diff -Nru plotly-3.5.0+dfsg1/debian/changelog plotly-3.6.1+dfsg1/debian/changelog --- plotly-3.5.0+dfsg1/debian/changelog 2019-01-07 00:08:37.000000000 +0000 +++ plotly-3.6.1+dfsg1/debian/changelog 2019-02-21 12:50:34.000000000 +0000 @@ -1,3 +1,10 @@ +plotly (3.6.1+dfsg1-1) unstable; urgency=medium + + * New upstream release (3.6.1): + - Update debian/offline/plotly.js to use version 1.44.4. + + -- Josue Ortega Thu, 21 Feb 2019 06:50:34 -0600 + plotly (3.5.0+dfsg1-1) unstable; urgency=medium * New upstream release (3.5.0): diff -Nru plotly-3.5.0+dfsg1/debian/offline/plotly.js plotly-3.6.1+dfsg1/debian/offline/plotly.js --- plotly-3.5.0+dfsg1/debian/offline/plotly.js 2019-01-07 00:08:37.000000000 +0000 +++ plotly-3.6.1+dfsg1/debian/offline/plotly.js 2019-02-21 12:50:34.000000000 +0000 @@ -1,6 +1,6 @@ /** -* plotly.js v1.42.5 -* Copyright 2012-2018, Plotly, Inc. +* plotly.js (basic) v1.44.4 +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ @@ -39,8 +39,9 @@ "X .cursor-ne-resize": "cursor:ne-resize;", "X .cursor-grab": "cursor:-webkit-grab;cursor:grab;", "X .modebar": "position:absolute;top:2px;right:2px;z-index:1001;", - "X .modebar--hover": "opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;", - "X:hover .modebar--hover": "opacity:1;", + "X .ease-bg": "-webkit-transition:background-color 0.3s ease 0s;-moz-transition:background-color 0.3s ease 0s;-ms-transition:background-color 0.3s ease 0s;-o-transition:background-color 0.3s ease 0s;transition:background-color 0.3s ease 0s;", + "X .modebar--hover>:not(.watermark)": "opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;", + "X:hover .modebar--hover .modebar-group": "opacity:1;", "X .modebar-group": "float:left;display:inline-block;box-sizing:border-box;margin-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;", @@ -71,7 +72,7 @@ Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":696}],2:[function(_dereq_,module,exports){ +},{"../src/lib":159}],2:[function(_dereq_,module,exports){ 'use strict'; module.exports = { @@ -203,20 +204,7 @@ },{}],3:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/transforms/aggregate'); - -},{"../src/transforms/aggregate":1155}],4:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -227,9 +215,9 @@ module.exports = _dereq_('../src/traces/bar'); -},{"../src/traces/bar":843}],5:[function(_dereq_,module,exports){ +},{"../src/traces/bar":260}],4:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -238,11 +226,11 @@ 'use strict'; -module.exports = _dereq_('../src/traces/barpolar'); +module.exports = _dereq_('../src/core'); -},{"../src/traces/barpolar":855}],6:[function(_dereq_,module,exports){ +},{"../src/core":142}],5:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -251,24 +239,18 @@ 'use strict'; -module.exports = _dereq_('../src/traces/box'); - -},{"../src/traces/box":865}],7:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +var Plotly = _dereq_('./core'); -'use strict'; +Plotly.register([ + _dereq_('./bar'), + _dereq_('./pie') +]); -module.exports = _dereq_('../src/components/calendars'); +module.exports = Plotly; -},{"../src/components/calendars":568}],8:[function(_dereq_,module,exports){ +},{"./bar":3,"./core":4,"./pie":6}],6:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -277,107753 +259,15085 @@ 'use strict'; -module.exports = _dereq_('../src/traces/candlestick'); +module.exports = _dereq_('../src/traces/pie'); -},{"../src/traces/candlestick":874}],9:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +},{"../src/traces/pie":274}],7:[function(_dereq_,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -'use strict'; +var objectCreate = Object.create || objectCreatePolyfill +var objectKeys = Object.keys || objectKeysPolyfill +var bind = Function.prototype.bind || functionBindPolyfill -module.exports = _dereq_('../src/traces/carpet'); +function EventEmitter() { + if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { + this._events = objectCreate(null); + this._eventsCount = 0; + } -},{"../src/traces/carpet":893}],10:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; -'use strict'; +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; -module.exports = _dereq_('../src/traces/choropleth'); +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; -},{"../src/traces/choropleth":907}],11:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; -'use strict'; +var hasDefineProperty; +try { + var o = {}; + if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); + hasDefineProperty = o.x === 0; +} catch (err) { hasDefineProperty = false } +if (hasDefineProperty) { + Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + // check whether the input is a positive number (whose value is zero or + // greater and not a NaN). + if (typeof arg !== 'number' || arg < 0 || arg !== arg) + throw new TypeError('"defaultMaxListeners" must be a positive number'); + defaultMaxListeners = arg; + } + }); +} else { + EventEmitter.defaultMaxListeners = defaultMaxListeners; +} -module.exports = _dereq_('../src/traces/cone'); +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || isNaN(n)) + throw new TypeError('"n" argument must be a positive number'); + this._maxListeners = n; + return this; +}; -},{"../src/traces/cone":915}],12:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function $getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} -'use strict'; +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return $getMaxListeners(this); +}; -module.exports = _dereq_('../src/traces/contour'); +// These standalone emit* functions are used to optimize calling of event +// handlers for fast cases because emit() itself often has a variable number of +// arguments and can be deoptimized because of that. These functions always have +// the same number of arguments and thus do not get deoptimized, so the code +// inside them can execute faster. +function emitNone(handler, isFn, self) { + if (isFn) + handler.call(self); + else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + listeners[i].call(self); + } +} +function emitOne(handler, isFn, self, arg1) { + if (isFn) + handler.call(self, arg1); + else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + listeners[i].call(self, arg1); + } +} +function emitTwo(handler, isFn, self, arg1, arg2) { + if (isFn) + handler.call(self, arg1, arg2); + else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + listeners[i].call(self, arg1, arg2); + } +} +function emitThree(handler, isFn, self, arg1, arg2, arg3) { + if (isFn) + handler.call(self, arg1, arg2, arg3); + else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + listeners[i].call(self, arg1, arg2, arg3); + } +} -},{"../src/traces/contour":930}],13:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function emitMany(handler, isFn, self, args) { + if (isFn) + handler.apply(self, args); + else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + listeners[i].apply(self, args); + } +} -'use strict'; +EventEmitter.prototype.emit = function emit(type) { + var er, handler, len, args, i, events; + var doError = (type === 'error'); -module.exports = _dereq_('../src/traces/contourcarpet'); + events = this._events; + if (events) + doError = (doError && events.error == null); + else if (!doError) + return false; -},{"../src/traces/contourcarpet":941}],14:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // If there is no 'error' event listener then throw. + if (doError) { + if (arguments.length > 1) + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Unhandled "error" event. (' + er + ')'); + err.context = er; + throw err; + } + return false; + } -'use strict'; + handler = events[type]; -module.exports = _dereq_('../src/core'); + if (!handler) + return false; -},{"../src/core":675}],15:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var isFn = typeof handler === 'function'; + len = arguments.length; + switch (len) { + // fast cases + case 1: + emitNone(handler, isFn, this); + break; + case 2: + emitOne(handler, isFn, this, arguments[1]); + break; + case 3: + emitTwo(handler, isFn, this, arguments[1], arguments[2]); + break; + case 4: + emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); + break; + // slower + default: + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + emitMany(handler, isFn, this, args); + } -'use strict'; + return true; +}; -module.exports = _dereq_('../src/transforms/filter'); +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; -},{"../src/transforms/filter":1156}],16:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if (typeof listener !== 'function') + throw new TypeError('"listener" argument must be a function'); -'use strict'; + events = target._events; + if (!events) { + events = target._events = objectCreate(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); -module.exports = _dereq_('../src/transforms/groupby'); + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } -},{"../src/transforms/groupby":1157}],17:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if (!existing) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + } else { + // If we've already got an array, just append. + if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + } -'use strict'; + // Check for listener leak + if (!existing.warned) { + m = $getMaxListeners(target); + if (m && m > 0 && existing.length > m) { + 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; + if (typeof console === 'object' && console.warn) { + console.warn('%s: %s', w.name, w.message); + } + } + } + } -module.exports = _dereq_('../src/traces/heatmap'); + return target; +} -},{"../src/traces/heatmap":953}],18:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; -'use strict'; +EventEmitter.prototype.on = EventEmitter.prototype.addListener; -module.exports = _dereq_('../src/traces/heatmapgl'); +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; -},{"../src/traces/heatmapgl":963}],19:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + switch (arguments.length) { + case 0: + return this.listener.call(this.target); + case 1: + return this.listener.call(this.target, arguments[0]); + case 2: + return this.listener.call(this.target, arguments[0], arguments[1]); + case 3: + return this.listener.call(this.target, arguments[0], arguments[1], + arguments[2]); + default: + var args = new Array(arguments.length); + for (var i = 0; i < args.length; ++i) + args[i] = arguments[i]; + this.listener.apply(this.target, args); + } + } +} -'use strict'; +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = bind.call(onceWrapper, state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} -module.exports = _dereq_('../src/traces/histogram'); +EventEmitter.prototype.once = function once(type, listener) { + if (typeof listener !== 'function') + throw new TypeError('"listener" argument must be a function'); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; -},{"../src/traces/histogram":974}],20:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + if (typeof listener !== 'function') + throw new TypeError('"listener" argument must be a function'); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; -'use strict'; +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; -module.exports = _dereq_('../src/traces/histogram2d'); + if (typeof listener !== 'function') + throw new TypeError('"listener" argument must be a function'); -},{"../src/traces/histogram2d":981}],21:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + events = this._events; + if (!events) + return this; -'use strict'; + list = events[type]; + if (!list) + return this; -module.exports = _dereq_('../src/traces/histogram2dcontour'); + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = objectCreate(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; -},{"../src/traces/histogram2dcontour":985}],22:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } -'use strict'; + if (position < 0) + return this; -var Plotly = _dereq_('./core'); + if (position === 0) + list.shift(); + else + spliceOne(list, position); -// traces -Plotly.register([ - _dereq_('./bar'), - _dereq_('./box'), - _dereq_('./heatmap'), - _dereq_('./histogram'), - _dereq_('./histogram2d'), - _dereq_('./histogram2dcontour'), - _dereq_('./pie'), - _dereq_('./contour'), - _dereq_('./scatterternary'), - _dereq_('./violin'), - - _dereq_('./scatter3d'), - _dereq_('./surface'), - _dereq_('./mesh3d'), - _dereq_('./cone'), - _dereq_('./streamtube'), - - _dereq_('./scattergeo'), - _dereq_('./choropleth'), - - _dereq_('./scattergl'), - _dereq_('./splom'), - - _dereq_('./pointcloud'), - _dereq_('./heatmapgl'), - _dereq_('./parcoords'), - _dereq_('./parcats'), - _dereq_('./scattermapbox'), - - _dereq_('./sankey'), - - _dereq_('./table'), - - _dereq_('./carpet'), - _dereq_('./scattercarpet'), - _dereq_('./contourcarpet'), - - _dereq_('./ohlc'), - _dereq_('./candlestick'), - - _dereq_('./scatterpolar'), - _dereq_('./scatterpolargl'), - _dereq_('./barpolar') -]); + if (list.length === 1) + events[type] = list[0]; -// transforms -// -// Please note that all *transform* methods are executed before -// all *calcTransform* methods - which could possibly lead to -// unexpected results when applying multiple transforms of different types -// to a given trace. -// -// For more info, see: -// https://github.com/plotly/plotly.js/pull/978#pullrequestreview-2403353 -// -Plotly.register([ - _dereq_('./aggregate'), - _dereq_('./filter'), - _dereq_('./groupby'), - _dereq_('./sort') -]); + if (events.removeListener) + this.emit('removeListener', type, originalListener || listener); + } -// components -Plotly.register([ - _dereq_('./calendars') -]); + return this; + }; -module.exports = Plotly; +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; -},{"./aggregate":3,"./bar":4,"./barpolar":5,"./box":6,"./calendars":7,"./candlestick":8,"./carpet":9,"./choropleth":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./filter":15,"./groupby":16,"./heatmap":17,"./heatmapgl":18,"./histogram":19,"./histogram2d":20,"./histogram2dcontour":21,"./mesh3d":23,"./ohlc":24,"./parcats":25,"./parcoords":26,"./pie":27,"./pointcloud":28,"./sankey":29,"./scatter3d":30,"./scattercarpet":31,"./scattergeo":32,"./scattergl":33,"./scattermapbox":34,"./scatterpolar":35,"./scatterpolargl":36,"./scatterternary":37,"./sort":38,"./splom":39,"./streamtube":40,"./surface":41,"./table":42,"./violin":43}],23:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + events = this._events; + if (!events) + return this; -'use strict'; + // not listening for removeListener, no need to emit + if (!events.removeListener) { + if (arguments.length === 0) { + this._events = objectCreate(null); + this._eventsCount = 0; + } else if (events[type]) { + if (--this._eventsCount === 0) + this._events = objectCreate(null); + else + delete events[type]; + } + return this; + } -module.exports = _dereq_('../src/traces/mesh3d'); + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = objectKeys(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 = objectCreate(null); + this._eventsCount = 0; + return this; + } -},{"../src/traces/mesh3d":990}],24:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/ohlc'); - -},{"../src/traces/ohlc":995}],25:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/parcats'); - -},{"../src/traces/parcats":1004}],26:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/parcoords'); - -},{"../src/traces/parcoords":1013}],27:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/pie'); - -},{"../src/traces/pie":1024}],28:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/pointcloud'); - -},{"../src/traces/pointcloud":1033}],29:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/sankey'); - -},{"../src/traces/sankey":1039}],30:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scatter3d'); - -},{"../src/traces/scatter3d":1075}],31:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scattercarpet'); - -},{"../src/traces/scattercarpet":1081}],32:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scattergeo'); - -},{"../src/traces/scattergeo":1088}],33:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scattergl'); - -},{"../src/traces/scattergl":1096}],34:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scattermapbox'); - -},{"../src/traces/scattermapbox":1102}],35:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scatterpolar'); - -},{"../src/traces/scatterpolar":1109}],36:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scatterpolargl'); - -},{"../src/traces/scatterpolargl":1113}],37:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/scatterternary'); - -},{"../src/traces/scatterternary":1119}],38:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/transforms/sort'); - -},{"../src/transforms/sort":1159}],39:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/splom'); - -},{"../src/traces/splom":1124}],40:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/streamtube'); - -},{"../src/traces/streamtube":1129}],41:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/surface'); - -},{"../src/traces/surface":1134}],42:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/table'); - -},{"../src/traces/table":1142}],43:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = _dereq_('../src/traces/violin'); - -},{"../src/traces/violin":1150}],44:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createCamera - -var now = _dereq_('right-now') -var createView = _dereq_('3d-view') -var mouseChange = _dereq_('mouse-change') -var mouseWheel = _dereq_('mouse-wheel') -var mouseOffset = _dereq_('mouse-event-offset') -var hasPassive = _dereq_('has-passive-events') - -function createCamera(element, options) { - element = element || document.body - options = options || {} - - var limits = [ 0.01, Infinity ] - if('distanceLimits' in options) { - limits[0] = options.distanceLimits[0] - limits[1] = options.distanceLimits[1] - } - if('zoomMin' in options) { - limits[0] = options.zoomMin - } - if('zoomMax' in options) { - limits[1] = options.zoomMax - } - - var view = createView({ - center: options.center || [0,0,0], - up: options.up || [0,1,0], - eye: options.eye || [0,0,10], - mode: options.mode || 'orbit', - distanceLimits: limits - }) - - var pmatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] - var distance = 0.0 - var width = element.clientWidth - var height = element.clientHeight - - var camera = { - view: view, - element: element, - delay: options.delay || 16, - rotateSpeed: options.rotateSpeed || 1, - zoomSpeed: options.zoomSpeed || 1, - translateSpeed: options.translateSpeed || 1, - flipX: !!options.flipX, - flipY: !!options.flipY, - modes: view.modes, - tick: function() { - var t = now() - var delay = this.delay - view.idle(t-delay) - view.flush(t-(100+delay*2)) - var ctime = t - 2 * delay - view.recalcMatrix(ctime) - var allEqual = true - var matrix = view.computedMatrix - for(var i=0; i<16; ++i) { - allEqual = allEqual && (pmatrix[i] === matrix[i]) - pmatrix[i] = matrix[i] - } - var sizeChanged = - element.clientWidth === width && - element.clientHeight === height - width = element.clientWidth - height = element.clientHeight - if(allEqual) { - return !sizeChanged - } - distance = Math.exp(view.computedRadius[0]) - return true - }, - lookAt: function(center, eye, up) { - view.lookAt(view.lastT(), center, eye, up) - }, - rotate: function(pitch, yaw, roll) { - view.rotate(view.lastT(), pitch, yaw, roll) - }, - pan: function(dx, dy, dz) { - view.pan(view.lastT(), dx, dy, dz) - }, - translate: function(dx, dy, dz) { - view.translate(view.lastT(), dx, dy, dz) - } - } - - Object.defineProperties(camera, { - matrix: { - get: function() { - return view.computedMatrix - }, - set: function(mat) { - view.setMatrix(view.lastT(), mat) - return view.computedMatrix - }, - enumerable: true - }, - mode: { - get: function() { - return view.getMode() - }, - set: function(mode) { - view.setMode(mode) - return view.getMode() - }, - enumerable: true - }, - center: { - get: function() { - return view.computedCenter - }, - set: function(ncenter) { - view.lookAt(view.lastT(), ncenter) - return view.computedCenter - }, - enumerable: true - }, - eye: { - get: function() { - return view.computedEye - }, - set: function(neye) { - view.lookAt(view.lastT(), null, neye) - return view.computedEye - }, - enumerable: true - }, - up: { - get: function() { - return view.computedUp - }, - set: function(nup) { - view.lookAt(view.lastT(), null, null, nup) - return view.computedUp - }, - enumerable: true - }, - distance: { - get: function() { - return distance - }, - set: function(d) { - view.setDistance(view.lastT(), d) - return d - }, - enumerable: true - }, - distanceLimits: { - get: function() { - return view.getDistanceLimits(limits) - }, - set: function(v) { - view.setDistanceLimits(v) - return v - }, - enumerable: true - } - }) - - element.addEventListener('contextmenu', function(ev) { - ev.preventDefault() - return false - }) - - var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false} - mouseChange(element, handleInteraction) - - //enable simple touch interactions - element.addEventListener('touchstart', function (ev) { - var xy = mouseOffset(ev.changedTouches[0], element) - handleInteraction(0, xy[0], xy[1], lastMods) - handleInteraction(1, xy[0], xy[1], lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) - - element.addEventListener('touchmove', function (ev) { - var xy = mouseOffset(ev.changedTouches[0], element) - handleInteraction(1, xy[0], xy[1], lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) - - element.addEventListener('touchend', function (ev) { - var xy = mouseOffset(ev.changedTouches[0], element) - handleInteraction(0, lastX, lastY, lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) - - function handleInteraction (buttons, x, y, mods) { - var scale = 1.0 / element.clientHeight - var dx = scale * (x - lastX) - var dy = scale * (y - lastY) - - var flipX = camera.flipX ? 1 : -1 - var flipY = camera.flipY ? 1 : -1 - - var drot = Math.PI * camera.rotateSpeed - - var t = now() - - if(buttons & 1) { - if(mods.shift) { - view.rotate(t, 0, 0, -dx * drot) - } else { - view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0) - } - } else if(buttons & 2) { - view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0) - } else if(buttons & 4) { - var kzoom = camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 50.0 - view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1)) - } - - lastX = x - lastY = y - lastMods = mods - } - - mouseWheel(element, function(dx, dy, dz) { - var flipX = camera.flipX ? 1 : -1 - var flipY = camera.flipY ? 1 : -1 - var t = now() - if(Math.abs(dx) > Math.abs(dy)) { - view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth) - } else { - var kzoom = camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 100.0 - view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1)) - } - }, true) - - return camera -} - -},{"3d-view":45,"has-passive-events":394,"mouse-change":418,"mouse-event-offset":419,"mouse-wheel":421,"right-now":480}],45:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createViewController - -var createTurntable = _dereq_('turntable-camera-controller') -var createOrbit = _dereq_('orbit-camera-controller') -var createMatrix = _dereq_('matrix-camera-controller') - -function ViewController(controllers, mode) { - this._controllerNames = Object.keys(controllers) - this._controllerList = this._controllerNames.map(function(n) { - return controllers[n] - }) - this._mode = mode - this._active = controllers[mode] - if(!this._active) { - this._mode = 'turntable' - this._active = controllers.turntable - } - this.modes = this._controllerNames - this.computedMatrix = this._active.computedMatrix - this.computedEye = this._active.computedEye - this.computedUp = this._active.computedUp - this.computedCenter = this._active.computedCenter - this.computedRadius = this._active.computedRadius -} - -var proto = ViewController.prototype - -var COMMON_METHODS = [ - ['flush', 1], - ['idle', 1], - ['lookAt', 4], - ['rotate', 4], - ['pan', 4], - ['translate', 4], - ['setMatrix', 2], - ['setDistanceLimits', 2], - ['setDistance', 2] -] - -COMMON_METHODS.forEach(function(method) { - var name = method[0] - var argNames = [] - for(var i=0; i= 0; i--) { + this.removeListener(type, listeners[i]); + } } - }); - } - - function scaleNodeBreadths(kx) { - nodes.forEach(function(node) { - node.x *= kx; - }); - } - - function computeNodeDepths(iterations) { - var nodesByBreadth = d3Collection.nest() - .key(function(d) { return d.x; }) - .sortKeys(d3Array.ascending) - .entries(nodes) - .map(function(d) { return d.values; }); - - // - initializeNodeDepth(); - resolveCollisions(); - for (var alpha = 1; iterations > 0; --iterations) { - relaxRightToLeft(alpha *= .99); - resolveCollisions(); - relaxLeftToRight(alpha); - resolveCollisions(); - } - function initializeNodeDepth() { - var L = d3Array.max(nodesByBreadth, function(nodes) { - return nodes.length; - }); - var maxNodePadding = maxPaddedSpace * size[1] / (L - 1); - if(nodePadding > maxNodePadding) nodePadding = maxNodePadding; - var ky = d3Array.min(nodesByBreadth, function(nodes) { - return (size[1] - (nodes.length - 1) * nodePadding) / d3Array.sum(nodes, value); - }); + return this; + }; - nodesByBreadth.forEach(function(nodes) { - nodes.forEach(function(node, i) { - node.y = i; - node.dy = node.value * ky; - }); - }); +function _listeners(target, type, unwrap) { + var events = target._events; - links.forEach(function(link) { - link.dy = link.value * ky; - }); - } + if (!events) + return []; - function relaxLeftToRight(alpha) { - nodesByBreadth.forEach(function(nodes) { - nodes.forEach(function(node) { - if (node.targetLinks.length) { - var y = d3Array.sum(node.targetLinks, weightedSource) / d3Array.sum(node.targetLinks, value); - node.y += (y - center(node)) * alpha; - } - }); - }); + var evlistener = events[type]; + if (!evlistener) + return []; - function weightedSource(link) { - return center(link.source) * link.value; - } - } + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - function relaxRightToLeft(alpha) { - nodesByBreadth.slice().reverse().forEach(function(nodes) { - nodes.forEach(function(node) { - if (node.sourceLinks.length) { - var y = d3Array.sum(node.sourceLinks, weightedTarget) / d3Array.sum(node.sourceLinks, value); - node.y += (y - center(node)) * alpha; - } - }); - }); + return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} - function weightedTarget(link) { - return center(link.target) * link.value; - } - } +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; - function resolveCollisions() { - nodesByBreadth.forEach(function(nodes) { - var node, - dy, - y0 = 0, - n = nodes.length, - i; - - // Push any overlapping nodes down. - nodes.sort(ascendingDepth); - for (i = 0; i < n; ++i) { - node = nodes[i]; - dy = y0 - node.y; - if (dy > 0) node.y += dy; - y0 = node.y + node.dy + nodePadding; - } - - // If the bottommost node goes outside the bounds, push it back up. - dy = y0 - nodePadding - size[1]; - if (dy > 0) { - y0 = node.y -= dy; - - // Push any overlapping nodes back up. - for (i = n - 2; i >= 0; --i) { - node = nodes[i]; - dy = node.y + node.dy + nodePadding - y0; - if (dy > 0) node.y -= dy; - y0 = node.y; - } - } - }); - } +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; - function ascendingDepth(a, b) { - return a.y - b.y; - } +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); } +}; - function computeLinkDepths() { - nodes.forEach(function(node) { - node.sourceLinks.sort(ascendingTargetDepth); - node.targetLinks.sort(ascendingSourceDepth); - }); - nodes.forEach(function(node) { - var sy = 0, ty = 0; - node.sourceLinks.forEach(function(link) { - link.sy = sy; - sy += link.dy; - }); - node.targetLinks.forEach(function(link) { - link.ty = ty; - ty += link.dy; - }); - }); +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; - function ascendingSourceDepth(a, b) { - return (a.source.y - b.source.y) || (a.originalIndex - b.originalIndex); - } + if (events) { + var evlistener = events[type]; - function ascendingTargetDepth(a, b) { - return (a.target.y - b.target.y) || (a.originalIndex - b.originalIndex); + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener) { + return evlistener.length; } } - function center(node) { - return node.y + node.dy / 2; - } - - function value(link) { - return link.value; - } - - return sankey; -}; - -exports.sankey = sankey; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{"d3-array":140,"d3-collection":141,"d3-interpolate":145}],47:[function(_dereq_,module,exports){ -'use strict' - -var weakMap = typeof WeakMap === 'undefined' ? _dereq_('weak-map') : WeakMap -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') - -var TriangleCache = new weakMap() - -function createABigTriangle(gl) { - - var triangleVAO = TriangleCache.get(gl) - var handle = triangleVAO && (triangleVAO._triangleBuffer.handle || triangleVAO._triangleBuffer.buffer) - if(!handle || !gl.isBuffer(handle)) { - var buf = createBuffer(gl, new Float32Array([-1, -1, -1, 4, 4, -1])) - triangleVAO = createVAO(gl, [ - { buffer: buf, - type: gl.FLOAT, - size: 2 - } - ]) - triangleVAO._triangleBuffer = buf - TriangleCache.set(gl, triangleVAO) - } - triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, 3) - triangleVAO.unbind() -} - -module.exports = createABigTriangle - -},{"gl-buffer":230,"gl-vao":310,"weak-map":529}],48:[function(_dereq_,module,exports){ - -module.exports = absolutize - -/** - * redefine `path` with absolute coordinates - * - * @param {Array} path - * @return {Array} - */ - -function absolutize(path){ - var startX = 0 - var startY = 0 - var x = 0 - var y = 0 - - return path.map(function(seg){ - seg = seg.slice() - var type = seg[0] - var command = type.toUpperCase() - - // is relative - if (type != command) { - seg[0] = command - switch (type) { - case 'a': - seg[6] += x - seg[7] += y - break - case 'v': - seg[1] += y - break - case 'h': - seg[1] += x - break - default: - for (var i = 1; i < seg.length;) { - seg[i++] += x - seg[i++] += y - } - } - } - - // update cursor state - switch (command) { - case 'Z': - x = startX - y = startY - break - case 'H': - x = seg[1] - break - case 'V': - y = seg[1] - break - case 'M': - x = startX = seg[1] - y = startY = seg[2] - break - default: - x = seg[seg.length - 2] - y = seg[seg.length - 1] - } - - return seg - }) + return 0; } -},{}],49:[function(_dereq_,module,exports){ -var padLeft = _dereq_('pad-left') - -module.exports = addLineNumbers -function addLineNumbers (string, start, delim) { - start = typeof start === 'number' ? start : 1 - delim = delim || ': ' +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; +}; - var lines = string.split(/\r?\n/) - var totalDigits = String(lines.length + start - 1).length - return lines.map(function (line, i) { - var c = i + start - var digits = String(c).length - var prefix = padLeft(c, totalDigits - digits) - return prefix + delim + line - }).join('\n') +// About 1.5x faster than the two-arg version of Array#splice(). +function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) + list[i] = list[k]; + list.pop(); } -},{"pad-left":440}],50:[function(_dereq_,module,exports){ -'use strict' - -module.exports = affineHull - -var orient = _dereq_('robust-orientation') - -function linearlyIndependent(points, d) { - var nhull = new Array(d+1) - for(var i=0; i max) max = arr[i]; - if (arr[i] < min) min = arr[i]; - } - - bounds[offset] = min - bounds[dim + offset] = max - } - - return bounds; -} - -},{}],54:[function(_dereq_,module,exports){ -'use strict' - -var getBounds = _dereq_('array-bounds') - -module.exports = normalize; - -function normalize (arr, dim, bounds) { - if (!arr || arr.length == null) throw Error('Argument should be an array') - - if (dim == null) dim = 1 - if (bounds == null) bounds = getBounds(arr, dim) - - for (var offset = 0; offset < dim; offset++) { - var max = bounds[dim + offset], min = bounds[offset], i = offset, l = arr.length; - - if (max === Infinity && min === -Infinity) { - for (i = offset; i < l; i+=dim) { - arr[i] = arr[i] === max ? 1 : arr[i] === min ? 0 : .5 - } - } - else if (max === Infinity) { - for (i = offset; i < l; i+=dim) { - arr[i] = arr[i] === max ? 1 : 0 - } - } - else if (min === -Infinity) { - for (i = offset; i < l; i+=dim) { - arr[i] = arr[i] === min ? 0 : 1 - } - } - else { - var range = max - min - for (i = offset; i < l; i+=dim) { - arr[i] = range === 0 ? .5 : (arr[i] - min) / range - } - } - } - - return arr; -} - -},{"array-bounds":53}],55:[function(_dereq_,module,exports){ -module.exports = function newArray(start, end) { - var n0 = typeof start === 'number', - n1 = typeof end === 'number' - - if (n0 && !n1) { - end = start - start = 0 - } else if (!n0 && !n1) { - start = 0 - end = 0 - } - - start = start|0 - end = end|0 - var len = end-start - if (len<0) - throw new Error('array length must be positive') - - var a = new Array(len) - for (var i=0, c=start; i - * @license MIT - */ -function compare(a, b) { - if (a === b) { - return 0; - } - - var x = a.length; - var y = b.length; - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - - if (x < y) { - return -1; - } - if (y < x) { - return 1; +function objectKeysPolyfill(obj) { + var keys = []; + for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { + keys.push(k); } - return 0; + return k; } -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); +function functionBindPolyfill(context) { + var fn = this; + return function () { + return fn.apply(context, arguments); + }; } -// based on node assert, original notice: - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -var util = _dereq_('util/'); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; +},{}],8:[function(_dereq_,module,exports){ +!function() { + var d3 = { + version: "3.5.17" + }; + var d3_arraySlice = [].slice, d3_array = function(list) { + return d3_arraySlice.call(list); + }; + var d3_document = this.document; + function d3_documentElement(node) { + return node && (node.ownerDocument || node.document || node).documentElement; } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; + function d3_window(node) { + return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView); } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; + 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; + }; } } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; + if (!Date.now) Date.now = function() { + return +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); + }; + } } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + d3.ascending = d3_ascending; + function d3_ascending(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } -}; - -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; + 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; } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } -} - - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; -} - -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"util/":59}],57:[function(_dereq_,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true + 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; } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],58:[function(_dereq_,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],59:[function(_dereq_,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; + 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 { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = b; + break; } - warned = true; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; + 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 { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); + 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 ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); + return [ a, c ]; + }; + function d3_number(x) { + return x === null ? NaN : +x; } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); + function d3_numeric(x) { + return !isNaN(x); } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); + 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; } - if (isError(value)) { - return formatError(value); + 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; } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + 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 { - return ctx.stylize('[Object]', 'special'); + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a); } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); + if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), .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 { - output.push(''); + 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, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; + } + return lo; + } + }; } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); + 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, i0, i1) { + if ((m = arguments.length) < 3) { + i1 = array.length; + if (m < 2) i0 = 0; } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); + var m = i1 - i0, t, i; + while (m) { + i = Math.random() * m-- | 0; + t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t; } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); + return array; + }; + d3.permute = function(array, indexes) { + var i = indexes.length, permutes = new Array(i); + while (i--) permutes[i] = array[indexes[i]]; + return permutes; + }; + d3.pairs = function(array) { + var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); + while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; + return pairs; + }; + d3.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; } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); + d3.zip = function() { + return d3.transpose(arguments); + }; + d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + }; + d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + }; + d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({ + key: key, + value: map[key] + }); + return entries; + }; + d3.merge = function(arrays) { + var n = arrays.length, m, i = -1, j = 0, merged, array; + while (++i < n) j += arrays[i].length; + merged = new Array(j); + while (--n >= 0) { + array = arrays[n]; + m = array.length; + while (--m >= 0) { + merged[--j] = array[m]; } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } + } + 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; } - } else { - str = ctx.stylize('[Circular]', 'special'); } + 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; } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; + function d3_class(ctor, properties) { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); + } + d3.map = function(object, f) { + var map = new d3_Map(); + if (object instanceof d3_Map) { + object.forEach(function(key, value) { + map.set(key, value); + }); + } else if (Array.isArray(object)) { + var i = -1, n = object.length, o; + if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o); } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); + for (var key in object) map.set(key, object[key]); } + return map; + }; + function d3_Map() { + this._ = Object.create(null); } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; + var d3_map_proto = "__proto__", d3_map_zero = "\x00"; + 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; } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = _dereq_('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = _dereq_('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":58,"_process":465,"inherits":57}],60:[function(_dereq_,module,exports){ -module.exports = function _atob(str) { - return atob(str) -} - -},{}],61:[function(_dereq_,module,exports){ -'use strict' - -module.exports = barycentric - -var solve = _dereq_('robust-linear-solve') - -function reduce(x) { - var r = 0 - for(var i=0; i 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - for (var i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF + function d3_map_unescape(key) { + return (key += "")[0] === d3_map_zero ? key.slice(1) : key; } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF + function d3_map_has(key) { + return d3_map_escape(key) in this._; } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF + function d3_map_remove(key) { + return (key = d3_map_escape(key)) in this._ && delete this._[key]; } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) + function d3_map_keys() { + var keys = []; + for (var key in this._) keys.push(d3_map_unescape(key)); + return keys; } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) + function d3_map_size() { + var size = 0; + for (var key in this._) ++size; + return size; } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) + function d3_map_empty() { + for (var key in this._) return false; + return true; } - - return parts.join('') -} - -},{}],63:[function(_dereq_,module,exports){ -'use strict' - -var rationalize = _dereq_('./lib/rationalize') - -module.exports = add - -function add(a, b) { - return rationalize( - a[0].mul(b[1]).add(b[0].mul(a[1])), - a[1].mul(b[1])) -} - -},{"./lib/rationalize":73}],64:[function(_dereq_,module,exports){ -'use strict' - -module.exports = cmp - -function cmp(a, b) { - return a[0].mul(b[1]).cmp(b[0].mul(a[1])) -} - -},{}],65:[function(_dereq_,module,exports){ -'use strict' - -var rationalize = _dereq_('./lib/rationalize') - -module.exports = div - -function div(a, b) { - return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) -} - -},{"./lib/rationalize":73}],66:[function(_dereq_,module,exports){ -'use strict' - -var isRat = _dereq_('./is-rat') -var isBN = _dereq_('./lib/is-bn') -var num2bn = _dereq_('./lib/num-to-bn') -var str2bn = _dereq_('./lib/str-to-bn') -var rationalize = _dereq_('./lib/rationalize') -var div = _dereq_('./div') - -module.exports = makeRational - -function makeRational(numer, denom) { - if(isRat(numer)) { - if(denom) { - return div(numer, makeRational(denom)) + d3.nest = function() { + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; + function map(mapType, array, depth) { + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; + var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [ object ]); + } + } + if (mapType) { + object = mapType(); + setter = function(keyValue, values) { + object.set(keyValue, map(mapType, values, depth)); + }; + } else { + object = {}; + setter = function(keyValue, values) { + object[keyValue] = map(mapType, values, depth); + }; + } + valuesByKey.forEach(setter); + return object; } - return [numer[0].clone(), numer[1].clone()] - } - var shift = 0 - var a, b - if(isBN(numer)) { - a = numer.clone() - } else if(typeof numer === 'string') { - a = str2bn(numer) - } else if(numer === 0) { - return [num2bn(0), num2bn(1)] - } else if(numer === Math.floor(numer)) { - a = num2bn(numer) - } else { - while(numer !== Math.floor(numer)) { - numer = numer * Math.pow(2, 256) - shift -= 256 - } - a = num2bn(numer) - } - if(isRat(denom)) { - a.mul(denom[1]) - b = denom[0].clone() - } else if(isBN(denom)) { - b = denom.clone() - } else if(typeof denom === 'string') { - b = str2bn(denom) - } else if(!denom) { - b = num2bn(1) - } else if(denom === Math.floor(denom)) { - b = num2bn(denom) - } else { - while(denom !== Math.floor(denom)) { - denom = denom * Math.pow(2, 256) - shift += 256 + function entries(map, depth) { + if (depth >= keys.length) return map; + var array = [], sortKey = sortKeys[depth++]; + map.forEach(function(key, keyMap) { + array.push({ + key: key, + values: entries(keyMap, depth) + }); + }); + return sortKey ? array.sort(function(a, b) { + return sortKey(a.key, b.key); + }) : array; } - b = num2bn(denom) - } - if(shift > 0) { - a = a.ushln(shift) - } else if(shift < 0) { - b = b.ushln(-shift) + nest.map = function(array, mapType) { + return map(mapType, array, 0); + }; + nest.entries = function(array) { + return entries(map(d3.map, array, 0), 0); + }; + nest.key = function(d) { + keys.push(d); + return nest; + }; + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + nest.rollup = function(f) { + rollup = f; + return nest; + }; + return nest; + }; + d3.set = function(array) { + var set = new d3_Set(); + if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]); + return set; + }; + function d3_Set() { + this._ = Object.create(null); } - return rationalize(a, b) -} - -},{"./div":65,"./is-rat":67,"./lib/is-bn":71,"./lib/num-to-bn":72,"./lib/rationalize":73,"./lib/str-to-bn":74}],67:[function(_dereq_,module,exports){ -'use strict' - -var isBN = _dereq_('./lib/is-bn') - -module.exports = isRat - -function isRat(x) { - return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) -} - -},{"./lib/is-bn":71}],68:[function(_dereq_,module,exports){ -'use strict' - -var BN = _dereq_('bn.js') - -module.exports = sign - -function sign (x) { - return x.cmp(new BN(0)) -} - -},{"bn.js":82}],69:[function(_dereq_,module,exports){ -'use strict' - -var sign = _dereq_('./bn-sign') - -module.exports = bn2num - -//TODO: Make this better -function bn2num(b) { - var l = b.length - var words = b.words - var out = 0 - if (l === 1) { - out = words[0] - } else if (l === 2) { - out = words[0] + (words[1] * 0x4000000) - } else { - for (var i = 0; i < l; i++) { - var w = words[i] - out += w * Math.pow(0x4000000, i) + 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; } - return sign(b) * out -} - -},{"./bn-sign":68}],70:[function(_dereq_,module,exports){ -'use strict' - -var db = _dereq_('double-bits') -var ctz = _dereq_('bit-twiddle').countTrailingZeros - -module.exports = ctzNumber - -//Counts the number of trailing zeros -function ctzNumber(x) { - var l = ctz(db.lo(x)) - if(l < 32) { - return l - } - var h = ctz(db.hi(x)) - if(h > 20) { - return 52 + 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; + }; } - return h + 32 -} - -},{"bit-twiddle":80,"double-bits":152}],71:[function(_dereq_,module,exports){ -'use strict' - -var BN = _dereq_('bn.js') - -module.exports = isBN - -//Test if x is a bignumber -//FIXME: obviously this is the wrong way to do it -function isBN(x) { - return x && typeof x === 'object' && Boolean(x.words) -} - -},{"bn.js":82}],72:[function(_dereq_,module,exports){ -'use strict' - -var BN = _dereq_('bn.js') -var db = _dereq_('double-bits') - -module.exports = num2bn - -function num2bn(x) { - var e = db.exponent(x) - if(e < 52) { - return new BN(x) - } else { - return (new BN(x * Math.pow(2, 52-e))).ushln(e-52) + 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; + } } -} - -},{"bn.js":82,"double-bits":152}],73:[function(_dereq_,module,exports){ -'use strict' - -var num2bn = _dereq_('./num-to-bn') -var sign = _dereq_('./bn-sign') - -module.exports = rationalize - -function rationalize(numer, denom) { - var snumer = sign(numer) - var sdenom = sign(denom) - if(snumer === 0) { - return [num2bn(0), num2bn(1)] + 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; } - if(sdenom === 0) { - return [num2bn(0), num2bn(0)] + d3.event = null; + function d3_eventPreventDefault() { + d3.event.preventDefault(); } - if(sdenom < 0) { - numer = numer.neg() - denom = denom.neg() + function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; } - var d = numer.gcd(denom) - if(d.cmpn(1)) { - return [ numer.div(d), denom.div(d) ] + function d3_eventDispatch(target) { + var dispatch = new d3_dispatch(), i = 0, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + return dispatch; } - return [ numer, denom ] -} - -},{"./bn-sign":68,"./num-to-bn":72}],74:[function(_dereq_,module,exports){ -'use strict' - -var BN = _dereq_('bn.js') - -module.exports = str2BN - -function str2BN(x) { - return new BN(x) -} - -},{"bn.js":82}],75:[function(_dereq_,module,exports){ -'use strict' - -var rationalize = _dereq_('./lib/rationalize') - -module.exports = mul - -function mul(a, b) { - return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) -} - -},{"./lib/rationalize":73}],76:[function(_dereq_,module,exports){ -'use strict' - -var bnsign = _dereq_('./lib/bn-sign') - -module.exports = sign - -function sign(x) { - return bnsign(x[0]) * bnsign(x[1]) -} - -},{"./lib/bn-sign":68}],77:[function(_dereq_,module,exports){ -'use strict' - -var rationalize = _dereq_('./lib/rationalize') - -module.exports = sub - -function sub(a, b) { - return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) -} - -},{"./lib/rationalize":73}],78:[function(_dereq_,module,exports){ -'use strict' - -var bn2num = _dereq_('./lib/bn-to-num') -var ctz = _dereq_('./lib/ctz') - -module.exports = roundRat - -// Round a rational to the closest float -function roundRat (f) { - var a = f[0] - var b = f[1] - if (a.cmpn(0) === 0) { - return 0 + 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 h = a.abs().divmod(b.abs()) - var iv = h.div - var x = bn2num(iv) - var ir = h.mod - var sgn = (a.negative !== b.negative) ? -1 : 1 - if (ir.cmpn(0) === 0) { - return sgn * x + 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(n, s) { + return d3_selectMatcher.call(n, s); + }; + 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; } - if (x) { - var s = ctz(x) + 4 - var y = bn2num(ir.ushln(s).divRound(b)) - return sgn * (x + y * Math.pow(2, -s)) - } else { - var ybits = b.bitLength() - ir.bitLength() + 53 - var y = bn2num(ir.ushln(ybits).divRound(b)) - if (ybits < 1023) { - return sgn * y * Math.pow(2, -ybits) - } - y *= Math.pow(2, -1023) - return sgn * y * Math.pow(2, 1023 - ybits) + 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); + }; } -} - -},{"./lib/bn-to-num":69,"./lib/ctz":70}],79:[function(_dereq_,module,exports){ -"use strict" - -function compileSearch(funcName, predicate, reversed, extraArgs, useNdarray, earlyOut) { - var code = [ - "function ", funcName, "(a,l,h,", extraArgs.join(","), "){", -earlyOut ? "" : "var i=", (reversed ? "l-1" : "h+1"), -";while(l<=h){\ -var m=(l+h)>>>1,x=a", useNdarray ? ".get(m)" : "[m]"] - if(earlyOut) { - if(predicate.indexOf("c") < 0) { - code.push(";if(x===y){return m}else if(x<=y){") - } else { - code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){") + 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; + } + } } - } else { - code.push(";if(", predicate, "){i=m;") + return d3_selection(subgroups); + }; + function d3_selection_selectorAll(selector) { + return typeof selector === "function" ? selector : function() { + return d3_selectAll(selector, this); + }; } - if(reversed) { - code.push("l=m+1}else{h=m-1}") - } else { - code.push("h=m-1}else{l=m+1}") + 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; } - code.push("}") - if(earlyOut) { - code.push("return -1};") - } else { - code.push("return i};") + function d3_collapse(s) { + return s.trim().replace(/\s+/g, " "); } - return code.join("") -} - -function compileBoundsSearch(predicate, reversed, suffix, earlyOut) { - var result = new Function([ - compileSearch("A", "x" + predicate + "y", reversed, ["y"], false, earlyOut), - compileSearch("B", "x" + predicate + "y", reversed, ["y"], true, earlyOut), - compileSearch("P", "c(x,y)" + predicate + "0", reversed, ["y", "c"], false, earlyOut), - compileSearch("Q", "c(x,y)" + predicate + "0", reversed, ["y", "c"], true, earlyOut), -"function dispatchBsearch", suffix, "(a,y,c,l,h){\ -if(a.shape){\ -if(typeof(c)==='function'){\ -return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)\ -}else{\ -return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)\ -}}else{\ -if(typeof(c)==='function'){\ -return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)\ -}else{\ -return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)\ -}}}\ -return dispatchBsearch", suffix].join("")) - return result() -} - -module.exports = { - ge: compileBoundsSearch(">=", false, "GE"), - gt: compileBoundsSearch(">", false, "GT"), - lt: compileBoundsSearch("<", true, "LT"), - le: compileBoundsSearch("<=", true, "LE"), - eq: compileBoundsSearch("-", true, "EQ", true) -} - -},{}],80:[function(_dereq_,module,exports){ -/** - * Bit twiddling hacks for JavaScript. - * - * Author: Mikola Lysenko - * - * Ported from Stanford bit twiddling hack library: - * http://graphics.stanford.edu/~seander/bithacks.html - */ - -"use strict"; "use restrict"; - -//Number of bits in an integer -var INT_BITS = 32; - -//Constants -exports.INT_BITS = INT_BITS; -exports.INT_MAX = 0x7fffffff; -exports.INT_MIN = -1<<(INT_BITS-1); - -//Returns -1, 0, +1 depending on sign of x -exports.sign = function(v) { - return (v > 0) - (v < 0); -} - -//Computes absolute value of integer -exports.abs = function(v) { - var mask = v >> (INT_BITS-1); - return (v ^ mask) - mask; -} - -//Computes minimum of integers x and y -exports.min = function(x, y) { - return y ^ ((x ^ y) & -(x < y)); -} - -//Computes maximum of integers x and y -exports.max = function(x, y) { - return x ^ ((x ^ y) & -(x < y)); -} - -//Checks if a number is a power of two -exports.isPow2 = function(v) { - return !(v & (v-1)) && (!!v); -} - -//Computes log base 2 of v -exports.log2 = function(v) { - var r, shift; - r = (v > 0xFFFF) << 4; v >>>= r; - shift = (v > 0xFF ) << 3; v >>>= shift; r |= shift; - shift = (v > 0xF ) << 2; v >>>= shift; r |= shift; - shift = (v > 0x3 ) << 1; v >>>= shift; r |= shift; - return r | (v >> 1); -} - -//Computes log base 10 of v -exports.log10 = function(v) { - return (v >= 1000000000) ? 9 : (v >= 100000000) ? 8 : (v >= 10000000) ? 7 : - (v >= 1000000) ? 6 : (v >= 100000) ? 5 : (v >= 10000) ? 4 : - (v >= 1000) ? 3 : (v >= 100) ? 2 : (v >= 10) ? 1 : 0; -} - -//Counts number of bits -exports.popCount = function(v) { - v = v - ((v >>> 1) & 0x55555555); - v = (v & 0x33333333) + ((v >>> 2) & 0x33333333); - return ((v + (v >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24; -} - -//Counts number of trailing zeros -function countTrailingZeros(v) { - var c = 32; - v &= -v; - if (v) c--; - if (v & 0x0000FFFF) c -= 16; - if (v & 0x00FF00FF) c -= 8; - if (v & 0x0F0F0F0F) c -= 4; - if (v & 0x33333333) c -= 2; - if (v & 0x55555555) c -= 1; - return c; -} -exports.countTrailingZeros = countTrailingZeros; - -//Rounds to next power of 2 -exports.nextPow2 = function(v) { - v += v === 0; - --v; - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - return v + 1; -} - -//Rounds down to previous power of 2 -exports.prevPow2 = function(v) { - v |= v >>> 1; - v |= v >>> 2; - v |= v >>> 4; - v |= v >>> 8; - v |= v >>> 16; - return v - (v>>>1); -} - -//Computes parity of word -exports.parity = function(v) { - v ^= v >>> 16; - v ^= v >>> 8; - v ^= v >>> 4; - v &= 0xf; - return (0x6996 >>> v) & 1; -} - -var REVERSE_TABLE = new Array(256); - -(function(tab) { - for(var i=0; i<256; ++i) { - var v = i, r = i, s = 7; - for (v >>>= 1; v; v >>>= 1) { - r <<= 1; - r |= v & 1; - --s; + 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; } - tab[i] = (r << s) & 0xff; - } -})(REVERSE_TABLE); - -//Reverse bits in a 32 bit word -exports.reverse = function(v) { - return (REVERSE_TABLE[ v & 0xff] << 24) | - (REVERSE_TABLE[(v >>> 8) & 0xff] << 16) | - (REVERSE_TABLE[(v >>> 16) & 0xff] << 8) | - REVERSE_TABLE[(v >>> 24) & 0xff]; -} - -//Interleave bits of 2 coordinates with 16 bits. Useful for fast quadtree codes -exports.interleave2 = function(x, y) { - x &= 0xFFFF; - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; - - y &= 0xFFFF; - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; - - return x | (y << 1); -} - -//Extracts the nth interleaved component -exports.deinterleave2 = function(v, n) { - v = (v >>> n) & 0x55555555; - v = (v | (v >>> 1)) & 0x33333333; - v = (v | (v >>> 2)) & 0x0F0F0F0F; - v = (v | (v >>> 4)) & 0x00FF00FF; - v = (v | (v >>> 16)) & 0x000FFFF; - return (v << 16) >> 16; -} - - -//Interleave bits of 3 coordinates, each with 10 bits. Useful for fast octree codes -exports.interleave3 = function(x, y, z) { - x &= 0x3FF; - x = (x | (x<<16)) & 4278190335; - x = (x | (x<<8)) & 251719695; - x = (x | (x<<4)) & 3272356035; - x = (x | (x<<2)) & 1227133513; - - y &= 0x3FF; - y = (y | (y<<16)) & 4278190335; - y = (y | (y<<8)) & 251719695; - y = (y | (y<<4)) & 3272356035; - y = (y | (y<<2)) & 1227133513; - x |= (y << 1); - - z &= 0x3FF; - z = (z | (z<<16)) & 4278190335; - z = (z | (z<<8)) & 251719695; - z = (z | (z<<4)) & 3272356035; - z = (z | (z<<2)) & 1227133513; - - return x | (z << 2); -} - -//Extracts nth interleaved component of a 3-tuple -exports.deinterleave3 = function(v, n) { - v = (v >>> n) & 1227133513; - v = (v | (v>>>2)) & 3272356035; - v = (v | (v>>>4)) & 251719695; - v = (v | (v>>>8)) & 4278190335; - v = (v | (v>>>16)) & 0x3FF; - return (v<<22)>>22; -} - -//Computes next combination in colexicographic order (this is mistakenly called nextPermutation on the bit twiddling hacks page) -exports.nextCombination = function(v) { - var t = v | (v - 1); - return (t + 1) | (((~t & -~t) - 1) >>> (countTrailingZeros(v) + 1)); -} - - -},{}],81:[function(_dereq_,module,exports){ -'use strict' - -var clamp = _dereq_('clamp') - -module.exports = calcSDF - -var INF = 1e20; - -function calcSDF(src, options) { - if (!options) options = {} - - var cutoff = options.cutoff == null ? 0.25 : options.cutoff - var radius = options.radius == null ? 8 : options.radius - var channel = options.channel || 0 - var w, h, size, data, intData, stride, ctx, canvas, imgData, i, l - - // handle image container - if (ArrayBuffer.isView(src) || Array.isArray(src)) { - if (!options.width || !options.height) throw Error('For raw data width and height should be provided by options') - w = options.width, h = options.height - data = src - - if (!options.stride) stride = Math.floor(src.length / w / h) - else stride = options.stride - } - else { - if (window.HTMLCanvasElement && src instanceof window.HTMLCanvasElement) { - canvas = src - ctx = canvas.getContext('2d') - w = canvas.width, h = canvas.height - imgData = ctx.getImageData(0, 0, w, h) - data = imgData.data - stride = 4 - } - else if (window.CanvasRenderingContext2D && src instanceof window.CanvasRenderingContext2D) { - canvas = src.canvas - ctx = src - w = canvas.width, h = canvas.height - imgData = ctx.getImageData(0, 0, w, h) - data = imgData.data - stride = 4 - } - else if (window.ImageData && src instanceof window.ImageData) { - imgData = src - w = src.width, h = src.height - data = imgData.data - stride = 4 - } - } - - size = Math.max(w, h) - - //convert int data to floats - if ((window.Uint8ClampedArray && data instanceof window.Uint8ClampedArray) || (window.Uint8Array && data instanceof window.Uint8Array)) { - intData = data - data = Array(w*h) - - for (i = 0, l = intData.length; i < l; i++) { - data[i] = intData[i*stride + channel] / 255 - } - } - else { - if (stride !== 1) throw Error('Raw data can have only 1 value per pixel') - } - - // temporary arrays for the distance transform - var gridOuter = Array(w * h) - var gridInner = Array(w * h) - var f = Array(size) - var d = Array(size) - var z = Array(size + 1) - var v = Array(size) - - for (i = 0, l = w * h; i < l; i++) { - var a = data[i] - gridOuter[i] = a === 1 ? 0 : a === 0 ? INF : Math.pow(Math.max(0, 0.5 - a), 2) - gridInner[i] = a === 1 ? INF : a === 0 ? 0 : Math.pow(Math.max(0, a - 0.5), 2) - } - - edt(gridOuter, w, h, f, d, v, z) - edt(gridInner, w, h, f, d, v, z) - - var dist = window.Float32Array ? new Float32Array(w * h) : new Array(w * h) - - for (i = 0, l = w*h; i < l; i++) { - dist[i] = clamp(1 - ( (gridOuter[i] - gridInner[i]) / radius + cutoff), 0, 1) - } - - return dist -} - -// 2D Euclidean distance transform by Felzenszwalb & Huttenlocher https://cs.brown.edu/~pff/dt/ -function edt(data, width, height, f, d, v, z) { - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - f[y] = data[y * width + x] - } - edt1d(f, d, v, z, height) - for (y = 0; y < height; y++) { - data[y * width + x] = d[y] - } - } - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - f[x] = data[y * width + x] - } - edt1d(f, d, v, z, width) - for (x = 0; x < width; x++) { - data[y * width + x] = Math.sqrt(d[x]) - } - } -} - -// 1D squared distance transform -function edt1d(f, d, v, z, n) { - v[0] = 0; - z[0] = -INF - z[1] = +INF - - for (var q = 1, k = 0; q < n; q++) { - var s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]) - while (s <= z[k]) { - k-- - s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]) - } - k++ - v[k] = q - z[k] = s - z[k + 1] = +INF - } - - for (q = 0, k = 0; q < n; q++) { - while (z[k + 1] < q) k++ - d[q] = (q - v[k]) * (q - v[k]) + f[v[k]] - } -} - -},{"clamp":103}],82:[function(_dereq_,module,exports){ -(function (module, exports) { - 'use strict'; - - // Utils - function assert (val, msg) { - if (!val) throw new Error(msg || 'Assertion failed'); + return this.each(d3_selection_classed(name, value)); + }; + function d3_selection_classedRe(name) { + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); } - - // Could use `inherits` module, but don't want to move from single file - // architecture yet. - function inherits (ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; + function d3_selection_classes(name) { + return (name + "").trim().split(/^|\s+/); } - - // BN - - function BN (number, base, endian) { - if (BN.isBN(number)) { - return number; + 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); } - - this.negative = 0; - this.words = null; - this.length = 0; - - // Reduction context - this.red = null; - - if (number !== null) { - if (base === 'le' || base === 'be') { - endian = base; - base = 10; - } - - this._init(number || 0, base || 10, endian || 'be'); + function classedFunction() { + var i = -1, x = value.apply(this, arguments); + while (++i < n) name[i](this, x); } + return typeof value === "function" ? classedFunction : classedConstant; } - if (typeof module === 'object') { - module.exports = BN; - } else { - exports.BN = BN; - } - - BN.BN = BN; - BN.wordSize = 26; - - var Buffer; - try { - Buffer = _dereq_('buffer').Buffer; - } catch (e) { + function d3_selection_classedName(name) { + var re = d3_selection_classedRe(name); + return function(node, value) { + if (c = node.classList) return value ? c.add(name) : c.remove(name); + var c = node.getAttribute("class") || ""; + if (value) { + re.lastIndex = 0; + if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); + } else { + node.setAttribute("class", d3_collapse(c.replace(re, " "))); + } + }; } - - BN.isBN = function isBN (num) { - if (num instanceof BN) { - return true; + 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 num !== null && typeof num === 'object' && - num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); - }; - - BN.max = function max (left, right) { - if (left.cmp(right) > 0) return left; - return right; - }; - - BN.min = function min (left, right) { - if (left.cmp(right) < 0) return left; - return right; + return this.each(d3_selection_style(name, value, priority)); }; - - BN.prototype._init = function init (number, base, endian) { - if (typeof number === 'number') { - return this._initNumber(number, base, endian); - } - - if (typeof number === 'object') { - return this._initArray(number, base, endian); - } - - if (base === 'hex') { - base = 16; - } - assert(base === (base | 0) && base >= 2 && base <= 36); - - number = number.toString().replace(/\s+/g, ''); - var start = 0; - if (number[0] === '-') { - start++; - } - - if (base === 16) { - this._parseHex(number, start); - } else { - this._parseBase(number, base, start); + function d3_selection_style(name, value, priority) { + function styleNull() { + this.style.removeProperty(name); } - - if (number[0] === '-') { - this.negative = 1; + function styleConstant() { + this.style.setProperty(name, value, priority); } - - this.strip(); - - if (endian !== 'le') return; - - this._initArray(this.toArray(), base, endian); - }; - - BN.prototype._initNumber = function _initNumber (number, base, endian) { - if (number < 0) { - this.negative = 1; - number = -number; + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); } - if (number < 0x4000000) { - this.words = [ number & 0x3ffffff ]; - this.length = 1; - } else if (number < 0x10000000000000) { - this.words = [ - number & 0x3ffffff, - (number / 0x4000000) & 0x3ffffff - ]; - this.length = 2; - } else { - assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) - this.words = [ - number & 0x3ffffff, - (number / 0x4000000) & 0x3ffffff, - 1 - ]; - this.length = 3; - } - - if (endian !== 'le') return; - - // Reverse the bytes - this._initArray(this.toArray(), base, endian); - }; - - BN.prototype._initArray = function _initArray (number, base, endian) { - // Perhaps a Uint8Array - assert(typeof number.length === 'number'); - if (number.length <= 0) { - this.words = [ 0 ]; - this.length = 1; + 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; } - - this.length = Math.ceil(number.length / 3); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; - } - - var j, w; - var off = 0; - if (endian === 'be') { - for (i = number.length - 1, j = 0; i >= 0; i -= 3) { - w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } else if (endian === 'le') { - for (i = 0, j = 0; i < number.length; i += 3) { - w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } - return this.strip(); + return this.each(d3_selection_property(name, value)); }; - - function parseHex (str, start, end) { - var r = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; - - r <<= 4; - - // 'a' - 'f' - if (c >= 49 && c <= 54) { - r |= c - 49 + 0xa; - - // 'A' - 'F' - } else if (c >= 17 && c <= 22) { - r |= c - 17 + 0xa; - - // '0' - '9' - } else { - r |= c & 0xf; - } - } - return r; - } - - BN.prototype._parseHex = function _parseHex (number, start) { - // Create possibly bigger array to ensure that it fits the number - this.length = Math.ceil((number.length - start) / 6); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; - } - - var j, w; - // Scan 24-bit chunks and add them to the number - var off = 0; - for (i = number.length - 6, j = 0; i >= start; i -= 6) { - w = parseHex(number, i, i + 6); - this.words[j] |= (w << off) & 0x3ffffff; - // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb - this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } + function d3_selection_property(name, value) { + function propertyNull() { + delete this[name]; } - if (i + 6 !== start) { - w = parseHex(number, start, i + 6); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + function propertyConstant() { + this[name] = value; } - this.strip(); - }; - - function parseBase (str, start, end, mul) { - var r = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; - - r *= mul; - - // 'a' - if (c >= 49) { - r += c - 49 + 0xa; - - // 'A' - } else if (c >= 17) { - r += c - 17 + 0xa; - - // '0' - '9' - } else { - r += c; - } + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; else this[name] = x; } - return r; + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; } - - BN.prototype._parseBase = function _parseBase (number, base, start) { - // Initialize as zero - this.words = [ 0 ]; - this.length = 1; - - // Find length of limb in base - for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { - limbLen++; - } - limbLen--; - limbPow = (limbPow / base) | 0; - - var total = number.length - start; - var mod = total % limbLen; - var end = Math.min(total, total - mod) + start; - - var word = 0; - for (var i = start; i < end; i += limbLen) { - word = parseBase(number, i, i + limbLen, base); - - this.imuln(limbPow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } - } - - if (mod !== 0) { - var pow = 1; - word = parseBase(number, i, number.length, base); - - for (i = 0; i < mod; i++) { - pow *= base; - } - - this.imuln(pow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } - } + 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; }; - - BN.prototype.copy = function copy (dest) { - dest.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - dest.words[i] = this.words[i]; - } - dest.length = this.length; - dest.negative = this.negative; - dest.red = this.red; + 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; }; - - BN.prototype.clone = function clone () { - var r = new BN(null); - this.copy(r); - return r; + d3_selectionPrototype.append = function(name) { + name = d3_selection_creator(name); + return this.select(function() { + return this.appendChild(name.apply(this, arguments)); + }); }; - - BN.prototype._expand = function _expand (size) { - while (this.length < size) { - this.words[this.length++] = 0; + function d3_selection_creator(name) { + function create() { + var document = this.ownerDocument, namespace = this.namespaceURI; + return namespace === d3_nsXhtml && document.documentElement.namespaceURI === d3_nsXhtml ? document.createElement(name) : document.createElementNS(namespace, name); } - return this; - }; - - // Remove leading `0` from `this` - BN.prototype.strip = function strip () { - while (this.length > 1 && this.words[this.length - 1] === 0) { - this.length--; - } - return this._normSign(); - }; - - BN.prototype._normSign = function _normSign () { - // -0 = 0 - if (this.length === 1 && this.words[0] === 0) { - this.negative = 0; + function createNS() { + return this.ownerDocument.createElementNS(name.space, name.local); } - return this; + 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); + }); }; - - BN.prototype.inspect = function inspect () { - return (this.red ? ''; + d3_selectionPrototype.remove = function() { + return this.each(d3_selectionRemove); }; - - /* - - var zeros = []; - var groupSizes = []; - var groupBases = []; - - var s = ''; - var i = -1; - while (++i < BN.wordSize) { - zeros[i] = s; - s += '0'; - } - groupSizes[0] = 0; - groupSizes[1] = 0; - groupBases[0] = 0; - groupBases[1] = 0; - var base = 2 - 1; - while (++base < 36 + 1) { - var groupSize = 0; - var groupBase = 1; - while (groupBase < (1 << BN.wordSize) / base) { - groupBase *= base; - groupSize += 1; - } - groupSizes[base] = groupSize; - groupBases[base] = groupBase; + function d3_selectionRemove() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); } - - */ - - var zeros = [ - '', - '0', - '00', - '000', - '0000', - '00000', - '000000', - '0000000', - '00000000', - '000000000', - '0000000000', - '00000000000', - '000000000000', - '0000000000000', - '00000000000000', - '000000000000000', - '0000000000000000', - '00000000000000000', - '000000000000000000', - '0000000000000000000', - '00000000000000000000', - '000000000000000000000', - '0000000000000000000000', - '00000000000000000000000', - '000000000000000000000000', - '0000000000000000000000000' - ]; - - var groupSizes = [ - 0, 0, - 25, 16, 12, 11, 10, 9, 8, - 8, 7, 7, 7, 7, 6, 6, - 6, 6, 6, 6, 6, 5, 5, - 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5 - ]; - - var groupBases = [ - 0, 0, - 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, - 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, - 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, - 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, - 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 - ]; - - BN.prototype.toString = function toString (base, padding) { - base = base || 10; - padding = padding | 0 || 1; - - var out; - if (base === 16 || base === 'hex') { - out = ''; - var off = 0; - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = this.words[i]; - var word = (((w << off) | carry) & 0xffffff).toString(16); - carry = (w >>> (24 - off)) & 0xffffff; - if (carry !== 0 || i !== this.length - 1) { - out = zeros[6 - word.length] + word + out; - } else { - out = word + out; - } - off += 2; - if (off >= 26) { - off -= 26; - i--; + 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__; } } - if (carry !== 0) { - out = carry.toString(16) + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; + return value; } - - if (base === (base | 0) && base >= 2 && base <= 36) { - // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); - var groupSize = groupSizes[base]; - // var groupBase = Math.pow(base, groupSize); - var groupBase = groupBases[base]; - out = ''; - var c = this.clone(); - c.negative = 0; - while (!c.isZero()) { - var r = c.modn(groupBase).toString(base); - c = c.idivn(groupBase); - - if (!c.isZero()) { - out = zeros[groupSize - r.length] + r + out; - } else { - out = r + out; + function bind(group, groupData) { + var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; + if (key) { + var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue; + for (i = -1; ++i < n; ) { + if (node = group[i]) { + if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) { + exitNodes[i] = node; + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues[i] = keyValue; + } + } + for (i = -1; ++i < m; ) { + if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) { + enterNodes[i] = d3_selection_dataNode(nodeData); + } else if (node !== true) { + updateNodes[i] = node; + node.__data__ = nodeData; + } + nodeByKeyValue.set(keyValue, true); + } + for (i = -1; ++i < n; ) { + if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0; ) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + } + } + for (;i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + } + for (;i < n; ++i) { + exitNodes[i] = group[i]; } } - if (this.isZero()) { - out = '0' + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } - - assert(false, 'Base should be between 2 and 36'); - }; - - BN.prototype.toNumber = function toNumber () { - var ret = this.words[0]; - if (this.length === 2) { - ret += this.words[1] * 0x4000000; - } else if (this.length === 3 && this.words[2] === 0x01) { - // NOTE: at this stage it is known that the top bit is set - ret += 0x10000000000000 + (this.words[1] * 0x4000000); - } else if (this.length > 2) { - assert(false, 'Number can only safely store up to 53 bits'); + enterNodes.update = updateNodes; + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); } - return (this.negative !== 0) ? -ret : ret; - }; - - BN.prototype.toJSON = function toJSON () { - return this.toString(16); - }; - - BN.prototype.toBuffer = function toBuffer (endian, length) { - assert(typeof Buffer !== 'undefined'); - return this.toArrayLike(Buffer, endian, length); - }; - - BN.prototype.toArray = function toArray (endian, length) { - return this.toArrayLike(Array, endian, length); - }; - - BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { - var byteLength = this.byteLength(); - var reqLength = length || Math.max(1, byteLength); - assert(byteLength <= reqLength, 'byte array longer than desired length'); - assert(reqLength > 0, 'Requested array length <= 0'); - - this.strip(); - var littleEndian = endian === 'le'; - var res = new ArrayType(reqLength); - - var b, i; - var q = this.clone(); - if (!littleEndian) { - // Assume big-endian - for (i = 0; i < reqLength - byteLength; i++) { - res[i] = 0; - } - - for (i = 0; !q.isZero(); i++) { - b = q.andln(0xff); - q.iushrn(8); - - res[reqLength - i - 1] = b; + 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 { - for (i = 0; !q.isZero(); i++) { - b = q.andln(0xff); - q.iushrn(8); - - res[i] = b; - } - - for (; i < reqLength; i++) { - res[i] = 0; + while (++i < n) { + bind(group = this[i], value); } } - - return res; - }; - - if (Math.clz32) { - BN.prototype._countBits = function _countBits (w) { - return 32 - Math.clz32(w); + update.enter = function() { + return enter; }; - } else { - BN.prototype._countBits = function _countBits (w) { - var t = w; - var r = 0; - if (t >= 0x1000) { - r += 13; - t >>>= 13; - } - if (t >= 0x40) { - r += 7; - t >>>= 7; - } - if (t >= 0x8) { - r += 4; - t >>>= 4; - } - if (t >= 0x02) { - r += 2; - t >>>= 2; - } - return r + t; + update.exit = function() { + return exit; }; - } - - BN.prototype._zeroBits = function _zeroBits (w) { - // Short-cut - if (w === 0) return 26; - - var t = w; - var r = 0; - if ((t & 0x1fff) === 0) { - r += 13; - t >>>= 13; - } - if ((t & 0x7f) === 0) { - r += 7; - t >>>= 7; - } - if ((t & 0xf) === 0) { - r += 4; - t >>>= 4; - } - if ((t & 0x3) === 0) { - r += 2; - t >>>= 2; - } - if ((t & 0x1) === 0) { - r++; - } - return r; - }; - - // Return number of used bits in a BN - BN.prototype.bitLength = function bitLength () { - var w = this.words[this.length - 1]; - var hi = this._countBits(w); - return (this.length - 1) * 26 + hi; + return update; }; - - function toBitArray (num) { - var w = new Array(num.bitLength()); - - for (var bit = 0; bit < w.length; bit++) { - var off = (bit / 26) | 0; - var wbit = bit % 26; - - w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; - } - - return w; + function d3_selection_dataNode(data) { + return { + __data__: data + }; } - - // Number of trailing zero bits - BN.prototype.zeroBits = function zeroBits () { - if (this.isZero()) return 0; - - var r = 0; - for (var i = 0; i < this.length; i++) { - var b = this._zeroBits(this.words[i]); - r += b; - if (b !== 26) break; - } - return r; - }; - - BN.prototype.byteLength = function byteLength () { - return Math.ceil(this.bitLength() / 8); + d3_selectionPrototype.datum = function(value) { + return arguments.length ? this.property("__data__", value) : this.property("__data__"); }; - - BN.prototype.toTwos = function toTwos (width) { - if (this.negative !== 0) { - return this.abs().inotn(width).iaddn(1); + 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 this.clone(); + return d3_selection(subgroups); }; - - BN.prototype.fromTwos = function fromTwos (width) { - if (this.testn(width - 1)) { - return this.notn(width).iaddn(1).ineg(); + 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.clone(); + return this; }; - - BN.prototype.isNeg = function isNeg () { - return this.negative !== 0; + 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(); }; - - // Return negative clone of `this` - BN.prototype.neg = function neg () { - return this.clone().ineg(); + 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); + }); }; - - BN.prototype.ineg = function ineg () { - if (!this.isZero()) { - this.negative ^= 1; + 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; }; - - // Or `num` with `this` in-place - BN.prototype.iuor = function iuor (num) { - while (this.length < num.length) { - this.words[this.length++] = 0; - } - - for (var i = 0; i < num.length; i++) { - this.words[i] = this.words[i] | num.words[i]; - } - - return this.strip(); - }; - - BN.prototype.ior = function ior (num) { - assert((this.negative | num.negative) === 0); - return this.iuor(num); - }; - - // Or `num` with `this` - BN.prototype.or = function or (num) { - if (this.length > num.length) return this.clone().ior(num); - return num.clone().ior(this); - }; - - BN.prototype.uor = function uor (num) { - if (this.length > num.length) return this.clone().iuor(num); - return num.clone().iuor(this); - }; - - // And `num` with `this` in-place - BN.prototype.iuand = function iuand (num) { - // b = min-length(num, this) - var b; - if (this.length > num.length) { - b = num; - } else { - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = this.words[i] & num.words[i]; - } - - this.length = b.length; - - return this.strip(); - }; - - BN.prototype.iand = function iand (num) { - assert((this.negative | num.negative) === 0); - return this.iuand(num); - }; - - // And `num` with `this` - BN.prototype.and = function and (num) { - if (this.length > num.length) return this.clone().iand(num); - return num.clone().iand(this); - }; - - BN.prototype.uand = function uand (num) { - if (this.length > num.length) return this.clone().iuand(num); - return num.clone().iuand(this); + d3_selectionPrototype.empty = function() { + return !this.node(); }; - - // Xor `num` with `this` in-place - BN.prototype.iuxor = function iuxor (num) { - // a.length > b.length - var a; - var b; - if (this.length > num.length) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = a.words[i] ^ b.words[i]; - } - - if (this !== a) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; + 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; } } - - this.length = a.length; - - return this.strip(); - }; - - BN.prototype.ixor = function ixor (num) { - assert((this.negative | num.negative) === 0); - return this.iuxor(num); - }; - - // Xor `num` with `this` - BN.prototype.xor = function xor (num) { - if (this.length > num.length) return this.clone().ixor(num); - return num.clone().ixor(this); + return null; }; - - BN.prototype.uxor = function uxor (num) { - if (this.length > num.length) return this.clone().iuxor(num); - return num.clone().iuxor(this); + d3_selectionPrototype.size = function() { + var n = 0; + d3_selection_each(this, function() { + ++n; + }); + return n; }; - - // Not ``this`` with ``width`` bitwidth - BN.prototype.inotn = function inotn (width) { - assert(typeof width === 'number' && width >= 0); - - var bytesNeeded = Math.ceil(width / 26) | 0; - var bitsLeft = width % 26; - - // Extend the buffer with leading zeroes - this._expand(bytesNeeded); - - if (bitsLeft > 0) { - bytesNeeded--; - } - - // Handle complete words - for (var i = 0; i < bytesNeeded; i++) { - this.words[i] = ~this.words[i] & 0x3ffffff; - } - - // Handle the residue - if (bitsLeft > 0) { - this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + 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); + } + } } - - // And remove leading zeroes - return this.strip(); + return d3_selection(subgroups); }; - - BN.prototype.notn = function notn (width) { - return this.clone().inotn(width); + d3_selection_enterPrototype.insert = function(name, before) { + if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); + return d3_selectionPrototype.insert.call(this, name, before); }; - - // Set `bit` of `this` - BN.prototype.setn = function setn (bit, val) { - assert(typeof bit === 'number' && bit >= 0); - - var off = (bit / 26) | 0; - var wbit = bit % 26; - - this._expand(off + 1); - - if (val) { - this.words[off] = this.words[off] | (1 << wbit); + function d3_selection_enterInsertBefore(enter) { + var i0, j0; + return function(d, i, j) { + var group = enter[j].update, n = group.length, node; + if (j != j0) j0 = j, i0 = 0; + if (i >= i0) i0 = i + 1; + while (!(node = group[i0]) && ++i0 < n) ; + return node; + }; + } + d3.select = function(node) { + var group; + if (typeof node === "string") { + group = [ d3_select(node, d3_document) ]; + group.parentNode = d3_document.documentElement; } else { - this.words[off] = this.words[off] & ~(1 << wbit); + group = [ node ]; + group.parentNode = d3_documentElement(node); } - - return this.strip(); + return d3_selection([ group ]); }; - - // Add `num` to `this` in-place - BN.prototype.iadd = function iadd (num) { - var r; - - // negative + positive - if (this.negative !== 0 && num.negative === 0) { - this.negative = 0; - r = this.isub(num); - this.negative ^= 1; - return this._normSign(); - - // positive + negative - } else if (this.negative === 0 && num.negative !== 0) { - num.negative = 0; - r = this.isub(num); - num.negative = 1; - return r._normSign(); - } - - // a.length > b.length - var a, b; - if (this.length > num.length) { - a = this; - b = num; + d3.selectAll = function(nodes) { + var group; + if (typeof nodes === "string") { + group = d3_array(d3_selectAll(nodes, d3_document)); + group.parentNode = d3_document.documentElement; } else { - a = num; - b = this; + group = d3_array(nodes); + group.parentNode = null; } - - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) + (b.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - - this.length = a.length; - if (carry !== 0) { - this.words[this.length] = carry; - this.length++; - // Copy the rest of the words - } else if (a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; + 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; + return this.each(d3_selection_on(type, listener, capture)); }; - - // Add `num` to `this` - BN.prototype.add = function add (num) { - var res; - if (num.negative !== 0 && this.negative === 0) { - num.negative = 0; - res = this.sub(num); - num.negative ^= 1; - return res; - } else if (num.negative === 0 && this.negative !== 0) { - this.negative = 0; - res = num.sub(this); - this.negative = 1; - return res; - } - - if (this.length > num.length) return this.clone().iadd(num); - - return num.clone().iadd(this); - }; - - // Subtract `num` from `this` in-place - BN.prototype.isub = function isub (num) { - // this - (-num) = this + num - if (num.negative !== 0) { - num.negative = 0; - var r = this.iadd(num); - num.negative = 1; - return r._normSign(); - - // -this - num = -(this + num) - } else if (this.negative !== 0) { - this.negative = 0; - this.iadd(num); - this.negative = 1; - return this._normSign(); - } - - // At this point both numbers are positive - var cmp = this.cmp(num); - - // Optimization - zeroify - if (cmp === 0) { - this.negative = 0; - this.length = 1; - this.words[0] = 0; - return this; - } - - // a > b - var a, b; - if (cmp > 0) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) - (b.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; - } - - // Copy rest of the words - if (carry === 0 && i < a.length && a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; + 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]; } } - - this.length = Math.max(this.length, i); - - if (a !== this) { - this.negative = 1; + function onAdd() { + var l = wrap(listener, d3_array(arguments)); + onRemove.call(this); + this.addEventListener(type, this[name] = l, l.$ = capture); + l._ = listener; } - - return this.strip(); - }; - - // Subtract `num` from `this` - BN.prototype.sub = function sub (num) { - return this.clone().isub(num); - }; - - function smallMulTo (self, num, out) { - out.negative = num.negative ^ self.negative; - var len = (self.length + num.length) | 0; - out.length = len; - len = (len - 1) | 0; - - // Peel one iteration (compiler can't do it, because of code complexity) - var a = self.words[0] | 0; - var b = num.words[0] | 0; - var r = a * b; - - var lo = r & 0x3ffffff; - var carry = (r / 0x4000000) | 0; - out.words[0] = lo; - - for (var k = 1; k < len; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = carry >>> 26; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = (k - j) | 0; - a = self.words[i] | 0; - b = num.words[j] | 0; - r = a * b + rword; - ncarry += (r / 0x4000000) | 0; - rword = r & 0x3ffffff; + function removeAll() { + var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; + for (var name in this) { + if (match = name.match(re)) { + var l = this[name]; + this.removeEventListener(match[1], l, l.$); + delete this[name]; + } } - out.words[k] = rword | 0; - carry = ncarry | 0; - } - if (carry !== 0) { - out.words[k] = carry | 0; - } else { - out.length--; } - - return out.strip(); + return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; } - - // TODO(indutny): it may be reasonable to omit it for users who don't need - // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit - // multiplication (like elliptic secp256k1). - var comb10MulTo = function comb10MulTo (self, num, out) { - var a = self.words; - var b = num.words; - var o = out.words; - var c = 0; - var lo; - var mid; - var hi; - var a0 = a[0] | 0; - var al0 = a0 & 0x1fff; - var ah0 = a0 >>> 13; - var a1 = a[1] | 0; - var al1 = a1 & 0x1fff; - var ah1 = a1 >>> 13; - var a2 = a[2] | 0; - var al2 = a2 & 0x1fff; - var ah2 = a2 >>> 13; - var a3 = a[3] | 0; - var al3 = a3 & 0x1fff; - var ah3 = a3 >>> 13; - var a4 = a[4] | 0; - var al4 = a4 & 0x1fff; - var ah4 = a4 >>> 13; - var a5 = a[5] | 0; - var al5 = a5 & 0x1fff; - var ah5 = a5 >>> 13; - var a6 = a[6] | 0; - var al6 = a6 & 0x1fff; - var ah6 = a6 >>> 13; - var a7 = a[7] | 0; - var al7 = a7 & 0x1fff; - var ah7 = a7 >>> 13; - var a8 = a[8] | 0; - var al8 = a8 & 0x1fff; - var ah8 = a8 >>> 13; - var a9 = a[9] | 0; - var al9 = a9 & 0x1fff; - var ah9 = a9 >>> 13; - var b0 = b[0] | 0; - var bl0 = b0 & 0x1fff; - var bh0 = b0 >>> 13; - var b1 = b[1] | 0; - var bl1 = b1 & 0x1fff; - var bh1 = b1 >>> 13; - var b2 = b[2] | 0; - var bl2 = b2 & 0x1fff; - var bh2 = b2 >>> 13; - var b3 = b[3] | 0; - var bl3 = b3 & 0x1fff; - var bh3 = b3 >>> 13; - var b4 = b[4] | 0; - var bl4 = b4 & 0x1fff; - var bh4 = b4 >>> 13; - var b5 = b[5] | 0; - var bl5 = b5 & 0x1fff; - var bh5 = b5 >>> 13; - var b6 = b[6] | 0; - var bl6 = b6 & 0x1fff; - var bh6 = b6 >>> 13; - var b7 = b[7] | 0; - var bl7 = b7 & 0x1fff; - var bh7 = b7 >>> 13; - var b8 = b[8] | 0; - var bl8 = b8 & 0x1fff; - var bh8 = b8 >>> 13; - var b9 = b[9] | 0; - var bl9 = b9 & 0x1fff; - var bh9 = b9 >>> 13; - - out.negative = self.negative ^ num.negative; - out.length = 19; - /* k = 0 */ - lo = Math.imul(al0, bl0); - mid = Math.imul(al0, bh0); - mid = (mid + Math.imul(ah0, bl0)) | 0; - hi = Math.imul(ah0, bh0); - var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; - w0 &= 0x3ffffff; - /* k = 1 */ - lo = Math.imul(al1, bl0); - mid = Math.imul(al1, bh0); - mid = (mid + Math.imul(ah1, bl0)) | 0; - hi = Math.imul(ah1, bh0); - lo = (lo + Math.imul(al0, bl1)) | 0; - mid = (mid + Math.imul(al0, bh1)) | 0; - mid = (mid + Math.imul(ah0, bl1)) | 0; - hi = (hi + Math.imul(ah0, bh1)) | 0; - var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; - w1 &= 0x3ffffff; - /* k = 2 */ - lo = Math.imul(al2, bl0); - mid = Math.imul(al2, bh0); - mid = (mid + Math.imul(ah2, bl0)) | 0; - hi = Math.imul(ah2, bh0); - lo = (lo + Math.imul(al1, bl1)) | 0; - mid = (mid + Math.imul(al1, bh1)) | 0; - mid = (mid + Math.imul(ah1, bl1)) | 0; - hi = (hi + Math.imul(ah1, bh1)) | 0; - lo = (lo + Math.imul(al0, bl2)) | 0; - mid = (mid + Math.imul(al0, bh2)) | 0; - mid = (mid + Math.imul(ah0, bl2)) | 0; - hi = (hi + Math.imul(ah0, bh2)) | 0; - var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; - w2 &= 0x3ffffff; - /* k = 3 */ - lo = Math.imul(al3, bl0); - mid = Math.imul(al3, bh0); - mid = (mid + Math.imul(ah3, bl0)) | 0; - hi = Math.imul(ah3, bh0); - lo = (lo + Math.imul(al2, bl1)) | 0; - mid = (mid + Math.imul(al2, bh1)) | 0; - mid = (mid + Math.imul(ah2, bl1)) | 0; - hi = (hi + Math.imul(ah2, bh1)) | 0; - lo = (lo + Math.imul(al1, bl2)) | 0; - mid = (mid + Math.imul(al1, bh2)) | 0; - mid = (mid + Math.imul(ah1, bl2)) | 0; - hi = (hi + Math.imul(ah1, bh2)) | 0; - lo = (lo + Math.imul(al0, bl3)) | 0; - mid = (mid + Math.imul(al0, bh3)) | 0; - mid = (mid + Math.imul(ah0, bl3)) | 0; - hi = (hi + Math.imul(ah0, bh3)) | 0; - var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; - w3 &= 0x3ffffff; - /* k = 4 */ - lo = Math.imul(al4, bl0); - mid = Math.imul(al4, bh0); - mid = (mid + Math.imul(ah4, bl0)) | 0; - hi = Math.imul(ah4, bh0); - lo = (lo + Math.imul(al3, bl1)) | 0; - mid = (mid + Math.imul(al3, bh1)) | 0; - mid = (mid + Math.imul(ah3, bl1)) | 0; - hi = (hi + Math.imul(ah3, bh1)) | 0; - lo = (lo + Math.imul(al2, bl2)) | 0; - mid = (mid + Math.imul(al2, bh2)) | 0; - mid = (mid + Math.imul(ah2, bl2)) | 0; - hi = (hi + Math.imul(ah2, bh2)) | 0; - lo = (lo + Math.imul(al1, bl3)) | 0; - mid = (mid + Math.imul(al1, bh3)) | 0; - mid = (mid + Math.imul(ah1, bl3)) | 0; - hi = (hi + Math.imul(ah1, bh3)) | 0; - lo = (lo + Math.imul(al0, bl4)) | 0; - mid = (mid + Math.imul(al0, bh4)) | 0; - mid = (mid + Math.imul(ah0, bl4)) | 0; - hi = (hi + Math.imul(ah0, bh4)) | 0; - var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; - w4 &= 0x3ffffff; - /* k = 5 */ - lo = Math.imul(al5, bl0); - mid = Math.imul(al5, bh0); - mid = (mid + Math.imul(ah5, bl0)) | 0; - hi = Math.imul(ah5, bh0); - lo = (lo + Math.imul(al4, bl1)) | 0; - mid = (mid + Math.imul(al4, bh1)) | 0; - mid = (mid + Math.imul(ah4, bl1)) | 0; - hi = (hi + Math.imul(ah4, bh1)) | 0; - lo = (lo + Math.imul(al3, bl2)) | 0; - mid = (mid + Math.imul(al3, bh2)) | 0; - mid = (mid + Math.imul(ah3, bl2)) | 0; - hi = (hi + Math.imul(ah3, bh2)) | 0; - lo = (lo + Math.imul(al2, bl3)) | 0; - mid = (mid + Math.imul(al2, bh3)) | 0; - mid = (mid + Math.imul(ah2, bl3)) | 0; - hi = (hi + Math.imul(ah2, bh3)) | 0; - lo = (lo + Math.imul(al1, bl4)) | 0; - mid = (mid + Math.imul(al1, bh4)) | 0; - mid = (mid + Math.imul(ah1, bl4)) | 0; - hi = (hi + Math.imul(ah1, bh4)) | 0; - lo = (lo + Math.imul(al0, bl5)) | 0; - mid = (mid + Math.imul(al0, bh5)) | 0; - mid = (mid + Math.imul(ah0, bl5)) | 0; - hi = (hi + Math.imul(ah0, bh5)) | 0; - var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; - w5 &= 0x3ffffff; - /* k = 6 */ - lo = Math.imul(al6, bl0); - mid = Math.imul(al6, bh0); - mid = (mid + Math.imul(ah6, bl0)) | 0; - hi = Math.imul(ah6, bh0); - lo = (lo + Math.imul(al5, bl1)) | 0; - mid = (mid + Math.imul(al5, bh1)) | 0; - mid = (mid + Math.imul(ah5, bl1)) | 0; - hi = (hi + Math.imul(ah5, bh1)) | 0; - lo = (lo + Math.imul(al4, bl2)) | 0; - mid = (mid + Math.imul(al4, bh2)) | 0; - mid = (mid + Math.imul(ah4, bl2)) | 0; - hi = (hi + Math.imul(ah4, bh2)) | 0; - lo = (lo + Math.imul(al3, bl3)) | 0; - mid = (mid + Math.imul(al3, bh3)) | 0; - mid = (mid + Math.imul(ah3, bl3)) | 0; - hi = (hi + Math.imul(ah3, bh3)) | 0; - lo = (lo + Math.imul(al2, bl4)) | 0; - mid = (mid + Math.imul(al2, bh4)) | 0; - mid = (mid + Math.imul(ah2, bl4)) | 0; - hi = (hi + Math.imul(ah2, bh4)) | 0; - lo = (lo + Math.imul(al1, bl5)) | 0; - mid = (mid + Math.imul(al1, bh5)) | 0; - mid = (mid + Math.imul(ah1, bl5)) | 0; - hi = (hi + Math.imul(ah1, bh5)) | 0; - lo = (lo + Math.imul(al0, bl6)) | 0; - mid = (mid + Math.imul(al0, bh6)) | 0; - mid = (mid + Math.imul(ah0, bl6)) | 0; - hi = (hi + Math.imul(ah0, bh6)) | 0; - var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; - w6 &= 0x3ffffff; - /* k = 7 */ - lo = Math.imul(al7, bl0); - mid = Math.imul(al7, bh0); - mid = (mid + Math.imul(ah7, bl0)) | 0; - hi = Math.imul(ah7, bh0); - lo = (lo + Math.imul(al6, bl1)) | 0; - mid = (mid + Math.imul(al6, bh1)) | 0; - mid = (mid + Math.imul(ah6, bl1)) | 0; - hi = (hi + Math.imul(ah6, bh1)) | 0; - lo = (lo + Math.imul(al5, bl2)) | 0; - mid = (mid + Math.imul(al5, bh2)) | 0; - mid = (mid + Math.imul(ah5, bl2)) | 0; - hi = (hi + Math.imul(ah5, bh2)) | 0; - lo = (lo + Math.imul(al4, bl3)) | 0; - mid = (mid + Math.imul(al4, bh3)) | 0; - mid = (mid + Math.imul(ah4, bl3)) | 0; - hi = (hi + Math.imul(ah4, bh3)) | 0; - lo = (lo + Math.imul(al3, bl4)) | 0; - mid = (mid + Math.imul(al3, bh4)) | 0; - mid = (mid + Math.imul(ah3, bl4)) | 0; - hi = (hi + Math.imul(ah3, bh4)) | 0; - lo = (lo + Math.imul(al2, bl5)) | 0; - mid = (mid + Math.imul(al2, bh5)) | 0; - mid = (mid + Math.imul(ah2, bl5)) | 0; - hi = (hi + Math.imul(ah2, bh5)) | 0; - lo = (lo + Math.imul(al1, bl6)) | 0; - mid = (mid + Math.imul(al1, bh6)) | 0; - mid = (mid + Math.imul(ah1, bl6)) | 0; - hi = (hi + Math.imul(ah1, bh6)) | 0; - lo = (lo + Math.imul(al0, bl7)) | 0; - mid = (mid + Math.imul(al0, bh7)) | 0; - mid = (mid + Math.imul(ah0, bl7)) | 0; - hi = (hi + Math.imul(ah0, bh7)) | 0; - var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; - w7 &= 0x3ffffff; - /* k = 8 */ - lo = Math.imul(al8, bl0); - mid = Math.imul(al8, bh0); - mid = (mid + Math.imul(ah8, bl0)) | 0; - hi = Math.imul(ah8, bh0); - lo = (lo + Math.imul(al7, bl1)) | 0; - mid = (mid + Math.imul(al7, bh1)) | 0; - mid = (mid + Math.imul(ah7, bl1)) | 0; - hi = (hi + Math.imul(ah7, bh1)) | 0; - lo = (lo + Math.imul(al6, bl2)) | 0; - mid = (mid + Math.imul(al6, bh2)) | 0; - mid = (mid + Math.imul(ah6, bl2)) | 0; - hi = (hi + Math.imul(ah6, bh2)) | 0; - lo = (lo + Math.imul(al5, bl3)) | 0; - mid = (mid + Math.imul(al5, bh3)) | 0; - mid = (mid + Math.imul(ah5, bl3)) | 0; - hi = (hi + Math.imul(ah5, bh3)) | 0; - lo = (lo + Math.imul(al4, bl4)) | 0; - mid = (mid + Math.imul(al4, bh4)) | 0; - mid = (mid + Math.imul(ah4, bl4)) | 0; - hi = (hi + Math.imul(ah4, bh4)) | 0; - lo = (lo + Math.imul(al3, bl5)) | 0; - mid = (mid + Math.imul(al3, bh5)) | 0; - mid = (mid + Math.imul(ah3, bl5)) | 0; - hi = (hi + Math.imul(ah3, bh5)) | 0; - lo = (lo + Math.imul(al2, bl6)) | 0; - mid = (mid + Math.imul(al2, bh6)) | 0; - mid = (mid + Math.imul(ah2, bl6)) | 0; - hi = (hi + Math.imul(ah2, bh6)) | 0; - lo = (lo + Math.imul(al1, bl7)) | 0; - mid = (mid + Math.imul(al1, bh7)) | 0; - mid = (mid + Math.imul(ah1, bl7)) | 0; - hi = (hi + Math.imul(ah1, bh7)) | 0; - lo = (lo + Math.imul(al0, bl8)) | 0; - mid = (mid + Math.imul(al0, bh8)) | 0; - mid = (mid + Math.imul(ah0, bl8)) | 0; - hi = (hi + Math.imul(ah0, bh8)) | 0; - var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; - w8 &= 0x3ffffff; - /* k = 9 */ - lo = Math.imul(al9, bl0); - mid = Math.imul(al9, bh0); - mid = (mid + Math.imul(ah9, bl0)) | 0; - hi = Math.imul(ah9, bh0); - lo = (lo + Math.imul(al8, bl1)) | 0; - mid = (mid + Math.imul(al8, bh1)) | 0; - mid = (mid + Math.imul(ah8, bl1)) | 0; - hi = (hi + Math.imul(ah8, bh1)) | 0; - lo = (lo + Math.imul(al7, bl2)) | 0; - mid = (mid + Math.imul(al7, bh2)) | 0; - mid = (mid + Math.imul(ah7, bl2)) | 0; - hi = (hi + Math.imul(ah7, bh2)) | 0; - lo = (lo + Math.imul(al6, bl3)) | 0; - mid = (mid + Math.imul(al6, bh3)) | 0; - mid = (mid + Math.imul(ah6, bl3)) | 0; - hi = (hi + Math.imul(ah6, bh3)) | 0; - lo = (lo + Math.imul(al5, bl4)) | 0; - mid = (mid + Math.imul(al5, bh4)) | 0; - mid = (mid + Math.imul(ah5, bl4)) | 0; - hi = (hi + Math.imul(ah5, bh4)) | 0; - lo = (lo + Math.imul(al4, bl5)) | 0; - mid = (mid + Math.imul(al4, bh5)) | 0; - mid = (mid + Math.imul(ah4, bl5)) | 0; - hi = (hi + Math.imul(ah4, bh5)) | 0; - lo = (lo + Math.imul(al3, bl6)) | 0; - mid = (mid + Math.imul(al3, bh6)) | 0; - mid = (mid + Math.imul(ah3, bl6)) | 0; - hi = (hi + Math.imul(ah3, bh6)) | 0; - lo = (lo + Math.imul(al2, bl7)) | 0; - mid = (mid + Math.imul(al2, bh7)) | 0; - mid = (mid + Math.imul(ah2, bl7)) | 0; - hi = (hi + Math.imul(ah2, bh7)) | 0; - lo = (lo + Math.imul(al1, bl8)) | 0; - mid = (mid + Math.imul(al1, bh8)) | 0; - mid = (mid + Math.imul(ah1, bl8)) | 0; - hi = (hi + Math.imul(ah1, bh8)) | 0; - lo = (lo + Math.imul(al0, bl9)) | 0; - mid = (mid + Math.imul(al0, bh9)) | 0; - mid = (mid + Math.imul(ah0, bl9)) | 0; - hi = (hi + Math.imul(ah0, bh9)) | 0; - var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; - w9 &= 0x3ffffff; - /* k = 10 */ - lo = Math.imul(al9, bl1); - mid = Math.imul(al9, bh1); - mid = (mid + Math.imul(ah9, bl1)) | 0; - hi = Math.imul(ah9, bh1); - lo = (lo + Math.imul(al8, bl2)) | 0; - mid = (mid + Math.imul(al8, bh2)) | 0; - mid = (mid + Math.imul(ah8, bl2)) | 0; - hi = (hi + Math.imul(ah8, bh2)) | 0; - lo = (lo + Math.imul(al7, bl3)) | 0; - mid = (mid + Math.imul(al7, bh3)) | 0; - mid = (mid + Math.imul(ah7, bl3)) | 0; - hi = (hi + Math.imul(ah7, bh3)) | 0; - lo = (lo + Math.imul(al6, bl4)) | 0; - mid = (mid + Math.imul(al6, bh4)) | 0; - mid = (mid + Math.imul(ah6, bl4)) | 0; - hi = (hi + Math.imul(ah6, bh4)) | 0; - lo = (lo + Math.imul(al5, bl5)) | 0; - mid = (mid + Math.imul(al5, bh5)) | 0; - mid = (mid + Math.imul(ah5, bl5)) | 0; - hi = (hi + Math.imul(ah5, bh5)) | 0; - lo = (lo + Math.imul(al4, bl6)) | 0; - mid = (mid + Math.imul(al4, bh6)) | 0; - mid = (mid + Math.imul(ah4, bl6)) | 0; - hi = (hi + Math.imul(ah4, bh6)) | 0; - lo = (lo + Math.imul(al3, bl7)) | 0; - mid = (mid + Math.imul(al3, bh7)) | 0; - mid = (mid + Math.imul(ah3, bl7)) | 0; - hi = (hi + Math.imul(ah3, bh7)) | 0; - lo = (lo + Math.imul(al2, bl8)) | 0; - mid = (mid + Math.imul(al2, bh8)) | 0; - mid = (mid + Math.imul(ah2, bl8)) | 0; - hi = (hi + Math.imul(ah2, bh8)) | 0; - lo = (lo + Math.imul(al1, bl9)) | 0; - mid = (mid + Math.imul(al1, bh9)) | 0; - mid = (mid + Math.imul(ah1, bl9)) | 0; - hi = (hi + Math.imul(ah1, bh9)) | 0; - var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; - w10 &= 0x3ffffff; - /* k = 11 */ - lo = Math.imul(al9, bl2); - mid = Math.imul(al9, bh2); - mid = (mid + Math.imul(ah9, bl2)) | 0; - hi = Math.imul(ah9, bh2); - lo = (lo + Math.imul(al8, bl3)) | 0; - mid = (mid + Math.imul(al8, bh3)) | 0; - mid = (mid + Math.imul(ah8, bl3)) | 0; - hi = (hi + Math.imul(ah8, bh3)) | 0; - lo = (lo + Math.imul(al7, bl4)) | 0; - mid = (mid + Math.imul(al7, bh4)) | 0; - mid = (mid + Math.imul(ah7, bl4)) | 0; - hi = (hi + Math.imul(ah7, bh4)) | 0; - lo = (lo + Math.imul(al6, bl5)) | 0; - mid = (mid + Math.imul(al6, bh5)) | 0; - mid = (mid + Math.imul(ah6, bl5)) | 0; - hi = (hi + Math.imul(ah6, bh5)) | 0; - lo = (lo + Math.imul(al5, bl6)) | 0; - mid = (mid + Math.imul(al5, bh6)) | 0; - mid = (mid + Math.imul(ah5, bl6)) | 0; - hi = (hi + Math.imul(ah5, bh6)) | 0; - lo = (lo + Math.imul(al4, bl7)) | 0; - mid = (mid + Math.imul(al4, bh7)) | 0; - mid = (mid + Math.imul(ah4, bl7)) | 0; - hi = (hi + Math.imul(ah4, bh7)) | 0; - lo = (lo + Math.imul(al3, bl8)) | 0; - mid = (mid + Math.imul(al3, bh8)) | 0; - mid = (mid + Math.imul(ah3, bl8)) | 0; - hi = (hi + Math.imul(ah3, bh8)) | 0; - lo = (lo + Math.imul(al2, bl9)) | 0; - mid = (mid + Math.imul(al2, bh9)) | 0; - mid = (mid + Math.imul(ah2, bl9)) | 0; - hi = (hi + Math.imul(ah2, bh9)) | 0; - var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; - w11 &= 0x3ffffff; - /* k = 12 */ - lo = Math.imul(al9, bl3); - mid = Math.imul(al9, bh3); - mid = (mid + Math.imul(ah9, bl3)) | 0; - hi = Math.imul(ah9, bh3); - lo = (lo + Math.imul(al8, bl4)) | 0; - mid = (mid + Math.imul(al8, bh4)) | 0; - mid = (mid + Math.imul(ah8, bl4)) | 0; - hi = (hi + Math.imul(ah8, bh4)) | 0; - lo = (lo + Math.imul(al7, bl5)) | 0; - mid = (mid + Math.imul(al7, bh5)) | 0; - mid = (mid + Math.imul(ah7, bl5)) | 0; - hi = (hi + Math.imul(ah7, bh5)) | 0; - lo = (lo + Math.imul(al6, bl6)) | 0; - mid = (mid + Math.imul(al6, bh6)) | 0; - mid = (mid + Math.imul(ah6, bl6)) | 0; - hi = (hi + Math.imul(ah6, bh6)) | 0; - lo = (lo + Math.imul(al5, bl7)) | 0; - mid = (mid + Math.imul(al5, bh7)) | 0; - mid = (mid + Math.imul(ah5, bl7)) | 0; - hi = (hi + Math.imul(ah5, bh7)) | 0; - lo = (lo + Math.imul(al4, bl8)) | 0; - mid = (mid + Math.imul(al4, bh8)) | 0; - mid = (mid + Math.imul(ah4, bl8)) | 0; - hi = (hi + Math.imul(ah4, bh8)) | 0; - lo = (lo + Math.imul(al3, bl9)) | 0; - mid = (mid + Math.imul(al3, bh9)) | 0; - mid = (mid + Math.imul(ah3, bl9)) | 0; - hi = (hi + Math.imul(ah3, bh9)) | 0; - var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; - w12 &= 0x3ffffff; - /* k = 13 */ - lo = Math.imul(al9, bl4); - mid = Math.imul(al9, bh4); - mid = (mid + Math.imul(ah9, bl4)) | 0; - hi = Math.imul(ah9, bh4); - lo = (lo + Math.imul(al8, bl5)) | 0; - mid = (mid + Math.imul(al8, bh5)) | 0; - mid = (mid + Math.imul(ah8, bl5)) | 0; - hi = (hi + Math.imul(ah8, bh5)) | 0; - lo = (lo + Math.imul(al7, bl6)) | 0; - mid = (mid + Math.imul(al7, bh6)) | 0; - mid = (mid + Math.imul(ah7, bl6)) | 0; - hi = (hi + Math.imul(ah7, bh6)) | 0; - lo = (lo + Math.imul(al6, bl7)) | 0; - mid = (mid + Math.imul(al6, bh7)) | 0; - mid = (mid + Math.imul(ah6, bl7)) | 0; - hi = (hi + Math.imul(ah6, bh7)) | 0; - lo = (lo + Math.imul(al5, bl8)) | 0; - mid = (mid + Math.imul(al5, bh8)) | 0; - mid = (mid + Math.imul(ah5, bl8)) | 0; - hi = (hi + Math.imul(ah5, bh8)) | 0; - lo = (lo + Math.imul(al4, bl9)) | 0; - mid = (mid + Math.imul(al4, bh9)) | 0; - mid = (mid + Math.imul(ah4, bl9)) | 0; - hi = (hi + Math.imul(ah4, bh9)) | 0; - var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; - w13 &= 0x3ffffff; - /* k = 14 */ - lo = Math.imul(al9, bl5); - mid = Math.imul(al9, bh5); - mid = (mid + Math.imul(ah9, bl5)) | 0; - hi = Math.imul(ah9, bh5); - lo = (lo + Math.imul(al8, bl6)) | 0; - mid = (mid + Math.imul(al8, bh6)) | 0; - mid = (mid + Math.imul(ah8, bl6)) | 0; - hi = (hi + Math.imul(ah8, bh6)) | 0; - lo = (lo + Math.imul(al7, bl7)) | 0; - mid = (mid + Math.imul(al7, bh7)) | 0; - mid = (mid + Math.imul(ah7, bl7)) | 0; - hi = (hi + Math.imul(ah7, bh7)) | 0; - lo = (lo + Math.imul(al6, bl8)) | 0; - mid = (mid + Math.imul(al6, bh8)) | 0; - mid = (mid + Math.imul(ah6, bl8)) | 0; - hi = (hi + Math.imul(ah6, bh8)) | 0; - lo = (lo + Math.imul(al5, bl9)) | 0; - mid = (mid + Math.imul(al5, bh9)) | 0; - mid = (mid + Math.imul(ah5, bl9)) | 0; - hi = (hi + Math.imul(ah5, bh9)) | 0; - var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; - w14 &= 0x3ffffff; - /* k = 15 */ - lo = Math.imul(al9, bl6); - mid = Math.imul(al9, bh6); - mid = (mid + Math.imul(ah9, bl6)) | 0; - hi = Math.imul(ah9, bh6); - lo = (lo + Math.imul(al8, bl7)) | 0; - mid = (mid + Math.imul(al8, bh7)) | 0; - mid = (mid + Math.imul(ah8, bl7)) | 0; - hi = (hi + Math.imul(ah8, bh7)) | 0; - lo = (lo + Math.imul(al7, bl8)) | 0; - mid = (mid + Math.imul(al7, bh8)) | 0; - mid = (mid + Math.imul(ah7, bl8)) | 0; - hi = (hi + Math.imul(ah7, bh8)) | 0; - lo = (lo + Math.imul(al6, bl9)) | 0; - mid = (mid + Math.imul(al6, bh9)) | 0; - mid = (mid + Math.imul(ah6, bl9)) | 0; - hi = (hi + Math.imul(ah6, bh9)) | 0; - var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; - w15 &= 0x3ffffff; - /* k = 16 */ - lo = Math.imul(al9, bl7); - mid = Math.imul(al9, bh7); - mid = (mid + Math.imul(ah9, bl7)) | 0; - hi = Math.imul(ah9, bh7); - lo = (lo + Math.imul(al8, bl8)) | 0; - mid = (mid + Math.imul(al8, bh8)) | 0; - mid = (mid + Math.imul(ah8, bl8)) | 0; - hi = (hi + Math.imul(ah8, bh8)) | 0; - lo = (lo + Math.imul(al7, bl9)) | 0; - mid = (mid + Math.imul(al7, bh9)) | 0; - mid = (mid + Math.imul(ah7, bl9)) | 0; - hi = (hi + Math.imul(ah7, bh9)) | 0; - var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; - w16 &= 0x3ffffff; - /* k = 17 */ - lo = Math.imul(al9, bl8); - mid = Math.imul(al9, bh8); - mid = (mid + Math.imul(ah9, bl8)) | 0; - hi = Math.imul(ah9, bh8); - lo = (lo + Math.imul(al8, bl9)) | 0; - mid = (mid + Math.imul(al8, bh9)) | 0; - mid = (mid + Math.imul(ah8, bl9)) | 0; - hi = (hi + Math.imul(ah8, bh9)) | 0; - var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; - w17 &= 0x3ffffff; - /* k = 18 */ - lo = Math.imul(al9, bl9); - mid = Math.imul(al9, bh9); - mid = (mid + Math.imul(ah9, bl9)) | 0; - hi = Math.imul(ah9, bh9); - var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; - c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; - w18 &= 0x3ffffff; - o[0] = w0; - o[1] = w1; - o[2] = w2; - o[3] = w3; - o[4] = w4; - o[5] = w5; - o[6] = w6; - o[7] = w7; - o[8] = w8; - o[9] = w9; - o[10] = w10; - o[11] = w11; - o[12] = w12; - o[13] = w13; - o[14] = w14; - o[15] = w15; - o[16] = w16; - o[17] = w17; - o[18] = w18; - if (c !== 0) { - o[19] = c; - out.length++; - } - return out; - }; - - // Polyfill comb - if (!Math.imul) { - comb10MulTo = smallMulTo; - } - - function bigMulTo (self, num, out) { - out.negative = num.negative ^ self.negative; - out.length = self.length + num.length; - - var carry = 0; - var hncarry = 0; - for (var k = 0; k < out.length - 1; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = hncarry; - hncarry = 0; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = k - j; - var a = self.words[i] | 0; - var b = num.words[j] | 0; - var r = a * b; - - var lo = r & 0x3ffffff; - ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; - lo = (lo + rword) | 0; - rword = lo & 0x3ffffff; - ncarry = (ncarry + (lo >>> 26)) | 0; - - hncarry += ncarry >>> 26; - ncarry &= 0x3ffffff; - } - out.words[k] = rword; - carry = ncarry; - ncarry = hncarry; - } - if (carry !== 0) { - out.words[k] = carry; - } else { - out.length--; - } - - return out.strip(); + 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 jumboMulTo (self, num, out) { - var fftm = new FFTM(); - return fftm.mulp(self, num, out); + 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; + } + }; } - - BN.prototype.mulTo = function mulTo (num, out) { - var res; - var len = this.length + num.length; - if (this.length === 10 && num.length === 10) { - res = comb10MulTo(this, num, out); - } else if (len < 63) { - res = smallMulTo(this, num, out); - } else if (len < 1024) { - res = bigMulTo(this, num, out); - } else { - res = jumboMulTo(this, num, out); - } - - return res; - }; - - // Cooley-Tukey algorithm for FFT - // slightly revisited to rely on looping instead of recursion - - function FFTM (x, y) { - this.x = x; - this.y = y; + 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); + } + }; } - - FFTM.prototype.makeRBT = function makeRBT (N) { - var t = new Array(N); - var l = BN.prototype._countBits(N) - 1; - for (var i = 0; i < N; i++) { - t[i] = this.revBin(i, l, N); - } - - return t; - }; - - // Returns binary-reversed representation of `x` - FFTM.prototype.revBin = function revBin (x, l, N) { - if (x === 0 || x === N - 1) return x; - - var rb = 0; - for (var i = 0; i < l; i++) { - rb |= (x & 1) << (l - i - 1); - x >>= 1; + 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"); } - - return rb; - }; - - // Performs "tweedling" phase, therefore 'emulating' - // behaviour of the recursive algorithm - FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { - for (var i = 0; i < N; i++) { - rtws[i] = rws[rbt[i]]; - itws[i] = iws[rbt[i]]; + 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()); }; - - FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { - this.permute(rbt, rws, iws, rtws, itws, N); - - for (var s = 1; s < N; s <<= 1) { - var l = s << 1; - - var rtwdf = Math.cos(2 * Math.PI / l); - var itwdf = Math.sin(2 * Math.PI / l); - - for (var p = 0; p < N; p += l) { - var rtwdf_ = rtwdf; - var itwdf_ = itwdf; - - for (var j = 0; j < s; j++) { - var re = rtws[p + j]; - var ie = itws[p + j]; - - var ro = rtws[p + j + s]; - var io = itws[p + j + s]; - - var rx = rtwdf_ * ro - itwdf_ * io; - - io = rtwdf_ * io + itwdf_ * ro; - ro = rx; - - rtws[p + j] = re + ro; - itws[p + j] = ie + io; - - rtws[p + j + s] = re - ro; - itws[p + j + s] = ie - io; - - /* jshint maxdepth : false */ - if (j !== l) { - rx = rtwdf * rtwdf_ - itwdf * itwdf_; - - itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; - rtwdf_ = rx; - } + 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 window = d3_window(container); + if (window.scrollX || window.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 ]; } - }; - - FFTM.prototype.guessLen13b = function guessLen13b (n, m) { - var N = Math.max(m, n) | 1; - var odd = N & 1; - var i = 0; - for (N = N / 2 | 0; N; N = N >>> 1) { - i++; - } - - return 1 << i + 1 + odd; - }; - - FFTM.prototype.conjugate = function conjugate (rws, iws, N) { - if (N <= 1) return; - - for (var i = 0; i < N / 2; i++) { - var t = rws[i]; - - rws[i] = rws[N - i - 1]; - rws[N - i - 1] = t; - - t = iws[i]; - - iws[i] = -iws[N - i - 1]; - iws[N - i - 1] = -t; - } - }; - - FFTM.prototype.normalize13b = function normalize13b (ws, N) { - var carry = 0; - for (var i = 0; i < N / 2; i++) { - var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + - Math.round(ws[2 * i] / N) + - carry; - - ws[i] = w & 0x3ffffff; - - if (w < 0x4000000) { - carry = 0; - } else { - carry = w / 0x4000000 | 0; + 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); } } - - return ws; - }; - - FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { - var carry = 0; - for (var i = 0; i < len; i++) { - carry = carry + (ws[i] | 0); - - rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; - rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; - } - - // Pad with zeroes - for (i = 2 * len; i < N; ++i) { - rws[i] = 0; - } - - assert(carry === 0); - assert((carry & ~0x1fff) === 0); - }; - - FFTM.prototype.stub = function stub (N) { - var ph = new Array(N); - for (var i = 0; i < N; i++) { - ph[i] = 0; - } - - return ph; - }; - - FFTM.prototype.mulp = function mulp (x, y, out) { - var N = 2 * this.guessLen13b(x.length, y.length); - - var rbt = this.makeRBT(N); - - var _ = this.stub(N); - - var rws = new Array(N); - var rwst = new Array(N); - var iwst = new Array(N); - - var nrws = new Array(N); - var nrwst = new Array(N); - var niwst = new Array(N); - - var rmws = out.words; - rmws.length = N; - - this.convert13b(x.words, x.length, rws, N); - this.convert13b(y.words, y.length, nrws, N); - - this.transform(rws, _, rwst, iwst, N, rbt); - this.transform(nrws, _, nrwst, niwst, N, rbt); - - for (var i = 0; i < N; i++) { - var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; - iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; - rwst[i] = rx; - } - - this.conjugate(rwst, iwst, N); - this.transform(rwst, iwst, rmws, _, N, rbt); - this.conjugate(rmws, _, N); - this.normalize13b(rmws, N); - - out.negative = x.negative ^ y.negative; - out.length = x.length + y.length; - return out.strip(); - }; - - // Multiply `this` by `num` - BN.prototype.mul = function mul (num) { - var out = new BN(null); - out.words = new Array(this.length + num.length); - return this.mulTo(num, out); - }; - - // Multiply employing FFT - BN.prototype.mulf = function mulf (num) { - var out = new BN(null); - out.words = new Array(this.length + num.length); - return jumboMulTo(this, num, out); - }; - - // In-place Multiplication - BN.prototype.imul = function imul (num) { - return this.clone().mulTo(num, this); }; - - BN.prototype.imuln = function imuln (num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - - // Carry - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = (this.words[i] | 0) * num; - var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); - carry >>= 26; - carry += (w / 0x4000000) | 0; - // NOTE: lo is 27bit maximum - carry += lo >>> 26; - this.words[i] = lo & 0x3ffffff; + 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); } - - if (carry !== 0) { - this.words[i] = carry; - this.length++; + function dragstart(id, 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 = id(), 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: dx, + dy: dy + }); + } + function ended() { + if (!position(parent, dragId)) return; + dragSubject.on(move + dragName, null).on(end + dragName, null); + dragRestore(dragged); + dispatch({ + type: "dragend" + }); + } + }; } - - return this; - }; - - BN.prototype.muln = function muln (num) { - return this.clone().imuln(num); - }; - - // `this` * `this` - BN.prototype.sqr = function sqr () { - return this.mul(this); + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + return d3.rebind(drag, event, "on"); }; - - // `this` * `this` in-place - BN.prototype.isqr = function isqr () { - return this.imul(this.clone()); + 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; + }) : []; }; - - // Math.pow(`this`, `num`) - BN.prototype.pow = function pow (num) { - var w = toBitArray(num); - if (w.length === 0) return new BN(1); - - // Skip leading zeroes - var res = this; - for (var i = 0; i < w.length; i++, res = res.sqr()) { - if (w[i] !== 0) break; - } - - if (++i < w.length) { - for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { - if (w[i] === 0) continue; - - res = res.mul(q); - } + 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(p0, p1) { + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < ε2) { + S = Math.log(w1 / w0) / ρ; + i = function(t) { + return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / ρ; + i = function(t) { + var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0)); + return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ]; + }; } - - return res; + i.duration = S * 1e3; + return i; }; - - // Shift-left in-place - BN.prototype.iushln = function iushln (bits) { - assert(typeof bits === 'number' && bits >= 0); - var r = bits % 26; - var s = (bits - r) / 26; - var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); - var i; - - if (r !== 0) { - var carry = 0; - - for (i = 0; i < this.length; i++) { - var newCarry = this.words[i] & carryMask; - var c = ((this.words[i] | 0) - newCarry) << r; - this.words[i] = c | carry; - carry = newCarry >>> (26 - r); - } - - if (carry) { - this.words[i] = carry; - this.length++; - } + 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"), x0, x1, y0, y1; + 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"); } - - if (s !== 0) { - for (i = this.length - 1; i >= 0; i--) { - this.words[i + s] = this.words[i]; - } - - for (i = 0; i < s; i++) { - this.words[i] = 0; - } - - this.length += s; + function zoom(g) { + g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted); } - - return this.strip(); - }; - - BN.prototype.ishln = function ishln (bits) { - // TODO(indutny): implement me - assert(this.negative === 0); - return this.iushln(bits); - }; - - // Shift-right in-place - // NOTE: `hint` is a lowest bit before trailing zeroes - // NOTE: if `extended` is present - it will be filled with destroyed bits - BN.prototype.iushrn = function iushrn (bits, hint, extended) { - assert(typeof bits === 'number' && bits >= 0); - var h; - if (hint) { - h = (hint - (hint % 26)) / 26; - } else { - h = 0; - } - - var r = bits % 26; - var s = Math.min((bits - r) / 26, this.length); - var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); - var maskedWords = extended; - - h -= s; - h = Math.max(0, h); - - // Extended mode, copy masked part - if (maskedWords) { - for (var i = 0; i < s; i++) { - maskedWords.words[i] = this.words[i]; - } - maskedWords.length = s; - } - - if (s === 0) { - // No-op, we should not move anything at all - } else if (this.length > s) { - this.length -= s; - for (i = 0; i < this.length; i++) { - this.words[i] = this.words[i + s]; - } - } else { - this.words[0] = 0; - this.length = 1; - } - - var carry = 0; - for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { - var word = this.words[i] | 0; - this.words[i] = (carry << (26 - r)) | (word >>> r); - carry = word & mask; - } - - // Push carried bits as a mask - if (maskedWords && carry !== 0) { - maskedWords.words[maskedWords.length++] = carry; - } - - if (this.length === 0) { - this.words[0] = 0; - this.length = 1; - } - - return this.strip(); - }; - - BN.prototype.ishrn = function ishrn (bits, hint, extended) { - // TODO(indutny): implement me - assert(this.negative === 0); - return this.iushrn(bits, hint, extended); - }; - - // Shift-left - BN.prototype.shln = function shln (bits) { - return this.clone().ishln(bits); - }; - - BN.prototype.ushln = function ushln (bits) { - return this.clone().iushln(bits); - }; - - // Shift-right - BN.prototype.shrn = function shrn (bits) { - return this.clone().ishrn(bits); - }; - - BN.prototype.ushrn = function ushrn (bits) { - return this.clone().iushrn(bits); - }; - - // Test if n bit is set - BN.prototype.testn = function testn (bit) { - assert(typeof bit === 'number' && bit >= 0); - var r = bit % 26; - var s = (bit - r) / 26; - var q = 1 << r; - - // Fast case: bit is much higher than all existing words - if (this.length <= s) return false; - - // Check bit and return - var w = this.words[s]; - - return !!(w & q); - }; - - // Return only lowers bits of number (in-place) - BN.prototype.imaskn = function imaskn (bits) { - assert(typeof bits === 'number' && bits >= 0); - var r = bits % 26; - var s = (bits - r) / 26; - - assert(this.negative === 0, 'imaskn works only with positive numbers'); - - if (this.length <= s) { - return this; - } - - if (r !== 0) { - s++; - } - this.length = Math.min(s, this.length); - - if (r !== 0) { - var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); - this.words[this.length - 1] &= mask; - } - - return this.strip(); - }; - - // Return only lowers bits of number - BN.prototype.maskn = function maskn (bits) { - return this.clone().imaskn(bits); - }; - - // Add plain number `num` to `this` - BN.prototype.iaddn = function iaddn (num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - if (num < 0) return this.isubn(-num); - - // Possible sign change - if (this.negative !== 0) { - if (this.length === 1 && (this.words[0] | 0) < num) { - this.words[0] = num - (this.words[0] | 0); - this.negative = 0; - return this; - } - - this.negative = 0; - this.isubn(num); - this.negative = 1; - return this; - } - - // Add without checks - return this._iaddn(num); - }; - - BN.prototype._iaddn = function _iaddn (num) { - this.words[0] += num; - - // Carry - for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { - this.words[i] -= 0x4000000; - if (i === this.length - 1) { - this.words[i + 1] = 1; - } else { - this.words[i + 1]++; - } - } - this.length = Math.max(this.length, i + 1); - - return this; - }; - - // Subtract plain number `num` from `this` - BN.prototype.isubn = function isubn (num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - if (num < 0) return this.iaddn(-num); - - if (this.negative !== 0) { - this.negative = 0; - this.iaddn(num); - this.negative = 1; - return this; - } - - this.words[0] -= num; - - if (this.length === 1 && this.words[0] < 0) { - this.words[0] = -this.words[0]; - this.negative = 1; - } else { - // Carry - for (var i = 0; i < this.length && this.words[i] < 0; i++) { - this.words[i] += 0x4000000; - this.words[i + 1] -= 1; - } - } - - return this.strip(); - }; - - BN.prototype.addn = function addn (num) { - return this.clone().iaddn(num); - }; - - BN.prototype.subn = function subn (num) { - return this.clone().isubn(num); - }; - - BN.prototype.iabs = function iabs () { - this.negative = 0; - - return this; - }; - - BN.prototype.abs = function abs () { - return this.clone().iabs(); - }; - - BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { - var len = num.length + shift; - var i; - - this._expand(len); - - var w; - var carry = 0; - for (i = 0; i < num.length; i++) { - w = (this.words[i + shift] | 0) + carry; - var right = (num.words[i] | 0) * mul; - w -= right & 0x3ffffff; - carry = (w >> 26) - ((right / 0x4000000) | 0); - this.words[i + shift] = w & 0x3ffffff; - } - for (; i < this.length - shift; i++) { - w = (this.words[i + shift] | 0) + carry; - carry = w >> 26; - this.words[i + shift] = w & 0x3ffffff; - } - - if (carry === 0) return this.strip(); - - // Subtraction overflow - assert(carry === -1); - carry = 0; - for (i = 0; i < this.length; i++) { - w = -(this.words[i] | 0) + carry; - carry = w >> 26; - this.words[i] = w & 0x3ffffff; - } - this.negative = 1; - - return this.strip(); - }; - - BN.prototype._wordDiv = function _wordDiv (num, mode) { - var shift = this.length - num.length; - - var a = this.clone(); - var b = num; - - // Normalize - var bhi = b.words[b.length - 1] | 0; - var bhiBits = this._countBits(bhi); - shift = 26 - bhiBits; - if (shift !== 0) { - b = b.ushln(shift); - a.iushln(shift); - bhi = b.words[b.length - 1] | 0; - } - - // Initialize quotient - var m = a.length - b.length; - var q; - - if (mode !== 'mod') { - q = new BN(null); - q.length = m + 1; - q.words = new Array(q.length); - for (var i = 0; i < q.length; i++) { - q.words[i] = 0; - } - } - - var diff = a.clone()._ishlnsubmul(b, 1, m); - if (diff.negative === 0) { - a = diff; - if (q) { - q.words[m] = 1; - } - } - - for (var j = m - 1; j >= 0; j--) { - var qj = (a.words[b.length + j] | 0) * 0x4000000 + - (a.words[b.length + j - 1] | 0); - - // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max - // (0x7ffffff) - qj = Math.min((qj / bhi) | 0, 0x3ffffff); - - a._ishlnsubmul(b, qj, j); - while (a.negative !== 0) { - qj--; - a.negative = 0; - a._ishlnsubmul(b, 1, j); - if (!a.isZero()) { - a.negative ^= 1; + 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: 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); } - } - if (q) { - q.words[j] = qj; - } - } - if (q) { - q.strip(); - } - a.strip(); - - // Denormalize - if (mode !== 'div' && shift !== 0) { - a.iushrn(shift); - } - - return { - div: q || null, - mod: a + }); }; - }; - - // NOTE: 1) `mode` can be set to `mod` to request mod only, - // to `div` to request div only, or be absent to - // request both div & mod - // 2) `positive` is true if unsigned mod is requested - BN.prototype.divmod = function divmod (num, mode, positive) { - assert(!num.isZero()); - - if (this.isZero()) { - return { - div: new BN(0), - mod: new BN(0) + zoom.translate = function(_) { + if (!arguments.length) return [ view.x, view.y ]; + view = { + x: +_[0], + y: +_[1], + k: view.k }; - } - - var div, mod, res; - if (this.negative !== 0 && num.negative === 0) { - res = this.neg().divmod(num, mode); - - if (mode !== 'mod') { - div = res.div.neg(); - } - - if (mode !== 'div') { - mod = res.mod.neg(); - if (positive && mod.negative !== 0) { - mod.iadd(num); - } - } - - return { - div: div, - mod: mod + rescale(); + return zoom; + }; + zoom.scale = function(_) { + if (!arguments.length) return view.k; + view = { + x: view.x, + y: view.y, + k: null }; - } - - if (this.negative === 0 && num.negative !== 0) { - res = this.divmod(num.neg(), mode); - - if (mode !== 'mod') { - div = res.div.neg(); - } - - return { - div: div, - mod: res.mod + 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 x1; + x1 = z; + x0 = z.copy(); + view = { + x: 0, + y: 0, + k: 1 }; - } - - if ((this.negative & num.negative) !== 0) { - res = this.neg().divmod(num.neg(), mode); - - if (mode !== 'div') { - mod = res.mod.neg(); - if (positive && mod.negative !== 0) { - mod.isub(num); - } - } - - return { - div: res.div, - mod: mod + return zoom; + }; + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + view = { + x: 0, + y: 0, + k: 1 }; + return zoom; + }; + function location(p) { + return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; } - - // Both numbers are positive at this point - - // Strip both numbers to approximate shift value - if (num.length > this.length || this.cmp(num) < 0) { - return { - div: new BN(0), - mod: this - }; + function point(l) { + return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; } - - // Very short reduction - if (num.length === 1) { - if (mode === 'div') { - return { - div: this.divn(num.words[0]), - mod: null - }; - } - - if (mode === 'mod') { - return { - div: null, - mod: new BN(this.modn(num.words[0])) - }; - } - - return { - div: this.divn(num.words[0]), - mod: new BN(this.modn(num.words[0])) + 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); } - - return this._wordDiv(num, mode); - }; - - // Find `this` / `num` - BN.prototype.div = function div (num) { - return this.divmod(num, 'div', false).div; - }; - - // Find `this` % `num` - BN.prototype.mod = function mod (num) { - return this.divmod(num, 'mod', false).mod; - }; - - BN.prototype.umod = function umod (num) { - return this.divmod(num, 'mod', true).mod; - }; - - // Find Round(`this` / `num`) - BN.prototype.divRound = function divRound (num) { - var dm = this.divmod(num); - - // Fast case - exact division - if (dm.mod.isZero()) return dm.div; - - var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; - - var half = num.ushrn(1); - var r2 = num.andln(1); - var cmp = mod.cmp(half); - - // Round down - if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; - - // Round up - return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); - }; - - BN.prototype.modn = function modn (num) { - assert(num <= 0x3ffffff); - var p = (1 << 26) % num; - - var acc = 0; - for (var i = this.length - 1; i >= 0; i--) { - acc = (p * acc + (this.words[i] | 0)) % num; + function rescale() { + if (x1) x1.domain(x0.range().map(function(x) { + return (x - view.x) / view.k; + }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { + return (y - view.y) / view.k; + }).map(y0.invert)); } - - return acc; - }; - - // In-place division by number - BN.prototype.idivn = function idivn (num) { - assert(num <= 0x3ffffff); - - var carry = 0; - for (var i = this.length - 1; i >= 0; i--) { - var w = (this.words[i] | 0) + carry * 0x4000000; - this.words[i] = (w / num) | 0; - carry = w % num; + function zoomstarted(dispatch) { + if (!zooming++) dispatch({ + type: "zoomstart" + }); } - - return this.strip(); - }; - - BN.prototype.divn = function divn (num) { - return this.clone().idivn(num); - }; - - BN.prototype.egcd = function egcd (p) { - assert(p.negative === 0); - assert(!p.isZero()); - - var x = this; - var y = p.clone(); - - if (x.negative !== 0) { - x = x.umod(p); - } else { - x = x.clone(); + function zoomed(dispatch) { + rescale(); + dispatch({ + type: "zoom", + scale: view.k, + translate: [ view.x, view.y ] + }); } - - // A * x + B * y = x - var A = new BN(1); - var B = new BN(0); - - // C * x + D * y = y - var C = new BN(0); - var D = new BN(1); - - var g = 0; - - while (x.isEven() && y.isEven()) { - x.iushrn(1); - y.iushrn(1); - ++g; + function zoomended(dispatch) { + if (!--zooming) dispatch({ + type: "zoomend" + }), center0 = null; } - - var yp = y.clone(); - var xp = x.clone(); - - while (!x.isZero()) { - for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); - if (i > 0) { - x.iushrn(i); - while (i-- > 0) { - if (A.isOdd() || B.isOdd()) { - A.iadd(yp); - B.isub(xp); - } - - A.iushrn(1); - B.iushrn(1); - } - } - - for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); - if (j > 0) { - y.iushrn(j); - while (j-- > 0) { - if (C.isOdd() || D.isOdd()) { - C.iadd(yp); - D.isub(xp); - } - - C.iushrn(1); - D.iushrn(1); - } + 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); } - - if (x.cmp(y) >= 0) { - x.isub(y); - A.isub(C); - B.isub(D); - } else { - y.isub(x); - C.isub(A); - D.isub(B); + function ended() { + subject.on(mousemove, null).on(mouseup, null); + dragRestore(dragged); + zoomended(dispatch); } } - - return { - a: C, - b: D, - gcd: y.iushln(g) - }; - }; - - // This is reduced incarnation of the binary EEA - // above, designated to invert members of the - // _prime_ fields F(p) at a maximal speed - BN.prototype._invmp = function _invmp (p) { - assert(p.negative === 0); - assert(!p.isZero()); - - var a = this; - var b = p.clone(); - - if (a.negative !== 0) { - a = a.umod(p); - } else { - a = a.clone(); - } - - var x1 = new BN(1); - var x2 = new BN(0); - - var delta = b.clone(); - - while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { - for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); - if (i > 0) { - a.iushrn(i); - while (i-- > 0) { - if (x1.isOdd()) { - x1.iadd(delta); + 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(); } - - x1.iushrn(1); + 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; } } - - for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); - if (j > 0) { - b.iushrn(j); - while (j-- > 0) { - if (x2.isOdd()) { - x2.iadd(delta); + function moved() { + var touches = d3.touches(that), p0, l0, p1, l1; + d3_selection_interrupt.call(that); + for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { + p1 = touches[i]; + if (l1 = locations0[p1.identifier]) { + if (l0) break; + p0 = p1, l0 = l1; } - - x2.iushrn(1); } + if (l1) { + var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; + scaleTo(scale1 * scale0); + } + touchtime = null; + translateTo(p0, l0); + zoomed(dispatch); } - - if (a.cmp(b) >= 0) { - a.isub(b); - x1.isub(x2); - } else { - b.isub(a); - x2.isub(x1); + 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); } } - - var res; - if (a.cmpn(1) === 0) { - res = x1; - } else { - res = x2; - } - - if (res.cmpn(0) < 0) { - res.iadd(p); + 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() * .002) * view.k); + translateTo(center0, translate0); + zoomed(dispatch); } - - return res; - }; - - BN.prototype.gcd = function gcd (num) { - if (this.isZero()) return num.abs(); - if (num.isZero()) return this.abs(); - - var a = this.clone(); - var b = num.clone(); - a.negative = 0; - b.negative = 0; - - // Remove common factor of two - for (var shift = 0; a.isEven() && b.isEven(); shift++) { - a.iushrn(1); - b.iushrn(1); + 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); } - - do { - while (a.isEven()) { - a.iushrn(1); - } - while (b.isEven()) { - b.iushrn(1); - } - - var r = a.cmp(b); - if (r < 0) { - // Swap `a` and `b` to make `a` always bigger than `b` - var t = a; - a = b; - b = t; - } else if (r === 0 || b.cmpn(1) === 0) { - break; - } - - a.isub(b); - } while (true); - - return b.iushln(shift); + return d3.rebind(zoom, event, "on"); }; - - // Invert number in the field F(num) - BN.prototype.invm = function invm (num) { - return this.egcd(num).a.umod(num); + 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() + ""; }; - - BN.prototype.isEven = function isEven () { - return (this.words[0] & 1) === 0; + 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(.7, arguments.length ? k : 1); + return new d3_hsl(this.h, this.s, this.l / k); }; - - BN.prototype.isOdd = function isOdd () { - return (this.words[0] & 1) === 1; + d3_hslPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_hsl(this.h, this.s, k * this.l); }; - - // And first word and num - BN.prototype.andln = function andln (num) { - return this.words[0] & num; + d3_hslPrototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); }; - - // Increment at the bit position in-line - BN.prototype.bincn = function bincn (bit) { - assert(typeof bit === 'number'); - var r = bit % 26; - var s = (bit - r) / 26; - var q = 1 << r; - - // Fast case: bit is much higher than all existing words - if (this.length <= s) { - this._expand(s + 1); - this.words[s] |= q; - return this; + function d3_hsl_rgb(h, s, l) { + var m1, m2; + h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; + s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + function v(h) { + if (h > 360) h -= 360; else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; } - - // Add bit and propagate, if needed - var carry = q; - for (var i = s; carry !== 0 && i < this.length; i++) { - var w = this.words[i] | 0; - w += carry; - carry = w >>> 26; - w &= 0x3ffffff; - this.words[i] = w; - } - if (carry !== 0) { - this.words[i] = carry; - this.length++; + function vv(h) { + return Math.round(v(h) * 255); } - return this; - }; - - BN.prototype.isZero = function isZero () { - return this.length === 1 && this.words[0] === 0; - }; - - BN.prototype.cmpn = function cmpn (num) { - var negative = num < 0; - - if (this.negative !== 0 && !negative) return -1; - if (this.negative === 0 && negative) return 1; - - this.strip(); - - var res; - if (this.length > 1) { - res = 1; - } else { - if (negative) { - num = -num; - } - - assert(num <= 0x3ffffff, 'Number is too big'); - - var w = this.words[0] | 0; - res = w === num ? 0 : w < num ? -1 : 1; - } - if (this.negative !== 0) return -res | 0; - return res; - }; - - // Compare two numbers and return: - // 1 - if `this` > `num` - // 0 - if `this` == `num` - // -1 - if `this` < `num` - BN.prototype.cmp = function cmp (num) { - if (this.negative !== 0 && num.negative === 0) return -1; - if (this.negative === 0 && num.negative !== 0) return 1; - - var res = this.ucmp(num); - if (this.negative !== 0) return -res | 0; - return res; - }; - - // Unsigned comparison - BN.prototype.ucmp = function ucmp (num) { - // At this point both numbers have the same sign - if (this.length > num.length) return 1; - if (this.length < num.length) return -1; - - var res = 0; - for (var i = this.length - 1; i >= 0; i--) { - var a = this.words[i] | 0; - var b = num.words[i] | 0; - - if (a === b) continue; - if (a < b) { - res = -1; - } else if (a > b) { - res = 1; - } - break; - } - return res; - }; - - BN.prototype.gtn = function gtn (num) { - return this.cmpn(num) === 1; - }; - - BN.prototype.gt = function gt (num) { - return this.cmp(num) === 1; - }; - - BN.prototype.gten = function gten (num) { - return this.cmpn(num) >= 0; - }; - - BN.prototype.gte = function gte (num) { - return this.cmp(num) >= 0; - }; - - BN.prototype.ltn = function ltn (num) { - return this.cmpn(num) === -1; - }; - - BN.prototype.lt = function lt (num) { - return this.cmp(num) === -1; - }; - - BN.prototype.lten = function lten (num) { - return this.cmpn(num) <= 0; - }; - - BN.prototype.lte = function lte (num) { - return this.cmp(num) <= 0; - }; - - BN.prototype.eqn = function eqn (num) { - return this.cmpn(num) === 0; - }; - - BN.prototype.eq = function eq (num) { - return this.cmp(num) === 0; - }; - - // - // A reduce context, could be using montgomery or something better, depending - // on the `m` itself. - // - BN.red = function red (num) { - return new Red(num); - }; - - BN.prototype.toRed = function toRed (ctx) { - assert(!this.red, 'Already a number in reduction context'); - assert(this.negative === 0, 'red works only with positives'); - return ctx.convertTo(this)._forceRed(ctx); - }; - - BN.prototype.fromRed = function fromRed () { - assert(this.red, 'fromRed works only with numbers in reduction context'); - return this.red.convertFrom(this); - }; - - BN.prototype._forceRed = function _forceRed (ctx) { - this.red = ctx; - return this; - }; - - BN.prototype.forceRed = function forceRed (ctx) { - assert(!this.red, 'Already a number in reduction context'); - return this._forceRed(ctx); - }; - - BN.prototype.redAdd = function redAdd (num) { - assert(this.red, 'redAdd works only with red numbers'); - return this.red.add(this, num); - }; - - BN.prototype.redIAdd = function redIAdd (num) { - assert(this.red, 'redIAdd works only with red numbers'); - return this.red.iadd(this, num); - }; - - BN.prototype.redSub = function redSub (num) { - assert(this.red, 'redSub works only with red numbers'); - return this.red.sub(this, num); - }; - - BN.prototype.redISub = function redISub (num) { - assert(this.red, 'redISub works only with red numbers'); - return this.red.isub(this, num); - }; - - BN.prototype.redShl = function redShl (num) { - assert(this.red, 'redShl works only with red numbers'); - return this.red.shl(this, num); - }; - - BN.prototype.redMul = function redMul (num) { - assert(this.red, 'redMul works only with red numbers'); - this.red._verify2(this, num); - return this.red.mul(this, num); - }; - - BN.prototype.redIMul = function redIMul (num) { - assert(this.red, 'redMul works only with red numbers'); - this.red._verify2(this, num); - return this.red.imul(this, num); - }; - - BN.prototype.redSqr = function redSqr () { - assert(this.red, 'redSqr works only with red numbers'); - this.red._verify1(this); - return this.red.sqr(this); - }; - - BN.prototype.redISqr = function redISqr () { - assert(this.red, 'redISqr works only with red numbers'); - this.red._verify1(this); - return this.red.isqr(this); - }; - - // Square root over p - BN.prototype.redSqrt = function redSqrt () { - assert(this.red, 'redSqrt works only with red numbers'); - this.red._verify1(this); - return this.red.sqrt(this); - }; - - BN.prototype.redInvm = function redInvm () { - assert(this.red, 'redInvm works only with red numbers'); - this.red._verify1(this); - return this.red.invm(this); - }; - - // Return negative clone of `this` % `red modulo` - BN.prototype.redNeg = function redNeg () { - assert(this.red, 'redNeg works only with red numbers'); - this.red._verify1(this); - return this.red.neg(this); - }; - - BN.prototype.redPow = function redPow (num) { - assert(this.red && !num.red, 'redPow(normalNum)'); - this.red._verify1(this); - return this.red.pow(this, num); - }; - - // Prime numbers with efficient reduction - var primes = { - k256: null, - p224: null, - p192: null, - p25519: null - }; - - // Pseudo-Mersenne prime - function MPrime (name, p) { - // P = 2 ^ N - K - this.name = name; - this.p = new BN(p, 16); - this.n = this.p.bitLength(); - this.k = new BN(1).iushln(this.n).isub(this.p); - - this.tmp = this._tmp(); + return new d3_rgb(vv(h + 120), vv(h), vv(h - 120)); } - - MPrime.prototype._tmp = function _tmp () { - var tmp = new BN(null); - tmp.words = new Array(Math.ceil(this.n / 13)); - return tmp; - }; - - MPrime.prototype.ireduce = function ireduce (num) { - // Assumes that `num` is less than `P^2` - // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) - var r = num; - var rlen; - - do { - this.split(r, this.tmp); - r = this.imulK(r); - r = r.iadd(this.tmp); - rlen = r.bitLength(); - } while (rlen > this.n); - - var cmp = rlen < this.n ? -1 : r.ucmp(this.p); - if (cmp === 0) { - r.words[0] = 0; - r.length = 1; - } else if (cmp > 0) { - r.isub(this.p); - } else { - r.strip(); - } - - return r; - }; - - MPrime.prototype.split = function split (input, out) { - input.iushrn(this.n, 0, out); - }; - - MPrime.prototype.imulK = function imulK (num) { - return num.imul(this.k); - }; - - function K256 () { - MPrime.call( - this, - 'k256', - 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + 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); } - inherits(K256, MPrime); - - K256.prototype.split = function split (input, output) { - // 256 = 9 * 26 + 22 - var mask = 0x3fffff; - - var outLen = Math.min(input.length, 9); - for (var i = 0; i < outLen; i++) { - output.words[i] = input.words[i]; - } - output.length = outLen; - - if (input.length <= 9) { - input.words[0] = 0; - input.length = 1; - return; - } - - // Shift by 9 limbs - var prev = input.words[9]; - output.words[output.length++] = prev & mask; - - for (i = 10; i < input.length; i++) { - var next = input.words[i] | 0; - input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); - prev = next; - } - prev >>>= 22; - input.words[i - 10] = prev; - if (prev === 0 && input.length > 10) { - input.length -= 10; - } else { - input.length -= 9; - } - }; - - K256.prototype.imulK = function imulK (num) { - // K = 0x1000003d1 = [ 0x40, 0x3d1 ] - num.words[num.length] = 0; - num.words[num.length + 1] = 0; - num.length += 2; - - // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 - var lo = 0; - for (var i = 0; i < num.length; i++) { - var w = num.words[i] | 0; - lo += w * 0x3d1; - num.words[i] = lo & 0x3ffffff; - lo = w * 0x40 + ((lo / 0x4000000) | 0); - } - - // Fast length reduction - if (num.words[num.length - 1] === 0) { - num.length--; - if (num.words[num.length - 1] === 0) { - num.length--; - } - } - return num; + 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))); }; - - function P224 () { - MPrime.call( - this, - 'p224', - 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); - } - inherits(P224, MPrime); - - function P192 () { - MPrime.call( - this, - 'p192', - 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); - } - inherits(P192, MPrime); - - function P25519 () { - // 2 ^ 255 - 19 - MPrime.call( - this, - '25519', - '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); - } - inherits(P25519, MPrime); - - P25519.prototype.imulK = function imulK (num) { - // K = 0x13 - var carry = 0; - for (var i = 0; i < num.length; i++) { - var hi = (num.words[i] | 0) * 0x13 + carry; - var lo = hi & 0x3ffffff; - hi >>>= 26; - - num.words[i] = lo; - carry = hi; - } - if (carry !== 0) { - num.words[num.length++] = carry; - } - return num; + 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))); }; - - // Exported mostly for testing purposes, use plain name instead - BN._prime = function prime (name) { - // Cached version of prime - if (primes[name]) return primes[name]; - - var prime; - if (name === 'k256') { - prime = new K256(); - } else if (name === 'p224') { - prime = new P224(); - } else if (name === 'p192') { - prime = new P192(); - } else if (name === 'p25519') { - prime = new P25519(); - } else { - throw new Error('Unknown prime ' + name); - } - primes[name] = prime; - - return prime; + d3_hclPrototype.rgb = function() { + return d3_hcl_lab(this.h, this.c, this.l).rgb(); }; - - // - // Base reduction engine - // - function Red (m) { - if (typeof m === 'string') { - var prime = BN._prime(m); - this.m = prime.p; - this.prime = prime; - } else { - assert(m.gtn(1), 'modulus must be greater than 1'); - this.m = m; - this.prime = null; - } + 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); } - - Red.prototype._verify1 = function _verify1 (a) { - assert(a.negative === 0, 'red works only with positives'); - assert(a.red, 'red works only with red numbers'); - }; - - Red.prototype._verify2 = function _verify2 (a, b) { - assert((a.negative | b.negative) === 0, 'red works only with positives'); - assert(a.red && a.red === b.red, - 'red works only with red numbers'); - }; - - Red.prototype.imod = function imod (a) { - if (this.prime) return this.prime.ireduce(a)._forceRed(this); - return a.umod(this.m)._forceRed(this); - }; - - Red.prototype.neg = function neg (a) { - if (a.isZero()) { - return a.clone(); - } - - return this.m.sub(a)._forceRed(this); - }; - - Red.prototype.add = function add (a, b) { - this._verify2(a, b); - - var res = a.add(b); - if (res.cmp(this.m) >= 0) { - res.isub(this.m); - } - return res._forceRed(this); - }; - - Red.prototype.iadd = function iadd (a, b) { - this._verify2(a, b); - - var res = a.iadd(b); - if (res.cmp(this.m) >= 0) { - res.isub(this.m); - } - return res; - }; - - Red.prototype.sub = function sub (a, b) { - this._verify2(a, b); - - var res = a.sub(b); - if (res.cmpn(0) < 0) { - res.iadd(this.m); - } - return res._forceRed(this); - }; - - Red.prototype.isub = function isub (a, b) { - this._verify2(a, b); - - var res = a.isub(b); - if (res.cmpn(0) < 0) { - res.iadd(this.m); - } - return res; - }; - - Red.prototype.shl = function shl (a, num) { - this._verify1(a); - return this.imod(a.ushln(num)); - }; - - Red.prototype.imul = function imul (a, b) { - this._verify2(a, b); - return this.imod(a.imul(b)); - }; - - Red.prototype.mul = function mul (a, b) { - this._verify2(a, b); - return this.imod(a.mul(b)); - }; - - Red.prototype.isqr = function isqr (a) { - return this.imul(a, a.clone()); - }; - - Red.prototype.sqr = function sqr (a) { - return this.mul(a, a); - }; - - Red.prototype.sqrt = function sqrt (a) { - if (a.isZero()) return a.clone(); - - var mod3 = this.m.andln(3); - assert(mod3 % 2 === 1); - - // Fast case - if (mod3 === 3) { - var pow = this.m.add(new BN(1)).iushrn(2); - return this.pow(a, pow); - } - - // Tonelli-Shanks algorithm (Totally unoptimized and slow) - // - // Find Q and S, that Q * 2 ^ S = (P - 1) - var q = this.m.subn(1); - var s = 0; - while (!q.isZero() && q.andln(1) === 0) { - s++; - q.iushrn(1); - } - assert(!q.isZero()); - - var one = new BN(1).toRed(this); - var nOne = one.redNeg(); - - // Find quadratic non-residue - // NOTE: Max is such because of generalized Riemann hypothesis. - var lpow = this.m.subn(1).iushrn(1); - var z = this.m.bitLength(); - z = new BN(2 * z * z).toRed(this); - - while (this.pow(z, lpow).cmp(nOne) !== 0) { - z.redIAdd(nOne); - } - - var c = this.pow(z, q); - var r = this.pow(a, q.addn(1).iushrn(1)); - var t = this.pow(a, q); - var m = s; - while (t.cmp(one) !== 0) { - var tmp = t; - for (var i = 0; tmp.cmp(one) !== 0; i++) { - tmp = tmp.redSqr(); - } - assert(i < m); - var b = this.pow(c, new BN(1).iushln(m - i - 1)); - - r = r.redMul(b); - c = b.redSqr(); - t = t.redMul(c); - m = i; - } - - return r; - }; - - Red.prototype.invm = function invm (a) { - var inv = a._invmp(this.m); - if (inv.negative !== 0) { - inv.negative = 0; - return this.imod(inv).redNeg(); - } else { - return this.imod(inv); - } - }; - - Red.prototype.pow = function pow (a, num) { - if (num.isZero()) return new BN(1).toRed(this); - if (num.cmpn(1) === 0) return a.clone(); - - var windowSize = 4; - var wnd = new Array(1 << windowSize); - wnd[0] = new BN(1).toRed(this); - wnd[1] = a; - for (var i = 2; i < wnd.length; i++) { - wnd[i] = this.mul(wnd[i - 1], a); - } - - var res = wnd[0]; - var current = 0; - var currentLen = 0; - var start = num.bitLength() % 26; - if (start === 0) { - start = 26; - } - - for (i = num.length - 1; i >= 0; i--) { - var word = num.words[i]; - for (var j = start - 1; j >= 0; j--) { - var bit = (word >> j) & 1; - if (res !== wnd[0]) { - res = this.sqr(res); - } - - if (bit === 0 && current === 0) { - currentLen = 0; - continue; - } - - current <<= 1; - current |= bit; - currentLen++; - if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; - - res = this.mul(res, wnd[current]); - currentLen = 0; - current = 0; - } - start = 26; - } - - return res; - }; - - Red.prototype.convertTo = function convertTo (num) { - var r = num.umod(this.m); - - return r === num ? r.clone() : r; - }; - - Red.prototype.convertFrom = function convertFrom (num) { - var res = num.clone(); - res.red = null; - return res; - }; - - // - // Montgomery method engine - // - - BN.mont = function mont (num) { - return new Mont(num); - }; - - function Mont (m) { - Red.call(this, m); - - this.shift = this.m.bitLength(); - if (this.shift % 26 !== 0) { - this.shift += 26 - (this.shift % 26); - } - - this.r = new BN(1).iushln(this.shift); - this.r2 = this.imod(this.r.sqr()); - this.rinv = this.r._invmp(this.m); - - this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); - this.minv = this.minv.umod(this.r); - this.minv = this.r.sub(this.minv); + 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); } - inherits(Mont, Red); - - Mont.prototype.convertTo = function convertTo (num) { - return this.imod(num.ushln(this.shift)); - }; - - Mont.prototype.convertFrom = function convertFrom (num) { - var r = this.imod(num.mul(this.rinv)); - r.red = null; - return r; - }; - - Mont.prototype.imul = function imul (a, b) { - if (a.isZero() || b.isZero()) { - a.words[0] = 0; - a.length = 1; - return a; - } - - var t = a.imul(b); - var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); - var u = t.isub(c).iushrn(this.shift); - var res = u; - - if (u.cmp(this.m) >= 0) { - res = u.isub(this.m); - } else if (u.cmpn(0) < 0) { - res = u.iadd(this.m); - } - - return res._forceRed(this); + var d3_lab_K = 18; + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; + var d3_labPrototype = d3_lab.prototype = new d3_color(); + d3_labPrototype.brighter = function(k) { + return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); }; - - Mont.prototype.mul = function mul (a, b) { - if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); - - var t = a.mul(b); - var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); - var u = t.isub(c).iushrn(this.shift); - var res = u; - if (u.cmp(this.m) >= 0) { - res = u.isub(this.m); - } else if (u.cmpn(0) < 0) { - res = u.iadd(this.m); - } - - return res._forceRed(this); + 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); }; - - Mont.prototype.invm = function invm (a) { - // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R - var res = this.imod(a._invmp(this.m).mul(this.r2)); - return res._forceRed(this); + d3_labPrototype.rgb = function() { + return d3_lab_rgb(this.l, this.a, this.b); }; -})(typeof module === 'undefined' || module, this); - -},{"buffer":91}],83:[function(_dereq_,module,exports){ -'use strict' - -module.exports = boundary - -function boundary (cells) { - var i, j, k - var n = cells.length - var sz = 0 - for (i = 0; i < n; ++i) { - sz += cells[i].length - } - var result = new Array(sz) - var ptr = 0 - for (i = 0; i < n; ++i) { - var c = cells[i] - var d = c.length - for (j = 0; j < d; ++j) { - var b = result[ptr++] = new Array(d - 1) - var p = 0 - for (k = 0; k < d; ++k) { - if (k === j) { - continue - } - b[p++] = c[k] - } - if (j & 1) { - var tmp = b[1] - b[1] = b[0] - b[0] = tmp - } - } - } - return result -} - -},{}],84:[function(_dereq_,module,exports){ -'use strict' - -module.exports = boxIntersectWrapper - -var pool = _dereq_('typedarray-pool') -var sweep = _dereq_('./lib/sweep') -var boxIntersectIter = _dereq_('./lib/intersect') - -function boxEmpty(d, box) { - for(var j=0; j>>1 - if(d <= 0) { - return - } - - var retval - - //Convert red boxes - var redList = pool.mallocDouble(2*d*n) - var redIds = pool.mallocInt32(n) - n = convertBoxes(red, d, redList, redIds) - - if(n > 0) { - if(d === 1 && full) { - //Special case: 1d complete - sweep.init(n) - retval = sweep.sweepComplete( - d, visit, - 0, n, redList, redIds, - 0, n, redList, redIds) - } else { - - //Convert blue boxes - var blueList = pool.mallocDouble(2*d*m) - var blueIds = pool.mallocInt32(m) - m = convertBoxes(blue, d, blueList, blueIds) - - if(m > 0) { - sweep.init(n+m) - - if(d === 1) { - //Special case: 1d bipartite - retval = sweep.sweepBipartite( - d, visit, - 0, n, redList, redIds, - 0, m, blueList, blueIds) - } else { - //General case: d>1 - retval = boxIntersectIter( - d, visit, full, - n, redList, redIds, - m, blueList, blueIds) - } - - pool.free(blueList) - pool.free(blueIds) - } - } - - pool.free(redList) - pool.free(redIds) + 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 - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); } - - return retval -} - - -var RESULT - -function appendItem(i,j) { - RESULT.push([i,j]) -} - -function intersectFullArray(x) { - RESULT = [] - boxIntersect(x, x, appendItem, true) - return RESULT -} - -function intersectBipartiteArray(x, y) { - RESULT = [] - boxIntersect(x, y, appendItem, false) - return RESULT -} - -//User-friendly wrapper, handle full input and no-visitor cases -function boxIntersectWrapper(arg0, arg1, arg2) { - var result - switch(arguments.length) { - case 1: - return intersectFullArray(arg0) - case 2: - if(typeof arg1 === 'function') { - return boxIntersect(arg0, arg0, arg1, true) - } else { - return intersectBipartiteArray(arg0, arg1) - } - case 3: - return boxIntersect(arg0, arg1, arg2, false) - default: - throw new Error('box-intersect: Invalid arguments') + 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); } -} -},{"./lib/intersect":86,"./lib/sweep":90,"typedarray-pool":522}],85:[function(_dereq_,module,exports){ -'use strict' - -var DIMENSION = 'd' -var AXIS = 'ax' -var VISIT = 'vv' -var FLIP = 'fp' - -var ELEM_SIZE = 'es' - -var RED_START = 'rs' -var RED_END = 're' -var RED_BOXES = 'rb' -var RED_INDEX = 'ri' -var RED_PTR = 'rp' - -var BLUE_START = 'bs' -var BLUE_END = 'be' -var BLUE_BOXES = 'bb' -var BLUE_INDEX = 'bi' -var BLUE_PTR = 'bp' - -var RETVAL = 'rv' - -var INNER_LABEL = 'Q' - -var ARGS = [ - DIMENSION, - AXIS, - VISIT, - RED_START, - RED_END, - RED_BOXES, - RED_INDEX, - BLUE_START, - BLUE_END, - BLUE_BOXES, - BLUE_INDEX -] - -function generateBruteForce(redMajor, flip, full) { - var funcName = 'bruteForce' + - (redMajor ? 'Red' : 'Blue') + - (flip ? 'Flip' : '') + - (full ? 'Full' : '') - - var code = ['function ', funcName, '(', ARGS.join(), '){', - 'var ', ELEM_SIZE, '=2*', DIMENSION, ';'] - - var redLoop = - 'for(var i=' + RED_START + ',' + RED_PTR + '=' + ELEM_SIZE + '*' + RED_START + ';' + - 'i<' + RED_END +';' + - '++i,' + RED_PTR + '+=' + ELEM_SIZE + '){' + - 'var x0=' + RED_BOXES + '[' + AXIS + '+' + RED_PTR + '],' + - 'x1=' + RED_BOXES + '[' + AXIS + '+' + RED_PTR + '+' + DIMENSION + '],' + - 'xi=' + RED_INDEX + '[i];' - - var blueLoop = - 'for(var j=' + BLUE_START + ',' + BLUE_PTR + '=' + ELEM_SIZE + '*' + BLUE_START + ';' + - 'j<' + BLUE_END + ';' + - '++j,' + BLUE_PTR + '+=' + ELEM_SIZE + '){' + - 'var y0=' + BLUE_BOXES + '[' + AXIS + '+' + BLUE_PTR + '],' + - (full ? 'y1=' + BLUE_BOXES + '[' + AXIS + '+' + BLUE_PTR + '+' + DIMENSION + '],' : '') + - 'yi=' + BLUE_INDEX + '[j];' - - if(redMajor) { - code.push(redLoop, INNER_LABEL, ':', blueLoop) - } else { - code.push(blueLoop, INNER_LABEL, ':', redLoop) + function d3_lab_xyz(x) { + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; } - - if(full) { - code.push('if(y1 .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; } - - code.push('for(var k='+AXIS+'+1;k<'+DIMENSION+';++k){'+ - 'var r0='+RED_BOXES+'[k+'+RED_PTR+'],'+ - 'r1='+RED_BOXES+'[k+'+DIMENSION+'+'+RED_PTR+'],'+ - 'b0='+BLUE_BOXES+'[k+'+BLUE_PTR+'],'+ - 'b1='+BLUE_BOXES+'[k+'+DIMENSION+'+'+BLUE_PTR+'];'+ - 'if(r1> 16, value >> 8 & 255, value & 255); } - - var code = ['function ' + funcName + '(' + fargs.join() + '){'] - - function invoke(redMajor, flip) { - var res = generateBruteForce(redMajor, flip, full) - prefix.push(res.code) - code.push('return ' + res.name + '(' + ARGS.join() + ');') + function d3_rgbString(value) { + return d3_rgbNumber(value) + ""; } - - code.push('if(' + RED_END + '-' + RED_START + '>' + - BLUE_END + '-' + BLUE_START + '){') - - if(full) { - invoke(true, false) - code.push('}else{') - invoke(false, false) - } else { - code.push('if(' + FLIP + '){') - invoke(true, true) - code.push('}else{') - invoke(true, false) - code.push('}}else{if(' + FLIP + '){') - invoke(false, true) - code.push('}else{') - invoke(false, false) - code.push('}') - } - code.push('}}return ' + funcName) - - var codeStr = prefix.join('') + code.join('') - var proc = new Function(codeStr) - return proc() -} - - -exports.partial = bruteForcePlanner(false) -exports.full = bruteForcePlanner(true) -},{}],86:[function(_dereq_,module,exports){ -'use strict' - -module.exports = boxIntersectIter - -var pool = _dereq_('typedarray-pool') -var bits = _dereq_('bit-twiddle') -var bruteForce = _dereq_('./brute') -var bruteForcePartial = bruteForce.partial -var bruteForceFull = bruteForce.full -var sweep = _dereq_('./sweep') -var findMedian = _dereq_('./median') -var genPartition = _dereq_('./partition') - -//Twiddle parameters -var BRUTE_FORCE_CUTOFF = 128 //Cut off for brute force search -var SCAN_CUTOFF = (1<<22) //Cut off for two way scan -var SCAN_COMPLETE_CUTOFF = (1<<22) - -//Partition functions -var partitionInteriorContainsInterval = genPartition( - '!(lo>=p0)&&!(p1>=hi)', - ['p0', 'p1']) - -var partitionStartEqual = genPartition( - 'lo===p0', - ['p0']) - -var partitionStartLessThan = genPartition( - 'lo 0) { - top -= 1 - - var iptr = top * IFRAME_SIZE - var axis = BOX_ISTACK[iptr] - var redStart = BOX_ISTACK[iptr+1] - var redEnd = BOX_ISTACK[iptr+2] - var blueStart = BOX_ISTACK[iptr+3] - var blueEnd = BOX_ISTACK[iptr+4] - var state = BOX_ISTACK[iptr+5] - - var dptr = top * DFRAME_SIZE - var lo = BOX_DSTACK[dptr] - var hi = BOX_DSTACK[dptr+1] - - //Unpack state info - var flip = (state & 1) - var full = !!(state & 16) - - //Unpack indices - var red = xBoxes - var redIndex = xIndex - var blue = yBoxes - var blueIndex = yIndex - if(flip) { - red = yBoxes - redIndex = yIndex - blue = xBoxes - blueIndex = xIndex - } - - if(state & 2) { - redEnd = partitionStartLessThan( - d, axis, - redStart, redEnd, red, redIndex, - hi) - if(redStart >= redEnd) { - continue - } - } - if(state & 4) { - redStart = partitionEndLessThanEqual( - d, axis, - redStart, redEnd, red, redIndex, - lo) - if(redStart >= redEnd) { - continue - } - } - - var redCount = redEnd - redStart - var blueCount = blueEnd - blueStart - - if(full) { - if(d * redCount * (redCount + blueCount) < SCAN_COMPLETE_CUTOFF) { - retval = sweep.scanComplete( - d, axis, visit, - redStart, redEnd, red, redIndex, - blueStart, blueEnd, blue, blueIndex) - if(retval !== void 0) { - return retval - } - continue - } - } else { - if(d * Math.min(redCount, blueCount) < BRUTE_FORCE_CUTOFF) { - //If input small, then use brute force - retval = bruteForcePartial( - d, axis, visit, flip, - redStart, redEnd, red, redIndex, - blueStart, blueEnd, blue, blueIndex) - if(retval !== void 0) { - return retval - } - continue - } else if(d * redCount * blueCount < SCAN_CUTOFF) { - //If input medium sized, then use sweep and prune - retval = sweep.scanBipartite( - d, axis, visit, flip, - redStart, redEnd, red, redIndex, - blueStart, blueEnd, blue, blueIndex) - if(retval !== void 0) { - return retval - } - continue - } - } - - //First, find all red intervals whose interior contains (lo,hi) - var red0 = partitionInteriorContainsInterval( - d, axis, - redStart, redEnd, red, redIndex, - lo, hi) - - //Lower dimensional case - if(redStart < red0) { - - if(d * (red0 - redStart) < BRUTE_FORCE_CUTOFF) { - //Special case for small inputs: use brute force - retval = bruteForceFull( - d, axis+1, visit, - redStart, red0, red, redIndex, - blueStart, blueEnd, blue, blueIndex) - if(retval !== void 0) { - return retval - } - } else if(axis === d-2) { - if(flip) { - retval = sweep.sweepBipartite( - d, visit, - blueStart, blueEnd, blue, blueIndex, - redStart, red0, red, redIndex) - } else { - retval = sweep.sweepBipartite( - d, visit, - redStart, red0, red, redIndex, - blueStart, blueEnd, blue, blueIndex) - } - if(retval !== void 0) { - return retval + function d3_rgb_parse(format, rgb, hsl) { + var r = 0, g = 0, b = 0, m1, m2, color; + m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase()); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": + { + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); } - } else { - iterPush(top++, - axis+1, - redStart, red0, - blueStart, blueEnd, - flip, - -Infinity, Infinity) - iterPush(top++, - axis+1, - blueStart, blueEnd, - redStart, red0, - flip^1, - -Infinity, Infinity) - } - } - - //Divide and conquer phase - if(red0 < redEnd) { - - //Cut blue into 3 parts: - // - // Points < mid point - // Points = mid point - // Points > mid point - // - var blue0 = findMedian( - d, axis, - blueStart, blueEnd, blue, blueIndex) - var mid = blue[elemSize * blue0 + axis] - var blue1 = partitionStartEqual( - d, axis, - blue0, blueEnd, blue, blueIndex, - mid) - - //Right case - if(blue1 < blueEnd) { - iterPush(top++, - axis, - red0, redEnd, - blue1, blueEnd, - (flip|4) + (full ? 16 : 0), - mid, hi) - } - - //Left case - if(blueStart < blue0) { - iterPush(top++, - axis, - red0, redEnd, - blueStart, blue0, - (flip|2) + (full ? 16 : 0), - lo, mid) - } - - //Center case (the hard part) - if(blue0 + 1 === blue1) { - //Optimization: Range with exactly 1 point, use a brute force scan - if(full) { - retval = onePointFull( - d, axis, visit, - red0, redEnd, red, redIndex, - blue0, blue, blueIndex[blue0]) - } else { - retval = onePointPartial( - d, axis, visit, flip, - red0, redEnd, red, redIndex, - blue0, blue, blueIndex[blue0]) - } - if(retval !== void 0) { - return retval - } - } else if(blue0 < blue1) { - var red1 - if(full) { - //If full intersection, need to handle special case - red1 = partitionContainsPoint( - d, axis, - red0, redEnd, red, redIndex, - mid) - if(red0 < red1) { - var redX = partitionStartEqual( - d, axis, - red0, red1, red, redIndex, - mid) - if(axis === d-2) { - //Degenerate sweep intersection: - // [red0, redX] with [blue0, blue1] - if(red0 < redX) { - retval = sweep.sweepComplete( - d, visit, - red0, redX, red, redIndex, - blue0, blue1, blue, blueIndex) - if(retval !== void 0) { - return retval - } - } - //Normal sweep intersection: - // [redX, red1] with [blue0, blue1] - if(redX < red1) { - retval = sweep.sweepBipartite( - d, visit, - redX, red1, red, redIndex, - blue0, blue1, blue, blueIndex) - if(retval !== void 0) { - return retval - } - } - } else { - if(red0 < redX) { - iterPush(top++, - axis+1, - red0, redX, - blue0, blue1, - 16, - -Infinity, Infinity) - } - if(redX < red1) { - iterPush(top++, - axis+1, - redX, red1, - blue0, blue1, - 0, - -Infinity, Infinity) - iterPush(top++, - axis+1, - blue0, blue1, - redX, red1, - 1, - -Infinity, Infinity) - } - } - } - } else { - if(flip) { - red1 = partitionContainsPointProper( - d, axis, - red0, redEnd, red, redIndex, - mid) - } else { - red1 = partitionContainsPoint( - d, axis, - red0, redEnd, red, redIndex, - mid) - } - if(red0 < red1) { - if(axis === d-2) { - if(flip) { - retval = sweep.sweepBipartite( - d, visit, - blue0, blue1, blue, blueIndex, - red0, red1, red, redIndex) - } else { - retval = sweep.sweepBipartite( - d, visit, - red0, red1, red, redIndex, - blue0, blue1, blue, blueIndex) - } - } else { - iterPush(top++, - axis+1, - red0, red1, - blue0, blue1, - flip, - -Infinity, Infinity) - iterPush(top++, - axis+1, - blue0, blue1, - red0, red1, - flip^1, - -Infinity, Infinity) - } - } + case "rgb": + { + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); } } } - } -} -},{"./brute":85,"./median":87,"./partition":88,"./sweep":90,"bit-twiddle":80,"typedarray-pool":522}],87:[function(_dereq_,module,exports){ -'use strict' - -module.exports = findMedian - -var genPartition = _dereq_('./partition') - -var partitionStartLessThan = genPartition('lostart && boxes[ptr+axis] > x; - --j, ptr-=elemSize) { - //Swap - var aPtr = ptr - var bPtr = ptr+elemSize - for(var k=0; k>> 1) - var elemSize = 2*d - var pivot = mid - var value = boxes[elemSize*mid+axis] - - while(lo < hi) { - if(hi - lo < PARTITION_THRESHOLD) { - insertionSort(d, axis, lo, hi, boxes, ids) - value = boxes[elemSize*mid+axis] - break - } - - //Select pivot using median-of-3 - var count = hi - lo - var pivot0 = (Math.random()*count+lo)|0 - var value0 = boxes[elemSize*pivot0 + axis] - var pivot1 = (Math.random()*count+lo)|0 - var value1 = boxes[elemSize*pivot1 + axis] - var pivot2 = (Math.random()*count+lo)|0 - var value2 = boxes[elemSize*pivot2 + axis] - if(value0 <= value1) { - if(value2 >= value1) { - pivot = pivot1 - value = value1 - } else if(value0 >= value2) { - pivot = pivot0 - value = value0 - } else { - pivot = pivot2 - value = value2 - } - } else { - if(value1 >= value2) { - pivot = pivot1 - value = value1 - } else if(value2 >= value0) { - pivot = pivot0 - value = value0 - } else { - pivot = pivot2 - value = value2 - } + if (color = d3_rgb_names.get(format)) { + return rgb(color.r, color.g, color.b); } - - //Swap pivot to end of array - var aPtr = elemSize * (hi-1) - var bPtr = elemSize * pivot - for(var i=0; i> 4; + r = r >> 4 | r; + g = color & 240; + g = g >> 4 | g; + b = color & 15; + b = b << 4 | b; + } else if (format.length === 7) { + r = (color & 16711680) >> 16; + g = (color & 65280) >> 8; + b = color & 255; } - } else { - break } + return rgb(r, g, b); } - - //Make sure pivot is at start - return partitionStartLessThan( - d, axis, - start, mid, boxes, ids, - boxes[elemSize*mid+axis]) -} -},{"./partition":88}],88:[function(_dereq_,module,exports){ -'use strict' - -module.exports = genPartition - -var code = 'for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m' - -function genPartition(predicate, args) { - var fargs ='abcdef'.split('').concat(args) - var reads = [] - if(predicate.indexOf('lo') >= 0) { - reads.push('lo=e[k+n]') - } - if(predicate.indexOf('hi') >= 0) { - reads.push('hi=e[k+o]') - } - fargs.push( - code.replace('_', reads.join()) - .replace('$', predicate)) - return Function.apply(void 0, fargs) -} -},{}],89:[function(_dereq_,module,exports){ -'use strict'; - -//This code is extracted from ndarray-sort -//It is inlined here as a temporary workaround - -module.exports = wrapper; - -var INSERT_SORT_CUTOFF = 32 - -function wrapper(data, n0) { - if (n0 <= 4*INSERT_SORT_CUTOFF) { - insertionSort(0, n0 - 1, data); - } else { - quickSort(0, n0 - 1, data); - } -} - -function insertionSort(left, right, data) { - var ptr = 2*(left+1) - for(var i=left+1; i<=right; ++i) { - var a = data[ptr++] - var b = data[ptr++] - var j = i - var jptr = ptr-2 - while(j-- > left) { - var x = data[jptr-2] - var y = data[jptr-1] - if(x < a) { - break - } else if(x === a && y < b) { - break - } - data[jptr] = x - data[jptr+1] = y - jptr -= 2 - } - data[jptr] = a - data[jptr+1] = b - } -} - -function swap(i, j, data) { - i *= 2 - j *= 2 - var x = data[i] - var y = data[i+1] - data[i] = data[j] - data[i+1] = data[j+1] - data[j] = x - data[j+1] = y -} - -function move(i, j, data) { - i *= 2 - j *= 2 - data[i] = data[j] - data[i+1] = data[j+1] -} - -function rotate(i, j, k, data) { - i *= 2 - j *= 2 - k *= 2 - var x = data[i] - var y = data[i+1] - data[i] = data[j] - data[i+1] = data[j+1] - data[j] = data[k] - data[j+1] = data[k+1] - data[k] = x - data[k+1] = y -} - -function shufflePivot(i, j, px, py, data) { - i *= 2 - j *= 2 - data[i] = data[j] - data[j] = px - data[i+1] = data[j+1] - data[j+1] = py -} - -function compare(i, j, data) { - i *= 2 - j *= 2 - var x = data[i], - y = data[j] - if(x < y) { - return false - } else if(x === y) { - return data[i+1] > data[j+1] - } - return true -} - -function comparePivot(i, y, b, data) { - i *= 2 - var x = data[i] - if(x < y) { - return true - } else if(x === y) { - return data[i+1] < b - } - return false -} - -function quickSort(left, right, data) { - var sixth = (right - left + 1) / 6 | 0, - index1 = left + sixth, - index5 = right - sixth, - index3 = left + right >> 1, - index2 = index3 - sixth, - index4 = index3 + sixth, - el1 = index1, - el2 = index2, - el3 = index3, - el4 = index4, - el5 = index5, - less = left + 1, - great = right - 1, - tmp = 0 - if(compare(el1, el2, data)) { - tmp = el1 - el1 = el2 - el2 = tmp - } - if(compare(el4, el5, data)) { - tmp = el4 - el4 = el5 - el5 = tmp - } - if(compare(el1, el3, data)) { - tmp = el1 - el1 = el3 - el3 = tmp - } - if(compare(el2, el3, data)) { - tmp = el2 - el2 = el3 - el3 = tmp - } - if(compare(el1, el4, data)) { - tmp = el1 - el1 = el4 - el4 = tmp - } - if(compare(el3, el4, data)) { - tmp = el3 - el3 = el4 - el4 = tmp - } - if(compare(el2, el5, data)) { - tmp = el2 - el2 = el5 - el5 = tmp - } - if(compare(el2, el3, data)) { - tmp = el2 - el2 = el3 - el3 = tmp - } - if(compare(el4, el5, data)) { - tmp = el4 - el4 = el5 - el5 = tmp - } - - var pivot1X = data[2*el2] - var pivot1Y = data[2*el2+1] - var pivot2X = data[2*el4] - var pivot2Y = data[2*el4+1] - - var ptr0 = 2 * el1; - var ptr2 = 2 * el3; - var ptr4 = 2 * el5; - var ptr5 = 2 * index1; - var ptr6 = 2 * index3; - var ptr7 = 2 * index5; - for (var i1 = 0; i1 < 2; ++i1) { - var x = data[ptr0+i1]; - var y = data[ptr2+i1]; - var z = data[ptr4+i1]; - data[ptr5+i1] = x; - data[ptr6+i1] = y; - data[ptr7+i1] = z; - } - - move(index2, left, data) - move(index4, right, data) - for (var k = less; k <= great; ++k) { - if (comparePivot(k, pivot1X, pivot1Y, data)) { - if (k !== less) { - swap(k, less, data) - } - ++less; + function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; + h *= 60; } else { - if (!comparePivot(k, pivot2X, pivot2Y, data)) { - while (true) { - if (!comparePivot(great, pivot2X, pivot2Y, data)) { - if (--great < k) { - break; - } - continue; - } else { - if (comparePivot(great, pivot1X, pivot1Y, data)) { - rotate(k, less, great, data) - ++less; - --great; - } else { - swap(k, great, data) - --great; - } - break; - } - } - } + h = NaN; + s = l > 0 && l < 1 ? 0 : h; } + return new d3_hsl(h, s, l); } - shufflePivot(left, less-1, pivot1X, pivot1Y, data) - shufflePivot(right, great+1, pivot2X, pivot2Y, data) - if (less - 2 - left <= INSERT_SORT_CUTOFF) { - insertionSort(left, less - 2, data); - } else { - quickSort(left, less - 2, data); - } - if (right - (great + 2) <= INSERT_SORT_CUTOFF) { - insertionSort(great + 2, right, data); - } else { - quickSort(great + 2, right, data); + function d3_rgb_lab(r, g, b) { + r = d3_rgb_xyz(r); + g = d3_rgb_xyz(g); + b = d3_rgb_xyz(b); + var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); } - if (great - less <= INSERT_SORT_CUTOFF) { - insertionSort(less, great, data); - } else { - quickSort(less, great, data); + function d3_rgb_xyz(r) { + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); } -} -},{}],90:[function(_dereq_,module,exports){ -'use strict' - -module.exports = { - init: sqInit, - sweepBipartite: sweepBipartite, - sweepComplete: sweepComplete, - scanBipartite: scanBipartite, - scanComplete: scanComplete -} - -var pool = _dereq_('typedarray-pool') -var bits = _dereq_('bit-twiddle') -var isort = _dereq_('./sort') - -//Flag for blue -var BLUE_FLAG = (1<<28) - -//1D sweep event queue stuff (use pool to save space) -var INIT_CAPACITY = 1024 -var RED_SWEEP_QUEUE = pool.mallocInt32(INIT_CAPACITY) -var RED_SWEEP_INDEX = pool.mallocInt32(INIT_CAPACITY) -var BLUE_SWEEP_QUEUE = pool.mallocInt32(INIT_CAPACITY) -var BLUE_SWEEP_INDEX = pool.mallocInt32(INIT_CAPACITY) -var COMMON_SWEEP_QUEUE = pool.mallocInt32(INIT_CAPACITY) -var COMMON_SWEEP_INDEX = pool.mallocInt32(INIT_CAPACITY) -var SWEEP_EVENTS = pool.mallocDouble(INIT_CAPACITY * 8) - -//Reserves memory for the 1D sweep data structures -function sqInit(count) { - var rcount = bits.nextPow2(count) - if(RED_SWEEP_QUEUE.length < rcount) { - pool.free(RED_SWEEP_QUEUE) - RED_SWEEP_QUEUE = pool.mallocInt32(rcount) - } - if(RED_SWEEP_INDEX.length < rcount) { - pool.free(RED_SWEEP_INDEX) - RED_SWEEP_INDEX = pool.mallocInt32(rcount) - } - if(BLUE_SWEEP_QUEUE.length < rcount) { - pool.free(BLUE_SWEEP_QUEUE) - BLUE_SWEEP_QUEUE = pool.mallocInt32(rcount) - } - if(BLUE_SWEEP_INDEX.length < rcount) { - pool.free(BLUE_SWEEP_INDEX) - BLUE_SWEEP_INDEX = pool.mallocInt32(rcount) - } - if(COMMON_SWEEP_QUEUE.length < rcount) { - pool.free(COMMON_SWEEP_QUEUE) - COMMON_SWEEP_QUEUE = pool.mallocInt32(rcount) - } - if(COMMON_SWEEP_INDEX.length < rcount) { - pool.free(COMMON_SWEEP_INDEX) - COMMON_SWEEP_INDEX = pool.mallocInt32(rcount) - } - var eventLength = 8 * rcount - if(SWEEP_EVENTS.length < eventLength) { - pool.free(SWEEP_EVENTS) - SWEEP_EVENTS = pool.mallocDouble(eventLength) - } -} - -//Remove an item from the active queue in O(1) -function sqPop(queue, index, count, item) { - var idx = index[item] - var top = queue[count-1] - queue[idx] = top - index[top] = idx -} - -//Insert an item into the active queue in O(1) -function sqPush(queue, index, count, item) { - queue[count] = item - index[item] = count -} - -//Recursion base case: use 1D sweep algorithm -function sweepBipartite( - d, visit, - redStart, redEnd, red, redIndex, - blueStart, blueEnd, blue, blueIndex) { - - //store events as pairs [coordinate, idx] - // - // red create: -(idx+1) - // red destroy: idx - // blue create: -(idx+BLUE_FLAG) - // blue destroy: idx+BLUE_FLAG - // - var ptr = 0 - var elemSize = 2*d - var istart = d-1 - var iend = elemSize-1 - - for(var i=redStart; iright - var n = ptr >>> 1 - isort(SWEEP_EVENTS, n) - - var redActive = 0 - var blueActive = 0 - for(var i=0; i= BLUE_FLAG) { - //blue destroy event - e = (e-BLUE_FLAG)|0 - sqPop(BLUE_SWEEP_QUEUE, BLUE_SWEEP_INDEX, blueActive--, e) - } else if(e >= 0) { - //red destroy event - sqPop(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive--, e) - } else if(e <= -BLUE_FLAG) { - //blue create event - e = (-e-BLUE_FLAG)|0 - for(var j=0; jright - var n = ptr >>> 1 - isort(SWEEP_EVENTS, n) - - var redActive = 0 - var blueActive = 0 - var commonActive = 0 - for(var i=0; i>1) === (SWEEP_EVENTS[2*i+3]>>1)) { - color = 2 - i += 1 - } - - if(e < 0) { - //Create event - var id = -(e>>1) - 1 - - //Intersect with common - for(var j=0; j 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); } - - if(color !== 0) { - //Intersect with red - for(var j=0; j= 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); } - - if(color !== 1) { - //Intersect with blue - for(var j=0; j 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); } + d3_timer_interval = 0; } else { - //Destroy event - var id = (e>>1) - 1 - if(color === 0) { - //Red - sqPop(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive--, id) - } else if(color === 1) { - //Blue - sqPop(BLUE_SWEEP_QUEUE, BLUE_SWEEP_INDEX, blueActive--, id) - } else if(color === 2) { - //Both - sqPop(COMMON_SWEEP_QUEUE, COMMON_SWEEP_INDEX, commonActive--, id) - } + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); } } -} - -//Sweep and prune/scanline algorithm: -// Scan along axis, detect intersections -// Brute force all boxes along axis -function scanBipartite( - d, axis, visit, flip, - redStart, redEnd, red, redIndex, - blueStart, blueEnd, blue, blueIndex) { - - var ptr = 0 - var elemSize = 2*d - var istart = axis - var iend = axis+d - - var redShift = 1 - var blueShift = 1 - if(flip) { - blueShift = BLUE_FLAG - } else { - redShift = BLUE_FLAG + 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; } - - for(var i=redStart; iright - var n = ptr >>> 1 - isort(SWEEP_EVENTS, n) - - var redActive = 0 - for(var i=0; i= BLUE_FLAG) { - isRed = !flip - idx -= BLUE_FLAG - } else { - isRed = !!flip - idx -= 1 - } - if(isRed) { - sqPush(RED_SWEEP_QUEUE, RED_SWEEP_INDEX, redActive++, idx) + function d3_timer_sweep() { + var t0, t1 = d3_timer_queueHead, time = Infinity; + while (t1) { + if (t1.c) { + if (t1.t < time) time = t1.t; + t1 = (t0 = t1).n; } else { - var blueId = blueIndex[idx] - var bluePtr = elemSize * idx - - var b0 = blue[bluePtr+axis+1] - var b1 = blue[bluePtr+axis+1+d] - -red_loop: - for(var j=0; j 8 ? function(d) { + return d / k; + } : function(d) { + return d * k; + }, + symbol: d + }; } + function d3_locale_numberFormat(locale) { + var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) { + var i = value.length, t = [], j = 0, g = locale_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 = locale_grouping[j = (j + 1) % locale_grouping.length]; + } + return t.reverse().join(locale_thousands); + } : d3_identity; + return function(specifier) { + var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true; + if (precision) precision = +precision.substring(1); + if (zfill || fill === "0" && align === "=") { + zfill = fill = "0"; + align = "="; + } + switch (type) { + case "n": + comma = true; + type = "g"; + break; - //process events from left->right - var n = ptr >>> 1 - isort(SWEEP_EVENTS, n) - - var redActive = 0 - for(var i=0; i= BLUE_FLAG) { - RED_SWEEP_QUEUE[redActive++] = idx - BLUE_FLAG - } else { - idx -= 1 - var blueId = blueIndex[idx] - var bluePtr = elemSize * idx - - var b0 = blue[bluePtr+axis+1] - var b1 = blue[bluePtr+axis+1+d] - -red_loop: - for(var j=0; j=0; --j) { - if(RED_SWEEP_QUEUE[j] === idx) { - for(var k=j+1; k" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix; + }; + }; } - - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; + var d3_format_types = d3.map({ + b: function(x) { + return x.toString(2); }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; + c: function(x) { + return String.fromCharCode(x); + }, + o: function(x) { + return x.toString(8); + }, + x: function(x) { + return x.toString(16); + }, + X: function(x) { + return x.toString(16).toUpperCase(); + }, + g: function(x, p) { + return x.toPrecision(p); + }, + e: function(x, p) { + return x.toExponential(p); + }, + f: function(x, p) { + return x.toFixed(p); + }, + r: function(x, p) { + return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); } }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; -} - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); - this._maxListeners = n; - return this; -}; - -function $getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); + function d3_format_typeDefault(x) { + return x + ""; } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); + var d3_time = d3.time = {}, d3_date = Date; + function d3_date_utc() { + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); } -} - -EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; - var doError = (type === 'error'); - - events = this._events; - if (events) - doError = (doError && events.error == null); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - if (arguments.length > 1) - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; + d3_date_utc.prototype = { + getDate: function() { + return this._.getUTCDate(); + }, + getDay: function() { + return this._.getUTCDay(); + }, + getFullYear: function() { + return this._.getUTCFullYear(); + }, + getHours: function() { + return this._.getUTCHours(); + }, + getMilliseconds: function() { + return this._.getUTCMilliseconds(); + }, + getMinutes: function() { + return this._.getUTCMinutes(); + }, + getMonth: function() { + return this._.getUTCMonth(); + }, + getSeconds: function() { + return this._.getUTCSeconds(); + }, + getTime: function() { + return this._.getTime(); + }, + getTimezoneOffset: function() { + return 0; + }, + valueOf: function() { + return this._.valueOf(); + }, + setDate: function() { + d3_time_prototype.setUTCDate.apply(this._, arguments); + }, + setDay: function() { + d3_time_prototype.setUTCDay.apply(this._, arguments); + }, + setFullYear: function() { + d3_time_prototype.setUTCFullYear.apply(this._, arguments); + }, + setHours: function() { + d3_time_prototype.setUTCHours.apply(this._, arguments); + }, + setMilliseconds: function() { + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); + }, + setMinutes: function() { + d3_time_prototype.setUTCMinutes.apply(this._, arguments); + }, + setMonth: function() { + d3_time_prototype.setUTCMonth.apply(this._, arguments); + }, + setSeconds: function() { + d3_time_prototype.setUTCSeconds.apply(this._, arguments); + }, + setTime: function() { + d3_time_prototype.setTime.apply(this._, arguments); } - return false; - } - - handler = events[type]; - - if (!handler) - return false; - - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = target._events; - if (!events) { - events = target._events = objectCreate(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; + }; + var d3_time_prototype = Date.prototype; + function d3_time_interval(local, step, number) { + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; } - existing = events[type]; - } - - if (!existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { - // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); + function ceil(date) { + step(date = local(new d3_date(date - 1)), 1); + return date; + } + function offset(date, k) { + step(date = new d3_date(+date), k); + return date; + } + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } } else { - existing.push(listener); + while (time < t1) times.push(new Date(+time)), step(time, 1); } + return times; } - - // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - 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; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } + function range_utc(t0, t1, dt) { + try { + d3_date = d3_date_utc; + var utc = new d3_date_utc(); + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_date = Date; } } + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + return local; } - - 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 d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_date = d3_date_utc; + var utc = new d3_date_utc(); + utc._ = date; + return method(utc, k)._; + } finally { + d3_date = Date; + } }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - switch (arguments.length) { - case 0: - return this.listener.call(this.target); - case 1: - return this.listener.call(this.target, arguments[0]); - case 2: - return this.listener.call(this.target, arguments[0], arguments[1]); - case 3: - return this.listener.call(this.target, arguments[0], arguments[1], - arguments[2]); - default: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = this._events; - if (!events) - return this; - - list = events[type]; - if (!list) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = objectCreate(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; + d3_time.year = d3_time_interval(function(date) { + date = d3_time.day(date); + date.setMonth(0, 1); + return date; + }, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); + }, function(date) { + return date.getFullYear(); + }); + d3_time.years = d3_time.year.range; + d3_time.years.utc = d3_time.year.utc.range; + d3_time.day = d3_time_interval(function(date) { + var day = new d3_date(2e3, 0); + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + return day; + }, function(date, offset) { + date.setDate(date.getDate() + offset); + }, function(date) { + return date.getDate() - 1; + }); + d3_time.days = d3_time.day.range; + d3_time.days.utc = d3_time.day.utc.range; + d3_time.dayOfYear = function(date) { + var year = d3_time.year(date); + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + }; + [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { + i = 7 - i; + var interval = d3_time[day] = d3_time_interval(function(date) { + (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3_time.year(date).getDay(); + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + d3_time[day + "s"] = interval.range; + d3_time[day + "s"].utc = interval.utc.range; + d3_time[day + "OfYear"] = function(date) { + var day = d3_time.year(date).getDay(); + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); + }; + }); + d3_time.week = d3_time.sunday; + d3_time.weeks = d3_time.sunday.range; + d3_time.weeks.utc = d3_time.sunday.utc.range; + d3_time.weekOfYear = d3_time.sundayOfYear; + function d3_locale_timeFormat(locale) { + var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; + function d3_time_format(template) { + var n = template.length; + function format(date) { + var string = [], i = -1, j = 0, c, p, f; + while (++i < n) { + if (template.charCodeAt(i) === 37) { + string.push(template.slice(j, i)); + if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); + if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); + string.push(c); + j = i + 1; } } - - 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) - this.emit('removeListener', type, originalListener || listener); + string.push(template.slice(j, i)); + return string.join(""); } - - return this; - }; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (!events) - return this; - - // not listening for removeListener, no need to emit - if (!events.removeListener) { - if (arguments.length === 0) { - this._events = objectCreate(null); - this._eventsCount = 0; - } else if (events[type]) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else - delete events[type]; + format.parse = function(string) { + var d = { + y: 1900, + m: 0, + d: 1, + H: 0, + M: 0, + S: 0, + L: 0, + Z: null + }, i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); + if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "W" in d ? 1 : 0; + date.setFullYear(d.y, 0, 1); + date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7); + } else date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L); + return localZ ? date._ : date; + }; + format.toString = function() { + return template; + }; + return format; + } + function d3_time_parse(date, template, string, j) { + var c, p, t, i = 0, n = template.length, m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c === 37) { + t = template.charAt(i++); + p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; + if (!p || (j = p(date, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; } - return this; } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = objectKeys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); + return j; + } + d3_time_format.utc = function(template) { + var local = d3_time_format(template); + function format(date) { + try { + d3_date = d3_date_utc; + var utc = new d3_date(); + utc._ = date; + return local(utc); + } finally { + d3_date = Date; } - this.removeAllListeners('removeListener'); - this._events = objectCreate(null); - this._eventsCount = 0; - return this; } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); + format.parse = function(string) { + try { + d3_date = d3_date_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_date = Date; } + }; + format.toString = local.toString; + return format; + }; + d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; + var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths); + locale_periods.forEach(function(p, i) { + d3_time_periodLookup.set(p.toLowerCase(), i); + }); + var d3_time_formats = { + a: function(d) { + return locale_shortDays[d.getDay()]; + }, + A: function(d) { + return locale_days[d.getDay()]; + }, + b: function(d) { + return locale_shortMonths[d.getMonth()]; + }, + B: function(d) { + return locale_months[d.getMonth()]; + }, + c: d3_time_format(locale_dateTime), + d: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + e: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + H: function(d, p) { + return d3_time_formatPad(d.getHours(), p, 2); + }, + I: function(d, p) { + return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); + }, + j: function(d, p) { + return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); + }, + L: function(d, p) { + return d3_time_formatPad(d.getMilliseconds(), p, 3); + }, + m: function(d, p) { + return d3_time_formatPad(d.getMonth() + 1, p, 2); + }, + M: function(d, p) { + return d3_time_formatPad(d.getMinutes(), p, 2); + }, + p: function(d) { + return locale_periods[+(d.getHours() >= 12)]; + }, + S: function(d, p) { + return d3_time_formatPad(d.getSeconds(), p, 2); + }, + U: function(d, p) { + return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); + }, + w: function(d) { + return d.getDay(); + }, + W: function(d, p) { + return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); + }, + x: d3_time_format(locale_date), + X: d3_time_format(locale_time), + y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 100, p, 2); + }, + Y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); + }, + Z: d3_time_zone, + "%": function() { + return "%"; } - - return this; }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (!events) - return []; - - var evlistener = events[type]; - if (!evlistener) - 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) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener) { - return evlistener.length; + var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + j: d3_time_parseDayOfYear, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + U: d3_time_parseWeekNumberSunday, + w: d3_time_parseWeekdayNumber, + W: d3_time_parseWeekNumberMonday, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear, + Z: d3_time_parseZone, + "%": d3_time_parseLiteralPercent + }; + function d3_time_parseWeekdayAbbrev(date, string, i) { + d3_time_dayAbbrevRe.lastIndex = 0; + var n = d3_time_dayAbbrevRe.exec(string.slice(i)); + return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } + function d3_time_parseWeekday(date, string, i) { + d3_time_dayRe.lastIndex = 0; + var n = d3_time_dayRe.exec(string.slice(i)); + return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseMonthAbbrev(date, string, i) { + d3_time_monthAbbrevRe.lastIndex = 0; + var n = d3_time_monthAbbrevRe.exec(string.slice(i)); + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.slice(i)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + } + function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + } + function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + } + function d3_time_parseAmPm(date, string, i) { + var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); + } + return d3_time_format; } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; -}; - -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -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 objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); + var d3_time_formatPads = { + "-": "", + _: " ", + "0": "0" + }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; + function d3_time_formatPad(value, fill, width) { + var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; -} - -},{}],93:[function(_dereq_,module,exports){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = _dereq_('base64-js') -var ieee754 = _dereq_('ieee754') - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 - } catch (e) { - return false + function d3_time_formatRe(names) { + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer + function d3_time_formatLookup(names) { + var map = new d3_Map(), i = -1, n = names.length; + while (++i < n) map.set(names[i].toLowerCase(), i); + return map; } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset + function d3_time_parseWeekdayNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 1)); + return n ? (date.w = +n[0], i + n[0].length) : -1; } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') + function d3_time_parseWeekNumberSunday(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i)); + return n ? (date.U = +n[0], i + n[0].length) : -1; } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - buf.__proto__ = Buffer.prototype - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) + function d3_time_parseWeekNumberMonday(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i)); + return n ? (date.W = +n[0], i + n[0].length) : -1; } - return from(arg, encodingOrOffset, length) -} - -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) + function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 4)); + return n ? (date.y = +n[0], i + n[0].length) : -1; } - - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) + function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; } - - if (value == null) { - throw TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) + function d3_time_parseZone(date, string, i) { + return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string, + i + 5) : -1; } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) + function d3_time_expandYear(d) { + return d + (d > 68 ? 1900 : 2e3); } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) + function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.m = n[0] - 1, i + n[0].length) : -1; } - - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) + function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.d = +n[0], i + n[0].length) : -1; } - - var b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Buffer.prototype.__proto__ = Uint8Array.prototype -Buffer.__proto__ = Uint8Array - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' + function d3_time_parseDayOfYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); + return n ? (date.j = +n[0], i + n[0].length) : -1; } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) + function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.H = +n[0], i + n[0].length) : -1; } - - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) - - var actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) + function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.M = +n[0], i + n[0].length) : -1; } - - return buf -} - -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 + function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.S = +n[0], i + n[0].length) : -1; } - return buf -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') + function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); + return n ? (date.L = +n[0], i + n[0].length) : -1; } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') + function d3_time_zone(d) { + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60; + return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); } - - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) + function d3_time_parseLiteralPercent(date, string, i) { + d3_time_percentRe.lastIndex = 0; + var n = d3_time_percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; } - - // Return an augmented `Uint8Array` instance - buf.__proto__ = Buffer.prototype - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf + function d3_time_formatMulti(formats) { + var n = formats.length, i = -1; + while (++i < n) formats[i][0] = this(formats[i][0]); + return function(date) { + var i = 0, f = formats[i]; + while (!f[1](date)) f = formats[++i]; + return f[0](date); + }; } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) + d3.locale = function(locale) { + return { + numberFormat: d3_locale_numberFormat(locale), + timeFormat: d3_locale_timeFormat(locale) + }; + }; + var d3_locale_enUS = d3.locale({ + decimal: ".", + thousands: ",", + grouping: [ 3 ], + currency: [ "$", "" ], + dateTime: "%a %b %e %X %Y", + date: "%m/%d/%Y", + time: "%H:%M:%S", + periods: [ "AM", "PM" ], + days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], + shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], + months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], + shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] + }); + d3.format = d3_locale_enUS.numberFormat; + d3.geo = {}; + function d3_adder() {} + d3_adder.prototype = { + s: 0, + t: 0, + add: function(y) { + d3_adderSum(y, this.t, d3_adderTemp); + d3_adderSum(d3_adderTemp.s, this.s, this); + if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; + }, + reset: function() { + this.s = this.t = 0; + }, + valueOf: function() { + return this.s; } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) + }; + var d3_adderTemp = new d3_adder(); + function d3_adderSum(a, b, o) { + var x = o.s = a + b, bv = x - a, av = x - bv; + o.t = a - av + (b - bv); } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break + d3.geo.stream = function(object, listener) { + if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { + d3_geo_streamObjectType[object.type](object, listener); + } else { + d3_geo_streamGeometry(object, listener); } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length + }; + function d3_geo_streamGeometry(geometry, listener) { + if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { + d3_geo_streamGeometryType[geometry.type](geometry, listener); } } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) + var d3_geo_streamObjectType = { + Feature: function(feature, listener) { + d3_geo_streamGeometry(feature.geometry, listener); + }, + FeatureCollection: function(object, listener) { + var features = object.features, i = -1, n = features.length; + while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') + }; + var d3_geo_streamGeometryType = { + Sphere: function(object, listener) { + listener.sphere(); + }, + Point: function(object, listener) { + object = object.coordinates; + listener.point(object[0], object[1], object[2]); + }, + MultiPoint: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); + }, + LineString: function(object, listener) { + d3_geo_streamLine(object.coordinates, listener, 0); + }, + MultiLineString: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); + }, + Polygon: function(object, listener) { + d3_geo_streamPolygon(object.coordinates, listener); + }, + MultiPolygon: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); + }, + GeometryCollection: function(object, listener) { + var geometries = object.geometries, i = -1, n = geometries.length; + while (++i < n) d3_geo_streamGeometry(geometries[i], listener); } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength + }; + function d3_geo_streamLine(coordinates, listener, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + listener.lineStart(); + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); + listener.lineEnd(); } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) + function d3_geo_streamPolygon(coordinates, listener) { + var i = -1, n = coordinates.length; + listener.polygonStart(); + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); + listener.polygonEnd(); } - - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true + d3.geo.area = function(object) { + d3_geo_areaSum = 0; + d3.geo.stream(object, d3_geo_area); + return d3_geo_areaSum; + }; + var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); + var d3_geo_area = { + sphere: function() { + d3_geo_areaSum += 4 * π; + }, + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_areaRingSum.reset(); + d3_geo_area.lineStart = d3_geo_areaRingStart; + }, + polygonEnd: function() { + var area = 2 * d3_geo_areaRingSum; + d3_geo_areaSum += area < 0 ? 4 * π + area : area; + d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true + }; + function d3_geo_areaRingStart() { + var λ00, φ00, λ0, cosφ0, sinφ0; + d3_geo_area.point = function(λ, φ) { + d3_geo_area.point = nextPoint; + λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), + sinφ0 = Math.sin(φ); + }; + function nextPoint(λ, φ) { + λ *= d3_radians; + φ = φ * d3_radians / 2 + π / 4; + var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ); + d3_geo_areaRingSum.add(Math.atan2(v, u)); + λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; } + d3_geo_area.lineEnd = function() { + nextPoint(λ00, φ00); + }; } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 + function d3_geo_cartesian(spherical) { + var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); + return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; } - if (thisStart === undefined) { - thisStart = 0 + function d3_geo_cartesianDot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } - if (thisEnd === undefined) { - thisEnd = this.length + function d3_geo_cartesianCross(a, b) { + return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') + function d3_geo_cartesianAdd(a, b) { + a[0] += b[0]; + a[1] += b[1]; + a[2] += b[2]; } - - if (thisStart >= thisEnd && start >= end) { - return 0 + function d3_geo_cartesianScale(vector, k) { + return [ vector[0] * k, vector[1] * k, vector[2] * k ]; } - if (thisStart >= thisEnd) { - return -1 + function d3_geo_cartesianNormalize(d) { + var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l; + d[1] /= l; + d[2] /= l; } - if (start >= end) { - return 1 + function d3_geo_spherical(cartesian) { + return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } + function d3_geo_sphericalEqual(a, b) { + return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε; } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + d3.geo.bounds = function() { + var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range; + var bound = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + bound.point = ringPoint; + bound.lineStart = ringStart; + bound.lineEnd = ringEnd; + dλSum = 0; + d3_geo_area.polygonStart(); + }, + polygonEnd: function() { + d3_geo_area.polygonEnd(); + bound.point = point; + bound.lineStart = lineStart; + bound.lineEnd = lineEnd; + if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90; + range[0] = λ0, range[1] = λ1; } + }; + function point(λ, φ) { + ranges.push(range = [ λ0 = λ, λ1 = λ ]); + if (φ < φ0) φ0 = φ; + if (φ > φ1) φ1 = φ; } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 + function linePoint(λ, φ) { + var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]); + if (p0) { + var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); + d3_geo_cartesianNormalize(inflection); + inflection = d3_geo_spherical(inflection); + var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180; + if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) { + var φi = inflection[1] * d3_degrees; + if (φi > φ1) φ1 = φi; + } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) { + var φi = -inflection[1] * d3_degrees; + if (φi < φ0) φ0 = φi; + } else { + if (φ < φ0) φ0 = φ; + if (φ > φ1) φ1 = φ; + } + if (antimeridian) { + if (λ < λ_) { + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; + } else { + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; + } + } else { + if (λ1 >= λ0) { + if (λ < λ0) λ0 = λ; + if (λ > λ1) λ1 = λ; + } else { + if (λ > λ_) { + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; + } else { + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; + } + } + } + } else { + point(λ, φ); } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 + p0 = p, λ_ = λ; } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) + function lineStart() { + bound.point = linePoint; } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } + function lineEnd() { + range[0] = λ0, range[1] = λ1; + bound.point = point; + p0 = null; } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i + function ringPoint(λ, φ) { + if (p0) { + var dλ = λ - λ_; + dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ; + } else λ__ = λ, φ__ = φ; + d3_geo_area.point(λ, φ); + linePoint(λ, φ); } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining + function ringStart() { + d3_geo_area.lineStart(); } - } - - var strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined + function ringEnd() { + ringPoint(λ__, φ__); + d3_geo_area.lineEnd(); + if (abs(dλSum) > ε) λ0 = -(λ1 = 180); + range[0] = λ0, range[1] = λ1; + p0 = null; } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true + function angle(λ0, λ1) { + return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } + function compareRanges(a, b) { + return a[0] - b[0]; } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF + function withinRange(x, range) { + return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - newBuf.__proto__ = Buffer.prototype - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code + return function(feature) { + φ1 = λ1 = -(λ0 = φ0 = Infinity); + ranges = []; + d3.geo.stream(feature, bound); + var n = ranges.length; + if (n) { + ranges.sort(compareRanges); + for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { + b = ranges[i]; + if (withinRange(b[0], a) || withinRange(b[1], a)) { + if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; + if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; + } else { + merged.push(a = b); + } + } + var best = -Infinity, dλ; + for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { + b = merged[i]; + if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1]; + } } + ranges = range = null; + return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ]; + }; + }(); + d3.geo.centroid = function(object) { + d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; + d3.geo.stream(object, d3_geo_centroid); + var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; + if (m < ε2) { + x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; + if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; + m = x * x + y * y + z * z; + if (m < ε2) return [ NaN, NaN ]; } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') + return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; + }; + var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2; + var d3_geo_centroid = { + sphere: d3_noop, + point: d3_geo_centroidPoint, + lineStart: d3_geo_centroidLineStart, + lineEnd: d3_geo_centroidLineEnd, + polygonStart: function() { + d3_geo_centroid.lineStart = d3_geo_centroidRingStart; + }, + polygonEnd: function() { + d3_geo_centroid.lineStart = d3_geo_centroidLineStart; } + }; + function d3_geo_centroidPoint(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians); + d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)); } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -},{"base64-js":62,"ieee754":395}],94:[function(_dereq_,module,exports){ -'use strict' - -var monotoneTriangulate = _dereq_('./lib/monotone') -var makeIndex = _dereq_('./lib/triangulation') -var delaunayFlip = _dereq_('./lib/delaunay') -var filterTriangulation = _dereq_('./lib/filter') - -module.exports = cdt2d - -function canonicalizeEdge(e) { - return [Math.min(e[0], e[1]), Math.max(e[0], e[1])] -} - -function compareEdge(a, b) { - return a[0]-b[0] || a[1]-b[1] -} - -function canonicalizeEdges(edges) { - return edges.map(canonicalizeEdge).sort(compareEdge) -} - -function getDefault(options, property, dflt) { - if(property in options) { - return options[property] - } - return dflt -} - -function cdt2d(points, edges, options) { - - if(!Array.isArray(edges)) { - options = edges || {} - edges = [] - } else { - options = options || {} - edges = edges || [] - } - - //Parse out options - var delaunay = !!getDefault(options, 'delaunay', true) - var interior = !!getDefault(options, 'interior', true) - var exterior = !!getDefault(options, 'exterior', true) - var infinity = !!getDefault(options, 'infinity', false) - - //Handle trivial case - if((!interior && !exterior) || points.length === 0) { - return [] + function d3_geo_centroidPointXYZ(x, y, z) { + ++d3_geo_centroidW0; + d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; + d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; + d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; } - - //Construct initial triangulation - var cells = monotoneTriangulate(points, edges) - - //If delaunay refinement needed, then improve quality by edge flipping - if(delaunay || interior !== exterior || infinity) { - - //Index all of the cells to support fast neighborhood queries - var triangulation = makeIndex(points.length, canonicalizeEdges(edges)) - for(var i=0; i 0) { - var b = stack.pop() - var a = stack.pop() - - //Find opposite pairs - var x = -1, y = -1 - var star = stars[a] - for(var i=1; i= 0) { - continue + function d3_geo_compose(a, b) { + function compose(x, y) { + return x = a(x, y), b(x[0], x[1]); } - - //Flip the edge - triangulation.flip(a, b) - - //Test flipping neighboring edges - testFlip(points, triangulation, stack, x, a, y) - testFlip(points, triangulation, stack, a, y, x) - testFlip(points, triangulation, stack, y, b, x) - testFlip(points, triangulation, stack, b, x, y) + if (a.invert && b.invert) compose.invert = function(x, y) { + return x = b.invert(x, y), x && a.invert(x[0], x[1]); + }; + return compose; } -} - -},{"binary-search-bounds":99,"robust-in-sphere":484}],96:[function(_dereq_,module,exports){ -'use strict' - -var bsearch = _dereq_('binary-search-bounds') - -module.exports = classifyFaces - -function FaceIndex(cells, neighbor, constraint, flags, active, next, boundary) { - this.cells = cells - this.neighbor = neighbor - this.flags = flags - this.constraint = constraint - this.active = active - this.next = next - this.boundary = boundary -} - -var proto = FaceIndex.prototype - -function compareCell(a, b) { - return a[0] - b[0] || - a[1] - b[1] || - a[2] - b[2] -} - -proto.locate = (function() { - var key = [0,0,0] - return function(a, b, c) { - var x = a, y = b, z = c - if(b < c) { - if(b < a) { - x = b - y = c - z = a - } - } else if(c < a) { - x = c - y = a - z = b - } - if(x < 0) { - return -1 - } - key[0] = x - key[1] = y - key[2] = z - return bsearch.eq(this.cells, key, compareCell) + function d3_true() { + return true; } -})() - -function indexCells(triangulation, infinity) { - //First get cells and canonicalize - var cells = triangulation.cells() - var nc = cells.length - for(var i=0; i 0 || next.length > 0) { - while(active.length > 0) { - var t = active.pop() - if(flags[t] === -side) { - continue - } - flags[t] = side - var c = cells[t] - for(var j=0; j<3; ++j) { - var f = neighbor[3*t+j] - if(f >= 0 && flags[f] === 0) { - if(constraint[3*t+j]) { - next.push(f) + if (isSubject) { + points = current.p.z; + for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); } else { - active.push(f) - flags[f] = side + interpolate(current.x, current.p.x, -1, listener); } + current = current.p; } - } - } - - //Swap arrays and loop - var tmp = next - next = active - active = tmp - next.length = 0 - side = -side - } - - var result = filterCells(cells, flags, target) - if(infinity) { - return result.concat(index.boundary) - } - return result -} - -},{"binary-search-bounds":99}],97:[function(_dereq_,module,exports){ -'use strict' - -var bsearch = _dereq_('binary-search-bounds') -var orient = _dereq_('robust-orientation')[3] - -var EVENT_POINT = 0 -var EVENT_END = 1 -var EVENT_START = 2 - -module.exports = monotoneTriangulate - -//A partial convex hull fragment, made of two unimonotone polygons -function PartialHull(a, b, idx, lowerIds, upperIds) { - this.a = a - this.b = b - this.idx = idx - this.lowerIds = lowerIds - this.upperIds = upperIds -} - -//An event in the sweep line procedure -function Event(a, b, type, idx) { - this.a = a - this.b = b - this.type = type - this.idx = idx -} - -//This is used to compare events for the sweep line procedure -// Points are: -// 1. sorted lexicographically -// 2. sorted by type (point < end < start) -// 3. segments sorted by winding order -// 4. sorted by index -function compareEvent(a, b) { - var d = - (a.a[0] - b.a[0]) || - (a.a[1] - b.a[1]) || - (a.type - b.type) - if(d) { return d } - if(a.type !== EVENT_POINT) { - d = orient(a.a, a.b, b.b) - if(d) { return d } - } - return a.idx - b.idx -} - -function testPoint(hull, p) { - return orient(hull.a, hull.b, p) -} - -function addPoint(cells, hulls, points, p, idx) { - var lo = bsearch.lt(hulls, p, testPoint) - var hi = bsearch.gt(hulls, p, testPoint) - for(var i=lo; i 1 && orient( - points[lowerIds[m-2]], - points[lowerIds[m-1]], - p) > 0) { - cells.push( - [lowerIds[m-1], - lowerIds[m-2], - idx]) - m -= 1 - } - lowerIds.length = m - lowerIds.push(idx) - - //Insert p into upper hull - var upperIds = hull.upperIds - var m = upperIds.length - while(m > 1 && orient( - points[upperIds[m-2]], - points[upperIds[m-1]], - p) < 0) { - cells.push( - [upperIds[m-2], - upperIds[m-1], - idx]) - m -= 1 - } - upperIds.length = m - upperIds.push(idx) - } -} - -function findSplit(hull, edge) { - var d - if(hull.a[0] < edge.a[0]) { - d = orient(hull.a, hull.b, edge.a) - } else { - d = orient(edge.b, edge.a, hull.a) - } - if(d) { return d } - if(edge.b[0] < hull.b[0]) { - d = orient(hull.a, hull.b, edge.b) - } else { - d = orient(edge.b, edge.a, hull.b) - } - return d || hull.idx - edge.idx -} - -function splitHulls(hulls, points, event) { - var splitIdx = bsearch.le(hulls, event, findSplit) - var hull = hulls[splitIdx] - var upperIds = hull.upperIds - var x = upperIds[upperIds.length-1] - hull.upperIds = [x] - hulls.splice(splitIdx+1, 0, - new PartialHull(event.a, event.b, event.idx, [x], upperIds)) -} - - -function mergeHulls(hulls, points, event) { - //Swap pointers for merge search - var tmp = event.a - event.a = event.b - event.b = tmp - var mergeIdx = bsearch.eq(hulls, event, findSplit) - var upper = hulls[mergeIdx] - var lower = hulls[mergeIdx-1] - lower.upperIds = upper.upperIds - hulls.splice(mergeIdx, 1) -} - - -function monotoneTriangulate(points, edges) { - - var numPoints = points.length - var numEdges = edges.length - - var events = [] - - //Create point events - for(var i=0; i b[0]) { - events.push( - new Event(b, a, EVENT_START, i), - new Event(a, b, EVENT_END, i)) - } - } - - //Sort events - events.sort(compareEvent) - - //Initialize hull - var minX = events[0].a[0] - (1 + Math.abs(events[0].a[0])) * Math.pow(2, -52) - var hull = [ new PartialHull([minX, 1], [minX, 0], -1, [], [], [], []) ] - - //Process events in order - var cells = [] - for(var i=0, numEvents=events.length; i= 0 - } -})() - -proto.removeTriangle = function(i, j, k) { - var stars = this.stars - removePair(stars[i], j, k) - removePair(stars[j], k, i) - removePair(stars[k], i, j) -} - -proto.addTriangle = function(i, j, k) { - var stars = this.stars - stars[i].push(j, k) - stars[j].push(k, i) - stars[k].push(i, j) -} - -proto.opposite = function(j, i) { - var list = this.stars[i] - for(var k=1, n=list.length; k>>1,x=a[m]"] - if(earlyOut) { - if(predicate.indexOf("c") < 0) { - code.push(";if(x===y){return m}else if(x<=y){") - } else { - code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){") - } - } else { - code.push(";if(", predicate, "){i=m;") - } - if(reversed) { - code.push("l=m+1}else{h=m-1}") - } else { - code.push("h=m-1}else{l=m+1}") - } - code.push("}") - if(earlyOut) { - code.push("return -1};") - } else { - code.push("return i};") - } - return code.join("") -} - -function compileBoundsSearch(predicate, reversed, suffix, earlyOut) { - var result = new Function([ - compileSearch("A", "x" + predicate + "y", reversed, ["y"], earlyOut), - compileSearch("P", "c(x,y)" + predicate + "0", reversed, ["y", "c"], earlyOut), -"function dispatchBsearch", suffix, "(a,y,c,l,h){\ -if(typeof(c)==='function'){\ -return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)\ -}else{\ -return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)\ -}}\ -return dispatchBsearch", suffix].join("")) - return result() -} - -module.exports = { - ge: compileBoundsSearch(">=", false, "GE"), - gt: compileBoundsSearch(">", false, "GT"), - lt: compileBoundsSearch("<", true, "LT"), - le: compileBoundsSearch("<=", true, "LE"), - eq: compileBoundsSearch("-", true, "EQ", true) -} - -},{}],100:[function(_dereq_,module,exports){ -'use strict' - -module.exports = orientation - -function orientation(s) { - var p = 1 - for(var i=1; i 0) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + listener.lineStart(); + while (++i < n) listener.point((point = segment[i])[0], point[1]); + listener.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); + } + return clip; + }; } - return result -} - -circumcenter.barycenetric = barycentricCircumcenter -module.exports = circumcenter -},{"dup":155,"robust-linear-solve":485}],102:[function(_dereq_,module,exports){ -module.exports = circumradius - -var circumcenter = _dereq_('circumcenter') - -function circumradius(points) { - var center = circumcenter(points) - var avgDist = 0.0 - for(var i=0; i 1; } - return Math.sqrt(avgDist / points.length) -} -},{"circumcenter":101}],103:[function(_dereq_,module,exports){ -module.exports = clamp - -function clamp(value, min, max) { - return min < max - ? (value < min ? min : value > max ? max : value) - : (value < max ? max : value > min ? min : value) -} - -},{}],104:[function(_dereq_,module,exports){ -'use strict' - -module.exports = cleanPSLG - -var UnionFind = _dereq_('union-find') -var boxIntersect = _dereq_('box-intersect') -var segseg = _dereq_('robust-segment-intersect') -var rat = _dereq_('big-rat') -var ratCmp = _dereq_('big-rat/cmp') -var ratToFloat = _dereq_('big-rat/to-float') -var ratVec = _dereq_('rat-vec') -var nextafter = _dereq_('nextafter') - -var solveIntersection = _dereq_('./lib/rat-seg-intersect') - -// Bounds on a rational number when rounded to a float -function boundRat (r) { - var f = ratToFloat(r) - return [ - nextafter(f, -Infinity), - nextafter(f, Infinity) - ] -} - -// Convert a list of edges in a pslg to bounding boxes -function boundEdges (points, edges) { - var bounds = new Array(edges.length) - for (var i = 0; i < edges.length; ++i) { - var e = edges[i] - var a = points[e[0]] - var b = points[e[1]] - bounds[i] = [ - nextafter(Math.min(a[0], b[0]), -Infinity), - nextafter(Math.min(a[1], b[1]), -Infinity), - nextafter(Math.max(a[0], b[0]), Infinity), - nextafter(Math.max(a[1], b[1]), Infinity) - ] + function d3_geo_clipBufferListener() { + var lines = [], line; + return { + lineStart: function() { + lines.push(line = []); + }, + point: function(λ, φ) { + line.push([ λ, φ ]); + }, + lineEnd: d3_noop, + buffer: function() { + var buffer = lines; + lines = []; + line = null; + return buffer; + }, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + } + }; } - return bounds -} - -// Convert a list of points into bounding boxes by duplicating coords -function boundPoints (points) { - var bounds = new Array(points.length) - for (var i = 0; i < points.length; ++i) { - var p = points[i] - bounds[i] = [ - nextafter(p[0], -Infinity), - nextafter(p[1], -Infinity), - nextafter(p[0], Infinity), - nextafter(p[1], Infinity) - ] + function d3_geo_clipSort(a, b) { + return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]); } - return bounds -} - -// Find all pairs of crossing edges in a pslg (given edge bounds) -function getCrossings (points, edges, edgeBounds) { - var result = [] - boxIntersect(edgeBounds, function (i, j) { - var e = edges[i] - var f = edges[j] - if (e[0] === f[0] || e[0] === f[1] || - e[1] === f[0] || e[1] === f[1]) { - return - } - var a = points[e[0]] - var b = points[e[1]] - var c = points[f[0]] - var d = points[f[1]] - if (segseg(a, b, c, d)) { - result.push([i, j]) - } - }) - return result -} - -// Find all pairs of crossing vertices in a pslg (given edge/vert bounds) -function getTJunctions (points, edges, edgeBounds, vertBounds) { - var result = [] - boxIntersect(edgeBounds, vertBounds, function (i, v) { - var e = edges[i] - if (e[0] === v || e[1] === v) { - return - } - var p = points[v] - var a = points[e[0]] - var b = points[e[1]] - if (segseg(a, b, p, p)) { - result.push([i, v]) - } - }) - return result -} - -// Cut edges along crossings/tjunctions -function cutEdges (floatPoints, edges, crossings, junctions, useColor) { - var i, e - - // Convert crossings into tjunctions by constructing rational points - var ratPoints = floatPoints.map(function(p) { - return [ - rat(p[0]), - rat(p[1]) - ] - }) - for (i = 0; i < crossings.length; ++i) { - var crossing = crossings[i] - e = crossing[0] - var f = crossing[1] - var ee = edges[e] - var ef = edges[f] - var x = solveIntersection( - ratVec(floatPoints[ee[0]]), - ratVec(floatPoints[ee[1]]), - ratVec(floatPoints[ef[0]]), - ratVec(floatPoints[ef[1]])) - if (!x) { - // Segments are parallel, should already be handled by t-junctions - continue - } - var idx = floatPoints.length - floatPoints.push([ratToFloat(x[0]), ratToFloat(x[1])]) - ratPoints.push(x) - junctions.push([e, idx], [f, idx]) - } - - // Sort tjunctions - junctions.sort(function (a, b) { - if (a[0] !== b[0]) { - return a[0] - b[0] - } - var u = ratPoints[a[1]] - var v = ratPoints[b[1]] - return ratCmp(u[0], v[0]) || ratCmp(u[1], v[1]) - }) - - // Split edges along junctions - for (i = junctions.length - 1; i >= 0; --i) { - var junction = junctions[i] - e = junction[0] - - var edge = edges[e] - var s = edge[0] - var t = edge[1] - - // Check if edge is not lexicographically sorted - var a = floatPoints[s] - var b = floatPoints[t] - if (((a[0] - b[0]) || (a[1] - b[1])) < 0) { - var tmp = s - s = t - t = tmp - } - - // Split leading edge - edge[0] = s - var last = edge[1] = junction[1] - - // If we are grouping edges by color, remember to track data - var color - if (useColor) { - color = edge[2] - } - - // Split other edges - while (i > 0 && junctions[i - 1][0] === e) { - var junction = junctions[--i] - var next = junction[1] - if (useColor) { - edges.push([last, next, color]) - } else { - edges.push([last, next]) + var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]); + function d3_geo_clipAntimeridianLine(listener) { + var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; + return { + lineStart: function() { + listener.lineStart(); + clean = 1; + }, + point: function(λ1, φ1) { + var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0); + if (abs(dλ - π) < ε) { + listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ); + listener.point(sλ0, φ0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sλ1, φ0); + listener.point(λ1, φ0); + clean = 0; + } else if (sλ0 !== sλ1 && dλ >= π) { + if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; + if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; + φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); + listener.point(sλ0, φ0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sλ1, φ0); + clean = 0; + } + listener.point(λ0 = λ1, φ0 = φ1); + sλ0 = sλ1; + }, + lineEnd: function() { + listener.lineEnd(); + λ0 = φ0 = NaN; + }, + clean: function() { + return 2 - clean; } - last = next - } - - // Add final edge - if (useColor) { - edges.push([last, t, color]) - } else { - edges.push([last, t]) - } + }; } - - // Return constructed rational points - return ratPoints -} - -// Merge overlapping points -function dedupPoints (floatPoints, ratPoints, floatBounds) { - var numPoints = ratPoints.length - var uf = new UnionFind(numPoints) - - // Compute rational bounds - var bounds = [] - for (var i = 0; i < ratPoints.length; ++i) { - var p = ratPoints[i] - var xb = boundRat(p[0]) - var yb = boundRat(p[1]) - bounds.push([ - nextafter(xb[0], -Infinity), - nextafter(yb[0], -Infinity), - nextafter(xb[1], Infinity), - nextafter(yb[1], Infinity) - ]) - } - - // Link all points with over lapping boxes - boxIntersect(bounds, function (i, j) { - uf.link(i, j) - }) - - // Do 1 pass over points to combine points in label sets - var noDupes = true - var labels = new Array(numPoints) - for (var i = 0; i < numPoints; ++i) { - var j = uf.find(i) - if (j !== i) { - // Clear no-dupes flag, zero out label - noDupes = false - // Make each point the top-left point from its cell - floatPoints[j] = [ - Math.min(floatPoints[i][0], floatPoints[j][0]), - Math.min(floatPoints[i][1], floatPoints[j][1]) - ] - } + function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { + var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); + return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2; } - - // If no duplicates, return null to signal termination - if (noDupes) { - return null - } - - var ptr = 0 - for (var i = 0; i < numPoints; ++i) { - var j = uf.find(i) - if (j === i) { - labels[i] = ptr - floatPoints[ptr++] = floatPoints[i] + function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { + var φ; + if (from == null) { + φ = direction * halfπ; + listener.point(-π, φ); + listener.point(0, φ); + listener.point(π, φ); + listener.point(π, 0); + listener.point(π, -φ); + listener.point(0, -φ); + listener.point(-π, -φ); + listener.point(-π, 0); + listener.point(-π, φ); + } else if (abs(from[0] - to[0]) > ε) { + var s = from[0] < to[0] ? π : -π; + φ = direction * s / 2; + listener.point(-s, φ); + listener.point(0, φ); + listener.point(s, φ); } else { - labels[i] = -1 + listener.point(to[0], to[1]); } } - - floatPoints.length = ptr - - // Do a second pass to fix up missing labels - for (var i = 0; i < numPoints; ++i) { - if (labels[i] < 0) { - labels[i] = labels[uf.find(i)] + function d3_geo_pointInPolygon(point, polygon) { + var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; + d3_geo_areaRingSum.reset(); + for (var i = 0, n = polygon.length; i < n; ++i) { + var ring = polygon[i], m = ring.length; + if (!m) continue; + var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1; + while (true) { + if (j === m) j = 0; + point = ring[j]; + var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ; + d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ))); + polarAngle += antimeridian ? dλ + sdλ * τ : dλ; + if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) { + var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); + d3_geo_cartesianNormalize(arc); + var intersection = d3_geo_cartesianCross(meridianNormal, arc); + d3_geo_cartesianNormalize(intersection); + var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]); + if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) { + winding += antimeridian ^ dλ >= 0 ? 1 : -1; + } + } + if (!j++) break; + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point; + } } + return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < -ε) ^ winding & 1; } - - // Return resulting union-find data structure - return labels -} - -function compareLex2 (a, b) { return (a[0] - b[0]) || (a[1] - b[1]) } -function compareLex3 (a, b) { - var d = (a[0] - b[0]) || (a[1] - b[1]) - if (d) { - return d - } - if (a[2] < b[2]) { - return -1 - } else if (a[2] > b[2]) { - return 1 - } - return 0 -} - -// Remove duplicate edge labels -function dedupEdges (edges, labels, useColor) { - if (edges.length === 0) { - return - } - if (labels) { - for (var i = 0; i < edges.length; ++i) { - var e = edges[i] - var a = labels[e[0]] - var b = labels[e[1]] - e[0] = Math.min(a, b) - e[1] = Math.max(a, b) - } - } else { - for (var i = 0; i < edges.length; ++i) { - var e = edges[i] - var a = e[0] - var b = e[1] - e[0] = Math.min(a, b) - e[1] = Math.max(a, b) + function d3_geo_clipCircle(radius) { + var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); + return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]); + function visible(λ, φ) { + return Math.cos(λ) * Math.cos(φ) > cr; } - } - if (useColor) { - edges.sort(compareLex3) - } else { - edges.sort(compareLex2) - } - var ptr = 1 - for (var i = 1; i < edges.length; ++i) { - var prev = edges[i - 1] - var next = edges[i] - if (next[0] === prev[0] && next[1] === prev[1] && - (!useColor || next[2] === prev[2])) { - continue + function clipLine(listener) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(λ, φ) { + var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0; + if (!point0 && (v00 = v0 = v)) listener.lineStart(); + if (v !== v0) { + point2 = intersect(point0, point1); + if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { + point1[0] += ε; + point1[1] += ε; + v = visible(point1[0], point1[1]); + } + } + if (v !== v0) { + clean = 0; + if (v) { + listener.lineStart(); + point2 = intersect(point1, point0); + listener.point(point2[0], point2[1]); + } else { + point2 = intersect(point0, point1); + listener.point(point2[0], point2[1]); + listener.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c & c0) && (t = intersect(point1, point0, true))) { + clean = 0; + if (smallRadius) { + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + } else { + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + } + } + } + if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { + listener.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c; + }, + lineEnd: function() { + if (v0) listener.lineEnd(); + point0 = null; + }, + clean: function() { + return clean | (v00 && v0) << 1; + } + }; } - edges[ptr++] = next - } - edges.length = ptr -} - -function preRound (points, edges, useColor) { - var labels = dedupPoints(points, [], boundPoints(points)) - dedupEdges(edges, labels, useColor) - return !!labels -} - -// Repeat until convergence -function snapRound (points, edges, useColor) { - // 1. find edge crossings - var edgeBounds = boundEdges(points, edges) - var crossings = getCrossings(points, edges, edgeBounds) - - // 2. find t-junctions - var vertBounds = boundPoints(points) - var tjunctions = getTJunctions(points, edges, edgeBounds, vertBounds) - - // 3. cut edges, construct rational points - var ratPoints = cutEdges(points, edges, crossings, tjunctions, useColor) - - // 4. dedupe verts - var labels = dedupPoints(points, ratPoints, vertBounds) - - // 5. dedupe edges - dedupEdges(edges, labels, useColor) - - // 6. check termination - if (!labels) { - return (crossings.length > 0 || tjunctions.length > 0) - } - - // More iterations necessary - return true -} - -// Main loop, runs PSLG clean up until completion -function cleanPSLG (points, edges, colors) { - // If using colors, augment edges with color data - var prevEdges - if (colors) { - prevEdges = edges - var augEdges = new Array(edges.length) - for (var i = 0; i < edges.length; ++i) { - var e = edges[i] - augEdges[i] = [e[0], e[1], colors[i]] + function intersect(a, b, two) { + var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); + var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a; + var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); + d3_geo_cartesianAdd(A, B); + var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1); + if (t2 < 0) return; + var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); + d3_geo_cartesianAdd(q, A); + q = d3_geo_spherical(q); + if (!two) return q; + var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; + if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; + var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε; + if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; + if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) { + var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); + d3_geo_cartesianAdd(q1, A); + return [ q, d3_geo_spherical(q1) ]; + } } - edges = augEdges - } - - // First round: remove duplicate edges and points - var modified = preRound(points, edges, !!colors) - - // Run snap rounding until convergence - while (snapRound(points, edges, !!colors)) { - modified = true - } - - // Strip color tags - if (!!colors && modified) { - prevEdges.length = 0 - colors.length = 0 - for (var i = 0; i < edges.length; ++i) { - var e = edges[i] - prevEdges.push([e[0], e[1]]) - colors.push(e[2]) + function code(λ, φ) { + var r = smallRadius ? radius : π - radius, code = 0; + if (λ < -r) code |= 1; else if (λ > r) code |= 2; + if (φ < -r) code |= 4; else if (φ > r) code |= 8; + return code; } } - - return modified -} - -},{"./lib/rat-seg-intersect":105,"big-rat":66,"big-rat/cmp":64,"big-rat/to-float":78,"box-intersect":84,"nextafter":434,"rat-vec":469,"robust-segment-intersect":489,"union-find":523}],105:[function(_dereq_,module,exports){ -'use strict' - -module.exports = solveIntersection - -var ratMul = _dereq_('big-rat/mul') -var ratDiv = _dereq_('big-rat/div') -var ratSub = _dereq_('big-rat/sub') -var ratSign = _dereq_('big-rat/sign') -var rvSub = _dereq_('rat-vec/sub') -var rvAdd = _dereq_('rat-vec/add') -var rvMuls = _dereq_('rat-vec/muls') - -function ratPerp (a, b) { - return ratSub(ratMul(a[0], b[1]), ratMul(a[1], b[0])) -} - -// Solve for intersection -// x = a + t (b-a) -// (x - c) ^ (d-c) = 0 -// (t * (b-a) + (a-c) ) ^ (d-c) = 0 -// t * (b-a)^(d-c) = (d-c)^(a-c) -// t = (d-c)^(a-c) / (b-a)^(d-c) - -function solveIntersection (a, b, c, d) { - var ba = rvSub(b, a) - var dc = rvSub(d, c) - - var baXdc = ratPerp(ba, dc) - - if (ratSign(baXdc) === 0) { - return null + function d3_geom_clipLine(x0, y0, x1, y1) { + return function(line) { + var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; + r = x0 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dx > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + r = x1 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dx > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + r = y0 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dy > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + r = y1 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dy > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + if (t0 > 0) line.a = { + x: ax + t0 * dx, + y: ay + t0 * dy + }; + if (t1 < 1) line.b = { + x: ax + t1 * dx, + y: ay + t1 * dy + }; + return line; + }; } - - var ac = rvSub(a, c) - var dcXac = ratPerp(dc, ac) - - var t = ratDiv(dcXac, baXdc) - var s = rvMuls(ba, t) - var r = rvAdd(a, s) - - return r -} - -},{"big-rat/div":65,"big-rat/mul":75,"big-rat/sign":76,"big-rat/sub":77,"rat-vec/add":468,"rat-vec/muls":470,"rat-vec/sub":471}],106:[function(_dereq_,module,exports){ -/** @module color-id */ - -'use strict' - -var clamp = _dereq_('clamp') - -module.exports = toNumber -module.exports.to = toNumber -module.exports.from = fromNumber - -function toNumber (rgba, normalized) { - if(normalized == null) normalized = true - - var r = rgba[0], g = rgba[1], b = rgba[2], a = rgba[3] - - if (a == null) a = normalized ? 1 : 255 - - if (normalized) { - r *= 255 - g *= 255 - b *= 255 - a *= 255 - } - - r = clamp(r, 0, 255) & 0xFF - g = clamp(g, 0, 255) & 0xFF - b = clamp(b, 0, 255) & 0xFF - a = clamp(a, 0, 255) & 0xFF - - //hi-order shift converts to -1, so we can't use <<24 - var n = (r * 0x01000000) + (g << 16) + (b << 8) + (a) - - return n -} - -function fromNumber (n, normalized) { - n = +n - - var r = n >>> 24 - var g = (n & 0x00ff0000) >>> 16 - var b = (n & 0x0000ff00) >>> 8 - var a = n & 0x000000ff - - if (normalized === false) return [r, g, b, a] - - return [r/255, g/255, b/255, a/255] -} - -},{"clamp":103}],107:[function(_dereq_,module,exports){ -'use strict' - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; - -},{}],108:[function(_dereq_,module,exports){ -/** @module color-normalize */ - -'use strict' - -var rgba = _dereq_('color-rgba') -var clamp = _dereq_('clamp') -var dtype = _dereq_('dtype') - -module.exports = function normalize (color, type) { - if (type === 'float' || !type) type = 'array' - if (type === 'uint') type = 'uint8' - if (type === 'uint_clamped') type = 'uint8_clamped' - var Ctor = dtype(type) - var output = new Ctor(4) - - var normalize = type !== 'uint8' && type !== 'uint8_clamped' - - // attempt to parse non-array arguments - if (!color.length || typeof color === 'string') { - color = rgba(color) - color[0] /= 255 - color[1] /= 255 - color[2] /= 255 - } - - // 0, 1 are possible contradictory values for Arrays: - // [1,1,1] input gives [1,1,1] output instead of [1/255,1/255,1/255], which may be collision if input is meant to be uint. - // converting [1,1,1] to [1/255,1/255,1/255] in case of float input gives larger mistake since [1,1,1] float is frequent edge value, whereas [0,1,1], [1,1,1] etc. uint inputs are relatively rare - if (isInt(color)) { - output[0] = color[0] - output[1] = color[1] - output[2] = color[2] - output[3] = color[3] != null ? color[3] : 255 - - if (normalize) { - output[0] /= 255 - output[1] /= 255 - output[2] /= 255 - output[3] /= 255 - } - - return output - } - - if (!normalize) { - output[0] = clamp(Math.floor(color[0] * 255), 0, 255) - output[1] = clamp(Math.floor(color[1] * 255), 0, 255) - output[2] = clamp(Math.floor(color[2] * 255), 0, 255) - output[3] = color[3] == null ? 255 : clamp(Math.floor(color[3] * 255), 0, 255) - } else { - output[0] = color[0] - output[1] = color[1] - output[2] = color[2] - output[3] = color[3] != null ? color[3] : 1 - } - - return output -} - -function isInt(color) { - if (color instanceof Uint8Array || color instanceof Uint8ClampedArray) return true - - if (Array.isArray(color) && - (color[0] > 1 || color[0] === 0) && - (color[1] > 1 || color[1] === 0) && - (color[2] > 1 || color[2] === 0) && - (!color[3] || color[3] > 1) - ) return true - - return false -} - -},{"clamp":103,"color-rgba":110,"dtype":154}],109:[function(_dereq_,module,exports){ -(function (global){ -/** - * @module color-parse - */ - -'use strict' - -var names = _dereq_('color-name') -var isObject = _dereq_('is-plain-obj') -var defined = _dereq_('defined') - -module.exports = parse - -/** - * Base hues - * http://dev.w3.org/csswg/css-color/#typedef-named-hue - */ -//FIXME: use external hue detector -var baseHues = { - red: 0, - orange: 60, - yellow: 120, - green: 180, - blue: 240, - purple: 300 -} - -/** - * Parse color from the string passed - * - * @return {Object} A space indicator `space`, an array `values` and `alpha` - */ -function parse (cstr) { - var m, parts = [], alpha = 1, space - - if (typeof cstr === 'string') { - //keyword - if (names[cstr]) { - parts = names[cstr].slice() - space = 'rgb' - } - - //reserved words - else if (cstr === 'transparent') { - alpha = 0 - space = 'rgb' - parts = [0,0,0] - } - - //hex - else if (/^#[A-Fa-f0-9]+$/.test(cstr)) { - var base = cstr.slice(1) - var size = base.length - var isShort = size <= 4 - alpha = 1 - - if (isShort) { - parts = [ - parseInt(base[0] + base[0], 16), - parseInt(base[1] + base[1], 16), - parseInt(base[2] + base[2], 16) - ] - if (size === 4) { - alpha = parseInt(base[3] + base[3], 16) / 255 - } - } - else { - parts = [ - parseInt(base[0] + base[1], 16), - parseInt(base[2] + base[3], 16), - parseInt(base[4] + base[5], 16) - ] - if (size === 8) { - alpha = parseInt(base[6] + base[7], 16) / 255 - } - } - - if (!parts[0]) parts[0] = 0 - if (!parts[1]) parts[1] = 0 - if (!parts[2]) parts[2] = 0 - - space = 'rgb' - } - - //color space - else if (m = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(cstr)) { - var name = m[1] - var base = name.replace(/a$/, '') - space = base - var size = base === 'cmyk' ? 4 : base === 'gray' ? 1 : 3 - parts = m[2].trim() - .split(/\s*,\s*/) - .map(function (x, i) { - // - if (/%$/.test(x)) { - //alpha - if (i === size) return parseFloat(x) / 100 - //rgb - if (base === 'rgb') return parseFloat(x) * 255 / 100 - return parseFloat(x) - } - //hue - else if (base[i] === 'h') { - // - if (/deg$/.test(x)) { - return parseFloat(x) - } - // - else if (baseHues[x] !== undefined) { - return baseHues[x] - } - } - return parseFloat(x) - }) - - if (name === base) parts.push(1) - alpha = parts[size] === undefined ? 1 : parts[size] - parts = parts.slice(0, size) - } - - //named channels case - else if (cstr.length > 10 && /[0-9](?:\s|\/)/.test(cstr)) { - parts = cstr.match(/([0-9]+)/g).map(function (value) { - return parseFloat(value) - }) - - space = cstr.match(/([a-z])/ig).join('').toLowerCase() - } - } - - //numeric case - else if (!isNaN(cstr)) { - space = 'rgb' - parts = [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff] - } - - //object case - detects css cases of rgb and hsl - else if (isObject(cstr)) { - var r = defined(cstr.r, cstr.red, cstr.R, null) - - if (r !== null) { - space = 'rgb' - parts = [ - r, - defined(cstr.g, cstr.green, cstr.G), - defined(cstr.b, cstr.blue, cstr.B) - ] - } - else { - space = 'hsl' - parts = [ - defined(cstr.h, cstr.hue, cstr.H), - defined(cstr.s, cstr.saturation, cstr.S), - defined(cstr.l, cstr.lightness, cstr.L, cstr.b, cstr.brightness) - ] - } - - alpha = defined(cstr.a, cstr.alpha, cstr.opacity, 1) - - if (cstr.opacity != null) alpha /= 100 - } - - //array - else if (Array.isArray(cstr) || global.ArrayBuffer && ArrayBuffer.isView && ArrayBuffer.isView(cstr)) { - parts = [cstr[0], cstr[1], cstr[2]] - space = 'rgb' - alpha = cstr.length === 4 ? cstr[3] : 1 - } - - return { - space: space, - values: parts, - alpha: alpha - } -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"color-name":107,"defined":149,"is-plain-obj":405}],110:[function(_dereq_,module,exports){ -/** @module color-rgba */ - -'use strict' - -var parse = _dereq_('color-parse') -var hsl = _dereq_('color-space/hsl') -var clamp = _dereq_('clamp') - -module.exports = function rgba (color) { - var values, i, l - - //attempt to parse non-array arguments - var parsed = parse(color) - - if (!parsed.space) return [] - - values = Array(3) - values[0] = clamp(parsed.values[0], 0, 255) - values[1] = clamp(parsed.values[1], 0, 255) - values[2] = clamp(parsed.values[2], 0, 255) - - if (parsed.space[0] === 'h') { - values = hsl.rgb(values) - } - - values.push(clamp(parsed.alpha, 0, 1)) - - return values -} - -},{"clamp":103,"color-parse":109,"color-space/hsl":111}],111:[function(_dereq_,module,exports){ -/** - * @module color-space/hsl - */ -'use strict' - -var rgb = _dereq_('./rgb'); - -module.exports = { - name: 'hsl', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'saturation', 'lightness'], - alias: ['HSL'], - - rgb: function(hsl) { - var h = hsl[0] / 360, - s = hsl[1] / 100, - l = hsl[2] / 100, - t1, t2, t3, rgb, val; - - if (s === 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) { - t2 = l * (1 + s); - } - else { - t2 = l + s - l * s; - } - t1 = 2 * l - t2; - - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { - t3 = h + 1 / 3 * - (i - 1); - if (t3 < 0) { - t3++; - } - else if (t3 > 1) { - t3--; - } - - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } - else if (2 * t3 < 1) { - val = t2; - } - else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } - else { - val = t1; - } - - rgb[i] = val * 255; - } - - return rgb; - } -}; - - -//extend rgb -rgb.hsl = function(rgb) { - var r = rgb[0]/255, - g = rgb[1]/255, - b = rgb[2]/255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, l; - - if (max === min) { - h = 0; - } - else if (r === max) { - h = (g - b) / delta; - } - else if (g === max) { - h = 2 + (b - r) / delta; - } - else if (b === max) { - h = 4 + (r - g)/ delta; - } - - h = Math.min(h * 60, 360); - - if (h < 0) { - h += 360; - } - - l = (min + max) / 2; - - if (max === min) { - s = 0; - } - else if (l <= 0.5) { - s = delta / (max + min); - } - else { - s = delta / (2 - max - min); - } - - return [h, s * 100, l * 100]; -}; - -},{"./rgb":112}],112:[function(_dereq_,module,exports){ -/** - * RGB space. - * - * @module color-space/rgb - */ -'use strict' - -module.exports = { - name: 'rgb', - min: [0,0,0], - max: [255,255,255], - channel: ['red', 'green', 'blue'], - alias: ['RGB'] -}; - -},{}],113:[function(_dereq_,module,exports){ -module.exports={ - "jet":[{"index":0,"rgb":[0,0,131]},{"index":0.125,"rgb":[0,60,170]},{"index":0.375,"rgb":[5,255,255]},{"index":0.625,"rgb":[255,255,0]},{"index":0.875,"rgb":[250,0,0]},{"index":1,"rgb":[128,0,0]}], - - "hsv":[{"index":0,"rgb":[255,0,0]},{"index":0.169,"rgb":[253,255,2]},{"index":0.173,"rgb":[247,255,2]},{"index":0.337,"rgb":[0,252,4]},{"index":0.341,"rgb":[0,252,10]},{"index":0.506,"rgb":[1,249,255]},{"index":0.671,"rgb":[2,0,253]},{"index":0.675,"rgb":[8,0,253]},{"index":0.839,"rgb":[255,0,251]},{"index":0.843,"rgb":[255,0,245]},{"index":1,"rgb":[255,0,6]}], - - "hot":[{"index":0,"rgb":[0,0,0]},{"index":0.3,"rgb":[230,0,0]},{"index":0.6,"rgb":[255,210,0]},{"index":1,"rgb":[255,255,255]}], - - "cool":[{"index":0,"rgb":[0,255,255]},{"index":1,"rgb":[255,0,255]}], - - "spring":[{"index":0,"rgb":[255,0,255]},{"index":1,"rgb":[255,255,0]}], - - "summer":[{"index":0,"rgb":[0,128,102]},{"index":1,"rgb":[255,255,102]}], - - "autumn":[{"index":0,"rgb":[255,0,0]},{"index":1,"rgb":[255,255,0]}], - - "winter":[{"index":0,"rgb":[0,0,255]},{"index":1,"rgb":[0,255,128]}], - - "bone":[{"index":0,"rgb":[0,0,0]},{"index":0.376,"rgb":[84,84,116]},{"index":0.753,"rgb":[169,200,200]},{"index":1,"rgb":[255,255,255]}], - - "copper":[{"index":0,"rgb":[0,0,0]},{"index":0.804,"rgb":[255,160,102]},{"index":1,"rgb":[255,199,127]}], - - "greys":[{"index":0,"rgb":[0,0,0]},{"index":1,"rgb":[255,255,255]}], - - "yignbu":[{"index":0,"rgb":[8,29,88]},{"index":0.125,"rgb":[37,52,148]},{"index":0.25,"rgb":[34,94,168]},{"index":0.375,"rgb":[29,145,192]},{"index":0.5,"rgb":[65,182,196]},{"index":0.625,"rgb":[127,205,187]},{"index":0.75,"rgb":[199,233,180]},{"index":0.875,"rgb":[237,248,217]},{"index":1,"rgb":[255,255,217]}], - - "greens":[{"index":0,"rgb":[0,68,27]},{"index":0.125,"rgb":[0,109,44]},{"index":0.25,"rgb":[35,139,69]},{"index":0.375,"rgb":[65,171,93]},{"index":0.5,"rgb":[116,196,118]},{"index":0.625,"rgb":[161,217,155]},{"index":0.75,"rgb":[199,233,192]},{"index":0.875,"rgb":[229,245,224]},{"index":1,"rgb":[247,252,245]}], - - "yiorrd":[{"index":0,"rgb":[128,0,38]},{"index":0.125,"rgb":[189,0,38]},{"index":0.25,"rgb":[227,26,28]},{"index":0.375,"rgb":[252,78,42]},{"index":0.5,"rgb":[253,141,60]},{"index":0.625,"rgb":[254,178,76]},{"index":0.75,"rgb":[254,217,118]},{"index":0.875,"rgb":[255,237,160]},{"index":1,"rgb":[255,255,204]}], - - "bluered":[{"index":0,"rgb":[0,0,255]},{"index":1,"rgb":[255,0,0]}], - - "rdbu":[{"index":0,"rgb":[5,10,172]},{"index":0.35,"rgb":[106,137,247]},{"index":0.5,"rgb":[190,190,190]},{"index":0.6,"rgb":[220,170,132]},{"index":0.7,"rgb":[230,145,90]},{"index":1,"rgb":[178,10,28]}], - - "picnic":[{"index":0,"rgb":[0,0,255]},{"index":0.1,"rgb":[51,153,255]},{"index":0.2,"rgb":[102,204,255]},{"index":0.3,"rgb":[153,204,255]},{"index":0.4,"rgb":[204,204,255]},{"index":0.5,"rgb":[255,255,255]},{"index":0.6,"rgb":[255,204,255]},{"index":0.7,"rgb":[255,153,255]},{"index":0.8,"rgb":[255,102,204]},{"index":0.9,"rgb":[255,102,102]},{"index":1,"rgb":[255,0,0]}], - - "rainbow":[{"index":0,"rgb":[150,0,90]},{"index":0.125,"rgb":[0,0,200]},{"index":0.25,"rgb":[0,25,255]},{"index":0.375,"rgb":[0,152,255]},{"index":0.5,"rgb":[44,255,150]},{"index":0.625,"rgb":[151,255,0]},{"index":0.75,"rgb":[255,234,0]},{"index":0.875,"rgb":[255,111,0]},{"index":1,"rgb":[255,0,0]}], - - "portland":[{"index":0,"rgb":[12,51,131]},{"index":0.25,"rgb":[10,136,186]},{"index":0.5,"rgb":[242,211,56]},{"index":0.75,"rgb":[242,143,56]},{"index":1,"rgb":[217,30,30]}], - - "blackbody":[{"index":0,"rgb":[0,0,0]},{"index":0.2,"rgb":[230,0,0]},{"index":0.4,"rgb":[230,210,0]},{"index":0.7,"rgb":[255,255,255]},{"index":1,"rgb":[160,200,255]}], - - "earth":[{"index":0,"rgb":[0,0,130]},{"index":0.1,"rgb":[0,180,180]},{"index":0.2,"rgb":[40,210,40]},{"index":0.4,"rgb":[230,230,50]},{"index":0.6,"rgb":[120,70,20]},{"index":1,"rgb":[255,255,255]}], - - "electric":[{"index":0,"rgb":[0,0,0]},{"index":0.15,"rgb":[30,0,100]},{"index":0.4,"rgb":[120,0,100]},{"index":0.6,"rgb":[160,90,0]},{"index":0.8,"rgb":[230,200,0]},{"index":1,"rgb":[255,250,220]}], - - "alpha": [{"index":0, "rgb": [255,255,255,0]},{"index":1, "rgb": [255,255,255,1]}], - - "viridis": [{"index":0,"rgb":[68,1,84]},{"index":0.13,"rgb":[71,44,122]},{"index":0.25,"rgb":[59,81,139]},{"index":0.38,"rgb":[44,113,142]},{"index":0.5,"rgb":[33,144,141]},{"index":0.63,"rgb":[39,173,129]},{"index":0.75,"rgb":[92,200,99]},{"index":0.88,"rgb":[170,220,50]},{"index":1,"rgb":[253,231,37]}], - - "inferno": [{"index":0,"rgb":[0,0,4]},{"index":0.13,"rgb":[31,12,72]},{"index":0.25,"rgb":[85,15,109]},{"index":0.38,"rgb":[136,34,106]},{"index":0.5,"rgb":[186,54,85]},{"index":0.63,"rgb":[227,89,51]},{"index":0.75,"rgb":[249,140,10]},{"index":0.88,"rgb":[249,201,50]},{"index":1,"rgb":[252,255,164]}], - - "magma": [{"index":0,"rgb":[0,0,4]},{"index":0.13,"rgb":[28,16,68]},{"index":0.25,"rgb":[79,18,123]},{"index":0.38,"rgb":[129,37,129]},{"index":0.5,"rgb":[181,54,122]},{"index":0.63,"rgb":[229,80,100]},{"index":0.75,"rgb":[251,135,97]},{"index":0.88,"rgb":[254,194,135]},{"index":1,"rgb":[252,253,191]}], - - "plasma": [{"index":0,"rgb":[13,8,135]},{"index":0.13,"rgb":[75,3,161]},{"index":0.25,"rgb":[125,3,168]},{"index":0.38,"rgb":[168,34,150]},{"index":0.5,"rgb":[203,70,121]},{"index":0.63,"rgb":[229,107,93]},{"index":0.75,"rgb":[248,148,65]},{"index":0.88,"rgb":[253,195,40]},{"index":1,"rgb":[240,249,33]}], - - "warm": [{"index":0,"rgb":[125,0,179]},{"index":0.13,"rgb":[172,0,187]},{"index":0.25,"rgb":[219,0,170]},{"index":0.38,"rgb":[255,0,130]},{"index":0.5,"rgb":[255,63,74]},{"index":0.63,"rgb":[255,123,0]},{"index":0.75,"rgb":[234,176,0]},{"index":0.88,"rgb":[190,228,0]},{"index":1,"rgb":[147,255,0]}], - - "cool": [{"index":0,"rgb":[125,0,179]},{"index":0.13,"rgb":[116,0,218]},{"index":0.25,"rgb":[98,74,237]},{"index":0.38,"rgb":[68,146,231]},{"index":0.5,"rgb":[0,204,197]},{"index":0.63,"rgb":[0,247,146]},{"index":0.75,"rgb":[0,255,88]},{"index":0.88,"rgb":[40,255,8]},{"index":1,"rgb":[147,255,0]}], - - "rainbow-soft": [{"index":0,"rgb":[125,0,179]},{"index":0.1,"rgb":[199,0,180]},{"index":0.2,"rgb":[255,0,121]},{"index":0.3,"rgb":[255,108,0]},{"index":0.4,"rgb":[222,194,0]},{"index":0.5,"rgb":[150,255,0]},{"index":0.6,"rgb":[0,255,55]},{"index":0.7,"rgb":[0,246,150]},{"index":0.8,"rgb":[50,167,222]},{"index":0.9,"rgb":[103,51,235]},{"index":1,"rgb":[124,0,186]}], - - "bathymetry": [{"index":0,"rgb":[40,26,44]},{"index":0.13,"rgb":[59,49,90]},{"index":0.25,"rgb":[64,76,139]},{"index":0.38,"rgb":[63,110,151]},{"index":0.5,"rgb":[72,142,158]},{"index":0.63,"rgb":[85,174,163]},{"index":0.75,"rgb":[120,206,163]},{"index":0.88,"rgb":[187,230,172]},{"index":1,"rgb":[253,254,204]}], - - "cdom": [{"index":0,"rgb":[47,15,62]},{"index":0.13,"rgb":[87,23,86]},{"index":0.25,"rgb":[130,28,99]},{"index":0.38,"rgb":[171,41,96]},{"index":0.5,"rgb":[206,67,86]},{"index":0.63,"rgb":[230,106,84]},{"index":0.75,"rgb":[242,149,103]},{"index":0.88,"rgb":[249,193,135]},{"index":1,"rgb":[254,237,176]}], - - "chlorophyll": [{"index":0,"rgb":[18,36,20]},{"index":0.13,"rgb":[25,63,41]},{"index":0.25,"rgb":[24,91,59]},{"index":0.38,"rgb":[13,119,72]},{"index":0.5,"rgb":[18,148,80]},{"index":0.63,"rgb":[80,173,89]},{"index":0.75,"rgb":[132,196,122]},{"index":0.88,"rgb":[175,221,162]},{"index":1,"rgb":[215,249,208]}], - - "density": [{"index":0,"rgb":[54,14,36]},{"index":0.13,"rgb":[89,23,80]},{"index":0.25,"rgb":[110,45,132]},{"index":0.38,"rgb":[120,77,178]},{"index":0.5,"rgb":[120,113,213]},{"index":0.63,"rgb":[115,151,228]},{"index":0.75,"rgb":[134,185,227]},{"index":0.88,"rgb":[177,214,227]},{"index":1,"rgb":[230,241,241]}], - - "freesurface-blue": [{"index":0,"rgb":[30,4,110]},{"index":0.13,"rgb":[47,14,176]},{"index":0.25,"rgb":[41,45,236]},{"index":0.38,"rgb":[25,99,212]},{"index":0.5,"rgb":[68,131,200]},{"index":0.63,"rgb":[114,156,197]},{"index":0.75,"rgb":[157,181,203]},{"index":0.88,"rgb":[200,208,216]},{"index":1,"rgb":[241,237,236]}], - - "freesurface-red": [{"index":0,"rgb":[60,9,18]},{"index":0.13,"rgb":[100,17,27]},{"index":0.25,"rgb":[142,20,29]},{"index":0.38,"rgb":[177,43,27]},{"index":0.5,"rgb":[192,87,63]},{"index":0.63,"rgb":[205,125,105]},{"index":0.75,"rgb":[216,162,148]},{"index":0.88,"rgb":[227,199,193]},{"index":1,"rgb":[241,237,236]}], - - "oxygen": [{"index":0,"rgb":[64,5,5]},{"index":0.13,"rgb":[106,6,15]},{"index":0.25,"rgb":[144,26,7]},{"index":0.38,"rgb":[168,64,3]},{"index":0.5,"rgb":[188,100,4]},{"index":0.63,"rgb":[206,136,11]},{"index":0.75,"rgb":[220,174,25]},{"index":0.88,"rgb":[231,215,44]},{"index":1,"rgb":[248,254,105]}], - - "par": [{"index":0,"rgb":[51,20,24]},{"index":0.13,"rgb":[90,32,35]},{"index":0.25,"rgb":[129,44,34]},{"index":0.38,"rgb":[159,68,25]},{"index":0.5,"rgb":[182,99,19]},{"index":0.63,"rgb":[199,134,22]},{"index":0.75,"rgb":[212,171,35]},{"index":0.88,"rgb":[221,210,54]},{"index":1,"rgb":[225,253,75]}], - - "phase": [{"index":0,"rgb":[145,105,18]},{"index":0.13,"rgb":[184,71,38]},{"index":0.25,"rgb":[186,58,115]},{"index":0.38,"rgb":[160,71,185]},{"index":0.5,"rgb":[110,97,218]},{"index":0.63,"rgb":[50,123,164]},{"index":0.75,"rgb":[31,131,110]},{"index":0.88,"rgb":[77,129,34]},{"index":1,"rgb":[145,105,18]}], - - "salinity": [{"index":0,"rgb":[42,24,108]},{"index":0.13,"rgb":[33,50,162]},{"index":0.25,"rgb":[15,90,145]},{"index":0.38,"rgb":[40,118,137]},{"index":0.5,"rgb":[59,146,135]},{"index":0.63,"rgb":[79,175,126]},{"index":0.75,"rgb":[120,203,104]},{"index":0.88,"rgb":[193,221,100]},{"index":1,"rgb":[253,239,154]}], - - "temperature": [{"index":0,"rgb":[4,35,51]},{"index":0.13,"rgb":[23,51,122]},{"index":0.25,"rgb":[85,59,157]},{"index":0.38,"rgb":[129,79,143]},{"index":0.5,"rgb":[175,95,130]},{"index":0.63,"rgb":[222,112,101]},{"index":0.75,"rgb":[249,146,66]},{"index":0.88,"rgb":[249,196,65]},{"index":1,"rgb":[232,250,91]}], - - "turbidity": [{"index":0,"rgb":[34,31,27]},{"index":0.13,"rgb":[65,50,41]},{"index":0.25,"rgb":[98,69,52]},{"index":0.38,"rgb":[131,89,57]},{"index":0.5,"rgb":[161,112,59]},{"index":0.63,"rgb":[185,140,66]},{"index":0.75,"rgb":[202,174,88]},{"index":0.88,"rgb":[216,209,126]},{"index":1,"rgb":[233,246,171]}], - - "velocity-blue": [{"index":0,"rgb":[17,32,64]},{"index":0.13,"rgb":[35,52,116]},{"index":0.25,"rgb":[29,81,156]},{"index":0.38,"rgb":[31,113,162]},{"index":0.5,"rgb":[50,144,169]},{"index":0.63,"rgb":[87,173,176]},{"index":0.75,"rgb":[149,196,189]},{"index":0.88,"rgb":[203,221,211]},{"index":1,"rgb":[254,251,230]}], - - "velocity-green": [{"index":0,"rgb":[23,35,19]},{"index":0.13,"rgb":[24,64,38]},{"index":0.25,"rgb":[11,95,45]},{"index":0.38,"rgb":[39,123,35]},{"index":0.5,"rgb":[95,146,12]},{"index":0.63,"rgb":[152,165,18]},{"index":0.75,"rgb":[201,186,69]},{"index":0.88,"rgb":[233,216,137]},{"index":1,"rgb":[255,253,205]}], - - "cubehelix": [{"index":0,"rgb":[0,0,0]},{"index":0.07,"rgb":[22,5,59]},{"index":0.13,"rgb":[60,4,105]},{"index":0.2,"rgb":[109,1,135]},{"index":0.27,"rgb":[161,0,147]},{"index":0.33,"rgb":[210,2,142]},{"index":0.4,"rgb":[251,11,123]},{"index":0.47,"rgb":[255,29,97]},{"index":0.53,"rgb":[255,54,69]},{"index":0.6,"rgb":[255,85,46]},{"index":0.67,"rgb":[255,120,34]},{"index":0.73,"rgb":[255,157,37]},{"index":0.8,"rgb":[241,191,57]},{"index":0.87,"rgb":[224,220,93]},{"index":0.93,"rgb":[218,241,142]},{"index":1,"rgb":[227,253,198]}] -}; - -},{}],114:[function(_dereq_,module,exports){ -/* - * Ben Postlethwaite - * January 2013 - * License MIT - */ -'use strict'; - -var colorScale = _dereq_('./colorScale'); -var lerp = _dereq_('lerp') - -module.exports = createColormap; - -function createColormap (spec) { - /* - * Default Options - */ - var indicies, rgba, fromrgba, torgba, - nsteps, cmap, colormap, format, - nshades, colors, alpha, index, i, - r = [], - g = [], - b = [], - a = []; - - if ( !spec ) spec = {}; - - nshades = (spec.nshades || 72) - 1; - format = spec.format || 'hex'; - - colormap = spec.colormap; - if (!colormap) colormap = 'jet'; - - if (typeof colormap === 'string') { - colormap = colormap.toLowerCase(); - - if (!colorScale[colormap]) { - throw Error(colormap + ' not a supported colorscale'); - } - - cmap = colorScale[colormap]; - - } else if (Array.isArray(colormap)) { - cmap = colormap.slice(); - - } else { - throw Error('unsupported colormap option', colormap); - } - - if (cmap.length > nshades) { - throw new Error( - colormap+' map requires nshades to be at least size '+cmap.length - ); - } - - if (!Array.isArray(spec.alpha)) { - - if (typeof spec.alpha === 'number') { - alpha = [spec.alpha, spec.alpha]; - - } else { - alpha = [1, 1]; - } - - } else if (spec.alpha.length !== 2) { - alpha = [1, 1]; - - } else { - alpha = spec.alpha.slice(); - } - - // map index points from 0..1 to 0..n-1 - indicies = cmap.map(function(c) { - return Math.round(c.index * nshades); - }); - - // Add alpha channel to the map - alpha[0] = Math.min(Math.max(alpha[0], 0), 1); - alpha[1] = Math.min(Math.max(alpha[1], 0), 1); - - var steps = cmap.map(function(c, i) { - var index = cmap[i].index - - var rgba = cmap[i].rgb.slice(); - - // if user supplies their own map use it - if (rgba.length === 4 && rgba[3] >= 0 && rgba[3] <= 1) { - return rgba + var d3_geo_clipExtentMAX = 1e9; + d3.geo.clipExtent = function() { + var x0, y0, x1, y1, stream, clip, clipExtent = { + stream: function(output) { + if (stream) stream.valid = false; + stream = clip(output); + stream.valid = true; + return stream; + }, + extent: function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); + if (stream) stream.valid = false, stream = null; + return clipExtent; + } + }; + return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); + }; + function d3_geo_clipExtent(x0, y0, x1, y1) { + return function(listener) { + var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + listener = bufferListener; + segments = []; + polygon = []; + clean = true; + }, + polygonEnd: function() { + listener = listener_; + segments = d3.merge(segments); + var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; + if (inside || visible) { + listener.polygonStart(); + if (inside) { + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + } + if (visible) { + d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); + } + listener.polygonEnd(); + } + segments = polygon = ring = null; } - rgba[3] = alpha[0] + (alpha[1] - alpha[0])*index; - - return rgba - }) - - - /* - * map increasing linear values between indicies to - * linear steps in colorvalues - */ - var colors = [] - for (i = 0; i < indicies.length-1; ++i) { - nsteps = indicies[i+1] - indicies[i]; - fromrgba = steps[i]; - torgba = steps[i+1]; - - for (var j = 0; j < nsteps; j++) { - var amt = j / nsteps - colors.push([ - Math.round(lerp(fromrgba[0], torgba[0], amt)), - Math.round(lerp(fromrgba[1], torgba[1], amt)), - Math.round(lerp(fromrgba[2], torgba[2], amt)), - lerp(fromrgba[3], torgba[3], amt) - ]) + }; + function insidePolygon(p) { + var wn = 0, n = polygon.length, y = p[1]; + for (var i = 0; i < n; ++i) { + for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { + b = v[j]; + if (a[1] <= y) { + if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; + } else { + if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; + } + a = b; + } } - } - - //add 1 step as last value - colors.push(cmap[cmap.length - 1].rgb.concat(alpha[1])) - - if (format === 'hex') colors = colors.map( rgb2hex ); - else if (format === 'rgbaString') colors = colors.map( rgbaStr ); - else if (format === 'float') colors = colors.map( rgb2float ); - - return colors; -}; - -function rgb2float (rgba) { - return [ - rgba[0] / 255, - rgba[1] / 255, - rgba[2] / 255, - rgba[3] - ] -} - -function rgb2hex (rgba) { - var dig, hex = '#'; - for (var i = 0; i < 3; ++i) { - dig = rgba[i]; - dig = dig.toString(16); - hex += ('00' + dig).substr( dig.length ); - } - return hex; -} - -function rgbaStr (rgba) { - return 'rgba(' + rgba.join(',') + ')'; -} - -},{"./colorScale":113,"lerp":408}],115:[function(_dereq_,module,exports){ -"use strict" - -module.exports = compareAngle - -var orient = _dereq_("robust-orientation") -var sgn = _dereq_("signum") -var twoSum = _dereq_("two-sum") -var robustProduct = _dereq_("robust-product") -var robustSum = _dereq_("robust-sum") - -function testInterior(a, b, c) { - var x0 = twoSum(a[0], -b[0]) - var y0 = twoSum(a[1], -b[1]) - var x1 = twoSum(c[0], -b[0]) - var y1 = twoSum(c[1], -b[1]) - - var d = robustSum( - robustProduct(x0, x1), - robustProduct(y0, y1)) - - return d[d.length-1] >= 0 -} - -function compareAngle(a, b, c, d) { - var bcd = orient(b, c, d) - if(bcd === 0) { - //Handle degenerate cases - var sabc = sgn(orient(a, b, c)) - var sabd = sgn(orient(a, b, d)) - if(sabc === sabd) { - if(sabc === 0) { - var ic = testInterior(a, b, c) - var id = testInterior(a, b, d) - if(ic === id) { - return 0 - } else if(ic) { - return 1 + return wn !== 0; + } + function interpolate(from, to, direction, listener) { + var a = 0, a1 = 0; + if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { + do { + listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); + } while ((a = (a + direction + 4) % 4) !== a1); } else { - return -1 + listener.point(to[0], to[1]); } } - return 0 - } else if(sabd === 0) { - if(sabc > 0) { - return -1 - } else if(testInterior(a, b, d)) { - return -1 - } else { - return 1 + function pointVisible(x, y) { + return x0 <= x && x <= x1 && y0 <= y && y <= y1; } - } else if(sabc === 0) { - if(sabd > 0) { - return 1 - } else if(testInterior(a, b, c)) { - return 1 - } else { - return -1 + function point(x, y) { + if (pointVisible(x, y)) listener.point(x, y); } - } - return sgn(sabd - sabc) - } - var abc = orient(a, b, c) - if(abc > 0) { - if(bcd > 0 && orient(a, b, d) > 0) { - return 1 - } - return -1 - } else if(abc < 0) { - if(bcd > 0 || orient(a, b, d) > 0) { - return 1 - } - return -1 - } else { - var abd = orient(a, b, d) - if(abd > 0) { - return 1 - } else { - if(testInterior(a, b, c)) { - return 1 - } else { - return -1 + var x__, y__, v__, x_, y_, v_, first, clean; + function lineStart() { + clip.point = linePoint; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; } - } - } -} -},{"robust-orientation":486,"robust-product":487,"robust-sum":491,"signum":492,"two-sum":521}],116:[function(_dereq_,module,exports){ -module.exports = compareCells - -var min = Math.min - -function compareInt(a, b) { - return a - b -} - -function compareCells(a, b) { - var n = a.length - , t = a.length - b.length - if(t) { - return t - } - switch(n) { - case 0: - return 0 - case 1: - return a[0] - b[0] - case 2: - return (a[0]+a[1]-b[0]-b[1]) || - min(a[0],a[1]) - min(b[0],b[1]) - case 3: - var l1 = a[0]+a[1] - , m1 = b[0]+b[1] - t = l1+a[2] - (m1+b[2]) - if(t) { - return t - } - var l0 = min(a[0], a[1]) - , m0 = min(b[0], b[1]) - return min(l0, a[2]) - min(m0, b[2]) || - min(l0+a[2], l1) - min(m0+b[2], m1) - case 4: - var aw=a[0], ax=a[1], ay=a[2], az=a[3] - , bw=b[0], bx=b[1], by=b[2], bz=b[3] - return (aw+ax+ay+az)-(bw+bx+by+bz) || - min(aw,ax,ay,az)-min(bw,bx,by,bz,bw) || - min(aw+ax,aw+ay,aw+az,ax+ay,ax+az,ay+az) - - min(bw+bx,bw+by,bw+bz,bx+by,bx+bz,by+bz) || - min(aw+ax+ay,aw+ax+az,aw+ay+az,ax+ay+az) - - min(bw+bx+by,bw+bx+bz,bw+by+bz,bx+by+bz) - default: - var as = a.slice().sort(compareInt) - var bs = b.slice().sort(compareInt) - for(var i=0; i points[hi][0]) { - hi = i - } - } - if(lo < hi) { - return [[lo], [hi]] - } else if(lo > hi) { - return [[hi], [lo]] - } else { - return [[lo]] - } -} -},{}],120:[function(_dereq_,module,exports){ -'use strict' - -module.exports = convexHull2D - -var monotoneHull = _dereq_('monotone-convex-hull-2d') - -function convexHull2D(points) { - var hull = monotoneHull(points) - var h = hull.length - if(h <= 2) { - return [] - } - var edges = new Array(h) - var a = hull[h-1] - for(var i=0; i= front[k]) { - x += 1 + function linePoint(x, y) { + x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); + y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); + var v = pointVisible(x, y); + if (polygon) ring.push([ x, y ]); + if (first) { + x__ = x, y__ = y, v__ = v; + first = false; + if (v) { + listener.lineStart(); + listener.point(x, y); + } + } else { + if (v && v_) listener.point(x, y); else { + var l = { + a: { + x: x_, + y: y_ + }, + b: { + x: x, + y: y + } + }; + if (clipLine(l)) { + if (!v_) { + listener.lineStart(); + listener.point(l.a.x, l.a.y); + } + listener.point(l.b.x, l.b.y); + if (!v) listener.lineEnd(); + clean = false; + } else if (v) { + listener.lineStart(); + listener.point(x, y); + clean = false; + } } } - c[j] = x + x_ = x, y_ = y, v_ = v; } + return clip; + }; + function corner(p, direction) { + return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; } - } - return cells -} - -function convexHullnD(points, d) { - try { - return ich(points, true) - } catch(e) { - //If point set is degenerate, try to find a basis and rerun it - var ah = aff(points) - if(ah.length <= d) { - //No basis, no try - return [] - } - var npoints = permute(points, ah) - var nhull = ich(npoints, true) - return invPermute(nhull, ah) - } -} -},{"affine-hull":50,"incremental-convex-hull":396}],122:[function(_dereq_,module,exports){ -module.exports = { - AFG: 'afghan', - ALA: '\\b\\wland', - ALB: 'albania', - DZA: 'algeria', - ASM: '^(?=.*americ).*samoa', - AND: 'andorra', - AGO: 'angola', - AIA: 'anguill?a', - ATA: 'antarctica', - ATG: 'antigua', - ARG: 'argentin', - ARM: 'armenia', - ABW: '^(?!.*bonaire).*\\baruba', - AUS: 'australia', - AUT: '^(?!.*hungary).*austria|\\baustri.*\\bemp', - AZE: 'azerbaijan', - BHS: 'bahamas', - BHR: 'bahrain', - BGD: 'bangladesh|^(?=.*east).*paki?stan', - BRB: 'barbados', - BLR: 'belarus|byelo', - BEL: '^(?!.*luxem).*belgium', - BLZ: 'belize|^(?=.*british).*honduras', - BEN: 'benin|dahome', - BMU: 'bermuda', - BTN: 'bhutan', - BOL: 'bolivia', - BES: '^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands', - BIH: 'herzegovina|bosnia', - BWA: 'botswana|bechuana', - BVT: 'bouvet', - BRA: 'brazil', - IOT: 'british.?indian.?ocean', - BRN: 'brunei', - BGR: 'bulgaria', - BFA: 'burkina|\\bfaso|upper.?volta', - BDI: 'burundi', - CPV: 'verde', - KHM: 'cambodia|kampuchea|khmer', - CMR: 'cameroon', - CAN: 'canada', - CYM: 'cayman', - CAF: '\\bcentral.african.republic', - TCD: '\\bchad', - CHL: '\\bchile', - CHN: '^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china', - CXR: 'christmas', - CCK: '\\bcocos|keeling', - COL: 'colombia', - COM: 'comoro', - COG: '^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo', - COK: '\\bcook', - CRI: 'costa.?rica', - CIV: 'ivoire|ivory', - HRV: 'croatia', - CUB: '\\bcuba', - CUW: '^(?!.*bonaire).*\\bcura(c|ç)ao', - CYP: 'cyprus', - CSK: 'czechoslovakia', - CZE: '^(?=.*rep).*czech|czechia|bohemia', - COD: '\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc', - DNK: 'denmark', - DJI: 'djibouti', - DMA: 'dominica(?!n)', - DOM: 'dominican.rep', - ECU: 'ecuador', - EGY: 'egypt', - SLV: 'el.?salvador', - GNQ: 'guine.*eq|eq.*guine|^(?=.*span).*guinea', - ERI: 'eritrea', - EST: 'estonia', - ETH: 'ethiopia|abyssinia', - FLK: 'falkland|malvinas', - FRO: 'faroe|faeroe', - FJI: 'fiji', - FIN: 'finland', - FRA: '^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul', - GUF: '^(?=.*french).*guiana', - PYF: 'french.?polynesia|tahiti', - ATF: 'french.?southern', - GAB: 'gabon', - GMB: 'gambia', - GEO: '^(?!.*south).*georgia', - DDR: 'german.?democratic.?republic|democratic.?republic.*germany|east.germany', - DEU: '^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german', - GHA: 'ghana|gold.?coast', - GIB: 'gibraltar', - GRC: 'greece|hellenic|hellas', - GRL: 'greenland', - GRD: 'grenada', - GLP: 'guadeloupe', - GUM: '\\bguam', - GTM: 'guatemala', - GGY: 'guernsey', - GIN: '^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea', - GNB: 'bissau|^(?=.*portu).*guinea', - GUY: 'guyana|british.?guiana', - HTI: 'haiti', - HMD: 'heard.*mcdonald', - VAT: 'holy.?see|vatican|papal.?st', - HND: '^(?!.*brit).*honduras', - HKG: 'hong.?kong', - HUN: '^(?!.*austr).*hungary', - ISL: 'iceland', - IND: 'india(?!.*ocea)', - IDN: 'indonesia', - IRN: '\\biran|persia', - IRQ: '\\biraq|mesopotamia', - IRL: '(^ireland)|(^republic.*ireland)', - IMN: '^(?=.*isle).*\\bman', - ISR: 'israel', - ITA: 'italy', - JAM: 'jamaica', - JPN: 'japan', - JEY: 'jersey', - JOR: 'jordan', - KAZ: 'kazak', - KEN: 'kenya|british.?east.?africa|east.?africa.?prot', - KIR: 'kiribati', - PRK: '^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)', - KWT: 'kuwait', - KGZ: 'kyrgyz|kirghiz', - LAO: '\\blaos?\\b', - LVA: 'latvia', - LBN: 'lebanon', - LSO: 'lesotho|basuto', - LBR: 'liberia', - LBY: 'libya', - LIE: 'liechtenstein', - LTU: 'lithuania', - LUX: '^(?!.*belg).*luxem', - MAC: 'maca(o|u)', - MDG: 'madagascar|malagasy', - MWI: 'malawi|nyasa', - MYS: 'malaysia', - MDV: 'maldive', - MLI: '\\bmali\\b', - MLT: '\\bmalta', - MHL: 'marshall', - MTQ: 'martinique', - MRT: 'mauritania', - MUS: 'mauritius', - MYT: '\\bmayotte', - MEX: '\\bmexic', - FSM: 'fed.*micronesia|micronesia.*fed', - MCO: 'monaco', - MNG: 'mongolia', - MNE: '^(?!.*serbia).*montenegro', - MSR: 'montserrat', - MAR: 'morocco|\\bmaroc', - MOZ: 'mozambique', - MMR: 'myanmar|burma', - NAM: 'namibia', - NRU: 'nauru', - NPL: 'nepal', - NLD: '^(?!.*\\bant)(?!.*\\bcarib).*netherlands', - ANT: '^(?=.*\\bant).*(nether|dutch)', - NCL: 'new.?caledonia', - NZL: 'new.?zealand', - NIC: 'nicaragua', - NER: '\\bniger(?!ia)', - NGA: 'nigeria', - NIU: 'niue', - NFK: 'norfolk', - MNP: 'mariana', - NOR: 'norway', - OMN: '\\boman|trucial', - PAK: '^(?!.*east).*paki?stan', - PLW: 'palau', - PSE: 'palestin|\\bgaza|west.?bank', - PAN: 'panama', - PNG: 'papua|new.?guinea', - PRY: 'paraguay', - PER: 'peru', - PHL: 'philippines', - PCN: 'pitcairn', - POL: 'poland', - PRT: 'portugal', - PRI: 'puerto.?rico', - QAT: 'qatar', - KOR: '^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)', - MDA: 'moldov|b(a|e)ssarabia', - REU: 'r(e|é)union', - ROU: 'r(o|u|ou)mania', - RUS: '\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics', - RWA: 'rwanda', - BLM: 'barth(e|é)lemy', - SHN: 'helena', - KNA: 'kitts|\\bnevis', - LCA: '\\blucia', - MAF: '^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)', - SPM: 'miquelon', - VCT: 'vincent', - WSM: '^(?!.*amer).*samoa', - SMR: 'san.?marino', - STP: '\\bs(a|ã)o.?tom(e|é)', - SAU: '\\bsa\\w*.?arabia', - SEN: 'senegal', - SRB: '^(?!.*monte).*serbia', - SYC: 'seychell', - SLE: 'sierra', - SGP: 'singapore', - SXM: '^(?!.*martin)(?!.*saba).*maarten', - SVK: '^(?!.*cze).*slovak', - SVN: 'slovenia', - SLB: 'solomon', - SOM: 'somali', - ZAF: 'south.africa|s\\\\..?africa', - SGS: 'south.?georgia|sandwich', - SSD: '\\bs\\w*.?sudan', - ESP: 'spain', - LKA: 'sri.?lanka|ceylon', - SDN: '^(?!.*\\bs(?!u)).*sudan', - SUR: 'surinam|dutch.?guiana', - SJM: 'svalbard', - SWZ: 'swaziland', - SWE: 'sweden', - CHE: 'switz|swiss', - SYR: 'syria', - TWN: 'taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china', - TJK: 'tajik', - THA: 'thailand|\\bsiam', - MKD: 'macedonia|fyrom', - TLS: '^(?=.*leste).*timor|^(?=.*east).*timor', - TGO: 'togo', - TKL: 'tokelau', - TON: 'tonga', - TTO: 'trinidad|tobago', - TUN: 'tunisia', - TUR: 'turkey', - TKM: 'turkmen', - TCA: 'turks', - TUV: 'tuvalu', - UGA: 'uganda', - UKR: 'ukrain', - ARE: 'emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em', - GBR: 'united.?kingdom|britain|^u\\.?k\\.?$', - TZA: 'tanzania', - USA: 'united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)', - UMI: 'minor.?outlying.?is', - URY: 'uruguay', - UZB: 'uzbek', - VUT: 'vanuatu|new.?hebrides', - VEN: 'venezuela', - VNM: '^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam', - VGB: '^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin', - VIR: '^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin', - WLF: 'futuna|wallis', - ESH: 'western.sahara', - YEM: '^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen', - YMD: '^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen', - YUG: 'yugoslavia', - ZMB: 'zambia|northern.?rhodesia', - EAZ: 'zanzibar', - ZWE: 'zimbabwe|^(?!.*northern).*rhodesia' -} - -},{}],123:[function(_dereq_,module,exports){ -module.exports=[ - "xx-small", - "x-small", - "small", - "medium", - "large", - "x-large", - "xx-large", - "larger", - "smaller" -] - -},{}],124:[function(_dereq_,module,exports){ -module.exports=[ - "normal", - "condensed", - "semi-condensed", - "extra-condensed", - "ultra-condensed", - "expanded", - "semi-expanded", - "extra-expanded", - "ultra-expanded" -] - -},{}],125:[function(_dereq_,module,exports){ -module.exports=[ - "normal", - "italic", - "oblique" -] - -},{}],126:[function(_dereq_,module,exports){ -module.exports=[ - "normal", - "bold", - "bolder", - "lighter", - "100", - "200", - "300", - "400", - "500", - "600", - "700", - "800", - "900" -] - -},{}],127:[function(_dereq_,module,exports){ -'use strict' - -module.exports = { - parse: _dereq_('./parse'), - stringify: _dereq_('./stringify') -} - -},{"./parse":129,"./stringify":130}],128:[function(_dereq_,module,exports){ -'use strict' - -var sizes = _dereq_('css-font-size-keywords') - -module.exports = { - isSize: function isSize(value) { - return /^[\d\.]/.test(value) - || value.indexOf('/') !== -1 - || sizes.indexOf(value) !== -1 - } -} - -},{"css-font-size-keywords":123}],129:[function(_dereq_,module,exports){ -'use strict' - -var unquote = _dereq_('unquote') -var globalKeywords = _dereq_('css-global-keywords') -var systemFontKeywords = _dereq_('css-system-font-keywords') -var fontWeightKeywords = _dereq_('css-font-weight-keywords') -var fontStyleKeywords = _dereq_('css-font-style-keywords') -var fontStretchKeywords = _dereq_('css-font-stretch-keywords') -var splitBy = _dereq_('string-split-by') -var isSize = _dereq_('./lib/util').isSize - - -module.exports = parseFont - - -var cache = parseFont.cache = {} - - -function parseFont (value) { - if (typeof value !== 'string') throw new Error('Font argument must be a string.') - - if (cache[value]) return cache[value] - - if (value === '') { - throw new Error('Cannot parse an empty string.') - } - - if (systemFontKeywords.indexOf(value) !== -1) { - return cache[value] = {system: value} - } - - var font = { - style: 'normal', - variant: 'normal', - weight: 'normal', - stretch: 'normal', - lineHeight: 'normal', - size: '1rem', - family: ['serif'] - } - - var tokens = splitBy(value, /\s+/) - var token - - while (token = tokens.shift()) { - if (globalKeywords.indexOf(token) !== -1) { - ['style', 'variant', 'weight', 'stretch'].forEach(function(prop) { - font[prop] = token - }) - - return cache[value] = font - } - - if (fontStyleKeywords.indexOf(token) !== -1) { - font.style = token - continue - } - - if (token === 'normal' || token === 'small-caps') { - font.variant = token - continue - } - - if (fontStretchKeywords.indexOf(token) !== -1) { - font.stretch = token - continue - } - - if (fontWeightKeywords.indexOf(token) !== -1) { - font.weight = token - continue - } - - - if (isSize(token)) { - var parts = splitBy(token, '/') - font.size = parts[0] - if (parts[1] != null) { - font.lineHeight = parseLineHeight(parts[1]) - } - else if (tokens[0] === '/') { - tokens.shift() - font.lineHeight = parseLineHeight(tokens.shift()) - } - - if (!tokens.length) { - throw new Error('Missing required font-family.') - } - font.family = splitBy(tokens.join(' '), /\s*,\s*/).map(unquote) - - return cache[value] = font - } - - throw new Error('Unknown or unsupported font token: ' + token) - } - - throw new Error('Missing required font-size.') -} - - -function parseLineHeight(value) { - var parsed = parseFloat(value) - if (parsed.toString() === value) { - return parsed - } - return value -} - -},{"./lib/util":128,"css-font-stretch-keywords":124,"css-font-style-keywords":125,"css-font-weight-keywords":126,"css-global-keywords":131,"css-system-font-keywords":132,"string-split-by":505,"unquote":525}],130:[function(_dereq_,module,exports){ -'use strict' - -var pick = _dereq_('pick-by-alias') -var isSize = _dereq_('./lib/util').isSize - -var globals = a2o(_dereq_('css-global-keywords')) -var systems = a2o(_dereq_('css-system-font-keywords')) -var weights = a2o(_dereq_('css-font-weight-keywords')) -var styles = a2o(_dereq_('css-font-style-keywords')) -var stretches = a2o(_dereq_('css-font-stretch-keywords')) - -var variants = {'normal': 1, 'small-caps': 1} -var fams = { - 'serif': 1, - 'sans-serif': 1, - 'monospace': 1, - 'cursive': 1, - 'fantasy': 1, - 'system-ui': 1 -} - -var defaults = { - style: 'normal', - variant: 'normal', - weight: 'normal', - stretch: 'normal', - size: '1rem', - lineHeight: 'normal', - family: 'serif' -} - -module.exports = function stringifyFont (o) { - o = pick(o, { - style: 'style fontstyle fontStyle font-style slope distinction', - variant: 'variant font-variant fontVariant fontvariant var capitalization', - weight: 'weight w font-weight fontWeight fontweight', - stretch: 'stretch font-stretch fontStretch fontstretch width', - size: 'size s font-size fontSize fontsize height em emSize', - lineHeight: 'lh line-height lineHeight lineheight leading', - family: 'font family fontFamily font-family fontfamily type typeface face', - system: 'system reserved default global', - }) - - if (o.system) { - if (o.system) verify(o.system, systems) - return o.system - } - - verify(o.style, styles) - verify(o.variant, variants) - verify(o.weight, weights) - verify(o.stretch, stretches) - - // default root value is medium, but by default it's inherited - if (o.size == null) o.size = defaults.size - if (typeof o.size === 'number') o.size += 'px' - - if (!isSize) throw Error('Bad size value `' + o.size + '`') - - // many user-agents use serif, we don't detect that for consistency - if (!o.family) o.family = defaults.family - if (Array.isArray(o.family)) { - if (!o.family.length) o.family = [defaults.family] - o.family = o.family.map(function (f) { - return fams[f] ? f : '"' + f + '"' - }).join(', ') - } - - // [ [ <'font-style'> || || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] - var result = [] - - result.push(o.style) - if (o.variant !== o.style) result.push(o.variant) - - if (o.weight !== o.variant && - o.weight !== o.style) result.push(o.weight) - - if (o.stretch !== o.weight && - o.stretch !== o.variant && - o.stretch !== o.style) result.push(o.stretch) - - result.push(o.size + (o.lineHeight == null || o.lineHeight === 'normal' || (o.lineHeight + '' === '1') ? '' : ('/' + o.lineHeight))) - result.push(o.family) - - return result.filter(Boolean).join(' ') -} - -function verify (value, values) { - if (value && !values[value] && !globals[value]) throw Error('Unknown keyword `' + value +'`') - - return value -} - - -// ['a', 'b'] -> {a: true, b: true} -function a2o (a) { - var o = {} - for (var i = 0; i < a.length; i++) { - o[a[i]] = 1 - } - return o -} - -},{"./lib/util":128,"css-font-stretch-keywords":124,"css-font-style-keywords":125,"css-font-weight-keywords":126,"css-global-keywords":131,"css-system-font-keywords":132,"pick-by-alias":448}],131:[function(_dereq_,module,exports){ -module.exports=[ - "inherit", - "initial", - "unset" -] - -},{}],132:[function(_dereq_,module,exports){ -module.exports=[ - "caption", - "icon", - "menu", - "message-box", - "small-caption", - "status-bar" -] - -},{}],133:[function(_dereq_,module,exports){ -"use strict" - -function dcubicHermite(p0, v0, p1, v1, t, f) { - var dh00 = 6*t*t-6*t, - dh10 = 3*t*t-4*t + 1, - dh01 = -6*t*t+6*t, - dh11 = 3*t*t-2*t - if(p0.length) { - if(!f) { - f = new Array(p0.length) - } - for(var i=p0.length-1; i>=0; --i) { - f[i] = dh00*p0[i] + dh10*v0[i] + dh01*p1[i] + dh11*v1[i] - } - return f - } - return dh00*p0 + dh10*v0 + dh01*p1[i] + dh11*v1 -} - -function cubicHermite(p0, v0, p1, v1, t, f) { - var ti = (t-1), t2 = t*t, ti2 = ti*ti, - h00 = (1+2*t)*ti2, - h10 = t*ti2, - h01 = t2*(3-2*t), - h11 = t2*ti - if(p0.length) { - if(!f) { - f = new Array(p0.length) - } - for(var i=p0.length-1; i>=0; --i) { - f[i] = h00*p0[i] + h10*v0[i] + h01*p1[i] + h11*v1[i] + function compare(a, b) { + return comparePoints(a.x, b.x); } - return f - } - return h00*p0 + h10*v0 + h01*p1 + h11*v1 -} - -module.exports = cubicHermite -module.exports.derivative = dcubicHermite -},{}],134:[function(_dereq_,module,exports){ -"use strict" - -var createThunk = _dereq_("./lib/thunk.js") - -function Procedure() { - this.argTypes = [] - this.shimArgs = [] - this.arrayArgs = [] - this.arrayBlockIndices = [] - this.scalarArgs = [] - this.offsetArgs = [] - this.offsetArgIndex = [] - this.indexArgs = [] - this.shapeArgs = [] - this.funcName = "" - this.pre = null - this.body = null - this.post = null - this.debug = false -} - -function compileCwise(user_args) { - //Create procedure - var proc = new Procedure() - - //Parse blocks - proc.pre = user_args.pre - proc.body = user_args.body - proc.post = user_args.post - - //Parse arguments - var proc_args = user_args.args.slice(0) - proc.argTypes = proc_args - for(var i=0; i0) { - throw new Error("cwise: pre() block may not reference array args") - } - if(i < proc.post.args.length && proc.post.args[i].count>0) { - throw new Error("cwise: post() block may not reference array args") - } - } else if(arg_type === "scalar") { - proc.scalarArgs.push(i) - proc.shimArgs.push("scalar" + i) - } else if(arg_type === "index") { - proc.indexArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { - throw new Error("cwise: pre() block may not reference array index") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array index") - } - if(i < proc.post.args.length && proc.post.args[i].count > 0) { - throw new Error("cwise: post() block may not reference array index") - } - } else if(arg_type === "shape") { - proc.shapeArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { - throw new Error("cwise: pre() block may not write to array shape") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array shape") - } - if(i < proc.post.args.length && proc.post.args[i].lvalue) { - throw new Error("cwise: post() block may not write to array shape") - } - } else if(typeof arg_type === "object" && arg_type.offset) { - proc.argTypes[i] = "offset" - proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) - proc.offsetArgIndex.push(i) - } else { - throw new Error("cwise: Unknown argument type " + proc_args[i]) + function comparePoints(a, b) { + var ca = corner(a, 1), cb = corner(b, 1); + return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; } } - - //Make sure at least one array argument was specified - if(proc.arrayArgs.length <= 0) { - throw new Error("cwise: No array arguments specified") + function d3_geo_conic(projectAt) { + var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); + p.parallels = function(_) { + if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ]; + return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180); + }; + return p; } - - //Make sure arguments are correct - if(proc.pre.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in pre() block") - } - if(proc.body.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in body() block") - } - if(proc.post.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in post() block") + function d3_geo_conicEqualArea(φ0, φ1) { + var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n; + function forward(λ, φ) { + var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; + return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; + } + forward.invert = function(x, y) { + var ρ0_y = ρ0 - y; + return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; + }; + return forward; } - - //Check debug flag - proc.debug = !!user_args.printCode || !!user_args.debug - - //Retrieve name - proc.funcName = user_args.funcName || "cwise" - - //Read in block size - proc.blockSize = user_args.blockSize || 64 - - return createThunk(proc) -} - -module.exports = compileCwise - -},{"./lib/thunk.js":136}],135:[function(_dereq_,module,exports){ -"use strict" - -var uniq = _dereq_("uniq") - -// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) -// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. -function innerFill(order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , has_index = proc.indexArgs.length>0 - , code = [] - , vars = [] - , idx=0, pidx=0, i, j - for(i=0; i 0) { - code.push("var " + vars.join(",")) - } - //Scan loop - for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards - idx = order[i] - code.push(["for(i",i,"=0;i",i," 0) { - code.push(["index[",pidx,"]-=s",pidx].join("")) - } - code.push(["++index[",idx,"]"].join("")) - } - code.push("}") - } - return code.join("\n") -} - -// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. -// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. -// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. -function outerFill(matched, order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , blockSize = proc.blockSize - , has_index = proc.indexArgs.length > 0 - , code = [] - for(var i=0; i0;){"].join("")) // Iterate back to front - code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). - code.push(["s",order[i],"=j",i].join("")) - code.push(["j",i,"=0"].join("")) - code.push(["}else{s",order[i],"=",blockSize].join("")) - code.push(["j",i,"-=",blockSize,"}"].join("")) - if(has_index) { - code.push(["index[",order[i],"]=j",i].join("")) - } - } - for(var i=0; i= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream) { + var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); + return { + point: function(x, y) { + lower48Stream.point(x, y); + alaskaStream.point(x, y); + hawaiiStream.point(x, y); + }, + sphere: function() { + lower48Stream.sphere(); + alaskaStream.sphere(); + hawaiiStream.sphere(); + }, + lineStart: function() { + lower48Stream.lineStart(); + alaskaStream.lineStart(); + hawaiiStream.lineStart(); + }, + lineEnd: function() { + lower48Stream.lineEnd(); + alaskaStream.lineEnd(); + hawaiiStream.lineEnd(); + }, + polygonStart: function() { + lower48Stream.polygonStart(); + alaskaStream.polygonStart(); + hawaiiStream.polygonStart(); + }, + polygonEnd: function() { + lower48Stream.polygonEnd(); + alaskaStream.polygonEnd(); + hawaiiStream.polygonEnd(); + } + }; + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_); + alaska.precision(_); + hawaii.precision(_); + return albersUsa; + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_); + alaska.scale(_ * .35); + hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x = +_[0], y = +_[1]; + lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; + alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; + hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; + return albersUsa; + }; + return albersUsa.scale(1070); + }; + var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_pathAreaPolygon = 0; + d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; + }, + polygonEnd: function() { + d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; + d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); } - if(i > 0) { - allEqual = allEqual && summary[i] === summary[i-1] + }; + function d3_geo_pathAreaRingStart() { + var x00, y00, x0, y0; + d3_geo_pathArea.point = function(x, y) { + d3_geo_pathArea.point = nextPoint; + x00 = x0 = x, y00 = y0 = y; + }; + function nextPoint(x, y) { + d3_geo_pathAreaPolygon += y0 * x - x0 * y; + x0 = x, y0 = y; } + d3_geo_pathArea.lineEnd = function() { + nextPoint(x00, y00); + }; } - if(allEqual) { - return summary[0] - } - return summary.join("") -} - -//Generates a cwise operator -function generateCWiseOp(proc, typesig) { - - //Compute dimension - // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. - var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 - var orders = new Array(proc.arrayArgs.length) - var dtypes = new Array(proc.arrayArgs.length) - for(var i=0; i d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; + if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; + if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; } - - //Determine where block and loop indices start and end - var blockBegin = [], blockEnd = [] // These indices are exposed as blocks - var loopBegin = [], loopEnd = [] // These indices are iterated over - var loopOrders = [] // orders restricted to the loop indices - for(var i=0; i 0) { - vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) - } - if(proc.indexArgs.length > 0) { - // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. - var zeros = new Array(dimension) - for(var i=0; i 0) { - code.push("var " + vars.join(",")) - } - for(var i=0; i 3) { - code.push(processBlock(proc.pre, proc, dtypes)) - } - - //Process body - var body = processBlock(proc.body, proc, dtypes) - var matched = countMatches(loopOrders) - if(matched < dimension) { - code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. - } else { - code.push(innerFill(loopOrders[0], proc, body)) - } - - //Inline epilog - if(proc.post.body.length > 3) { - code.push(processBlock(proc.post, proc, dtypes)) - } - - if(proc.debug) { - console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") - } - - var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") - var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) - return f() -} -module.exports = generateCWiseOp - -},{"uniq":524}],136:[function(_dereq_,module,exports){ -"use strict" - -// The function below is called when constructing a cwise function object, and does the following: -// A function object is constructed which accepts as argument a compilation function and returns another function. -// It is this other function that is eventually returned by createThunk, and this function is the one that actually -// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. -// The compilation passed to the first function object is used for compiling new functions. -// Once this function object is created, it is called with compile as argument, where the first argument of compile -// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). -// So createThunk roughly works like this: -// function createThunk(proc) { -// var thunk = function(compileBound) { -// var CACHED = {} -// return function(arrays and scalars) { -// if (dtype and order of arrays in CACHED) { -// var func = CACHED[dtype and order of arrays] -// } else { -// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) -// } -// return func(arrays and scalars) -// } -// } -// return thunk(compile.bind1(proc)) -// } - -var compile = _dereq_("./compile.js") - -function createThunk(proc) { - var code = ["'use strict'", "var CACHED={}"] - var vars = [] - var thunkName = proc.funcName + "_cwise_thunk" - - //Build thunk - code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) - var typesig = [] - var string_typesig = [] - var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). - Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] - var shapeLengthConditions = [], shapeConditions = [] - // Process array arguments - for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) - shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) - shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") - } - } - // Check for shape equality - if (proc.arrayArgs.length > 1) { - code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") - code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") - code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") - code.push("}") - } - // Process scalar arguments - for(var i=0; i b ? 1 : a >= b ? 0 : NaN; -} - -function bisector(compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - } - return lo; + var d3_geo_pathCentroid = { + point: d3_geo_pathCentroidPoint, + lineStart: d3_geo_pathCentroidLineStart, + lineEnd: d3_geo_pathCentroidLineEnd, + polygonStart: function() { + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; }, - right: function(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) > 0) hi = mid; - else lo = mid + 1; - } - return lo; + polygonEnd: function() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; + d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; } }; -} - -function ascendingComparator(f) { - return function(d, x) { - return ascending(f(d), x); - }; -} - -var ascendingBisect = bisector(ascending); -var bisectRight = ascendingBisect.right; -var bisectLeft = ascendingBisect.left; - -function pairs(array, f) { - if (f == null) f = pair; - var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = f(p, p = array[++i]); - return pairs; -} - -function pair(a, b) { - return [a, b]; -} - -function cross(values0, values1, reduce) { - var n0 = values0.length, - n1 = values1.length, - values = new Array(n0 * n1), - i0, - i1, - i, - value0; - - if (reduce == null) reduce = pair; - - for (i0 = i = 0; i0 < n0; ++i0) { - for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { - values[i] = reduce(value0, values1[i1]); - } + function d3_geo_pathCentroidPoint(x, y) { + d3_geo_centroidX0 += x; + d3_geo_centroidY0 += y; + ++d3_geo_centroidZ0; } - - return values; -} - -function descending(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -function number(x) { - return x === null ? NaN : +x; -} - -function variance(values, valueof) { - var n = values.length, - m = 0, - i = -1, - mean = 0, - value, - delta, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } + function d3_geo_pathCentroidLineStart() { + var x0, y0; + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX1 += z * (x0 + x) / 2; + d3_geo_centroidY1 += z * (y0 + y) / 2; + d3_geo_centroidZ1 += z; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); } } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - delta = value - mean; - mean += delta / ++m; - sum += delta * (value - mean); - } - } + function d3_geo_pathCentroidLineEnd() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; } - - if (m > 1) return sum / (m - 1); -} - -function deviation(array, f) { - var v = variance(array, f); - return v ? Math.sqrt(v) : v; -} - -function extent(values, valueof) { - var n = values.length, - i = -1, - value, - min, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } + function d3_geo_pathCentroidRingStart() { + var x00, y00, x0, y0; + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX1 += z * (x0 + x) / 2; + d3_geo_centroidY1 += z * (y0 + y) / 2; + d3_geo_centroidZ1 += z; + z = y0 * x - x0 * y; + d3_geo_centroidX2 += z * (x0 + x); + d3_geo_centroidY2 += z * (y0 + y); + d3_geo_centroidZ2 += z * 3; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); } + d3_geo_pathCentroid.lineEnd = function() { + nextPoint(x00, y00); + }; } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null) { - if (min > value) min = value; - if (max < value) max = value; - } - } - } + function d3_geo_pathContext(context) { + var pointRadius = 4.5; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointRadius = _; + return stream; + }, + result: d3_noop + }; + function point(x, y) { + context.moveTo(x + pointRadius, y); + context.arc(x, y, pointRadius, 0, τ); } - } - - return [min, max]; -} - -var array = Array.prototype; - -var slice = array.slice; -var map = array.map; - -function constant(x) { - return function() { - return x; - }; -} - -function identity(x) { - return x; -} - -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; -} - -var e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); - -function ticks(start, stop, count) { - var reverse, - i = -1, - n, - ticks, - step; - - stop = +stop, start = +start, count = +count; - if (start === stop && count > 0) return [start]; - if (reverse = stop < start) n = start, start = stop, stop = n; - if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; - - if (step > 0) { - start = Math.ceil(start / step); - stop = Math.floor(stop / step); - ticks = new Array(n = Math.ceil(stop - start + 1)); - while (++i < n) ticks[i] = (start + i) * step; - } else { - start = Math.floor(start * step); - stop = Math.ceil(stop * step); - ticks = new Array(n = Math.ceil(start - stop + 1)); - while (++i < n) ticks[i] = (start - i) / step; - } - - if (reverse) ticks.reverse(); - - return ticks; -} - -function tickIncrement(start, stop, count) { - var step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log(step) / Math.LN10), - error = step / Math.pow(10, power); - return power >= 0 - ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) - : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); -} - -function tickStep(start, stop, count) { - var step0 = Math.abs(stop - start) / Math.max(0, count), - step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), - error = step0 / step1; - if (error >= e10) step1 *= 10; - else if (error >= e5) step1 *= 5; - else if (error >= e2) step1 *= 2; - return stop < start ? -step1 : step1; -} - -function sturges(values) { - return Math.ceil(Math.log(values.length) / Math.LN2) + 1; -} - -function histogram() { - var value = identity, - domain = extent, - threshold = sturges; - - function histogram(data) { - var i, - n = data.length, - x, - values = new Array(n); - - for (i = 0; i < n; ++i) { - values[i] = value(data[i], i, data); + function pointLineStart(x, y) { + context.moveTo(x, y); + stream.point = pointLine; } - - var xz = domain(values), - x0 = xz[0], - x1 = xz[1], - tz = threshold(values, x0, x1); - - // Convert number of thresholds into uniform thresholds. - if (!Array.isArray(tz)) { - tz = tickStep(x0, x1, tz); - tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive + function pointLine(x, y) { + context.lineTo(x, y); } - - // Remove any thresholds outside the domain. - var m = tz.length; - while (tz[0] <= x0) tz.shift(), --m; - while (tz[m - 1] > x1) tz.pop(), --m; - - var bins = new Array(m + 1), - bin; - - // Initialize bins. - for (i = 0; i <= m; ++i) { - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; + function lineEnd() { + stream.point = point; } - - // Assign data to bins by value, ignoring any outside the domain. - for (i = 0; i < n; ++i) { - x = values[i]; - if (x0 <= x && x <= x1) { - bins[bisectRight(tz, x, 0, m)].push(data[i]); - } + function lineEndPolygon() { + context.closePath(); } - - return bins; + return stream; } - - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; - }; - - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; - }; - - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; - }; - - return histogram; -} - -function quantile(values, p, valueof) { - if (valueof == null) valueof = number; - if (!(n = values.length)) return; - if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, - i = (n - 1) * p, - i0 = Math.floor(i), - value0 = +valueof(values[i0], i0, values), - value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} - -function freedmanDiaconis(values, min, max) { - values = map.call(values, number).sort(ascending); - return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3))); -} - -function scott(values, min, max) { - return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); -} - -function max(values, valueof) { - var n = values.length, - i = -1, - value, - max; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && value > max) { - max = value; - } + function d3_geo_resample(project) { + var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; + function resample(stream) { + return (maxDepth ? resampleRecursive : resampleNone)(stream); + } + function resampleNone(stream) { + return d3_geo_transformPoint(stream, function(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + }); + } + function resampleRecursive(stream) { + var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; + var resample = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + stream.polygonStart(); + resample.lineStart = ringStart; + }, + polygonEnd: function() { + stream.polygonEnd(); + resample.lineStart = lineStart; } + }; + function point(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + } + function lineStart() { + x0 = NaN; + resample.point = linePoint; + stream.lineStart(); + } + function linePoint(λ, φ) { + var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); + resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); + stream.point(x0, y0); + } + function lineEnd() { + resample.point = point; + stream.lineEnd(); + } + function ringStart() { + lineStart(); + resample.point = ringPoint; + resample.lineEnd = ringEnd; + } + function ringPoint(λ, φ) { + linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; + resample.point = linePoint; + } + function ringEnd() { + resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); + resample.lineEnd = lineEnd; + lineEnd(); } + return resample; } - } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - max = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && value > max) { - max = value; - } + function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { + var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; + if (d2 > 4 * δ2 && depth--) { + var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); + stream.point(x2, y2); + resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); } } } + resample.precision = function(_) { + if (!arguments.length) return Math.sqrt(δ2); + maxDepth = (δ2 = _ * _) > 0 && 16; + return resample; + }; + return resample; } - - return max; -} - -function mean(values, valueof) { - var n = values.length, - m = n, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) sum += value; - else --m; - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; - else --m; - } - } - - if (m) return sum / m; -} - -function median(values, valueof) { - var n = values.length, - i = -1, - value, - numbers = []; - - if (valueof == null) { - while (++i < n) { - if (!isNaN(value = number(values[i]))) { - numbers.push(value); - } - } - } - - else { - while (++i < n) { - if (!isNaN(value = number(valueof(values[i], i, values)))) { - numbers.push(value); + d3.geo.path = function() { + var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; + function path(object) { + if (object) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); + d3.geo.stream(object, cacheStream); } + return contextStream.result(); } - } - - return quantile(numbers.sort(ascending), 0.5); -} - -function merge(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; -} - -function min(values, valueof) { - var n = values.length, - i = -1, - value, - min; - - if (valueof == null) { - while (++i < n) { // Find the first comparable value. - if ((value = values[i]) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = values[i]) != null && min > value) { - min = value; - } - } - } + path.area = function(object) { + d3_geo_pathAreaSum = 0; + d3.geo.stream(object, projectStream(d3_geo_pathArea)); + return d3_geo_pathAreaSum; + }; + path.centroid = function(object) { + d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; + d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); + return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ]; + }; + path.bounds = function(object) { + d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); + d3.geo.stream(object, projectStream(d3_geo_pathBounds)); + return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; + }; + path.projection = function(_) { + if (!arguments.length) return projection; + projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; + return reset(); + }; + path.context = function(_) { + if (!arguments.length) return context; + contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return reset(); + }; + path.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path; + }; + function reset() { + cacheStream = null; + return path; } + return path.projection(d3.geo.albersUsa()).context(null); + }; + function d3_geo_pathProjectStream(project) { + var resample = d3_geo_resample(function(x, y) { + return project([ x * d3_degrees, y * d3_degrees ]); + }); + return function(stream) { + return d3_geo_projectionRadians(resample(stream)); + }; } - - else { - while (++i < n) { // Find the first comparable value. - if ((value = valueof(values[i], i, values)) != null && value >= value) { - min = value; - while (++i < n) { // Compare the remaining values. - if ((value = valueof(values[i], i, values)) != null && min > value) { - min = value; - } - } + d3.geo.transform = function(methods) { + return { + stream: function(stream) { + var transform = new d3_geo_transform(stream); + for (var k in methods) transform[k] = methods[k]; + return transform; } - } + }; + }; + function d3_geo_transform(stream) { + this.stream = stream; } - - return min; -} - -function permute(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; -} - -function scan(values, compare) { - if (!(n = values.length)) return; - var n, - i = 0, - j = 0, - xi, - xj = values[j]; - - if (compare == null) compare = ascending; - - while (++i < n) { - if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { - xj = xi, j = i; + d3_geo_transform.prototype = { + point: function(x, y) { + this.stream.point(x, y); + }, + sphere: function() { + this.stream.sphere(); + }, + lineStart: function() { + this.stream.lineStart(); + }, + lineEnd: function() { + this.stream.lineEnd(); + }, + polygonStart: function() { + this.stream.polygonStart(); + }, + polygonEnd: function() { + this.stream.polygonEnd(); } + }; + function d3_geo_transformPoint(stream, point) { + return { + point: point, + sphere: function() { + stream.sphere(); + }, + lineStart: function() { + stream.lineStart(); + }, + lineEnd: function() { + stream.lineEnd(); + }, + polygonStart: function() { + stream.polygonStart(); + }, + polygonEnd: function() { + stream.polygonEnd(); + } + }; } - - if (compare(xj, xj) === 0) return j; -} - -function shuffle(array, i0, i1) { - var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0), - t, - i; - - while (m) { - i = Math.random() * m-- | 0; - t = array[m + i0]; - array[m + i0] = array[i + i0]; - array[i + i0] = t; + d3.geo.projection = d3_geo_projection; + d3.geo.projectionMutator = d3_geo_projectionMutator; + function d3_geo_projection(project) { + return d3_geo_projectionMutator(function() { + return project; + })(); } - - return array; -} - -function sum(values, valueof) { - var n = values.length, - i = -1, - value, - sum = 0; - - if (valueof == null) { - while (++i < n) { - if (value = +values[i]) sum += value; // Note: zero and null are equivalent. + function d3_geo_projectionMutator(projectAt) { + var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { + x = project(x, y); + return [ x[0] * k + δx, δy - x[1] * k ]; + }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream; + function projection(point) { + point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); + return [ point[0] * k + δx, δy - point[1] * k ]; } - } - - else { - while (++i < n) { - if (value = +valueof(values[i], i, values)) sum += value; + function invert(point) { + point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); + return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; } - } - - return sum; -} - -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for (var i = -1, m = min(matrix, length), 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 length(d) { - return d.length; -} - -function zip() { - return transpose(arguments); -} - -exports.bisect = bisectRight; -exports.bisectRight = bisectRight; -exports.bisectLeft = bisectLeft; -exports.ascending = ascending; -exports.bisector = bisector; -exports.cross = cross; -exports.descending = descending; -exports.deviation = deviation; -exports.extent = extent; -exports.histogram = histogram; -exports.thresholdFreedmanDiaconis = freedmanDiaconis; -exports.thresholdScott = scott; -exports.thresholdSturges = sturges; -exports.max = max; -exports.mean = mean; -exports.median = median; -exports.merge = merge; -exports.min = min; -exports.pairs = pairs; -exports.permute = permute; -exports.quantile = quantile; -exports.range = range; -exports.scan = scan; -exports.shuffle = shuffle; -exports.sum = sum; -exports.ticks = ticks; -exports.tickIncrement = tickIncrement; -exports.tickStep = tickStep; -exports.transpose = transpose; -exports.variance = variance; -exports.zip = zip; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],141:[function(_dereq_,module,exports){ -// https://d3js.org/d3-collection/ Version 1.0.4. Copyright 2017 Mike Bostock. -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -var prefix = "$"; - -function Map() {} - -Map.prototype = map.prototype = { - constructor: Map, - has: function(key) { - return (prefix + key) in this; - }, - get: function(key) { - return this[prefix + key]; - }, - set: function(key, value) { - this[prefix + key] = value; - return this; - }, - remove: function(key) { - var property = prefix + key; - return property in this && delete this[property]; - }, - clear: function() { - for (var property in this) if (property[0] === prefix) delete this[property]; - }, - keys: function() { - var keys = []; - for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); - return keys; - }, - values: function() { - var values = []; - for (var property in this) if (property[0] === prefix) values.push(this[property]); - return values; - }, - entries: function() { - var entries = []; - for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); - return entries; - }, - size: function() { - var size = 0; - for (var property in this) if (property[0] === prefix) ++size; - return size; - }, - empty: function() { - for (var property in this) if (property[0] === prefix) return false; - return true; - }, - each: function(f) { - for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); - } -}; - -function map(object, f) { - var map = new Map; - - // Copy constructor. - if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); - - // Index array by numeric index or specified key function. - else if (Array.isArray(object)) { - var i = -1, - n = object.length, - o; - - if (f == null) while (++i < n) map.set(i, object[i]); - else while (++i < n) map.set(f(o = object[i], i, object), o); - } - - // Convert object to map. - else if (object) for (var key in object) map.set(key, object[key]); - - return map; -} - -var nest = function() { - var keys = [], - sortKeys = [], - sortValues, - rollup, - nest; - - function apply(array, depth, createResult, setResult) { - if (depth >= keys.length) { - if (sortValues != null) array.sort(sortValues); - return rollup != null ? rollup(array) : array; + projection.stream = function(output) { + if (stream) stream.valid = false; + stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); + stream.valid = true; + return stream; + }; + projection.clipAngle = function(_) { + if (!arguments.length) return clipAngle; + preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); + return invalidate(); + }; + projection.clipExtent = function(_) { + if (!arguments.length) return clipExtent; + clipExtent = _; + postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; + return invalidate(); + }; + projection.scale = function(_) { + if (!arguments.length) return k; + k = +_; + return reset(); + }; + projection.translate = function(_) { + if (!arguments.length) return [ x, y ]; + x = +_[0]; + y = +_[1]; + return reset(); + }; + projection.center = function(_) { + if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; + λ = _[0] % 360 * d3_radians; + φ = _[1] % 360 * d3_radians; + return reset(); + }; + projection.rotate = function(_) { + if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; + δλ = _[0] % 360 * d3_radians; + δφ = _[1] % 360 * d3_radians; + δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; + return reset(); + }; + d3.rebind(projection, projectResample, "precision"); + function reset() { + projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); + var center = project(λ, φ); + δx = x - center[0] * k; + δy = y + center[1] * k; + return invalidate(); } - - var i = -1, - n = array.length, - key = keys[depth++], - keyValue, - value, - valuesByKey = map(), - values, - result = createResult(); - - while (++i < n) { - if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) { - values.push(value); - } else { - valuesByKey.set(keyValue, [value]); - } + function invalidate() { + if (stream) stream.valid = false, stream = null; + return projection; } - - valuesByKey.each(function(values, key) { - setResult(result, key, apply(values, depth, createResult, setResult)); + return function() { + project = projectAt.apply(this, arguments); + projection.invert = project.invert && invert; + return reset(); + }; + } + function d3_geo_projectionRadians(stream) { + return d3_geo_transformPoint(stream, function(x, y) { + stream.point(x * d3_radians, y * d3_radians); }); - - return result; } - - function entries(map$$1, depth) { - if (++depth > keys.length) return map$$1; - var array, sortKey = sortKeys[depth - 1]; - if (rollup != null && depth >= keys.length) array = map$$1.entries(); - else array = [], map$$1.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); }); - return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array; + function d3_geo_equirectangular(λ, φ) { + return [ λ, φ ]; } - - return nest = { - object: function(array) { return apply(array, 0, createObject, setObject); }, - map: function(array) { return apply(array, 0, createMap, setMap); }, - entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); }, - key: function(d) { keys.push(d); return nest; }, - sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, - sortValues: function(order) { sortValues = order; return nest; }, - rollup: function(f) { rollup = f; return nest; } + (d3.geo.equirectangular = function() { + return d3_geo_projection(d3_geo_equirectangular); + }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; + d3.geo.rotation = function(rotate) { + rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); + function forward(coordinates) { + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + }; + return forward; }; -}; - -function createObject() { - return {}; -} - -function setObject(object, key, value) { - object[key] = value; -} - -function createMap() { - return map(); -} - -function setMap(map$$1, key, value) { - map$$1.set(key, value); -} - -function Set() {} - -var proto = map.prototype; - -Set.prototype = set.prototype = { - constructor: Set, - has: proto.has, - add: function(value) { - value += ""; - this[prefix + value] = value; - return this; - }, - remove: proto.remove, - clear: proto.clear, - values: proto.keys, - size: proto.size, - empty: proto.empty, - each: proto.each -}; - -function set(object, f) { - var set = new Set; - - // Copy constructor. - if (object instanceof Set) object.each(function(value) { set.add(value); }); - - // Otherwise, assume it’s an array. - else if (object) { - var i = -1, n = object.length; - if (f == null) while (++i < n) set.add(object[i]); - else while (++i < n) set.add(f(object[i], i, object)); - } - - return set; -} - -var keys = function(map) { - var keys = []; - for (var key in map) keys.push(key); - return keys; -}; - -var values = function(map) { - var values = []; - for (var key in map) values.push(map[key]); - return values; -}; - -var entries = function(map) { - var entries = []; - for (var key in map) entries.push({key: key, value: map[key]}); - return entries; -}; - -exports.nest = nest; -exports.set = set; -exports.map = map; -exports.keys = keys; -exports.values = values; -exports.entries = entries; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],142:[function(_dereq_,module,exports){ -// https://d3js.org/d3-color/ v1.2.3 Copyright 2018 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : -typeof define === 'function' && define.amd ? define(['exports'], factory) : -(factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; -} - -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; - return prototype; -} - -function Color() {} - -var darker = 0.7; -var brighter = 1 / darker; - -var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", - reHex3 = /^#([0-9a-f]{3})$/, - reHex6 = /^#([0-9a-f]{6})$/, - reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), - reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), - reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), - reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), - reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), - reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); - -var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 -}; - -define(Color, color, { - displayable: function() { - return this.rgb().displayable(); - }, - hex: function() { - return this.rgb().hex(); - }, - toString: function() { - return this.rgb() + ""; - } -}); - -function color(format) { - var m; - format = (format + "").trim().toLowerCase(); - return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 - : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 - : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) - : null; -} - -function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); -} - -function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} - -function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} - -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} - -function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} - -define(Rgb, rgb, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb: function() { - return this; - }, - displayable: function() { - return (0 <= this.r && this.r <= 255) - && (0 <= this.g && this.g <= 255) - && (0 <= this.b && this.b <= 255) - && (0 <= this.opacity && this.opacity <= 1); - }, - hex: function() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); - }, - toString: function() { - var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "rgb(" : "rgba(") - + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " - + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " - + Math.max(0, Math.min(255, Math.round(this.b) || 0)) - + (a === 1 ? ")" : ", " + a + ")"); - } -})); - -function hex(value) { - value = Math.max(0, Math.min(255, Math.round(value) || 0)); - return (value < 16 ? "0" : "") + value.toString(16); -} - -function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); -} - -function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - return new Hsl(h, s, l, o.opacity); -} - -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} - -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} - -define(Hsl, hsl, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), - hsl2rgb(h, m1, m2), - hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), - this.opacity - ); - }, - displayable: function() { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) - && (0 <= this.l && this.l <= 1) - && (0 <= this.opacity && this.opacity <= 1); - } -})); - -/* From FvD 13.37, CSS Color Module Level 3 */ -function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 - : h < 180 ? m2 - : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 - : m1) * 255; -} - -var deg2rad = Math.PI / 180; -var rad2deg = 180 / Math.PI; - -// https://beta.observablehq.com/@mbostock/lab-and-rgb -var K = 18, - Xn = 0.96422, - Yn = 1, - Zn = 0.82521, - t0 = 4 / 29, - t1 = 6 / 29, - t2 = 3 * t1 * t1, - t3 = t1 * t1 * t1; - -function labConvert(o) { - if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); - if (o instanceof Hcl) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * deg2rad; - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); - } - if (!(o instanceof Rgb)) o = rgbConvert(o); - var r = rgb2lrgb(o.r), - g = rgb2lrgb(o.g), - b = rgb2lrgb(o.b), - y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); - } - return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); -} - -function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} - -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} - -function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} - -define(Lab, lab, extend(Color, { - brighter: function(k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker: function(k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb: function() { - var y = (this.l + 16) / 116, - x = isNaN(this.a) ? y : y + this.a / 500, - z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = Zn * lab2xyz(z); - return new Rgb( - lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z), - lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), - lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z), - this.opacity - ); - } -})); - -function xyz2lab(t) { - return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; -} - -function lab2xyz(t) { - return t > t1 ? t * t * t : t2 * (t - t0); -} - -function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} - -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); -} - -function hclConvert(o) { - if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); - if (!(o instanceof Lab)) o = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity); - var h = Math.atan2(o.b, o.a) * rad2deg; - return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); -} - -function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} - -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} - -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} - -define(Hcl, hcl, extend(Color, { - brighter: function(k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker: function(k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb: function() { - return labConvert(this).rgb(); - } -})); - -var A = -0.14861, - B = +1.78277, - C = -0.29227, - D = -0.90649, - E = +1.97294, - ED = E * D, - EB = E * B, - BC_DA = B * C - D * A; - -function cubehelixConvert(o) { - if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Rgb)) o = rgbConvert(o); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), - bl = b - l, - k = (E * (g - l) - C * bl) / D, - s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 - h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} - -function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} - -function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} - -define(Cubehelix, cubehelix, extend(Color, { - brighter: function(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, - l = +this.l, - a = isNaN(this.s) ? 0 : this.s * l * (1 - l), - cosh = Math.cos(h), - sinh = Math.sin(h); - return new Rgb( - 255 * (l + a * (A * cosh + B * sinh)), - 255 * (l + a * (C * cosh + D * sinh)), - 255 * (l + a * (E * cosh)), - this.opacity - ); + function d3_geo_identityRotation(λ, φ) { + return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; } -})); - -exports.color = color; -exports.rgb = rgb; -exports.hsl = hsl; -exports.lab = lab; -exports.hcl = hcl; -exports.lch = lch; -exports.gray = gray; -exports.cubehelix = cubehelix; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],143:[function(_dereq_,module,exports){ -// https://d3js.org/d3-dispatch/ Version 1.0.3. Copyright 2017 Mike Bostock. -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -var noop = {value: function() {}}; - -function dispatch() { - for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { - if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t); - _[t] = []; + d3_geo_identityRotation.invert = d3_geo_equirectangular; + function d3_geo_rotation(δλ, δφ, δγ) { + return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; } - return new Dispatch(_); -} - -function Dispatch(_) { - this._ = _; -} - -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return {type: t, name: name}; - }); -} - -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, - T = parseTypenames(typename + "", _), - t, - i = -1, - n = T.length; - - // If no callback was specified, return the callback of the given type and name. - if (arguments.length < 2) { - while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; - } - - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while (++i < n) { - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); - } - - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for (var t in _) copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + function d3_geo_forwardRotationλ(δλ) { + return function(λ, φ) { + return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; + }; } -}; - -function get(type, name) { - for (var i = 0, n = type.length, c; i < n; ++i) { - if ((c = type[i]).name === name) { - return c.value; - } + function d3_geo_rotationλ(δλ) { + var rotation = d3_geo_forwardRotationλ(δλ); + rotation.invert = d3_geo_forwardRotationλ(-δλ); + return rotation; } -} - -function set(type, name, callback) { - for (var i = 0, n = type.length; i < n; ++i) { - if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; + function d3_geo_rotationφγ(δφ, δγ) { + var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); + function rotation(λ, φ) { + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; + return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ]; } + rotation.invert = function(λ, φ) { + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; + return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ]; + }; + return rotation; } - if (callback != null) type.push({name: name, value: callback}); - return type; -} - -exports.dispatch = dispatch; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],144:[function(_dereq_,module,exports){ -// https://d3js.org/d3-force/ Version 1.1.0. Copyright 2017 Mike Bostock. -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-quadtree'), _dereq_('d3-collection'), _dereq_('d3-dispatch'), _dereq_('d3-timer')) : - typeof define === 'function' && define.amd ? define(['exports', 'd3-quadtree', 'd3-collection', 'd3-dispatch', 'd3-timer'], factory) : - (factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3)); -}(this, (function (exports,d3Quadtree,d3Collection,d3Dispatch,d3Timer) { 'use strict'; - -var center = function(x, y) { - var nodes; - - if (x == null) x = 0; - if (y == null) y = 0; - - function force() { - var i, - n = nodes.length, - node, - sx = 0, - sy = 0; - - for (i = 0; i < n; ++i) { - node = nodes[i], sx += node.x, sy += node.y; - } - - for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { - node = nodes[i], node.x -= sx, node.y -= sy; + d3.geo.circle = function() { + var origin = [ 0, 0 ], angle, precision = 6, interpolate; + function circle() { + var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; + interpolate(null, null, 1, { + point: function(x, y) { + ring.push(x = rotate(x, y)); + x[0] *= d3_degrees, x[1] *= d3_degrees; + } + }); + return { + type: "Polygon", + coordinates: [ ring ] + }; } - } - - force.initialize = function(_) { - nodes = _; - }; - - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - - return force; -}; - -var constant = function(x) { - return function() { - return x; + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + circle.angle = function(x) { + if (!arguments.length) return angle; + interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); + return circle; + }; + circle.precision = function(_) { + if (!arguments.length) return precision; + interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); + return circle; + }; + return circle.angle(90); }; -}; - -var jiggle = function() { - return (Math.random() - 0.5) * 1e-6; -}; - -function x(d) { - return d.x + d.vx; -} - -function y(d) { - return d.y + d.vy; -} - -var collide = function(radius) { - var nodes, - radii, - strength = 1, - iterations = 1; - - if (typeof radius !== "function") radius = constant(radius == null ? 1 : +radius); - - function force() { - var i, n = nodes.length, - tree, - node, - xi, - yi, - ri, - ri2; - - for (var k = 0; k < iterations; ++k) { - tree = d3Quadtree.quadtree(nodes, x, y).visitAfter(prepare); - for (i = 0; i < n; ++i) { - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, - y = yi - data.y - data.vy, - l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= y * r; - } - } - return; + function d3_geo_circleInterpolate(radius, precision) { + var cr = Math.cos(radius), sr = Math.sin(radius); + return function(from, to, direction, listener) { + var step = direction * precision; + if (from != null) { + from = d3_geo_circleAngle(cr, from); + to = d3_geo_circleAngle(cr, to); + if (direction > 0 ? from < to : from > to) from += direction * τ; + } else { + from = radius + direction * τ; + to = radius - .5 * step; } - return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; - } - } - - function prepare(quad) { - if (quad.data) return quad.r = radii[quad.data.index]; - for (var i = quad.r = 0; i < 4; ++i) { - if (quad[i] && quad[i].r > quad.r) { - quad.r = quad[i].r; + for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { + listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); } - } + }; } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes); + function d3_geo_circleAngle(cr, point) { + var a = d3_geo_cartesian(point); + a[0] -= cr; + d3_geo_cartesianNormalize(a); + var angle = d3_acos(-a[1]); + return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; + d3.geo.distance = function(a, b) { + var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t; + return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ); }; - - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; + d3.geo.graticule = function() { + var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; + function graticule() { + return { + type: "MultiLineString", + coordinates: lines() + }; + } + function lines() { + return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) { + return abs(x % DX) > ε; + }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { + return abs(y % DY) > ε; + }).map(y)); + } + graticule.lines = function() { + return lines().map(function(coordinates) { + return { + type: "LineString", + coordinates: coordinates + }; + }); + }; + graticule.outline = function() { + return { + type: "Polygon", + coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] + }; + }; + graticule.extent = function(_) { + if (!arguments.length) return graticule.minorExtent(); + return graticule.majorExtent(_).minorExtent(_); + }; + graticule.majorExtent = function(_) { + if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; + X0 = +_[0][0], X1 = +_[1][0]; + Y0 = +_[0][1], Y1 = +_[1][1]; + if (X0 > X1) _ = X0, X0 = X1, X1 = _; + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; + return graticule.precision(precision); + }; + graticule.minorExtent = function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + x0 = +_[0][0], x1 = +_[1][0]; + y0 = +_[0][1], y1 = +_[1][1]; + if (x0 > x1) _ = x0, x0 = x1, x1 = _; + if (y0 > y1) _ = y0, y0 = y1, y1 = _; + return graticule.precision(precision); + }; + graticule.step = function(_) { + if (!arguments.length) return graticule.minorStep(); + return graticule.majorStep(_).minorStep(_); + }; + graticule.majorStep = function(_) { + if (!arguments.length) return [ DX, DY ]; + DX = +_[0], DY = +_[1]; + return graticule; + }; + graticule.minorStep = function(_) { + if (!arguments.length) return [ dx, dy ]; + dx = +_[0], dy = +_[1]; + return graticule; + }; + graticule.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x = d3_geo_graticuleX(y0, y1, 90); + y = d3_geo_graticuleY(x0, x1, precision); + X = d3_geo_graticuleX(Y0, Y1, 90); + Y = d3_geo_graticuleY(X0, X1, precision); + return graticule; + }; + return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); }; - - return force; -}; - -function index(d) { - return d.index; -} - -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("missing: " + nodeId); - return node; -} - -var link = function(links) { - var id = index, - strength = defaultStrength, - strengths, - distance = constant(30), - distances, - nodes, - count, - bias, - iterations = 1; - - if (links == null) links = []; - - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); + function d3_geo_graticuleX(y0, y1, dy) { + var y = d3.range(y0, y1 - ε, dy).concat(y1); + return function(x) { + return y.map(function(y) { + return [ x, y ]; + }); + }; } - - function force(alpha) { - for (var k = 0, n = links.length; k < iterations; ++k) { - for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || jiggle(); - y = target.y + target.vy - source.y - source.vy || jiggle(); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } + function d3_geo_graticuleY(x0, x1, dx) { + var x = d3.range(x0, x1 - ε, dx).concat(x1); + return function(y) { + return x.map(function(x) { + return [ x, y ]; + }); + }; } - - function initialize() { - if (!nodes) return; - - var i, - n = nodes.length, - m = links.length, - nodeById = d3Collection.map(nodes, id), - link; - - for (i = 0, count = new Array(n); i < m; ++i) { - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - - for (i = 0, bias = new Array(m); i < m; ++i) { - link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - } - - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); + function d3_source(d) { + return d.source; } - - function initializeStrength() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - strengths[i] = +strength(links[i], i, links); - } + function d3_target(d) { + return d.target; } - - function initializeDistance() { - if (!nodes) return; - - for (var i = 0, n = links.length; i < n; ++i) { - distances[i] = +distance(links[i], i, links); + d3.geo.greatArc = function() { + var source = d3_source, source_, target = d3_target, target_; + function greatArc() { + return { + type: "LineString", + coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] + }; } - } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - - force.id = function(_) { - return arguments.length ? (id = _, force) : id; + greatArc.distance = function() { + return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); + }; + greatArc.source = function(_) { + if (!arguments.length) return source; + source = _, source_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.target = function(_) { + if (!arguments.length) return target; + target = _, target_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.precision = function() { + return arguments.length ? greatArc : 0; + }; + return greatArc; }; - - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; + d3.geo.interpolate = function(source, target) { + return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength; + function d3_geo_interpolate(x0, y0, x1, y1) { + var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d); + var interpolate = d ? function(t) { + var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; + return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; + } : function() { + return [ x0 * d3_degrees, y0 * d3_degrees ]; + }; + interpolate.distance = d; + return interpolate; + } + d3.geo.length = function(object) { + d3_geo_lengthSum = 0; + d3.geo.stream(object, d3_geo_length); + return d3_geo_lengthSum; }; - - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance; + var d3_geo_lengthSum; + var d3_geo_length = { + sphere: d3_noop, + point: d3_noop, + lineStart: d3_geo_lengthLineStart, + lineEnd: d3_noop, + polygonStart: d3_noop, + polygonEnd: d3_noop }; - - return force; -}; - -function x$1(d) { - return d.x; -} - -function y$1(d) { - return d.y; -} - -var initialRadius = 10; -var initialAngle = Math.PI * (3 - Math.sqrt(5)); - -var simulation = function(nodes) { - var simulation, - alpha = 1, - alphaMin = 0.001, - alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), - alphaTarget = 0, - velocityDecay = 0.6, - forces = d3Collection.map(), - stepper = d3Timer.timer(step), - event = d3Dispatch.dispatch("tick", "end"); - - if (nodes == null) nodes = []; - - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); + function d3_geo_lengthLineStart() { + var λ0, sinφ0, cosφ0; + d3_geo_length.point = function(λ, φ) { + λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); + d3_geo_length.point = nextPoint; + }; + d3_geo_length.lineEnd = function() { + d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; + }; + function nextPoint(λ, φ) { + var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); + d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ); + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; } } - - function tick() { - var i, n = nodes.length, node; - - alpha += (alphaTarget - alpha) * alphaDecay; - - forces.each(function(force) { - force(alpha); - }); - - for (i = 0; i < n; ++i) { - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; + function d3_geo_azimuthal(scale, angle) { + function azimuthal(λ, φ) { + var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); + return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; } + azimuthal.invert = function(x, y) { + var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); + return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; + }; + return azimuthal; } - - function initializeNodes() { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.index = i; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) { - node.vx = node.vy = 0; + var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { + return Math.sqrt(2 / (1 + cosλcosφ)); + }, function(ρ) { + return 2 * Math.asin(ρ / 2); + }); + (d3.geo.azimuthalEqualArea = function() { + return d3_geo_projection(d3_geo_azimuthalEqualArea); + }).raw = d3_geo_azimuthalEqualArea; + var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { + var c = Math.acos(cosλcosφ); + return c && c / Math.sin(c); + }, d3_identity); + (d3.geo.azimuthalEquidistant = function() { + return d3_geo_projection(d3_geo_azimuthalEquidistant); + }).raw = d3_geo_azimuthalEquidistant; + function d3_geo_conicConformal(φ0, φ1) { + var cosφ0 = Math.cos(φ0), t = function(φ) { + return Math.tan(π / 4 + φ / 2); + }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n; + if (!n) return d3_geo_mercator; + function forward(λ, φ) { + if (F > 0) { + if (φ < -halfπ + ε) φ = -halfπ + ε; + } else { + if (φ > halfπ - ε) φ = halfπ - ε; } + var ρ = F / Math.pow(t(φ), n); + return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ]; } + forward.invert = function(x, y) { + var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y); + return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ]; + }; + return forward; } - - function initializeForce(force) { - if (force.initialize) force.initialize(nodes); - return force; - } - - initializeNodes(); - - return simulation = { - tick: tick, - - restart: function() { - return stepper.restart(step), simulation; - }, - - stop: function() { - return stepper.stop(), simulation; - }, - - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes; - }, - - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - - force: function(name, _) { - return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name); - }, - - find: function(x, y, radius) { - var i = 0, - n = nodes.length, - dx, - dy, - d2, - node, - closest; - - if (radius == null) radius = Infinity; - else radius *= radius; - - for (i = 0; i < n; ++i) { - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - - return closest; - }, - - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); + (d3.geo.conicConformal = function() { + return d3_geo_conic(d3_geo_conicConformal); + }).raw = d3_geo_conicConformal; + function d3_geo_conicEquidistant(φ0, φ1) { + var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0; + if (abs(n) < ε) return d3_geo_equirectangular; + function forward(λ, φ) { + var ρ = G - φ; + return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ]; } - }; -}; - -var manyBody = function() { - var nodes, - node, - alpha, - strength = constant(-30), - strengths, - distanceMin2 = 1, - distanceMax2 = Infinity, - theta2 = 0.81; - - function force(_) { - var i, n = nodes.length, tree = d3Quadtree.quadtree(nodes, x$1, y$1).visitAfter(accumulate); - for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply); + forward.invert = function(x, y) { + var ρ0_y = G - y; + return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ]; + }; + return forward; } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes); + (d3.geo.conicEquidistant = function() { + return d3_geo_conic(d3_geo_conicEquidistant); + }).raw = d3_geo_conicEquidistant; + var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { + return 1 / cosλcosφ; + }, Math.atan); + (d3.geo.gnomonic = function() { + return d3_geo_projection(d3_geo_gnomonic); + }).raw = d3_geo_gnomonic; + function d3_geo_mercator(λ, φ) { + return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ]; } - - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for (x = y = i = 0; i < 4; ++i) { - if ((q = quad[i]) && (c = Math.abs(q.value))) { - strength += q.value, weight += c, x += c * q.x, y += c * q.y; + d3_geo_mercator.invert = function(x, y) { + return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ]; + }; + function d3_geo_mercatorProjection(project) { + var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; + m.scale = function() { + var v = scale.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.translate = function() { + var v = translate.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.clipExtent = function(_) { + var v = clipExtent.apply(m, arguments); + if (v === m) { + if (clipAuto = _ == null) { + var k = π * scale(), t = translate(); + clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); } + } else if (clipAuto) { + v = null; } - quad.x = x / weight; - quad.y = y / weight; - } - - // For leaf nodes, accumulate forces from coincident quadrants. - else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - - quad.value = strength; + return v; + }; + return m.clipExtent(null); } - - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - - var x = quad.x - node.x, - y = quad.y - node.y, - w = x2 - x1, - l = x * x + y * y; - - // Apply the Barnes-Hut approximation if possible. - // Limit forces for very close nodes; randomize direction if coincident. - if (w * w / theta2 < l) { - if (l < distanceMax2) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } - - // Otherwise, process points directly. - else if (quad.length || l >= distanceMax2) return; - - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = jiggle(), l += x * x; - if (y === 0) y = jiggle(), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } while (quad = quad.next); + (d3.geo.mercator = function() { + return d3_geo_mercatorProjection(d3_geo_mercator); + }).raw = d3_geo_mercator; + var d3_geo_orthographic = d3_geo_azimuthal(function() { + return 1; + }, Math.asin); + (d3.geo.orthographic = function() { + return d3_geo_projection(d3_geo_orthographic); + }).raw = d3_geo_orthographic; + var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { + return 1 / (1 + cosλcosφ); + }, function(ρ) { + return 2 * Math.atan(ρ); + }); + (d3.geo.stereographic = function() { + return d3_geo_projection(d3_geo_stereographic); + }).raw = d3_geo_stereographic; + function d3_geo_transverseMercator(λ, φ) { + return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ]; } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); + d3_geo_transverseMercator.invert = function(x, y) { + return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ]; }; - - return force; -}; - -var radial = function(radius, x, y) { - var nodes, - strength = constant(0.1), - strengths, - radiuses; - - if (typeof radius !== "function") radius = constant(+radius); - if (x == null) x = 0; - if (y == null) y = 0; - - function force(alpha) { - for (var i = 0, n = nodes.length; i < n; ++i) { - var node = nodes[i], - dx = node.x - x || 1e-6, - dy = node.y - y || 1e-6, - r = Math.sqrt(dx * dx + dy * dy), - k = (radiuses[i] - r) * strengths[i] * alpha / r; - node.vx += dx * k; - node.vy += dy * k; - } + (d3.geo.transverseMercator = function() { + var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; + projection.center = function(_) { + return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]); + }; + projection.rotate = function(_) { + return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), + [ _[0], _[1], _[2] - 90 ]); + }; + return rotate([ 0, 0, 90 ]); + }).raw = d3_geo_transverseMercator; + d3.geom = {}; + function d3_geom_pointX(d) { + return d[0]; } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - radiuses = new Array(n); - for (i = 0; i < n; ++i) { - radiuses[i] = +radius(nodes[i], i, nodes); - strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes); - } + function d3_geom_pointY(d) { + return d[1]; } - - force.initialize = function(_) { - nodes = _, initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius; - }; - - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; + 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; }; - - return force; -}; - -var x$2 = function(x) { - var strength = constant(0.1), - nodes, - strengths, - xz; - - if (typeof x !== "function") x = constant(x == null ? 0 : +x); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; + function d3_geom_hullUpper(points) { + var n = points.length, hull = [ 0, 1 ], hs = 2; + for (var i = 2; i < n; i++) { + while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; + hull[hs++] = i; } + return hull.slice(0, hs); } - - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } + function d3_geom_hullOrder(a, b) { + return a[0] - b[0] || a[1] - b[1]; } - - force.initialize = function(_) { - nodes = _; - initialize(); + d3.geom.polygon = function(coordinates) { + d3_subclass(coordinates, d3_geom_polygonPrototype); + return coordinates; }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; + var d3_geom_polygonPrototype = d3.geom.polygon.prototype = []; + d3_geom_polygonPrototype.area = function() { + var i = -1, n = this.length, a, b = this[n - 1], area = 0; + while (++i < n) { + a = b; + b = this[i]; + area += a[1] * b[0] - a[0] * b[1]; + } + return area * .5; }; - - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x; + 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 ]; }; - - return force; -}; - -var y$2 = function(y) { - var strength = constant(0.1), - nodes, - strengths, - yz; - - if (typeof y !== "function") y = constant(y == null ? 0 : +y); - - function force(alpha) { - for (var i = 0, n = nodes.length, node; i < n; ++i) { - node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; + 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 initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for (i = 0; i < n; ++i) { - strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } + function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); + return [ x1 + ua * x21, y1 + ua * y21 ]; } - - force.initialize = function(_) { - nodes = _; - initialize(); - }; - - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength; - }; - - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y; - }; - - return force; -}; - -exports.forceCenter = center; -exports.forceCollide = collide; -exports.forceLink = link; -exports.forceManyBody = manyBody; -exports.forceRadial = radial; -exports.forceSimulation = simulation; -exports.forceX = x$2; -exports.forceY = y$2; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{"d3-collection":141,"d3-dispatch":143,"d3-quadtree":146,"d3-timer":147}],145:[function(_dereq_,module,exports){ -// https://d3js.org/d3-interpolate/ v1.3.2 Copyright 2018 Mike Bostock -(function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-color')) : -typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) : -(factory((global.d3 = global.d3 || {}),global.d3)); -}(this, (function (exports,d3Color) { 'use strict'; - -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 - + (4 - 6 * t2 + 3 * t3) * v1 - + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 - + t3 * v3) / 6; -} - -function basis$1(values) { - var n = values.length - 1; - return function(t) { - var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), - v1 = values[i], - v2 = values[i + 1], - v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, - v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} - -function basisClosed(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), - v0 = values[(i + n - 1) % n], - v1 = values[i % n], - v2 = values[(i + 1) % n], - v3 = values[(i + 2) % n]; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; -} - -function constant(x) { - return function() { - return x; - }; -} - -function linear(a, d) { - return function(t) { - return a + t * d; - }; -} - -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} - -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); -} - -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); - }; -} - -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant(isNaN(a) ? b : a); -} - -var rgb = (function rgbGamma(y) { - var color = gamma(y); - - function rgb(start, end) { - var r = color((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r), - g = color(start.g, end.g), - b = color(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - rgb.gamma = rgbGamma; - - return rgb; -})(1); - -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, - r = new Array(n), - g = new Array(n), - b = new Array(n), - i, color; - for (i = 0; i < n; ++i) { - color = d3Color.rgb(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; - }; -} - -var rgbBasis = rgbSpline(basis$1); -var rgbBasisClosed = rgbSpline(basisClosed); - -function array(a, b) { - var nb = b ? b.length : 0, - na = a ? Math.min(nb, a.length) : 0, - x = new Array(na), - c = new Array(nb), - i; - - for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]); - for (; i < nb; ++i) c[i] = b[i]; - - return function(t) { - for (i = 0; i < na; ++i) c[i] = x[i](t); - return c; - }; -} - -function date(a, b) { - var d = new Date; - return a = +a, b -= a, function(t) { - return d.setTime(a + b * t), d; - }; -} - -function number(a, b) { - return a = +a, b -= a, function(t) { - return a + b * t; - }; -} - -function object(a, b) { - var i = {}, - c = {}, - k; - - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - - for (k in b) { - if (k in a) { - i[k] = value(a[k], b[k]); - } else { - c[k] = b[k]; - } + function d3_geom_polygonClosed(coordinates) { + var a = coordinates[0], b = coordinates[coordinates.length - 1]; + return !(a[0] - b[0] || a[1] - b[1]); } - - return function(t) { - for (k in i) c[k] = i[k](t); - return c; - }; -} - -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, - reB = new RegExp(reA.source, "g"); - -function zero(b) { - return function() { - return b; - }; -} - -function one(b) { - return function(t) { - return b(t) + ""; - }; -} - -function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b - am, // current match in a - bm, // current match in b - bs, // string preceding current number in b, if any - i = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators - - // Coerce inputs to strings. - a = a + "", b = b + ""; - - // Interpolate pairs of numbers in a & b. - while ((am = reA.exec(a)) - && (bm = reB.exec(b))) { - if ((bs = bm.index) > bi) { // a string precedes the next number in b - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { // interpolate non-matching numbers - s[++i] = null; - q.push({i: i, x: number(am, bm)}); - } - bi = reB.lastIndex; + 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; } - - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; + function d3_geom_voronoiCreateBeach(site) { + var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); + beach.site = site; + return beach; } - - // Special optimization for only a single match. - // Otherwise, interpolate each of the numbers and rejoin the string. - return s.length < 2 ? (q[0] - ? one(q[0].x) - : zero(b)) - : (b = q.length, function(t) { - for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); -} - -function value(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? constant(b) - : (t === "number" ? number - : t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb) : string) - : b instanceof d3Color.color ? rgb - : b instanceof Date ? date - : Array.isArray(b) ? array - : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object - : number)(a, b); -} - -function discrete(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; -} - -function hue$1(a, b) { - var i = hue(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; -} - -function round(a, b) { - return a = +a, b -= a, function(t) { - return Math.round(a + b * t); - }; -} - -var degrees = 180 / Math.PI; - -var identity = { - translateX: 0, - translateY: 0, - rotate: 0, - skewX: 0, - scaleX: 1, - scaleY: 1 -}; - -function decompose(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX: scaleX, - scaleY: scaleY - }; -} - -var cssNode, - cssRoot, - cssView, - svgNode; - -function parseCss(value) { - if (value === "none") return identity; - if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; - cssNode.style.transform = value; - value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); - cssRoot.removeChild(cssNode); - value = value.slice(7, -1).split(","); - return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); -} - -function parseSvg(value) { - if (value == null) return identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return identity; - value = value.matrix; - return decompose(value.a, value.b, value.c, value.d, value.e, value.f); -} - -function interpolateTransform(parse, pxComma, pxParen, degParen) { - - function pop(s) { - return s.length ? s.pop() + " " : ""; + function d3_geom_voronoiDetachBeach(beach) { + d3_geom_voronoiDetachCircle(beach); + d3_geom_voronoiBeaches.remove(beach); + d3_geom_voronoiBeachPool.push(beach); + d3_geom_voronoiRedBlackNode(beach); } - - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb || yb) { - s.push("translate(" + xb + pxComma + yb + pxParen); + function d3_geom_voronoiRemoveBeach(beach) { + var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { + x: x, + y: y + }, previous = beach.P, next = beach.N, disappearing = [ beach ]; + d3_geom_voronoiDetachBeach(beach); + var lArc = previous; + while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) { + previous = lArc.P; + disappearing.unshift(lArc); + d3_geom_voronoiDetachBeach(lArc); + lArc = previous; } - } - - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path - q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "rotate(" + b + degParen); + 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; } - } - - function skewX(a, b, s, q) { - if (a !== b) { - q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)}); - } else if (b) { - s.push(pop(s) + "skewX(" + b + degParen); + 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 scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); - } else if (xb !== 1 || yb !== 1) { - s.push(pop(s) + "scale(" + xb + "," + yb + ")"); + 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; + } + } } - } - - return function(a, b) { - var s = [], // string constants and placeholders - q = []; // number interpolators - a = parse(a), b = parse(b); - translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); - rotate(a.rotate, b.rotate, s, q); - skewX(a.skewX, b.skewX, s, q); - scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); - a = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while (++i < n) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - }; -} - -var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); - -var rho = Math.SQRT2, - rho2 = 2, - rho4 = 4, - epsilon2 = 1e-12; - -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} - -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} - -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} - -// p0 = [ux0, uy0, w0] -// p1 = [ux1, uy1, w1] -function zoom(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], - ux1 = p1[0], uy1 = p1[1], w1 = p1[2], - dx = ux1 - ux0, - dy = uy1 - uy0, - d2 = dx * dx + dy * dy, - i, - S; - - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; + var newArc = d3_geom_voronoiCreateBeach(site); + d3_geom_voronoiBeaches.insert(lArc, newArc); + if (!lArc && !rArc) return; + if (lArc === rArc) { + d3_geom_voronoiDetachCircle(lArc); + rArc = d3_geom_voronoiCreateBeach(lArc.site); + d3_geom_voronoiBeaches.insert(newArc, rArc); + newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + return; + } + if (!rArc) { + newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); + return; + } + d3_geom_voronoiDetachCircle(lArc); + d3_geom_voronoiDetachCircle(rArc); + var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = { + x: (cy * hb - by * hc) / d + ax, + y: (bx * hc - cx * hb) / d + ay }; + d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex); + newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex); + rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); } - - // General case. - else { - var d1 = Math.sqrt(d2), - b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), - b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), - r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), - r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, - coshr0 = cosh(r0), - u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); - return [ - ux0 + u * dx, - uy0 + u * dy, - w0 * coshr0 / cosh(rho * s + r0) - ]; - }; + 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; } - - i.duration = S * 1000; - - return i; -} - -function hsl(hue$$1) { - return function(start, end) { - var h = hue$$1((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; + 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; } -} - -var hsl$1 = hsl(hue); -var hslLong = hsl(nogamma); - -function lab(start, end) { - var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l), - a = nogamma(start.a, end.a), - b = nogamma(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; -} - -function hcl(hue$$1) { - return function(start, end) { - var h = hue$$1((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h), - c = nogamma(start.c, end.c), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; + function d3_geom_voronoiCell(site) { + this.site = site; + this.edges = []; } -} - -var hcl$1 = hcl(hue); -var hclLong = hcl(nogamma); - -function cubehelix(hue$$1) { - return (function cubehelixGamma(y) { - y = +y; - - function cubehelix(start, end) { - var h = hue$$1((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; + 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); } - - cubehelix.gamma = cubehelixGamma; - - return cubehelix; - })(1); -} - -var cubehelix$1 = cubehelix(hue); -var cubehelixLong = cubehelix(nogamma); - -function piecewise(interpolate, values) { - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while (i < n) I[i] = interpolate(v, v = values[++i]); - return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); + halfEdges.sort(d3_geom_voronoiHalfEdgeOrder); + return halfEdges.length; }; -} - -function quantize(interpolator, n) { - var samples = new Array(n); - for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); - return samples; -} - -exports.interpolate = value; -exports.interpolateArray = array; -exports.interpolateBasis = basis$1; -exports.interpolateBasisClosed = basisClosed; -exports.interpolateDate = date; -exports.interpolateDiscrete = discrete; -exports.interpolateHue = hue$1; -exports.interpolateNumber = number; -exports.interpolateObject = object; -exports.interpolateRound = round; -exports.interpolateString = string; -exports.interpolateTransformCss = interpolateTransformCss; -exports.interpolateTransformSvg = interpolateTransformSvg; -exports.interpolateZoom = zoom; -exports.interpolateRgb = rgb; -exports.interpolateRgbBasis = rgbBasis; -exports.interpolateRgbBasisClosed = rgbBasisClosed; -exports.interpolateHsl = hsl$1; -exports.interpolateHslLong = hslLong; -exports.interpolateLab = lab; -exports.interpolateHcl = hcl$1; -exports.interpolateHclLong = hclLong; -exports.interpolateCubehelix = cubehelix$1; -exports.interpolateCubehelixLong = cubehelixLong; -exports.piecewise = piecewise; -exports.quantize = quantize; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{"d3-color":142}],146:[function(_dereq_,module,exports){ -// https://d3js.org/d3-quadtree/ Version 1.0.3. Copyright 2017 Mike Bostock. -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -var tree_add = function(d) { - var x = +this._x.call(null, d), - y = +this._y.call(null, d); - return add(this.cover(x, y), x, y, d); -}; - -function add(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - - var parent, - node = tree._root, - leaf = {data: d}, - x0 = tree._x0, - y0 = tree._y0, - x1 = tree._x1, - y1 = tree._y1, - xm, - ym, - xp, - yp, - right, - bottom, - i, - j; - - // If the tree is empty, initialize the root as a leaf. - if (!node) return tree._root = leaf, tree; - - // Find the existing leaf for the new point, or add it. - while (node.length) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm))); - return parent[j] = node, parent[i] = leaf, tree; -} - -function addAll(data) { - var d, i, n = data.length, - x, - y, - xz = new Array(n), - yz = new Array(n), - x0 = Infinity, - y0 = Infinity, - x1 = -Infinity, - y1 = -Infinity; - - // Compute the points and their extent. - for (i = 0; i < n; ++i) { - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; - } - - // If there were no (valid) points, inherit the existing extent. - if (x1 < x0) x0 = this._x0, x1 = this._x1; - if (y1 < y0) y0 = this._y0, y1 = this._y1; - - // Expand the tree to cover the new points. - this.cover(x0, y0).cover(x1, y1); - - // Add the new points. - for (i = 0; i < n; ++i) { - add(this, xz[i], yz[i], data[i]); - } - - return this; -} - -var tree_cover = function(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - - var x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = this._y1; - - // If the quadtree has no extent, initialize them. - // Integer extent are necessary so that if we later double the extent, - // the existing quadrant boundaries don’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } - - // Otherwise, double repeatedly to cover. - else if (x0 > x || x > x1 || y0 > y || y > y1) { - var z = x1 - x0, - node = this._root, - parent, - i; - - switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) { - case 0: { - do parent = new Array(4), parent[i] = node, node = parent; - while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1); - break; - } - case 1: { - do parent = new Array(4), parent[i] = node, node = parent; - while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1); - break; - } - case 2: { - do parent = new Array(4), parent[i] = node, node = parent; - while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y); - break; - } - case 3: { - do parent = new Array(4), parent[i] = node, node = parent; - while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y); - break; + function d3_geom_voronoiCloseCells(extent) { + var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end; + while (iCell--) { + cell = cells[iCell]; + if (!cell || !cell.prepare()) continue; + halfEdges = cell.edges; + nHalfEdges = halfEdges.length; + iHalfEdge = 0; + while (iHalfEdge < nHalfEdges) { + end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; + start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; + if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) { + halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? { + x: x0, + y: abs(x2 - x0) < ε ? y2 : y1 + } : abs(y3 - y1) < ε && x1 - x3 > ε ? { + x: abs(y2 - y1) < ε ? x2 : x1, + y: y1 + } : abs(x3 - x1) < ε && y3 - y0 > ε ? { + x: x1, + y: abs(x2 - x1) < ε ? y2 : y0 + } : abs(y3 - y0) < ε && x3 - x0 > ε ? { + x: abs(y2 - y0) < ε ? x2 : x0, + y: y0 + } : null), cell.site, null)); + ++nHalfEdges; + } } } - - if (this._root && this._root.length) this._root = node; } - - // If the quadtree covers the point already, just return. - else return this; - - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; -}; - -var tree_data = function() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); while (node = node.next) - }); - return data; -}; - -var tree_extent = function(_) { - return arguments.length - ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) - : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]]; -}; - -var Quad = function(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; -}; - -var tree_find = function(x, y, radius) { - var data, - x0 = this._x0, - y0 = this._y0, - x1, - y1, - x2, - y2, - x3 = this._x1, - y3 = this._y1, - quads = [], - node = this._root, - q, - i; - - if (node) quads.push(new Quad(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; + function d3_geom_voronoiHalfEdgeOrder(a, b) { + return b.angle - a.angle; } - - while (q = quads.pop()) { - - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) - || (x1 = q.x0) > x3 - || (y1 = q.y0) > y3 - || (x2 = q.x1) < x0 - || (y2 = q.y1) < y0) continue; - - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, - ym = (y1 + y2) / 2; - - quads.push( - new Quad(node[3], xm, ym, x2, y2), - new Quad(node[2], x1, ym, xm, y2), - new Quad(node[1], xm, y1, x2, ym), - new Quad(node[0], x1, y1, xm, ym) - ); - - // Visit the closest quadrant first. - if (i = (y >= ym) << 1 | (x >= xm)) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; + function d3_geom_voronoiCircle() { + d3_geom_voronoiRedBlackNode(this); + this.x = this.y = this.arc = this.site = this.cy = null; + } + function d3_geom_voronoiAttachCircle(arc) { + var lArc = arc.P, rArc = arc.N; + if (!lArc || !rArc) return; + var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; + if (lSite === rSite) return; + var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; + var d = 2 * (ax * cy - ay * cx); + if (d >= -ε2) return; + var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by; + var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); + circle.arc = arc; + circle.site = cSite; + circle.x = x + bx; + circle.y = cy + Math.sqrt(x * x + y * y); + circle.cy = cy; + arc.circle = circle; + var before = null, node = d3_geom_voronoiCircles._; + while (node) { + if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { + if (node.L) node = node.L; else { + before = node.P; + break; + } + } else { + if (node.R) node = node.R; else { + before = node; + break; + } } } - - // Visit this point. (Visiting coincident points isn’t necessary!) - else { - var dx = x - +this._x.call(null, node.data), - dy = y - +this._y.call(null, node.data), - d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - - return data; -}; - -var tree_remove = function(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - - var parent, - node = this._root, - retainer, - previous, - next, - x0 = this._x0, - y0 = this._y0, - x1 = this._x1, - y1 = this._y1, - x, - y, - xm, - ym, - right, - bottom, - i, - j; - - // If the tree is empty, initialize the root as a leaf. - if (!node) return this; - - // Find the leaf node for the point. - // While descending, also retain the deepest parent with a non-removed sibling. - if (node.length) while (true) { - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i; - } - - // Find the point to remove. - while (node.data !== d) if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - - // If there are multiple coincident points, remove just the point. - if (previous) return (next ? previous.next = next : delete previous.next), this; - - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) - && node === (parent[3] || parent[2] || parent[1] || parent[0]) - && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; + d3_geom_voronoiCircles.insert(before, circle); + if (!before) d3_geom_voronoiFirstCircle = circle; } - - return this; -}; - -function removeAll(data) { - for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); - return this; -} - -var tree_root = function() { - return this._root; -}; - -var tree_size = function() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; while (node = node.next) - }); - return size; -}; - -var tree_visit = function(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); + 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; } } - return this; -}; - -var tree_visitAfter = function(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); - while (q = quads.pop()) { - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); + 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); + } } - next.push(q); - } - while (q = next.pop()) { - callback(q.node, q.x0, q.y0, q.x1, q.y1); } - return this; -}; - -function defaultX(d) { - return d[0]; -} - -var tree_x = function(_) { - return arguments.length ? (this._x = _, this) : this._x; -}; - -function defaultY(d) { - return d[1]; -} - -var tree_y = function(_) { - return arguments.length ? (this._y = _, this) : this._y; -}; - -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} - -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} - -function leaf_copy(leaf) { - var copy = {data: leaf.data}, next = copy; - while (leaf = leaf.next) next = next.next = {data: leaf.data}; - return copy; -} - -var treeProto = quadtree.prototype = Quadtree.prototype; - -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), - node = this._root, - nodes, - child; - - if (!node) return copy; - - if (!node.length) return copy._root = leaf_copy(node), copy; - - nodes = [{source: node, target: copy._root = new Array(4)}]; - while (node = nodes.pop()) { - for (var i = 0; i < 4; ++i) { - if (child = node.source[i]) { - if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)}); - else node.target[i] = leaf_copy(child); + function d3_geom_voronoiConnectEdge(edge, extent) { + var vb = edge.b; + if (vb) return true; + var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb; + if (ry === ly) { + if (fx < x0 || fx >= x1) return; + if (lx > rx) { + if (!va) va = { + x: fx, + y: y0 + }; else if (va.y >= y1) return; + vb = { + x: fx, + y: y1 + }; + } else { + if (!va) va = { + x: fx, + y: y1 + }; else if (va.y < y0) return; + vb = { + x: fx, + y: y0 + }; + } + } else { + fm = (lx - rx) / (ry - ly); + fb = fy - fm * fx; + if (fm < -1 || fm > 1) { + if (lx > rx) { + if (!va) va = { + x: (y0 - fb) / fm, + y: y0 + }; else if (va.y >= y1) return; + vb = { + x: (y1 - fb) / fm, + y: y1 + }; + } else { + if (!va) va = { + x: (y1 - fb) / fm, + y: y1 + }; else if (va.y < y0) return; + vb = { + x: (y0 - fb) / fm, + y: y0 + }; + } + } else { + if (ly < ry) { + if (!va) va = { + x: x0, + y: fm * x0 + fb + }; else if (va.x >= x1) return; + vb = { + x: x1, + y: fm * x1 + fb + }; + } else { + if (!va) va = { + x: x1, + y: fm * x1 + fb + }; else if (va.x < x0) return; + vb = { + x: x0, + y: fm * x0 + fb + }; + } } } + edge.a = va; + edge.b = vb; + return true; } - - return copy; -}; - -treeProto.add = tree_add; -treeProto.addAll = addAll; -treeProto.cover = tree_cover; -treeProto.data = tree_data; -treeProto.extent = tree_extent; -treeProto.find = tree_find; -treeProto.remove = tree_remove; -treeProto.removeAll = removeAll; -treeProto.root = tree_root; -treeProto.size = tree_size; -treeProto.visit = tree_visit; -treeProto.visitAfter = tree_visitAfter; -treeProto.x = tree_x; -treeProto.y = tree_y; - -exports.quadtree = quadtree; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],147:[function(_dereq_,module,exports){ -// https://d3js.org/d3-timer/ Version 1.0.7. Copyright 2017 Mike Bostock. -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.d3 = global.d3 || {}))); -}(this, (function (exports) { 'use strict'; - -var frame = 0; -var timeout = 0; -var interval = 0; -var pokeDelay = 1000; -var taskHead; -var taskTail; -var clockLast = 0; -var clockNow = 0; -var clockSkew = 0; -var clock = typeof performance === "object" && performance.now ? performance : Date; -var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); }; - -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} - -function clearNow() { - clockNow = 0; -} - -function Timer() { - this._call = - this._time = - this._next = null; -} - -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } - } -}; - -function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} - -function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while (t) { - if ((e = clockNow - t._time) >= 0) t._call.call(null, e); - t = t._next; - } - --frame; -} - -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally { - frame = 0; - nap(); - clockNow = 0; + function d3_geom_voronoiEdge(lSite, rSite) { + this.l = lSite; + this.r = rSite; + this.a = this.b = null; } -} - -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} - -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while (t1) { - if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } + function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { + var edge = new d3_geom_voronoiEdge(lSite, rSite); + d3_geom_voronoiEdges.push(edge); + if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); + if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); + d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); + d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); + return edge; } - taskTail = t0; - sleep(time); -} - -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); + function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { + var edge = new d3_geom_voronoiEdge(lSite, null); + edge.a = va; + edge.b = vb; + d3_geom_voronoiEdges.push(edge); + return edge; } -} - -var timeout$1 = function(callback, delay, time) { - var t = new Timer; - delay = delay == null ? 0 : +delay; - t.restart(function(elapsed) { - t.stop(); - callback(elapsed + delay); - }, delay, time); - return t; -}; - -var interval$1 = function(callback, delay, time) { - var t = new Timer, total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - delay = +delay, time = time == null ? now() : +time; - t.restart(function tick(elapsed) { - elapsed += total; - t.restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - return t; -}; - -exports.now = now; -exports.timer = timer; -exports.timerFlush = timerFlush; -exports.timeout = timeout$1; -exports.interval = interval$1; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],148:[function(_dereq_,module,exports){ -!function() { - var d3 = { - version: "3.5.17" - }; - var d3_arraySlice = [].slice, d3_array = function(list) { - return d3_arraySlice.call(list); - }; - var d3_document = this.document; - function d3_documentElement(node) { - return node && (node.ownerDocument || node.document || node).documentElement; + 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_window(node) { - return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView); + function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { + var va = edge.a, vb = edge.b; + this.edge = edge; + this.site = lSite; + this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y); } - 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; - }; + 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; } - } - if (!Date.now) Date.now = function() { - return +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); - }; - } + function d3_geom_voronoiRedBlackTree() { + this._ = null; } - d3.ascending = d3_ascending; - function d3_ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + function d3_geom_voronoiRedBlackNode(node) { + node.U = node.C = node.L = node.R = node.P = node.N = null; } - 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; + 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; } - 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; + 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; } - 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; + 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; } - 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; + 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; } - while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + 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; } - 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; - } + 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 { - while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { - a = c = b; + tree._ = q; + } + q.U = parent; + p.U = q; + p.R = q.L; + if (p.R) p.R.U = p; + q.L = p; + } + function d3_geom_voronoiRedBlackRotateRight(tree, node) { + var p = node, q = node.L, parent = p.U; + if (parent) { + if (parent.L === p) parent.L = q; else parent.R = q; + } else { + tree._ = q; + } + q.U = parent; + p.U = q; + p.L = q.R; + if (p.L) p.L.U = p; + q.R = p; + } + function d3_geom_voronoiRedBlackFirst(node) { + while (node.L) node = node.L; + return node; + } + function d3_geom_voronoi(sites, bbox) { + var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; + d3_geom_voronoiEdges = []; + d3_geom_voronoiCells = new Array(sites.length); + d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); + d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); + while (true) { + circle = d3_geom_voronoiFirstCircle; + if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { + if (site.x !== x0 || site.y !== y0) { + d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); + d3_geom_voronoiAddBeach(site); + x0 = site.x, y0 = site.y; + } + site = sites.pop(); + } else if (circle) { + d3_geom_voronoiRemoveBeach(circle.arc); + } else { break; } - 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; + 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_numeric(x) { - return !isNaN(x); + function d3_geom_voronoiVertexOrder(a, b) { + return b.y - a.y || b.x - a.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; + d3.geom.voronoi = function(points) { + var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; + if (points) return voronoi(points); + function voronoi(data) { + var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; + d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { + var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { + var s = e.start(); + return [ s.x, s.y ]; + }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; + polygon.point = data[i]; + }); + return polygons; } - 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; + function sites(data) { + return data.map(function(d, i) { + return { + x: Math.round(fx(d, i) / ε) * ε, + y: Math.round(fy(d, i) / ε) * ε, + i: i + }; + }); } - 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; + voronoi.links = function(data) { + return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { + return edge.l && edge.r; + }).map(function(edge) { + return { + source: data[edge.l.i], + target: data[edge.r.i] + }; + }); + }; + voronoi.triangles = function(data) { + var triangles = []; + d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { + var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l; + while (++j < m) { + e0 = e1; + s0 = s1; + e1 = edges[j].edge; + s1 = e1.l === site ? e1.r : e1.l; + if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { + triangles.push([ data[i], data[s0.i], data[s1.i] ]); + } + } + }); + return triangles; + }; + voronoi.x = function(_) { + return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; + }; + voronoi.y = function(_) { + return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; + }; + voronoi.clipExtent = function(_) { + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; + clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; + return voronoi; + }; + voronoi.size = function(_) { + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; + return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); + }; + return voronoi; }; - 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), .5); + 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.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); - } + d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var x = d3_geom_pointX, y = d3_geom_pointY, compat; + if (compat = arguments.length) { + x = d3_geom_quadtreeCompatX; + y = d3_geom_quadtreeCompatY; + if (compat === 3) { + y2 = y1; + x2 = x1; + y1 = x1 = 0; } - } 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); + return quadtree(points); + } + function quadtree(data) { + var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; + if (x1 != null) { + x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; + } else { + x2_ = y2_ = -(x1_ = y1_ = Infinity); + xs = [], ys = []; + n = data.length; + if (compat) for (i = 0; i < n; ++i) { + d = data[i]; + if (d.x < x1_) x1_ = d.x; + if (d.y < y1_) y1_ = d.y; + if (d.x > x2_) x2_ = d.x; + if (d.y > y2_) y2_ = d.y; + xs.push(d.x); + ys.push(d.y); + } else for (i = 0; i < n; ++i) { + var x_ = +fx(d = data[i], i), y_ = +fy(d, i); + if (x_ < x1_) x1_ = x_; + if (y_ < y1_) y1_ = y_; + if (x_ > x2_) x2_ = x_; + if (y_ > y2_) y2_ = y_; + xs.push(x_); + ys.push(y_); } } + var dx = x2_ - x1_, dy = y2_ - y1_; + if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; + function insert(n, d, x, y, x1, y1, x2, y2) { + if (isNaN(x) || isNaN(y)) return; + if (n.leaf) { + var nx = n.x, ny = n.y; + if (nx != null) { + if (abs(nx - x) + abs(ny - y) < .01) { + insertChild(n, d, x, y, x1, y1, x2, y2); + } else { + var nPoint = n.point; + n.x = n.y = n.point = null; + insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } else { + n.x = x, n.y = y, n.point = d; + } + } else { + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } + function insertChild(n, d, x, y, x1, y1, x2, y2) { + var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right; + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + if (right) x1 = xm; else x2 = xm; + if (below) y1 = ym; else y2 = ym; + insert(n, d, x, y, x1, y1, x2, y2); + } + var root = d3_geom_quadtreeNode(); + root.add = function(d) { + insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); + }; + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); + }; + root.find = function(point) { + return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_); + }; + i = -1; + if (x1 == null) { + while (++i < n) { + insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); + } + --i; + } else data.forEach(root.add); + xs = ys = data = d = null; + return root; } - if (j > 1) return s / (j - 1); - }; - d3.deviation = function() { - var v = d3.variance.apply(this, arguments); - return v ? Math.sqrt(v) : v; + quadtree.x = function(_) { + return arguments.length ? (x = _, quadtree) : x; + }; + quadtree.y = function(_) { + return arguments.length ? (y = _, quadtree) : y; + }; + quadtree.extent = function(_) { + if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], + y2 = +_[1][1]; + return quadtree; + }; + quadtree.size = function(_) { + if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; + return quadtree; + }; + return quadtree; }; - function d3_bisector(compare) { + function d3_geom_quadtreeCompatX(d) { + return d.x; + } + function d3_geom_quadtreeCompatY(d) { + return d.y; + } + function d3_geom_quadtreeNode() { return { - left: function(a, x, lo, hi) { - if (arguments.length < 3) lo = 0; - if (arguments.length < 4) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; + leaf: true, + nodes: [], + point: null, + x: null, + y: null + }; + } + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } + } + function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) { + var minDistance2 = Infinity, closestPoint; + (function find(node, x1, y1, x2, y2) { + if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) 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); + x0 = x - distance, y0 = y - distance; + x3 = x + distance, y3 = y + distance; + closestPoint = point; } - return lo; - }, - right: function(a, x, lo, hi) { - if (arguments.length < 3) lo = 0; - if (arguments.length < 4) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; + } + var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .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, x1, y1, xm, ym); + break; + + case 1: + find(node, xm, y1, x2, ym); + break; + + case 2: + find(node, x1, ym, xm, y2); + break; + + case 3: + find(node, xm, ym, x2, y2); + break; } - return lo; } + })(root, x0, y0, x3, y3); + return closestPoint; + } + d3.interpolateRgb = d3_interpolateRgb; + function d3_interpolateRgb(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; + return function(t) { + return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); }; } - 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, i0, i1) { - if ((m = arguments.length) < 3) { - i1 = array.length; - if (m < 2) i0 = 0; - } - var m = i1 - i0, t, i; - while (m) { - i = Math.random() * m-- | 0; - t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = 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]; + } } - return array; - }; - d3.permute = function(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; - }; - d3.pairs = function(array) { - var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; - return pairs; - }; - d3.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]; + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; } } - return transpose; - }; - function d3_transposeLength(d) { - return d.length; + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; } - d3.zip = function() { - return d3.transpose(arguments); - }; - d3.keys = function(map) { - var keys = []; - for (var key in map) keys.push(key); - return keys; - }; - d3.values = function(map) { - var values = []; - for (var key in map) values.push(map[key]); - return values; - }; - d3.entries = function(map) { - var entries = []; - for (var key in map) entries.push({ - key: key, - value: map[key] - }); - return entries; - }; - d3.merge = function(arrays) { - var n = arrays.length, m, i = -1, j = 0, merged, array; - while (++i < n) j += arrays[i].length; - merged = new Array(j); - while (--n >= 0) { - array = arrays[n]; - m = array.length; - while (--m >= 0) { - merged[--j] = array[m]; + 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 bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; + a = a + "", b = b + ""; + while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) { + if ((bs = bm.index) > bi) { + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; else s[++i] = bs; } - } - 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 ((am = am[0]) === (bm = bm[0])) { + if (s[i]) s[i] += bm; else s[++i] = bm; + } else { + s[++i] = null; + q.push({ + i: i, + x: d3_interpolateNumber(am, bm) + }); } + bi = d3_interpolate_numberB.lastIndex; } - 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 - }); + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; else s[++i] = bs; } + 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 i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); } - d3.map = function(object, f) { - var map = new d3_Map(); - if (object instanceof d3_Map) { - object.forEach(function(key, value) { - map.set(key, value); - }); - } else if (Array.isArray(object)) { - var i = -1, n = object.length, o; - if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o); - } else { - for (var key in object) map.set(key, object[key]); - } - return map; - }; - function d3_Map() { - this._ = Object.create(null); + 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; } - var d3_map_proto = "__proto__", d3_map_zero = "\x00"; - d3_class(d3_Map, { - has: d3_map_has, - get: function(key) { - return this._[d3_map_escape(key)]; + 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 = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; + for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); + for (;i < na; ++i) c[i] = a[i]; + for (;i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; + } + var d3_ease_default = function() { + return d3_identity; + }; + var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { + return d3_ease_quad; }, - set: function(key, value) { - return this._[d3_map_escape(key)] = value; + cubic: function() { + return d3_ease_cubic; }, - remove: d3_map_remove, - keys: d3_map_keys, - values: function() { - var values = []; - for (var key in this._) values.push(this._[key]); - return values; + sin: function() { + return d3_ease_sin; }, - entries: function() { - var entries = []; - for (var key in this._) entries.push({ - key: d3_map_unescape(key), - value: this._[key] - }); - return entries; + exp: function() { + return d3_ease_exp; }, - 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]); + circle: function() { + return d3_ease_circle; + }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { + return d3_ease_bounce; } }); - 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; + 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_map_has(key) { - return d3_map_escape(key) in this._; + function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; } - function d3_map_remove(key) { - return (key = d3_map_escape(key)) in this._ && delete this._[key]; + function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); + }; } - function d3_map_keys() { - var keys = []; - for (var key in this._) keys.push(d3_map_unescape(key)); - return keys; + function d3_ease_quad(t) { + return t * t; } - function d3_map_size() { - var size = 0; - for (var key in this._) ++size; - return size; + function d3_ease_cubic(t) { + return t * t * t; } - function d3_map_empty() { - for (var key in this._) return false; - return true; + function d3_ease_cubicInOut(t) { + if (t <= 0) return 0; + if (t >= 1) return 1; + var t2 = t * t, t3 = t2 * t; + return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); } - d3.nest = function() { - var nest = {}, keys = [], sortKeys = [], sortValues, rollup; - function map(mapType, array, depth) { - if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; - var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; - while (++i < n) { - if (values = valuesByKey.get(keyValue = key(object = array[i]))) { - values.push(object); - } else { - valuesByKey.set(keyValue, [ object ]); - } - } - if (mapType) { - object = mapType(); - setter = function(keyValue, values) { - object.set(keyValue, map(mapType, values, depth)); - }; - } else { - object = {}; - setter = function(keyValue, values) { - object[keyValue] = map(mapType, values, depth); - }; - } - valuesByKey.forEach(setter); - return object; - } - function entries(map, depth) { - if (depth >= keys.length) return map; - var array = [], sortKey = sortKeys[depth++]; - map.forEach(function(key, keyMap) { - array.push({ - key: key, - values: entries(keyMap, depth) - }); - }); - return sortKey ? array.sort(function(a, b) { - return sortKey(a.key, b.key); - }) : array; - } - nest.map = function(array, mapType) { - return map(mapType, array, 0); - }; - nest.entries = function(array) { - return entries(map(d3.map, array, 0), 0); - }; - nest.key = function(d) { - keys.push(d); - return nest; + function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); }; - nest.sortKeys = function(order) { - sortKeys[keys.length - 1] = order; - return nest; + } + function d3_ease_sin(t) { + return 1 - Math.cos(t * halfπ); + } + function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); + } + function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); + } + function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = .45; + if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4; + return function(t) { + return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p); }; - nest.sortValues = function(order) { - sortValues = order; - return nest; + } + function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); }; - 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._ = 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; + function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; } - d3.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; + d3.interpolateHcl = d3_interpolateHcl; + function d3_interpolateHcl(a, b) { + a = d3.hcl(a); + b = d3.hcl(b); + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; + if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; }; } - 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; + d3.interpolateHsl = d3_interpolateHsl; + function d3_interpolateHsl(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; + if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; }; - return event; - } - d3.event = null; - function d3_eventPreventDefault() { - d3.event.preventDefault(); - } - function d3_eventSource() { - var e = d3.event, s; - while (s = e.sourceEvent) e = s; - return e; } - function d3_eventDispatch(target) { - var dispatch = new d3_dispatch(), i = 0, n = arguments.length; - while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); - dispatch.of = function(thiz, argumentz) { - return function(e1) { - try { - var e0 = e1.sourceEvent = d3.event; - e1.target = target; - d3.event = e1; - dispatch[e1.type].apply(thiz, argumentz); - } finally { - d3.event = e0; - } - }; + d3.interpolateLab = d3_interpolateLab; + function d3_interpolateLab(a, b) { + a = d3.lab(a); + b = d3.lab(b); + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; + return function(t) { + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; }; - 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(n, s) { - return d3_selectMatcher.call(n, s); - }; - return d3_selectMatches(n, s); - }; - if (typeof Sizzle === "function") { - d3_select = function(s, n) { - return Sizzle(s, n)[0] || null; + d3.interpolateRound = d3_interpolateRound; + function d3_interpolateRound(a, b) { + b -= a; + return function(t) { + return Math.round(a + b * t); }; - 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); - } + d3.transform = function(string) { + var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); + return (d3.transform = function(string) { + if (string != null) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); } - } - return d3_selection(subgroups); + return new d3_transform(t ? t.matrix : d3_transformIdentity); + })(string); }; - 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; - } - } + function d3_transform(m) { + var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; } - return d3_selection(subgroups); - }; - function d3_selection_selectorAll(selector) { - return typeof selector === "function" ? selector : function() { - return d3_selectAll(selector, this); - }; + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; + this.translate = [ m.e, m.f ]; + this.scale = [ kx, ky ]; + this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; } - 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_transform.prototype.toString = function() { + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; }; - 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; + 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 this.each(d3_selection_attr(name, value)); + 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 }; - 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); + d3.interpolateTransform = d3_interpolateTransform; + function d3_interpolateTransformPop(s) { + return s.length ? s.pop() + "," : ""; + } + function d3_interpolateTranslate(ta, tb, s, q) { + if (ta[0] !== tb[0] || ta[1] !== tb[1]) { + var i = s.push("translate(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: d3_interpolateNumber(ta[0], tb[0]) + }, { + i: i - 2, + x: d3_interpolateNumber(ta[1], tb[1]) + }); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); } - 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); + } + function d3_interpolateRotate(ra, rb, s, q) { + if (ra !== rb) { + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; + q.push({ + i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2, + x: d3_interpolateNumber(ra, rb) + }); + } else if (rb) { + s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")"); } - 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, " "); + function d3_interpolateSkew(wa, wb, s, q) { + if (wa !== wb) { + q.push({ + i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2, + x: d3_interpolateNumber(wa, wb) + }); + } else if (wb) { + s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")"); + } } - 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; + function d3_interpolateScale(ka, kb, s, q) { + if (ka[0] !== kb[0] || ka[1] !== kb[1]) { + var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: d3_interpolateNumber(ka[0], kb[0]) + }, { + i: i - 2, + x: d3_interpolateNumber(ka[1], kb[1]) + }); + } else if (kb[0] !== 1 || kb[1] !== 1) { + s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")"); } - 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_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_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_uninterpolateNumber(a, b) { + b = (b -= a = +a) || 1 / b; + return function(x) { + return (x - a) / b; + }; } - function d3_selection_classedName(name) { - var re = d3_selection_classedRe(name); - return function(node, value) { - if (c = node.classList) return value ? c.add(name) : c.remove(name); - var c = node.getAttribute("class") || ""; - if (value) { - re.lastIndex = 0; - if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); - } else { - node.setAttribute("class", d3_collapse(c.replace(re, " "))); - } + 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_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)); + 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_selection_style(name, value, priority) { - function styleNull() { - this.style.removeProperty(name); - } - function styleConstant() { - this.style.setProperty(name, value, priority); + 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); } - function styleFunction() { - var x = value.apply(this, arguments); - if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; } - return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; + return points; } - 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 d3_layout_bundleAncestors(node) { + var ancestors = [], parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; } - function propertyFunction() { - var x = value.apply(this, arguments); - if (x == null) delete this[name]; else this[name] = x; + 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 value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; + return sharedNode; } - 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 document = this.ownerDocument, namespace = this.namespaceURI; - return namespace === d3_nsXhtml && document.documentElement.namespaceURI === d3_nsXhtml ? document.createElement(name) : document.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); + d3.layout.chord = function() { + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; + function relayout() { + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; + chords = []; + groups = []; + k = 0, i = -1; while (++i < n) { - if (node = group[i]) { - value[i] = node.__data__; + x = 0, j = -1; + while (++j < n) { + x += matrix[i][j]; } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; } - return value; - } - function bind(group, groupData) { - var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; - if (key) { - var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue; - for (i = -1; ++i < n; ) { - if (node = group[i]) { - if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) { - exitNodes[i] = node; - } else { - nodeByKeyValue.set(keyValue, node); - } - keyValues[i] = keyValue; - } + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + k = (τ - padding * n) / k; + x = 0, i = -1; + while (++i < n) { + x0 = x, j = -1; + while (++j < n) { + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; } - for (i = -1; ++i < m; ) { - if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) { - enterNodes[i] = d3_selection_dataNode(nodeData); - } else if (node !== true) { - updateNodes[i] = node; - node.__data__ = nodeData; + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: groupSums[di] + }; + x += padding; + } + i = -1; + while (++i < n) { + j = i - 1; + while (++j < n) { + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value ? { + source: target, + target: source + } : { + source: source, + target: target + }); } - nodeByKeyValue.set(keyValue, true); } - for (i = -1; ++i < n; ) { - if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) { - exitNodes[i] = group[i]; + } + 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 = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges; + function repulse(node) { + return function(quad, x1, _, x2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; + if (dw * dw / theta2 < dn) { + if (dn < chargeDistance2) { + var k = quad.charge / dn; + node.px -= dx * k; + node.py -= dy * k; + } + return true; } - } - } else { - for (i = -1; ++i < n0; ) { - node = group[i]; - nodeData = groupData[i]; - if (node) { - node.__data__ = nodeData; - updateNodes[i] = node; - } else { - enterNodes[i] = d3_selection_dataNode(nodeData); + if (quad.point && dn && dn < chargeDistance2) { + var k = quad.pointCharge / dn; + node.px -= dx * k; + node.py -= dy * k; } } - for (;i < m; ++i) { - enterNodes[i] = d3_selection_dataNode(groupData[i]); + return !quad.charge; + }; + } + force.tick = function() { + if ((alpha *= .99) < .005) { + 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) : .5); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; } - for (;i < n; ++i) { - exitNodes[i] = group[i]; + } + 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; } } - enterNodes.update = updateNodes; - enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; - enter.push(enterNodes); - update.push(updateNodes); - exit.push(exitNodes); - } - var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); - if (typeof value === "function") { - while (++i < n) { - bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + 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)); + } + } } - } else { + i = -1; while (++i < n) { - bind(group = this[i], value); + 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; + } } - } - update.enter = function() { - return enter; + event.tick({ + type: "tick", + alpha: alpha + }); }; - update.exit = function() { - return exit; + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; }; - return update; - }; - function d3_selection_dataNode(data) { - return { - __data__: data + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; }; - } - 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); + 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 d3_selection(subgroups); - }; - function d3_selection_filter(selector) { - return function() { - return d3_selectMatches(this, selector); + return force; }; - } - 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; + force.start = function() { + var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + ++o.source.weight; + ++o.target.weight; + } + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + distances = []; + if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance; + strengths = []; + if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength; + charges = []; + if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; + function position(dimension, size) { + if (!neighbors) { + neighbors = new Array(n); + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } } + var candidates = neighbors[i], j = -1, l = candidates.length, x; + while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; + return Math.random() * size; } + return force.resume(); + }; + force.resume = function() { + return force.alpha(.1); + }; + force.stop = function() { + return force.alpha(0); + }; + force.drag = function() { + if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); + if (!arguments.length) return drag; + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); + }; + function dragmove(d) { + d.px = d3.event.x, d.py = d3.event.y; + force.resume(); } - return 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(); + return d3.rebind(force, event, "on"); }; - 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; - }; + function d3_layout_forceDragstart(d) { + d.fixed |= 2; } - 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); + 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; } } - 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; + if (quad.point) { + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; } - 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; + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; } - 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__; + 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 { - subgroup.push(null); + if (value) node.value = +value.call(hierarchy, node, node.depth) || 0; + delete node.children; } } + d3_layout_hierarchyVisitAfter(root, function(node) { + var childs, parent; + if (sort && (childs = node.children)) childs.sort(sort); + if (value && (parent = node.parent)) parent.value += node.value; + }); + return nodes; } - return d3_selection(subgroups); - }; - d3_selection_enterPrototype.insert = function(name, before) { - if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); - return d3_selectionPrototype.insert.call(this, name, before); - }; - function d3_selection_enterInsertBefore(enter) { - var i0, j0; - return function(d, i, j) { - var group = enter[j].update, n = group.length, node; - if (j != j0) j0 = j, i0 = 0; - if (i >= i0) i0 = i + 1; - while (!(node = group[i0]) && ++i0 < n) ; - return node; + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; }; - } - 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; + 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; + }); } - if (n < 2) return (n = this.node()["__on" + type]) && n._; - capture = false; - } - return this.each(d3_selection_on(type, listener, capture)); + return root; + }; + return hierarchy; }; - 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 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 onAdd() { - var l = wrap(listener, d3_array(arguments)); - onRemove.call(this); - this.addEventListener(type, this[name] = l, l.$ = capture); - l._ = listener; - } - function removeAll() { - var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; - for (var name in this) { - if (match = name.match(re)) { - var l = this[name]; - this.removeEventListener(match[1], l, l.$); - delete this[name]; - } + } + 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]); } } - return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; + while ((node = nodes2.pop()) != null) { + callback(node); + } } - 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_layout_hierarchyChildren(d) { + return d.children; } - 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_layout_hierarchyValue(d) { + return d.value; } - 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); - } - }; + function d3_layout_hierarchySort(a, b) { + return b.value - a.value; } - 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); + function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return { + source: parent, + target: child }; - 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 window = d3_window(container); - if (window.scrollX || window.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(); + 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; } } - 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); + 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.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); + 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), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / 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 + pa, + padAngle: p + }; + }); + return arcs; } - function dragstart(id, 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 = id(), 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" + 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, i) { + return values.call(stack, d, i); + }); + var points = series.map(function(d) { + return d.map(function(v, i) { + return [ x.call(stack, v, i), y.call(stack, v, i) ]; }); - function moved() { - var position1 = position(parent, dragId), dx, dy; - if (!position1) return; - dx = position1[0] - position0[0]; - dy = position1[1] - position0[1]; - dragged |= dx | dy; - position0 = position1; - dispatch({ - type: "drag", - x: position1[0] + dragOffset[0], - y: position1[1] + dragOffset[1], - dx: dx, - dy: dy - }); - } - function ended() { - if (!position(parent, dragId)) return; - dragSubject.on(move + dragName, null).on(end + dragName, null); - dragRestore(dragged); - dispatch({ - type: "dragend" - }); + }); + 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; } - drag.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - return drag; + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; }; - 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; - }) : []; + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + return stack; }; - 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_layout_stackX(d) { + return d.x; } - function d3_tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); + function d3_layout_stackY(d) { + return d.y; } - function d3_haversin(x) { - return (x = Math.sin(x / 2)) * x; + function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; } - var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4; - d3.interpolateZoom = function(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - if (d2 < ε2) { - S = Math.log(w1 / w0) / ρ; - i = function(t) { - return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / ρ; - i = function(t) { - var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0)); - return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ]; - }; - } - 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"), x0, x1, y0, y1; - 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: k - }; - zoomed(dispatch); - }; - }).each("interrupt.zoom", function() { - zoomended(dispatch); - }).each("end.zoom", function() { - zoomended(dispatch); - }); + 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 { - this.__chart__ = view; - zoomstarted(dispatch); - zoomed(dispatch); - zoomended(dispatch); + bottom += sums[j]; + bottoms.push(j); } - }); - }; - 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 x1; - x1 = z; - x0 = z.copy(); - view = { - x: 0, - y: 0, - k: 1 - }; - return zoom; - }; - zoom.y = function(z) { - if (!arguments.length) return y1; - y1 = z; - y0 = z.copy(); - view = { - x: 0, - y: 0, - k: 1 - }; - return zoom; - }; - function location(p) { - return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; - } - function point(l) { - return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; - } - function scaleTo(s) { - view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); - } - function translateTo(p, l) { - l = point(l); - view.x += p[0] - l[0]; - view.y += p[1] - l[1]; - } - function 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 (x1) x1.domain(x0.range().map(function(x) { - return (x - view.x) / view.k; - }).map(x0.invert)); - if (y1) y1.domain(y0.range().map(function(y) { - return (y - view.y) / view.k; - }).map(y0.invert)); - } - function zoomstarted(dispatch) { - 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); + return bottoms.reverse().concat(tops); + }, + reverse: function(data) { + return d3.range(data.length).reverse(); + }, + "default": d3_layout_stackOrderDefault + }); + var d3_layout_stackOffsets = d3.map({ + silhouette: function(data) { + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); } - } - 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; + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; } - 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(); + return y0; + }, + wiggle: function(data) { + var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; } - 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; + s2 += s3 * data[i][j][1]; } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; } - function moved() { - var touches = d3.touches(that), p0, l0, p1, l1; - d3_selection_interrupt.call(that); - for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { - p1 = touches[i]; - if (l1 = locations0[p1.identifier]) { - if (l0) break; - p0 = p1, l0 = l1; - } - } - if (l1) { - var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); - p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; - l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; - scaleTo(scale1 * scale0); - } - touchtime = null; - translateTo(p0, l0); - zoomed(dispatch); + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + expand: function(data) { + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; } - 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(); + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + zero: d3_layout_stackOffsetZero + }); + function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); + } + function d3_layout_stackOffsetZero(data) { + var j = -1, m = data[0].length, y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + function d3_layout_stackMaxIndex(array) { + var i = 1, j = 0, v = array[0][1], k, n = array.length; + for (;i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; + } + function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); + } + function d3_layout_stackSum(p, d) { + return p + d[1]; + } + d3.layout.histogram = function() { + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; + function histogram(data, i) { + var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + if (m > 0) { + i = -1; + while (++i < n) { + x = values[i]; + if (x >= range[0] && x <= range[1]) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); } } - d3.selectAll(targets).on(zoomName, null); - subject.on(mousedown, mousedowned).on(touchstart, touchstarted); - dragRestore(); - zoomended(dispatch); } + return bins; } - 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() * .002) * 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() + ""; + 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; }; - 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); + function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); } - var d3_hslPrototype = d3_hsl.prototype = new d3_color(); - d3_hslPrototype.brighter = function(k) { - k = Math.pow(.7, arguments.length ? k : 1); - return new d3_hsl(this.h, this.s, this.l / k); - }; - d3_hslPrototype.darker = function(k) { - k = Math.pow(.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 m1, m2; - h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; - s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; - l = l < 0 ? 0 : l > 1 ? 1 : l; - m2 = l <= .5 ? l * (1 + s) : l + s - l * s; - m1 = 2 * l - m2; - function v(h) { - if (h > 360) h -= 360; else if (h < 0) h += 360; - if (h < 60) return m1 + (m2 - m1) * h / 60; - if (h < 180) return m2; - if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; - return m1; - } - function vv(h) { - return Math.round(v(h) * 255); - } - return new d3_rgb(vv(h + 120), vv(h), vv(h - 120)); + 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; } - 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); + function d3_layout_histogramRange(values) { + return [ d3.min(values), d3.max(values) ]; } - 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(); + 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(d) { + d.r = +r(d.value); + }); + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); + if (padding) { + var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r += dr; + }); + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r -= dr; + }); + } + d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); + return nodes; + } + pack.size = function(_) { + if (!arguments.length) return size; + size = _; + return pack; + }; + pack.radius = function(_) { + if (!arguments.length) return radius; + radius = _ == null || typeof _ === "function" ? _ : +_; + return pack; + }; + pack.padding = function(_) { + if (!arguments.length) return padding; + padding = +_; + return pack; + }; + return d3_layout_hierarchyRebind(pack, hierarchy); }; - function d3_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); + function d3_layout_packSort(a, b) { + return a.value - b.value; } - var d3_lab_K = 18; - var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; - var d3_labPrototype = d3_lab.prototype = new d3_color(); - d3_labPrototype.brighter = function(k) { - return 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 - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); + 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_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_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; } - function d3_lab_xyz(x) { - return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; + return .999 * dr * dr > dx * dx + dy * dy; } - function d3_xyz_lab(x) { - return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; - } - function d3_xyz_rgb(r) { - return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); + function d3_layout_packSiblings(node) { + if (!(nodes = node.children) || !(n = nodes.length)) return; + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + nodes.forEach(d3_layout_packLink); + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + for (i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + if (isect) { + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; + for (i = 0; i < n; i++) { + c = nodes[i]; + c.x -= cx; + c.y -= cy; + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); + } + node.r = cr; + nodes.forEach(d3_layout_packUnlink); } - 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_layout_packLink(node) { + node._pack_next = node._pack_prev = node; } - function d3_rgbNumber(value) { - return new d3_rgb(value >> 16, value >> 8 & 255, value & 255); + function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; } - function d3_rgbString(value) { - return d3_rgbNumber(value) + ""; + 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); + } } - var d3_rgbPrototype = d3_rgb.prototype = new d3_color(); - d3_rgbPrototype.brighter = function(k) { - k = Math.pow(.7, arguments.length ? k : 1); - var r = this.r, g = this.g, b = this.b, i = 30; - if (!r && !g && !b) return 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(.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_layout_packPlace(a, b, c) { + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, dc = dx * dx + dy * dy; + da *= da; + db *= db; + var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } } - function d3_rgb_parse(format, rgb, hsl) { - var r = 0, g = 0, b = 0, m1, m2, color; - m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase()); - if (m1) { - m2 = m1[2].split(","); - switch (m1[1]) { - case "hsl": - { - return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); + 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: i + }).a = child); } - - case "rgb": - { - return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); + } + 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]); } - if (color = d3_rgb_names.get(format)) { - return rgb(color.r, color.g, color.b); + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; } - if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) { - if (format.length === 4) { - r = (color & 3840) >> 4; - r = r >> 4 | r; - g = color & 240; - g = g >> 4 | g; - b = color & 15; - b = b << 4 | b; - } else if (format.length === 7) { - r = (color & 16711680) >> 16; - g = (color & 65280) >> 8; - b = color & 255; + 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; } - return rgb(r, g, b); - } - function d3_rgb_hsl(r, g, b) { - var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; - if (d) { - s = l < .5 ? d / (max + min) : d / (2 - max - min); - if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; - h *= 60; - } else { - h = NaN; - s = l > 0 && l < 1 ? 0 : h; + function sizeNode(node) { + node.x *= size[0]; + node.y = node.depth * size[1]; } - return new d3_hsl(h, s, l); + 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_rgb_lab(r, g, b) { - r = d3_rgb_xyz(r); - g = d3_rgb_xyz(g); - b = d3_rgb_xyz(b); - var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); - return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + function d3_layout_treeLeft(v) { + var children = v.children; + return children.length ? children[0] : v.t; } - function d3_rgb_xyz(r) { - return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); + function d3_layout_treeRight(v) { + var children = v.children, n; + return (n = children.length) ? children[n - 1] : v.t; } - function d3_rgb_parseNumber(c) { - var f = parseFloat(c); - return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; + function d3_layout_treeMove(wm, wp, shift) { + var change = shift / (wp.i - wm.i); + wp.c -= change; + wp.s += shift; + wm.c += change; + wp.z += shift; + wp.m += shift; } - 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; - }; + 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); + } } - 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_layout_treeAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; } - function d3_xhr(url, mimeType, response, callback) { - var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null; - if (this.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; + 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; } - 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; + }); + var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; + d3_layout_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 - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + return nodes; + } + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; }; - xhr.responseType = function(value) { - if (!arguments.length) return responseType; - responseType = value; - return xhr; + cluster.size = function(x) { + if (!arguments.length) return nodeSize ? null : size; + nodeSize = (size = x) == null; + return cluster; }; - xhr.response = function(value) { - response = value; - return xhr; + cluster.nodeSize = function(x) { + if (!arguments.length) return nodeSize ? size : null; + nodeSize = (size = x) != null; + return cluster; }; - [ "get", "post" ].forEach(function(method) { - xhr[method] = function() { - return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); - }; + return d3_layout_hierarchyRebind(cluster, hierarchy); + }; + function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; }); - xhr.send = function(method, data, callback) { - if (arguments.length === 2 && typeof data === "function") callback = data, data = null; - request.open(method, url, true); - if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; - if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); - if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); - if (responseType != null) request.responseType = responseType; - if (callback != null) xhr.on("error", callback).on("load", function(request) { - callback(null, request); - }); - dispatch.beforesend.call(xhr, request); - request.send(data == null ? null : data); - return xhr; - }; - xhr.abort = function() { - request.abort(); - return xhr; - }; - d3.rebind(xhr, dispatch, "on"); - return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); } - function d3_xhr_fixCallback(callback) { - return callback.length === 1 ? function(error, request) { - callback(error == null ? request : null); - } : callback; + function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; } - function d3_xhrHasResponse(request) { - var type = request.responseType; - return type && type !== "text" ? request.response : request.responseText; + function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; } - 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); - }; + function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; + } + d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); + function scale(children, k) { + var i = -1, n = children.length, child, area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } } - dsv.parse = function(text, f) { - var o; - return dsv.parseRows(text, function(row, i) { - if (o) return o(row, i - 1); - var a = new Function("d", "return {" + row.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + "]"; - }).join(",") + "}"); - o = f ? function(row, i) { - return f(a(row), i); - } : a; - }); - }; - dsv.parseRows = function(text, f) { - var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; - function token() { - if (I >= N) return EOF; - if (eol) return eol = false, EOL; - var j = I; - if (text.charCodeAt(j) === 34) { - var i = j; - while (i++ < N) { - if (text.charCodeAt(i) === 34) { - if (text.charCodeAt(i + 1) !== 34) break; - ++i; - } - } - I = i + 2; - var c = text.charCodeAt(i + 1); - if (c === 13) { - eol = true; - if (text.charCodeAt(i + 2) === 10) ++I; - } else if (c === 10) { - eol = true; + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if (mode !== "squarify" || (score = worst(row, u)) <= best) { + remaining.pop(); + best = score; + } else { + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; } - 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); + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; } - return text.slice(j); + children.forEach(squarify); } - while ((t = token()) !== EOF) { - var a = []; - while (t !== EOL && t !== EOF) { - a.push(t); - t = token(); + } + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), remaining = children.slice(), child, row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } } - if (f && (a = f(a, n++)) == null) continue; - rows.push(a); + children.forEach(stickify); } - 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)); - } + } + 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); } - }); - return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { - return fields.map(function(field) { - return formatValue(row[field]); - }).join(delimiter); - })).join("\n"); + 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; }; - dsv.formatRows = function(rows) { - return rows.map(formatRow).join("\n"); + treemap.padding = function(x) { + if (!arguments.length) return padding; + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); + } + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], + padConstant) : padConstant; + return treemap; }; - function formatRow(row) { - return row.map(formatValue).join(delimiter); + 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; } - function formatValue(text) { - return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; + if (dy < 0) { + y += dy / 2; + dy = 0; + } + return { + x: x, + y: y, + dx: dx, + dy: dy + }; + } + d3.random = { + normal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); + }; + }, + logNormal: function() { + var random = d3.random.normal.apply(d3, arguments); + return function() { + return Math.exp(random()); + }; + }, + bates: function(m) { + var random = d3.random.irwinHall(m); + return function() { + return random() / m; + }; + }, + irwinHall: function(m) { + return function() { + for (var s = 0, j = 0; j < m; j++) s += Math.random(); + return s; + }; } - 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 + 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)); }; - if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer; - d3_timer_queueTail = timer; - if (!d3_timer_interval) { - d3_timer_timeout = clearTimeout(d3_timer_timeout); - d3_timer_interval = 1; - d3_timer_frame(d3_timer_step); + } + function d3_scale_nice(domain, nice) { + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; + if (x1 < x0) { + dx = i0, i0 = i1, i1 = dx; + dx = x0, x0 = x1, x1 = dx; } - return timer; + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + return domain; } - 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); + 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_timer_interval = 0; - } else { - d3_timer_interval = 1; - d3_timer_frame(d3_timer_step); - } + } : d3_scale_niceIdentity; } - d3.timer.flush = function() { - d3_timer_mark(); - d3_timer_sweep(); + var d3_scale_niceIdentity = { + floor: d3_identity, + ceil: d3_identity }; - 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; + 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(); } - return now; - } - function d3_timer_sweep() { - var t0, t1 = d3_timer_queueHead, time = Infinity; - while (t1) { - if (t1.c) { - if (t1.t < time) time = t1.t; - t1 = (t0 = t1).n; - } else { - t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n; - } + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); } - d3_timer_queueTail = t0; - return time; - } - function d3_format_precision(x, p) { - return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; } - d3.round = function(x, n) { - return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); + d3.scale.linear = function() { + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); }; - var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); - d3.formatPrefix = function(value, precision) { - var i = 0; - if (value = +value) { - if (value < 0) value *= -1; - if (precision) value = d3.round(value, d3_format_precision(value, precision)); - i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); - i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3)); + 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; } - return d3_formatPrefixes[8 + i / 3]; - }; - function d3_formatPrefix(d, i) { - var k = Math.pow(10, abs(8 - i) * 3); - return { - scale: i > 8 ? function(d) { - return d / k; - } : function(d) { - return d * k; - }, - symbol: d + function scale(x) { + return output(x); + } + scale.invert = function(y) { + return input(y); }; - } - function d3_locale_numberFormat(locale) { - var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) { - var i = value.length, t = [], j = 0, g = locale_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 = locale_grouping[j = (j + 1) % locale_grouping.length]; - } - return t.reverse().join(locale_thousands); - } : d3_identity; - return function(specifier) { - var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true; - if (precision) precision = +precision.substring(1); - if (zfill || fill === "0" && align === "=") { - zfill = fill = "0"; - align = "="; - } - switch (type) { - case "n": - comma = true; - type = "g"; - break; - - case "%": - scale = 100; - suffix = "%"; - type = "f"; - break; - - case "p": - scale = 100; - suffix = "%"; - type = "r"; - break; - - case "b": - case "o": - case "x": - case "X": - if (symbol === "#") prefix = "0" + type.toLowerCase(); - - case "c": - exponent = false; - - case "d": - integer = true; - precision = 0; - break; - - case "s": - scale = -1; - type = "r"; - break; - } - if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1]; - if (type == "r" && !precision) type = "g"; - if (precision != null) { - if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision)); - } - type = d3_format_types.get(type) || d3_format_typeDefault; - var zcomma = zfill && comma; - return function(value) { - var fullSuffix = suffix; - if (integer && value % 1) return ""; - var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign; - if (scale < 0) { - var unit = d3.formatPrefix(value, precision); - value = unit.scale(value); - fullSuffix = unit.symbol + suffix; - } else { - value *= scale; - } - value = type(value, precision); - var i = value.lastIndexOf("."), before, after; - if (i < 0) { - var j = exponent ? value.lastIndexOf("e") : -1; - if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j); - } else { - before = value.substring(0, i); - after = locale_decimal + value.substring(i + 1); - } - if (!zfill && comma) before = formatGroup(before, Infinity); - var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; - if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity); - negative += prefix; - value = before + after; - return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix; - }; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3_interpolateRound); }; + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function(m) { + d3_scale_linearNice(domain, m); + return rescale(); + }; + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + return rescale(); } - var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; - var d3_format_types = d3.map({ - b: function(x) { - return x.toString(2); - }, - c: function(x) { - return String.fromCharCode(x); - }, - o: function(x) { - return x.toString(8); - }, - x: function(x) { - return x.toString(16); - }, - X: function(x) { - return x.toString(16).toUpperCase(); - }, - g: function(x, p) { - return x.toPrecision(p); - }, - e: function(x, p) { - return x.toExponential(p); - }, - f: function(x, p) { - return x.toFixed(p); - }, - r: function(x, p) { - return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); - } - }); - function d3_format_typeDefault(x) { - return x + ""; + function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); } - var d3_time = d3.time = {}, d3_date = Date; - function d3_date_utc() { - this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); + 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; } - d3_date_utc.prototype = { - getDate: function() { - return this._.getUTCDate(); - }, - getDay: function() { - return this._.getUTCDay(); - }, - getFullYear: function() { - return this._.getUTCFullYear(); - }, - getHours: function() { - return this._.getUTCHours(); - }, - getMilliseconds: function() { - return this._.getUTCMilliseconds(); - }, - getMinutes: function() { - return this._.getUTCMinutes(); - }, - getMonth: function() { - return this._.getUTCMonth(); - }, - getSeconds: function() { - return this._.getUTCSeconds(); - }, - getTime: function() { - return this._.getTime(); - }, - getTimezoneOffset: function() { - return 0; - }, - valueOf: function() { - return this._.valueOf(); - }, - setDate: function() { - d3_time_prototype.setUTCDate.apply(this._, arguments); - }, - setDay: function() { - d3_time_prototype.setUTCDay.apply(this._, arguments); - }, - setFullYear: function() { - d3_time_prototype.setUTCFullYear.apply(this._, arguments); - }, - setHours: function() { - d3_time_prototype.setUTCHours.apply(this._, arguments); - }, - setMilliseconds: function() { - d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); - }, - setMinutes: function() { - d3_time_prototype.setUTCMinutes.apply(this._, arguments); - }, - setMonth: function() { - d3_time_prototype.setUTCMonth.apply(this._, arguments); - }, - setSeconds: function() { - d3_time_prototype.setUTCSeconds.apply(this._, arguments); - }, - setTime: function() { - d3_time_prototype.setTime.apply(this._, arguments); + function d3_scale_linearTickRange(domain, m) { + if (m == null) m = 10; + var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; + extent[2] = step; + return extent; + } + function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); + } + function d3_scale_linearTickFormat(domain, m, format) { + var range = d3_scale_linearTickRange(domain, m); + if (format) { + var match = d3_format_re.exec(format); + match.shift(); + if (match[8] === "s") { + var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1]))); + if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2])); + match[8] = "f"; + format = d3.format(match.join("")); + return function(d) { + return format(prefix.scale(d)) + prefix.symbol; + }; + } + if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range); + format = match.join(""); + } else { + format = ",." + d3_scale_linearPrecision(range[2]) + "f"; } + return d3.format(format); + } + var d3_scale_linearFormatSignificant = { + s: 1, + g: 1, + p: 1, + r: 1, + e: 1 }; - var d3_time_prototype = Date.prototype; - function d3_time_interval(local, step, number) { - function round(date) { - var d0 = local(date), d1 = offset(d0, 1); - return date - d0 < d1 - date ? d0 : d1; + function d3_scale_linearPrecision(value) { + return -Math.floor(Math.log(value) / Math.LN10 + .01); + } + function d3_scale_linearFormatPrecision(type, range) { + var p = d3_scale_linearPrecision(range[2]); + return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; + } + d3.scale.log = function() { + return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); + }; + function d3_scale_log(linear, base, positive, domain) { + function log(x) { + return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); } - function ceil(date) { - step(date = local(new d3_date(date - 1)), 1); - return date; + function pow(x) { + return positive ? Math.pow(base, x) : -Math.pow(base, -x); } - function offset(date, k) { - step(date = new d3_date(+date), k); - return date; + function scale(x) { + return linear(log(x)); } - function range(t0, t1, dt) { - var time = ceil(t0), times = []; - if (dt > 1) { - while (time < t1) { - if (!(number(time) % dt)) times.push(new Date(+time)); - step(time, 1); + 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); } - } else { - while (time < t1) times.push(new Date(+time)), step(time, 1); + for (i = 0; ticks[i] < u; i++) {} + for (j = ticks.length; ticks[j - 1] > v; j--) {} + ticks = ticks.slice(i, j); } - return times; + return ticks; + }; + scale.tickFormat = function(n, format) { + if (!arguments.length) return d3_scale_logFormat; + if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); + var k = Math.max(1, base * n / scale.ticks().length); + return function(d) { + var i = d / pow(Math.round(log(d))); + if (i * base < base - .5) i *= base; + return i <= k ? format(d) : ""; + }; + }; + scale.copy = function() { + return d3_scale_log(linear.copy(), base, positive, domain); + }; + return d3_scale_linearRebind(scale, linear); + } + var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { + floor: function(x) { + return -Math.ceil(-x); + }, + ceil: function(x) { + return -Math.floor(-x); } - function range_utc(t0, t1, dt) { - try { - d3_date = d3_date_utc; - var utc = new d3_date_utc(); - utc._ = t0; - return range(utc, t1, dt); - } finally { - d3_date = Date; - } + }; + 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)); } - local.floor = local; - local.round = round; - local.ceil = ceil; - local.offset = offset; - local.range = range; - var utc = local.utc = d3_time_interval_utc(local); - utc.floor = utc; - utc.round = d3_time_interval_utc(round); - utc.ceil = d3_time_interval_utc(ceil); - utc.offset = d3_time_interval_utc(offset); - utc.range = range_utc; - return local; + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + linear.domain((domain = x.map(Number)).map(powp)); + return scale; + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function(m) { + return scale.domain(d3_scale_linearNice(domain, m)); + }; + scale.exponent = function(x) { + if (!arguments.length) return exponent; + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + linear.domain(domain.map(powp)); + return scale; + }; + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent, domain); + }; + return d3_scale_linearRebind(scale, linear); } - function d3_time_interval_utc(method) { - return function(date, k) { - try { - d3_date = d3_date_utc; - var utc = new d3_date_utc(); - utc._ = date; - return method(utc, k)._; - } finally { - d3_date = Date; - } + function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); }; } - d3_time.year = d3_time_interval(function(date) { - date = d3_time.day(date); - date.setMonth(0, 1); - return date; - }, function(date, offset) { - date.setFullYear(date.getFullYear() + offset); - }, function(date) { - return date.getFullYear(); - }); - d3_time.years = d3_time.year.range; - d3_time.years.utc = d3_time.year.utc.range; - d3_time.day = d3_time_interval(function(date) { - var day = new d3_date(2e3, 0); - day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); - return day; - }, function(date, offset) { - date.setDate(date.getDate() + offset); - }, function(date) { - return date.getDate() - 1; - }); - d3_time.days = d3_time.day.range; - d3_time.days.utc = d3_time.day.utc.range; - d3_time.dayOfYear = function(date) { - var year = d3_time.year(date); - return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); }; - [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { - i = 7 - i; - var interval = d3_time[day] = d3_time_interval(function(date) { - (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); - return date; - }, function(date, offset) { - date.setDate(date.getDate() + Math.floor(offset) * 7); - }, function(date) { - var day = d3_time.year(date).getDay(); - return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + d3.scale.ordinal = function() { + return d3_scale_ordinal([], { + t: "range", + a: [ [] ] }); - d3_time[day + "s"] = interval.range; - d3_time[day + "s"].utc = interval.utc.range; - d3_time[day + "OfYear"] = function(date) { - var day = d3_time.year(date).getDay(); - return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); + }; + function d3_scale_ordinal(domain, ranger) { + var index, range, rangeBand; + function scale(x) { + return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length]; + } + function steps(start, step) { + return d3.range(domain.length).map(function(i) { + return start + step * i; + }); + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map(); + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t].apply(scale, ranger.a); }; - }); - d3_time.week = d3_time.sunday; - d3_time.weeks = d3_time.sunday.range; - d3_time.weeks.utc = d3_time.sunday.utc.range; - d3_time.weekOfYear = d3_time.sundayOfYear; - function d3_locale_timeFormat(locale) { - var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; - function d3_time_format(template) { - var n = template.length; - function format(date) { - var string = [], i = -1, j = 0, c, p, f; - while (++i < n) { - if (template.charCodeAt(i) === 37) { - string.push(template.slice(j, i)); - if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); - if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); - string.push(c); - j = i + 1; - } - } - string.push(template.slice(j, i)); - return string.join(""); - } - format.parse = function(string) { - var d = { - y: 1900, - m: 0, - d: 1, - H: 0, - M: 0, - S: 0, - L: 0, - Z: null - }, i = d3_time_parse(d, template, string, 0); - if (i != string.length) return null; - if ("p" in d) d.H = d.H % 12 + d.p * 12; - var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); - if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "W" in d ? 1 : 0; - date.setFullYear(d.y, 0, 1); - date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7); - } else date.setFullYear(d.y, d.m, d.d); - date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L); - return localZ ? date._ : date; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = { + t: "range", + a: arguments }; - format.toString = function() { - return template; + 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 format; - } - function d3_time_parse(date, template, string, j) { - var c, p, t, i = 0, n = template.length, m = string.length; - while (i < n) { - if (j >= m) return -1; - c = template.charCodeAt(i++); - if (c === 37) { - t = template.charAt(i++); - p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; - if (!p || (j = p(date, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - return j; - } - d3_time_format.utc = function(template) { - var local = d3_time_format(template); - function format(date) { - try { - d3_date = d3_date_utc; - var utc = new d3_date(); - utc._ = date; - return local(utc); - } finally { - d3_date = Date; - } - } - format.parse = function(string) { - try { - d3_date = d3_date_utc; - var date = local.parse(string); - return date && date._; - } finally { - d3_date = Date; - } + 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 }; - format.toString = local.toString; - return format; + return scale; }; - d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; - var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths); - locale_periods.forEach(function(p, i) { - d3_time_periodLookup.set(p.toLowerCase(), i); - }); - var d3_time_formats = { - a: function(d) { - return locale_shortDays[d.getDay()]; - }, - A: function(d) { - return locale_days[d.getDay()]; - }, - b: function(d) { - return locale_shortMonths[d.getMonth()]; - }, - B: function(d) { - return locale_months[d.getMonth()]; - }, - c: d3_time_format(locale_dateTime), - d: function(d, p) { - return d3_time_formatPad(d.getDate(), p, 2); - }, - e: function(d, p) { - return d3_time_formatPad(d.getDate(), p, 2); - }, - H: function(d, p) { - return d3_time_formatPad(d.getHours(), p, 2); - }, - I: function(d, p) { - return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); - }, - j: function(d, p) { - return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); - }, - L: function(d, p) { - return d3_time_formatPad(d.getMilliseconds(), p, 3); - }, - m: function(d, p) { - return d3_time_formatPad(d.getMonth() + 1, p, 2); - }, - M: function(d, p) { - return d3_time_formatPad(d.getMinutes(), p, 2); - }, - p: function(d) { - return locale_periods[+(d.getHours() >= 12)]; - }, - S: function(d, p) { - return d3_time_formatPad(d.getSeconds(), p, 2); - }, - U: function(d, p) { - return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); - }, - w: function(d) { - return d.getDay(); - }, - W: function(d, p) { - return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); - }, - x: d3_time_format(locale_date), - X: d3_time_format(locale_time), - y: function(d, p) { - return d3_time_formatPad(d.getFullYear() % 100, p, 2); - }, - Y: function(d, p) { - return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); - }, - Z: d3_time_zone, - "%": function() { - return "%"; - } + 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; }; - var d3_time_parsers = { - a: d3_time_parseWeekdayAbbrev, - A: d3_time_parseWeekday, - b: d3_time_parseMonthAbbrev, - B: d3_time_parseMonth, - c: d3_time_parseLocaleFull, - d: d3_time_parseDay, - e: d3_time_parseDay, - H: d3_time_parseHour24, - I: d3_time_parseHour24, - j: d3_time_parseDayOfYear, - L: d3_time_parseMilliseconds, - m: d3_time_parseMonthNumber, - M: d3_time_parseMinutes, - p: d3_time_parseAmPm, - S: d3_time_parseSeconds, - U: d3_time_parseWeekNumberSunday, - w: d3_time_parseWeekdayNumber, - W: d3_time_parseWeekNumberMonday, - x: d3_time_parseLocaleDate, - X: d3_time_parseLocaleTime, - y: d3_time_parseYear, - Y: d3_time_parseFullYear, - Z: d3_time_parseZone, - "%": d3_time_parseLiteralPercent + 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; }; - function d3_time_parseWeekdayAbbrev(date, string, i) { - d3_time_dayAbbrevRe.lastIndex = 0; - var n = d3_time_dayAbbrevRe.exec(string.slice(i)); - return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseWeekday(date, string, i) { - d3_time_dayRe.lastIndex = 0; - var n = d3_time_dayRe.exec(string.slice(i)); - return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseMonthAbbrev(date, string, i) { - d3_time_monthAbbrevRe.lastIndex = 0; - var n = d3_time_monthAbbrevRe.exec(string.slice(i)); - return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseMonth(date, string, i) { - d3_time_monthRe.lastIndex = 0; - var n = d3_time_monthRe.exec(string.slice(i)); - return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseLocaleFull(date, string, i) { - return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + 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 d3_time_parseLocaleDate(date, string, i) { - return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + function scale(x) { + if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)]; } - function d3_time_parseLocaleTime(date, string, i) { - return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + 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(x0, x1, range) { + var kx, i; + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; } - function d3_time_parseAmPm(date, string, i) { - var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase()); - return n == null ? -1 : (date.p = n, i); + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; } - return d3_time_format; - } - var d3_time_formatPads = { - "-": "", - _: " ", - "0": "0" - }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; - function d3_time_formatPad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); - } - function d3_time_formatRe(names) { - return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); - } - function d3_time_formatLookup(names) { - var map = new d3_Map(), i = -1, n = names.length; - while (++i < n) map.set(names[i].toLowerCase(), i); - return map; - } - function d3_time_parseWeekdayNumber(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 1)); - return n ? (date.w = +n[0], i + n[0].length) : -1; - } - function d3_time_parseWeekNumberSunday(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i)); - return n ? (date.U = +n[0], i + n[0].length) : -1; - } - function d3_time_parseWeekNumberMonday(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i)); - return n ? (date.W = +n[0], i + n[0].length) : -1; - } - function d3_time_parseFullYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 4)); - return n ? (date.y = +n[0], i + n[0].length) : -1; - } - function d3_time_parseYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 2)); - return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; - } - function d3_time_parseZone(date, string, i) { - return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string, - i + 5) : -1; - } - function d3_time_expandYear(d) { - return d + (d > 68 ? 1900 : 2e3); - } - function d3_time_parseMonthNumber(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 2)); - return n ? (date.m = n[0] - 1, i + n[0].length) : -1; - } - function d3_time_parseDay(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 2)); - return n ? (date.d = +n[0], i + n[0].length) : -1; - } - function d3_time_parseDayOfYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 3)); - return n ? (date.j = +n[0], i + n[0].length) : -1; - } - function d3_time_parseHour24(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 2)); - return n ? (date.H = +n[0], i + n[0].length) : -1; - } - function d3_time_parseMinutes(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 2)); - return n ? (date.M = +n[0], i + n[0].length) : -1; - } - function d3_time_parseSeconds(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 2)); - return n ? (date.S = +n[0], i + n[0].length) : -1; - } - function d3_time_parseMilliseconds(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.slice(i, i + 3)); - return n ? (date.L = +n[0], i + n[0].length) : -1; - } - function d3_time_zone(d) { - var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60; - return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); - } - function d3_time_parseLiteralPercent(date, string, i) { - d3_time_percentRe.lastIndex = 0; - var n = d3_time_percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; - } - function d3_time_formatMulti(formats) { - var n = formats.length, i = -1; - while (++i < n) formats[i][0] = this(formats[i][0]); - return function(date) { - var i = 0, f = formats[i]; - while (!f[1](date)) f = formats[++i]; - return f[0](date); + scale.domain = function(x) { + if (!arguments.length) return [ x0, x1 ]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); }; - } - d3.locale = function(locale) { - return { - numberFormat: d3_locale_numberFormat(locale), - timeFormat: d3_locale_timeFormat(locale) + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + y = y < 0 ? NaN : y / kx + x0; + return [ y, y + 1 / kx ]; + }; + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); }; + return rescale(); + } + d3.scale.threshold = function() { + return d3_scale_threshold([ .5 ], [ 0, 1 ]); }; - var d3_locale_enUS = d3.locale({ - decimal: ".", - thousands: ",", - grouping: [ 3 ], - currency: [ "$", "" ], - dateTime: "%a %b %e %X %Y", - date: "%m/%d/%Y", - time: "%H:%M:%S", - periods: [ "AM", "PM" ], - days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], - shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], - months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], - shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] - }); - d3.format = d3_locale_enUS.numberFormat; - d3.geo = {}; - function d3_adder() {} - d3_adder.prototype = { - s: 0, - t: 0, - add: function(y) { - d3_adderSum(y, this.t, d3_adderTemp); - d3_adderSum(d3_adderTemp.s, this.s, this); - if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; - }, - reset: function() { - this.s = this.t = 0; - }, - valueOf: function() { - return this.s; + function d3_scale_threshold(domain, range) { + function scale(x) { + if (x <= x) return range[d3.bisect(domain, x)]; } - }; - var d3_adderTemp = new d3_adder(); - function d3_adderSum(a, b, o) { - var x = o.s = a + b, bv = x - a, av = x - bv; - o.t = a - av + (b - bv); + 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.geo.stream = function(object, listener) { - if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { - d3_geo_streamObjectType[object.type](object, listener); - } else { - d3_geo_streamGeometry(object, listener); - } + d3.scale.identity = function() { + return d3_scale_identity([ 0, 1 ]); }; - function d3_geo_streamGeometry(geometry, listener) { - if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { - d3_geo_streamGeometryType[geometry.type](geometry, listener); + function d3_scale_identity(domain) { + function identity(x) { + return +x; } - } - var d3_geo_streamObjectType = { - Feature: function(feature, listener) { - d3_geo_streamGeometry(feature.geometry, listener); - }, - FeatureCollection: function(object, listener) { - var features = object.features, i = -1, n = features.length; - while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); - } - }; - var d3_geo_streamGeometryType = { - Sphere: function(object, listener) { - listener.sphere(); - }, - Point: function(object, listener) { - object = object.coordinates; - listener.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, listener) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); - }, - LineString: function(object, listener) { - d3_geo_streamLine(object.coordinates, listener, 0); - }, - MultiLineString: function(object, listener) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); - }, - Polygon: function(object, listener) { - d3_geo_streamPolygon(object.coordinates, listener); - }, - MultiPolygon: function(object, listener) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); - }, - GeometryCollection: function(object, listener) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) d3_geo_streamGeometry(geometries[i], listener); - } - }; - function d3_geo_streamLine(coordinates, listener, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - listener.lineStart(); - while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); - listener.lineEnd(); - } - function d3_geo_streamPolygon(coordinates, listener) { - var i = -1, n = coordinates.length; - listener.polygonStart(); - while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); - listener.polygonEnd(); - } - d3.geo.area = function(object) { - d3_geo_areaSum = 0; - d3.geo.stream(object, d3_geo_area); - return d3_geo_areaSum; - }; - var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); - var d3_geo_area = { - sphere: function() { - d3_geo_areaSum += 4 * π; - }, - point: d3_noop, - lineStart: d3_noop, - lineEnd: d3_noop, - polygonStart: function() { - d3_geo_areaRingSum.reset(); - d3_geo_area.lineStart = d3_geo_areaRingStart; - }, - polygonEnd: function() { - var area = 2 * d3_geo_areaRingSum; - d3_geo_areaSum += area < 0 ? 4 * π + area : area; - d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; - } - }; - function d3_geo_areaRingStart() { - var λ00, φ00, λ0, cosφ0, sinφ0; - d3_geo_area.point = function(λ, φ) { - d3_geo_area.point = nextPoint; - λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), - sinφ0 = Math.sin(φ); + identity.invert = identity; + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; }; - function nextPoint(λ, φ) { - λ *= d3_radians; - φ = φ * d3_radians / 2 + π / 4; - var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ); - d3_geo_areaRingSum.add(Math.atan2(v, u)); - λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; - } - d3_geo_area.lineEnd = function() { - nextPoint(λ00, φ00); + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); }; + identity.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + identity.copy = function() { + return d3_scale_identity(domain); + }; + return identity; } - function d3_geo_cartesian(spherical) { - var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); - return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; - } - function d3_geo_cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; - } - function d3_geo_cartesianCross(a, b) { - return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; - } - function d3_geo_cartesianAdd(a, b) { - a[0] += b[0]; - a[1] += b[1]; - a[2] += b[2]; - } - function d3_geo_cartesianScale(vector, k) { - return [ vector[0] * k, vector[1] * k, vector[2] * k ]; - } - function d3_geo_cartesianNormalize(d) { - var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l; - d[1] /= l; - d[2] /= l; - } - function d3_geo_spherical(cartesian) { - return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; - } - function d3_geo_sphericalEqual(a, b) { - return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε; + d3.svg = {}; + function d3_zero() { + return 0; } - d3.geo.bounds = function() { - var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range; - var bound = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - bound.point = ringPoint; - bound.lineStart = ringStart; - bound.lineEnd = ringEnd; - dλSum = 0; - d3_geo_area.polygonStart(); - }, - polygonEnd: function() { - d3_geo_area.polygonEnd(); - bound.point = point; - bound.lineStart = lineStart; - bound.lineEnd = lineEnd; - if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90; - range[0] = λ0, range[1] = λ1; + 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 r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfπ, a1 = endAngle.apply(this, arguments) - halfπ, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1; + if (r1 < r0) rc = r1, r1 = r0, r0 = rc; + if (da >= τε) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : "") + "Z"; + var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = []; + if (ap = (+padAngle.apply(this, arguments) || 0) / 2) { + rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments); + if (!cw) p1 *= -1; + if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap)); + if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap)); } - }; - function point(λ, φ) { - ranges.push(range = [ λ0 = λ, λ1 = λ ]); - if (φ < φ0) φ0 = φ; - if (φ > φ1) φ1 = φ; - } - function linePoint(λ, φ) { - var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]); - if (p0) { - var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); - d3_geo_cartesianNormalize(inflection); - inflection = d3_geo_spherical(inflection); - var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180; - if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) { - var φi = inflection[1] * d3_degrees; - if (φi > φ1) φ1 = φi; - } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) { - var φi = -inflection[1] * d3_degrees; - if (φi < φ0) φ0 = φi; - } else { - if (φ < φ0) φ0 = φ; - if (φ > φ1) φ1 = φ; + if (r1) { + x0 = r1 * Math.cos(a0 + p1); + y0 = r1 * Math.sin(a0 + p1); + x1 = r1 * Math.cos(a1 - p1); + y1 = r1 * Math.sin(a1 - p1); + var l1 = Math.abs(a1 - a0 - 2 * p1) <= π ? 0 : 1; + if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) { + var h1 = (a0 + a1) / 2; + x0 = r1 * Math.cos(h1); + y0 = r1 * Math.sin(h1); + x1 = y1 = null; } - if (antimeridian) { - if (λ < λ_) { - if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; + } else { + x0 = y0 = 0; + } + if (r0) { + x2 = r0 * Math.cos(a1 - p0); + y2 = r0 * Math.sin(a1 - p0); + x3 = r0 * Math.cos(a0 + p0); + y3 = r0 * Math.sin(a0 + p0); + var l0 = Math.abs(a0 - a1 + 2 * p0) <= π ? 0 : 1; + if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) { + var h0 = (a0 + a1) / 2; + x2 = r0 * Math.cos(h0); + y2 = r0 * Math.sin(h0); + x3 = y3 = null; + } + } else { + x2 = y2 = 0; + } + if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) { + cr = r0 < r1 ^ cw ? 0 : 1; + var rc1 = rc, rc0 = rc; + if (da < π) { + var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); + rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); + } + if (x1 != null) { + var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw); + if (rc === rc1) { + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]); } else { - if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr, " ", t12[0]); } } else { - if (λ1 >= λ0) { - if (λ < λ0) λ0 = λ; - if (λ > λ1) λ1 = λ; + path.push("M", x0, ",", y0); + } + if (x3 != null) { + var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw); + if (rc === rc0) { + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 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,", cr, " ", t03[0]); } else { - if (λ > λ_) { - if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; - } else { - if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; - } + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); } + } else { + path.push("L", x2, ",", y2); } } else { - point(λ, φ); + path.push("M", x0, ",", y0); + if (x1 != null) path.push("A", r1, ",", r1, " 0 ", l1, ",", cw, " ", x1, ",", y1); + path.push("L", x2, ",", y2); + if (x3 != null) path.push("A", r0, ",", r0, " 0 ", l0, ",", 1 - cw, " ", x3, ",", y3); } - p0 = p, λ_ = λ; - } - function lineStart() { - bound.point = linePoint; - } - function lineEnd() { - range[0] = λ0, range[1] = λ1; - bound.point = point; - p0 = null; - } - function ringPoint(λ, φ) { - if (p0) { - var dλ = λ - λ_; - dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ; - } else λ__ = λ, φ__ = φ; - d3_geo_area.point(λ, φ); - linePoint(λ, φ); - } - function ringStart() { - d3_geo_area.lineStart(); - } - function ringEnd() { - ringPoint(λ__, φ__); - d3_geo_area.lineEnd(); - if (abs(dλSum) > ε) λ0 = -(λ1 = 180); - range[0] = λ0, range[1] = λ1; - p0 = null; - } - function angle(λ0, λ1) { - return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; - } - function compareRanges(a, b) { - return a[0] - b[0]; + path.push("Z"); + return path.join(""); } - function withinRange(x, range) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; + function circleSegment(r1, cw) { + return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1; } - return function(feature) { - φ1 = λ1 = -(λ0 = φ0 = Infinity); - ranges = []; - d3.geo.stream(feature, bound); - var n = ranges.length; - if (n) { - ranges.sort(compareRanges); - for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { - b = ranges[i]; - if (withinRange(b[0], a) || withinRange(b[1], a)) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else { - merged.push(a = b); - } - } - var best = -Infinity, dλ; - for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { - b = merged[i]; - if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1]; - } - } - ranges = range = null; - return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ]; + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; }; - }(); - d3.geo.centroid = function(object) { - d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; - d3.geo.stream(object, d3_geo_centroid); - var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; - if (m < ε2) { - x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; - if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; - m = x * x + y * y + z * z; - if (m < ε2) return [ NaN, NaN ]; - } - return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; - }; - var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2; - var d3_geo_centroid = { - sphere: d3_noop, - point: d3_geo_centroidPoint, - lineStart: d3_geo_centroidLineStart, - lineEnd: d3_geo_centroidLineEnd, - polygonStart: function() { - d3_geo_centroid.lineStart = d3_geo_centroidRingStart; - }, - polygonEnd: function() { - d3_geo_centroid.lineStart = d3_geo_centroidLineStart; - } + 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; }; - function d3_geo_centroidPoint(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians); - d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)); + var d3_svg_arcAuto = "auto"; + function d3_svg_arcInnerRadius(d) { + return d.innerRadius; } - function d3_geo_centroidPointXYZ(x, y, z) { - ++d3_geo_centroidW0; - d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; - d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; - d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; + function d3_svg_arcOuterRadius(d) { + return d.outerRadius; } - function d3_geo_centroidLineStart() { - var x0, y0, z0; - d3_geo_centroid.point = function(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians); - x0 = cosφ * Math.cos(λ); - y0 = cosφ * Math.sin(λ); - z0 = Math.sin(φ); - d3_geo_centroid.point = nextPoint; - d3_geo_centroidPointXYZ(x0, y0, z0); - }; - function nextPoint(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - d3_geo_centroidW1 += w; - d3_geo_centroidX1 += w * (x0 + (x0 = x)); - d3_geo_centroidY1 += w * (y0 + (y0 = y)); - d3_geo_centroidZ1 += w * (z0 + (z0 = z)); - d3_geo_centroidPointXYZ(x0, y0, z0); - } + function d3_svg_arcStartAngle(d) { + return d.startAngle; } - function d3_geo_centroidLineEnd() { - d3_geo_centroid.point = d3_geo_centroidPoint; + function d3_svg_arcEndAngle(d) { + return d.endAngle; } - function d3_geo_centroidRingStart() { - var λ00, φ00, x0, y0, z0; - d3_geo_centroid.point = function(λ, φ) { - λ00 = λ, φ00 = φ; - d3_geo_centroid.point = nextPoint; - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians); - x0 = cosφ * Math.cos(λ); - y0 = cosφ * Math.sin(λ); - z0 = Math.sin(φ); - d3_geo_centroidPointXYZ(x0, y0, z0); - }; - d3_geo_centroid.lineEnd = function() { - nextPoint(λ00, φ00); - d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; - d3_geo_centroid.point = d3_geo_centroidPoint; - }; - function nextPoint(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u); - d3_geo_centroidX2 += v * cx; - d3_geo_centroidY2 += v * cy; - d3_geo_centroidZ2 += v * cz; - d3_geo_centroidW1 += w; - d3_geo_centroidX1 += w * (x0 + (x0 = x)); - d3_geo_centroidY1 += w * (y0 + (y0 = y)); - d3_geo_centroidZ1 += w * (z0 + (z0 = z)); - d3_geo_centroidPointXYZ(x0, y0, z0); - } + function d3_svg_arcPadAngle(d) { + return d && d.padAngle; } - function d3_geo_compose(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; + function d3_svg_arcSweep(x0, y0, x1, y1) { + return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1; } - function d3_true() { - return true; + function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) { + var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * 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 * r1 / r, cy0 * r1 / r ] ]; } - function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) { - var subject = [], clip = []; - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n]; - if (d3_geo_sphericalEqual(p0, p1)) { - listener.lineStart(); - for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); - listener.lineEnd(); - return; + function d3_svg_line(projection) { + var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; + function line(data) { + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); + function segment() { + segments.push("M", interpolate(projection(points), tension)); } - var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false); - a.o = b; - subject.push(a); - clip.push(b); - a = new d3_geo_clipPolygonIntersection(p1, segment, null, false); - b = new d3_geo_clipPolygonIntersection(p1, null, a, true); - a.o = b; - subject.push(a); - clip.push(b); - }); - clip.sort(compare); - d3_geo_clipPolygonLinkCircular(subject); - d3_geo_clipPolygonLinkCircular(clip); - if (!subject.length) return; - for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) { - clip[i].e = entry = !entry; + 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; } - var start = subject[0], points, point; - while (1) { - var current = start, isSubject = true; - while (current.v) if ((current = current.n) === start) return; - points = current.z; - listener.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.n.x, 1, listener); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.p.x, -1, listener); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - listener.lineEnd(); + 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 = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + } } + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; + } + return path; } - function d3_geo_clipPolygonLinkCircular(array) { - if (!(n = array.length)) return; - var n, i = 0, a = array[0], b; + function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); } - a.n = b = array[0]; - b.p = a; + return tangents; } - function d3_geo_clipPolygonIntersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; - this.e = entry; - this.v = false; - this.n = this.p = null; + function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + points.push(points[n - 1]); + while (++i <= n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + points.pop(); + path.push("L", pi); + return path.join(""); } - function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) { - return function(rotate, listener) { - var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]); - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = d3.merge(segments); - var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon); - if (segments.length) { - if (!polygonStarted) listener.polygonStart(), polygonStarted = true; - d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener); - } else if (clipStartInside) { - if (!polygonStarted) listener.polygonStart(), polygonStarted = true; - listener.lineStart(); - interpolate(null, null, 1, listener); - listener.lineEnd(); - } - if (polygonStarted) listener.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - listener.polygonStart(); - listener.lineStart(); - interpolate(null, null, 1, listener); - listener.lineEnd(); - listener.polygonEnd(); - } - }; - function point(λ, φ) { - var point = rotate(λ, φ); - if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ); - } - function pointLine(λ, φ) { - var point = rotate(λ, φ); - line.point(point[0], point[1]); - } - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - var segments; - var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygonStarted = false, polygon, ring; - function pointRing(λ, φ) { - ring.push([ λ, φ ]); - var point = rotate(λ, φ); - ringListener.point(point[0], point[1]); - } - function ringStart() { - ringListener.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringListener.lineEnd(); - var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; - if (clean & 1) { - segment = ringSegments[0]; - var n = segment.length - 1, i = -1, point; - if (n > 0) { - if (!polygonStarted) listener.polygonStart(), polygonStarted = true; - listener.lineStart(); - while (++i < n) listener.point((point = segment[i])[0], point[1]); - listener.lineEnd(); - } - return; - } - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); - } - return clip; - }; + function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); } - function d3_geo_clipSegmentLength1(segment) { - return segment.length > 1; + function d3_svg_lineBasisClosed(points) { + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + --i; + while (++i < m) { + pi = points[i % n]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); } - function d3_geo_clipBufferListener() { - var lines = [], line; - return { - lineStart: function() { - lines.push(line = []); - }, - point: function(λ, φ) { - line.push([ λ, φ ]); - }, - lineEnd: d3_noop, - buffer: function() { - var buffer = lines; - lines = []; - line = null; - return buffer; - }, - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); } - }; + } + return d3_svg_lineBasis(points); } - function d3_geo_clipSort(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]); + function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; } - var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]); - function d3_geo_clipAntimeridianLine(listener) { - var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; - return { - lineStart: function() { - listener.lineStart(); - clean = 1; - }, - point: function(λ1, φ1) { - var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0); - if (abs(dλ - π) < ε) { - listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ); - listener.point(sλ0, φ0); - listener.lineEnd(); - listener.lineStart(); - listener.point(sλ1, φ0); - listener.point(λ1, φ0); - clean = 0; - } else if (sλ0 !== sλ1 && dλ >= π) { - if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; - if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; - φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); - listener.point(sλ0, φ0); - listener.lineEnd(); - listener.lineStart(); - listener.point(sλ1, φ0); - clean = 0; - } - listener.point(λ0 = λ1, φ0 = φ1); - sλ0 = sλ1; - }, - lineEnd: function() { - listener.lineEnd(); - λ0 = φ0 = NaN; - }, - clean: function() { - return 2 - clean; - } - }; + 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_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { - var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); - return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2; + function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); } - function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { - var φ; - if (from == null) { - φ = direction * halfπ; - listener.point(-π, φ); - listener.point(0, φ); - listener.point(π, φ); - listener.point(π, 0); - listener.point(π, -φ); - listener.point(0, -φ); - listener.point(-π, -φ); - listener.point(-π, 0); - listener.point(-π, φ); - } else if (abs(from[0] - to[0]) > ε) { - var s = from[0] < to[0] ? π : -π; - φ = direction * s / 2; - listener.point(-s, φ); - listener.point(0, φ); - listener.point(s, φ); - } else { - listener.point(to[0], to[1]); + function d3_svg_lineFiniteDifferences(points) { + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; } + m[i] = d; + return m; } - function d3_geo_pointInPolygon(point, polygon) { - var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; - d3_geo_areaRingSum.reset(); - for (var i = 0, n = polygon.length; i < n; ++i) { - var ring = polygon[i], m = ring.length; - if (!m) continue; - var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1; - while (true) { - if (j === m) j = 0; - point = ring[j]; - var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ; - d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ))); - polarAngle += antimeridian ? dλ + sdλ * τ : dλ; - if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) { - var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); - d3_geo_cartesianNormalize(arc); - var intersection = d3_geo_cartesianCross(meridianNormal, arc); - d3_geo_cartesianNormalize(intersection); - var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]); - if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) { - winding += antimeridian ^ dλ >= 0 ? 1 : -1; - } + 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; } - if (!j++) break; - λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point; } } - return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < -ε) ^ winding & 1; + 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_geo_clipCircle(radius) { - var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); - return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]); - function visible(λ, φ) { - return Math.cos(λ) * Math.cos(φ) > cr; - } - function clipLine(listener) { - var point0, c0, v0, v00, clean; - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(λ, φ) { - var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0; - if (!point0 && (v00 = v0 = v)) listener.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { - point1[0] += ε; - point1[1] += ε; - v = visible(point1[0], point1[1]); - } - } - if (v !== v0) { - clean = 0; - if (v) { - listener.lineStart(); - point2 = intersect(point1, point0); - listener.point(point2[0], point2[1]); - } else { - point2 = intersect(point0, point1); - listener.point(point2[0], point2[1]); - listener.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - listener.lineStart(); - listener.point(t[0][0], t[0][1]); - listener.point(t[1][0], t[1][1]); - listener.lineEnd(); - } else { - listener.point(t[1][0], t[1][1]); - listener.lineEnd(); - listener.lineStart(); - listener.point(t[0][0], t[0][1]); - } - } - } - if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { - listener.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) listener.lineEnd(); - point0 = null; - }, - clean: function() { - return clean | (v00 && v0) << 1; - } - }; - } - function intersect(a, b, two) { - var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); - var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); - d3_geo_cartesianAdd(A, B); - var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1); - if (t2 < 0) return; - var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); - d3_geo_cartesianAdd(q, A); - q = d3_geo_spherical(q); - if (!two) return q; - var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; - if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; - var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε; - if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; - if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) { - var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); - d3_geo_cartesianAdd(q1, A); - return [ q, d3_geo_spherical(q1) ]; - } - } - function code(λ, φ) { - var r = smallRadius ? radius : π - radius, code = 0; - if (λ < -r) code |= 1; else if (λ > r) code |= 2; - if (φ < -r) code |= 4; else if (φ > r) code |= 8; - return code; + function d3_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_geom_clipLine(x0, y0, x1, y1) { - return function(line) { - var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; + function d3_svg_area(projection) { + var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; + function area(data) { + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { + return x; + } : d3_functor(x1), fy1 = y0 === y1 ? function() { + return y; + } : d3_functor(y1), x, y; + function segment() { + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); } - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; + 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 (t0 > 0) line.a = { - x: ax + t0 * dx, - y: ay + t0 * dy - }; - if (t1 < 1) line.b = { - x: ax + t1 * dx, - y: ay + t1 * dy - }; - return line; + if (points0.length) segment(); + return segments.length ? segments.join("") : null; + } + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; }; - } - var d3_geo_clipExtentMAX = 1e9; - d3.geo.clipExtent = function() { - var x0, y0, x1, y1, stream, clip, clipExtent = { - stream: function(output) { - if (stream) stream.valid = false; - stream = clip(output); - stream.valid = true; - return stream; - }, - extent: function(_) { - if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; - clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); - if (stream) stream.valid = false, stream = null; - return clipExtent; - } + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; }; - return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); - }; - function d3_geo_clipExtent(x0, y0, x1, y1) { - return function(listener) { - var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - listener = bufferListener; - segments = []; - polygon = []; - clean = true; - }, - polygonEnd: function() { - listener = listener_; - segments = d3.merge(segments); - var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; - if (inside || visible) { - listener.polygonStart(); - if (inside) { - listener.lineStart(); - interpolate(null, null, 1, listener); - listener.lineEnd(); - } - if (visible) { - d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); - } - listener.polygonEnd(); - } - segments = polygon = ring = null; - } - }; - function insidePolygon(p) { - var wn = 0, n = polygon.length, y = p[1]; - for (var i = 0; i < n; ++i) { - for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { - b = v[j]; - if (a[1] <= y) { - if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; - } else { - if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; - } - a = b; - } - } - return wn !== 0; - } - function interpolate(from, to, direction, listener) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { - do { - listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - } while ((a = (a + direction + 4) % 4) !== a1); - } else { - listener.point(to[0], to[1]); - } - } - function pointVisible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - function point(x, y) { - if (pointVisible(x, y)) listener.point(x, y); - } - var x__, y__, v__, x_, y_, v_, first, clean; - function lineStart() { - clip.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferListener.rejoin(); - segments.push(bufferListener.buffer()); - } - clip.point = point; - if (v_) listener.lineEnd(); - } - function linePoint(x, y) { - x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); - y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); - var v = pointVisible(x, y); - if (polygon) ring.push([ x, y ]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - listener.lineStart(); - listener.point(x, y); - } - } else { - if (v && v_) listener.point(x, y); else { - var l = { - a: { - x: x_, - y: y_ - }, - b: { - x: x, - y: y - } - }; - if (clipLine(l)) { - if (!v_) { - listener.lineStart(); - listener.point(l.a.x, l.a.y); - } - listener.point(l.b.x, l.b.y); - if (!v) listener.lineEnd(); - clean = false; - } else if (v) { - listener.lineStart(); - listener.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - return clip; + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; }; - function corner(p, direction) { - return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; - } - function compare(a, b) { - return comparePoints(a.x, b.x); - } - function comparePoints(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - } - function d3_geo_conic(projectAt) { - var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); - p.parallels = function(_) { - if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ]; - return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180); + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; }; - return p; - } - function d3_geo_conicEqualArea(φ0, φ1) { - var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n; - function forward(λ, φ) { - var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; - return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; - } - forward.invert = function(x, y) { - var ρ0_y = ρ0 - y; - return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; }; - return forward; + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + area.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + interpolateReverse = interpolate.reverse || interpolate; + L = interpolate.closed ? "M" : "L"; + return area; + }; + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + return area; } - (d3.geo.conicEqualArea = function() { - return d3_geo_conic(d3_geo_conicEqualArea); - }).raw = d3_geo_conicEqualArea; - d3.geo.albers = function() { - return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070); + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + d3.svg.area = function() { + return d3_svg_area(d3_identity); }; - d3.geo.albersUsa = function() { - var lower48 = d3.geo.albers(); - var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]); - var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]); - var point, pointStream = { - point: function(x, y) { - point = [ x, y ]; - } - }, lower48Point, alaskaPoint, hawaiiPoint; - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - point = null; - (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y); - return point; + d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; + }; + d3.svg.chord = function() { + var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + function chord(d, i) { + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); + return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; } - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; - return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); - }; - albersUsa.stream = function(stream) { - var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ; return { - point: function(x, y) { - lower48Stream.point(x, y); - alaskaStream.point(x, y); - hawaiiStream.point(x, y); - }, - sphere: function() { - lower48Stream.sphere(); - alaskaStream.sphere(); - hawaiiStream.sphere(); - }, - lineStart: function() { - lower48Stream.lineStart(); - alaskaStream.lineStart(); - hawaiiStream.lineStart(); - }, - lineEnd: function() { - lower48Stream.lineEnd(); - alaskaStream.lineEnd(); - hawaiiStream.lineEnd(); - }, - polygonStart: function() { - lower48Stream.polygonStart(); - alaskaStream.polygonStart(); - hawaiiStream.polygonStart(); - }, - polygonEnd: function() { - lower48Stream.polygonEnd(); - alaskaStream.polygonEnd(); - hawaiiStream.polygonEnd(); - } + r: r, + a0: a0, + a1: a1, + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] }; + } + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; + } + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; }; - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_); - alaska.precision(_); - hawaii.precision(_); - return albersUsa; - }; - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_); - alaska.scale(_ * .35); - hawaii.scale(_); - return albersUsa.translate(lower48.translate()); + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; }; - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; - alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; - hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; - return albersUsa; + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; }; - return albersUsa.scale(1070); - }; - var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { - point: d3_noop, - lineStart: d3_noop, - lineEnd: d3_noop, - polygonStart: function() { - d3_geo_pathAreaPolygon = 0; - d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; - }, - polygonEnd: function() { - d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; - d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); - } - }; - function d3_geo_pathAreaRingStart() { - var x00, y00, x0, y0; - d3_geo_pathArea.point = function(x, y) { - d3_geo_pathArea.point = nextPoint; - x00 = x0 = x, y00 = y0 = y; + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; }; - function nextPoint(x, y) { - d3_geo_pathAreaPolygon += y0 * x - x0 * y; - x0 = x, y0 = y; - } - d3_geo_pathArea.lineEnd = function() { - nextPoint(x00, y00); + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; }; - } - var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1; - var d3_geo_pathBounds = { - point: d3_geo_pathBoundsPoint, - lineStart: d3_noop, - lineEnd: d3_noop, - polygonStart: d3_noop, - polygonEnd: d3_noop + return chord; }; - function d3_geo_pathBoundsPoint(x, y) { - if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x; - if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; - if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; - if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; + function d3_svg_chordRadius(d) { + return d.radius; } - function d3_geo_pathBuffer() { - var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = []; - var stream = { - point: point, - lineStart: function() { - stream.point = pointLineStart; - }, - lineEnd: lineEnd, - polygonStart: function() { - stream.lineEnd = lineEndPolygon; - }, - polygonEnd: function() { - stream.lineEnd = lineEnd; - stream.point = point; - }, - pointRadius: function(_) { - pointCircle = d3_geo_pathBufferCircle(_); - return stream; - }, - result: function() { - if (buffer.length) { - var result = buffer.join(""); - buffer = []; - return result; - } - } - }; - function point(x, y) { - buffer.push("M", x, ",", y, pointCircle); - } - function pointLineStart(x, y) { - buffer.push("M", x, ",", y); - stream.point = pointLine; - } - function pointLine(x, y) { - buffer.push("L", x, ",", y); - } - function lineEnd() { - stream.point = point; - } - function lineEndPolygon() { - buffer.push("Z"); + d3.svg.diagonal = function() { + var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; + function diagonal(d, i) { + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { + x: p0.x, + y: m + }, { + x: p3.x, + y: m + }, p3 ]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; } - return stream; + 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 ]; } - function d3_geo_pathBufferCircle(radius) { - return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; + 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) ]; + }; } - var d3_geo_pathCentroid = { - point: d3_geo_pathCentroidPoint, - lineStart: d3_geo_pathCentroidLineStart, - lineEnd: d3_geo_pathCentroidLineEnd, - polygonStart: function() { - d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; - }, - polygonEnd: function() { - d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; - d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; - d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; + 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_geo_pathCentroidPoint(x, y) { - d3_geo_centroidX0 += x; - d3_geo_centroidY0 += y; - ++d3_geo_centroidZ0; + function d3_svg_symbolSize() { + return 64; } - function d3_geo_pathCentroidLineStart() { - var x0, y0; - d3_geo_pathCentroid.point = function(x, y) { - d3_geo_pathCentroid.point = nextPoint; - d3_geo_pathCentroidPoint(x0 = x, y0 = y); - }; - function nextPoint(x, y) { - var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); - d3_geo_centroidX1 += z * (x0 + x) / 2; - d3_geo_centroidY1 += z * (y0 + y) / 2; - d3_geo_centroidZ1 += z; - d3_geo_pathCentroidPoint(x0 = x, y0 = y); - } + function d3_svg_symbolType() { + return "circle"; } - function d3_geo_pathCentroidLineEnd() { - d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + 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"; } - function d3_geo_pathCentroidRingStart() { - var x00, y00, x0, y0; - d3_geo_pathCentroid.point = function(x, y) { - d3_geo_pathCentroid.point = nextPoint; - d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); + var d3_svg_symbols = d3.map({ + circle: d3_svg_symbolCircle, + cross: function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; + }, + diamond: function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; + }, + square: function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; + } + }); + d3.svg.symbolTypes = d3_svg_symbols.keys(); + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); + d3_selectionPrototype.transition = function(name) { + var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name), subgroups = [], subgroup, node, transition = d3_transitionInherit || { + time: Date.now(), + ease: d3_ease_cubicInOut, + delay: 0, + duration: 250 }; - function nextPoint(x, y) { - var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); - d3_geo_centroidX1 += z * (x0 + x) / 2; - d3_geo_centroidY1 += z * (y0 + y) / 2; - d3_geo_centroidZ1 += z; - z = y0 * x - x0 * y; - d3_geo_centroidX2 += z * (x0 + x); - d3_geo_centroidY2 += z * (y0 + y); - d3_geo_centroidZ2 += z * 3; - d3_geo_pathCentroidPoint(x0 = x, y0 = y); + 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, ns, id, transition); + subgroup.push(node); + } } - d3_geo_pathCentroid.lineEnd = function() { - nextPoint(x00, y00); + return d3_transition(subgroups, ns, id); + }; + 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(ns) { + return function() { + var lock, activeId, active; + if ((lock = this[ns]) && (active = lock[activeId = lock.active])) { + active.timer.c = null; + active.timer.t = NaN; + if (--lock.count) delete lock[activeId]; else delete this[ns]; + lock.active += .5; + active.event && active.event.interrupt.call(this, this.__data__, active.index); + } }; } - function d3_geo_pathContext(context) { - var pointRadius = 4.5; - var stream = { - point: point, - lineStart: function() { - stream.point = pointLineStart; - }, - lineEnd: lineEnd, - polygonStart: function() { - stream.lineEnd = lineEndPolygon; - }, - polygonEnd: function() { - stream.lineEnd = lineEnd; - stream.point = point; - }, - pointRadius: function(_) { - pointRadius = _; - return stream; - }, - result: d3_noop - }; - function point(x, y) { - context.moveTo(x + pointRadius, y); - context.arc(x, y, pointRadius, 0, τ); - } - function pointLineStart(x, y) { - context.moveTo(x, y); - stream.point = pointLine; - } - function pointLine(x, y) { - context.lineTo(x, y); - } - function lineEnd() { - stream.point = point; - } - function lineEndPolygon() { - context.closePath(); - } - return stream; + function d3_transition(groups, ns, id) { + d3_subclass(groups, d3_transitionPrototype); + groups.namespace = ns; + groups.id = id; + return groups; } - function d3_geo_resample(project) { - var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; - function resample(stream) { - return (maxDepth ? resampleRecursive : resampleNone)(stream); - } - function resampleNone(stream) { - return d3_geo_transformPoint(stream, function(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - }); - } - function resampleRecursive(stream) { - var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; - var resample = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - stream.polygonStart(); - resample.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resample.lineStart = lineStart; + 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 id = this.id, ns = 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, ns, id, node[ns][id]); + subgroup.push(subnode); + } else { + subgroup.push(null); } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x0 = NaN; - resample.point = linePoint; - stream.lineStart(); - } - function linePoint(λ, φ) { - var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); - resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - function lineEnd() { - resample.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resample.point = ringPoint; - resample.lineEnd = ringEnd; - } - function ringPoint(λ, φ) { - linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resample.point = linePoint; - } - function ringEnd() { - resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); - resample.lineEnd = lineEnd; - lineEnd(); } - return resample; } - function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; - if (d2 > 4 * δ2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); + return d3_transition(subgroups, ns, id); + }; + d3_transitionPrototype.selectAll = function(selector) { + var id = this.id, ns = 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[ns][id]; + subnodes = selector.call(node, node.__data__, i, j); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o; ) { + if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition); + subgroup.push(subnode); + } } } } - resample.precision = function(_) { - if (!arguments.length) return Math.sqrt(δ2); - maxDepth = (δ2 = _ * _) > 0 && 16; - return resample; - }; - return resample; - } - d3.geo.path = function() { - var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); - d3.geo.stream(object, cacheStream); + return d3_transition(subgroups, ns, id); + }; + d3_transitionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { + subgroup.push(node); + } } - return contextStream.result(); - } - path.area = function(object) { - d3_geo_pathAreaSum = 0; - d3.geo.stream(object, projectStream(d3_geo_pathArea)); - return d3_geo_pathAreaSum; - }; - path.centroid = function(object) { - d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; - d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); - return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ]; - }; - path.bounds = function(object) { - d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); - d3.geo.stream(object, projectStream(d3_geo_pathBounds)); - return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; - }; - path.projection = function(_) { - if (!arguments.length) return projection; - projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; - return reset(); - }; - path.context = function(_) { - if (!arguments.length) return context; - contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return reset(); - }; - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - function reset() { - cacheStream = null; - return path; } - return path.projection(d3.geo.albersUsa()).context(null); + return d3_transition(subgroups, this.namespace, this.id); }; - function d3_geo_pathProjectStream(project) { - var resample = d3_geo_resample(function(x, y) { - return project([ x * d3_degrees, y * d3_degrees ]); + d3_transitionPrototype.tween = function(name, tween) { + var id = this.id, ns = this.namespace; + if (arguments.length < 2) return this.node()[ns][id].tween.get(name); + return d3_selection_each(this, tween == null ? function(node) { + node[ns][id].tween.remove(name); + } : function(node) { + node[ns][id].tween.set(name, tween); }); - return function(stream) { - return d3_geo_projectionRadians(resample(stream)); - }; - } - d3.geo.transform = function(methods) { - return { - stream: function(stream) { - var transform = new d3_geo_transform(stream); - for (var k in methods) transform[k] = methods[k]; - return transform; - } - }; }; - function d3_geo_transform(stream) { - this.stream = stream; + function d3_transition_tween(groups, name, value, tween) { + var id = groups.id, ns = groups.namespace; + return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { + node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j))); + } : (value = tween(value), function(node) { + node[ns][id].tween.set(name, value); + })); } - d3_geo_transform.prototype = { - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); + d3_transitionPrototype.attr = function(nameNS, value) { + if (arguments.length < 2) { + for (value in nameNS) this.attr(value, nameNS[value]); + return this; } - }; - function d3_geo_transformPoint(stream, point) { - return { - point: point, - sphere: function() { - stream.sphere(); - }, - lineStart: function() { - stream.lineStart(); - }, - lineEnd: function() { - stream.lineEnd(); - }, - polygonStart: function() { - stream.polygonStart(); - }, - polygonEnd: function() { - stream.polygonEnd(); - } - }; - } - d3.geo.projection = d3_geo_projection; - d3.geo.projectionMutator = d3_geo_projectionMutator; - function d3_geo_projection(project) { - return d3_geo_projectionMutator(function() { - return project; - })(); - } - function d3_geo_projectionMutator(projectAt) { - var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { - x = project(x, y); - return [ x[0] * k + δx, δy - x[1] * k ]; - }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream; - function projection(point) { - point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); - return [ point[0] * k + δx, δy - point[1] * k ]; + var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); + function attrNull() { + this.removeAttribute(name); } - function invert(point) { - point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); - return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); } - projection.stream = function(output) { - if (stream) stream.valid = false; - stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); - stream.valid = true; - return stream; - }; - projection.clipAngle = function(_) { - if (!arguments.length) return clipAngle; - preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); - return invalidate(); - }; - projection.clipExtent = function(_) { - if (!arguments.length) return clipExtent; - clipExtent = _; - postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; - return invalidate(); - }; - projection.scale = function(_) { - if (!arguments.length) return k; - k = +_; - return reset(); - }; - projection.translate = function(_) { - if (!arguments.length) return [ x, y ]; - x = +_[0]; - y = +_[1]; - return reset(); - }; - projection.center = function(_) { - if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; - λ = _[0] % 360 * d3_radians; - φ = _[1] % 360 * d3_radians; - return reset(); - }; - projection.rotate = function(_) { - if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; - δλ = _[0] % 360 * d3_radians; - δφ = _[1] % 360 * d3_radians; - δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; - return reset(); - }; - d3.rebind(projection, projectResample, "precision"); - function reset() { - projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); - var center = project(λ, φ); - δx = x - center[0] * k; - δy = y + center[1] * k; - return invalidate(); + function 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 invalidate() { - if (stream) stream.valid = false, stream = null; - return projection; + 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() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return reset(); + this.textContent = b; }; } - function d3_geo_projectionRadians(stream) { - return d3_geo_transformPoint(stream, function(x, y) { - stream.point(x * d3_radians, y * d3_radians); + d3_transitionPrototype.remove = function() { + var ns = this.namespace; + return this.each("end.transition", function() { + var p; + if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this); }); - } - function d3_geo_equirectangular(λ, φ) { - return [ λ, φ ]; - } - (d3.geo.equirectangular = function() { - return d3_geo_projection(d3_geo_equirectangular); - }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; - d3.geo.rotation = function(rotate) { - rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); - function forward(coordinates) { - coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); - return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + }; + d3_transitionPrototype.ease = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].ease; + if (typeof value !== "function") value = d3.ease.apply(d3, arguments); + return d3_selection_each(this, function(node) { + node[ns][id].ease = value; + }); + }; + d3_transitionPrototype.delay = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].delay; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node[ns][id].delay = +value.call(node, node.__data__, i, j); + } : (value = +value, function(node) { + node[ns][id].delay = value; + })); + }; + d3_transitionPrototype.duration = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].duration; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j)); + } : (value = Math.max(1, value), function(node) { + node[ns][id].duration = value; + })); + }; + d3_transitionPrototype.each = function(type, listener) { + var id = this.id, ns = this.namespace; + if (arguments.length < 2) { + var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; + try { + d3_transitionInheritId = id; + d3_selection_each(this, function(node, i, j) { + d3_transitionInherit = node[ns][id]; + type.call(node, node.__data__, i, j); + }); + } finally { + d3_transitionInherit = inherit; + d3_transitionInheritId = inheritId; + } + } else { + d3_selection_each(this, function(node) { + var transition = node[ns][id]; + (transition.event || (transition.event = d3.dispatch("start", "end", "interrupt"))).on(type, listener); + }); } - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); - return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; - }; - return forward; + return this; }; - function d3_geo_identityRotation(λ, φ) { - return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; - } - d3_geo_identityRotation.invert = d3_geo_equirectangular; - function d3_geo_rotation(δλ, δφ, δγ) { - return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; - } - function d3_geo_forwardRotationλ(δλ) { - return function(λ, φ) { - return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; - }; - } - function d3_geo_rotationλ(δλ) { - var rotation = d3_geo_forwardRotationλ(δλ); - rotation.invert = d3_geo_forwardRotationλ(-δλ); - return rotation; - } - function d3_geo_rotationφγ(δφ, δγ) { - var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); - function rotation(λ, φ) { - var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; - return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ]; + d3_transitionPrototype.transition = function() { + var id0 = this.id, id1 = ++d3_transitionId, ns = 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[ns][id0]; + d3_transitionNode(node, i, ns, id1, { + time: transition.time, + ease: transition.ease, + delay: transition.delay + transition.duration, + duration: transition.duration + }); + } + subgroup.push(node); + } } - rotation.invert = function(λ, φ) { - var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; - return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ]; - }; - return rotation; + return d3_transition(subgroups, ns, id1); + }; + function d3_transitionNamespace(name) { + return name == null ? "__transition__" : "__transition_" + name + "__"; } - d3.geo.circle = function() { - var origin = [ 0, 0 ], angle, precision = 6, interpolate; - function circle() { - var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; - interpolate(null, null, 1, { - point: function(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= d3_degrees, x[1] *= d3_degrees; + function d3_transitionNode(node, i, ns, id, inherit) { + var lock = node[ns] || (node[ns] = { + active: 0, + count: 0 + }), transition = lock[id], 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 < id) { + 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 = id; + 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); } }); - return { - type: "Polygon", - coordinates: [ ring ] - }; + ease = transition.ease; + duration = transition.duration; } - circle.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - return circle; - }; - circle.angle = function(x) { - if (!arguments.length) return angle; - interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); - return circle; - }; - circle.precision = function(_) { - if (!arguments.length) return precision; - interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); - return circle; - }; - return circle.angle(90); - }; - function d3_geo_circleInterpolate(radius, precision) { - var cr = Math.cos(radius), sr = Math.sin(radius); - return function(from, to, direction, listener) { - var step = direction * precision; - if (from != null) { - from = d3_geo_circleAngle(cr, from); - to = d3_geo_circleAngle(cr, to); - if (direction > 0 ? from < to : from > to) from += direction * τ; - } else { - from = radius + direction * τ; - to = radius - .5 * step; + function tick(elapsed) { + var t = elapsed / duration, e = ease(t), n = tweens.length; + while (n > 0) { + tweens[--n].call(node, e); } - for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { - listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); + if (t >= 1) { + transition.event && transition.event.end.call(node, node.__data__, i); + if (--lock.count) delete lock[id]; else delete node[ns]; + return 1; } - }; - } - function d3_geo_circleAngle(cr, point) { - var a = d3_geo_cartesian(point); - a[0] -= cr; - d3_geo_cartesianNormalize(a); - var angle = d3_acos(-a[1]); - return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); - } - d3.geo.distance = function(a, b) { - var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t; - return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ); - }; - d3.geo.graticule = function() { - var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; } - function lines() { - return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) { - return abs(x % DX) > ε; - }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { - return abs(y % DY) > ε; - }).map(y)); + if (!transition) { + time = inherit.time; + timer = d3_timer(schedule, 0, time); + transition = lock[id] = { + tween: new d3_Map(), + time: time, + timer: timer, + delay: inherit.delay, + duration: inherit.duration, + ease: inherit.ease, + index: i + }; + inherit = null; + ++lock.count; } - graticule.lines = function() { - return lines().map(function(coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; + } + d3.svg.axis = function() { + var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_; + function axis(g) { + g.each(function() { + var g = d3.select(this); + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); + var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform; + var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), + d3.transition(path)); + tickEnter.append("line"); + tickEnter.append("text"); + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2; + if (orient === "bottom" || orient === "top") { + tickTransform = d3_svg_axisX, x1 = "x", y1 = "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, x1 = "y", y1 = "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(y1, sign * tickSpacing); + lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize); + textUpdate.attr(x1, 0).attr(y1, 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; }; - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] - }; + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; + return axis; }; - graticule.extent = function(_) { - if (!arguments.length) return graticule.minorExtent(); - return graticule.majorExtent(_).minorExtent(_); + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = d3_array(arguments); + return axis; }; - graticule.majorExtent = function(_) { - if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; }; - graticule.minorExtent = function(_) { - if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; }; - graticule.step = function(_) { - if (!arguments.length) return graticule.minorStep(); - return graticule.majorStep(_).minorStep(_); + axis.tickSize = function(x) { + var n = arguments.length; + if (!n) return innerTickSize; + innerTickSize = +x; + outerTickSize = +arguments[n - 1]; + return axis; }; - graticule.majorStep = function(_) { - if (!arguments.length) return [ DX, DY ]; - DX = +_[0], DY = +_[1]; - return graticule; + axis.innerTickSize = function(x) { + if (!arguments.length) return innerTickSize; + innerTickSize = +x; + return axis; }; - graticule.minorStep = function(_) { - if (!arguments.length) return [ dx, dy ]; - dx = +_[0], dy = +_[1]; - return graticule; + axis.outerTickSize = function(x) { + if (!arguments.length) return outerTickSize; + outerTickSize = +x; + return axis; }; - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = d3_geo_graticuleX(y0, y1, 90); - y = d3_geo_graticuleY(x0, x1, precision); - X = d3_geo_graticuleX(Y0, Y1, 90); - Y = d3_geo_graticuleY(X0, X1, precision); - return graticule; + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; }; - return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); + axis.tickSubdivide = function() { + return arguments.length && axis; + }; + return axis; }; - function d3_geo_graticuleX(y0, y1, dy) { - var y = d3.range(y0, y1 - ε, dy).concat(y1); - return function(x) { - return y.map(function(y) { - return [ x, y ]; - }); - }; - } - function d3_geo_graticuleY(x0, x1, dx) { - var x = d3.range(x0, x1 - ε, dx).concat(x1); - return function(y) { - return x.map(function(x) { - return [ x, y ]; - }); - }; - } - function d3_source(d) { - return d.source; + var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { + top: 1, + right: 1, + bottom: 1, + left: 1 + }; + function d3_svg_axisX(selection, x0, x1) { + selection.attr("transform", function(d) { + var v0 = x0(d); + return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)"; + }); } - function d3_target(d) { - return d.target; + function d3_svg_axisY(selection, y0, y1) { + selection.attr("transform", function(d) { + var v0 = y0(d); + return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")"; + }); } - d3.geo.greatArc = function() { - var source = d3_source, source_, target = d3_target, target_; - function greatArc() { - return { - type: "LineString", - coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] - }; + d3.svg.brush = function() { + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0]; + function brush(g) { + g.each(function() { + var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); + var background = g.selectAll(".background").data([ 0 ]); + background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); + g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); + var resize = g.selectAll(".resize").data(resizes, d3_identity); + resize.exit().remove(); + resize.enter().append("g").attr("class", function(d) { + return "resize " + d; + }).style("cursor", function(d) { + return d3_svg_brushCursor[d]; + }).append("rect").attr("x", function(d) { + return /[ew]$/.test(d) ? -3 : null; + }).attr("y", function(d) { + return /^[ns]/.test(d) ? -3 : null; + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); + resize.style("display", brush.empty() ? "none" : null); + var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; + if (x) { + range = d3_scaleRange(x); + backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); + redrawX(gUpdate); + } + if (y) { + range = d3_scaleRange(y); + backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); + redrawY(gUpdate); + } + redraw(gUpdate); + }); } - greatArc.distance = function() { - return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); - }; - greatArc.source = function(_) { - if (!arguments.length) return source; - source = _, source_ = typeof _ === "function" ? null : _; - return greatArc; - }; - greatArc.target = function(_) { - if (!arguments.length) return target; - target = _, target_ = typeof _ === "function" ? null : _; - return greatArc; - }; - greatArc.precision = function() { - return arguments.length ? greatArc : 0; - }; - return greatArc; - }; - d3.geo.interpolate = function(source, target) { - return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); - }; - function d3_geo_interpolate(x0, y0, x1, y1) { - var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d); - var interpolate = d ? function(t) { - var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; - return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; - } : function() { - return [ x0 * d3_degrees, y0 * d3_degrees ]; - }; - interpolate.distance = d; - return interpolate; - } - d3.geo.length = function(object) { - d3_geo_lengthSum = 0; - d3.geo.stream(object, d3_geo_length); - return d3_geo_lengthSum; - }; - var d3_geo_lengthSum; - var d3_geo_length = { - sphere: d3_noop, - point: d3_noop, - lineStart: d3_geo_lengthLineStart, - lineEnd: d3_noop, - polygonStart: d3_noop, - polygonEnd: d3_noop - }; - function d3_geo_lengthLineStart() { - var λ0, sinφ0, cosφ0; - d3_geo_length.point = function(λ, φ) { - λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); - d3_geo_length.point = nextPoint; - }; - d3_geo_length.lineEnd = function() { - d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; + brush.event = function(g) { + g.each(function() { + var event_ = event.of(this, arguments), extent1 = { + x: xExtent, + y: yExtent, + i: xExtentDomain, + j: yExtentDomain + }, extent0 = this.__chart__ || extent1; + this.__chart__ = extent1; + if (d3_transitionInheritId) { + d3.select(this).transition().each("start.brush", function() { + xExtentDomain = extent0.i; + yExtentDomain = extent0.j; + xExtent = extent0.x; + yExtent = extent0.y; + event_({ + type: "brushstart" + }); + }).tween("brush:brush", function() { + var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); + xExtentDomain = yExtentDomain = null; + return function(t) { + xExtent = extent1.x = xi(t); + yExtent = extent1.y = yi(t); + event_({ + type: "brush", + mode: "resize" + }); + }; + }).each("end.brush", function() { + xExtentDomain = extent1.i; + yExtentDomain = extent1.j; + event_({ + type: "brush", + mode: "resize" + }); + event_({ + type: "brushend" + }); + }); + } else { + event_({ + type: "brushstart" + }); + event_({ + type: "brush", + mode: "resize" + }); + event_({ + type: "brushend" + }); + } + }); }; - function nextPoint(λ, φ) { - var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); - d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ); - λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; + }); } - } - function d3_geo_azimuthal(scale, angle) { - function azimuthal(λ, φ) { - var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); - return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; + function redrawX(g) { + g.select(".extent").attr("x", xExtent[0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); } - azimuthal.invert = function(x, y) { - var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); - return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; - }; - return azimuthal; - } - var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { - return Math.sqrt(2 / (1 + cosλcosφ)); - }, function(ρ) { - return 2 * Math.asin(ρ / 2); - }); - (d3.geo.azimuthalEqualArea = function() { - return d3_geo_projection(d3_geo_azimuthalEqualArea); - }).raw = d3_geo_azimuthalEqualArea; - var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { - var c = Math.acos(cosλcosφ); - return c && c / Math.sin(c); - }, d3_identity); - (d3.geo.azimuthalEquidistant = function() { - return d3_geo_projection(d3_geo_azimuthalEquidistant); - }).raw = d3_geo_azimuthalEquidistant; - function d3_geo_conicConformal(φ0, φ1) { - var cosφ0 = Math.cos(φ0), t = function(φ) { - return Math.tan(π / 4 + φ / 2); - }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n; - if (!n) return d3_geo_mercator; - function forward(λ, φ) { - if (F > 0) { - if (φ < -halfπ + ε) φ = -halfπ + ε; + 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 { - if (φ > halfπ - ε) φ = halfπ - ε; + w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend); + } + g.interrupt().selectAll("*").interrupt(); + if (dragging) { + origin[0] = xExtent[0] - origin[0]; + origin[1] = yExtent[0] - origin[1]; + } else if (resizing) { + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); + offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ]; + origin[0] = xExtent[ex]; + origin[1] = yExtent[ey]; + } else if (d3.event.altKey) center = origin.slice(); + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + event_({ + type: "brushstart" + }); + brushmove(); + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= xExtent[1]; + origin[1] -= yExtent[1]; + dragging = 2; + } + d3_eventPreventDefault(); + } + } + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += xExtent[1]; + origin[1] += yExtent[1]; + dragging = 0; + d3_eventPreventDefault(); + } + } + function brushmove() { + var point = d3.mouse(target), moved = false; + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + if (!dragging) { + if (d3.event.altKey) { + if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ]; + origin[0] = xExtent[+(point[0] < center[0])]; + origin[1] = yExtent[+(point[1] < center[1])]; + } else center = null; + } + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + if (moved) { + redraw(g); + event_({ + type: "brush", + mode: dragging ? "move" : "resize" + }); + } + } + function move1(point, scale, i) { + var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max; + if (dragging) { + r0 -= position; + r1 -= size + position; + } + min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; + if (dragging) { + max = (min += position) + size; + } else { + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + if (extent[0] != min || extent[1] != max) { + if (i) yExtentDomain = null; else xExtentDomain = null; + extent[0] = min; + extent[1] = max; + return true; + } + } + function brushend() { + brushmove(); + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); + dragRestore(); + event_({ + type: "brushend" + }); } - var ρ = F / Math.pow(t(φ), n); - return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ]; - } - forward.invert = function(x, y) { - var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y); - return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ]; - }; - return forward; - } - (d3.geo.conicConformal = function() { - return d3_geo_conic(d3_geo_conicConformal); - }).raw = d3_geo_conicConformal; - function d3_geo_conicEquidistant(φ0, φ1) { - var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0; - if (abs(n) < ε) return d3_geo_equirectangular; - function forward(λ, φ) { - var ρ = G - φ; - return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ]; } - forward.invert = function(x, y) { - var ρ0_y = G - y; - return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ]; + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; }; - return forward; - } - (d3.geo.conicEquidistant = function() { - return d3_geo_conic(d3_geo_conicEquidistant); - }).raw = d3_geo_conicEquidistant; - var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { - return 1 / cosλcosφ; - }, Math.atan); - (d3.geo.gnomonic = function() { - return d3_geo_projection(d3_geo_gnomonic); - }).raw = d3_geo_gnomonic; - function d3_geo_mercator(λ, φ) { - return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ]; - } - d3_geo_mercator.invert = function(x, y) { - return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ]; - }; - function d3_geo_mercatorProjection(project) { - var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; - m.scale = function() { - var v = scale.apply(m, arguments); - return v === m ? clipAuto ? m.clipExtent(null) : m : v; + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; }; - m.translate = function() { - var v = translate.apply(m, arguments); - return v === m ? clipAuto ? m.clipExtent(null) : m : v; + 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; }; - m.clipExtent = function(_) { - var v = clipExtent.apply(m, arguments); - if (v === m) { - if (clipAuto = _ == null) { - var k = π * scale(), t = translate(); - clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); + brush.extent = function(z) { + var x0, x1, y0, y1, t; + if (!arguments.length) { + if (x) { + if (xExtentDomain) { + x0 = xExtentDomain[0], x1 = xExtentDomain[1]; + } else { + x0 = xExtent[0], x1 = xExtent[1]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } } - } else if (clipAuto) { - v = null; + if (y) { + if (yExtentDomain) { + y0 = yExtentDomain[0], y1 = yExtentDomain[1]; + } else { + y0 = yExtent[0], y1 = yExtent[1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; } - return v; - }; - return m.clipExtent(null); - } - (d3.geo.mercator = function() { - return d3_geo_mercatorProjection(d3_geo_mercator); - }).raw = d3_geo_mercator; - var d3_geo_orthographic = d3_geo_azimuthal(function() { - return 1; - }, Math.asin); - (d3.geo.orthographic = function() { - return d3_geo_projection(d3_geo_orthographic); - }).raw = d3_geo_orthographic; - var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { - return 1 / (1 + cosλcosφ); - }, function(ρ) { - return 2 * Math.atan(ρ); - }); - (d3.geo.stereographic = function() { - return d3_geo_projection(d3_geo_stereographic); - }).raw = d3_geo_stereographic; - function d3_geo_transverseMercator(λ, φ) { - return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ]; - } - d3_geo_transverseMercator.invert = function(x, y) { - return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ]; - }; - (d3.geo.transverseMercator = function() { - var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; - projection.center = function(_) { - return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]); - }; - projection.rotate = function(_) { - return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), - [ _[0], _[1], _[2] - 90 ]); + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + xExtentDomain = [ x0, x1 ]; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + yExtentDomain = [ y0, y1 ]; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; + } + return brush; }; - return rotate([ 0, 0, 90 ]); - }).raw = d3_geo_transverseMercator; - d3.geom = {}; - function d3_geom_pointX(d) { - return d[0]; - } - function d3_geom_pointY(d) { - return d[1]; - } - d3.geom.hull = function(vertices) { - var x = d3_geom_pointX, y = d3_geom_pointY; - if (arguments.length) return hull(vertices); - function hull(data) { - if (data.length < 3) return []; - var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = []; - for (i = 0; i < n; i++) { - points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]); + brush.clear = function() { + if (!brush.empty()) { + xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; + xExtentDomain = yExtentDomain = null; } - 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; + return brush; }; - hull.y = function(_) { - return arguments.length ? (y = _, hull) : y; + brush.empty = function() { + return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; }; - return hull; + return d3.rebind(brush, event, "on"); }; - function d3_geom_hullUpper(points) { - var n = points.length, hull = [ 0, 1 ], hs = 2; - for (var i = 2; i < n; i++) { - while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; - hull[hs++] = i; - } - return hull.slice(0, hs); - } - function d3_geom_hullOrder(a, b) { - return a[0] - b[0] || a[1] - b[1]; + var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" + }; + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; + var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; + var d3_time_formatUtc = d3_time_format.utc; + var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); + d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; + function d3_time_formatIsoNative(date) { + return date.toISOString(); } - d3.geom.polygon = function(coordinates) { - d3_subclass(coordinates, d3_geom_polygonPrototype); - return coordinates; + d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; }; - 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]; + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; + d3_time.second = d3_time_interval(function(date) { + return new d3_date(Math.floor(date / 1e3) * 1e3); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); + }, function(date) { + return date.getSeconds(); + }); + d3_time.seconds = d3_time.second.range; + d3_time.seconds.utc = d3_time.second.utc.range; + d3_time.minute = d3_time_interval(function(date) { + return new d3_date(Math.floor(date / 6e4) * 6e4); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); + }, function(date) { + return date.getMinutes(); + }); + d3_time.minutes = d3_time.minute.range; + d3_time.minutes.utc = d3_time.minute.utc.range; + d3_time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); + }, function(date) { + return date.getHours(); + }); + d3_time.hours = d3_time.hour.range; + d3_time.hours.utc = d3_time.hour.utc.range; + d3_time.month = d3_time_interval(function(date) { + date = d3_time.day(date); + date.setDate(1); + return date; + }, function(date, offset) { + date.setMonth(date.getMonth() + offset); + }, function(date) { + return date.getMonth(); + }); + d3_time.months = d3_time.month.range; + d3_time.months.utc = d3_time.month.utc.range; + function d3_time_scale(linear, methods, format) { + function scale(x) { + return linear(x); } - return area * .5; - }; - d3_geom_polygonPrototype.centroid = function(k) { - var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c; - if (!arguments.length) k = -1 / (6 * this.area()); - while (++i < n) { - a = b; - b = this[i]; - c = a[0] * b[1] - b[0] * a[1]; - x += (a[0] + b[0]) * c; - y += (a[1] + b[1]) * c; + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + function tickMethod(extent, count) { + var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); + return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { + return d / 31536e6; + }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i]; } - 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; + scale.nice = function(interval, skip) { + var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); + if (method) interval = method[0], skip = method[1]; + function skipped(date) { + return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; } - if (closed) subject.push(subject[0]); - a = b; - } - return subject; - }; - function d3_geom_polygonInside(p, a, b) { - return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); - } - function d3_geom_polygonIntersect(c, d, a, b) { - var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); - return [ x1 + ua * x21, y1 + ua * y21 ]; - } - function d3_geom_polygonClosed(coordinates) { - var a = coordinates[0], b = coordinates[coordinates.length - 1]; - return !(a[0] - b[0] || a[1] - b[1]); - } - var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = []; - function d3_geom_voronoiBeach() { - d3_geom_voronoiRedBlackNode(this); - this.edge = this.site = this.circle = null; - } - function d3_geom_voronoiCreateBeach(site) { - var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); - beach.site = site; - return beach; - } - function d3_geom_voronoiDetachBeach(beach) { - d3_geom_voronoiDetachCircle(beach); - d3_geom_voronoiBeaches.remove(beach); - d3_geom_voronoiBeachPool.push(beach); - d3_geom_voronoiRedBlackNode(beach); - } - function d3_geom_voronoiRemoveBeach(beach) { - var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { - x: x, - y: y - }, previous = beach.P, next = beach.N, disappearing = [ beach ]; - d3_geom_voronoiDetachBeach(beach); - var lArc = previous; - while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) { - previous = lArc.P; - disappearing.unshift(lArc); - d3_geom_voronoiDetachBeach(lArc); - lArc = previous; - } - disappearing.unshift(lArc); - d3_geom_voronoiDetachCircle(lArc); - var rArc = next; - while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) { - next = rArc.N; - disappearing.push(rArc); - d3_geom_voronoiDetachBeach(rArc); - rArc = next; - } - disappearing.push(rArc); - d3_geom_voronoiDetachCircle(rArc); - var nArcs = disappearing.length, iArc; - for (iArc = 1; iArc < nArcs; ++iArc) { - rArc = disappearing[iArc]; - lArc = disappearing[iArc - 1]; - d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); - } - lArc = disappearing[0]; - rArc = disappearing[nArcs - 1]; - rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex); - d3_geom_voronoiAttachCircle(lArc); - d3_geom_voronoiAttachCircle(rArc); - } - function d3_geom_voronoiAddBeach(site) { - var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._; - while (node) { - dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x; - if (dxl > ε) node = node.L; else { - dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix); - if (dxr > ε) { - if (!node.R) { - lArc = node; - break; - } - node = node.R; - } else { - if (dxl > -ε) { - lArc = node.P; - rArc = node; - } else if (dxr > -ε) { - lArc = node; - rArc = node.N; - } else { - lArc = rArc = node; - } - break; + return scale.domain(d3_scale_nice(domain, skip > 1 ? { + floor: function(date) { + while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); + return date; + }, + ceil: function(date) { + while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); + return date; } - } - } - var newArc = d3_geom_voronoiCreateBeach(site); - d3_geom_voronoiBeaches.insert(lArc, newArc); - if (!lArc && !rArc) return; - if (lArc === rArc) { - d3_geom_voronoiDetachCircle(lArc); - rArc = d3_geom_voronoiCreateBeach(lArc.site); - d3_geom_voronoiBeaches.insert(newArc, rArc); - newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); - d3_geom_voronoiAttachCircle(lArc); - d3_geom_voronoiAttachCircle(rArc); - return; - } - if (!rArc) { - newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); - return; - } - d3_geom_voronoiDetachCircle(lArc); - d3_geom_voronoiDetachCircle(rArc); - var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = { - x: (cy * hb - by * hc) / d + ax, - y: (bx * hc - cx * hb) / d + ay + } : interval)); }; - 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; + scale.ticks = function(interval, skip) { + var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { + range: interval + }, skip ]; + if (method) interval = method[0], skip = method[1]; + return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); + }; + scale.tickFormat = function() { + return format; + }; + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + return d3_scale_linearRebind(scale, linear); } - function d3_geom_voronoiCell(site) { - this.site = site; - this.edges = []; + function d3_time_scaleDate(t) { + return new Date(t); } - 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; + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; + var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ]; + var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { + return d.getMilliseconds(); + } ], [ ":%S", function(d) { + return d.getSeconds(); + } ], [ "%I:%M", function(d) { + return d.getMinutes(); + } ], [ "%I %p", function(d) { + return d.getHours(); + } ], [ "%a %d", function(d) { + return d.getDay() && d.getDate() != 1; + } ], [ "%b %d", function(d) { + return d.getDate() != 1; + } ], [ "%B", function(d) { + return d.getMonth(); + } ], [ "%Y", d3_true ] ]); + var d3_time_scaleMilliseconds = { + range: function(start, stop, step) { + return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); + }, + floor: d3_identity, + ceil: d3_identity }; - function d3_geom_voronoiCloseCells(extent) { - var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end; - while (iCell--) { - cell = cells[iCell]; - if (!cell || !cell.prepare()) continue; - halfEdges = cell.edges; - nHalfEdges = halfEdges.length; - iHalfEdge = 0; - while (iHalfEdge < nHalfEdges) { - end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; - start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; - if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) { - halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? { - x: x0, - y: abs(x2 - x0) < ε ? y2 : y1 - } : abs(y3 - y1) < ε && x1 - x3 > ε ? { - x: abs(y2 - y1) < ε ? x2 : x1, - y: y1 - } : abs(x3 - x1) < ε && y3 - y0 > ε ? { - x: x1, - y: abs(x2 - x1) < ε ? y2 : y0 - } : abs(y3 - y0) < ε && x3 - x0 > ε ? { - x: abs(y2 - y0) < ε ? x2 : x0, - y: y0 - } : null), cell.site, null)); - ++nHalfEdges; - } - } - } - } - function d3_geom_voronoiHalfEdgeOrder(a, b) { - return b.angle - a.angle; - } - function d3_geom_voronoiCircle() { - d3_geom_voronoiRedBlackNode(this); - this.x = this.y = this.arc = this.site = this.cy = null; - } - function d3_geom_voronoiAttachCircle(arc) { - var lArc = arc.P, rArc = arc.N; - if (!lArc || !rArc) return; - var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; - if (lSite === rSite) return; - var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; - var d = 2 * (ax * cy - ay * cx); - if (d >= -ε2) return; - var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by; - var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); - circle.arc = arc; - circle.site = cSite; - circle.x = x + bx; - circle.y = cy + Math.sqrt(x * x + y * y); - circle.cy = cy; - arc.circle = circle; - var before = null, node = d3_geom_voronoiCircles._; - while (node) { - if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { - if (node.L) node = node.L; else { - before = node.P; - break; - } - } else { - if (node.R) node = node.R; else { - before = node; - break; - } - } - } - d3_geom_voronoiCircles.insert(before, circle); - if (!before) d3_geom_voronoiFirstCircle = circle; + d3_time_scaleLocalMethods.year = d3_time.year; + d3_time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); + }; + var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { + return [ m[0].utc, m[1] ]; + }); + var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { + return d.getUTCMilliseconds(); + } ], [ ":%S", function(d) { + return d.getUTCSeconds(); + } ], [ "%I:%M", function(d) { + return d.getUTCMinutes(); + } ], [ "%I %p", function(d) { + return d.getUTCHours(); + } ], [ "%a %d", function(d) { + return d.getUTCDay() && d.getUTCDate() != 1; + } ], [ "%b %d", function(d) { + return d.getUTCDate() != 1; + } ], [ "%B", function(d) { + return d.getUTCMonth(); + } ], [ "%Y", d3_true ] ]); + d3_time_scaleUtcMethods.year = d3_time.year.utc; + d3_time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); + }; + d3.text = d3_xhrType(function(request) { + return request.responseText; + }); + d3.json = function(url, callback) { + return d3_xhr(url, "application/json", d3_json, callback); + }; + function d3_json(request) { + return JSON.parse(request.responseText); } - 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; - } + 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); } - 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); - } + d3.xml = d3_xhrType(function(request) { + return request.responseXML; + }); + if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; +}(); +},{}],9:[function(_dereq_,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version 3.3.1 + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.ES6Promise = factory()); +}(this, (function () { 'use strict'; + +function objectOrFunction(x) { + return typeof x === 'function' || typeof x === 'object' && x !== null; +} + +function isFunction(x) { + return typeof x === 'function'; +} + +var _isArray = undefined; +if (!Array.isArray) { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; +} else { + _isArray = Array.isArray; +} + +var isArray = _isArray; + +var len = 0; +var vertxNext = undefined; +var customSchedulerFn = undefined; + +var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); } } - function d3_geom_voronoiConnectEdge(edge, extent) { - var vb = edge.b; - if (vb) return true; - var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb; - if (ry === ly) { - if (fx < x0 || fx >= x1) return; - if (lx > rx) { - if (!va) va = { - x: fx, - y: y0 - }; else if (va.y >= y1) return; - vb = { - x: fx, - y: y1 - }; - } else { - if (!va) va = { - x: fx, - y: y1 - }; else if (va.y < y0) return; - vb = { - x: fx, - y: y0 - }; +}; + +function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; +} + +function setAsap(asapFn) { + asap = asapFn; +} + +var browserWindow = typeof window !== 'undefined' ? window : undefined; +var browserGlobal = browserWindow || {}; +var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]'; + +// test for web worker but not in IE10 +var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + +// node +function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; +} + +// vertx +function useVertxTimer() { + return function () { + vertxNext(flush); + }; +} + +function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; +} + +// web worker +function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; +} + +function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; +} + +var queue = new Array(1000); +function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; +} + +function attemptVertx() { + try { + var r = _dereq_; + var vertx = r('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } +} + +var scheduleFlush = undefined; +// Decide what async method to use to triggering processing of queued callbacks: +if (isNode) { + scheduleFlush = useNextTick(); +} else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); +} else if (isWorker) { + scheduleFlush = useMessageChannel(); +} else if (browserWindow === undefined && typeof _dereq_ === 'function') { + scheduleFlush = attemptVertx(); +} else { + scheduleFlush = useSetTimeout(); +} + +function then(onFulfillment, onRejection) { + var _arguments = arguments; + + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + if (_state) { + (function () { + var callback = _arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + })(); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; +} + +/** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` +*/ +function resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + _resolve(promise, object); + return promise; +} + +var PROMISE_ID = Math.random().toString(36).substring(16); + +function noop() {} + +var PENDING = void 0; +var FULFILLED = 1; +var REJECTED = 2; + +var GET_THEN_ERROR = new ErrorObject(); + +function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); +} + +function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); +} + +function getThen(promise) { + try { + return promise.then; + } catch (error) { + GET_THEN_ERROR.error = error; + return GET_THEN_ERROR; + } +} + +function tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } +} + +function handleForeignThenable(promise, thenable, then) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then, thenable, function (value) { + if (sealed) { + return; } - } else { - fm = (lx - rx) / (ry - ly); - fb = fy - fm * fx; - if (fm < -1 || fm > 1) { - if (lx > rx) { - if (!va) va = { - x: (y0 - fb) / fm, - y: y0 - }; else if (va.y >= y1) return; - vb = { - x: (y1 - fb) / fm, - y: y1 - }; - } else { - if (!va) va = { - x: (y1 - fb) / fm, - y: y1 - }; else if (va.y < y0) return; - vb = { - x: (y0 - fb) / fm, - y: y0 - }; - } + sealed = true; + if (thenable !== value) { + _resolve(promise, value); } else { - if (ly < ry) { - if (!va) va = { - x: x0, - y: fm * x0 + fb - }; else if (va.x >= x1) return; - vb = { - x: x1, - y: fm * x1 + fb - }; - } else { - if (!va) va = { - x: x1, - y: fm * x1 + fb - }; else if (va.x < x0) return; - vb = { - x: x0, - y: fm * x0 + fb - }; - } + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; } + sealed = true; + + _reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + _reject(promise, error); } - edge.a = va; - edge.b = vb; - return true; + }, promise); +} + +function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + _reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return _resolve(promise, value); + }, function (reason) { + return _reject(promise, reason); + }); } - function d3_geom_voronoiEdge(lSite, rSite) { - this.l = lSite; - this.r = rSite; - this.a = this.b = null; +} + +function handleMaybeThenable(promise, maybeThenable, then$$) { + if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$ === GET_THEN_ERROR) { + _reject(promise, GET_THEN_ERROR.error); + } else if (then$$ === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$)) { + handleForeignThenable(promise, maybeThenable, then$$); + } else { + fulfill(promise, maybeThenable); + } } - function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { - var edge = new d3_geom_voronoiEdge(lSite, rSite); - d3_geom_voronoiEdges.push(edge); - if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); - if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); - d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); - d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); - return edge; +} + +function _resolve(promise, value) { + if (promise === value) { + _reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + handleMaybeThenable(promise, value, getThen(value)); + } else { + fulfill(promise, value); } - function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { - var edge = new d3_geom_voronoiEdge(lSite, null); - edge.a = va; - edge.b = vb; - d3_geom_voronoiEdges.push(edge); - return edge; +} + +function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); } - 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; + + publish(promise); +} + +function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } +} + +function _reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); +} + +function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } +} + +function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = undefined, + callback = undefined, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); } else { - edge.a = vertex; + callback(detail); } } - function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { - var va = edge.a, vb = edge.b; - this.edge = edge; - this.site = lSite; - this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y); + + promise._subscribers.length = 0; +} + +function ErrorObject() { + this.error = null; +} + +var TRY_CATCH_ERROR = new ErrorObject(); + +function tryCatch(callback, detail) { + try { + return callback(detail); + } catch (e) { + TRY_CATCH_ERROR.error = e; + return TRY_CATCH_ERROR; } - 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 invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = undefined, + error = undefined, + succeeded = undefined, + failed = undefined; + + if (hasCallback) { + value = tryCatch(callback, detail); + + if (value === TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; } - }; - function d3_geom_voronoiRedBlackTree() { - this._ = null; + + if (promise === value) { + _reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + succeeded = true; } - function d3_geom_voronoiRedBlackNode(node) { - node.U = node.C = node.L = node.R = node.P = node.N = null; + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + _resolve(promise, value); + } else if (failed) { + _reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + _reject(promise, value); + } +} + +function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + _resolve(promise, value); + }, function rejectPromise(reason) { + _reject(promise, reason); + }); + } catch (e) { + _reject(promise, e); } - 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; +} + +var id = 0; +function nextId() { + return id++; +} + +function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; +} + +function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); } - 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; + + if (isArray(input)) { + this._input = input; + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); } else { - tree._ = q; - } - q.U = parent; - p.U = q; - p.L = q.R; - if (p.L) p.L.U = p; - q.R = p; - } - function d3_geom_voronoiRedBlackFirst(node) { - while (node.L) node = node.L; - return node; - } - function d3_geom_voronoi(sites, bbox) { - var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; - d3_geom_voronoiEdges = []; - d3_geom_voronoiCells = new Array(sites.length); - d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); - d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); - while (true) { - circle = d3_geom_voronoiFirstCircle; - if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { - if (site.x !== x0 || site.y !== y0) { - d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); - d3_geom_voronoiAddBeach(site); - x0 = site.x, y0 = site.y; - } - site = sites.pop(); - } else if (circle) { - d3_geom_voronoiRemoveBeach(circle.arc); - } else { - break; + this.length = this.length || 0; + this._enumerate(); + if (this._remaining === 0) { + fulfill(this.promise, this._result); } } - 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; + } else { + _reject(this.promise, validationError()); } - function d3_geom_voronoiVertexOrder(a, b) { - return b.y - a.y || b.x - a.x; +} + +function validationError() { + return new Error('Array Methods must be provided an Array'); +}; + +Enumerator.prototype._enumerate = function () { + var length = this.length; + var _input = this._input; + + for (var i = 0; this._state === PENDING && i < length; i++) { + this._eachEntry(_input[i], i); } - d3.geom.voronoi = function(points) { - var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; - if (points) return voronoi(points); - function voronoi(data) { - var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; - d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { - var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { - var s = e.start(); - return [ s.x, s.y ]; - }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; - polygon.point = data[i]; - }); - return polygons; - } - function sites(data) { - return data.map(function(d, i) { - return { - x: Math.round(fx(d, i) / ε) * ε, - y: Math.round(fy(d, i) / ε) * ε, - i: i - }; - }); +}; + +Enumerator.prototype._eachEntry = function (entry, i) { + var c = this._instanceConstructor; + var resolve$$ = c.resolve; + + if (resolve$$ === resolve) { + var _then = getThen(entry); + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise) { + var promise = new c(noop); + handleMaybeThenable(promise, entry, _then); + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$) { + return resolve$$(entry); + }), i); } - voronoi.links = function(data) { - return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { - return edge.l && edge.r; - }).map(function(edge) { - return { - source: data[edge.l.i], - target: data[edge.r.i] - }; - }); - }; - voronoi.triangles = function(data) { - var triangles = []; - d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { - var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l; - while (++j < m) { - e0 = e1; - s0 = s1; - e1 = edges[j].edge; - s1 = e1.l === site ? e1.r : e1.l; - if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { - triangles.push([ data[i], data[s0.i], data[s1.i] ]); - } - } - }); - return triangles; - }; - voronoi.x = function(_) { - return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; - }; - voronoi.y = function(_) { - return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; - }; - voronoi.clipExtent = function(_) { - if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; - clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; - return voronoi; - }; - voronoi.size = function(_) { - if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; - return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); - }; - return voronoi; - }; - var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ]; - function d3_geom_voronoiTriangleArea(a, b, c) { - return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y); + } else { + this._willSettleAt(resolve$$(entry), i); } - d3.geom.delaunay = function(vertices) { - return d3.geom.voronoi().triangles(vertices); - }; - d3.geom.quadtree = function(points, x1, y1, x2, y2) { - var x = d3_geom_pointX, y = d3_geom_pointY, compat; - if (compat = arguments.length) { - x = d3_geom_quadtreeCompatX; - y = d3_geom_quadtreeCompatY; - if (compat === 3) { - y2 = y1; - x2 = x1; - y1 = x1 = 0; - } - return quadtree(points); - } - function quadtree(data) { - var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; - if (x1 != null) { - x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; - } else { - x2_ = y2_ = -(x1_ = y1_ = Infinity); - xs = [], ys = []; - n = data.length; - if (compat) for (i = 0; i < n; ++i) { - d = data[i]; - if (d.x < x1_) x1_ = d.x; - if (d.y < y1_) y1_ = d.y; - if (d.x > x2_) x2_ = d.x; - if (d.y > y2_) y2_ = d.y; - xs.push(d.x); - ys.push(d.y); - } else for (i = 0; i < n; ++i) { - var x_ = +fx(d = data[i], i), y_ = +fy(d, i); - if (x_ < x1_) x1_ = x_; - if (y_ < y1_) y1_ = y_; - if (x_ > x2_) x2_ = x_; - if (y_ > y2_) y2_ = y_; - xs.push(x_); - ys.push(y_); - } - } - var dx = x2_ - x1_, dy = y2_ - y1_; - if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; - function insert(n, d, x, y, x1, y1, x2, y2) { - if (isNaN(x) || isNaN(y)) return; - if (n.leaf) { - var nx = n.x, ny = n.y; - if (nx != null) { - if (abs(nx - x) + abs(ny - y) < .01) { - insertChild(n, d, x, y, x1, y1, x2, y2); - } else { - var nPoint = n.point; - n.x = n.y = n.point = null; - insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); - insertChild(n, d, x, y, x1, y1, x2, y2); - } - } else { - n.x = x, n.y = y, n.point = d; - } - } else { - insertChild(n, d, x, y, x1, y1, x2, y2); - } - } - function insertChild(n, d, x, y, x1, y1, x2, y2) { - var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right; - n.leaf = false; - n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); - if (right) x1 = xm; else x2 = xm; - if (below) y1 = ym; else y2 = ym; - insert(n, d, x, y, x1, y1, x2, y2); - } - var root = d3_geom_quadtreeNode(); - root.add = function(d) { - insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); - }; - root.visit = function(f) { - d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); - }; - root.find = function(point) { - return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_); - }; - i = -1; - if (x1 == null) { - while (++i < n) { - insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); - } - --i; - } else data.forEach(root.add); - xs = ys = data = d = null; - return root; +}; + +Enumerator.prototype._settledAt = function (state, i, value) { + var promise = this.promise; + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + _reject(promise, value); + } else { + this._result[i] = value; } - quadtree.x = function(_) { - return arguments.length ? (x = _, quadtree) : x; - }; - quadtree.y = function(_) { - return arguments.length ? (y = _, quadtree) : y; - }; - quadtree.extent = function(_) { - if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; - if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], - y2 = +_[1][1]; - return quadtree; - }; - quadtree.size = function(_) { - if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; - if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; - return quadtree; - }; - return quadtree; - }; - function d3_geom_quadtreeCompatX(d) { - return d.x; - } - function d3_geom_quadtreeCompatY(d) { - return d.y; - } - function d3_geom_quadtreeNode() { - return { - leaf: true, - nodes: [], - point: null, - x: null, - y: null - }; } - function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { - if (!f(node, x1, y1, x2, y2)) { - var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; - if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); - if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); - if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); - if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); - } + + if (this._remaining === 0) { + fulfill(promise, this._result); } - function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) { - var minDistance2 = Infinity, closestPoint; - (function find(node, x1, y1, x2, y2) { - if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) 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); - x0 = x - distance, y0 = y - distance; - x3 = x + distance, y3 = y + distance; - closestPoint = point; - } +}; + +Enumerator.prototype._willSettleAt = function (promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); +}; + +/** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static +*/ +function all(entries) { + return new Enumerator(this, entries).promise; +} + +/** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. +*/ +function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); } - var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .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, x1, y1, xm, ym); - break; + }); + } +} - case 1: - find(node, xm, y1, x2, ym); - break; +/** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: - case 2: - find(node, x1, ym, xm, y2); - break; + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); - case 3: - find(node, xm, ym, x2, y2); - break; + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. +*/ +function reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + _reject(promise, reason); + return promise; +} + +function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); +} + +function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); +} + +/** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } } - } - })(root, x0, y0, x3, y3); - return closestPoint; + }; + }); } - d3.interpolateRgb = d3_interpolateRgb; - function d3_interpolateRgb(a, b) { - a = d3.rgb(a); - b = d3.rgb(b); - var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; - return function(t) { - return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); - }; + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor +*/ +function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); } - 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]; - } +} + +Promise.all = all; +Promise.race = race; +Promise.resolve = resolve; +Promise.reject = reject; +Promise._setScheduler = setScheduler; +Promise._setAsap = setAsap; +Promise._asap = asap; + +Promise.prototype = { + constructor: Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + let result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure } - 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 bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; - a = a + "", b = b + ""; - while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) { - if ((bs = bm.index) > bi) { - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s[i]) s[i] += bm; else s[++i] = bm; + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure } else { - s[++i] = null; - q.push({ - i: i, - x: d3_interpolateNumber(am, bm) - }); + // success } - bi = d3_interpolate_numberB.lastIndex; - } - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; else s[++i] = bs; - } - 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 i = 0, o; i < b; ++i) s[(o = q[i]).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 = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; - for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); - for (;i < na; ++i) c[i] = a[i]; - for (;i < nb; ++i) c[i] = b[i]; - return function(t) { - for (i = 0; i < n0; ++i) c[i] = x[i](t); - return c; - }; - } - var d3_ease_default = function() { - return d3_identity; - }; - var d3_ease = d3.map({ - linear: d3_ease_default, - poly: d3_ease_poly, - quad: function() { - return d3_ease_quad; - }, - cubic: function() { - return d3_ease_cubic; - }, - sin: function() { - return d3_ease_sin; - }, - exp: function() { - return d3_ease_exp; - }, - circle: function() { - return d3_ease_circle; - }, - elastic: d3_ease_elastic, - back: d3_ease_back, - bounce: function() { - return d3_ease_bounce; - } - }); - var d3_ease_mode = d3.map({ - "in": d3_identity, - out: d3_ease_reverse, - "in-out": d3_ease_reflect, - "out-in": function(f) { - return d3_ease_reflect(d3_ease_reverse(f)); - } - }); - d3.ease = function(name) { - var i = name.indexOf("-"), t = i >= 0 ? name.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 .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); - }; - } - function d3_ease_quad(t) { - return t * t; - } - function d3_ease_cubic(t) { - return t * t * t; - } - function d3_ease_cubicInOut(t) { - if (t <= 0) return 0; - if (t >= 1) return 1; - var t2 = t * t, t3 = t2 * t; - return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); - } - function d3_ease_poly(e) { - return function(t) { - return Math.pow(t, e); - }; - } - function d3_ease_sin(t) { - return 1 - Math.cos(t * halfπ); - } - function d3_ease_exp(t) { - return Math.pow(2, 10 * (t - 1)); - } - function d3_ease_circle(t) { - return 1 - Math.sqrt(1 - t * t); - } - function d3_ease_elastic(a, p) { - var s; - if (arguments.length < 2) p = .45; - if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4; - return function(t) { - return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p); - }; - } - function d3_ease_back(s) { - if (!s) s = 1.70158; - return function(t) { - return t * t * ((s + 1) * t - s); - }; - } - function d3_ease_bounce(t) { - return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; - } - d3.interpolateHcl = d3_interpolateHcl; - function d3_interpolateHcl(a, b) { - a = d3.hcl(a); - b = d3.hcl(b); - var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; - if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; - if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; - return function(t) { - return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; - }; - } - d3.interpolateHsl = d3_interpolateHsl; - function d3_interpolateHsl(a, b) { - a = d3.hsl(a); - b = d3.hsl(b); - var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; - if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; - if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; - return function(t) { - return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; - }; - } - d3.interpolateLab = d3_interpolateLab; - function d3_interpolateLab(a, b) { - a = d3.lab(a); - b = d3.lab(b); - var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; - return function(t) { - return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; - }; - } - d3.interpolateRound = d3_interpolateRound; - function d3_interpolateRound(a, b) { - b -= a; - return function(t) { - return Math.round(a + b * t); - }; - } - d3.transform = function(string) { - var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); - return (d3.transform = function(string) { - if (string != null) { - g.setAttribute("transform", string); - var t = g.transform.baseVal.consolidate(); - } - return new d3_transform(t ? t.matrix : d3_transformIdentity); - })(string); - }; - function d3_transform(m) { - var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; - if (r0[0] * r1[1] < r1[0] * r0[1]) { - r0[0] *= -1; - r0[1] *= -1; - kx *= -1; - kz *= -1; - } - this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; - this.translate = [ m.e, m.f ]; - this.scale = [ kx, ky ]; - this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; - } - d3_transform.prototype.toString = function() { - return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; - }; - function d3_transformDot(a, b) { - return a[0] * b[0] + a[1] * b[1]; - } - function d3_transformNormalize(a) { - var k = Math.sqrt(d3_transformDot(a, a)); - if (k) { - a[0] /= k; - a[1] /= k; - } - return k; - } - function d3_transformCombine(a, b, k) { - a[0] += k * b[0]; - a[1] += k * b[1]; - return a; - } - var d3_transformIdentity = { - a: 1, - b: 0, - c: 0, - d: 1, - e: 0, - f: 0 - }; - d3.interpolateTransform = d3_interpolateTransform; - function d3_interpolateTransformPop(s) { - return s.length ? s.pop() + "," : ""; - } - function d3_interpolateTranslate(ta, tb, s, q) { - if (ta[0] !== tb[0] || ta[1] !== tb[1]) { - var i = s.push("translate(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: d3_interpolateNumber(ta[0], tb[0]) - }, { - i: i - 2, - x: d3_interpolateNumber(ta[1], tb[1]) - }); - } else if (tb[0] || tb[1]) { - s.push("translate(" + tb + ")"); - } - } - function d3_interpolateRotate(ra, rb, s, q) { - if (ra !== rb) { - if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; - q.push({ - i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2, - x: d3_interpolateNumber(ra, rb) - }); - } else if (rb) { - s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")"); - } - } - function d3_interpolateSkew(wa, wb, s, q) { - if (wa !== wb) { - q.push({ - i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2, - x: d3_interpolateNumber(wa, wb) - }); - } else if (wb) { - s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")"); - } - } - function d3_interpolateScale(ka, kb, s, q) { - if (ka[0] !== kb[0] || ka[1] !== kb[1]) { - var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: d3_interpolateNumber(ka[0], kb[0]) - }, { - i: i - 2, - x: d3_interpolateNumber(ka[1], kb[1]) - }); - } else if (kb[0] !== 1 || kb[1] !== 1) { - s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")"); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + let author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure } - } - 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); + ``` + + Errback Example + + ```js + + function foundBooks(books) { + } - var k = points.length; - while (end !== lca) { - points.splice(k, 0, end); - end = end.parent; + + function failure(reason) { + } - return points; - } - function d3_layout_bundleAncestors(node) { - var ancestors = [], parent = node.parent; - while (parent != null) { - ancestors.push(node); - node = parent; - parent = parent.parent; + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: then, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); } - 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(); + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong } - return sharedNode; + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function _catch(onRejection) { + return this.then(null, onRejection); } - d3.layout.chord = function() { - var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; - function relayout() { - var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; - chords = []; - groups = []; - k = 0, i = -1; - while (++i < n) { - x = 0, j = -1; - while (++j < n) { - x += matrix[i][j]; +}; + +function polyfill() { + var local = undefined; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); } - groupSums.push(x); - subgroupIndex.push(d3.range(n)); - k += x; - } - if (sortGroups) { - groupIndex.sort(function(a, b) { - return sortGroups(groupSums[a], groupSums[b]); - }); - } - if (sortSubgroups) { - subgroupIndex.forEach(function(d, i) { - d.sort(function(a, b) { - return sortSubgroups(matrix[i][a], matrix[i][b]); - }); - }); - } - k = (τ - padding * n) / k; - x = 0, i = -1; - while (++i < n) { - x0 = x, j = -1; - while (++j < n) { - var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; - subgroups[di + "-" + dj] = { - index: di, - subindex: dj, - startAngle: a0, - endAngle: a1, - value: v - }; + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored } - groups[di] = { - index: di, - startAngle: x0, - endAngle: x, - value: groupSums[di] - }; - x += padding; - } - i = -1; - while (++i < n) { - j = i - 1; - while (++j < n) { - var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; - if (source.value || target.value) { - chords.push(source.value < target.value ? { - source: target, - target: source - } : { - source: source, - target: target - }); - } - } - } - if (sortChords) resort(); - } - function resort() { - chords.sort(function(a, b) { - return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); - }); - } - chord.matrix = function(x) { - if (!arguments.length) return matrix; - n = (matrix = x) && matrix.length; - chords = groups = null; - return chord; - }; - chord.padding = function(x) { - if (!arguments.length) return padding; - padding = x; - chords = groups = null; - return chord; - }; - chord.sortGroups = function(x) { - if (!arguments.length) return sortGroups; - sortGroups = x; - chords = groups = null; - return chord; - }; - chord.sortSubgroups = function(x) { - if (!arguments.length) return sortSubgroups; - sortSubgroups = x; - chords = null; - return chord; - }; - chord.sortChords = function(x) { - if (!arguments.length) return sortChords; - sortChords = x; - if (chords) resort(); - return chord; - }; - chord.chords = function() { - if (!chords) relayout(); - return chords; - }; - chord.groups = function() { - if (!groups) relayout(); - return groups; - }; - return chord; - }; - d3.layout.force = function() { - var force = {}, event = d3.dispatch("start", "tick", "end"), timer, size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges; - function repulse(node) { - return function(quad, x1, _, x2) { - if (quad.point !== node) { - var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; - if (dw * dw / theta2 < dn) { - if (dn < chargeDistance2) { - var k = quad.charge / dn; - node.px -= dx * k; - node.py -= dy * k; - } - return true; - } - if (quad.point && dn && dn < chargeDistance2) { - var k = quad.pointCharge / dn; - node.px -= dx * k; - node.py -= dy * k; - } - } - return !quad.charge; - }; - } - force.tick = function() { - if ((alpha *= .99) < .005) { - 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) : .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: 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, size) { - if (!neighbors) { - neighbors = new Array(n); - for (j = 0; j < n; ++j) { - neighbors[j] = []; - } - for (j = 0; j < m; ++j) { - var o = links[j]; - neighbors[o.source.index].push(o.target); - neighbors[o.target.index].push(o.source); - } - } - var candidates = neighbors[i], j = -1, l = candidates.length, x; - while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; - return Math.random() * size; - } - return force.resume(); - }; - force.resume = function() { - return force.alpha(.1); - }; - force.stop = function() { - return force.alpha(0); - }; - force.drag = function() { - if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); - if (!arguments.length) return drag; - this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); - }; - function dragmove(d) { - d.px = d3.event.x, d.py = d3.event.y; - force.resume(); - } - return d3.rebind(force, event, "on"); - }; - function d3_layout_forceDragstart(d) { - d.fixed |= 2; - } - function d3_layout_forceDragend(d) { - d.fixed &= ~6; - } - function d3_layout_forceMouseover(d) { - d.fixed |= 4; - d.px = d.x, d.py = d.y; - } - function d3_layout_forceMouseout(d) { - d.fixed &= ~4; - } - function d3_layout_forceAccumulate(quad, alpha, charges) { - var cx = 0, cy = 0; - quad.charge = 0; - if (!quad.leaf) { - var nodes = quad.nodes, n = nodes.length, i = -1, c; - while (++i < n) { - c = nodes[i]; - if (c == null) continue; - d3_layout_forceAccumulate(c, alpha, charges); - quad.charge += c.charge; - cx += c.charge * c.cx; - cy += c.charge * c.cy; - } - } - if (quad.point) { - if (!quad.leaf) { - quad.point.x += Math.random() - .5; - quad.point.y += Math.random() - .5; - } - var k = alpha * charges[quad.point.index]; - quad.charge += quad.pointCharge = k; - cx += k * quad.point.x; - cy += k * quad.point.y; - } - quad.cx = cx / quad.charge; - quad.cy = cy / quad.charge; - } - var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity; - d3.layout.hierarchy = function() { - var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; - function 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(node) { - var childs, parent; - if (sort && (childs = node.children)) childs.sort(sort); - if (value && (parent = node.parent)) parent.value += node.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), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / 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 + pa, - 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, i) { - return values.call(stack, d, i); - }); - var points = series.map(function(d) { - return d.map(function(v, i) { - return [ x.call(stack, v, i), y.call(stack, v, i) ]; - }); - }); - var orders = order.call(stack, points, index); - series = d3.permute(series, orders); - points = d3.permute(points, orders); - var offsets = offset.call(stack, points, index); - var 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(x) { - if (!arguments.length) return values; - values = x; - return stack; - }; - stack.order = function(x) { - if (!arguments.length) return order; - order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; - return stack; - }; - stack.offset = function(x) { - if (!arguments.length) return offset; - offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; - return stack; - }; - stack.x = function(z) { - if (!arguments.length) return x; - x = z; - return stack; - }; - stack.y = function(z) { - if (!arguments.length) return y; - y = z; - return stack; - }; - stack.out = function(z) { - if (!arguments.length) return out; - out = z; - return stack; - }; - return stack; - }; - function d3_layout_stackX(d) { - return d.x; - } - function d3_layout_stackY(d) { - return d.y; - } - function d3_layout_stackOut(d, y0, y) { - d.y0 = y0; - d.y = y; - } - var d3_layout_stackOrders = d3.map({ - "inside-out": function(data) { - var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { - return max[a] - max[b]; - }), top = 0, bottom = 0, tops = [], bottoms = []; - for (i = 0; i < n; ++i) { - j = index[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - return bottoms.reverse().concat(tops); - }, - reverse: function(data) { - return d3.range(data.length).reverse(); - }, - "default": d3_layout_stackOrderDefault - }); - var d3_layout_stackOffsets = d3.map({ - silhouette: function(data) { - var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; - for (j = 0; j < m; ++j) { - for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; - if (o > max) max = o; - sums.push(o); - } - for (j = 0; j < m; ++j) { - y0[j] = (max - sums[j]) / 2; - } - return y0; - }, - wiggle: function(data) { - var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; - y0[0] = o = o0 = 0; - for (j = 1; j < m; ++j) { - for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; - for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { - for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { - s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; - } - s2 += s3 * data[i][j][1]; - } - y0[j] = o -= s1 ? s2 / s1 * dx : 0; - if (o < o0) o0 = o; - } - for (j = 0; j < m; ++j) y0[j] -= o0; - return y0; - }, - expand: function(data) { - var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; - for (j = 0; j < m; ++j) { - for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; - if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; - } - for (j = 0; j < m; ++j) y0[j] = 0; - return y0; - }, - zero: d3_layout_stackOffsetZero - }); - function d3_layout_stackOrderDefault(data) { - return d3.range(data.length); - } - function d3_layout_stackOffsetZero(data) { - var j = -1, m = data[0].length, y0 = []; - while (++j < m) y0[j] = 0; - return y0; - } - function d3_layout_stackMaxIndex(array) { - var i = 1, j = 0, v = array[0][1], k, n = array.length; - for (;i < n; ++i) { - if ((k = array[i][1]) > v) { - j = i; - v = k; - } - } - return j; - } - function d3_layout_stackReduceSum(d) { - return d.reduce(d3_layout_stackSum, 0); - } - function d3_layout_stackSum(p, d) { - return p + d[1]; - } - d3.layout.histogram = function() { - var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; - function histogram(data, i) { - var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; - while (++i < m) { - bin = bins[i] = []; - bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); - bin.y = 0; - } - if (m > 0) { - i = -1; - while (++i < n) { - x = values[i]; - if (x >= range[0] && x <= range[1]) { - bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; - bin.y += k; - bin.push(data[i]); - } - } - } - return bins; - } - histogram.value = function(x) { - if (!arguments.length) return valuer; - valuer = x; - return histogram; - }; - histogram.range = function(x) { - if (!arguments.length) return ranger; - ranger = d3_functor(x); - return histogram; - }; - histogram.bins = function(x) { - if (!arguments.length) return binner; - binner = typeof x === "number" ? function(range) { - return d3_layout_histogramBinFixed(range, x); - } : d3_functor(x); - return histogram; - }; - histogram.frequency = function(x) { - if (!arguments.length) return frequency; - frequency = !!x; - return histogram; - }; - return histogram; - }; - function d3_layout_histogramBinSturges(range, values) { - return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); - } - function d3_layout_histogramBinFixed(range, n) { - var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; - while (++x <= n) f[x] = m * x + b; - return f; - } - function d3_layout_histogramRange(values) { - return [ d3.min(values), d3.max(values) ]; - } - d3.layout.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(d) { - d.r = +r(d.value); - }); - d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); - if (padding) { - var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; - d3_layout_hierarchyVisitAfter(root, function(d) { - d.r += dr; - }); - d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); - d3_layout_hierarchyVisitAfter(root, function(d) { - d.r -= dr; - }); - } - d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); - return nodes; - } - pack.size = function(_) { - if (!arguments.length) return size; - size = _; - return pack; - }; - pack.radius = function(_) { - if (!arguments.length) return radius; - radius = _ == null || typeof _ === "function" ? _ : +_; - return pack; - }; - pack.padding = function(_) { - if (!arguments.length) return padding; - padding = +_; - return pack; - }; - return d3_layout_hierarchyRebind(pack, hierarchy); - }; - function d3_layout_packSort(a, b) { - return a.value - b.value; - } - function d3_layout_packInsert(a, b) { - var c = a._pack_next; - a._pack_next = b; - b._pack_prev = a; - b._pack_next = c; - c._pack_prev = b; - } - function d3_layout_packSplice(a, b) { - a._pack_next = b; - b._pack_prev = a; - } - function d3_layout_packIntersects(a, b) { - var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; - return .999 * dr * dr > dx * dx + dy * dy; - } - function d3_layout_packSiblings(node) { - if (!(nodes = node.children) || !(n = nodes.length)) return; - var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; - function bound(node) { - xMin = Math.min(node.x - node.r, xMin); - xMax = Math.max(node.x + node.r, xMax); - yMin = Math.min(node.y - node.r, yMin); - yMax = Math.max(node.y + node.r, yMax); - } - nodes.forEach(d3_layout_packLink); - a = nodes[0]; - a.x = -a.r; - a.y = 0; - bound(a); - if (n > 1) { - b = nodes[1]; - b.x = b.r; - b.y = 0; - bound(b); - if (n > 2) { - c = nodes[2]; - d3_layout_packPlace(a, b, c); - bound(c); - d3_layout_packInsert(a, c); - a._pack_prev = c; - d3_layout_packInsert(c, b); - b = a._pack_next; - for (i = 3; i < n; i++) { - d3_layout_packPlace(a, b, c = nodes[i]); - var isect = 0, s1 = 1, s2 = 1; - for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { - if (d3_layout_packIntersects(j, c)) { - isect = 1; - break; - } - } - if (isect == 1) { - for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { - if (d3_layout_packIntersects(k, c)) { - break; - } - } - } - if (isect) { - if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); - i--; - } else { - d3_layout_packInsert(a, c); - b = c; - bound(c); - } - } - } - } - var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; - for (i = 0; i < n; i++) { - c = nodes[i]; - c.x -= cx; - c.y -= cy; - cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); - } - node.r = cr; - nodes.forEach(d3_layout_packUnlink); - } - function d3_layout_packLink(node) { - node._pack_next = node._pack_prev = node; - } - function d3_layout_packUnlink(node) { - delete node._pack_next; - delete node._pack_prev; - } - function d3_layout_packTransform(node, x, y, k) { - var children = node.children; - node.x = x += k * node.x; - node.y = y += k * node.y; - node.r *= k; - if (children) { - var i = -1, n = children.length; - while (++i < n) d3_layout_packTransform(children[i], x, y, k); - } - } - function d3_layout_packPlace(a, b, c) { - var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; - if (db && (dx || dy)) { - var da = b.r + c.r, dc = dx * dx + dy * dy; - da *= da; - db *= db; - var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); - c.x = a.x + x * dx + y * dy; - c.y = a.y + x * dy - y * dx; - } else { - c.x = a.x + db; - c.y = a.y; - } - } - d3.layout.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: 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, wp, shift) { - var change = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.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), x0 = left.x - separation(left, right) / 2, x1 = 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 - x0) / (x1 - x0) * size[0]; - node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; - }); - return nodes; - } - cluster.separation = function(x) { - if (!arguments.length) return separation; - separation = x; - return cluster; - }; - cluster.size = function(x) { - if (!arguments.length) return nodeSize ? null : size; - nodeSize = (size = x) == null; - return cluster; - }; - cluster.nodeSize = function(x) { - if (!arguments.length) return nodeSize ? size : null; - nodeSize = (size = x) != null; - return cluster; - }; - return d3_layout_hierarchyRebind(cluster, hierarchy); - }; - function d3_layout_clusterY(children) { - return 1 + d3.max(children, function(child) { - return child.y; - }); - } - function d3_layout_clusterX(children) { - return children.reduce(function(x, child) { - return x + child.x; - }, 0) / children.length; - } - function d3_layout_clusterLeft(node) { - var children = node.children; - return children && children.length ? d3_layout_clusterLeft(children[0]) : node; - } - function d3_layout_clusterRight(node) { - var children = node.children, n; - return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; - } - d3.layout.treemap = function() { - var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); - function scale(children, k) { - var i = -1, n = children.length, child, area; - while (++i < n) { - area = (child = children[i]).value * (k < 0 ? 0 : k); - child.area = isNaN(area) || area <= 0 ? 0 : area; - } - } - function squarify(node) { - var children = node.children; - if (children && children.length) { - var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; - scale(remaining, rect.dx * rect.dy / node.value); - row.area = 0; - while ((n = remaining.length) > 0) { - row.push(child = remaining[n - 1]); - row.area += child.area; - if (mode !== "squarify" || (score = worst(row, u)) <= best) { - remaining.pop(); - best = score; - } else { - row.area -= row.pop().area; - position(row, u, rect, false); - u = Math.min(rect.dx, rect.dy); - row.length = row.area = 0; - best = Infinity; - } - } - if (row.length) { - position(row, u, rect, true); - row.length = row.area = 0; - } - children.forEach(squarify); - } - } - function stickify(node) { - var children = node.children; - if (children && children.length) { - var rect = pad(node), remaining = children.slice(), child, row = []; - scale(remaining, rect.dx * rect.dy / node.value); - row.area = 0; - while (child = remaining.pop()) { - row.push(child); - row.area += child.area; - if (child.z != null) { - position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); - row.length = row.area = 0; - } - } - children.forEach(stickify); - } - } - function worst(row, u) { - var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; - while (++i < n) { - if (!(r = row[i].area)) continue; - if (r < rmin) rmin = r; - if (r > rmax) rmax = r; - } - s *= s; - u *= u; - return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; - } - function position(row, u, rect, flush) { - var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; - if (u == rect.dx) { - if (flush || v > rect.dy) v = rect.dy; - while (++i < n) { - o = row[i]; - o.x = x; - o.y = y; - o.dy = v; - x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); - } - o.z = true; - o.dx += rect.x + rect.dx - x; - rect.y += v; - rect.dy -= v; - } else { - if (flush || v > rect.dx) v = rect.dx; - while (++i < n) { - o = row[i]; - o.x = x; - o.y = y; - o.dx = v; - y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); - } - o.z = false; - o.dy += rect.y + rect.dy - y; - rect.x += v; - rect.dx -= v; - } - } - function treemap(d) { - var nodes = stickies || hierarchy(d), root = nodes[0]; - root.x = 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; - pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], - padConstant) : padConstant; - return treemap; - }; - treemap.round = function(x) { - if (!arguments.length) return round != Number; - round = x ? Math.round : Number; - return treemap; - }; - treemap.sticky = function(x) { - if (!arguments.length) return sticky; - sticky = x; - stickies = null; - return treemap; - }; - treemap.ratio = function(x) { - if (!arguments.length) return ratio; - ratio = x; - return treemap; - }; - treemap.mode = function(x) { - if (!arguments.length) return mode; - mode = x + ""; - return treemap; - }; - return d3_layout_hierarchyRebind(treemap, hierarchy); - }; - function d3_layout_treemapPadNull(node) { - return { - x: node.x, - y: node.y, - dx: node.dx, - dy: node.dy - }; - } - function d3_layout_treemapPad(node, padding) { - var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; - if (dx < 0) { - x += dx / 2; - dx = 0; - } - if (dy < 0) { - y += dy / 2; - dy = 0; - } - return { - x: x, - y: y, - dx: dx, - dy: dy - }; - } - d3.random = { - normal: function(µ, σ) { - var n = arguments.length; - if (n < 2) σ = 1; - if (n < 1) µ = 0; - return function() { - var x, y, r; - do { - x = Math.random() * 2 - 1; - y = Math.random() * 2 - 1; - r = x * x + y * y; - } while (!r || r > 1); - return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); - }; - }, - logNormal: function() { - var random = d3.random.normal.apply(d3, arguments); - return function() { - return Math.exp(random()); - }; - }, - bates: function(m) { - var random = d3.random.irwinHall(m); - return function() { - return random() / m; - }; - }, - irwinHall: function(m) { - return function() { - for (var s = 0, j = 0; j < m; j++) s += Math.random(); - return s; - }; - } - }; - d3.scale = {}; - function d3_scaleExtent(domain) { - var start = domain[0], stop = domain[domain.length - 1]; - return start < stop ? [ start, stop ] : [ stop, start ]; - } - function d3_scaleRange(scale) { - return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); - } - function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { - var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); - return function(x) { - return i(u(x)); - }; - } - function d3_scale_nice(domain, nice) { - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; - if (x1 < x0) { - dx = i0, i0 = i1, i1 = dx; - dx = x0, x0 = x1, x1 = dx; - } - domain[i0] = nice.floor(x0); - domain[i1] = nice.ceil(x1); - return domain; - } - function d3_scale_niceStep(step) { - return step ? { - floor: function(x) { - return Math.floor(x / step) * step; - }, - ceil: function(x) { - return Math.ceil(x / step) * step; - } - } : d3_scale_niceIdentity; - } - var d3_scale_niceIdentity = { - floor: d3_identity, - ceil: d3_identity - }; - function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { - var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; - if (domain[k] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - while (++j <= k) { - u.push(uninterpolate(domain[j - 1], domain[j])); - i.push(interpolate(range[j - 1], range[j])); - } - return function(x) { - var j = d3.bisect(domain, x, 1, k) - 1; - return i[j](u[j](x)); - }; - } - d3.scale.linear = function() { - return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); - }; - function d3_scale_linear(domain, range, interpolate, clamp) { - var output, input; - function rescale() { - var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; - output = linear(domain, range, uninterpolate, interpolate); - input = linear(range, domain, uninterpolate, d3_interpolate); - return scale; - } - function scale(x) { - return output(x); - } - scale.invert = function(y) { - return input(y); - }; - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = x.map(Number); - return rescale(); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - scale.rangeRound = function(x) { - return scale.range(x).interpolate(d3_interpolateRound); - }; - scale.clamp = function(x) { - if (!arguments.length) return clamp; - clamp = x; - return rescale(); - }; - scale.interpolate = function(x) { - if (!arguments.length) return interpolate; - interpolate = x; - return rescale(); - }; - scale.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - scale.tickFormat = function(m, format) { - return d3_scale_linearTickFormat(domain, m, format); - }; - scale.nice = function(m) { - d3_scale_linearNice(domain, m); - return rescale(); - }; - scale.copy = function() { - return d3_scale_linear(domain, range, interpolate, clamp); - }; - return rescale(); - } - function d3_scale_linearRebind(scale, linear) { - return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); - } - function d3_scale_linearNice(domain, m) { - 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 <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; - extent[0] = Math.ceil(extent[0] / step) * step; - extent[1] = Math.floor(extent[1] / step) * step + step * .5; - extent[2] = step; - return extent; - } - function d3_scale_linearTicks(domain, m) { - return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); - } - function d3_scale_linearTickFormat(domain, m, format) { - var range = d3_scale_linearTickRange(domain, m); - if (format) { - var match = d3_format_re.exec(format); - match.shift(); - if (match[8] === "s") { - var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1]))); - if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2])); - match[8] = "f"; - format = d3.format(match.join("")); - return function(d) { - return format(prefix.scale(d)) + prefix.symbol; - }; - } - if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range); - format = match.join(""); - } else { - format = ",." + d3_scale_linearPrecision(range[2]) + "f"; - } - return d3.format(format); - } - var d3_scale_linearFormatSignificant = { - s: 1, - g: 1, - p: 1, - r: 1, - e: 1 - }; - function d3_scale_linearPrecision(value) { - return -Math.floor(Math.log(value) / Math.LN10 + .01); - } - function d3_scale_linearFormatPrecision(type, range) { - var p = d3_scale_linearPrecision(range[2]); - return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; - } - d3.scale.log = function() { - return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); - }; - function d3_scale_log(linear, base, positive, domain) { - function log(x) { - return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); - } - function pow(x) { - return positive ? Math.pow(base, x) : -Math.pow(base, -x); - } - function scale(x) { - return linear(log(x)); - } - scale.invert = function(x) { - return pow(linear.invert(x)); - }; - scale.domain = function(x) { - if (!arguments.length) return domain; - positive = x[0] >= 0; - linear.domain((domain = x.map(Number)).map(log)); - return scale; - }; - scale.base = function(_) { - if (!arguments.length) return base; - base = +_; - linear.domain(domain.map(log)); - return scale; - }; - scale.nice = function() { - var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative); - linear.domain(niced); - domain = niced.map(pow); - return scale; - }; - scale.ticks = function() { - var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base; - if (isFinite(j - i)) { - if (positive) { - for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k); - ticks.push(pow(i)); - } else { - ticks.push(pow(i)); - for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k); - } - for (i = 0; ticks[i] < u; i++) {} - for (j = ticks.length; ticks[j - 1] > v; j--) {} - ticks = ticks.slice(i, j); - } - return ticks; - }; - scale.tickFormat = function(n, format) { - if (!arguments.length) return d3_scale_logFormat; - if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); - var k = Math.max(1, base * n / scale.ticks().length); - return function(d) { - var i = d / pow(Math.round(log(d))); - if (i * base < base - .5) i *= base; - return i <= k ? format(d) : ""; - }; - }; - scale.copy = function() { - return d3_scale_log(linear.copy(), base, positive, domain); - }; - return d3_scale_linearRebind(scale, linear); - } - var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { - floor: function(x) { - return -Math.ceil(-x); - }, - ceil: function(x) { - return -Math.floor(-x); - } - }; - d3.scale.pow = function() { - return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]); - }; - function d3_scale_pow(linear, exponent, domain) { - var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); - function scale(x) { - return linear(powp(x)); - } - scale.invert = function(x) { - return powb(linear.invert(x)); - }; - scale.domain = function(x) { - if (!arguments.length) return domain; - linear.domain((domain = x.map(Number)).map(powp)); - return scale; - }; - scale.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - scale.tickFormat = function(m, format) { - return d3_scale_linearTickFormat(domain, m, format); - }; - scale.nice = function(m) { - return scale.domain(d3_scale_linearNice(domain, m)); - }; - scale.exponent = function(x) { - if (!arguments.length) return exponent; - powp = d3_scale_powPow(exponent = x); - powb = d3_scale_powPow(1 / exponent); - linear.domain(domain.map(powp)); - return scale; - }; - scale.copy = function() { - return d3_scale_pow(linear.copy(), exponent, domain); - }; - return d3_scale_linearRebind(scale, linear); - } - function d3_scale_powPow(e) { - return function(x) { - return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); - }; - } - d3.scale.sqrt = function() { - return d3.scale.pow().exponent(.5); - }; - d3.scale.ordinal = function() { - return d3_scale_ordinal([], { - t: "range", - a: [ [] ] - }); - }; - function d3_scale_ordinal(domain, ranger) { - var index, range, rangeBand; - function scale(x) { - return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length]; - } - function steps(start, step) { - return d3.range(domain.length).map(function(i) { - return start + step * i; - }); - } - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = []; - index = new d3_Map(); - var i = -1, n = x.length, xi; - while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); - return scale[ranger.t].apply(scale, ranger.a); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - rangeBand = 0; - ranger = { - t: "range", - a: arguments - }; - return scale; - }; - scale.rangePoints = function(x, padding) { - if (arguments.length < 2) padding = 0; - var start = x[0], stop = x[1], step = 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(x0, x1, range) { - var kx, i; - function scale(x) { - return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; - } - function rescale() { - kx = range.length / (x1 - x0); - i = range.length - 1; - return scale; - } - scale.domain = function(x) { - if (!arguments.length) return [ x0, x1 ]; - x0 = +x[0]; - x1 = +x[x.length - 1]; - return rescale(); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - scale.invertExtent = function(y) { - y = range.indexOf(y); - y = y < 0 ? NaN : y / kx + x0; - return [ y, y + 1 / kx ]; - }; - scale.copy = function() { - return d3_scale_quantize(x0, x1, range); - }; - return rescale(); - } - d3.scale.threshold = function() { - return d3_scale_threshold([ .5 ], [ 0, 1 ]); - }; - function d3_scale_threshold(domain, range) { - function scale(x) { - if (x <= x) return range[d3.bisect(domain, x)]; - } - scale.domain = function(_) { - if (!arguments.length) return domain; - domain = _; - return scale; - }; - scale.range = function(_) { - if (!arguments.length) return range; - range = _; - return scale; - }; - scale.invertExtent = function(y) { - y = range.indexOf(y); - return [ domain[y - 1], domain[y] ]; - }; - scale.copy = function() { - return d3_scale_threshold(domain, range); - }; - return scale; - } - d3.scale.identity = function() { - return d3_scale_identity([ 0, 1 ]); - }; - function d3_scale_identity(domain) { - function identity(x) { - return +x; - } - identity.invert = identity; - identity.domain = identity.range = function(x) { - if (!arguments.length) return domain; - domain = x.map(identity); - return identity; - }; - identity.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - identity.tickFormat = function(m, format) { - return d3_scale_linearTickFormat(domain, m, format); - }; - identity.copy = function() { - return d3_scale_identity(domain); - }; - return identity; - } - d3.svg = {}; - 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 r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfπ, a1 = endAngle.apply(this, arguments) - halfπ, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1; - if (r1 < r0) rc = r1, r1 = r0, r0 = rc; - if (da >= τε) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : "") + "Z"; - var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = []; - if (ap = (+padAngle.apply(this, arguments) || 0) / 2) { - rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments); - if (!cw) p1 *= -1; - if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap)); - if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap)); - } - if (r1) { - x0 = r1 * Math.cos(a0 + p1); - y0 = r1 * Math.sin(a0 + p1); - x1 = r1 * Math.cos(a1 - p1); - y1 = r1 * Math.sin(a1 - p1); - var l1 = Math.abs(a1 - a0 - 2 * p1) <= π ? 0 : 1; - if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) { - var h1 = (a0 + a1) / 2; - x0 = r1 * Math.cos(h1); - y0 = r1 * Math.sin(h1); - x1 = y1 = null; - } - } else { - x0 = y0 = 0; - } - if (r0) { - x2 = r0 * Math.cos(a1 - p0); - y2 = r0 * Math.sin(a1 - p0); - x3 = r0 * Math.cos(a0 + p0); - y3 = r0 * Math.sin(a0 + p0); - var l0 = Math.abs(a0 - a1 + 2 * p0) <= π ? 0 : 1; - if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) { - var h0 = (a0 + a1) / 2; - x2 = r0 * Math.cos(h0); - y2 = r0 * Math.sin(h0); - x3 = y3 = null; - } - } else { - x2 = y2 = 0; - } - if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) { - cr = r0 < r1 ^ cw ? 0 : 1; - var rc1 = rc, rc0 = rc; - if (da < π) { - var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); - rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); - } - if (x1 != null) { - var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw); - if (rc === rc1) { - path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]); - } else { - path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr, " ", t12[0]); - } - } else { - path.push("M", x0, ",", y0); - } - if (x3 != null) { - var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw); - if (rc === rc0) { - path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 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,", cr, " ", t03[0]); - } else { - path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); - } - } else { - path.push("L", x2, ",", y2); - } - } else { - path.push("M", x0, ",", y0); - if (x1 != null) path.push("A", r1, ",", r1, " 0 ", l1, ",", cw, " ", x1, ",", y1); - path.push("L", x2, ",", y2); - if (x3 != null) path.push("A", r0, ",", r0, " 0 ", l0, ",", 1 - cw, " ", x3, ",", y3); - } - path.push("Z"); - return path.join(""); - } - function circleSegment(r1, cw) { - return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1; - } - 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(x0, y0, x1, y1) { - return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1; - } - function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) { - var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * 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 * r1 / r, cy0 * r1 / r ] ]; - } - function d3_svg_line(projection) { - var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; - function line(data) { - var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); - function segment() { - segments.push("M", interpolate(projection(points), tension)); - } - while (++i < n) { - if (defined.call(this, d = data[i], i)) { - points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); - } else if (points.length) { - segment(); - points = []; - } - } - if (points.length) segment(); - return segments.length ? segments.join("") : null; - } - line.x = function(_) { - if (!arguments.length) return x; - x = _; - return line; - }; - line.y = function(_) { - if (!arguments.length) return y; - y = _; - return line; - }; - line.defined = function(_) { - if (!arguments.length) return defined; - defined = _; - return line; - }; - line.interpolate = function(_) { - if (!arguments.length) return interpolateKey; - if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; - return line; - }; - line.tension = function(_) { - if (!arguments.length) return tension; - tension = _; - return line; - }; - return line; - } - d3.svg.line = function() { - return d3_svg_line(d3_identity); - }; - var d3_svg_lineInterpolators = d3.map({ - linear: d3_svg_lineLinear, - "linear-closed": d3_svg_lineLinearClosed, - step: d3_svg_lineStep, - "step-before": d3_svg_lineStepBefore, - "step-after": d3_svg_lineStepAfter, - basis: d3_svg_lineBasis, - "basis-open": d3_svg_lineBasisOpen, - "basis-closed": d3_svg_lineBasisClosed, - bundle: d3_svg_lineBundle, - cardinal: d3_svg_lineCardinal, - "cardinal-open": d3_svg_lineCardinalOpen, - "cardinal-closed": d3_svg_lineCardinalClosed, - monotone: d3_svg_lineMonotone - }); - d3_svg_lineInterpolators.forEach(function(key, value) { - value.key = key; - value.closed = /-closed$/.test(key); - }); - function d3_svg_lineLinear(points) { - return points.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 = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; - if (quad) { - path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; - p0 = points[1]; - pi = 2; - } - if (tangents.length > 1) { - t = tangents[1]; - p = points[pi]; - pi++; - path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; - for (var i = 2; i < tangents.length; i++, pi++) { - p = points[pi]; - t = tangents[i]; - path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; - } - } - if (quad) { - var lp = points[pi]; - path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; - } - return path; - } - function d3_svg_lineCardinalTangents(points, tension) { - var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; - while (++i < n) { - p0 = p1; - p1 = p2; - p2 = points[i]; - tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); - } - return tangents; - } - function d3_svg_lineBasis(points) { - if (points.length < 3) return d3_svg_lineLinear(points); - var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; - points.push(points[n - 1]); - while (++i <= n) { - pi = points[i]; - px.shift(); - px.push(pi[0]); - py.shift(); - py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - points.pop(); - path.push("L", pi); - return path.join(""); - } - function d3_svg_lineBasisOpen(points) { - if (points.length < 4) return d3_svg_lineLinear(points); - var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; - while (++i < 3) { - pi = points[i]; - px.push(pi[0]); - py.push(pi[1]); - } - path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); - --i; - while (++i < n) { - pi = points[i]; - px.shift(); - px.push(pi[0]); - py.shift(); - py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); - } - function d3_svg_lineBasisClosed(points) { - var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; - while (++i < 4) { - pi = points[i % n]; - px.push(pi[0]); - py.push(pi[1]); - } - path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; - --i; - while (++i < m) { - pi = points[i % n]; - px.shift(); - px.push(pi[0]); - py.shift(); - py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); - } - function d3_svg_lineBundle(points, tension) { - var n = points.length - 1; - if (n) { - var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; - while (++i <= n) { - p = points[i]; - t = i / n; - p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); - p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); - } - } - return d3_svg_lineBasis(points); - } - function d3_svg_lineDot4(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; - } - var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; - function d3_svg_lineBasisBezier(path, x, y) { - path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); - } - function d3_svg_lineSlope(p0, p1) { - return (p1[1] - p0[1]) / (p1[0] - p0[0]); - } - function d3_svg_lineFiniteDifferences(points) { - var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); - while (++i < j) { - m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; - } - m[i] = d; - return m; - } - function d3_svg_lineMonotoneTangents(points) { - var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; - while (++i < j) { - d = d3_svg_lineSlope(points[i], points[i + 1]); - if (abs(d) < ε) { - m[i] = m[i + 1] = 0; - } else { - a = m[i] / d; - b = m[i + 1] / d; - s = a * a + b * b; - if (s > 9) { - s = d * 3 / Math.sqrt(s); - m[i] = s * a; - m[i + 1] = s * b; - } - } - } - i = -1; - while (++i <= j) { - s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); - tangents.push([ s || 0, m[i] * s || 0 ]); - } - return tangents; - } - function d3_svg_lineMonotone(points) { - return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); - } - d3.svg.line.radial = function() { - var line = d3_svg_line(d3_svg_lineRadial); - line.radius = line.x, delete line.x; - line.angle = line.y, delete line.y; - return line; - }; - function d3_svg_lineRadial(points) { - var point, i = -1, n = points.length, r, a; - while (++i < n) { - point = points[i]; - r = point[0]; - a = point[1] - halfπ; - point[0] = r * Math.cos(a); - point[1] = r * Math.sin(a); - } - return points; - } - function d3_svg_area(projection) { - var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; - function area(data) { - var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { - return x; - } : d3_functor(x1), fy1 = y0 === y1 ? function() { - return y; - } : d3_functor(y1), x, y; - function segment() { - segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); - } - while (++i < n) { - if (defined.call(this, d = data[i], i)) { - points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); - points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); - } else if (points0.length) { - segment(); - points0 = []; - points1 = []; - } - } - if (points0.length) segment(); - return segments.length ? segments.join("") : null; - } - area.x = function(_) { - if (!arguments.length) return x1; - x0 = x1 = _; - return area; - }; - area.x0 = function(_) { - if (!arguments.length) return x0; - x0 = _; - return area; - }; - area.x1 = function(_) { - if (!arguments.length) return x1; - x1 = _; - return area; - }; - area.y = function(_) { - if (!arguments.length) return y1; - y0 = y1 = _; - return area; - }; - area.y0 = function(_) { - if (!arguments.length) return y0; - y0 = _; - return area; - }; - area.y1 = function(_) { - if (!arguments.length) return y1; - y1 = _; - return area; - }; - area.defined = function(_) { - if (!arguments.length) return defined; - defined = _; - return area; - }; - area.interpolate = function(_) { - if (!arguments.length) return interpolateKey; - if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; - interpolateReverse = interpolate.reverse || interpolate; - L = interpolate.closed ? "M" : "L"; - return area; - }; - area.tension = function(_) { - if (!arguments.length) return tension; - tension = _; - return area; - }; - return area; - } - d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; - d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; - d3.svg.area = function() { - return d3_svg_area(d3_identity); - }; - d3.svg.area.radial = function() { - var area = d3_svg_area(d3_svg_lineRadial); - area.radius = area.x, delete area.x; - area.innerRadius = area.x0, delete area.x0; - area.outerRadius = area.x1, delete area.x1; - area.angle = area.y, delete area.y; - area.startAngle = area.y0, delete area.y0; - area.endAngle = area.y1, delete area.y1; - return area; - }; - d3.svg.chord = function() { - var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; - function chord(d, i) { - var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); - return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; - } - function subgroup(self, f, d, i) { - var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ; - return { - r: r, - a0: a0, - a1: a1, - p0: [ r * Math.cos(a0), r * Math.sin(a0) ], - p1: [ r * Math.cos(a1), r * Math.sin(a1) ] - }; - } - function equals(a, b) { - return a.a0 == b.a0 && a.a1 == b.a1; - } - function arc(r, p, a) { - return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; - } - function curve(r0, p0, r1, p1) { - return "Q 0,0 " + p1; - } - chord.radius = function(v) { - if (!arguments.length) return radius; - radius = d3_functor(v); - return chord; - }; - chord.source = function(v) { - if (!arguments.length) return source; - source = d3_functor(v); - return chord; - }; - chord.target = function(v) { - if (!arguments.length) return target; - target = d3_functor(v); - return chord; - }; - chord.startAngle = function(v) { - if (!arguments.length) return startAngle; - startAngle = d3_functor(v); - return chord; - }; - chord.endAngle = function(v) { - if (!arguments.length) return endAngle; - endAngle = d3_functor(v); - return chord; - }; - return chord; - }; - function d3_svg_chordRadius(d) { - return d.radius; - } - d3.svg.diagonal = function() { - var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; - function diagonal(d, i) { - var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { - x: p0.x, - y: m - }, { - x: p3.x, - y: m - }, p3 ]; - p = p.map(projection); - return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; - } - diagonal.source = function(x) { - if (!arguments.length) return source; - source = d3_functor(x); - return diagonal; - }; - diagonal.target = function(x) { - if (!arguments.length) return target; - target = d3_functor(x); - return diagonal; - }; - diagonal.projection = function(x) { - if (!arguments.length) return projection; - projection = x; - return diagonal; - }; - return diagonal; - }; - function d3_svg_diagonalProjection(d) { - return [ d.x, d.y ]; - } - d3.svg.diagonal.radial = function() { - var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; - diagonal.projection = function(x) { - return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; - }; - return diagonal; - }; - function d3_svg_diagonalRadialProjection(projection) { - return function() { - var d = projection.apply(this, arguments), r = d[0], a = d[1] - 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 + ",0" + "Z"; - }, - square: function(size) { - var r = Math.sqrt(size) / 2; - return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; - }, - "triangle-down": function(size) { - var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; - return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; - }, - "triangle-up": function(size) { - var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; - return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; - } - }); - d3.svg.symbolTypes = d3_svg_symbols.keys(); - var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); - d3_selectionPrototype.transition = function(name) { - var id = d3_transitionInheritId || ++d3_transitionId, ns = 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, ns, id, transition); - subgroup.push(node); - } - } - return d3_transition(subgroups, ns, id); - }; - 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(ns) { - return function() { - var lock, activeId, active; - if ((lock = this[ns]) && (active = lock[activeId = lock.active])) { - active.timer.c = null; - active.timer.t = NaN; - if (--lock.count) delete lock[activeId]; else delete this[ns]; - lock.active += .5; - active.event && active.event.interrupt.call(this, this.__data__, active.index); - } - }; - } - function d3_transition(groups, ns, id) { - d3_subclass(groups, d3_transitionPrototype); - groups.namespace = ns; - groups.id = id; - return groups; - } - var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit; - d3_transitionPrototype.call = d3_selectionPrototype.call; - d3_transitionPrototype.empty = d3_selectionPrototype.empty; - d3_transitionPrototype.node = d3_selectionPrototype.node; - d3_transitionPrototype.size = d3_selectionPrototype.size; - d3.transition = function(selection, 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 id = this.id, ns = 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, ns, id, node[ns][id]); - subgroup.push(subnode); - } else { - subgroup.push(null); - } - } - } - return d3_transition(subgroups, ns, id); - }; - d3_transitionPrototype.selectAll = function(selector) { - var id = this.id, ns = 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[ns][id]; - subnodes = selector.call(node, node.__data__, i, j); - subgroups.push(subgroup = []); - for (var k = -1, o = subnodes.length; ++k < o; ) { - if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition); - subgroup.push(subnode); - } - } - } - } - return d3_transition(subgroups, ns, id); - }; - d3_transitionPrototype.filter = function(filter) { - var subgroups = [], subgroup, group, node; - if (typeof filter !== "function") filter = d3_selection_filter(filter); - for (var j = 0, m = this.length; j < m; j++) { - subgroups.push(subgroup = []); - for (var group = this[j], i = 0, n = group.length; i < n; i++) { - if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { - subgroup.push(node); - } - } - } - return d3_transition(subgroups, this.namespace, this.id); - }; - d3_transitionPrototype.tween = function(name, tween) { - var id = this.id, ns = this.namespace; - if (arguments.length < 2) return this.node()[ns][id].tween.get(name); - return d3_selection_each(this, tween == null ? function(node) { - node[ns][id].tween.remove(name); - } : function(node) { - node[ns][id].tween.set(name, tween); - }); - }; - function d3_transition_tween(groups, name, value, tween) { - var id = groups.id, ns = groups.namespace; - return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { - node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j))); - } : (value = tween(value), function(node) { - node[ns][id].tween.set(name, value); - })); - } - d3_transitionPrototype.attr = function(nameNS, value) { - if (arguments.length < 2) { - for (value in nameNS) this.attr(value, nameNS[value]); - return this; - } - var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); - function attrNull() { - this.removeAttribute(name); - } - function attrNullNS() { - this.removeAttributeNS(name.space, name.local); - } - function attrTween(b) { - return b == null ? attrNull : (b += "", function() { - var a = this.getAttribute(name), i; - return a !== b && (i = interpolate(a, b), function(t) { - this.setAttribute(name, i(t)); - }); - }); - } - function attrTweenNS(b) { - return b == null ? attrNullNS : (b += "", function() { - var a = this.getAttributeNS(name.space, name.local), i; - return a !== b && (i = interpolate(a, b), function(t) { - this.setAttributeNS(name.space, name.local, i(t)); - }); - }); - } - return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween); - }; - d3_transitionPrototype.attrTween = function(nameNS, tween) { - var name = d3.ns.qualify(nameNS); - function attrTween(d, i) { - var f = tween.call(this, d, i, this.getAttribute(name)); - return f && function(t) { - this.setAttribute(name, f(t)); - }; - } - function attrTweenNS(d, i) { - var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); - return f && function(t) { - this.setAttributeNS(name.space, name.local, f(t)); - }; - } - return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); - }; - d3_transitionPrototype.style = function(name, value, priority) { - var n = arguments.length; - if (n < 3) { - if (typeof name !== "string") { - if (n < 2) value = ""; - for (priority in name) this.style(priority, name[priority], value); - return this; - } - priority = ""; - } - function styleNull() { - this.style.removeProperty(name); - } - function styleString(b) { - return b == null ? styleNull : (b += "", function() { - var a = d3_window(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 ns = this.namespace; - return this.each("end.transition", function() { - var p; - if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this); - }); - }; - d3_transitionPrototype.ease = function(value) { - var id = this.id, ns = this.namespace; - if (arguments.length < 1) return this.node()[ns][id].ease; - if (typeof value !== "function") value = d3.ease.apply(d3, arguments); - return d3_selection_each(this, function(node) { - node[ns][id].ease = value; - }); - }; - d3_transitionPrototype.delay = function(value) { - var id = this.id, ns = this.namespace; - if (arguments.length < 1) return this.node()[ns][id].delay; - return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { - node[ns][id].delay = +value.call(node, node.__data__, i, j); - } : (value = +value, function(node) { - node[ns][id].delay = value; - })); - }; - d3_transitionPrototype.duration = function(value) { - var id = this.id, ns = this.namespace; - if (arguments.length < 1) return this.node()[ns][id].duration; - return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { - node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j)); - } : (value = Math.max(1, value), function(node) { - node[ns][id].duration = value; - })); - }; - d3_transitionPrototype.each = function(type, listener) { - var id = this.id, ns = this.namespace; - if (arguments.length < 2) { - var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; - try { - d3_transitionInheritId = id; - d3_selection_each(this, function(node, i, j) { - d3_transitionInherit = node[ns][id]; - type.call(node, node.__data__, i, j); - }); - } finally { - d3_transitionInherit = inherit; - d3_transitionInheritId = inheritId; - } - } else { - d3_selection_each(this, function(node) { - var transition = node[ns][id]; - (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, ns = 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[ns][id0]; - d3_transitionNode(node, i, ns, id1, { - time: transition.time, - ease: transition.ease, - delay: transition.delay + transition.duration, - duration: transition.duration - }); - } - subgroup.push(node); - } - } - return d3_transition(subgroups, ns, id1); - }; - function d3_transitionNamespace(name) { - return name == null ? "__transition__" : "__transition_" + name + "__"; - } - function d3_transitionNode(node, i, ns, id, inherit) { - var lock = node[ns] || (node[ns] = { - active: 0, - count: 0 - }), transition = lock[id], 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 < id) { - 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 = id; - 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[id]; else delete node[ns]; - return 1; - } - } - if (!transition) { - time = inherit.time; - timer = d3_timer(schedule, 0, time); - transition = lock[id] = { - tween: new d3_Map(), - time: time, - timer: 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 g = d3.select(this); - var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); - var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform; - var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), - d3.transition(path)); - tickEnter.append("line"); - tickEnter.append("text"); - var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2; - if (orient === "bottom" || orient === "top") { - tickTransform = d3_svg_axisX, x1 = "x", y1 = "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, x1 = "y", y1 = "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(y1, sign * tickSpacing); - lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize); - textUpdate.attr(x1, 0).attr(y1, 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, x0, x1) { - selection.attr("transform", function(d) { - var v0 = x0(d); - return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)"; - }); - } - function d3_svg_axisY(selection, y0, y1) { - selection.attr("transform", function(d) { - var v0 = y0(d); - return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")"; - }); - } - d3.svg.brush = function() { - var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0]; - function brush(g) { - g.each(function() { - var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); - var background = g.selectAll(".background").data([ 0 ]); - background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); - g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); - var resize = g.selectAll(".resize").data(resizes, d3_identity); - resize.exit().remove(); - resize.enter().append("g").attr("class", function(d) { - return "resize " + d; - }).style("cursor", function(d) { - return d3_svg_brushCursor[d]; - }).append("rect").attr("x", function(d) { - return /[ew]$/.test(d) ? -3 : null; - }).attr("y", function(d) { - return /^[ns]/.test(d) ? -3 : null; - }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); - resize.style("display", brush.empty() ? "none" : null); - var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; - if (x) { - range = d3_scaleRange(x); - backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); - redrawX(gUpdate); - } - if (y) { - range = d3_scaleRange(y); - backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); - redrawY(gUpdate); - } - redraw(gUpdate); - }); - } - brush.event = function(g) { - g.each(function() { - var event_ = event.of(this, arguments), extent1 = { - x: xExtent, - y: yExtent, - i: xExtentDomain, - j: yExtentDomain - }, extent0 = this.__chart__ || extent1; - this.__chart__ = extent1; - if (d3_transitionInheritId) { - d3.select(this).transition().each("start.brush", function() { - xExtentDomain = extent0.i; - yExtentDomain = extent0.j; - xExtent = extent0.x; - yExtent = extent0.y; - event_({ - type: "brushstart" - }); - }).tween("brush:brush", function() { - var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); - xExtentDomain = yExtentDomain = null; - return function(t) { - xExtent = extent1.x = xi(t); - yExtent = extent1.y = yi(t); - event_({ - type: "brush", - mode: "resize" - }); - }; - }).each("end.brush", function() { - xExtentDomain = extent1.i; - yExtentDomain = extent1.j; - event_({ - type: "brush", - mode: "resize" - }); - event_({ - type: "brushend" - }); - }); - } else { - event_({ - type: "brushstart" - }); - event_({ - type: "brush", - mode: "resize" - }); - event_({ - type: "brushend" - }); - } - }); - }; - function redraw(g) { - g.selectAll(".resize").attr("transform", function(d) { - return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; - }); - } - function redrawX(g) { - g.select(".extent").attr("x", xExtent[0]); - g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); - } - function redrawY(g) { - g.select(".extent").attr("y", yExtent[0]); - g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]); - } - function brushstart() { - var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(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), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max; - if (dragging) { - r0 -= position; - r1 -= size + position; - } - min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; - if (dragging) { - max = (min += position) + size; - } else { - if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); - if (position < min) { - max = min; - min = position; - } else { - max = position; - } - } - if (extent[0] != min || extent[1] != max) { - if (i) yExtentDomain = null; else xExtentDomain = null; - extent[0] = min; - extent[1] = max; - return true; - } - } - function brushend() { - brushmove(); - g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); - d3.select("body").style("cursor", null); - w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); - dragRestore(); - event_({ - type: "brushend" - }); - } - } - brush.x = function(z) { - if (!arguments.length) return x; - x = z; - resizes = d3_svg_brushResizes[!x << 1 | !y]; - return brush; - }; - brush.y = function(z) { - if (!arguments.length) return y; - y = z; - resizes = d3_svg_brushResizes[!x << 1 | !y]; - return brush; - }; - brush.clamp = function(z) { - if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null; - if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z; - return brush; - }; - brush.extent = function(z) { - var x0, x1, y0, y1, t; - if (!arguments.length) { - if (x) { - if (xExtentDomain) { - x0 = xExtentDomain[0], x1 = xExtentDomain[1]; - } else { - x0 = xExtent[0], x1 = xExtent[1]; - if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); - if (x1 < x0) t = x0, x0 = x1, x1 = t; - } - } - if (y) { - if (yExtentDomain) { - y0 = yExtentDomain[0], y1 = yExtentDomain[1]; - } else { - y0 = yExtent[0], y1 = yExtent[1]; - if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); - if (y1 < y0) t = y0, y0 = y1, y1 = t; - } - } - return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; - } - if (x) { - x0 = z[0], x1 = z[1]; - if (y) x0 = x0[0], x1 = x1[0]; - xExtentDomain = [ x0, x1 ]; - if (x.invert) x0 = x(x0), x1 = x(x1); - if (x1 < x0) t = x0, x0 = x1, x1 = t; - if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; - } - if (y) { - y0 = z[0], y1 = z[1]; - if (x) y0 = y0[1], y1 = y1[1]; - yExtentDomain = [ y0, y1 ]; - if (y.invert) y0 = y(y0), y1 = y(y1); - if (y1 < y0) t = y0, y0 = y1, y1 = t; - if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; - } - return brush; - }; - brush.clear = function() { - if (!brush.empty()) { - xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; - xExtentDomain = yExtentDomain = null; - } - return brush; - }; - brush.empty = function() { - return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; - }; - return d3.rebind(brush, event, "on"); - }; - var d3_svg_brushCursor = { - n: "ns-resize", - e: "ew-resize", - s: "ns-resize", - w: "ew-resize", - nw: "nwse-resize", - ne: "nesw-resize", - se: "nwse-resize", - sw: "nesw-resize" - }; - var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; - var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; - var d3_time_formatUtc = d3_time_format.utc; - var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); - d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; - function d3_time_formatIsoNative(date) { - return date.toISOString(); - } - d3_time_formatIsoNative.parse = function(string) { - var date = new Date(string); - return isNaN(date) ? null : date; - }; - d3_time_formatIsoNative.toString = d3_time_formatIso.toString; - d3_time.second = d3_time_interval(function(date) { - return new d3_date(Math.floor(date / 1e3) * 1e3); - }, function(date, offset) { - date.setTime(date.getTime() + Math.floor(offset) * 1e3); - }, function(date) { - return date.getSeconds(); - }); - d3_time.seconds = d3_time.second.range; - d3_time.seconds.utc = d3_time.second.utc.range; - d3_time.minute = d3_time_interval(function(date) { - return new d3_date(Math.floor(date / 6e4) * 6e4); - }, function(date, offset) { - date.setTime(date.getTime() + Math.floor(offset) * 6e4); - }, function(date) { - return date.getMinutes(); - }); - d3_time.minutes = d3_time.minute.range; - d3_time.minutes.utc = d3_time.minute.utc.range; - d3_time.hour = d3_time_interval(function(date) { - var timezone = date.getTimezoneOffset() / 60; - return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); - }, function(date, offset) { - date.setTime(date.getTime() + Math.floor(offset) * 36e5); - }, function(date) { - return date.getHours(); - }); - d3_time.hours = d3_time.hour.range; - d3_time.hours.utc = d3_time.hour.utc.range; - d3_time.month = d3_time_interval(function(date) { - date = d3_time.day(date); - date.setDate(1); - return date; - }, function(date, offset) { - date.setMonth(date.getMonth() + offset); - }, function(date) { - return date.getMonth(); - }); - d3_time.months = d3_time.month.range; - d3_time.months.utc = d3_time.month.utc.range; - function d3_time_scale(linear, methods, format) { - function scale(x) { - return linear(x); - } - scale.invert = function(x) { - return d3_time_scaleDate(linear.invert(x)); - }; - scale.domain = function(x) { - if (!arguments.length) return linear.domain().map(d3_time_scaleDate); - linear.domain(x); - return scale; - }; - function tickMethod(extent, count) { - var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); - return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { - return d / 31536e6; - }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i]; - } - scale.nice = function(interval, skip) { - var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); - if (method) interval = method[0], skip = method[1]; - function skipped(date) { - return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; - } - return scale.domain(d3_scale_nice(domain, skip > 1 ? { - floor: function(date) { - while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); - return date; - }, - ceil: function(date) { - while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); - return date; - } - } : interval)); - }; - scale.ticks = function(interval, skip) { - var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { - range: interval - }, skip ]; - if (method) interval = method[0], skip = method[1]; - return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); - }; - scale.tickFormat = function() { - return format; - }; - scale.copy = function() { - return d3_time_scale(linear.copy(), methods, format); - }; - return d3_scale_linearRebind(scale, linear); - } - function d3_time_scaleDate(t) { - return new Date(t); - } - var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; - var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ]; - var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { - return d.getMilliseconds(); - } ], [ ":%S", function(d) { - return d.getSeconds(); - } ], [ "%I:%M", function(d) { - return d.getMinutes(); - } ], [ "%I %p", function(d) { - return d.getHours(); - } ], [ "%a %d", function(d) { - return d.getDay() && d.getDate() != 1; - } ], [ "%b %d", function(d) { - return d.getDate() != 1; - } ], [ "%B", function(d) { - return d.getMonth(); - } ], [ "%Y", d3_true ] ]); - var d3_time_scaleMilliseconds = { - range: function(start, stop, step) { - return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); - }, - floor: d3_identity, - ceil: d3_identity - }; - d3_time_scaleLocalMethods.year = d3_time.year; - d3_time.scale = function() { - return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); - }; - var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { - return [ m[0].utc, m[1] ]; - }); - var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { - return d.getUTCMilliseconds(); - } ], [ ":%S", function(d) { - return d.getUTCSeconds(); - } ], [ "%I:%M", function(d) { - return d.getUTCMinutes(); - } ], [ "%I %p", function(d) { - return d.getUTCHours(); - } ], [ "%a %d", function(d) { - return d.getUTCDay() && d.getUTCDate() != 1; - } ], [ "%b %d", function(d) { - return d.getUTCDate() != 1; - } ], [ "%B", function(d) { - return d.getUTCMonth(); - } ], [ "%Y", d3_true ] ]); - d3_time_scaleUtcMethods.year = d3_time.year.utc; - d3_time.scale.utc = function() { - return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); - }; - d3.text = d3_xhrType(function(request) { - return request.responseText; - }); - d3.json = function(url, callback) { - return d3_xhr(url, "application/json", d3_json, callback); - }; - function d3_json(request) { - return JSON.parse(request.responseText); - } - d3.html = function(url, callback) { - return d3_xhr(url, "text/html", d3_html, callback); - }; - function d3_html(request) { - var range = d3_document.createRange(); - range.selectNode(d3_document.body); - return range.createContextualFragment(request.responseText); - } - d3.xml = d3_xhrType(function(request) { - return request.responseXML; - }); - if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; -}(); -},{}],149:[function(_dereq_,module,exports){ -module.exports = function () { - for (var i = 0; i < arguments.length; i++) { - if (arguments[i] !== undefined) return arguments[i]; - } -}; - -},{}],150:[function(_dereq_,module,exports){ -"use strict" - -var ch = _dereq_("incremental-convex-hull") -var uniq = _dereq_("uniq") - -module.exports = triangulate - -function LiftedPoint(p, i) { - this.point = p - this.index = i -} - -function compareLifted(a, b) { - var ap = a.point - var bp = b.point - var d = ap.length - for(var i=0; i= 2) { - return false - } - } - cell[j] = v - } - return true - }) - } else { - hull = hull.filter(function(cell) { - for(var i=0; i<=d; ++i) { - var v = dindex[cell[i]] - if(v < 0) { - return false - } - cell[i] = v - } - return true - }) - } - - if(d & 1) { - for(var i=0; i fs * threshold) { - var emWidth = (kerningWidth - width) / fs - table[pair] = emWidth * 1000 - } - } - - return table -} - - -function createPairs (range) { - var pairs = [] - - for (var i = range[0]; i <= range[1]; i++) { - var leftChar = String.fromCharCode(i) - for (var j = range[0]; j < range[1]; j++) { - var rightChar = String.fromCharCode(j) - var pair = leftChar + rightChar - - pairs.push(pair) - } - } - - return pairs -} - -},{}],152:[function(_dereq_,module,exports){ -(function (Buffer){ -var hasTypedArrays = false -if(typeof Float64Array !== "undefined") { - var DOUBLE_VIEW = new Float64Array(1) - , UINT_VIEW = new Uint32Array(DOUBLE_VIEW.buffer) - DOUBLE_VIEW[0] = 1.0 - hasTypedArrays = true - if(UINT_VIEW[1] === 0x3ff00000) { - //Use little endian - module.exports = function doubleBitsLE(n) { - DOUBLE_VIEW[0] = n - return [ UINT_VIEW[0], UINT_VIEW[1] ] - } - function toDoubleLE(lo, hi) { - UINT_VIEW[0] = lo - UINT_VIEW[1] = hi - return DOUBLE_VIEW[0] - } - module.exports.pack = toDoubleLE - function lowUintLE(n) { - DOUBLE_VIEW[0] = n - return UINT_VIEW[0] - } - module.exports.lo = lowUintLE - function highUintLE(n) { - DOUBLE_VIEW[0] = n - return UINT_VIEW[1] - } - module.exports.hi = highUintLE - } else if(UINT_VIEW[0] === 0x3ff00000) { - //Use big endian - module.exports = function doubleBitsBE(n) { - DOUBLE_VIEW[0] = n - return [ UINT_VIEW[1], UINT_VIEW[0] ] - } - function toDoubleBE(lo, hi) { - UINT_VIEW[1] = lo - UINT_VIEW[0] = hi - return DOUBLE_VIEW[0] - } - module.exports.pack = toDoubleBE - function lowUintBE(n) { - DOUBLE_VIEW[0] = n - return UINT_VIEW[1] - } - module.exports.lo = lowUintBE - function highUintBE(n) { - DOUBLE_VIEW[0] = n - return UINT_VIEW[0] - } - module.exports.hi = highUintBE - } else { - hasTypedArrays = false - } -} -if(!hasTypedArrays) { - var buffer = new Buffer(8) - module.exports = function doubleBits(n) { - buffer.writeDoubleLE(n, 0, true) - return [ buffer.readUInt32LE(0, true), buffer.readUInt32LE(4, true) ] - } - function toDouble(lo, hi) { - buffer.writeUInt32LE(lo, 0, true) - buffer.writeUInt32LE(hi, 4, true) - return buffer.readDoubleLE(0, true) - } - module.exports.pack = toDouble - function lowUint(n) { - buffer.writeDoubleLE(n, 0, true) - return buffer.readUInt32LE(0, true) - } - module.exports.lo = lowUint - function highUint(n) { - buffer.writeDoubleLE(n, 0, true) - return buffer.readUInt32LE(4, true) - } - module.exports.hi = highUint -} - -module.exports.sign = function(n) { - return module.exports.hi(n) >>> 31 -} - -module.exports.exponent = function(n) { - var b = module.exports.hi(n) - return ((b<<1) >>> 21) - 1023 -} - -module.exports.fraction = function(n) { - var lo = module.exports.lo(n) - var hi = module.exports.hi(n) - var b = hi & ((1<<20) - 1) - if(hi & 0x7ff00000) { - b += (1<<20) - } - return [lo, b] -} - -module.exports.denormalized = function(n) { - var hi = module.exports.hi(n) - return !(hi & 0x7ff00000) -} -}).call(this,_dereq_("buffer").Buffer) -},{"buffer":93}],153:[function(_dereq_,module,exports){ -var abs = _dereq_('abs-svg-path') -var normalize = _dereq_('normalize-svg-path') - -var methods = { - 'M': 'moveTo', - 'C': 'bezierCurveTo' -} - -module.exports = function(context, segments) { - context.beginPath() - - // Make path easy to reproduce. - normalize(abs(segments)).forEach( - function(segment) { - var command = segment[0] - var args = segment.slice(1) - - // Convert the path command to a context method. - context[methods[command]].apply(context, args) - } - ) - - context.closePath() -} - -},{"abs-svg-path":48,"normalize-svg-path":435}],154:[function(_dereq_,module,exports){ -module.exports = function(dtype) { - switch (dtype) { - case 'int8': - return Int8Array - case 'int16': - return Int16Array - case 'int32': - return Int32Array - case 'uint8': - return Uint8Array - case 'uint16': - return Uint16Array - case 'uint32': - return Uint32Array - case 'float32': - return Float32Array - case 'float64': - return Float64Array - case 'array': - return Array - case 'uint8_clamped': - return Uint8ClampedArray - } -} - -},{}],155:[function(_dereq_,module,exports){ -"use strict" - -function dupe_array(count, value, i) { - var c = count[i]|0 - if(c <= 0) { - return [] - } - var result = new Array(c), j - if(i === count.length-1) { - for(j=0; j 0) { - return dupe_number(count|0, value) - } - break - case "object": - if(typeof (count.length) === "number") { - return dupe_array(count, value, 0) - } - break - } - return [] -} - -module.exports = dupe -},{}],156:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = earcut; -module.exports.default = earcut; - -function earcut(data, holeIndices, dim) { - - dim = dim || 2; - - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; - - if (!outerNode) return triangles; - - var minX, minY, maxX, maxY, x, y, invSize; - - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); - - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; - - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - } - - // minX, minY and invSize are later used to transform coords into integers for z-order calculation - invSize = Math.max(maxX - minX, maxY - minY); - invSize = invSize !== 0 ? 1 / invSize : 0; - } - - earcutLinked(outerNode, triangles, dim, minX, minY, invSize); - - return triangles; -} - -// create a circular doubly linked list from polygon points in the specified winding order -function linkedList(data, start, end, dim, clockwise) { - var i, last; - - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); - } - - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } - - return last; -} - -// eliminate colinear or duplicate points -function filterPoints(start, end) { - if (!start) return start; - if (!end) end = start; - - var p = start, - again; - do { - again = false; - - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) break; - again = true; - - } else { - p = p.next; - } - } while (again || p !== end); - - return end; -} - -// main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) return; - - // interlink polygon nodes in z-order - if (!pass && invSize) indexCurve(ear, minX, minY, invSize); - - var stop = ear, - prev, next; - - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; - - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); - - removeNode(ear); - - // skipping the next vertice leads to less sliver triangles - ear = next.next; - stop = next.next; - - continue; - } - - ear = next; - - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(ear, triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, invSize); - } - - break; - } - } -} - -// check whether a polygon node forms a valid ear with adjacent nodes -function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; - - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.next; - } - - return true; -} - -function isEarHashed(ear, minX, minY, invSize) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); - - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - - var p = ear.prevZ, - n = ear.nextZ; - - // look for points inside the triangle in both directions - while (p && p.z >= minZ && n && n.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) return false; - n = n.nextZ; - } - - // look for remaining points in decreasing z-order - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - } - - // look for remaining points in increasing z-order - while (n && n.z <= maxZ) { - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) return false; - n = n.nextZ; - } - - return true; -} - -// go through all polygon nodes and cure small local self-intersections -function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; - - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); - - // remove two nodes involved - removeNode(p); - removeNode(p.next); - - p = start = b; - } - p = p.next; - } while (p !== start); - - return p; -} - -// try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, invSize) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); - - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); - - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, invSize); - earcutLinked(c, triangles, dim, minX, minY, invSize); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); -} - -// link every hole into the outer loop, producing a single-ring polygon without holes -function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; - - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) list.steiner = true; - queue.push(getLeftmost(list)); - } - - queue.sort(compareX); - - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); - } - - return outerNode; -} - -function compareX(a, b) { - return a.x - b.x; -} - -// find a bridge between vertices that connects hole with an outer ring and and link it -function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); - filterPoints(b, b.next); - } -} - -// David Eberly's algorithm for finding a bridge between hole and outer polygon -function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; - - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) return p; - if (hy === p.next.y) return p.next; - } - m = p.x < p.next.x ? p : p.next; - } - } - p = p.next; - } while (p !== outerNode); - - if (!m) return null; - - if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint - - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point - - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; - - p = m.next; - - while (p !== stop) { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential - - if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { - m = p; - tanMin = tan; - } - } - - p = p.next; - } - - return m; -} - -// interlink polygon nodes in z-order -function indexCurve(start, minX, minY, invSize) { - var p = start; - do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - - p.prevZ.nextZ = null; - p.prevZ = null; - - sortLinked(p); -} - -// Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html -function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; - - do { - p = list; - list = null; - tail = null; - numMerges = 0; - - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) break; - } - qSize = inSize; - - while (pSize > 0 || (qSize > 0 && q)) { - - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } - - if (tail) tail.nextZ = e; - else list = e; - - e.prevZ = tail; - tail = e; - } - - p = q; - } - - tail.nextZ = null; - inSize *= 2; - - } while (numMerges > 1); - - return list; -} - -// z-order of a point given coords and inverse of the longer side of data bbox -function zOrder(x, y, minX, minY, invSize) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) * invSize; - y = 32767 * (y - minY) * invSize; - - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; - - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; - - return x | (y << 1); -} - -// find the leftmost node of a polygon ring -function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x) leftmost = p; - p = p.next; - } while (p !== start); - - return leftmost; -} - -// check if a point lies within a convex triangle -function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; -} - -// check if a diagonal between two polygon nodes is valid (lies in polygon interior) -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && - locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); -} - -// signed area of a triangle -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} - -// check if two points are equal -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} - -// check if two segments intersect -function intersects(p1, q1, p2, q2) { - if ((equals(p1, q1) && equals(p2, q2)) || - (equals(p1, q2) && equals(p2, q1))) return true; - return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && - area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; -} - -// check if a polygon diagonal intersects any polygon segments -function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) return true; - p = p.next; - } while (p !== a); - - return false; -} - -// check if a polygon diagonal is locally inside the polygon -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} - -// check if the middle point of a polygon diagonal is inside the polygon -function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - inside = !inside; - p = p.next; - } while (p !== a); - - return inside; -} - -// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring -function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; - - a.next = b; - b.prev = a; - - a2.next = an; - an.prev = a2; - - b2.next = a2; - a2.prev = b2; - - bp.next = b2; - b2.prev = bp; - - return b2; -} - -// create a node and optionally link it with previous one (in a circular doubly linked list) -function insertNode(i, x, y, last) { - var p = new Node(i, x, y); - - if (!last) { - p.prev = p; - p.next = p; - - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; -} - -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - - if (p.prevZ) p.prevZ.nextZ = p.nextZ; - if (p.nextZ) p.nextZ.prevZ = p.prevZ; -} - -function Node(i, x, y) { - // vertice index in coordinates array - this.i = i; - - // vertex coordinates - this.x = x; - this.y = y; - - // previous and next vertice nodes in a polygon ring - this.prev = null; - this.next = null; - - // z-order curve value - this.z = null; - - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; - - // indicates whether this is a steiner point - this.steiner = false; -} - -// return a percentage difference between the polygon area and its triangulation area; -// used to verify correctness of triangulation -earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; - - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); - } - } - - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } - - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); -}; - -function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} - -// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts -earcut.flatten = function (data) { - var dim = data[0][0].length, - result = {vertices: [], holes: [], dimensions: dim}, - holeIndex = 0; - - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); - } - } - return result; -}; - -},{}],157:[function(_dereq_,module,exports){ -"use strict" - -module.exports = edgeToAdjacency - -var uniq = _dereq_("uniq") - -function edgeToAdjacency(edges, numVertices) { - var numEdges = edges.length - if(typeof numVertices !== "number") { - numVertices = 0 - for(var i=0; i= 0xd800 && code <= 0xdbff) value += arrayLike[++i]; - } - value = mapFn ? call.call(mapFn, thisArg, value, j) : value; - if (Context) { - desc.value = value; - defineProperty(arr, j, desc); - } else { - arr[j] = value; - } - ++j; - } - length = j; - } - } - if (length === undefined) { - // Source: array or array-like - length = toPosInt(arrayLike.length); - if (Context) arr = new Context(length); - for (i = 0; i < length; ++i) { - value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i]; - if (Context) { - desc.value = value; - defineProperty(arr, i, desc); - } else { - arr[i] = value; - } - } - } - if (Context) { - desc.value = null; - arr.length = length; - } - return arr; -}; - -},{"../../function/is-arguments":162,"../../function/is-function":163,"../../number/to-pos-integer":169,"../../object/is-value":179,"../../object/valid-callable":188,"../../object/valid-value":190,"../../string/is-string":194,"es6-symbol":204}],162:[function(_dereq_,module,exports){ -"use strict"; - -var objToString = Object.prototype.toString - , id = objToString.call( - (function () { - return arguments; - })() -); - -module.exports = function (value) { - return objToString.call(value) === id; -}; - -},{}],163:[function(_dereq_,module,exports){ -"use strict"; - -var objToString = Object.prototype.toString, id = objToString.call(_dereq_("./noop")); - -module.exports = function (value) { - return typeof value === "function" && objToString.call(value) === id; -}; - -},{"./noop":164}],164:[function(_dereq_,module,exports){ -"use strict"; - -// eslint-disable-next-line no-empty-function -module.exports = function () {}; - -},{}],165:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = _dereq_("./is-implemented")() - ? Math.sign - : _dereq_("./shim"); - -},{"./is-implemented":166,"./shim":167}],166:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = function () { - var sign = Math.sign; - if (typeof sign !== "function") return false; - return (sign(10) === 1) && (sign(-20) === -1); -}; - -},{}],167:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = function (value) { - value = Number(value); - if (isNaN(value) || (value === 0)) return value; - return value > 0 ? 1 : -1; -}; - -},{}],168:[function(_dereq_,module,exports){ -"use strict"; - -var sign = _dereq_("../math/sign") - - , abs = Math.abs, floor = Math.floor; - -module.exports = function (value) { - if (isNaN(value)) return 0; - value = Number(value); - if ((value === 0) || !isFinite(value)) return value; - return sign(value) * floor(abs(value)); -}; - -},{"../math/sign":165}],169:[function(_dereq_,module,exports){ -"use strict"; - -var toInteger = _dereq_("./to-integer") - - , max = Math.max; - -module.exports = function (value) { - return max(0, toInteger(value)); -}; - -},{"./to-integer":168}],170:[function(_dereq_,module,exports){ -// Internal method, used by iteration functions. -// Calls a function for each key-value pair found in object -// Optionally takes compareFn to iterate object in specific order - -"use strict"; - -var callable = _dereq_("./valid-callable") - , value = _dereq_("./valid-value") - , bind = Function.prototype.bind - , call = Function.prototype.call - , keys = Object.keys - , objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable; - -module.exports = function (method, defVal) { - return function (obj, cb /*, thisArg, compareFn*/) { - var list, thisArg = arguments[2], compareFn = arguments[3]; - obj = Object(value(obj)); - callable(cb); - - list = keys(obj); - if (compareFn) { - list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined); - } - if (typeof method !== "function") method = list[method]; - return call.call(method, list, function (key, index) { - if (!objPropertyIsEnumerable.call(obj, key)) return defVal; - return call.call(cb, thisArg, obj[key], key, obj, index); - }); - }; -}; - -},{"./valid-callable":188,"./valid-value":190}],171:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = _dereq_("./is-implemented")() - ? Object.assign - : _dereq_("./shim"); - -},{"./is-implemented":172,"./shim":173}],172:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = function () { - var assign = Object.assign, obj; - if (typeof assign !== "function") return false; - obj = { foo: "raz" }; - assign(obj, { bar: "dwa" }, { trzy: "trzy" }); - return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy"; -}; - -},{}],173:[function(_dereq_,module,exports){ -"use strict"; - -var keys = _dereq_("../keys") - , value = _dereq_("../valid-value") - , max = Math.max; - -module.exports = function (dest, src /*, …srcn*/) { - var error, i, length = max(arguments.length, 2), assign; - dest = Object(value(dest)); - assign = function (key) { - try { - dest[key] = src[key]; - } catch (e) { - if (!error) error = e; - } - }; - for (i = 1; i < length; ++i) { - src = arguments[i]; - keys(src).forEach(assign); - } - if (error !== undefined) throw error; - return dest; -}; - -},{"../keys":180,"../valid-value":190}],174:[function(_dereq_,module,exports){ -"use strict"; - -var aFrom = _dereq_("../array/from") - , assign = _dereq_("./assign") - , value = _dereq_("./valid-value"); - -module.exports = function (obj/*, propertyNames, options*/) { - var copy = Object(value(obj)), propertyNames = arguments[1], options = Object(arguments[2]); - if (copy !== obj && !propertyNames) return copy; - var result = {}; - if (propertyNames) { - aFrom(propertyNames, function (propertyName) { - if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName]; - }); - } else { - assign(result, obj); - } - return result; -}; - -},{"../array/from":159,"./assign":171,"./valid-value":190}],175:[function(_dereq_,module,exports){ -// Workaround for http://code.google.com/p/v8/issues/detail?id=2804 - -"use strict"; - -var create = Object.create, shim; - -if (!_dereq_("./set-prototype-of/is-implemented")()) { - shim = _dereq_("./set-prototype-of/shim"); -} - -module.exports = (function () { - var nullObject, polyProps, desc; - if (!shim) return create; - if (shim.level !== 1) return create; - - nullObject = {}; - polyProps = {}; - desc = { - configurable: false, - enumerable: false, - writable: true, - value: undefined - }; - Object.getOwnPropertyNames(Object.prototype).forEach(function (name) { - if (name === "__proto__") { - polyProps[name] = { - configurable: true, - enumerable: false, - writable: true, - value: undefined - }; - return; - } - polyProps[name] = desc; - }); - Object.defineProperties(nullObject, polyProps); - - Object.defineProperty(shim, "nullPolyfill", { - configurable: false, - enumerable: false, - writable: false, - value: nullObject - }); - - return function (prototype, props) { - return create(prototype === null ? nullObject : prototype, props); - }; -}()); - -},{"./set-prototype-of/is-implemented":186,"./set-prototype-of/shim":187}],176:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = _dereq_("./_iterate")("forEach"); - -},{"./_iterate":170}],177:[function(_dereq_,module,exports){ -// Deprecated - -"use strict"; - -module.exports = function (obj) { - return typeof obj === "function"; -}; - -},{}],178:[function(_dereq_,module,exports){ -"use strict"; - -var isValue = _dereq_("./is-value"); - -var map = { function: true, object: true }; - -module.exports = function (value) { - return (isValue(value) && map[typeof value]) || false; -}; - -},{"./is-value":179}],179:[function(_dereq_,module,exports){ -"use strict"; - -var _undefined = _dereq_("../function/noop")(); // Support ES3 engines - -module.exports = function (val) { - return (val !== _undefined) && (val !== null); -}; - -},{"../function/noop":164}],180:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = _dereq_("./is-implemented")() ? Object.keys : _dereq_("./shim"); - -},{"./is-implemented":181,"./shim":182}],181:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = function () { - try { - Object.keys("primitive"); - return true; - } catch (e) { - return false; - } -}; - -},{}],182:[function(_dereq_,module,exports){ -"use strict"; - -var isValue = _dereq_("../is-value"); - -var keys = Object.keys; - -module.exports = function (object) { return keys(isValue(object) ? Object(object) : object); }; - -},{"../is-value":179}],183:[function(_dereq_,module,exports){ -"use strict"; - -var callable = _dereq_("./valid-callable") - , forEach = _dereq_("./for-each") - , call = Function.prototype.call; - -module.exports = function (obj, cb /*, thisArg*/) { - var result = {}, thisArg = arguments[2]; - callable(cb); - forEach(obj, function (value, key, targetObj, index) { - result[key] = call.call(cb, thisArg, value, key, targetObj, index); - }); - return result; -}; - -},{"./for-each":176,"./valid-callable":188}],184:[function(_dereq_,module,exports){ -"use strict"; - -var isValue = _dereq_("./is-value"); - -var forEach = Array.prototype.forEach, create = Object.create; - -var process = function (src, obj) { - var key; - for (key in src) obj[key] = src[key]; -}; - -// eslint-disable-next-line no-unused-vars -module.exports = function (opts1 /*, …options*/) { - var result = create(null); - forEach.call(arguments, function (options) { - if (!isValue(options)) return; - process(Object(options), result); - }); - return result; -}; - -},{"./is-value":179}],185:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = _dereq_("./is-implemented")() - ? Object.setPrototypeOf - : _dereq_("./shim"); - -},{"./is-implemented":186,"./shim":187}],186:[function(_dereq_,module,exports){ -"use strict"; - -var create = Object.create, getPrototypeOf = Object.getPrototypeOf, plainObject = {}; - -module.exports = function (/* CustomCreate*/) { - var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create; - if (typeof setPrototypeOf !== "function") return false; - return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject; -}; - -},{}],187:[function(_dereq_,module,exports){ -/* eslint no-proto: "off" */ - -// Big thanks to @WebReflection for sorting this out -// https://gist.github.com/WebReflection/5593554 - -"use strict"; - -var isObject = _dereq_("../is-object") - , value = _dereq_("../valid-value") - , objIsPrototypeOf = Object.prototype.isPrototypeOf - , defineProperty = Object.defineProperty - , nullDesc = { - configurable: true, - enumerable: false, - writable: true, - value: undefined -} - , validate; - -validate = function (obj, prototype) { - value(obj); - if (prototype === null || isObject(prototype)) return obj; - throw new TypeError("Prototype must be null or an object"); -}; - -module.exports = (function (status) { - var fn, set; - if (!status) return null; - if (status.level === 2) { - if (status.set) { - set = status.set; - fn = function (obj, prototype) { - set.call(validate(obj, prototype), prototype); - return obj; - }; - } else { - fn = function (obj, prototype) { - validate(obj, prototype).__proto__ = prototype; - return obj; - }; - } - } else { - fn = function self(obj, prototype) { - var isNullBase; - validate(obj, prototype); - isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj); - if (isNullBase) delete self.nullPolyfill.__proto__; - if (prototype === null) prototype = self.nullPolyfill; - obj.__proto__ = prototype; - if (isNullBase) defineProperty(self.nullPolyfill, "__proto__", nullDesc); - return obj; - }; - } - return Object.defineProperty(fn, "level", { - configurable: false, - enumerable: false, - writable: false, - value: status.level - }); -}( - (function () { - var tmpObj1 = Object.create(null) - , tmpObj2 = {} - , set - , desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__"); - - if (desc) { - try { - set = desc.set; // Opera crashes at this point - set.call(tmpObj1, tmpObj2); - } catch (ignore) {} - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { set: set, level: 2 }; - } - - tmpObj1.__proto__ = tmpObj2; - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 2 }; - - tmpObj1 = {}; - tmpObj1.__proto__ = tmpObj2; - if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 1 }; - - return false; - })() -)); - -_dereq_("../create"); - -},{"../create":175,"../is-object":178,"../valid-value":190}],188:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = function (fn) { - if (typeof fn !== "function") throw new TypeError(fn + " is not a function"); - return fn; -}; - -},{}],189:[function(_dereq_,module,exports){ -"use strict"; - -var isObject = _dereq_("./is-object"); - -module.exports = function (value) { - if (!isObject(value)) throw new TypeError(value + " is not an Object"); - return value; -}; - -},{"./is-object":178}],190:[function(_dereq_,module,exports){ -"use strict"; - -var isValue = _dereq_("./is-value"); - -module.exports = function (value) { - if (!isValue(value)) throw new TypeError("Cannot use null or undefined"); - return value; -}; - -},{"./is-value":179}],191:[function(_dereq_,module,exports){ -"use strict"; - -module.exports = _dereq_("./is-implemented")() - ? String.prototype.contains - : _dereq_("./shim"); - -},{"./is-implemented":192,"./shim":193}],192:[function(_dereq_,module,exports){ -"use strict"; - -var str = "razdwatrzy"; - -module.exports = function () { - if (typeof str.contains !== "function") return false; - return (str.contains("dwa") === true) && (str.contains("foo") === false); -}; - -},{}],193:[function(_dereq_,module,exports){ -"use strict"; - -var indexOf = String.prototype.indexOf; - -module.exports = function (searchString/*, position*/) { - return indexOf.call(this, searchString, arguments[1]) > -1; -}; - -},{}],194:[function(_dereq_,module,exports){ -"use strict"; - -var objToString = Object.prototype.toString, id = objToString.call(""); - -module.exports = function (value) { - return ( - typeof value === "string" || - (value && - typeof value === "object" && - (value instanceof String || objToString.call(value) === id)) || - false - ); -}; - -},{}],195:[function(_dereq_,module,exports){ -"use strict"; - -var generated = Object.create(null), random = Math.random; - -module.exports = function () { - var str; - do { - str = random() - .toString(36) - .slice(2); - } while (generated[str]); - return str; -}; - -},{}],196:[function(_dereq_,module,exports){ -"use strict"; - -var setPrototypeOf = _dereq_("es5-ext/object/set-prototype-of") - , contains = _dereq_("es5-ext/string/#/contains") - , d = _dereq_("d") - , Symbol = _dereq_("es6-symbol") - , Iterator = _dereq_("./"); - -var defineProperty = Object.defineProperty, ArrayIterator; - -ArrayIterator = module.exports = function (arr, kind) { - if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'"); - Iterator.call(this, arr); - if (!kind) kind = "value"; - else if (contains.call(kind, "key+value")) kind = "key+value"; - else if (contains.call(kind, "key")) kind = "key"; - else kind = "value"; - defineProperty(this, "__kind__", d("", kind)); -}; -if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator); - -// Internal %ArrayIteratorPrototype% doesn't expose its constructor -delete ArrayIterator.prototype.constructor; - -ArrayIterator.prototype = Object.create(Iterator.prototype, { - _resolve: d(function (i) { - if (this.__kind__ === "value") return this.__list__[i]; - if (this.__kind__ === "key+value") return [i, this.__list__[i]]; - return i; - }) -}); -defineProperty(ArrayIterator.prototype, Symbol.toStringTag, d("c", "Array Iterator")); - -},{"./":199,"d":139,"es5-ext/object/set-prototype-of":185,"es5-ext/string/#/contains":191,"es6-symbol":204}],197:[function(_dereq_,module,exports){ -"use strict"; - -var isArguments = _dereq_("es5-ext/function/is-arguments") - , callable = _dereq_("es5-ext/object/valid-callable") - , isString = _dereq_("es5-ext/string/is-string") - , get = _dereq_("./get"); - -var isArray = Array.isArray, call = Function.prototype.call, some = Array.prototype.some; - -module.exports = function (iterable, cb /*, thisArg*/) { - var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code; - if (isArray(iterable) || isArguments(iterable)) mode = "array"; - else if (isString(iterable)) mode = "string"; - else iterable = get(iterable); - - callable(cb); - doBreak = function () { - broken = true; - }; - if (mode === "array") { - some.call(iterable, function (value) { - call.call(cb, thisArg, value, doBreak); - return broken; - }); - return; - } - if (mode === "string") { - length = iterable.length; - for (i = 0; i < length; ++i) { - char = iterable[i]; - if (i + 1 < length) { - code = char.charCodeAt(0); - if (code >= 0xd800 && code <= 0xdbff) char += iterable[++i]; - } - call.call(cb, thisArg, char, doBreak); - if (broken) break; - } - return; - } - result = iterable.next(); - - while (!result.done) { - call.call(cb, thisArg, result.value, doBreak); - if (broken) return; - result = iterable.next(); - } -}; - -},{"./get":198,"es5-ext/function/is-arguments":162,"es5-ext/object/valid-callable":188,"es5-ext/string/is-string":194}],198:[function(_dereq_,module,exports){ -"use strict"; - -var isArguments = _dereq_("es5-ext/function/is-arguments") - , isString = _dereq_("es5-ext/string/is-string") - , ArrayIterator = _dereq_("./array") - , StringIterator = _dereq_("./string") - , iterable = _dereq_("./valid-iterable") - , iteratorSymbol = _dereq_("es6-symbol").iterator; - -module.exports = function (obj) { - if (typeof iterable(obj)[iteratorSymbol] === "function") return obj[iteratorSymbol](); - if (isArguments(obj)) return new ArrayIterator(obj); - if (isString(obj)) return new StringIterator(obj); - return new ArrayIterator(obj); -}; - -},{"./array":196,"./string":201,"./valid-iterable":202,"es5-ext/function/is-arguments":162,"es5-ext/string/is-string":194,"es6-symbol":204}],199:[function(_dereq_,module,exports){ -"use strict"; - -var clear = _dereq_("es5-ext/array/#/clear") - , assign = _dereq_("es5-ext/object/assign") - , callable = _dereq_("es5-ext/object/valid-callable") - , value = _dereq_("es5-ext/object/valid-value") - , d = _dereq_("d") - , autoBind = _dereq_("d/auto-bind") - , Symbol = _dereq_("es6-symbol"); - -var defineProperty = Object.defineProperty, defineProperties = Object.defineProperties, Iterator; - -module.exports = Iterator = function (list, context) { - if (!(this instanceof Iterator)) throw new TypeError("Constructor requires 'new'"); - defineProperties(this, { - __list__: d("w", value(list)), - __context__: d("w", context), - __nextIndex__: d("w", 0) - }); - if (!context) return; - callable(context.on); - context.on("_add", this._onAdd); - context.on("_delete", this._onDelete); - context.on("_clear", this._onClear); -}; - -// Internal %IteratorPrototype% doesn't expose its constructor -delete Iterator.prototype.constructor; - -defineProperties( - Iterator.prototype, - assign( - { - _next: d(function () { - var i; - if (!this.__list__) return undefined; - if (this.__redo__) { - i = this.__redo__.shift(); - if (i !== undefined) return i; - } - if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; - this._unBind(); - return undefined; - }), - next: d(function () { - return this._createResult(this._next()); - }), - _createResult: d(function (i) { - if (i === undefined) return { done: true, value: undefined }; - return { done: false, value: this._resolve(i) }; - }), - _resolve: d(function (i) { - return this.__list__[i]; - }), - _unBind: d(function () { - this.__list__ = null; - delete this.__redo__; - if (!this.__context__) return; - this.__context__.off("_add", this._onAdd); - this.__context__.off("_delete", this._onDelete); - this.__context__.off("_clear", this._onClear); - this.__context__ = null; - }), - toString: d(function () { - return "[object " + (this[Symbol.toStringTag] || "Object") + "]"; - }) - }, - autoBind({ - _onAdd: d(function (index) { - if (index >= this.__nextIndex__) return; - ++this.__nextIndex__; - if (!this.__redo__) { - defineProperty(this, "__redo__", d("c", [index])); - return; - } - this.__redo__.forEach(function (redo, i) { - if (redo >= index) this.__redo__[i] = ++redo; - }, this); - this.__redo__.push(index); - }), - _onDelete: d(function (index) { - var i; - if (index >= this.__nextIndex__) return; - --this.__nextIndex__; - if (!this.__redo__) return; - i = this.__redo__.indexOf(index); - if (i !== -1) this.__redo__.splice(i, 1); - this.__redo__.forEach(function (redo, j) { - if (redo > index) this.__redo__[j] = --redo; - }, this); - }), - _onClear: d(function () { - if (this.__redo__) clear.call(this.__redo__); - this.__nextIndex__ = 0; - }) - }) - ) -); - -defineProperty( - Iterator.prototype, - Symbol.iterator, - d(function () { - return this; - }) -); - -},{"d":139,"d/auto-bind":138,"es5-ext/array/#/clear":158,"es5-ext/object/assign":171,"es5-ext/object/valid-callable":188,"es5-ext/object/valid-value":190,"es6-symbol":204}],200:[function(_dereq_,module,exports){ -"use strict"; - -var isArguments = _dereq_("es5-ext/function/is-arguments") - , isValue = _dereq_("es5-ext/object/is-value") - , isString = _dereq_("es5-ext/string/is-string"); - -var iteratorSymbol = _dereq_("es6-symbol").iterator - , isArray = Array.isArray; - -module.exports = function (value) { - if (!isValue(value)) return false; - if (isArray(value)) return true; - if (isString(value)) return true; - if (isArguments(value)) return true; - return typeof value[iteratorSymbol] === "function"; -}; - -},{"es5-ext/function/is-arguments":162,"es5-ext/object/is-value":179,"es5-ext/string/is-string":194,"es6-symbol":204}],201:[function(_dereq_,module,exports){ -// Thanks @mathiasbynens -// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols - -"use strict"; - -var setPrototypeOf = _dereq_("es5-ext/object/set-prototype-of") - , d = _dereq_("d") - , Symbol = _dereq_("es6-symbol") - , Iterator = _dereq_("./"); - -var defineProperty = Object.defineProperty, StringIterator; - -StringIterator = module.exports = function (str) { - if (!(this instanceof StringIterator)) throw new TypeError("Constructor requires 'new'"); - str = String(str); - Iterator.call(this, str); - defineProperty(this, "__length__", d("", str.length)); -}; -if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator); - -// Internal %ArrayIteratorPrototype% doesn't expose its constructor -delete StringIterator.prototype.constructor; - -StringIterator.prototype = Object.create(Iterator.prototype, { - _next: d(function () { - if (!this.__list__) return undefined; - if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++; - this._unBind(); - return undefined; - }), - _resolve: d(function (i) { - var char = this.__list__[i], code; - if (this.__nextIndex__ === this.__length__) return char; - code = char.charCodeAt(0); - if (code >= 0xd800 && code <= 0xdbff) return char + this.__list__[this.__nextIndex__++]; - return char; - }) -}); -defineProperty(StringIterator.prototype, Symbol.toStringTag, d("c", "String Iterator")); - -},{"./":199,"d":139,"es5-ext/object/set-prototype-of":185,"es6-symbol":204}],202:[function(_dereq_,module,exports){ -"use strict"; - -var isIterable = _dereq_("./is-iterable"); - -module.exports = function (value) { - if (!isIterable(value)) throw new TypeError(value + " is not iterable"); - return value; -}; - -},{"./is-iterable":200}],203:[function(_dereq_,module,exports){ -(function (process,global){ -/*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE - * @version 3.3.1 - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.ES6Promise = factory()); -}(this, (function () { 'use strict'; - -function objectOrFunction(x) { - return typeof x === 'function' || typeof x === 'object' && x !== null; -} - -function isFunction(x) { - return typeof x === 'function'; -} - -var _isArray = undefined; -if (!Array.isArray) { - _isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; -} else { - _isArray = Array.isArray; -} - -var isArray = _isArray; - -var len = 0; -var vertxNext = undefined; -var customSchedulerFn = undefined; - -var asap = function asap(callback, arg) { - queue[len] = callback; - queue[len + 1] = arg; - len += 2; - if (len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - if (customSchedulerFn) { - customSchedulerFn(flush); - } else { - scheduleFlush(); - } - } -}; - -function setScheduler(scheduleFn) { - customSchedulerFn = scheduleFn; -} - -function setAsap(asapFn) { - asap = asapFn; -} - -var browserWindow = typeof window !== 'undefined' ? window : undefined; -var browserGlobal = browserWindow || {}; -var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; -var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]'; - -// test for web worker but not in IE10 -var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; - -// node -function useNextTick() { - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // see https://github.com/cujojs/when/issues/410 for details - return function () { - return process.nextTick(flush); - }; -} - -// vertx -function useVertxTimer() { - return function () { - vertxNext(flush); - }; -} - -function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function () { - node.data = iterations = ++iterations % 2; - }; -} - -// web worker -function useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = flush; - return function () { - return channel.port2.postMessage(0); - }; -} - -function useSetTimeout() { - // Store setTimeout reference so es6-promise will be unaffected by - // other code modifying setTimeout (like sinon.useFakeTimers()) - var globalSetTimeout = setTimeout; - return function () { - return globalSetTimeout(flush, 1); - }; -} - -var queue = new Array(1000); -function flush() { - for (var i = 0; i < len; i += 2) { - var callback = queue[i]; - var arg = queue[i + 1]; - - callback(arg); - - queue[i] = undefined; - queue[i + 1] = undefined; - } - - len = 0; -} - -function attemptVertx() { - try { - var r = _dereq_; - var vertx = r('vertx'); - vertxNext = vertx.runOnLoop || vertx.runOnContext; - return useVertxTimer(); - } catch (e) { - return useSetTimeout(); - } -} - -var scheduleFlush = undefined; -// Decide what async method to use to triggering processing of queued callbacks: -if (isNode) { - scheduleFlush = useNextTick(); -} else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); -} else if (isWorker) { - scheduleFlush = useMessageChannel(); -} else if (browserWindow === undefined && typeof _dereq_ === 'function') { - scheduleFlush = attemptVertx(); -} else { - scheduleFlush = useSetTimeout(); -} - -function then(onFulfillment, onRejection) { - var _arguments = arguments; - - var parent = this; - - var child = new this.constructor(noop); - - if (child[PROMISE_ID] === undefined) { - makePromise(child); - } - - var _state = parent._state; - - if (_state) { - (function () { - var callback = _arguments[_state - 1]; - asap(function () { - return invokeCallback(_state, child, callback, parent._result); - }); - })(); - } else { - subscribe(parent, child, onFulfillment, onRejection); - } - - return child; -} - -/** - `Promise.resolve` returns a promise that will become resolved with the - passed `value`. It is shorthand for the following: - - ```javascript - let promise = new Promise(function(resolve, reject){ - resolve(1); - }); - - promise.then(function(value){ - // value === 1 - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - let promise = Promise.resolve(1); - - promise.then(function(value){ - // value === 1 - }); - ``` - - @method resolve - @static - @param {Any} value value that the returned promise will be resolved with - Useful for tooling. - @return {Promise} a promise that will become fulfilled with the given - `value` -*/ -function resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(noop); - _resolve(promise, object); - return promise; -} - -var PROMISE_ID = Math.random().toString(36).substring(16); - -function noop() {} - -var PENDING = void 0; -var FULFILLED = 1; -var REJECTED = 2; - -var GET_THEN_ERROR = new ErrorObject(); - -function selfFulfillment() { - return new TypeError("You cannot resolve a promise with itself"); -} - -function cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); -} - -function getThen(promise) { - try { - return promise.then; - } catch (error) { - GET_THEN_ERROR.error = error; - return GET_THEN_ERROR; - } -} - -function tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch (e) { - return e; - } -} - -function handleForeignThenable(promise, thenable, then) { - asap(function (promise) { - var sealed = false; - var error = tryThen(then, thenable, function (value) { - if (sealed) { - return; - } - sealed = true; - if (thenable !== value) { - _resolve(promise, value); - } else { - fulfill(promise, value); - } - }, function (reason) { - if (sealed) { - return; - } - sealed = true; - - _reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - _reject(promise, error); - } - }, promise); -} - -function handleOwnThenable(promise, thenable) { - if (thenable._state === FULFILLED) { - fulfill(promise, thenable._result); - } else if (thenable._state === REJECTED) { - _reject(promise, thenable._result); - } else { - subscribe(thenable, undefined, function (value) { - return _resolve(promise, value); - }, function (reason) { - return _reject(promise, reason); - }); - } -} - -function handleMaybeThenable(promise, maybeThenable, then$$) { - if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) { - handleOwnThenable(promise, maybeThenable); - } else { - if (then$$ === GET_THEN_ERROR) { - _reject(promise, GET_THEN_ERROR.error); - } else if (then$$ === undefined) { - fulfill(promise, maybeThenable); - } else if (isFunction(then$$)) { - handleForeignThenable(promise, maybeThenable, then$$); - } else { - fulfill(promise, maybeThenable); - } - } -} - -function _resolve(promise, value) { - if (promise === value) { - _reject(promise, selfFulfillment()); - } else if (objectOrFunction(value)) { - handleMaybeThenable(promise, value, getThen(value)); - } else { - fulfill(promise, value); - } -} - -function publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - publish(promise); -} - -function fulfill(promise, value) { - if (promise._state !== PENDING) { - return; - } - - promise._result = value; - promise._state = FULFILLED; - - if (promise._subscribers.length !== 0) { - asap(publish, promise); - } -} - -function _reject(promise, reason) { - if (promise._state !== PENDING) { - return; - } - promise._state = REJECTED; - promise._result = reason; - - asap(publishRejection, promise); -} - -function subscribe(parent, child, onFulfillment, onRejection) { - var _subscribers = parent._subscribers; - var length = _subscribers.length; - - parent._onerror = null; - - _subscribers[length] = child; - _subscribers[length + FULFILLED] = onFulfillment; - _subscribers[length + REJECTED] = onRejection; - - if (length === 0 && parent._state) { - asap(publish, parent); - } -} - -function publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { - return; - } - - var child = undefined, - callback = undefined, - detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; -} - -function ErrorObject() { - this.error = null; -} - -var TRY_CATCH_ERROR = new ErrorObject(); - -function tryCatch(callback, detail) { - try { - return callback(detail); - } catch (e) { - TRY_CATCH_ERROR.error = e; - return TRY_CATCH_ERROR; - } -} - -function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), - value = undefined, - error = undefined, - succeeded = undefined, - failed = undefined; - - if (hasCallback) { - value = tryCatch(callback, detail); - - if (value === TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - _reject(promise, cannotReturnOwn()); - return; - } - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== PENDING) { - // noop - } else if (hasCallback && succeeded) { - _resolve(promise, value); - } else if (failed) { - _reject(promise, error); - } else if (settled === FULFILLED) { - fulfill(promise, value); - } else if (settled === REJECTED) { - _reject(promise, value); - } -} - -function initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value) { - _resolve(promise, value); - }, function rejectPromise(reason) { - _reject(promise, reason); - }); - } catch (e) { - _reject(promise, e); - } -} - -var id = 0; -function nextId() { - return id++; -} - -function makePromise(promise) { - promise[PROMISE_ID] = id++; - promise._state = undefined; - promise._result = undefined; - promise._subscribers = []; -} - -function Enumerator(Constructor, input) { - this._instanceConstructor = Constructor; - this.promise = new Constructor(noop); - - if (!this.promise[PROMISE_ID]) { - makePromise(this.promise); - } - - if (isArray(input)) { - this._input = input; - this.length = input.length; - this._remaining = input.length; - - this._result = new Array(this.length); - - if (this.length === 0) { - fulfill(this.promise, this._result); - } else { - this.length = this.length || 0; - this._enumerate(); - if (this._remaining === 0) { - fulfill(this.promise, this._result); - } - } - } else { - _reject(this.promise, validationError()); - } -} - -function validationError() { - return new Error('Array Methods must be provided an Array'); -}; - -Enumerator.prototype._enumerate = function () { - var length = this.length; - var _input = this._input; - - for (var i = 0; this._state === PENDING && i < length; i++) { - this._eachEntry(_input[i], i); - } -}; - -Enumerator.prototype._eachEntry = function (entry, i) { - var c = this._instanceConstructor; - var resolve$$ = c.resolve; - - if (resolve$$ === resolve) { - var _then = getThen(entry); - - if (_then === then && entry._state !== PENDING) { - this._settledAt(entry._state, i, entry._result); - } else if (typeof _then !== 'function') { - this._remaining--; - this._result[i] = entry; - } else if (c === Promise) { - var promise = new c(noop); - handleMaybeThenable(promise, entry, _then); - this._willSettleAt(promise, i); - } else { - this._willSettleAt(new c(function (resolve$$) { - return resolve$$(entry); - }), i); - } - } else { - this._willSettleAt(resolve$$(entry), i); - } -}; - -Enumerator.prototype._settledAt = function (state, i, value) { - var promise = this.promise; - - if (promise._state === PENDING) { - this._remaining--; - - if (state === REJECTED) { - _reject(promise, value); - } else { - this._result[i] = value; - } - } - - if (this._remaining === 0) { - fulfill(promise, this._result); - } -}; - -Enumerator.prototype._willSettleAt = function (promise, i) { - var enumerator = this; - - subscribe(promise, undefined, function (value) { - return enumerator._settledAt(FULFILLED, i, value); - }, function (reason) { - return enumerator._settledAt(REJECTED, i, reason); - }); -}; - -/** - `Promise.all` accepts an array of promises, and returns a new promise which - is fulfilled with an array of fulfillment values for the passed promises, or - rejected with the reason of the first passed promise to be rejected. It casts all - elements of the passed iterable to promises as it runs this algorithm. - - Example: - - ```javascript - let promise1 = resolve(1); - let promise2 = resolve(2); - let promise3 = resolve(3); - let promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - let promise1 = resolve(1); - let promise2 = reject(new Error("2")); - let promise3 = reject(new Error("3")); - let promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @static - @param {Array} entries array of promises - @param {String} label optional string for labeling the promise. - Useful for tooling. - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - @static -*/ -function all(entries) { - return new Enumerator(this, entries).promise; -} - -/** - `Promise.race` returns a new promise which is settled in the same way as the - first passed promise to settle. - - Example: - - ```javascript - let promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - let promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 2'); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // result === 'promise 2' because it was resolved before promise1 - // was resolved. - }); - ``` - - `Promise.race` is deterministic in that only the state of the first - settled promise matters. For example, even if other promises given to the - `promises` array argument are resolved, but the first settled promise has - become rejected before the other promises became fulfilled, the returned - promise will become rejected: - - ```javascript - let promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - let promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error('promise 2')); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // Code here never runs - }, function(reason){ - // reason.message === 'promise 2' because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - An example real-world use case is implementing timeouts: - - ```javascript - Promise.race([ajax('foo.json'), timeout(5000)]) - ``` - - @method race - @static - @param {Array} promises array of promises to observe - Useful for tooling. - @return {Promise} a promise which settles in the same way as the first passed - promise to settle. -*/ -function race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - if (!isArray(entries)) { - return new Constructor(function (_, reject) { - return reject(new TypeError('You must pass an array to race.')); - }); - } else { - return new Constructor(function (resolve, reject) { - var length = entries.length; - for (var i = 0; i < length; i++) { - Constructor.resolve(entries[i]).then(resolve, reject); - } - }); - } -} - -/** - `Promise.reject` returns a promise rejected with the passed `reason`. - It is shorthand for the following: - - ```javascript - let promise = new Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - let promise = Promise.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @static - @param {Any} reason value that the returned promise will be rejected with. - Useful for tooling. - @return {Promise} a promise rejected with the given `reason`. -*/ -function reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(noop); - _reject(promise, reason); - return promise; -} - -function needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); -} - -function needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); -} - -/** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise's eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - let promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - let xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor -*/ -function Promise(resolver) { - this[PROMISE_ID] = nextId(); - this._result = this._state = undefined; - this._subscribers = []; - - if (noop !== resolver) { - typeof resolver !== 'function' && needsResolver(); - this instanceof Promise ? initializePromise(this, resolver) : needsNew(); - } -} - -Promise.all = all; -Promise.race = race; -Promise.resolve = resolve; -Promise.reject = reject; -Promise._setScheduler = setScheduler; -Promise._setAsap = setAsap; -Promise._asap = asap; - -Promise.prototype = { - constructor: Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - let result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - let author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: then, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function _catch(onRejection) { - return this.then(null, onRejection); - } -}; - -function polyfill() { - var local = undefined; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P) { - var promiseToString = null; - try { - promiseToString = Object.prototype.toString.call(P.resolve()); - } catch (e) { - // silently ignored - } - - if (promiseToString === '[object Promise]' && !P.cast) { - return; - } - } - - local.Promise = Promise; -} - -polyfill(); -// Strange compat.. -Promise.polyfill = polyfill; -Promise.Promise = Promise; - -return Promise; - -}))); - -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":465}],204:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = _dereq_('./is-implemented')() ? Symbol : _dereq_('./polyfill'); - -},{"./is-implemented":205,"./polyfill":207}],205:[function(_dereq_,module,exports){ -'use strict'; - -var validTypes = { object: true, symbol: true }; - -module.exports = function () { - var symbol; - if (typeof Symbol !== 'function') return false; - symbol = Symbol('test symbol'); - try { String(symbol); } catch (e) { return false; } - - // Return 'true' also for polyfills - if (!validTypes[typeof Symbol.iterator]) return false; - if (!validTypes[typeof Symbol.toPrimitive]) return false; - if (!validTypes[typeof Symbol.toStringTag]) return false; - - return true; -}; - -},{}],206:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = function (x) { - if (!x) return false; - if (typeof x === 'symbol') return true; - if (!x.constructor) return false; - if (x.constructor.name !== 'Symbol') return false; - return (x[x.constructor.toStringTag] === 'Symbol'); -}; - -},{}],207:[function(_dereq_,module,exports){ -// ES2015 Symbol polyfill for environments that do not (or partially) support it - -'use strict'; - -var d = _dereq_('d') - , validateSymbol = _dereq_('./validate-symbol') - - , create = Object.create, defineProperties = Object.defineProperties - , defineProperty = Object.defineProperty, objPrototype = Object.prototype - , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null) - , isNativeSafe; - -if (typeof Symbol === 'function') { - NativeSymbol = Symbol; - try { - String(NativeSymbol()); - isNativeSafe = true; - } catch (ignore) {} -} - -var generateName = (function () { - var created = create(null); - return function (desc) { - var postfix = 0, name, ie11BugWorkaround; - while (created[desc + (postfix || '')]) ++postfix; - desc += (postfix || ''); - created[desc] = true; - name = '@@' + desc; - defineProperty(objPrototype, name, d.gs(null, function (value) { - // For IE11 issue see: - // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/ - // ie11-broken-getters-on-dom-objects - // https://github.com/medikoo/es6-symbol/issues/12 - if (ie11BugWorkaround) return; - ie11BugWorkaround = true; - defineProperty(this, name, d(value)); - ie11BugWorkaround = false; - })); - return name; - }; -}()); - -// Internal constructor (not one exposed) for creating Symbol instances. -// This one is used to ensure that `someSymbol instanceof Symbol` always return false -HiddenSymbol = function Symbol(description) { - if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor'); - return SymbolPolyfill(description); -}; - -// Exposed `Symbol` constructor -// (returns instances of HiddenSymbol) -module.exports = SymbolPolyfill = function Symbol(description) { - var symbol; - if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor'); - if (isNativeSafe) return NativeSymbol(description); - symbol = create(HiddenSymbol.prototype); - description = (description === undefined ? '' : String(description)); - return defineProperties(symbol, { - __description__: d('', description), - __name__: d('', generateName(description)) - }); -}; -defineProperties(SymbolPolyfill, { - for: d(function (key) { - if (globalSymbols[key]) return globalSymbols[key]; - return (globalSymbols[key] = SymbolPolyfill(String(key))); - }), - keyFor: d(function (s) { - var key; - validateSymbol(s); - for (key in globalSymbols) if (globalSymbols[key] === s) return key; - }), - - // To ensure proper interoperability with other native functions (e.g. Array.from) - // fallback to eventual native implementation of given symbol - hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')), - isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) || - SymbolPolyfill('isConcatSpreadable')), - iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')), - match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')), - replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')), - search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')), - species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')), - split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')), - toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')), - toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')), - unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables')) -}); - -// Internal tweaks for real symbol producer -defineProperties(HiddenSymbol.prototype, { - constructor: d(SymbolPolyfill), - toString: d('', function () { return this.__name__; }) -}); - -// Proper implementation of methods exposed on Symbol.prototype -// They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype -defineProperties(SymbolPolyfill.prototype, { - toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), - valueOf: d(function () { return validateSymbol(this); }) -}); -defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () { - var symbol = validateSymbol(this); - if (typeof symbol === 'symbol') return symbol; - return symbol.toString(); -})); -defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol')); - -// Proper implementaton of toPrimitive and toStringTag for returned symbol instances -defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, - d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag])); - -// Note: It's important to define `toPrimitive` as last one, as some implementations -// implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols) -// And that may invoke error in definition flow: -// See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149 -defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, - d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])); - -},{"./validate-symbol":208,"d":139}],208:[function(_dereq_,module,exports){ -'use strict'; - -var isSymbol = _dereq_('./is-symbol'); - -module.exports = function (value) { - if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); - return value; -}; - -},{"./is-symbol":206}],209:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = _dereq_('./is-implemented')() ? WeakMap : _dereq_('./polyfill'); - -},{"./is-implemented":210,"./polyfill":212}],210:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = function () { - var weakMap, x; - if (typeof WeakMap !== 'function') return false; - try { - // WebKit doesn't support arguments and crashes - weakMap = new WeakMap([[x = {}, 'one'], [{}, 'two'], [{}, 'three']]); - } catch (e) { - return false; - } - if (String(weakMap) !== '[object WeakMap]') return false; - if (typeof weakMap.set !== 'function') return false; - if (weakMap.set({}, 1) !== weakMap) return false; - if (typeof weakMap.delete !== 'function') return false; - if (typeof weakMap.has !== 'function') return false; - if (weakMap.get(x) !== 'one') return false; - - return true; -}; - -},{}],211:[function(_dereq_,module,exports){ -// Exports true if environment provides native `WeakMap` implementation, whatever that is. - -'use strict'; - -module.exports = (function () { - if (typeof WeakMap !== 'function') return false; - return (Object.prototype.toString.call(new WeakMap()) === '[object WeakMap]'); -}()); - -},{}],212:[function(_dereq_,module,exports){ -'use strict'; - -var setPrototypeOf = _dereq_('es5-ext/object/set-prototype-of') - , object = _dereq_('es5-ext/object/valid-object') - , value = _dereq_('es5-ext/object/valid-value') - , randomUniq = _dereq_('es5-ext/string/random-uniq') - , d = _dereq_('d') - , getIterator = _dereq_('es6-iterator/get') - , forOf = _dereq_('es6-iterator/for-of') - , toStringTagSymbol = _dereq_('es6-symbol').toStringTag - , isNative = _dereq_('./is-native-implemented') - - , isArray = Array.isArray, defineProperty = Object.defineProperty - , hasOwnProperty = Object.prototype.hasOwnProperty, getPrototypeOf = Object.getPrototypeOf - , WeakMapPoly; - -module.exports = WeakMapPoly = function (/*iterable*/) { - var iterable = arguments[0], self; - if (!(this instanceof WeakMapPoly)) throw new TypeError('Constructor requires \'new\''); - if (isNative && setPrototypeOf && (WeakMap !== WeakMapPoly)) { - self = setPrototypeOf(new WeakMap(), getPrototypeOf(this)); - } else { - self = this; - } - if (iterable != null) { - if (!isArray(iterable)) iterable = getIterator(iterable); - } - defineProperty(self, '__weakMapData__', d('c', '$weakMap$' + randomUniq())); - if (!iterable) return self; - forOf(iterable, function (val) { - value(val); - self.set(val[0], val[1]); - }); - return self; -}; - -if (isNative) { - if (setPrototypeOf) setPrototypeOf(WeakMapPoly, WeakMap); - WeakMapPoly.prototype = Object.create(WeakMap.prototype, { - constructor: d(WeakMapPoly) - }); -} - -Object.defineProperties(WeakMapPoly.prototype, { - delete: d(function (key) { - if (hasOwnProperty.call(object(key), this.__weakMapData__)) { - delete key[this.__weakMapData__]; - return true; - } - return false; - }), - get: d(function (key) { - if (hasOwnProperty.call(object(key), this.__weakMapData__)) { - return key[this.__weakMapData__]; - } - }), - has: d(function (key) { - return hasOwnProperty.call(object(key), this.__weakMapData__); - }), - set: d(function (key, value) { - defineProperty(object(key), this.__weakMapData__, d('c', value)); - return this; - }), - toString: d(function () { return '[object WeakMap]'; }) -}); -defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d('c', 'WeakMap')); - -},{"./is-native-implemented":211,"d":139,"es5-ext/object/set-prototype-of":185,"es5-ext/object/valid-object":189,"es5-ext/object/valid-value":190,"es5-ext/string/random-uniq":195,"es6-iterator/for-of":197,"es6-iterator/get":198,"es6-symbol":204}],213:[function(_dereq_,module,exports){ -"use strict" - -module.exports = extractPlanes - -function extractPlanes(M, zNear, zFar) { - var z = zNear || 0.0 - var zf = zFar || 1.0 - return [ - [ M[12] + M[0], M[13] + M[1], M[14] + M[2], M[15] + M[3] ], - [ M[12] - M[0], M[13] - M[1], M[14] - M[2], M[15] - M[3] ], - [ M[12] + M[4], M[13] + M[5], M[14] + M[6], M[15] + M[7] ], - [ M[12] - M[4], M[13] - M[5], M[14] - M[6], M[15] - M[7] ], - [ z*M[12] + M[8], z*M[13] + M[9], z*M[14] + M[10], z*M[15] + M[11] ], - [ zf*M[12] - M[8], zf*M[13] - M[9], zf*M[14] - M[10], zf*M[15] - M[11] ] - ] -} -},{}],214:[function(_dereq_,module,exports){ -/** - * inspired by is-number - * but significantly simplified and sped up by ignoring number and string constructors - * ie these return false: - * new Number(1) - * new String('1') - */ - -'use strict'; - -var allBlankCharCodes = _dereq_('is-string-blank'); - -module.exports = function(n) { - var type = typeof n; - if(type === 'string') { - var original = n; - n = +n; - // whitespace strings cast to zero - filter them out - if(n===0 && allBlankCharCodes(original)) return false; - } - else if(type !== 'number') return false; - - return n - n < 1; -}; - -},{"is-string-blank":406}],215:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createFilteredVector - -var cubicHermite = _dereq_('cubic-hermite') -var bsearch = _dereq_('binary-search-bounds') - -function clamp(lo, hi, x) { - return Math.min(hi, Math.max(lo, x)) -} - -function FilteredVector(state0, velocity0, t0) { - this.dimension = state0.length - this.bounds = [ new Array(this.dimension), new Array(this.dimension) ] - for(var i=0; i= n-1) { - var ptr = state.length-1 - var tf = t - time[n-1] - for(var i=0; i= n-1) { - var ptr = state.length-1 - var tf = t - time[n-1] - for(var i=0; i=0; --i) { - if(velocity[--ptr]) { - return false - } - } - return true -} - -proto.jump = function(t) { - var t0 = this.lastT() - var d = this.dimension - if(t < t0 || arguments.length !== d+1) { - return - } - var state = this._state - var velocity = this._velocity - var ptr = state.length-this.dimension - var bounds = this.bounds - var lo = bounds[0] - var hi = bounds[1] - this._time.push(t0, t) - for(var j=0; j<2; ++j) { - for(var i=0; i0; --i) { - state.push(clamp(lo[i-1], hi[i-1], arguments[i])) - velocity.push(0) - } -} - -proto.push = function(t) { - var t0 = this.lastT() - var d = this.dimension - if(t < t0 || arguments.length !== d+1) { - return - } - var state = this._state - var velocity = this._velocity - var ptr = state.length-this.dimension - var dt = t - t0 - var bounds = this.bounds - var lo = bounds[0] - var hi = bounds[1] - var sf = (dt > 1e-6) ? 1/dt : 0 - this._time.push(t) - for(var i=d; i>0; --i) { - var xc = clamp(lo[i-1], hi[i-1], arguments[i]) - state.push(xc) - velocity.push((xc - state[ptr++]) * sf) - } -} - -proto.set = function(t) { - var d = this.dimension - if(t < this.lastT() || arguments.length !== d+1) { - return - } - var state = this._state - var velocity = this._velocity - var bounds = this.bounds - var lo = bounds[0] - var hi = bounds[1] - this._time.push(t) - for(var i=d; i>0; --i) { - state.push(clamp(lo[i-1], hi[i-1], arguments[i])) - velocity.push(0) - } -} - -proto.move = function(t) { - var t0 = this.lastT() - var d = this.dimension - if(t <= t0 || arguments.length !== d+1) { - return - } - var state = this._state - var velocity = this._velocity - var statePtr = state.length - this.dimension - var bounds = this.bounds - var lo = bounds[0] - var hi = bounds[1] - var dt = t - t0 - var sf = (dt > 1e-6) ? 1/dt : 0.0 - this._time.push(t) - for(var i=d; i>0; --i) { - var dx = arguments[i] - state.push(clamp(lo[i-1], hi[i-1], state[statePtr++] + dx)) - velocity.push(dx * sf) - } -} - -proto.idle = function(t) { - var t0 = this.lastT() - if(t < t0) { - return - } - var d = this.dimension - var state = this._state - var velocity = this._velocity - var statePtr = state.length-d - var bounds = this.bounds - var lo = bounds[0] - var hi = bounds[1] - var dt = t - t0 - this._time.push(t) - for(var i=d-1; i>=0; --i) { - state.push(clamp(lo[i], hi[i], state[statePtr] + dt * velocity[statePtr])) - velocity.push(0) - statePtr += 1 - } -} - -function getZero(d) { - var result = new Array(d) - for(var i=0; i shape[0] - step[0]/2) (x = step[0]/2), (y += step[1]) - } - - return canvas -} - -},{"css-font/stringify":130}],218:[function(_dereq_,module,exports){ -'use strict' - -module.exports = measure - -measure.canvas = document.createElement('canvas') -measure.cache = {} - -function measure (font, o) { - if (!o) o = {} - - if (typeof font === 'string' || Array.isArray(font)) { - o.family = font - } - - var family = Array.isArray(o.family) ? o.family.join(', ') : o.family - if (!family) throw Error('`family` must be defined') - - var fs = o.size || o.fontSize || o.em || 48 - var weight = o.weight || o.fontWeight || '' - var style = o.style || o.fontStyle || '' - var font = [style, weight, fs].join(' ') + 'px ' + family - var origin = o.origin || 'top' - - if (measure.cache[family]) { - // return more precise values if cache has them - if (fs <= measure.cache[family].em) { - return applyOrigin(measure.cache[family], origin) - } - } - - var canvas = o.canvas || measure.canvas - var ctx = canvas.getContext('2d') - var chars = { - upper: o.upper !== undefined ? o.upper : 'H', - lower: o.lower !== undefined ? o.lower : 'x', - descent: o.descent !== undefined ? o.descent : 'p', - ascent: o.ascent !== undefined ? o.ascent : 'h', - tittle: o.tittle !== undefined ? o.tittle : 'i', - overshoot: o.overshoot !== undefined ? o.overshoot : 'O' - } - var l = Math.ceil(fs * 1.5) - canvas.height = l - canvas.width = l * .5 - ctx.font = font - - var char = 'H' - var result = { - top: 0 - } - - // measure line-height - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillStyle = 'black' - ctx.fillText(char, 0, 0) - var topPx = firstTop(ctx.getImageData(0, 0, l, l)) - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'bottom' - ctx.fillText(char, 0, l) - var bottomPx = firstTop(ctx.getImageData(0, 0, l, l)) - result.lineHeight = - result.bottom = l - bottomPx + topPx - - // measure baseline - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'alphabetic' - ctx.fillText(char, 0, l) - var baselinePx = firstTop(ctx.getImageData(0, 0, l, l)) - var baseline = l - baselinePx - 1 + topPx - result.baseline = - result.alphabetic = baseline - - // measure median - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'middle' - ctx.fillText(char, 0, l * .5) - var medianPx = firstTop(ctx.getImageData(0, 0, l, l)) - result.median = - result.middle = l - medianPx - 1 + topPx - l * .5 - - // measure hanging - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'hanging' - ctx.fillText(char, 0, l * .5) - var hangingPx = firstTop(ctx.getImageData(0, 0, l, l)) - result.hanging = l - hangingPx - 1 + topPx - l * .5 - - // measure ideographic - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'ideographic' - ctx.fillText(char, 0, l) - var ideographicPx = firstTop(ctx.getImageData(0, 0, l, l)) - result.ideographic = l - ideographicPx - 1 + topPx - - // measure cap - if (chars.upper) { - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillText(chars.upper, 0, 0) - result.upper = firstTop(ctx.getImageData(0, 0, l, l)) - result.capHeight = (result.baseline - result.upper) - } - - // measure x - if (chars.lower) { - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillText(chars.lower, 0, 0) - result.lower = firstTop(ctx.getImageData(0, 0, l, l)) - result.xHeight = (result.baseline - result.lower) - } - - // measure tittle - if (chars.tittle) { - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillText(chars.tittle, 0, 0) - result.tittle = firstTop(ctx.getImageData(0, 0, l, l)) - } - - // measure ascent - if (chars.ascent) { - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillText(chars.ascent, 0, 0) - result.ascent = firstTop(ctx.getImageData(0, 0, l, l)) - } - - // measure descent - if (chars.descent) { - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillText(chars.descent, 0, 0) - result.descent = firstBottom(ctx.getImageData(0, 0, l, l)) - } - - // measure overshoot - if (chars.overshoot) { - ctx.clearRect(0, 0, l, l) - ctx.textBaseline = 'top' - ctx.fillText(chars.overshoot, 0, 0) - var overshootPx = firstBottom(ctx.getImageData(0, 0, l, l)) - result.overshoot = overshootPx - baseline - } - - // normalize result - for (var name in result) { - result[name] /= fs - } - - result.em = fs - measure.cache[family] = result - - return applyOrigin(result, origin) -} - -function applyOrigin(obj, origin) { - var res = {} - if (typeof origin === 'string') origin = obj[origin] - for (var name in obj) { - if (name === 'em') continue - res[name] = obj[name] - origin - } - return res -} - -function firstTop(iData) { - var l = iData.height - var data = iData.data - for (var i = 3; i < data.length; i+=4) { - if (data[i] !== 0) { - return Math.floor((i - 3) *.25 / l) - } - } -} - -function firstBottom(iData) { - var l = iData.height - var data = iData.data - for (var i = data.length - 1; i > 0; i -= 4) { - if (data[i] !== 0) { - return Math.floor((i - 3) *.25 / l) - } - } -} - -},{}],219:[function(_dereq_,module,exports){ -"use strict" - -module.exports = createRBTree - -var RED = 0 -var BLACK = 1 - -function RBNode(color, key, value, left, right, count) { - this._color = color - this.key = key - this.value = value - this.left = left - this.right = right - this._count = count -} - -function cloneNode(node) { - return new RBNode(node._color, node.key, node.value, node.left, node.right, node._count) -} - -function repaint(color, node) { - return new RBNode(color, node.key, node.value, node.left, node.right, node._count) -} - -function recount(node) { - node._count = 1 + (node.left ? node.left._count : 0) + (node.right ? node.right._count : 0) -} - -function RedBlackTree(compare, root) { - this._compare = compare - this.root = root -} - -var proto = RedBlackTree.prototype - -Object.defineProperty(proto, "keys", { - get: function() { - var result = [] - this.forEach(function(k,v) { - result.push(k) - }) - return result - } -}) - -Object.defineProperty(proto, "values", { - get: function() { - var result = [] - this.forEach(function(k,v) { - result.push(v) - }) - return result - } -}) - -//Returns the number of nodes in the tree -Object.defineProperty(proto, "length", { - get: function() { - if(this.root) { - return this.root._count - } - return 0 - } -}) - -//Insert a new item into the tree -proto.insert = function(key, value) { - var cmp = this._compare - //Find point to insert new node at - var n = this.root - var n_stack = [] - var d_stack = [] - while(n) { - var d = cmp(key, n.key) - n_stack.push(n) - d_stack.push(d) - if(d <= 0) { - n = n.left - } else { - n = n.right - } - } - //Rebuild path to leaf node - n_stack.push(new RBNode(RED, key, value, null, null, 1)) - for(var s=n_stack.length-2; s>=0; --s) { - var n = n_stack[s] - if(d_stack[s] <= 0) { - n_stack[s] = new RBNode(n._color, n.key, n.value, n_stack[s+1], n.right, n._count+1) - } else { - n_stack[s] = new RBNode(n._color, n.key, n.value, n.left, n_stack[s+1], n._count+1) - } - } - //Rebalance tree using rotations - //console.log("start insert", key, d_stack) - for(var s=n_stack.length-1; s>1; --s) { - var p = n_stack[s-1] - var n = n_stack[s] - if(p._color === BLACK || n._color === BLACK) { - break - } - var pp = n_stack[s-2] - if(pp.left === p) { - if(p.left === n) { - var y = pp.right - if(y && y._color === RED) { - //console.log("LLr") - p._color = BLACK - pp.right = repaint(BLACK, y) - pp._color = RED - s -= 1 - } else { - //console.log("LLb") - pp._color = RED - pp.left = p.right - p._color = BLACK - p.right = pp - n_stack[s-2] = p - n_stack[s-1] = n - recount(pp) - recount(p) - if(s >= 3) { - var ppp = n_stack[s-3] - if(ppp.left === pp) { - ppp.left = p - } else { - ppp.right = p - } - } - break - } - } else { - var y = pp.right - if(y && y._color === RED) { - //console.log("LRr") - p._color = BLACK - pp.right = repaint(BLACK, y) - pp._color = RED - s -= 1 - } else { - //console.log("LRb") - p.right = n.left - pp._color = RED - pp.left = n.right - n._color = BLACK - n.left = p - n.right = pp - n_stack[s-2] = n - n_stack[s-1] = p - recount(pp) - recount(p) - recount(n) - if(s >= 3) { - var ppp = n_stack[s-3] - if(ppp.left === pp) { - ppp.left = n - } else { - ppp.right = n - } - } - break - } - } - } else { - if(p.right === n) { - var y = pp.left - if(y && y._color === RED) { - //console.log("RRr", y.key) - p._color = BLACK - pp.left = repaint(BLACK, y) - pp._color = RED - s -= 1 - } else { - //console.log("RRb") - pp._color = RED - pp.right = p.left - p._color = BLACK - p.left = pp - n_stack[s-2] = p - n_stack[s-1] = n - recount(pp) - recount(p) - if(s >= 3) { - var ppp = n_stack[s-3] - if(ppp.right === pp) { - ppp.right = p - } else { - ppp.left = p - } - } - break - } - } else { - var y = pp.left - if(y && y._color === RED) { - //console.log("RLr") - p._color = BLACK - pp.left = repaint(BLACK, y) - pp._color = RED - s -= 1 - } else { - //console.log("RLb") - p.left = n.right - pp._color = RED - pp.right = n.left - n._color = BLACK - n.right = p - n.left = pp - n_stack[s-2] = n - n_stack[s-1] = p - recount(pp) - recount(p) - recount(n) - if(s >= 3) { - var ppp = n_stack[s-3] - if(ppp.right === pp) { - ppp.right = n - } else { - ppp.left = n - } - } - break - } - } - } - } - //Return new tree - n_stack[0]._color = BLACK - return new RedBlackTree(cmp, n_stack[0]) -} - - -//Visit all nodes inorder -function doVisitFull(visit, node) { - if(node.left) { - var v = doVisitFull(visit, node.left) - if(v) { return v } - } - var v = visit(node.key, node.value) - if(v) { return v } - if(node.right) { - return doVisitFull(visit, node.right) - } -} - -//Visit half nodes in order -function doVisitHalf(lo, compare, visit, node) { - var l = compare(lo, node.key) - if(l <= 0) { - if(node.left) { - var v = doVisitHalf(lo, compare, visit, node.left) - if(v) { return v } - } - var v = visit(node.key, node.value) - if(v) { return v } - } - if(node.right) { - return doVisitHalf(lo, compare, visit, node.right) - } -} - -//Visit all nodes within a range -function doVisit(lo, hi, compare, visit, node) { - var l = compare(lo, node.key) - var h = compare(hi, node.key) - var v - if(l <= 0) { - if(node.left) { - v = doVisit(lo, hi, compare, visit, node.left) - if(v) { return v } - } - if(h > 0) { - v = visit(node.key, node.value) - if(v) { return v } - } - } - if(h > 0 && node.right) { - return doVisit(lo, hi, compare, visit, node.right) - } -} - - -proto.forEach = function rbTreeForEach(visit, lo, hi) { - if(!this.root) { - return - } - switch(arguments.length) { - case 1: - return doVisitFull(visit, this.root) - break - - case 2: - return doVisitHalf(lo, this._compare, visit, this.root) - break - - case 3: - if(this._compare(lo, hi) >= 0) { - return - } - return doVisit(lo, hi, this._compare, visit, this.root) - break - } -} - -//First item in list -Object.defineProperty(proto, "begin", { - get: function() { - var stack = [] - var n = this.root - while(n) { - stack.push(n) - n = n.left - } - return new RedBlackTreeIterator(this, stack) - } -}) - -//Last item in list -Object.defineProperty(proto, "end", { - get: function() { - var stack = [] - var n = this.root - while(n) { - stack.push(n) - n = n.right - } - return new RedBlackTreeIterator(this, stack) - } -}) - -//Find the ith item in the tree -proto.at = function(idx) { - if(idx < 0) { - return new RedBlackTreeIterator(this, []) - } - var n = this.root - var stack = [] - while(true) { - stack.push(n) - if(n.left) { - if(idx < n.left._count) { - n = n.left - continue - } - idx -= n.left._count - } - if(!idx) { - return new RedBlackTreeIterator(this, stack) - } - idx -= 1 - if(n.right) { - if(idx >= n.right._count) { - break - } - n = n.right - } else { - break - } - } - return new RedBlackTreeIterator(this, []) -} - -proto.ge = function(key) { - var cmp = this._compare - var n = this.root - var stack = [] - var last_ptr = 0 - while(n) { - var d = cmp(key, n.key) - stack.push(n) - if(d <= 0) { - last_ptr = stack.length - } - if(d <= 0) { - n = n.left - } else { - n = n.right - } - } - stack.length = last_ptr - return new RedBlackTreeIterator(this, stack) -} - -proto.gt = function(key) { - var cmp = this._compare - var n = this.root - var stack = [] - var last_ptr = 0 - while(n) { - var d = cmp(key, n.key) - stack.push(n) - if(d < 0) { - last_ptr = stack.length - } - if(d < 0) { - n = n.left - } else { - n = n.right - } - } - stack.length = last_ptr - return new RedBlackTreeIterator(this, stack) -} - -proto.lt = function(key) { - var cmp = this._compare - var n = this.root - var stack = [] - var last_ptr = 0 - while(n) { - var d = cmp(key, n.key) - stack.push(n) - if(d > 0) { - last_ptr = stack.length - } - if(d <= 0) { - n = n.left - } else { - n = n.right - } - } - stack.length = last_ptr - return new RedBlackTreeIterator(this, stack) -} - -proto.le = function(key) { - var cmp = this._compare - var n = this.root - var stack = [] - var last_ptr = 0 - while(n) { - var d = cmp(key, n.key) - stack.push(n) - if(d >= 0) { - last_ptr = stack.length - } - if(d < 0) { - n = n.left - } else { - n = n.right - } - } - stack.length = last_ptr - return new RedBlackTreeIterator(this, stack) -} - -//Finds the item with key if it exists -proto.find = function(key) { - var cmp = this._compare - var n = this.root - var stack = [] - while(n) { - var d = cmp(key, n.key) - stack.push(n) - if(d === 0) { - return new RedBlackTreeIterator(this, stack) - } - if(d <= 0) { - n = n.left - } else { - n = n.right - } - } - return new RedBlackTreeIterator(this, []) -} - -//Removes item with key from tree -proto.remove = function(key) { - var iter = this.find(key) - if(iter) { - return iter.remove() - } - return this -} - -//Returns the item at `key` -proto.get = function(key) { - var cmp = this._compare - var n = this.root - while(n) { - var d = cmp(key, n.key) - if(d === 0) { - return n.value - } - if(d <= 0) { - n = n.left - } else { - n = n.right - } - } - return -} - -//Iterator for red black tree -function RedBlackTreeIterator(tree, stack) { - this.tree = tree - this._stack = stack -} - -var iproto = RedBlackTreeIterator.prototype - -//Test if iterator is valid -Object.defineProperty(iproto, "valid", { - get: function() { - return this._stack.length > 0 - } -}) - -//Node of the iterator -Object.defineProperty(iproto, "node", { - get: function() { - if(this._stack.length > 0) { - return this._stack[this._stack.length-1] - } - return null - }, - enumerable: true -}) - -//Makes a copy of an iterator -iproto.clone = function() { - return new RedBlackTreeIterator(this.tree, this._stack.slice()) -} - -//Swaps two nodes -function swapNode(n, v) { - n.key = v.key - n.value = v.value - n.left = v.left - n.right = v.right - n._color = v._color - n._count = v._count -} - -//Fix up a double black node in a tree -function fixDoubleBlack(stack) { - var n, p, s, z - for(var i=stack.length-1; i>=0; --i) { - n = stack[i] - if(i === 0) { - n._color = BLACK - return - } - //console.log("visit node:", n.key, i, stack[i].key, stack[i-1].key) - p = stack[i-1] - if(p.left === n) { - //console.log("left child") - s = p.right - if(s.right && s.right._color === RED) { - //console.log("case 1: right sibling child red") - s = p.right = cloneNode(s) - z = s.right = cloneNode(s.right) - p.right = s.left - s.left = p - s.right = z - s._color = p._color - n._color = BLACK - p._color = BLACK - z._color = BLACK - recount(p) - recount(s) - if(i > 1) { - var pp = stack[i-2] - if(pp.left === p) { - pp.left = s - } else { - pp.right = s - } - } - stack[i-1] = s - return - } else if(s.left && s.left._color === RED) { - //console.log("case 1: left sibling child red") - s = p.right = cloneNode(s) - z = s.left = cloneNode(s.left) - p.right = z.left - s.left = z.right - z.left = p - z.right = s - z._color = p._color - p._color = BLACK - s._color = BLACK - n._color = BLACK - recount(p) - recount(s) - recount(z) - if(i > 1) { - var pp = stack[i-2] - if(pp.left === p) { - pp.left = z - } else { - pp.right = z - } - } - stack[i-1] = z - return - } - if(s._color === BLACK) { - if(p._color === RED) { - //console.log("case 2: black sibling, red parent", p.right.value) - p._color = BLACK - p.right = repaint(RED, s) - return - } else { - //console.log("case 2: black sibling, black parent", p.right.value) - p.right = repaint(RED, s) - continue - } - } else { - //console.log("case 3: red sibling") - s = cloneNode(s) - p.right = s.left - s.left = p - s._color = p._color - p._color = RED - recount(p) - recount(s) - if(i > 1) { - var pp = stack[i-2] - if(pp.left === p) { - pp.left = s - } else { - pp.right = s - } - } - stack[i-1] = s - stack[i] = p - if(i+1 < stack.length) { - stack[i+1] = n - } else { - stack.push(n) - } - i = i+2 - } - } else { - //console.log("right child") - s = p.left - if(s.left && s.left._color === RED) { - //console.log("case 1: left sibling child red", p.value, p._color) - s = p.left = cloneNode(s) - z = s.left = cloneNode(s.left) - p.left = s.right - s.right = p - s.left = z - s._color = p._color - n._color = BLACK - p._color = BLACK - z._color = BLACK - recount(p) - recount(s) - if(i > 1) { - var pp = stack[i-2] - if(pp.right === p) { - pp.right = s - } else { - pp.left = s - } - } - stack[i-1] = s - return - } else if(s.right && s.right._color === RED) { - //console.log("case 1: right sibling child red") - s = p.left = cloneNode(s) - z = s.right = cloneNode(s.right) - p.left = z.right - s.right = z.left - z.right = p - z.left = s - z._color = p._color - p._color = BLACK - s._color = BLACK - n._color = BLACK - recount(p) - recount(s) - recount(z) - if(i > 1) { - var pp = stack[i-2] - if(pp.right === p) { - pp.right = z - } else { - pp.left = z - } - } - stack[i-1] = z - return - } - if(s._color === BLACK) { - if(p._color === RED) { - //console.log("case 2: black sibling, red parent") - p._color = BLACK - p.left = repaint(RED, s) - return - } else { - //console.log("case 2: black sibling, black parent") - p.left = repaint(RED, s) - continue - } - } else { - //console.log("case 3: red sibling") - s = cloneNode(s) - p.left = s.right - s.right = p - s._color = p._color - p._color = RED - recount(p) - recount(s) - if(i > 1) { - var pp = stack[i-2] - if(pp.right === p) { - pp.right = s - } else { - pp.left = s - } - } - stack[i-1] = s - stack[i] = p - if(i+1 < stack.length) { - stack[i+1] = n - } else { - stack.push(n) - } - i = i+2 - } - } - } -} - -//Removes item at iterator from tree -iproto.remove = function() { - var stack = this._stack - if(stack.length === 0) { - return this.tree - } - //First copy path to node - var cstack = new Array(stack.length) - var n = stack[stack.length-1] - cstack[cstack.length-1] = new RBNode(n._color, n.key, n.value, n.left, n.right, n._count) - for(var i=stack.length-2; i>=0; --i) { - var n = stack[i] - if(n.left === stack[i+1]) { - cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i+1], n.right, n._count) - } else { - cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count) - } - } - - //Get node - n = cstack[cstack.length-1] - //console.log("start remove: ", n.value) - - //If not leaf, then swap with previous node - if(n.left && n.right) { - //console.log("moving to leaf") - - //First walk to previous leaf - var split = cstack.length - n = n.left - while(n.right) { - cstack.push(n) - n = n.right - } - //Copy path to leaf - var v = cstack[split-1] - cstack.push(new RBNode(n._color, v.key, v.value, n.left, n.right, n._count)) - cstack[split-1].key = n.key - cstack[split-1].value = n.value - - //Fix up stack - for(var i=cstack.length-2; i>=split; --i) { - n = cstack[i] - cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count) - } - cstack[split-1].left = cstack[split] - } - //console.log("stack=", cstack.map(function(v) { return v.value })) - - //Remove leaf node - n = cstack[cstack.length-1] - if(n._color === RED) { - //Easy case: removing red leaf - //console.log("RED leaf") - var p = cstack[cstack.length-2] - if(p.left === n) { - p.left = null - } else if(p.right === n) { - p.right = null - } - cstack.pop() - for(var i=0; i 0) { - return this._stack[this._stack.length-1].key - } - return - }, - enumerable: true -}) - -//Returns value -Object.defineProperty(iproto, "value", { - get: function() { - if(this._stack.length > 0) { - return this._stack[this._stack.length-1].value - } - return - }, - enumerable: true -}) - - -//Returns the position of this iterator in the sorted list -Object.defineProperty(iproto, "index", { - get: function() { - var idx = 0 - var stack = this._stack - if(stack.length === 0) { - var r = this.tree.root - if(r) { - return r._count - } - return 0 - } else if(stack[stack.length-1].left) { - idx = stack[stack.length-1].left._count - } - for(var s=stack.length-2; s>=0; --s) { - if(stack[s+1] === stack[s].right) { - ++idx - if(stack[s].left) { - idx += stack[s].left._count - } - } - } - return idx - }, - enumerable: true -}) - -//Advances iterator to next element in list -iproto.next = function() { - var stack = this._stack - if(stack.length === 0) { - return - } - var n = stack[stack.length-1] - if(n.right) { - n = n.right - while(n) { - stack.push(n) - n = n.left - } - } else { - stack.pop() - while(stack.length > 0 && stack[stack.length-1].right === n) { - n = stack[stack.length-1] - stack.pop() - } - } -} - -//Checks if iterator is at end of tree -Object.defineProperty(iproto, "hasNext", { - get: function() { - var stack = this._stack - if(stack.length === 0) { - return false - } - if(stack[stack.length-1].right) { - return true - } - for(var s=stack.length-1; s>0; --s) { - if(stack[s-1].left === stack[s]) { - return true - } - } - return false - } -}) - -//Update value -iproto.update = function(value) { - var stack = this._stack - if(stack.length === 0) { - throw new Error("Can't update empty node!") - } - var cstack = new Array(stack.length) - var n = stack[stack.length-1] - cstack[cstack.length-1] = new RBNode(n._color, n.key, value, n.left, n.right, n._count) - for(var i=stack.length-2; i>=0; --i) { - n = stack[i] - if(n.left === stack[i+1]) { - cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i+1], n.right, n._count) - } else { - cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count) - } - } - return new RedBlackTree(this.tree._compare, cstack[0]) -} - -//Moves iterator backward one element -iproto.prev = function() { - var stack = this._stack - if(stack.length === 0) { - return - } - var n = stack[stack.length-1] - if(n.left) { - n = n.left - while(n) { - stack.push(n) - n = n.right - } - } else { - stack.pop() - while(stack.length > 0 && stack[stack.length-1].left === n) { - n = stack[stack.length-1] - stack.pop() - } - } -} - -//Checks if iterator is at start of tree -Object.defineProperty(iproto, "hasPrev", { - get: function() { - var stack = this._stack - if(stack.length === 0) { - return false - } - if(stack[stack.length-1].left) { - return true - } - for(var s=stack.length-1; s>0; --s) { - if(stack[s-1].right === stack[s]) { - return true - } - } - return false - } -}) - -//Default comparison function -function defaultCompare(a, b) { - if(a < b) { - return -1 - } - if(a > b) { - return 1 - } - return 0 -} - -//Build a tree -function createRBTree(compare) { - return new RedBlackTree(compare || defaultCompare, null) -} -},{}],220:[function(_dereq_,module,exports){ -// transliterated from the python snippet here: -// http://en.wikipedia.org/wiki/Lanczos_approximation - -var g = 7; -var p = [ - 0.99999999999980993, - 676.5203681218851, - -1259.1392167224028, - 771.32342877765313, - -176.61502916214059, - 12.507343278686905, - -0.13857109526572012, - 9.9843695780195716e-6, - 1.5056327351493116e-7 -]; - -var g_ln = 607/128; -var p_ln = [ - 0.99999999999999709182, - 57.156235665862923517, - -59.597960355475491248, - 14.136097974741747174, - -0.49191381609762019978, - 0.33994649984811888699e-4, - 0.46523628927048575665e-4, - -0.98374475304879564677e-4, - 0.15808870322491248884e-3, - -0.21026444172410488319e-3, - 0.21743961811521264320e-3, - -0.16431810653676389022e-3, - 0.84418223983852743293e-4, - -0.26190838401581408670e-4, - 0.36899182659531622704e-5 -]; - -// Spouge approximation (suitable for large arguments) -function lngamma(z) { - - if(z < 0) return Number('0/0'); - var x = p_ln[0]; - for(var i = p_ln.length - 1; i > 0; --i) x += p_ln[i] / (z + i); - var t = z + g_ln + 0.5; - return .5*Math.log(2*Math.PI)+(z+.5)*Math.log(t)-t+Math.log(x)-Math.log(z); -} - -module.exports = function gamma (z) { - if (z < 0.5) { - return Math.PI / (Math.sin(Math.PI * z) * gamma(1 - z)); - } - else if(z > 100) return Math.exp(lngamma(z)); - else { - z -= 1; - var x = p[0]; - for (var i = 1; i < g + 2; i++) { - x += p[i] / (z + i); - } - var t = z + g + 0.5; - - return Math.sqrt(2 * Math.PI) - * Math.pow(t, z + 0.5) - * Math.exp(-t) - * x - ; - } -}; - -module.exports.log = lngamma; - -},{}],221:[function(_dereq_,module,exports){ -module.exports = getCanvasContext -function getCanvasContext (type, opts) { - if (typeof type !== 'string') { - throw new TypeError('must specify type string') - } - - opts = opts || {} - - if (typeof document === 'undefined' && !opts.canvas) { - return null // check for Node - } - - var canvas = opts.canvas || document.createElement('canvas') - if (typeof opts.width === 'number') { - canvas.width = opts.width - } - if (typeof opts.height === 'number') { - canvas.height = opts.height - } - - var attribs = opts - var gl - try { - var names = [ type ] - // prefix GL contexts - if (type.indexOf('webgl') === 0) { - names.push('experimental-' + type) - } - - for (var i = 0; i < names.length; i++) { - gl = canvas.getContext(names[i], attribs) - if (gl) return gl - } - } catch (e) { - gl = null - } - return (gl || null) // ensure null on fail -} - -},{}],222:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createAxes - -var createText = _dereq_('./lib/text.js') -var createLines = _dereq_('./lib/lines.js') -var createBackground = _dereq_('./lib/background.js') -var getCubeProperties = _dereq_('./lib/cube.js') -var Ticks = _dereq_('./lib/ticks.js') - -var identity = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]) - -function copyVec3(a, b) { - a[0] = b[0] - a[1] = b[1] - a[2] = b[2] - return a -} - -function Axes(gl) { - this.gl = gl - - this.pixelRatio = 1 - - this.bounds = [ [-10, -10, -10], - [ 10, 10, 10] ] - this.ticks = [ [], [], [] ] - this.autoTicks = true - this.tickSpacing = [ 1, 1, 1 ] - - this.tickEnable = [ true, true, true ] - this.tickFont = [ 'sans-serif', 'sans-serif', 'sans-serif' ] - this.tickSize = [ 12, 12, 12 ] - this.tickAngle = [ 0, 0, 0 ] - this._tickAlign = [ 'auto', 'auto', 'auto' ] - this.tickColor = [ [0,0,0,1], [0,0,0,1], [0,0,0,1] ] - this.tickPad = [ 10, 10, 10 ] - - this.lastCubeProps = { - cubeEdges: [0,0,0], - axis: [0,0,0] - } - - this.labels = [ 'x', 'y', 'z' ] - this.labelEnable = [ true, true, true ] - this.labelFont = 'sans-serif' - this.labelSize = [ 20, 20, 20 ] - this._labelAngle = [ 0, 0, 0 ] - this._labelAlign = [ 'auto', 'auto', 'auto' ] - this.labelColor = [ [0,0,0,1], [0,0,0,1], [0,0,0,1] ] - this.labelPad = [ 10, 10, 10 ] - - this.lineEnable = [ true, true, true ] - this.lineMirror = [ false, false, false ] - this.lineWidth = [ 1, 1, 1 ] - this.lineColor = [ [0,0,0,1], [0,0,0,1], [0,0,0,1] ] - - this.lineTickEnable = [ true, true, true ] - this.lineTickMirror = [ false, false, false ] - this.lineTickLength = [ 0, 0, 0 ] - this.lineTickWidth = [ 1, 1, 1 ] - this.lineTickColor = [ [0,0,0,1], [0,0,0,1], [0,0,0,1] ] - - this.gridEnable = [ true, true, true ] - this.gridWidth = [ 1, 1, 1 ] - this.gridColor = [ [0,0,0,1], [0,0,0,1], [0,0,0,1] ] - - this.zeroEnable = [ true, true, true ] - this.zeroLineColor = [ [0,0,0,1], [0,0,0,1], [0,0,0,1] ] - this.zeroLineWidth = [ 2, 2, 2 ] - - this.backgroundEnable = [ false, false, false ] - this.backgroundColor = [ [0.8, 0.8, 0.8, 0.5], - [0.8, 0.8, 0.8, 0.5], - [0.8, 0.8, 0.8, 0.5] ] - - this._firstInit = true - this._text = null - this._lines = null - this._background = createBackground(gl) -} - -var proto = Axes.prototype - -proto.update = function(options) { - options = options || {} - - //Option parsing helper functions - function parseOption(nest, cons, name) { - if(name in options) { - var opt = options[name] - var prev = this[name] - var next - if(nest ? (Array.isArray(opt) && Array.isArray(opt[0])) : - Array.isArray(opt) ) { - this[name] = next = [ cons(opt[0]), cons(opt[1]), cons(opt[2]) ] - } else { - this[name] = next = [ cons(opt), cons(opt), cons(opt) ] - } - for(var i=0; i<3; ++i) { - if(next[i] !== prev[i]) { - return true - } - } - } - return false - } - - var NUMBER = parseOption.bind(this, false, Number) - var BOOLEAN = parseOption.bind(this, false, Boolean) - var STRING = parseOption.bind(this, false, String) - var COLOR = parseOption.bind(this, true, function(v) { - if(Array.isArray(v)) { - if(v.length === 3) { - return [ +v[0], +v[1], +v[2], 1.0 ] - } else if(v.length === 4) { - return [ +v[0], +v[1], +v[2], +v[3] ] - } - } - return [ 0, 0, 0, 1 ] - }) - - //Tick marks and bounds - var nextTicks - var ticksUpdate = false - var boundsChanged = false - if('bounds' in options) { - var bounds = options.bounds -i_loop: - for(var i=0; i<2; ++i) { - for(var j=0; j<3; ++j) { - if(bounds[i][j] !== this.bounds[i][j]) { - boundsChanged = true - } - this.bounds[i][j] = bounds[i][j] - } - } - } - if('ticks' in options) { - nextTicks = options.ticks - ticksUpdate = true - this.autoTicks = false - for(var i=0; i<3; ++i) { - this.tickSpacing[i] = 0.0 - } - } else if(NUMBER('tickSpacing')) { - this.autoTicks = true - boundsChanged = true - } - - if(this._firstInit) { - if(!('ticks' in options || 'tickSpacing' in options)) { - this.autoTicks = true - } - - //Force tick recomputation on first update - boundsChanged = true - ticksUpdate = true - this._firstInit = false - } - - if(boundsChanged && this.autoTicks) { - nextTicks = Ticks.create(this.bounds, this.tickSpacing) - ticksUpdate = true - } - - //Compare next ticks to previous ticks, only update if needed - if(ticksUpdate) { - for(var i=0; i<3; ++i) { - nextTicks[i].sort(function(a,b) { - return a.x-b.x - }) - } - if(Ticks.equal(nextTicks, this.ticks)) { - ticksUpdate = false - } else { - this.ticks = nextTicks - } - } - - //Parse tick properties - BOOLEAN('tickEnable') - if(STRING('tickFont')) { - ticksUpdate = true //If font changes, must rebuild vbo - } - NUMBER('tickSize') - NUMBER('tickAngle') - NUMBER('tickPad') - COLOR('tickColor') - - //Axis labels - var labelUpdate = STRING('labels') - if(STRING('labelFont')) { - labelUpdate = true - } - BOOLEAN('labelEnable') - NUMBER('labelSize') - NUMBER('labelPad') - COLOR('labelColor') - - //Axis lines - BOOLEAN('lineEnable') - BOOLEAN('lineMirror') - NUMBER('lineWidth') - COLOR('lineColor') - - //Axis line ticks - BOOLEAN('lineTickEnable') - BOOLEAN('lineTickMirror') - NUMBER('lineTickLength') - NUMBER('lineTickWidth') - COLOR('lineTickColor') - - //Grid lines - BOOLEAN('gridEnable') - NUMBER('gridWidth') - COLOR('gridColor') - - //Zero line - BOOLEAN('zeroEnable') - COLOR('zeroLineColor') - NUMBER('zeroLineWidth') - - //Background - BOOLEAN('backgroundEnable') - COLOR('backgroundColor') - - //Update text if necessary - if(!this._text) { - this._text = createText( - this.gl, - this.bounds, - this.labels, - this.labelFont, - this.ticks, - this.tickFont) - } else if(this._text && (labelUpdate || ticksUpdate)) { - this._text.update( - this.bounds, - this.labels, - this.labelFont, - this.ticks, - this.tickFont) - } - - //Update lines if necessary - if(this._lines && ticksUpdate) { - this._lines.dispose() - this._lines = null - } - if(!this._lines) { - this._lines = createLines(this.gl, this.bounds, this.ticks) - } -} - -function OffsetInfo() { - this.primalOffset = [0,0,0] - this.primalMinor = [0,0,0] - this.mirrorOffset = [0,0,0] - this.mirrorMinor = [0,0,0] -} - -var LINE_OFFSET = [ new OffsetInfo(), new OffsetInfo(), new OffsetInfo() ] - -function computeLineOffset(result, i, bounds, cubeEdges, cubeAxis) { - var primalOffset = result.primalOffset - var primalMinor = result.primalMinor - var dualOffset = result.mirrorOffset - var dualMinor = result.mirrorMinor - var e = cubeEdges[i] - - //Calculate offsets - for(var j=0; j<3; ++j) { - if(i === j) { - continue - } - var a = primalOffset, - b = dualOffset, - c = primalMinor, - d = dualMinor - if(e & (1< 0) { - c[j] = -1 - d[j] = 0 - } else { - c[j] = 0 - d[j] = +1 - } - } -} - -var CUBE_ENABLE = [0,0,0] -var DEFAULT_PARAMS = { - model: identity, - view: identity, - projection: identity -} - -proto.isOpaque = function() { - return true -} - -proto.isTransparent = function() { - return false -} - -proto.drawTransparent = function(params) {} - -var ALIGN_OPTION_AUTO = 0 // i.e. as defined in the shader the text would rotate to stay upwards range: [-90,90] - -var PRIMAL_MINOR = [0,0,0] -var MIRROR_MINOR = [0,0,0] -var PRIMAL_OFFSET = [0,0,0] - -proto.draw = function(params) { - params = params || DEFAULT_PARAMS - - var gl = this.gl - - //Geometry for camera and axes - var model = params.model || identity - var view = params.view || identity - var projection = params.projection || identity - var bounds = this.bounds - - //Unpack axis info - var cubeParams = getCubeProperties(model, view, projection, bounds) - var cubeEdges = cubeParams.cubeEdges - var cubeAxis = cubeParams.axis - - var cx = view[12] - var cy = view[13] - var cz = view[14] - var cw = view[15] - - var pixelScaleF = this.pixelRatio * (projection[3]*cx + projection[7]*cy + projection[11]*cz + projection[15]*cw) / gl.drawingBufferHeight - - for(var i=0; i<3; ++i) { - this.lastCubeProps.cubeEdges[i] = cubeEdges[i] - this.lastCubeProps.axis[i] = cubeAxis[i] - } - - //Compute axis info - var lineOffset = LINE_OFFSET - for(var i=0; i<3; ++i) { - computeLineOffset( - LINE_OFFSET[i], - i, - this.bounds, - cubeEdges, - cubeAxis) - } - - //Set up state parameters - var gl = this.gl - - //Draw background first - var cubeEnable = CUBE_ENABLE - for(var i=0; i<3; ++i) { - if(this.backgroundEnable[i]) { - cubeEnable[i] = cubeAxis[i] - } else { - cubeEnable[i] = 0 - } - } - - this._background.draw( - model, - view, - projection, - bounds, - cubeEnable, - this.backgroundColor) - - //Draw lines - this._lines.bind( - model, - view, - projection, - this) - - //First draw grid lines and zero lines - for(var i=0; i<3; ++i) { - var x = [0,0,0] - if(cubeAxis[i] > 0) { - x[i] = bounds[1][i] - } else { - x[i] = bounds[0][i] - } - - //Draw grid lines - for(var j=0; j<2; ++j) { - var u = (i + 1 + j) % 3 - var v = (i + 1 + (j^1)) % 3 - if(this.gridEnable[u]) { - this._lines.drawGrid(u, v, this.bounds, x, this.gridColor[u], this.gridWidth[u]*this.pixelRatio) - } - } - - //Draw zero lines (need to do this AFTER all grid lines are drawn) - for(var j=0; j<2; ++j) { - var u = (i + 1 + j) % 3 - var v = (i + 1 + (j^1)) % 3 - if(this.zeroEnable[v]) { - //Check if zero line in bounds - if(Math.min(bounds[0][v], bounds[1][v]) <= 0 && Math.max(bounds[0][v], bounds[1][v]) >= 0) { - this._lines.drawZero(u, v, this.bounds, x, this.zeroLineColor[v], this.zeroLineWidth[v]*this.pixelRatio) - } - } - } - } - - //Then draw axis lines and tick marks - for(var i=0; i<3; ++i) { - - //Draw axis lines - if(this.lineEnable[i]) { - this._lines.drawAxisLine(i, this.bounds, lineOffset[i].primalOffset, this.lineColor[i], this.lineWidth[i]*this.pixelRatio) - } - if(this.lineMirror[i]) { - this._lines.drawAxisLine(i, this.bounds, lineOffset[i].mirrorOffset, this.lineColor[i], this.lineWidth[i]*this.pixelRatio) - } - - //Compute minor axes - var primalMinor = copyVec3(PRIMAL_MINOR, lineOffset[i].primalMinor) - var mirrorMinor = copyVec3(MIRROR_MINOR, lineOffset[i].mirrorMinor) - var tickLength = this.lineTickLength - var op = 0 - for(var j=0; j<3; ++j) { - var scaleFactor = pixelScaleF / model[5*j] - primalMinor[j] *= tickLength[j] * scaleFactor - mirrorMinor[j] *= tickLength[j] * scaleFactor - } - - //Draw axis line ticks - if(this.lineTickEnable[i]) { - this._lines.drawAxisTicks(i, lineOffset[i].primalOffset, primalMinor, this.lineTickColor[i], this.lineTickWidth[i]*this.pixelRatio) - } - if(this.lineTickMirror[i]) { - this._lines.drawAxisTicks(i, lineOffset[i].mirrorOffset, mirrorMinor, this.lineTickColor[i], this.lineTickWidth[i]*this.pixelRatio) - } - } - this._lines.unbind() - - //Draw text sprites - this._text.bind( - model, - view, - projection, - this.pixelRatio) - - var alignOpt // options in shader are from this list {-1, 0, 1, 2, 3, ..., n} - // -1: backward compatible - // 0: raw data - // 1: auto align, free angles - // 2: auto align, horizontal or vertical - //3-n: auto align, round to n directions e.g. 12 -> round to angles with 30-degree steps - - var hv_ratio = 0.5 // can have an effect on the ratio between horizontals and verticals when using option 2 - - var enableAlign - var alignDir - - function alignTo(i) { - alignDir = [0,0,0] - alignDir[i] = 1 - } - - function solveTickAlignments(i, minor, major) { - - var i1 = (i + 1) % 3 - var i2 = (i + 2) % 3 - - var A = minor[i1] - var B = minor[i2] - var C = major[i1] - var D = major[i2] - - if ((A > 0) && (D > 0)) { alignTo(i1); return; } - else if ((A > 0) && (D < 0)) { alignTo(i1); return; } - else if ((A < 0) && (D > 0)) { alignTo(i1); return; } - else if ((A < 0) && (D < 0)) { alignTo(i1); return; } - else if ((B > 0) && (C > 0)) { alignTo(i2); return; } - else if ((B > 0) && (C < 0)) { alignTo(i2); return; } - else if ((B < 0) && (C > 0)) { alignTo(i2); return; } - else if ((B < 0) && (C < 0)) { alignTo(i2); return; } - } - - for(var i=0; i<3; ++i) { - - var minor = lineOffset[i].primalMinor - var major = lineOffset[i].mirrorMinor - - var offset = copyVec3(PRIMAL_OFFSET, lineOffset[i].primalOffset) - - for(var j=0; j<3; ++j) { - if(this.lineTickEnable[i]) { - offset[j] += pixelScaleF * minor[j] * Math.max(this.lineTickLength[j], 0) / model[5*j] - } - } - - var axis = [0,0,0] - axis[i] = 1 - - //Draw tick text - if(this.tickEnable[i]) { - - if(this.tickAngle[i] === -3600) { - this.tickAngle[i] = 0 - this._tickAlign[i] = 'auto' - } else { - this._tickAlign[i] = -1 - } - - enableAlign = 1; - - alignOpt = [this._tickAlign[i], hv_ratio, enableAlign] - if(alignOpt[0] === 'auto') alignOpt[0] = ALIGN_OPTION_AUTO - else alignOpt[0] = parseInt('' + alignOpt[0]) - - alignDir = [0,0,0] - solveTickAlignments(i, minor, major) - - //Add tick padding - for(var j=0; j<3; ++j) { - offset[j] += pixelScaleF * minor[j] * this.tickPad[j] / model[5*j] - } - - //Draw axis - this._text.drawTicks( - i, - this.tickSize[i], - this.tickAngle[i], - offset, - this.tickColor[i], - axis, - alignDir, - alignOpt) - } - - //Draw labels - if(this.labelEnable[i]) { - - enableAlign = 0 - alignDir = [0,0,0] - if(this.labels[i].length > 4) { // for large label axis enable alignDir to axis - alignTo(i) - enableAlign = 1 - } - - alignOpt = [this._labelAlign[i], hv_ratio, enableAlign] - if(alignOpt[0] === 'auto') alignOpt[0] = ALIGN_OPTION_AUTO - else alignOpt[0] = parseInt('' + alignOpt[0]) - - //Add label padding - for(var j=0; j<3; ++j) { - offset[j] += pixelScaleF * minor[j] * this.labelPad[j] / model[5*j] - } - offset[i] += 0.5 * (bounds[0][i] + bounds[1][i]) - - //Draw axis - this._text.drawLabel( - i, - this.labelSize[i], - this._labelAngle[i], - offset, - this.labelColor[i], - [0,0,0], - alignDir, - alignOpt) - } - } - - this._text.unbind() -} - -proto.dispose = function() { - this._text.dispose() - this._lines.dispose() - this._background.dispose() - this._lines = null - this._text = null - this._background = null - this.gl = null -} - -function createAxes(gl, options) { - var axes = new Axes(gl) - axes.update(options) - return axes -} - -},{"./lib/background.js":223,"./lib/cube.js":224,"./lib/lines.js":225,"./lib/text.js":227,"./lib/ticks.js":228}],223:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createBackgroundCube - -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createShader = _dereq_('./shaders').bg - -function BackgroundCube(gl, buffer, vao, shader) { - this.gl = gl - this.buffer = buffer - this.vao = vao - this.shader = shader -} - -var proto = BackgroundCube.prototype - -proto.draw = function(model, view, projection, bounds, enable, colors) { - var needsBG = false - for(var i=0; i<3; ++i) { - needsBG = needsBG || enable[i] - } - if(!needsBG) { - return - } - - var gl = this.gl - - gl.enable(gl.POLYGON_OFFSET_FILL) - gl.polygonOffset(1, 2) - - this.shader.bind() - this.shader.uniforms = { - model: model, - view: view, - projection: projection, - bounds: bounds, - enable: enable, - colors: colors - } - this.vao.bind() - this.vao.draw(this.gl.TRIANGLES, 36) - this.vao.unbind() - - gl.disable(gl.POLYGON_OFFSET_FILL) -} - -proto.dispose = function() { - this.vao.dispose() - this.buffer.dispose() - this.shader.dispose() -} - -function createBackgroundCube(gl) { - //Create cube vertices - var vertices = [] - var indices = [] - var ptr = 0 - for(var d=0; d<3; ++d) { - var u = (d+1) % 3 - var v = (d+2) % 3 - var x = [0,0,0] - var c = [0,0,0] - for(var s=-1; s<=1; s+=2) { - indices.push(ptr, ptr+2, ptr+1, - ptr+1, ptr+2, ptr+3) - x[d] = s - c[d] = s - for(var i=-1; i<=1; i+=2) { - x[u] = i - for(var j=-1; j<=1; j+=2) { - x[v] = j - vertices.push(x[0], x[1], x[2], - c[0], c[1], c[2]) - ptr += 1 - } - } - //Swap u and v - var tt = u - u = v - v = tt - } - } - - //Allocate buffer and vertex array - var buffer = createBuffer(gl, new Float32Array(vertices)) - var elements = createBuffer(gl, new Uint16Array(indices), gl.ELEMENT_ARRAY_BUFFER) - var vao = createVAO(gl, [ - { - buffer: buffer, - type: gl.FLOAT, - size: 3, - offset: 0, - stride: 24 - }, - { - buffer: buffer, - type: gl.FLOAT, - size: 3, - offset: 12, - stride: 24 - } - ], elements) - - //Create shader object - var shader = createShader(gl) - shader.attributes.position.location = 0 - shader.attributes.normal.location = 1 - - return new BackgroundCube(gl, buffer, vao, shader) -} - -},{"./shaders":226,"gl-buffer":230,"gl-vao":310}],224:[function(_dereq_,module,exports){ -"use strict" - -module.exports = getCubeEdges - -var bits = _dereq_('bit-twiddle') -var multiply = _dereq_('gl-mat4/multiply') -var invert = _dereq_('gl-mat4/invert') -var splitPoly = _dereq_('split-polygon') -var orient = _dereq_('robust-orientation') - -var mvp = new Array(16) -var imvp = new Array(16) -var pCubeVerts = new Array(8) -var cubeVerts = new Array(8) -var x = new Array(3) -var zero3 = [0,0,0] - -;(function() { - for(var i=0; i<8; ++i) { - pCubeVerts[i] =[1,1,1,1] - cubeVerts[i] = [1,1,1] - } -})() - - -function transformHg(result, x, mat) { - for(var i=0; i<4; ++i) { - result[i] = mat[12+i] - for(var j=0; j<3; ++j) { - result[i] += x[j]*mat[4*j+i] - } - } -} - -var FRUSTUM_PLANES = [ - [ 0, 0, 1, 0, 0], - [ 0, 0,-1, 1, 0], - [ 0,-1, 0, 1, 0], - [ 0, 1, 0, 1, 0], - [-1, 0, 0, 1, 0], - [ 1, 0, 0, 1, 0] -] - -function polygonArea(p) { - for(var i=0; i o0) { - closest |= 1< o0) { - closest |= 1< cubeVerts[i][1]) { - bottom = i - } - } - - //Find left/right neighbors of bottom vertex - var left = -1 - for(var i=0; i<3; ++i) { - var idx = bottom ^ (1< cubeVerts[right][0]) { - right = idx - } - } - - //Determine edge axis coordinates - var cubeEdges = CUBE_EDGES - cubeEdges[0] = cubeEdges[1] = cubeEdges[2] = 0 - cubeEdges[bits.log2(left^bottom)] = bottom&left - cubeEdges[bits.log2(bottom^right)] = bottom&right - var top = right ^ 7 - if(top === closest || top === farthest) { - top = left ^ 7 - cubeEdges[bits.log2(right^top)] = top&right - } else { - cubeEdges[bits.log2(left^top)] = top&left - } - - //Determine visible faces - var axis = CUBE_AXIS - var cutCorner = closest - for(var d=0; d<3; ++d) { - if(cutCorner & (1< HALF_PI) && (b <= ONE_AND_HALF_PI)) ?\n b - PI :\n b;\n}\n\nfloat look_horizontal_or_vertical(float a, float ratio) {\n // ratio controls the ratio between being horizontal to (vertical + horizontal)\n // if ratio is set to 0.5 then it is 50%, 50%.\n // when using a higher ratio e.g. 0.75 the result would\n // likely be more horizontal than vertical.\n\n float b = positive_angle(a);\n\n return\n (b < ( ratio) * HALF_PI) ? 0.0 :\n (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :\n (b < (2.0 + ratio) * HALF_PI) ? 0.0 :\n (b < (4.0 - ratio) * HALF_PI) ? HALF_PI :\n 0.0;\n}\n\nfloat roundTo(float a, float b) {\n return float(b * floor((a + 0.5 * b) / b));\n}\n\nfloat look_round_n_directions(float a, int n) {\n float b = positive_angle(a);\n float div = TWO_PI / float(n);\n float c = roundTo(b, div);\n return look_upwards(c);\n}\n\nfloat applyAlignOption(float rawAngle, float delta) {\n return\n (option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions\n (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical\n (option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis\n (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards\n (option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal\n rawAngle; // otherwise return back raw input angle\n}\n\nbool isAxisTitle = (axis.x == 0.0) &&\n (axis.y == 0.0) &&\n (axis.z == 0.0);\n\nvoid main() {\n //Compute world offset\n float axisDistance = position.z;\n vec3 dataPosition = axisDistance * axis + offset;\n\n float beta = angle; // i.e. user defined attributes for each tick\n\n float axisAngle;\n float clipAngle;\n float flip;\n\n if (enableAlign) {\n axisAngle = (isAxisTitle) ? HALF_PI :\n computeViewAngle(dataPosition, dataPosition + axis);\n clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);\n\n axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;\n clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;\n\n flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),\n vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;\n\n beta += applyAlignOption(clipAngle, flip * PI);\n }\n\n //Compute plane offset\n vec2 planeCoord = position.xy * pixelScale;\n\n mat2 planeXform = scale * mat2(\n cos(beta), sin(beta),\n -sin(beta), cos(beta)\n );\n\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n //Compute clip position\n vec3 clipPosition = project(dataPosition);\n\n //Apply text offset in clip coordinates\n clipPosition += vec3(viewOffset, 0.0);\n\n //Done\n gl_Position = vec4(clipPosition, 1.0);\n}"]) -var textFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"]) -exports.text = function(gl) { - return createShader(gl, textVert, textFrag, null, [ - {name: 'position', type: 'vec3'} - ]) -} - -var bgVert = glslify(["#define GLSLIFY 1\nattribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection;\nuniform vec3 enable;\nuniform vec3 bounds[2];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n\n vec3 signAxis = sign(bounds[1] - bounds[0]);\n\n vec3 realNormal = signAxis * normal;\n\n if(dot(realNormal, enable) > 0.0) {\n vec3 minRange = min(bounds[0], bounds[1]);\n vec3 maxRange = max(bounds[0], bounds[1]);\n vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n\n colorChannel = abs(realNormal);\n}"]) -var bgFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] +\n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}"]) -exports.bg = function(gl) { - return createShader(gl, bgVert, bgFrag, null, [ - {name: 'position', type: 'vec3'}, - {name: 'normal', type: 'vec3'} - ]) -} - -},{"gl-shader":288,"glslify":392}],227:[function(_dereq_,module,exports){ -(function (process){ -"use strict" - -module.exports = createTextSprites - -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var vectorizeText = _dereq_('vectorize-text') -var createShader = _dereq_('./shaders').text - -var globals = window || process.global || {} -var __TEXT_CACHE = globals.__TEXT_CACHE || {} -globals.__TEXT_CACHE = {} - -//Vertex buffer format for text is: -// -/// [x,y,z] = Spatial coordinate -// - -var VERTEX_SIZE = 3 -var VERTEX_STRIDE = VERTEX_SIZE * 4 - -function TextSprites( - gl, - shader, - buffer, - vao) { - this.gl = gl - this.shader = shader - this.buffer = buffer - this.vao = vao - this.tickOffset = - this.tickCount = - this.labelOffset = - this.labelCount = null -} - -var proto = TextSprites.prototype - -//Bind textures for rendering -var SHAPE = [0,0] -proto.bind = function(model, view, projection, pixelScale) { - this.vao.bind() - this.shader.bind() - var uniforms = this.shader.uniforms - uniforms.model = model - uniforms.view = view - uniforms.projection = projection - uniforms.pixelScale = pixelScale - SHAPE[0] = this.gl.drawingBufferWidth - SHAPE[1] = this.gl.drawingBufferHeight - this.shader.uniforms.resolution = SHAPE -} - -proto.unbind = function() { - this.vao.unbind() -} - -proto.update = function(bounds, labels, labelFont, ticks, tickFont) { - var gl = this.gl - var data = [] - - function addItem(t, text, font, size) { - var fontcache = __TEXT_CACHE[font] - if(!fontcache) { - fontcache = __TEXT_CACHE[font] = {} - } - var mesh = fontcache[text] - if(!mesh) { - mesh = fontcache[text] = tryVectorizeText(text, { - triangles: true, - font: font, - textAlign: 'center', - textBaseline: 'middle' - }) - } - var scale = (size || 12) / 12 - var positions = mesh.positions - var cells = mesh.cells - var lo = [ Infinity, Infinity] - var hi = [-Infinity,-Infinity] - for(var i=0, nc=cells.length; i=0; --j) { - var p = positions[c[j]] - data.push(scale*p[0], -scale*p[1], t) - } - } - } - - //Generate sprites for all 3 axes, store data in texture atlases - var tickOffset = [0,0,0] - var tickCount = [0,0,0] - var labelOffset = [0,0,0] - var labelCount = [0,0,0] - for(var d=0; d<3; ++d) { - - //Generate label - labelOffset[d] = (data.length/VERTEX_SIZE)|0 - addItem(0.5*(bounds[0][d]+bounds[1][d]), labels[d], labelFont) - labelCount[d] = ((data.length/VERTEX_SIZE)|0) - labelOffset[d] - - //Generate sprites for tick marks - tickOffset[d] = (data.length/VERTEX_SIZE)|0 - for(var i=0; i= 0) { - sigFigs = stepStr.length - u - 1 - } - var shift = Math.pow(10, sigFigs) - var x = Math.round(spacing * i * shift) - var xstr = x + "" - if(xstr.indexOf("e") >= 0) { - return xstr - } - var xi = x / shift, xf = x % shift - if(x < 0) { - xi = -Math.ceil(xi)|0 - xf = (-xf)|0 - } else { - xi = Math.floor(xi)|0 - xf = xf|0 - } - var xis = "" + xi - if(x < 0) { - xis = "-" + xis - } - if(sigFigs) { - var xs = "" + xf - while(xs.length < sigFigs) { - xs = "0" + xs - } - return xis + "." + xs - } else { - return xis - } -} - -function defaultTicks(bounds, tickSpacing) { - var array = [] - for(var d=0; d<3; ++d) { - var ticks = [] - var m = 0.5*(bounds[0][d]+bounds[1][d]) - for(var t=0; t*tickSpacing[d]<=bounds[1][d]; ++t) { - ticks.push({x: t*tickSpacing[d], text: prettyPrint(tickSpacing[d], t)}) - } - for(var t=-1; t*tickSpacing[d]>=bounds[0][d]; --t) { - ticks.push({x: t*tickSpacing[d], text: prettyPrint(tickSpacing[d], t)}) - } - array.push(ticks) - } - return array -} - -function ticksEqual(ticksA, ticksB) { - for(var i=0; i<3; ++i) { - if(ticksA[i].length !== ticksB[i].length) { - return false - } - for(var j=0; j len) { - throw new Error("gl-buffer: If resizing buffer, must not specify offset") - } - gl.bufferSubData(type, offset, data) - return len -} - -function makeScratchTypeArray(array, dtype) { - var res = pool.malloc(array.length, dtype) - var n = array.length - for(var i=0; i=0; --i) { - if(stride[i] !== n) { - return false - } - n *= shape[i] - } - return true -} - -proto.update = function(array, offset) { - if(typeof offset !== "number") { - offset = -1 - } - this.bind() - if(typeof array === "object" && typeof array.shape !== "undefined") { //ndarray - var dtype = array.dtype - if(SUPPORTED_TYPES.indexOf(dtype) < 0) { - dtype = "float32" - } - if(this.type === this.gl.ELEMENT_ARRAY_BUFFER) { - var ext = gl.getExtension('OES_element_index_uint') - if(ext && dtype !== "uint16") { - dtype = "uint32" - } else { - dtype = "uint16" - } - } - if(dtype === array.dtype && isPacked(array.shape, array.stride)) { - if(array.offset === 0 && array.data.length === array.shape[0]) { - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, array.data, offset) - } else { - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, array.data.subarray(array.offset, array.shape[0]), offset) - } - } else { - var tmp = pool.malloc(array.size, dtype) - var ndt = ndarray(tmp, array.shape) - ops.assign(ndt, array) - if(offset < 0) { - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, tmp, offset) - } else { - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, tmp.subarray(0, array.size), offset) - } - pool.free(tmp) - } - } else if(Array.isArray(array)) { //Vanilla array - var t - if(this.type === this.gl.ELEMENT_ARRAY_BUFFER) { - t = makeScratchTypeArray(array, "uint16") - } else { - t = makeScratchTypeArray(array, "float32") - } - if(offset < 0) { - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, t, offset) - } else { - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, t.subarray(0, array.length), offset) - } - pool.free(t) - } else if(typeof array === "object" && typeof array.length === "number") { //Typed array - this.length = updateTypeArray(this.gl, this.type, this.length, this.usage, array, offset) - } else if(typeof array === "number" || array === undefined) { //Number/default - if(offset >= 0) { - throw new Error("gl-buffer: Cannot specify offset when resizing buffer") - } - array = array | 0 - if(array <= 0) { - array = 1 - } - this.gl.bufferData(this.type, array|0, this.usage) - this.length = array - } else { //Error, case should not happen - throw new Error("gl-buffer: Invalid data type") - } -} - -function createBuffer(gl, data, type, usage) { - type = type || gl.ARRAY_BUFFER - usage = usage || gl.DYNAMIC_DRAW - if(type !== gl.ARRAY_BUFFER && type !== gl.ELEMENT_ARRAY_BUFFER) { - throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER") - } - if(usage !== gl.DYNAMIC_DRAW && usage !== gl.STATIC_DRAW && usage !== gl.STREAM_DRAW) { - throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW") - } - var handle = gl.createBuffer() - var result = new GLBuffer(gl, type, handle, 0, usage) - result.update(data) - return result -} - -module.exports = createBuffer - -},{"ndarray":433,"ndarray-ops":427,"typedarray-pool":522}],231:[function(_dereq_,module,exports){ -"use strict"; - -var V = _dereq_('gl-vec3'); -var V4 = _dereq_('gl-vec4'); - -var vec3 = function(x, y, z) { - var v = V.create(); - if (x !== undefined) { - V.set(v, x, y, z); - } - return v; -} - -var createPositionsForMeshgrid = function(meshgrid) { - var xs = meshgrid[0], ys = meshgrid[1], zs = meshgrid[2]; - var positions = []; - for (var z=0; z= v) { - return i-1; - } - } - return i; -}; - -var tmp = V.create(); -var tmp2 = V.create(); - -var clamp = function(v, min, max) { - return v < min ? min : (v > max ? max : v); -}; - -var sampleMeshgrid = function(point, array, meshgrid, clampOverflow) { - var x = point[0]; - var y = point[1]; - var z = point[2]; - - var w = meshgrid[0].length; - var h = meshgrid[1].length; - var d = meshgrid[2].length; - - // Find the index of the nearest smaller value in the meshgrid for each coordinate of (x,y,z). - // The nearest smaller value index for x is the index x0 such that - // meshgrid[0][x0] < x and for all x1 > x0, meshgrid[0][x1] >= x. - var x0 = findLastSmallerIndex(meshgrid[0], x); - var y0 = findLastSmallerIndex(meshgrid[1], y); - var z0 = findLastSmallerIndex(meshgrid[2], z); - - // Get the nearest larger meshgrid value indices. - // From the above "nearest smaller value", we know that - // meshgrid[0][x0] < x - // meshgrid[0][x0+1] >= x - var x1 = x0 + 1; - var y1 = y0 + 1; - var z1 = z0 + 1; - - if (clampOverflow) { - x0 = clamp(x0, 0, w-1); - x1 = clamp(x1, 0, w-1); - y0 = clamp(y0, 0, h-1); - y1 = clamp(y1, 0, h-1); - z0 = clamp(z0, 0, d-1); - z1 = clamp(z1, 0, d-1); - } - - // Reject points outside the meshgrid, return a zero vector. - if (x0 < 0 || y0 < 0 || z0 < 0 || x1 >= w || y1 >= h || z1 >= d) { - return V.create(); - } - - // Normalize point coordinates to 0..1 scaling factor between x0 and x1. - var xf = (x - meshgrid[0][x0]) / (meshgrid[0][x1] - meshgrid[0][x0]); - var yf = (y - meshgrid[1][y0]) / (meshgrid[1][y1] - meshgrid[1][y0]); - var zf = (z - meshgrid[2][z0]) / (meshgrid[2][z1] - meshgrid[2][z0]); - - if (xf < 0 || xf > 1 || isNaN(xf)) xf = 0; - if (yf < 0 || yf > 1 || isNaN(yf)) yf = 0; - if (zf < 0 || zf > 1 || isNaN(zf)) zf = 0; - - var z0off = z0*w*h; - var z1off = z1*w*h; - - var y0off = y0*w; - var y1off = y1*w; - - var x0off = x0; - var x1off = x1; - - // Sample data array around the (x,y,z) point. - // vZYX = array[zZoff + yYoff + xXoff] - var v000 = array[y0off + z0off + x0off]; - var v001 = array[y0off + z0off + x1off]; - var v010 = array[y1off + z0off + x0off]; - var v011 = array[y1off + z0off + x1off]; - var v100 = array[y0off + z1off + x0off]; - var v101 = array[y0off + z1off + x1off]; - var v110 = array[y1off + z1off + x0off]; - var v111 = array[y1off + z1off + x1off]; - - var result = V.create(); - - // Average samples according to distance to point. - V.lerp(result, v000, v001, xf); - V.lerp(tmp, v010, v011, xf); - V.lerp(result, result, tmp, yf); - V.lerp(tmp, v100, v101, xf); - V.lerp(tmp2, v110, v111, xf); - V.lerp(tmp, tmp, tmp2, yf); - V.lerp(result, result, tmp, zf); - - return result; -}; - -var getOrthogonalVector = function(dst, v) { - // Return up-vector for only-z vector. - if (v[0] === 0 && v[1] === 0) { - V.set(dst, 0, 1, 0); - } else { - // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0). - // From the above if-statement we have ||a|| > 0 U ||b|| > 0. - // Assign z = 0, x = -b, y = a: - // a*-b + b*a + c*0 = -ba + ba + 0 = 0 - V.set(dst, -v[1], v[0], 0); - } - return dst; -}; - -module.exports = function(vectorfield, bounds) { - var positions; - if (vectorfield.positions) { - positions = vectorfield.positions; - } else { - positions = createPositionsForMeshgrid(vectorfield.meshgrid); - } - var meshgrid = vectorfield.meshgrid; - var vectors = vectorfield.vectors; - var geo = { - positions: [], - vertexIntensity: [], - vertexIntensityBounds: vectorfield.vertexIntensityBounds, - vertexNormals: [], - vectors: [], - cells: [], - coneOffset: vectorfield.coneOffset, - colormap: vectorfield.colormap - }; - - if (vectorfield.positions.length === 0) { - if (bounds) { - bounds[0] = [0,0,0]; - bounds[1] = [0,0,0]; - } - return geo; - } - - // Compute bounding box for the dataset. - // Compute maximum velocity for the dataset to use for scaling the cones. - var maxNorm = 0; - var minX = 1/0, maxX = -1/0; - var minY = 1/0, maxY = -1/0; - var minZ = 1/0, maxZ = -1/0; - var p2 = null; - var u2 = null; - var positionVectors = []; - var vectorScale = 1/0; - for (var i = 0; i < positions.length; i++) { - var p = positions[i]; - minX = Math.min(p[0], minX); - maxX = Math.max(p[0], maxX); - minY = Math.min(p[1], minY); - maxY = Math.max(p[1], maxY); - minZ = Math.min(p[2], minZ); - maxZ = Math.max(p[2], maxZ); - var u; - if (meshgrid) { - u = sampleMeshgrid(p, vectors, meshgrid, true); - } else { - u = vectors[i]; - } - if (V.length(u) > maxNorm) { - maxNorm = V.length(u); - } - if (i) { - // Find vector scale [w/ units of time] using "successive" positions - // (not "adjacent" with would be O(n^2)), - // - // The vector scale corresponds to the minimum "time" to travel across two - // two adjacent positions at the average velocity of those two adjacent positions - vectorScale = Math.min(vectorScale, - 2 * V.distance(p2, p) / (V.length(u2) + V.length(u)) - ); - } - p2 = p; - u2 = u; - positionVectors.push(u); - } - var minV = [minX, minY, minZ]; - var maxV = [maxX, maxY, maxZ]; - if (bounds) { - bounds[0] = minV; - bounds[1] = maxV; - } - if (maxNorm === 0) { - maxNorm = 1; - } - - // Inverted max norm would map vector with norm maxNorm to 1 coord space units in length - var invertedMaxNorm = 1 / maxNorm; - - if (!isFinite(vectorScale) || isNaN(vectorScale)) { - vectorScale = 1.0; - } - geo.vectorScale = vectorScale; - - var nml = vec3(0,1,0); - - var coneScale = vectorfield.coneSize || 0.5; - - if (vectorfield.absoluteConeSize) { - coneScale = vectorfield.absoluteConeSize * invertedMaxNorm; - } - - geo.coneScale = coneScale; - - // Build the cone model. - for (var i = 0, j = 0; i < positions.length; i++) { - var p = positions[i]; - var x = p[0], y = p[1], z = p[2]; - var d = positionVectors[i]; - var intensity = V.length(d) * invertedMaxNorm; - for (var k = 0, l = 8; k < l; k++) { - geo.positions.push([x, y, z, j++]); - geo.positions.push([x, y, z, j++]); - geo.positions.push([x, y, z, j++]); - geo.positions.push([x, y, z, j++]); - geo.positions.push([x, y, z, j++]); - geo.positions.push([x, y, z, j++]); - - geo.vectors.push(d); - geo.vectors.push(d); - geo.vectors.push(d); - geo.vectors.push(d); - geo.vectors.push(d); - geo.vectors.push(d); - - geo.vertexIntensity.push(intensity, intensity, intensity); - geo.vertexIntensity.push(intensity, intensity, intensity); - - geo.vertexNormals.push(nml, nml, nml); - geo.vertexNormals.push(nml, nml, nml); - - var m = geo.positions.length; - geo.cells.push([m-6, m-5, m-4], [m-3, m-2, m-1]); - } - } - - return geo; -}; - -module.exports.createConeMesh = _dereq_('./lib/conemesh'); - -},{"./lib/conemesh":233,"gl-vec3":329,"gl-vec4":365}],232:[function(_dereq_,module,exports){ -'use strict' - -var barycentric = _dereq_('barycentric') -var closestPointToTriangle = _dereq_('polytope-closest-point/lib/closest_point_2d.js') - -module.exports = closestPointToPickLocation - -function xformMatrix(m, v) { - var out = [0,0,0,0] - for(var i=0; i<4; ++i) { - for(var j=0; j<4; ++j) { - out[j] += m[4*i + j] * v[i] - } - } - return out -} - -function projectVertex(v, model, view, projection, resolution) { - var p = xformMatrix(projection, - xformMatrix(view, - xformMatrix(model, [v[0], v[1], v[2], 1]))) - for(var i=0; i<3; ++i) { - p[i] /= p[3] - } - return [ 0.5 * resolution[0] * (1.0+p[0]), 0.5 * resolution[1] * (1.0-p[1]) ] -} - -function barycentricCoord(simplex, point) { - if(simplex.length === 2) { - var d0 = 0.0 - var d1 = 0.0 - for(var i=0; i<2; ++i) { - d0 += Math.pow(point[i] - simplex[0][i], 2) - d1 += Math.pow(point[i] - simplex[1][i], 2) - } - d0 = Math.sqrt(d0) - d1 = Math.sqrt(d1) - if(d0+d1 < 1e-6) { - return [1,0] - } - return [d1/(d0+d1),d0/(d1+d0)] - } else if(simplex.length === 3) { - var closestPoint = [0,0] - closestPointToTriangle(simplex[0], simplex[1], simplex[2], point, closestPoint) - return barycentric(simplex, closestPoint) - } - return [] -} - -function interpolate(simplex, weights) { - var result = [0,0,0] - for(var i=0; i 1.0001) { - return null - } - s += weights[i] - } - if(Math.abs(s - 1.0) > 0.001) { - return null - } - return [closestIndex, interpolate(simplex, weights), weights] -} -},{"barycentric":61,"polytope-closest-point/lib/closest_point_2d.js":464}],233:[function(_dereq_,module,exports){ -'use strict' - -var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small -var DEFAULT_FACE_NORMALS_EPSILON = 1e-6; - -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createTexture = _dereq_('gl-texture2d') -var normals = _dereq_('normals') -var multiply = _dereq_('gl-mat4/multiply') -var invert = _dereq_('gl-mat4/invert') -var ndarray = _dereq_('ndarray') -var colormap = _dereq_('colormap') -var getContour = _dereq_('simplicial-complex-contour') -var pool = _dereq_('typedarray-pool') -var shaders = _dereq_('./shaders') -var closestPoint = _dereq_('./closest-point') - -var meshShader = shaders.meshShader -var pickShader = shaders.pickShader - -var identityMatrix = [ - 1,0,0,0, - 0,1,0,0, - 0,0,1,0, - 0,0,0,1] - -function SimplicialMesh(gl - , texture - , triShader - , lineShader - , pointShader - , pickShader - , pointPickShader - , contourShader - , trianglePositions - , triangleVectors - , triangleIds - , triangleColors - , triangleUVs - , triangleNormals - , triangleVAO - , edgePositions - , edgeIds - , edgeColors - , edgeUVs - , edgeVAO - , pointPositions - , pointIds - , pointColors - , pointUVs - , pointSizes - , pointVAO - , contourPositions - , contourVAO) { - - this.gl = gl - this.cells = [] - this.positions = [] - this.intensity = [] - this.texture = texture - this.dirty = true - - this.triShader = triShader - this.lineShader = lineShader - this.pointShader = pointShader - this.pickShader = pickShader - this.pointPickShader = pointPickShader - this.contourShader = contourShader - - this.trianglePositions = trianglePositions - this.triangleVectors = triangleVectors - this.triangleColors = triangleColors - this.triangleNormals = triangleNormals - this.triangleUVs = triangleUVs - this.triangleIds = triangleIds - this.triangleVAO = triangleVAO - this.triangleCount = 0 - - this.lineWidth = 1 - this.edgePositions = edgePositions - this.edgeColors = edgeColors - this.edgeUVs = edgeUVs - this.edgeIds = edgeIds - this.edgeVAO = edgeVAO - this.edgeCount = 0 - - this.pointPositions = pointPositions - this.pointColors = pointColors - this.pointUVs = pointUVs - this.pointSizes = pointSizes - this.pointIds = pointIds - this.pointVAO = pointVAO - this.pointCount = 0 - - this.contourLineWidth = 1 - this.contourPositions = contourPositions - this.contourVAO = contourVAO - this.contourCount = 0 - this.contourColor = [0,0,0] - this.contourEnable = true - - this.pickId = 1 - this.bounds = [ - [ Infinity, Infinity, Infinity], - [-Infinity,-Infinity,-Infinity] ] - this.clipBounds = [ - [-Infinity,-Infinity,-Infinity], - [ Infinity, Infinity, Infinity] ] - - this.lightPosition = [1e5, 1e5, 0] - this.ambientLight = 0.8 - this.diffuseLight = 0.8 - this.specularLight = 2.0 - this.roughness = 0.5 - this.fresnel = 1.5 - - this.opacity = 1.0 - - this.coneScale = 2.0 - this.vectorScale = 1.0 - this.coneOffset = 1.0 / 4.0; - - this._model = identityMatrix - this._view = identityMatrix - this._projection = identityMatrix - this._resolution = [1,1] -} - -var proto = SimplicialMesh.prototype - -proto.isOpaque = function() { - return this.opacity >= 1 -} - -proto.isTransparent = function() { - return this.opacity < 1 -} - -proto.pickSlots = 1 - -proto.setPickBase = function(id) { - this.pickId = id -} - -function genColormap(param) { - var colors = colormap({ - colormap: param - , nshades: 256 - , format: 'rgba' - }) - - var result = new Uint8Array(256*4) - for(var i=0; i<256; ++i) { - var c = colors[i] - for(var j=0; j<3; ++j) { - result[4*i+j] = c[j] - } - result[4*i+3] = c[3]*255 - } - - return ndarray(result, [256,256,4], [4,0,1]) -} - -function unpackIntensity(cells, numVerts, cellIntensity) { - var result = new Array(numVerts) - for(var i=0; i 0) { - var shader = this.triShader - shader.bind() - shader.uniforms = uniforms - - this.triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, this.triangleCount*3) - this.triangleVAO.unbind() - } - - if(this.edgeCount > 0 && this.lineWidth > 0) { - var shader = this.lineShader - shader.bind() - shader.uniforms = uniforms - - this.edgeVAO.bind() - gl.lineWidth(this.lineWidth) - gl.drawArrays(gl.LINES, 0, this.edgeCount*2) - this.edgeVAO.unbind() - } - - if(this.pointCount > 0) { - var shader = this.pointShader - shader.bind() - shader.uniforms = uniforms - - this.pointVAO.bind() - gl.drawArrays(gl.POINTS, 0, this.pointCount) - this.pointVAO.unbind() - } - - if(this.contourEnable && this.contourCount > 0 && this.contourLineWidth > 0) { - var shader = this.contourShader - shader.bind() - shader.uniforms = uniforms - - this.contourVAO.bind() - gl.drawArrays(gl.LINES, 0, this.contourCount) - this.contourVAO.unbind() - } -} - -proto.drawPick = function(params) { - params = params || {} - - var gl = this.gl - - var model = params.model || identityMatrix - var view = params.view || identityMatrix - var projection = params.projection || identityMatrix - - var clipBounds = [[-1e6,-1e6,-1e6],[1e6,1e6,1e6]] - for(var i=0; i<3; ++i) { - clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]) - clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]) - } - - //Save camera parameters - this._model = [].slice.call(model) - this._view = [].slice.call(view) - this._projection = [].slice.call(projection) - this._resolution = [gl.drawingBufferWidth, gl.drawingBufferHeight] - - var uniforms = { - model: model, - view: view, - projection: projection, - clipBounds: clipBounds, - - vectorScale: this.vectorScale, - coneScale: this.coneScale, - coneOffset: this.coneOffset, - - pickId: this.pickId / 255.0, - } - - var shader = this.pickShader - shader.bind() - shader.uniforms = uniforms - - if(this.triangleCount > 0) { - this.triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, this.triangleCount*3) - this.triangleVAO.unbind() - } - - if(this.edgeCount > 0) { - this.edgeVAO.bind() - gl.lineWidth(this.lineWidth) - gl.drawArrays(gl.LINES, 0, this.edgeCount*2) - this.edgeVAO.unbind() - } - - if(this.pointCount > 0) { - var shader = this.pointPickShader - shader.bind() - shader.uniforms = uniforms - - this.pointVAO.bind() - gl.drawArrays(gl.POINTS, 0, this.pointCount) - this.pointVAO.unbind() - } -} - - -proto.pick = function(pickData) { - if(!pickData) { - return null - } - if(pickData.id !== this.pickId) { - return null - } - - var cellId = pickData.value[0] + 256*pickData.value[1] + 65536*pickData.value[2] - var cell = this.cells[cellId] - var pos = this.positions[cell[1]].slice(0, 3) - - return { - // corresponding to input indices - index: Math.floor(cell[1] / 48), - position: pos, - dataCoordinate: pos - } -} - - -proto.dispose = function() { - this.texture.dispose() - - this.triShader.dispose() - // this.lineShader.dispose() - // this.pointShader.dispose() - this.pickShader.dispose() - // this.pointPickShader.dispose() - - this.triangleVAO.dispose() - this.trianglePositions.dispose() - this.triangleVectors.dispose() - this.triangleColors.dispose() - this.triangleUVs.dispose() - this.triangleNormals.dispose() - this.triangleIds.dispose() - - this.edgeVAO.dispose() - this.edgePositions.dispose() - this.edgeColors.dispose() - this.edgeUVs.dispose() - this.edgeIds.dispose() - - this.pointVAO.dispose() - this.pointPositions.dispose() - this.pointColors.dispose() - this.pointUVs.dispose() - this.pointSizes.dispose() - this.pointIds.dispose() - - this.contourVAO.dispose() - this.contourPositions.dispose() - // this.contourShader.dispose() -} - -function createMeshShader(gl) { - // need to pass meshShader attributes manually, - // to make this work on etpinard's Ubuntu Thinkpad - var shader = createShader(gl, meshShader.vertex, meshShader.fragment, null, meshShader.attributes) - shader.attributes.position.location = 0 - shader.attributes.color.location = 2 - shader.attributes.uv.location = 3 - shader.attributes.vector.location = 5 - return shader -} - -function createWireShader(gl) { - var shader = createShader(gl, wireShader.vertex, wireShader.fragment) - shader.attributes.position.location = 0 - shader.attributes.color.location = 2 - shader.attributes.uv.location = 3 - return shader -} - -function createPointShader(gl) { - var shader = createShader(gl, pointShader.vertex, pointShader.fragment) - shader.attributes.position.location = 0 - shader.attributes.color.location = 2 - shader.attributes.uv.location = 3 - shader.attributes.pointSize.location = 4 - return shader -} - -function createPickShader(gl) { - var shader = createShader(gl, pickShader.vertex, pickShader.fragment, null, pickShader.attributes) - shader.attributes.position.location = 0 - shader.attributes.id.location = 1 - shader.attributes.vector.location = 5 - return shader -} - -function createPointPickShader(gl) { - var shader = createShader(gl, pointPickShader.vertex, pointPickShader.fragment) - shader.attributes.position.location = 0 - shader.attributes.id.location = 1 - shader.attributes.pointSize.location = 4 - return shader -} - -function createContourShader(gl) { - var shader = createShader(gl, contourShader.vertex, contourShader.fragment) - shader.attributes.position.location = 0 - return shader -} - -function createSimplicialMesh(gl, params) { - if (arguments.length === 1) { - params = gl; - gl = params.gl; - } - - var triShader = params.triShader || createMeshShader(gl) - var lineShader = null; //createWireShader(gl) - var pointShader = null; //createPointShader(gl) - var pickShader = createPickShader(gl) - var pointPickShader = null; //createPointPickShader(gl) - var contourShader = null; //createContourShader(gl) - - var meshTexture = createTexture(gl, - ndarray(new Uint8Array([255,255,255,255]), [1,1,4])) - meshTexture.generateMipmap() - meshTexture.minFilter = gl.LINEAR_MIPMAP_LINEAR - meshTexture.magFilter = gl.LINEAR - - var trianglePositions = createBuffer(gl) - var triangleVectors = createBuffer(gl) - var triangleColors = createBuffer(gl) - var triangleUVs = createBuffer(gl) - var triangleNormals = createBuffer(gl) - var triangleIds = createBuffer(gl) - var triangleVAO = createVAO(gl, [ - { buffer: trianglePositions, - type: gl.FLOAT, - size: 4 - }, - { buffer: triangleIds, - type: gl.UNSIGNED_BYTE, - size: 4, - normalized: true - }, - { buffer: triangleColors, - type: gl.FLOAT, - size: 4 - }, - { buffer: triangleUVs, - type: gl.FLOAT, - size: 2 - }, - { buffer: triangleNormals, - type: gl.FLOAT, - size: 3 - }, - { buffer: triangleVectors, - type: gl.FLOAT, - size: 3 - } - ]) - - var edgePositions = createBuffer(gl) - var edgeColors = createBuffer(gl) - var edgeUVs = createBuffer(gl) - var edgeIds = createBuffer(gl) - var edgeVAO = createVAO(gl, [ - { buffer: edgePositions, - type: gl.FLOAT, - size: 3 - }, - { buffer: edgeIds, - type: gl.UNSIGNED_BYTE, - size: 4, - normalized: true - }, - { buffer: edgeColors, - type: gl.FLOAT, - size: 4 - }, - { buffer: edgeUVs, - type: gl.FLOAT, - size: 2 - } - ]) - - var pointPositions = createBuffer(gl) - var pointColors = createBuffer(gl) - var pointUVs = createBuffer(gl) - var pointSizes = createBuffer(gl) - var pointIds = createBuffer(gl) - var pointVAO = createVAO(gl, [ - { buffer: pointPositions, - type: gl.FLOAT, - size: 3 - }, - { buffer: pointIds, - type: gl.UNSIGNED_BYTE, - size: 4, - normalized: true - }, - { buffer: pointColors, - type: gl.FLOAT, - size: 4 - }, - { buffer: pointUVs, - type: gl.FLOAT, - size: 2 - }, - { buffer: pointSizes, - type: gl.FLOAT, - size: 1 - } - ]) - - var contourPositions = createBuffer(gl) - var contourVAO = createVAO(gl, [ - { buffer: contourPositions, - type: gl.FLOAT, - size: 3 - }]) - - var mesh = new SimplicialMesh(gl - , meshTexture - , triShader - , lineShader - , pointShader - , pickShader - , pointPickShader - , contourShader - , trianglePositions - , triangleVectors - , triangleIds - , triangleColors - , triangleUVs - , triangleNormals - , triangleVAO - , edgePositions - , edgeIds - , edgeColors - , edgeUVs - , edgeVAO - , pointPositions - , pointIds - , pointColors - , pointUVs - , pointSizes - , pointVAO - , contourPositions - , contourVAO) - - mesh.update(params) - - return mesh -} - -module.exports = createSimplicialMesh - -},{"./closest-point":232,"./shaders":234,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":288,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"normals":436,"simplicial-complex-contour":494,"typedarray-pool":522}],234:[function(_dereq_,module,exports){ -var glslify = _dereq_('glslify') - -var triVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float vectorScale;\nuniform float coneScale;\n\nuniform float coneOffset;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n f_color = color; //vec4(position.w, color.r, 0, 0);\n f_normal = normal;\n f_data = conePosition.xyz;\n f_position = position.xyz;\n f_eyeDirection = eyePosition - conePosition.xyz;\n f_lightDirection = lightPosition - conePosition.xyz;\n f_uv = uv;\n}\n"]) -var triFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}"]) -var pickVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nuniform float vectorScale;\nuniform float coneScale;\nuniform float coneOffset;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n gl_Position = projection * view * conePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]) -var pickFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]) - -exports.meshShader = { - vertex: triVertSrc, - fragment: triFragSrc, - attributes: [ - {name: 'position', type: 'vec4'}, - {name: 'normal', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'uv', type: 'vec2'}, - {name: 'vector', type: 'vec3'} - ] -} -exports.pickShader = { - vertex: pickVertSrc, - fragment: pickFragSrc, - attributes: [ - {name: 'position', type: 'vec4'}, - {name: 'id', type: 'vec4'}, - {name: 'vector', type: 'vec3'} - ] -} - -},{"glslify":392}],235:[function(_dereq_,module,exports){ -module.exports = { - 0: 'NONE', - 1: 'ONE', - 2: 'LINE_LOOP', - 3: 'LINE_STRIP', - 4: 'TRIANGLES', - 5: 'TRIANGLE_STRIP', - 6: 'TRIANGLE_FAN', - 256: 'DEPTH_BUFFER_BIT', - 512: 'NEVER', - 513: 'LESS', - 514: 'EQUAL', - 515: 'LEQUAL', - 516: 'GREATER', - 517: 'NOTEQUAL', - 518: 'GEQUAL', - 519: 'ALWAYS', - 768: 'SRC_COLOR', - 769: 'ONE_MINUS_SRC_COLOR', - 770: 'SRC_ALPHA', - 771: 'ONE_MINUS_SRC_ALPHA', - 772: 'DST_ALPHA', - 773: 'ONE_MINUS_DST_ALPHA', - 774: 'DST_COLOR', - 775: 'ONE_MINUS_DST_COLOR', - 776: 'SRC_ALPHA_SATURATE', - 1024: 'STENCIL_BUFFER_BIT', - 1028: 'FRONT', - 1029: 'BACK', - 1032: 'FRONT_AND_BACK', - 1280: 'INVALID_ENUM', - 1281: 'INVALID_VALUE', - 1282: 'INVALID_OPERATION', - 1285: 'OUT_OF_MEMORY', - 1286: 'INVALID_FRAMEBUFFER_OPERATION', - 2304: 'CW', - 2305: 'CCW', - 2849: 'LINE_WIDTH', - 2884: 'CULL_FACE', - 2885: 'CULL_FACE_MODE', - 2886: 'FRONT_FACE', - 2928: 'DEPTH_RANGE', - 2929: 'DEPTH_TEST', - 2930: 'DEPTH_WRITEMASK', - 2931: 'DEPTH_CLEAR_VALUE', - 2932: 'DEPTH_FUNC', - 2960: 'STENCIL_TEST', - 2961: 'STENCIL_CLEAR_VALUE', - 2962: 'STENCIL_FUNC', - 2963: 'STENCIL_VALUE_MASK', - 2964: 'STENCIL_FAIL', - 2965: 'STENCIL_PASS_DEPTH_FAIL', - 2966: 'STENCIL_PASS_DEPTH_PASS', - 2967: 'STENCIL_REF', - 2968: 'STENCIL_WRITEMASK', - 2978: 'VIEWPORT', - 3024: 'DITHER', - 3042: 'BLEND', - 3088: 'SCISSOR_BOX', - 3089: 'SCISSOR_TEST', - 3106: 'COLOR_CLEAR_VALUE', - 3107: 'COLOR_WRITEMASK', - 3317: 'UNPACK_ALIGNMENT', - 3333: 'PACK_ALIGNMENT', - 3379: 'MAX_TEXTURE_SIZE', - 3386: 'MAX_VIEWPORT_DIMS', - 3408: 'SUBPIXEL_BITS', - 3410: 'RED_BITS', - 3411: 'GREEN_BITS', - 3412: 'BLUE_BITS', - 3413: 'ALPHA_BITS', - 3414: 'DEPTH_BITS', - 3415: 'STENCIL_BITS', - 3553: 'TEXTURE_2D', - 4352: 'DONT_CARE', - 4353: 'FASTEST', - 4354: 'NICEST', - 5120: 'BYTE', - 5121: 'UNSIGNED_BYTE', - 5122: 'SHORT', - 5123: 'UNSIGNED_SHORT', - 5124: 'INT', - 5125: 'UNSIGNED_INT', - 5126: 'FLOAT', - 5386: 'INVERT', - 5890: 'TEXTURE', - 6401: 'STENCIL_INDEX', - 6402: 'DEPTH_COMPONENT', - 6406: 'ALPHA', - 6407: 'RGB', - 6408: 'RGBA', - 6409: 'LUMINANCE', - 6410: 'LUMINANCE_ALPHA', - 7680: 'KEEP', - 7681: 'REPLACE', - 7682: 'INCR', - 7683: 'DECR', - 7936: 'VENDOR', - 7937: 'RENDERER', - 7938: 'VERSION', - 9728: 'NEAREST', - 9729: 'LINEAR', - 9984: 'NEAREST_MIPMAP_NEAREST', - 9985: 'LINEAR_MIPMAP_NEAREST', - 9986: 'NEAREST_MIPMAP_LINEAR', - 9987: 'LINEAR_MIPMAP_LINEAR', - 10240: 'TEXTURE_MAG_FILTER', - 10241: 'TEXTURE_MIN_FILTER', - 10242: 'TEXTURE_WRAP_S', - 10243: 'TEXTURE_WRAP_T', - 10497: 'REPEAT', - 10752: 'POLYGON_OFFSET_UNITS', - 16384: 'COLOR_BUFFER_BIT', - 32769: 'CONSTANT_COLOR', - 32770: 'ONE_MINUS_CONSTANT_COLOR', - 32771: 'CONSTANT_ALPHA', - 32772: 'ONE_MINUS_CONSTANT_ALPHA', - 32773: 'BLEND_COLOR', - 32774: 'FUNC_ADD', - 32777: 'BLEND_EQUATION_RGB', - 32778: 'FUNC_SUBTRACT', - 32779: 'FUNC_REVERSE_SUBTRACT', - 32819: 'UNSIGNED_SHORT_4_4_4_4', - 32820: 'UNSIGNED_SHORT_5_5_5_1', - 32823: 'POLYGON_OFFSET_FILL', - 32824: 'POLYGON_OFFSET_FACTOR', - 32854: 'RGBA4', - 32855: 'RGB5_A1', - 32873: 'TEXTURE_BINDING_2D', - 32926: 'SAMPLE_ALPHA_TO_COVERAGE', - 32928: 'SAMPLE_COVERAGE', - 32936: 'SAMPLE_BUFFERS', - 32937: 'SAMPLES', - 32938: 'SAMPLE_COVERAGE_VALUE', - 32939: 'SAMPLE_COVERAGE_INVERT', - 32968: 'BLEND_DST_RGB', - 32969: 'BLEND_SRC_RGB', - 32970: 'BLEND_DST_ALPHA', - 32971: 'BLEND_SRC_ALPHA', - 33071: 'CLAMP_TO_EDGE', - 33170: 'GENERATE_MIPMAP_HINT', - 33189: 'DEPTH_COMPONENT16', - 33306: 'DEPTH_STENCIL_ATTACHMENT', - 33635: 'UNSIGNED_SHORT_5_6_5', - 33648: 'MIRRORED_REPEAT', - 33901: 'ALIASED_POINT_SIZE_RANGE', - 33902: 'ALIASED_LINE_WIDTH_RANGE', - 33984: 'TEXTURE0', - 33985: 'TEXTURE1', - 33986: 'TEXTURE2', - 33987: 'TEXTURE3', - 33988: 'TEXTURE4', - 33989: 'TEXTURE5', - 33990: 'TEXTURE6', - 33991: 'TEXTURE7', - 33992: 'TEXTURE8', - 33993: 'TEXTURE9', - 33994: 'TEXTURE10', - 33995: 'TEXTURE11', - 33996: 'TEXTURE12', - 33997: 'TEXTURE13', - 33998: 'TEXTURE14', - 33999: 'TEXTURE15', - 34000: 'TEXTURE16', - 34001: 'TEXTURE17', - 34002: 'TEXTURE18', - 34003: 'TEXTURE19', - 34004: 'TEXTURE20', - 34005: 'TEXTURE21', - 34006: 'TEXTURE22', - 34007: 'TEXTURE23', - 34008: 'TEXTURE24', - 34009: 'TEXTURE25', - 34010: 'TEXTURE26', - 34011: 'TEXTURE27', - 34012: 'TEXTURE28', - 34013: 'TEXTURE29', - 34014: 'TEXTURE30', - 34015: 'TEXTURE31', - 34016: 'ACTIVE_TEXTURE', - 34024: 'MAX_RENDERBUFFER_SIZE', - 34041: 'DEPTH_STENCIL', - 34055: 'INCR_WRAP', - 34056: 'DECR_WRAP', - 34067: 'TEXTURE_CUBE_MAP', - 34068: 'TEXTURE_BINDING_CUBE_MAP', - 34069: 'TEXTURE_CUBE_MAP_POSITIVE_X', - 34070: 'TEXTURE_CUBE_MAP_NEGATIVE_X', - 34071: 'TEXTURE_CUBE_MAP_POSITIVE_Y', - 34072: 'TEXTURE_CUBE_MAP_NEGATIVE_Y', - 34073: 'TEXTURE_CUBE_MAP_POSITIVE_Z', - 34074: 'TEXTURE_CUBE_MAP_NEGATIVE_Z', - 34076: 'MAX_CUBE_MAP_TEXTURE_SIZE', - 34338: 'VERTEX_ATTRIB_ARRAY_ENABLED', - 34339: 'VERTEX_ATTRIB_ARRAY_SIZE', - 34340: 'VERTEX_ATTRIB_ARRAY_STRIDE', - 34341: 'VERTEX_ATTRIB_ARRAY_TYPE', - 34342: 'CURRENT_VERTEX_ATTRIB', - 34373: 'VERTEX_ATTRIB_ARRAY_POINTER', - 34466: 'NUM_COMPRESSED_TEXTURE_FORMATS', - 34467: 'COMPRESSED_TEXTURE_FORMATS', - 34660: 'BUFFER_SIZE', - 34661: 'BUFFER_USAGE', - 34816: 'STENCIL_BACK_FUNC', - 34817: 'STENCIL_BACK_FAIL', - 34818: 'STENCIL_BACK_PASS_DEPTH_FAIL', - 34819: 'STENCIL_BACK_PASS_DEPTH_PASS', - 34877: 'BLEND_EQUATION_ALPHA', - 34921: 'MAX_VERTEX_ATTRIBS', - 34922: 'VERTEX_ATTRIB_ARRAY_NORMALIZED', - 34930: 'MAX_TEXTURE_IMAGE_UNITS', - 34962: 'ARRAY_BUFFER', - 34963: 'ELEMENT_ARRAY_BUFFER', - 34964: 'ARRAY_BUFFER_BINDING', - 34965: 'ELEMENT_ARRAY_BUFFER_BINDING', - 34975: 'VERTEX_ATTRIB_ARRAY_BUFFER_BINDING', - 35040: 'STREAM_DRAW', - 35044: 'STATIC_DRAW', - 35048: 'DYNAMIC_DRAW', - 35632: 'FRAGMENT_SHADER', - 35633: 'VERTEX_SHADER', - 35660: 'MAX_VERTEX_TEXTURE_IMAGE_UNITS', - 35661: 'MAX_COMBINED_TEXTURE_IMAGE_UNITS', - 35663: 'SHADER_TYPE', - 35664: 'FLOAT_VEC2', - 35665: 'FLOAT_VEC3', - 35666: 'FLOAT_VEC4', - 35667: 'INT_VEC2', - 35668: 'INT_VEC3', - 35669: 'INT_VEC4', - 35670: 'BOOL', - 35671: 'BOOL_VEC2', - 35672: 'BOOL_VEC3', - 35673: 'BOOL_VEC4', - 35674: 'FLOAT_MAT2', - 35675: 'FLOAT_MAT3', - 35676: 'FLOAT_MAT4', - 35678: 'SAMPLER_2D', - 35680: 'SAMPLER_CUBE', - 35712: 'DELETE_STATUS', - 35713: 'COMPILE_STATUS', - 35714: 'LINK_STATUS', - 35715: 'VALIDATE_STATUS', - 35716: 'INFO_LOG_LENGTH', - 35717: 'ATTACHED_SHADERS', - 35718: 'ACTIVE_UNIFORMS', - 35719: 'ACTIVE_UNIFORM_MAX_LENGTH', - 35720: 'SHADER_SOURCE_LENGTH', - 35721: 'ACTIVE_ATTRIBUTES', - 35722: 'ACTIVE_ATTRIBUTE_MAX_LENGTH', - 35724: 'SHADING_LANGUAGE_VERSION', - 35725: 'CURRENT_PROGRAM', - 36003: 'STENCIL_BACK_REF', - 36004: 'STENCIL_BACK_VALUE_MASK', - 36005: 'STENCIL_BACK_WRITEMASK', - 36006: 'FRAMEBUFFER_BINDING', - 36007: 'RENDERBUFFER_BINDING', - 36048: 'FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE', - 36049: 'FRAMEBUFFER_ATTACHMENT_OBJECT_NAME', - 36050: 'FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL', - 36051: 'FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE', - 36053: 'FRAMEBUFFER_COMPLETE', - 36054: 'FRAMEBUFFER_INCOMPLETE_ATTACHMENT', - 36055: 'FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT', - 36057: 'FRAMEBUFFER_INCOMPLETE_DIMENSIONS', - 36061: 'FRAMEBUFFER_UNSUPPORTED', - 36064: 'COLOR_ATTACHMENT0', - 36096: 'DEPTH_ATTACHMENT', - 36128: 'STENCIL_ATTACHMENT', - 36160: 'FRAMEBUFFER', - 36161: 'RENDERBUFFER', - 36162: 'RENDERBUFFER_WIDTH', - 36163: 'RENDERBUFFER_HEIGHT', - 36164: 'RENDERBUFFER_INTERNAL_FORMAT', - 36168: 'STENCIL_INDEX8', - 36176: 'RENDERBUFFER_RED_SIZE', - 36177: 'RENDERBUFFER_GREEN_SIZE', - 36178: 'RENDERBUFFER_BLUE_SIZE', - 36179: 'RENDERBUFFER_ALPHA_SIZE', - 36180: 'RENDERBUFFER_DEPTH_SIZE', - 36181: 'RENDERBUFFER_STENCIL_SIZE', - 36194: 'RGB565', - 36336: 'LOW_FLOAT', - 36337: 'MEDIUM_FLOAT', - 36338: 'HIGH_FLOAT', - 36339: 'LOW_INT', - 36340: 'MEDIUM_INT', - 36341: 'HIGH_INT', - 36346: 'SHADER_COMPILER', - 36347: 'MAX_VERTEX_UNIFORM_VECTORS', - 36348: 'MAX_VARYING_VECTORS', - 36349: 'MAX_FRAGMENT_UNIFORM_VECTORS', - 37440: 'UNPACK_FLIP_Y_WEBGL', - 37441: 'UNPACK_PREMULTIPLY_ALPHA_WEBGL', - 37442: 'CONTEXT_LOST_WEBGL', - 37443: 'UNPACK_COLORSPACE_CONVERSION_WEBGL', - 37444: 'BROWSER_DEFAULT_WEBGL' -} - -},{}],236:[function(_dereq_,module,exports){ -var gl10 = _dereq_('./1.0/numbers') - -module.exports = function lookupConstant (number) { - return gl10[number] -} - -},{"./1.0/numbers":235}],237:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createErrorBars - -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createShader = _dereq_('./shaders/index') - -var IDENTITY = [1,0,0,0, - 0,1,0,0, - 0,0,1,0, - 0,0,0,1] - -function ErrorBars(gl, buffer, vao, shader) { - this.gl = gl - this.shader = shader - this.buffer = buffer - this.vao = vao - this.pixelRatio = 1 - this.bounds = [[ Infinity, Infinity, Infinity], [-Infinity,-Infinity,-Infinity]] - this.clipBounds = [[-Infinity,-Infinity,-Infinity], [ Infinity, Infinity, Infinity]] - this.lineWidth = [1,1,1] - this.capSize = [10,10,10] - this.lineCount = [0,0,0] - this.lineOffset = [0,0,0] - this.opacity = 1 -} - -var proto = ErrorBars.prototype - -proto.isOpaque = function() { - return this.opacity >= 1 -} - -proto.isTransparent = function() { - return this.opacity < 1 -} - -proto.drawTransparent = proto.draw = function(cameraParams) { - var gl = this.gl - var uniforms = this.shader.uniforms - - this.shader.bind() - var view = uniforms.view = cameraParams.view || IDENTITY - var projection = uniforms.projection = cameraParams.projection || IDENTITY - uniforms.model = cameraParams.model || IDENTITY - uniforms.clipBounds = this.clipBounds - uniforms.opacity = this.opacity - - - var cx = view[12] - var cy = view[13] - var cz = view[14] - var cw = view[15] - var pixelScaleF = this.pixelRatio * (projection[3]*cx + projection[7]*cy + projection[11]*cz + projection[15]*cw) / gl.drawingBufferHeight - - this.vao.bind() - for(var i=0; i<3; ++i) { - gl.lineWidth(this.lineWidth[i]) - uniforms.capSize = this.capSize[i] * pixelScaleF - if (this.lineCount[i]) { - gl.drawArrays(gl.LINES, this.lineOffset[i], this.lineCount[i]) - } - } - this.vao.unbind() -} - -function updateBounds(bounds, point) { - for(var i=0; i<3; ++i) { - bounds[0][i] = Math.min(bounds[0][i], point[i]) - bounds[1][i] = Math.max(bounds[1][i], point[i]) - } -} - -var FACE_TABLE = (function(){ - var table = new Array(3) - for(var d=0; d<3; ++d) { - var row = [] - for(var j=1; j<=2; ++j) { - for(var s=-1; s<=1; s+=2) { - var u = (j+d) % 3 - var y = [0,0,0] - y[u] = s - row.push(y) - } - } - table[d] = row - } - return table -})() - - -function emitFace(verts, x, c, d) { - var offsets = FACE_TABLE[d] - for(var i=0; i 0) { - var x = p.slice() - x[j] += e[1][j] - verts.push(p[0], p[1], p[2], - c[0], c[1], c[2], c[3], - 0, 0, 0, - x[0], x[1], x[2], - c[0], c[1], c[2], c[3], - 0, 0, 0) - updateBounds(this.bounds, x) - vertexCount += 2 + emitFace(verts, x, c, j) - } - } - this.lineCount[j] = vertexCount - this.lineOffset[j] - } - this.buffer.update(verts) - } -} - -proto.dispose = function() { - this.shader.dispose() - this.buffer.dispose() - this.vao.dispose() -} - -function createErrorBars(options) { - var gl = options.gl - var buffer = createBuffer(gl) - var vao = createVAO(gl, [ - { - buffer: buffer, - type: gl.FLOAT, - size: 3, - offset: 0, - stride: 40 - }, - { - buffer: buffer, - type: gl.FLOAT, - size: 4, - offset: 12, - stride: 40 - }, - { - buffer: buffer, - type: gl.FLOAT, - size: 3, - offset: 28, - stride: 40 - } - ]) - - var shader = createShader(gl) - shader.attributes.position.location = 0 - shader.attributes.color.location = 1 - shader.attributes.offset.location = 2 - - var result = new ErrorBars(gl, buffer, vao, shader) - result.update(options) - return result -} - -},{"./shaders/index":238,"gl-buffer":230,"gl-vao":310}],238:[function(_dereq_,module,exports){ -'use strict' - -var glslify = _dereq_('glslify') -var createShader = _dereq_('gl-shader') - -var vertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]) -var fragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], fragPosition)) discard;\n\n gl_FragColor = opacity * fragColor;\n}"]) - -module.exports = function(gl) { - return createShader(gl, vertSrc, fragSrc, null, [ - {name: 'position', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'offset', type: 'vec3'} - ]) -} - -},{"gl-shader":288,"glslify":392}],239:[function(_dereq_,module,exports){ -'use strict' - -var createTexture = _dereq_('gl-texture2d') - -module.exports = createFBO - -var colorAttachmentArrays = null -var FRAMEBUFFER_UNSUPPORTED -var FRAMEBUFFER_INCOMPLETE_ATTACHMENT -var FRAMEBUFFER_INCOMPLETE_DIMENSIONS -var FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT - -function saveFBOState(gl) { - var fbo = gl.getParameter(gl.FRAMEBUFFER_BINDING) - var rbo = gl.getParameter(gl.RENDERBUFFER_BINDING) - var tex = gl.getParameter(gl.TEXTURE_BINDING_2D) - return [fbo, rbo, tex] -} - -function restoreFBOState(gl, data) { - gl.bindFramebuffer(gl.FRAMEBUFFER, data[0]) - gl.bindRenderbuffer(gl.RENDERBUFFER, data[1]) - gl.bindTexture(gl.TEXTURE_2D, data[2]) -} - -function lazyInitColorAttachments(gl, ext) { - var maxColorAttachments = gl.getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL) - colorAttachmentArrays = new Array(maxColorAttachments + 1) - for(var i=0; i<=maxColorAttachments; ++i) { - var x = new Array(maxColorAttachments) - for(var j=0; j 1) { - ext.drawBuffersWEBGL(colorAttachmentArrays[numColors]) - } - - //Allocate depth/stencil buffers - var WEBGL_depth_texture = gl.getExtension('WEBGL_depth_texture') - if(WEBGL_depth_texture) { - if(useStencil) { - fbo.depth = initTexture(gl, width, height, - WEBGL_depth_texture.UNSIGNED_INT_24_8_WEBGL, - gl.DEPTH_STENCIL, - gl.DEPTH_STENCIL_ATTACHMENT) - } else if(useDepth) { - fbo.depth = initTexture(gl, width, height, - gl.UNSIGNED_SHORT, - gl.DEPTH_COMPONENT, - gl.DEPTH_ATTACHMENT) - } - } else { - if(useDepth && useStencil) { - fbo._depth_rb = initRenderBuffer(gl, width, height, gl.DEPTH_STENCIL, gl.DEPTH_STENCIL_ATTACHMENT) - } else if(useDepth) { - fbo._depth_rb = initRenderBuffer(gl, width, height, gl.DEPTH_COMPONENT16, gl.DEPTH_ATTACHMENT) - } else if(useStencil) { - fbo._depth_rb = initRenderBuffer(gl, width, height, gl.STENCIL_INDEX, gl.STENCIL_ATTACHMENT) - } - } - - //Check frame buffer state - var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER) - if(status !== gl.FRAMEBUFFER_COMPLETE) { - - //Release all partially allocated resources - fbo._destroyed = true - - //Release all resources - gl.bindFramebuffer(gl.FRAMEBUFFER, null) - gl.deleteFramebuffer(fbo.handle) - fbo.handle = null - if(fbo.depth) { - fbo.depth.dispose() - fbo.depth = null - } - if(fbo._depth_rb) { - gl.deleteRenderbuffer(fbo._depth_rb) - fbo._depth_rb = null - } - for(var i=0; i maxFBOSize || - h < 0 || h > maxFBOSize) { - throw new Error('gl-fbo: Can\'t resize FBO, invalid dimensions') - } - - //Update shape - fbo._shape[0] = w - fbo._shape[1] = h - - //Save framebuffer state - var state = saveFBOState(gl) - - //Resize framebuffer attachments - for(var i=0; i maxFBOSize || height < 0 || height > maxFBOSize) { - throw new Error('gl-fbo: Parameters are too large for FBO') - } - - //Handle each option type - options = options || {} - - //Figure out number of color buffers to use - var numColors = 1 - if('color' in options) { - numColors = Math.max(options.color|0, 0) - if(numColors < 0) { - throw new Error('gl-fbo: Must specify a nonnegative number of colors') - } - if(numColors > 1) { - //Check if multiple render targets supported - if(!WEBGL_draw_buffers) { - throw new Error('gl-fbo: Multiple draw buffer extension not supported') - } else if(numColors > gl.getParameter(WEBGL_draw_buffers.MAX_COLOR_ATTACHMENTS_WEBGL)) { - throw new Error('gl-fbo: Context does not support ' + numColors + ' draw buffers') - } - } - } - - //Determine whether to use floating point textures - var colorType = gl.UNSIGNED_BYTE - var OES_texture_float = gl.getExtension('OES_texture_float') - if(options.float && numColors > 0) { - if(!OES_texture_float) { - throw new Error('gl-fbo: Context does not support floating point textures') - } - colorType = gl.FLOAT - } else if(options.preferFloat && numColors > 0) { - if(OES_texture_float) { - colorType = gl.FLOAT - } - } - - //Check if we should use depth buffer - var useDepth = true - if('depth' in options) { - useDepth = !!options.depth - } - - //Check if we should use a stencil buffer - var useStencil = false - if('stencil' in options) { - useStencil = !!options.stencil - } - - return new Framebuffer( - gl, - width, - height, - colorType, - numColors, - useDepth, - useStencil, - WEBGL_draw_buffers) -} - -},{"gl-texture2d":305}],240:[function(_dereq_,module,exports){ - -var sprintf = _dereq_('sprintf-js').sprintf; -var glConstants = _dereq_('gl-constants/lookup'); -var shaderName = _dereq_('glsl-shader-name'); -var addLineNumbers = _dereq_('add-line-numbers'); - -module.exports = formatCompilerError; - -function formatCompilerError(errLog, src, type) { - "use strict"; - - var name = shaderName(src) || 'of unknown name (see npm glsl-shader-name)'; - - var typeName = 'unknown type'; - if (type !== undefined) { - typeName = type === glConstants.FRAGMENT_SHADER ? 'fragment' : 'vertex' - } - - var longForm = sprintf('Error compiling %s shader %s:\n', typeName, name); - var shortForm = sprintf("%s%s", longForm, errLog); - - var errorStrings = errLog.split('\n'); - var errors = {}; - - for (var i = 0; i < errorStrings.length; i++) { - var errorString = errorStrings[i]; - if (errorString === '' || errorString === "\0") continue; - var lineNo = parseInt(errorString.split(':')[2]); - if (isNaN(lineNo)) { - throw new Error(sprintf('Could not parse error: %s', errorString)); - } - errors[lineNo] = errorString; - } - - var lines = addLineNumbers(src).split('\n'); - - for (var i = 0; i < lines.length; i++) { - if (!errors[i+3] && !errors[i+2] && !errors[i+1]) continue; - var line = lines[i]; - longForm += line + '\n'; - if (errors[i+1]) { - var e = errors[i+1]; - e = e.substr(e.split(':', 3).join(':').length + 1).trim(); - longForm += sprintf('^^^ %s\n\n', e); - } - } - - return { - long: longForm.trim(), - short: shortForm.trim() - }; -} - - -},{"add-line-numbers":49,"gl-constants/lookup":236,"glsl-shader-name":384,"sprintf-js":504}],241:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createHeatmap2D - -var bsearch = _dereq_('binary-search-bounds') -var iota = _dereq_('iota-array') -var pool = _dereq_('typedarray-pool') -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') - -var shaders = _dereq_('./lib/shaders') - -function GLHeatmap2D ( - plot, - shader, - pickShader, - positionBuffer, - weightBuffer, - colorBuffer, - idBuffer) { - this.plot = plot - this.shader = shader - this.pickShader = pickShader - this.positionBuffer = positionBuffer - this.weightBuffer = weightBuffer - this.colorBuffer = colorBuffer - this.idBuffer = idBuffer - this.xData = [] - this.yData = [] - this.shape = [0, 0] - this.bounds = [Infinity, Infinity, -Infinity, -Infinity] - this.pickOffset = 0 -} - -var proto = GLHeatmap2D.prototype - -var WEIGHTS = [ - 0, 0, - 1, 0, - 0, 1, - 1, 0, - 1, 1, - 0, 1 -] - -proto.draw = (function () { - var MATRIX = [ - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - ] - - return function () { - var plot = this.plot - var shader = this.shader - var bounds = this.bounds - var numVertices = this.numVertices - - if (numVertices <= 0) { - return - } - - var gl = plot.gl - var dataBox = plot.dataBox - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - - MATRIX[0] = 2.0 * boundX / dataX - MATRIX[4] = 2.0 * boundY / dataY - MATRIX[6] = 2.0 * (bounds[0] - dataBox[0]) / dataX - 1.0 - MATRIX[7] = 2.0 * (bounds[1] - dataBox[1]) / dataY - 1.0 - - shader.bind() - - var uniforms = shader.uniforms - uniforms.viewTransform = MATRIX - - uniforms.shape = this.shape - - var attributes = shader.attributes - this.positionBuffer.bind() - attributes.position.pointer() - - this.weightBuffer.bind() - attributes.weight.pointer(gl.UNSIGNED_BYTE, false) - - this.colorBuffer.bind() - attributes.color.pointer(gl.UNSIGNED_BYTE, true) - - gl.drawArrays(gl.TRIANGLES, 0, numVertices) - } -})() - -proto.drawPick = (function () { - var MATRIX = [ - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - ] - - var PICK_VECTOR = [0, 0, 0, 0] - - return function (pickOffset) { - var plot = this.plot - var shader = this.pickShader - var bounds = this.bounds - var numVertices = this.numVertices - - if (numVertices <= 0) { - return - } - - var gl = plot.gl - var dataBox = plot.dataBox - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - - MATRIX[0] = 2.0 * boundX / dataX - MATRIX[4] = 2.0 * boundY / dataY - MATRIX[6] = 2.0 * (bounds[0] - dataBox[0]) / dataX - 1.0 - MATRIX[7] = 2.0 * (bounds[1] - dataBox[1]) / dataY - 1.0 - - for (var i = 0; i < 4; ++i) { - PICK_VECTOR[i] = (pickOffset >> (i * 8)) & 0xff - } - - this.pickOffset = pickOffset - - shader.bind() - - var uniforms = shader.uniforms - uniforms.viewTransform = MATRIX - uniforms.pickOffset = PICK_VECTOR - uniforms.shape = this.shape - - var attributes = shader.attributes - this.positionBuffer.bind() - attributes.position.pointer() - - this.weightBuffer.bind() - attributes.weight.pointer(gl.UNSIGNED_BYTE, false) - - this.idBuffer.bind() - attributes.pickId.pointer(gl.UNSIGNED_BYTE, false) - - gl.drawArrays(gl.TRIANGLES, 0, numVertices) - - return pickOffset + this.shape[0] * this.shape[1] - } -})() - -proto.pick = function (x, y, value) { - var pickOffset = this.pickOffset - var pointCount = this.shape[0] * this.shape[1] - if (value < pickOffset || value >= pickOffset + pointCount) { - return null - } - var pointId = value - pickOffset - var xData = this.xData - var yData = this.yData - return { - object: this, - pointId: pointId, - dataCoord: [ - xData[pointId % this.shape[0]], - yData[(pointId / this.shape[0]) | 0]] - } -} - -proto.update = function (options) { - options = options || {} - - var shape = options.shape || [0, 0] - - var x = options.x || iota(shape[0]) - var y = options.y || iota(shape[1]) - var z = options.z || new Float32Array(shape[0] * shape[1]) - - this.xData = x - this.yData = y - - var colorLevels = options.colorLevels || [0] - var colorValues = options.colorValues || [0, 0, 0, 1] - var colorCount = colorLevels.length - - var bounds = this.bounds - var lox = bounds[0] = x[0] - var loy = bounds[1] = y[0] - var hix = bounds[2] = x[x.length - 1] - var hiy = bounds[3] = y[y.length - 1] - - var xs = 1.0 / (hix - lox) - var ys = 1.0 / (hiy - loy) - - var numX = shape[0] - var numY = shape[1] - - this.shape = [numX, numY] - - var numVerts = (numX - 1) * (numY - 1) * (WEIGHTS.length >>> 1) - - this.numVertices = numVerts - - var colors = pool.mallocUint8(numVerts * 4) - var positions = pool.mallocFloat32(numVerts * 2) - var weights = pool.mallocUint8 (numVerts * 2) - var ids = pool.mallocUint32(numVerts) - - var ptr = 0 - - for (var j = 0; j < numY - 1; ++j) { - var yc0 = ys * (y[j] - loy) - var yc1 = ys * (y[j + 1] - loy) - for (var i = 0; i < numX - 1; ++i) { - var xc0 = xs * (x[i] - lox) - var xc1 = xs * (x[i + 1] - lox) - - for (var dd = 0; dd < WEIGHTS.length; dd += 2) { - var dx = WEIGHTS[dd] - var dy = WEIGHTS[dd + 1] - var offset = (j + dy) * numX + (i + dx) - var zc = z[offset] - var colorIdx = bsearch.le(colorLevels, zc) - var r, g, b, a - if (colorIdx < 0) { - r = colorValues[0] - g = colorValues[1] - b = colorValues[2] - a = colorValues[3] - } else if (colorIdx === colorCount - 1) { - r = colorValues[4 * colorCount - 4] - g = colorValues[4 * colorCount - 3] - b = colorValues[4 * colorCount - 2] - a = colorValues[4 * colorCount - 1] - } else { - var t = (zc - colorLevels[colorIdx]) / - (colorLevels[colorIdx + 1] - colorLevels[colorIdx]) - var ti = 1.0 - t - var i0 = 4 * colorIdx - var i1 = 4 * (colorIdx + 1) - r = ti * colorValues[i0] + t * colorValues[i1] - g = ti * colorValues[i0 + 1] + t * colorValues[i1 + 1] - b = ti * colorValues[i0 + 2] + t * colorValues[i1 + 2] - a = ti * colorValues[i0 + 3] + t * colorValues[i1 + 3] - } - - colors[4 * ptr] = 255 * r - colors[4 * ptr + 1] = 255 * g - colors[4 * ptr + 2] = 255 * b - colors[4 * ptr + 3] = 255 * a - - positions[2*ptr] = xc0*.5 + xc1*.5; - positions[2*ptr+1] = yc0*.5 + yc1*.5; - - weights[2*ptr] = dx; - weights[2*ptr+1] = dy; - - ids[ptr] = j * numX + i - - ptr += 1 - } - } - } - - this.positionBuffer.update(positions) - this.weightBuffer.update(weights) - this.colorBuffer.update(colors) - this.idBuffer.update(ids) - - pool.free(positions) - pool.free(colors) - pool.free(weights) - pool.free(ids) -} - -proto.dispose = function () { - this.shader.dispose() - this.pickShader.dispose() - this.positionBuffer.dispose() - this.weightBuffer.dispose() - this.colorBuffer.dispose() - this.idBuffer.dispose() - this.plot.removeObject(this) -} - -function createHeatmap2D (plot, options) { - var gl = plot.gl - - var shader = createShader(gl, shaders.vertex, shaders.fragment) - var pickShader = createShader(gl, shaders.pickVertex, shaders.pickFragment) - - var positionBuffer = createBuffer(gl) - var weightBuffer = createBuffer(gl) - var colorBuffer = createBuffer(gl) - var idBuffer = createBuffer(gl) - - var heatmap = new GLHeatmap2D( - plot, - shader, - pickShader, - positionBuffer, - weightBuffer, - colorBuffer, - idBuffer) - - heatmap.update(options) - plot.addObject(heatmap) - - return heatmap -} - -},{"./lib/shaders":242,"binary-search-bounds":243,"gl-buffer":230,"gl-shader":288,"iota-array":399,"typedarray-pool":522}],242:[function(_dereq_,module,exports){ -'use strict' - -var glslify = _dereq_('glslify') - -module.exports = { - fragment: glslify(["precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n"]), - vertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]), - pickFragment: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nuniform vec2 shape;\nuniform vec4 pickOffset;\n\nvoid main() {\n vec2 d = step(.5, vWeight);\n vec4 id = fragId + pickOffset;\n id.x += d.x + d.y*shape.x;\n\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n gl_FragColor = id/255.;\n}\n"]), - pickVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) -} - -},{"glslify":392}],243:[function(_dereq_,module,exports){ -arguments[4][99][0].apply(exports,arguments) -},{"dup":99}],244:[function(_dereq_,module,exports){ -var glslify = _dereq_('glslify') -var createShader = _dereq_('gl-shader') - -var vertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n vec4 startPoint = project(position);\n vec4 endPoint = project(nextPosition);\n\n vec2 A = startPoint.xy / startPoint.w;\n vec2 B = endPoint.xy / endPoint.w;\n\n float clipAngle = atan(\n (B.y - A.y) * screenShape.y,\n (B.x - A.x) * screenShape.x\n );\n\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(\n sin(clipAngle),\n -cos(clipAngle)\n ) / screenShape;\n\n gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n"]) -var forwardFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n"]) -var pickFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1540259130(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, encode_float_1540259130(pixelArcLength).xyz);\n}"]) - -var ATTRIBUTES = [ - {name: 'position', type: 'vec3'}, - {name: 'nextPosition', type: 'vec3'}, - {name: 'arcLength', type: 'float'}, - {name: 'lineWidth', type: 'float'}, - {name: 'color', type: 'vec4'} -] - -exports.createShader = function(gl) { - return createShader(gl, vertSrc, forwardFrag, null, ATTRIBUTES) -} - -exports.createPickShader = function(gl) { - return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) -} - -},{"gl-shader":288,"glslify":392}],245:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createLinePlot - -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createTexture = _dereq_('gl-texture2d') -var unpackFloat = _dereq_('glsl-read-float') -var bsearch = _dereq_('binary-search-bounds') -var ndarray = _dereq_('ndarray') -var shaders = _dereq_('./lib/shaders') - -var createShader = shaders.createShader -var createPickShader = shaders.createPickShader - -var identity = [1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1] - -function distance (a, b) { - var s = 0.0 - for (var i = 0; i < 3; ++i) { - var d = a[i] - b[i] - s += d * d - } - return Math.sqrt(s) -} - -function filterClipBounds (bounds) { - var result = [[-1e6, -1e6, -1e6], [1e6, 1e6, 1e6]] - for (var i = 0; i < 3; ++i) { - result[0][i] = Math.max(bounds[0][i], result[0][i]) - result[1][i] = Math.min(bounds[1][i], result[1][i]) - } - return result -} - -function PickResult (tau, position, index, dataCoordinate) { - this.arcLength = tau - this.position = position - this.index = index - this.dataCoordinate = dataCoordinate -} - -function LinePlot (gl, shader, pickShader, buffer, vao, texture) { - this.gl = gl - this.shader = shader - this.pickShader = pickShader - this.buffer = buffer - this.vao = vao - this.clipBounds = [ - [ -Infinity, -Infinity, -Infinity ], - [ Infinity, Infinity, Infinity ]] - this.points = [] - this.arcLength = [] - this.vertexCount = 0 - this.bounds = [[0, 0, 0], [0, 0, 0]] - this.pickId = 0 - this.lineWidth = 1 - this.texture = texture - this.dashScale = 1 - this.opacity = 1 - this.dirty = true - this.pixelRatio = 1 -} - -var proto = LinePlot.prototype - -proto.isTransparent = function () { - return this.opacity < 1 -} - -proto.isOpaque = function () { - return this.opacity >= 1 -} - -proto.pickSlots = 1 - -proto.setPickBase = function (id) { - this.pickId = id -} - -proto.drawTransparent = proto.draw = function (camera) { - if (!this.vertexCount) return - var gl = this.gl - var shader = this.shader - var vao = this.vao - shader.bind() - shader.uniforms = { - model: camera.model || identity, - view: camera.view || identity, - projection: camera.projection || identity, - clipBounds: filterClipBounds(this.clipBounds), - dashTexture: this.texture.bind(), - dashScale: this.dashScale / this.arcLength[this.arcLength.length - 1], - opacity: this.opacity, - screenShape: [gl.drawingBufferWidth, gl.drawingBufferHeight], - pixelRatio: this.pixelRatio - } - vao.bind() - vao.draw(gl.TRIANGLE_STRIP, this.vertexCount) - vao.unbind() -} - -proto.drawPick = function (camera) { - if (!this.vertexCount) return - var gl = this.gl - var shader = this.pickShader - var vao = this.vao - shader.bind() - shader.uniforms = { - model: camera.model || identity, - view: camera.view || identity, - projection: camera.projection || identity, - pickId: this.pickId, - clipBounds: filterClipBounds(this.clipBounds), - screenShape: [gl.drawingBufferWidth, gl.drawingBufferHeight], - pixelRatio: this.pixelRatio - } - vao.bind() - vao.draw(gl.TRIANGLE_STRIP, this.vertexCount) - vao.unbind() -} - -proto.update = function (options) { - var i, j - - this.dirty = true - - var connectGaps = !!options.connectGaps - - if ('dashScale' in options) { - this.dashScale = options.dashScale - } - if ('opacity' in options) { - this.opacity = +options.opacity - } - - // Recalculate buffer data - var buffer = [] - var arcLengthArray = [] - var pointArray = [] - var arcLength = 0.0 - var vertexCount = 0 - var bounds = [ - [ Infinity, Infinity, Infinity ], - [ -Infinity, -Infinity, -Infinity ]] - - var positions = options.position || options.positions - if (positions) { - - // Default color - var colors = options.color || options.colors || [0, 0, 0, 1] - - var lineWidth = options.lineWidth || 1 - - var hadGap = false - - fill_loop: - for (i = 1; i < positions.length; ++i) { - var a = positions[i - 1] - var b = positions[i] - - arcLengthArray.push(arcLength) - pointArray.push(a.slice()) - - for (j = 0; j < 3; ++j) { - if (isNaN(a[j]) || isNaN(b[j]) || - !isFinite(a[j]) || !isFinite(b[j])) { - - if (!connectGaps && buffer.length > 0) { - for (var k = 0; k < 24; ++k) { - buffer.push(buffer[buffer.length - 12]) - } - vertexCount += 2 - hadGap = true - } - - continue fill_loop - } - bounds[0][j] = Math.min(bounds[0][j], a[j], b[j]) - bounds[1][j] = Math.max(bounds[1][j], a[j], b[j]) - } - - var acolor, bcolor - if (Array.isArray(colors[0])) { - acolor = (colors.length > i - 1) ? colors[i - 1] : // using index value - (colors.length > 0) ? colors[colors.length - 1] : // using last item - [0, 0, 0, 1]; // using black - - bcolor = (colors.length > i) ? colors[i] : // using index value - (colors.length > 0) ? colors[colors.length - 1] : // using last item - [0, 0, 0, 1]; // using black - } else { - acolor = bcolor = colors - } - - if (acolor.length === 3) { - acolor = [acolor[0], acolor[1], acolor[2], 1] - } - if (bcolor.length === 3) { - bcolor = [bcolor[0], bcolor[1], bcolor[2], 1] - } - - var w0 - if (Array.isArray(lineWidth)) { - w0 = (lineWidth.length > i - 1) ? lineWidth[i - 1] : // using index value - (lineWidth.length > 0) ? lineWidth[lineWidth.length - 1] : // using last item - [0, 0, 0, 1]; // using black - } else { - w0 = lineWidth - } - - var t0 = arcLength - arcLength += distance(a, b) - - if (hadGap) { - for (j = 0; j < 2; ++j) { - buffer.push( - a[0], a[1], a[2], b[0], b[1], b[2], t0, w0, acolor[0], acolor[1], acolor[2], acolor[3]) - } - vertexCount += 2 - hadGap = false - } - - buffer.push( - a[0], a[1], a[2], b[0], b[1], b[2], t0, w0, acolor[0], acolor[1], acolor[2], acolor[3], - a[0], a[1], a[2], b[0], b[1], b[2], t0, -w0, acolor[0], acolor[1], acolor[2], acolor[3], - b[0], b[1], b[2], a[0], a[1], a[2], arcLength, -w0, bcolor[0], bcolor[1], bcolor[2], bcolor[3], - b[0], b[1], b[2], a[0], a[1], a[2], arcLength, w0, bcolor[0], bcolor[1], bcolor[2], bcolor[3]) - - vertexCount += 4 - } - } - this.buffer.update(buffer) - - arcLengthArray.push(arcLength) - pointArray.push(positions[positions.length - 1].slice()) - - this.bounds = bounds - - this.vertexCount = vertexCount - - this.points = pointArray - this.arcLength = arcLengthArray - - if ('dashes' in options) { - var dashArray = options.dashes - - // Calculate prefix sum - var prefixSum = dashArray.slice() - prefixSum.unshift(0) - for (i = 1; i < prefixSum.length; ++i) { - prefixSum[i] = prefixSum[i - 1] + prefixSum[i] - } - - var dashTexture = ndarray(new Array(256 * 4), [256, 1, 4]) - for (i = 0; i < 256; ++i) { - for (j = 0; j < 4; ++j) { - dashTexture.set(i, 0, j, 0) - } - if (bsearch.le(prefixSum, prefixSum[prefixSum.length - 1] * i / 255.0) & 1) { - dashTexture.set(i, 0, 0, 0) - } else { - dashTexture.set(i, 0, 0, 255) - } - } - - this.texture.setPixels(dashTexture) - } -} - -proto.dispose = function () { - this.shader.dispose() - this.vao.dispose() - this.buffer.dispose() -} - -proto.pick = function (selection) { - if (!selection) { - return null - } - if (selection.id !== this.pickId) { - return null - } - var tau = unpackFloat( - selection.value[0], - selection.value[1], - selection.value[2], - 0) - var index = bsearch.le(this.arcLength, tau) - if (index < 0) { - return null - } - if (index === this.arcLength.length - 1) { - return new PickResult( - this.arcLength[this.arcLength.length - 1], - this.points[this.points.length - 1].slice(), - index) - } - var a = this.points[index] - var b = this.points[Math.min(index + 1, this.points.length - 1)] - var t = (tau - this.arcLength[index]) / (this.arcLength[index + 1] - this.arcLength[index]) - var ti = 1.0 - t - var x = [0, 0, 0] - for (var i = 0; i < 3; ++i) { - x[i] = ti * a[i] + t * b[i] - } - var dataIndex = Math.min((t < 0.5) ? index : (index + 1), this.points.length - 1) - return new PickResult( - tau, - x, - dataIndex, - this.points[dataIndex]) -} - -function createLinePlot (options) { - var gl = options.gl || (options.scene && options.scene.gl) - - var shader = createShader(gl) - shader.attributes.position.location = 0 - shader.attributes.nextPosition.location = 1 - shader.attributes.arcLength.location = 2 - shader.attributes.lineWidth.location = 3 - shader.attributes.color.location = 4 - - var pickShader = createPickShader(gl) - pickShader.attributes.position.location = 0 - pickShader.attributes.nextPosition.location = 1 - pickShader.attributes.arcLength.location = 2 - pickShader.attributes.lineWidth.location = 3 - pickShader.attributes.color.location = 4 - - var buffer = createBuffer(gl) - var vao = createVAO(gl, [ - { - 'buffer': buffer, - 'size': 3, - 'offset': 0, - 'stride': 48 - }, - { - 'buffer': buffer, - 'size': 3, - 'offset': 12, - 'stride': 48 - }, - { - 'buffer': buffer, - 'size': 1, - 'offset': 24, - 'stride': 48 - }, - { - 'buffer': buffer, - 'size': 1, - 'offset': 28, - 'stride': 48 - }, - { - 'buffer': buffer, - 'size': 4, - 'offset': 32, - 'stride': 48 - } - ]) - - // Create texture for dash pattern - var defaultTexture = ndarray(new Array(256 * 4), [256, 1, 4]) - for (var i = 0; i < 256 * 4; ++i) { - defaultTexture.data[i] = 255 - } - var texture = createTexture(gl, defaultTexture) - texture.wrap = gl.REPEAT - - var linePlot = new LinePlot(gl, shader, pickShader, buffer, vao, texture) - linePlot.update(options) - return linePlot -} - -},{"./lib/shaders":244,"binary-search-bounds":79,"gl-buffer":230,"gl-texture2d":305,"gl-vao":310,"glsl-read-float":383,"ndarray":433}],246:[function(_dereq_,module,exports){ -module.exports = invert - -/** - * Inverts a mat2 - * - * @alias mat2.invert - * @param {mat2} out the receiving matrix - * @param {mat2} a the source matrix - * @returns {mat2} out - */ -function invert(out, a) { - var a0 = a[0] - var a1 = a[1] - var a2 = a[2] - var a3 = a[3] - var det = a0 * a3 - a2 * a1 - - if (!det) return null - det = 1.0 / det - - out[0] = a3 * det - out[1] = -a1 * det - out[2] = -a2 * det - out[3] = a0 * det - - return out -} - -},{}],247:[function(_dereq_,module,exports){ -module.exports = invert - -/** - * Inverts a mat3 - * - * @alias mat3.invert - * @param {mat3} out the receiving matrix - * @param {mat3} a the source matrix - * @returns {mat3} out - */ -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2] - var a10 = a[3], a11 = a[4], a12 = a[5] - var a20 = a[6], a21 = a[7], a22 = a[8] - - var b01 = a22 * a11 - a12 * a21 - var b11 = -a22 * a10 + a12 * a20 - var b21 = a21 * a10 - a11 * a20 - - // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21 - - if (!det) return null - det = 1.0 / det - - out[0] = b01 * det - out[1] = (-a22 * a01 + a02 * a21) * det - out[2] = (a12 * a01 - a02 * a11) * det - out[3] = b11 * det - out[4] = (a22 * a00 - a02 * a20) * det - out[5] = (-a12 * a00 + a02 * a10) * det - out[6] = b21 * det - out[7] = (-a21 * a00 + a01 * a20) * det - out[8] = (a11 * a00 - a01 * a10) * det - - return out -} - -},{}],248:[function(_dereq_,module,exports){ -module.exports = clone; - -/** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param {mat4} a matrix to clone - * @returns {mat4} a new 4x4 matrix - */ -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; -}; -},{}],249:[function(_dereq_,module,exports){ -module.exports = create; - -/** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ -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; -}; -},{}],250:[function(_dereq_,module,exports){ -module.exports = determinant; - -/** - * Calculates the determinant of a mat4 - * - * @param {mat4} a the source matrix - * @returns {Number} determinant of a - */ -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; - - // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -}; -},{}],251:[function(_dereq_,module,exports){ -module.exports = fromQuat; - -/** - * Creates a matrix from a quaternion rotation. - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @returns {mat4} out - */ -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; -}; -},{}],252:[function(_dereq_,module,exports){ -module.exports = fromRotationTranslation; - -/** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * var quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {vec3} v Translation vector - * @returns {mat4} out - */ -function fromRotationTranslation(out, q, v) { - // Quaternion math - 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; -}; -},{}],253:[function(_dereq_,module,exports){ -module.exports = identity; - -/** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ -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; -}; -},{}],254:[function(_dereq_,module,exports){ -module.exports = invert; - -/** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the source matrix - * @returns {mat4} out - */ -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, - - // Calculate the determinant - det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) { - return null; - } - det = 1.0 / 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; -}; -},{}],255:[function(_dereq_,module,exports){ -var identity = _dereq_('./identity'); - -module.exports = lookAt; - -/** - * Generates a look-at matrix with the given eye position, focal point, and up axis - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {vec3} eye Position of the viewer - * @param {vec3} center Point the viewer is looking at - * @param {vec3} up vec3 pointing up - * @returns {mat4} out - */ -function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, - eyex = eye[0], - eyey = eye[1], - eyez = eye[2], - upx = up[0], - upy = up[1], - upz = up[2], - centerx = center[0], - centery = center[1], - centerz = center[2]; - - if (Math.abs(eyex - centerx) < 0.000001 && - Math.abs(eyey - centery) < 0.000001 && - Math.abs(eyez - centerz) < 0.000001) { - return identity(out); - } - - z0 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - - len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - z0 *= len; - z1 *= len; - z2 *= len; - - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; - } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; - } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - - return out; -}; -},{"./identity":253}],256:[function(_dereq_,module,exports){ -module.exports = multiply; - -/** - * Multiplies two mat4's - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @returns {mat4} out - */ -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]; - - // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - - b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; - out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - - b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; - out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - - b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; - out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - return out; -}; -},{}],257:[function(_dereq_,module,exports){ -module.exports = perspective; - -/** - * Generates a perspective projection matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ -function perspective(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), - nf = 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) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - return out; -}; -},{}],258:[function(_dereq_,module,exports){ -module.exports = rotate; - -/** - * Rotates a mat4 by the given angle - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @param {vec3} axis the axis to rotate around - * @returns {mat4} out - */ -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) < 0.000001) { 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]; - - // Construct the elements of the rotation matrix - 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; - - // Perform rotation-specific matrix multiplication - 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) { // If the source and destination differ, copy the unchanged last row - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - return out; -}; -},{}],259:[function(_dereq_,module,exports){ -module.exports = rotateX; - -/** - * Rotates a matrix by the given angle around the X axis - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ -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) { // If the source and destination differ, copy the unchanged rows - 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]; - } - - // Perform axis-specific matrix multiplication - 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; -}; -},{}],260:[function(_dereq_,module,exports){ -module.exports = rotateY; - -/** - * Rotates a matrix by the given angle around the Y axis - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ -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) { // If the source and destination differ, copy the unchanged rows - 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]; - } - - // Perform axis-specific matrix multiplication - 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; -}; -},{}],261:[function(_dereq_,module,exports){ -module.exports = rotateZ; - -/** - * Rotates a matrix by the given angle around the Z axis - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ -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) { // If the source and destination differ, copy the unchanged last row - 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]; - } - - // Perform axis-specific matrix multiplication - 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; -}; -},{}],262:[function(_dereq_,module,exports){ -module.exports = scale; - -/** - * Scales the mat4 by the dimensions in the given vec3 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to scale - * @param {vec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ -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; -}; -},{}],263:[function(_dereq_,module,exports){ -module.exports = translate; - -/** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to translate - * @param {vec3} v vector to translate by - * @returns {mat4} out - */ -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; -}; -},{}],264:[function(_dereq_,module,exports){ -module.exports = transpose; - -/** - * Transpose the values of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the source matrix - * @returns {mat4} out - */ -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - 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; -}; -},{}],265:[function(_dereq_,module,exports){ -'use strict' - -module.exports = invert - -var invert2 = _dereq_('gl-mat2/invert') -var invert3 = _dereq_('gl-mat3/invert') -var invert4 = _dereq_('gl-mat4/invert') - -function invert(out, M) { - switch(M.length) { - case 0: - break - case 1: - out[0] = 1.0 / M[0] - break - case 4: - invert2(out, M) - break - case 9: - invert3(out, M) - break - case 16: - invert4(out, M) - break - default: - throw new Error('currently supports matrices up to 4x4') - break - } - return out -} -},{"gl-mat2/invert":246,"gl-mat3/invert":247,"gl-mat4/invert":254}],266:[function(_dereq_,module,exports){ -arguments[4][232][0].apply(exports,arguments) -},{"barycentric":61,"dup":232,"polytope-closest-point/lib/closest_point_2d.js":464}],267:[function(_dereq_,module,exports){ -var glslify = _dereq_('glslify') - -var triVertSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}\n"]) -var triFragSrc = glslify(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nvec3 normals(vec3 pos) {\n vec3 fdx = dFdx(pos);\n vec3 fdy = dFdy(pos);\n return normalize(cross(fdx, fdy));\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n vec3 normal = normals(f_data);\n\n if (dot(N, normal) < 0.0) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]) -var edgeVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}"]) -var edgeFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]) -var pointVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}"]) -var pointFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]) -var pickVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}"]) -var pickFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]) -var pickPointVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}"]) -var contourVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}"]) -var contourFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"]) - -exports.meshShader = { - vertex: triVertSrc, - fragment: triFragSrc, - attributes: [ - {name: 'position', type: 'vec3'}, - {name: 'normal', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'uv', type: 'vec2'} - ] -} -exports.wireShader = { - vertex: edgeVertSrc, - fragment: edgeFragSrc, - attributes: [ - {name: 'position', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'uv', type: 'vec2'} - ] -} -exports.pointShader = { - vertex: pointVertSrc, - fragment: pointFragSrc, - attributes: [ - {name: 'position', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'uv', type: 'vec2'}, - {name: 'pointSize', type: 'float'} - ] -} -exports.pickShader = { - vertex: pickVertSrc, - fragment: pickFragSrc, - attributes: [ - {name: 'position', type: 'vec3'}, - {name: 'id', type: 'vec4'} - ] -} -exports.pointPickShader = { - vertex: pickPointVertSrc, - fragment: pickFragSrc, - attributes: [ - {name: 'position', type: 'vec3'}, - {name: 'pointSize', type: 'float'}, - {name: 'id', type: 'vec4'} - ] -} -exports.contourShader = { - vertex: contourVertSrc, - fragment: contourFragSrc, - attributes: [ - {name: 'position', type: 'vec3'} - ] -} - -},{"glslify":392}],268:[function(_dereq_,module,exports){ -'use strict' - -var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small -var DEFAULT_FACE_NORMALS_EPSILON = 1e-6; - -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createTexture = _dereq_('gl-texture2d') -var normals = _dereq_('normals') -var multiply = _dereq_('gl-mat4/multiply') -var invert = _dereq_('gl-mat4/invert') -var ndarray = _dereq_('ndarray') -var colormap = _dereq_('colormap') -var getContour = _dereq_('simplicial-complex-contour') -var pool = _dereq_('typedarray-pool') -var shaders = _dereq_('./lib/shaders') -var closestPoint = _dereq_('./lib/closest-point') - -var meshShader = shaders.meshShader -var wireShader = shaders.wireShader -var pointShader = shaders.pointShader -var pickShader = shaders.pickShader -var pointPickShader = shaders.pointPickShader -var contourShader = shaders.contourShader - -var identityMatrix = [ - 1,0,0,0, - 0,1,0,0, - 0,0,1,0, - 0,0,0,1] - - -function SimplicialMesh(gl - , texture - , triShader - , lineShader - , pointShader - , pickShader - , pointPickShader - , contourShader - , trianglePositions - , triangleIds - , triangleColors - , triangleUVs - , triangleNormals - , triangleVAO - , edgePositions - , edgeIds - , edgeColors - , edgeUVs - , edgeVAO - , pointPositions - , pointIds - , pointColors - , pointUVs - , pointSizes - , pointVAO - , contourPositions - , contourVAO) { - - this.gl = gl - this.cells = [] - this.positions = [] - this.intensity = [] - this.texture = texture - this.dirty = true - - this.triShader = triShader - this.lineShader = lineShader - this.pointShader = pointShader - this.pickShader = pickShader - this.pointPickShader = pointPickShader - this.contourShader = contourShader - - this.trianglePositions = trianglePositions - this.triangleColors = triangleColors - this.triangleNormals = triangleNormals - this.triangleUVs = triangleUVs - this.triangleIds = triangleIds - this.triangleVAO = triangleVAO - this.triangleCount = 0 - - this.lineWidth = 1 - this.edgePositions = edgePositions - this.edgeColors = edgeColors - this.edgeUVs = edgeUVs - this.edgeIds = edgeIds - this.edgeVAO = edgeVAO - this.edgeCount = 0 - - this.pointPositions = pointPositions - this.pointColors = pointColors - this.pointUVs = pointUVs - this.pointSizes = pointSizes - this.pointIds = pointIds - this.pointVAO = pointVAO - this.pointCount = 0 - - this.contourLineWidth = 1 - this.contourPositions = contourPositions - this.contourVAO = contourVAO - this.contourCount = 0 - this.contourColor = [0,0,0] - this.contourEnable = true - - this.pickId = 1 - this.bounds = [ - [ Infinity, Infinity, Infinity], - [-Infinity,-Infinity,-Infinity] ] - this.clipBounds = [ - [-Infinity,-Infinity,-Infinity], - [ Infinity, Infinity, Infinity] ] - - this.lightPosition = [1e5, 1e5, 0] - this.ambientLight = 0.8 - this.diffuseLight = 0.8 - this.specularLight = 2.0 - this.roughness = 0.5 - this.fresnel = 1.5 - - this.opacity = 1.0 - - this._model = identityMatrix - this._view = identityMatrix - this._projection = identityMatrix - this._resolution = [1,1] -} - -var proto = SimplicialMesh.prototype - -proto.isOpaque = function() { - return this.opacity >= 1 -} - -proto.isTransparent = function() { - return this.opacity < 1 -} - -proto.pickSlots = 1 - -proto.setPickBase = function(id) { - this.pickId = id -} - -function genColormap(param) { - var colors = colormap({ - colormap: param - , nshades: 256 - , format: 'rgba' - }) - - var result = new Uint8Array(256*4) - for(var i=0; i<256; ++i) { - var c = colors[i] - for(var j=0; j<3; ++j) { - result[4*i+j] = c[j] - } - result[4*i+3] = c[3]*255 - } - - return ndarray(result, [256,256,4], [4,0,1]) -} - -function unpackIntensity(cells, numVerts, cellIntensity) { - var result = new Array(numVerts) - for(var i=0; i 0) { - var shader = this.triShader - shader.bind() - shader.uniforms = uniforms - - this.triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, this.triangleCount*3) - this.triangleVAO.unbind() - } - - if(this.edgeCount > 0 && this.lineWidth > 0) { - var shader = this.lineShader - shader.bind() - shader.uniforms = uniforms - - this.edgeVAO.bind() - gl.lineWidth(this.lineWidth) - gl.drawArrays(gl.LINES, 0, this.edgeCount*2) - this.edgeVAO.unbind() - } - - if(this.pointCount > 0) { - var shader = this.pointShader - shader.bind() - shader.uniforms = uniforms - - this.pointVAO.bind() - gl.drawArrays(gl.POINTS, 0, this.pointCount) - this.pointVAO.unbind() - } - - if(this.contourEnable && this.contourCount > 0 && this.contourLineWidth > 0) { - var shader = this.contourShader - shader.bind() - shader.uniforms = uniforms - - this.contourVAO.bind() - gl.drawArrays(gl.LINES, 0, this.contourCount) - this.contourVAO.unbind() - } -} - -proto.drawPick = function(params) { - params = params || {} - - var gl = this.gl - - var model = params.model || identityMatrix - var view = params.view || identityMatrix - var projection = params.projection || identityMatrix - - var clipBounds = [[-1e6,-1e6,-1e6],[1e6,1e6,1e6]] - for(var i=0; i<3; ++i) { - clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]) - clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]) - } - - //Save camera parameters - this._model = [].slice.call(model) - this._view = [].slice.call(view) - this._projection = [].slice.call(projection) - this._resolution = [gl.drawingBufferWidth, gl.drawingBufferHeight] - - var uniforms = { - model: model, - view: view, - projection: projection, - clipBounds: clipBounds, - pickId: this.pickId / 255.0, - } - - var shader = this.pickShader - shader.bind() - shader.uniforms = uniforms - - if(this.triangleCount > 0) { - this.triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, this.triangleCount*3) - this.triangleVAO.unbind() - } - - if(this.edgeCount > 0) { - this.edgeVAO.bind() - gl.lineWidth(this.lineWidth) - gl.drawArrays(gl.LINES, 0, this.edgeCount*2) - this.edgeVAO.unbind() - } - - if(this.pointCount > 0) { - var shader = this.pointPickShader - shader.bind() - shader.uniforms = uniforms - - this.pointVAO.bind() - gl.drawArrays(gl.POINTS, 0, this.pointCount) - this.pointVAO.unbind() - } -} - - -proto.pick = function(pickData) { - if(!pickData) { - return null - } - if(pickData.id !== this.pickId) { - return null - } - - var cellId = pickData.value[0] + 256*pickData.value[1] + 65536*pickData.value[2] - var cell = this.cells[cellId] - var positions = this.positions - - var simplex = new Array(cell.length) - for(var i=0; i tickOffset[start]) { - shader.uniforms.dataAxis = DATA_AXIS - shader.uniforms.screenOffset = SCREEN_OFFSET - shader.uniforms.color = textColor[axis] - shader.uniforms.angle = textAngle[axis] - gl.drawArrays( - gl.TRIANGLES, - tickOffset[start], - tickOffset[end] - tickOffset[start]) - } - } - if(labelEnable[axis] && labelCount) { - SCREEN_OFFSET[axis^1] -= screenScale * pixelRatio * labelPad[axis] - shader.uniforms.dataAxis = ZERO_2 - shader.uniforms.screenOffset = SCREEN_OFFSET - shader.uniforms.color = labelColor[axis] - shader.uniforms.angle = labelAngle[axis] - gl.drawArrays( - gl.TRIANGLES, - labelOffset, - labelCount) - } - - SCREEN_OFFSET[axis^1] = screenScale * viewBox[2+(axis^1)] - 1.0 - if(tickEnable[axis+2]) { - SCREEN_OFFSET[axis^1] += screenScale * pixelRatio * tickPad[axis+2] - if(start < end && tickOffset[end] > tickOffset[start]) { - shader.uniforms.dataAxis = DATA_AXIS - shader.uniforms.screenOffset = SCREEN_OFFSET - shader.uniforms.color = textColor[axis+2] - shader.uniforms.angle = textAngle[axis+2] - gl.drawArrays( - gl.TRIANGLES, - tickOffset[start], - tickOffset[end] - tickOffset[start]) - } - } - if(labelEnable[axis+2] && labelCount) { - SCREEN_OFFSET[axis^1] += screenScale * pixelRatio * labelPad[axis+2] - shader.uniforms.dataAxis = ZERO_2 - shader.uniforms.screenOffset = SCREEN_OFFSET - shader.uniforms.color = labelColor[axis+2] - shader.uniforms.angle = labelAngle[axis+2] - gl.drawArrays( - gl.TRIANGLES, - labelOffset, - labelCount) - } - - } -})() - -proto.drawTitle = (function() { - var DATA_AXIS = [0,0] - var SCREEN_OFFSET = [0,0] - - return function() { - var plot = this.plot - var shader = this.shader - var gl = plot.gl - var screenBox = plot.screenBox - var titleCenter = plot.titleCenter - var titleAngle = plot.titleAngle - var titleColor = plot.titleColor - var pixelRatio = plot.pixelRatio - - if(!this.titleCount) { - return - } - - for(var i=0; i<2; ++i) { - SCREEN_OFFSET[i] = 2.0 * (titleCenter[i]*pixelRatio - screenBox[i]) / - (screenBox[2+i] - screenBox[i]) - 1 - } - - shader.bind() - shader.uniforms.dataAxis = DATA_AXIS - shader.uniforms.screenOffset = SCREEN_OFFSET - shader.uniforms.angle = titleAngle - shader.uniforms.color = titleColor - - gl.drawArrays(gl.TRIANGLES, this.titleOffset, this.titleCount) - } -})() - -proto.bind = (function() { - var DATA_SHIFT = [0,0] - var DATA_SCALE = [0,0] - var TEXT_SCALE = [0,0] - - return function() { - var plot = this.plot - var shader = this.shader - var bounds = plot._tickBounds - var dataBox = plot.dataBox - var screenBox = plot.screenBox - var viewBox = plot.viewBox - - shader.bind() - - //Set up coordinate scaling uniforms - for(var i=0; i<2; ++i) { - - var lo = bounds[i] - var hi = bounds[i+2] - var boundScale = hi - lo - var dataCenter = 0.5 * (dataBox[i+2] + dataBox[i]) - var dataWidth = (dataBox[i+2] - dataBox[i]) - - var viewLo = viewBox[i] - var viewHi = viewBox[i+2] - var viewScale = viewHi - viewLo - var screenLo = screenBox[i] - var screenHi = screenBox[i+2] - var screenScale = screenHi - screenLo - - DATA_SCALE[i] = 2.0 * boundScale / dataWidth * viewScale / screenScale - DATA_SHIFT[i] = 2.0 * (lo - dataCenter) / dataWidth * viewScale / screenScale - } - - TEXT_SCALE[1] = 2.0 * plot.pixelRatio / (screenBox[3] - screenBox[1]) - TEXT_SCALE[0] = TEXT_SCALE[1] * (screenBox[3] - screenBox[1]) / (screenBox[2] - screenBox[0]) - - shader.uniforms.dataScale = DATA_SCALE - shader.uniforms.dataShift = DATA_SHIFT - shader.uniforms.textScale = TEXT_SCALE - - //Set attributes - this.vbo.bind() - shader.attributes.textCoordinate.pointer() - } -})() - -proto.update = function(options) { - var vertices = [] - var axesTicks = options.ticks - var bounds = options.bounds - var i, j, k, data, scale, dimension - - for(dimension=0; dimension<2; ++dimension) { - var offsets = [Math.floor(vertices.length/3)], tickX = [-Infinity] - - //Copy vertices over to buffer - var ticks = axesTicks[dimension] - for(i=0; i= 0)) { - continue - } - - var zeroIntercept = screenBox[i] - - dataBox[i] * (screenBox[i+2] - screenBox[i]) / (dataBox[i+2] - dataBox[i]) - - if(i === 0) { - line.drawLine( - zeroIntercept, screenBox[1], zeroIntercept, screenBox[3], - zeroLineWidth[i], - zeroLineColor[i]) - } else { - line.drawLine( - screenBox[0], zeroIntercept, screenBox[2], zeroIntercept, - zeroLineWidth[i], - zeroLineColor[i]) - } - } - } - - //Draw traces - for(var i=0; i=0; --i) { - this.objects[i].dispose() - } - this.objects.length = 0 - for(var i=this.overlays.length-1; i>=0; --i) { - this.overlays[i].dispose() - } - this.overlays.length = 0 - - this.gl = null -} - -proto.addObject = function(object) { - if(this.objects.indexOf(object) < 0) { - this.objects.push(object) - this.setDirty() - } -} - -proto.removeObject = function(object) { - var objects = this.objects - for(var i=0; i 0) { - var base = Math.round(Math.pow(10, y)) - return Math.ceil(x/base) * base - } - return Math.ceil(x) -} - -function defaultBool(x) { - if(typeof x === 'boolean') { - return x - } - return true -} - -function createScene(options) { - options = options || {} - - var stopped = false - - var pixelRatio = options.pixelRatio || parseFloat(window.devicePixelRatio) - - var canvas = options.canvas - if(!canvas) { - canvas = document.createElement('canvas') - if(options.container) { - var container = options.container - container.appendChild(canvas) - } else { - document.body.appendChild(canvas) - } - } - - var gl = options.gl - if(!gl) { - gl = getContext(canvas, - options.glOptions || { - premultipliedAlpha: true, - antialias: true, - preserveDrawingBuffer: isMobile - }) - } - if(!gl) { - throw new Error('webgl not supported') - } - - //Initial bounds - var bounds = options.bounds || [[-10,-10,-10], [10,10,10]] - - //Create selection - var selection = new MouseSelect() - - //Accumulation buffer - var accumBuffer = createFBO(gl, - [gl.drawingBufferWidth, gl.drawingBufferHeight], { - preferFloat: !isMobile - }) - - var accumShader = createShader(gl) - - //Create a camera - var cameraOptions = options.camera || { - eye: [2,0,0], - center: [0,0,0], - up: [0,1,0], - zoomMin: 0.1, - zoomMax: 100, - mode: 'turntable' - } - - //Create axes - var axesOptions = options.axes || {} - var axes = createAxes(gl, axesOptions) - axes.enable = !axesOptions.disable - - //Create spikes - var spikeOptions = options.spikes || {} - var spikes = createSpikes(gl, spikeOptions) - - //Object list is empty initially - var objects = [] - var pickBufferIds = [] - var pickBufferCount = [] - var pickBuffers = [] - - //Dirty flag, skip redraw if scene static - var dirty = true - var pickDirty = true - - var projection = new Array(16) - var model = new Array(16) - - var cameraParams = { - view: null, - projection: projection, - model: model - } - - var pickDirty = true - - var viewShape = [ gl.drawingBufferWidth, gl.drawingBufferHeight ] - - //Create scene object - var scene = { - gl: gl, - contextLost: false, - pixelRatio: options.pixelRatio || parseFloat(window.devicePixelRatio), - canvas: canvas, - selection: selection, - camera: createCamera(canvas, cameraOptions), - axes: axes, - axesPixels: null, - spikes: spikes, - bounds: bounds, - objects: objects, - shape: viewShape, - aspect: options.aspectRatio || [1,1,1], - pickRadius: options.pickRadius || 10, - zNear: options.zNear || 0.01, - zFar: options.zFar || 1000, - fovy: options.fovy || Math.PI/4, - clearColor: options.clearColor || [0,0,0,0], - autoResize: defaultBool(options.autoResize), - autoBounds: defaultBool(options.autoBounds), - autoScale: !!options.autoScale, - autoCenter: defaultBool(options.autoCenter), - clipToBounds: defaultBool(options.clipToBounds), - snapToData: !!options.snapToData, - onselect: options.onselect || null, - onrender: options.onrender || null, - onclick: options.onclick || null, - cameraParams: cameraParams, - oncontextloss: null, - mouseListener: null - } - - var pickShape = [ (gl.drawingBufferWidth/scene.pixelRatio)|0, (gl.drawingBufferHeight/scene.pixelRatio)|0 ] - - function resizeListener() { - if(stopped) { - return - } - if(!scene.autoResize) { - return - } - var parent = canvas.parentNode - var width = 1 - var height = 1 - if(parent && parent !== document.body) { - width = parent.clientWidth - height = parent.clientHeight - } else { - width = window.innerWidth - height = window.innerHeight - } - var nextWidth = Math.ceil(width * scene.pixelRatio)|0 - var nextHeight = Math.ceil(height * scene.pixelRatio)|0 - if(nextWidth !== canvas.width || nextHeight !== canvas.height) { - canvas.width = nextWidth - canvas.height = nextHeight - var style = canvas.style - style.position = style.position || 'absolute' - style.left = '0px' - style.top = '0px' - style.width = width + 'px' - style.height = height + 'px' - dirty = true - } - } - if(scene.autoResize) { - resizeListener() - } - window.addEventListener('resize', resizeListener) - - function reallocPickIds() { - var numObjs = objects.length - var numPick = pickBuffers.length - for(var i=0; i 0 && pickBufferCount[numPick-1] === 0) { - pickBufferCount.pop() - pickBuffers.pop().dispose() - } - } - - scene.update = function(options) { - if(stopped) { - return - } - options = options || {} - dirty = true - pickDirty = true - } - - scene.add = function(obj) { - if(stopped) { - return - } - obj.axes = axes - objects.push(obj) - pickBufferIds.push(-1) - dirty = true - pickDirty = true - reallocPickIds() - } - - scene.remove = function(obj) { - if(stopped) { - return - } - var idx = objects.indexOf(obj) - if(idx < 0) { - return - } - objects.splice(idx, 1) - pickBufferIds.pop() - dirty = true - pickDirty = true - reallocPickIds() - } - - scene.dispose = function() { - if(stopped) { - return - } - - stopped = true - - window.removeEventListener('resize', resizeListener) - canvas.removeEventListener('webglcontextlost', checkContextLoss) - scene.mouseListener.enabled = false - - if(scene.contextLost) { - return - } - - //Destroy objects - axes.dispose() - spikes.dispose() - for(var i=0; i selection.distance) { - continue - } - for(var j=0; j 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]) -exports.pickVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]) -exports.pickFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"]) - -},{"glslify":392}],279:[function(_dereq_,module,exports){ -'use strict' - -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') - -var pool = _dereq_('typedarray-pool') - -var SHADERS = _dereq_('./lib/shader') - -module.exports = createPointcloud2D - -function Pointcloud2D(plot, offsetBuffer, pickBuffer, shader, pickShader) { - this.plot = plot - this.offsetBuffer = offsetBuffer - this.pickBuffer = pickBuffer - this.shader = shader - this.pickShader = pickShader - this.sizeMin = 0.5 - this.sizeMinCap = 2 - this.sizeMax = 20 - this.areaRatio = 1.0 - this.pointCount = 0 - this.color = [1, 0, 0, 1] - this.borderColor = [0, 0, 0, 1] - this.blend = false - this.pickOffset = 0 - this.points = null -} - -var proto = Pointcloud2D.prototype - -proto.dispose = function() { - this.shader.dispose() - this.pickShader.dispose() - this.offsetBuffer.dispose() - this.pickBuffer.dispose() - this.plot.removeObject(this) -} - -proto.update = function(options) { - - var i - - options = options || {} - - function dflt(opt, value) { - if(opt in options) { - return options[opt] - } - return value - } - - this.sizeMin = dflt('sizeMin', 0.5) - // this.sizeMinCap = dflt('sizeMinCap', 2) - this.sizeMax = dflt('sizeMax', 20) - this.color = dflt('color', [1, 0, 0, 1]).slice() - this.areaRatio = dflt('areaRatio', 1) - this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() - this.blend = dflt('blend', false) - - //Update point data - - // Attempt straight-through processing (STP) to avoid allocation and copy - // TODO eventually abstract out STP logic, maybe into `pool` or a layer above - var pointCount = options.positions.length >>> 1 - var dataStraightThrough = options.positions instanceof Float32Array - var idStraightThrough = options.idToIndex instanceof Int32Array && options.idToIndex.length >= pointCount // permit larger to help reuse - - var data = options.positions - var packed = dataStraightThrough ? data : pool.mallocFloat32(data.length) - var packedId = idStraightThrough ? options.idToIndex : pool.mallocInt32(pointCount) - - if(!dataStraightThrough) { - packed.set(data) - } - - if(!idStraightThrough) { - packed.set(data) - for(i = 0; i < pointCount; i++) { - packedId[i] = i - } - } - - this.points = data - - this.offsetBuffer.update(packed) - this.pickBuffer.update(packedId) - - if(!dataStraightThrough) { - pool.free(packed) - } - - if(!idStraightThrough) { - pool.free(packedId) - } - - this.pointCount = pointCount - this.pickOffset = 0 -} - -function count(points, dataBox) { - var visiblePointCountEstimate = 0 - var length = points.length >>> 1 - var i - for(i = 0; i < length; i++) { - var x = points[i * 2] - var y = points[i * 2 + 1] - if(x >= dataBox[0] && x <= dataBox[2] && y >= dataBox[1] && y <= dataBox[3]) - visiblePointCountEstimate++ - } - return visiblePointCountEstimate -} - -proto.unifiedDraw = (function() { - var MATRIX = [1, 0, 0, - 0, 1, 0, - 0, 0, 1] - var PICK_VEC4 = [0, 0, 0, 0] -return function(pickOffset) { - var pick = pickOffset !== void(0) - - var shader = pick ? this.pickShader : this.shader - var gl = this.plot.gl - var dataBox = this.plot.dataBox - - if(this.pointCount === 0) { - return pickOffset - } - - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - - var visiblePointCountEstimate = count(this.points, dataBox) - var basicPointSize = this.plot.pickPixelRatio * Math.max(Math.min(this.sizeMinCap, this.sizeMin), Math.min(this.sizeMax, this.sizeMax / Math.pow(visiblePointCountEstimate, 0.33333))) - - MATRIX[0] = 2.0 / dataX - MATRIX[4] = 2.0 / dataY - MATRIX[6] = -2.0 * dataBox[0] / dataX - 1.0 - MATRIX[7] = -2.0 * dataBox[1] / dataY - 1.0 - - this.offsetBuffer.bind() - - shader.bind() - shader.attributes.position.pointer() - shader.uniforms.matrix = MATRIX - shader.uniforms.color = this.color - shader.uniforms.borderColor = this.borderColor - shader.uniforms.pointCloud = basicPointSize < 5 - shader.uniforms.pointSize = basicPointSize - shader.uniforms.centerFraction = Math.min(1, Math.max(0, Math.sqrt(1 - this.areaRatio))) - - if(pick) { - - PICK_VEC4[0] = ( pickOffset & 0xff) - PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) - PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) - PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) - - this.pickBuffer.bind() - shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) - shader.uniforms.pickOffset = PICK_VEC4 - this.pickOffset = pickOffset - } - - // Worth switching these off, but we can't make assumptions about other - // renderers, so let's restore it after each draw - var blend = gl.getParameter(gl.BLEND) - var dither = gl.getParameter(gl.DITHER) - - if(blend && !this.blend) - gl.disable(gl.BLEND) - if(dither) - gl.disable(gl.DITHER) - - gl.drawArrays(gl.POINTS, 0, this.pointCount) - - if(blend && !this.blend) - gl.enable(gl.BLEND) - if(dither) - gl.enable(gl.DITHER) - - return pickOffset + this.pointCount -} -})() - -proto.draw = proto.unifiedDraw -proto.drawPick = proto.unifiedDraw - -proto.pick = function(x, y, value) { - var pickOffset = this.pickOffset - var pointCount = this.pointCount - if(value < pickOffset || value >= pickOffset + pointCount) { - return null - } - var pointId = value - pickOffset - var points = this.points - return { - object: this, - pointId: pointId, - dataCoord: [points[2 * pointId], points[2 * pointId + 1] ] - } -} - -function createPointcloud2D(plot, options) { - var gl = plot.gl - var buffer = createBuffer(gl) - var pickBuffer = createBuffer(gl) - var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) - var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) - - var result = new Pointcloud2D(plot, buffer, pickBuffer, shader, pickShader) - result.update(options) - - //Register with plot - plot.addObject(result) - - return result -} - -},{"./lib/shader":278,"gl-buffer":230,"gl-shader":288,"typedarray-pool":522}],280:[function(_dereq_,module,exports){ -module.exports = slerp - -/** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {quat} a the first operand - * @param {quat} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {quat} out - */ -function slerp (out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - - var ax = a[0], ay = a[1], az = a[2], aw = a[3], - bx = b[0], by = b[1], bz = b[2], bw = b[3] - - var omega, cosom, sinom, scale0, scale1 - - // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw - // adjust signs (if necessary) - if (cosom < 0.0) { - cosom = -cosom - bx = -bx - by = -by - bz = -bz - bw = -bw - } - // calculate coefficients - if ((1.0 - cosom) > 0.000001) { - // standard case (slerp) - omega = Math.acos(cosom) - sinom = Math.sin(omega) - scale0 = Math.sin((1.0 - t) * omega) / sinom - scale1 = Math.sin(t * omega) / sinom - } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t - scale1 = t - } - // calculate final values - out[0] = scale0 * ax + scale1 * bx - out[1] = scale0 * ay + scale1 * by - out[2] = scale0 * az + scale1 * bz - out[3] = scale0 * aw + scale1 * bw - - return out -} - -},{}],281:[function(_dereq_,module,exports){ -'use strict'; - -module.exports = function(a){ - return (!a && a !== 0) ? '' : a.toString(); -} - -},{}],282:[function(_dereq_,module,exports){ -"use strict" - -var vectorizeText = _dereq_("vectorize-text") - -module.exports = getGlyph - -var GLYPH_CACHE = {} - -function getGlyph(symbol, font) { - var fontCache = GLYPH_CACHE[font] - if(!fontCache) { - fontCache = GLYPH_CACHE[font] = {} - } - if(symbol in fontCache) { - return fontCache[symbol] - } - - //Get line and triangle meshes for glyph - var lineSymbol = vectorizeText(symbol, { - textAlign: "center", - textBaseline: "middle", - lineHeight: 1.0, - font: font - }) - var triSymbol = vectorizeText(symbol, { - triangles: true, - textAlign: "center", - textBaseline: "middle", - lineHeight: 1.0, - font: font - }) - - //Calculate bounding box - var bounds = [[Infinity,Infinity], [-Infinity,-Infinity]] - for(var i=0; i max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}"]) -var orthographicVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n\n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}"]) -var projectionVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n"]) -var drawFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\n\n gl_FragColor = interpColor * opacity;\n}\n"]) -var pickFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\n\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n}"]) - -var ATTRIBUTES = [ - {name: 'position', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'glyph', type: 'vec2'}, - {name: 'id', type: 'vec4'} -] - -var perspective = { - vertex: perspectiveVertSrc, - fragment: drawFragSrc, - attributes: ATTRIBUTES - }, - ortho = { - vertex: orthographicVertSrc, - fragment: drawFragSrc, - attributes: ATTRIBUTES - }, - project = { - vertex: projectionVertSrc, - fragment: drawFragSrc, - attributes: ATTRIBUTES - }, - pickPerspective = { - vertex: perspectiveVertSrc, - fragment: pickFragSrc, - attributes: ATTRIBUTES - }, - pickOrtho = { - vertex: orthographicVertSrc, - fragment: pickFragSrc, - attributes: ATTRIBUTES - }, - pickProject = { - vertex: projectionVertSrc, - fragment: pickFragSrc, - attributes: ATTRIBUTES - } - -function createShader(gl, src) { - var shader = createShaderWrapper(gl, src) - var attr = shader.attributes - attr.position.location = 0 - attr.color.location = 1 - attr.glyph.location = 2 - attr.id.location = 3 - return shader -} - -exports.createPerspective = function(gl) { - return createShader(gl, perspective) -} -exports.createOrtho = function(gl) { - return createShader(gl, ortho) -} -exports.createProject = function(gl) { - return createShader(gl, project) -} -exports.createPickPerspective = function(gl) { - return createShader(gl, pickPerspective) -} -exports.createPickOrtho = function(gl) { - return createShader(gl, pickOrtho) -} -exports.createPickProject = function(gl) { - return createShader(gl, pickProject) -} - -},{"gl-shader":288,"glslify":392}],284:[function(_dereq_,module,exports){ -'use strict' - -var isAllBlank = _dereq_('is-string-blank') -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var pool = _dereq_('typedarray-pool') -var mat4mult = _dereq_('gl-mat4/multiply') -var shaders = _dereq_('./lib/shaders') -var getGlyph = _dereq_('./lib/glyphs') -var getSimpleString = _dereq_('./lib/get-simple-string') - -var IDENTITY = [1,0,0,0, - 0,1,0,0, - 0,0,1,0, - 0,0,0,1] - -module.exports = createPointCloud - -function transformMat4(x, m) { - var x0 = x[0] - var x1 = x[1] - var x2 = x[2] - var x3 = x[3] - x[0] = m[0] * x0 + m[4] * x1 + m[8] * x2 + m[12] * x3 - x[1] = m[1] * x0 + m[5] * x1 + m[9] * x2 + m[13] * x3 - x[2] = m[2] * x0 + m[6] * x1 + m[10] * x2 + m[14] * x3 - x[3] = m[3] * x0 + m[7] * x1 + m[11] * x2 + m[15] * x3 - return x -} - -function project(p, v, m, x) { - transformMat4(x, x, m) - transformMat4(x, x, v) - return transformMat4(x, x, p) -} - -function clampVec(v) { - var result = new Array(3) - for(var i=0; i<3; ++i) { - result[i] = Math.min(Math.max(v[i], -1e8), 1e8) - } - return result -} - -function ScatterPlotPickResult(index, position) { - this.index = index - this.dataCoordinate = this.position = position -} - -function PointCloud( - gl, - shader, - orthoShader, - projectShader, - pointBuffer, - colorBuffer, - glyphBuffer, - idBuffer, - vao, - pickPerspectiveShader, - pickOrthoShader, - pickProjectShader) { - - this.gl = gl - - this.pixelRatio = 1 - - this.shader = shader - this.orthoShader = orthoShader - this.projectShader = projectShader - - this.pointBuffer = pointBuffer - this.colorBuffer = colorBuffer - this.glyphBuffer = glyphBuffer - this.idBuffer = idBuffer - this.vao = vao - this.vertexCount = 0 - this.lineVertexCount = 0 - - this.opacity = 1.0 - - this.lineWidth = 0 - this.projectScale = [2.0/3.0, 2.0/3.0, 2.0/3.0] - this.projectOpacity = [1,1,1] - - this.pickId = 0 - this.pickPerspectiveShader = pickPerspectiveShader - this.pickOrthoShader = pickOrthoShader - this.pickProjectShader = pickProjectShader - this.points = [] - - this._selectResult = new ScatterPlotPickResult(0, [0,0,0]) - - this.useOrtho = true - this.bounds = [[ Infinity,Infinity,Infinity], - [-Infinity,-Infinity,-Infinity]] - - //Axes projections - this.axesProject = [ true, true, true ] - this.axesBounds = [[-Infinity,-Infinity,-Infinity], - [ Infinity, Infinity, Infinity]] - - this.highlightId = [1,1,1,1] - this.highlightScale = 2 - - this.clipBounds = [[-Infinity,-Infinity,-Infinity], - [ Infinity, Infinity, Infinity]] - - this.dirty = true -} - -var proto = PointCloud.prototype - -proto.pickSlots = 1 - -proto.setPickBase = function(pickBase) { - this.pickId = pickBase -} - -proto.isTransparent = function() { - if(this.opacity < 1) { - return true - } - for(var i=0; i<3; ++i) { - if(this.axesProject[i] && this.projectOpacity[i] < 1) { - return true - } - } - return false -} - -proto.isOpaque = function() { - if(this.opacity >= 1) { - return true - } - for(var i=0; i<3; ++i) { - if(this.axesProject[i] && this.projectOpacity[i] >= 1) { - return true - } - } - return false -} - -var VIEW_SHAPE = [0,0] -var U_VEC = [0,0,0] -var V_VEC = [0,0,0] -var MU_VEC = [0,0,0,1] -var MV_VEC = [0,0,0,1] -var SCRATCH_MATRIX = IDENTITY.slice() -var SCRATCH_VEC = [0,0,0] -var CLIP_BOUNDS = [[0,0,0], [0,0,0]] - -function zeroVec(a) { - a[0] = a[1] = a[2] = 0 - return a -} - -function augment(hg, af) { - hg[0] = af[0] - hg[1] = af[1] - hg[2] = af[2] - hg[3] = 1 - return hg -} - -function setComponent(out, v, i, x) { - out[0] = v[0] - out[1] = v[1] - out[2] = v[2] - out[i] = x - return out -} - -function getClipBounds(bounds) { - var result = CLIP_BOUNDS - for(var i=0; i<2; ++i) { - for(var j=0; j<3; ++j) { - result[i][j] = Math.max(Math.min(bounds[i][j], 1e8), -1e8) - } - } - return result -} - -function drawProject(shader, points, camera, transparent, forceDraw) { - var axesProject = points.axesProject - - var gl = points.gl - var uniforms = shader.uniforms - var model = camera.model || IDENTITY - var view = camera.view || IDENTITY - var projection = camera.projection || IDENTITY - var bounds = points.axesBounds - var clipBounds = getClipBounds(points.clipBounds) - - var cubeAxis - if(points.axes && points.axes.lastCubeProps) { - cubeAxis = points.axes.lastCubeProps.axis - } else { - cubeAxis = [1,1,1] - } - - VIEW_SHAPE[0] = 2.0/gl.drawingBufferWidth - VIEW_SHAPE[1] = 2.0/gl.drawingBufferHeight - - shader.bind() - uniforms.view = view - uniforms.projection = projection - uniforms.screenSize = VIEW_SHAPE - uniforms.highlightId = points.highlightId - uniforms.highlightScale = points.highlightScale - uniforms.clipBounds = clipBounds - uniforms.pickGroup = points.pickId / 255.0 - uniforms.pixelRatio = points.pixelRatio - - for(var i=0; i<3; ++i) { - if(!axesProject[i]) { - continue - } - if((points.projectOpacity[i] < 1) !== transparent) { - continue - } - - uniforms.scale = points.projectScale[i] - uniforms.opacity = points.projectOpacity[i] - - //Project model matrix - var pmodel = SCRATCH_MATRIX - for(var j=0; j<16; ++j) { - pmodel[j] = 0 - } - for(var j=0; j<4; ++j) { - pmodel[5*j] = 1 - } - pmodel[5*i] = 0 - if(cubeAxis[i] < 0) { - pmodel[12+i] = bounds[0][i] - } else { - pmodel[12+i] = bounds[1][i] - } - mat4mult(pmodel, model, pmodel) - uniforms.model = pmodel - - //Compute initial axes - var u = (i+1)%3 - var v = (i+2)%3 - var du = zeroVec(U_VEC) - var dv = zeroVec(V_VEC) - du[u] = 1 - dv[v] = 1 - - //Align orientation relative to viewer - var mdu = project(projection, view, model, augment(MU_VEC, du)) - var mdv = project(projection, view, model, augment(MV_VEC, dv)) - if(Math.abs(mdu[1]) > Math.abs(mdv[1])) { - var tmp = mdu - mdu = mdv - mdv = tmp - tmp = du - du = dv - dv = tmp - var t = u - u = v - v = t - } - if(mdu[0] < 0) { - du[u] = -1 - } - if(mdv[1] > 0) { - dv[v] = -1 - } - var su = 0.0 - var sv = 0.0 - for(var j=0; j<4; ++j) { - su += Math.pow(model[4*u+j], 2) - sv += Math.pow(model[4*v+j], 2) - } - du[u] /= Math.sqrt(su) - dv[v] /= Math.sqrt(sv) - uniforms.axes[0] = du - uniforms.axes[1] = dv - - //Update fragment clip bounds - uniforms.fragClipBounds[0] = setComponent(SCRATCH_VEC, clipBounds[0], i, -1e8) - uniforms.fragClipBounds[1] = setComponent(SCRATCH_VEC, clipBounds[1], i, 1e8) - - //Draw interior - points.vao.draw(gl.TRIANGLES, points.vertexCount) - - //Draw edges - if(points.lineWidth > 0) { - gl.lineWidth(points.lineWidth) - points.vao.draw(gl.LINES, points.lineVertexCount, points.vertexCount) - } - } -} - - -var NEG_INFINITY3 = [-1e8, -1e8, -1e8] -var POS_INFINITY3 = [1e8, 1e8, 1e8] -var CLIP_GROUP = [NEG_INFINITY3, POS_INFINITY3] - -function drawFull(shader, pshader, points, camera, transparent, forceDraw) { - var gl = points.gl - - points.vao.bind() - - if(transparent === (points.opacity < 1) || forceDraw) { - shader.bind() - var uniforms = shader.uniforms - - uniforms.model = camera.model || IDENTITY - uniforms.view = camera.view || IDENTITY - uniforms.projection = camera.projection || IDENTITY - - VIEW_SHAPE[0] = 2.0/gl.drawingBufferWidth - VIEW_SHAPE[1] = 2.0/gl.drawingBufferHeight - uniforms.screenSize = VIEW_SHAPE - - uniforms.highlightId = points.highlightId - uniforms.highlightScale = points.highlightScale - - uniforms.fragClipBounds = CLIP_GROUP - uniforms.clipBounds = points.axes.bounds - - uniforms.opacity = points.opacity - uniforms.pickGroup = points.pickId / 255.0 - - uniforms.pixelRatio = points.pixelRatio - - //Draw interior - points.vao.draw(gl.TRIANGLES, points.vertexCount) - - //Draw edges - if(points.lineWidth > 0) { - gl.lineWidth(points.lineWidth) - points.vao.draw(gl.LINES, points.lineVertexCount, points.vertexCount) - } - } - - drawProject(pshader, points, camera, transparent, forceDraw) - - points.vao.unbind() -} - -proto.draw = function(camera) { - var shader = this.useOrtho ? this.orthoShader : this.shader - drawFull(shader, this.projectShader, this, camera, false, false) -} - -proto.drawTransparent = function(camera) { - var shader = this.useOrtho ? this.orthoShader : this.shader - drawFull(shader, this.projectShader, this, camera, true, false) -} - -proto.drawPick = function(camera) { - var shader = this.useOrtho ? this.pickOrthoShader : this.pickPerspectiveShader - drawFull(shader, this.pickProjectShader, this, camera, false, true) -} - -proto.pick = function(selected) { - if(!selected) { - return null - } - if(selected.id !== this.pickId) { - return null - } - var x = selected.value[2] + (selected.value[1]<<8) + (selected.value[0]<<16) - if(x >= this.pointCount || x < 0) { - return null - } - - //Unpack result - var coord = this.points[x] - var result = this._selectResult - result.index = x - for(var i=0; i<3; ++i) { - result.position[i] = result.dataCoordinate[i] = coord[i] - } - return result -} - -proto.highlight = function(selection) { - if(!selection) { - this.highlightId = [1,1,1,1] - } else { - var pointId = selection.index - var a0 = pointId &0xff - var a1 = (pointId>>8) &0xff - var a2 = (pointId>>16)&0xff - this.highlightId = [a0/255.0, a1/255.0, a2/255.0, 0] - } -} - -function get_glyphData(glyphs, index, font) { - var str - - // use the data if presented in an array - if(Array.isArray(glyphs)) { - if(index < glyphs.length) { - str = glyphs[index] - } else { - str = undefined - } - } else { - str = glyphs - } - - str = getSimpleString(str) // this would handle undefined cases - - var visible = true - if(isAllBlank(str)) { - str = '▼' // Note: this special character may have minimum number of surfaces - visible = false - } - - var glyph = getGlyph(str, font) - - return { mesh:glyph[0], - lines:glyph[1], - bounds:glyph[2], - visible:visible }; -} - - - -proto.update = function(options) { - - options = options || {} - - if('perspective' in options) { - this.useOrtho = !options.perspective - } - if('orthographic' in options) { - this.useOrtho = !!options.orthographic - } - if('lineWidth' in options) { - this.lineWidth = options.lineWidth - } - if('project' in options) { - if(Array.isArray(options.project)) { - this.axesProject = options.project - } else { - var v = !!options.project - this.axesProject = [v,v,v] - } - } - if('projectScale' in options) { - if(Array.isArray(options.projectScale)) { - this.projectScale = options.projectScale.slice() - } else { - var s = +options.projectScale - this.projectScale = [s,s,s] - } - } - if('projectOpacity' in options) { - if(Array.isArray(options.projectOpacity)) { - this.projectOpacity = options.projectOpacity.slice() - } else { - var s = +options.projectOpacity - this.projectOpacity = [s,s,s] - } - } - if('opacity' in options) { - this.opacity = options.opacity - } - - //Set dirty flag - this.dirty = true - - //Create new buffers - var points = options.position - - //Text font - var font = options.font || 'normal' - var alignment = options.alignment || [0,0] - - //Bounds - var lowerBound = [ Infinity, Infinity, Infinity] - var upperBound = [-Infinity,-Infinity,-Infinity] - - //Unpack options - var glyphs = options.glyph - var colors = options.color - var sizes = options.size - var angles = options.angle - var lineColors = options.lineColor - - //Picking geometry - var pickCounter = -1 - - //First do pass to compute buffer sizes - var triVertexCount = 0 - var lineVertexCount = 0 - - var numPoints = 0; - - if(points.length) { - - //Count number of points and buffer size - numPoints = points.length - - count_loop: - for(var i=0; i 0) { - var triOffset = 0 - var lineOffset = triVertexCount - var color = [0,0,0,1] - var lineColor = [0,0,0,1] - - var isColorArray = Array.isArray(colors) && Array.isArray(colors[0]) - var isLineColorArray = Array.isArray(lineColors) && Array.isArray(lineColors[0]) - - fill_loop: - for(var i=0; i 0) { - textOffset[j] *= (1-glyphBounds[0][j]) - } else if(alignment[j] < 0) { - textOffset[j] *= (1+glyphBounds[1][j]) - } - } - - //Write out inner marker - var cells = glyphMesh.cells || [] - var verts = glyphMesh.positions || [] - - for(var j=0; j 0) { - - //Draw border - var w = lineWidth * pixelRatio - boxes.drawBox(loX-w, loY-w, hiX+w, loY+w, borderColor) - boxes.drawBox(loX-w, hiY-w, hiX+w, hiY+w, borderColor) - boxes.drawBox(loX-w, loY-w, loX+w, hiY+w, borderColor) - boxes.drawBox(hiX-w, loY-w, hiX+w, hiY+w, borderColor) - } -} - -proto.update = function(options) { - options = options || {} - - this.innerFill = !!options.innerFill - this.outerFill = !!options.outerFill - this.innerColor = (options.innerColor || [0,0,0,0.5]).slice() - this.outerColor = (options.outerColor || [0,0,0,0.5]).slice() - this.borderColor = (options.borderColor || [0,0,0,1]).slice() - this.borderWidth = options.borderWidth || 0 - this.selectBox = (options.selectBox || this.selectBox).slice() -} - -proto.dispose = function() { - this.boxBuffer.dispose() - this.boxShader.dispose() - this.plot.removeOverlay(this) -} - -function createSelectBox(plot, options) { - var gl = plot.gl - var buffer = createBuffer(gl, [ - 0, 0, - 0, 1, - 1, 0, - 1, 1 ]) - var shader = createShader(gl, SHADERS.boxVertex, SHADERS.boxFragment) - var selectBox = new SelectBox(plot, buffer, shader) - selectBox.update(options) - plot.addOverlay(selectBox) - return selectBox -} - -},{"./lib/shaders":285,"gl-buffer":230,"gl-shader":288}],287:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createSelectBuffer - -var createFBO = _dereq_('gl-fbo') -var pool = _dereq_('typedarray-pool') -var ndarray = _dereq_('ndarray') - -var nextPow2 = _dereq_('bit-twiddle').nextPow2 - -var selectRange = _dereq_('cwise/lib/wrapper')({"args":["array",{"offset":[0,0,1],"array":0},{"offset":[0,0,2],"array":0},{"offset":[0,0,3],"array":0},"scalar","scalar","index"],"pre":{"body":"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}","args":[],"thisVars":["this_closestD2","this_closestX","this_closestY"],"localVars":[]},"body":{"body":"{if(_inline_16_arg0_<255||_inline_16_arg1_<255||_inline_16_arg2_<255||_inline_16_arg3_<255){var _inline_16_l=_inline_16_arg4_-_inline_16_arg6_[0],_inline_16_a=_inline_16_arg5_-_inline_16_arg6_[1],_inline_16_f=_inline_16_l*_inline_16_l+_inline_16_a*_inline_16_a;_inline_16_f this.buffer.length) { - pool.free(this.buffer) - var buffer = this.buffer = pool.mallocUint8(nextPow2(r*c*4)) - for(var i=0; i oldAttribCount) { - for(i = oldAttribCount; i < newAttribCount; i++) { - this.gl.enableVertexAttribArray(i) - } - } else if(oldAttribCount > newAttribCount) { - for(i = newAttribCount; i < oldAttribCount; i++) { - this.gl.disableVertexAttribArray(i) - } - } - - this.gl.lastAttribCount = newAttribCount - - this.gl.useProgram(this.program) -} - -proto.dispose = function() { - - // disabling vertex attributes so new shader starts with zero - // and it's also useful if all shaders are disposed but the - // gl context is reused for subsequent replotting - var oldAttribCount = this.gl.lastAttribCount - for (var i = 0; i < oldAttribCount; i++) { - this.gl.disableVertexAttribArray(i) - } - this.gl.lastAttribCount = 0 - - if(this._fref) { - this._fref.dispose() - } - if(this._vref) { - this._vref.dispose() - } - this.attributes = - this.types = - this.vertShader = - this.fragShader = - this.program = - this._relink = - this._fref = - this._vref = null -} - -function compareAttributes(a, b) { - if(a.name < b.name) { - return -1 - } - return 1 -} - -//Update export hook for glslify-live -proto.update = function( - vertSource - , fragSource - , uniforms - , attributes) { - - //If only one object passed, assume glslify style output - if(!fragSource || arguments.length === 1) { - var obj = vertSource - vertSource = obj.vertex - fragSource = obj.fragment - uniforms = obj.uniforms - attributes = obj.attributes - } - - var wrapper = this - var gl = wrapper.gl - - //Compile vertex and fragment shaders - var pvref = wrapper._vref - wrapper._vref = shaderCache.shader(gl, gl.VERTEX_SHADER, vertSource) - if(pvref) { - pvref.dispose() - } - wrapper.vertShader = wrapper._vref.shader - var pfref = this._fref - wrapper._fref = shaderCache.shader(gl, gl.FRAGMENT_SHADER, fragSource) - if(pfref) { - pfref.dispose() - } - wrapper.fragShader = wrapper._fref.shader - - //If uniforms/attributes is not specified, use RT reflection - if(!uniforms || !attributes) { - - //Create initial test program - var testProgram = gl.createProgram() - gl.attachShader(testProgram, wrapper.fragShader) - gl.attachShader(testProgram, wrapper.vertShader) - gl.linkProgram(testProgram) - if(!gl.getProgramParameter(testProgram, gl.LINK_STATUS)) { - var errLog = gl.getProgramInfoLog(testProgram) - throw new GLError(errLog, 'Error linking program:' + errLog) - } - - //Load data from runtime - uniforms = uniforms || runtime.uniforms(gl, testProgram) - attributes = attributes || runtime.attributes(gl, testProgram) - - //Release test program - gl.deleteProgram(testProgram) - } - - //Sort attributes lexicographically - // overrides undefined WebGL behavior for attribute locations - attributes = attributes.slice() - attributes.sort(compareAttributes) - - //Convert attribute types, read out locations - var attributeUnpacked = [] - var attributeNames = [] - var attributeLocations = [] - var i - for(i=0; i= 0) { - var size = attr.type.charAt(attr.type.length-1)|0 - var locVector = new Array(size) - for(var j=0; j= 0) { - curLocation += 1 - } - attributeLocations[i] = curLocation - } - } - - //Rebuild program and recompute all uniform locations - var uniformLocations = new Array(uniforms.length) - function relink() { - wrapper.program = shaderCache.program( - gl - , wrapper._vref - , wrapper._fref - , attributeNames - , attributeLocations) - - for(var i=0; i= 0) { - var d = type.charCodeAt(type.length-1) - 48 - if(d < 2 || d > 4) { - throw new GLError('', 'Invalid data type for attribute ' + name + ': ' + type) - } - addVectorAttribute( - gl - , wrapper - , locs[0] - , locations - , d - , obj - , name) - } else if(type.indexOf('mat') >= 0) { - var d = type.charCodeAt(type.length-1) - 48 - if(d < 2 || d > 4) { - throw new GLError('', 'Invalid data type for attribute ' + name + ': ' + type) - } - addMatrixAttribute( - gl - , wrapper - , locs - , locations - , d - , obj - , name) - } else { - throw new GLError('', 'Unknown data type for attribute ' + name + ': ' + type) - } - break - } - } - return obj -} - -},{"./GLError":289}],291:[function(_dereq_,module,exports){ -'use strict' - -var coallesceUniforms = _dereq_('./reflect') -var GLError = _dereq_("./GLError") - -module.exports = createUniformWrapper - -//Binds a function and returns a value -function identity(x) { - var c = new Function('y', 'return function(){return y}') - return c(x) -} - -function makeVector(length, fill) { - var result = new Array(length) - for(var i=0; i 4) { - throw new GLError('', 'Invalid data type') - } - switch(type.charAt(0)) { - case 'b': - case 'i': - return 'gl.uniform' + d + 'iv(locations[' + index + '],obj' + path + ')' - case 'v': - return 'gl.uniform' + d + 'fv(locations[' + index + '],obj' + path + ')' - default: - throw new GLError('', 'Unrecognized data type for vector ' + name + ': ' + type) - } - } else if(type.indexOf('mat') === 0 && type.length === 4) { - var d = type.charCodeAt(type.length-1) - 48 - if(d < 2 || d > 4) { - throw new GLError('', 'Invalid uniform dimension type for matrix ' + name + ': ' + type) - } - return 'gl.uniformMatrix' + d + 'fv(locations[' + index + '],false,obj' + path + ')' - } else { - throw new GLError('', 'Unknown uniform data type for ' + name + ': ' + type) - } - break - } - } - - function enumerateIndices(prefix, type) { - if(typeof type !== 'object') { - return [ [prefix, type] ] - } - var indices = [] - for(var id in type) { - var prop = type[id] - var tprefix = prefix - if(parseInt(id) + '' === id) { - tprefix += '[' + id + ']' - } else { - tprefix += '.' + id - } - if(typeof prop === 'object') { - indices.push.apply(indices, enumerateIndices(tprefix, prop)) - } else { - indices.push([tprefix, prop]) - } - } - return indices - } - - function makeSetter(type) { - var code = [ 'return function updateProperty(obj){' ] - var indices = enumerateIndices('', type) - for(var i=0; i 4) { - throw new GLError('', 'Invalid data type') - } - if(type.charAt(0) === 'b') { - return makeVector(d, false) - } - return makeVector(d, 0) - } else if(type.indexOf('mat') === 0 && type.length === 4) { - var d = type.charCodeAt(type.length-1) - 48 - if(d < 2 || d > 4) { - throw new GLError('', 'Invalid uniform dimension type for matrix ' + name + ': ' + type) - } - return makeVector(d*d, 0) - } else { - throw new GLError('', 'Unknown uniform data type for ' + name + ': ' + type) - } - break - } - } - - function storeProperty(obj, prop, type) { - if(typeof type === 'object') { - var child = processObject(type) - Object.defineProperty(obj, prop, { - get: identity(child), - set: makeSetter(type), - enumerable: true, - configurable: false - }) - } else { - if(locations[type]) { - Object.defineProperty(obj, prop, { - get: makeGetter(type), - set: makeSetter(type), - enumerable: true, - configurable: false - }) - } else { - obj[prop] = defaultValue(uniforms[type].type) - } - } - } - - function processObject(obj) { - var result - if(Array.isArray(obj)) { - result = new Array(obj.length) - for(var i=0; i 1) { - if(!(x[0] in o)) { - o[x[0]] = [] - } - o = o[x[0]] - for(var k=1; k 1) { - for(var j=0; j 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float tubeScale;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n gl_Position = projection * view * tubePosition;\n f_color = color;\n f_normal = normal;\n f_data = tubePosition.xyz;\n f_position = position.xyz;\n f_eyeDirection = eyePosition - tubePosition.xyz;\n f_lightDirection = lightPosition - tubePosition.xyz;\n f_uv = uv;\n}\n"]) -var triFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}"]) -var pickVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float tubeScale;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n gl_Position = projection * view * tubePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]) -var pickFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]) - -exports.meshShader = { - vertex: triVertSrc, - fragment: triFragSrc, - attributes: [ - {name: 'position', type: 'vec4'}, - {name: 'normal', type: 'vec3'}, - {name: 'color', type: 'vec4'}, - {name: 'uv', type: 'vec2'}, - {name: 'vector', type: 'vec4'} - ] -} -exports.pickShader = { - vertex: pickVertSrc, - fragment: pickFragSrc, - attributes: [ - {name: 'position', type: 'vec4'}, - {name: 'id', type: 'vec4'}, - {name: 'vector', type: 'vec4'} - ] -} - -},{"glslify":392}],300:[function(_dereq_,module,exports){ -'use strict' - -var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small -var DEFAULT_FACE_NORMALS_EPSILON = 1e-6; - -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createTexture = _dereq_('gl-texture2d') -var normals = _dereq_('normals') -var multiply = _dereq_('gl-mat4/multiply') -var invert = _dereq_('gl-mat4/invert') -var ndarray = _dereq_('ndarray') -var colormap = _dereq_('colormap') -var getContour = _dereq_('simplicial-complex-contour') -var pool = _dereq_('typedarray-pool') -var shaders = _dereq_('./shaders') -var closestPoint = _dereq_('./closest-point') - -var meshShader = shaders.meshShader -var pickShader = shaders.pickShader - -var identityMatrix = [ - 1,0,0,0, - 0,1,0,0, - 0,0,1,0, - 0,0,0,1] - -function SimplicialMesh(gl - , texture - , triShader - , lineShader - , pointShader - , pickShader - , pointPickShader - , contourShader - , trianglePositions - , triangleVectors - , triangleIds - , triangleColors - , triangleUVs - , triangleNormals - , triangleVAO - , edgePositions - , edgeIds - , edgeColors - , edgeUVs - , edgeVAO - , pointPositions - , pointIds - , pointColors - , pointUVs - , pointSizes - , pointVAO - , contourPositions - , contourVAO) { - - this.gl = gl - this.cells = [] - this.positions = [] - this.intensity = [] - this.texture = texture - this.dirty = true - - this.triShader = triShader - this.lineShader = lineShader - this.pointShader = pointShader - this.pickShader = pickShader - this.pointPickShader = pointPickShader - this.contourShader = contourShader - - this.trianglePositions = trianglePositions - this.triangleVectors = triangleVectors - this.triangleColors = triangleColors - this.triangleNormals = triangleNormals - this.triangleUVs = triangleUVs - this.triangleIds = triangleIds - this.triangleVAO = triangleVAO - this.triangleCount = 0 - - this.lineWidth = 1 - this.edgePositions = edgePositions - this.edgeColors = edgeColors - this.edgeUVs = edgeUVs - this.edgeIds = edgeIds - this.edgeVAO = edgeVAO - this.edgeCount = 0 - - this.pointPositions = pointPositions - this.pointColors = pointColors - this.pointUVs = pointUVs - this.pointSizes = pointSizes - this.pointIds = pointIds - this.pointVAO = pointVAO - this.pointCount = 0 - - this.contourLineWidth = 1 - this.contourPositions = contourPositions - this.contourVAO = contourVAO - this.contourCount = 0 - this.contourColor = [0,0,0] - this.contourEnable = false - - this.pickId = 1 - this.bounds = [ - [ Infinity, Infinity, Infinity], - [-Infinity,-Infinity,-Infinity] ] - this.clipBounds = [ - [-Infinity,-Infinity,-Infinity], - [ Infinity, Infinity, Infinity] ] - - this.lightPosition = [1e5, 1e5, 0] - this.ambientLight = 0.8 - this.diffuseLight = 0.8 - this.specularLight = 2.0 - this.roughness = 0.5 - this.fresnel = 1.5 - - this.opacity = 1.0 - - this.tubeScale = 1.0 - - this._model = identityMatrix - this._view = identityMatrix - this._projection = identityMatrix - this._resolution = [1,1] -} - -var proto = SimplicialMesh.prototype - -proto.isOpaque = function() { - return this.opacity >= 1 -} - -proto.isTransparent = function() { - return this.opacity < 1 -} - -proto.pickSlots = 1 - -proto.setPickBase = function(id) { - this.pickId = id -} - -function genColormap(param) { - var colors = colormap({ - colormap: param - , nshades: 256 - , format: 'rgba' - }) - - var result = new Uint8Array(256*4) - for(var i=0; i<256; ++i) { - var c = colors[i] - for(var j=0; j<3; ++j) { - result[4*i+j] = c[j] - } - result[4*i+3] = c[3]*255 - } - - return ndarray(result, [256,256,4], [4,0,1]) -} - -function unpackIntensity(cells, numVerts, cellIntensity) { - var result = new Array(numVerts) - for(var i=0; i 0) { - var shader = this.triShader - shader.bind() - shader.uniforms = uniforms - - this.triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, this.triangleCount*3) - this.triangleVAO.unbind() - } - - if(this.edgeCount > 0 && this.lineWidth > 0) { - var shader = this.lineShader - shader.bind() - shader.uniforms = uniforms - - this.edgeVAO.bind() - gl.lineWidth(this.lineWidth) - gl.drawArrays(gl.LINES, 0, this.edgeCount*2) - this.edgeVAO.unbind() - } - - if(this.pointCount > 0) { - var shader = this.pointShader - shader.bind() - shader.uniforms = uniforms - - this.pointVAO.bind() - gl.drawArrays(gl.POINTS, 0, this.pointCount) - this.pointVAO.unbind() - } - - if(this.contourEnable && this.contourCount > 0 && this.contourLineWidth > 0) { - var shader = this.contourShader - shader.bind() - shader.uniforms = uniforms - - this.contourVAO.bind() - gl.drawArrays(gl.LINES, 0, this.contourCount) - this.contourVAO.unbind() - } -} - -proto.drawPick = function(params) { - params = params || {} - - var gl = this.gl - - var model = params.model || identityMatrix - var view = params.view || identityMatrix - var projection = params.projection || identityMatrix - - var clipBounds = [[-1e6,-1e6,-1e6],[1e6,1e6,1e6]] - for(var i=0; i<3; ++i) { - clipBounds[0][i] = Math.max(clipBounds[0][i], this.clipBounds[0][i]) - clipBounds[1][i] = Math.min(clipBounds[1][i], this.clipBounds[1][i]) - } - - //Save camera parameters - this._model = [].slice.call(model) - this._view = [].slice.call(view) - this._projection = [].slice.call(projection) - this._resolution = [gl.drawingBufferWidth, gl.drawingBufferHeight] - - var uniforms = { - model: model, - view: view, - projection: projection, - clipBounds: clipBounds, - - tubeScale: this.tubeScale, - - pickId: this.pickId / 255.0, - } - - var shader = this.pickShader - shader.bind() - shader.uniforms = uniforms - - if(this.triangleCount > 0) { - this.triangleVAO.bind() - gl.drawArrays(gl.TRIANGLES, 0, this.triangleCount*3) - this.triangleVAO.unbind() - } - - if(this.edgeCount > 0) { - this.edgeVAO.bind() - gl.lineWidth(this.lineWidth) - gl.drawArrays(gl.LINES, 0, this.edgeCount*2) - this.edgeVAO.unbind() - } - - if(this.pointCount > 0) { - var shader = this.pointPickShader - shader.bind() - shader.uniforms = uniforms - - this.pointVAO.bind() - gl.drawArrays(gl.POINTS, 0, this.pointCount) - this.pointVAO.unbind() - } -} - - -proto.pick = function(pickData) { - if(!pickData) { - return null - } - if(pickData.id !== this.pickId) { - return null - } - - var cellId = pickData.value[0] + 256*pickData.value[1] + 65536*pickData.value[2] - var cell = this.cells[cellId] - - var pos = this.positions[cell[1]].slice(0, 3) - var intensity = this.intensity[cell[1]] - var velocity = this.vectors[cell[1]].slice(0, 3) - var divergence = this.vectors[cell[1]][3] - - return { - index: cellId, - position: pos, - intensity: intensity, - velocity: velocity, - divergence: divergence, - dataCoordinate: pos - } -} - - -proto.dispose = function() { - this.texture.dispose() - - this.triShader.dispose() - // this.lineShader.dispose() - // this.pointShader.dispose() - this.pickShader.dispose() - // this.pointPickShader.dispose() - - this.triangleVAO.dispose() - this.trianglePositions.dispose() - this.triangleVectors.dispose() - this.triangleColors.dispose() - this.triangleUVs.dispose() - this.triangleNormals.dispose() - this.triangleIds.dispose() - - this.edgeVAO.dispose() - this.edgePositions.dispose() - this.edgeColors.dispose() - this.edgeUVs.dispose() - this.edgeIds.dispose() - - this.pointVAO.dispose() - this.pointPositions.dispose() - this.pointColors.dispose() - this.pointUVs.dispose() - this.pointSizes.dispose() - this.pointIds.dispose() - - this.contourVAO.dispose() - this.contourPositions.dispose() - // this.contourShader.dispose() -} - -function createMeshShader(gl) { - var shader = createShader(gl, meshShader.vertex, meshShader.fragment, null, meshShader.attributes) - shader.attributes.position.location = 0 - shader.attributes.color.location = 2 - shader.attributes.uv.location = 3 - shader.attributes.vector.location = 5 - return shader -} - -function createWireShader(gl) { - var shader = createShader(gl, wireShader.vertex, wireShader.fragment) - shader.attributes.position.location = 0 - shader.attributes.color.location = 2 - shader.attributes.uv.location = 3 - return shader -} - -function createPointShader(gl) { - var shader = createShader(gl, pointShader.vertex, pointShader.fragment) - shader.attributes.position.location = 0 - shader.attributes.color.location = 2 - shader.attributes.uv.location = 3 - shader.attributes.pointSize.location = 4 - return shader -} - -function createPickShader(gl) { - var shader = createShader(gl, pickShader.vertex, pickShader.fragment, null, pickShader.attributes) - shader.attributes.position.location = 0 - shader.attributes.id.location = 1 - shader.attributes.vector.location = 5 - return shader -} - -function createPointPickShader(gl) { - var shader = createShader(gl, pointPickShader.vertex, pointPickShader.fragment) - shader.attributes.position.location = 0 - shader.attributes.id.location = 1 - shader.attributes.pointSize.location = 4 - return shader -} - -function createContourShader(gl) { - var shader = createShader(gl, contourShader.vertex, contourShader.fragment) - shader.attributes.position.location = 0 - return shader -} - -function createSimplicialMesh(gl, params) { - if (arguments.length === 1) { - params = gl; - gl = params.gl; - } - - var triShader = params.triShader || createMeshShader(gl) - var lineShader = null; //createWireShader(gl) - var pointShader = null; //createPointShader(gl) - var pickShader = createPickShader(gl) - var pointPickShader = null; //createPointPickShader(gl) - var contourShader = null; //createContourShader(gl) - - var meshTexture = createTexture(gl, - ndarray(new Uint8Array([255,255,255,255]), [1,1,4])) - meshTexture.generateMipmap() - meshTexture.minFilter = gl.LINEAR_MIPMAP_LINEAR - meshTexture.magFilter = gl.LINEAR - - var trianglePositions = createBuffer(gl) - var triangleVectors = createBuffer(gl) - var triangleColors = createBuffer(gl) - var triangleUVs = createBuffer(gl) - var triangleNormals = createBuffer(gl) - var triangleIds = createBuffer(gl) - var triangleVAO = createVAO(gl, [ - { buffer: trianglePositions, - type: gl.FLOAT, - size: 4 - }, - { buffer: triangleIds, - type: gl.UNSIGNED_BYTE, - size: 4, - normalized: true - }, - { buffer: triangleColors, - type: gl.FLOAT, - size: 4 - }, - { buffer: triangleUVs, - type: gl.FLOAT, - size: 2 - }, - { buffer: triangleNormals, - type: gl.FLOAT, - size: 3 - }, - { buffer: triangleVectors, - type: gl.FLOAT, - size: 4 - } - ]) - - var edgePositions = createBuffer(gl) - var edgeColors = createBuffer(gl) - var edgeUVs = createBuffer(gl) - var edgeIds = createBuffer(gl) - var edgeVAO = createVAO(gl, [ - { buffer: edgePositions, - type: gl.FLOAT, - size: 3 - }, - { buffer: edgeIds, - type: gl.UNSIGNED_BYTE, - size: 4, - normalized: true - }, - { buffer: edgeColors, - type: gl.FLOAT, - size: 4 - }, - { buffer: edgeUVs, - type: gl.FLOAT, - size: 2 - } - ]) - - var pointPositions = createBuffer(gl) - var pointColors = createBuffer(gl) - var pointUVs = createBuffer(gl) - var pointSizes = createBuffer(gl) - var pointIds = createBuffer(gl) - var pointVAO = createVAO(gl, [ - { buffer: pointPositions, - type: gl.FLOAT, - size: 3 - }, - { buffer: pointIds, - type: gl.UNSIGNED_BYTE, - size: 4, - normalized: true - }, - { buffer: pointColors, - type: gl.FLOAT, - size: 4 - }, - { buffer: pointUVs, - type: gl.FLOAT, - size: 2 - }, - { buffer: pointSizes, - type: gl.FLOAT, - size: 1 - } - ]) - - var contourPositions = createBuffer(gl) - var contourVAO = createVAO(gl, [ - { buffer: contourPositions, - type: gl.FLOAT, - size: 3 - }]) - - var mesh = new SimplicialMesh(gl - , meshTexture - , triShader - , lineShader - , pointShader - , pickShader - , pointPickShader - , contourShader - , trianglePositions - , triangleVectors - , triangleIds - , triangleColors - , triangleUVs - , triangleNormals - , triangleVAO - , edgePositions - , edgeIds - , edgeColors - , edgeUVs - , edgeVAO - , pointPositions - , pointIds - , pointColors - , pointUVs - , pointSizes - , pointVAO - , contourPositions - , contourVAO) - - mesh.update(params) - - return mesh -} - -module.exports = createSimplicialMesh - -},{"./closest-point":298,"./shaders":299,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":288,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"normals":436,"simplicial-complex-contour":494,"typedarray-pool":522}],301:[function(_dereq_,module,exports){ -"use strict"; - -var vec3 = _dereq_('gl-vec3'); -var vec4 = _dereq_('gl-vec4'); - -var streamToTube = function(stream, maxDivergence, minDistance, maxNorm) { - var points = stream.points; - var velocities = stream.velocities; - var divergences = stream.divergences; - - var p, fwd, r, u, v, up; - up = vec3.set(vec3.create(), 0, 1, 0); - u = vec3.create(); - v = vec3.create(); - var p2 = vec3.create(); - - var verts = []; - var faces = []; - var vectors = []; - var previousVerts = []; - var currentVerts = []; - var intensities = []; - var previousIntensity = 0; - var currentIntensity = 0; - var currentVector = vec4.create(); - var previousVector = vec4.create(); - - var facets = 8; - - for (var i = 0; i < points.length; i++) { - p = points[i]; - fwd = velocities[i]; - r = divergences[i]; - if (maxDivergence === 0) { - r = minDistance * 0.05; - } - currentIntensity = vec3.length(fwd) / maxNorm; - currentVector = vec4.create(); - vec3.copy(currentVector, fwd); - currentVector[3] = r; - - for (var a = 0; a < facets; a++) { - currentVerts[a] = [p[0], p[1], p[2], a]; - } - if (previousVerts.length > 0) { - for (var a = 0; a < facets; a++) { - var a1 = (a+1) % facets; - verts.push( - previousVerts[a], - currentVerts[a], - currentVerts[a1], - - currentVerts[a1], - previousVerts[a1], - previousVerts[a] - ); - vectors.push( - previousVector, - currentVector, - currentVector, - - currentVector, - previousVector, - previousVector - ); - intensities.push( - previousIntensity, - currentIntensity, - currentIntensity, - - currentIntensity, - previousIntensity, - previousIntensity - ); - faces.push( - [verts.length-6, verts.length-5, verts.length-4], - [verts.length-3, verts.length-2, verts.length-1] - ); - } - } - var tmp = previousVerts; - previousVerts = currentVerts; - currentVerts = tmp; - tmp = previousVector; - previousVector = currentVector; - currentVector = tmp; - tmp = previousIntensity; - previousIntensity = currentIntensity; - currentIntensity = tmp; - } - return { - positions: verts, - cells: faces, - vectors: vectors, - vertexIntensity: intensities - }; - -}; - -var createTubes = function(streams, colormap, maxDivergence, minDistance) { - - var maxNorm = 0; - for (var i=0; i maxNorm) { - maxNorm = norm; - } - } - } - - var tubes = streams.map(function(s) { - return streamToTube(s, maxDivergence, minDistance, maxNorm); - }); - - var positions = []; - var cells = []; - var vectors = []; - var vertexIntensity = []; - for (var i=0; i < tubes.length; i++) { - var tube = tubes[i]; - var offset = positions.length; - positions = positions.concat(tube.positions); - vectors = vectors.concat(tube.vectors); - vertexIntensity = vertexIntensity.concat(tube.vertexIntensity); - for (var j=0; j v) return i-1; - } - return i; -}; - -var tmp = vec3.create(); -var tmp2 = vec3.create(); - -var clamp = function(v, min, max) { - return v < min ? min : (v > max ? max : v); -}; - -var sampleMeshgrid = function(point, array, meshgrid, clampOverflow) { - var x = point[0]; - var y = point[1]; - var z = point[2]; - - var w = meshgrid[0].length; - var h = meshgrid[1].length; - var d = meshgrid[2].length; - - // Find the index of the nearest smaller value in the meshgrid for each coordinate of (x,y,z). - // The nearest smaller value index for x is the index x0 such that - // meshgrid[0][x0] < x and for all x1 > x0, meshgrid[0][x1] >= x. - var x0 = findLastSmallerIndex(meshgrid[0], x); - var y0 = findLastSmallerIndex(meshgrid[1], y); - var z0 = findLastSmallerIndex(meshgrid[2], z); - - // Get the nearest larger meshgrid value indices. - // From the above "nearest smaller value", we know that - // meshgrid[0][x0] < x - // meshgrid[0][x0+1] >= x - var x1 = x0 + 1; - var y1 = y0 + 1; - var z1 = z0 + 1; - - if (meshgrid[0][x0] === x) x1 = x0; - if (meshgrid[1][y0] === y) y1 = y0; - if (meshgrid[2][z0] === z) z1 = z0; - - if (clampOverflow) { - x0 = clamp(x0, 0, w-1); - x1 = clamp(x1, 0, w-1); - y0 = clamp(y0, 0, h-1); - y1 = clamp(y1, 0, h-1); - z0 = clamp(z0, 0, d-1); - z1 = clamp(z1, 0, d-1); - } - - // Reject points outside the meshgrid, return a zero vector. - if (x0 < 0 || y0 < 0 || z0 < 0 || x1 >= w || y1 >= h || z1 >= d) { - return vec3.create(); - } - - // Normalize point coordinates to 0..1 scaling factor between x0 and x1. - var xf = (x - meshgrid[0][x0]) / (meshgrid[0][x1] - meshgrid[0][x0]); - var yf = (y - meshgrid[1][y0]) / (meshgrid[1][y1] - meshgrid[1][y0]); - var zf = (z - meshgrid[2][z0]) / (meshgrid[2][z1] - meshgrid[2][z0]); - - if (xf < 0 || xf > 1 || isNaN(xf)) xf = 0; - if (yf < 0 || yf > 1 || isNaN(yf)) yf = 0; - if (zf < 0 || zf > 1 || isNaN(zf)) zf = 0; - - var z0off = z0*w*h; - var z1off = z1*w*h; - - var y0off = y0*w; - var y1off = y1*w; - - var x0off = x0; - var x1off = x1; - - // Sample data array around the (x,y,z) point. - // vZYX = array[zZoff + yYoff + xXoff] - var v000 = array[y0off + z0off + x0off]; - var v001 = array[y0off + z0off + x1off]; - var v010 = array[y1off + z0off + x0off]; - var v011 = array[y1off + z0off + x1off]; - var v100 = array[y0off + z1off + x0off]; - var v101 = array[y0off + z1off + x1off]; - var v110 = array[y1off + z1off + x0off]; - var v111 = array[y1off + z1off + x1off]; - - var result = vec3.create(); - - // Average samples according to distance to point. - vec3.lerp(result, v000, v001, xf); - vec3.lerp(tmp, v010, v011, xf); - vec3.lerp(result, result, tmp, yf); - vec3.lerp(tmp, v100, v101, xf); - vec3.lerp(tmp2, v110, v111, xf); - vec3.lerp(tmp, tmp, tmp2, yf); - vec3.lerp(result, result, tmp, zf); - - return result; -}; - - -var vabs = function(dst, v) { - var x = v[0]; - var y = v[1]; - var z = v[2]; - dst[0] = x >= 0 ? x : -x; - dst[1] = y >= 0 ? y : -y; - dst[2] = z >= 0 ? z : -z; - return dst; -}; - -var findMinSeparation = function(xs) { - var minSeparation = 1/0; - xs.sort(function(a, b) { return a - b; }); - for (var i=1; i= minX && x <= maxX && - y >= minY && y <= maxY && - z >= minZ && z <= maxZ - ); - }; - - var boundsSize = vec3.distance(bounds[0], bounds[1]); - var maxStepSize = 10 * boundsSize / maxLength; - var maxStepSizeSq = maxStepSize * maxStepSize; - - var minDistance = 1; - var maxDivergence = 0; // For component-wise divergence vec3.create(); - var tmp = vec3.create(); - - if (positions.length >= 2) { - minDistance = calculateMinPositionDistance(positions); - } - - for (var i = 0; i < positions.length; i++) { - var p = vec3.create(); - vec3.copy(p, positions[i]); - - var stream = [p]; - var velocities = []; - var v = vectorField.getVelocity(p); - var op = p; - velocities.push(v); - - var divergences = []; - - var dv = vectorField.getDivergence(p, v); - var dvLength = vec3.length(dv); - if (dvLength > maxDivergence && !isNaN(dvLength) && isFinite(dvLength)) { - maxDivergence = dvLength; - } - // In case we need to do component-wise divergence visualization - // vec3.max(maxDivergence, maxDivergence, vabs(tmp, dv)); - divergences.push(dvLength); - - streams.push({points: stream, velocities: velocities, divergences: divergences}); - - var j = 0; - - while (j < maxLength * 100 && stream.length < maxLength && inBounds(bounds, p)) { - j++; - var np = vec3.clone(v); - var sqLen = vec3.squaredLength(np); - if (sqLen === 0) { - break; - } else if (sqLen > maxStepSizeSq) { - vec3.scale(np, np, maxStepSize / Math.sqrt(sqLen)); - } - vec3.add(np, np, p); - - v = vectorField.getVelocity(np); - - if (vec3.squaredDistance(op, np) - maxStepSizeSq > -0.0001 * maxStepSizeSq) { - stream.push(np); - op = np; - velocities.push(v); - var dv = vectorField.getDivergence(np, v); - var dvLength = vec3.length(dv); - if (dvLength > maxDivergence && !isNaN(dvLength) && isFinite(dvLength)) { - maxDivergence = dvLength; - } - // In case we need to do component-wise divergence visualization - //vec3.max(maxDivergence, maxDivergence, vabs(tmp, dv)); - divergences.push(dvLength); - } - - p = np; - } - } - - // Replace NaNs and Infinities with non-NaN, finite maxDivergence - for (var i=0; i max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if ((kill > 0.0) ||\n (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color — in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n"]) -var contourVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n"]) -var pickSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if ((kill > 0.0) ||\n (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;\n\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n"]) - -exports.createShader = function (gl) { - var shader = createShader(gl, vertSrc, fragSrc, null, [ - {name: 'uv', type: 'vec4'}, - {name: 'f', type: 'vec3'}, - {name: 'normal', type: 'vec3'} - ]) - shader.attributes.uv.location = 0 - shader.attributes.f.location = 1 - shader.attributes.normal.location = 2 - return shader -} -exports.createPickShader = function (gl) { - var shader = createShader(gl, vertSrc, pickSrc, null, [ - {name: 'uv', type: 'vec4'}, - {name: 'f', type: 'vec3'}, - {name: 'normal', type: 'vec3'} - ]) - shader.attributes.uv.location = 0 - shader.attributes.f.location = 1 - shader.attributes.normal.location = 2 - return shader -} -exports.createContourShader = function (gl) { - var shader = createShader(gl, contourVertSrc, fragSrc, null, [ - {name: 'uv', type: 'vec4'}, - {name: 'f', type: 'float'} - ]) - shader.attributes.uv.location = 0 - shader.attributes.f.location = 1 - return shader -} -exports.createPickContourShader = function (gl) { - var shader = createShader(gl, contourVertSrc, pickSrc, null, [ - {name: 'uv', type: 'vec4'}, - {name: 'f', type: 'float'} - ]) - shader.attributes.uv.location = 0 - shader.attributes.f.location = 1 - return shader -} - -},{"gl-shader":288,"glslify":392}],303:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createSurfacePlot - -var bits = _dereq_('bit-twiddle') -var createBuffer = _dereq_('gl-buffer') -var createVAO = _dereq_('gl-vao') -var createTexture = _dereq_('gl-texture2d') -var pool = _dereq_('typedarray-pool') -var colormap = _dereq_('colormap') -var ops = _dereq_('ndarray-ops') -var pack = _dereq_('ndarray-pack') -var ndarray = _dereq_('ndarray') -var surfaceNets = _dereq_('surface-nets') -var multiply = _dereq_('gl-mat4/multiply') -var invert = _dereq_('gl-mat4/invert') -var bsearch = _dereq_('binary-search-bounds') -var gradient = _dereq_('ndarray-gradient') -var shaders = _dereq_('./lib/shaders') - -var createShader = shaders.createShader -var createContourShader = shaders.createContourShader -var createPickShader = shaders.createPickShader -var createPickContourShader = shaders.createPickContourShader - -var SURFACE_VERTEX_SIZE = 4 * (4 + 3 + 3) - -var IDENTITY = [ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 ] - -var QUAD = [ - [0, 0], - [0, 1], - [1, 0], - [1, 1], - [1, 0], - [0, 1] -] - -var PERMUTATIONS = [ - [0, 0, 0, 0, 0, 0, 0, 0, 0], - [0, 0, 0, 0, 0, 0, 0, 0, 0], - [0, 0, 0, 0, 0, 0, 0, 0, 0] -] - -;(function () { - for (var i = 0; i < 3; ++i) { - var p = PERMUTATIONS[i] - var u = (i + 1) % 3 - var v = (i + 2) % 3 - p[u + 0] = 1 - p[v + 3] = 1 - p[i + 6] = 1 - } -})() - -function SurfacePickResult (position, index, uv, level, dataCoordinate) { - this.position = position - this.index = index - this.uv = uv - this.level = level - this.dataCoordinate = dataCoordinate -} - -var N_COLORS = 256 - -function genColormap (name) { - var x = pack([colormap({ - colormap: name, - nshades: N_COLORS, - format: 'rgba' - }).map(function (c) { - return [c[0], c[1], c[2], 255 * c[3]] - })]) - ops.divseq(x, 255.0) - return x -} - -function SurfacePlot ( - gl, - shape, - bounds, - shader, - pickShader, - coordinates, - vao, - colorMap, - contourShader, - contourPickShader, - contourBuffer, - contourVAO, - dynamicBuffer, - dynamicVAO) { - this.gl = gl - this.shape = shape - this.bounds = bounds - this.intensityBounds = []; - - this._shader = shader - this._pickShader = pickShader - this._coordinateBuffer = coordinates - this._vao = vao - this._colorMap = colorMap - - this._contourShader = contourShader - this._contourPickShader = contourPickShader - this._contourBuffer = contourBuffer - this._contourVAO = contourVAO - this._contourOffsets = [[], [], []] - this._contourCounts = [[], [], []] - this._vertexCount = 0 - - this._pickResult = new SurfacePickResult([0, 0, 0], [0, 0], [0, 0], [0, 0, 0], [0, 0, 0]) - - this._dynamicBuffer = dynamicBuffer - this._dynamicVAO = dynamicVAO - this._dynamicOffsets = [0, 0, 0] - this._dynamicCounts = [0, 0, 0] - - this.contourWidth = [ 1, 1, 1 ] - this.contourLevels = [[1], [1], [1]] - this.contourTint = [0, 0, 0] - this.contourColor = [[0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1], [0.5, 0.5, 0.5, 1]] - - this.showContour = true - this.showSurface = true - - this.enableHighlight = [true, true, true] - this.highlightColor = [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]] - this.highlightTint = [ 1, 1, 1 ] - this.highlightLevel = [-1, -1, -1] - - // Dynamic contour options - this.enableDynamic = [ true, true, true ] - this.dynamicLevel = [ NaN, NaN, NaN ] - this.dynamicColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ] - this.dynamicTint = [ 1, 1, 1 ] - this.dynamicWidth = [ 1, 1, 1 ] - - this.axesBounds = [[Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity]] - this.surfaceProject = [ false, false, false ] - this.contourProject = [[ false, false, false ], - [ false, false, false ], - [ false, false, false ]] - - this.colorBounds = [ false, false ] - - // Store xyz fields, need this for picking - this._field = [ - ndarray(pool.mallocFloat(1024), [0, 0]), - ndarray(pool.mallocFloat(1024), [0, 0]), - ndarray(pool.mallocFloat(1024), [0, 0]) ] - - this.pickId = 1 - this.clipBounds = [[-Infinity, -Infinity, -Infinity], [Infinity, Infinity, Infinity]] - - this.snapToData = false - - this.opacity = 1.0 - - this.lightPosition = [10, 10000, 0] - this.ambientLight = 0.8 - this.diffuseLight = 0.8 - this.specularLight = 2.0 - this.roughness = 0.5 - this.fresnel = 1.5 - this.vertexColor = 0; - - this.dirty = true -} - -var proto = SurfacePlot.prototype - -proto.isTransparent = function () { - return this.opacity < 1 -} - -proto.isOpaque = function () { - if (this.opacity >= 1) { - return true - } - for (var i = 0; i < 3; ++i) { - if (this._contourCounts[i].length > 0 || this._dynamicCounts[i] > 0) { - return true - } - } - return false -} - -proto.pickSlots = 1 - -proto.setPickBase = function (id) { - this.pickId = id -} - -var ZERO_VEC = [0, 0, 0] - -var PROJECT_DATA = { - showSurface: false, - showContour: false, - projections: [IDENTITY.slice(), IDENTITY.slice(), IDENTITY.slice()], - clipBounds: [ - [[0, 0, 0], [0, 0, 0]], - [[0, 0, 0], [0, 0, 0]], - [[0, 0, 0], [0, 0, 0]]] -} - -function computeProjectionData (camera, obj) { - var i, j, k - - // Compute cube properties - var cubeAxis = (obj.axes && obj.axes.lastCubeProps.axis) || ZERO_VEC - - var showSurface = obj.showSurface - var showContour = obj.showContour - - for (i = 0; i < 3; ++i) { - showSurface = showSurface || obj.surfaceProject[i] - for (j = 0; j < 3; ++j) { - showContour = showContour || obj.contourProject[i][j] - } - } - - for (i = 0; i < 3; ++i) { - // Construct projection onto axis - var axisSquish = PROJECT_DATA.projections[i] - for (j = 0; j < 16; ++j) { - axisSquish[j] = 0 - } - for (j = 0; j < 4; ++j) { - axisSquish[5 * j] = 1 - } - axisSquish[5 * i] = 0 - axisSquish[12 + i] = obj.axesBounds[+(cubeAxis[i] > 0)][i] - multiply(axisSquish, camera.model, axisSquish) - - var nclipBounds = PROJECT_DATA.clipBounds[i] - for (k = 0; k < 2; ++k) { - for (j = 0; j < 3; ++j) { - nclipBounds[k][j] = camera.clipBounds[k][j] - } - } - nclipBounds[0][i] = -1e8 - nclipBounds[1][i] = 1e8 - } - - PROJECT_DATA.showSurface = showSurface - PROJECT_DATA.showContour = showContour - - return PROJECT_DATA -} - -var UNIFORMS = { - model: IDENTITY, - view: IDENTITY, - projection: IDENTITY, - inverseModel: IDENTITY.slice(), - lowerBound: [0, 0, 0], - upperBound: [0, 0, 0], - colorMap: 0, - clipBounds: [[0, 0, 0], [0, 0, 0]], - height: 0.0, - contourTint: 0, - contourColor: [0, 0, 0, 1], - permutation: [1, 0, 0, 0, 1, 0, 0, 0, 1], - zOffset: -1e-4, - kambient: 1, - kdiffuse: 1, - kspecular: 1, - lightPosition: [1000, 1000, 1000], - eyePosition: [0, 0, 0], - roughness: 1, - fresnel: 1, - opacity: 1, - vertexColor: 0 -} - -var MATRIX_INVERSE = IDENTITY.slice() -var DEFAULT_PERM = [1, 0, 0, 0, 1, 0, 0, 0, 1] - -function drawCore (params, transparent) { - params = params || {} - var gl = this.gl - - gl.disable(gl.CULL_FACE) - - this._colorMap.bind(0) - - var uniforms = UNIFORMS - uniforms.model = params.model || IDENTITY - uniforms.view = params.view || IDENTITY - uniforms.projection = params.projection || IDENTITY - uniforms.lowerBound = [this.bounds[0][0], this.bounds[0][1], this.colorBounds[0] || this.bounds[0][2]] - uniforms.upperBound = [this.bounds[1][0], this.bounds[1][1], this.colorBounds[1] || this.bounds[1][2]] - uniforms.contourColor = this.contourColor[0] - - uniforms.inverseModel = invert(uniforms.inverseModel, uniforms.model) - - for (var i = 0; i < 2; ++i) { - var clipClamped = uniforms.clipBounds[i] - for (var j = 0; j < 3; ++j) { - clipClamped[j] = Math.min(Math.max(this.clipBounds[i][j], -1e8), 1e8) - } - } - - uniforms.kambient = this.ambientLight - uniforms.kdiffuse = this.diffuseLight - uniforms.kspecular = this.specularLight - - uniforms.roughness = this.roughness - uniforms.fresnel = this.fresnel - uniforms.opacity = this.opacity - - uniforms.height = 0.0 - uniforms.permutation = DEFAULT_PERM - - uniforms.vertexColor = this.vertexColor - - // Compute camera matrix inverse - var invCameraMatrix = MATRIX_INVERSE - multiply(invCameraMatrix, uniforms.view, uniforms.model) - multiply(invCameraMatrix, uniforms.projection, invCameraMatrix) - invert(invCameraMatrix, invCameraMatrix) - - for (i = 0; i < 3; ++i) { - uniforms.eyePosition[i] = invCameraMatrix[12 + i] / invCameraMatrix[15] - } - - var w = invCameraMatrix[15] - for (i = 0; i < 3; ++i) { - w += this.lightPosition[i] * invCameraMatrix[4 * i + 3] - } - for (i = 0; i < 3; ++i) { - var s = invCameraMatrix[12 + i] - for (j = 0; j < 3; ++j) { - s += invCameraMatrix[4 * j + i] * this.lightPosition[j] - } - uniforms.lightPosition[i] = s / w - } - - var projectData = computeProjectionData(uniforms, this) - - if (projectData.showSurface && (transparent === (this.opacity < 1))) { - // Set up uniforms - this._shader.bind() - this._shader.uniforms = uniforms - - // Draw it - this._vao.bind() - - if (this.showSurface && this._vertexCount) { - this._vao.draw(gl.TRIANGLES, this._vertexCount) - } - - // Draw projections of surface - for (i = 0; i < 3; ++i) { - if (!this.surfaceProject[i] || !this.vertexCount) { - continue - } - this._shader.uniforms.model = projectData.projections[i] - this._shader.uniforms.clipBounds = projectData.clipBounds[i] - this._vao.draw(gl.TRIANGLES, this._vertexCount) - } - - this._vao.unbind() - } - - if (projectData.showContour && !transparent) { - var shader = this._contourShader - - // Don't apply lighting to contours - uniforms.kambient = 1.0 - uniforms.kdiffuse = 0.0 - uniforms.kspecular = 0.0 - uniforms.opacity = 1.0 - - shader.bind() - shader.uniforms = uniforms - - // Draw contour lines - var vao = this._contourVAO - vao.bind() - - // Draw contour levels - for (i = 0; i < 3; ++i) { - shader.uniforms.permutation = PERMUTATIONS[i] - gl.lineWidth(this.contourWidth[i]) - - for (j = 0; j < this.contourLevels[i].length; ++j) { - if (j === this.highlightLevel[i]) { - shader.uniforms.contourColor = this.highlightColor[i] - shader.uniforms.contourTint = this.highlightTint[i] - } else if (j === 0 || (j - 1) === this.highlightLevel[i]) { - shader.uniforms.contourColor = this.contourColor[i] - shader.uniforms.contourTint = this.contourTint[i] - } - if (!this._contourCounts[i][j]) { - continue - } - shader.uniforms.height = this.contourLevels[i][j] - vao.draw(gl.LINES, this._contourCounts[i][j], this._contourOffsets[i][j]) - } - } - - // Draw projections of surface - for (i = 0; i < 3; ++i) { - shader.uniforms.model = projectData.projections[i] - shader.uniforms.clipBounds = projectData.clipBounds[i] - for (j = 0; j < 3; ++j) { - if (!this.contourProject[i][j]) { - continue - } - shader.uniforms.permutation = PERMUTATIONS[j] - gl.lineWidth(this.contourWidth[j]) - for (var k = 0; k < this.contourLevels[j].length; ++k) { - if (k === this.highlightLevel[j]) { - shader.uniforms.contourColor = this.highlightColor[j] - shader.uniforms.contourTint = this.highlightTint[j] - } else if (k === 0 || (k - 1) === this.highlightLevel[j]) { - shader.uniforms.contourColor = this.contourColor[j] - shader.uniforms.contourTint = this.contourTint[j] - } - shader.uniforms.height = this.contourLevels[j][k] - vao.draw(gl.LINES, this._contourCounts[j][k], this._contourOffsets[j][k]) - } - } - } - vao.unbind() - - // Draw dynamic contours - vao = this._dynamicVAO - vao.bind() - - // Draw contour levels - for (i = 0; i < 3; ++i) { - if (this._dynamicCounts[i] === 0) { - continue - } - - shader.uniforms.model = uniforms.model - shader.uniforms.clipBounds = uniforms.clipBounds - shader.uniforms.permutation = PERMUTATIONS[i] - gl.lineWidth(this.dynamicWidth[i]) - - shader.uniforms.contourColor = this.dynamicColor[i] - shader.uniforms.contourTint = this.dynamicTint[i] - shader.uniforms.height = this.dynamicLevel[i] - vao.draw(gl.LINES, this._dynamicCounts[i], this._dynamicOffsets[i]) - - for (j = 0; j < 3; ++j) { - if (!this.contourProject[j][i]) { - continue - } - - shader.uniforms.model = projectData.projections[j] - shader.uniforms.clipBounds = projectData.clipBounds[j] - vao.draw(gl.LINES, this._dynamicCounts[i], this._dynamicOffsets[i]) - } - } - - vao.unbind() - } -} - -proto.draw = function (params) { - return drawCore.call(this, params, false) -} - -proto.drawTransparent = function (params) { - return drawCore.call(this, params, true) -} - -var PICK_UNIFORMS = { - model: IDENTITY, - view: IDENTITY, - projection: IDENTITY, - inverseModel: IDENTITY, - clipBounds: [[0, 0, 0], [0, 0, 0]], - height: 0.0, - shape: [0, 0], - pickId: 0, - lowerBound: [0, 0, 0], - upperBound: [0, 0, 0], - zOffset: 0.0, - permutation: [1, 0, 0, 0, 1, 0, 0, 0, 1], - lightPosition: [0, 0, 0], - eyePosition: [0, 0, 0] -} - -proto.drawPick = function (params) { - params = params || {} - var gl = this.gl - gl.disable(gl.CULL_FACE) - - var uniforms = PICK_UNIFORMS - uniforms.model = params.model || IDENTITY - uniforms.view = params.view || IDENTITY - uniforms.projection = params.projection || IDENTITY - uniforms.shape = this._field[2].shape - uniforms.pickId = this.pickId / 255.0 - uniforms.lowerBound = this.bounds[0] - uniforms.upperBound = this.bounds[1] - uniforms.permutation = DEFAULT_PERM - - for (var i = 0; i < 2; ++i) { - var clipClamped = uniforms.clipBounds[i] - for (var j = 0; j < 3; ++j) { - clipClamped[j] = Math.min(Math.max(this.clipBounds[i][j], -1e8), 1e8) - } - } - - var projectData = computeProjectionData(uniforms, this) - - if (projectData.showSurface) { - // Set up uniforms - this._pickShader.bind() - this._pickShader.uniforms = uniforms - - // Draw it - this._vao.bind() - this._vao.draw(gl.TRIANGLES, this._vertexCount) - - // Draw projections of surface - for (i = 0; i < 3; ++i) { - if (!this.surfaceProject[i]) { - continue - } - this._pickShader.uniforms.model = projectData.projections[i] - this._pickShader.uniforms.clipBounds = projectData.clipBounds[i] - this._vao.draw(gl.TRIANGLES, this._vertexCount) - } - - this._vao.unbind() - } - - if (projectData.showContour) { - var shader = this._contourPickShader - - shader.bind() - shader.uniforms = uniforms - - var vao = this._contourVAO - vao.bind() - - for (j = 0; j < 3; ++j) { - gl.lineWidth(this.contourWidth[j]) - shader.uniforms.permutation = PERMUTATIONS[j] - for (i = 0; i < this.contourLevels[j].length; ++i) { - if (this._contourCounts[j][i]) { - shader.uniforms.height = this.contourLevels[j][i] - vao.draw(gl.LINES, this._contourCounts[j][i], this._contourOffsets[j][i]) - } - } - } - - // Draw projections of surface - for (i = 0; i < 3; ++i) { - shader.uniforms.model = projectData.projections[i] - shader.uniforms.clipBounds = projectData.clipBounds[i] - - for (j = 0; j < 3; ++j) { - if (!this.contourProject[i][j]) { - continue - } - - shader.uniforms.permutation = PERMUTATIONS[j] - gl.lineWidth(this.contourWidth[j]) - for (var k = 0; k < this.contourLevels[j].length; ++k) { - if (this._contourCounts[j][k]) { - shader.uniforms.height = this.contourLevels[j][k] - vao.draw(gl.LINES, this._contourCounts[j][k], this._contourOffsets[j][k]) - } - } - } - } - - vao.unbind() - } -} - -proto.pick = function (selection) { - if (!selection) { - return null - } - - if (selection.id !== this.pickId) { - return null - } - - var shape = this._field[2].shape - - var result = this._pickResult - - // Compute uv coordinate - var x = shape[0] * (selection.value[0] + (selection.value[2] >> 4) / 16.0) / 255.0 - var ix = Math.floor(x) - var fx = x - ix - - var y = shape[1] * (selection.value[1] + (selection.value[2] & 15) / 16.0) / 255.0 - var iy = Math.floor(y) - var fy = y - iy - - ix += 1 - iy += 1 - - // Compute xyz coordinate - var pos = result.position - pos[0] = pos[1] = pos[2] = 0 - for (var dx = 0; dx < 2; ++dx) { - var s = dx ? fx : 1.0 - fx - for (var dy = 0; dy < 2; ++dy) { - var t = dy ? fy : 1.0 - fy - - var r = ix + dx - var c = iy + dy - var w = s * t - - for (var i = 0; i < 3; ++i) { - pos[i] += this._field[i].get(r, c) * w - } - } - } - - // Find closest level - var levelIndex = this._pickResult.level - for (var j = 0; j < 3; ++j) { - levelIndex[j] = bsearch.le(this.contourLevels[j], pos[j]) - if (levelIndex[j] < 0) { - if (this.contourLevels[j].length > 0) { - levelIndex[j] = 0 - } - } else if (levelIndex[j] < this.contourLevels[j].length - 1) { - var a = this.contourLevels[j][levelIndex[j]] - var b = this.contourLevels[j][levelIndex[j] + 1] - if (Math.abs(a - pos[j]) > Math.abs(b - pos[j])) { - levelIndex[j] += 1 - } - } - } - - result.index[0] = fx < 0.5 ? ix : (ix + 1) - result.index[1] = fy < 0.5 ? iy : (iy + 1) - - result.uv[0] = x / shape[0] - result.uv[1] = y / shape[1] - - for (i = 0; i < 3; ++i) { - result.dataCoordinate[i] = this._field[i].get(result.index[0], result.index[1]) - } - - return result -} - -function padField (nfield, field) { - var shape = field.shape.slice() - var nshape = nfield.shape.slice() - - // Center - ops.assign(nfield.lo(1, 1).hi(shape[0], shape[1]), field) - - // Edges - ops.assign(nfield.lo(1).hi(shape[0], 1), - field.hi(shape[0], 1)) - ops.assign(nfield.lo(1, nshape[1] - 1).hi(shape[0], 1), - field.lo(0, shape[1] - 1).hi(shape[0], 1)) - ops.assign(nfield.lo(0, 1).hi(1, shape[1]), - field.hi(1)) - ops.assign(nfield.lo(nshape[0] - 1, 1).hi(1, shape[1]), - field.lo(shape[0] - 1)) - // Corners - nfield.set(0, 0, field.get(0, 0)) - nfield.set(0, nshape[1] - 1, field.get(0, shape[1] - 1)) - nfield.set(nshape[0] - 1, 0, field.get(shape[0] - 1, 0)) - nfield.set(nshape[0] - 1, nshape[1] - 1, field.get(shape[0] - 1, shape[1] - 1)) -} - -function handleArray (param, ctor) { - if (Array.isArray(param)) { - return [ ctor(param[0]), ctor(param[1]), ctor(param[2]) ] - } - return [ ctor(param), ctor(param), ctor(param) ] -} - -function toColor (x) { - if (Array.isArray(x)) { - if (x.length === 3) { - return [x[0], x[1], x[2], 1] - } - return [x[0], x[1], x[2], x[3]] - } - return [0, 0, 0, 1] -} - -function handleColor (param) { - if (Array.isArray(param)) { - if (Array.isArray(param)) { - return [ - toColor(param[0]), - toColor(param[1]), - toColor(param[2]) ] - } else { - var c = toColor(param) - return [ - c.slice(), - c.slice(), - c.slice() ] - } - } -} - -proto.update = function (params) { - params = params || {} - - this.dirty = true - - if ('contourWidth' in params) { - this.contourWidth = handleArray(params.contourWidth, Number) - } - if ('showContour' in params) { - this.showContour = handleArray(params.showContour, Boolean) - } - if ('showSurface' in params) { - this.showSurface = !!params.showSurface - } - if ('contourTint' in params) { - this.contourTint = handleArray(params.contourTint, Boolean) - } - if ('contourColor' in params) { - this.contourColor = handleColor(params.contourColor) - } - if ('contourProject' in params) { - this.contourProject = handleArray(params.contourProject, function (x) { - return handleArray(x, Boolean) - }) - } - if ('surfaceProject' in params) { - this.surfaceProject = params.surfaceProject - } - if ('dynamicColor' in params) { - this.dynamicColor = handleColor(params.dynamicColor) - } - if ('dynamicTint' in params) { - this.dynamicTint = handleArray(params.dynamicTint, Number) - } - if ('dynamicWidth' in params) { - this.dynamicWidth = handleArray(params.dynamicWidth, Number) - } - if ('opacity' in params) { - this.opacity = params.opacity - } - if ('colorBounds' in params) { - this.colorBounds = params.colorBounds - } - if ('vertexColor' in params) { - this.vertexColor = params.vertexColor ? 1 : 0; - } - - var field = params.field || (params.coords && params.coords[2]) || null - var levelsChanged = false - - if (!field) { - if (this._field[2].shape[0] || this._field[2].shape[2]) { - field = this._field[2].lo(1, 1).hi(this._field[2].shape[0] - 2, this._field[2].shape[1] - 2) - } else { - field = this._field[2].hi(0, 0) - } - } - - // Update field - if ('field' in params || 'coords' in params) { - var fsize = (field.shape[0] + 2) * (field.shape[1] + 2) - - // Resize if necessary - if (fsize > this._field[2].data.length) { - pool.freeFloat(this._field[2].data) - this._field[2].data = pool.mallocFloat(bits.nextPow2(fsize)) - } - - // Pad field - this._field[2] = ndarray(this._field[2].data, [field.shape[0] + 2, field.shape[1] + 2]) - padField(this._field[2], field) - - // Save shape of field - this.shape = field.shape.slice() - var shape = this.shape - - // Resize coordinate fields if necessary - for (var i = 0; i < 2; ++i) { - if (this._field[2].size > this._field[i].data.length) { - pool.freeFloat(this._field[i].data) - this._field[i].data = pool.mallocFloat(this._field[2].size) - } - this._field[i] = ndarray(this._field[i].data, [shape[0] + 2, shape[1] + 2]) - } - - // Generate x/y coordinates - if (params.coords) { - var coords = params.coords - if (!Array.isArray(coords) || coords.length !== 3) { - throw new Error('gl-surface: invalid coordinates for x/y') - } - for (i = 0; i < 2; ++i) { - var coord = coords[i] - for (j = 0; j < 2; ++j) { - if (coord.shape[j] !== shape[j]) { - throw new Error('gl-surface: coords have incorrect shape') - } - } - padField(this._field[i], coord) - } - } else if (params.ticks) { - var ticks = params.ticks - if (!Array.isArray(ticks) || ticks.length !== 2) { - throw new Error('gl-surface: invalid ticks') - } - for (i = 0; i < 2; ++i) { - var tick = ticks[i] - if (Array.isArray(tick) || tick.length) { - tick = ndarray(tick) - } - if (tick.shape[0] !== shape[i]) { - throw new Error('gl-surface: invalid tick length') - } - // Make a copy view of the tick array - var tick2 = ndarray(tick.data, shape) - tick2.stride[i] = tick.stride[0] - tick2.stride[i ^ 1] = 0 - - // Fill in field array - padField(this._field[i], tick2) - } - } else { - for (i = 0; i < 2; ++i) { - var offset = [0, 0] - offset[i] = 1 - this._field[i] = ndarray(this._field[i].data, [shape[0] + 2, shape[1] + 2], offset, 0) - } - this._field[0].set(0, 0, 0) - for (var j = 0; j < shape[0]; ++j) { - this._field[0].set(j + 1, 0, j) - } - this._field[0].set(shape[0] + 1, 0, shape[0] - 1) - this._field[1].set(0, 0, 0) - for (j = 0; j < shape[1]; ++j) { - this._field[1].set(0, j + 1, j) - } - this._field[1].set(0, shape[1] + 1, shape[1] - 1) - } - - // Save shape - var fields = this._field - - // Compute surface normals - var dfields = ndarray(pool.mallocFloat(fields[2].size * 3 * 2), [3, shape[0] + 2, shape[1] + 2, 2]) - for (i = 0; i < 3; ++i) { - gradient(dfields.pick(i), fields[i], 'mirror') - } - var normals = ndarray(pool.mallocFloat(fields[2].size * 3), [shape[0] + 2, shape[1] + 2, 3]) - for (i = 0; i < shape[0] + 2; ++i) { - for (j = 0; j < shape[1] + 2; ++j) { - var dxdu = dfields.get(0, i, j, 0) - var dxdv = dfields.get(0, i, j, 1) - var dydu = dfields.get(1, i, j, 0) - var dydv = dfields.get(1, i, j, 1) - var dzdu = dfields.get(2, i, j, 0) - var dzdv = dfields.get(2, i, j, 1) - - var nx = dydu * dzdv - dydv * dzdu - var ny = dzdu * dxdv - dzdv * dxdu - var nz = dxdu * dydv - dxdv * dydu - - var nl = Math.sqrt(nx * nx + ny * ny + nz * nz) - if (nl < 1e-8) { - nl = Math.max(Math.abs(nx), Math.abs(ny), Math.abs(nz)) - if (nl < 1e-8) { - nz = 1.0 - ny = nx = 0.0 - nl = 1.0 - } else { - nl = 1.0 / nl - } - } else { - nl = 1.0 / Math.sqrt(nl) - } - - normals.set(i, j, 0, nx * nl) - normals.set(i, j, 1, ny * nl) - normals.set(i, j, 2, nz * nl) - } - } - pool.free(dfields.data) - - // Initialize surface - var lo = [ Infinity, Infinity, Infinity ] - var hi = [ -Infinity, -Infinity, -Infinity ] - var lo_intensity = Infinity - var hi_intensity = -Infinity - var count = (shape[0] - 1) * (shape[1] - 1) * 6 - var tverts = pool.mallocFloat(bits.nextPow2(10 * count)) - var tptr = 0 - var vertexCount = 0 - for (i = 0; i < shape[0] - 1; ++i) { - j_loop: - for (j = 0; j < shape[1] - 1; ++j) { - // Test for NaNs - for (var dx = 0; dx < 2; ++dx) { - for (var dy = 0; dy < 2; ++dy) { - for (var k = 0; k < 3; ++k) { - var f = this._field[k].get(1 + i + dx, 1 + j + dy) - if (isNaN(f) || !isFinite(f)) { - continue j_loop - } - } - } - } - for (k = 0; k < 6; ++k) { - var r = i + QUAD[k][0] - var c = j + QUAD[k][1] - - var tx = this._field[0].get(r + 1, c + 1) - var ty = this._field[1].get(r + 1, c + 1) - f = this._field[2].get(r + 1, c + 1) - var vf = f - nx = normals.get(r + 1, c + 1, 0) - ny = normals.get(r + 1, c + 1, 1) - nz = normals.get(r + 1, c + 1, 2) - - if (params.intensity) { - vf = params.intensity.get(r, c) - } - - tverts[tptr++] = r - tverts[tptr++] = c - tverts[tptr++] = tx - tverts[tptr++] = ty - tverts[tptr++] = f - tverts[tptr++] = 0 - tverts[tptr++] = vf - tverts[tptr++] = nx - tverts[tptr++] = ny - tverts[tptr++] = nz - - lo[0] = Math.min(lo[0], tx) - lo[1] = Math.min(lo[1], ty) - lo[2] = Math.min(lo[2], f) - lo_intensity = Math.min(lo_intensity, vf) - - hi[0] = Math.max(hi[0], tx) - hi[1] = Math.max(hi[1], ty) - hi[2] = Math.max(hi[2], f) - hi_intensity = Math.max(hi_intensity, vf) - - vertexCount += 1 - } - } - } - - if (params.intensityBounds) { - lo_intensity = +params.intensityBounds[0] - hi_intensity = +params.intensityBounds[1] - } - - // Scale all vertex intensities - for (i = 6; i < tptr; i += 10) { - tverts[i] = (tverts[i] - lo_intensity) / (hi_intensity - lo_intensity) - } - - this._vertexCount = vertexCount - this._coordinateBuffer.update(tverts.subarray(0, tptr)) - pool.freeFloat(tverts) - pool.free(normals.data) - - // Update bounds - this.bounds = [lo, hi] - - // Save intensity - this.intensity = params.intensity || this._field[2] - - if(this.intensityBounds[0] !== lo_intensity || this.intensityBounds[1] !== hi_intensity) { - levelsChanged = true - } - - // Save intensity bound - this.intensityBounds = [lo_intensity, hi_intensity] - } - - // Update level crossings - if ('levels' in params) { - var levels = params.levels - if (!Array.isArray(levels[0])) { - levels = [ [], [], levels ] - } else { - levels = levels.slice() - } - for (i = 0; i < 3; ++i) { - levels[i] = levels[i].slice() - levels.sort(function (a, b) { - return a - b - }) - } - change_test: - for (i = 0; i < 3; ++i) { - if (levels[i].length !== this.contourLevels[i].length) { - levelsChanged = true - break - } - for (j = 0; j < levels[i].length; ++j) { - if (levels[i][j] !== this.contourLevels[i][j]) { - levelsChanged = true - break change_test - } - } - } - this.contourLevels = levels - } - - if (levelsChanged) { - fields = this._field - shape = this.shape - - // Update contour lines - var contourVerts = [] - - for (var dim = 0; dim < 3; ++dim) { - levels = this.contourLevels[dim] - var levelOffsets = [] - var levelCounts = [] - - var parts = [0, 0, 0] - - for (i = 0; i < levels.length; ++i) { - var graph = surfaceNets(this._field[dim], levels[i]) - levelOffsets.push((contourVerts.length / 5) | 0) - vertexCount = 0 - - edge_loop: - for (j = 0; j < graph.cells.length; ++j) { - var e = graph.cells[j] - for (k = 0; k < 2; ++k) { - var p = graph.positions[e[k]] - - var x = p[0] - var ix = Math.floor(x) | 0 - var fx = x - ix - - var y = p[1] - var iy = Math.floor(y) | 0 - var fy = y - iy - - var hole = false - dd_loop: - for (var dd = 0; dd < 3; ++dd) { - parts[dd] = 0.0 - var iu = (dim + dd + 1) % 3 - for (dx = 0; dx < 2; ++dx) { - var s = dx ? fx : 1.0 - fx - r = Math.min(Math.max(ix + dx, 0), shape[0]) | 0 - for (dy = 0; dy < 2; ++dy) { - var t = dy ? fy : 1.0 - fy - c = Math.min(Math.max(iy + dy, 0), shape[1]) | 0 - - if (dd < 2) { - f = this._field[iu].get(r, c) - } else { - f = (this.intensity.get(r, c) - this.intensityBounds[0]) / (this.intensityBounds[1] - this.intensityBounds[0]) - } - if (!isFinite(f) || isNaN(f)) { - hole = true - break dd_loop - } - - var w = s * t - parts[dd] += w * f - } - } - } - - if (!hole) { - contourVerts.push(parts[0], parts[1], p[0], p[1], parts[2]) - vertexCount += 1 - } else { - if (k > 0) { - // If we already added first edge, pop off verts - for (var l = 0; l < 5; ++l) { - contourVerts.pop() - } - vertexCount -= 1 - } - continue edge_loop - } - } - } - levelCounts.push(vertexCount) - } - - // Store results - this._contourOffsets[dim] = levelOffsets - this._contourCounts[dim] = levelCounts - } - - var floatBuffer = pool.mallocFloat(contourVerts.length) - for (i = 0; i < contourVerts.length; ++i) { - floatBuffer[i] = contourVerts[i] - } - this._contourBuffer.update(floatBuffer) - pool.freeFloat(floatBuffer) - } - - if (params.colormap) { - this._colorMap.setPixels(genColormap(params.colormap)) - } -} - -proto.dispose = function () { - this._shader.dispose() - this._vao.dispose() - this._coordinateBuffer.dispose() - this._colorMap.dispose() - this._contourBuffer.dispose() - this._contourVAO.dispose() - this._contourShader.dispose() - this._contourPickShader.dispose() - this._dynamicBuffer.dispose() - this._dynamicVAO.dispose() - for (var i = 0; i < 3; ++i) { - pool.freeFloat(this._field[i].data) - } -} - -proto.highlight = function (selection) { - if (!selection) { - this._dynamicCounts = [0, 0, 0] - this.dyanamicLevel = [NaN, NaN, NaN] - this.highlightLevel = [-1, -1, -1] - return - } - - for (var i = 0; i < 3; ++i) { - if (this.enableHighlight[i]) { - this.highlightLevel[i] = selection.level[i] - } else { - this.highlightLevel[i] = -1 - } - } - - var levels - if (this.snapToData) { - levels = selection.dataCoordinate - } else { - levels = selection.position - } - if ((!this.enableDynamic[0] || levels[0] === this.dynamicLevel[0]) && - (!this.enableDynamic[1] || levels[1] === this.dynamicLevel[1]) && - (!this.enableDynamic[2] || levels[2] === this.dynamicLevel[2])) { - return - } - - var vertexCount = 0 - var shape = this.shape - var scratchBuffer = pool.mallocFloat(12 * shape[0] * shape[1]) - - for (var d = 0; d < 3; ++d) { - if (!this.enableDynamic[d]) { - this.dynamicLevel[d] = NaN - this._dynamicCounts[d] = 0 - continue - } - - this.dynamicLevel[d] = levels[d] - - var u = (d + 1) % 3 - var v = (d + 2) % 3 - - var f = this._field[d] - var g = this._field[u] - var h = this._field[v] - var intensity = this.intensity - - var graph = surfaceNets(f, levels[d]) - var edges = graph.cells - var positions = graph.positions - - this._dynamicOffsets[d] = vertexCount - - for (i = 0; i < edges.length; ++i) { - var e = edges[i] - for (var j = 0; j < 2; ++j) { - var p = positions[e[j]] - - var x = +p[0] - var ix = x | 0 - var jx = Math.min(ix + 1, shape[0]) | 0 - var fx = x - ix - var hx = 1.0 - fx - - var y = +p[1] - var iy = y | 0 - var jy = Math.min(iy + 1, shape[1]) | 0 - var fy = y - iy - var hy = 1.0 - fy - - var w00 = hx * hy - var w01 = hx * fy - var w10 = fx * hy - var w11 = fx * fy - - var cu = w00 * g.get(ix, iy) + - w01 * g.get(ix, jy) + - w10 * g.get(jx, iy) + - w11 * g.get(jx, jy) - - var cv = w00 * h.get(ix, iy) + - w01 * h.get(ix, jy) + - w10 * h.get(jx, iy) + - w11 * h.get(jx, jy) - - if (isNaN(cu) || isNaN(cv)) { - if (j) { - vertexCount -= 1 - } - break - } - - scratchBuffer[2 * vertexCount + 0] = cu - scratchBuffer[2 * vertexCount + 1] = cv - - vertexCount += 1 - } - } - - this._dynamicCounts[d] = vertexCount - this._dynamicOffsets[d] - } - - this._dynamicBuffer.update(scratchBuffer.subarray(0, 2 * vertexCount)) - pool.freeFloat(scratchBuffer) -} - -function createSurfacePlot (params) { - var gl = params.gl - var shader = createShader(gl) - var pickShader = createPickShader(gl) - var contourShader = createContourShader(gl) - var contourPickShader = createPickContourShader(gl) - - var coordinateBuffer = createBuffer(gl) - var vao = createVAO(gl, [ - { buffer: coordinateBuffer, - size: 4, - stride: SURFACE_VERTEX_SIZE, - offset: 0 - }, - { buffer: coordinateBuffer, - size: 3, - stride: SURFACE_VERTEX_SIZE, - offset: 16 - }, - { - buffer: coordinateBuffer, - size: 3, - stride: SURFACE_VERTEX_SIZE, - offset: 28 - } - ]) - - var contourBuffer = createBuffer(gl) - var contourVAO = createVAO(gl, [ - { - buffer: contourBuffer, - size: 4, - stride: 20, - offset: 0 - }, - { - buffer: contourBuffer, - size: 1, - stride: 20, - offset: 16 - } - ]) - - var dynamicBuffer = createBuffer(gl) - var dynamicVAO = createVAO(gl, [ - { - buffer: dynamicBuffer, - size: 2, - type: gl.FLOAT - }]) - - var cmap = createTexture(gl, 1, N_COLORS, gl.RGBA, gl.UNSIGNED_BYTE) - cmap.minFilter = gl.LINEAR - cmap.magFilter = gl.LINEAR - - var surface = new SurfacePlot( - gl, - [0, 0], - [[0, 0, 0], [0, 0, 0]], - shader, - pickShader, - coordinateBuffer, - vao, - cmap, - contourShader, - contourPickShader, - contourBuffer, - contourVAO, - dynamicBuffer, - dynamicVAO - ) - - var nparams = { - levels: [[], [], []] - } - for (var id in params) { - nparams[id] = params[id] - } - nparams.colormap = nparams.colormap || 'jet' - - surface.update(nparams) - - return surface -} - -},{"./lib/shaders":302,"binary-search-bounds":79,"bit-twiddle":80,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"ndarray-gradient":424,"ndarray-ops":427,"ndarray-pack":428,"surface-nets":508,"typedarray-pool":522}],304:[function(_dereq_,module,exports){ -'use strict' - -var Font = _dereq_('css-font') -var pick = _dereq_('pick-by-alias') -var createRegl = _dereq_('regl') -var createGl = _dereq_('gl-util/context') -var WeakMap = _dereq_('es6-weak-map') -var rgba = _dereq_('color-normalize') -var fontAtlas = _dereq_('font-atlas') -var pool = _dereq_('typedarray-pool') -var parseRect = _dereq_('parse-rect') -var isObj = _dereq_('is-plain-obj') -var parseUnit = _dereq_('parse-unit') -var px = _dereq_('to-px') -var kerning = _dereq_('detect-kerning') -var extend = _dereq_('object-assign') -var metrics = _dereq_('font-measure') -var flatten = _dereq_('flatten-vertex-data') -var ref = _dereq_('bit-twiddle'); -var nextPow2 = ref.nextPow2; - -var shaderCache = new WeakMap - - -// Safari does not support font-stretch -var isStretchSupported = false -if (document.body) { - var el = document.body.appendChild(document.createElement('div')) - el.style.font = 'italic small-caps bold condensed 16px/2 cursive' - if (getComputedStyle(el).fontStretch) { - isStretchSupported = true - } - document.body.removeChild(el) -} - -var GlText = function GlText (o) { - if (isRegl(o)) { - o = {regl: o} - this.gl = o.regl._gl - } - else { - this.gl = createGl(o) - } - - this.shader = shaderCache.get(this.gl) - - if (!this.shader) { - this.regl = o.regl || createRegl({ gl: this.gl }) - } - else { - this.regl = this.shader.regl - } - - this.charBuffer = this.regl.buffer({ type: 'uint8', usage: 'stream' }) - this.sizeBuffer = this.regl.buffer({ type: 'float', usage: 'stream' }) - - if (!this.shader) { - this.shader = this.createShader() - shaderCache.set(this.gl, this.shader) - } - - this.batch = [] - - // multiple options initial state - this.fontSize = [] - this.font = [] - this.fontAtlas = [] - - this.draw = this.shader.draw.bind(this) - this.render = function () { - // FIXME: add Safari regl report here: - // charBuffer and width just do not trigger - this.regl._refresh() - this.draw(this.batch) - } - this.canvas = this.gl.canvas - - this.update(isObj(o) ? o : {}) -}; - -GlText.prototype.createShader = function createShader () { - var regl = this.regl - - // FIXME: store 2 shader versions: with normal viewport and without - // draw texture method - var draw = regl({ - blend: { - enable: true, - color: [0,0,0,1], - - func: { - srcRGB: 'src alpha', - dstRGB: 'one minus src alpha', - srcAlpha: 'one minus dst alpha', - dstAlpha: 'one' - } - }, - stencil: {enable: false}, - depth: {enable: false}, - - count: regl.prop('count'), - offset: regl.prop('offset'), - attributes: { - charOffset: { - offset: 4, - stride: 8, - buffer: regl.this('sizeBuffer') - }, - width: { - offset: 0, - stride: 8, - buffer: regl.this('sizeBuffer') - }, - char: regl.this('charBuffer'), - position: regl.this('position') - }, - uniforms: { - atlasSize: function (c, p) { return [p.atlas.width, p.atlas.height]; }, - atlasDim: function (c, p) { return [p.atlas.cols, p.atlas.rows]; }, - atlas: function (c, p) { return p.atlas.texture; }, - charStep: function (c, p) { return p.atlas.step; }, - em: function (c, p) { return p.atlas.em; }, - color: regl.prop('color'), - opacity: regl.prop('opacity'), - viewport: regl.this('viewportArray'), - scale: regl.this('scale'), - align: regl.prop('align'), - baseline: regl.prop('baseline'), - translate: regl.this('translate'), - positionOffset: regl.prop('positionOffset') - }, - primitive: 'points', - viewport: regl.this('viewport'), - - vert: ("\n\t\t\tprecision highp float;\n\t\t\tattribute float width, charOffset, char;\n\t\t\tattribute vec2 position;\n\t\t\tuniform float fontSize, charStep, em, align, baseline;\n\t\t\tuniform vec4 viewport;\n\t\t\tuniform vec4 color;\n\t\t\tuniform vec2 atlasSize, atlasDim, scale, translate, positionOffset;\n\t\t\tvarying vec2 charCoord, charId;\n\t\t\tvarying float charWidth;\n\t\t\tvarying vec4 fontColor;\n\t\t\tvoid main () {\n\t\t\t\t" + (!GlText.normalViewport ? 'vec2 positionOffset = vec2(positionOffset.x,- positionOffset.y);' : '') + "\n\n\t\t\t\tvec2 offset = floor(em * (vec2(align + charOffset, baseline)\n\t\t\t\t\t+ positionOffset))\n\t\t\t\t\t/ (viewport.zw * scale.xy);\n\n\t\t\t\tvec2 position = (position + translate) * scale;\n\t\t\t\tposition += offset * scale;\n\n\t\t\t\t" + (GlText.normalViewport ? 'position.y = 1. - position.y;' : '') + "\n\n\t\t\t\tcharCoord = position * viewport.zw + viewport.xy;\n\n\t\t\t\tgl_Position = vec4(position * 2. - 1., 0, 1);\n\n\t\t\t\tgl_PointSize = charStep;\n\n\t\t\t\tcharId.x = mod(char, atlasDim.x);\n\t\t\t\tcharId.y = floor(char / atlasDim.x);\n\n\t\t\t\tcharWidth = width * em;\n\n\t\t\t\tfontColor = color / 255.;\n\t\t\t}"), - - frag: "\n\t\t\tprecision highp float;\n\t\t\tuniform sampler2D atlas;\n\t\t\tuniform float fontSize, charStep, opacity;\n\t\t\tuniform vec2 atlasSize;\n\t\t\tuniform vec4 viewport;\n\t\t\tvarying vec4 fontColor;\n\t\t\tvarying vec2 charCoord, charId;\n\t\t\tvarying float charWidth;\n\n\t\t\tfloat lightness(vec4 color) {\n\t\t\t\treturn color.r * 0.299 + color.g * 0.587 + color.b * 0.114;\n\t\t\t}\n\n\t\t\tvoid main () {\n\t\t\t\tvec2 uv = gl_FragCoord.xy - charCoord + charStep * .5;\n\t\t\t\tfloat halfCharStep = floor(charStep * .5 + .5);\n\n\t\t\t\t// invert y and shift by 1px (FF expecially needs that)\n\t\t\t\tuv.y = charStep - uv.y;\n\n\t\t\t\t// ignore points outside of character bounding box\n\t\t\t\tfloat halfCharWidth = ceil(charWidth * .5);\n\t\t\t\tif (floor(uv.x) > halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}" - }) - - // per font-size atlas - var atlas = {} - - return { regl: regl, draw: draw, atlas: atlas } -}; - -GlText.prototype.update = function update (o) { - var this$1 = this; - - if (typeof o === 'string') { o = { text: o } } - else if (!o) { return } - - // FIXME: make this a static transform or more general approact - o = pick(o, { - position: 'position positions coord coords coordinates', - font: 'font fontFace fontface typeface cssFont css-font family fontFamily', - fontSize: 'fontSize fontsize size font-size', - text: 'text texts chars characters value values symbols', - align: 'align alignment textAlign textbaseline', - baseline: 'baseline textBaseline textbaseline', - direction: 'dir direction textDirection', - color: 'color colour fill fill-color fillColor textColor textcolor', - kerning: 'kerning kern', - range: 'range dataBox', - viewport: 'vp viewport viewBox viewbox viewPort', - opacity: 'opacity alpha transparency visible visibility opaque', - offset: 'offset positionOffset padding shift indent indentation' - }, true) - - - if (o.opacity != null) { - if (Array.isArray(o.opacity)) { - this.opacity = o.opacity.map(function (o) { return parseFloat(o); }) - } - else { - this.opacity = parseFloat(o.opacity) - } - } - - if (o.viewport != null) { - this.viewport = parseRect(o.viewport) - - if (GlText.normalViewport) { - this.viewport.y = this.canvas.height - this.viewport.y - this.viewport.height - } - - this.viewportArray = [this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height] - - } - if (this.viewport == null) { - this.viewport = { - x: 0, y: 0, - width: this.gl.drawingBufferWidth, - height: this.gl.drawingBufferHeight - } - this.viewportArray = [this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height] - } - - if (o.kerning != null) { this.kerning = o.kerning } - - if (o.offset != null) { - if (typeof o.offset === 'number') { o.offset = [o.offset, 0] } - - this.positionOffset = flatten(o.offset) - } - - if (o.direction) { this.direction = o.direction } - - if (o.range) { - this.range = o.range - this.scale = [1 / (o.range[2] - o.range[0]), 1 / (o.range[3] - o.range[1])] - this.translate = [-o.range[0], -o.range[1]] - } - if (o.scale) { this.scale = o.scale } - if (o.translate) { this.translate = o.translate } - - // default scale corresponds to viewport - if (!this.scale) { this.scale = [1 / this.viewport.width, 1 / this.viewport.height] } - - if (!this.translate) { this.translate = [0, 0] } - - if (!this.font.length && !o.font) { o.font = GlText.baseFontSize + 'px sans-serif' } - - // normalize font caching string - var newFont = false, newFontSize = false - - // obtain new font data - if (o.font) { - (Array.isArray(o.font) ? o.font : [o.font]).forEach(function (font, i) { - // normalize font - if (typeof font === 'string') { - try { - font = Font.parse(font) - } catch (e) { - font = Font.parse(GlText.baseFontSize + 'px ' + font) - } - } - else { font = Font.parse(Font.stringify(font)) } - - var baseString = Font.stringify({ - size: GlText.baseFontSize, - family: font.family, - stretch: isStretchSupported ? font.stretch : undefined, - variant: font.variant, - weight: font.weight, - style: font.style - }) - - var unit = parseUnit(font.size) - var fs = Math.round(unit[0] * px(unit[1])) - if (fs !== this$1.fontSize[i]) { - newFontSize = true - this$1.fontSize[i] = fs - } - - // calc new font metrics/atlas - if (!this$1.font[i] || baseString != this$1.font[i].baseString) { - newFont = true - - // obtain font cache or create one - this$1.font[i] = GlText.fonts[baseString] - if (!this$1.font[i]) { - var family = font.family.join(', ') - var style = [font.style] - if (font.style != font.variant) { style.push(font.variant) } - if (font.variant != font.weight) { style.push(font.weight) } - if (isStretchSupported && font.weight != font.stretch) { style.push(font.stretch) } - - this$1.font[i] = { - baseString: baseString, - - // typeface - family: family, - weight: font.weight, - stretch: font.stretch, - style: font.style, - variant: font.variant, - - // widths of characters - width: {}, - - // kernin pairs offsets - kerning: {}, - - metrics: metrics(family, { - origin: 'top', - fontSize: GlText.baseFontSize, - fontStyle: style.join(' ') - }) - } - - GlText.fonts[baseString] = this$1.font[i] - } - } - }) - } - - // FIXME: make independend font-size - // if (o.fontSize) { - // let unit = parseUnit(o.fontSize) - // let fs = Math.round(unit[0] * px(unit[1])) - - // if (fs != this.fontSize) { - // newFontSize = true - // this.fontSize = fs - // } - // } - - if (newFont || newFontSize) { - this.font.forEach(function (font, i) { - var fontString = Font.stringify({ - size: this$1.fontSize[i], - family: font.family, - stretch: isStretchSupported ? font.stretch : undefined, - variant: font.variant, - weight: font.weight, - style: font.style - }) - - // calc new font size atlas - this$1.fontAtlas[i] = this$1.shader.atlas[fontString] - - if (!this$1.fontAtlas[i]) { - var metrics = font.metrics - - this$1.shader.atlas[fontString] = - this$1.fontAtlas[i] = { - fontString: fontString, - // even step is better for rendered characters - step: Math.ceil(this$1.fontSize[i] * metrics.bottom * .5) * 2, - em: this$1.fontSize[i], - cols: 0, - rows: 0, - height: 0, - width: 0, - chars: [], - ids: {}, - texture: this$1.regl.texture() - } - } - - // bump atlas characters - if (o.text == null) { o.text = this$1.text } - }) - } - - // if multiple positions - duplicate text arguments - // FIXME: this possibly can be done better to avoid array spawn - if (typeof o.text === 'string' && o.position && o.position.length > 2) { - var textArray = Array(o.position.length * .5) - for (var i = 0; i < textArray.length; i++) { - textArray[i] = o.text - } - o.text = textArray - } - - // calculate offsets for the new font/text - var newAtlasChars - if (o.text != null || newFont) { - // FIXME: ignore spaces - // text offsets within the text buffer - this.textOffsets = [0] - - if (Array.isArray(o.text)) { - this.count = o.text[0].length - this.counts = [this.count] - for (var i$1 = 1; i$1 < o.text.length; i$1++) { - this$1.textOffsets[i$1] = this$1.textOffsets[i$1 - 1] + o.text[i$1 - 1].length - this$1.count += o.text[i$1].length - this$1.counts.push(o.text[i$1].length) - } - this.text = o.text.join('') - } - else { - this.text = o.text - this.count = this.text.length - this.counts = [this.count] - } - - newAtlasChars = [] - - // detect & measure new characters - this.font.forEach(function (font, idx) { - GlText.atlasContext.font = font.baseString - - var atlas = this$1.fontAtlas[idx] - - for (var i = 0; i < this$1.text.length; i++) { - var char = this$1.text.charAt(i) - - if (atlas.ids[char] == null) { - atlas.ids[char] = atlas.chars.length - atlas.chars.push(char) - newAtlasChars.push(char) - } - - if (font.width[char] == null) { - font.width[char] = GlText.atlasContext.measureText(char).width / GlText.baseFontSize - - // measure kerning pairs for the new character - if (this$1.kerning) { - var pairs = [] - for (var baseChar in font.width) { - pairs.push(baseChar + char, char + baseChar) - } - extend(font.kerning, kerning(font.family, { - pairs: pairs - })) - } - } - } - }) - } - - // create single position buffer (faster than batch or multiple separate instances) - if (o.position) { - if (o.position.length > 2) { - var flat = !o.position[0].length - var positionData = pool.mallocFloat(this.count * 2) - for (var i$2 = 0, ptr = 0; i$2 < this.counts.length; i$2++) { - var count = this$1.counts[i$2] - if (flat) { - for (var j = 0; j < count; j++) { - positionData[ptr++] = o.position[i$2 * 2] - positionData[ptr++] = o.position[i$2 * 2 + 1] - } - } - else { - for (var j$1 = 0; j$1 < count; j$1++) { - positionData[ptr++] = o.position[i$2][0] - positionData[ptr++] = o.position[i$2][1] - } - } - } - if (this.position.call) { - this.position({ - type: 'float', - data: positionData - }) - } else { - this.position = this.regl.buffer({ - type: 'float', - data: positionData - }) - } - pool.freeFloat(positionData) - } - else { - if (this.position.destroy) { this.position.destroy() } - this.position = { - constant: o.position - } - } - } - - // populate text/offset buffers if font/text has changed - // as [charWidth, offset, charWidth, offset...] - // that is in em units since font-size can change often - if (o.text || newFont) { - var charIds = pool.mallocUint8(this.count) - var sizeData = pool.mallocFloat(this.count * 2) - this.textWidth = [] - - for (var i$3 = 0, ptr$1 = 0; i$3 < this.counts.length; i$3++) { - var count$1 = this$1.counts[i$3] - var font = this$1.font[i$3] || this$1.font[0] - var atlas = this$1.fontAtlas[i$3] || this$1.fontAtlas[0] - - for (var j$2 = 0; j$2 < count$1; j$2++) { - var char = this$1.text.charAt(ptr$1) - var prevChar = this$1.text.charAt(ptr$1 - 1) - - charIds[ptr$1] = atlas.ids[char] - sizeData[ptr$1 * 2] = font.width[char] - - if (j$2) { - var prevWidth = sizeData[ptr$1 * 2 - 2] - var currWidth = sizeData[ptr$1 * 2] - var prevOffset = sizeData[ptr$1 * 2 - 1] - var offset = prevOffset + prevWidth * .5 + currWidth * .5; - - if (this$1.kerning) { - var kerning$1 = font.kerning[prevChar + char] - if (kerning$1) { - offset += kerning$1 * 1e-3 - } - } - - sizeData[ptr$1 * 2 + 1] = offset - } - else { - sizeData[ptr$1 * 2 + 1] = sizeData[ptr$1 * 2] * .5 - } - - ptr$1++ - } - this$1.textWidth.push( - !sizeData.length ? 0 : - // last offset + half last width - sizeData[ptr$1 * 2 - 2] * .5 + sizeData[ptr$1 * 2 - 1] - ) - } - - - // bump recalc align offset - if (!o.align) { o.align = this.align } - this.charBuffer({data: charIds, type: 'uint8', usage: 'stream'}) - this.sizeBuffer({data: sizeData, type: 'float', usage: 'stream'}) - pool.freeUint8(charIds) - pool.freeFloat(sizeData) - - // udpate font atlas and texture - if (newAtlasChars.length) { - this.font.forEach(function (font, i) { - var atlas = this$1.fontAtlas[i] - - // FIXME: insert metrics-based ratio here - var step = atlas.step - - var maxCols = Math.floor(GlText.maxAtlasSize / step) - var cols = Math.min(maxCols, atlas.chars.length) - var rows = Math.ceil(atlas.chars.length / cols) - - var atlasWidth = nextPow2( cols * step ) - // let atlasHeight = Math.min(rows * step + step * .5, GlText.maxAtlasSize); - var atlasHeight = nextPow2( rows * step ); - - atlas.width = atlasWidth - atlas.height = atlasHeight; - atlas.rows = rows - atlas.cols = cols - - if (!atlas.em) { return } - - atlas.texture({ - data: fontAtlas({ - canvas: GlText.atlasCanvas, - font: atlas.fontString, - chars: atlas.chars, - shape: [atlasWidth, atlasHeight], - step: [step, step] - }) - }) - - }) - } - } - - if (o.align) { - this.align = o.align - this.alignOffset = this.textWidth.map(function (textWidth, i) { - var align = !Array.isArray(this$1.align) ? this$1.align : this$1.align.length > 1 ? this$1.align[i] : this$1.align[0] - - if (typeof align === 'number') { return align } - switch (align) { - case 'right': - case 'end': - return -textWidth - case 'center': - case 'centre': - case 'middle': - return -textWidth * .5 - } - - return 0 - }) - } - - if (this.baseline == null && o.baseline == null) { - o.baseline = 0 - } - if (o.baseline != null) { - this.baseline = o.baseline - if (!Array.isArray(this.baseline)) { this.baseline = [this.baseline] } - this.baselineOffset = this.baseline.map(function (baseline, i) { - var m = (this$1.font[i] || this$1.font[0]).metrics - var base = 0 - - base += m.bottom * .5 - - if (typeof baseline === 'number') { - base += (baseline - m.baseline) - } - else { - base += -m[baseline] - } - - if (!GlText.normalViewport) { base *= -1 } - return base - }) - } - - // flatten colors to a single uint8 array - if (o.color != null) { - if (!o.color) { o.color = 'transparent' } - - // single color - if (typeof o.color === 'string' || !isNaN(o.color)) { - this.color = rgba(o.color, 'uint8') - } - // array - else { - var colorData - - // flat array - if (typeof o.color[0] === 'number' && o.color.length > this.counts.length) { - var l = o.color.length - colorData = pool.mallocUint8(l) - var sub = (o.color.subarray || o.color.slice).bind(o.color) - for (var i$4 = 0; i$4 < l; i$4 += 4) { - colorData.set(rgba(sub(i$4, i$4 + 4), 'uint8'), i$4) - } - } - // nested array - else { - var l$1 = o.color.length - colorData = pool.mallocUint8(l$1 * 4) - for (var i$5 = 0; i$5 < l$1; i$5++) { - colorData.set(rgba(o.color[i$5] || 0, 'uint8'), i$5 * 4) - } - } - - this.color = colorData - } - } - - // update render batch - if (o.position || o.text || o.color || o.baseline || o.align || o.font || o.offset || o.opacity) { - var isBatch = (this.color.length > 4) - || (this.baselineOffset.length > 1) - || (this.align && this.align.length > 1) - || (this.fontAtlas.length > 1) - || (this.positionOffset.length > 2) - if (isBatch) { - var length = Math.max( - this.position.length * .5 || 0, - this.color.length * .25 || 0, - this.baselineOffset.length || 0, - this.alignOffset.length || 0, - this.font.length || 0, - this.opacity.length || 0, - this.positionOffset.length * .5 || 0 - ) - this.batch = Array(length) - for (var i$6 = 0; i$6 < this.batch.length; i$6++) { - this$1.batch[i$6] = { - count: this$1.counts.length > 1 ? this$1.counts[i$6] : this$1.counts[0], - offset: this$1.textOffsets.length > 1 ? this$1.textOffsets[i$6] : this$1.textOffsets[0], - color: !this$1.color ? [0,0,0,255] : this$1.color.length <= 4 ? this$1.color : this$1.color.subarray(i$6 * 4, i$6 * 4 + 4), - opacity: Array.isArray(this$1.opacity) ? this$1.opacity[i$6] : this$1.opacity, - baseline: this$1.baselineOffset[i$6] != null ? this$1.baselineOffset[i$6] : this$1.baselineOffset[0], - align: !this$1.align ? 0 : this$1.alignOffset[i$6] != null ? this$1.alignOffset[i$6] : this$1.alignOffset[0], - atlas: this$1.fontAtlas[i$6] || this$1.fontAtlas[0], - positionOffset: this$1.positionOffset.length > 2 ? this$1.positionOffset.subarray(i$6 * 2, i$6 * 2 + 2) : this$1.positionOffset - } - } - } - // single-color, single-baseline, single-align batch is faster to render - else { - if (this.count) { - this.batch = [{ - count: this.count, - offset: 0, - color: this.color || [0,0,0,255], - opacity: Array.isArray(this.opacity) ? this.opacity[0] : this.opacity, - baseline: this.baselineOffset[0], - align: this.alignOffset ? this.alignOffset[0] : 0, - atlas: this.fontAtlas[0], - positionOffset: this.positionOffset - }] - } - else { - this.batch = [] - } - } - } -}; - -GlText.prototype.destroy = function destroy () { - // TODO: count instances of atlases and destroy all on null -}; - - -// defaults -GlText.prototype.kerning = true -GlText.prototype.position = { constant: new Float32Array(2) } -GlText.prototype.translate = null -GlText.prototype.scale = null -GlText.prototype.font = null -GlText.prototype.text = '' -GlText.prototype.positionOffset = [0, 0] -GlText.prototype.opacity = 1 -GlText.prototype.color = new Uint8Array([0, 0, 0, 255]) -GlText.prototype.alignOffset = [0, 0] - - -// whether viewport should be top↓bottom 2d one (true) or webgl one (false) -GlText.normalViewport = false - -// size of an atlas -GlText.maxAtlasSize = 1024 - -// font atlas canvas is singleton -GlText.atlasCanvas = document.createElement('canvas') -GlText.atlasContext = GlText.atlasCanvas.getContext('2d', {alpha: false}) - -// font-size used for metrics, atlas step calculation -GlText.baseFontSize = 64 - -// fonts storage -GlText.fonts = {} - -// max number of different font atlases/textures cached -// FIXME: enable atlas size limitation via LRU -// GlText.atlasCacheSize = 64 - -function isRegl (o) { - return typeof o === 'function' && - o._gl && - o.prop && - o.texture && - o.buffer -} - - -module.exports = GlText - - -},{"bit-twiddle":80,"color-normalize":108,"css-font":127,"detect-kerning":151,"es6-weak-map":209,"flatten-vertex-data":216,"font-atlas":217,"font-measure":218,"gl-util/context":306,"is-plain-obj":405,"object-assign":437,"parse-rect":442,"parse-unit":444,"pick-by-alias":448,"regl":478,"to-px":516,"typedarray-pool":522}],305:[function(_dereq_,module,exports){ -'use strict' - -var ndarray = _dereq_('ndarray') -var ops = _dereq_('ndarray-ops') -var pool = _dereq_('typedarray-pool') - -module.exports = createTexture2D - -var linearTypes = null -var filterTypes = null -var wrapTypes = null - -function lazyInitLinearTypes(gl) { - linearTypes = [ - gl.LINEAR, - gl.NEAREST_MIPMAP_LINEAR, - gl.LINEAR_MIPMAP_NEAREST, - gl.LINEAR_MIPMAP_NEAREST - ] - filterTypes = [ - gl.NEAREST, - gl.LINEAR, - gl.NEAREST_MIPMAP_NEAREST, - gl.NEAREST_MIPMAP_LINEAR, - gl.LINEAR_MIPMAP_NEAREST, - gl.LINEAR_MIPMAP_LINEAR - ] - wrapTypes = [ - gl.REPEAT, - gl.CLAMP_TO_EDGE, - gl.MIRRORED_REPEAT - ] -} - -function acceptTextureDOM (obj) { - return ( - ('undefined' != typeof HTMLCanvasElement && obj instanceof HTMLCanvasElement) || - ('undefined' != typeof HTMLImageElement && obj instanceof HTMLImageElement) || - ('undefined' != typeof HTMLVideoElement && obj instanceof HTMLVideoElement) || - ('undefined' != typeof ImageData && obj instanceof ImageData)) -} - -var convertFloatToUint8 = function(out, inp) { - ops.muls(out, inp, 255.0) -} - -function reshapeTexture(tex, w, h) { - var gl = tex.gl - var maxSize = gl.getParameter(gl.MAX_TEXTURE_SIZE) - if(w < 0 || w > maxSize || h < 0 || h > maxSize) { - throw new Error('gl-texture2d: Invalid texture size') - } - tex._shape = [w, h] - tex.bind() - gl.texImage2D(gl.TEXTURE_2D, 0, tex.format, w, h, 0, tex.format, tex.type, null) - tex._mipLevels = [0] - return tex -} - -function Texture2D(gl, handle, width, height, format, type) { - this.gl = gl - this.handle = handle - this.format = format - this.type = type - this._shape = [width, height] - this._mipLevels = [0] - this._magFilter = gl.NEAREST - this._minFilter = gl.NEAREST - this._wrapS = gl.CLAMP_TO_EDGE - this._wrapT = gl.CLAMP_TO_EDGE - this._anisoSamples = 1 - - var parent = this - var wrapVector = [this._wrapS, this._wrapT] - Object.defineProperties(wrapVector, [ - { - get: function() { - return parent._wrapS - }, - set: function(v) { - return parent.wrapS = v - } - }, - { - get: function() { - return parent._wrapT - }, - set: function(v) { - return parent.wrapT = v - } - } - ]) - this._wrapVector = wrapVector - - var shapeVector = [this._shape[0], this._shape[1]] - Object.defineProperties(shapeVector, [ - { - get: function() { - return parent._shape[0] - }, - set: function(v) { - return parent.width = v - } - }, - { - get: function() { - return parent._shape[1] - }, - set: function(v) { - return parent.height = v - } - } - ]) - this._shapeVector = shapeVector -} - -var proto = Texture2D.prototype - -Object.defineProperties(proto, { - minFilter: { - get: function() { - return this._minFilter - }, - set: function(v) { - this.bind() - var gl = this.gl - if(this.type === gl.FLOAT && linearTypes.indexOf(v) >= 0) { - if(!gl.getExtension('OES_texture_float_linear')) { - v = gl.NEAREST - } - } - if(filterTypes.indexOf(v) < 0) { - throw new Error('gl-texture2d: Unknown filter mode ' + v) - } - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, v) - return this._minFilter = v - } - }, - magFilter: { - get: function() { - return this._magFilter - }, - set: function(v) { - this.bind() - var gl = this.gl - if(this.type === gl.FLOAT && linearTypes.indexOf(v) >= 0) { - if(!gl.getExtension('OES_texture_float_linear')) { - v = gl.NEAREST - } - } - if(filterTypes.indexOf(v) < 0) { - throw new Error('gl-texture2d: Unknown filter mode ' + v) - } - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, v) - return this._magFilter = v - } - }, - mipSamples: { - get: function() { - return this._anisoSamples - }, - set: function(i) { - var psamples = this._anisoSamples - this._anisoSamples = Math.max(i, 1)|0 - if(psamples !== this._anisoSamples) { - var ext = this.gl.getExtension('EXT_texture_filter_anisotropic') - if(ext) { - this.gl.texParameterf(this.gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, this._anisoSamples) - } - } - return this._anisoSamples - } - }, - wrapS: { - get: function() { - return this._wrapS - }, - set: function(v) { - this.bind() - if(wrapTypes.indexOf(v) < 0) { - throw new Error('gl-texture2d: Unknown wrap mode ' + v) - } - this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, v) - return this._wrapS = v - } - }, - wrapT: { - get: function() { - return this._wrapT - }, - set: function(v) { - this.bind() - if(wrapTypes.indexOf(v) < 0) { - throw new Error('gl-texture2d: Unknown wrap mode ' + v) - } - this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, v) - return this._wrapT = v - } - }, - wrap: { - get: function() { - return this._wrapVector - }, - set: function(v) { - if(!Array.isArray(v)) { - v = [v,v] - } - if(v.length !== 2) { - throw new Error('gl-texture2d: Must specify wrap mode for rows and columns') - } - for(var i=0; i<2; ++i) { - if(wrapTypes.indexOf(v[i]) < 0) { - throw new Error('gl-texture2d: Unknown wrap mode ' + v) - } - } - this._wrapS = v[0] - this._wrapT = v[1] - - var gl = this.gl - this.bind() - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, this._wrapS) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, this._wrapT) - - return v - } - }, - shape: { - get: function() { - return this._shapeVector - }, - set: function(x) { - if(!Array.isArray(x)) { - x = [x|0,x|0] - } else { - if(x.length !== 2) { - throw new Error('gl-texture2d: Invalid texture shape') - } - } - reshapeTexture(this, x[0]|0, x[1]|0) - return [x[0]|0, x[1]|0] - } - }, - width: { - get: function() { - return this._shape[0] - }, - set: function(w) { - w = w|0 - reshapeTexture(this, w, this._shape[1]) - return w - } - }, - height: { - get: function() { - return this._shape[1] - }, - set: function(h) { - h = h|0 - reshapeTexture(this, this._shape[0], h) - return h - } - } -}) - -proto.bind = function(unit) { - var gl = this.gl - if(unit !== undefined) { - gl.activeTexture(gl.TEXTURE0 + (unit|0)) - } - gl.bindTexture(gl.TEXTURE_2D, this.handle) - if(unit !== undefined) { - return (unit|0) - } - return gl.getParameter(gl.ACTIVE_TEXTURE) - gl.TEXTURE0 -} - -proto.dispose = function() { - this.gl.deleteTexture(this.handle) -} - -proto.generateMipmap = function() { - this.bind() - this.gl.generateMipmap(this.gl.TEXTURE_2D) - - //Update mip levels - var l = Math.min(this._shape[0], this._shape[1]) - for(var i=0; l>0; ++i, l>>>=1) { - if(this._mipLevels.indexOf(i) < 0) { - this._mipLevels.push(i) - } - } -} - -proto.setPixels = function(data, x_off, y_off, mip_level) { - var gl = this.gl - this.bind() - if(Array.isArray(x_off)) { - mip_level = y_off - y_off = x_off[1]|0 - x_off = x_off[0]|0 - } else { - x_off = x_off || 0 - y_off = y_off || 0 - } - mip_level = mip_level || 0 - var directData = acceptTextureDOM(data) ? data : data.raw - if(directData) { - var needsMip = this._mipLevels.indexOf(mip_level) < 0 - if(needsMip) { - gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, directData) - this._mipLevels.push(mip_level) - } else { - gl.texSubImage2D(gl.TEXTURE_2D, mip_level, x_off, y_off, this.format, this.type, directData) - } - } else if(data.shape && data.stride && data.data) { - if(data.shape.length < 2 || - x_off + data.shape[1] > this._shape[1]>>>mip_level || - y_off + data.shape[0] > this._shape[0]>>>mip_level || - x_off < 0 || - y_off < 0) { - throw new Error('gl-texture2d: Texture dimensions are out of bounds') - } - texSubImageArray(gl, x_off, y_off, mip_level, this.format, this.type, this._mipLevels, data) - } else { - throw new Error('gl-texture2d: Unsupported data type') - } -} - - -function isPacked(shape, stride) { - if(shape.length === 3) { - return (stride[2] === 1) && - (stride[1] === shape[0]*shape[2]) && - (stride[0] === shape[2]) - } - return (stride[0] === 1) && - (stride[1] === shape[0]) -} - -function texSubImageArray(gl, x_off, y_off, mip_level, cformat, ctype, mipLevels, array) { - var dtype = array.dtype - var shape = array.shape.slice() - if(shape.length < 2 || shape.length > 3) { - throw new Error('gl-texture2d: Invalid ndarray, must be 2d or 3d') - } - var type = 0, format = 0 - var packed = isPacked(shape, array.stride.slice()) - if(dtype === 'float32') { - type = gl.FLOAT - } else if(dtype === 'float64') { - type = gl.FLOAT - packed = false - dtype = 'float32' - } else if(dtype === 'uint8') { - type = gl.UNSIGNED_BYTE - } else { - type = gl.UNSIGNED_BYTE - packed = false - dtype = 'uint8' - } - var channels = 1 - if(shape.length === 2) { - format = gl.LUMINANCE - shape = [shape[0], shape[1], 1] - array = ndarray(array.data, shape, [array.stride[0], array.stride[1], 1], array.offset) - } else if(shape.length === 3) { - if(shape[2] === 1) { - format = gl.ALPHA - } else if(shape[2] === 2) { - format = gl.LUMINANCE_ALPHA - } else if(shape[2] === 3) { - format = gl.RGB - } else if(shape[2] === 4) { - format = gl.RGBA - } else { - throw new Error('gl-texture2d: Invalid shape for pixel coords') - } - channels = shape[2] - } else { - throw new Error('gl-texture2d: Invalid shape for texture') - } - //For 1-channel textures allow conversion between formats - if((format === gl.LUMINANCE || format === gl.ALPHA) && - (cformat === gl.LUMINANCE || cformat === gl.ALPHA)) { - format = cformat - } - if(format !== cformat) { - throw new Error('gl-texture2d: Incompatible texture format for setPixels') - } - var size = array.size - var needsMip = mipLevels.indexOf(mip_level) < 0 - if(needsMip) { - mipLevels.push(mip_level) - } - if(type === ctype && packed) { - //Array data types are compatible, can directly copy into texture - if(array.offset === 0 && array.data.length === size) { - if(needsMip) { - gl.texImage2D(gl.TEXTURE_2D, mip_level, cformat, shape[0], shape[1], 0, cformat, ctype, array.data) - } else { - gl.texSubImage2D(gl.TEXTURE_2D, mip_level, x_off, y_off, shape[0], shape[1], cformat, ctype, array.data) - } - } else { - if(needsMip) { - gl.texImage2D(gl.TEXTURE_2D, mip_level, cformat, shape[0], shape[1], 0, cformat, ctype, array.data.subarray(array.offset, array.offset+size)) - } else { - gl.texSubImage2D(gl.TEXTURE_2D, mip_level, x_off, y_off, shape[0], shape[1], cformat, ctype, array.data.subarray(array.offset, array.offset+size)) - } - } - } else { - //Need to do type conversion to pack data into buffer - var pack_buffer - if(ctype === gl.FLOAT) { - pack_buffer = pool.mallocFloat32(size) - } else { - pack_buffer = pool.mallocUint8(size) - } - var pack_view = ndarray(pack_buffer, shape, [shape[2], shape[2]*shape[0], 1]) - if(type === gl.FLOAT && ctype === gl.UNSIGNED_BYTE) { - convertFloatToUint8(pack_view, array) - } else { - ops.assign(pack_view, array) - } - if(needsMip) { - gl.texImage2D(gl.TEXTURE_2D, mip_level, cformat, shape[0], shape[1], 0, cformat, ctype, pack_buffer.subarray(0, size)) - } else { - gl.texSubImage2D(gl.TEXTURE_2D, mip_level, x_off, y_off, shape[0], shape[1], cformat, ctype, pack_buffer.subarray(0, size)) - } - if(ctype === gl.FLOAT) { - pool.freeFloat32(pack_buffer) - } else { - pool.freeUint8(pack_buffer) - } - } -} - -function initTexture(gl) { - var tex = gl.createTexture() - gl.bindTexture(gl.TEXTURE_2D, tex) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) - return tex -} - -function createTextureShape(gl, width, height, format, type) { - var maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE) - if(width < 0 || width > maxTextureSize || height < 0 || height > maxTextureSize) { - throw new Error('gl-texture2d: Invalid texture shape') - } - if(type === gl.FLOAT && !gl.getExtension('OES_texture_float')) { - throw new Error('gl-texture2d: Floating point textures not supported on this platform') - } - var tex = initTexture(gl) - gl.texImage2D(gl.TEXTURE_2D, 0, format, width, height, 0, format, type, null) - return new Texture2D(gl, tex, width, height, format, type) -} - -function createTextureDOM(gl, directData, width, height, format, type) { - var tex = initTexture(gl) - gl.texImage2D(gl.TEXTURE_2D, 0, format, format, type, directData) - return new Texture2D(gl, tex, width, height, format, type) -} - -//Creates a texture from an ndarray -function createTextureArray(gl, array) { - var dtype = array.dtype - var shape = array.shape.slice() - var maxSize = gl.getParameter(gl.MAX_TEXTURE_SIZE) - if(shape[0] < 0 || shape[0] > maxSize || shape[1] < 0 || shape[1] > maxSize) { - throw new Error('gl-texture2d: Invalid texture size') - } - var packed = isPacked(shape, array.stride.slice()) - var type = 0 - if(dtype === 'float32') { - type = gl.FLOAT - } else if(dtype === 'float64') { - type = gl.FLOAT - packed = false - dtype = 'float32' - } else if(dtype === 'uint8') { - type = gl.UNSIGNED_BYTE - } else { - type = gl.UNSIGNED_BYTE - packed = false - dtype = 'uint8' - } - var format = 0 - if(shape.length === 2) { - format = gl.LUMINANCE - shape = [shape[0], shape[1], 1] - array = ndarray(array.data, shape, [array.stride[0], array.stride[1], 1], array.offset) - } else if(shape.length === 3) { - if(shape[2] === 1) { - format = gl.ALPHA - } else if(shape[2] === 2) { - format = gl.LUMINANCE_ALPHA - } else if(shape[2] === 3) { - format = gl.RGB - } else if(shape[2] === 4) { - format = gl.RGBA - } else { - throw new Error('gl-texture2d: Invalid shape for pixel coords') - } - } else { - throw new Error('gl-texture2d: Invalid shape for texture') - } - if(type === gl.FLOAT && !gl.getExtension('OES_texture_float')) { - type = gl.UNSIGNED_BYTE - packed = false - } - var buffer, buf_store - var size = array.size - if(!packed) { - var stride = [shape[2], shape[2]*shape[0], 1] - buf_store = pool.malloc(size, dtype) - var buf_array = ndarray(buf_store, shape, stride, 0) - if((dtype === 'float32' || dtype === 'float64') && type === gl.UNSIGNED_BYTE) { - convertFloatToUint8(buf_array, array) - } else { - ops.assign(buf_array, array) - } - buffer = buf_store.subarray(0, size) - } else if (array.offset === 0 && array.data.length === size) { - buffer = array.data - } else { - buffer = array.data.subarray(array.offset, array.offset + size) - } - var tex = initTexture(gl) - gl.texImage2D(gl.TEXTURE_2D, 0, format, shape[0], shape[1], 0, format, type, buffer) - if(!packed) { - pool.free(buf_store) - } - return new Texture2D(gl, tex, shape[0], shape[1], format, type) -} - -function createTexture2D(gl) { - if(arguments.length <= 1) { - throw new Error('gl-texture2d: Missing arguments for texture2d constructor') - } - if(!linearTypes) { - lazyInitLinearTypes(gl) - } - if(typeof arguments[1] === 'number') { - return createTextureShape(gl, arguments[1], arguments[2], arguments[3]||gl.RGBA, arguments[4]||gl.UNSIGNED_BYTE) - } - if(Array.isArray(arguments[1])) { - return createTextureShape(gl, arguments[1][0]|0, arguments[1][1]|0, arguments[2]||gl.RGBA, arguments[3]||gl.UNSIGNED_BYTE) - } - if(typeof arguments[1] === 'object') { - var obj = arguments[1] - var directData = acceptTextureDOM(obj) ? obj : obj.raw - if (directData) { - return createTextureDOM(gl, directData, obj.width|0, obj.height|0, arguments[2]||gl.RGBA, arguments[3]||gl.UNSIGNED_BYTE) - } else if(obj.shape && obj.data && obj.stride) { - return createTextureArray(gl, obj) - } - } - throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') -} - -},{"ndarray":433,"ndarray-ops":427,"typedarray-pool":522}],306:[function(_dereq_,module,exports){ -/** @module gl-util/context */ -'use strict' - -var pick = _dereq_('pick-by-alias') - -module.exports = function setContext (o) { - if (!o) o = {} - else if (typeof o === 'string') o = {container: o} - - // HTMLCanvasElement - if (isCanvas(o)) { - o = {container: o} - } - // HTMLElement - else if (isElement(o)) { - o = {container: o} - } - // WebGLContext - else if (isContext(o)) { - o = {gl: o} - } - // options object - else { - o = pick(o, { - container: 'container target element el canvas holder parent parentNode wrapper use ref root node', - gl: 'gl context webgl glContext', - attrs: 'attributes attrs contextAttributes', - pixelRatio: 'pixelRatio pxRatio px ratio pxratio pixelratio' - }, true) - } - - if (!o.pixelRatio) o.pixelRatio = window.pixelRatio || 1 - - // make sure there is container and canvas - if (o.gl) { - return o.gl - } - if (o.canvas) { - o.container = o.canvas.parentNode - } - if (o.container) { - if (typeof o.container === 'string') { - var c = document.querySelector(o.container) - if (!c) throw Error('Element ' + o.container + ' is not found') - o.container = c - } - if (isCanvas(o.container)) { - o.canvas = o.container - o.container = o.canvas.parentNode - } - else if (!o.canvas) { - o.canvas = document.createElement('canvas') - o.container.appendChild(o.canvas) - resize(o) - } - } - // blank new canvas - else if (!o.canvas) { - o.container = document.body || document.documentElement - o.canvas = document.createElement('canvas') - o.canvas.style.position = 'absolute' - o.canvas.style.top = 0 - o.canvas.style.left = 0 - o.container.appendChild(o.canvas) - resize(o) - } - - // make sure there is context - if (!o.gl) { - try { - o.gl = o.canvas.getContext('webgl', o.attrs) - } catch (e) { - try { - o.gl = o.canvas.getContext('experimental-webgl', o.attrs) - } - catch (e) { - o.gl = o.canvas.getContext('webgl-experimental', o.attrs) - } - } - } - - return o.gl -} - - -function resize (o) { - if (o.container) { - if (o.container == document.body) { - if (!document.body.style.width) o.canvas.width = o.width || (o.pixelRatio * window.innerWidth) - if (!document.body.style.height) o.canvas.height = o.height || (o.pixelRatio * window.innerHeight) - } - else { - var bounds = o.container.getBoundingClientRect() - o.canvas.width = o.width || (bounds.right - bounds.left) - o.canvas.height = o.height || (bounds.bottom - bounds.top) - } - } -} - -function isCanvas (e) { - return typeof e.getContext === 'function' - && 'width' in e - && 'height' in e -} - -function isElement (e) { - return typeof e.nodeName === 'string' && - typeof e.appendChild === 'function' && - typeof e.getBoundingClientRect === 'function' -} - -function isContext (e) { - return typeof e.drawArrays === 'function' || - typeof e.drawElements === 'function' -} - -},{"pick-by-alias":448}],307:[function(_dereq_,module,exports){ -"use strict" - -function doBind(gl, elements, attributes) { - if(elements) { - elements.bind() - } else { - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null) - } - var nattribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS)|0 - if(attributes) { - if(attributes.length > nattribs) { - throw new Error("gl-vao: Too many vertex attributes") - } - for(var i=0; i 1.0){ - return 0 - } else { - return Math.acos(cosine) - } -} - -},{"./dot":322,"./fromValues":328,"./normalize":339}],313:[function(_dereq_,module,exports){ -module.exports = ceil - -/** - * Math.ceil the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to ceil - * @returns {vec3} out - */ -function ceil(out, a) { - out[0] = Math.ceil(a[0]) - out[1] = Math.ceil(a[1]) - out[2] = Math.ceil(a[2]) - return out -} - -},{}],314:[function(_dereq_,module,exports){ -module.exports = clone; - -/** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {vec3} a vector to clone - * @returns {vec3} a new 3D vector - */ -function clone(a) { - var out = new Float32Array(3) - out[0] = a[0] - out[1] = a[1] - out[2] = a[2] - return out -} -},{}],315:[function(_dereq_,module,exports){ -module.exports = copy; - -/** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {vec3} a the source vector - * @returns {vec3} out - */ -function copy(out, a) { - out[0] = a[0] - out[1] = a[1] - out[2] = a[2] - return out -} -},{}],316:[function(_dereq_,module,exports){ -module.exports = create; - -/** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ -function create() { - var out = new Float32Array(3) - out[0] = 0 - out[1] = 0 - out[2] = 0 - return out -} -},{}],317:[function(_dereq_,module,exports){ -module.exports = cross; - -/** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -function cross(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], - bx = b[0], by = b[1], bz = b[2] - - out[0] = ay * bz - az * by - out[1] = az * bx - ax * bz - out[2] = ax * by - ay * bx - return out -} -},{}],318:[function(_dereq_,module,exports){ -module.exports = _dereq_('./distance') - -},{"./distance":319}],319:[function(_dereq_,module,exports){ -module.exports = distance; - -/** - * Calculates the euclidian distance between two vec3's - * - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {Number} distance between a and b - */ -function distance(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2] - return Math.sqrt(x*x + y*y + z*z) -} -},{}],320:[function(_dereq_,module,exports){ -module.exports = _dereq_('./divide') - -},{"./divide":321}],321:[function(_dereq_,module,exports){ -module.exports = divide; - -/** - * Divides two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -function divide(out, a, b) { - out[0] = a[0] / b[0] - out[1] = a[1] / b[1] - out[2] = a[2] / b[2] - return out -} -},{}],322:[function(_dereq_,module,exports){ -module.exports = dot; - -/** - * Calculates the dot product of two vec3's - * - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {Number} dot product of a and b - */ -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] -} -},{}],323:[function(_dereq_,module,exports){ -module.exports = 0.000001 - -},{}],324:[function(_dereq_,module,exports){ -module.exports = equals - -var EPSILON = _dereq_('./epsilon') - -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {vec3} a The first vector. - * @param {vec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ -function equals(a, b) { - var a0 = a[0] - var a1 = a[1] - var a2 = a[2] - var b0 = b[0] - var b1 = b[1] - var b2 = b[2] - return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))) -} - -},{"./epsilon":323}],325:[function(_dereq_,module,exports){ -module.exports = exactEquals - -/** - * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) - * - * @param {vec3} a The first vector. - * @param {vec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] -} - -},{}],326:[function(_dereq_,module,exports){ -module.exports = floor - -/** - * Math.floor the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to floor - * @returns {vec3} out - */ -function floor(out, a) { - out[0] = Math.floor(a[0]) - out[1] = Math.floor(a[1]) - out[2] = Math.floor(a[2]) - return out -} - -},{}],327:[function(_dereq_,module,exports){ -module.exports = forEach; - -var vec = _dereq_('./create')() - -/** - * Perform some operation over an array of vec3s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ -function forEach(a, stride, offset, count, fn, arg) { - var i, l - if(!stride) { - stride = 3 - } - - if(!offset) { - offset = 0 - } - - if(count) { - l = Math.min((count * stride) + offset, a.length) - } else { - l = a.length - } - - for(i = offset; i < l; i += stride) { - vec[0] = a[i] - vec[1] = a[i+1] - vec[2] = a[i+2] - fn(vec, vec, arg) - a[i] = vec[0] - a[i+1] = vec[1] - a[i+2] = vec[2] - } - - return a -} -},{"./create":316}],328:[function(_dereq_,module,exports){ -module.exports = fromValues; - -/** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ -function fromValues(x, y, z) { - var out = new Float32Array(3) - out[0] = x - out[1] = y - out[2] = z - return out -} -},{}],329:[function(_dereq_,module,exports){ -module.exports = { - EPSILON: _dereq_('./epsilon') - , create: _dereq_('./create') - , clone: _dereq_('./clone') - , angle: _dereq_('./angle') - , fromValues: _dereq_('./fromValues') - , copy: _dereq_('./copy') - , set: _dereq_('./set') - , equals: _dereq_('./equals') - , exactEquals: _dereq_('./exactEquals') - , add: _dereq_('./add') - , subtract: _dereq_('./subtract') - , sub: _dereq_('./sub') - , multiply: _dereq_('./multiply') - , mul: _dereq_('./mul') - , divide: _dereq_('./divide') - , div: _dereq_('./div') - , min: _dereq_('./min') - , max: _dereq_('./max') - , floor: _dereq_('./floor') - , ceil: _dereq_('./ceil') - , round: _dereq_('./round') - , scale: _dereq_('./scale') - , scaleAndAdd: _dereq_('./scaleAndAdd') - , distance: _dereq_('./distance') - , dist: _dereq_('./dist') - , squaredDistance: _dereq_('./squaredDistance') - , sqrDist: _dereq_('./sqrDist') - , length: _dereq_('./length') - , len: _dereq_('./len') - , squaredLength: _dereq_('./squaredLength') - , sqrLen: _dereq_('./sqrLen') - , negate: _dereq_('./negate') - , inverse: _dereq_('./inverse') - , normalize: _dereq_('./normalize') - , dot: _dereq_('./dot') - , cross: _dereq_('./cross') - , lerp: _dereq_('./lerp') - , random: _dereq_('./random') - , transformMat4: _dereq_('./transformMat4') - , transformMat3: _dereq_('./transformMat3') - , transformQuat: _dereq_('./transformQuat') - , rotateX: _dereq_('./rotateX') - , rotateY: _dereq_('./rotateY') - , rotateZ: _dereq_('./rotateZ') - , forEach: _dereq_('./forEach') -} - -},{"./add":311,"./angle":312,"./ceil":313,"./clone":314,"./copy":315,"./create":316,"./cross":317,"./dist":318,"./distance":319,"./div":320,"./divide":321,"./dot":322,"./epsilon":323,"./equals":324,"./exactEquals":325,"./floor":326,"./forEach":327,"./fromValues":328,"./inverse":330,"./len":331,"./length":332,"./lerp":333,"./max":334,"./min":335,"./mul":336,"./multiply":337,"./negate":338,"./normalize":339,"./random":340,"./rotateX":341,"./rotateY":342,"./rotateZ":343,"./round":344,"./scale":345,"./scaleAndAdd":346,"./set":347,"./sqrDist":348,"./sqrLen":349,"./squaredDistance":350,"./squaredLength":351,"./sub":352,"./subtract":353,"./transformMat3":354,"./transformMat4":355,"./transformQuat":356}],330:[function(_dereq_,module,exports){ -module.exports = inverse; - -/** - * Returns the inverse of the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to invert - * @returns {vec3} out - */ -function inverse(out, a) { - out[0] = 1.0 / a[0] - out[1] = 1.0 / a[1] - out[2] = 1.0 / a[2] - return out -} -},{}],331:[function(_dereq_,module,exports){ -module.exports = _dereq_('./length') - -},{"./length":332}],332:[function(_dereq_,module,exports){ -module.exports = length; - -/** - * Calculates the length of a vec3 - * - * @param {vec3} a vector to calculate length of - * @returns {Number} length of a - */ -function length(a) { - var x = a[0], - y = a[1], - z = a[2] - return Math.sqrt(x*x + y*y + z*z) -} -},{}],333:[function(_dereq_,module,exports){ -module.exports = lerp; - -/** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {vec3} out - */ -function lerp(out, a, b, t) { - var ax = a[0], - ay = a[1], - az = a[2] - out[0] = ax + t * (b[0] - ax) - out[1] = ay + t * (b[1] - ay) - out[2] = az + t * (b[2] - az) - return out -} -},{}],334:[function(_dereq_,module,exports){ -module.exports = max; - -/** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]) - out[1] = Math.max(a[1], b[1]) - out[2] = Math.max(a[2], b[2]) - return out -} -},{}],335:[function(_dereq_,module,exports){ -module.exports = min; - -/** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]) - out[1] = Math.min(a[1], b[1]) - out[2] = Math.min(a[2], b[2]) - return out -} -},{}],336:[function(_dereq_,module,exports){ -module.exports = _dereq_('./multiply') - -},{"./multiply":337}],337:[function(_dereq_,module,exports){ -module.exports = multiply; - -/** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -function multiply(out, a, b) { - out[0] = a[0] * b[0] - out[1] = a[1] * b[1] - out[2] = a[2] * b[2] - return out -} -},{}],338:[function(_dereq_,module,exports){ -module.exports = negate; - -/** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to negate - * @returns {vec3} out - */ -function negate(out, a) { - out[0] = -a[0] - out[1] = -a[1] - out[2] = -a[2] - return out -} -},{}],339:[function(_dereq_,module,exports){ -module.exports = normalize; - -/** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to normalize - * @returns {vec3} out - */ -function normalize(out, a) { - var x = a[0], - y = a[1], - z = a[2] - var len = x*x + y*y + z*z - if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len) - out[0] = a[0] * len - out[1] = a[1] * len - out[2] = a[2] * len - } - return out -} -},{}],340:[function(_dereq_,module,exports){ -module.exports = random; - -/** - * Generates a random vector with the given scale - * - * @param {vec3} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec3} out - */ -function random(out, scale) { - scale = scale || 1.0 - - var r = Math.random() * 2.0 * Math.PI - var z = (Math.random() * 2.0) - 1.0 - var zScale = Math.sqrt(1.0-z*z) * scale - - out[0] = Math.cos(r) * zScale - out[1] = Math.sin(r) * zScale - out[2] = z * scale - return out -} -},{}],341:[function(_dereq_,module,exports){ -module.exports = rotateX; - -/** - * Rotate a 3D vector around the x-axis - * @param {vec3} out The receiving vec3 - * @param {vec3} a The vec3 point to rotate - * @param {vec3} b The origin of the rotation - * @param {Number} c The angle of rotation - * @returns {vec3} out - */ -function rotateX(out, a, b, c){ - var by = b[1] - var bz = b[2] - - // Translate point to the origin - var py = a[1] - by - var pz = a[2] - bz - - var sc = Math.sin(c) - var cc = Math.cos(c) - - // perform rotation and translate to correct position - out[0] = a[0] - out[1] = by + py * cc - pz * sc - out[2] = bz + py * sc + pz * cc - - return out -} - -},{}],342:[function(_dereq_,module,exports){ -module.exports = rotateY; - -/** - * Rotate a 3D vector around the y-axis - * @param {vec3} out The receiving vec3 - * @param {vec3} a The vec3 point to rotate - * @param {vec3} b The origin of the rotation - * @param {Number} c The angle of rotation - * @returns {vec3} out - */ -function rotateY(out, a, b, c){ - var bx = b[0] - var bz = b[2] - - // translate point to the origin - var px = a[0] - bx - var pz = a[2] - bz - - var sc = Math.sin(c) - var cc = Math.cos(c) - - // perform rotation and translate to correct position - out[0] = bx + pz * sc + px * cc - out[1] = a[1] - out[2] = bz + pz * cc - px * sc - - return out -} - -},{}],343:[function(_dereq_,module,exports){ -module.exports = rotateZ; - -/** - * Rotate a 3D vector around the z-axis - * @param {vec3} out The receiving vec3 - * @param {vec3} a The vec3 point to rotate - * @param {vec3} b The origin of the rotation - * @param {Number} c The angle of rotation - * @returns {vec3} out - */ -function rotateZ(out, a, b, c){ - var bx = b[0] - var by = b[1] - - //Translate point to the origin - var px = a[0] - bx - var py = a[1] - by - - var sc = Math.sin(c) - var cc = Math.cos(c) - - // perform rotation and translate to correct position - out[0] = bx + px * cc - py * sc - out[1] = by + px * sc + py * cc - out[2] = a[2] - - return out -} - -},{}],344:[function(_dereq_,module,exports){ -module.exports = round - -/** - * Math.round the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to round - * @returns {vec3} out - */ -function round(out, a) { - out[0] = Math.round(a[0]) - out[1] = Math.round(a[1]) - out[2] = Math.round(a[2]) - return out -} - -},{}],345:[function(_dereq_,module,exports){ -module.exports = scale; - -/** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ -function scale(out, a, b) { - out[0] = a[0] * b - out[1] = a[1] * b - out[2] = a[2] * b - return out -} -},{}],346:[function(_dereq_,module,exports){ -module.exports = scaleAndAdd; - -/** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + (b[0] * scale) - out[1] = a[1] + (b[1] * scale) - out[2] = a[2] + (b[2] * scale) - return out -} -},{}],347:[function(_dereq_,module,exports){ -module.exports = set; - -/** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ -function set(out, x, y, z) { - out[0] = x - out[1] = y - out[2] = z - return out -} -},{}],348:[function(_dereq_,module,exports){ -module.exports = _dereq_('./squaredDistance') - -},{"./squaredDistance":350}],349:[function(_dereq_,module,exports){ -module.exports = _dereq_('./squaredLength') - -},{"./squaredLength":351}],350:[function(_dereq_,module,exports){ -module.exports = squaredDistance; - -/** - * Calculates the squared euclidian distance between two vec3's - * - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {Number} squared distance between a and b - */ -function squaredDistance(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2] - return x*x + y*y + z*z -} -},{}],351:[function(_dereq_,module,exports){ -module.exports = squaredLength; - -/** - * Calculates the squared length of a vec3 - * - * @param {vec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ -function squaredLength(a) { - var x = a[0], - y = a[1], - z = a[2] - return x*x + y*y + z*z -} -},{}],352:[function(_dereq_,module,exports){ -module.exports = _dereq_('./subtract') - -},{"./subtract":353}],353:[function(_dereq_,module,exports){ -module.exports = subtract; - -/** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -function subtract(out, a, b) { - out[0] = a[0] - b[0] - out[1] = a[1] - b[1] - out[2] = a[2] - b[2] - return out -} -},{}],354:[function(_dereq_,module,exports){ -module.exports = transformMat3; - -/** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to transform - * @param {mat4} m the 3x3 matrix to transform with - * @returns {vec3} out - */ -function transformMat3(out, a, m) { - var x = a[0], y = a[1], z = a[2] - out[0] = x * m[0] + y * m[3] + z * m[6] - out[1] = x * m[1] + y * m[4] + z * m[7] - out[2] = x * m[2] + y * m[5] + z * m[8] - return out -} -},{}],355:[function(_dereq_,module,exports){ -module.exports = transformMat4; - -/** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to transform - * @param {mat4} m matrix to transform with - * @returns {vec3} out - */ -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2], - w = m[3] * x + m[7] * y + m[11] * z + m[15] - w = w || 1.0 - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w - return out -} -},{}],356:[function(_dereq_,module,exports){ -module.exports = transformQuat; - -/** - * Transforms the vec3 with a quat - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to transform - * @param {quat} q quaternion to transform with - * @returns {vec3} out - */ -function transformQuat(out, a, q) { - // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations - - var x = a[0], y = a[1], z = a[2], - qx = q[0], qy = q[1], qz = q[2], qw = q[3], - - // calculate quat * vec - ix = qw * x + qy * z - qz * y, - iy = qw * y + qz * x - qx * z, - iz = qw * z + qx * y - qy * x, - iw = -qx * x - qy * y - qz * z - - // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx - return out -} -},{}],357:[function(_dereq_,module,exports){ -module.exports = add - -/** - * Adds two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -function add (out, a, b) { - out[0] = a[0] + b[0] - out[1] = a[1] + b[1] - out[2] = a[2] + b[2] - out[3] = a[3] + b[3] - return out -} - -},{}],358:[function(_dereq_,module,exports){ -module.exports = clone - -/** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {vec4} a vector to clone - * @returns {vec4} a new 4D vector - */ -function clone (a) { - var out = new Float32Array(4) - out[0] = a[0] - out[1] = a[1] - out[2] = a[2] - out[3] = a[3] - return out -} - -},{}],359:[function(_dereq_,module,exports){ -module.exports = copy - -/** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {vec4} a the source vector - * @returns {vec4} out - */ -function copy (out, a) { - out[0] = a[0] - out[1] = a[1] - out[2] = a[2] - out[3] = a[3] - return out -} - -},{}],360:[function(_dereq_,module,exports){ -module.exports = create - -/** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ -function create () { - var out = new Float32Array(4) - out[0] = 0 - out[1] = 0 - out[2] = 0 - out[3] = 0 - return out -} - -},{}],361:[function(_dereq_,module,exports){ -module.exports = distance - -/** - * Calculates the euclidian distance between two vec4's - * - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {Number} distance between a and b - */ -function distance (a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2], - w = b[3] - a[3] - return Math.sqrt(x * x + y * y + z * z + w * w) -} - -},{}],362:[function(_dereq_,module,exports){ -module.exports = divide - -/** - * Divides two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -function divide (out, a, b) { - out[0] = a[0] / b[0] - out[1] = a[1] / b[1] - out[2] = a[2] / b[2] - out[3] = a[3] / b[3] - return out -} - -},{}],363:[function(_dereq_,module,exports){ -module.exports = dot - -/** - * Calculates the dot product of two vec4's - * - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {Number} dot product of a and b - */ -function dot (a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] -} - -},{}],364:[function(_dereq_,module,exports){ -module.exports = fromValues - -/** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ -function fromValues (x, y, z, w) { - var out = new Float32Array(4) - out[0] = x - out[1] = y - out[2] = z - out[3] = w - return out -} - -},{}],365:[function(_dereq_,module,exports){ -module.exports = { - create: _dereq_('./create'), - clone: _dereq_('./clone'), - fromValues: _dereq_('./fromValues'), - copy: _dereq_('./copy'), - set: _dereq_('./set'), - add: _dereq_('./add'), - subtract: _dereq_('./subtract'), - multiply: _dereq_('./multiply'), - divide: _dereq_('./divide'), - min: _dereq_('./min'), - max: _dereq_('./max'), - scale: _dereq_('./scale'), - scaleAndAdd: _dereq_('./scaleAndAdd'), - distance: _dereq_('./distance'), - squaredDistance: _dereq_('./squaredDistance'), - length: _dereq_('./length'), - squaredLength: _dereq_('./squaredLength'), - negate: _dereq_('./negate'), - inverse: _dereq_('./inverse'), - normalize: _dereq_('./normalize'), - dot: _dereq_('./dot'), - lerp: _dereq_('./lerp'), - random: _dereq_('./random'), - transformMat4: _dereq_('./transformMat4'), - transformQuat: _dereq_('./transformQuat') -} - -},{"./add":357,"./clone":358,"./copy":359,"./create":360,"./distance":361,"./divide":362,"./dot":363,"./fromValues":364,"./inverse":366,"./length":367,"./lerp":368,"./max":369,"./min":370,"./multiply":371,"./negate":372,"./normalize":373,"./random":374,"./scale":375,"./scaleAndAdd":376,"./set":377,"./squaredDistance":378,"./squaredLength":379,"./subtract":380,"./transformMat4":381,"./transformQuat":382}],366:[function(_dereq_,module,exports){ -module.exports = inverse - -/** - * Returns the inverse of the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to invert - * @returns {vec4} out - */ -function inverse (out, a) { - out[0] = 1.0 / a[0] - out[1] = 1.0 / a[1] - out[2] = 1.0 / a[2] - out[3] = 1.0 / a[3] - return out -} - -},{}],367:[function(_dereq_,module,exports){ -module.exports = length - -/** - * Calculates the length of a vec4 - * - * @param {vec4} a vector to calculate length of - * @returns {Number} length of a - */ -function length (a) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3] - return Math.sqrt(x * x + y * y + z * z + w * w) -} - -},{}],368:[function(_dereq_,module,exports){ -module.exports = lerp - -/** - * Performs a linear interpolation between two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {vec4} out - */ -function lerp (out, a, b, t) { - var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3] - out[0] = ax + t * (b[0] - ax) - out[1] = ay + t * (b[1] - ay) - out[2] = az + t * (b[2] - az) - out[3] = aw + t * (b[3] - aw) - return out -} - -},{}],369:[function(_dereq_,module,exports){ -module.exports = max - -/** - * Returns the maximum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -function max (out, a, b) { - out[0] = Math.max(a[0], b[0]) - out[1] = Math.max(a[1], b[1]) - out[2] = Math.max(a[2], b[2]) - out[3] = Math.max(a[3], b[3]) - return out -} - -},{}],370:[function(_dereq_,module,exports){ -module.exports = min - -/** - * Returns the minimum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -function min (out, a, b) { - out[0] = Math.min(a[0], b[0]) - out[1] = Math.min(a[1], b[1]) - out[2] = Math.min(a[2], b[2]) - out[3] = Math.min(a[3], b[3]) - return out -} - -},{}],371:[function(_dereq_,module,exports){ -module.exports = multiply - -/** - * Multiplies two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -function multiply (out, a, b) { - out[0] = a[0] * b[0] - out[1] = a[1] * b[1] - out[2] = a[2] * b[2] - out[3] = a[3] * b[3] - return out -} - -},{}],372:[function(_dereq_,module,exports){ -module.exports = negate - -/** - * Negates the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to negate - * @returns {vec4} out - */ -function negate (out, a) { - out[0] = -a[0] - out[1] = -a[1] - out[2] = -a[2] - out[3] = -a[3] - return out -} - -},{}],373:[function(_dereq_,module,exports){ -module.exports = normalize - -/** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to normalize - * @returns {vec4} out - */ -function normalize (out, a) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3] - var len = x * x + y * y + z * z + w * w - if (len > 0) { - len = 1 / Math.sqrt(len) - out[0] = x * len - out[1] = y * len - out[2] = z * len - out[3] = w * len - } - return out -} - -},{}],374:[function(_dereq_,module,exports){ -var vecNormalize = _dereq_('./normalize') -var vecScale = _dereq_('./scale') - -module.exports = random - -/** - * Generates a random vector with the given scale - * - * @param {vec4} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec4} out - */ -function random (out, scale) { - scale = scale || 1.0 - - // TODO: This is a pretty awful way of doing this. Find something better. - out[0] = Math.random() - out[1] = Math.random() - out[2] = Math.random() - out[3] = Math.random() - vecNormalize(out, out) - vecScale(out, out, scale) - return out -} - -},{"./normalize":373,"./scale":375}],375:[function(_dereq_,module,exports){ -module.exports = scale - -/** - * Scales a vec4 by a scalar number - * - * @param {vec4} out the receiving vector - * @param {vec4} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec4} out - */ -function scale (out, a, b) { - out[0] = a[0] * b - out[1] = a[1] * b - out[2] = a[2] * b - out[3] = a[3] * b - return out -} - -},{}],376:[function(_dereq_,module,exports){ -module.exports = scaleAndAdd - -/** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec4} out - */ -function scaleAndAdd (out, a, b, scale) { - out[0] = a[0] + (b[0] * scale) - out[1] = a[1] + (b[1] * scale) - out[2] = a[2] + (b[2] * scale) - out[3] = a[3] + (b[3] * scale) - return out -} - -},{}],377:[function(_dereq_,module,exports){ -module.exports = set - -/** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ -function set (out, x, y, z, w) { - out[0] = x - out[1] = y - out[2] = z - out[3] = w - return out -} - -},{}],378:[function(_dereq_,module,exports){ -module.exports = squaredDistance - -/** - * Calculates the squared euclidian distance between two vec4's - * - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {Number} squared distance between a and b - */ -function squaredDistance (a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2], - w = b[3] - a[3] - return x * x + y * y + z * z + w * w -} - -},{}],379:[function(_dereq_,module,exports){ -module.exports = squaredLength - -/** - * Calculates the squared length of a vec4 - * - * @param {vec4} a vector to calculate squared length of - * @returns {Number} squared length of a - */ -function squaredLength (a) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3] - return x * x + y * y + z * z + w * w -} - -},{}],380:[function(_dereq_,module,exports){ -module.exports = subtract - -/** - * Subtracts vector b from vector a - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -function subtract (out, a, b) { - out[0] = a[0] - b[0] - out[1] = a[1] - b[1] - out[2] = a[2] - b[2] - out[3] = a[3] - b[3] - return out -} - -},{}],381:[function(_dereq_,module,exports){ -module.exports = transformMat4 - -/** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {vec4} a the vector to transform - * @param {mat4} m matrix to transform with - * @returns {vec4} out - */ -function transformMat4 (out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3] - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w - return out -} - -},{}],382:[function(_dereq_,module,exports){ -module.exports = transformQuat - -/** - * Transforms the vec4 with a quat - * - * @param {vec4} out the receiving vector - * @param {vec4} a the vector to transform - * @param {quat} q quaternion to transform with - * @returns {vec4} out - */ -function transformQuat (out, a, q) { - var x = a[0], y = a[1], z = a[2], - qx = q[0], qy = q[1], qz = q[2], qw = q[3], - - // calculate quat * vec - ix = qw * x + qy * z - qz * y, - iy = qw * y + qz * x - qx * z, - iz = qw * z + qx * y - qy * x, - iw = -qx * x - qy * y - qz * z - - // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx - out[3] = a[3] - return out -} - -},{}],383:[function(_dereq_,module,exports){ -module.exports = decodeFloat - -var UINT8_VIEW = new Uint8Array(4) -var FLOAT_VIEW = new Float32Array(UINT8_VIEW.buffer) - -function decodeFloat(x, y, z, w) { - UINT8_VIEW[0] = w - UINT8_VIEW[1] = z - UINT8_VIEW[2] = y - UINT8_VIEW[3] = x - return FLOAT_VIEW[0] -} - -},{}],384:[function(_dereq_,module,exports){ -var tokenize = _dereq_('glsl-tokenizer') -var atob = _dereq_('atob-lite') - -module.exports = getName - -function getName(src) { - var tokens = Array.isArray(src) - ? src - : tokenize(src) - - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i] - if (token.type !== 'preprocessor') continue - var match = token.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/) - if (!match) continue - if (!match[2]) continue - - var b64 = match[1] - var name = match[2] - - return (b64 ? atob(name) : name).trim() - } -} - -},{"atob-lite":60,"glsl-tokenizer":391}],385:[function(_dereq_,module,exports){ -module.exports = tokenize - -var literals100 = _dereq_('./lib/literals') - , operators = _dereq_('./lib/operators') - , builtins100 = _dereq_('./lib/builtins') - , literals300es = _dereq_('./lib/literals-300es') - , builtins300es = _dereq_('./lib/builtins-300es') - -var NORMAL = 999 // <-- never emitted - , TOKEN = 9999 // <-- never emitted - , BLOCK_COMMENT = 0 - , LINE_COMMENT = 1 - , PREPROCESSOR = 2 - , OPERATOR = 3 - , INTEGER = 4 - , FLOAT = 5 - , IDENT = 6 - , BUILTIN = 7 - , KEYWORD = 8 - , WHITESPACE = 9 - , EOF = 10 - , HEX = 11 - -var map = [ - 'block-comment' - , 'line-comment' - , 'preprocessor' - , 'operator' - , 'integer' - , 'float' - , 'ident' - , 'builtin' - , 'keyword' - , 'whitespace' - , 'eof' - , 'integer' -] - -function tokenize(opt) { - var i = 0 - , total = 0 - , mode = NORMAL - , c - , last - , content = [] - , tokens = [] - , token_idx = 0 - , token_offs = 0 - , line = 1 - , col = 0 - , start = 0 - , isnum = false - , isoperator = false - , input = '' - , len - - opt = opt || {} - var allBuiltins = builtins100 - var allLiterals = literals100 - if (opt.version === '300 es') { - allBuiltins = builtins300es - allLiterals = literals300es - } - - return function(data) { - tokens = [] - if (data !== null) return write(data.replace ? data.replace(/\r\n/g, '\n') : data) - return end() - } - - function token(data) { - if (data.length) { - tokens.push({ - type: map[mode] - , data: data - , position: start - , line: line - , column: col - }) - } - } - - function write(chunk) { - i = 0 - input += chunk - len = input.length - - var last - - while(c = input[i], i < len) { - last = i - - switch(mode) { - case BLOCK_COMMENT: i = block_comment(); break - case LINE_COMMENT: i = line_comment(); break - case PREPROCESSOR: i = preprocessor(); break - case OPERATOR: i = operator(); break - case INTEGER: i = integer(); break - case HEX: i = hex(); break - case FLOAT: i = decimal(); break - case TOKEN: i = readtoken(); break - case WHITESPACE: i = whitespace(); break - case NORMAL: i = normal(); break - } - - if(last !== i) { - switch(input[last]) { - case '\n': col = 0; ++line; break - default: ++col; break - } - } - } - - total += i - input = input.slice(i) - return tokens - } - - function end(chunk) { - if(content.length) { - token(content.join('')) - } - - mode = EOF - token('(eof)') - return tokens - } - - function normal() { - content = content.length ? [] : content - - if(last === '/' && c === '*') { - start = total + i - 1 - mode = BLOCK_COMMENT - last = c - return i + 1 - } - - if(last === '/' && c === '/') { - start = total + i - 1 - mode = LINE_COMMENT - last = c - return i + 1 - } - - if(c === '#') { - mode = PREPROCESSOR - start = total + i - return i - } - - if(/\s/.test(c)) { - mode = WHITESPACE - start = total + i - return i - } - - isnum = /\d/.test(c) - isoperator = /[^\w_]/.test(c) - - start = total + i - mode = isnum ? INTEGER : isoperator ? OPERATOR : TOKEN - return i - } - - function whitespace() { - if(/[^\s]/g.test(c)) { - token(content.join('')) - mode = NORMAL - return i - } - content.push(c) - last = c - return i + 1 - } - - function preprocessor() { - if((c === '\r' || c === '\n') && last !== '\\') { - token(content.join('')) - mode = NORMAL - return i - } - content.push(c) - last = c - return i + 1 - } - - function line_comment() { - return preprocessor() - } - - function block_comment() { - if(c === '/' && last === '*') { - content.push(c) - token(content.join('')) - mode = NORMAL - return i + 1 - } - - content.push(c) - last = c - return i + 1 - } - - function operator() { - if(last === '.' && /\d/.test(c)) { - mode = FLOAT - return i - } - - if(last === '/' && c === '*') { - mode = BLOCK_COMMENT - return i - } - - if(last === '/' && c === '/') { - mode = LINE_COMMENT - return i - } - - if(c === '.' && content.length) { - while(determine_operator(content)); - - mode = FLOAT - return i - } - - if(c === ';' || c === ')' || c === '(') { - if(content.length) while(determine_operator(content)); - token(c) - mode = NORMAL - return i + 1 - } - - var is_composite_operator = content.length === 2 && c !== '=' - if(/[\w_\d\s]/.test(c) || is_composite_operator) { - while(determine_operator(content)); - mode = NORMAL - return i - } - - content.push(c) - last = c - return i + 1 - } - - function determine_operator(buf) { - var j = 0 - , idx - , res - - do { - idx = operators.indexOf(buf.slice(0, buf.length + j).join('')) - res = operators[idx] - - if(idx === -1) { - if(j-- + buf.length > 0) continue - res = buf.slice(0, 1).join('') - } - - token(res) - - start += res.length - content = content.slice(res.length) - return content.length - } while(1) - } - - function hex() { - if(/[^a-fA-F0-9]/.test(c)) { - token(content.join('')) - mode = NORMAL - return i - } - - content.push(c) - last = c - return i + 1 - } - - function integer() { - if(c === '.') { - content.push(c) - mode = FLOAT - last = c - return i + 1 - } - - if(/[eE]/.test(c)) { - content.push(c) - mode = FLOAT - last = c - return i + 1 - } - - if(c === 'x' && content.length === 1 && content[0] === '0') { - mode = HEX - content.push(c) - last = c - return i + 1 - } - - if(/[^\d]/.test(c)) { - token(content.join('')) - mode = NORMAL - return i - } - - content.push(c) - last = c - return i + 1 - } - - function decimal() { - if(c === 'f') { - content.push(c) - last = c - i += 1 - } - - if(/[eE]/.test(c)) { - content.push(c) - last = c - return i + 1 - } - - if (c === '-' && /[eE]/.test(last)) { - content.push(c) - last = c - return i + 1 - } - - if(/[^\d]/.test(c)) { - token(content.join('')) - mode = NORMAL - return i - } - - content.push(c) - last = c - return i + 1 - } - - function readtoken() { - if(/[^\d\w_]/.test(c)) { - var contentstr = content.join('') - if(allLiterals.indexOf(contentstr) > -1) { - mode = KEYWORD - } else if(allBuiltins.indexOf(contentstr) > -1) { - mode = BUILTIN - } else { - mode = IDENT - } - token(content.join('')) - mode = NORMAL - return i - } - content.push(c) - last = c - return i + 1 - } -} - -},{"./lib/builtins":387,"./lib/builtins-300es":386,"./lib/literals":389,"./lib/literals-300es":388,"./lib/operators":390}],386:[function(_dereq_,module,exports){ -// 300es builtins/reserved words that were previously valid in v100 -var v100 = _dereq_('./builtins') - -// The texture2D|Cube functions have been removed -// And the gl_ features are updated -v100 = v100.slice().filter(function (b) { - return !/^(gl\_|texture)/.test(b) -}) - -module.exports = v100.concat([ - // the updated gl_ constants - 'gl_VertexID' - , 'gl_InstanceID' - , 'gl_Position' - , 'gl_PointSize' - , 'gl_FragCoord' - , 'gl_FrontFacing' - , 'gl_FragDepth' - , 'gl_PointCoord' - , 'gl_MaxVertexAttribs' - , 'gl_MaxVertexUniformVectors' - , 'gl_MaxVertexOutputVectors' - , 'gl_MaxFragmentInputVectors' - , 'gl_MaxVertexTextureImageUnits' - , 'gl_MaxCombinedTextureImageUnits' - , 'gl_MaxTextureImageUnits' - , 'gl_MaxFragmentUniformVectors' - , 'gl_MaxDrawBuffers' - , 'gl_MinProgramTexelOffset' - , 'gl_MaxProgramTexelOffset' - , 'gl_DepthRangeParameters' - , 'gl_DepthRange' - - // other builtins - , 'trunc' - , 'round' - , 'roundEven' - , 'isnan' - , 'isinf' - , 'floatBitsToInt' - , 'floatBitsToUint' - , 'intBitsToFloat' - , 'uintBitsToFloat' - , 'packSnorm2x16' - , 'unpackSnorm2x16' - , 'packUnorm2x16' - , 'unpackUnorm2x16' - , 'packHalf2x16' - , 'unpackHalf2x16' - , 'outerProduct' - , 'transpose' - , 'determinant' - , 'inverse' - , 'texture' - , 'textureSize' - , 'textureProj' - , 'textureLod' - , 'textureOffset' - , 'texelFetch' - , 'texelFetchOffset' - , 'textureProjOffset' - , 'textureLodOffset' - , 'textureProjLod' - , 'textureProjLodOffset' - , 'textureGrad' - , 'textureGradOffset' - , 'textureProjGrad' - , 'textureProjGradOffset' -]) - -},{"./builtins":387}],387:[function(_dereq_,module,exports){ -module.exports = [ - // Keep this list sorted - 'abs' - , 'acos' - , 'all' - , 'any' - , 'asin' - , 'atan' - , 'ceil' - , 'clamp' - , 'cos' - , 'cross' - , 'dFdx' - , 'dFdy' - , 'degrees' - , 'distance' - , 'dot' - , 'equal' - , 'exp' - , 'exp2' - , 'faceforward' - , 'floor' - , 'fract' - , 'gl_BackColor' - , 'gl_BackLightModelProduct' - , 'gl_BackLightProduct' - , 'gl_BackMaterial' - , 'gl_BackSecondaryColor' - , 'gl_ClipPlane' - , 'gl_ClipVertex' - , 'gl_Color' - , 'gl_DepthRange' - , 'gl_DepthRangeParameters' - , 'gl_EyePlaneQ' - , 'gl_EyePlaneR' - , 'gl_EyePlaneS' - , 'gl_EyePlaneT' - , 'gl_Fog' - , 'gl_FogCoord' - , 'gl_FogFragCoord' - , 'gl_FogParameters' - , 'gl_FragColor' - , 'gl_FragCoord' - , 'gl_FragData' - , 'gl_FragDepth' - , 'gl_FragDepthEXT' - , 'gl_FrontColor' - , 'gl_FrontFacing' - , 'gl_FrontLightModelProduct' - , 'gl_FrontLightProduct' - , 'gl_FrontMaterial' - , 'gl_FrontSecondaryColor' - , 'gl_LightModel' - , 'gl_LightModelParameters' - , 'gl_LightModelProducts' - , 'gl_LightProducts' - , 'gl_LightSource' - , 'gl_LightSourceParameters' - , 'gl_MaterialParameters' - , 'gl_MaxClipPlanes' - , 'gl_MaxCombinedTextureImageUnits' - , 'gl_MaxDrawBuffers' - , 'gl_MaxFragmentUniformComponents' - , 'gl_MaxLights' - , 'gl_MaxTextureCoords' - , 'gl_MaxTextureImageUnits' - , 'gl_MaxTextureUnits' - , 'gl_MaxVaryingFloats' - , 'gl_MaxVertexAttribs' - , 'gl_MaxVertexTextureImageUnits' - , 'gl_MaxVertexUniformComponents' - , 'gl_ModelViewMatrix' - , 'gl_ModelViewMatrixInverse' - , 'gl_ModelViewMatrixInverseTranspose' - , 'gl_ModelViewMatrixTranspose' - , 'gl_ModelViewProjectionMatrix' - , 'gl_ModelViewProjectionMatrixInverse' - , 'gl_ModelViewProjectionMatrixInverseTranspose' - , 'gl_ModelViewProjectionMatrixTranspose' - , 'gl_MultiTexCoord0' - , 'gl_MultiTexCoord1' - , 'gl_MultiTexCoord2' - , 'gl_MultiTexCoord3' - , 'gl_MultiTexCoord4' - , 'gl_MultiTexCoord5' - , 'gl_MultiTexCoord6' - , 'gl_MultiTexCoord7' - , 'gl_Normal' - , 'gl_NormalMatrix' - , 'gl_NormalScale' - , 'gl_ObjectPlaneQ' - , 'gl_ObjectPlaneR' - , 'gl_ObjectPlaneS' - , 'gl_ObjectPlaneT' - , 'gl_Point' - , 'gl_PointCoord' - , 'gl_PointParameters' - , 'gl_PointSize' - , 'gl_Position' - , 'gl_ProjectionMatrix' - , 'gl_ProjectionMatrixInverse' - , 'gl_ProjectionMatrixInverseTranspose' - , 'gl_ProjectionMatrixTranspose' - , 'gl_SecondaryColor' - , 'gl_TexCoord' - , 'gl_TextureEnvColor' - , 'gl_TextureMatrix' - , 'gl_TextureMatrixInverse' - , 'gl_TextureMatrixInverseTranspose' - , 'gl_TextureMatrixTranspose' - , 'gl_Vertex' - , 'greaterThan' - , 'greaterThanEqual' - , 'inversesqrt' - , 'length' - , 'lessThan' - , 'lessThanEqual' - , 'log' - , 'log2' - , 'matrixCompMult' - , 'max' - , 'min' - , 'mix' - , 'mod' - , 'normalize' - , 'not' - , 'notEqual' - , 'pow' - , 'radians' - , 'reflect' - , 'refract' - , 'sign' - , 'sin' - , 'smoothstep' - , 'sqrt' - , 'step' - , 'tan' - , 'texture2D' - , 'texture2DLod' - , 'texture2DProj' - , 'texture2DProjLod' - , 'textureCube' - , 'textureCubeLod' - , 'texture2DLodEXT' - , 'texture2DProjLodEXT' - , 'textureCubeLodEXT' - , 'texture2DGradEXT' - , 'texture2DProjGradEXT' - , 'textureCubeGradEXT' -] - -},{}],388:[function(_dereq_,module,exports){ -var v100 = _dereq_('./literals') - -module.exports = v100.slice().concat([ - 'layout' - , 'centroid' - , 'smooth' - , 'case' - , 'mat2x2' - , 'mat2x3' - , 'mat2x4' - , 'mat3x2' - , 'mat3x3' - , 'mat3x4' - , 'mat4x2' - , 'mat4x3' - , 'mat4x4' - , 'uint' - , 'uvec2' - , 'uvec3' - , 'uvec4' - , 'samplerCubeShadow' - , 'sampler2DArray' - , 'sampler2DArrayShadow' - , 'isampler2D' - , 'isampler3D' - , 'isamplerCube' - , 'isampler2DArray' - , 'usampler2D' - , 'usampler3D' - , 'usamplerCube' - , 'usampler2DArray' - , 'coherent' - , 'restrict' - , 'readonly' - , 'writeonly' - , 'resource' - , 'atomic_uint' - , 'noperspective' - , 'patch' - , 'sample' - , 'subroutine' - , 'common' - , 'partition' - , 'active' - , 'filter' - , 'image1D' - , 'image2D' - , 'image3D' - , 'imageCube' - , 'iimage1D' - , 'iimage2D' - , 'iimage3D' - , 'iimageCube' - , 'uimage1D' - , 'uimage2D' - , 'uimage3D' - , 'uimageCube' - , 'image1DArray' - , 'image2DArray' - , 'iimage1DArray' - , 'iimage2DArray' - , 'uimage1DArray' - , 'uimage2DArray' - , 'image1DShadow' - , 'image2DShadow' - , 'image1DArrayShadow' - , 'image2DArrayShadow' - , 'imageBuffer' - , 'iimageBuffer' - , 'uimageBuffer' - , 'sampler1DArray' - , 'sampler1DArrayShadow' - , 'isampler1D' - , 'isampler1DArray' - , 'usampler1D' - , 'usampler1DArray' - , 'isampler2DRect' - , 'usampler2DRect' - , 'samplerBuffer' - , 'isamplerBuffer' - , 'usamplerBuffer' - , 'sampler2DMS' - , 'isampler2DMS' - , 'usampler2DMS' - , 'sampler2DMSArray' - , 'isampler2DMSArray' - , 'usampler2DMSArray' -]) - -},{"./literals":389}],389:[function(_dereq_,module,exports){ -module.exports = [ - // current - 'precision' - , 'highp' - , 'mediump' - , 'lowp' - , 'attribute' - , 'const' - , 'uniform' - , 'varying' - , 'break' - , 'continue' - , 'do' - , 'for' - , 'while' - , 'if' - , 'else' - , 'in' - , 'out' - , 'inout' - , 'float' - , 'int' - , 'void' - , 'bool' - , 'true' - , 'false' - , 'discard' - , 'return' - , 'mat2' - , 'mat3' - , 'mat4' - , 'vec2' - , 'vec3' - , 'vec4' - , 'ivec2' - , 'ivec3' - , 'ivec4' - , 'bvec2' - , 'bvec3' - , 'bvec4' - , 'sampler1D' - , 'sampler2D' - , 'sampler3D' - , 'samplerCube' - , 'sampler1DShadow' - , 'sampler2DShadow' - , 'struct' - - // future - , 'asm' - , 'class' - , 'union' - , 'enum' - , 'typedef' - , 'template' - , 'this' - , 'packed' - , 'goto' - , 'switch' - , 'default' - , 'inline' - , 'noinline' - , 'volatile' - , 'public' - , 'static' - , 'extern' - , 'external' - , 'interface' - , 'long' - , 'short' - , 'double' - , 'half' - , 'fixed' - , 'unsigned' - , 'input' - , 'output' - , 'hvec2' - , 'hvec3' - , 'hvec4' - , 'dvec2' - , 'dvec3' - , 'dvec4' - , 'fvec2' - , 'fvec3' - , 'fvec4' - , 'sampler2DRect' - , 'sampler3DRect' - , 'sampler2DRectShadow' - , 'sizeof' - , 'cast' - , 'namespace' - , 'using' -] - -},{}],390:[function(_dereq_,module,exports){ -module.exports = [ - '<<=' - , '>>=' - , '++' - , '--' - , '<<' - , '>>' - , '<=' - , '>=' - , '==' - , '!=' - , '&&' - , '||' - , '+=' - , '-=' - , '*=' - , '/=' - , '%=' - , '&=' - , '^^' - , '^=' - , '|=' - , '(' - , ')' - , '[' - , ']' - , '.' - , '!' - , '~' - , '*' - , '/' - , '%' - , '+' - , '-' - , '<' - , '>' - , '&' - , '^' - , '|' - , '?' - , ':' - , '=' - , ',' - , ';' - , '{' - , '}' -] - -},{}],391:[function(_dereq_,module,exports){ -var tokenize = _dereq_('./index') - -module.exports = tokenizeString - -function tokenizeString(str, opt) { - var generator = tokenize(opt) - var tokens = [] - - tokens = tokens.concat(generator(str)) - tokens = tokens.concat(generator(null)) - - return tokens -} - -},{"./index":385}],392:[function(_dereq_,module,exports){ -module.exports = function(strings) { - if (typeof strings === 'string') strings = [strings] - var exprs = [].slice.call(arguments,1) - var parts = [] - for (var i = 0; i < strings.length-1; i++) { - parts.push(strings[i], exprs[i] || '') - } - parts.push(strings[i]) - return parts.join('') -} - -},{}],393:[function(_dereq_,module,exports){ -(function (global){ -'use strict' - -var isBrowser = _dereq_('is-browser') -var hasHover - -if (typeof global.matchMedia === 'function') { - hasHover = !global.matchMedia('(hover: none)').matches -} -else { - hasHover = isBrowser -} - -module.exports = hasHover - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":400}],394:[function(_dereq_,module,exports){ -'use strict' - -var isBrowser = _dereq_('is-browser') - -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 -} - -module.exports = isBrowser && detect() - -},{"is-browser":400}],395:[function(_dereq_,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],396:[function(_dereq_,module,exports){ -"use strict" - -//High level idea: -// 1. Use Clarkson's incremental construction to find convex hull -// 2. Point location in triangulation by jump and walk - -module.exports = incrementalConvexHull - -var orient = _dereq_("robust-orientation") -var compareCell = _dereq_("simplicial-complex").compareCells - -function compareInt(a, b) { - return a - b -} - -function Simplex(vertices, adjacent, boundary) { - this.vertices = vertices - this.adjacent = adjacent - this.boundary = boundary - this.lastVisited = -1 -} - -Simplex.prototype.flip = function() { - var t = this.vertices[0] - this.vertices[0] = this.vertices[1] - this.vertices[1] = t - var u = this.adjacent[0] - this.adjacent[0] = this.adjacent[1] - this.adjacent[1] = u -} - -function GlueFacet(vertices, cell, index) { - this.vertices = vertices - this.cell = cell - this.index = index -} - -function compareGlue(a, b) { - return compareCell(a.vertices, b.vertices) -} - -function bakeOrient(d) { - var code = ["function orient(){var tuple=this.tuple;return test("] - for(var i=0; i<=d; ++i) { - if(i > 0) { - code.push(",") - } - code.push("tuple[", i, "]") - } - code.push(")}return orient") - var proc = new Function("test", code.join("")) - var test = orient[d+1] - if(!test) { - test = orient - } - return proc(test) -} - -var BAKED = [] - -function Triangulation(dimension, vertices, simplices) { - this.dimension = dimension - this.vertices = vertices - this.simplices = simplices - this.interior = simplices.filter(function(c) { - return !c.boundary - }) - - this.tuple = new Array(dimension+1) - for(var i=0; i<=dimension; ++i) { - this.tuple[i] = this.vertices[i] - } - - var o = BAKED[dimension] - if(!o) { - o = BAKED[dimension] = bakeOrient(dimension) - } - this.orient = o -} - -var proto = Triangulation.prototype - -//Degenerate situation where we are on boundary, but coplanar to face -proto.handleBoundaryDegeneracy = function(cell, point) { - var d = this.dimension - var n = this.vertices.length - 1 - var tuple = this.tuple - var verts = this.vertices - - //Dumb solution: Just do dfs from boundary cell until we find any peak, or terminate - var toVisit = [ cell ] - cell.lastVisited = -n - while(toVisit.length > 0) { - cell = toVisit.pop() - var cellVerts = cell.vertices - var cellAdj = cell.adjacent - for(var i=0; i<=d; ++i) { - var neighbor = cellAdj[i] - if(!neighbor.boundary || neighbor.lastVisited <= -n) { - continue - } - var nv = neighbor.vertices - for(var j=0; j<=d; ++j) { - var vv = nv[j] - if(vv < 0) { - tuple[j] = point - } else { - tuple[j] = verts[vv] - } - } - var o = this.orient() - if(o > 0) { - return neighbor - } - neighbor.lastVisited = -n - if(o === 0) { - toVisit.push(neighbor) - } - } - } - return null -} - -proto.walk = function(point, random) { - //Alias local properties - var n = this.vertices.length - 1 - var d = this.dimension - var verts = this.vertices - var tuple = this.tuple - - //Compute initial jump cell - var initIndex = random ? (this.interior.length * Math.random())|0 : (this.interior.length-1) - var cell = this.interior[ initIndex ] - - //Start walking -outerLoop: - while(!cell.boundary) { - var cellVerts = cell.vertices - var cellAdj = cell.adjacent - - for(var i=0; i<=d; ++i) { - tuple[i] = verts[cellVerts[i]] - } - cell.lastVisited = n - - //Find farthest adjacent cell - for(var i=0; i<=d; ++i) { - var neighbor = cellAdj[i] - if(neighbor.lastVisited >= n) { - continue - } - var prev = tuple[i] - tuple[i] = point - var o = this.orient() - tuple[i] = prev - if(o < 0) { - cell = neighbor - continue outerLoop - } else { - if(!neighbor.boundary) { - neighbor.lastVisited = n - } else { - neighbor.lastVisited = -n - } - } - } - return - } - - return cell -} - -proto.addPeaks = function(point, cell) { - var n = this.vertices.length - 1 - var d = this.dimension - var verts = this.vertices - var tuple = this.tuple - var interior = this.interior - var simplices = this.simplices - - //Walking finished at boundary, time to add peaks - var tovisit = [ cell ] - - //Stretch initial boundary cell into a peak - cell.lastVisited = n - cell.vertices[cell.vertices.indexOf(-1)] = n - cell.boundary = false - interior.push(cell) - - //Record a list of all new boundaries created by added peaks so we can glue them together when we are all done - var glueFacets = [] - - //Do a traversal of the boundary walking outward from starting peak - while(tovisit.length > 0) { - //Pop off peak and walk over adjacent cells - var cell = tovisit.pop() - var cellVerts = cell.vertices - var cellAdj = cell.adjacent - var indexOfN = cellVerts.indexOf(n) - if(indexOfN < 0) { - continue - } - - for(var i=0; i<=d; ++i) { - if(i === indexOfN) { - continue - } - - //For each boundary neighbor of the cell - var neighbor = cellAdj[i] - if(!neighbor.boundary || neighbor.lastVisited >= n) { - continue - } - - var nv = neighbor.vertices - - //Test if neighbor is a peak - if(neighbor.lastVisited !== -n) { - //Compute orientation of p relative to each boundary peak - var indexOfNeg1 = 0 - for(var j=0; j<=d; ++j) { - if(nv[j] < 0) { - indexOfNeg1 = j - tuple[j] = point - } else { - tuple[j] = verts[nv[j]] - } - } - var o = this.orient() - - //Test if neighbor cell is also a peak - if(o > 0) { - nv[indexOfNeg1] = n - neighbor.boundary = false - interior.push(neighbor) - tovisit.push(neighbor) - neighbor.lastVisited = n - continue - } else { - neighbor.lastVisited = -n - } - } - - var na = neighbor.adjacent - - //Otherwise, replace neighbor with new face - var vverts = cellVerts.slice() - var vadj = cellAdj.slice() - var ncell = new Simplex(vverts, vadj, true) - simplices.push(ncell) - - //Connect to neighbor - var opposite = na.indexOf(cell) - if(opposite < 0) { - continue - } - na[opposite] = ncell - vadj[indexOfN] = neighbor - - //Connect to cell - vverts[i] = -1 - vadj[i] = cell - cellAdj[i] = ncell - - //Flip facet - ncell.flip() - - //Add to glue list - for(var j=0; j<=d; ++j) { - var uu = vverts[j] - if(uu < 0 || uu === n) { - continue - } - var nface = new Array(d-1) - var nptr = 0 - for(var k=0; k<=d; ++k) { - var vv = vverts[k] - if(vv < 0 || k === j) { - continue - } - nface[nptr++] = vv - } - glueFacets.push(new GlueFacet(nface, ncell, j)) - } - } - } - - //Glue boundary facets together - glueFacets.sort(compareGlue) - - for(var i=0; i+1= 0) { - bcell[ptr++] = cv[j] - } else { - parity = j&1 - } - } - if(parity === (d&1)) { - var t = bcell[0] - bcell[0] = bcell[1] - bcell[1] = t - } - boundary.push(bcell) - } - } - return boundary -} - -function incrementalConvexHull(points, randomSearch) { - var n = points.length - if(n === 0) { - throw new Error("Must have at least d+1 points") - } - var d = points[0].length - if(n <= d) { - throw new Error("Must input at least d+1 points") - } - - //FIXME: This could be degenerate, but need to select d+1 non-coplanar points to bootstrap process - var initialSimplex = points.slice(0, d+1) - - //Make sure initial simplex is positively oriented - var o = orient.apply(void 0, initialSimplex) - if(o === 0) { - throw new Error("Input not in general position") - } - var initialCoords = new Array(d+1) - for(var i=0; i<=d; ++i) { - initialCoords[i] = i - } - if(o < 0) { - initialCoords[0] = 1 - initialCoords[1] = 0 - } - - //Create initial topological index, glue pointers together (kind of messy) - var initialCell = new Simplex(initialCoords, new Array(d+1), false) - var boundary = initialCell.adjacent - var list = new Array(d+2) - for(var i=0; i<=d; ++i) { - var verts = initialCoords.slice() - for(var j=0; j<=d; ++j) { - if(j === i) { - verts[j] = -1 - } - } - var t = verts[0] - verts[0] = verts[1] - verts[1] = t - var cell = new Simplex(verts, new Array(d+1), true) - boundary[i] = cell - list[i] = cell - } - list[d+1] = initialCell - for(var i=0; i<=d; ++i) { - var verts = boundary[i].vertices - var adj = boundary[i].adjacent - for(var j=0; j<=d; ++j) { - var v = verts[j] - if(v < 0) { - adj[j] = initialCell - continue - } - for(var k=0; k<=d; ++k) { - if(boundary[k].vertices.indexOf(v) < 0) { - adj[j] = boundary[k] - } - } - } - } - - //Initialize triangles - var triangles = new Triangulation(d, initialSimplex, list) - - //Insert remaining points - var useRandom = !!randomSearch - for(var i=d+1; i 3*(weight+1)) { - rebuildWithInterval(this, interval) - } else { - this.left.insert(interval) - } - } else { - this.left = createIntervalTree([interval]) - } - } else if(interval[0] > this.mid) { - if(this.right) { - if(4*(this.right.count+1) > 3*(weight+1)) { - rebuildWithInterval(this, interval) - } else { - this.right.insert(interval) - } - } else { - this.right = createIntervalTree([interval]) - } - } else { - var l = bounds.ge(this.leftPoints, interval, compareBegin) - var r = bounds.ge(this.rightPoints, interval, compareEnd) - this.leftPoints.splice(l, 0, interval) - this.rightPoints.splice(r, 0, interval) - } -} - -proto.remove = function(interval) { - var weight = this.count - this.leftPoints - if(interval[1] < this.mid) { - if(!this.left) { - return NOT_FOUND - } - var rw = this.right ? this.right.count : 0 - if(4 * rw > 3 * (weight-1)) { - return rebuildWithoutInterval(this, interval) - } - var r = this.left.remove(interval) - if(r === EMPTY) { - this.left = null - this.count -= 1 - return SUCCESS - } else if(r === SUCCESS) { - this.count -= 1 - } - return r - } else if(interval[0] > this.mid) { - if(!this.right) { - return NOT_FOUND - } - var lw = this.left ? this.left.count : 0 - if(4 * lw > 3 * (weight-1)) { - return rebuildWithoutInterval(this, interval) - } - var r = this.right.remove(interval) - if(r === EMPTY) { - this.right = null - this.count -= 1 - return SUCCESS - } else if(r === SUCCESS) { - this.count -= 1 - } - return r - } else { - if(this.count === 1) { - if(this.leftPoints[0] === interval) { - return EMPTY - } else { - return NOT_FOUND - } - } - if(this.leftPoints.length === 1 && this.leftPoints[0] === interval) { - if(this.left && this.right) { - var p = this - var n = this.left - while(n.right) { - p = n - n = n.right - } - if(p === this) { - n.right = this.right - } else { - var l = this.left - var r = this.right - p.count -= n.count - p.right = n.left - n.left = l - n.right = r - } - copy(this, n) - this.count = (this.left?this.left.count:0) + (this.right?this.right.count:0) + this.leftPoints.length - } else if(this.left) { - copy(this, this.left) - } else { - copy(this, this.right) - } - return SUCCESS - } - for(var l = bounds.ge(this.leftPoints, interval, compareBegin); l=0 && arr[i][1] >= lo; --i) { - var r = cb(arr[i]) - if(r) { return r } - } -} - -function reportRange(arr, cb) { - for(var i=0; i this.mid) { - if(this.right) { - var r = this.right.queryPoint(x, cb) - if(r) { return r } - } - return reportRightRange(this.rightPoints, x, cb) - } else { - return reportRange(this.leftPoints, cb) - } -} - -proto.queryInterval = function(lo, hi, cb) { - if(lo < this.mid && this.left) { - var r = this.left.queryInterval(lo, hi, cb) - if(r) { return r } - } - if(hi > this.mid && this.right) { - var r = this.right.queryInterval(lo, hi, cb) - if(r) { return r } - } - if(hi < this.mid) { - return reportLeftRange(this.leftPoints, hi, cb) - } else if(lo > this.mid) { - return reportRightRange(this.rightPoints, lo, cb) - } else { - return reportRange(this.leftPoints, cb) - } -} - -function compareNumbers(a, b) { - return a - b -} - -function compareBegin(a, b) { - var d = a[0] - b[0] - if(d) { return d } - return a[1] - b[1] -} - -function compareEnd(a, b) { - var d = a[1] - b[1] - if(d) { return d } - return a[0] - b[0] -} - -function createIntervalTree(intervals) { - if(intervals.length === 0) { - return null - } - var pts = [] - for(var i=0; i>1] - - var leftIntervals = [] - var rightIntervals = [] - var centerIntervals = [] - for(var i=0; i - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - -},{}],402:[function(_dereq_,module,exports){ -'use strict'; -module.exports = typeof navigator !== 'undefined' && - (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion)); - -},{}],403:[function(_dereq_,module,exports){ -'use strict' - -module.exports = isMobile; -module.exports.isMobile = isMobile; - -var mobileRE = /(android|bb\d+|meego).+mobile|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(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i; - -var tabletRE = /(android|bb\d+|meego).+mobile|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(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i; - -function isMobile (opts) { - if (!opts) opts = {} - var ua = opts.ua - if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent; - if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') { - ua = ua.headers['user-agent']; - } - if (typeof ua !== 'string') return false; - - return opts.tablet - ? tabletRE.test(ua) - : mobileRE.test(ua); -} - -},{}],404:[function(_dereq_,module,exports){ -'use strict'; -module.exports = function (x) { - var type = typeof x; - return x !== null && (type === 'object' || type === 'function'); -}; - -},{}],405:[function(_dereq_,module,exports){ -'use strict'; -var toString = Object.prototype.toString; - -module.exports = function (x) { - var prototype; - return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); -}; - -},{}],406:[function(_dereq_,module,exports){ -'use strict'; - -/** - * Is this string all whitespace? - * This solution kind of makes my brain hurt, but it's significantly faster - * than !str.trim() or any other solution I could find. - * - * whitespace codes from: http://en.wikipedia.org/wiki/Whitespace_character - * and verified with: - * - * for(var i = 0; i < 65536; i++) { - * var s = String.fromCharCode(i); - * if(+s===0 && !s.trim()) console.log(i, s); - * } - * - * which counts a couple of these as *not* whitespace, but finds nothing else - * that *is* whitespace. Note that charCodeAt stops at 16 bits, but it appears - * that there are no whitespace characters above this, and code points above - * this do not map onto white space characters. - */ - -module.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; -} - -},{}],407:[function(_dereq_,module,exports){ -'use strict' - -module.exports = function isPath(str) { - if (typeof str !== 'string') return false - - str = str.trim() - - // https://www.w3.org/TR/SVG/paths.html#PathDataBNF - if (/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(str) && /[\dz]$/i.test(str) && str.length > 4) return true - - return false -} - -},{}],408:[function(_dereq_,module,exports){ -function lerp(v0, v1, t) { - return v0*(1-t)+v1*t -} -module.exports = lerp -},{}],409:[function(_dereq_,module,exports){ -(function (global){ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.mapboxgl = factory()); -}(this, (function () { 'use strict'; - -/* eslint-disable */ - -var shared, worker, mapboxgl; -// define gets called three times: one for each chunk. we rely on the order -// they're imported to know which is which -function define(_, chunk) { -if (!shared) { - shared = chunk; -} else if (!worker) { - worker = chunk; -} else { - var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);' - - var sharedChunk = {}; - shared(sharedChunk); - mapboxgl = chunk(sharedChunk); - mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); -} -} - - -define(["exports"],function(t){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var i=o;function o(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n;}o.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},o.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},o.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},o.prototype.solveCurveX=function(t,e){var r,n,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)(n=1))return n;for(;ro?r=i:n=i,i=.5*(n-r)+r;}return i},o.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var a=function(t,e,r){this.column=t,this.row=e,this.zoom=r;};a.prototype.clone=function(){return new a(this.column,this.row,this.zoom)},a.prototype.zoomTo=function(t){return this.clone()._zoomTo(t)},a.prototype.sub=function(t){return this.clone()._sub(t)},a.prototype._zoomTo=function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},a.prototype._sub=function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this};var s=u;function u(t,e){this.x=t,this.y=e;}function l(t,e,r,n){var o=new i(t,e,r,n);return function(t){return o.solve(t)}}u.prototype={clone:function(){return new u(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},u.convert=function(t){return t instanceof u?t:Array.isArray(t)?new u(t[0],t[1]):t};var p=l(.25,.1,.25,1);function c(t,e,r){return Math.min(r,Math.max(e,t))}function h(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n(e.y-t.y)*(r.x-t.x)}function _(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r=200&&r.status<300&&r.response?e(null,{data:n,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new k(r.statusText,r.status,t.url));},r.send(),r};function M(t,e,r){r[t]=r[t]||[],r[t].push(e);}function V(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1);}}var B=function(t,e){void 0===e&&(e={}),h(this,e),this.type=t;},C=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",h({error:e},r));}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(B),I=function(){};I.prototype.on=function(t,e){return this._listeners=this._listeners||{},M(t,e,this._listeners),this},I.prototype.off=function(t,e){return V(t,e,this._listeners),V(t,e,this._oneTimeListeners),this},I.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},M(t,e,this._oneTimeListeners),this},I.prototype.fire=function(t){"string"==typeof t&&(t=new B(t,arguments[1]||{}));var e=t.type;if(this.listens(e)){t.target=this;for(var r=0,n=this._listeners&&this._listeners[e]?this._listeners[e].slice():[];r0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},I.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var E={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},lineMetrics:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_fill:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_circle:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{butt:{},round:{},square:{}},default:"butt"},"line-join":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{bevel:{},round:{},miter:{}},default:"miter"},"line-miter-limit":{type:"number",default:2,function:"interpolated","zoom-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{point:{},line:{}},default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,units:"factor of the original icon size",requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",function:"interpolated","zoom-function":!0,requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}]},"icon-image":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,tokens:!0},"icon-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number",default:2,minimum:0,function:"interpolated","zoom-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"]},"icon-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"]},"text-field":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:"",tokens:!0},"text-font":{type:"array",value:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number",default:16,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"ems",function:"interpolated","zoom-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-justify":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{left:{},center:{},right:{}},default:"center",requires:["text-field"]},"text-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"]},"text-max-angle":{type:"number",default:45,units:"degrees",function:"interpolated","zoom-function":!0,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number",default:0,period:360,units:"degrees",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,length:2,default:[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},transition:!1,"zoom-function":!0,"property-function":!1,function:"piecewise-constant"},position:{type:"array",default:[1.15,210,30],length:3,value:"number",transition:!0,function:"interpolated","zoom-function":!0,"property-function":!1},color:{type:"color",default:"#ffffff",function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},intensity:{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!0},"fill-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0}},paint_line:{"line-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["line-translate"]},"line-width":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number",function:"piecewise-constant","zoom-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"line-gradient":{type:"color",function:"interpolated","zoom-function":!1,"property-function":!1,transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}]}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map"},"circle-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"circle-stroke-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-stroke-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"heatmap-weight":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!1},"heatmap-intensity":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],function:"interpolated","zoom-function":!1,"property-function":!1,transition:!1},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number",function:"interpolated","zoom-function":!0,default:0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number",function:"interpolated","zoom-function":!0,default:1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number",default:300,minimum:0,function:"interpolated","zoom-function":!0,transition:!1,units:"milliseconds"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,function:"interpolated","zoom-function":!0,transition:!1},"hillshade-illumination-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"hillshade-shadow-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-accent-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0}},paint_background:{"background-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!1,default:1,minimum:0,maximum:1,transition:!0},"fill-extrusion-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-extrusion-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"]},"fill-extrusion-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"fill-extrusion-height":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0},"fill-extrusion-base":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"]}}},F=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);};function P(t){var e=t.key,r=t.value;return r?[new F(e,r,"constants have been deprecated as of v8")]:[]}function T(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var G=[R,U,D,N,Z,K,H(J)];function Y(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&!Y(t.itemType,e.itemType)&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=G;r255?255:t}function i(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function a(t){return"%"===t[t.length-1]?i(parseFloat(t)/100):i(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in r)return r[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=i.indexOf("("),l=i.indexOf(")");if(-1!==u&&l+1===i.length){var p=i.substr(0,u),c=i.substr(u+1,l-(u+1)).split(","),h=1;switch(p){case"rgba":if(4!==c.length)return null;h=a(c.pop());case"rgb":return 3!==c.length?null:[o(c[0]),o(c[1]),o(c[2]),h];case"hsla":if(4!==c.length)return null;h=a(c.pop());case"hsl":if(3!==c.length)return null;var f=(parseFloat(c[0])%360+360)%360/360,y=a(c[1]),d=a(c[2]),v=d<=.5?d*(y+1):d+y-d*y,m=2*d-v;return[n(255*s(m,v,f+1/3)),n(255*s(m,v,f)),n(255*s(m,v,f-1/3)),h];default:return null}}return null};}catch(t){}}).parseCSSColor,Q=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n;};Q.parse=function(t){if(t){if(t instanceof Q)return t;if("string"==typeof t){var e=W(t);if(e)return new Q(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Q.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],n=t[2],i=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(n)+","+i+")"},Q.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,n=this.a;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]},Q.black=new Q(0,0,0,1),Q.white=new Q(1,1,1,1),Q.transparent=new Q(0,0,0,0);var tt=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"});};tt.prototype.compare=function(t,e){return this.collator.compare(t,e)},tt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var et=function(t,e,r){this.type=$,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e;};function rt(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function nt(t){if(null===t)return R;if("string"==typeof t)return D;if("boolean"==typeof t)return N;if("number"==typeof t)return U;if(t instanceof Q)return Z;if(t instanceof tt)return $;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,n;if(t.length>2){var i=t[1];if("string"!=typeof i||!(i in ut))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=ut[i];}else r=J;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2];}var o=H(r,n),a=e.parse(t[t.length-1],t.length-1,J);return a?new lt(o,a):null},lt.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(Y(this.type,nt(e)))throw new ot("Expected value to be of type "+X(this.type)+", but found "+X(nt(e))+" instead.");return e},lt.prototype.eachChild=function(t){t(this.input);},lt.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},lt.prototype.serialize=function(){var t=["array"],e=this.type.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){t.push(e.kind);var r=this.type.N;"number"==typeof r&&t.push(r);}return t.push(this.input.serialize()),t};var pt={"to-number":U,"to-color":Z},ct=function(t,e){this.type=t,this.args=e;};ct.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],n=pt[r],i=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":rt(e[0],e[1],e[2],e[3])))return new Q(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ot(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var a=null,s=0,u=this.args;s=0)return!1;var r=!0;return t.eachChild(function(t){r&&!vt(t,e)&&(r=!1);}),r}yt.prototype.evaluate=function(t){return this._evaluate(t,this.args)},yt.prototype.eachChild=function(t){this.args.forEach(t);},yt.prototype.possibleOutputs=function(){return[void 0]},yt.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},yt.parse=function(t,e){var r=t[0],n=yt.definitions[r];if(!n)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var i=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter(function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1}),s=[],u=1;ur&&ee))throw new ot("Input is not a number.");o=a-1;}}return Math.max(a-1,0)}gt.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},gt.prototype._parse=function(t,e){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var n=this.registry[r];if(n){var i=n.parse(t,this);if(!i)return null;if(this.expectedType){var o=this.expectedType,a=i.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind||"value"!==a.kind)if("array"===o.kind&&"value"===a.kind)e.omitTypeAnnotations||(i=new lt(o,i));else if("color"!==o.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(this.expectedType,i.type))return null}else e.omitTypeAnnotations||(i=new ct(o,[i]));else e.omitTypeAnnotations||(i=new st(o,[i]));}if(!(i instanceof it)&&function t(e){if(e instanceof mt)return t(e.boundExpression);if(e instanceof yt&&"error"===e.name)return!1;if(e instanceof et)return!1;var r=e instanceof ct||e instanceof st||e instanceof lt;var n=!0;e.eachChild(function(e){n=r?n&&t(e):n&&e instanceof it;});if(!n)return!1;return dt(e)&&vt(e,["zoom","heatmap-density","line-progress","is-supported-script"])}(i)){var s=new ft;try{i=new it(i.type,i.evaluate(s));}catch(t){return this.error(t.message),null}}return i}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},gt.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new gt(this.registry,n,e||null,i,this.errors)},gt.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map(function(t){return"["+t+"]"}).join("");this.errors.push(new j(n,t));},gt.prototype.checkSubtype=function(t,e){var r=Y(t,e);return r&&this.error(r),r};var bt=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var c=e.parse(u,p,o);if(!c)return null;o=o||c.type,i.push([s,c]);}return new bt(o,r,i)},bt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[xt(e,n)].evaluate(t)},bt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var _t=Object.freeze({number:wt,color:function(t,e,r){return new Q(wt(t.r,e.r,r),wt(t.g,e.g,r),wt(t.b,e.b,r),wt(t.a,e.a,r))},array:function(t,e,r){return t.map(function(t,n){return wt(t,e[n],r)})}}),At=function(t,e,r,n){this.type=t,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(var i=0,o=n;i1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:a};}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,U)))return null;var s=[],u=null;e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var l=0;l=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);var y=e.parse(c,f,u);if(!y)return null;u=u||y.type,s.push([p,y]);}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new At(u,r,n,s):e.error("Type "+X(u)+" is not interpolatable.")},At.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=xt(e,n),a=e[o],s=e[o+1],u=At.interpolationFactor(this.interpolation,n,a,s),l=r[o].evaluate(t),p=r[o+1].evaluate(t);return _t[this.type.kind.toLowerCase()](l,p,u)},At.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new ot("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new ot("Array index must be an integer, but found "+e+" instead.");return r[e]},Mt.prototype.eachChild=function(t){t(this.index),t(this.input);},Mt.prototype.possibleOutputs=function(){return[void 0]},Mt.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Vt=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o;};Vt.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;aNumber.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,nt(h)))return null}else r=nt(h);if(void 0!==i[String(h)])return l.error("Branch labels must be unique.");i[String(h)]=o.length;}var f=e.parse(u,a,n);if(!f)return null;n=n||f.type,o.push(f);}var y=e.parse(t[1],1,r);if(!y)return null;var d=e.parse(t[t.length-1],t.length-1,n);return d?new Vt(r,n,y,i,o,d):null},Vt.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Vt.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);},Vt.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t;},Vt.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();in.evaluate(t)}function Ut(t,e){var r=e[0],n=e[1];return r.evaluate(t)<=n.evaluate(t)}function Dt(t,e){var r=e[0],n=e[1];return r.evaluate(t)>=n.evaluate(t)}function Nt(t){return{type:t}}function Zt(t){return{result:"success",value:t}}function Kt(t){return{result:"error",value:t}}yt.register(Tt,{error:[{kind:"error"},[D],function(t,e){var r=e[0];throw new ot(r.evaluate(t))}],typeof:[D,[J],function(t,e){return X(nt(e[0].evaluate(t)))}],"to-string":[D,[J],function(t,e){var r=e[0],n=typeof(r=r.evaluate(t));return null===r?"":"string"===n||"number"===n||"boolean"===n?String(r):r instanceof Q?r.toString():JSON.stringify(r)}],"to-boolean":[N,[J],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[H(U,4),[Z],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Z,[U,U,U],Ot],rgba:[Z,[U,U,U,U],Ot],has:{type:N,overloads:[[[D],function(t,e){return Lt(e[0].evaluate(t),t.properties())}],[[D,K],function(t,e){var r=e[0],n=e[1];return Lt(r.evaluate(t),n.evaluate(t))}]]},get:{type:J,overloads:[[[D],function(t,e){return jt(e[0].evaluate(t),t.properties())}],[[D,K],function(t,e){var r=e[0],n=e[1];return jt(r.evaluate(t),n.evaluate(t))}]]},properties:[K,[],function(t){return t.properties()}],"geometry-type":[D,[],function(t){return t.geometryType()}],id:[J,[],function(t){return t.id()}],zoom:[U,[],function(t){return t.globals.zoom}],"heatmap-density":[U,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[U,[],function(t){return t.globals.lineProgress||0}],"+":[U,Nt(U),function(t,e){for(var r=0,n=0,i=e;n":[N,[D,J],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[N,[J],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[N,[D,J],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[N,[J],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[N,[D,J],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[N,[J],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[N,[J],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[N,[],function(t){return null!==t.id()}],"filter-type-in":[N,[H(D)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[N,[H(J)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[N,[D,H(J)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[N,[D,H(J)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1;}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],">":{type:N,overloads:[[[U,U],Rt],[[D,D],Rt],[[D,D,$],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>0}]]},"<":{type:N,overloads:[[[U,U],qt],[[D,D],qt],[[D,D,$],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<0}]]},">=":{type:N,overloads:[[[U,U],Dt],[[D,D],Dt],[[D,D,$],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>=0}]]},"<=":{type:N,overloads:[[[U,U],Ut],[[D,D],Ut],[[D,D,$],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<=0}]]},all:{type:N,overloads:[[[N,N],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[Nt(N),function(t,e){for(var r=0,n=e;rWt?Math.pow(t,1/3):t/Yt+Xt}function re(t){return t>Gt?t*t*t:Yt*(t-Xt)}function ne(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ie(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function oe(t){var e=ie(t.r),r=ie(t.g),n=ie(t.b),i=ee((.4124564*e+.3575761*r+.1804375*n)/Jt),o=ee((.2126729*e+.7151522*r+.072175*n)/$t);return{l:116*o-16,a:500*(i-o),b:200*(o-ee((.0193339*e+.119192*r+.9503041*n)/Ht)),alpha:t.a}}function ae(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=$t*re(e),r=Jt*re(r),n=Ht*re(n),new Q(ne(3.2404542*r-1.5371385*e-.4985314*n),ne(-.969266*r+1.8760108*e+.041556*n),ne(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}var se={forward:oe,reverse:ae,interpolate:function(t,e,r){return{l:wt(t.l,e.l,r),a:wt(t.a,e.a,r),b:wt(t.b,e.b,r),alpha:wt(t.alpha,e.alpha,r)}}},ue={forward:function(t){var e=oe(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*te;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*Qt,r=t.c;return ae({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}(t.h,e.h,r),c:wt(t.c,e.c,r),l:wt(t.l,e.l,r),alpha:wt(t.alpha,e.alpha,r)}}},le=Object.freeze({lab:se,hcl:ue});function pe(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function ce(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function he(t){return t}function fe(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function ye(t,e,r,n,i){return fe(typeof r===i?n[r]:void 0,t.default,e.default)}function de(t,e,r){if("number"!==pe(r))return fe(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=ge(t.stops,r);return t.stops[i][1]}function ve(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==pe(r))return fe(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var o=ge(t.stops,r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],u=t.stops[o+1][1],l=_t[e.type]||he;if(t.colorSpace&&"rgb"!==t.colorSpace){var p=le[t.colorSpace];l=function(t,e){return p.reverse(p.interpolate(p.forward(t),p.forward(e),a))};}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return l(r,n,a)}}:l(s,u,a)}function me(t,e,r){return"color"===e.type?r=Q.parse(r):pe(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),fe(r,t.default,e.default)}function ge(t,e){for(var r,n,i=0,o=t.length-1,a=0;i<=o;){if(r=t[a=Math.floor((i+o)/2)][0],n=t[a+1][0],e===r||e>r&&ee&&(o=a-1);}return Math.max(a-1,0)}var xe=function(t,e){var r;this.expression=t,this._warningHistory={},this._defaultValue="color"===(r=e).type&&ce(r.default)?new Q(0,0,0,0):"color"===r.type?Q.parse(r.default)||null:void 0===r.default?null:r.default,"enum"===e.type&&(this._enumValues=e.values);};function be(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Tt}function we(t,e){var r=new gt(Tt,[],function(t){var e={color:Z,string:D,number:U,enum:D,boolean:N};if("array"===t.type)return H(e[t.value]||J,t.length);return e[t.type]||null}(e)),n=r.parse(t);return n?Zt(new xe(n,e)):Kt(r.errors)}xe.prototype.evaluateWithoutErrorHandling=function(t,e){return this._evaluator||(this._evaluator=new ft),this._evaluator.globals=t,this._evaluator.feature=e,this.expression.evaluate(this._evaluator)},xe.prototype.evaluate=function(t,e){this._evaluator||(this._evaluator=new ft),this._evaluator.globals=t,this._evaluator.feature=e;try{var r=this.expression.evaluate(this._evaluator);if(null==r)return this._defaultValue;if(this._enumValues&&!(r in this._enumValues))throw new ot("Expected value to be one of "+Object.keys(this._enumValues).map(function(t){return JSON.stringify(t)}).join(", ")+", but found "+JSON.stringify(r)+" instead.");return r}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var _e=function(t,e){this.kind=t,this._styleExpression=e;};_e.prototype.evaluateWithoutErrorHandling=function(t,e){return this._styleExpression.evaluateWithoutErrorHandling(t,e)},_e.prototype.evaluate=function(t,e){return this._styleExpression.evaluate(t,e)};var Ae=function(t,e,r){this.kind=t,this.zoomStops=r.labels,this._styleExpression=e,r instanceof At&&(this._interpolationType=r.interpolation);};function ke(t,e){if("error"===(t=we(t,e)).result)return t;var r=t.value.expression,n=dt(r);if(!n&&!e["property-function"])return Kt([new j("","property expressions not supported")]);var i=vt(r,["zoom"]);if(!i&&!1===e["zoom-function"])return Kt([new j("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof St)r=t(e.result);else if(e instanceof zt)for(var n=0,i=e.args;nn.maximum?[new F(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function Ce(t){var e,r,n,i=t.valueSpec,o=O(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,u=!s,l="array"===pe(t.value.stops)&&"array"===pe(t.value.stops[0])&&"object"===pe(t.value.stops[0][0]),p=Me({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new F(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;e=e.concat(Ve({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===pe(r)&&0===r.length&&e.push(new F(t.key,r,"array must have at least one stop"));return e},default:function(t){return Ye({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&p.push(new F(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||p.push(new F(t.key,t.value,'missing required property "stops"')),"exponential"===o&&"piecewise-constant"===t.valueSpec.function&&p.push(new F(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!t.valueSpec["property-function"]?p.push(new F(t.key,t.value,"property functions not supported")):s&&!t.valueSpec["zoom-function"]&&"heatmap-color"!==t.objectKey&&"line-gradient"!==t.objectKey&&p.push(new F(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!l||void 0!==t.value.property||p.push(new F(t.key,t.value,'"property" property is required')),p;function c(t){var e=[],o=t.value,s=t.key;if("array"!==pe(o))return[new F(s,o,"array expected, "+pe(o)+" found")];if(2!==o.length)return[new F(s,o,"array length 2 expected, length "+o.length+" found")];if(l){if("object"!==pe(o[0]))return[new F(s,o,"object expected, "+pe(o[0])+" found")];if(void 0===o[0].zoom)return[new F(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new F(s,o,"object stop key must have value")];if(n&&n>O(o[0].zoom))return[new F(s,o[0].zoom,"stop zoom values must appear in ascending order")];O(o[0].zoom)!==n&&(n=O(o[0].zoom),r=void 0,a={}),e=e.concat(Me({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Be,value:h}}));}else e=e.concat(h({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return e.concat(Ye({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=pe(t.value),u=O(t.value),l=null!==t.value?t.value:n;if(e){if(s!==e)return[new F(t.key,l,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new F(t.key,l,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var p="number expected, "+s+" found";return i["property-function"]&&void 0===o&&(p+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new F(t.key,l,p)]}return"categorical"!==o||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==o&&"number"===s&&void 0!==r&&u=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&(Array.isArray(t[1])||Array.isArray(t[2]));case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function Le(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?je(t[1],t[2],"=="):"!="===r?Ue(je(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?je(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(Le))):"all"===r?["all"].concat(t.slice(1).map(Le)):"none"===r?["all"].concat(t.slice(1).map(Le).map(Ue)):"in"===r?qe(t[1],t.slice(2)):"!in"===r?Ue(qe(t[1],t.slice(2))):"has"===r?Re(t[1]):"!has"!==r||Ue(Re(t[1]))}function je(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function qe(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(Oe)]]:["filter-in-small",t,["literal",e]]}}function Re(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ue(t){return["!",t]}function De(t){return Fe(L(t.value))?Ie(T({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value;var n=e.key;if("array"!==pe(r))return[new F(n,r,"array expected, "+pe(r)+" found")];var i=e.styleSpec;var o;var a=[];if(r.length<1)return[new F(n,r,"filter array must have at least 1 element")];a=a.concat(Ee({key:n+"[0]",value:r[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec}));switch(O(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===O(r[1])&&a.push(new F(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new F(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(o=pe(r[1]))&&a.push(new F(n+"[1]",r[1],"string expected, "+o+" found"));for(var s=2;s=l[h+0]&&n>=l[h+1]?(a[c]=!0,o.push(u[c])):a[c]=!1;}}},lr.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),u=this._convertToCellCoord(e),l=this._convertToCellCoord(r),p=this._convertToCellCoord(n),c=s;c<=l;c++)for(var h=u;h<=p;h++){var f=this.d*h+c;if(i.call(this,t,e,r,n,f,o,a))return}},lr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},lr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=ur+this.cells.length+1+1,r=0,n=0;n=0)){var c=t[p];l[p]=cr[u].shallow.indexOf(p)>=0?c:yr(c,e);}t instanceof Error&&(l.message=t.message);}return{name:u,properties:l}}throw new Error("can't serialize object of type "+typeof t)}function dr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof pr)return t;if(Array.isArray(t))return t.map(function(t){return dr(t)});if("object"==typeof t){var e=t,r=e.name,n=e.properties;if(!r)throw new Error("can't deserialize object of anonymous class");var i=cr[r].klass;if(!i)throw new Error("can't deserialize unregistered class "+r);if(i.deserialize)return i.deserialize(n._serialized);for(var o=Object.create(i.prototype),a=0,s=Object.keys(n);a=0?n[u]:dr(n[u]);}return o}throw new Error("can't deserialize object of type "+typeof t)}var vr=function(){this.first=!0;};vr.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function gr(t){for(var e=0,r=t;e=65097&&t<=65103)||(!!mr["CJK Compatibility Ideographs"](t)||(!!mr["CJK Compatibility"](t)||(!!mr["CJK Radicals Supplement"](t)||(!!mr["CJK Strokes"](t)||(!(!mr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||(!!mr["CJK Unified Ideographs Extension A"](t)||(!!mr["CJK Unified Ideographs"](t)||(!!mr["Enclosed CJK Letters and Months"](t)||(!!mr["Hangul Compatibility Jamo"](t)||(!!mr["Hangul Jamo Extended-A"](t)||(!!mr["Hangul Jamo Extended-B"](t)||(!!mr["Hangul Jamo"](t)||(!!mr["Hangul Syllables"](t)||(!!mr.Hiragana(t)||(!!mr["Ideographic Description Characters"](t)||(!!mr.Kanbun(t)||(!!mr["Kangxi Radicals"](t)||(!!mr["Katakana Phonetic Extensions"](t)||(!(!mr.Katakana(t)||12540===t)||(!(!mr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||(!(!mr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(!!mr["Unified Canadian Aboriginal Syllabics"](t)||(!!mr["Unified Canadian Aboriginal Syllabics Extended"](t)||(!!mr["Vertical Forms"](t)||(!!mr["Yijing Hexagram Symbols"](t)||(!!mr["Yi Syllables"](t)||!!mr["Yi Radicals"](t))))))))))))))))))))))))))))))}function wr(t){return!(br(t)||function(t){return!!(mr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||mr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||mr["Letterlike Symbols"](t)||mr["Number Forms"](t)||mr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||mr["Control Pictures"](t)&&9251!==t||mr["Optical Character Recognition"](t)||mr["Enclosed Alphanumerics"](t)||mr["Geometric Shapes"](t)||mr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||mr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||mr["CJK Symbols and Punctuation"](t)||mr.Katakana(t)||mr["Private Use Area"](t)||mr["CJK Compatibility Forms"](t)||mr["Small Form Variants"](t)||mr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function _r(t,e){return!(!e&&(t>=1424&&t<=2303||mr["Arabic Presentation Forms-A"](t)||mr["Arabic Presentation Forms-B"](t)))&&!(t>=2304&&t<=3583||t>=3840&&t<=4255||mr.Khmer(t))}var Ar,kr=!1,zr=null,Sr=!1,Mr=new I,Vr={applyArabicShaping:null,processBidirectionalText:null,isLoaded:function(){return Sr||null!=Vr.applyArabicShaping}},Br=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new vr,this.transition={});};Br.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(e=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(i))}return r};var Pr=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);};Pr.prototype.possiblyEvaluate=function(t){for(var e=new Lr(this._properties),r=0,n=Object.keys(this._values);rn.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:o+(1-o)*a}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-a)*o}},Rr.prototype.interpolate=function(t){return t};var Ur=function(t){this.specification=t;};Ur.prototype.possiblyEvaluate=function(t,e){return!!t.expression.evaluate(e)},Ur.prototype.interpolate=function(){return!1};var Dr=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var r=t[e],n=this.defaultPropertyValues[e]=new Cr(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Ir(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}};hr("DataDrivenProperty",qr),hr("DataConstantProperty",jr),hr("CrossFadedProperty",Rr),hr("ColorRampProperty",Ur);var Nr=function(t){function e(e,r){for(var n in t.call(this),this.id=e.id,this.metadata=e.metadata,this.type=e.type,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.visibility="visible","background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),this._featureFilter=function(){return!0},r.layout&&(this._unevaluatedLayout=new Tr(r.layout)),this._transitionablePaint=new Er(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned();}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".layout."+t;if(this._validate(or,n,t,e,r))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility="none"===e?e:"visible";},e.prototype.getPaintProperty=function(t){return d(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".paint."+t;if(this._validate(ir,n,t,e,r))return}d(t,"-transition")?this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0):this._transitionablePaint.setValue(t,e);},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility)},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t);},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),m(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,n,i){return(!i||!1!==i.validate)&&ar(this,t.call(rr,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:E,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e}(I),Zr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Kr=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;},Jr=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0);};function $r(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map(function(t){var i,o=(i=t.type,Zr[i].BYTES_PER_ELEMENT),a=r=Hr(r,Math.max(e,o)),s=t.components||1;return n=Math.max(n,o),r+=o*s,{name:t.name,type:t.type,components:s,offset:a}}),size:Hr(r,Math.max(n,e)),alignment:e}}function Hr(t,e){return Math.ceil(t/e)*e}Jr.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Jr.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Jr.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());},Jr.prototype.clear=function(){this.length=0;},Jr.prototype.resize=function(t){this.reserve(t),this.length=t;},Jr.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}},Jr.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Xr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.int16[n+0]=t,this.int16[n+1]=e,r},e}(Jr);Xr.prototype.bytesPerElement=4,hr("StructArrayLayout2i4",Xr);var Gr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;this.resize(i+1);var o=4*i;return this.int16[o+0]=t,this.int16[o+1]=e,this.int16[o+2]=r,this.int16[o+3]=n,i},e}(Jr);Gr.prototype.bytesPerElement=8,hr("StructArrayLayout4i8",Gr);var Yr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=i,this.int16[s+5]=o,a},e}(Jr);Yr.prototype.bytesPerElement=12,hr("StructArrayLayout2i4i12",Yr);var Wr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var u=this.length;this.resize(u+1);var l=6*u,p=12*u;return this.int16[l+0]=t,this.int16[l+1]=e,this.int16[l+2]=r,this.int16[l+3]=n,this.uint8[p+8]=i,this.uint8[p+9]=o,this.uint8[p+10]=a,this.uint8[p+11]=s,u},e}(Jr);Wr.prototype.bytesPerElement=12,hr("StructArrayLayout4i4ub12",Wr);var Qr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var u=this.length;this.resize(u+1);var l=8*u;return this.int16[l+0]=t,this.int16[l+1]=e,this.int16[l+2]=r,this.int16[l+3]=n,this.uint16[l+4]=i,this.uint16[l+5]=o,this.uint16[l+6]=a,this.uint16[l+7]=s,u},e}(Jr);Qr.prototype.bytesPerElement=16,hr("StructArrayLayout4i4ui16",Qr);var tn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.float32[i+0]=t,this.float32[i+1]=e,this.float32[i+2]=r,n},e}(Jr);tn.prototype.bytesPerElement=12,hr("StructArrayLayout3f12",tn);var en=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.uint32[r+0]=t,e},e}(Jr);en.prototype.bytesPerElement=4,hr("StructArrayLayout1ul4",en);var rn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,p){var c=this.length;this.resize(c+1);var h=12*c,f=6*c;return this.int16[h+0]=t,this.int16[h+1]=e,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=i,this.int16[h+5]=o,this.uint32[f+3]=a,this.uint16[h+8]=s,this.uint16[h+9]=u,this.int16[h+10]=l,this.int16[h+11]=p,c},e}(Jr);rn.prototype.bytesPerElement=24,hr("StructArrayLayout6i1ul2ui2i24",rn);var nn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=i,this.int16[s+5]=o,a},e}(Jr);nn.prototype.bytesPerElement=12,hr("StructArrayLayout2i2i2i12",nn);var on=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=4*r;return this.uint8[n+0]=t,this.uint8[n+1]=e,r},e}(Jr);on.prototype.bytesPerElement=4,hr("StructArrayLayout2ub4",on);var an=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,p,c,h,f){var y=this.length;this.resize(y+1);var d=20*y,v=10*y,m=40*y;return this.int16[d+0]=t,this.int16[d+1]=e,this.uint16[d+2]=r,this.uint16[d+3]=n,this.uint32[v+2]=i,this.uint32[v+3]=o,this.uint32[v+4]=a,this.uint16[d+10]=s,this.uint16[d+11]=u,this.uint16[d+12]=l,this.float32[v+7]=p,this.float32[v+8]=c,this.uint8[m+36]=h,this.uint8[m+37]=f,y},e}(Jr);an.prototype.bytesPerElement=40,hr("StructArrayLayout2i2ui3ul3ui2f2ub40",an);var sn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.float32[r+0]=t,e},e}(Jr);sn.prototype.bytesPerElement=4,hr("StructArrayLayout1f4",sn);var un=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.int16[i+0]=t,this.int16[i+1]=e,this.int16[i+2]=r,n},e}(Jr);un.prototype.bytesPerElement=6,hr("StructArrayLayout3i6",un);var ln=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=2*n,o=4*n;return this.uint32[i+0]=t,this.uint16[o+2]=e,this.uint16[o+3]=r,n},e}(Jr);ln.prototype.bytesPerElement=8,hr("StructArrayLayout1ul2ui8",ln);var pn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.uint16[i+0]=t,this.uint16[i+1]=e,this.uint16[i+2]=r,n},e}(Jr);pn.prototype.bytesPerElement=6,hr("StructArrayLayout3ui6",pn);var cn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.uint16[n+0]=t,this.uint16[n+1]=e,r},e}(Jr);cn.prototype.bytesPerElement=4,hr("StructArrayLayout2ui4",cn);var hn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.float32[n+0]=t,this.float32[n+1]=e,r},e}(Jr);hn.prototype.bytesPerElement=8,hr("StructArrayLayout2f8",hn);var fn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;this.resize(i+1);var o=4*i;return this.float32[o+0]=t,this.float32[o+1]=e,this.float32[o+2]=r,this.float32[o+3]=n,i},e}(Jr);fn.prototype.bytesPerElement=16,hr("StructArrayLayout4f16",fn);var yn=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t;},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t;},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.x1.set=function(t){this._structArray.int16[this._pos2+2]=t;},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.y1.set=function(t){this._structArray.int16[this._pos2+3]=t;},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.x2.set=function(t){this._structArray.int16[this._pos2+4]=t;},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.y2.set=function(t){this._structArray.int16[this._pos2+5]=t;},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t;},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t;},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t;},r.radius.get=function(){return this._structArray.int16[this._pos2+10]},r.radius.set=function(t){this._structArray.int16[this._pos2+10]=t;},r.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},r.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t;},r.anchorPoint.get=function(){return new s(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Kr);yn.prototype.size=24;var dn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new yn(this,t)},e}(rn);hr("CollisionBoxArray",dn);var vn=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},hidden:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t;},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t;},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t;},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t;},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t;},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t;},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t;},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t;},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t;},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t;},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t;},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t;},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t;},r.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t;},Object.defineProperties(e.prototype,r),e}(Kr);vn.prototype.size=40;var mn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new vn(this,t)},e}(an);hr("PlacedSymbolArray",mn);var gn=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={offsetX:{configurable:!0}};return r.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},r.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t;},Object.defineProperties(e.prototype,r),e}(Kr);gn.prototype.size=4;var xn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new gn(this,t)},e}(sn);hr("GlyphOffsetArray",xn);var bn=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return r.x.get=function(){return this._structArray.int16[this._pos2+0]},r.x.set=function(t){this._structArray.int16[this._pos2+0]=t;},r.y.get=function(){return this._structArray.int16[this._pos2+1]},r.y.set=function(t){this._structArray.int16[this._pos2+1]=t;},r.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},r.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t;},Object.defineProperties(e.prototype,r),e}(Kr);bn.prototype.size=6;var wn=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new bn(this,t)},e}(un);hr("SymbolLineVertexArray",wn);var _n=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t;},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t;},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t;},Object.defineProperties(e.prototype,r),e}(Kr);_n.prototype.size=8;var An=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new _n(this,t)},e}(ln);hr("FeatureIndexArray",An);var kn=$r([{name:"a_pos",components:2,type:"Int16"}],4).members,zn=function(t){void 0===t&&(t=[]),this.segments=t;};zn.prototype.prepareSegment=function(t,e,r){var n=this.segments[this.segments.length-1];return t>zn.MAX_VERTEX_ARRAY_LENGTH&&b("Max vertices per segment is "+zn.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!n||n.vertexLength+t>zn.MAX_VERTEX_ARRAY_LENGTH)&&(n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(n)),n},zn.prototype.get=function(){return this.segments},zn.prototype.destroy=function(){for(var t=0,e=this.segments;tOn.max||a.yOn.max)&&b("Geometry exceeds allowed extent, reduce your vector tile buffer size");}return r}function jn(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}var qn=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new Xr,this.indexArray=new pn,this.segments=new zn,this.programConfigurations=new En(kn,t.layers,t.zoom);};function Rn(t,e,r){for(var n=0;n=3)for(var s=0;s1){if(Zn(t,e))return!0;for(var n=0;n1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function Hn(t,e){for(var r,n,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function Xn(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r);}return r}function Gn(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].statistics.max}function Yn(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Wn(t,e,r,n,i){if(!e[0]&&!e[1])return t;var o=s.convert(e);"viewport"===r&&o._rotate(-n);for(var a=[],u=0;u=Pn||u<0||u>=Pn)){var l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),p=l.vertexLength;jn(this.layoutVertexArray,s,u,-1,-1),jn(this.layoutVertexArray,s,u,1,-1),jn(this.layoutVertexArray,s,u,1,1),jn(this.layoutVertexArray,s,u,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),l.vertexLength+=4,l.primitiveLength+=2;}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t);},hr("CircleBucket",qn,{omit:["layers"]});var Qn={paint:new Dr({"circle-radius":new qr(E.paint_circle["circle-radius"]),"circle-color":new qr(E.paint_circle["circle-color"]),"circle-blur":new qr(E.paint_circle["circle-blur"]),"circle-opacity":new qr(E.paint_circle["circle-opacity"]),"circle-translate":new jr(E.paint_circle["circle-translate"]),"circle-translate-anchor":new jr(E.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new jr(E.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new jr(E.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new qr(E.paint_circle["circle-stroke-width"]),"circle-stroke-color":new qr(E.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new qr(E.paint_circle["circle-stroke-opacity"])})},ti=n(function(t,e){var r;t.exports=((r=new Float32Array(3))[0]=0,r[1]=0,r[2]=0,function(){var t=new Float32Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=0;}(),{vec3:{transformMat3:function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}},vec4:{transformMat4:function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}},mat2:{create:function(){var t=new Float32Array(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},rotate:function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=i*u+a*s,t[2]=n*-s+o*u,t[3]=i*-s+a*u,t},scale:function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],u=r[1];return t[0]=n*s,t[1]=i*s,t[2]=o*u,t[3]=a*u,t}},mat3:{create:function(){var t=new Float32Array(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},fromRotation:function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}},mat4:{create:function(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},translate:function(t,e,r){var n,i,o,a,s,u,l,p,c,h,f,y,d=r[0],v=r[1],m=r[2];return e===t?(t[12]=e[0]*d+e[4]*v+e[8]*m+e[12],t[13]=e[1]*d+e[5]*v+e[9]*m+e[13],t[14]=e[2]*d+e[6]*v+e[10]*m+e[14],t[15]=e[3]*d+e[7]*v+e[11]*m+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],p=e[7],c=e[8],h=e[9],f=e[10],y=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=l,t[7]=p,t[8]=c,t[9]=h,t[10]=f,t[11]=y,t[12]=n*d+s*v+c*m+e[12],t[13]=i*d+u*v+h*m+e[13],t[14]=o*d+l*v+f*m+e[14],t[15]=a*d+p*v+y*m+e[15]),t},scale:function(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},multiply:function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],p=e[7],c=e[8],h=e[9],f=e[10],y=e[11],d=e[12],v=e[13],m=e[14],g=e[15],x=r[0],b=r[1],w=r[2],_=r[3];return t[0]=x*n+b*s+w*c+_*d,t[1]=x*i+b*u+w*h+_*v,t[2]=x*o+b*l+w*f+_*m,t[3]=x*a+b*p+w*y+_*g,x=r[4],b=r[5],w=r[6],_=r[7],t[4]=x*n+b*s+w*c+_*d,t[5]=x*i+b*u+w*h+_*v,t[6]=x*o+b*l+w*f+_*m,t[7]=x*a+b*p+w*y+_*g,x=r[8],b=r[9],w=r[10],_=r[11],t[8]=x*n+b*s+w*c+_*d,t[9]=x*i+b*u+w*h+_*v,t[10]=x*o+b*l+w*f+_*m,t[11]=x*a+b*p+w*y+_*g,x=r[12],b=r[13],w=r[14],_=r[15],t[12]=x*n+b*s+w*c+_*d,t[13]=x*i+b*u+w*h+_*v,t[14]=x*o+b*l+w*f+_*m,t[15]=x*a+b*p+w*y+_*g,t},perspective:function(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},rotateX:function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],u=e[7],l=e[8],p=e[9],c=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+l*n,t[5]=a*i+p*n,t[6]=s*i+c*n,t[7]=u*i+h*n,t[8]=l*i-o*n,t[9]=p*i-a*n,t[10]=c*i-s*n,t[11]=h*i-u*n,t},rotateZ:function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],u=e[3],l=e[4],p=e[5],c=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+l*n,t[1]=a*i+p*n,t[2]=s*i+c*n,t[3]=u*i+h*n,t[4]=l*i-o*n,t[5]=p*i-a*n,t[6]=c*i-s*n,t[7]=h*i-u*n,t},invert:function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7],p=e[8],c=e[9],h=e[10],f=e[11],y=e[12],d=e[13],v=e[14],m=e[15],g=r*s-n*a,x=r*u-i*a,b=r*l-o*a,w=n*u-i*s,_=n*l-o*s,A=i*l-o*u,k=p*d-c*y,z=p*v-h*y,S=p*m-f*y,M=c*v-h*d,V=c*m-f*d,B=h*m-f*v,C=g*B-x*V+b*M+w*S-_*z+A*k;return C?(C=1/C,t[0]=(s*B-u*V+l*M)*C,t[1]=(i*V-n*B-o*M)*C,t[2]=(d*A-v*_+m*w)*C,t[3]=(h*_-c*A-f*w)*C,t[4]=(u*S-a*B-l*z)*C,t[5]=(r*B-i*S+o*z)*C,t[6]=(v*b-y*A-m*x)*C,t[7]=(p*A-h*b+f*x)*C,t[8]=(a*V-s*S+l*k)*C,t[9]=(n*S-r*V-o*k)*C,t[10]=(y*_-d*b+m*g)*C,t[11]=(c*b-p*_-f*g)*C,t[12]=(s*z-a*M-u*k)*C,t[13]=(r*M-n*z+i*k)*C,t[14]=(d*x-y*w-v*g)*C,t[15]=(p*w-c*x+h*g)*C,t):null},ortho:function(t,e,r,n,i,o,a){var s=1/(e-r),u=1/(n-i),l=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(a+o)*l,t[15]=1,t}}});}),ei=(ti.vec3,ti.vec4),ri=(ti.mat2,ti.mat3,ti.mat4),ni=function(t){function e(e){t.call(this,e,Qn);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new qn(t)},e.prototype.queryRadius=function(t){var e=t;return Gn("circle-radius",this,e)+Gn("circle-stroke-width",this,e)+Yn(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a){for(var s=Wn(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),i.angle,o),u=this.paint.get("circle-radius").evaluate(e)+this.paint.get("circle-stroke-width").evaluate(e),l="map"===this.paint.get("circle-pitch-alignment"),p=l?s:function(t,e,r){return t.map(function(t){return t.map(function(t){return ii(t,e,r)})})}(s,a,i),c=l?u*o:u,h=0,f=r;ht.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,u=0;u80*r){n=o=t[0],i=a=t[1];for(var y=r;yo&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0;}return _i(h,f,r,n,i,l),f}function bi(t,e,r,n,i){var o,a;if(i===Ui(t,e,r,n)>0)for(o=e;o=e;o-=n)a=ji(o,t[o],t[o+1],a);return a&&Pi(a,a.next)&&(qi(a),a=a.next),a}function wi(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Pi(n,n.next)&&0!==Fi(n.prev,n,n.next))n=n.next;else{if(qi(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function _i(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Bi(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n;}o.nextZ=null,l*=2;}while(a>1)}(i);}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?ki(t,n,i,o):Ai(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),qi(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?_i(t=zi(t,e,r),e,r,n,i,o,2):2===a&&Si(t,e,r,n,i,o):_i(wi(t),e,r,n,i,o,1);break}}}function Ai(t){var e=t.prev,r=t,n=t.next;if(Fi(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Ii(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Fi(i.prev,i,i.next)>=0)return!1;i=i.next;}return!0}function ki(t,e,r,n){var i=t.prev,o=t,a=t.next;if(Fi(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,p=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,c=Bi(s,u,e,r,n),h=Bi(l,p,e,r,n),f=t.prevZ,y=t.nextZ;f&&f.z>=c&&y&&y.z<=h;){if(f!==t.prev&&f!==t.next&&Ii(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Fi(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,y!==t.prev&&y!==t.next&&Ii(i.x,i.y,o.x,o.y,a.x,a.y,y.x,y.y)&&Fi(y.prev,y,y.next)>=0)return!1;y=y.nextZ;}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&Ii(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Fi(f.prev,f,f.next)>=0)return!1;f=f.prevZ;}for(;y&&y.z<=h;){if(y!==t.prev&&y!==t.next&&Ii(i.x,i.y,o.x,o.y,a.x,a.y,y.x,y.y)&&Fi(y.prev,y,y.next)>=0)return!1;y=y.nextZ;}return!0}function zi(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Pi(i,o)&&Ti(i,n,n.next,o)&&Oi(i,o)&&Oi(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),qi(n),qi(n.next),n=t=o),n=n.next;}while(n!==t);return n}function Si(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Ei(a,s)){var u=Li(a,s);return a=wi(a,a.next),u=wi(u,u.next),_i(a,e,r,n,i,o),void _i(u,e,r,n,i,o)}s=s.next;}a=a.next;}while(a!==t)}function Mi(t,e){return t.x-e.x}function Vi(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=p&&i!==n.x&&Ii(or.x)&&Oi(n,t)&&(r=n,h=u),n=n.next;return r}(t,e)){var r=Li(e,t);wi(r,r.next);}}function Bi(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ci(t){var e=t,r=t;do{e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function Ei(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ti(r,r.next,t,e))return!0;r=r.next;}while(r!==t);return!1}(t,e)&&Oi(t,e)&&Oi(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)}function Fi(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Pi(t,e){return t.x===e.x&&t.y===e.y}function Ti(t,e,r,n){return!!(Pi(t,e)&&Pi(r,n)||Pi(t,n)&&Pi(r,e))||Fi(t,e,r)>0!=Fi(t,e,n)>0&&Fi(r,n,t)>0!=Fi(r,n,e)>0}function Oi(t,e){return Fi(t.prev,t,t.next)<0?Fi(t,e,t.next)>=0&&Fi(t,t.prev,e)>=0:Fi(t,e,t.prev)<0||Fi(t,t.next,e)<0}function Li(t,e){var r=new Ri(t.i,t.x,t.y),n=new Ri(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function ji(t,e,r,n){var i=new Ri(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function qi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function Ri(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function Ui(t,e,r,n){for(var i=0,o=e,a=r-n;o0&&(n+=t[i-1].length,r.holes.push(n));}return r},mi.default=gi;var Di=Zi,Ni=Zi;function Zi(t,e,r,n,i){!function t(e,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,u=Math.log(a),l=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*l*(a-l)/a)*(s-a/2<0?-1:1),c=Math.max(n,Math.floor(r-s*l/a+p)),h=Math.min(i,Math.floor(r+(a-s)*l/a+p));t(e,r,c,h,o);}var f=e[r],y=n,d=i;for(Ki(e,n,r),o(e[i],f)>0&&Ki(e,n,i);y0;)d--;}0===o(e[n],f)?Ki(e,n,d):Ki(e,++d,i),d<=r&&(n=d+1),r<=d&&(i=d-1);}}(t,e,r||0,n||t.length-1,i||Ji);}function Ki(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function Ji(t,e){return te?1:0}function $i(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a1)for(var u=0;uPn)||t.y===e.y&&(t.y<0||t.y>Pn)}function no(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>Pn})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>Pn})}eo.prototype.populate=function(t,e){for(var r=0,n=t;r=1){var d=c[f-1];if(!ro(y,d)){u.vertexLength+4>zn.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var v=y.sub(d)._perp()._unit(),m=d.dist(y);h+m>32768&&(h=0),to(this.layoutVertexArray,y.x,y.y,v.x,v.y,0,0,h),to(this.layoutVertexArray,y.x,y.y,v.x,v.y,0,1,h),h+=m,to(this.layoutVertexArray,d.x,d.y,v.x,v.y,0,0,h),to(this.layoutVertexArray,d.x,d.y,v.x,v.y,0,1,h);var g=u.vertexLength;this.indexArray.emplaceBack(g,g+1,g+2),this.indexArray.emplaceBack(g+1,g+2,g+3),u.vertexLength+=4,u.primitiveLength+=2;}}}}u.vertexLength+o>zn.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(o,this.layoutVertexArray,this.indexArray));for(var x=[],b=[],w=u.vertexLength,_=0,A=i;_>3;}if(i--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new s(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone());}}return e&&u.push(e),u},uo.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,l=-1/0;t.pos>3;}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(o+=t.readSVarint())l&&(l=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,u,s,l]},uo.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,u=this.loadGeometry(),l=uo.types[this.type];function p(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}function yo(t,e,r){if(3===t){var n=new co(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}ho.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new so(this._pbf,e,this.extent,this._keys,this._values)};var vo={VectorTile:function(t,e){this.layers=t.readFields(yo,{},e);},VectorTileFeature:so,VectorTileLayer:co},mo=vo.VectorTileFeature.types,go=63,xo=Math.cos(Math.PI/180*37.5),bo=.5,wo=Math.pow(2,14)/bo;function _o(t,e,r,n,i,o,a){t.emplaceBack(e.x,e.y,n?1:0,i?1:-1,Math.round(go*r.x)+128,Math.round(go*r.y)+128,1+(0===o?0:o<0?-1:1)|(a*bo&63)<<2,a*bo>>6);}var Ao=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new Wr,this.indexArray=new pn,this.programConfigurations=new En(ao,t.layers,t.zoom),this.segments=new zn;};function ko(t,e){return(t/e.tileTotal*(e.end-e.start)+e.start)*(wo-1)}Ao.prototype.populate=function(t,e){for(var r=0,n=t;r=2&&t[u-1].equals(t[u-2]);)u--;for(var l=0;ll){var V=f.dist(x);if(V>2*p){var B=f.sub(f.sub(x)._mult(p/V)._round());this.distance+=B.dist(x),this.addCurrentVertex(B,this.distance,w.mult(1),0,0,!1,h,a),x=B;}}var C=x&&b,I=C?r:b?v:m;if(C&&"round"===I&&(Si&&(I="bevel"),"bevel"===I&&(S>2&&(I="flipbevel"),S100)k=_.clone().mult(-1);else{var E=w.x*_.y-w.y*_.x>0?-1:1,F=S*w.add(_).mag()/w.sub(_).mag();k._perp()._mult(F*E);}this.addCurrentVertex(f,this.distance,k,0,0,!1,h,a),this.addCurrentVertex(f,this.distance,k.mult(-1),0,0,!1,h,a);}else if("bevel"===I||"fakeround"===I){var P=w.x*_.y-w.y*_.x>0,T=-Math.sqrt(S*S-1);if(P?(d=0,y=T):(y=0,d=T),g||this.addCurrentVertex(f,this.distance,w,y,d,!1,h,a),"fakeround"===I){for(var O=Math.floor(8*(.5-(z-.5))),L=void 0,j=0;j=0;q--)L=w.mult((q+1)/(O+1))._add(_)._unit(),this.addPieSliceVertex(f,this.distance,L,P,h,a);}b&&this.addCurrentVertex(f,this.distance,_,-y,-d,!1,h,a);}else"butt"===I?(g||this.addCurrentVertex(f,this.distance,w,0,0,!1,h,a),b&&this.addCurrentVertex(f,this.distance,_,0,0,!1,h,a)):"square"===I?(g||(this.addCurrentVertex(f,this.distance,w,1,1,!1,h,a),this.e1=this.e2=-1),b&&this.addCurrentVertex(f,this.distance,_,-1,-1,!1,h,a)):"round"===I&&(g||(this.addCurrentVertex(f,this.distance,w,0,0,!1,h,a),this.addCurrentVertex(f,this.distance,w,1,1,!0,h,a),this.e1=this.e2=-1),b&&(this.addCurrentVertex(f,this.distance,_,-1,-1,!0,h,a),this.addCurrentVertex(f,this.distance,_,0,0,!1,h,a)));if(M&&A2*p){var U=f.add(b.sub(f)._mult(p/R)._round());this.distance+=U.dist(f),this.addCurrentVertex(U,this.distance,_.mult(1),0,0,!1,h,a),f=U;}}g=!1;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e);}},Ao.prototype.addCurrentVertex=function(t,e,r,n,i,o,a,s){var u,l=this.layoutVertexArray,p=this.indexArray;s&&(e=ko(e,s)),u=r.clone(),n&&u._sub(r.perp()._mult(n)),_o(l,t,u,o,!1,n,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(p.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,u=r.mult(-1),i&&u._sub(r.perp()._mult(i)),_o(l,t,u,o,!0,-i,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(p.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>wo/2&&!s&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,o,a));},Ao.prototype.addPieSliceVertex=function(t,e,r,n,i,o){r=r.mult(n?-1:1);var a=this.layoutVertexArray,s=this.indexArray;o&&(e=ko(e,o)),_o(a,t,r,!1,n,0,e),this.e3=i.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),i.primitiveLength++),n?this.e2=this.e3:this.e1=this.e3;},hr("LineBucket",Ao,{omit:["layers"]});var zo=new Dr({"line-cap":new jr(E.layout_line["line-cap"]),"line-join":new qr(E.layout_line["line-join"]),"line-miter-limit":new jr(E.layout_line["line-miter-limit"]),"line-round-limit":new jr(E.layout_line["line-round-limit"])}),So={paint:new Dr({"line-opacity":new qr(E.paint_line["line-opacity"]),"line-color":new qr(E.paint_line["line-color"]),"line-translate":new jr(E.paint_line["line-translate"]),"line-translate-anchor":new jr(E.paint_line["line-translate-anchor"]),"line-width":new qr(E.paint_line["line-width"]),"line-gap-width":new qr(E.paint_line["line-gap-width"]),"line-offset":new qr(E.paint_line["line-offset"]),"line-blur":new qr(E.paint_line["line-blur"]),"line-dasharray":new Rr(E.paint_line["line-dasharray"]),"line-pattern":new Rr(E.paint_line["line-pattern"]),"line-gradient":new Ur(E.paint_line["line-gradient"])}),layout:zo},Mo=new(function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new Br(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n){return r=h({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n)},e}(qr))(So.paint.properties["line-width"].specification);Mo.useIntegerZoom=!0;var Vo=function(t){function e(e){t.call(this,e,So);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPaintProperty=function(e,r,n){t.prototype.setPaintProperty.call(this,e,r,n),"line-gradient"===e&&this._updateGradient();},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=hi(t,"lineProgress"),this.gradientTexture=null;},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Mo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e);},e.prototype.createBucket=function(t){return new Ao(t)},e.prototype.queryRadius=function(t){var e=t,r=Bo(Gn("line-width",this,e),Gn("line-gap-width",this,e)),n=Gn("line-offset",this,e);return r/2+Math.abs(n)+Yn(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var a=Wn(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),i.angle,o),u=o/2*Bo(this.paint.get("line-width").evaluate(e),this.paint.get("line-gap-width").evaluate(e)),l=this.paint.get("line-offset").evaluate(e);return l&&(r=function(t,e){for(var r=[],n=new s(0,0),i=0;i0?e+2*t:t}var Co=$r([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),Io=$r([{name:"a_projected_pos",components:3,type:"Float32"}],4),Eo=($r([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),$r([{name:"a_placed",components:2,type:"Uint8"}],4)),Fo=($r([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),$r([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Po=$r([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);$r([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),$r([{type:"Float32",name:"offsetX"}]),$r([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);function To(t,e,r){var n=e.layout.get("text-transform").evaluate(r);return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Vr.applyArabicShaping&&(t=Vr.applyArabicShaping(t)),t}var Oo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Lo=function(t){function e(e,r,n,i){t.call(this,e,r),this.angle=n,void 0!==i&&(this.segment=i);}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(s);function jo(t,e){var r=e.expression;if("constant"===r.kind)return{functionType:"constant",layoutSize:r.evaluate(new Br(t+1))};if("source"===r.kind)return{functionType:"source"};for(var n=r.zoomStops,i=0;i0)&&("constant"!==i.value.kind||i.value.value.length>0),u="constant"!==a.value.kind||a.value.value&&a.value.value.length>0;if(this.features=[],s||u){for(var l=e.iconDependencies,p=e.glyphDependencies,c=new Br(this.zoom),h=0,f=t;h=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u0;this.addCollisionDebugVertices(s,u,l,p,c?this.collisionCircle:this.collisionBox,a.anchorPoint,r,c);}}}},Ko.prototype.deserializeCollisionBoxes=function(t,e,r,n,i){for(var o={},a=e;a0},Ko.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Ko.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},Ko.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},Ko.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],n=0;ni.maxh||t>i.maxw||r<=i.maxh&&t<=i.maxw&&(a=i.maxw*i.maxh-t*r)o.free)){if(r===o.h)return this.allocShelf(s,t,r,n);r>o.h||rp)&&(c=2*Math.max(t,p)),(uu)&&(l=2*Math.max(r,u)),this.resize(c,l),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var i=this.freebins.splice(t,1)[0];return i.id=n,i.w=e,i.h=r,i.refcount=0,this.bins[n]=i,this.ref(i),i},t.prototype.allocShelf=function(t,e,r,n){var i=this.shelves[t].alloc(e,r,n);return this.bins[n]=i,this.ref(i),i},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,new function(t,e,r,n,i,o,a){this.id=t,this.x=e,this.y=r,this.w=n,this.h=i,this.maxw=o||n,this.maxh=a||i,this.refcount=0;}(r,n,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}();}),ta=function(t,e){var r=e.pixelRatio;this.paddedRect=t,this.pixelRatio=r;},ea={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};ea.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},ea.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},ea.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(ta.prototype,ea);var ra=function(t){var e=new pi({width:0,height:0}),r={},n=new Qo(0,0,{autoResize:!0});for(var i in t){var o=t[i],a=n.packOne(o.data.width+2,o.data.height+2);e.resize({width:n.w,height:n.h}),pi.copy(o.data,e,{x:0,y:0},{x:a.x+1,y:a.y+1},o.data),r[i]=new ta(a,o);}n.shrink(),e.resize({width:n.w,height:n.h}),this.image=e,this.positions=r;};hr("ImagePosition",ta),hr("ImageAtlas",ra);var na=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,p=-7,c=r?i-1:0,h=r?-1:1,f=t[e+c];for(c+=h,o=f&(1<<-p)-1,f>>=-p,p+=s;p>0;o=256*o+t[e+c],c+=h,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=n;p>0;a=256*a+t[e+c],c+=h,p-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l;}return(f?-1:1)*a*Math.pow(2,o-n)},ia=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,p=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=p?(s=0,a=p):a+c>=1?(s=(e*u-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=y,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=y,a/=256,l-=8);t[r+f-y]|=128*d;},oa=aa;function aa(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}aa.Varint=0,aa.Fixed64=1,aa.Bytes=2,aa.Fixed32=5;function sa(t){return t.type===aa.Bytes?t.readVarint()+t.pos:t.pos+1}function ua(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function la(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function pa(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function wa(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}aa.prototype={destroy:function(){this.buf=null;},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=xa(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=wa(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=xa(this.buf,this.pos)+4294967296*xa(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=xa(this.buf,this.pos)+4294967296*wa(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=na(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=na(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return ua(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return ua(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return ua(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return ua(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return ua(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return ua(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){var n="",i=e;for(;i239?4:u>223?3:u>191?2:1;if(i+p>r)break;1===p?u<128&&(l=u):2===p?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===p?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((l=(15&u)<<12|(63&o)<<6|63&a)<=2047||l>=55296&&l<=57343)&&(l=null)):4===p&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,p=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=p;}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=sa(this);for(t=t||[];this.pos127;);else if(e===aa.Bytes)this.pos=this.readVarint()+this.pos;else if(e===aa.Fixed32)this.pos+=4;else{if(e!==aa.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t;}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t;}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&la(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),ia(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),ia(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&la(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,aa.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){this.writeMessage(t,pa,e);},writePackedSVarint:function(t,e){this.writeMessage(t,ca,e);},writePackedBoolean:function(t,e){this.writeMessage(t,ya,e);},writePackedFloat:function(t,e){this.writeMessage(t,ha,e);},writePackedDouble:function(t,e){this.writeMessage(t,fa,e);},writePackedFixed32:function(t,e){this.writeMessage(t,da,e);},writePackedSFixed32:function(t,e){this.writeMessage(t,va,e);},writePackedFixed64:function(t,e){this.writeMessage(t,ma,e);},writePackedSFixed64:function(t,e){this.writeMessage(t,ga,e);},writeBytesField:function(t,e){this.writeTag(t,aa.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,aa.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,aa.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,aa.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,aa.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,aa.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,aa.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,aa.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,aa.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,aa.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};var _a=3;function Aa(t,e,r){1===t&&r.readMessage(ka,e);}function ka(t,e,r){if(3===t){var n=r.readMessage(za,{}),i=n.id,o=n.bitmap,a=n.width,s=n.height,u=n.left,l=n.top,p=n.advance;e.push({id:i,bitmap:new li({width:a+2*_a,height:s+2*_a},o),metrics:{width:a,height:s,left:u,top:l,advance:p}});}}function za(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}var Sa=_a,Ma=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,y(["receive"],this),this.target.addEventListener("message",this.receive,!1);};Ma.prototype.send=function(t,e,r,n){var i=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[i]=r);var o=[];this.target.postMessage({targetMapId:n,sourceMapId:this.mapId,type:t,id:String(i),data:yr(e,o)},o);},Ma.prototype.receive=function(t){var e,r=this,n=t.data,i=n.id;if(!n.targetMapId||this.mapId===n.targetMapId){var o=function(t,e){var n=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(i),error:t?yr(t):null,data:yr(e,n)},n);};if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e&&n.error?e(dr(n.error)):e&&e(null,dr(n.data));else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.sourceMapId,dr(n.data),o);else if(void 0!==n.id&&this.parent.getWorkerSource){var a=n.type.split(".");this.parent.getWorkerSource(n.sourceMapId,a[0],a[1])[a[2]](dr(n.data),o);}else this.parent[n.type](dr(n.data));}},Ma.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1);};var Va=r(n(function(t,e){!function(t){function e(t,e,n){e=Math.pow(2,n)-e-1;var i=r(256*t,256*e,n),o=r(256*(t+1),256*(e+1),n);return i[0]+","+i[1]+","+o[0]+","+o[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}t.getURL=function(t,r,n,i,o,a){return a=a||{},t+"?"+["bbox="+e(n,i,o),"format="+(a.format||"image/png"),"service="+(a.service||"WMS"),"version="+(a.version||"1.1.1"),"request="+(a.request||"GetMap"),"srs="+(a.srs||"EPSG:3857"),"width="+(a.width||256),"height="+(a.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0});}(e);})),Ba=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Ea(0,t,e,r);};Ba.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Ba.prototype.url=function(t,e){var r=Va.getTileBBox(this.x,this.y,this.z),n=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<this.canonical.z?new Ia(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ia(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Ia.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Ia.prototype.children=function(t){if(this.overscaledZ>=t)return[new Ia(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Ia(e,this.wrap,e,r,n),new Ia(e,this.wrap,e,r+1,n),new Ia(e,this.wrap,e,r,n+1),new Ia(e,this.wrap,e,r+1,n+1)]},Ia.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},hr("Level",Fa);var Pa=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new Fa(256,512),this.loaded=!!r;};Pa.prototype.loadFromImage=function(t,e){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");if(e&&"mapbox"!==e&&"terrarium"!==e)return b('"'+e+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');var r=this.level=new Fa(t.width,t.width/2),n=t.data;this._unpackData(r,n,e||"mapbox");for(var i=0;i=0&&u[3]>=0&&this.grid.insert(o,u[0],u[1],u[2],u[3]);}},ja.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new vo.VectorTile(new oa(this.rawTileData)).layers,this.sourceLayerCoder=new Ta(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ja.prototype.query=function(t,e){var r=this;this.loadVTLayers();for(var n=t.params||{},i=Pn/t.tileSize/t.scale,o=Te(n.filter),a=t.queryGeometry,s=t.queryPadding*i,u=1/0,l=1/0,p=-1/0,c=-1/0,h=0;h=0)return!0;return!1}(o,u)){var l=this.sourceLayerCoder.decode(r),p=this.vtLayers[l].feature(n);if(i(new Br(this.tileID.overscaledZ),p))for(var c=0;c=200&&r.status<300&&r.response){var n;try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n);}else 401===r.status&&t.url.match(/mapbox.com/)?e(new k(r.statusText+": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens",r.status,t.url)):e(new k(r.statusText,r.status,t.url));},r.send(),r},t.getImage=function(t,e){return S(t,function(t,r){if(t)e(t);else if(r){var n=new self.Image,i=self.URL||self.webkitURL;n.onload=function(){e(null,n),i.revokeObjectURL(n.src);};var o=new self.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?i.createObjectURL(o):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";}})},t.ResourceType=A,t.RGBAImage=pi,t.default$2=Qo,t.ImagePosition=ta,t.getArrayBuffer=S,t.default$3=function(t){return new oa(t).readFields(Aa,[])},t.default$4=mr,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),i[a]=e,0==--n&&r(o,i);});});},t.AlphaImage=li,t.default$5=E,t.endsWith=d,t.extend=h,t.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},t.Evented=I,t.validateStyle=rr,t.validateLight=nr,t.emitValidationErrors=ar,t.default$6=Q,t.number=wt,t.Properties=Dr,t.Transitionable=Er,t.Transitioning=Pr,t.PossiblyEvaluated=Lr,t.DataConstantProperty=jr,t.warnOnce=b,t.uniqueId=function(){return f++},t.default$7=Ma,t.pick=function(t,e){for(var r={},n=0;n@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r;}return e},t.default$11=ja,t.default$12=Oa,t.default$13=Te,t.default$14=Ko,t.CollisionBoxArray=dn,t.default$15=zn,t.TriangleIndexArray=pn,t.default$16=Br,t.default$17=a,t.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},t.default$18=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.mat4=ri,t.vec4=ei,t.getSizeData=jo,t.evaluateSizeForFeature=function(t,e,r){var n=e;return"source"===t.functionType?r.lowerSize/10:"composite"===t.functionType?wt(r.lowerSize/10,r.upperSize/10,n.uSizeT):n.uSize},t.evaluateSizeForZoom=function(t,e,r){if("constant"===t.functionType)return{uSizeT:0,uSize:t.layoutSize};if("source"===t.functionType)return{uSizeT:0,uSize:0};if("camera"===t.functionType){var n=t.propertyValue,i=t.zoomRange,o=t.sizeRange,a=c(Se(n,r.specification).interpolationFactor(e,i.min,i.max),0,1);return{uSizeT:0,uSize:o.min+a*(o.max-o.min)}}var s=t.propertyValue,u=t.zoomRange;return{uSizeT:c(Se(s,r.specification).interpolationFactor(e,u.min,u.max),0,1),uSize:0}},t.addDynamicAttributes=Do,t.default$19=$o,t.WritingMode=Ra,t.multiPolygonIntersectsBufferedPoint=Rn,t.multiPolygonIntersectsMultiPolygon=Un,t.multiPolygonIntersectsBufferedMultiLine=Dn,t.polygonIntersectsPolygon=function(t,e){for(var r=0;r-i/2;){if(--a<0)return!1;s-=e[a].dist(o),o=e[a];}s+=e[a].dist(e[a+1]),a++;for(var l=[],u=0;sr;)u-=l.shift().angleDelta;if(u>n)return!1;a++,s+=c.dist(f);}return!0}function o(t,i,r,o,a,s,l,u,h){var c=o?.6*s*l:0,f=Math.max(o?o.right-o.left:0,a?a.right-a.left:0),p=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return i-f*l=0&&_=0&&I=0&&v+f<=p){var z=new e.default$25(_,I,M,m);z._round(),a&&!n(i,z,l,a,s)||y.push(z);}}g+=S;}h||y.length||u||(y=t(i,g/2,o,a,s,l,u,!0,c));return y}(t,p?i/2*u%i:(f/2+2*s)*l*u%i,i,c,r,f*l,p,!1,h)}r.prototype.replace=function(e){this._layerConfigs={},this._layers={},this.update(e,[]);},r.prototype.update=function(t,r){for(var n=this,o=0,a=t;o0&&(g=Math.max(10*s,g),this._addLineCollisionCircles(e,t,i,i.segment,v,g,r,n,o,h));}else e.emplaceBack(i.x,i.y,p,c,d,f,r,n,o,0,0);this.boxEndIndex=e.length;};s.prototype._addLineCollisionCircles=function(e,t,i,r,n,o,a,s,l,u){var h=o/2,c=Math.floor(n/h),f=1+.4*Math.log(u)/Math.LN2,p=Math.floor(c*f/2),d=-o/2,g=i,v=r+1,y=d,m=-n/2,x=m-n/4;do{if(--v<0){if(y>m)return;v=0;break}y-=t[v].dist(g),g=t[v];}while(y>x);for(var w=t[v].dist(t[v+1]),S=-p;Sn&&(b+=M-n),!(b=t.length)return;w=t[v].dist(t[v+1]);}var _=b-y,I=t[v],z=t[v+1].sub(I)._unit()._mult(_)._add(I)._round(),T=Math.abs(b-d)0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i);}function c(e,t){return et?1:0}function f(t,i,r){void 0===i&&(i=1),void 0===r&&(r=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,u=t[0],h=0;ha)&&(a=c.x),(!h||c.y>s)&&(s=c.y);}var f=a-n,g=s-o,v=Math.min(f,g),y=v/2,m=new l(null,p);if(0===v)return new e.default$1(n,o);for(var x=n;xS.d||!S.d)&&(S=b,r&&console.log("found best %d after %d probes",Math.round(1e4*b.d)/1e4,M)),b.max-S.d<=i||(y=b.h/2,m.push(new d(b.p.x-y,b.p.y-y,y,t)),m.push(new d(b.p.x+y,b.p.y-y,y,t)),m.push(new d(b.p.x-y,b.p.y+y,y,t)),m.push(new d(b.p.x+y,b.p.y+y,y,t)),M+=4);}return r&&(console.log("num probes: "+M),console.log("best distance: "+S.d)),S.p}function p(e,t){return t.max-e.max}function d(t,i,r,n){this.p=new e.default$1(t,i),this.h=r,this.d=function(t,i){for(var r=!1,n=1/0,o=0;ot.y!=c.y>t.y&&t.x<(c.x-h.x)*(t.y-h.y)/(c.y-h.y)+h.x&&(r=!r),n=Math.min(n,e.distToSegmentSquared(t,h,c));}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}function g(t,i,r,n,o,a){t.createArrays(),t.symbolInstances=[];var s=512*t.overscaling;t.tilePixelRatio=e.default$8/s,t.compareText={},t.iconsNeedLinear=!1;var l=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,h={};if("composite"===t.textSizeData.functionType){var c=t.textSizeData.zoomRange,f=c.min,p=c.max;h.compositeTextSizes=[u["text-size"].possiblyEvaluate(new e.default$16(f)),u["text-size"].possiblyEvaluate(new e.default$16(p))];}if("composite"===t.iconSizeData.functionType){var d=t.iconSizeData.zoomRange,g=d.min,y=d.max;h.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new e.default$16(g)),u["icon-size"].possiblyEvaluate(new e.default$16(y))];}h.layoutTextSize=u["text-size"].possiblyEvaluate(new e.default$16(t.zoom+1)),h.layoutIconSize=u["icon-size"].possiblyEvaluate(new e.default$16(t.zoom+1)),h.textMaxSize=u["text-size"].possiblyEvaluate(new e.default$16(18));for(var m=24*l.get("text-line-height"),x="map"===l.get("text-rotation-alignment")&&"line"===l.get("symbol-placement"),w=l.get("text-keep-upright"),S=0,M=t.features;S=e.default$8||h.y<0||h.y>=e.default$8||t.symbolInstances.push(function(t,i,r,n,o,l,u,h,c,f,p,d,g,v,m,x,w,S,M,b,_){var I,z,T=t.addToLineVertexArray(i,r),P=0,k=0,L=0,$=n.horizontal?n.horizontal.text:"",D=[];n.horizontal&&(I=new s(u,r,i,h,c,f,n.horizontal,p,d,g,t.overscaling),k+=y(t,i,n.horizontal,l,g,M,v,T,n.vertical?e.WritingMode.horizontal:e.WritingMode.horizontalOnly,D,b,_),n.vertical&&(L+=y(t,i,n.vertical,l,g,M,v,T,e.WritingMode.vertical,D,b,_)));var O=I?I.boxStartIndex:t.collisionBoxArray.length,C=I?I.boxEndIndex:t.collisionBoxArray.length;if(o){var A=function(t,i,r,n,o,a){var s,l,u,h,c=i.image,f=r.layout,p=i.top-1/c.pixelRatio,d=i.left-1/c.pixelRatio,g=i.bottom+1/c.pixelRatio,v=i.right+1/c.pixelRatio;if("none"!==f.get("icon-text-fit")&&o){var y=v-d,m=g-p,x=f.get("text-size").evaluate(a)/24,w=o.left*x,S=o.right*x,M=o.top*x,b=S-w,_=o.bottom*x-M,I=f.get("icon-text-fit-padding")[0],z=f.get("icon-text-fit-padding")[1],T=f.get("icon-text-fit-padding")[2],P=f.get("icon-text-fit-padding")[3],k="width"===f.get("icon-text-fit")?.5*(_-m):0,L="height"===f.get("icon-text-fit")?.5*(b-y):0,$="width"===f.get("icon-text-fit")||"both"===f.get("icon-text-fit")?b:y,D="height"===f.get("icon-text-fit")||"both"===f.get("icon-text-fit")?_:m;s=new e.default$1(w+L-P,M+k-I),l=new e.default$1(w+L+z+$,M+k-I),u=new e.default$1(w+L+z+$,M+k+T+D),h=new e.default$1(w+L-P,M+k+T+D);}else s=new e.default$1(d,p),l=new e.default$1(v,p),u=new e.default$1(v,g),h=new e.default$1(d,g);var O=r.layout.get("icon-rotate").evaluate(a)*Math.PI/180;if(O){var C=Math.sin(O),A=Math.cos(O),E=[A,-C,C,A];s._matMult(E),l._matMult(E),h._matMult(E),u._matMult(E);}return[{tl:s,tr:l,bl:h,br:u,tex:c.paddedRect,writingMode:void 0,glyphOffset:[0,0]}]}(0,o,l,0,n.horizontal,M);z=new s(u,r,i,h,c,f,o,m,x,!1,t.overscaling),P=4*A.length;var E=t.iconSizeData,N=null;"source"===E.functionType?N=[10*l.layout.get("icon-size").evaluate(M)]:"composite"===E.functionType&&(N=[10*_.compositeIconSizes[0].evaluate(M),10*_.compositeIconSizes[1].evaluate(M)]),t.addSymbols(t.icon,A,N,S,w,M,!1,i,T.lineStartIndex,T.lineLength);}var R=z?z.boxStartIndex:t.collisionBoxArray.length,B=z?z.boxEndIndex:t.collisionBoxArray.length;t.glyphOffsetArray.length>=e.default$14.MAX_GLYPHS&&e.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");var F=new a,G=new a;return{key:$,textBoxStartIndex:O,textBoxEndIndex:C,iconBoxStartIndex:R,iconBoxEndIndex:B,textOffset:v,iconOffset:S,anchor:i,line:r,featureIndex:h,feature:M,numGlyphVertices:k,numVerticalGlyphVertices:L,numIconVertices:P,textOpacityState:F,iconOpacityState:G,isDuplicate:!1,placedTextSymbolIndices:D,crossTileID:0}}(t,h,o,r,n,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,w,_,T,g,M,I,P,v,i,l,u));};if("line"===d.get("symbol-placement"))for(var $=0,D=function(t,i,r,n,o){for(var a=[],s=0;s=n&&f.x>=n||(c.x>=n?c=new e.default$1(n,c.y+(f.y-c.y)*((n-c.x)/(f.x-c.x)))._round():f.x>=n&&(f=new e.default$1(n,c.y+(f.y-c.y)*((n-c.x)/(f.x-c.x)))._round()),c.y>=o&&f.y>=o||(c.y>=o?c=new e.default$1(c.x+(f.x-c.x)*((o-c.y)/(f.y-c.y)),o)._round():f.y>=o&&(f=new e.default$1(c.x+(f.x-c.x)*((o-c.y)/(f.y-c.y)),o)._round()),u&&c.equals(u[u.length-1])||(u=[c],a.push(u)),u.push(f)))));}return a}(i.geometry,0,0,e.default$8,e.default$8);$=0;a--)if(r.dist(o[a])0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),e}},peek:function(){return this.data[0]},_up:function(e){for(var t=this.data,i=this.compare,r=t[e];e>0;){var n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n;}t[e]=r;},_down:function(e){for(var t=this.data,i=this.compare,r=this.length>>1,n=t[e];e=0)break;t[e]=s,e=o;}t[e]=n;}},l.default=u;var x=function(t){var i=new e.AlphaImage({width:0,height:0}),r={},n=new e.default$2(0,0,{autoResize:!0});for(var o in t){var a=t[o],s=r[o]={};for(var l in a){var u=a[+l];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var h=n.packOne(u.bitmap.width+2,u.bitmap.height+2);i.resize({width:n.w,height:n.h}),e.AlphaImage.copy(u.bitmap,i,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap),s[l]={rect:h,metrics:u.metrics};}}}n.shrink(),i.resize({width:n.w,height:n.h}),this.image=i,this.positions=r;};e.register("GlyphAtlas",x);var w=function(t){this.tileID=new e.OverscaledTileID(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming;};function S(t,i){for(var r=new e.default$16(i),n=0,o=t;n=z.maxzoom))if("none"!==z.visibility)S(I,o.zoom),(c[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:I,zoom:o.zoom,pixelRatio:o.pixelRatio,overscaling:o.overscaling,collisionBoxArray:o.collisionBoxArray,sourceLayerIndex:y})).populate(m,f),s.bucketLayerIDs.push(I.map(function(e){return e.id}));}}}var T=e.mapObject(f.glyphDependencies,function(e){return Object.keys(e).map(Number)});Object.keys(T).length?r.send("getGlyphs",{uid:this.uid,stacks:T},function(e,t){l||(l=e,u=t,k.call(o));}):u={};var P=Object.keys(f.iconDependencies);function k(){if(l)return n(l);if(u&&h){var t=new x(u),i=new e.default$28(h);for(var r in c){var o=c[r];o instanceof e.default$14&&(S(o.layers,this.zoom),g(o,u,t.positions,h,i.positions,this.showCollisionBoxes));}this.status="done",n(null,{buckets:e.values(c).filter(function(e){return!e.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,iconAtlasImage:i.image});}}P.length?r.send("getImages",{icons:P},function(e,t){l||(l=e,h=t,k.call(o));}):h={},k.call(this);};var M=function(e){return!(!performance||!performance.getEntriesByName)&&performance.getEntriesByName(e)};function b(t,i){var r=e.getArrayBuffer(t.request,function(t,r){t?i(t):r&&i(null,{vectorTile:new e.default$29.VectorTile(new e.default$30(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires});});return function(){r.abort(),i();}}var _=function(e,t,i){this.actor=e,this.layerIndex=t,this.loadVectorData=i||b,this.loading={},this.loaded={};};_.prototype.loadTile=function(t,i){var r=this,n=t.uid;this.loading||(this.loading={});var o=this.loading[n]=new w(t);o.abort=this.loadVectorData(t,function(a,s){if(delete r.loading[n],a||!s)return i(a);var l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);var h={};if(t.request&&t.request.collectResourceTiming){var c=M(t.request.url);c&&(h.resourceTiming=JSON.parse(JSON.stringify(c)));}o.vectorTile=s.vectorTile,o.parse(s.vectorTile,r.layerIndex,r.actor,function(t,r){if(t||!r)return i(t);i(null,e.extend({rawTileData:l.slice(0)},r,u,h));}),r.loaded=r.loaded||{},r.loaded[n]=o;});},_.prototype.reloadTile=function(e,t){var i=this.loaded,r=e.uid,n=this;if(i&&i[r]){var o=i[r];o.showCollisionBoxes=e.showCollisionBoxes;var a=function(e,i){var r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,n.layerIndex,n.actor,r)),t(e,i);};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&o.parse(o.vectorTile,this.layerIndex,this.actor,a);}},_.prototype.abortTile=function(e,t){var i=this.loading,r=e.uid;i&&i[r]&&i[r].abort&&(i[r].abort(),delete i[r]),t();},_.prototype.removeTile=function(e,t){var i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t();};var I=function(){this.loading={},this.loaded={};};I.prototype.loadTile=function(t,i){var r=t.uid,n=t.encoding,o=new e.default$31(r);this.loading[r]=o,o.loadFromImage(t.rawImageData,n),delete this.loading[r],this.loaded=this.loaded||{},this.loaded[r]=o,i(null,o);},I.prototype.removeTile=function(e){var t=this.loaded,i=e.uid;t&&t[i]&&delete t[i];};var z={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function T(e){var t=0;if(e&&e.length>0){t+=Math.abs(P(e[0]));for(var i=1;i2){for(a=0;a=0}(e)===t?e:e.reverse()}var A=e.default$29.VectorTileFeature.prototype.toGeoJSON,E=function(t){this._feature=t,this.extent=e.default$8,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));};E.prototype.loadGeometry=function(){if(1===this._feature.type){for(var t=[],i=0,r=this._feature.geometry;i>31}function Q(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,a=i.length,s=0;sn;){if(o-n>600){var s=o-n+1,l=r-n+1,u=Math.log(s),h=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*h*(s-h)/s)*(l-s/2<0?-1:1),f=Math.max(n,Math.floor(r-l*h/s+c)),p=Math.min(o,Math.floor(r+(s-l)*h/s+c));e(t,i,r,f,p,a);}var d=i[2*r+a],g=n,v=o;for(te(t,i,n,r),i[2*o+a]>d&&te(t,i,n,o);gd;)v--;}i[2*n+a]===d?te(t,i,n,v):te(t,i,++v,o),v<=r&&(n=v+1),r<=v&&(o=v-1);}}(t,i,s,n,o,a%2);e(t,i,r,n,s-1,a+1);e(t,i,r,s+1,o,a+1);};function te(e,t,i,r){ie(e,i,r),ie(t,2*i,2*r),ie(t,2*i+1,2*r+1);}function ie(e,t,i){var r=e[t];e[t]=e[i],e[i]=r;}var re=function(e,t,i,r,n,o,a){var s,l,u=[0,e.length-1,0],h=[];for(;u.length;){var c=u.pop(),f=u.pop(),p=u.pop();if(f-p<=a)for(var d=p;d<=f;d++)s=t[2*d],l=t[2*d+1],s>=i&&s<=n&&l>=r&&l<=o&&h.push(e[d]);else{var g=Math.floor((p+f)/2);s=t[2*g],l=t[2*g+1],s>=i&&s<=n&&l>=r&&l<=o&&h.push(e[g]);var v=(c+1)%2;(0===c?i<=s:r<=l)&&(u.push(p),u.push(g-1),u.push(v)),(0===c?n>=s:o>=l)&&(u.push(g+1),u.push(f),u.push(v));}}return h};var ne=function(e,t,i,r,n,o){var a=[0,e.length-1,0],s=[],l=n*n;for(;a.length;){var u=a.pop(),h=a.pop(),c=a.pop();if(h-c<=o)for(var f=c;f<=h;f++)oe(t[2*f],t[2*f+1],i,r)<=l&&s.push(e[f]);else{var p=Math.floor((c+h)/2),d=t[2*p],g=t[2*p+1];oe(d,g,i,r)<=l&&s.push(e[p]);var v=(u+1)%2;(0===u?i-n<=d:r-n<=g)&&(a.push(c),a.push(p-1),a.push(v)),(0===u?i+n>=d:r+n>=g)&&(a.push(p+1),a.push(h),a.push(v));}}return s};function oe(e,t,i,r){var n=e-i,o=t-r;return n*n+o*o}var ae=function(e,t,i,r,n){return new se(e,t,i,r,n)};function se(e,t,i,r,n){t=t||le,i=i||ue,n=n||Array,this.nodeSize=r||64,this.points=e,this.ids=new n(e.length),this.coords=new n(2*e.length);for(var o=0;o=1e4?Math.round(t/1e3)+"k":t>=1e3?Math.round(t/100)/10+"k":t;return me(me({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:i})}function ve(e){return e/360+.5}function ye(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function me(e,t){for(var i in t)e[i]=t[i];return e}function xe(e){return e.x}function we(e){return e.y}function Se(e,t,i,r,n,o){var a=n-i,s=o-r;if(0!==a||0!==s){var l=((e-i)*a+(t-r)*s)/(a*a+s*s);l>1?(i=n,r=o):l>0&&(i+=a*l,r+=s*l);}return(a=e-i)*a+(s=t-r)*s}function Me(e,t,i,r){var n={id:e||null,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)be(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r0&&(a+=r?(n*u-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-o,2))),n=l,o=u;}var h=t.length-3;t[2]=1,function e(t,i,r,n){for(var o,a=n,s=t[i],l=t[i+1],u=t[r],h=t[r+1],c=i+3;ca&&(o=c,a=f);}a>n&&(o-i>3&&e(t,i,o,n),t[o+2]=a,r-o>3&&e(t,o,r,n));}(t,0,h,i),t[h+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size;}function Te(e,t,i,r){for(var n=0;n1?1:i}function Le(e,t,i,r,n,o,a,s){if(r/=t,o>=(i/=t)&&a<=r)return e;if(o>r||a=i&&d<=r)l.push(h);else if(!(p>r||d=i&&a<=r&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]));}}function De(e,t,i,r,n,o,a){for(var s,l,u=Oe(e),h=0===n?Ee:Ne,c=e.start,f=0;f=i&&(l=h(u,p,d,v,y,i),a&&(u.start=c+s*l)):m>r?x<=r&&(l=h(u,p,d,v,y,r),a&&(u.start=c+s*l)):Ae(u,p,d,g),x=i&&(l=h(u,p,d,v,y,i),w=!0),x>r&&m<=r&&(l=h(u,p,d,v,y,r),w=!0),!o&&w&&(a&&(u.end=c+s*l),t.push(u),u=Oe(e)),a&&(c+=s);}var S=e.length-3;p=e[S],d=e[S+1],g=e[S+2],(m=0===n?p:d)>=i&&m<=r&&Ae(u,p,d,g),S=u.length-3,o&&S>=3&&(u[S]!==u[0]||u[S+1]!==u[1])&&Ae(u,u[0],u[1],u[2]),u.length&&t.push(u);}function Oe(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Ce(e,t,i,r,n,o){for(var a=0;aa.maxX&&(a.maxX=h),c>a.maxY&&(a.maxY=c);}return a}function Je(e,t,i,r){var n=t.geometry,o=t.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&t.size<(n?a:r))i.numPoints+=t.length/3;else{for(var s=[],l=0;la)&&(i.numSimplified++,s.push(t[l]),s.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,o=n-2;r0===t)for(r=0,n=e.length;r24)throw new Error("maxZoom should be in the 0-24 range");var r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r=this.options.minZoom;n--){var o=+Date.now();this.trees[n+1]=ae(r,xe,we,this.options.nodeSize,Float32Array),r=this._cluster(r,n),t&&console.log("z%d: %d clusters in %dms",n,r.length,+Date.now()-o);}return this.trees[this.options.minZoom]=ae(r,xe,we,this.options.nodeSize,Float32Array),t&&console.timeEnd("total time"),this},getClusters:function(e,t){for(var i=this.trees[this._limitZoom(t)],r=i.range(ve(e[0]),ye(e[3]),ve(e[2]),ye(e[1])),n=[],o=0;o1&&console.time("creation"),f=this.tiles[c]=Ve(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++;}if(f.source=e,n){if(t===l.maxZoom||t===n)continue;var d=1<1&&console.time("clipping");var g,v,y,m,x,w,S=.5*l.buffer/l.extent,M=.5-S,b=.5+S,_=1+S;g=v=y=m=null,x=Le(e,h,i-S,i+b,0,f.minX,f.maxX,l),w=Le(e,h,i+M,i+_,0,f.minX,f.maxX,l),e=null,x&&(g=Le(x,h,r-S,r+b,1,f.minY,f.maxY,l),v=Le(x,h,r+M,r+_,1,f.minY,f.maxY,l),x=null),w&&(y=Le(w,h,r-S,r+b,1,f.minY,f.maxY,l),m=Le(w,h,r+M,r+_,1,f.minY,f.maxY,l),w=null),u>1&&console.timeEnd("clipping"),s.push(g||[],t+1,2*i,2*r),s.push(v||[],t+1,2*i,2*r+1),s.push(y||[],t+1,2*i+1,2*r),s.push(m||[],t+1,2*i+1,2*r+1);}}},Ye.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,o=r.debug;if(e<0||e>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,h=t,c=i;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[Ze(u,h,c)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,h,c),o>1&&console.time("drilling down"),this.splitTile(l.source,u,h,c,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Fe(this.tiles[s],n):null):null};var Xe=function(t){function i(e,i,r){t.call(this,e,i,je),r&&(this.loadGeoJSON=r);}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.loadData=function(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=t,this._pendingLoadDataParams=e,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData());},i.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var t=this._pendingCallback,i=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams,this.loadGeoJSON(i,function(r,n){if(r||!n)return t(r);if("object"!=typeof n)return t(new Error("Input data is not a valid GeoJSON object."));$(n,!0);try{e._geoJSONIndex=i.cluster?he(i.superclusterOptions).load(n.features):function(e,t){return new Ye(e,t)}(n,i.geojsonVtOptions);}catch(r){return t(r)}e.loaded={};var o={};if(i.request&&i.request.collectResourceTiming){var a=M(i.request.url);a&&(o.resourceTiming={},o.resourceTiming[i.source]=JSON.parse(JSON.stringify(a)));}t(null,o);});}},i.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData());},i.prototype.reloadTile=function(e,i){var r=this.loaded,n=e.uid;return r&&r[n]?t.prototype.reloadTile.call(this,e,i):this.loadTile(e,i)},i.prototype.loadGeoJSON=function(t,i){if(t.request)e.getJSON(t.request,i);else{if("string"!=typeof t.data)return i(new Error("Input data is not a valid GeoJSON object."));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error("Input data is not a valid GeoJSON object."))}}},i.prototype.removeSource=function(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t();},i}(_),qe=function(t){var i=this;this.self=t,this.actor=new e.default$7(t,this),this.layerIndexes={},this.workerSourceTypes={vector:_,geojson:Xe},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(e,t){if(i.workerSourceTypes[e])throw new Error('Worker source with name "'+e+'" already registered.');i.workerSourceTypes[e]=t;},this.self.registerRTLTextPlugin=function(t){if(e.plugin.isLoaded())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText;};};return qe.prototype.setLayers=function(e,t,i){this.getLayerIndex(e).replace(t),i();},qe.prototype.updateLayers=function(e,t,i){this.getLayerIndex(e).update(t.layers,t.removedIds),i();},qe.prototype.loadTile=function(e,t,i){this.getWorkerSource(e,t.type,t.source).loadTile(t,i);},qe.prototype.loadDEMTile=function(e,t,i){this.getDEMWorkerSource(e,t.source).loadTile(t,i);},qe.prototype.reloadTile=function(e,t,i){this.getWorkerSource(e,t.type,t.source).reloadTile(t,i);},qe.prototype.abortTile=function(e,t,i){this.getWorkerSource(e,t.type,t.source).abortTile(t,i);},qe.prototype.removeTile=function(e,t,i){this.getWorkerSource(e,t.type,t.source).removeTile(t,i);},qe.prototype.removeDEMTile=function(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t);},qe.prototype.removeSource=function(e,t,i){if(this.workerSources[e]&&this.workerSources[e][t.type]&&this.workerSources[e][t.type][t.source]){var r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i();}},qe.prototype.loadWorkerSource=function(e,t,i){try{this.self.importScripts(t.url),i();}catch(e){i(e.toString());}},qe.prototype.loadRTLTextPlugin=function(t,i,r){try{e.plugin.isLoaded()||(this.self.importScripts(i),r(e.plugin.isLoaded()?null:new Error("RTL Text Plugin failed to import scripts from "+i)));}catch(e){r(e.toString());}},qe.prototype.getLayerIndex=function(e){var t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new r),t},qe.prototype.getWorkerSource=function(e,t,i){var r=this;if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){var n={send:function(t,i,n){r.actor.send(t,i,n,e);}};this.workerSources[e][t][i]=new this.workerSourceTypes[t](n,this.getLayerIndex(e));}return this.workerSources[e][t][i]},qe.prototype.getDEMWorkerSource=function(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new I),this.demWorkerSources[e][t]},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&new qe(self),qe}); - -define(["./chunk1.js"],function(t){"use strict";var e=t.createCommonjsModule(function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(i);try{e=new Worker(n),t=!0;}catch(e){t=!1;}e&&e.terminate();return URL.revokeObjectURL(n),t}()&&"Uint8ClampedArray"in window&&function(t){void 0===i[t]&&(i[t]=function(t){var i=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,i.probablySupportsContext?i.probablySupportsContext("webgl",n)||i.probablySupportsContext("experimental-webgl",n):i.supportsContext?i.supportsContext("webgl",n)||i.supportsContext("experimental-webgl",n):i.getContext("webgl",n)||i.getContext("experimental-webgl",n)}(t));return i[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var i={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};}),i=t.default.performance&&t.default.performance.now?t.default.performance.now.bind(t.default.performance):Date.now.bind(Date),n=t.default.requestAnimationFrame||t.default.mozRequestAnimationFrame||t.default.webkitRequestAnimationFrame||t.default.msRequestAnimationFrame,o=t.default.cancelAnimationFrame||t.default.mozCancelAnimationFrame||t.default.webkitCancelAnimationFrame||t.default.msCancelAnimationFrame,r={now:i,frame:function(t){return n(t)},cancelFrame:function(t){return o(t)},getImageData:function(e){var i=t.default.document.createElement("canvas"),n=i.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return i.width=e.width,i.height=e.height,n.drawImage(e,0,0,e.width,e.height),n.getImageData(0,0,e.width,e.height)},hardwareConcurrency:t.default.navigator.hardwareConcurrency||4,get devicePixelRatio(){return t.default.devicePixelRatio},supportsWebp:!1};if(t.default.document){var a=t.default.document.createElement("img");a.onload=function(){r.supportsWebp=!0;},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=";}var s={create:function(e,i,n){var o=t.default.document.createElement(e);return i&&(o.className=i),n&&n.appendChild(o),o},createNS:function(e,i){return t.default.document.createElementNS(e,i)}},l=t.default.document?t.default.document.documentElement.style:null;function c(t){if(!l)return null;for(var e=0;e=0?0:e.button},s.remove=function(t){t.parentNode&&t.parentNode.removeChild(t);};var _={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null},g="See https://www.mapbox.com/api-documentation/#access-tokens";function v(t,e){var i=C(_.API_URL);if(t.protocol=i.protocol,t.authority=i.authority,"/"!==i.path&&(t.path=""+i.path+t.path),!_.REQUIRE_ACCESS_TOKEN)return S(t);if(!(e=e||_.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+g);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+g);return t.params.push("access_token="+e),S(t)}function y(t){return 0===t.indexOf("mapbox:")}var x=function(t,e){if(!y(t))return t;var i=C(t);return i.path="/fonts/v1"+i.path,v(i,e)},b=function(t,e){if(!y(t))return t;var i=C(t);return i.path="/v4/"+i.authority+".json",i.params.push("secure"),v(i,e)},w=function(t,e,i,n){var o=C(t);return y(t)?(o.path="/styles/v1"+o.path+"/sprite"+e+i,v(o,n)):(o.path+=""+e+i,S(o))},E=/(\.(png|jpg)\d*)(?=$)/,T=function(t,e,i){if(!e||!y(e))return t;var n=C(t),o=r.devicePixelRatio>=2||512===i?"@2x":"",a=r.supportsWebp?".webp":"$1";return n.path=n.path.replace(E,""+o+a),function(t){for(var e=0;e=0?1.2:1));}function O(t,e,i,n,o,r,a){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else{var l=r.requests[s];l||(l=r.requests[s]=[],N.loadGlyphRange(i,s,n.url,n.requestTransform,function(t,e){if(e)for(var i in e)r.glyphs[+i]=e[+i];for(var n=0,o=l;nthis.height)return t.warnOnce("LineAtlas out of space"),null;for(var r=0,a=0;a90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};W.prototype.wrap=function(){return new W(t.wrap(this.lng,-180,180),this.lat)},W.prototype.toArray=function(){return[this.lng,this.lat]},W.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},W.prototype.toBounds=function(t){var e=360*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return new q(new W(this.lng-i,this.lat-e),new W(this.lng+i,this.lat+e))},W.convert=function(t){if(t instanceof W)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new W(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new W(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")};var q=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]));};q.prototype.setNorthEast=function(t){return this._ne=t instanceof W?new W(t.lng,t.lat):W.convert(t),this},q.prototype.setSouthWest=function(t){return this._sw=t instanceof W?new W(t.lng,t.lat):W.convert(t),this},q.prototype.extend=function(t){var e,i,n=this._sw,o=this._ne;if(t instanceof W)e=t,i=t;else{if(!(t instanceof q))return Array.isArray(t)?t.every(Array.isArray)?this.extend(q.convert(t)):this.extend(W.convert(t)):this;if(e=t._sw,i=t._ne,!e||!i)return this}return n||o?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),o.lng=Math.max(i.lng,o.lng),o.lat=Math.max(i.lat,o.lat)):(this._sw=new W(e.lng,e.lat),this._ne=new W(i.lng,i.lat)),this},q.prototype.getCenter=function(){return new W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},q.prototype.getSouthWest=function(){return this._sw},q.prototype.getNorthEast=function(){return this._ne},q.prototype.getNorthWest=function(){return new W(this.getWest(),this.getNorth())},q.prototype.getSouthEast=function(){return new W(this.getEast(),this.getSouth())},q.prototype.getWest=function(){return this._sw.lng},q.prototype.getSouth=function(){return this._sw.lat},q.prototype.getEast=function(){return this._ne.lng},q.prototype.getNorth=function(){return this._ne.lat},q.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},q.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},q.prototype.isEmpty=function(){return!(this._sw&&this._ne)},q.convert=function(t){return!t||t instanceof q?t:new q(t)};var X=function(t,e,i){this.bounds=q.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24;};X.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},X.prototype.contains=function(t){var e=Math.floor(this.lngX(this.bounds.getWest(),t.z)),i=Math.floor(this.latY(this.bounds.getNorth(),t.z)),n=Math.ceil(this.lngX(this.bounds.getEast(),t.z)),o=Math.ceil(this.latY(this.bounds.getSouth(),t.z));return t.x>=e&&t.x=i&&t.y0&&(l[new t.OverscaledTileID(e.overscaledZ,r,i.z,o,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n));}});},i.prototype.onAdd=function(t){this.map=t,this.load();},i.prototype.setData=function(e){var i=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)return i.fire(new t.ErrorEvent(e));var n={dataType:"source",sourceDataType:"content"};i._collectResourceTiming&&i._resourceTiming&&i._resourceTiming.length>0&&(n.resourceTiming=i._resourceTiming,i._resourceTiming=[]),i.fire(new t.Event("data",n));}),this},i.prototype._updateWorkerData=function(e){var i,n,o=this,r=t.extend({},this.workerOptions),a=this._data;"string"==typeof a?(r.request=this.map._transformRequest((i=a,(n=t.default.document.createElement("a")).href=i,n.href),t.ResourceType.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(a),this.workerID=this.dispatcher.send(this.type+"."+r.source+".loadData",r,function(t,i){o._removed||i&&i.abandoned||(o._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[o.id]&&(o._resourceTiming=i.resourceTiming[o.id].slice(0)),o.dispatcher.send(o.type+"."+r.source+".coalesce",null,null,o.workerID),e(t));},this.workerID);},i.prototype.loadTile=function(t,e){var i=this,n=void 0===t.workerID?"loadTile":"reloadTile",o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:r.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send(n,o,function(o,r){return t.unloadVectorData(),t.aborted?e(null):o?e(o):(t.loadVectorData(r,i.map.painter,"reloadTile"===n),e(null))},this.workerID);},i.prototype.abortTile=function(t){t.aborted=!0;},i.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID);},i.prototype.onRemove=function(){this._removed=!0,this.dispatcher.send("removeSource",{type:this.type,source:this.id},null,this.workerID);},i.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},i.prototype.hasTransition=function(){return!1},i}(t.Evented);var Q=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),tt=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;};tt.prototype.bind=function(t,e,i,n,o,r,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,c=0;!l&&c>s.z,c=new t.default$1(s.x*l,s.y*l),u=new t.default$1(c.x+l,c.y+l),h=this.segments.prepareSegment(4,n,o);n.emplaceBack(c.x,c.y,c.x,c.y),n.emplaceBack(u.x,c.y,u.x,c.y),n.emplaceBack(c.x,u.y,c.x,u.y),n.emplaceBack(u.x,u.y,u.x,u.y);var p=h.vertexLength;o.emplaceBack(p,p+1,p+2),o.emplaceBack(p+1,p+2,p+3),h.vertexLength+=4,h.primitiveLength+=2;}this.maskedBoundsBuffer=i.createVertexBuffer(n,Q.members),this.maskedIndexBuffer=i.createIndexBuffer(o);}},lt.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},lt.prototype.setExpiryData=function(e){var i=this.expirationTime;if(e.cacheControl){var n=t.parseCacheControl(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"]);}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var o=Date.now(),r=!1;if(this.expirationTime>o)r=!1;else if(i)if(this.expirationTimethis.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a);}return this},ct.prototype.has=function(t){return t.wrapped().key in this.data},ct.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},ct.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},ct.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},ct.prototype.remove=function(t,e){if(!this.has(t))return this;var i=t.wrapped().key,n=void 0===e?0:this.data[i].indexOf(e),o=this.data[i][n];return this.data[i].splice(n,1),o.timeout&&clearTimeout(o.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this},ct.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e);}return this};var ut=function(t,e,i){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;};ut.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null);},ut.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer);},ut.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer);},ut.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer);};var ht={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},pt=function(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;};pt.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer);},pt.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer);},pt.prototype.enableAttributes=function(t,e){for(var i=0;i1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[r]&&(t.neighboringTiles[r].backfilled=!0)));}},i.prototype.getTile=function(t){return this.getTileByID(t.key)},i.prototype.getTileByID=function(t){return this._tiles[t]},i.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},i.prototype._findLoadedChildren=function(t,e,i){var n=!1;for(var o in this._tiles){var r=this._tiles[o];if(!(i[o]||!r.hasData()||r.tileID.overscaledZ<=t.overscaledZ||r.tileID.overscaledZ>e)){var a=Math.pow(2,r.tileID.canonical.z-t.canonical.z);if(Math.floor(r.tileID.canonical.x/a)===t.canonical.x&&Math.floor(r.tileID.canonical.y/a)===t.canonical.y)for(i[o]=r.tileID,n=!0;r&&r.tileID.overscaledZ-1>t.overscaledZ;){var s=r.tileID.scaledTo(r.tileID.overscaledZ-1);if(!s)break;(r=this._tiles[s.key])&&r.hasData()&&(delete i[o],i[s.key]=s);}}}return n},i.prototype.findLoadedParent=function(t,e,i){for(var n=t.overscaledZ-1;n>=e;n--){var o=t.scaledTo(n);if(!o)return;var r=String(o.key),a=this._tiles[r];if(a&&a.hasData())return i[r]=o,a;if(this._cache.has(o))return i[r]=o,this._cache.get(o)}},i.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),i=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(n);},i.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,i=Math.round(e);if(this._prevLng=t,i){var n={};for(var o in this._tiles){var r=this._tiles[o];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+i),n[r.tileID.key]=r;}for(var a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l);}}},i.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var o;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?o=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(o=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(o=o.filter(function(t){return n._source.hasTile(t)}))):o=[];var a,s=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),l=Math.max(s-i.maxOverzooming,this._source.minzoom),c=Math.max(s+i.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(o,s),h={};if(Kt(this._source.type))for(var p=Object.keys(u),d=0;d=r.now())){n._findLoadedChildren(m,c,u)&&(u[f]=m);var g=n.findLoadedParent(m,l,h);g&&n._addTile(g.tileID);}}for(a in h)u[a]||(n._coveredTiles[a]=!0);for(a in h)u[a]=h[a];for(var v=t.keysDifference(this._tiles,u),y=0;ythis._source.maxzoom){var p=l.children(this._source.maxzoom)[0],d=this.getTile(p);d&&d.hasData()?n[p.key]=p:h=!1;}else{this._findLoadedChildren(l,a,n);for(var f=l.children(this._source.maxzoom),m=0;m=r;--_){var g=l.scaledTo(_);if(o[g.key])break;if(o[g.key]=!0,!(c=this.getTile(g))&&u&&(c=this._addTile(g)),c&&(n[g.key]=g,u=c.wasRequested(),c.hasData()))break}}}return n},i.prototype._addTile=function(e){var i=this._tiles[e.key];if(i)return i;(i=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,i),i.tileID=e);var n=Boolean(i);return n||(i=new lt(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i?(i.uses++,this._tiles[e.key]=i,n||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null},i.prototype._setTileReloadTimer=function(t,e){var i=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){i._reloadTile(t,"expired"),delete i._timers[t];},n));},i.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));},i.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset();},i.prototype.tilesIn=function(e,i){for(var n=[],o=this.getIds(),r=1/0,a=1/0,s=-1/0,l=-1/0,c=e[0].zoom,u=0;u=0&&g[1].y+_>=0){for(var v=[],y=0;y=r.now())return!0}return!1},i}(t.Evented);function Ht(e,i){var n=i.zoomTo(e.canonical.z);return new t.default$1((n.column-(e.canonical.x+e.wrap*Math.pow(2,e.canonical.z)))*t.default$8,(n.row-e.canonical.y)*t.default$8)}function Kt(t){return"raster"===t||"image"===t||"video"===t}function Yt(){return new t.default.Worker(Rn.workerUrl)}Xt.maxOverzooming=10,Xt.maxUnderzooming=3;var Jt,Qt=function(){this.active={};};function te(e,i){var n={};for(var o in e)"ref"!==o&&(n[o]=e[o]);return t.default$18.forEach(function(t){t in i&&(n[t]=i[t]);}),n}function ee(t){t=t.slice();for(var e=Object.create(null),i=0;ithis.width||n<0||e>this.height)return!o&&[];var r=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(o)return!0;for(var a=0;a0:r},he.prototype._queryCircle=function(t,e,i,n){var o=t-i,r=t+i,a=e-i,s=e+i;if(r<0||o>this.width||s<0||a>this.height)return!n&&[];var l=[],c={hitTest:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(o,a,r,s,this._queryCellCircle,l,c),n?l.length>0:l},he.prototype.query=function(t,e,i,n){return this._query(t,e,i,n,!1)},he.prototype.hitTest=function(t,e,i,n){return this._query(t,e,i,n,!0)},he.prototype.hitTestCircle=function(t,e,i){return this._queryCircle(t,e,i,!0)},he.prototype._queryCell=function(t,e,i,n,o,r,a){var s=a.seenUids,l=this.boxCells[o];if(null!==l)for(var c=this.bboxes,u=0,h=l;u=c[d+0]&&n>=c[d+1]){if(a.hitTest)return r.push(!0),!0;r.push({key:this.boxKeys[p],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]});}}}var f=this.circleCells[o];if(null!==f)for(var m=this.circles,_=0,g=f;_a*a+s*s},he.prototype._circleAndRectCollide=function(t,e,i,n,o,r,a){var s=(r-n)/2,l=Math.abs(t-(n+s));if(l>s+i)return!1;var c=(a-o)/2,u=Math.abs(e-(o+c));if(u>c+i)return!1;if(l<=s||u<=c)return!0;var h=l-s,p=u-c;return h*h+p*p<=i*i};var pe=t.default$19.layout;function de(e,i,n,o,r){var a=t.mat4.identity(new Float32Array(16));return i?(t.mat4.identity(a),t.mat4.scale(a,a,[1/r,1/r,1]),n||t.mat4.rotateZ(a,a,o.angle)):(t.mat4.scale(a,a,[o.width/2,-o.height/2,1]),t.mat4.translate(a,a,[1,-1,0]),t.mat4.multiply(a,a,e)),a}function fe(e,i,n,o,r){var a=t.mat4.identity(new Float32Array(16));return i?(t.mat4.multiply(a,a,e),t.mat4.scale(a,a,[r,r,1]),n||t.mat4.rotateZ(a,a,-o.angle)):(t.mat4.scale(a,a,[1,-1,1]),t.mat4.translate(a,a,[-1,-1,0]),t.mat4.scale(a,a,[2/o.width,2/o.height,1])),a}function me(e,i){var n=[e.x,e.y,0,1];Ie(n,n,i);var o=n[3];return{point:new t.default$1(n[0]/o,n[1]/o),signedDistanceFromCamera:o}}function _e(t,e){var i=t[0]/t[3],n=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&n>=-e[1]&&n<=e[1]}function ge(e,i,n,o,r,a,s,l){var c=o?e.textSizeData:e.iconSizeData,u=t.evaluateSizeForZoom(c,n.transform.zoom,pe.properties[o?"text-size":"icon-size"]),h=[256/n.width*2+1,256/n.height*2+1],p=o?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var d=e.lineVertexArray,f=o?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=n.transform.width/n.transform.height,_=!1,g=0;gMath.abs(n.x-i.x)*o)return{useVertical:!0};return(e===t.WritingMode.vertical?i.yn.x)?{needsFlipping:!0}:null}function xe(e,i,n,o,r,a,s,l,c,u,h,p,d,f){var m,_=i/24,g=e.lineOffsetX*i,v=e.lineOffsetY*i;if(e.numGlyphs>1){var y=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ve(_,l,g,v,n,h,p,e,c,a,d,!1);if(!w)return{notEnoughRoom:!0};var E=me(w.first.point,s).point,T=me(w.last.point,s).point;if(o&&!n){var I=ye(e.writingMode,E,T,f);if(I)return I}m=[w.first];for(var C=e.glyphStartIndex+1;C0?R.point:be(p,A,S,1,r),M=ye(e.writingMode,S,D,f);if(M)return M}var L=we(_*l.getoffsetX(e.glyphStartIndex),g,v,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,a,d,!1);if(!L)return{notEnoughRoom:!0};m=[L];}for(var P=0,k=m;P0?1:-1,_=0;o&&(m*=-1,_=Math.PI),m<0&&(_+=Math.PI);for(var g=m>0?l+s:l+s+1,v=g,y=r,x=r,b=0,w=0,E=Math.abs(f);b+w<=E;){if((g+=m)=c)return null;if(x=y,void 0===(y=p[g])){var T=new t.default$1(u.getx(g),u.gety(g)),I=me(T,h);if(I.signedDistanceFromCamera>0)y=p[g]=I.point;else{var C=g-m;y=be(0===b?a:new t.default$1(u.getx(C),u.gety(C)),T,x,E-b+1,h);}}b+=w,w=x.dist(y);}var S=(E-b)/w,z=y.sub(x),A=z.mult(S)._add(x);return A._add(z._unit()._perp()._mult(n*m)),{point:A,angle:_+Math.atan2(y.y-x.y,y.x-x.x),tileDistance:d?{prevTileDistance:g-m===v?0:u.gettileUnitDistanceFromAnchor(g-m),lastSegmentViewportDistance:E-b}:null}}var Ee=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Te(t,e){for(var i=0;iC)Se(e,S,!1);else{var M=this.projectPoint(u,z,A),L=R*E;if(f.length>0){var P=M.x-f[f.length-4],k=M.y-f[f.length-3];if(L*L*2>P*P+k*k)if(S+8-I&&B=this.screenRightBoundary||n<100||e>this.screenBottomBoundary};var Ae=t.default$19.layout,Re=function(t,e,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&i?1:0,this.placed=i;};Re.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var De=function(t,e,i,n,o){this.text=new Re(t?t.text:null,e,i,o),this.icon=new Re(t?t.icon:null,e,n,o);};De.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var Me=function(t,e,i){this.text=t,this.icon=e,this.skipFade=i;},Le=function(t,e){this.transform=t.clone(),this.collisionIndex=new Ce(this.transform),this.placements={},this.opacities={},this.stale=!1,this.fadeDuration=e,this.retainedQueryData={};};function Pe(t,e,i){t.emplaceBack(e?1:0,i?1:0),t.emplaceBack(e?1:0,i?1:0),t.emplaceBack(e?1:0,i?1:0),t.emplaceBack(e?1:0,i?1:0);}Le.prototype.placeLayerTile=function(e,i,n,o){var r=i.getBucket(e),a=i.latestFeatureIndex;if(r&&a&&e.id===r.layerIds[0]){var s=i.collisionBoxArray,l=r.layers[0].layout,c=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/t.default$8,h=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),p=de(h,"map"===l.get("text-pitch-alignment"),"map"===l.get("text-rotation-alignment"),this.transform,ze(i,1,this.transform.zoom)),d=de(h,"map"===l.get("icon-pitch-alignment"),"map"===l.get("icon-rotation-alignment"),this.transform,ze(i,1,this.transform.zoom));this.retainedQueryData[r.bucketInstanceId]=new function(t,e,i,n,o){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=o;}(r.bucketInstanceId,a,r.sourceLayerIndex,r.index,i.tileID),this.placeLayerBucket(r,h,p,d,c,u,n,o,s);}},Le.prototype.placeLayerBucket=function(e,i,n,o,r,a,s,l,c){for(var u=e.layers[0].layout,h=t.evaluateSizeForZoom(e.textSizeData,this.transform.zoom,Ae.properties["text-size"]),p=!e.hasTextData()||u.get("text-optional"),d=!e.hasIconData()||u.get("icon-optional"),f=0,m=e.symbolInstances;f0,y=y&&x.offscreen);var I=_.collisionArrays.textCircles;if(I){var C=e.text.placedSymbolArray.get(_.placedTextSymbolIndices[0]),S=t.evaluateSizeForFeature(e.textSizeData,h,C);b=this.collisionIndex.placeCollisionCircles(I,u.get("text-allow-overlap"),r,a,_.key,C,e.lineVertexArray,e.glyphOffsetArray,S,i,n,s,"map"===u.get("text-pitch-alignment")),g=u.get("text-allow-overlap")||b.circles.length>0,y=y&&b.offscreen;}_.collisionArrays.iconFeatureIndex&&(T=_.collisionArrays.iconFeatureIndex),_.collisionArrays.iconBox&&(v=(w=this.collisionIndex.placeCollisionBox(_.collisionArrays.iconBox,u.get("icon-allow-overlap"),a,i)).box.length>0,y=y&&w.offscreen),p||d?d?p||(v=v&&g):g=v&&g:v=g=v&&g,g&&x&&this.collisionIndex.insertCollisionBox(x.box,u.get("text-ignore-placement"),e.bucketInstanceId,E),v&&w&&this.collisionIndex.insertCollisionBox(w.box,u.get("icon-ignore-placement"),e.bucketInstanceId,T),g&&b&&this.collisionIndex.insertCollisionCircles(b.circles,u.get("text-ignore-placement"),e.bucketInstanceId,E),this.placements[_.crossTileID]=new Me(g,v,y||e.justReloaded),l[_.crossTileID]=!0;}}e.justReloaded=!1;},Le.prototype.commit=function(t,e){this.commitTime=e;var i=!1,n=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,o=t?t.opacities:{};for(var r in this.placements){var a=this.placements[r],s=o[r];s?(this.opacities[r]=new De(s,n,a.text,a.icon),i=i||a.text!==s.text.placed||a.icon!==s.icon.placed):(this.opacities[r]=new De(null,n,a.text,a.icon,a.skipFade),i=i||a.text||a.icon);}for(var l in o){var c=o[l];if(!this.opacities[l]){var u=new De(c,n,!1,!1);u.isHidden()||(this.opacities[l]=u,i=i||c.text.placed||c.icon.placed);}}i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e);},Le.prototype.updateLayerOpacities=function(t,e){for(var i={},n=0,o=e;n0||s.numVerticalGlyphVertices>0,h=s.numIconVertices>0;if(u){for(var p=Ve(c.text),d=(s.numGlyphVertices+s.numVerticalGlyphVertices)/4,f=0;ft},Le.prototype.setStale=function(){this.stale=!0;};var ke=Math.pow(2,25),Be=Math.pow(2,24),Oe=Math.pow(2,17),Fe=Math.pow(2,16),Ne=Math.pow(2,9),Ue=Math.pow(2,8),Ze=Math.pow(2,1);function Ve(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*ke+e*Be+i*Oe+e*Fe+i*Ne+e*Ue+i*Ze+e}var je=function(){this._currentTileIndex=0,this._seenCrossTileIDs={};};je.prototype.continuePlacement=function(t,e,i,n,o){for(;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=e[t[n._currentPlacementIndex]],l=n.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(n._inProgressLayer||(n._inProgressLayer=new je),n._inProgressLayer.continuePlacement(i[s.source],n.placement,n._showCollisionBoxes,s,a))return;delete n._inProgressLayer;}n._currentPlacementIndex--;}this._done=!0;},$e.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement};var Ge=512/t.default$8/2,We=function(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(var n=0,o=e;nt.overscaledZ)for(var l in s){var c=s[l];c.tileID.isChildOf(t)&&c.findMatches(e.symbolInstances,t,r);}else{var u=s[t.scaledTo(Number(a)).key];u&&u.findMatches(e.symbolInstances,t,r);}}for(var h=0,p=e.symbolInstances;h1?"@2x":"";function c(){if(s)n(s);else if(o&&a){var e=r.getImageData(a),i={};for(var l in o){var c=o[l],u=c.width,h=c.height,p=c.x,d=c.y,f=c.sdf,m=c.pixelRatio,_=new t.RGBAImage({width:u,height:h});t.RGBAImage.copy(e,_,{x:p,y:d},{x:0,y:0},{width:u,height:h}),i[l]={data:_,pixelRatio:m,sdf:f};}n(null,i);}}t.getJSON(i(w(e,l,".json"),t.ResourceType.SpriteJSON),function(t,e){s||(s=t,o=e,c());}),t.getImage(i(w(e,l,".png"),t.ResourceType.SpriteImage),function(t,e){s||(s=t,a=e,c());});}(e.sprite,this.map._transformRequest,function(e,i){if(e)n.fire(new t.ErrorEvent(e));else if(i)for(var o in i)n.imageManager.addImage(o,i[o]);n.imageManager.setLoaded(!0),n.fire(new t.Event("data",{dataType:"style"}));}):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var a=ee(this.stylesheet.layers);this._order=a.map(function(t){return t.id}),this._layers={};for(var s=0,l=a;s0)throw new Error("Unimplemented: "+o.map(function(t){return t.command}).join(", ")+".");return n.forEach(function(t){"setTransition"!==t.command&&i[t.command].apply(i,t.args);}),this.stylesheet=e,!0},i.prototype.addImage=function(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,i),this.fire(new t.Event("data",{dataType:"style"}));},i.prototype.getImage=function(t){return this.imageManager.getImage(t)},i.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this.fire(new t.Event("data",{dataType:"style"}));},i.prototype.addSource=function(e,i,n){var o=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(i).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0)||!this._validate(t.validateStyle.source,"sources."+e,i,null,n)){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var r=this.sourceCaches[e]=new Xt(e,i,this.dispatcher);r.style=this,r.setEventedParent(this,function(){return{isSourceLoaded:o.loaded(),source:r.serialize(),sourceId:e}}),r.onAdd(this.map),this._changed=!0;}},i.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+i+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0;},i.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0;},i.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},i.prototype.addLayer=function(e,i,n){this._checkLoaded();var o=e.id;if(this.getLayer(o))this.fire(new t.ErrorEvent(new Error('Layer with id "'+o+'" already exists on this map')));else if("object"==typeof e.source&&(this.addSource(o,e.source),e=t.clone(e),e=t.extend(e,{source:o})),!this._validate(t.validateStyle.layer,"layers."+o,e,{arrayIndex:-1},n)){var r=t.default$22(e);this._validateLayer(r),r.setEventedParent(this,{layer:{id:o}});var a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.')));else{if(this._order.splice(a,0,o),this._layerOrderChanged=!0,this._layers[o]=r,this._removedLayers[o]&&r.source){var s=this._removedLayers[o];delete this._removedLayers[o],s.type!==r.type?this._updatedSources[r.source]="clear":(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause());}this._updateLayer(r);}}},i.prototype.moveLayer=function(e,i){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==i){var n=this._order.indexOf(e);this._order.splice(n,1);var o=i?this._order.indexOf(i):this._order.length;i&&-1===o?this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" does not exist on this map.'))):(this._order.splice(o,0,e),this._layerOrderChanged=!0);}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")));},i.prototype.removeLayer=function(e){this._checkLoaded();var i=this._layers[e];if(i){i.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e];}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")));},i.prototype.getLayer=function(t){return this._layers[t]},i.prototype.setLayerZoomRange=function(e,i,n){this._checkLoaded();var o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===n||(null!=i&&(o.minzoom=i),null!=n&&(o.maxzoom=n),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")));},i.prototype.setFilter=function(e,i){this._checkLoaded();var n=this.getLayer(e);if(n){if(!t.default$10(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,"layers."+n.id+".filter",i)||(n.filter=t.clone(i),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")));},i.prototype.getFilter=function(e){return t.clone(this.getLayer(e).filter)},i.prototype.setLayoutProperty=function(e,i,n){this._checkLoaded();var o=this.getLayer(e);o?t.default$10(o.getLayoutProperty(i),n)||(o.setLayoutProperty(i,n),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")));},i.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},i.prototype.setPaintProperty=function(e,i,n){this._checkLoaded();var o=this.getLayer(e);if(o){if(!t.default$10(o.getPaintProperty(i),n)){var r=o._transitionablePaint._values[i].value.isDataDriven();o.setPaintProperty(i,n),(o._transitionablePaint._values[i].value.isDataDriven()||r)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0;}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")));},i.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},i.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},i.prototype.serialize=function(){var e=this;return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(t){return void 0!==t})},i.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0;},i.prototype._flattenRenderedFeatures=function(t){for(var e=[],i=this._order.length-1;i>=0;i--)for(var n=this._order[i],o=0,r=t;o 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"uniform float u_overscale_factor;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value\n // Here we use a=0.3 which works out to the expression below. see \n // nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_linesofar;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},lineGradient:{fragmentSource:"\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nuniform sampler2D u_image;\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n // For gradient lines, v_lineprogress is the ratio along the entire line,\n // scaled to [0, 2^15), and the gradient ramp is stored in a texture.\n vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n// the attribute conveying progress along a line is scaled to [0, 2^15)\n#define MAX_LINE_DISTANCE 32767.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n\n // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge\n // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0)\n // to ensure we don't sample outside the designated symbol on the sprite sheet.\n // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of\n // the texture coordinate\n float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_a.y + 2.0) / 2.0) / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_b.y + 2.0) / 2.0) / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},ii=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,ni=function(t){var e=ei[t],i={};e.fragmentSource=e.fragmentSource.replace(ii,function(t,e,n,o,r){return i[r]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+r+"\nvarying "+n+" "+o+" "+r+";\n#else\nuniform "+n+" "+o+" u_"+r+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+r+"\n "+n+" "+o+" "+r+" = u_"+r+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(ii,function(t,e,n,o,r){var a="float"===o?"vec2":"vec4";return i[r]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+r+"\nuniform lowp float a_"+r+"_t;\nattribute "+n+" "+a+" a_"+r+";\nvarying "+n+" "+o+" "+r+";\n#else\nuniform "+n+" "+o+" u_"+r+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+r+"\n "+r+" = unpack_mix_"+a+"(a_"+r+", a_"+r+"_t);\n#else\n "+n+" "+o+" "+r+" = u_"+r+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+r+"\nuniform lowp float a_"+r+"_t;\nattribute "+n+" "+a+" a_"+r+";\n#else\nuniform "+n+" "+o+" u_"+r+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+r+"\n "+n+" "+o+" "+r+" = unpack_mix_"+a+"(a_"+r+", a_"+r+"_t);\n#else\n "+n+" "+o+" "+r+" = u_"+r+";\n#endif\n"});};for(var oi in ei)ni(oi);var ri=ei,ai=function(t,e,i,n){var o=t.gl;this.program=o.createProgram();var a=i.defines().concat("#define DEVICE_PIXEL_RATIO "+r.devicePixelRatio.toFixed(1));n&&a.push("#define OVERDRAW_INSPECTOR;");var s=a.concat(ri.prelude.fragmentSource,e.fragmentSource).join("\n"),l=a.concat(ri.prelude.vertexSource,e.vertexSource).join("\n"),c=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(c,s),o.compileShader(c),o.attachShader(this.program,c);var u=o.createShader(o.VERTEX_SHADER);o.shaderSource(u,l),o.compileShader(u),o.attachShader(this.program,u);for(var h=i.layoutAttributes||[],p=0;p>16,s>>16),n.uniform2f(i.uniforms.u_pixel_coord_lower,65535&a,65535&s);};function yi(t,e,i,n,o){if(!_i(i.paint.get("fill-pattern"),t))for(var r=!0,a=0,s=n;a0){var l=r.now(),c=(l-e.timeAdded)/s,u=i?(l-i.timeAdded)/s:-1,h=n.getSource(),p=a.coveringZoomLevel({tileSize:h.tileSize,roundZoom:h.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),f=d&&e.refreshedUponExpiration?1:t.clamp(d?c:1-u,0,1);return e.refreshedUponExpiration&&c>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}function Ri(e,i,n){var o=e.context,a=o.gl;o.lineWidth.set(1*r.devicePixelRatio);var s=n.posMatrix,l=e.useProgram("debug");o.setDepthMode($t.disabled),o.setStencilMode(Gt.disabled),o.setColorMode(e.colorModeForRenderPass()),a.uniformMatrix4fv(l.uniforms.u_matrix,!1,s),a.uniform4f(l.uniforms.u_color,1,0,0,1),e.debugVAO.bind(o,l,e.debugBuffer,[]),a.drawArrays(a.LINE_STRIP,0,e.debugBuffer.length);for(var c=function(t,e,i,n){n=n||1;var o,r,a,s,l,c,u,h,p=[];for(o=0,r=t.length;o":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};var Mi={symbol:function(t,e,i,n){if("translucent"===t.renderPass){var o=t.context;o.setStencilMode(Gt.disabled),o.setColorMode(t.colorModeForRenderPass()),0!==i.paint.get("icon-opacity").constantOr(1)&&hi(t,e,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright")),0!==i.paint.get("text-opacity").constantOr(1)&&hi(t,e,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright")),e.map.showCollisionBoxes&&function(t,e,i,n){li(t,e,i,n,!1),li(t,e,i,n,!0);}(t,e,i,n);}},circle:function(t,e,i,n){if("translucent"===t.renderPass){var o=i.paint.get("circle-opacity"),r=i.paint.get("circle-stroke-width"),a=i.paint.get("circle-stroke-opacity");if(0!==o.constantOr(1)||0!==r.constantOr(1)&&0!==a.constantOr(1)){var s=t.context,l=s.gl;s.setDepthMode(t.depthModeForSublayer(0,$t.ReadOnly)),s.setStencilMode(Gt.disabled),s.setColorMode(t.colorModeForRenderPass());for(var c=!0,u=0;u0?1-1/(1.001-o):-o),s.uniform1f(c.uniforms.u_contrast_factor,(r=i.paint.get("raster-contrast"))>0?1/(1-r):1+r),s.uniform3fv(c.uniforms.u_spin_weights,function(t){t*=Math.PI/180;var e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}(i.paint.get("raster-hue-rotate"))),s.uniform1f(c.uniforms.u_buffer_scale,1),s.uniform1i(c.uniforms.u_image0,0),s.uniform1i(c.uniforms.u_image1,1);for(var u=n.length&&n[0].overscaledZ,h=0,p=n;he.row){var i=t;t=e,e=i;}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function ki(t,e,i,n,o){var r=Math.max(i,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,h=e.dx<0,p=r;pl.dy&&(a=s,s=l,l=a),s.dy>c.dy&&(a=s,s=c,c=a),l.dy>c.dy&&(a=l,l=c,c=a),s.dy&&ki(c,s,n,o,r),l.dy&&ki(c,l,n,o,r);}Li.prototype.resize=function(t,e){var i=this.context.gl;if(this.width=t*r.devicePixelRatio,this.height=e*r.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var n=0,o=this.style._order;n=0;this.currentLayer--){var g=n.style._layers[s[n.currentLayer]];g.source!==(m&&m.id)&&(_=[],(m=n.style.sourceCaches[g.source])&&(n.clearStencil(),_=m.getVisibleCoordinates(),m.getSource().isTileClipped&&n._renderTileClippingMasks(_))),n.renderLayer(n,m,g,_);}this.renderPass="translucent";var v,y=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},Li.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var i=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[i]||(this.cache[i]=new ai(this.context,ri[t],e,this._showOverdrawInspector)),this.cache[i]},Li.prototype.useProgram=function(t,e){var i=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(i.program),i};var Oi=t.default$20.vec4,Fi=t.default$20.mat4,Ni=t.default$20.mat2,Ui=function(t,e,i){this.tileSize=512,this._renderWorldCopies=void 0===i||i,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new W(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={};},Zi={minZoom:{configurable:!0},maxZoom:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},x:{configurable:!0},y:{configurable:!0},point:{configurable:!0}};Ui.prototype.clone=function(){var t=new Ui(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},Zi.minZoom.get=function(){return this._minZoom},Zi.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t));},Zi.maxZoom.get=function(){return this._maxZoom},Zi.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t));},Zi.renderWorldCopies.get=function(){return this._renderWorldCopies},Zi.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;},Zi.worldSize.get=function(){return this.tileSize*this.scale},Zi.centerPoint.get=function(){return this.size._div(2)},Zi.size.get=function(){return new t.default$1(this.width,this.height)},Zi.bearing.get=function(){return-this.angle/Math.PI*180},Zi.bearing.set=function(e){var i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=Ni.create(),Ni.rotate(this.rotationMatrix,this.rotationMatrix,this.angle));},Zi.pitch.get=function(){return this._pitch/Math.PI*180},Zi.pitch.set=function(e){var i=t.clamp(e,0,60)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());},Zi.fov.get=function(){return this._fov/Math.PI*180},Zi.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices());},Zi.zoom.get=function(){return this._zoom},Zi.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices());},Zi.center.get=function(){return this._center},Zi.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices());},Ui.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},Ui.prototype.getVisibleUnwrappedCoordinates=function(e){var i=this.pointCoordinate(new t.default$1(0,0),0),n=this.pointCoordinate(new t.default$1(this.width,0),0),o=Math.floor(i.column),r=Math.floor(n.column),a=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var s=o;s<=r;s++)0!==s&&a.push(new t.UnwrappedTileID(s,e));return a},Ui.prototype.coveringTiles=function(e){var i=this.coveringZoomLevel(e),n=i;if(void 0!==e.minzoom&&ie.maxzoom&&(i=e.maxzoom);var o=this.pointCoordinate(this.centerPoint,i),r=new t.default$1(o.column-.5,o.row-.5);return function(e,i,n,o){void 0===o&&(o=!0);var r=1<=0&&l<=r)for(c=i;ca&&(o=a-m);}if(this.lngRange){var _=this.x,g=c.x/2;_-gl&&(n=l-g);}void 0===n&&void 0===o||(this.center=this.unproject(new t.default$1(void 0!==n?n:this.x,void 0!==o?o:this.y))),this._unmodified=u,this._constraining=!1;}},Ui.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,e=Math.PI/2+this._pitch,i=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-e-t),n=this.x,o=this.y,r=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),a=new Float64Array(16);Fi.perspective(a,this._fov,this.width/this.height,1,r),Fi.scale(a,a,[1,-1,1]),Fi.translate(a,a,[0,0,-this.cameraToCenterDistance]),Fi.rotateX(a,a,this._pitch),Fi.rotateZ(a,a,this.angle),Fi.translate(a,a,[-n,-o,0]);var s=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));Fi.scale(a,a,[1,1,s,1]),this.projMatrix=a;var l=this.width%2/2,c=this.height%2/2,u=Math.cos(this.angle),h=Math.sin(this.angle),p=n-Math.round(n)+u*l+h*c,d=o-Math.round(o)+u*c+h*l,f=new Float64Array(a);if(Fi.translate(f,f,[p>.5?p-1:p,d>.5?d-1:d,0]),this.alignedProjMatrix=f,a=Fi.create(),Fi.scale(a,a,[this.width/2,-this.height/2,1]),Fi.translate(a,a,[1,-1,0]),this.pixelMatrix=Fi.multiply(new Float64Array(16),a,this.projMatrix),!(a=Fi.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={};}},Ui.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.default$1(0,0)).zoomTo(this.zoom),i=[e.column*this.tileSize,e.row*this.tileSize,0,1];return Oi.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance},Object.defineProperties(Ui.prototype,Zi);var Vi=function(){var e,i,n,o,r;t.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),i=300,n=!1,o=0,r=function(){o=0,n&&(e(),o=setTimeout(r,i),n=!1);},function(){return n=!0,o||r(),o});};Vi.prototype.addTo=function(e){return this._map=e,t.default.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Vi.prototype.remove=function(){return t.default.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Vi.prototype.getHashString=function(t){var e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),r=Math.round(e.lng*o)/o,a=Math.round(e.lat*o)/o,s=this._map.getBearing(),l=this._map.getPitch(),c="";return c+=t?"#/"+r+"/"+a+"/"+i:"#"+i+"/"+a+"/"+r,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+="/"+Math.round(l)),c},Vi.prototype._onHashChange=function(){var e=t.default.location.hash.replace("#","").split("/");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},Vi.prototype._updateHashUnthrottled=function(){var e=this.getHashString();t.default.history.replaceState(t.default.history.state,"",e);};var ji=function(e){function i(i,n,o,r){void 0===r&&(r={});var a=s.mousePos(n.getCanvasContainer(),o),l=n.unproject(a);e.call(this,i,t.extend({point:a,lngLat:l,originalEvent:o},r)),this._defaultPrevented=!1,this.target=n;}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var n={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0;},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,n),i}(t.Event),$i=function(e){function i(i,n,o){var r=s.touchPos(n.getCanvasContainer(),o),a=r.map(function(t){return n.unproject(t)}),l=r.reduce(function(t,e,i,n){return t.add(e.div(n.length))},new t.default$1(0,0)),c=n.unproject(l);e.call(this,i,{points:r,point:l,lngLats:a,lngLat:c,originalEvent:o}),this._defaultPrevented=!1;}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var n={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0;},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,n),i}(t.Event),Gi=function(t){function e(e,i,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1;}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0;},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,i),e}(t.Event),Wi=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this);};Wi.prototype.isEnabled=function(){return!!this._enabled},Wi.prototype.isActive=function(){return!!this._active},Wi.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around);},Wi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},Wi.prototype.onWheel=function(e){if(this.isEnabled()){var i=e.deltaMode===t.default.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=r.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this.isActive()||this._start(e)),e.preventDefault();}},Wi.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t);},Wi.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var i=s.mousePos(this._el,e);this._around=W.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame));}},Wi.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var i=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,o=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==o&&(o=1/o);var a="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(a*o))),"wheel"===this._type&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}var s=!1;if("wheel"===this._type){var l=Math.min((r.now()-this._lastWheelEventTime)/200,1),c=this._easing(l);i.zoom=t.number(this._startZoom,this._targetZoom,c),l<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):s=!0;}else i.zoom=this._targetZoom,s=!0;i.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),s&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom;},200));}},Wi.prototype._smoothOutEasing=function(e){var i=t.ease;if(this._prevEase){var n=this._prevEase,o=(r.now()-n.start)/n.duration,a=n.easing(o+.01)-n.easing(o),s=.27/Math.sqrt(a*a+1e-4)*.01,l=Math.sqrt(.0729-s*s);i=t.bezier(s,l,.25,1);}return this._prevEase={start:r.now(),duration:e,easing:i},i};var qi=function(e){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this);};qi.prototype.isEnabled=function(){return!!this._enabled},qi.prototype.isActive=function(){return!!this._active},qi.prototype.enable=function(){this.isEnabled()||(this._enabled=!0);},qi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},qi.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.default.document.addEventListener("mousemove",this._onMouseMove,!1),t.default.document.addEventListener("keydown",this._onKeyDown,!1),t.default.document.addEventListener("mouseup",this._onMouseUp,!1),s.disableDrag(),this._startPos=s.mousePos(this._el,e),this._active=!0);},qi.prototype._onMouseMove=function(t){var e=this._startPos,i=s.mousePos(this._el,t);this._box||(this._box=s.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,i.x),o=Math.max(e.x,i.x),r=Math.min(e.y,i.y),a=Math.max(e.y,i.y);s.setTransform(this._box,"translate("+n+"px,"+r+"px)"),this._box.style.width=o-n+"px",this._box.style.height=a-r+"px";},qi.prototype._onMouseUp=function(e){if(0===e.button){var i=this._startPos,n=s.mousePos(this._el,e),o=(new q).extend(this._map.unproject(i)).extend(this._map.unproject(n));this._finish(),s.suppressClick(),i.x===n.x&&i.y===n.y?this._fireEvent("boxzoomcancel",e):this._map.fitBounds(o,{linear:!0}).fire(new t.Event("boxzoomend",{originalEvent:e,boxZoomBounds:o}));}},qi.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t));},qi.prototype._finish=function(){this._active=!1,t.default.document.removeEventListener("mousemove",this._onMouseMove,!1),t.default.document.removeEventListener("keydown",this._onKeyDown,!1),t.default.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag();},qi.prototype._fireEvent=function(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))};var Xi=t.bezier(0,0,.25,1),Hi=function(e,i){this._map=e,this._el=i.element||e.getCanvasContainer(),this._state="disabled",this._button=i.button||"right",this._bearingSnap=i.bearingSnap||0,this._pitchWithRotate=!1!==i.pitchWithRotate,t.bindAll(["_onMouseMove","_onMouseUp","_onBlur","_onDragFrame"],this);};Hi.prototype.isEnabled=function(){return"disabled"!==this._state},Hi.prototype.isActive=function(){return"active"===this._state},Hi.prototype.enable=function(){this.isEnabled()||(this._state="enabled");},Hi.prototype.disable=function(){if(this.isEnabled())switch(this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend"),this._pitchWithRotate&&this._fireEvent("pitchend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled";}},Hi.prototype.onMouseDown=function(e){if("enabled"===this._state){if("right"===this._button){if(this._eventButton=s.mouseButton(e),this._eventButton!==(e.ctrlKey?0:2))return}else{if(e.ctrlKey||0!==s.mouseButton(e))return;this._eventButton=0;}s.disableDrag(),t.default.document.addEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default.document.addEventListener("mouseup",this._onMouseUp),t.default.addEventListener("blur",this._onBlur),this._state="pending",this._inertia=[[r.now(),this._map.getBearing()]],this._previousPos=s.mousePos(this._el,e),this._center=this._map.transform.centerPoint,e.preventDefault();}},Hi.prototype._onMouseMove=function(t){this._lastMoveEvent=t,this._pos=s.mousePos(this._el,t),"pending"===this._state&&(this._state="active",this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame));},Hi.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform,i=this._previousPos,n=this._pos,o=.8*(i.x-n.x),a=-.5*(i.y-n.y),s=e.bearing-o,l=e.pitch-a,c=this._inertia,u=c[c.length-1];this._drainInertiaBuffer(),c.push([r.now(),this._map._normalizeBearing(s,u[1])]),e.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",t),e.pitch=l),this._fireEvent("rotate",t),this._fireEvent("move",t),delete this._lastMoveEvent,this._previousPos=this._pos;}},Hi.prototype._onMouseUp=function(t){if(s.mouseButton(t)===this._eventButton)switch(this._state){case"active":this._state="enabled",s.suppressClick(),this._unbind(),this._deactivate(),this._inertialRotate(t);break;case"pending":this._state="enabled",this._unbind();}},Hi.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend",t),this._pitchWithRotate&&this._fireEvent("pitchend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind();}},Hi.prototype._unbind=function(){t.default.document.removeEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default.document.removeEventListener("mouseup",this._onMouseUp),t.default.removeEventListener("blur",this._onBlur),s.enableDrag();},Hi.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._previousPos;},Hi.prototype._inertialRotate=function(t){var e=this;this._fireEvent("rotateend",t),this._drainInertiaBuffer();var i=this._map,n=i.getBearing(),o=this._inertia,r=function(){Math.abs(n)180&&(d=180);var f=d/180;c+=h*d*(f/2),Math.abs(i._normalizeBearing(c,0))0&&e-t[0][0]>160;)t.shift();};var Ki=t.bezier(0,0,.3,1),Yi=function(e){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this);};Yi.prototype.isEnabled=function(){return"disabled"!==this._state},Yi.prototype.isActive=function(){return"active"===this._state},Yi.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled");},Yi.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled";}},Yi.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==s.mouseButton(e)||(s.addEventListener(t.default.document,"mousemove",this._onMove,{capture:!0}),s.addEventListener(t.default.document,"mouseup",this._onMouseUp),this._start(e)));},Yi.prototype.onTouchStart=function(e){"enabled"===this._state&&(e.touches.length>1||(s.addEventListener(t.default.document,"touchmove",this._onMove,{capture:!0,passive:!1}),s.addEventListener(t.default.document,"touchend",this._onTouchEnd),this._start(e)));},Yi.prototype._start=function(e){t.default.addEventListener("blur",this._onBlur),this._state="pending",this._previousPos=s.mousePos(this._el,e),this._inertia=[[r.now(),this._previousPos]];},Yi.prototype._onMove=function(t){this._lastMoveEvent=t,t.preventDefault(),this._pos=s.mousePos(this._el,t),this._drainInertiaBuffer(),this._inertia.push([r.now(),this._pos]),"pending"===this._state&&(this._state="active",this._fireEvent("dragstart",t),this._fireEvent("movestart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame));},Yi.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform;e.setLocationAtPoint(e.pointLocation(this._previousPos),this._pos),this._fireEvent("drag",t),this._fireEvent("move",t),this._previousPos=this._pos,delete this._lastMoveEvent;}},Yi.prototype._onMouseUp=function(t){if(0===s.mouseButton(t))switch(this._state){case"active":this._state="enabled",s.suppressClick(),this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind();}},Yi.prototype._onTouchEnd=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind();}},Yi.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("dragend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind();}},Yi.prototype._unbind=function(){s.removeEventListener(t.default.document,"touchmove",this._onMove,{capture:!0,passive:!1}),s.removeEventListener(t.default.document,"touchend",this._onTouchEnd),s.removeEventListener(t.default.document,"mousemove",this._onMove,{capture:!0}),s.removeEventListener(t.default.document,"mouseup",this._onMouseUp),s.removeEventListener(t.default,"blur",this._onBlur);},Yi.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._previousPos,delete this._pos;},Yi.prototype._inertialPan=function(t){this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=this._inertia;if(e.length<2)this._fireEvent("moveend",t);else{var i=e[e.length-1],n=e[0],o=i[1].sub(n[1]),r=(i[0]-n[0])/1e3;if(0===r||i[1].equals(n[1]))this._fireEvent("moveend",t);else{var a=o.mult(.3/r),s=a.mag();s>1400&&(s=1400,a._unit()._mult(s));var l=s/750,c=a.mult(-l/2);this._map.panBy(c,{duration:1e3*l,easing:Ki,noMoveStart:!0},{originalEvent:t});}}},Yi.prototype._fireEvent=function(e,i){return this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))},Yi.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=r.now();t.length>0&&e-t[0][0]>160;)t.shift();};var Ji=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this);};function Qi(t){return t*(2-t)}Ji.prototype.isEnabled=function(){return!!this._enabled},Ji.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0);},Ji.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1);},Ji.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,i=0,n=0,o=0,r=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),r=-1);break;case 40:t.shiftKey?n=-1:(r=1,t.preventDefault());break;default:return}var a=this._map,s=a.getZoom(),l={duration:300,delayEndEvents:500,easing:Qi,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+15*i,pitch:a.getPitch()+10*n,offset:[100*-o,100*-r],center:a.getCenter()};a.easeTo(l,{originalEvent:t});}};var tn=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this);};tn.prototype.isEnabled=function(){return!!this._enabled},tn.prototype.isActive=function(){return!!this._active},tn.prototype.enable=function(){this.isEnabled()||(this._enabled=!0);},tn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},tn.prototype.onTouchStart=function(t){var e=this;this.isEnabled()&&(t.points.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._zoom(t)):this._tapped=setTimeout(function(){e._tapped=null;},300)));},tn.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t));},tn.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t);},tn.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd);};var en=t.bezier(0,0,.15,1),nn=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this);};nn.prototype.isEnabled=function(){return!!this._enabled},nn.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around);},nn.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1);},nn.prototype.disableRotation=function(){this._rotationDisabled=!0;},nn.prototype.enableRotation=function(){this._rotationDisabled=!1;},nn.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var i=s.mousePos(this._el,e.touches[0]),n=s.mousePos(this._el,e.touches[1]);this._startVec=i.sub(n),this._gestureIntent=void 0,this._inertia=[],s.addEventListener(t.default.document,"touchmove",this._onMove,{passive:!1}),s.addEventListener(t.default.document,"touchend",this._onEnd);}},nn.prototype._getTouchEventData=function(t){var e=s.mousePos(this._el,t.touches[0]),i=s.mousePos(this._el,t.touches[1]),n=e.sub(i);return{vec:n,center:e.add(i).div(2),scale:n.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*n.angleWith(this._startVec)/Math.PI}},nn.prototype._onMove=function(e){if(2===e.touches.length){var i=this._getTouchEventData(e),n=i.vec,o=i.scale,r=i.bearing;if(!this._gestureIntent){var a=Math.abs(1-o)>.15;Math.abs(r)>10?this._gestureIntent="rotate":a&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=n);}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault();}},nn.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var i=this._map.transform;this._startScale||(this._startScale=i.scale,this._startBearing=i.bearing);var n=this._getTouchEventData(this._lastTouchEvent),o=n.center,a=n.bearing,s=n.scale,l=i.pointLocation(o),c=i.locationPoint(l);"rotate"===e&&(i.bearing=this._startBearing+a),i.zoom=i.scaleZoom(this._startScale*s),i.setLocationAtPoint(l,c),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([r.now(),s,o]);}},nn.prototype._onEnd=function(e){s.removeEventListener(t.default.document,"touchmove",this._onMove,{passive:!1}),s.removeEventListener(t.default.document,"touchend",this._onEnd);var i=this._gestureIntent,n=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,i){this._map.fire(new t.Event(i+"end",{originalEvent:e})),this._drainInertiaBuffer();var o=this._inertia,r=this._map;if(o.length<2)r.snapToNorth({},{originalEvent:e});else{var a=o[o.length-1],l=o[0],c=r.transform.scaleZoom(n*a[1]),u=r.transform.scaleZoom(n*l[1]),h=c-u,p=(a[0]-l[0])/1e3,d=a[2];if(0!==p&&c!==u){var f=.15*h/p;Math.abs(f)>2.5&&(f=f>0?2.5:-2.5);var m=1e3*Math.abs(f/(12*.15)),_=c+f*m/2e3;_<0&&(_=0),r.easeTo({zoom:_,duration:m,easing:en,around:this._aroundCenter?r.getCenter():r.unproject(d),noMoveStart:!0},{originalEvent:e});}else r.snapToNorth({},{originalEvent:e});}}},nn.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=r.now();t.length>2&&e-t[0][0]>160;)t.shift();};var on={scrollZoom:Wi,boxZoom:qi,dragRotate:Hi,dragPan:Yi,keyboard:Ji,doubleClickZoom:tn,touchZoomRotate:nn};var rn=function(e){function i(i,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this);}return e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.getCenter=function(){return this.transform.center},i.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},i.prototype.panBy=function(e,i,n){return e=t.default$1.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),n)},i.prototype.panTo=function(e,i,n){return this.easeTo(t.extend({center:e},i),n)},i.prototype.getZoom=function(){return this.transform.zoom},i.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},i.prototype.zoomTo=function(e,i,n){return this.easeTo(t.extend({zoom:e},i),n)},i.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},i.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},i.prototype.getBearing=function(){return this.transform.bearing},i.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},i.prototype.rotateTo=function(e,i,n){return this.easeTo(t.extend({bearing:e},i),n)},i.prototype.resetNorth=function(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this},i.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"]))return t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"),this;e=q.convert(e);var r=[(i.padding.left-i.padding.right)/2,(i.padding.top-i.padding.bottom)/2],a=Math.min(i.padding.right,i.padding.left),s=Math.min(i.padding.top,i.padding.bottom);i.offset=[i.offset[0]+r[0],i.offset[1]+r[1]];var l=t.default$1.convert(i.offset),c=this.transform,u=c.project(e.getNorthWest()),h=c.project(e.getSouthEast()),p=h.sub(u),d=(c.width-2*a-2*Math.abs(l.x))/p.x,f=(c.height-2*s-2*Math.abs(l.y))/p.y;return f<0||d<0?(t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."),this):(i.center=c.unproject(u.add(h).div(2)),i.zoom=Math.min(c.scaleZoom(c.scale*Math.min(d,f)),i.maxZoom),i.bearing=0,i.linear?this.easeTo(i,n):this.flyTo(i,n))},i.prototype.jumpTo=function(e,i){this.stop();var n=this.transform,o=!1,r=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(o=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=W.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(r=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),o&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),r&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),a&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))},i.prototype.easeTo=function(e,i){var n=this;this.stop(),!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate&&(e.duration=0);var o=this.transform,r=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?+e.zoom:r,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,u="pitch"in e?+e.pitch:s,h=o.centerPoint.add(t.default$1.convert(e.offset)),p=o.pointLocation(h),d=W.convert(e.center||p);this._normalizeCenter(d);var f,m,_=o.project(p),g=o.project(d).sub(_),v=o.zoomScale(l-r);return e.around&&(f=W.convert(e.around),m=o.locationPoint(f)),this._zooming=l!==r,this._rotating=a!==c,this._pitching=u!==s,this._prepareEase(i,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease(function(e){if(n._zooming&&(o.zoom=t.number(r,l,e)),n._rotating&&(o.bearing=t.number(a,c,e)),n._pitching&&(o.pitch=t.number(s,u,e)),f)o.setLocationAtPoint(f,m);else{var p=o.zoomScale(o.zoom-r),d=l>r?Math.min(2,v):Math.max(.5,v),y=Math.pow(d,1-e),x=o.unproject(_.add(g.mult(e*y)).mult(p));o.setLocationAtPoint(o.renderWorldCopies?x.wrap():x,h);}n._fireMoveEvents(i);},function(){e.delayEndEvents?n._easeEndTimeoutID=setTimeout(function(){return n._afterEase(i)},e.delayEndEvents):n._afterEase(i);},e),this},i.prototype._prepareEase=function(e,i){this._moving=!0,i||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e));},i.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e));},i.prototype._afterEase=function(e){var i=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,i&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e));},i.prototype.flyTo=function(e,i){var n=this;this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,r=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):r,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,u="pitch"in e?+e.pitch:s,h=o.zoomScale(l-r),p=o.centerPoint.add(t.default$1.convert(e.offset)),d=o.pointLocation(p),f=W.convert(e.center||d);this._normalizeCenter(f);var m=o.project(d),_=o.project(f).sub(m),g=e.curve,v=Math.max(o.width,o.height),y=v/h,x=_.mag();if("minZoom"in e){var b=t.clamp(Math.min(e.minZoom,r,l),o.minZoom,o.maxZoom),w=v/o.zoomScale(b-r);g=Math.sqrt(w/x*2);}var E=g*g;function T(t){var e=(y*y-v*v+(t?-1:1)*E*E*x*x)/(2*(t?y:v)*E*x);return Math.log(Math.sqrt(e*e+1)-e)}function I(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}var S=T(0),z=function(t){return C(S)/C(S+g*t)},A=function(t){return v*((C(S)*(I(e=S+g*t)/C(e))-I(S))/E)/x;var e;},R=(T(1)-S)/g;if(Math.abs(x)<1e-6||!isFinite(R)){if(Math.abs(v-y)<1e-6)return this.easeTo(e,i);var D=ye.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==c,this._pitching=u!==s,this._prepareEase(i,!1),this._ease(function(e){var l=e*R,h=1/z(l);o.zoom=r+o.scaleZoom(h),n._rotating&&(o.bearing=t.number(a,c,e)),n._pitching&&(o.pitch=t.number(s,u,e));var d=o.unproject(m.add(_.mult(A(l))).mult(h));o.setLocationAtPoint(o.renderWorldCopies?d.wrap():d,p),n._fireMoveEvents(i);},function(){return n._afterEase(i)},e),this},i.prototype.isEasing=function(){return!!this._easeFrameId},i.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this);}return this},i.prototype._ease=function(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=r.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));},i.prototype._renderFrameCallback=function(){var t=Math.min((r.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();},i.prototype._normalizeBearing=function(e,i){e=t.wrap(e,-180,180);var n=Math.abs(e-i);return Math.abs(e-360-i)180?-360:i<-180?360:0;}},i}(t.Evented),an=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this);};an.prototype.getDefaultPosition=function(){return"bottom-right"},an.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},an.prototype.onRemove=function(){s.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0;},an.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:_.ACCESS_TOKEN}];if(t){var i=e.reduce(function(t,i,n){return i.value&&(t+=i.key+"="+i.value+(n=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null;}},an.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact");};var sn=function(){t.bindAll(["_updateLogo"],this);};sn.prototype.onAdd=function(t){this._map=t,this._container=s.create("div","mapboxgl-ctrl");var e=s.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._container},sn.prototype.onRemove=function(){s.remove(this._container),this._map.off("sourcedata",this._updateLogo);},sn.prototype.getDefaultPosition=function(){return"bottom-left"},sn.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none");},sn.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t){if(t[e].getSource().mapbox_logo)return!0}return!1}};var ln=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;};ln.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},ln.prototype.remove=function(t){for(var e=this._currentlyRunning,i=0,n=e?this._queue.concat(e):this._queue;ie.maxZoom)throw new Error("maxZoom must be greater than minZoom");var n=new Ui(e.minZoom,e.maxZoom,e.renderWorldCopies);i.call(this,n,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new ln;var o=e.transformRequest;if(this._transformRequest=o?function(t,e){return o(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var r=t.default.document.getElementById(e.container);if(!r)throw new Error("Container '"+e.container+"' not found.");this._container=r;}else{if(!(e.container instanceof un))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container;}e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==t.default&&(t.default.addEventListener("online",this._onWindowOnline,!1),t.default.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var i=t.getCanvasContainer(),n=null,o=!1;for(var r in on)t[r]=new on[r](t,e),e.interactive&&e[r]&&t[r].enable(e[r]);s.addEventListener(i,"mouseout",function(e){t.fire(new ji("mouseout",t,e));}),s.addEventListener(i,"mousedown",function(i){o=!0;var n=new ji("mousedown",t,i);t.fire(n),n.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(i),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(i),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(i));}),s.addEventListener(i,"mouseup",function(e){var i=t.dragRotate.isActive();n&&!i&&t.fire(new ji("contextmenu",t,n)),n=null,o=!1,t.fire(new ji("mouseup",t,e));}),s.addEventListener(i,"mousemove",function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var n=e.toElement||e.target;n&&n!==i;)n=n.parentNode;n===i&&t.fire(new ji("mousemove",t,e));}}),s.addEventListener(i,"mouseover",function(e){for(var n=e.toElement||e.target;n&&n!==i;)n=n.parentNode;n===i&&t.fire(new ji("mouseover",t,e));}),s.addEventListener(i,"touchstart",function(i){var n=new $i("touchstart",t,i);t.fire(n),n.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(i),t.touchZoomRotate.onStart(i),t.doubleClickZoom.onTouchStart(n));},{passive:!1}),s.addEventListener(i,"touchmove",function(e){t.fire(new $i("touchmove",t,e));},{passive:!1}),s.addEventListener(i,"touchend",function(e){t.fire(new $i("touchend",t,e));}),s.addEventListener(i,"touchcancel",function(e){t.fire(new $i("touchcancel",t,e));}),s.addEventListener(i,"click",function(e){t.fire(new ji("click",t,e));}),s.addEventListener(i,"dblclick",function(e){var i=new ji("dblclick",t,e);t.fire(i),i.defaultPrevented||t.doubleClickZoom.onDblClick(i);}),s.addEventListener(i,"contextmenu",function(e){var i=t.dragRotate.isActive();o||i?o&&(n=e):t.fire(new ji("contextmenu",t,e)),e.preventDefault();}),s.addEventListener(i,"wheel",function(e){var i=new Gi("wheel",t,e);t.fire(i),i.defaultPrevented||t.scrollZoom.onWheel(e);},{passive:!1});}(this,e),this._hash=e.hash&&(new Vi).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new an),this.addControl(new sn,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet);}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading);}i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n;var o={showTileBoundaries:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0}};return n.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var i=t.onAdd(this),n=this._controlPositions[e];return-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this},n.prototype.removeControl=function(t){return t.onRemove(this),this},n.prototype.resize=function(e){var i=this._containerDimensions(),n=i[0],o=i[1];return this._resizeCanvas(n,o),this.transform.resize(n,o),this.painter.resize(n,o),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)).fire(new t.Event("resize",e)).fire(new t.Event("moveend",e))},n.prototype.getBounds=function(){var e=new q(this.transform.pointLocation(new t.default$1(0,this.transform.height)),this.transform.pointLocation(new t.default$1(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(e.extend(this.transform.pointLocation(new t.default$1(this.transform.size.x,0))),e.extend(this.transform.pointLocation(new t.default$1(0,this.transform.size.y)))),e},n.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new q([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},n.prototype.setMaxBounds=function(t){if(t){var e=q.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update();}else null==t&&(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},n.prototype.setMinZoom=function(t){if((t=null==t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},n.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},n.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update(),this},n.prototype.getMaxZoom=function(){return this.transform.maxZoom},n.prototype.project=function(t){return this.transform.locationPoint(W.convert(t))},n.prototype.unproject=function(e){return this.transform.pointLocation(t.default$1.convert(e))},n.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},n.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isActive()},n.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},n.prototype.on=function(t,e,n){var o,r=this;if(void 0===n)return i.prototype.on.call(this,t,e);var a=function(){if("mouseenter"===t||"mouseover"===t){var i=!1;return{layer:e,listener:n,delegates:{mousemove:function(o){var a=r.getLayer(e)?r.queryRenderedFeatures(o.point,{layers:[e]}):[];a.length?i||(i=!0,n.call(r,new ji(t,r,o.originalEvent,{features:a}))):i=!1;},mouseout:function(){i=!1;}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:n,delegates:{mousemove:function(i){(r.getLayer(e)?r.queryRenderedFeatures(i.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,n.call(r,new ji(t,r,i.originalEvent)));},mouseout:function(e){a&&(a=!1,n.call(r,new ji(t,r,e.originalEvent)));}}}}return{layer:e,listener:n,delegates:(o={},o[t]=function(t){var i=r.getLayer(e)?r.queryRenderedFeatures(t.point,{layers:[e]}):[];i.length&&(t.features=i,n.call(r,t),delete t.features);},o)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(a),a.delegates)r.on(s,a.delegates[s]);return this},n.prototype.off=function(t,e,n){if(void 0===n)return i.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var o=this._delegatedListeners[t],r=0;r180;){var a=i.locationPoint(t);if(a.x>=0&&a.y>=0&&a.x<=i.width&&a.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360;}return t}mn.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t;},mn.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Hi(t,{button:"left",element:this._compass}),this._handler.enable()),this._container},mn.prototype.onRemove=function(){s.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),this._handler.disable(),delete this._handler),delete this._map;},mn.prototype._createButton=function(t,e,i){var n=s.create("button",t,this._container);return n.type="button",n.setAttribute("aria-label",e),n.addEventListener("click",i),n};var gn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function vn(t,e,i){var n=t.classList;for(var o in gn)n.remove("mapboxgl-"+i+"-anchor-"+o);n.add("mapboxgl-"+i+"-anchor-"+e);}var yn=function(e){if((arguments[0]instanceof t.default.HTMLElement||2===arguments.length)&&(e=t.extend({element:e},arguments[1])),t.bindAll(["_update","_onMapClick"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",e&&e.element)this._element=e.element,this._offset=t.default$1.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div");var i=s.createNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"height","41px"),i.setAttributeNS(null,"width","27px"),i.setAttributeNS(null,"viewBox","0 0 27 41");var n=s.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"stroke","none"),n.setAttributeNS(null,"stroke-width","1"),n.setAttributeNS(null,"fill","none"),n.setAttributeNS(null,"fill-rule","evenodd");var o=s.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"fill-rule","nonzero");var r=s.createNS("http://www.w3.org/2000/svg","g");r.setAttributeNS(null,"transform","translate(3.0, 29.0)"),r.setAttributeNS(null,"fill","#000000");for(var a=0,l=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];a5280)Cn(e,c,p/5280,"mi");else Cn(e,c,p,"ft");}else if(i&&"nautical"===i.unit){Cn(e,c,h/1852,"nm");}else Cn(e,c,h,"m");}function Cn(t,e,i,n){var o,r,a,s=(o=i,(r=Math.pow(10,(""+Math.floor(o)).length-1))*(a=(a=o/r)>=10?10:a>=5?5:a>=3?3:a>=2?2:1)),l=s/i;"m"===n&&s>=1e3&&(s/=1e3,n="km"),t.style.width=e*l+"px",t.innerHTML=s+n;}Tn.prototype.getDefaultPosition=function(){return"bottom-left"},Tn.prototype._onMove=function(){In(this._map,this._container,this.options);},Tn.prototype.onAdd=function(t){return this._map=t,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Tn.prototype.onRemove=function(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0;},Tn.prototype.setUnit=function(t){this.options.unit=t,In(this._map,this._container,this.options);};var Sn=function(){this._fullscreen=!1,t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.default.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.default.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.default.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.default.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl";};Sn.prototype.onAdd=function(e){return this._map=e,this._mapContainer=this._map.getContainer(),this._container=s.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._container},Sn.prototype.onRemove=function(){s.remove(this._container),this._map=null,t.default.document.removeEventListener(this._fullscreenchange,this._changeIcon);},Sn.prototype._checkFullscreenSupport=function(){return!!(t.default.document.fullscreenEnabled||t.default.document.mozFullScreenEnabled||t.default.document.msFullscreenEnabled||t.default.document.webkitFullscreenEnabled)},Sn.prototype._setupUI=function(){var e=this._fullscreenButton=s.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);e.setAttribute("aria-label","Toggle fullscreen"),e.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.default.document.addEventListener(this._fullscreenchange,this._changeIcon);},Sn.prototype._isFullscreen=function(){return this._fullscreen},Sn.prototype._changeIcon=function(){(t.default.document.fullscreenElement||t.default.document.mozFullScreenElement||t.default.document.webkitFullscreenElement||t.default.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"));},Sn.prototype._onClickFullscreen=function(){this._isFullscreen()?t.default.document.exitFullscreen?t.default.document.exitFullscreen():t.default.document.mozCancelFullScreen?t.default.document.mozCancelFullScreen():t.default.document.msExitFullscreen?t.default.document.msExitFullscreen():t.default.document.webkitCancelFullScreen&&t.default.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen();};var zn={closeButton:!0,closeOnClick:!0},An=function(e){function i(i){e.call(this),this.options=t.extend(Object.create(zn),i),t.bindAll(["_update","_onClickClose"],this);}return e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.addTo=function(e){return this._map=e,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this.fire(new t.Event("open")),this},i.prototype.isOpen=function(){return!!this._map},i.prototype.remove=function(){return this._content&&s.remove(this._content),this._container&&(s.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire(new t.Event("close")),this},i.prototype.getLngLat=function(){return this._lngLat},i.prototype.setLngLat=function(t){return this._lngLat=W.convert(t),this._pos=null,this._update(),this},i.prototype.setText=function(e){return this.setDOMContent(t.default.document.createTextNode(e))},i.prototype.setHTML=function(e){var i,n=t.default.document.createDocumentFragment(),o=t.default.document.createElement("body");for(o.innerHTML=e;i=o.firstChild;)n.appendChild(i);return this.setDOMContent(n)},i.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},i.prototype._createContent=function(){this._content&&s.remove(this._content),this._content=s.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=s.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose));},i.prototype._update=function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=s.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=s.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this._map.transform.renderWorldCopies&&(this._lngLat=_n(this._lngLat,this._pos,this._map.transform));var e=this._pos=this._map.project(this._lngLat),i=this.options.anchor,n=function e(i){if(i){if("number"==typeof i){var n=Math.round(Math.sqrt(.5*Math.pow(i,2)));return{center:new t.default$1(0,0),top:new t.default$1(0,i),"top-left":new t.default$1(n,n),"top-right":new t.default$1(-n,n),bottom:new t.default$1(0,-i),"bottom-left":new t.default$1(n,-n),"bottom-right":new t.default$1(-n,-n),left:new t.default$1(i,0),right:new t.default$1(-i,0)}}if(i instanceof t.default$1||Array.isArray(i)){var o=t.default$1.convert(i);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:t.default$1.convert(i.center||[0,0]),top:t.default$1.convert(i.top||[0,0]),"top-left":t.default$1.convert(i["top-left"]||[0,0]),"top-right":t.default$1.convert(i["top-right"]||[0,0]),bottom:t.default$1.convert(i.bottom||[0,0]),"bottom-left":t.default$1.convert(i["bottom-left"]||[0,0]),"bottom-right":t.default$1.convert(i["bottom-right"]||[0,0]),left:t.default$1.convert(i.left||[0,0]),right:t.default$1.convert(i.right||[0,0])}}return e(new t.default$1(0,0))}(this.options.offset);if(!i){var o,r=this._container.offsetWidth,a=this._container.offsetHeight;o=e.y+n.bottom.ythis._map.transform.height-a?["bottom"]:[],e.xthis._map.transform.width-r/2&&o.push("right"),i=0===o.length?"bottom":o.join("-");}var l=e.add(n[i]).round();s.setTransform(this._container,gn[i]+" translate("+l.x+"px,"+l.y+"px)"),vn(this._container,i,"popup");}},i.prototype._onClickClose=function(){this.remove();},i}(t.Evented);var Rn={version:"0.45.0",supported:e,workerCount:Math.max(Math.floor(r.hardwareConcurrency/2),1),setRTLTextPlugin:t.setRTLTextPlugin,Map:pn,NavigationControl:mn,GeolocateControl:wn,AttributionControl:an,ScaleControl:Tn,FullscreenControl:Sn,Popup:An,Marker:yn,Style:Qe,LngLat:W,LngLatBounds:q,Point:t.default$1,Evented:t.Evented,config:_,get accessToken(){return _.ACCESS_TOKEN},set accessToken(t){_.ACCESS_TOKEN=t;},workerUrl:""};return Rn}); - -// - -return mapboxgl; - -}))); - - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],410:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createTable - -var chull = _dereq_('convex-hull') - -function constructVertex(d, a, b) { - var x = new Array(d) - for(var i=0; i row[1][2]) - quaternion[0] = -quaternion[0] - if (row[0][2] > row[2][0]) - quaternion[1] = -quaternion[1] - if (row[1][0] > row[0][1]) - quaternion[2] = -quaternion[2] - return true -} - -//will be replaced by gl-vec4 eventually -function vec4multMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; -} - -//gets upper-left of a 4x4 matrix into a 3x3 of vectors -function mat3from4(out, mat4x4) { - out[0][0] = mat4x4[0] - out[0][1] = mat4x4[1] - out[0][2] = mat4x4[2] - - out[1][0] = mat4x4[4] - out[1][1] = mat4x4[5] - out[1][2] = mat4x4[6] - - out[2][0] = mat4x4[8] - out[2][1] = mat4x4[9] - out[2][2] = mat4x4[10] -} - -function combine(out, a, b, scale1, scale2) { - out[0] = a[0] * scale1 + b[0] * scale2 - out[1] = a[1] * scale1 + b[1] * scale2 - out[2] = a[2] * scale1 + b[2] * scale2 -} -},{"./normalize":412,"gl-mat4/clone":248,"gl-mat4/create":249,"gl-mat4/determinant":250,"gl-mat4/invert":254,"gl-mat4/transpose":264,"gl-vec3/cross":317,"gl-vec3/dot":322,"gl-vec3/length":332,"gl-vec3/normalize":339}],412:[function(_dereq_,module,exports){ -module.exports = function normalize(out, mat) { - var m44 = mat[15] - // Cannot normalize. - if (m44 === 0) - return false - var scale = 1 / m44 - for (var i=0; i<16; i++) - out[i] = mat[i] * scale - return true -} -},{}],413:[function(_dereq_,module,exports){ -var lerp = _dereq_('gl-vec3/lerp') - -var recompose = _dereq_('mat4-recompose') -var decompose = _dereq_('mat4-decompose') -var determinant = _dereq_('gl-mat4/determinant') -var slerp = _dereq_('quat-slerp') - -var state0 = state() -var state1 = state() -var tmp = state() - -module.exports = interpolate -function interpolate(out, start, end, alpha) { - if (determinant(start) === 0 || determinant(end) === 0) - return false - - //decompose the start and end matrices into individual components - var r0 = decompose(start, state0.translate, state0.scale, state0.skew, state0.perspective, state0.quaternion) - var r1 = decompose(end, state1.translate, state1.scale, state1.skew, state1.perspective, state1.quaternion) - if (!r0 || !r1) - return false - - - //now lerp/slerp the start and end components into a temporary lerp(tmptranslate, state0.translate, state1.translate, alpha) - lerp(tmp.translate, state0.translate, state1.translate, alpha) - lerp(tmp.skew, state0.skew, state1.skew, alpha) - lerp(tmp.scale, state0.scale, state1.scale, alpha) - lerp(tmp.perspective, state0.perspective, state1.perspective, alpha) - slerp(tmp.quaternion, state0.quaternion, state1.quaternion, alpha) - - //and recompose into our 'out' matrix - recompose(out, tmp.translate, tmp.scale, tmp.skew, tmp.perspective, tmp.quaternion) - return true -} - -function state() { - return { - translate: vec3(), - scale: vec3(1), - skew: vec3(), - perspective: vec4(), - quaternion: vec4() - } -} - -function vec3(n) { - return [n||0,n||0,n||0] -} - -function vec4() { - return [0,0,0,1] -} -},{"gl-mat4/determinant":250,"gl-vec3/lerp":333,"mat4-decompose":411,"mat4-recompose":414,"quat-slerp":466}],414:[function(_dereq_,module,exports){ -/* -Input: translation ; a 3 component vector - scale ; a 3 component vector - skew ; skew factors XY,XZ,YZ represented as a 3 component vector - perspective ; a 4 component vector - quaternion ; a 4 component vector -Output: matrix ; a 4x4 matrix - -From: http://www.w3.org/TR/css3-transforms/#recomposing-to-a-3d-matrix -*/ - -var mat4 = { - identity: _dereq_('gl-mat4/identity'), - translate: _dereq_('gl-mat4/translate'), - multiply: _dereq_('gl-mat4/multiply'), - create: _dereq_('gl-mat4/create'), - scale: _dereq_('gl-mat4/scale'), - fromRotationTranslation: _dereq_('gl-mat4/fromRotationTranslation') -} - -var rotationMatrix = mat4.create() -var temp = mat4.create() - -module.exports = function recomposeMat4(matrix, translation, scale, skew, perspective, quaternion) { - mat4.identity(matrix) - - //apply translation & rotation - mat4.fromRotationTranslation(matrix, quaternion, translation) - - //apply perspective - matrix[3] = perspective[0] - matrix[7] = perspective[1] - matrix[11] = perspective[2] - matrix[15] = perspective[3] - - // apply skew - // temp is a identity 4x4 matrix initially - mat4.identity(temp) - - if (skew[2] !== 0) { - temp[9] = skew[2] - mat4.multiply(matrix, matrix, temp) - } - - if (skew[1] !== 0) { - temp[9] = 0 - temp[8] = skew[1] - mat4.multiply(matrix, matrix, temp) - } - - if (skew[0] !== 0) { - temp[8] = 0 - temp[4] = skew[0] - mat4.multiply(matrix, matrix, temp) - } - - //apply scale - mat4.scale(matrix, matrix, scale) - return matrix -} -},{"gl-mat4/create":249,"gl-mat4/fromRotationTranslation":252,"gl-mat4/identity":253,"gl-mat4/multiply":256,"gl-mat4/scale":262,"gl-mat4/translate":263}],415:[function(_dereq_,module,exports){ -'use strict'; -module.exports = Math.log2 || function (x) { - return Math.log(x) * Math.LOG2E; -}; - -},{}],416:[function(_dereq_,module,exports){ -'use strict' - -var bsearch = _dereq_('binary-search-bounds') -var m4interp = _dereq_('mat4-interpolate') -var invert44 = _dereq_('gl-mat4/invert') -var rotateX = _dereq_('gl-mat4/rotateX') -var rotateY = _dereq_('gl-mat4/rotateY') -var rotateZ = _dereq_('gl-mat4/rotateZ') -var lookAt = _dereq_('gl-mat4/lookAt') -var translate = _dereq_('gl-mat4/translate') -var scale = _dereq_('gl-mat4/scale') -var normalize = _dereq_('gl-vec3/normalize') - -var DEFAULT_CENTER = [0,0,0] - -module.exports = createMatrixCameraController - -function MatrixCameraController(initialMatrix) { - this._components = initialMatrix.slice() - this._time = [0] - this.prevMatrix = initialMatrix.slice() - this.nextMatrix = initialMatrix.slice() - this.computedMatrix = initialMatrix.slice() - this.computedInverse = initialMatrix.slice() - this.computedEye = [0,0,0] - this.computedUp = [0,0,0] - this.computedCenter = [0,0,0] - this.computedRadius = [0] - this._limits = [-Infinity, Infinity] -} - -var proto = MatrixCameraController.prototype - -proto.recalcMatrix = function(t) { - var time = this._time - var tidx = bsearch.le(time, t) - var mat = this.computedMatrix - if(tidx < 0) { - return - } - var comps = this._components - if(tidx === time.length-1) { - var ptr = 16*tidx - for(var i=0; i<16; ++i) { - mat[i] = comps[ptr++] - } - } else { - var dt = (time[tidx+1] - time[tidx]) - var ptr = 16*tidx - var prev = this.prevMatrix - var allEqual = true - for(var i=0; i<16; ++i) { - prev[i] = comps[ptr++] - } - var next = this.nextMatrix - for(var i=0; i<16; ++i) { - next[i] = comps[ptr++] - allEqual = allEqual && (prev[i] === next[i]) - } - if(dt < 1e-6 || allEqual) { - for(var i=0; i<16; ++i) { - mat[i] = prev[i] - } - } else { - m4interp(mat, prev, next, (t - time[tidx])/dt) - } - } - - var up = this.computedUp - up[0] = mat[1] - up[1] = mat[5] - up[2] = mat[9] - normalize(up, up) - - var imat = this.computedInverse - invert44(imat, mat) - var eye = this.computedEye - var w = imat[15] - eye[0] = imat[12]/w - eye[1] = imat[13]/w - eye[2] = imat[14]/w - - var center = this.computedCenter - var radius = Math.exp(this.computedRadius[0]) - for(var i=0; i<3; ++i) { - center[i] = eye[i] - mat[2+4*i] * radius - } -} - -proto.idle = function(t) { - if(t < this.lastT()) { - return - } - var mc = this._components - var ptr = mc.length-16 - for(var i=0; i<16; ++i) { - mc.push(mc[ptr++]) - } - this._time.push(t) -} - -proto.flush = function(t) { - var idx = bsearch.gt(this._time, t) - 2 - if(idx < 0) { - return - } - this._time.splice(0, idx) - this._components.splice(0, 16*idx) -} - -proto.lastT = function() { - return this._time[this._time.length-1] -} - -proto.lookAt = function(t, eye, center, up) { - this.recalcMatrix(t) - eye = eye || this.computedEye - center = center || DEFAULT_CENTER - up = up || this.computedUp - this.setMatrix(t, lookAt(this.computedMatrix, eye, center, up)) - var d2 = 0.0 - for(var i=0; i<3; ++i) { - d2 += Math.pow(center[i] - eye[i], 2) - } - d2 = Math.log(Math.sqrt(d2)) - this.computedRadius[0] = d2 -} - -proto.rotate = function(t, yaw, pitch, roll) { - this.recalcMatrix(t) - var mat = this.computedInverse - if(yaw) rotateY(mat, mat, yaw) - if(pitch) rotateX(mat, mat, pitch) - if(roll) rotateZ(mat, mat, roll) - this.setMatrix(t, invert44(this.computedMatrix, mat)) -} - -var tvec = [0,0,0] - -proto.pan = function(t, dx, dy, dz) { - tvec[0] = -(dx || 0.0) - tvec[1] = -(dy || 0.0) - tvec[2] = -(dz || 0.0) - this.recalcMatrix(t) - var mat = this.computedInverse - translate(mat, mat, tvec) - this.setMatrix(t, invert44(mat, mat)) -} - -proto.translate = function(t, dx, dy, dz) { - tvec[0] = dx || 0.0 - tvec[1] = dy || 0.0 - tvec[2] = dz || 0.0 - this.recalcMatrix(t) - var mat = this.computedMatrix - translate(mat, mat, tvec) - this.setMatrix(t, mat) -} - -proto.setMatrix = function(t, mat) { - if(t < this.lastT()) { - return - } - this._time.push(t) - for(var i=0; i<16; ++i) { - this._components.push(mat[i]) - } -} - -proto.setDistance = function(t, d) { - this.computedRadius[0] = d -} - -proto.setDistanceLimits = function(a,b) { - var lim = this._limits - lim[0] = a - lim[1] = b -} - -proto.getDistanceLimits = function(out) { - var lim = this._limits - if(out) { - out[0] = lim[0] - out[1] = lim[1] - return out - } - return lim -} - -function createMatrixCameraController(options) { - options = options || {} - var matrix = options.matrix || - [1,0,0,0, - 0,1,0,0, - 0,0,1,0, - 0,0,0,1] - return new MatrixCameraController(matrix) -} - -},{"binary-search-bounds":79,"gl-mat4/invert":254,"gl-mat4/lookAt":255,"gl-mat4/rotateX":259,"gl-mat4/rotateY":260,"gl-mat4/rotateZ":261,"gl-mat4/scale":262,"gl-mat4/translate":263,"gl-vec3/normalize":339,"mat4-interpolate":413}],417:[function(_dereq_,module,exports){ -'use strict' - -module.exports = monotoneConvexHull2D - -var orient = _dereq_('robust-orientation')[3] - -function monotoneConvexHull2D(points) { - var n = points.length - - if(n < 3) { - var result = new Array(n) - for(var i=0; i 1 && orient( - points[lower[m-2]], - points[lower[m-1]], - p) <= 0) { - m -= 1 - lower.pop() - } - lower.push(idx) - - //Insert into upper list - m = upper.length - while(m > 1 && orient( - points[upper[m-2]], - points[upper[m-1]], - p) >= 0) { - m -= 1 - upper.pop() - } - upper.push(idx) - } - - //Merge lists together - var result = new Array(upper.length + lower.length - 2) - var ptr = 0 - for(var i=0, nl=lower.length; i0; --j) { - result[ptr++] = upper[j] - } - - //Return result - return result -} -},{"robust-orientation":486}],418:[function(_dereq_,module,exports){ -'use strict' - -module.exports = mouseListen - -var mouse = _dereq_('mouse-event') - -function mouseListen (element, callback) { - if (!callback) { - callback = element - element = window - } - - var buttonState = 0 - var x = 0 - var y = 0 - var mods = { - shift: false, - alt: false, - control: false, - meta: false - } - var attached = false - - function updateMods (ev) { - var changed = false - if ('altKey' in ev) { - changed = changed || ev.altKey !== mods.alt - mods.alt = !!ev.altKey - } - if ('shiftKey' in ev) { - changed = changed || ev.shiftKey !== mods.shift - mods.shift = !!ev.shiftKey - } - if ('ctrlKey' in ev) { - changed = changed || ev.ctrlKey !== mods.control - mods.control = !!ev.ctrlKey - } - if ('metaKey' in ev) { - changed = changed || ev.metaKey !== mods.meta - mods.meta = !!ev.metaKey - } - return changed - } - - function handleEvent (nextButtons, ev) { - var nextX = mouse.x(ev) - var nextY = mouse.y(ev) - if ('buttons' in ev) { - nextButtons = ev.buttons | 0 - } - if (nextButtons !== buttonState || - nextX !== x || - nextY !== y || - updateMods(ev)) { - buttonState = nextButtons | 0 - x = nextX || 0 - y = nextY || 0 - callback && callback(buttonState, x, y, mods) - } - } - - function clearState (ev) { - handleEvent(0, ev) - } - - function handleBlur () { - if (buttonState || - x || - y || - mods.shift || - mods.alt || - mods.meta || - mods.control) { - x = y = 0 - buttonState = 0 - mods.shift = mods.alt = mods.control = mods.meta = false - callback && callback(0, 0, 0, mods) - } - } - - function handleMods (ev) { - if (updateMods(ev)) { - callback && callback(buttonState, x, y, mods) - } - } - - function handleMouseMove (ev) { - if (mouse.buttons(ev) === 0) { - handleEvent(0, ev) - } else { - handleEvent(buttonState, ev) - } - } - - function handleMouseDown (ev) { - handleEvent(buttonState | mouse.buttons(ev), ev) - } - - function handleMouseUp (ev) { - handleEvent(buttonState & ~mouse.buttons(ev), ev) - } - - function attachListeners () { - if (attached) { - return - } - attached = true - - element.addEventListener('mousemove', handleMouseMove) - - element.addEventListener('mousedown', handleMouseDown) - - element.addEventListener('mouseup', handleMouseUp) - - element.addEventListener('mouseleave', clearState) - element.addEventListener('mouseenter', clearState) - element.addEventListener('mouseout', clearState) - element.addEventListener('mouseover', clearState) - - element.addEventListener('blur', handleBlur) - - element.addEventListener('keyup', handleMods) - element.addEventListener('keydown', handleMods) - element.addEventListener('keypress', handleMods) - - if (element !== window) { - window.addEventListener('blur', handleBlur) - - window.addEventListener('keyup', handleMods) - window.addEventListener('keydown', handleMods) - window.addEventListener('keypress', handleMods) - } - } - - function detachListeners () { - if (!attached) { - return - } - attached = false - - element.removeEventListener('mousemove', handleMouseMove) - - element.removeEventListener('mousedown', handleMouseDown) - - element.removeEventListener('mouseup', handleMouseUp) - - element.removeEventListener('mouseleave', clearState) - element.removeEventListener('mouseenter', clearState) - element.removeEventListener('mouseout', clearState) - element.removeEventListener('mouseover', clearState) - - element.removeEventListener('blur', handleBlur) - - element.removeEventListener('keyup', handleMods) - element.removeEventListener('keydown', handleMods) - element.removeEventListener('keypress', handleMods) - - if (element !== window) { - window.removeEventListener('blur', handleBlur) - - window.removeEventListener('keyup', handleMods) - window.removeEventListener('keydown', handleMods) - window.removeEventListener('keypress', handleMods) - } - } - - // Attach listeners - attachListeners() - - var result = { - element: element - } - - Object.defineProperties(result, { - enabled: { - get: function () { return attached }, - set: function (f) { - if (f) { - attachListeners() - } else { - detachListeners() - } - }, - enumerable: true - }, - buttons: { - get: function () { return buttonState }, - enumerable: true - }, - x: { - get: function () { return x }, - enumerable: true - }, - y: { - get: function () { return y }, - enumerable: true - }, - mods: { - get: function () { return mods }, - enumerable: true - } - }) - - return result -} - -},{"mouse-event":420}],419:[function(_dereq_,module,exports){ -var rootPosition = { left: 0, top: 0 } - -module.exports = mouseEventOffset -function mouseEventOffset (ev, target, out) { - target = target || ev.currentTarget || ev.srcElement - if (!Array.isArray(out)) { - out = [ 0, 0 ] - } - var cx = ev.clientX || 0 - var cy = ev.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() - } -} - -},{}],420:[function(_dereq_,module,exports){ -'use strict' - -function mouseButtons(ev) { - if(typeof ev === 'object') { - if('buttons' in ev) { - return ev.buttons - } else if('which' in ev) { - var b = ev.which - if(b === 2) { - return 4 - } else if(b === 3) { - return 2 - } else if(b > 0) { - return 1<<(b-1) - } - } else if('button' in ev) { - var b = ev.button - if(b === 1) { - return 4 - } else if(b === 2) { - return 2 - } else if(b >= 0) { - return 1< 0) { - stepVal.push(stride(i, order[j-1]) + "*" + shape(order[j-1]) ) - } - vars.push(step(i,order[j]) + "=(" + stepVal.join("-") + ")|0") - } - } - //Create index variables - for(var i=0; i=0; --i) { - sizeVariable.push(shape(order[i])) - } - //Previous phases and vertex_ids - vars.push(POOL_SIZE + "=(" + sizeVariable.join("*") + ")|0", - PHASES + "=mallocUint32(" + POOL_SIZE + ")", - VERTEX_IDS + "=mallocUint32(" + POOL_SIZE + ")", - POINTER + "=0") - //Create cube variables for phases - vars.push(pcube(0) + "=0") - for(var j=1; j<(1<=0; --i) { - forLoopBegin(i, 0) - } - var phaseFuncArgs = [] - for(var i=0; i0; k=(k-1)&subset) { - faceArgs.push(VERTEX_IDS + "[" + POINTER + "+" + pdelta(k) + "]") - } - faceArgs.push(vert(0)) - for(var k=0; k0){", - index(order[i]), "=1;") - createLoop(i-1, mask|(1< 0") - } - if(typeof args.vertex !== "function") { - error("Must specify vertex creation function") - } - if(typeof args.cell !== "function") { - error("Must specify cell creation function") - } - if(typeof args.phase !== "function") { - error("Must specify phase function") - } - var getters = args.getters || [] - var typesig = new Array(arrays) - for(var i=0; i= 0) { - typesig[i] = true - } else { - typesig[i] = false - } - } - return compileSurfaceProcedure( - args.vertex, - args.cell, - args.phase, - scalars, - order, - typesig) -} -},{"typedarray-pool":522}],423:[function(_dereq_,module,exports){ -"use strict" - - - -var fill = _dereq_('cwise/lib/wrapper')({"args":["index","array","scalar"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{_inline_1_arg1_=_inline_1_arg2_.apply(void 0,_inline_1_arg0_)}","args":[{"name":"_inline_1_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) - -module.exports = function(array, f) { - fill(array, f) - return array -} - -},{"cwise/lib/wrapper":137}],424:[function(_dereq_,module,exports){ -'use strict' - -module.exports = gradient - -var dup = _dereq_('dup') -var cwiseCompiler = _dereq_('cwise-compiler') - -var TEMPLATE_CACHE = {} -var GRADIENT_CACHE = {} - -var EmptyProc = { - body: "", - args: [], - thisVars: [], - localVars: [] -} - -var centralDiff = cwiseCompiler({ - args: [ 'array', 'array', 'array' ], - pre: EmptyProc, - post: EmptyProc, - body: { - args: [ { - name: 'out', - lvalue: true, - rvalue: false, - count: 1 - }, { - name: 'left', - lvalue: false, - rvalue: true, - count: 1 - }, { - name: 'right', - lvalue: false, - rvalue: true, - count: 1 - }], - body: "out=0.5*(left-right)", - thisVars: [], - localVars: [] - }, - funcName: 'cdiff' -}) - -var zeroOut = cwiseCompiler({ - args: [ 'array' ], - pre: EmptyProc, - post: EmptyProc, - body: { - args: [ { - name: 'out', - lvalue: true, - rvalue: false, - count: 1 - }], - body: "out=0", - thisVars: [], - localVars: [] - }, - funcName: 'zero' -}) - -function generateTemplate(d) { - if(d in TEMPLATE_CACHE) { - return TEMPLATE_CACHE[d] - } - var code = [] - for(var i=0; i= 0) { - pickStr.push('0') - } else if(facet.indexOf(-(i+1)) >= 0) { - pickStr.push('s['+i+']-1') - } else { - pickStr.push('-1') - loStr.push('1') - hiStr.push('s['+i+']-2') - } - } - var boundStr = '.lo(' + loStr.join() + ').hi(' + hiStr.join() + ')' - if(loStr.length === 0) { - boundStr = '' - } - - if(cod > 0) { - code.push('if(1') - for(var i=0; i= 0 || facet.indexOf(-(i+1)) >= 0) { - continue - } - code.push('&&s[', i, ']>2') - } - code.push('){grad', cod, '(src.pick(', pickStr.join(), ')', boundStr) - for(var i=0; i= 0 || facet.indexOf(-(i+1)) >= 0) { - continue - } - code.push(',dst.pick(', pickStr.join(), ',', i, ')', boundStr) - } - code.push(');') - } - - for(var i=0; i1){dst.set(', - pickStr.join(), ',', bnd, ',0.5*(src.get(', - cPickStr.join(), ')-src.get(', - dPickStr.join(), ')))}else{dst.set(', - pickStr.join(), ',', bnd, ',0)};') - } else { - code.push('if(s[', bnd, ']>1){diff(', outStr, - ',src.pick(', cPickStr.join(), ')', boundStr, - ',src.pick(', dPickStr.join(), ')', boundStr, - ');}else{zero(', outStr, ');};') - } - break - - case 'mirror': - if(cod === 0) { - code.push('dst.set(', pickStr.join(), ',', bnd, ',0);') - } else { - code.push('zero(', outStr, ');') - } - break - - case 'wrap': - var aPickStr = pickStr.slice() - var bPickStr = pickStr.slice() - if(facet[i] < 0) { - aPickStr[bnd] = 's[' + bnd + ']-2' - bPickStr[bnd] = '0' - - } else { - aPickStr[bnd] = 's[' + bnd + ']-1' - bPickStr[bnd] = '1' - } - if(cod === 0) { - code.push('if(s[', bnd, ']>2){dst.set(', - pickStr.join(), ',', bnd, ',0.5*(src.get(', - aPickStr.join(), ')-src.get(', - bPickStr.join(), ')))}else{dst.set(', - pickStr.join(), ',', bnd, ',0)};') - } else { - code.push('if(s[', bnd, ']>2){diff(', outStr, - ',src.pick(', aPickStr.join(), ')', boundStr, - ',src.pick(', bPickStr.join(), ')', boundStr, - ');}else{zero(', outStr, ');};') - } - break - - default: - throw new Error('ndarray-gradient: Invalid boundary condition') - } - } - - if(cod > 0) { - code.push('};') - } - } - - //Enumerate ridges, facets, etc. of hypercube - for(var i=0; i<(1<>", - rrshift: ">>>" -} -;(function(){ - for(var id in assign_ops) { - var op = assign_ops[id] - exports[id] = makeOp({ - args: ["array","array","array"], - body: {args:["a","b","c"], - body: "a=b"+op+"c"}, - funcName: id - }) - exports[id+"eq"] = makeOp({ - args: ["array","array"], - body: {args:["a","b"], - body:"a"+op+"=b"}, - rvalue: true, - funcName: id+"eq" - }) - exports[id+"s"] = makeOp({ - args: ["array", "array", "scalar"], - body: {args:["a","b","s"], - body:"a=b"+op+"s"}, - funcName: id+"s" - }) - exports[id+"seq"] = makeOp({ - args: ["array","scalar"], - body: {args:["a","s"], - body:"a"+op+"=s"}, - rvalue: true, - funcName: id+"seq" - }) - } -})(); - -var unary_ops = { - not: "!", - bnot: "~", - neg: "-", - recip: "1.0/" -} -;(function(){ - for(var id in unary_ops) { - var op = unary_ops[id] - exports[id] = makeOp({ - args: ["array", "array"], - body: {args:["a","b"], - body:"a="+op+"b"}, - funcName: id - }) - exports[id+"eq"] = makeOp({ - args: ["array"], - body: {args:["a"], - body:"a="+op+"a"}, - rvalue: true, - count: 2, - funcName: id+"eq" - }) - } -})(); - -var binary_ops = { - and: "&&", - or: "||", - eq: "===", - neq: "!==", - lt: "<", - gt: ">", - leq: "<=", - geq: ">=" -} -;(function() { - for(var id in binary_ops) { - var op = binary_ops[id] - exports[id] = makeOp({ - args: ["array","array","array"], - body: {args:["a", "b", "c"], - body:"a=b"+op+"c"}, - funcName: id - }) - exports[id+"s"] = makeOp({ - args: ["array","array","scalar"], - body: {args:["a", "b", "s"], - body:"a=b"+op+"s"}, - funcName: id+"s" - }) - exports[id+"eq"] = makeOp({ - args: ["array", "array"], - body: {args:["a", "b"], - body:"a=a"+op+"b"}, - rvalue:true, - count:2, - funcName: id+"eq" - }) - exports[id+"seq"] = makeOp({ - args: ["array", "scalar"], - body: {args:["a","s"], - body:"a=a"+op+"s"}, - rvalue:true, - count:2, - funcName: id+"seq" - }) - } -})(); - -var math_unary = [ - "abs", - "acos", - "asin", - "atan", - "ceil", - "cos", - "exp", - "floor", - "log", - "round", - "sin", - "sqrt", - "tan" -] -;(function() { - for(var i=0; ithis_s){this_s=-a}else if(a>this_s){this_s=a}", localVars: [], thisVars: ["this_s"]}, - post: {args:[], localVars:[], thisVars:["this_s"], body:"return this_s"}, - funcName: "norminf" -}) - -exports.norm1 = compile({ - args:["array"], - pre: {args:[], localVars:[], thisVars:["this_s"], body:"this_s=0"}, - body: {args:[{name:"a", lvalue:false, rvalue:true, count:3}], body: "this_s+=a<0?-a:a", localVars: [], thisVars: ["this_s"]}, - post: {args:[], localVars:[], thisVars:["this_s"], body:"return this_s"}, - funcName: "norm1" -}) - -exports.sup = compile({ - args: [ "array" ], - pre: - { body: "this_h=-Infinity", - args: [], - thisVars: [ "this_h" ], - localVars: [] }, - body: - { body: "if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_", - args: [{"name":"_inline_1_arg0_","lvalue":false,"rvalue":true,"count":2} ], - thisVars: [ "this_h" ], - localVars: [] }, - post: - { body: "return this_h", - args: [], - thisVars: [ "this_h" ], - localVars: [] } - }) - -exports.inf = compile({ - args: [ "array" ], - pre: - { body: "this_h=Infinity", - args: [], - thisVars: [ "this_h" ], - localVars: [] }, - body: - { body: "if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}", - args:[ - {name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2}, - {name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:2}], - thisVars:["this_i","this_v"], - localVars:["_inline_1_k"]}, - post:{ - body:"{return this_i}", - args:[], - thisVars:["this_i"], - localVars:[]} -}) - -exports.random = makeOp({ - args: ["array"], - pre: {args:[], body:"this_f=Math.random", thisVars:["this_f"]}, - body: {args: ["a"], body:"a=this_f()", thisVars:["this_f"]}, - funcName: "random" -}) - -exports.assign = makeOp({ - args:["array", "array"], - body: {args:["a", "b"], body:"a=b"}, - funcName: "assign" }) - -exports.assigns = makeOp({ - args:["array", "scalar"], - body: {args:["a", "b"], body:"a=b"}, - funcName: "assigns" }) - - -exports.equals = compile({ - args:["array", "array"], - pre: EmptyProc, - body: {args:[{name:"x", lvalue:false, rvalue:true, count:1}, - {name:"y", lvalue:false, rvalue:true, count:1}], - body: "if(x!==y){return false}", - localVars: [], - thisVars: []}, - post: {args:[], localVars:[], thisVars:[], body:"return true"}, - funcName: "equals" -}) - - - -},{"cwise-compiler":134}],428:[function(_dereq_,module,exports){ -"use strict" - -var ndarray = _dereq_("ndarray") -var do_convert = _dereq_("./doConvert.js") - -module.exports = function convert(arr, result) { - var shape = [], c = arr, sz = 1 - while(Array.isArray(c)) { - shape.push(c.length) - sz *= c.length - c = c[0] - } - if(shape.length === 0) { - return ndarray() - } - if(!result) { - result = ndarray(new Float64Array(sz), shape) - } - do_convert(result, arr) - return result -} - -},{"./doConvert.js":429,"ndarray":433}],429:[function(_dereq_,module,exports){ -module.exports=_dereq_('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) - -},{"cwise-compiler":134}],430:[function(_dereq_,module,exports){ -"use strict" - -var pool = _dereq_("typedarray-pool") - -var INSERTION_SORT_THRESHOLD = 32 - -function getMallocFree(dtype) { - switch(dtype) { - case "uint8": - return [pool.mallocUint8, pool.freeUint8] - case "uint16": - return [pool.mallocUint16, pool.freeUint16] - case "uint32": - return [pool.mallocUint32, pool.freeUint32] - case "int8": - return [pool.mallocInt8, pool.freeInt8] - case "int16": - return [pool.mallocInt16, pool.freeInt16] - case "int32": - return [pool.mallocInt32, pool.freeInt32] - case "float32": - return [pool.mallocFloat, pool.freeFloat] - case "float64": - return [pool.mallocDouble, pool.freeDouble] - default: - return null - } -} - -function shapeArgs(dimension) { - var args = [] - for(var i=0; i 1) { - var scratch_shape = [] - for(var i=1; i 1) { - - //Copy data into scratch - code.push("dptr=0;sptr=ptr") - for(var i=order.length-1; i>=0; --i) { - var j = order[i] - if(j === 0) { - continue - } - code.push(["for(i",j,"=0;i",j,"left){", - "dptr=0", - "sptr=cptr-s0") - for(var i=1; ib){break __l}"].join("")) - for(var i=order.length-1; i>=1; --i) { - code.push( - "sptr+=e"+i, - "dptr+=f"+i, - "}") - } - - //Copy data back - code.push("dptr=cptr;sptr=cptr-s0") - for(var i=order.length-1; i>=0; --i) { - var j = order[i] - if(j === 0) { - continue - } - code.push(["for(i",j,"=0;i",j,"=0; --i) { - var j = order[i] - if(j === 0) { - continue - } - code.push(["for(i",j,"=0;i",j,"left)&&("+dataRead("cptr-s0")+">scratch)){", - dataWrite("cptr", dataRead("cptr-s0")), - "cptr-=s0", - "}", - dataWrite("cptr", "scratch")) - } - - //Close outer loop body - code.push("}") - if(order.length > 1 && allocator) { - code.push("free(scratch)") - } - code.push("} return " + funcName) - - //Compile and link function - if(allocator) { - var result = new Function("malloc", "free", code.join("\n")) - return result(allocator[0], allocator[1]) - } else { - var result = new Function(code.join("\n")) - return result() - } -} - -function createQuickSort(order, dtype, insertionSort) { - var code = [ "'use strict'" ] - var funcName = ["ndarrayQuickSort", order.join("d"), dtype].join("") - var funcArgs = ["left", "right", "data", "offset" ].concat(shapeArgs(order.length)) - var allocator = getMallocFree(dtype) - var labelCounter=0 - - code.push(["function ", funcName, "(", funcArgs.join(","), "){"].join("")) - - var vars = [ - "sixth=((right-left+1)/6)|0", - "index1=left+sixth", - "index5=right-sixth", - "index3=(left+right)>>1", - "index2=index3-sixth", - "index4=index3+sixth", - "el1=index1", - "el2=index2", - "el3=index3", - "el4=index4", - "el5=index5", - "less=left+1", - "great=right-1", - "pivots_are_equal=true", - "tmp", - "tmp0", - "x", - "y", - "z", - "k", - "ptr0", - "ptr1", - "ptr2", - "comp_pivot1=0", - "comp_pivot2=0", - "comp=0" - ] - - if(order.length > 1) { - var ele_size = [] - for(var i=1; i=0; --i) { - var j = order[i] - if(j === 0) { - continue - } - code.push(["for(i",j,"=0;i",j," 1) { - for(var i=0; i1) { - code.push("ptr_shift+=d"+j) - } else { - code.push("ptr0+=d"+j) - } - code.push("}") - } - } - - function lexicoLoop(label, ptrs, usePivot, body) { - if(ptrs.length === 1) { - code.push("ptr0="+toPointer(ptrs[0])) - } else { - for(var i=0; i 1) { - for(var i=0; i=1; --i) { - if(usePivot) { - code.push("pivot_ptr+=f"+i) - } - if(ptrs.length > 1) { - code.push("ptr_shift+=e"+i) - } else { - code.push("ptr0+=e"+i) - } - code.push("}") - } - } - - function cleanUp() { - if(order.length > 1 && allocator) { - code.push("free(pivot1)", "free(pivot2)") - } - } - - function compareSwap(a_id, b_id) { - var a = "el"+a_id - var b = "el"+b_id - if(order.length > 1) { - var lbl = "__l" + (++labelCounter) - lexicoLoop(lbl, [a, b], false, [ - "comp=",dataRead("ptr0"),"-",dataRead("ptr1"),"\n", - "if(comp>0){tmp0=", a, ";",a,"=",b,";", b,"=tmp0;break ", lbl,"}\n", - "if(comp<0){break ", lbl, "}" - ].join("")) - } else { - code.push(["if(", dataRead(toPointer(a)), ">", dataRead(toPointer(b)), "){tmp0=", a, ";",a,"=",b,";", b,"=tmp0}"].join("")) - } - } - - compareSwap(1, 2) - compareSwap(4, 5) - compareSwap(1, 3) - compareSwap(2, 3) - compareSwap(1, 4) - compareSwap(3, 4) - compareSwap(2, 5) - compareSwap(2, 3) - compareSwap(4, 5) - - if(order.length > 1) { - cacheLoop(["el1", "el2", "el3", "el4", "el5", "index1", "index3", "index5"], true, [ - "pivot1[pivot_ptr]=",dataRead("ptr1"),"\n", - "pivot2[pivot_ptr]=",dataRead("ptr3"),"\n", - "pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n", - "x=",dataRead("ptr0"),"\n", - "y=",dataRead("ptr2"),"\n", - "z=",dataRead("ptr4"),"\n", - dataWrite("ptr5", "x"),"\n", - dataWrite("ptr6", "y"),"\n", - dataWrite("ptr7", "z") - ].join("")) - } else { - code.push([ - "pivot1=", dataRead(toPointer("el2")), "\n", - "pivot2=", dataRead(toPointer("el4")), "\n", - "pivots_are_equal=pivot1===pivot2\n", - "x=", dataRead(toPointer("el1")), "\n", - "y=", dataRead(toPointer("el3")), "\n", - "z=", dataRead(toPointer("el5")), "\n", - dataWrite(toPointer("index1"), "x"), "\n", - dataWrite(toPointer("index3"), "y"), "\n", - dataWrite(toPointer("index5"), "z") - ].join("")) - } - - - function moveElement(dst, src) { - if(order.length > 1) { - cacheLoop([dst, src], false, - dataWrite("ptr0", dataRead("ptr1")) - ) - } else { - code.push(dataWrite(toPointer(dst), dataRead(toPointer(src)))) - } - } - - moveElement("index2", "left") - moveElement("index4", "right") - - function comparePivot(result, ptr, n) { - if(order.length > 1) { - var lbl = "__l" + (++labelCounter) - lexicoLoop(lbl, [ptr], true, [ - result,"=",dataRead("ptr0"),"-pivot",n,"[pivot_ptr]\n", - "if(",result,"!==0){break ", lbl, "}" - ].join("")) - } else { - code.push([result,"=", dataRead(toPointer(ptr)), "-pivot", n].join("")) - } - } - - function swapElements(a, b) { - if(order.length > 1) { - cacheLoop([a,b],false,[ - "tmp=",dataRead("ptr0"),"\n", - dataWrite("ptr0", dataRead("ptr1")),"\n", - dataWrite("ptr1", "tmp") - ].join("")) - } else { - code.push([ - "ptr0=",toPointer(a),"\n", - "ptr1=",toPointer(b),"\n", - "tmp=",dataRead("ptr0"),"\n", - dataWrite("ptr0", dataRead("ptr1")),"\n", - dataWrite("ptr1", "tmp") - ].join("")) - } - } - - function tripleSwap(k, less, great) { - if(order.length > 1) { - cacheLoop([k,less,great], false, [ - "tmp=",dataRead("ptr0"),"\n", - dataWrite("ptr0", dataRead("ptr1")),"\n", - dataWrite("ptr1", dataRead("ptr2")),"\n", - dataWrite("ptr2", "tmp") - ].join("")) - code.push("++"+less, "--"+great) - } else { - code.push([ - "ptr0=",toPointer(k),"\n", - "ptr1=",toPointer(less),"\n", - "ptr2=",toPointer(great),"\n", - "++",less,"\n", - "--",great,"\n", - "tmp=", dataRead("ptr0"), "\n", - dataWrite("ptr0", dataRead("ptr1")), "\n", - dataWrite("ptr1", dataRead("ptr2")), "\n", - dataWrite("ptr2", "tmp") - ].join("")) - } - } - - function swapAndDecrement(k, great) { - swapElements(k, great) - code.push("--"+great) - } - - code.push("if(pivots_are_equal){") - //Pivots are equal case - code.push("for(k=less;k<=great;++k){") - comparePivot("comp", "k", 1) - code.push("if(comp===0){continue}") - code.push("if(comp<0){") - code.push("if(k!==less){") - swapElements("k", "less") - code.push("}") - code.push("++less") - code.push("}else{") - code.push("while(true){") - comparePivot("comp", "great", 1) - code.push("if(comp>0){") - code.push("great--") - code.push("}else if(comp<0){") - tripleSwap("k", "less", "great") - code.push("break") - code.push("}else{") - swapAndDecrement("k", "great") - code.push("break") - code.push("}") - code.push("}") - code.push("}") - code.push("}") - code.push("}else{") - //Pivots not equal case - code.push("for(k=less;k<=great;++k){") - comparePivot("comp_pivot1", "k", 1) - code.push("if(comp_pivot1<0){") - code.push("if(k!==less){") - swapElements("k", "less") - code.push("}") - code.push("++less") - code.push("}else{") - comparePivot("comp_pivot2", "k", 2) - code.push("if(comp_pivot2>0){") - code.push("while(true){") - comparePivot("comp", "great", 2) - code.push("if(comp>0){") - code.push("if(--great1) { - cacheLoop([mem_dest, pivot_dest], true, [ - dataWrite("ptr0", dataRead("ptr1")), "\n", - dataWrite("ptr1", ["pivot",pivot,"[pivot_ptr]"].join("")) - ].join("")) - } else { - code.push( - dataWrite(toPointer(mem_dest), dataRead(toPointer(pivot_dest))), - dataWrite(toPointer(pivot_dest), "pivot"+pivot)) - } - } - - storePivot("left", "(less-1)", 1) - storePivot("right", "(great+1)", 2) - - //Recursive sort call - function doSort(left, right) { - code.push([ - "if((",right,"-",left,")<=",INSERTION_SORT_THRESHOLD,"){\n", - "insertionSort(", left, ",", right, ",data,offset,", shapeArgs(order.length).join(","), ")\n", - "}else{\n", - funcName, "(", left, ",", right, ",data,offset,", shapeArgs(order.length).join(","), ")\n", - "}" - ].join("")) - } - doSort("left", "(less-2)") - doSort("(great+2)", "right") - - //If pivots are equal, then early out - code.push("if(pivots_are_equal){") - cleanUp() - code.push("return") - code.push("}") - - function walkPointer(ptr, pivot, body) { - if(order.length > 1) { - code.push(["__l",++labelCounter,":while(true){"].join("")) - cacheLoop([ptr], true, [ - "if(", dataRead("ptr0"), "!==pivot", pivot, "[pivot_ptr]){break __l", labelCounter, "}" - ].join("")) - code.push(body, "}") - } else { - code.push(["while(", dataRead(toPointer(ptr)), "===pivot", pivot, "){", body, "}"].join("")) - } - } - - //Check bounds - code.push("if(lessindex5){") - - walkPointer("less", 1, "++less") - walkPointer("great", 2, "--great") - - code.push("for(k=less;k<=great;++k){") - comparePivot("comp_pivot1", "k", 1) - code.push("if(comp_pivot1===0){") - code.push("if(k!==less){") - swapElements("k", "less") - code.push("}") - code.push("++less") - code.push("}else{") - comparePivot("comp_pivot2", "k", 2) - code.push("if(comp_pivot2===0){") - code.push("while(true){") - comparePivot("comp", "great", 2) - code.push("if(comp===0){") - code.push("if(--great 1 && allocator) { - var compiled = new Function("insertionSort", "malloc", "free", code.join("\n")) - return compiled(insertionSort, allocator[0], allocator[1]) - } - var compiled = new Function("insertionSort", code.join("\n")) - return compiled(insertionSort) -} - -function compileSort(order, dtype) { - var code = ["'use strict'"] - var funcName = ["ndarraySortWrapper", order.join("d"), dtype].join("") - var funcArgs = [ "array" ] - - code.push(["function ", funcName, "(", funcArgs.join(","), "){"].join("")) - - //Unpack local variables from array - var vars = ["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"] - for(var i=0; i 0) { - vars.push(["d",j,"=s",j,"-d",p,"*n",p].join("")) - } else { - vars.push(["d",j,"=s",j].join("")) - } - p = j - } - var k = order.length-1-i - if(k !== 0) { - if(q > 0) { - vars.push(["e",k,"=s",k,"-e",q,"*n",q, - ",f",k,"=",scratch_stride[k],"-f",q,"*n",q].join("")) - } else { - vars.push(["e",k,"=s",k,",f",k,"=",scratch_stride[k]].join("")) - } - q = k - } - } - - //Declare local variables - code.push("var " + vars.join(",")) - - //Create arguments for subroutine - var sortArgs = ["0", "n0-1", "data", "offset"].concat(shapeArgs(order.length)) - - //Call main sorting routine - code.push([ - "if(n0<=",INSERTION_SORT_THRESHOLD,"){", - "insertionSort(", sortArgs.join(","), ")}else{", - "quickSort(", sortArgs.join(","), - ")}" - ].join("")) - - //Return - code.push("}return " + funcName) - - //Link everything together - var result = new Function("insertionSort", "quickSort", code.join("\n")) - var insertionSort = createInsertionSort(order, dtype) - var quickSort = createQuickSort(order, dtype, insertionSort) - return result(insertionSort, quickSort) -} - -module.exports = compileSort -},{"typedarray-pool":522}],431:[function(_dereq_,module,exports){ -"use strict" - -var compile = _dereq_("./lib/compile_sort.js") -var CACHE = {} - -function sort(array) { - var order = array.order - var dtype = array.dtype - var typeSig = [order, dtype ] - var typeName = typeSig.join(":") - var compiled = CACHE[typeName] - if(!compiled) { - CACHE[typeName] = compiled = compile(order, dtype) - } - compiled(array) - return array -} - -module.exports = sort -},{"./lib/compile_sort.js":430}],432:[function(_dereq_,module,exports){ -'use strict' - -var interp = _dereq_('ndarray-linear-interpolate') - - -var do_warp = _dereq_('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_3_arg4_)}","args":[{"name":"_inline_3_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_3_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_3_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_3_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_3_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_4_arg2_(this_warped,_inline_4_arg0_),_inline_4_arg1_=_inline_4_arg3_.apply(void 0,this_warped)}","args":[{"name":"_inline_4_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_4_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_4_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_4_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_4_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) - -var do_warp_1 = _dereq_('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_7_arg2_(this_warped,_inline_7_arg0_),_inline_7_arg1_=_inline_7_arg3_(_inline_7_arg4_,this_warped[0])}","args":[{"name":"_inline_7_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_7_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_7_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_7_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_7_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) - -var do_warp_2 = _dereq_('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0,0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_10_arg2_(this_warped,_inline_10_arg0_),_inline_10_arg1_=_inline_10_arg3_(_inline_10_arg4_,this_warped[0],this_warped[1])}","args":[{"name":"_inline_10_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_10_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_10_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_10_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_10_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) - -var do_warp_3 = _dereq_('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=[0,0,0]}","args":[],"thisVars":["this_warped"],"localVars":[]},"body":{"body":"{_inline_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0],this_warped[1],this_warped[2])}","args":[{"name":"_inline_13_arg0_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_13_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_13_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_13_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_13_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) - -module.exports = function warp(dest, src, func) { - switch(src.shape.length) { - case 1: - do_warp_1(dest, func, interp.d1, src) - break - case 2: - do_warp_2(dest, func, interp.d2, src) - break - case 3: - do_warp_3(dest, func, interp.d3, src) - break - default: - do_warp(dest, func, interp.bind(undefined, src), src.shape.length) - break - } - return dest -} - -},{"cwise/lib/wrapper":137,"ndarray-linear-interpolate":426}],433:[function(_dereq_,module,exports){ -var iota = _dereq_("iota-array") -var isBuffer = _dereq_("is-buffer") - -var hasTypedArrays = ((typeof Float64Array) !== "undefined") - -function compare1st(a, b) { - return a[0] - b[0] -} - -function order() { - var stride = this.stride - var terms = new Array(stride.length) - var i - for(i=0; iMath.abs(this.stride[1]))?[1,0]:[0,1]}})") - } else if(dimension === 3) { - code.push( -"var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);\ -if(s0>s1){\ -if(s1>s2){\ -return [2,1,0];\ -}else if(s0>s2){\ -return [1,2,0];\ -}else{\ -return [1,0,2];\ -}\ -}else if(s0>s2){\ -return [2,0,1];\ -}else if(s2>s1){\ -return [0,1,2];\ -}else{\ -return [0,2,1];\ -}}})") - } - } else { - code.push("ORDER})") - } - } - - //view.set(i0, ..., v): - code.push( -"proto.set=function "+className+"_set("+args.join(",")+",v){") - if(useGetters) { - code.push("return this.data.set("+index_str+",v)}") - } else { - code.push("return this.data["+index_str+"]=v}") - } - - //view.get(i0, ...): - code.push("proto.get=function "+className+"_get("+args.join(",")+"){") - if(useGetters) { - code.push("return this.data.get("+index_str+")}") - } else { - code.push("return this.data["+index_str+"]}") - } - - //view.index: - code.push( - "proto.index=function "+className+"_index(", args.join(), "){return "+index_str+"}") - - //view.hi(): - code.push("proto.hi=function "+className+"_hi("+args.join(",")+"){return new "+className+"(this.data,"+ - indices.map(function(i) { - return ["(typeof i",i,"!=='number'||i",i,"<0)?this.shape[", i, "]:i", i,"|0"].join("") - }).join(",")+","+ - indices.map(function(i) { - return "this.stride["+i + "]" - }).join(",")+",this.offset)}") - - //view.lo(): - var a_vars = indices.map(function(i) { return "a"+i+"=this.shape["+i+"]" }) - var c_vars = indices.map(function(i) { return "c"+i+"=this.stride["+i+"]" }) - code.push("proto.lo=function "+className+"_lo("+args.join(",")+"){var b=this.offset,d=0,"+a_vars.join(",")+","+c_vars.join(",")) - for(var i=0; i=0){\ -d=i"+i+"|0;\ -b+=c"+i+"*d;\ -a"+i+"-=d}") - } - code.push("return new "+className+"(this.data,"+ - indices.map(function(i) { - return "a"+i - }).join(",")+","+ - indices.map(function(i) { - return "c"+i - }).join(",")+",b)}") - - //view.step(): - code.push("proto.step=function "+className+"_step("+args.join(",")+"){var "+ - indices.map(function(i) { - return "a"+i+"=this.shape["+i+"]" - }).join(",")+","+ - indices.map(function(i) { - return "b"+i+"=this.stride["+i+"]" - }).join(",")+",c=this.offset,d=0,ceil=Math.ceil") - for(var i=0; i=0){c=(c+this.stride["+i+"]*i"+i+")|0}else{a.push(this.shape["+i+"]);b.push(this.stride["+i+"])}") - } - code.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}") - - //Add return statement - code.push("return function construct_"+className+"(data,shape,stride,offset){return new "+className+"(data,"+ - indices.map(function(i) { - return "shape["+i+"]" - }).join(",")+","+ - indices.map(function(i) { - return "stride["+i+"]" - }).join(",")+",offset)}") - - //Compile procedure - var procedure = new Function("CTOR_LIST", "ORDER", code.join("\n")) - return procedure(CACHED_CONSTRUCTORS[dtype], order) -} - -function arrayDType(data) { - if(isBuffer(data)) { - return "buffer" - } - if(hasTypedArrays) { - switch(Object.prototype.toString.call(data)) { - case "[object Float64Array]": - return "float64" - case "[object Float32Array]": - return "float32" - case "[object Int8Array]": - return "int8" - case "[object Int16Array]": - return "int16" - case "[object Int32Array]": - return "int32" - case "[object Uint8Array]": - return "uint8" - case "[object Uint16Array]": - return "uint16" - case "[object Uint32Array]": - return "uint32" - case "[object Uint8ClampedArray]": - return "uint8_clamped" - } - } - if(Array.isArray(data)) { - return "array" - } - return "generic" -} - -var CACHED_CONSTRUCTORS = { - "float32":[], - "float64":[], - "int8":[], - "int16":[], - "int32":[], - "uint8":[], - "uint16":[], - "uint32":[], - "array":[], - "uint8_clamped":[], - "buffer":[], - "generic":[] -} - -;(function() { - for(var id in CACHED_CONSTRUCTORS) { - CACHED_CONSTRUCTORS[id].push(compileConstructor(id, -1)) - } -}); - -function wrappedNDArrayCtor(data, shape, stride, offset) { - if(data === undefined) { - var ctor = CACHED_CONSTRUCTORS.array[0] - return ctor([]) - } else if(typeof data === "number") { - data = [data] - } - if(shape === undefined) { - shape = [ data.length ] - } - var d = shape.length - if(stride === undefined) { - stride = new Array(d) - for(var i=d-1, sz=1; i>=0; --i) { - stride[i] = sz - sz *= shape[i] - } - } - if(offset === undefined) { - offset = 0 - for(var i=0; i>>0 - -module.exports = nextafter - -function nextafter(x, y) { - if(isNaN(x) || isNaN(y)) { - return NaN - } - if(x === y) { - return x - } - if(x === 0) { - if(y < 0) { - return -SMALLEST_DENORM - } else { - return SMALLEST_DENORM - } - } - var hi = doubleBits.hi(x) - var lo = doubleBits.lo(x) - if((y > x) === (x > 0)) { - if(lo === UINT_MAX) { - hi += 1 - lo = 0 - } else { - lo += 1 - } - } else { - if(lo === 0) { - lo = UINT_MAX - hi -= 1 - } else { - lo -= 1 - } - } - return doubleBits.pack(lo, hi) -} -},{"double-bits":152}],435:[function(_dereq_,module,exports){ - -var π = Math.PI -var _120 = radians(120) - -module.exports = normalize - -/** - * describe `path` in terms of cubic bézier - * curves and move commands - * - * @param {Array} path - * @return {Array} - */ - -function normalize(path){ - // init state - var prev - var result = [] - var bezierX = 0 - var bezierY = 0 - var startX = 0 - var startY = 0 - var quadX = null - var quadY = null - var x = 0 - var y = 0 - - for (var i = 0, len = path.length; i < len; i++) { - var seg = path[i] - var command = seg[0] - switch (command) { - case 'M': - startX = seg[1] - startY = seg[2] - break - case 'A': - seg = arc(x, y,seg[1],seg[2],radians(seg[3]),seg[4],seg[5],seg[6],seg[7]) - // split multi part - seg.unshift('C') - if (seg.length > 7) { - result.push(seg.splice(0, 7)) - seg.unshift('C') - } - break - case 'S': - // default control point - var cx = x - var cy = y - if (prev == 'C' || prev == 'S') { - cx += cx - bezierX // reflect the previous command's control - cy += cy - bezierY // point relative to the current point - } - seg = ['C', cx, cy, seg[1], seg[2], seg[3], seg[4]] - break - case 'T': - if (prev == 'Q' || prev == 'T') { - quadX = x * 2 - quadX // as with 'S' reflect previous control point - quadY = y * 2 - quadY - } else { - quadX = x - quadY = y - } - seg = quadratic(x, y, quadX, quadY, seg[1], seg[2]) - break - case 'Q': - quadX = seg[1] - quadY = seg[2] - seg = quadratic(x, y, seg[1], seg[2], seg[3], seg[4]) - break - case 'L': - seg = line(x, y, seg[1], seg[2]) - break - case 'H': - seg = line(x, y, seg[1], y) - break - case 'V': - seg = line(x, y, x, seg[1]) - break - case 'Z': - seg = line(x, y, startX, startY) - break - } - - // update state - prev = command - x = seg[seg.length - 2] - y = seg[seg.length - 1] - if (seg.length > 4) { - bezierX = seg[seg.length - 4] - bezierY = seg[seg.length - 3] - } else { - bezierX = x - bezierY = y - } - result.push(seg) - } - - return result -} - -function line(x1, y1, x2, y2){ - return ['C', x1, y1, x2, y2, x2, y2] -} - -function quadratic(x1, y1, cx, cy, x2, y2){ - return [ - 'C', - x1/3 + (2/3) * cx, - y1/3 + (2/3) * cy, - x2/3 + (2/3) * cx, - y2/3 + (2/3) * cy, - x2, - y2 - ] -} - -// This function is ripped from -// github.com/DmitryBaranovskiy/raphael/blob/4d97d4/raphael.js#L2216-L2304 -// which references w3.org/TR/SVG11/implnote.html#ArcImplementationNotes -// TODO: make it human readable - -function arc(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) { - if (!recursive) { - var xy = rotate(x1, y1, -angle) - x1 = xy.x - y1 = xy.y - xy = rotate(x2, y2, -angle) - x2 = xy.x - y2 = xy.y - var x = (x1 - x2) / 2 - var y = (y1 - y2) / 2 - var h = (x * x) / (rx * rx) + (y * y) / (ry * ry) - if (h > 1) { - h = Math.sqrt(h) - rx = h * rx - ry = h * ry - } - var rx2 = rx * rx - var ry2 = ry * ry - var k = (large_arc_flag == sweep_flag ? -1 : 1) - * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))) - if (k == Infinity) k = 1 // neutralize - var cx = k * rx * y / ry + (x1 + x2) / 2 - var cy = k * -ry * x / rx + (y1 + y2) / 2 - var f1 = Math.asin(((y1 - cy) / ry).toFixed(9)) - var f2 = Math.asin(((y2 - cy) / ry).toFixed(9)) - - f1 = x1 < cx ? π - f1 : f1 - f2 = x2 < cx ? π - f2 : f2 - if (f1 < 0) f1 = π * 2 + f1 - if (f2 < 0) f2 = π * 2 + f2 - if (sweep_flag && f1 > f2) f1 = f1 - π * 2 - if (!sweep_flag && f2 > f1) f2 = f2 - π * 2 - } else { - f1 = recursive[0] - f2 = recursive[1] - cx = recursive[2] - cy = recursive[3] - } - // greater than 120 degrees requires multiple segments - if (Math.abs(f2 - f1) > _120) { - var f2old = f2 - var x2old = x2 - var y2old = y2 - f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1) - x2 = cx + rx * Math.cos(f2) - y2 = cy + ry * Math.sin(f2) - var res = arc(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]) - } - var t = Math.tan((f2 - f1) / 4) - var hx = 4 / 3 * rx * t - var hy = 4 / 3 * ry * t - var curve = [ - 2 * x1 - (x1 + hx * Math.sin(f1)), - 2 * y1 - (y1 - hy * Math.cos(f1)), - x2 + hx * Math.sin(f2), - y2 - hy * Math.cos(f2), - x2, - y2 - ] - if (recursive) return curve - if (res) curve = curve.concat(res) - for (var i = 0; i < curve.length;) { - var rot = rotate(curve[i], curve[i+1], angle) - curve[i++] = rot.x - curve[i++] = rot.y - } - return curve -} - -function rotate(x, y, rad){ - return { - x: x * Math.cos(rad) - y * Math.sin(rad), - y: x * Math.sin(rad) + y * Math.cos(rad) - } -} - -function radians(degress){ - return degress * (π / 180) -} - -},{}],436:[function(_dereq_,module,exports){ -var DEFAULT_NORMALS_EPSILON = 1e-6; -var DEFAULT_FACE_EPSILON = 1e-6; - -//Estimate the vertex normals of a mesh -exports.vertexNormals = function(faces, positions, specifiedEpsilon) { - - var N = positions.length; - var normals = new Array(N); - var epsilon = specifiedEpsilon === void(0) ? DEFAULT_NORMALS_EPSILON : specifiedEpsilon; - - //Initialize normal array - for(var i=0; i epsilon) { - var norm = normals[c]; - var w = 1.0 / Math.sqrt(m01 * m21); - for(var k=0; k<3; ++k) { - var u = (k+1)%3; - var v = (k+2)%3; - norm[k] += w * (d21[u] * d01[v] - d21[v] * d01[u]); - } - } - } - } - - //Scale all normals to unit length - for(var i=0; i epsilon) { - var w = 1.0 / Math.sqrt(m); - for(var k=0; k<3; ++k) { - norm[k] *= w; - } - } else { - for(var k=0; k<3; ++k) { - norm[k] = 0.0; - } - } - } - - //Return the resulting set of patches - return normals; -} - -//Compute face normals of a mesh -exports.faceNormals = function(faces, positions, specifiedEpsilon) { - - var N = faces.length; - var normals = new Array(N); - var epsilon = specifiedEpsilon === void(0) ? DEFAULT_FACE_EPSILON : specifiedEpsilon; - - for(var i=0; i epsilon) { - l = 1.0 / Math.sqrt(l); - } else { - l = 0.0; - } - for(var j=0; j<3; ++j) { - n[j] *= l; - } - normals[i] = n; - } - return normals; -} - - - -},{}],437:[function(_dereq_,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - -},{}],438:[function(_dereq_,module,exports){ -'use strict' - -module.exports = quatFromFrame - -function quatFromFrame( - out, - rx, ry, rz, - ux, uy, uz, - fx, fy, fz) { - var tr = rx + uy + fz - if(l > 0) { - var l = Math.sqrt(tr + 1.0) - out[0] = 0.5 * (uz - fy) / l - out[1] = 0.5 * (fx - rz) / l - out[2] = 0.5 * (ry - uy) / l - out[3] = 0.5 * l - } else { - var tf = Math.max(rx, uy, fz) - var l = Math.sqrt(2 * tf - tr + 1.0) - if(rx >= tf) { - //x y z order - out[0] = 0.5 * l - out[1] = 0.5 * (ux + ry) / l - out[2] = 0.5 * (fx + rz) / l - out[3] = 0.5 * (uz - fy) / l - } else if(uy >= tf) { - //y z x order - out[0] = 0.5 * (ry + ux) / l - out[1] = 0.5 * l - out[2] = 0.5 * (fy + uz) / l - out[3] = 0.5 * (fx - rz) / l - } else { - //z x y order - out[0] = 0.5 * (rz + fx) / l - out[1] = 0.5 * (uz + fy) / l - out[2] = 0.5 * l - out[3] = 0.5 * (ry - ux) / l - } - } - return out -} -},{}],439:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createOrbitController - -var filterVector = _dereq_('filtered-vector') -var lookAt = _dereq_('gl-mat4/lookAt') -var mat4FromQuat = _dereq_('gl-mat4/fromQuat') -var invert44 = _dereq_('gl-mat4/invert') -var quatFromFrame = _dereq_('./lib/quatFromFrame') - -function len3(x,y,z) { - return Math.sqrt(Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2)) -} - -function len4(w,x,y,z) { - return Math.sqrt(Math.pow(w,2) + Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2)) -} - -function normalize4(out, a) { - var ax = a[0] - var ay = a[1] - var az = a[2] - var aw = a[3] - var al = len4(ax, ay, az, aw) - if(al > 1e-6) { - out[0] = ax/al - out[1] = ay/al - out[2] = az/al - out[3] = aw/al - } else { - out[0] = out[1] = out[2] = 0.0 - out[3] = 1.0 - } -} - -function OrbitCameraController(initQuat, initCenter, initRadius) { - this.radius = filterVector([initRadius]) - this.center = filterVector(initCenter) - this.rotation = filterVector(initQuat) - - this.computedRadius = this.radius.curve(0) - this.computedCenter = this.center.curve(0) - this.computedRotation = this.rotation.curve(0) - this.computedUp = [0.1,0,0] - this.computedEye = [0.1,0,0] - this.computedMatrix = [0.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] - - this.recalcMatrix(0) -} - -var proto = OrbitCameraController.prototype - -proto.lastT = function() { - return Math.max( - this.radius.lastT(), - this.center.lastT(), - this.rotation.lastT()) -} - -proto.recalcMatrix = function(t) { - this.radius.curve(t) - this.center.curve(t) - this.rotation.curve(t) - - var quat = this.computedRotation - normalize4(quat, quat) - - var mat = this.computedMatrix - mat4FromQuat(mat, quat) - - var center = this.computedCenter - var eye = this.computedEye - var up = this.computedUp - var radius = Math.exp(this.computedRadius[0]) - - eye[0] = center[0] + radius * mat[2] - eye[1] = center[1] + radius * mat[6] - eye[2] = center[2] + radius * mat[10] - up[0] = mat[1] - up[1] = mat[5] - up[2] = mat[9] - - for(var i=0; i<3; ++i) { - var rr = 0.0 - for(var j=0; j<3; ++j) { - rr += mat[i+4*j] * eye[j] - } - mat[12+i] = -rr - } -} - -proto.getMatrix = function(t, result) { - this.recalcMatrix(t) - var m = this.computedMatrix - if(result) { - for(var i=0; i<16; ++i) { - result[i] = m[i] - } - return result - } - return m -} - -proto.idle = function(t) { - this.center.idle(t) - this.radius.idle(t) - this.rotation.idle(t) -} - -proto.flush = function(t) { - this.center.flush(t) - this.radius.flush(t) - this.rotation.flush(t) -} - -proto.pan = function(t, dx, dy, dz) { - dx = dx || 0.0 - dy = dy || 0.0 - dz = dz || 0.0 - - this.recalcMatrix(t) - var mat = this.computedMatrix - - var ux = mat[1] - var uy = mat[5] - var uz = mat[9] - var ul = len3(ux, uy, uz) - ux /= ul - uy /= ul - uz /= ul - - var rx = mat[0] - var ry = mat[4] - var rz = mat[8] - var ru = rx * ux + ry * uy + rz * uz - rx -= ux * ru - ry -= uy * ru - rz -= uz * ru - var rl = len3(rx, ry, rz) - rx /= rl - ry /= rl - rz /= rl - - var fx = mat[2] - var fy = mat[6] - var fz = mat[10] - var fu = fx * ux + fy * uy + fz * uz - var fr = fx * rx + fy * ry + fz * rz - fx -= fu * ux + fr * rx - fy -= fu * uy + fr * ry - fz -= fu * uz + fr * rz - var fl = len3(fx, fy, fz) - fx /= fl - fy /= fl - fz /= fl - - var vx = rx * dx + ux * dy - var vy = ry * dx + uy * dy - var vz = rz * dx + uz * dy - - this.center.move(t, vx, vy, vz) - - //Update z-component of radius - var radius = Math.exp(this.computedRadius[0]) - radius = Math.max(1e-4, radius + dz) - this.radius.set(t, Math.log(radius)) -} - -proto.rotate = function(t, dx, dy, dz) { - this.recalcMatrix(t) - - dx = dx||0.0 - dy = dy||0.0 - - var mat = this.computedMatrix - - var rx = mat[0] - var ry = mat[4] - var rz = mat[8] - - var ux = mat[1] - var uy = mat[5] - var uz = mat[9] - - var fx = mat[2] - var fy = mat[6] - var fz = mat[10] - - var qx = dx * rx + dy * ux - var qy = dx * ry + dy * uy - var qz = dx * rz + dy * uz - - var bx = -(fy * qz - fz * qy) - var by = -(fz * qx - fx * qz) - var bz = -(fx * qy - fy * qx) - var bw = Math.sqrt(Math.max(0.0, 1.0 - Math.pow(bx,2) - Math.pow(by,2) - Math.pow(bz,2))) - var bl = len4(bx, by, bz, bw) - if(bl > 1e-6) { - bx /= bl - by /= bl - bz /= bl - bw /= bl - } else { - bx = by = bz = 0.0 - bw = 1.0 - } - - var rotation = this.computedRotation - var ax = rotation[0] - var ay = rotation[1] - var az = rotation[2] - var aw = rotation[3] - - var cx = ax*bw + aw*bx + ay*bz - az*by - var cy = ay*bw + aw*by + az*bx - ax*bz - var cz = az*bw + aw*bz + ax*by - ay*bx - var cw = aw*bw - ax*bx - ay*by - az*bz - - //Apply roll - if(dz) { - bx = fx - by = fy - bz = fz - var s = Math.sin(dz) / len3(bx, by, bz) - bx *= s - by *= s - bz *= s - bw = Math.cos(dx) - cx = cx*bw + cw*bx + cy*bz - cz*by - cy = cy*bw + cw*by + cz*bx - cx*bz - cz = cz*bw + cw*bz + cx*by - cy*bx - cw = cw*bw - cx*bx - cy*by - cz*bz - } - - var cl = len4(cx, cy, cz, cw) - if(cl > 1e-6) { - cx /= cl - cy /= cl - cz /= cl - cw /= cl - } else { - cx = cy = cz = 0.0 - cw = 1.0 - } - - this.rotation.set(t, cx, cy, cz, cw) -} - -proto.lookAt = function(t, eye, center, up) { - this.recalcMatrix(t) - - center = center || this.computedCenter - eye = eye || this.computedEye - up = up || this.computedUp - - var mat = this.computedMatrix - lookAt(mat, eye, center, up) - - var rotation = this.computedRotation - quatFromFrame(rotation, - mat[0], mat[1], mat[2], - mat[4], mat[5], mat[6], - mat[8], mat[9], mat[10]) - normalize4(rotation, rotation) - this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3]) - - var fl = 0.0 - for(var i=0; i<3; ++i) { - fl += Math.pow(center[i] - eye[i], 2) - } - this.radius.set(t, 0.5 * Math.log(Math.max(fl, 1e-6))) - - this.center.set(t, center[0], center[1], center[2]) -} - -proto.translate = function(t, dx, dy, dz) { - this.center.move(t, - dx||0.0, - dy||0.0, - dz||0.0) -} - -proto.setMatrix = function(t, matrix) { - - var rotation = this.computedRotation - quatFromFrame(rotation, - matrix[0], matrix[1], matrix[2], - matrix[4], matrix[5], matrix[6], - matrix[8], matrix[9], matrix[10]) - normalize4(rotation, rotation) - this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3]) - - var mat = this.computedMatrix - invert44(mat, matrix) - var w = mat[15] - if(Math.abs(w) > 1e-6) { - var cx = mat[12]/w - var cy = mat[13]/w - var cz = mat[14]/w - - this.recalcMatrix(t) - var r = Math.exp(this.computedRadius[0]) - this.center.set(t, cx-mat[2]*r, cy-mat[6]*r, cz-mat[10]*r) - this.radius.idle(t) - } else { - this.center.idle(t) - this.radius.idle(t) - } -} - -proto.setDistance = function(t, d) { - if(d > 0) { - this.radius.set(t, Math.log(d)) - } -} - -proto.setDistanceLimits = function(lo, hi) { - if(lo > 0) { - lo = Math.log(lo) - } else { - lo = -Infinity - } - if(hi > 0) { - hi = Math.log(hi) - } else { - hi = Infinity - } - hi = Math.max(hi, lo) - this.radius.bounds[0][0] = lo - this.radius.bounds[1][0] = hi -} - -proto.getDistanceLimits = function(out) { - var bounds = this.radius.bounds - if(out) { - out[0] = Math.exp(bounds[0][0]) - out[1] = Math.exp(bounds[1][0]) - return out - } - return [ Math.exp(bounds[0][0]), Math.exp(bounds[1][0]) ] -} - -proto.toJSON = function() { - this.recalcMatrix(this.lastT()) - return { - center: this.computedCenter.slice(), - rotation: this.computedRotation.slice(), - distance: Math.log(this.computedRadius[0]), - zoomMin: this.radius.bounds[0][0], - zoomMax: this.radius.bounds[1][0] - } -} - -proto.fromJSON = function(options) { - var t = this.lastT() - var c = options.center - if(c) { - this.center.set(t, c[0], c[1], c[2]) - } - var r = options.rotation - if(r) { - this.rotation.set(t, r[0], r[1], r[2], r[3]) - } - var d = options.distance - if(d && d > 0) { - this.radius.set(t, Math.log(d)) - } - this.setDistanceLimits(options.zoomMin, options.zoomMax) -} - -function createOrbitController(options) { - options = options || {} - var center = options.center || [0,0,0] - var rotation = options.rotation || [0,0,0,1] - var radius = options.radius || 1.0 - - center = [].slice.call(center, 0, 3) - rotation = [].slice.call(rotation, 0, 4) - normalize4(rotation, rotation) - - var result = new OrbitCameraController( - rotation, - center, - Math.log(radius)) - - result.setDistanceLimits(options.zoomMin, options.zoomMax) - - if('eye' in options || 'up' in options) { - result.lookAt(0, options.eye, options.center, options.up) - } - - return result -} -},{"./lib/quatFromFrame":438,"filtered-vector":215,"gl-mat4/fromQuat":251,"gl-mat4/invert":254,"gl-mat4/lookAt":255}],440:[function(_dereq_,module,exports){ -/*! - * pad-left - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT license. - */ - -'use strict'; - -var repeat = _dereq_('repeat-string'); - -module.exports = function padLeft(str, num, ch) { - ch = typeof ch !== 'undefined' ? (ch + '') : ' '; - return repeat(ch, num) + str; -}; -},{"repeat-string":479}],441:[function(_dereq_,module,exports){ -'use strict' - -/** - * @module parenthesis - */ - -function parse (str, opts) { - // pretend non-string parsed per-se - if (typeof str !== 'string') return [str] - - var res = [str] - - if (typeof opts === 'string' || Array.isArray(opts)) { - opts = {brackets: opts} - } - else if (!opts) opts = {} - - var brackets = opts.brackets ? (Array.isArray(opts.brackets) ? opts.brackets : [opts.brackets]) : ['{}', '[]', '()'] - - var escape = opts.escape || '___' - - var flat = !!opts.flat - - brackets.forEach(function (bracket) { - // create parenthesis regex - var pRE = new RegExp(['\\', bracket[0], '[^\\', bracket[0], '\\', bracket[1], ']*\\', bracket[1]].join('')) - - var ids = [] - - function replaceToken(token, idx, str){ - // save token to res - var refId = res.push(token.slice(bracket[0].length, -bracket[1].length)) - 1 - - ids.push(refId) - - return escape + refId - } - - res.forEach(function (str, i) { - var prevStr - - // replace paren tokens till there’s none - var a = 0 - while (str != prevStr) { - prevStr = str - str = str.replace(pRE, replaceToken) - if (a++ > 10e3) throw Error('References have circular dependency. Please, check them.') - } - - res[i] = str - }) - - // wrap found refs to brackets - ids = ids.reverse() - res = res.map(function (str) { - ids.forEach(function (id) { - str = str.replace(new RegExp('(\\' + escape + id + '(?![0-9]))', 'g'), bracket[0] + '$1' + bracket[1]) - }) - return str - }) - }) - - var re = new RegExp('\\' + escape + '([0-9]+)') - - // transform references to tree - function nest (str, refs, escape) { - var res = [], match - - var a = 0 - while (match = re.exec(str)) { - if (a++ > 10e3) throw Error('Circular references in parenthesis') - - res.push(str.slice(0, match.index)) - - res.push(nest(refs[match[1]], refs)) - - str = str.slice(match.index + match[0].length) - } - - res.push(str) - - return res - } - - return flat ? res : nest(res[0], res) -} - -function stringify (arg, opts) { - if (opts && opts.flat) { - var escape = opts && opts.escape || '___' - - var str = arg[0], prevStr - - // pretend bad string stringified with no parentheses - if (!str) return '' - - - var re = new RegExp('\\' + escape + '([0-9]+)') - - var a = 0 - while (str != prevStr) { - if (a++ > 10e3) throw Error('Circular references in ' + arg) - prevStr = str - str = str.replace(re, replaceRef) - } - - return str - } - - return arg.reduce(function f (prev, curr) { - if (Array.isArray(curr)) { - curr = curr.reduce(f, '') - } - return prev + curr - }, '') - - function replaceRef(match, idx){ - if (arg[idx] == null) throw Error('Reference ' + idx + 'is undefined') - return arg[idx] - } -} - -function parenthesis (arg, opts) { - if (Array.isArray(arg)) { - return stringify(arg, opts) - } - else { - return parse(arg, opts) - } -} - -parenthesis.parse = parse -parenthesis.stringify = stringify - -module.exports = parenthesis - -},{}],442:[function(_dereq_,module,exports){ -'use strict' - -var pick = _dereq_('pick-by-alias') - -module.exports = parseRect - -function parseRect (arg) { - var rect - - // direct arguments sequence - if (arguments.length > 1) { - arg = arguments - } - - // svg viewbox - if (typeof arg === 'string') { - arg = arg.split(/\s/).map(parseFloat) - } - else if (typeof arg === 'number') { - arg = [arg] - } - - // 0, 0, 100, 100 - array-like - if (arg.length && typeof arg[0] === 'number') { - // [w, w] - if (arg.length === 1) { - rect = { - width: arg[0], - height: arg[0], - x: 0, y: 0 - } - } - // [w, h] - else if (arg.length === 2) { - rect = { - width: arg[0], - height: arg[1], - x: 0, y: 0 - } - } - // [l, t, r, b] - else { - rect = { - x: arg[0], - y: arg[1], - width: (arg[2] - arg[0]) || 0, - height: (arg[3] - arg[1]) || 0 - } - } - } - // {x, y, w, h} or {l, t, b, r} - else if (arg) { - arg = pick(arg, { - left: 'x l left Left', - top: 'y t top Top', - width: 'w width W Width', - height: 'h height W Width', - bottom: 'b bottom Bottom', - right: 'r right Right' - }) - - rect = { - x: arg.left || 0, - y: arg.top || 0 - } - - if (arg.width == null) { - if (arg.right) rect.width = arg.right - rect.x - else rect.width = 0 - } - else { - rect.width = arg.width - } - - if (arg.height == null) { - if (arg.bottom) rect.height = arg.bottom - rect.y - else rect.height = 0 - } - else { - rect.height = arg.height - } - } - - return rect -} - -},{"pick-by-alias":448}],443:[function(_dereq_,module,exports){ - -module.exports = parse - -/** - * expected argument lengths - * @type {Object} - */ - -var length = {a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0} - -/** - * segment pattern - * @type {RegExp} - */ - -var segment = /([astvzqmhlc])([^astvzqmhlc]*)/ig - -/** - * parse an svg path data string. Generates an Array - * of commands where each command is an Array of the - * form `[command, arg1, arg2, ...]` - * - * @param {String} path - * @return {Array} - */ - -function parse(path) { - var data = [] - path.replace(segment, function(_, command, args){ - var type = command.toLowerCase() - args = parseValues(args) - - // overloaded moveTo - 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) : [] -} - -},{}],444:[function(_dereq_,module,exports){ -module.exports = function parseUnit(str, out) { - if (!out) - out = [ 0, '' ] - - str = String(str) - var num = parseFloat(str, 10) - out[0] = num - out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' - return out -} -},{}],445:[function(_dereq_,module,exports){ -(function (process){ -// Generated by CoffeeScript 1.12.2 -(function() { - var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; - - if ((typeof performance !== "undefined" && performance !== null) && performance.now) { - module.exports = function() { - return performance.now(); - }; - } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) { - module.exports = function() { - return (getNanoSeconds() - nodeLoadTime) / 1e6; - }; - hrtime = process.hrtime; - getNanoSeconds = function() { - var hr; - hr = hrtime(); - return hr[0] * 1e9 + hr[1]; - }; - moduleLoadTime = getNanoSeconds(); - upTime = process.uptime() * 1e9; - nodeLoadTime = moduleLoadTime - upTime; - } else if (Date.now) { - module.exports = function() { - return Date.now() - loadTime; - }; - loadTime = Date.now(); - } else { - module.exports = function() { - return new Date().getTime() - loadTime; - }; - loadTime = new Date().getTime(); - } - -}).call(this); - - - -}).call(this,_dereq_('_process')) -},{"_process":465}],446:[function(_dereq_,module,exports){ -"use strict" - -module.exports = permutationSign - -var BRUTE_FORCE_CUTOFF = 32 - -var pool = _dereq_("typedarray-pool") - -function permutationSign(p) { - var n = p.length - if(n < BRUTE_FORCE_CUTOFF) { - //Use quadratic algorithm for small n - var sgn = 1 - for(var i=0; i0; --i) { - t = pinv[i] - s = p[i] - p[i] = p[t] - p[t] = s - pinv[i] = pinv[s] - pinv[s] = t - r = (r + s) * i - } - pool.freeUint32(pinv) - pool.freeUint32(p) - return r -} - -function unrank(n, r, p) { - switch(n) { - case 0: - if(p) { return p } - return [] - case 1: - if(p) { - p[0] = 0 - return p - } else { - return [0] - } - case 2: - if(p) { - if(r) { - p[0] = 0 - p[1] = 1 - } else { - p[0] = 1 - p[1] = 0 - } - return p - } else { - return r ? [0,1] : [1,0] - } - default: - break - } - p = p || new Array(n) - var s, t, i, nf=1 - p[0] = 0 - for(i=1; i0; --i) { - s = (r / nf)|0 - r = (r - s * nf)|0 - nf = (nf / i)|0 - t = p[i]|0 - p[i] = p[s]|0 - p[s] = t|0 - } - return p -} - -exports.rank = rank -exports.unrank = unrank - -},{"invert-permutation":398,"typedarray-pool":522}],448:[function(_dereq_,module,exports){ -'use strict' - - -module.exports = function pick (src, props, keepRest) { - var result = {}, prop, i - - if (typeof props === 'string') props = toList(props) - if (Array.isArray(props)) { - var res = {} - for (i = 0; i < props.length; i++) { - res[props[i]] = true - } - props = res - } - - // convert strings to lists - for (prop in props) { - props[prop] = toList(props[prop]) - } - - // keep-rest strategy requires unmatched props to be preserved - var occupied = {} - - for (prop in props) { - var aliases = props[prop] - - if (Array.isArray(aliases)) { - for (i = 0; i < aliases.length; i++) { - var alias = aliases[i] - - if (keepRest) { - occupied[alias] = true - } - - if (alias in src) { - result[prop] = src[alias] - - if (keepRest) { - for (var j = i; j < aliases.length; j++) { - occupied[aliases[j]] = true - } - } - - break - } - } - } - else if (prop in src) { - if (props[prop]) { - result[prop] = src[prop] - } - - if (keepRest) { - occupied[prop] = true - } - } - } - - if (keepRest) { - for (prop in src) { - if (occupied[prop]) continue - result[prop] = src[prop] - } - } - - return result -} - -var CACHE = {} - -function toList(arg) { - if (CACHE[arg]) return CACHE[arg] - if (typeof arg === 'string') { - arg = CACHE[arg] = arg.split(/\s*,\s*|\s+/) - } - return arg -} - -},{}],449:[function(_dereq_,module,exports){ -"use strict" - -module.exports = planarDual - -var compareAngle = _dereq_("compare-angle") - -function planarDual(cells, positions) { - - var numVertices = positions.length|0 - var numEdges = cells.length - var adj = [new Array(numVertices), new Array(numVertices)] - for(var i=0; i 0) { - nextCell = adj[i][b][0] - nextDir = i - break - } - } - nextVertex = nextCell[nextDir^1] - - for(var dir=0; dir<2; ++dir) { - var nbhd = adj[dir][b] - for(var k=0; k 0) { - nextCell = e - nextVertex = p - nextDir = dir - } - } - } - if(noCut) { - return nextVertex - } - if(nextCell) { - cut(nextCell, nextDir) - } - return nextVertex - } - - function extractCycle(v, dir) { - var e0 = adj[dir][v][0] - var cycle = [v] - cut(e0, dir) - var u = e0[dir^1] - var d0 = dir - while(true) { - while(u !== v) { - cycle.push(u) - u = next(cycle[cycle.length-2], u, false) - } - if(adj[0][v].length + adj[1][v].length === 0) { - break - } - var a = cycle[cycle.length-1] - var b = v - var c = cycle[1] - var d = next(a, b, true) - if(compareAngle(positions[a], positions[b], positions[c], positions[d]) < 0) { - break - } - cycle.push(v) - u = next(a, b) - } - return cycle - } - - function shouldGlue(pcycle, ncycle) { - return (ncycle[1] === ncycle[ncycle.length-1]) - } - - for(var i=0; i 0) { - var ni = adj[0][i].length - var ncycle = extractCycle(i,j) - if(shouldGlue(pcycle, ncycle)) { - //Glue together trivial cycles - pcycle.push.apply(pcycle, ncycle) - } else { - if(pcycle.length > 0) { - cycles.push(pcycle) - } - pcycle = ncycle - } - } - if(pcycle.length > 0) { - cycles.push(pcycle) - } - } - } - - //Combine paths and loops together - return cycles -} -},{"compare-angle":115}],450:[function(_dereq_,module,exports){ -'use strict' - -module.exports = trimLeaves - -var e2a = _dereq_('edges-to-adjacency-list') - -function trimLeaves(edges, positions) { - var adj = e2a(edges, positions.length) - var live = new Array(positions.length) - var nbhd = new Array(positions.length) - - var dead = [] - for(var i=0; i 0) { - var v = dead.pop() - live[v] = false - var n = adj[v] - for(var i=0; i 0 - } - - //Extract all clockwise faces - faces = faces.filter(ccw) - - //Detect which loops are contained in one another to handle parent-of relation - var numFaces = faces.length - var parent = new Array(numFaces) - var containment = new Array(numFaces) - for(var i=0; i 0) { - var top = toVisit.pop() - var nbhd = fadj[top] - uniq(nbhd, function(a,b) { - return a-b - }) - var nnbhr = nbhd.length - var p = parity[top] - var polyline - if(p === 0) { - var c = faces[top] - polyline = [c] - } - for(var i=0; i= 0) { - continue - } - parity[f] = p^1 - toVisit.push(f) - if(p === 0) { - var c = faces[f] - if(!sharedBoundary(c)) { - c.reverse() - polyline.push(c) - } - } - } - if(p === 0) { - result.push(polyline) - } - } - - return result -} -},{"./lib/trim-leaves":450,"edges-to-adjacency-list":157,"planar-dual":449,"point-in-big-polygon":455,"robust-sum":491,"two-product":520,"uniq":524}],452:[function(_dereq_,module,exports){ -'use strict' - -module.exports = _dereq_('./quad') -},{"./quad":454}],453:[function(_dereq_,module,exports){ -arguments[4][99][0].apply(exports,arguments) -},{"dup":99}],454:[function(_dereq_,module,exports){ -/** - * @module point-cluster/quad - * - * Bucket based quad tree clustering - */ - -'use strict' - -var search = _dereq_('binary-search-bounds') -var clamp = _dereq_('clamp') -var rect = _dereq_('parse-rect') -var getBounds = _dereq_('array-bounds') -var pick = _dereq_('pick-by-alias') -var defined = _dereq_('defined') -var flatten = _dereq_('flatten-vertex-data') -var isObj = _dereq_('is-obj') -var dtype = _dereq_('dtype') -var log2 = _dereq_('math-log2') - - -module.exports = function cluster (srcPoints, options) { - if (!options) { options = {} } - - srcPoints = flatten(srcPoints, 'float64') - - options = pick(options, { - bounds: 'range bounds dataBox databox', - maxDepth: 'depth maxDepth maxdepth level maxLevel maxlevel levels', - dtype: 'type dtype format out dst output destination' - // sort: 'sortBy sortby sort', - // pick: 'pick levelPoint', - // nodeSize: 'node nodeSize minNodeSize minSize size' - }) - - // let nodeSize = defined(options.nodeSize, 1) - var maxDepth = defined(options.maxDepth, 255) - var bounds = defined(options.bounds, getBounds(srcPoints, 2)) - if (bounds[0] === bounds[2]) { bounds[2]++ } - if (bounds[1] === bounds[3]) { bounds[3]++ } - - var points = normalize(srcPoints, bounds) - - // init variables - var n = srcPoints.length >>> 1 - var ids - if (!options.dtype) { options.dtype = 'array' } - - if (typeof options.dtype === 'string') { - ids = new (dtype(options.dtype))(n) - } - else if (options.dtype) { - ids = options.dtype - if (Array.isArray(ids)) { ids.length = n } - } - for (var i = 0; i < n; ++i) { - ids[i] = i - } - - // point indexes for levels [0: [a,b,c,d], 1: [a,b,c,d,e,f,...], ...] - var levels = [] - - // starting indexes of subranges in sub levels, levels.length * 4 - var sublevels = [] - - // unique group ids, sorted in z-curve fashion within levels - var groups = [] - - // level offsets in `ids` - var offsets = [] - - - // sort points - sort(0, 0, 1, ids, 0, 1) - - - // return reordered ids with provided methods - // save level offsets in output buffer - var offset = 0 - for (var level = 0; level < levels.length; level++) { - var levelItems = levels[level] - if (ids.set) { ids.set(levelItems, offset) } - else { - for (var i$1 = 0, l = levelItems.length; i$1 < l; i$1++) { - ids[i$1 + offset] = levelItems[i$1] - } - } - var nextOffset = offset + levels[level].length - offsets[level] = [offset, nextOffset] - offset = nextOffset - } - - ids.range = range - - return ids - - - - // FIXME: it is possible to create one typed array heap and reuse that to avoid memory blow - function sort (x, y, diam, ids, level, group) { - if (!ids.length) { return null } - - // save first point as level representative - var levelItems = levels[level] || (levels[level] = []) - var levelGroups = groups[level] || (groups[level] = []) - var sublevel = sublevels[level] || (sublevels[level] = []) - var offset = levelItems.length - - level++ - - // max depth reached - put all items into a first group - if (level > maxDepth) { - for (var i = 0; i < ids.length; i++) { - levelItems.push(ids[i]) - levelGroups.push(group) - sublevel.push(null, null, null, null) - } - - return offset - } - - levelItems.push(ids[0]) - levelGroups.push(group) - - if (ids.length <= 1) { - sublevel.push(null, null, null, null) - return offset - } - - - var d2 = diam * .5 - var cx = x + d2, cy = y + d2 - - // distribute points by 4 buckets - var lolo = [], lohi = [], hilo = [], hihi = [] - - for (var i$1 = 1, l = ids.length; i$1 < l; i$1++) { - var idx = ids[i$1], - x$1 = points[idx * 2], - y$1 = points[idx * 2 + 1] - x$1 < cx ? (y$1 < cy ? lolo.push(idx) : lohi.push(idx)) : (y$1 < cy ? hilo.push(idx) : hihi.push(idx)) - } - - group <<= 2 - sublevel.push( - sort(x, y, d2, lolo, level, group), - sort(x, cy, d2, lohi, level, group + 1), - sort(cx, y, d2, hilo, level, group + 2), - sort(cx, cy, d2, hihi, level, group + 3) - ) - - return offset - } - - // get all points within the passed range - function range () { - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - var options - - if (isObj(args[args.length - 1])) { - var arg = args.pop() - - // detect if that was a rect object - if (!args.length && (arg.x != null || arg.l != null || arg.left != null)) { - args = [arg] - options = {} - } - - options = pick(arg, { - level: 'level maxLevel', - d: 'd diam diameter r radius px pxSize pixel pixelSize maxD size minSize', - lod: 'lod details ranges offsets' - }) - } - else { - options = {} - } - - if (!args.length) { args = bounds } - - var box = rect.apply( void 0, args ) - - var ref = [ - Math.min(box.x, box.x + box.width), - Math.min(box.y, box.y + box.height), - Math.max(box.x, box.x + box.width), - Math.max(box.y, box.y + box.height) - ]; - var minX = ref[0]; - var minY = ref[1]; - var maxX = ref[2]; - var maxY = ref[3]; - - var ref$1 = normalize([minX, minY, maxX, maxY], bounds ); - var nminX = ref$1[0]; - var nminY = ref$1[1]; - var nmaxX = ref$1[2]; - var nmaxY = ref$1[3]; - - var maxLevel = defined(options.level, levels.length) - - // limit maxLevel by px size - if (options.d != null) { - var d - if (typeof options.d === 'number') { d = [options.d, options.d] } - else if (options.d.length) { d = options.d } - - maxLevel = Math.min( - Math.max( - Math.ceil(-log2(Math.abs(d[0]) / (bounds[2] - bounds[0]))), - Math.ceil(-log2(Math.abs(d[1]) / (bounds[3] - bounds[1]))) - ), - maxLevel - ) - } - maxLevel = Math.min(maxLevel, levels.length) - - // return levels of details - if (options.lod) { - return lod(nminX, nminY, nmaxX, nmaxY, maxLevel) - } - - - - // do selection ids - var selection = [] - - // FIXME: probably we can do LOD here beforehead - select( 0, 0, 1, 0, 0, 1) - - function select ( lox, loy, d, level, from, to ) { - if (from === null || to === null) { return } - - var hix = lox + d - var hiy = loy + d - - // if box does not intersect level - ignore - if ( nminX > hix || nminY > hiy || nmaxX < lox || nmaxY < loy ) { return } - if ( level >= maxLevel ) { return } - if ( from === to ) { return } - - // if points fall into box range - take it - var levelItems = levels[level] - - if (to === undefined) { to = levelItems.length } - - for (var i = from; i < to; i++) { - var id = levelItems[i] - - var px = srcPoints[ id * 2 ] - var py = srcPoints[ id * 2 + 1 ] - - if ( px >= minX && px <= maxX && py >= minY && py <= maxY ) {selection.push(id) - } - } - - // for every subsection do select - var offsets = sublevels[ level ] - var off0 = offsets[ from * 4 + 0 ] - var off1 = offsets[ from * 4 + 1 ] - var off2 = offsets[ from * 4 + 2 ] - var off3 = offsets[ from * 4 + 3 ] - var end = nextOffset(offsets, from + 1) - - var d2 = d * .5 - var nextLevel = level + 1 - select( lox, loy, d2, nextLevel, off0, off1 || off2 || off3 || end) - select( lox, loy + d2, d2, nextLevel, off1, off2 || off3 || end) - select( lox + d2, loy, d2, nextLevel, off2, off3 || end) - select( lox + d2, loy + d2, d2, nextLevel, off3, end) - } - - function nextOffset(offsets, from) { - var offset = null, i = 0 - while(offset === null) { - offset = offsets[ from * 4 + i ] - i++ - if (i > offsets.length) { return null } - } - return offset - } - - return selection - } - - // get range offsets within levels to render lods appropriate for zoom level - // TODO: it is possible to store minSize of a point to optimize neede level calc - function lod (lox, loy, hix, hiy, maxLevel) { - var ranges = [] - - for (var level = 0; level < maxLevel; level++) { - var levelGroups = groups[level] - var from = offsets[level][0] - - var levelGroupStart = group(lox, loy, level) - var levelGroupEnd = group(hix, hiy, level) - - // FIXME: utilize sublevels to speed up search range here - var startOffset = search.ge(levelGroups, levelGroupStart) - var endOffset = search.gt(levelGroups, levelGroupEnd, startOffset, levelGroups.length - 1) - - ranges[level] = [startOffset + from, endOffset + from] - } - - return ranges - } - - // get group id closest to the x,y coordinate, corresponding to a level - function group (x, y, level) { - var group = 1 - - var cx = .5, cy = .5 - var diam = .5 - - for (var i = 0; i < level; i++) { - group <<= 2 - - group += x < cx ? (y < cy ? 0 : 1) : (y < cy ? 2 : 3) - - diam *= .5 - - cx += x < cx ? -diam : diam - cy += y < cy ? -diam : diam - } - - return group - } -} - - -// normalize points by bounds -function normalize (pts, bounds) { - var lox = bounds[0]; - var loy = bounds[1]; - var hix = bounds[2]; - var hiy = bounds[3]; - var scaleX = 1.0 / (hix - lox) - var scaleY = 1.0 / (hiy - loy) - var result = new Array(pts.length) - - for (var i = 0, n = pts.length / 2; i < n; i++) { - result[2*i] = clamp((pts[2*i] - lox) * scaleX, 0, 1) - result[2*i+1] = clamp((pts[2*i+1] - loy) * scaleY, 0, 1) - } - - return result -} -},{"array-bounds":53,"binary-search-bounds":453,"clamp":103,"defined":149,"dtype":154,"flatten-vertex-data":216,"is-obj":404,"math-log2":415,"parse-rect":442,"pick-by-alias":448}],455:[function(_dereq_,module,exports){ -module.exports = preprocessPolygon - -var orient = _dereq_('robust-orientation')[3] -var makeSlabs = _dereq_('slab-decomposition') -var makeIntervalTree = _dereq_('interval-tree-1d') -var bsearch = _dereq_('binary-search-bounds') - -function visitInterval() { - return true -} - -function intervalSearch(table) { - return function(x, y) { - var tree = table[x] - if(tree) { - return !!tree.queryPoint(y, visitInterval) - } - return false - } -} - -function buildVerticalIndex(segments) { - var table = {} - for(var i=0; i 0 && coordinates[bucket] === p[0]) { - root = slabs[bucket-1] - } else { - return 1 - } - } - var lastOrientation = 1 - while(root) { - var s = root.key - var o = orient(p, s[0], s[1]) - if(s[0][0] < s[1][0]) { - if(o < 0) { - root = root.left - } else if(o > 0) { - lastOrientation = -1 - root = root.right - } else { - return 0 - } - } else { - if(o > 0) { - root = root.left - } else if(o < 0) { - lastOrientation = 1 - root = root.right - } else { - return 0 - } - } - } - return lastOrientation - } -} - -function classifyEmpty(p) { - return 1 -} - -function createClassifyVertical(testVertical) { - return function classify(p) { - if(testVertical(p[0], p[1])) { - return 0 - } - return 1 - } -} - -function createClassifyPointDegen(testVertical, testNormal) { - return function classify(p) { - if(testVertical(p[0], p[1])) { - return 0 - } - return testNormal(p) - } -} - -function preprocessPolygon(loops) { - //Compute number of loops - var numLoops = loops.length - - //Unpack segments - var segments = [] - var vsegments = [] - var ptr = 0 - for(var i=0; i= -eps; - }, - pointBetween: function(p, left, right){ - // p must be collinear with left->right - // returns false if p == left, p == right, or 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` is 0, then `p` == `left` or `left` == `right` (reject) - // if `dot` is less than 0, then `p` is to the left of `left` (reject) - if (dot < eps) - return false; - - var sqlen = d_rx_lx * d_rx_lx + d_ry_ly * d_ry_ly; - // if `dot` > `sqlen`, then `p` is to the right of `right` (reject) - // therefore, if `dot - sqlen` is greater than 0, then `p` is to the right of `right` (reject) - if (dot - sqlen > -eps) - return false; - - return true; - }, - pointsSameX: function(p1, p2){ - return Math.abs(p1[0] - p2[0]) < eps; - }, - pointsSameY: function(p1, p2){ - return Math.abs(p1[1] - p2[1]) < eps; - }, - pointsSame: function(p1, p2){ - return my.pointsSameX(p1, p2) && my.pointsSameY(p1, p2); - }, - pointsCompare: function(p1, p2){ - // returns -1 if p1 is smaller, 1 if p2 is smaller, 0 if equal - if (my.pointsSameX(p1, p2)) - return my.pointsSameY(p1, p2) ? 0 : (p1[1] < p2[1] ? -1 : 1); - return p1[0] < p2[0] ? -1 : 1; - }, - pointsCollinear: function(pt1, pt2, pt3){ - // does pt1->pt2->pt3 make a straight line? - // essentially this is just checking to see if the slope(pt1->pt2) === slope(pt2->pt3) - // if slopes are equal, then they must be collinear, because they share pt2 - 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(a0, a1, b0, b1){ - // returns false if the lines are coincident (e.g., parallel or on top of each other) - // - // returns an object if the lines intersect: - // { - // pt: [x, y], where the intersection point is at - // alongA: where intersection point is along A, - // alongB: where intersection point is along B - // } - // - // alongA and alongB will each be one of: -2, -1, 0, 1, 2 - // - // with the following meaning: - // - // -2 intersection point is before segment's first point - // -1 intersection point is directly on segment's first point - // 0 intersection point is between segment's first and second points (exclusive) - // 1 intersection point is directly on segment's second point - // 2 intersection point is after segment's second point - var adx = a1[0] - a0[0]; - var ady = a1[1] - a0[1]; - var bdx = b1[0] - b0[0]; - var bdy = b1[1] - b0[1]; - - var axb = adx * bdy - ady * bdx; - if (Math.abs(axb) < eps) - return false; // lines are coincident - - var dx = a0[0] - b0[0]; - var dy = a0[1] - b0[1]; - - var A = (bdx * dy - bdy * dx) / axb; - var B = (adx * dy - ady * dx) / axb; - - var ret = { - alongA: 0, - alongB: 0, - pt: [ - a0[0] + A * adx, - a0[1] + A * ady - ] - }; - - // categorize where intersection point is along A and B - - 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(pt, region){ - var x = pt[0]; - var y = pt[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 y is between curr_y and last_y, and - // x is to the right of the boundary created by the line - 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; -} - -module.exports = Epsilon; - -},{}],459:[function(_dereq_,module,exports){ -// (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc -// MIT License -// Project Home: https://github.com/voidqk/polybooljs - -// -// convert between PolyBool polygon format and GeoJSON formats (Polygon and MultiPolygon) -// - -var GeoJSON = { - // convert a GeoJSON object to a PolyBool polygon - toPolygon: function(PolyBool, geojson){ - - // converts list of LineString's to segments - function GeoPoly(coords){ - // check for empty coords - if (coords.length <= 0) - return PolyBool.segments({ inverted: false, regions: [] }); - - // convert LineString to segments - function LineString(ls){ - // remove tail which should be the same as head - var reg = ls.slice(0, ls.length - 1); - return PolyBool.segments({ inverted: false, regions: [reg] }); - } - - // the first LineString is considered the outside - var out = LineString(coords[0]); - - // the rest of the LineStrings are considered interior holes, so subtract them from the - // current result - for (var i = 1; i < coords.length; i++) - out = PolyBool.selectDifference(PolyBool.combine(out, LineString(coords[i]))); - - return out; - } - - if (geojson.type === 'Polygon'){ - // single polygon, so just convert it and we're done - return PolyBool.polygon(GeoPoly(geojson.coordinates)); - } - else if (geojson.type === 'MultiPolygon'){ - // multiple polygons, so union all the polygons together - 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){ - // make sure out polygon is clean - poly = PolyBool.polygon(PolyBool.segments(poly)); - - // test if r1 is inside r2 - function regionInsideRegion(r1, r2){ - // we're guaranteed no lines intersect (because the polygon is clean), but a vertex - // could be on the edge -- so we just average pt[0] and pt[1] to produce a point on the - // edge of the first line, which cannot be on an edge - return eps.pointInsideRegion([ - (r1[0][0] + r1[1][0]) * 0.5, - (r1[0][1] + r1[1][1]) * 0.5 - ], r2); - } - - // calculate inside heirarchy - // - // _____________________ _______ roots -> A -> F - // | A | | F | | | - // | _______ _______ | | ___ | +-- B +-- G - // | | B | | C | | | | | | | | - // | | ___ | | ___ | | | | | | | +-- D - // | | | D | | | | E | | | | | G | | | - // | | |___| | | |___| | | | | | | +-- C - // | |_______| |_______| | | |___| | | - // |_____________________| |_______| +-- E - - function newNode(region){ - return { - region: region, - children: [] - }; - } - - var roots = newNode(null); - - function addChild(root, region){ - // first check if we're inside any children - for (var i = 0; i < root.children.length; i++){ - var child = root.children[i]; - if (regionInsideRegion(region, child.region)){ - // we are, so insert inside them instead - addChild(child, region); - return; - } - } - - // not inside any children, so check to see if any children are inside us - var node = newNode(region); - for (var i = 0; i < root.children.length; i++){ - var child = root.children[i]; - if (regionInsideRegion(child.region, region)){ - // oops... move the child beneath us, and remove them from root - node.children.push(child); - root.children.splice(i, 1); - i--; - } - } - - // now we can add ourselves - root.children.push(node); - } - - // add all regions to the root - for (var i = 0; i < poly.regions.length; i++){ - var region = poly.regions[i]; - if (region.length < 3) // regions must have at least 3 points (sanity check) - continue; - addChild(roots, region); - } - - // with our heirarchy, we can distinguish between exterior borders, and interior holes - // the root nodes are exterior, children are interior, children's children are exterior, - // children's children's children are interior, etc - - // while we're at it, exteriors are counter-clockwise, and interiors are clockwise - - function forceWinding(region, clockwise){ - // first, see if we're clockwise or counter-clockwise - // https://en.wikipedia.org/wiki/Shoelace_formula - var winding = 0; - var last_x = region[region.length - 1][0]; - var last_y = region[region.length - 1][1]; - var copy = []; - for (var i = 0; i < region.length; i++){ - var curr_x = region[i][0]; - var curr_y = region[i][1]; - copy.push([curr_x, curr_y]); // create a copy while we're at it - winding += curr_y * last_x - curr_x * last_y; - last_x = curr_x; - last_y = curr_y; - } - // this assumes Cartesian coordinates (Y is positive going up) - var isclockwise = winding < 0; - if (isclockwise !== clockwise) - copy.reverse(); - // while we're here, the last point must be the first point... - copy.push([copy[0][0], copy[0][1]]); - return copy; - } - - var geopolys = []; - - function addExterior(node){ - var poly = [forceWinding(node.region, false)]; - geopolys.push(poly); - // children of exteriors are interior - for (var i = 0; i < node.children.length; i++) - poly.push(getInterior(node.children[i])); - } - - function getInterior(node){ - // children of interiors are exterior - for (var i = 0; i < node.children.length; i++) - addExterior(node.children[i]); - // return the clockwise interior - return forceWinding(node.region, true); - } - - // root nodes are exterior - for (var i = 0; i < roots.children.length; i++) - addExterior(roots.children[i]); - - // lastly, construct the approrpriate GeoJSON object - - if (geopolys.length <= 0) // empty GeoJSON Polygon - return { type: 'Polygon', coordinates: [] }; - if (geopolys.length == 1) // use a GeoJSON Polygon - return { type: 'Polygon', coordinates: geopolys[0] }; - return { // otherwise, use a GeoJSON MultiPolygon - type: 'MultiPolygon', - coordinates: geopolys - }; - } -}; - -module.exports = GeoJSON; - -},{}],460:[function(_dereq_,module,exports){ -// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc -// MIT License -// Project Home: https://github.com/voidqk/polybooljs - -// -// this is the core work-horse -// - -var LinkedList = _dereq_('./linked-list'); - -function Intersecter(selfIntersection, eps, buildLog){ - // selfIntersection is true/false depending on the phase of the overall algorithm - - // - // segment creation - // - - function segmentNew(start, end){ - return { - id: buildLog ? buildLog.segmentId() : -1, - start: start, - end: 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: start, - end: end, - myFill: { - above: seg.myFill.above, - below: seg.myFill.below - }, - otherFill: null - }; - } - - // - // event logic - // - - var event_root = LinkedList.create(); - - function eventCompare(p1_isStart, p1_1, p1_2, p2_isStart, p2_1, p2_2){ - // compare the selected points first - var comp = eps.pointsCompare(p1_1, p2_1); - if (comp !== 0) - return comp; - // the selected points are the same - - if (eps.pointsSame(p1_2, p2_2)) // if the non-selected points are the same too... - return 0; // then the segments are equal - - if (p1_isStart !== p2_isStart) // if one is a start and the other isn't... - return p1_isStart ? 1 : -1; // favor the one that isn't the start - - // otherwise, we'll have to calculate which one is below the other manually - return eps.pointAboveOrOnLine(p1_2, - p2_isStart ? p2_1 : p2_2, // order matters - p2_isStart ? p2_2 : p2_1 - ) ? 1 : -1; - } - - function eventAdd(ev, other_pt){ - event_root.insertBefore(ev, function(here){ - // should ev be inserted before here? - var comp = eventCompare( - ev .isStart, ev .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: seg, - primary: 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: seg, - primary: 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(ev, end){ - // slides an end backwards - // (start)------------(end) to: - // (start)---(end) - - if (buildLog) - buildLog.segmentChop(ev.seg, end); - - ev.other.remove(); - ev.seg.end = end; - ev.other.pt = end; - eventAdd(ev.other, ev.pt); - } - - function eventDivide(ev, pt){ - var ns = segmentCopy(pt, ev.seg.end, ev.seg); - eventUpdateEnd(ev, pt); - return eventAddSegment(ns, ev.primary); - } - - function calculate(primaryPolyInverted, secondaryPolyInverted){ - // if selfIntersection is true then there is no secondary polygon, so that isn't used - - // - // status logic - // - - var status_root = LinkedList.create(); - - function statusCompare(ev1, ev2){ - var a1 = ev1.seg.start; - var a2 = ev1.seg.end; - var b1 = ev2.seg.start; - var b2 = ev2.seg.end; - - if (eps.pointsCollinear(a1, b1, b2)){ - if (eps.pointsCollinear(a2, b1, b2)) - return 1;//eventCompare(true, a1, a2, true, b1, b2); - return eps.pointAboveOrOnLine(a2, b1, b2) ? 1 : -1; - } - return eps.pointAboveOrOnLine(a1, b1, b2) ? 1 : -1; - } - - function statusFindSurrounding(ev){ - return status_root.findTransition(function(here){ - var comp = statusCompare(ev, here.ev); - return comp > 0; - }); - } - - function checkIntersection(ev1, ev2){ - // returns the segment equal to ev1, or false if nothing equal - - var seg1 = ev1.seg; - var seg2 = ev2.seg; - var a1 = seg1.start; - var a2 = seg1.end; - var b1 = seg2.start; - var b2 = seg2.end; - - if (buildLog) - buildLog.checkIntersection(seg1, seg2); - - var i = eps.linesIntersect(a1, a2, b1, b2); - - if (i === false){ - // segments are parallel or coincident - - // if points aren't collinear, then the segments are parallel, so no intersections - if (!eps.pointsCollinear(a1, a2, b1)) - return false; - // otherwise, segments are on top of each other somehow (aka coincident) - - if (eps.pointsSame(a1, b2) || eps.pointsSame(a2, b1)) - return false; // segments touch at endpoints... no intersection - - var a1_equ_b1 = eps.pointsSame(a1, b1); - var a2_equ_b2 = eps.pointsSame(a2, b2); - - if (a1_equ_b1 && a2_equ_b2) - return ev2; // segments are exactly equal - - var a1_between = !a1_equ_b1 && eps.pointBetween(a1, b1, b2); - var a2_between = !a2_equ_b2 && eps.pointBetween(a2, b1, b2); - - // handy for debugging: - // buildLog.log({ - // a1_equ_b1: a1_equ_b1, - // a2_equ_b2: a2_equ_b2, - // a1_between: a1_between, - // a2_between: a2_between - // }); - - if (a1_equ_b1){ - if (a2_between){ - // (a1)---(a2) - // (b1)----------(b2) - eventDivide(ev2, a2); - } - else{ - // (a1)----------(a2) - // (b1)---(b2) - eventDivide(ev1, b2); - } - return ev2; - } - else if (a1_between){ - if (!a2_equ_b2){ - // make a2 equal to b2 - if (a2_between){ - // (a1)---(a2) - // (b1)-----------------(b2) - eventDivide(ev2, a2); - } - else{ - // (a1)----------(a2) - // (b1)----------(b2) - eventDivide(ev1, b2); - } - } - - // (a1)---(a2) - // (b1)----------(b2) - eventDivide(ev2, a1); - } - } - else{ - // otherwise, lines intersect at i.pt, which may or may not be between the endpoints - - // is A divided between its endpoints? (exclusive) - if (i.alongA === 0){ - if (i.alongB === -1) // yes, at exactly b1 - eventDivide(ev1, b1); - else if (i.alongB === 0) // yes, somewhere between B's endpoints - eventDivide(ev1, i.pt); - else if (i.alongB === 1) // yes, at exactly b2 - eventDivide(ev1, b2); - } - - // is B divided between its endpoints? (exclusive) - if (i.alongB === 0){ - if (i.alongA === -1) // yes, at exactly a1 - eventDivide(ev2, a1); - else if (i.alongA === 0) // yes, somewhere between A's endpoints (exclusive) - eventDivide(ev2, i.pt); - else if (i.alongA === 1) // yes, at exactly a2 - eventDivide(ev2, a2); - } - } - return false; - } - - // - // main event loop - // - var segments = []; - while (!event_root.isEmpty()){ - var ev = event_root.getHead(); - - if (buildLog) - buildLog.vert(ev.pt[0]); - - if (ev.isStart){ - - if (buildLog) - buildLog.segmentNew(ev.seg, ev.primary); - - var surrounding = statusFindSurrounding(ev); - var above = surrounding.before ? surrounding.before.ev : null; - var below = surrounding.after ? surrounding.after.ev : null; - - if (buildLog){ - buildLog.tempStatus( - ev.seg, - above ? above.seg : false, - below ? below.seg : false - ); - } - - function checkBothIntersections(){ - if (above){ - var eve = checkIntersection(ev, above); - if (eve) - return eve; - } - if (below) - return checkIntersection(ev, below); - return false; - } - - var eve = checkBothIntersections(); - if (eve){ - // ev and eve are equal - // we'll keep eve and throw away ev - - // merge ev.seg's fill information into eve.seg - - if (selfIntersection){ - var toggle; // are we a toggling edge? - if (ev.seg.myFill.below === null) - toggle = true; - else - toggle = ev.seg.myFill.above !== ev.seg.myFill.below; - - // merge two segments that belong to the same polygon - // think of this as sandwiching two segments together, where `eve.seg` is - // the bottom -- this will cause the above fill flag to toggle - if (toggle) - eve.seg.myFill.above = !eve.seg.myFill.above; - } - else{ - // merge two segments that belong to different polygons - // each segment has distinct knowledge, so no special logic is needed - // note that this can only happen once per segment in this phase, because we - // are guaranteed that all self-intersections are gone - eve.seg.otherFill = ev.seg.myFill; - } - - if (buildLog) - buildLog.segmentUpdate(eve.seg); - - ev.other.remove(); - ev.remove(); - } - - if (event_root.getHead() !== ev){ - // something was inserted before us in the event queue, so loop back around and - // process it before continuing - if (buildLog) - buildLog.rewind(ev.seg); - continue; - } - - // - // calculate fill flags - // - if (selfIntersection){ - var toggle; // are we a toggling edge? - if (ev.seg.myFill.below === null) // if we are a new segment... - toggle = true; // then we toggle - else // we are a segment that has previous knowledge from a division - toggle = ev.seg.myFill.above !== ev.seg.myFill.below; // calculate toggle - - // next, calculate whether we are filled below us - if (!below){ // if nothing is below us... - // we are filled below us if the polygon is inverted - ev.seg.myFill.below = primaryPolyInverted; - } - else{ - // otherwise, we know the answer -- it's the same if whatever is below - // us is filled above it - ev.seg.myFill.below = below.seg.myFill.above; - } - - // since now we know if we're filled below us, we can calculate whether - // we're filled above us by applying toggle to whatever is below us - if (toggle) - ev.seg.myFill.above = !ev.seg.myFill.below; - else - ev.seg.myFill.above = ev.seg.myFill.below; - } - else{ - // now we fill in any missing transition information, since we are all-knowing - // at this point - - if (ev.seg.otherFill === null){ - // if we don't have other information, then we need to figure out if we're - // inside the other polygon - var inside; - if (!below){ - // if nothing is below us, then we're inside if the other polygon is - // inverted - inside = - ev.primary ? secondaryPolyInverted : primaryPolyInverted; - } - else{ // otherwise, something is below us - // so copy the below segment's other polygon's above - if (ev.primary === below.primary) - inside = below.seg.otherFill.above; - else - inside = below.seg.myFill.above; - } - ev.seg.otherFill = { - above: inside, - below: inside - }; - } - } - - if (buildLog){ - buildLog.status( - ev.seg, - above ? above.seg : false, - below ? below.seg : false - ); - } - - // insert the status and remember it for later removal - ev.other.status = surrounding.insert(LinkedList.node({ ev: ev })); - } - else{ - var st = ev.status; - - if (st === null){ - throw new Error('PolyBool: Zero-length segment detected; your epsilon is ' + - 'probably too small or too large'); - } - - // removing the status will create two new adjacent edges, so we'll need to check - // for those - if (status_root.exists(st.prev) && status_root.exists(st.next)) - checkIntersection(st.prev.ev, st.next.ev); - - if (buildLog) - buildLog.statusRemove(st.ev.seg); - - // remove the status - st.remove(); - - // if we've reached this point, we've calculated everything there is to know, so - // save the segment for reporting - if (!ev.primary){ - // make sure `seg.myFill` actually points to the primary polygon though - var s = ev.seg.myFill; - ev.seg.myFill = ev.seg.otherFill; - ev.seg.otherFill = s; - } - segments.push(ev.seg); - } - - // remove the event and continue - event_root.getHead().remove(); - } - - if (buildLog) - buildLog.done(); - - return segments; - } - - // return the appropriate API depending on what we're doing - if (!selfIntersection){ - // performing combination of polygons, so only deal with already-processed segments - return { - calculate: function(segments1, inverted1, segments2, inverted2){ - // segmentsX come from the self-intersection API, or this API - // invertedX is whether we treat that list of segments as an inverted polygon or not - // returns segments that can be used for further operations - 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); - } - }; - } - - // otherwise, performing self-intersection, so deal with regions - return { - addRegion: function(region){ - // regions are a list of points: - // [ [0, 0], [100, 0], [50, 100] ] - // you can add multiple regions before running calculate - 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) // points are equal, so we have a zero-length segment - continue; // just skip it - - eventAddSegment( - segmentNew( - forward < 0 ? pt1 : pt2, - forward < 0 ? pt2 : pt1 - ), - true - ); - } - }, - calculate: function(inverted){ - // is the polygon inverted? - // returns segments - return calculate(inverted, false); - } - }; -} - -module.exports = Intersecter; - -},{"./linked-list":461}],461:[function(_dereq_,module,exports){ -// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc -// MIT License -// Project Home: https://github.com/voidqk/polybooljs - -// -// simple linked list implementation that allows you to traverse down nodes and save positions -// - -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; - } -}; - -module.exports = LinkedList; - -},{}],462:[function(_dereq_,module,exports){ -// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc -// MIT License -// Project Home: https://github.com/voidqk/polybooljs - -// -// converts a list of segments into a list of regions, while also removing unnecessary verticies -// - -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); - - // search for two chains that this segment matches - 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(index, matches_head, matches_pt1){ - // return true if we've matched twice - next_match.index = index; - 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; // we've matched twice, we're done here - } - 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){ - // we didn't match anything, so create a new chain - chains.push([ pt1, pt2 ]); - if (buildLog) - buildLog.chainNew(pt1, pt2); - return; - } - - if (next_match === second_match){ - // we matched a single chain - - if (buildLog) - buildLog.chainMatch(first_match.index); - - // add the other point to the apporpriate end, and check to see if we've closed the - // chain into a loop - - var index = first_match.index; - var pt = first_match.matches_pt1 ? pt2 : pt1; // if we matched pt1, then we add pt2, etc - var addToHead = first_match.matches_head; // if we matched at head, then add to the 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, pt)){ - // grow isn't needed because it's directly between grow2 and pt: - // grow2 ---grow---> pt - if (addToHead){ - if (buildLog) - buildLog.chainRemoveHead(first_match.index, pt); - chain.shift(); - } - else{ - if (buildLog) - buildLog.chainRemoveTail(first_match.index, pt); - chain.pop(); - } - grow = grow2; // old grow is gone... new grow is what grow2 was - } - - if (eps.pointsSame(oppo, pt)){ - // we're closing the loop, so remove chain from chains - chains.splice(index, 1); - - if (eps.pointsCollinear(oppo2, oppo, grow)){ - // oppo isn't needed because it's directly between oppo2 and grow: - // 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); - - // we have a closed chain! - regions.push(chain); - return; - } - - // not closing a loop, so just add it to the apporpriate side - if (addToHead){ - if (buildLog) - buildLog.chainAddHead(first_match.index, pt); - chain.unshift(pt); - } - else{ - if (buildLog) - buildLog.chainAddTail(first_match.index, pt); - chain.push(pt); - } - return; - } - - // otherwise, we matched two chains, so we need to combine those chains together - - function reverseChain(index){ - if (buildLog) - buildLog.chainReverse(index); - chains[index].reverse(); // gee, that's easy - } - - function appendChain(index1, index2){ - // index1 gets index2 appended to it, and index2 is removed - var chain1 = chains[index1]; - var chain2 = chains[index2]; - var tail = chain1[chain1.length - 1]; - var tail2 = chain1[chain1.length - 2]; - var head = chain2[0]; - var head2 = chain2[1]; - - if (eps.pointsCollinear(tail2, tail, head)){ - // tail isn't needed because it's directly between tail2 and head - // tail2 ---tail---> head - if (buildLog) - buildLog.chainRemoveTail(index1, tail); - chain1.pop(); - tail = tail2; // old tail is gone... new tail is what tail2 was - } - - if (eps.pointsCollinear(tail, head, head2)){ - // head isn't needed because it's directly between tail and head2 - // tail ---head---> head2 - if (buildLog) - buildLog.chainRemoveHead(index2, head); - 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; // reverse the shorter chain, if needed - if (first_match.matches_head){ - if (second_match.matches_head){ - if (reverseF){ - // <<<< F <<<< --- >>>> S >>>> - reverseChain(F); - // >>>> F >>>> --- >>>> S >>>> - appendChain(F, S); - } - else{ - // <<<< F <<<< --- >>>> S >>>> - reverseChain(S); - // <<<< F <<<< --- <<<< S <<<< logically same as: - // >>>> S >>>> --- >>>> F >>>> - appendChain(S, F); - } - } - else{ - // <<<< F <<<< --- <<<< S <<<< logically same as: - // >>>> S >>>> --- >>>> F >>>> - appendChain(S, F); - } - } - else{ - if (second_match.matches_head){ - // >>>> F >>>> --- >>>> S >>>> - appendChain(F, S); - } - else{ - if (reverseF){ - // >>>> F >>>> --- <<<< S <<<< - reverseChain(F); - // <<<< F <<<< --- <<<< S <<<< logically same as: - // >>>> S >>>> --- >>>> F >>>> - appendChain(S, F); - } - else{ - // >>>> F >>>> --- <<<< S <<<< - reverseChain(S); - // >>>> F >>>> --- >>>> S >>>> - appendChain(F, S); - } - } - } - }); - - return regions; -} - -module.exports = SegmentChainer; - -},{}],463:[function(_dereq_,module,exports){ -// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc -// MIT License -// Project Home: https://github.com/voidqk/polybooljs - -// -// filter a list of segments based on boolean operations -// - -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){ - // copy the segment to the results, while also calculating the fill status - 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){ // primary | secondary - // above1 below1 above2 below2 Keep? Value - // 0 0 0 0 => no 0 - // 0 0 0 1 => yes filled below 2 - // 0 0 1 0 => yes filled above 1 - // 0 0 1 1 => no 0 - // 0 1 0 0 => yes filled below 2 - // 0 1 0 1 => yes filled below 2 - // 0 1 1 0 => no 0 - // 0 1 1 1 => no 0 - // 1 0 0 0 => yes filled above 1 - // 1 0 0 1 => no 0 - // 1 0 1 0 => yes filled above 1 - // 1 0 1 1 => no 0 - // 1 1 0 0 => no 0 - // 1 1 0 1 => no 0 - // 1 1 1 0 => no 0 - // 1 1 1 1 => no 0 - return select(segments, [ - 0, 2, 1, 0, - 2, 2, 0, 0, - 1, 0, 1, 0, - 0, 0, 0, 0 - ], buildLog); - }, - intersect: function(segments, buildLog){ // primary & secondary - // above1 below1 above2 below2 Keep? Value - // 0 0 0 0 => no 0 - // 0 0 0 1 => no 0 - // 0 0 1 0 => no 0 - // 0 0 1 1 => no 0 - // 0 1 0 0 => no 0 - // 0 1 0 1 => yes filled below 2 - // 0 1 1 0 => no 0 - // 0 1 1 1 => yes filled below 2 - // 1 0 0 0 => no 0 - // 1 0 0 1 => no 0 - // 1 0 1 0 => yes filled above 1 - // 1 0 1 1 => yes filled above 1 - // 1 1 0 0 => no 0 - // 1 1 0 1 => yes filled below 2 - // 1 1 1 0 => yes filled above 1 - // 1 1 1 1 => no 0 - return select(segments, [ - 0, 0, 0, 0, - 0, 2, 0, 2, - 0, 0, 1, 1, - 0, 2, 1, 0 - ], buildLog); - }, - difference: function(segments, buildLog){ // primary - secondary - // above1 below1 above2 below2 Keep? Value - // 0 0 0 0 => no 0 - // 0 0 0 1 => no 0 - // 0 0 1 0 => no 0 - // 0 0 1 1 => no 0 - // 0 1 0 0 => yes filled below 2 - // 0 1 0 1 => no 0 - // 0 1 1 0 => yes filled below 2 - // 0 1 1 1 => no 0 - // 1 0 0 0 => yes filled above 1 - // 1 0 0 1 => yes filled above 1 - // 1 0 1 0 => no 0 - // 1 0 1 1 => no 0 - // 1 1 0 0 => no 0 - // 1 1 0 1 => yes filled above 1 - // 1 1 1 0 => yes filled below 2 - // 1 1 1 1 => no 0 - return select(segments, [ - 0, 0, 0, 0, - 2, 0, 2, 0, - 1, 1, 0, 0, - 0, 1, 2, 0 - ], buildLog); - }, - differenceRev: function(segments, buildLog){ // secondary - primary - // above1 below1 above2 below2 Keep? Value - // 0 0 0 0 => no 0 - // 0 0 0 1 => yes filled below 2 - // 0 0 1 0 => yes filled above 1 - // 0 0 1 1 => no 0 - // 0 1 0 0 => no 0 - // 0 1 0 1 => no 0 - // 0 1 1 0 => yes filled above 1 - // 0 1 1 1 => yes filled above 1 - // 1 0 0 0 => no 0 - // 1 0 0 1 => yes filled below 2 - // 1 0 1 0 => no 0 - // 1 0 1 1 => yes filled below 2 - // 1 1 0 0 => no 0 - // 1 1 0 1 => no 0 - // 1 1 1 0 => no 0 - // 1 1 1 1 => no 0 - return select(segments, [ - 0, 2, 1, 0, - 0, 0, 1, 1, - 0, 2, 0, 2, - 0, 0, 0, 0 - ], buildLog); - }, - xor: function(segments, buildLog){ // primary ^ secondary - // above1 below1 above2 below2 Keep? Value - // 0 0 0 0 => no 0 - // 0 0 0 1 => yes filled below 2 - // 0 0 1 0 => yes filled above 1 - // 0 0 1 1 => no 0 - // 0 1 0 0 => yes filled below 2 - // 0 1 0 1 => no 0 - // 0 1 1 0 => no 0 - // 0 1 1 1 => yes filled above 1 - // 1 0 0 0 => yes filled above 1 - // 1 0 0 1 => no 0 - // 1 0 1 0 => no 0 - // 1 0 1 1 => yes filled below 2 - // 1 1 0 0 => no 0 - // 1 1 0 1 => yes filled above 1 - // 1 1 1 0 => yes filled below 2 - // 1 1 1 1 => no 0 - return select(segments, [ - 0, 2, 1, 0, - 2, 0, 0, 1, - 1, 0, 0, 2, - 0, 1, 2, 0 - ], buildLog); - } -}; - -module.exports = SegmentSelector; - -},{}],464:[function(_dereq_,module,exports){ -//Optimized version for triangle closest point -// Based on Eberly's WildMagick codes -// http://www.geometrictools.com/LibMathematics/Distance/Distance.html -"use strict"; - -var diff = new Float64Array(4); -var edge0 = new Float64Array(4); -var edge1 = new Float64Array(4); - -function closestPoint2d(V0, V1, V2, point, result) { - //Reallocate buffers if necessary - if(diff.length < point.length) { - diff = new Float64Array(point.length); - edge0 = new Float64Array(point.length); - edge1 = new Float64Array(point.length); - } - //Compute edges - for(var i=0; i= a00) { - s = 1.0; - sqrDistance = a00 + 2.0*b0 + c; - } else { - s = -b0/a00; - sqrDistance = b0*s + c; - } - } else { - s = 0; - if (b1 >= 0) { - t = 0; - sqrDistance = c; - } else if (-b1 >= a11) { - t = 1; - sqrDistance = a11 + 2.0*b1 + c; - } else { - t = -b1/a11; - sqrDistance = b1*t + c; - } - } - } else { // region 3 - s = 0; - if (b1 >= 0) { - t = 0; - sqrDistance = c; - } else if (-b1 >= a11) { - t = 1; - sqrDistance = a11 + 2.0*b1 + c; - } else { - t = -b1/a11; - sqrDistance = b1*t + c; - } - } - } else if (t < 0) { // region 5 - t = 0; - if (b0 >= 0) { - s = 0; - sqrDistance = c; - } else if (-b0 >= a00) { - s = 1; - sqrDistance = a00 + 2.0*b0 + c; - } else { - s = -b0/a00; - sqrDistance = b0*s + c; - } - } else { // region 0 - // minimum at interior point - var invDet = 1.0 / det; - s *= invDet; - t *= invDet; - sqrDistance = s*(a00*s + a01*t + 2.0*b0) + t*(a01*s + a11*t + 2.0*b1) + c; - } - } else { - var tmp0, tmp1, numer, denom; - - if (s < 0) { // region 2 - tmp0 = a01 + b0; - tmp1 = a11 + b1; - if (tmp1 > tmp0) { - numer = tmp1 - tmp0; - denom = a00 - 2.0*a01 + a11; - if (numer >= denom) { - s = 1; - t = 0; - sqrDistance = a00 + 2.0*b0 + c; - } else { - s = numer/denom; - t = 1 - s; - sqrDistance = s*(a00*s + a01*t + 2.0*b0) + - t*(a01*s + a11*t + 2.0*b1) + c; - } - } else { - s = 0; - if (tmp1 <= 0) { - t = 1; - sqrDistance = a11 + 2.0*b1 + c; - } else if (b1 >= 0) { - t = 0; - sqrDistance = c; - } else { - t = -b1/a11; - sqrDistance = b1*t + c; - } - } - } else if (t < 0) { // region 6 - tmp0 = a01 + b1; - tmp1 = a00 + b0; - if (tmp1 > tmp0) { - numer = tmp1 - tmp0; - denom = a00 - 2.0*a01 + a11; - if (numer >= denom) { - t = 1; - s = 0; - sqrDistance = a11 + 2.0*b1 + c; - } else { - t = numer/denom; - s = 1 - t; - sqrDistance = s*(a00*s + a01*t + 2.0*b0) + - t*(a01*s + a11*t + 2.0*b1) + c; - } - } else { - t = 0; - if (tmp1 <= 0) { - s = 1; - sqrDistance = a00 + 2.0*b0 + c; - } else if (b0 >= 0) { - s = 0; - sqrDistance = c; - } else { - s = -b0/a00; - sqrDistance = b0*s + c; - } - } - } else { // region 1 - numer = a11 + b1 - a01 - b0; - if (numer <= 0) { - s = 0; - t = 1; - sqrDistance = a11 + 2.0*b1 + c; - } else { - denom = a00 - 2.0*a01 + a11; - if (numer >= denom) { - s = 1; - t = 0; - sqrDistance = a00 + 2.0*b0 + c; - } else { - s = numer/denom; - t = 1 - s; - sqrDistance = s*(a00*s + a01*t + 2.0*b0) + - t*(a01*s + a11*t + 2.0*b1) + c; - } - } - } - } - var u = 1.0 - s - t; - for(var i=0; i 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],466:[function(_dereq_,module,exports){ -module.exports = _dereq_('gl-quat/slerp') -},{"gl-quat/slerp":280}],467:[function(_dereq_,module,exports){ -(function (global){ -var now = _dereq_('performance-now') - , root = typeof window === 'undefined' ? global : window - , vendors = ['moz', 'webkit'] - , suffix = 'AnimationFrame' - , raf = root['request' + suffix] - , caf = root['cancel' + suffix] || root['cancelRequest' + suffix] - -for(var i = 0; !raf && i < vendors.length; i++) { - raf = root[vendors[i] + 'Request' + suffix] - caf = root[vendors[i] + 'Cancel' + suffix] - || root[vendors[i] + 'CancelRequest' + suffix] -} - -// Some versions of FF have rAF but not cAF -if(!raf || !caf) { - var last = 0 - , id = 0 - , queue = [] - , frameDuration = 1000 / 60 - - raf = function(callback) { - if(queue.length === 0) { - var _now = now() - , next = Math.max(0, frameDuration - (_now - last)) - last = next + _now - setTimeout(function() { - var cp = queue.slice(0) - // Clear queue here to prevent - // callbacks from appending listeners - // to the current frame's queue - queue.length = 0 - for(var i = 0; i < cp.length; i++) { - if(!cp[i].cancelled) { - try{ - cp[i].callback(last) - } catch(e) { - setTimeout(function() { throw e }, 0) - } - } - } - }, Math.round(next)) - } - queue.push({ - handle: ++id, - callback: callback, - cancelled: false - }) - return id - } - - caf = function(handle) { - for(var i = 0; i < queue.length; i++) { - if(queue[i].handle === handle) { - queue[i].cancelled = true - } - } - } -} - -module.exports = function(fn) { - // Wrap in a new function to prevent - // `cancel` potentially being assigned - // to the native rAF function - return raf.call(root, fn) -} -module.exports.cancel = function() { - caf.apply(root, arguments) -} -module.exports.polyfill = function(object) { - if (!object) { - object = root; - } - object.requestAnimationFrame = raf - object.cancelAnimationFrame = caf -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"performance-now":445}],468:[function(_dereq_,module,exports){ -'use strict' - -var bnadd = _dereq_('big-rat/add') - -module.exports = add - -function add (a, b) { - var n = a.length - var r = new Array(n) - for (var i=0; i 0) { - var f = cells[ptr-1] - if(compareCell(c, f) === 0 && - orientation(f) !== o) { - ptr -= 1 - continue - } - } - cells[ptr++] = c - } - cells.length = ptr - return cells -} - -},{"cell-orientation":100,"compare-cell":116,"compare-oriented-cell":117}],473:[function(_dereq_,module,exports){ -'use strict' - -var getBounds = _dereq_('array-bounds') -var rgba = _dereq_('color-normalize') -var updateDiff = _dereq_('update-diff') -var pick = _dereq_('pick-by-alias') -var extend = _dereq_('object-assign') -var flatten = _dereq_('flatten-vertex-data') -var ref = _dereq_('to-float32'); -var float32 = ref.float32; -var fract32 = ref.fract32; - -module.exports = Error2D - -var WEIGHTS = [ - //direction, lineWidth shift, capSize shift - - // x-error bar - [1, 0, 0, 1, 0, 0], - [1, 0, 0, -1, 0, 0], - [-1, 0, 0, -1, 0, 0], - - [-1, 0, 0, -1, 0, 0], - [-1, 0, 0, 1, 0, 0], - [1, 0, 0, 1, 0, 0], - - // x-error right cap - [1, 0, -1, 0, 0, 1], - [1, 0, -1, 0, 0, -1], - [1, 0, 1, 0, 0, -1], - - [1, 0, 1, 0, 0, -1], - [1, 0, 1, 0, 0, 1], - [1, 0, -1, 0, 0, 1], - - // x-error left cap - [-1, 0, -1, 0, 0, 1], - [-1, 0, -1, 0, 0, -1], - [-1, 0, 1, 0, 0, -1], - - [-1, 0, 1, 0, 0, -1], - [-1, 0, 1, 0, 0, 1], - [-1, 0, -1, 0, 0, 1], - - // y-error bar - [0, 1, 1, 0, 0, 0], - [0, 1, -1, 0, 0, 0], - [0, -1, -1, 0, 0, 0], - - [0, -1, -1, 0, 0, 0], - [0, 1, 1, 0, 0, 0], - [0, -1, 1, 0, 0, 0], - - // y-error top cap - [0, 1, 0, -1, 1, 0], - [0, 1, 0, -1, -1, 0], - [0, 1, 0, 1, -1, 0], - - [0, 1, 0, 1, 1, 0], - [0, 1, 0, -1, 1, 0], - [0, 1, 0, 1, -1, 0], - - // y-error bottom cap - [0, -1, 0, -1, 1, 0], - [0, -1, 0, -1, -1, 0], - [0, -1, 0, 1, -1, 0], - - [0, -1, 0, 1, 1, 0], - [0, -1, 0, -1, 1, 0], - [0, -1, 0, 1, -1, 0] -] - - -function Error2D (regl, options) { - if (typeof regl === 'function') { - if (!options) { options = {} } - options.regl = regl - } - else { - options = regl - } - if (options.length) { options.positions = options } - regl = options.regl - - if (!regl.hasExtension('ANGLE_instanced_arrays')) { - throw Error('regl-error2d: `ANGLE_instanced_arrays` extension should be enabled'); - } - - // persistent variables - var gl = regl._gl, drawErrors, positionBuffer, positionFractBuffer, colorBuffer, errorBuffer, meshBuffer, - defaults = { - color: 'black', - capSize: 5, - lineWidth: 1, - opacity: 1, - viewport: null, - range: null, - offset: 0, - count: 0, - bounds: null, - positions: [], - errors: [] - }, groups = [] - - //color per-point - colorBuffer = regl.buffer({ - usage: 'dynamic', - type: 'uint8', - data: new Uint8Array(0) - }) - //xy-position per-point - positionBuffer = regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array(0) - }) - //xy-position float32-fraction - positionFractBuffer = regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array(0) - }) - //4 errors per-point - errorBuffer = regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array(0) - }) - //error bar mesh - meshBuffer = regl.buffer({ - usage: 'static', - type: 'float', - data: WEIGHTS - }) - - update(options) - - //drawing method - drawErrors = regl({ - vert: "\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t", - - frag: "\n\t\tprecision mediump float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t", - - uniforms: { - range: regl.prop('range'), - lineWidth: regl.prop('lineWidth'), - capSize: regl.prop('capSize'), - opacity: regl.prop('opacity'), - scale: regl.prop('scale'), - translate: regl.prop('translate'), - scaleFract: regl.prop('scaleFract'), - translateFract: regl.prop('translateFract'), - viewport: function (ctx, prop) { return [prop.viewport.x, prop.viewport.y, ctx.viewportWidth, ctx.viewportHeight]; } - }, - - attributes: { - //dynamic attributes - color: { - buffer: colorBuffer, - offset: function (ctx, prop) { return prop.offset * 4; }, - divisor: 1, - }, - position: { - buffer: positionBuffer, - offset: function (ctx, prop) { return prop.offset * 8; }, - divisor: 1 - }, - positionFract: { - buffer: positionFractBuffer, - offset: function (ctx, prop) { return prop.offset * 8; }, - divisor: 1 - }, - error: { - buffer: errorBuffer, - offset: function (ctx, prop) { return prop.offset * 16; }, - divisor: 1 - }, - - //static attributes - direction: { - buffer: meshBuffer, - stride: 24, - offset: 0 - }, - lineOffset: { - buffer: meshBuffer, - stride: 24, - offset: 8 - }, - capOffset: { - buffer: meshBuffer, - stride: 24, - offset: 16 - } - }, - - primitive: 'triangles', - - blend: { - enable: true, - color: [0,0,0,0], - equation: { - rgb: 'add', - alpha: 'add' - }, - func: { - srcRGB: 'src alpha', - dstRGB: 'one minus src alpha', - srcAlpha: 'one minus dst alpha', - dstAlpha: 'one' - } - }, - - depth: { - enable: false - }, - - scissor: { - enable: true, - box: regl.prop('viewport') - }, - viewport: regl.prop('viewport'), - stencil: false, - - instances: regl.prop('count'), - count: WEIGHTS.length - }) - - //expose API - extend(error2d, { - update: update, - draw: draw, - destroy: destroy, - regl: regl, - gl: gl, - canvas: gl.canvas, - groups: groups - }) - - return error2d - - function error2d (opts) { - //update - if (opts) { - update(opts) - } - - //destroy - else if (opts === null) { - destroy() - } - - draw() - } - - - //main draw method - function draw (options) { - if (typeof options === 'number') { return drawGroup(options) } - - //make options a batch - if (options && !Array.isArray(options)) { options = [options] } - - - regl._refresh() - - //render multiple polylines via regl batch - groups.forEach(function (s, i) { - if (!s) { return } - - if (options) { - if (!options[i]) { s.draw = false } - else { s.draw = true } - } - - //ignore draw flag for one pass - if (!s.draw) { - s.draw = true; - return - } - - drawGroup(i) - }) - } - - //draw single error group by id - function drawGroup (s) { - if (typeof s === 'number') { s = groups[s] } - if (s == null) { return } - - if (!(s && s.count && s.color && s.opacity && s.positions && s.positions.length > 1)) { return } - - s.scaleRatio = [ - s.scale[0] * s.viewport.width, - s.scale[1] * s.viewport.height - ] - - drawErrors(s) - - if (s.after) { s.after(s) } - } - - function update (options) { - if (!options) { return } - - //direct points argument - if (options.length != null) { - if (typeof options[0] === 'number') { options = [{positions: options}] } - } - - //make options a batch - else if (!Array.isArray(options)) { options = [options] } - - //global count of points - var pointCount = 0, errorCount = 0 - - error2d.groups = groups = options.map(function (options, i) { - var group = groups[i] - - if (!options) { return group } - else if (typeof options === 'function') { options = {after: options} } - else if (typeof options[0] === 'number') { options = {positions: options} } - - //copy options to avoid mutation & handle aliases - options = pick(options, { - color: 'color colors fill', - capSize: 'capSize cap capsize cap-size', - lineWidth: 'lineWidth line-width width line thickness', - opacity: 'opacity alpha', - range: 'range dataBox', - viewport: 'viewport viewBox', - errors: 'errors error', - positions: 'positions position data points' - }) - - if (!group) { - groups[i] = group = { - id: i, - scale: null, - translate: null, - scaleFract: null, - translateFract: null, - draw: true - } - options = extend({}, defaults, options) - } - - updateDiff(group, options, [{ - lineWidth: function (v) { return +v * .5; }, - capSize: function (v) { return +v * .5; }, - opacity: parseFloat, - errors: function (errors) { - errors = flatten(errors) - - errorCount += errors.length - return errors - }, - positions: function (positions, state) { - positions = flatten(positions, 'float64') - state.count = Math.floor(positions.length / 2) - state.bounds = getBounds(positions, 2) - state.offset = pointCount - - pointCount += state.count - - return positions - } - }, { - color: function (colors, state) { - var count = state.count - - if (!colors) { colors = 'transparent' } - - // 'black' or [0,0,0,0] case - if (!Array.isArray(colors) || typeof colors[0] === 'number') { - var color = colors - colors = Array(count) - for (var i = 0; i < count; i++) { - colors[i] = color - } - } - - if (colors.length < count) { throw Error('Not enough colors') } - - var colorData = new Uint8Array(count * 4) - - //convert colors to float arrays - for (var i$1 = 0; i$1 < count; i$1++) { - var c = rgba(colors[i$1], 'uint8') - colorData.set(c, i$1 * 4) - } - - return colorData - }, - - range: function (range, state, options) { - var bounds = state.bounds - if (!range) { range = bounds } - - state.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])] - state.translate = [-range[0], -range[1]] - - state.scaleFract = fract32(state.scale) - state.translateFract = fract32(state.translate) - - return range - }, - - viewport: function (vp) { - var viewport - - if (Array.isArray(vp)) { - viewport = { - x: vp[0], - y: vp[1], - width: vp[2] - vp[0], - height: vp[3] - vp[1] - } - } - else if (vp) { - viewport = { - x: vp.x || vp.left || 0, - y: vp.y || vp.top || 0 - } - - if (vp.right) { viewport.width = vp.right - viewport.x } - else { viewport.width = vp.w || vp.width || 0 } - - if (vp.bottom) { viewport.height = vp.bottom - viewport.y } - else { viewport.height = vp.h || vp.height || 0 } - } - else { - viewport = { - x: 0, y: 0, - width: gl.drawingBufferWidth, - height: gl.drawingBufferHeight - } - } - - return viewport - } - }]) - - return group - }) - - if (pointCount || errorCount) { - var len = groups.reduce(function (acc, group, i) { - return acc + (group ? group.count : 0) - }, 0) - - var positionData = new Float64Array(len * 2) - var colorData = new Uint8Array(len * 4) - var errorData = new Float32Array(len * 4) - - groups.forEach(function (group, i) { - if (!group) { return } - var positions = group.positions; - var count = group.count; - var offset = group.offset; - var color = group.color; - var errors = group.errors; - if (!count) { return } - - colorData.set(color, offset * 4) - errorData.set(errors, offset * 4) - positionData.set(positions, offset * 2) - }) - - positionBuffer(float32(positionData)) - positionFractBuffer(fract32(positionData)) - colorBuffer(colorData) - errorBuffer(errorData) - } - - } - - function destroy () { - positionBuffer.destroy() - positionFractBuffer.destroy() - colorBuffer.destroy() - errorBuffer.destroy() - meshBuffer.destroy() - } -} -},{"array-bounds":53,"color-normalize":108,"flatten-vertex-data":216,"object-assign":437,"pick-by-alias":448,"to-float32":515,"update-diff":526}],474:[function(_dereq_,module,exports){ -'use strict' - - -var rgba = _dereq_('color-normalize') -var getBounds = _dereq_('array-bounds') -var extend = _dereq_('object-assign') -var glslify = _dereq_('glslify') -var pick = _dereq_('pick-by-alias') -var flatten = _dereq_('flatten-vertex-data') -var triangulate = _dereq_('earcut') -var normalize = _dereq_('array-normalize') -var ref = _dereq_('to-float32'); -var float32 = ref.float32; -var fract32 = ref.fract32; -var WeakMap = _dereq_('es6-weak-map') -var parseRect = _dereq_('parse-rect') - - -module.exports = Line2D - - -/** @constructor */ -function Line2D (regl, options) { - if (!(this instanceof Line2D)) { return new Line2D(regl, options) } - - if (typeof regl === 'function') { - if (!options) { options = {} } - options.regl = regl - } - else { - options = regl - } - if (options.length) { options.positions = options } - regl = options.regl - - if (!regl.hasExtension('ANGLE_instanced_arrays')) { - throw Error('regl-error2d: `ANGLE_instanced_arrays` extension should be enabled'); - } - - // persistent variables - this.gl = regl._gl - this.regl = regl - - // list of options for lines - this.passes = [] - - // cached shaders instance - this.shaders = Line2D.shaders.has(regl) ? Line2D.shaders.get(regl) : Line2D.shaders.set(regl, Line2D.createShaders(regl)).get(regl) - - - // init defaults - this.update(options) -} - - -Line2D.dashMult = 2 -Line2D.maxPatternLength = 256 -Line2D.precisionThreshold = 3e6 -Line2D.maxPoints = 1e4 -Line2D.maxLines = 2048 - - -// cache of created draw calls per-regl instance -Line2D.shaders = new WeakMap() - - -// create static shaders once -Line2D.createShaders = function (regl) { - var offsetBuffer = regl.buffer({ - usage: 'static', - type: 'float', - data: [0,1, 0,0, 1,1, 1,0] - }) - - var shaderOptions = { - primitive: 'triangle strip', - instances: regl.prop('count'), - count: 4, - offset: 0, - - uniforms: { - miterMode: function (ctx, prop) { return prop.join === 'round' ? 2 : 1; }, - miterLimit: regl.prop('miterLimit'), - scale: regl.prop('scale'), - scaleFract: regl.prop('scaleFract'), - translateFract: regl.prop('translateFract'), - translate: regl.prop('translate'), - thickness: regl.prop('thickness'), - dashPattern: regl.prop('dashTexture'), - opacity: regl.prop('opacity'), - pixelRatio: regl.context('pixelRatio'), - id: regl.prop('id'), - dashSize: regl.prop('dashLength'), - viewport: function (c, p) { return [p.viewport.x, p.viewport.y, c.viewportWidth, c.viewportHeight]; }, - depth: regl.prop('depth') - }, - - blend: { - enable: true, - color: [0,0,0,0], - equation: { - rgb: 'add', - alpha: 'add' - }, - func: { - srcRGB: 'src alpha', - dstRGB: 'one minus src alpha', - srcAlpha: 'one minus dst alpha', - dstAlpha: 'one' - } - }, - depth: { - enable: function (c, p) { - return !p.overlay - } - }, - stencil: {enable: false}, - scissor: { - enable: true, - box: regl.prop('viewport') - }, - viewport: regl.prop('viewport') - } - - - // simplified rectangular line shader - var drawRectLine = regl(extend({ - vert: glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;\nattribute vec4 color;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {\n\t// the order is important\n\treturn position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n}\n\nvoid main() {\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineOffset = lineTop * 2. - 1.;\n\n\tvec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);\n\ttangent = normalize(diff * scale * viewport.zw);\n\tvec2 normal = vec2(-tangent.y, tangent.x);\n\n\tvec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart\n\t\t+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd\n\n\t\t+ thickness * normal * .5 * lineOffset / viewport.zw;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]), - frag: glslify(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\n\nuniform float dashSize, pixelRatio, thickness, opacity, id;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvoid main() {\n\tfloat alpha = 1.;\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]), - - attributes: { - // if point is at the end of segment - lineEnd: { - buffer: offsetBuffer, - divisor: 0, - stride: 8, - offset: 0 - }, - // if point is at the top of segment - lineTop: { - buffer: offsetBuffer, - divisor: 0, - stride: 8, - offset: 4 - }, - // beginning of line coordinate - aCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 8, - divisor: 1 - }, - // end of line coordinate - bCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 16, - divisor: 1 - }, - aCoordFract: { - buffer: regl.prop('positionFractBuffer'), - stride: 8, - offset: 8, - divisor: 1 - }, - bCoordFract: { - buffer: regl.prop('positionFractBuffer'), - stride: 8, - offset: 16, - divisor: 1 - }, - color: { - buffer: regl.prop('colorBuffer'), - stride: 4, - offset: 0, - divisor: 1 - } - } - }, shaderOptions)) - - // create regl draw - var drawMiterLine - - try { - drawMiterLine = regl(extend({ - // culling removes polygon creasing - cull: { - enable: true, - face: 'back' - }, - - vert: glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, nextCoord, prevCoord;\nattribute vec4 aColor, bColor;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, translate;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\nuniform float miterLimit, miterMode;\n\nvarying vec4 fragColor;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 tangent;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nconst float REVERSE_THRESHOLD = -.875;\nconst float MIN_DIFF = 1e-6;\n\n// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead\n// TODO: precalculate dot products, normalize things beforehead etc.\n// TODO: refactor to rectangular algorithm\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nbool isNaN( float val ){\n return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true;\n}\n\nvoid main() {\n\tvec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord;\n\n vec2 adjustedScale;\n adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x;\n adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y;\n\n vec2 scaleRatio = adjustedScale * viewport.zw;\n\tvec2 normalWidth = thickness / scaleRatio;\n\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineBot = 1. - lineTop;\n\n\tfragColor = (lineStart * aColor + lineEnd * bColor) / 255.;\n\n\tif (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return;\n\n\tif (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord);\n\tif (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord);\n\n\tvec2 prevDiff = aCoord - prevCoord;\n\tvec2 currDiff = bCoord - aCoord;\n\tvec2 nextDiff = nextCoord - bCoord;\n\n\tvec2 prevTangent = normalize(prevDiff * scaleRatio);\n\tvec2 currTangent = normalize(currDiff * scaleRatio);\n\tvec2 nextTangent = normalize(nextDiff * scaleRatio);\n\n\tvec2 prevNormal = vec2(-prevTangent.y, prevTangent.x);\n\tvec2 currNormal = vec2(-currTangent.y, currTangent.x);\n\tvec2 nextNormal = vec2(-nextTangent.y, nextTangent.x);\n\n\tvec2 startJoinDirection = normalize(prevTangent - currTangent);\n\tvec2 endJoinDirection = normalize(currTangent - nextTangent);\n\n\t// collapsed/unidirectional segment cases\n\t// FIXME: there should be more elegant solution\n\tvec2 prevTanDiff = abs(prevTangent - currTangent);\n\tvec2 nextTanDiff = abs(nextTangent - currTangent);\n\tif (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) {\n\t\tstartJoinDirection = currNormal;\n\t}\n\tif (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) {\n\t\tendJoinDirection = currNormal;\n\t}\n\tif (aCoord == bCoord) {\n\t\tendJoinDirection = startJoinDirection;\n\t\tcurrNormal = prevNormal;\n\t\tcurrTangent = prevTangent;\n\t}\n\n\ttangent = currTangent;\n\n\t//calculate join shifts relative to normals\n\tfloat startJoinShift = dot(currNormal, startJoinDirection);\n\tfloat endJoinShift = dot(currNormal, endJoinDirection);\n\n\tfloat startMiterRatio = abs(1. / startJoinShift);\n\tfloat endMiterRatio = abs(1. / endJoinShift);\n\n\tvec2 startJoin = startJoinDirection * startMiterRatio;\n\tvec2 endJoin = endJoinDirection * endMiterRatio;\n\n\tvec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin;\n\tstartTopJoin = sign(startJoinShift) * startJoin * .5;\n\tstartBotJoin = -startTopJoin;\n\n\tendTopJoin = sign(endJoinShift) * endJoin * .5;\n\tendBotJoin = -endTopJoin;\n\n\tvec2 aTopCoord = aCoord + normalWidth * startTopJoin;\n\tvec2 bTopCoord = bCoord + normalWidth * endTopJoin;\n\tvec2 aBotCoord = aCoord + normalWidth * startBotJoin;\n\tvec2 bBotCoord = bCoord + normalWidth * endBotJoin;\n\n\t//miter anti-clipping\n\tfloat baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x)));\n\tfloat abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x)));\n\n\t//prevent close to reverse direction switch\n\tbool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) < length(normalWidth * currNormal);\n\tbool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) < length(normalWidth * currNormal);\n\n\tif (prevReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.);\n\t\taBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\taTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]), - frag: glslify(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]), - - attributes: { - // is line end - lineEnd: { - buffer: offsetBuffer, - divisor: 0, - stride: 8, - offset: 0 - }, - // is line top - lineTop: { - buffer: offsetBuffer, - divisor: 0, - stride: 8, - offset: 4 - }, - // left color - aColor: { - buffer: regl.prop('colorBuffer'), - stride: 4, - offset: 0, - divisor: 1 - }, - // right color - bColor: { - buffer: regl.prop('colorBuffer'), - stride: 4, - offset: 4, - divisor: 1 - }, - prevCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 0, - divisor: 1 - }, - aCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 8, - divisor: 1 - }, - bCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 16, - divisor: 1 - }, - nextCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 24, - divisor: 1 - } - } - }, shaderOptions)) - } catch (e) { - // IE/bad Webkit fallback - drawMiterLine = drawRectLine - } - - // fill shader - var drawFill = regl({ - primitive: 'triangle', - elements: function (ctx, prop) { return prop.triangles; }, - offset: 0, - - vert: glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]), - frag: glslify(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]), - - uniforms: { - scale: regl.prop('scale'), - color: regl.prop('fill'), - scaleFract: regl.prop('scaleFract'), - translateFract: regl.prop('translateFract'), - translate: regl.prop('translate'), - opacity: regl.prop('opacity'), - pixelRatio: regl.context('pixelRatio'), - id: regl.prop('id'), - viewport: function (ctx, prop) { return [prop.viewport.x, prop.viewport.y, ctx.viewportWidth, ctx.viewportHeight]; } - }, - - attributes: { - position: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 8 - }, - positionFract: { - buffer: regl.prop('positionFractBuffer'), - stride: 8, - offset: 8 - } - }, - - blend: shaderOptions.blend, - - depth: { enable: false }, - scissor: shaderOptions.scissor, - stencil: shaderOptions.stencil, - viewport: shaderOptions.viewport - }) - - return { - fill: drawFill, rect: drawRectLine, miter: drawMiterLine - } -} - - -// used to for new lines instances -Line2D.defaults = { - dashes: null, - join: 'miter', - miterLimit: 1, - thickness: 10, - cap: 'square', - color: 'black', - opacity: 1, - overlay: false, - viewport: null, - range: null, - close: false, - fill: null -} - - -Line2D.prototype.render = function () { - var ref; - - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (args.length) { - (ref = this).update.apply(ref, args) - } - - this.draw() -} - - -Line2D.prototype.draw = function () { - var this$1 = this; - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - // render multiple polylines via regl batch - (args.length ? args : this.passes).forEach(function (s, i) { - var ref; - - // render array pass as a list of passes - if (s && Array.isArray(s)) { return (ref = this$1).draw.apply(ref, s) } - - if (typeof s === 'number') { s = this$1.passes[s] } - - if (!(s && s.count > 1 && s.opacity)) { return } - - this$1.regl._refresh() - - if (s.fill && s.triangles && s.triangles.length > 2) { - this$1.shaders.fill(s) - } - - if (!s.thickness) { return } - - // high scale is only available for rect mode with precision - if (s.scale[0] * s.viewport.width > Line2D.precisionThreshold || s.scale[1] * s.viewport.height > Line2D.precisionThreshold) { - this$1.shaders.rect(s) - } - - // thin this.passes or too many points are rendered as simplified rect shader - else if (s.join === 'rect' || (!s.join && (s.thickness <= 2 || s.count >= Line2D.maxPoints))) { - this$1.shaders.rect(s) - } - else { - this$1.shaders.miter(s) - } - }) - - return this -} - -Line2D.prototype.update = function (options) { - var this$1 = this; - - if (!options) { return } - - if (options.length != null) { - if (typeof options[0] === 'number') { options = [{positions: options}] } - } - - // make options a batch - else if (!Array.isArray(options)) { options = [options] } - - var ref = this; - var regl = ref.regl; - var gl = ref.gl; - - // process per-line settings - options.forEach(function (o, i) { - var state = this$1.passes[i] - - if (o === undefined) { return } - - // null-argument removes pass - if (o === null) { - this$1.passes[i] = null - return - } - - if (typeof o[0] === 'number') { o = {positions: o} } - - // handle aliases - o = pick(o, { - positions: 'positions points data coords', - thickness: 'thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth', - join: 'lineJoin linejoin join type mode', - miterLimit: 'miterlimit miterLimit', - dashes: 'dash dashes dasharray dash-array dashArray', - color: 'color colour stroke colors colours stroke-color strokeColor', - fill: 'fill fill-color fillColor', - opacity: 'alpha opacity', - overlay: 'overlay crease overlap intersect', - close: 'closed close closed-path closePath', - range: 'range dataBox', - viewport: 'viewport viewBox', - hole: 'holes hole hollow' - }) - - // init state - if (!state) { - this$1.passes[i] = state = { - id: i, - scale: null, - scaleFract: null, - translate: null, - translateFract: null, - count: 0, - hole: [], - depth: 0, - - dashLength: 1, - dashTexture: regl.texture({ - channels: 1, - data: new Uint8Array([255]), - width: 1, - height: 1, - mag: 'linear', - min: 'linear' - }), - - colorBuffer: regl.buffer({ - usage: 'dynamic', - type: 'uint8', - data: new Uint8Array() - }), - positionBuffer: regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array() - }), - positionFractBuffer: regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array() - }) - } - - o = extend({}, Line2D.defaults, o) - } - if (o.thickness != null) { state.thickness = parseFloat(o.thickness) } - if (o.opacity != null) { state.opacity = parseFloat(o.opacity) } - if (o.miterLimit != null) { state.miterLimit = parseFloat(o.miterLimit) } - if (o.overlay != null) { - state.overlay = !!o.overlay - if (i < Line2D.maxLines) { - state.depth = 2 * (Line2D.maxLines - 1 - i % Line2D.maxLines) / Line2D.maxLines - 1.; - } - } - if (o.join != null) { state.join = o.join } - if (o.hole != null) { state.hole = o.hole } - if (o.fill != null) { state.fill = !o.fill ? null : rgba(o.fill, 'uint8') } - if (o.viewport != null) { state.viewport = parseRect(o.viewport) } - - if (!state.viewport) { - state.viewport = parseRect([ - gl.drawingBufferWidth, - gl.drawingBufferHeight - ]) - } - - if (o.close != null) { state.close = o.close } - - // reset positions - if (o.positions === null) { o.positions = [] } - if (o.positions) { - var positions, count - - // if positions are an object with x/y - if (o.positions.x && o.positions.y) { - var xPos = o.positions.x - var yPos = o.positions.y - count = state.count = Math.max( - xPos.length, - yPos.length - ) - positions = new Float64Array(count * 2) - for (var i$1 = 0; i$1 < count; i$1++) { - positions[i$1 * 2] = xPos[i$1] - positions[i$1 * 2 + 1] = yPos[i$1] - } - } - else { - positions = flatten(o.positions, 'float64') - count = state.count = Math.floor(positions.length / 2) - } - - var bounds = state.bounds = getBounds(positions, 2) - - // create fill positions - // FIXME: fill positions can be set only along with positions - if (state.fill) { - var pos = [] - - // filter bad vertices and remap triangles to ensure shape - var ids = {} - var lastId = 0 - - for (var i$2 = 0, ptr = 0, l = state.count; i$2 < l; i$2++) { - var x = positions[i$2*2] - var y = positions[i$2*2 + 1] - if (isNaN(x) || isNaN(y) || x == null || y == null) { - x = positions[lastId*2] - y = positions[lastId*2 + 1] - ids[i$2] = lastId - } - else { - lastId = i$2 - } - pos[ptr++] = x - pos[ptr++] = y - } - - var triangles = triangulate(pos, state.hole || []) - - for (var i$3 = 0, l$1 = triangles.length; i$3 < l$1; i$3++) { - if (ids[triangles[i$3]] != null) { triangles[i$3] = ids[triangles[i$3]] } - } - - state.triangles = triangles - } - - // update position buffers - var npos = new Float64Array(positions) - normalize(npos, 2, bounds) - - var positionData = new Float64Array(count * 2 + 6) - - // rotate first segment join - if (state.close) { - if (positions[0] === positions[count*2 - 2] && - positions[1] === positions[count*2 - 1]) { - positionData[0] = npos[count*2 - 4] - positionData[1] = npos[count*2 - 3] - } - else { - positionData[0] = npos[count*2 - 2] - positionData[1] = npos[count*2 - 1] - } - } - else { - positionData[0] = npos[0] - positionData[1] = npos[1] - } - - positionData.set(npos, 2) - - // add last segment - if (state.close) { - // ignore coinciding start/end - if (positions[0] === positions[count*2 - 2] && - positions[1] === positions[count*2 - 1]) { - positionData[count*2 + 2] = npos[2] - positionData[count*2 + 3] = npos[3] - state.count -= 1 - } - else { - positionData[count*2 + 2] = npos[0] - positionData[count*2 + 3] = npos[1] - positionData[count*2 + 4] = npos[2] - positionData[count*2 + 5] = npos[3] - } - } - // add stub - else { - positionData[count*2 + 2] = npos[count*2 - 2] - positionData[count*2 + 3] = npos[count*2 - 1] - positionData[count*2 + 4] = npos[count*2 - 2] - positionData[count*2 + 5] = npos[count*2 - 1] - } - - state.positionBuffer(float32(positionData)) - state.positionFractBuffer(fract32(positionData)) - } - - if (o.range) { - state.range = o.range - } else if (!state.range) { - state.range = state.bounds - } - - if ((o.range || o.positions) && state.count) { - var bounds$1 = state.bounds - - var boundsW = bounds$1[2] - bounds$1[0], - boundsH = bounds$1[3] - bounds$1[1] - - var rangeW = state.range[2] - state.range[0], - rangeH = state.range[3] - state.range[1] - - state.scale = [ - boundsW / rangeW, - boundsH / rangeH - ] - state.translate = [ - -state.range[0] / rangeW + bounds$1[0] / rangeW || 0, - -state.range[1] / rangeH + bounds$1[1] / rangeH || 0 - ] - - state.scaleFract = fract32(state.scale) - state.translateFract = fract32(state.translate) - } - - if (o.dashes) { - var dashLength = 0., dashData - - if (!o.dashes || o.dashes.length < 2) { - dashLength = 1. - dashData = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]) - } - - else { - dashLength = 0.; - for(var i$4 = 0; i$4 < o.dashes.length; ++i$4) { - dashLength += o.dashes[i$4] - } - dashData = new Uint8Array(dashLength * Line2D.dashMult) - var ptr$1 = 0 - var fillColor = 255 - - // repeat texture two times to provide smooth 0-step - for (var k = 0; k < 2; k++) { - for(var i$5 = 0; i$5 < o.dashes.length; ++i$5) { - for(var j = 0, l$2 = o.dashes[i$5] * Line2D.dashMult * .5; j < l$2; ++j) { - dashData[ptr$1++] = fillColor - } - fillColor ^= 255 - } - } - } - - state.dashLength = dashLength - state.dashTexture({ - channels: 1, - data: dashData, - width: dashData.length, - height: 1, - mag: 'linear', - min: 'linear' - }, 0, 0) - } - - if (o.color) { - var count$1 = state.count - var colors = o.color - - if (!colors) { colors = 'transparent' } - - var colorData = new Uint8Array(count$1 * 4 + 4) - - // convert colors to typed arrays - if (!Array.isArray(colors) || typeof colors[0] === 'number') { - var c = rgba(colors, 'uint8') - - for (var i$6 = 0; i$6 < count$1 + 1; i$6++) { - colorData.set(c, i$6 * 4) - } - } else { - for (var i$7 = 0; i$7 < count$1; i$7++) { - var c$1 = rgba(colors[i$7], 'uint8') - colorData.set(c$1, i$7 * 4) - } - colorData.set(rgba(colors[0], 'uint8'), count$1 * 4) - } - - state.colorBuffer({ - usage: 'dynamic', - type: 'uint8', - data: colorData - }) - } - }) - - // remove unmentioned passes - if (options.length < this.passes.length) { - for (var i = options.length; i < this.passes.length; i++) { - var pass = this$1.passes[i] - if (!pass) { continue } - pass.colorBuffer.destroy() - pass.positionBuffer.destroy() - pass.dashTexture.destroy() - } - this.passes.length = options.length - } - - // remove null items - var passes = [] - for (var i$1 = 0; i$1 < this.passes.length; i$1++) { - if (this$1.passes[i$1] !== null) { passes.push(this$1.passes[i$1]) } - } - this.passes = passes - - return this -} - -Line2D.prototype.destroy = function () { - this.passes.forEach(function (pass) { - pass.colorBuffer.destroy() - pass.positionBuffer.destroy() - pass.dashTexture.destroy() - }) - - this.passes.length = 0 - - return this -} - -},{"array-bounds":53,"array-normalize":54,"color-normalize":108,"earcut":156,"es6-weak-map":209,"flatten-vertex-data":216,"glslify":392,"object-assign":437,"parse-rect":442,"pick-by-alias":448,"to-float32":515}],475:[function(_dereq_,module,exports){ -'use strict' - -var Scatter = _dereq_('./scatter') -var extend = _dereq_('object-assign') - -module.exports = function (regl, options) { - var scatter = new Scatter(regl, options) - - var render = scatter.render.bind(scatter) - - // expose API - extend(render, { - render: render, - update: scatter.update.bind(scatter), - draw: scatter.draw.bind(scatter), - destroy: scatter.destroy.bind(scatter), - regl: scatter.regl, - gl: scatter.gl, - canvas: scatter.gl.canvas, - groups: scatter.groups, - markers: scatter.markerCache, - palette: scatter.palette - }) - - return render -} -},{"./scatter":476,"object-assign":437}],476:[function(_dereq_,module,exports){ -'use strict' - -var rgba = _dereq_('color-normalize') -var getBounds = _dereq_('array-bounds') -var colorId = _dereq_('color-id') -var cluster = _dereq_('point-cluster') -var extend = _dereq_('object-assign') -var glslify = _dereq_('glslify') -var pick = _dereq_('pick-by-alias') -var updateDiff = _dereq_('update-diff') -var flatten = _dereq_('flatten-vertex-data') -var ie = _dereq_('is-iexplorer') -var f32 = _dereq_('to-float32') -var parseRect = _dereq_('parse-rect') - - -module.exports = Scatter - - -function Scatter (regl, options) { - var this$1 = this; - - if (!(this instanceof Scatter)) { return new Scatter(regl, options) } - - if (typeof regl === 'function') { - if (!options) { options = {} } - options.regl = regl - } - else { - options = regl - regl = null - } - - if (options && options.length) { options.positions = options } - - regl = options.regl - - // persistent variables - var gl = regl._gl, paletteTexture, palette = [], paletteIds = {}, - - // state - groups = [], - - // textures for marker keys - markerTextures = [null], - markerCache = [null] - - var maxColors = 255, maxSize = 100 - - // direct color buffer mode - // IE does not support palette anyways - this.tooManyColors = ie - - // texture with color palette - paletteTexture = regl.texture({ - data: new Uint8Array(maxColors * 4), - width: maxColors, - height: 1, - type: 'uint8', - format: 'rgba', - wrapS: 'clamp', - wrapT: 'clamp', - mag: 'nearest', - min: 'nearest' - }) - - extend(this, { - regl: regl, - gl: gl, - groups: groups, - markerCache: markerCache, - markerTextures: markerTextures, - palette: palette, - paletteIds: paletteIds, - paletteTexture: paletteTexture, - maxColors: maxColors, - maxSize: maxSize, - canvas: gl.canvas - }) - - this.update(options) - - // common shader options - var shaderOptions = { - uniforms: { - pixelRatio: regl.context('pixelRatio'), - palette: paletteTexture, - paletteSize: function (ctx, prop) { return [this$1.tooManyColors ? 0 : maxColors, paletteTexture.height]; }, - scale: regl.prop('scale'), - scaleFract: regl.prop('scaleFract'), - translate: regl.prop('translate'), - translateFract: regl.prop('translateFract'), - opacity: regl.prop('opacity'), - marker: regl.prop('markerTexture'), - }, - - attributes: { - // FIXME: optimize these parts - x: function (ctx, prop) { return prop.xAttr || { - buffer: prop.positionBuffer, - stride: 8, - offset: 0 - }; }, - y: function (ctx, prop) { return prop.yAttr || { - buffer: prop.positionBuffer, - stride: 8, - offset: 4 - }; }, - xFract: function (ctx, prop) { return prop.xAttr ? { constant: [0, 0] } : { - buffer: prop.positionFractBuffer, - stride: 8, - offset: 0 - }; }, - yFract: function (ctx, prop) { return prop.yAttr ? { constant: [0, 0] } : { - buffer: prop.positionFractBuffer, - stride: 8, - offset: 4 - }; }, - size: function (ctx, prop) { return prop.size.length ? { - buffer: prop.sizeBuffer, - stride: 2, - offset: 0 - } : { - constant: [ Math.round(prop.size * 255 / this$1.maxSize) ] - }; }, - borderSize: function (ctx, prop) { return prop.borderSize.length ? { - buffer: prop.sizeBuffer, - stride: 2, - offset: 1 - } : { - constant: [ Math.round(prop.borderSize * 255 / this$1.maxSize) ] - }; }, - colorId: function (ctx, prop) { return prop.color.length ? { - buffer: prop.colorBuffer, - stride: this$1.tooManyColors ? 8 : 4, - offset: 0 - } : { - constant: this$1.tooManyColors ? palette.slice(prop.color * 4, prop.color * 4 + 4) : [ prop.color ] - }; }, - borderColorId: function (ctx, prop) { return prop.borderColor.length ? { - buffer: prop.colorBuffer, - stride: this$1.tooManyColors ? 8 : 4, - offset: this$1.tooManyColors ? 4 : 2 - } : { - constant: this$1.tooManyColors ? palette.slice(prop.borderColor * 4, prop.borderColor * 4 + 4) : [ prop.borderColor ] - }; }, - isActive: function (ctx, prop) { return prop.activation === true ? { constant: [1] } : prop.activation ? prop.activation : { constant: [0] }; } - }, - - blend: { - enable: true, - color: [0,0,0,1], - - // photoshop blending - func: { - srcRGB: 'src alpha', - dstRGB: 'one minus src alpha', - srcAlpha: 'one minus dst alpha', - dstAlpha: 'one' - } - }, - - scissor: { - enable: true, - box: regl.prop('viewport') - }, - viewport: regl.prop('viewport'), - - stencil: {enable: false}, - depth: {enable: false}, - - elements: regl.prop('elements'), - count: regl.prop('count'), - offset: regl.prop('offset'), - - primitive: 'points' - } - - // draw sdf-marker - var markerOptions = extend({}, shaderOptions) - markerOptions.frag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragWidth, fragBorderColorLevel, fragColorLevel;\n\nuniform sampler2D marker;\nuniform float pixelRatio, opacity;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float dist = texture2D(marker, gl_PointCoord).r, delta = fragWidth;\n\n // max-distance alpha\n if (dist < 0.003) discard;\n\n // null-border case\n if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {\n float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);\n gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a * opacity);\n }\n else {\n float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);\n float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);\n\n vec4 color = fragBorderColor;\n color.a *= borderColorAmt;\n color = mix(color, fragColor, colorAmt);\n color.a *= opacity;\n\n gl_FragColor = color;\n }\n\n}\n"]) - markerOptions.vert = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract, paletteSize;\nuniform float pixelRatio;\nuniform sampler2D palette;\n\nconst float maxSize = 100.;\nconst float borderLevel = .5;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragPointSize, fragBorderRadius,\n fragWidth, fragBorderColorLevel, fragColorLevel;\n\nvec2 paletteCoord(float id) {\n return vec2(\n (mod(id, paletteSize.x) + .5) / paletteSize.x,\n (floor(id / paletteSize.x) + .5) / paletteSize.y\n );\n}\nvec2 paletteCoord(vec2 id) {\n return vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n );\n}\nvec4 getColor(vec4 id) {\n // zero-palette means we deal with direct buffer\n if (paletteSize.x == 0.) return id / 255.;\n return texture2D(palette, paletteCoord(id.xy));\n}\n\nvoid main() {\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = 2. * size * pixelRatio;\n fragPointSize = size * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragColor = color;\n fragBorderColor = borderColor;\n fragWidth = 1. / gl_PointSize;\n\n fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);\n fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);\n}\n"]) - - this.drawMarker = regl(markerOptions) - - // draw circle - var circleOptions = extend({}, shaderOptions) - circleOptions.frag = glslify(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor, fragBorderColor;\n\nuniform float opacity;\nvarying float fragBorderRadius, fragWidth;\n\nfloat smoothStep(float edge0, float edge1, float x) {\n\tfloat t;\n\tt = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\treturn t * t * (3.0 - 2.0 * t);\n}\n\nvoid main() {\n\tfloat radius, alpha = 1.0, delta = fragWidth;\n\n\tradius = length(2.0 * gl_PointCoord.xy - 1.0);\n\n\tif (radius > 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]) - circleOptions.vert = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nvec2 paletteCoord(float id) {\n return vec2(\n (mod(id, paletteSize.x) + .5) / paletteSize.x,\n (floor(id / paletteSize.x) + .5) / paletteSize.y\n );\n}\nvec2 paletteCoord(vec2 id) {\n return vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n );\n}\n\nvec4 getColor(vec4 id) {\n // zero-palette means we deal with direct buffer\n if (paletteSize.x == 0.) return id / 255.;\n return texture2D(palette, paletteCoord(id.xy));\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]) - - // polyfill IE - if (ie) { - circleOptions.frag = circleOptions.frag.replace('smoothstep', 'smoothStep') - markerOptions.frag = markerOptions.frag.replace('smoothstep', 'smoothStep') - } - - this.drawCircle = regl(circleOptions) -} - -// single pass defaults -Scatter.defaults = { - color: 'black', - borderColor: 'transparent', - borderSize: 0, - size: 12, - opacity: 1, - marker: undefined, - viewport: null, - range: null, - pixelSize: null, - count: 0, - offset: 0, - bounds: null, - positions: [], - snap: 1e4 -} - - -// update & redraw -Scatter.prototype.render = function () { - var ref; - - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (args.length) { - (ref = this).update.apply(ref, args) - } - - this.draw() - - return this -} - - -// draw all groups or only indicated ones -Scatter.prototype.draw = function () { - var this$1 = this; - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - var ref = this; - var groups = ref.groups; - - // if directly array passed - treat as passes - if (args.length === 1 && Array.isArray(args[0]) && (args[0][0] === null || Array.isArray(args[0][0]))) { - args = args[0] - } - - // FIXME: remove once https://github.com/regl-project/regl/issues/474 resolved - this.regl._refresh() - - if (args.length) { - for (var i = 0; i < args.length; i++) { - this$1.drawItem(i, args[i]) - } - } - // draw all passes - else { - groups.forEach(function (group, i) { - this$1.drawItem(i) - }) - } - - return this -} - -// draw specific scatter group -Scatter.prototype.drawItem = function (id, els) { - var this$1 = this; - - var ref = this; - var groups = ref.groups; - var group = groups[id] - - // debug viewport - // let { viewport } = group - // gl.enable(gl.SCISSOR_TEST); - // gl.scissor(viewport.x, viewport.y, viewport.width, viewport.height); - // gl.clearColor(0, 0, 0, .5); - // gl.clear(gl.COLOR_BUFFER_BIT); - - if (typeof els === 'number') { - id = els - group = groups[els] - els = null - } - - if (!(group && group.count && group.opacity)) { return } - - // draw circles - if (group.activation[0]) { - // TODO: optimize this performance by making groups and regl.this props - this.drawCircle(this.getMarkerDrawOptions(0, group, els)) - } - - // draw all other available markers - var batch = [] - - for (var i = 1; i < group.activation.length; i++) { - if (!group.activation[i] || (group.activation[i] !== true && !group.activation[i].data.length)) { continue } - - batch.push.apply(batch, this$1.getMarkerDrawOptions(i, group, els)) - } - - if (batch.length) { - this.drawMarker(batch) - } -} - -// get options for the marker ids -Scatter.prototype.getMarkerDrawOptions = function(markerId, group, elements) { - var this$1 = this; - - var range = group.range; - var tree = group.tree; - var viewport = group.viewport; - var activation = group.activation; - var selectionBuffer = group.selectionBuffer; - var count = group.count; - var ref = this; - var regl = ref.regl; - - // direct points - if (!tree) { - // if elements array - draw unclustered points - if (elements) { - return [extend({}, group, { - markerTexture: this.markerTextures[markerId], - activation: activation[markerId], - count: elements.length, - elements: elements, - offset: 0 - })] - } - - return [ extend({}, group, { - markerTexture: this.markerTextures[markerId], - activation: activation[markerId], - offset: 0 - }) ] - } - - // clustered points - var batch = [] - - var lod = tree.range(range, { lod: true, px: [ - (range[2] - range[0]) / viewport.width, - (range[3] - range[1]) / viewport.height - ]}) - - // enable elements by using selection buffer - if (elements) { - var markerActivation = activation[markerId] - var mask = markerActivation.data - var data = new Uint8Array(count) - for (var i = 0; i < elements.length; i++) { - var id = elements[i] - data[id] = mask ? mask[id] : 1 - } - selectionBuffer.subdata(data) - } - - for (var l = lod.length; l--;) { - var ref$1 = lod[l]; - var from = ref$1[0]; - var to = ref$1[1]; - - batch.push(extend({}, group, { - markerTexture: this$1.markerTextures[markerId], - activation: elements ? selectionBuffer : activation[markerId], - offset: from, - count: to - from - })) - } - - return batch -} - -// update groups options -Scatter.prototype.update = function () { - var this$1 = this; - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - if (!args.length) { return } - - // passes are as single array - if (args.length === 1 && Array.isArray(args[0])) { args = args[0] } - - var ref = this; - var groups = ref.groups; - var gl = ref.gl; - var regl = ref.regl; - var maxSize = ref.maxSize; - var maxColors = ref.maxColors; - var palette = ref.palette; - - this.groups = groups = args.map(function (options, i) { - var group = groups[i] - - if (options === undefined) { return group } - - if (options === null) { options = { positions: null } } - else if (typeof options === 'function') { options = { ondraw: options } } - else if (typeof options[0] === 'number') { options = { positions: options } } - - // copy options to avoid mutation & handle aliases - options = pick(options, { - positions: 'positions data points', - snap: 'snap cluster lod tree', - size: 'sizes size radius', - borderSize: 'borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline', - color: 'colors color fill fill-color fillColor', - borderColor: 'borderColors borderColor stroke stroke-color strokeColor', - marker: 'markers marker shape', - range: 'range dataBox databox', - viewport: 'viewport viewPort viewBox viewbox', - opacity: 'opacity alpha transparency', - bounds: 'bound bounds boundaries limits' - }) - - if (options.positions === null) { options.positions = [] } - - if (!group) { - groups[i] = group = { - id: i, - scale: null, - translate: null, - scaleFract: null, - translateFract: null, - - // buffers for active markers - activation: [], - - // buffer for filtered markers - selectionBuffer: regl.buffer({ - data: new Uint8Array(0), - usage: 'stream', - type: 'uint8' - }), - - // buffers with data: it is faster to switch them per-pass - // than provide one congregate buffer - sizeBuffer: regl.buffer({ - data: new Uint8Array(0), - usage: 'dynamic', - type: 'uint8' - }), - colorBuffer: regl.buffer({ - data: new Uint8Array(0), - usage: 'dynamic', - type: 'uint8' - }), - positionBuffer: regl.buffer({ - data: new Uint8Array(0), - usage: 'dynamic', - type: 'float' - }), - positionFractBuffer: regl.buffer({ - data: new Uint8Array(0), - usage: 'dynamic', - type: 'float' - }) - } - options = extend({}, Scatter.defaults, options) - } - - // force update triggers - if (options.positions && !('marker' in options)) { - options.marker = group.marker - delete group.marker - } - - // updating markers cause recalculating snapping - if (options.marker && !('positions' in options)) { - options.positions = group.positions - delete group.positions - } - - // global count of points - var hasSize = 0, hasColor = 0 - - updateDiff(group, options, [{ - snap: true, - size: function (s, group) { - if (s == null) { s = Scatter.defaults.size } - hasSize += s && s.length ? 1 : 0 - return s - }, - borderSize: function (s, group) { - if (s == null) { s = Scatter.defaults.borderSize } - hasSize += s && s.length ? 1 : 0 - return s - }, - opacity: parseFloat, - - // add colors to palette, save references - color: function (c, group) { - if (c == null) { c = Scatter.defaults.color } - c = this$1.updateColor(c) - hasColor++ - return c - }, - borderColor: function (c, group) { - if (c == null) { c = Scatter.defaults.borderColor } - c = this$1.updateColor(c) - hasColor++ - return c - }, - - bounds: function (bounds, group, options) { - if (!('range' in options)) { options.range = null } - return bounds - }, - - positions: function (positions, group, options) { - var snap = group.snap; - var positionBuffer = group.positionBuffer; - var positionFractBuffer = group.positionFractBuffer; - var selectionBuffer = group.selectionBuffer; - - // separate buffers for x/y coordinates - if (positions.x || positions.y) { - if (positions.x.length) { - group.xAttr = { - buffer: regl.buffer(positions.x), - offset: 0, - stride: 4, - count: positions.x.length - } - } - else { - group.xAttr = { - buffer: positions.x.buffer, - offset: positions.x.offset * 4 || 0, - stride: (positions.x.stride || 1) * 4, - count: positions.x.count - } - } - if (positions.y.length) { - group.yAttr = { - buffer: regl.buffer(positions.y), - offset: 0, - stride: 4, - count: positions.y.length - } - } - else { - group.yAttr = { - buffer: positions.y.buffer, - offset: positions.y.offset * 4 || 0, - stride: (positions.y.stride || 1) * 4, - count: positions.y.count - } - } - group.count = Math.max(group.xAttr.count, group.yAttr.count) - - return positions - } - - positions = flatten(positions, 'float64') - - var count = group.count = Math.floor(positions.length / 2) - var bounds = group.bounds = count ? getBounds(positions, 2) : null - - // if range is not provided updated - recalc it - if (!options.range && !group.range) { - delete group.range - options.range = bounds - } - - // reset marker - if (!options.marker && !group.marker) { - delete group.marker; - options.marker = null; - } - - // build cluster tree if required - if (snap && (snap === true || count > snap)) { - group.tree = cluster(positions, { bounds: bounds }) - } - // existing tree instance - else if (snap && snap.length) { - group.tree = snap - } - - if (group.tree) { - var opts = { - primitive: 'points', - usage: 'static', - data: group.tree, - type: 'uint32' - } - if (group.elements) { group.elements(opts) } - else { group.elements = regl.elements(opts) } - } - - // update position buffers - positionBuffer({ - data: f32.float(positions), - usage: 'dynamic' - }) - positionFractBuffer({ - data: f32.fract(positions), - usage: 'dynamic' - }) - - // expand selectionBuffer - selectionBuffer({ - data: new Uint8Array(count), - type: 'uint8', - usage: 'stream' - }) - - return positions - } - }, { - // create marker ids corresponding to known marker textures - marker: function (markers, group, options) { - var activation = group.activation; - - // reset marker elements - activation.forEach(function (buffer) { return buffer && buffer.destroy && buffer.destroy(); }) - activation.length = 0 - - // single sdf marker - if (!markers || typeof markers[0] === 'number') { - var id = this$1.addMarker(markers) - activation[id] = true - } - - // per-point markers use mask buffers to enable markers in vert shader - else { - var markerMasks = [] - - for (var i = 0, l = Math.min(markers.length, group.count); i < l; i++) { - var id$1 = this$1.addMarker(markers[i]) - - if (!markerMasks[id$1]) { markerMasks[id$1] = new Uint8Array(group.count) } - - // enable marker by default - markerMasks[id$1][i] = 1 - } - - for (var id$2 = 0; id$2 < markerMasks.length; id$2++) { - if (!markerMasks[id$2]) { continue } - - var opts = { - data: markerMasks[id$2], - type: 'uint8', - usage: 'static' - } - if (!activation[id$2]) { - activation[id$2] = regl.buffer(opts) - } - else { - activation[id$2](opts) - } - - activation[id$2].data = markerMasks[id$2] - } - } - - return markers - }, - - range: function (range, group, options) { - var bounds = group.bounds - - // FIXME: why do we need this? - if (!bounds) { return } - if (!range) { range = bounds } - - group.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])] - group.translate = [-range[0], -range[1]] - - group.scaleFract = f32.fract(group.scale) - group.translateFract = f32.fract(group.translate) - - return range - }, - - viewport: function (vp) { - var rect = parseRect(vp || [ - gl.drawingBufferWidth, - gl.drawingBufferHeight - ]) - - // normalize viewport to the canvas coordinates - // rect.y = gl.drawingBufferHeight - rect.height - rect.y - - return rect - } - }]) - - // update size buffer, if needed - if (hasSize) { - var count = group.count; - var size = group.size; - var borderSize = group.borderSize; - var sizeBuffer = group.sizeBuffer; - - var sizes = new Uint8Array(count*2) - if (size.length || borderSize.length) { - for (var i$1 = 0; i$1 < count; i$1++) { - // we downscale size to allow for fractions - sizes[i$1*2] = Math.round((size[i$1] == null ? size : size[i$1]) * 255 / maxSize) - sizes[i$1*2 + 1] = Math.round((borderSize[i$1] == null ? borderSize : borderSize[i$1]) * 255 / maxSize) - } - } - sizeBuffer({ - data: sizes, - usage: 'dynamic' - }) - } - - // update color buffer if needed - if (hasColor) { - var count$1 = group.count; - var color = group.color; - var borderColor = group.borderColor; - var colorBuffer = group.colorBuffer; - var colors - - // if too many colors - put colors to buffer directly - if (this$1.tooManyColors) { - if (color.length || borderColor.length) { - colors = new Uint8Array(count$1 * 8) - for (var i$2 = 0; i$2 < count$1; i$2++) { - var colorId = color[i$2] - colors[i$2*8] = palette[colorId*4] - colors[i$2*8 + 1] = palette[colorId*4 + 1] - colors[i$2*8 + 2] = palette[colorId*4 + 2] - colors[i$2*8 + 3] = palette[colorId*4 + 3] - - var borderColorId = borderColor[i$2] - colors[i$2*8 + 4] = palette[borderColorId*4] - colors[i$2*8 + 5] = palette[borderColorId*4 + 1] - colors[i$2*8 + 6] = palette[borderColorId*4 + 2] - colors[i$2*8 + 7] = palette[borderColorId*4 + 3] - } - } - } - - // if limited amount of colors - keep palette color picking - // that saves significant memory - else { - if (color.length || borderColor.length) { - // we need slight data increase by 2 due to vec4 borderId in shader - colors = new Uint8Array(count$1 * 4 + 2) - for (var i$3 = 0; i$3 < count$1; i$3++) { - // put color coords in palette texture - if (color[i$3] != null) { - colors[i$3*4] = color[i$3] % maxColors - colors[i$3*4 + 1] = Math.floor(color[i$3] / maxColors) - } - if (borderColor[i$3] != null) { - colors[i$3*4 + 2] = borderColor[i$3] % maxColors - colors[i$3*4 + 3] = Math.floor(borderColor[i$3] / maxColors) - } - } - } - } - - colorBuffer({ - data: colors || new Uint8Array(0), - type: 'uint8', - usage: 'dynamic' - }) - } - - return group - }) -} - - -// get (and create) marker texture id -Scatter.prototype.addMarker = function (sdf) { - var ref = this; - var markerTextures = ref.markerTextures; - var regl = ref.regl; - var markerCache = ref.markerCache; - - var pos = sdf == null ? 0 : markerCache.indexOf(sdf) - - if (pos >= 0) { return pos } - - // convert sdf to 0..255 range - var distArr - if (sdf instanceof Uint8Array || sdf instanceof Uint8ClampedArray) { - distArr = sdf - } - else { - distArr = new Uint8Array(sdf.length) - for (var i = 0, l = sdf.length; i < l; i++) { - distArr[i] = sdf[i] * 255 - } - } - - var radius = Math.floor(Math.sqrt(distArr.length)) - - pos = markerTextures.length - - markerCache.push(sdf) - markerTextures.push(regl.texture({ - channels: 1, - data: distArr, - radius: radius, - mag: 'linear', - min: 'linear' - })) - - return pos -} - -// register color to palette, return it's index or list of indexes -Scatter.prototype.updateColor = function (colors) { - var ref = this; - var paletteIds = ref.paletteIds; - var palette = ref.palette; - var maxColors = ref.maxColors; - - if (!Array.isArray(colors)) { - colors = [colors] - } - - var idx = [] - - // if color groups - flatten them - if (typeof colors[0] === 'number') { - var grouped = [] - - if (Array.isArray(colors)) { - for (var i = 0; i < colors.length; i+=4) { - grouped.push(colors.slice(i, i+4)) - } - } - else { - for (var i$1 = 0; i$1 < colors.length; i$1+=4) { - grouped.push(colors.subarray(i$1, i$1+4)) - } - } - - colors = grouped - } - - for (var i$2 = 0; i$2 < colors.length; i$2++) { - var color = colors[i$2] - - color = rgba(color, 'uint8') - - var id = colorId(color, false) - - // if new color - save it - if (paletteIds[id] == null) { - var pos = palette.length - paletteIds[id] = Math.floor(pos / 4) - palette[pos] = color[0] - palette[pos+1] = color[1] - palette[pos+2] = color[2] - palette[pos+3] = color[3] - } - - idx[i$2] = paletteIds[id] - } - - // detect if too many colors in palette - if (!this.tooManyColors && palette.length > maxColors * maxColors * 4) { this.tooManyColors = true } - - // limit max color - this.updatePalette(palette) - - // keep static index for single-color property - return idx.length === 1 ? idx[0] : idx -} - -Scatter.prototype.updatePalette = function (palette) { - if (this.tooManyColors) { return } - - var ref = this; - var maxColors = ref.maxColors; - var paletteTexture = ref.paletteTexture; - - var requiredHeight = Math.ceil(palette.length * .25 / maxColors) - - // pad data - if (requiredHeight > 1) { - palette = palette.slice() - for (var i = (palette.length * .25) % maxColors; i < requiredHeight * maxColors; i++) { - palette.push(0, 0, 0, 0) - } - } - - // ensure height - if (paletteTexture.height < requiredHeight) { - paletteTexture.resize(maxColors, requiredHeight) - } - - // update full data - paletteTexture.subimage({ - width: Math.min(palette.length * .25, maxColors), - height: requiredHeight, - data: palette - }, 0, 0) -} - -// remove unused stuff -Scatter.prototype.destroy = function () { - this.groups.forEach(function (group) { - group.sizeBuffer.destroy() - group.positionBuffer.destroy() - group.positionFractBuffer.destroy() - group.colorBuffer.destroy() - group.activation.forEach(function (b) { return b && b.destroy && b.destroy(); }) - group.selectionBuffer.destroy() - - if (group.elements) { group.elements.destroy() } - }) - this.groups.length = 0 - - this.paletteTexture.destroy() - - this.markerTextures.forEach(function (txt) { return txt && txt.destroy && txt.destroy(); }) - - return this -} -},{"array-bounds":53,"color-id":106,"color-normalize":108,"flatten-vertex-data":216,"glslify":392,"is-iexplorer":402,"object-assign":437,"parse-rect":442,"pick-by-alias":448,"point-cluster":452,"to-float32":515,"update-diff":526}],477:[function(_dereq_,module,exports){ -'use strict' - - -var createScatter = _dereq_('regl-scatter2d/scatter') -var pick = _dereq_('pick-by-alias') -var getBounds = _dereq_('array-bounds') -var raf = _dereq_('raf') -var arrRange = _dereq_('array-range') -var rect = _dereq_('parse-rect') -var flatten = _dereq_('flatten-vertex-data') - - -module.exports = SPLOM - - -// @constructor -function SPLOM (regl, options) { - if (!(this instanceof SPLOM)) { return new SPLOM(regl, options) } - - // render passes - this.traces = [] - - // passes for scatter, combined across traces - this.passes = {} - - this.regl = regl - - // main scatter drawing instance - this.scatter = createScatter(regl) - - this.canvas = this.scatter.canvas -} - - -// update & draw passes once per frame -SPLOM.prototype.render = function () { - var this$1 = this; - var ref; - - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (args.length) { - (ref = this).update.apply(ref, args) - } - - if (this.regl.attributes.preserveDrawingBuffer) { return this.draw() } - - // make sure draw is not called more often than once a frame - if (this.dirty) { - if (this.planned == null) { - this.planned = raf(function () { - this$1.draw() - this$1.dirty = true - this$1.planned = null - }) - } - } - else { - this.draw() - this.dirty = true - raf(function () { - this$1.dirty = false - }) - } - - return this -} - - -// update passes -SPLOM.prototype.update = function () { - var this$1 = this; - var ref; - - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (!args.length) { return } - - for (var i = 0; i < args.length; i++) { - this$1.updateItem(i, args[i]) - } - - // remove nulled passes - this.traces = this.traces.filter(Boolean) - - // FIXME: update passes independently - var passes = [] - var offset = 0 - for (var i$1 = 0; i$1 < this.traces.length; i$1++) { - var trace = this$1.traces[i$1] - var tracePasses = this$1.traces[i$1].passes - for (var j = 0; j < tracePasses.length; j++) { - passes.push(this$1.passes[tracePasses[j]]) - } - // save offset of passes - trace.passOffset = offset - offset += trace.passes.length - } - - (ref = this.scatter).update.apply(ref, passes) - - return this -} - - -// update trace by index, not supposed to be called directly -SPLOM.prototype.updateItem = function (i, options) { - var this$1 = this; - - var ref = this; - var regl = ref.regl; - - // remove pass if null - if (options === null) { - this.traces[i] = null - return this - } - - if (!options) { return this } - - var o = pick(options, { - data: 'data items columns rows values dimensions samples x', - snap: 'snap cluster', - size: 'sizes size radius', - color: 'colors color fill fill-color fillColor', - opacity: 'opacity alpha transparency opaque', - borderSize: 'borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline', - borderColor: 'borderColors borderColor bordercolor stroke stroke-color strokeColor', - marker: 'markers marker shape', - range: 'range ranges databox dataBox', - viewport: 'viewport viewBox viewbox', - domain: 'domain domains area areas', - padding: 'pad padding paddings pads margin margins', - transpose: 'transpose transposed', - diagonal: 'diagonal diag showDiagonal', - upper: 'upper up top upperhalf upperHalf showupperhalf showUpper showUpperHalf', - lower: 'lower low bottom lowerhalf lowerHalf showlowerhalf showLowerHalf showLower' - }) - - // we provide regl buffer per-trace, since trace data can be changed - var trace = (this.traces[i] || (this.traces[i] = { - id: i, - buffer: regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array() - }), - color: 'black', - marker: null, - size: 12, - borderColor: 'transparent', - borderSize: 1, - viewport: rect([regl._gl.drawingBufferWidth, regl._gl.drawingBufferHeight]), - padding: [0, 0, 0, 0], - opacity: 1, - diagonal: true, - upper: true, - lower: true - })) - - - // save styles - if (o.color != null) { - trace.color = o.color - } - if (o.size != null) { - trace.size = o.size - } - if (o.marker != null) { - trace.marker = o.marker - } - if (o.borderColor != null) { - trace.borderColor = o.borderColor - } - if (o.borderSize != null) { - trace.borderSize = o.borderSize - } - if (o.opacity != null) { - trace.opacity = o.opacity - } - if (o.viewport) { - trace.viewport = rect(o.viewport) - } - if (o.diagonal != null) { trace.diagonal = o.diagonal } - if (o.upper != null) { trace.upper = o.upper } - if (o.lower != null) { trace.lower = o.lower } - - // put flattened data into buffer - if (o.data) { - trace.buffer(flatten(o.data)) - trace.columns = o.data.length - trace.count = o.data[0].length - - // detect bounds per-column - trace.bounds = [] - - for (var i$1 = 0; i$1 < trace.columns; i$1++) { - trace.bounds[i$1] = getBounds(o.data[i$1], 1) - } - } - - // add proper range updating markers - var multirange - if (o.range) { - trace.range = o.range - multirange = trace.range && typeof trace.range[0] !== 'number' - } - - if (o.domain) { - trace.domain = o.domain - } - var multipadding = false - if (o.padding != null) { - // multiple paddings - if (Array.isArray(o.padding) && o.padding.length === trace.columns && typeof o.padding[o.padding.length - 1] === 'number') { - trace.padding = o.padding.map(getPad) - multipadding = true - } - // single padding - else { - trace.padding = getPad(o.padding) - } - } - - // create passes - var m = trace.columns - var n = trace.count - - var w = trace.viewport.width - var h = trace.viewport.height - var left = trace.viewport.x - var top = trace.viewport.y - var iw = w / m - var ih = h / m - - trace.passes = [] - - for (var i$2 = 0; i$2 < m; i$2++) { - for (var j = 0; j < m; j++) { - if (!trace.diagonal && j === i$2) { continue } - if (!trace.upper && i$2 > j) { continue } - if (!trace.lower && i$2 < j) { continue } - - var key = passId(trace.id, i$2, j) - - var pass = this$1.passes[key] || (this$1.passes[key] = {}) - - if (o.data) { - if (o.transpose) { - pass.positions = { - x: {buffer: trace.buffer, offset: j, count: n, stride: m}, - y: {buffer: trace.buffer, offset: i$2, count: n, stride: m} - } - } - else { - pass.positions = { - x: {buffer: trace.buffer, offset: j * n, count: n}, - y: {buffer: trace.buffer, offset: i$2 * n, count: n} - } - } - - pass.bounds = getBox(trace.bounds, i$2, j) - } - - if (o.domain || o.viewport || o.data) { - var pad = multipadding ? getBox(trace.padding, i$2, j) : trace.padding - if (trace.domain) { - var ref$1 = getBox(trace.domain, i$2, j); - var lox = ref$1[0]; - var loy = ref$1[1]; - var hix = ref$1[2]; - var hiy = ref$1[3]; - - pass.viewport = [ - left + lox * w + pad[0], - top + loy * h + pad[1], - left + hix * w - pad[2], - top + hiy * h - pad[3] - ] - } - // consider auto-domain equipartial - else { - pass.viewport = [ - left + j * iw + iw * pad[0], - top + i$2 * ih + ih * pad[1], - left + (j + 1) * iw - iw * pad[2], - top + (i$2 + 1) * ih - ih * pad[3] - ] - } - } - - if (o.color) { pass.color = trace.color } - if (o.size) { pass.size = trace.size } - if (o.marker) { pass.marker = trace.marker } - if (o.borderSize) { pass.borderSize = trace.borderSize } - if (o.borderColor) { pass.borderColor = trace.borderColor } - if (o.opacity) { pass.opacity = trace.opacity } - - if (o.range) { - pass.range = multirange ? getBox(trace.range, i$2, j) : trace.range || pass.bounds - } - - trace.passes.push(key) - } - } - - return this -} - - -// draw all or passed passes -SPLOM.prototype.draw = function () { - var this$1 = this; - var ref$2; - - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (!args.length) { - this.scatter.draw() - } - else { - var idx = [] - for (var i = 0; i < args.length; i++) { - // draw(0, 2, 5) - draw traces - if (typeof args[i] === 'number' ) { - var ref = this$1.traces[args[i]]; - var passes = ref.passes; - var passOffset = ref.passOffset; - idx.push.apply(idx, arrRange(passOffset, passOffset + passes.length)) - } - // draw([0, 1, 2 ...], [3, 4, 5]) - draw points - else if (args[i].length) { - var els = args[i] - var ref$1 = this$1.traces[i]; - var passes$1 = ref$1.passes; - var passOffset$1 = ref$1.passOffset; - passes$1 = passes$1.map(function (passId, i) { - idx[passOffset$1 + i] = els - }) - } - } - (ref$2 = this.scatter).draw.apply(ref$2, idx) - } - - return this -} - - -// dispose resources -SPLOM.prototype.destroy = function () { - this.traces.forEach(function (trace) { - if (trace.buffer && trace.buffer.destroy) { trace.buffer.destroy() } - }) - this.traces = null - this.passes = null - - this.scatter.destroy() - - return this -} - - -// return pass corresponding to trace i- j- square -function passId (trace, i, j) { - var id = (trace.id != null ? trace.id : trace) - var n = i - var m = j - var key = id << 16 | (n & 0xff) << 8 | m & 0xff - - return key -} - - -// return bounding box corresponding to a pass -function getBox (items, i, j) { - var ilox, iloy, ihix, ihiy, jlox, jloy, jhix, jhiy - var iitem = items[i], jitem = items[j] - - if (iitem.length > 2) { - ilox = iitem[0] - ihix = iitem[2] - iloy = iitem[1] - ihiy = iitem[3] - } - else if (iitem.length) { - ilox = iloy = iitem[0] - ihix = ihiy = iitem[1] - } - else { - ilox = iitem.x - iloy = iitem.y - ihix = iitem.x + iitem.width - ihiy = iitem.y + iitem.height - } - - if (jitem.length > 2) { - jlox = jitem[0] - jhix = jitem[2] - jloy = jitem[1] - jhiy = jitem[3] - } - else if (jitem.length) { - jlox = jloy = jitem[0] - jhix = jhiy = jitem[1] - } - else { - jlox = jitem.x - jloy = jitem.y - jhix = jitem.x + jitem.width - jhiy = jitem.y + jitem.height - } - - return [ jlox, iloy, jhix, ihiy ] -} - - -function getPad (arg) { - if (typeof arg === 'number') { return [arg, arg, arg, arg] } - else if (arg.length === 2) { return [arg[0], arg[1], arg[0], arg[1]] } - else { - var box = rect(arg) - return [box.x, box.y, box.x + box.width, box.y + box.height] - } -} - -},{"array-bounds":53,"array-range":55,"flatten-vertex-data":216,"parse-rect":442,"pick-by-alias":448,"raf":467,"regl-scatter2d/scatter":476}],478:[function(_dereq_,module,exports){ -(function(pa,W){"object"===typeof exports&&"undefined"!==typeof module?module.exports=W():"function"===typeof define&&define.amd?define(W):pa.createREGL=W()})(this,function(){function pa(a,b){this.id=Ab++;this.type=a;this.data=b}function W(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1>>=b;c=(255>>=c;b|=c;c=(15>>=c;b|=c;c=(3>>c>>1}function cb(){function a(a){a:{for(var b=16;268435456>=b;b*=16)if(a<=b){a=b;break a}a=0}b=c[bb(a)>>2];return 0>2].push(a)}var c=O(8,function(){return[]});return{alloc:a,free:b,allocType:function(b,c){var d=null;switch(b){case 5120:d=new Int8Array(a(c),0,c);break;case 5121:d=new Uint8Array(a(c),0,c);break;case 5122:d=new Int16Array(a(2*c),0,c);break;case 5123:d=new Uint16Array(a(2*c),0,c);break;case 5124:d=new Int32Array(a(4*c),0,c);break;case 5125:d=new Uint32Array(a(4*c),0,c);break;case 5126:d=new Float32Array(a(4*c),0,c);break;default:return null}return d.length!==c?d.subarray(0, -c):d},freeType:function(a){b(a.buffer)}}}function ka(a){return!!a&&"object"===typeof a&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&"number"===typeof a.offset&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||P(a.data))}function db(a,b,c,e,f,d){for(var n=0;ne&&(e=d.buffer.byteLength,5123===k?e>>=1:5125===k&&(e>>=2));d.vertCount=e;e=g;0>g&&(e=4,g=d.buffer.dimension,1===g&&(e=0),2===g&&(e=1),3===g&&(e=4));d.primType=e}function n(a){e.elementsCount--;delete k[a.id];a.buffer.destroy();a.buffer=null}var k={},r=0,p={uint8:5121,uint16:5123};b.oes_element_index_uint&&(p.uint32=5125);f.prototype.bind=function(){this.buffer.bind()};var u=[];return{create:function(a,b){function l(a){if(a)if("number"===typeof a)g(a),h.primType=4,h.vertCount=a|0, -h.type=5121;else{var b=null,c=35044,e=-1,f=-1,m=0,k=0;if(Array.isArray(a)||P(a)||ka(a))b=a;else if("data"in a&&(b=a.data),"usage"in a&&(c=jb[a.usage]),"primitive"in a&&(e=Sa[a.primitive]),"count"in a&&(f=a.count|0),"type"in a&&(k=p[a.type]),"length"in a)m=a.length|0;else if(m=f,5123===k||5122===k)m*=2;else if(5125===k||5124===k)m*=4;d(h,b,c,e,f,m,k)}else g(),h.primType=4,h.vertCount=0,h.type=5121;return l}var g=c.create(null,34963,!0),h=new f(g._buffer);e.elementsCount++;l(a);l._reglType="elements"; -l._elements=h;l.subdata=function(a,b){g.subdata(a,b);return l};l.destroy=function(){n(h)};return l},createStream:function(a){var b=u.pop();b||(b=new f(c.create(null,34963,!0,!1)._buffer));d(b,a,35040,-1,-1,0,0);return b},destroyStream:function(a){u.push(a)},getElements:function(a){return"function"===typeof a&&a._elements instanceof f?a._elements:null},clear:function(){R(k).forEach(n)}}}function kb(a){for(var b=z.allocType(5123,a.length),c=0;c>>31<<15,d=(e<<1>>>24)-127,e=e>>13&1023;b[c]=-24>d?f:-14>d?f+(e+1024>>-14-d):15>=d,c.height>>=d,C(c,e[d]),a.mipmask|=1<b;++b)a.images[b]=null;return a}function ib(a){for(var b=a.images,c=0;cb){for(var c=0;c=--this.refCount&&w(this)}});n.profile&&(d.getTotalTextureSize=function(){var a=0;Object.keys(Z).forEach(function(b){a+=Z[b].stats.size});return a});return{create2D:function(b,c){function e(a,b){var c=f.texInfo;v.call(c);var d=x();"number"===typeof a?"number"===typeof b?t(d,a|0,b|0):t(d,a|0,a|0):a?(N(c,a),B(d,a)):t(d,1,1);c.genMipmaps&&(d.mipmask=(d.width<<1)-1);f.mipmask=d.mipmask;r(f,d);f.internalformat=d.internalformat; -e.width=d.width;e.height=d.height;T(f);X(d,3553);Q(c,3553);Ba();ib(d);n.profile&&(f.stats.size=Ja(f.internalformat,f.type,d.width,d.height,c.genMipmaps,!1));e.format=O[f.internalformat];e.type=ba[f.type];e.mag=oa[c.magFilter];e.min=Aa[c.minFilter];e.wrapS=ia[c.wrapS];e.wrapT=ia[c.wrapT];return e}var f=new E(3553);Z[f.id]=f;d.textureCount++;e(b,c);e.subimage=function(a,b,c,d){b|=0;c|=0;d|=0;var q=g();r(q,f);q.width=0;q.height=0;C(q,a);q.width=q.width||(f.width>>d)-b;q.height=q.height||(f.height>>d)- -c;T(f);l(q,3553,b,c,d);Ba();h(q);return e};e.resize=function(b,c){var d=b|0,g=c|0||d;if(d===f.width&&g===f.height)return e;e.width=f.width=d;e.height=f.height=g;T(f);for(var q,y=f.channels,G=f.type,H=0;f.mipmask>>H;++H){var ea=d>>H,fa=g>>H;if(!ea||!fa)break;q=z.zero.allocType(G,ea*fa*y);a.texImage2D(3553,H,f.format,ea,fa,0,f.format,f.type,q);q&&z.zero.freeType(q)}Ba();n.profile&&(f.stats.size=Ja(f.internalformat,f.type,d,g,!1,!1));return e};e._reglType="texture2d";e._texture=f;n.profile&&(e.stats= -f.stats);e.destroy=function(){f.decRef()};return e},createCube:function(b,c,e,f,k,m){function A(a,b,c,d,e,J){var I,da=w.texInfo;v.call(da);for(I=0;6>I;++I)q[I]=x();if("number"===typeof a||!a)for(a=a|0||1,I=0;6>I;++I)t(q[I],a,a);else if("object"===typeof a)if(b)B(q[0],a),B(q[1],b),B(q[2],c),B(q[3],d),B(q[4],e),B(q[5],J);else if(N(da,a),p(w,a),"faces"in a)for(a=a.faces,I=0;6>I;++I)r(q[I],w),B(q[I],a[I]);else for(I=0;6>I;++I)B(q[I],a);r(w,q[0]);w.mipmask=da.genMipmaps?(q[0].width<<1)-1:q[0].mipmask; -w.internalformat=q[0].internalformat;A.width=q[0].width;A.height=q[0].height;T(w);for(I=0;6>I;++I)X(q[I],34069+I);Q(da,34067);Ba();n.profile&&(w.stats.size=Ja(w.internalformat,w.type,A.width,A.height,da.genMipmaps,!0));A.format=O[w.internalformat];A.type=ba[w.type];A.mag=oa[da.magFilter];A.min=Aa[da.minFilter];A.wrapS=ia[da.wrapS];A.wrapT=ia[da.wrapT];for(I=0;6>I;++I)ib(q[I]);return A}var w=new E(34067);Z[w.id]=w;d.cubeCount++;var q=Array(6);A(b,c,e,f,k,m);A.subimage=function(a,b,c,q,d){c|=0;q|=0; -d|=0;var e=g();r(e,w);e.width=0;e.height=0;C(e,b);e.width=e.width||(w.width>>d)-c;e.height=e.height||(w.height>>d)-q;T(w);l(e,34069+a,c,q,d);Ba();h(e);return A};A.resize=function(b){b|=0;if(b!==w.width){A.width=w.width=b;A.height=w.height=b;T(w);for(var c=0;6>c;++c)for(var q=0;w.mipmask>>q;++q)a.texImage2D(34069+c,q,w.format,b>>q,b>>q,0,w.format,w.type,null);Ba();n.profile&&(w.stats.size=Ja(w.internalformat,w.type,A.width,A.height,!1,!0));return A}};A._reglType="textureCube";A._texture=w;n.profile&& -(A.stats=w.stats);A.destroy=function(){w.decRef()};return A},clear:function(){for(var b=0;bc;++c)if(0!==(b.mipmask&1<>c,b.height>>c,0,b.internalformat,b.type,null); -else for(var e=0;6>e;++e)a.texImage2D(34069+e,c,b.internalformat,b.width>>c,b.height>>c,0,b.internalformat,b.type,null);Q(b.texInfo,b.target)})}}}function Ob(a,b,c,e,f,d){function n(a,b,c){this.target=a;this.texture=b;this.renderbuffer=c;var e=a=0;b?(a=b.width,e=b.height):c&&(a=c.width,e=c.height);this.width=a;this.height=e}function k(a){a&&(a.texture&&a.texture._texture.decRef(),a.renderbuffer&&a.renderbuffer._renderbuffer.decRef())}function r(a,b,c){a&&(a.texture?a.texture._texture.refCount+=1: -a.renderbuffer._renderbuffer.refCount+=1)}function p(b,c){c&&(c.texture?a.framebufferTexture2D(36160,b,c.target,c.texture._texture.texture,0):a.framebufferRenderbuffer(36160,b,36161,c.renderbuffer._renderbuffer.renderbuffer))}function u(a){var b=3553,c=null,e=null,d=a;"object"===typeof a&&(d=a.data,"target"in a&&(b=a.target|0));a=d._reglType;"texture2d"===a?c=d:"textureCube"===a?c=d:"renderbuffer"===a&&(e=d,b=36161);return new n(b,c,e)}function m(a,b,c,d,g){if(c)return a=e.create2D({width:a,height:b, -format:d,type:g}),a._texture.refCount=0,new n(3553,a,null);a=f.create({width:a,height:b,format:d});a._renderbuffer.refCount=0;return new n(36161,null,a)}function C(a){return a&&(a.texture||a.renderbuffer)}function l(a,b,c){a&&(a.texture?a.texture.resize(b,c):a.renderbuffer&&a.renderbuffer.resize(b,c))}function g(){this.id=N++;Q[this.id]=this;this.framebuffer=a.createFramebuffer();this.height=this.width=0;this.colorAttachments=[];this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment= -null}function h(a){a.colorAttachments.forEach(k);k(a.depthAttachment);k(a.stencilAttachment);k(a.depthStencilAttachment)}function qa(b){a.deleteFramebuffer(b.framebuffer);b.framebuffer=null;d.framebufferCount--;delete Q[b.id]}function t(b){var e;a.bindFramebuffer(36160,b.framebuffer);var d=b.colorAttachments;for(e=0;ed;++d){for(k=0;ka;++a)c[a].resize(d);b.width=b.height=d;return b},_reglType:"framebufferCube",destroy:function(){c.forEach(function(a){a.destroy()})}})},clear:function(){R(Q).forEach(qa)},restore:function(){R(Q).forEach(function(b){b.framebuffer=a.createFramebuffer();t(b)})}})}function ub(){this.w=this.z=this.y=this.x=this.state=0;this.buffer=null;this.size=0;this.normalized=!1;this.type=5126;this.divisor=this.stride=this.offset= -0}function Pb(a,b,c,e){a=c.maxAttributes;b=Array(a);for(c=0;ca&&(a=b.stats.uniformsCount)});return a},c.getMaxAttributesCount=function(){var a= -0;C.forEach(function(b){b.stats.attributesCount>a&&(a=b.stats.attributesCount)});return a});return{clear:function(){var b=a.deleteShader.bind(a);R(p).forEach(b);p={};R(u).forEach(b);u={};C.forEach(function(b){a.deleteProgram(b.program)});C.length=0;m={};c.shaderCount=0},program:function(a,b,d){var e=m[b];e||(e=m[b]={});var f=e[a];f||(f=new k(b,a),c.shaderCount++,r(f,d),e[a]=f,C.push(f));return f},restore:function(){p={};u={};for(var a=0;a"+b+"?"+e+".constant["+b+"]:0;"}).join(""),"}}else{", -"if(",f,"(",e,".buffer)){",h,"=",g,".createStream(",34962,",",e,".buffer);","}else{",h,"=",g,".getBuffer(",e,".buffer);","}",k,'="type" in ',e,"?",q.glTypes,"[",e,".type]:",h,".dtype;",y.normalized,"=!!",e,".normalized;");d("size");d("offset");d("stride");d("divisor");c("}}");c.exit("if(",y.isStream,"){",g,".destroyStream(",h,");","}");return y})});return g}function M(a){var b=a["static"],c=a.dynamic,d={};Object.keys(b).forEach(function(a){var c=b[a];d[a]=x(function(a,b){return"number"===typeof c|| -"boolean"===typeof c?""+c:a.link(c)})});Object.keys(c).forEach(function(a){var b=c[a];d[a]=K(b,function(a,c){return a.invoke(c,b)})});return d}function w(a,b,c,d,e){var f=z(a,e),g=D(a,f,e),l=N(a,e),k=Q(a,e),m=P(a,e),xa=g.viewport;xa&&(k.viewport=xa);xa=h("scissor.box");(g=g[xa])&&(k[xa]=g);g=0>1)",u],");")}function b(){c(ba,".drawArraysInstancedANGLE(",[p,r,t,u],");")}n?B?a():(c("if(",n,"){"),a(),c("}else{"),b(),c("}")):b()}function g(){function a(){c(l+".drawElements("+[p,t,C,r+"<<(("+C+"-5121)>>1)"]+");")}function b(){c(l+".drawArrays("+[p,r,t]+");")}n?B?a():(c("if(",n,"){"),a(),c("}else{"),b(),c("}")): -b()}var h=a.shared,l=h.gl,k=h.draw,m=d.draw,n=function(){var e=m.elements,f=b;if(e){if(e.contextDep&&d.contextDynamic||e.propDep)f=c;e=e.append(a,f)}else e=f.def(k,".","elements");e&&f("if("+e+")"+l+".bindBuffer(34963,"+e+".buffer.buffer);");return e}(),p=e("primitive"),r=e("offset"),t=function(){var e=m.count,f=b;if(e){if(e.contextDep&&d.contextDynamic||e.propDep)f=c;e=e.append(a,f)}else e=f.def(k,".","count");return e}();if("number"===typeof t){if(0===t)return}else c("if(",t,"){"),c.exit("}");var u, -ba;ga&&(u=e("instances"),ba=a.instancing);var C=n+".type",B=m.elements&&wa(m.elements);ga&&("number"!==typeof u||0<=u)?"string"===typeof u?(c("if(",u,">0){"),f(),c("}else if(",u,"<0){"),g(),c("}")):f():g()}function ca(a,b,c,d,e){b=B();e=b.proc("body",e);ga&&(b.instancing=e.def(b.shared.extensions,".angle_instanced_arrays"));a(b,e,c,d);return b.compile().body}function W(a,b,c,d){ya(a,b);U(a,b,c,d.attributes,function(){return!0});Y(a,b,c,d.uniforms,function(){return!0});S(a,b,b,c)}function ba(a,b){var c= -a.proc("draw",1);ya(a,c);A(a,c,b.context);L(a,c,b.framebuffer);V(a,c,b);R(a,c,b.state);F(a,c,b,!1,!0);var d=b.shader.progVar.append(a,c);c(a.shared.gl,".useProgram(",d,".program);");if(b.shader.program)W(a,c,b,b.shader.program);else{var e=a.global.def("{}"),f=c.def(d,".id"),g=c.def(e,"[",f,"]");c(a.cond(g).then(g,".call(this,a0);")["else"](g,"=",e,"[",f,"]=",a.link(function(c){return ca(W,a,b,c,1)}),"(",d,");",g,".call(this,a0);"))}0=--this.refCount&&n(this)};f.profile&&(e.getTotalRenderbufferSize=function(){var a=0;Object.keys(u).forEach(function(b){a+=u[b].stats.size});return a});return{create:function(b,c){function l(b,c){var d=0,e=0,m=32854;"object"===typeof b&&b?("shape"in b?(e=b.shape,d=e[0]|0,e=e[1]|0):("radius"in b&&(d=e=b.radius|0),"width"in b&&(d=b.width|0),"height"in b&&(e=b.height|0)),"format"in b&&(m=k[b.format])): -"number"===typeof b?(d=b|0,e="number"===typeof c?c|0:d):b||(d=e=1);if(d!==g.width||e!==g.height||m!==g.format)return l.width=g.width=d,l.height=g.height=e,g.format=m,a.bindRenderbuffer(36161,g.renderbuffer),a.renderbufferStorage(36161,m,d,e),f.profile&&(g.stats.size=M[g.format]*g.width*g.height),l.format=r[g.format],l}var g=new d(a.createRenderbuffer());u[g.id]=g;e.renderbufferCount++;l(b,c);l.resize=function(b,c){var d=b|0,e=c|0||d;if(d===g.width&&e===g.height)return l;l.width=g.width=d;l.height= -g.height=e;a.bindRenderbuffer(36161,g.renderbuffer);a.renderbufferStorage(36161,g.format,d,e);f.profile&&(g.stats.size=M[g.format]*g.width*g.height);return l};l._reglType="renderbuffer";l._renderbuffer=g;f.profile&&(l.stats=g.stats);l.destroy=function(){g.decRef()};return l},clear:function(){R(u).forEach(n)},restore:function(){R(u).forEach(function(b){b.renderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,b.renderbuffer);a.renderbufferStorage(36161,b.format,b.width,b.height)});a.bindRenderbuffer(36161, -null)}}},Wa=[];Wa[6408]=4;Wa[6407]=3;var Na=[];Na[5121]=1;Na[5126]=4;Na[36193]=2;var Da=["x","y","z","w"],Ub="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Ga={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771, -"one minus constant alpha":32772,"src alpha saturate":776},Xa={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Pa={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},wb={cw:2304,ccw:2305},xb=new aa(!1,!1,!1,function(){}),Xb=function(a,b){function c(){this.endQueryIndex=this.startQueryIndex=-1;this.sum=0;this.stats= -null}function e(a,b,d){var e=k.pop()||new c;e.startQueryIndex=a;e.endQueryIndex=b;e.sum=0;e.stats=d;r.push(e)}var f=b.ext_disjoint_timer_query;if(!f)return null;var d=[],n=[],k=[],r=[],p=[],u=[];return{beginQuery:function(a){var b=d.pop()||f.createQueryEXT();f.beginQueryEXT(35007,b);n.push(b);e(n.length-1,n.length,a)},endQuery:function(){f.endQueryEXT(35007)},pushScopeStats:e,update:function(){var a,b;a=n.length;if(0!==a){u.length=Math.max(u.length,a+1);p.length=Math.max(p.length,a+1);p[0]=0;var c= -u[0]=0;for(b=a=0;b=F.length&&e()}var c=yb(F,a);F[c]=b}}}function p(){var a=S.viewport,b=S.scissor_box;a[0]=a[1]=b[0]=b[1]=0;N.viewportWidth=N.framebufferWidth=N.drawingBufferWidth=a[2]=b[2]=l.drawingBufferWidth;N.viewportHeight=N.framebufferHeight=N.drawingBufferHeight=a[3]=b[3]=l.drawingBufferHeight}function u(){N.tick+=1;N.time=v();p();V.procs.poll()}function m(){p();V.procs.refresh();x&&x.update()}function v(){return(zb()-O)/1E3}a=Eb(a);if(!a)return null;var l=a.gl,g=l.getContextAttributes(); -l.isContextLost();var h=Fb(l,a);if(!h)return null;var z=Bb(),t={bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},B=h.extensions,x=Xb(l,B),O=zb(),K=l.drawingBufferWidth,P=l.drawingBufferHeight,N={tick:0,time:0,viewportWidth:K,viewportHeight:P,framebufferWidth:K,framebufferHeight:P,drawingBufferWidth:K,drawingBufferHeight:P,pixelRatio:a.pixelRatio},Q=Vb(l,B),K=Pb(l,B,Q,z),E=Gb(l,t,a,K),T=Hb(l,B,E,t),R=Qb(l,z,t,a),w=Kb(l, -B,Q,function(){V.procs.poll()},N,t,a),A=Wb(l,B,Q,t,a),L=Ob(l,B,Q,w,A,t),V=Tb(l,z,B,Q,E,T,w,L,{},K,R,{elements:null,primitive:4,count:-1,offset:0,instances:-1},N,x,a),z=Rb(l,L,V.procs.poll,N,g,B,Q),S=V.next,M=l.canvas,F=[],U=[],Y=[],W=[a.onDestroy],ca=null;M&&(M.addEventListener("webglcontextlost",f,!1),M.addEventListener("webglcontextrestored",d,!1));var aa=L.setFBO=n({framebuffer:ja.define.call(null,1,"framebuffer")});m();g=D(n,{clear:function(a){if("framebuffer"in a)if(a.framebuffer&&"framebufferCube"=== -a.framebuffer_reglType)for(var b=0;6>b;++b)aa(D({framebuffer:a.framebuffer.faces[b]},a),k);else aa(a,k);else k(null,a)},prop:ja.define.bind(null,1),context:ja.define.bind(null,2),"this":ja.define.bind(null,3),draw:n({}),buffer:function(a){return E.create(a,34962,!1,!1)},elements:function(a){return T.create(a,!1)},texture:w.create2D,cube:w.createCube,renderbuffer:A.create,framebuffer:L.create,framebufferCube:L.createCube,attributes:g,frame:r,on:function(a,b){var c;switch(a){case "frame":return r(b); -case "lost":c=U;break;case "restore":c=Y;break;case "destroy":c=W}c.push(b);return{cancel:function(){for(var a=0;a - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -/** - * Results cache - */ - -var res = ''; -var cache; - -/** - * Expose `repeat` - */ - -module.exports = repeat; - -/** - * Repeat the given `string` the specified `number` - * of times. - * - * **Example:** - * - * ```js - * var repeat = require('repeat-string'); - * repeat('A', 5); - * //=> AAAAA - * ``` - * - * @param {String} `string` The string to repeat - * @param {Number} `number` The number of times to repeat the string - * @return {String} Repeated string - * @api public - */ - -function repeat(str, num) { - if (typeof str !== 'string') { - throw new TypeError('expected a string'); - } - - // cover common, quick use cases - if (num === 1) return str; - if (num === 2) return str + str; - - var max = str.length * num; - if (cache !== str || typeof cache === 'undefined') { - cache = str; - res = ''; - } else if (res.length >= max) { - return res.substr(0, max); - } - - while (max > res.length && num > 1) { - if (num & 1) { - res += str; - } - - num >>= 1; - str += str; - } - - res += str; - res = res.substr(0, max); - return res; -} - -},{}],480:[function(_dereq_,module,exports){ -(function (global){ -module.exports = - global.performance && - global.performance.now ? function now() { - return performance.now() - } : Date.now || function now() { - return +new Date - } - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],481:[function(_dereq_,module,exports){ -"use strict" - -module.exports = compressExpansion - -function compressExpansion(e) { - var m = e.length - var Q = e[e.length-1] - var bottom = m - for(var i=m-2; i>=0; --i) { - var a = Q - var b = e[i] - Q = a + b - var bv = Q - a - var q = b - bv - if(q) { - e[--bottom] = Q - Q = q - } - } - var top = 0 - for(var i=bottom; i>1 - return ["sum(", generateSum(expr.slice(0, m)), ",", generateSum(expr.slice(m)), ")"].join("") - } -} - -function determinant(m) { - if(m.length === 2) { - return ["sum(prod(", m[0][0], ",", m[1][1], "),prod(-", m[0][1], ",", m[1][0], "))"].join("") - } else { - var expr = [] - for(var i=0; i>1 - return ["sum(", generateSum(expr.slice(0, m)), ",", generateSum(expr.slice(m)), ")"].join("") - } -} - -function makeProduct(a, b) { - if(a.charAt(0) === "m") { - if(b.charAt(0) === "w") { - var toks = a.split("[") - return ["w", b.substr(1), "m", toks[0].substr(1)].join("") - } else { - return ["prod(", a, ",", b, ")"].join("") - } - } else { - return makeProduct(b, a) - } -} - -function sign(s) { - if(s & 1 !== 0) { - return "-" - } - return "" -} - -function determinant(m) { - if(m.length === 2) { - return [["diff(", makeProduct(m[0][0], m[1][1]), ",", makeProduct(m[1][0], m[0][1]), ")"].join("")] - } else { - var expr = [] - for(var i=0; i 0) { - code.push(",") - } - code.push("[") - for(var k=0; k 0) { - code.push(",") - } - if(k === i) { - code.push("+b[", j, "]") - } else { - code.push("+A[", j, "][", k, "]") - } - } - code.push("]") - } - code.push("]),") - } - code.push("det(A)]}return ", funcName) - var proc = new Function("det", code.join("")) - if(n < 6) { - return proc(determinant[n]) - } - return proc(determinant) -} - -function robustLinearSolve0d() { - return [ 0 ] -} - -function robustLinearSolve1d(A, b) { - return [ [ b[0] ], [ A[0][0] ] ] -} - -var CACHE = [ - robustLinearSolve0d, - robustLinearSolve1d -] - -function generateDispatch() { - while(CACHE.length < NUM_EXPAND) { - CACHE.push(generateSolver(CACHE.length)) - } - var procArgs = [] - var code = ["function dispatchLinearSolve(A,b){switch(A.length){"] - for(var i=0; i>1 - return ["sum(", generateSum(expr.slice(0, m)), ",", generateSum(expr.slice(m)), ")"].join("") - } -} - -function determinant(m) { - if(m.length === 2) { - return [["sum(prod(", m[0][0], ",", m[1][1], "),prod(-", m[0][1], ",", m[1][0], "))"].join("")] - } else { - var expr = [] - for(var i=0; i 0) { - if(r <= 0) { - return det - } else { - s = l + r - } - } else if(l < 0) { - if(r >= 0) { - return det - } else { - s = -(l + r) - } - } else { - return det - } - var tol = ERRBOUND3 * s - if(det >= tol || det <= -tol) { - return det - } - return orientation3Exact(a, b, c) - }, - function orientation4(a,b,c,d) { - var adx = a[0] - d[0] - var bdx = b[0] - d[0] - var cdx = c[0] - d[0] - var ady = a[1] - d[1] - var bdy = b[1] - d[1] - var cdy = c[1] - d[1] - var adz = a[2] - d[2] - var bdz = b[2] - d[2] - var cdz = c[2] - d[2] - var bdxcdy = bdx * cdy - var cdxbdy = cdx * bdy - var cdxady = cdx * ady - var adxcdy = adx * cdy - var adxbdy = adx * bdy - var bdxady = bdx * ady - var det = adz * (bdxcdy - cdxbdy) - + bdz * (cdxady - adxcdy) - + cdz * (adxbdy - bdxady) - var permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) - + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) - + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz) - var tol = ERRBOUND4 * permanent - if ((det > tol) || (-det > tol)) { - return det - } - return orientation4Exact(a,b,c,d) - } -] - -function slowOrient(args) { - var proc = CACHED[args.length] - if(!proc) { - proc = CACHED[args.length] = orientation(args.length) - } - return proc.apply(undefined, args) -} - -function generateOrientationProc() { - while(CACHED.length <= NUM_EXPAND) { - CACHED.push(orientation(CACHED.length)) - } - var args = [] - var procArgs = ["slow"] - for(var i=0; i<=NUM_EXPAND; ++i) { - args.push("a" + i) - procArgs.push("o" + i) - } - var code = [ - "function getOrientation(", args.join(), "){switch(arguments.length){case 0:case 1:return 0;" - ] - for(var i=2; i<=NUM_EXPAND; ++i) { - code.push("case ", i, ":return o", i, "(", args.slice(0, i).join(), ");") - } - code.push("}var s=new Array(arguments.length);for(var i=0;i 0 && y0 > 0) || (x0 < 0 && y0 < 0)) { - return false - } - - var x1 = orient(b0, a0, a1) - var y1 = orient(b1, a0, a1) - if((x1 > 0 && y1 > 0) || (x1 < 0 && y1 < 0)) { - return false - } - - //Check for degenerate collinear case - if(x0 === 0 && y0 === 0 && x1 === 0 && y1 === 0) { - return checkCollinear(a0, a1, b0, b1) - } - - return true -} -},{"robust-orientation":486}],490:[function(_dereq_,module,exports){ -"use strict" - -module.exports = robustSubtract - -//Easy case: Add two scalars -function scalarScalar(a, b) { - var x = a + b - var bv = x - a - var av = x - bv - var br = b - bv - var ar = a - av - var y = ar + br - if(y) { - return [y, x] - } - return [x] -} - -function robustSubtract(e, f) { - var ne = e.length|0 - var nf = f.length|0 - if(ne === 1 && nf === 1) { - return scalarScalar(e[0], -f[0]) - } - var n = ne + nf - var g = new Array(n) - var count = 0 - var eptr = 0 - var fptr = 0 - var abs = Math.abs - var ei = e[eptr] - var ea = abs(ei) - var fi = -f[fptr] - var fa = abs(fi) - var a, b - if(ea < fa) { - b = ei - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - ea = abs(ei) - } - } else { - b = fi - fptr += 1 - if(fptr < nf) { - fi = -f[fptr] - fa = abs(fi) - } - } - if((eptr < ne && ea < fa) || (fptr >= nf)) { - a = ei - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - ea = abs(ei) - } - } else { - a = fi - fptr += 1 - if(fptr < nf) { - fi = -f[fptr] - fa = abs(fi) - } - } - var x = a + b - var bv = x - a - var y = b - bv - var q0 = y - var q1 = x - var _x, _bv, _av, _br, _ar - while(eptr < ne && fptr < nf) { - if(ea < fa) { - a = ei - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - ea = abs(ei) - } - } else { - a = fi - fptr += 1 - if(fptr < nf) { - fi = -f[fptr] - fa = abs(fi) - } - } - b = q0 - x = a + b - bv = x - a - y = b - bv - if(y) { - g[count++] = y - } - _x = q1 + x - _bv = _x - q1 - _av = _x - _bv - _br = x - _bv - _ar = q1 - _av - q0 = _ar + _br - q1 = _x - } - while(eptr < ne) { - a = ei - b = q0 - x = a + b - bv = x - a - y = b - bv - if(y) { - g[count++] = y - } - _x = q1 + x - _bv = _x - q1 - _av = _x - _bv - _br = x - _bv - _ar = q1 - _av - q0 = _ar + _br - q1 = _x - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - } - } - while(fptr < nf) { - a = fi - b = q0 - x = a + b - bv = x - a - y = b - bv - if(y) { - g[count++] = y - } - _x = q1 + x - _bv = _x - q1 - _av = _x - _bv - _br = x - _bv - _ar = q1 - _av - q0 = _ar + _br - q1 = _x - fptr += 1 - if(fptr < nf) { - fi = -f[fptr] - } - } - if(q0) { - g[count++] = q0 - } - if(q1) { - g[count++] = q1 - } - if(!count) { - g[count++] = 0.0 - } - g.length = count - return g -} -},{}],491:[function(_dereq_,module,exports){ -"use strict" - -module.exports = linearExpansionSum - -//Easy case: Add two scalars -function scalarScalar(a, b) { - var x = a + b - var bv = x - a - var av = x - bv - var br = b - bv - var ar = a - av - var y = ar + br - if(y) { - return [y, x] - } - return [x] -} - -function linearExpansionSum(e, f) { - var ne = e.length|0 - var nf = f.length|0 - if(ne === 1 && nf === 1) { - return scalarScalar(e[0], f[0]) - } - var n = ne + nf - var g = new Array(n) - var count = 0 - var eptr = 0 - var fptr = 0 - var abs = Math.abs - var ei = e[eptr] - var ea = abs(ei) - var fi = f[fptr] - var fa = abs(fi) - var a, b - if(ea < fa) { - b = ei - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - ea = abs(ei) - } - } else { - b = fi - fptr += 1 - if(fptr < nf) { - fi = f[fptr] - fa = abs(fi) - } - } - if((eptr < ne && ea < fa) || (fptr >= nf)) { - a = ei - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - ea = abs(ei) - } - } else { - a = fi - fptr += 1 - if(fptr < nf) { - fi = f[fptr] - fa = abs(fi) - } - } - var x = a + b - var bv = x - a - var y = b - bv - var q0 = y - var q1 = x - var _x, _bv, _av, _br, _ar - while(eptr < ne && fptr < nf) { - if(ea < fa) { - a = ei - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - ea = abs(ei) - } - } else { - a = fi - fptr += 1 - if(fptr < nf) { - fi = f[fptr] - fa = abs(fi) - } - } - b = q0 - x = a + b - bv = x - a - y = b - bv - if(y) { - g[count++] = y - } - _x = q1 + x - _bv = _x - q1 - _av = _x - _bv - _br = x - _bv - _ar = q1 - _av - q0 = _ar + _br - q1 = _x - } - while(eptr < ne) { - a = ei - b = q0 - x = a + b - bv = x - a - y = b - bv - if(y) { - g[count++] = y - } - _x = q1 + x - _bv = _x - q1 - _av = _x - _bv - _br = x - _bv - _ar = q1 - _av - q0 = _ar + _br - q1 = _x - eptr += 1 - if(eptr < ne) { - ei = e[eptr] - } - } - while(fptr < nf) { - a = fi - b = q0 - x = a + b - bv = x - a - y = b - bv - if(y) { - g[count++] = y - } - _x = q1 + x - _bv = _x - q1 - _av = _x - _bv - _br = x - _bv - _ar = q1 - _av - q0 = _ar + _br - q1 = _x - fptr += 1 - if(fptr < nf) { - fi = f[fptr] - } - } - if(q0) { - g[count++] = q0 - } - if(q1) { - g[count++] = q1 - } - if(!count) { - g[count++] = 0.0 - } - g.length = count - return g -} -},{}],492:[function(_dereq_,module,exports){ -"use strict" - -module.exports = function signum(x) { - if(x < 0) { return -1 } - if(x > 0) { return 1 } - return 0.0 -} -},{}],493:[function(_dereq_,module,exports){ -'use strict' - -module.exports = boundary - -var bnd = _dereq_('boundary-cells') -var reduce = _dereq_('reduce-simplicial-complex') - -function boundary(cells) { - return reduce(bnd(cells)) -} - -},{"boundary-cells":83,"reduce-simplicial-complex":472}],494:[function(_dereq_,module,exports){ -'use strict' - -module.exports = extractContour - -var ndarray = _dereq_('ndarray') -var pool = _dereq_('typedarray-pool') -var ndsort = _dereq_('ndarray-sort') - -var contourAlgorithm = _dereq_('./lib/codegen') - -function getDimension(cells) { - var numCells = cells.length - var d = 0 - for(var i=0; i>1,v=E[2*m+1];', - 'if(v===b){return m}', - 'if(b 0) { - code.push(',') - } - code.push('[') - for(var j=0; j 0) { - code.push(',') - } - code.push('B(C,E,c[', f[0], '],c[', f[1], '])') - } - code.push(']') - } - code.push(');') - } - - for(var i=d+1; i>1; --i) { - if(i < d+1) { - code.push('else ') - } - code.push('if(l===', i, '){') - - //Generate mask - var maskStr = [] - for(var j=0; j> 1 - , s = compareCells(cells[mid], c) - if(s <= 0) { - if(s === 0) { - r = mid - } - lo = mid + 1 - } else if(s > 0) { - hi = mid - 1 - } - } - return r -} -exports.findCell = findCell; - -//Builds an index for an n-cell. This is more general than dual, but less efficient -function incidence(from_cells, to_cells) { - var index = new Array(from_cells.length) - for(var i=0, il=index.length; i= from_cells.length || compareCells(from_cells[idx], b) !== 0) { - break - } - } - } - } - return index -} -exports.incidence = incidence - -//Computes the dual of the mesh. This is basically an optimized version of buildIndex for the situation where from_cells is just the list of vertices -function dual(cells, vertex_count) { - if(!vertex_count) { - return incidence(unique(skeleton(cells, 0)), cells, 0) - } - var res = new Array(vertex_count) - for(var i=0; i>> k) & 1) { - b.push(c[k]) - } - } - result.push(b) - } - } - return normalize(result) -} -exports.explode = explode - -//Enumerates all of the n-cells of a cell complex -function skeleton(cells, n) { - if(n < 0) { - return [] - } - var result = [] - , k0 = (1<<(n+1))-1 - for(var i=0; i> 1 - } - return (i >> 1) - 1 - } - - //Bubble element i down the heap - function heapDown(i) { - var w = heapWeight(i) - while(true) { - var tw = w - var left = 2*i + 1 - var right = 2*(i + 1) - var next = i - if(left < heapCount) { - var lw = heapWeight(left) - if(lw < tw) { - next = left - tw = lw - } - } - if(right < heapCount) { - var rw = heapWeight(right) - if(rw < tw) { - next = right - } - } - if(next === i) { - return i - } - heapSwap(i, next) - i = next - } - } - - //Bubbles element i up the heap - function heapUp(i) { - var w = heapWeight(i) - while(i > 0) { - var parent = heapParent(i) - if(parent >= 0) { - var pw = heapWeight(parent) - if(w < pw) { - heapSwap(i, parent) - i = parent - continue - } - } - return i - } - } - - //Pop minimum element - function heapPop() { - if(heapCount > 0) { - var head = heap[0] - heapSwap(0, heapCount-1) - heapCount -= 1 - heapDown(0) - return head - } - return -1 - } - - //Update heap item i - function heapUpdate(i, w) { - var a = heap[i] - if(weights[a] === w) { - return i - } - weights[a] = -Infinity - heapUp(i) - heapPop() - weights[a] = w - heapCount += 1 - return heapUp(heapCount-1) - } - - //Kills a vertex (assume vertex already removed from heap) - function kill(i) { - if(dead[i]) { - return - } - //Kill vertex - dead[i] = true - //Fixup topology - var s = inv[i] - var t = outv[i] - if(inv[t] >= 0) { - inv[t] = s - } - if(outv[s] >= 0) { - outv[s] = t - } - - //Update weights on s and t - if(index[s] >= 0) { - heapUpdate(index[s], computeWeight(s)) - } - if(index[t] >= 0) { - heapUpdate(index[t], computeWeight(t)) - } - } - - //Initialize weights and heap - var heap = [] - var index = new Array(n) - for(var i=0; i>1; i>=0; --i) { - heapDown(i) - } - - //Kill vertices - while(true) { - var hmin = heapPop() - if((hmin < 0) || (weights[hmin] > minArea)) { - break - } - kill(hmin) - } - - //Build collapsed vertex table - var npositions = [] - for(var i=0; i= 0 && tout >= 0 && tin !== tout) { - var cin = index[tin] - var cout = index[tout] - if(cin !== cout) { - ncells.push([ cin, cout ]) - } - } - }) - - //Normalize result - sc.unique(sc.normalize(ncells)) - - //Return final list of cells - return { - positions: npositions, - edges: ncells - } -} -},{"robust-orientation":486,"simplicial-complex":498}],501:[function(_dereq_,module,exports){ -"use strict" - -module.exports = orderSegments - -var orient = _dereq_("robust-orientation") - -function horizontalOrder(a, b) { - var bl, br - if(b[0][0] < b[1][0]) { - bl = b[0] - br = b[1] - } else if(b[0][0] > b[1][0]) { - bl = b[1] - br = b[0] - } else { - var alo = Math.min(a[0][1], a[1][1]) - var ahi = Math.max(a[0][1], a[1][1]) - var blo = Math.min(b[0][1], b[1][1]) - var bhi = Math.max(b[0][1], b[1][1]) - if(ahi < blo) { - return ahi - blo - } - if(alo > bhi) { - return alo - bhi - } - return ahi - bhi - } - var al, ar - if(a[0][1] < a[1][1]) { - al = a[0] - ar = a[1] - } else { - al = a[1] - ar = a[0] - } - var d = orient(br, bl, al) - if(d) { - return d - } - d = orient(br, bl, ar) - if(d) { - return d - } - return ar - br -} - -function orderSegments(b, a) { - var al, ar - if(a[0][0] < a[1][0]) { - al = a[0] - ar = a[1] - } else if(a[0][0] > a[1][0]) { - al = a[1] - ar = a[0] - } else { - return horizontalOrder(a, b) - } - var bl, br - if(b[0][0] < b[1][0]) { - bl = b[0] - br = b[1] - } else if(b[0][0] > b[1][0]) { - bl = b[1] - br = b[0] - } else { - return -horizontalOrder(b, a) - } - var d1 = orient(al, ar, br) - var d2 = orient(al, ar, bl) - if(d1 < 0) { - if(d2 <= 0) { - return d1 - } - } else if(d1 > 0) { - if(d2 >= 0) { - return d1 - } - } else if(d2) { - return d2 - } - d1 = orient(br, bl, ar) - d2 = orient(br, bl, al) - if(d1 < 0) { - if(d2 <= 0) { - return d1 - } - } else if(d1 > 0) { - if(d2 >= 0) { - return d1 - } - } else if(d2) { - return d2 - } - return ar[0] - br[0] -} -},{"robust-orientation":486}],502:[function(_dereq_,module,exports){ -"use strict" - -module.exports = createSlabDecomposition - -var bounds = _dereq_("binary-search-bounds") -var createRBTree = _dereq_("functional-red-black-tree") -var orient = _dereq_("robust-orientation") -var orderSegments = _dereq_("./lib/order-segments") - -function SlabDecomposition(slabs, coordinates, horizontal) { - this.slabs = slabs - this.coordinates = coordinates - this.horizontal = horizontal -} - -var proto = SlabDecomposition.prototype - -function compareHorizontal(e, y) { - return e.y - y -} - -function searchBucket(root, p) { - var lastNode = null - while(root) { - var seg = root.key - var l, r - if(seg[0][0] < seg[1][0]) { - l = seg[0] - r = seg[1] - } else { - l = seg[1] - r = seg[0] - } - var o = orient(l, r, p) - if(o < 0) { - root = root.left - } else if(o > 0) { - if(p[0] !== seg[1][0]) { - lastNode = root - root = root.right - } else { - var val = searchBucket(root.right, p) - if(val) { - return val - } - root = root.left - } - } else { - if(p[0] !== seg[1][0]) { - return root - } else { - var val = searchBucket(root.right, p) - if(val) { - return val - } - root = root.left - } - } - } - return lastNode -} - -proto.castUp = function(p) { - var bucket = bounds.le(this.coordinates, p[0]) - if(bucket < 0) { - return -1 - } - var root = this.slabs[bucket] - var hitNode = searchBucket(this.slabs[bucket], p) - var lastHit = -1 - if(hitNode) { - lastHit = hitNode.value - } - //Edge case: need to handle horizontal segments (sucks) - if(this.coordinates[bucket] === p[0]) { - var lastSegment = null - if(hitNode) { - lastSegment = hitNode.key - } - if(bucket > 0) { - var otherHitNode = searchBucket(this.slabs[bucket-1], p) - if(otherHitNode) { - if(lastSegment) { - if(orderSegments(otherHitNode.key, lastSegment) > 0) { - lastSegment = otherHitNode.key - lastHit = otherHitNode.value - } - } else { - lastHit = otherHitNode.value - lastSegment = otherHitNode.key - } - } - } - var horiz = this.horizontal[bucket] - if(horiz.length > 0) { - var hbucket = bounds.ge(horiz, p[1], compareHorizontal) - if(hbucket < horiz.length) { - var e = horiz[hbucket] - if(p[1] === e.y) { - if(e.closed) { - return e.index - } else { - while(hbucket < horiz.length-1 && horiz[hbucket+1].y === p[1]) { - hbucket = hbucket+1 - e = horiz[hbucket] - if(e.closed) { - return e.index - } - } - if(e.y === p[1] && !e.start) { - hbucket = hbucket+1 - if(hbucket >= horiz.length) { - return lastHit - } - e = horiz[hbucket] - } - } - } - //Check if e is above/below last segment - if(e.start) { - if(lastSegment) { - var o = orient(lastSegment[0], lastSegment[1], [p[0], e.y]) - if(lastSegment[0][0] > lastSegment[1][0]) { - o = -o - } - if(o > 0) { - lastHit = e.index - } - } else { - lastHit = e.index - } - } else if(e.y !== p[1]) { - lastHit = e.index - } - } - } - } - return lastHit -} - -function IntervalSegment(y, index, start, closed) { - this.y = y - this.index = index - this.start = start - this.closed = closed -} - -function Event(x, segment, create, index) { - this.x = x - this.segment = segment - this.create = create - this.index = index -} - - -function createSlabDecomposition(segments) { - var numSegments = segments.length - var numEvents = 2 * numSegments - var events = new Array(numEvents) - for(var i=0; i 1.0) { - t = 1.0 - } - var ti = 1.0 - t - var n = a.length - var r = new Array(n) - for(var i=0; i 0) || (a > 0 && b < 0)) { - var p = lerpW(s, b, t, a) - pos.push(p) - neg.push(p.slice()) - } - if(b < 0) { - neg.push(t.slice()) - } else if(b > 0) { - pos.push(t.slice()) - } else { - pos.push(t.slice()) - neg.push(t.slice()) - } - a = b - } - return { positive: pos, negative: neg } -} - -function positive(points, plane) { - var pos = [] - var a = planeT(points[points.length-1], plane) - for(var s=points[points.length-1], t=points[0], i=0; i 0) || (a > 0 && b < 0)) { - pos.push(lerpW(s, b, t, a)) - } - if(b >= 0) { - pos.push(t.slice()) - } - a = b - } - return pos -} - -function negative(points, plane) { - var neg = [] - var a = planeT(points[points.length-1], plane) - for(var s=points[points.length-1], t=points[0], i=0; i 0) || (a > 0 && b < 0)) { - neg.push(lerpW(s, b, t, a)) - } - if(b <= 0) { - neg.push(t.slice()) - } - a = b - } - return neg -} -},{"robust-dot-product":483,"robust-sum":491}],504:[function(_dereq_,module,exports){ -/* global window, exports, define */ - -!function() { - 'use strict' - - var re = { - not_string: /[^s]/, - not_bool: /[^t]/, - not_type: /[^T]/, - not_primitive: /[^v]/, - number: /[diefg]/, - numeric_arg: /[bcdiefguxX]/, - json: /[j]/, - not_json: /[^j]/, - text: /^[^\x25]+/, - modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, - key: /^([a-z_][a-z_\d]*)/i, - key_access: /^\.([a-z_][a-z_\d]*)/i, - index_access: /^\[(\d+)\]/, - sign: /^[\+\-]/ - } - - function sprintf(key) { - // `arguments` is not an array, but should be fine for this call - return sprintf_format(sprintf_parse(key), arguments) - } - - function vsprintf(fmt, argv) { - return sprintf.apply(null, [fmt].concat(argv || [])) - } - - function sprintf_format(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign - for (i = 0; i < tree_length; i++) { - if (typeof parse_tree[i] === 'string') { - output += parse_tree[i] - } - else if (Array.isArray(parse_tree[i])) { - match = parse_tree[i] // convenience purposes only - if (match[2]) { // keyword argument - arg = argv[cursor] - for (k = 0; k < match[2].length; k++) { - if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) - } - arg = arg[match[2][k]] - } - } - else if (match[1]) { // positional argument (explicit) - arg = argv[match[1]] - } - else { // positional argument (implicit) - arg = argv[cursor++] - } - - if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) { - arg = arg() - } - - if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) { - throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) - } - - if (re.number.test(match[8])) { - is_positive = arg >= 0 - } - - switch (match[8]) { - case 'b': - arg = parseInt(arg, 10).toString(2) - break - case 'c': - arg = String.fromCharCode(parseInt(arg, 10)) - break - case 'd': - case 'i': - arg = parseInt(arg, 10) - break - case 'j': - arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) - break - case 'e': - arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() - break - case 'f': - arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) - break - case 'g': - arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg) - break - case 'o': - arg = (parseInt(arg, 10) >>> 0).toString(8) - break - case 's': - arg = String(arg) - arg = (match[7] ? arg.substring(0, match[7]) : arg) - break - case 't': - arg = String(!!arg) - arg = (match[7] ? arg.substring(0, match[7]) : arg) - break - case 'T': - arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() - arg = (match[7] ? arg.substring(0, match[7]) : arg) - break - case 'u': - arg = parseInt(arg, 10) >>> 0 - break - case 'v': - arg = arg.valueOf() - arg = (match[7] ? arg.substring(0, match[7]) : arg) - break - case 'x': - arg = (parseInt(arg, 10) >>> 0).toString(16) - break - case 'X': - arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() - break - } - if (re.json.test(match[8])) { - output += arg - } - else { - if (re.number.test(match[8]) && (!is_positive || match[3])) { - sign = is_positive ? '+' : '-' - arg = arg.toString().replace(re.sign, '') - } - else { - sign = '' - } - pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' - pad_length = match[6] - (sign + arg).length - pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' - output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) - } - } - } - return output - } - - var sprintf_cache = Object.create(null) - - function sprintf_parse(fmt) { - if (sprintf_cache[fmt]) { - return sprintf_cache[fmt] - } - - var _fmt = fmt, match, parse_tree = [], arg_names = 0 - while (_fmt) { - if ((match = re.text.exec(_fmt)) !== null) { - parse_tree.push(match[0]) - } - else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree.push('%') - } - else if ((match = re.placeholder.exec(_fmt)) !== null) { - if (match[2]) { - arg_names |= 1 - var field_list = [], replacement_field = match[2], field_match = [] - if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list.push(field_match[1]) - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { - if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list.push(field_match[1]) - } - else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list.push(field_match[1]) - } - else { - throw new SyntaxError('[sprintf] failed to parse named argument key') - } - } - } - else { - throw new SyntaxError('[sprintf] failed to parse named argument key') - } - match[2] = field_list - } - else { - arg_names |= 2 - } - if (arg_names === 3) { - throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') - } - parse_tree.push(match) - } - else { - throw new SyntaxError('[sprintf] unexpected placeholder') - } - _fmt = _fmt.substring(match[0].length) - } - return sprintf_cache[fmt] = parse_tree - } - - /** - * export to either browser or node.js - */ - /* eslint-disable quote-props */ - if (typeof exports !== 'undefined') { - exports['sprintf'] = sprintf - exports['vsprintf'] = vsprintf - } - if (typeof window !== 'undefined') { - window['sprintf'] = sprintf - window['vsprintf'] = vsprintf - - if (typeof define === 'function' && define['amd']) { - define(function() { - return { - 'sprintf': sprintf, - 'vsprintf': vsprintf - } - }) - } - } - /* eslint-enable quote-props */ -}() - -},{}],505:[function(_dereq_,module,exports){ -'use strict' - -var paren = _dereq_('parenthesis') - -module.exports = function splitBy (string, separator, o) { - if (string == null) throw Error('First argument should be a string') - if (separator == null) throw Error('Separator should be a string or a RegExp') - - if (!o) o = {} - else if (typeof o === 'string' || Array.isArray(o)) { - o = {ignore: o} - } - - if (o.escape == null) o.escape = true - if (o.ignore == null) o.ignore = ['[]', '()', '{}', '<>', '""', "''", '``', '“”', '«»'] - else { - if (typeof o.ignore === 'string') {o.ignore = [o.ignore]} - - o.ignore = o.ignore.map(function (pair) { - // '"' → '""' - if (pair.length === 1) pair = pair + pair - return pair - }) - } - - var tokens = paren.parse(string, {flat: true, brackets: o.ignore}) - var str = tokens[0] - - var parts = str.split(separator) - - // join parts separated by escape - if (o.escape) { - var cleanParts = [] - for (var i = 0; i < parts.length; i++) { - var prev = parts[i] - var part = parts[i + 1] - - if (prev[prev.length - 1] === '\\' && prev[prev.length - 2] !== '\\') { - cleanParts.push(prev + separator + part) - i++ - } - else { - cleanParts.push(prev) - } - } - parts = cleanParts - } - - // open parens pack & apply unquotes, if any - for (var i = 0; i < parts.length; i++) { - tokens[0] = parts[i] - parts[i] = paren.stringify(tokens, {flat: true}) - } - - return parts -} - -},{"parenthesis":441}],506:[function(_dereq_,module,exports){ -"use strict" - -module.exports = stronglyConnectedComponents - -function stronglyConnectedComponents(adjList) { - var numVertices = adjList.length; - var index = new Array(numVertices) - var lowValue = new Array(numVertices) - var active = new Array(numVertices) - var child = new Array(numVertices) - var scc = new Array(numVertices) - var sccLinks = new Array(numVertices) - - //Initialize tables - for(var i=0; i 0) { - v = T[T.length-1] - var e = adjList[v] - if (child[v] < e.length) { // If we're not done iterating over the children, first try finishing that. - for(var i=child[v]; i= 0) { - // Node v is not yet assigned an scc, but once it is that scc can apparently reach scc[u]. - sccLinks[v].push(scc[u]) - } - } - child[v] = i // Remember where we left off. - } else { // If we're done iterating over the children, check whether we have an scc. - if(lowValue[v] === index[v]) { // TODO: It /might/ be true that T is always a prefix of S (at this point!!!), and if so, this could be used here. - var component = [] - var links = [], linkCount = 0 - for(var i=S.length-1; i>=0; --i) { - var w = S[i] - active[w] = false - component.push(w) - links.push(sccLinks[w]) - linkCount += sccLinks[w].length - scc[w] = components.length - if(w === v) { - S.length = i - break - } - } - components.push(component) - var allLinks = new Array(linkCount) - for(var i=0; i c)|0 },") - if(dtype === "generic") { - code.push("getters:[0],") - } - - //Generate vertex function - var cubeArgs = [] - var extraArgs = [] - for(var i=0; i>>7){") - } - for(var i=0; i<1<<(1< 128) { - if((i%128)===0) { - if(extraFuncs.length > 0) { - currentFunc.push("}}") - } - var efName = "vExtra" + extraFuncs.length - code.push("case ", (i>>>7), ":", efName, "(m&0x7f,", extraArgs.join(), ");break;") - currentFunc = [ - "function ", efName, "(m,", extraArgs.join(), "){switch(m){" - ] - extraFuncs.push(currentFunc) - } - } - currentFunc.push("case ", (i&0x7f), ":") - var crossings = new Array(dimension) - var denoms = new Array(dimension) - var crossingCount = new Array(dimension) - var bias = new Array(dimension) - var totalCrossings = 0 - for(var j=0; j j) { - continue - } - if(!(i&(1< 0) { - cStr = "+" + crossingCount[k] + "*c" - } - var weight = 0.5 * (crossings[k].length / totalCrossings) - var shift = 0.5 + 0.5 * (bias[k] / totalCrossings) - vertexStr.push("d" + k + "-" + shift + "-" + weight + "*(" + crossings[k].join("+") + cStr + ")/(" + denoms[k].join("+") + ")") - - } - } - currentFunc.push("a.push([", vertexStr.join(), "]);", - "break;") - } - code.push("}},") - if(extraFuncs.length > 0) { - currentFunc.push("}}") - } - - //Create face function - var faceArgs = [] - for(var i=0; i<(1<<(dimension-1)); ++i) { - faceArgs.push("v" + i) - } - faceArgs.push("c0", "c1", "p0", "p1", "a", "b", "c") - code.push("cell:function cellFunc(", faceArgs.join(), "){") - - var facets = triangulateCube(dimension-1) - code.push("if(p0){b.push(", - facets.map(function(f) { - return "[" + f.map(function(v) { - return "v" + v - }) + "]" - }).join(), ")}else{b.push(", - facets.map(function(f) { - var e = f.slice() - e.reverse() - return "[" + e.map(function(v) { - return "v" + v - }) + "]" - }).join(), - ")}}});function ", funcName, "(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ", funcName, ";") - - for(var i=0; i 1) { - div = 1; - } - - if (div < -1) { - div = -1; - } - - return sign * Math.acos(div); -}; - -var getArcCenter = function getArcCenter(px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinphi, cosphi, pxp, pyp) { - var rxsq = Math.pow(rx, 2); - var rysq = Math.pow(ry, 2); - var pxpsq = Math.pow(pxp, 2); - var pypsq = Math.pow(pyp, 2); - - var radicant = rxsq * rysq - rxsq * pypsq - rysq * pxpsq; - - if (radicant < 0) { - radicant = 0; - } - - radicant /= rxsq * pypsq + rysq * pxpsq; - radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1); - - var centerxp = radicant * rx / ry * pyp; - var centeryp = radicant * -ry / rx * pxp; - - var centerx = cosphi * centerxp - sinphi * centeryp + (px + cx) / 2; - var centery = sinphi * centerxp + cosphi * centeryp + (py + cy) / 2; - - var vx1 = (pxp - centerxp) / rx; - var vy1 = (pyp - centeryp) / ry; - var vx2 = (-pxp - centerxp) / rx; - var vy2 = (-pyp - centeryp) / ry; - - var ang1 = vectorAngle(1, 0, vx1, vy1); - var ang2 = vectorAngle(vx1, vy1, vx2, vy2); - - if (sweepFlag === 0 && ang2 > 0) { - ang2 -= TAU; - } - - if (sweepFlag === 1 && ang2 < 0) { - ang2 += TAU; - } - - return [centerx, centery, ang1, ang2]; -}; - -var arcToBezier = function arcToBezier(_ref2) { - var px = _ref2.px, - py = _ref2.py, - cx = _ref2.cx, - cy = _ref2.cy, - rx = _ref2.rx, - ry = _ref2.ry, - _ref2$xAxisRotation = _ref2.xAxisRotation, - xAxisRotation = _ref2$xAxisRotation === undefined ? 0 : _ref2$xAxisRotation, - _ref2$largeArcFlag = _ref2.largeArcFlag, - largeArcFlag = _ref2$largeArcFlag === undefined ? 0 : _ref2$largeArcFlag, - _ref2$sweepFlag = _ref2.sweepFlag, - sweepFlag = _ref2$sweepFlag === undefined ? 0 : _ref2$sweepFlag; - - var curves = []; - - if (rx === 0 || ry === 0) { - return []; - } - - var sinphi = Math.sin(xAxisRotation * TAU / 360); - var cosphi = Math.cos(xAxisRotation * TAU / 360); - - var pxp = cosphi * (px - cx) / 2 + sinphi * (py - cy) / 2; - var pyp = -sinphi * (px - cx) / 2 + cosphi * (py - cy) / 2; - - if (pxp === 0 && pyp === 0) { - return []; - } - - rx = Math.abs(rx); - ry = Math.abs(ry); - - var lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2); - - if (lambda > 1) { - rx *= Math.sqrt(lambda); - ry *= Math.sqrt(lambda); - } - - var _getArcCenter = getArcCenter(px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinphi, cosphi, pxp, pyp), - _getArcCenter2 = _slicedToArray(_getArcCenter, 4), - centerx = _getArcCenter2[0], - centery = _getArcCenter2[1], - ang1 = _getArcCenter2[2], - ang2 = _getArcCenter2[3]; - - // If 'ang2' == 90.0000000001, then `ratio` will evaluate to - // 1.0000000001. This causes `segments` to be greater than one, which is an - // unecessary split, and adds extra points to the bezier curve. To alleviate - // this issue, we round to 1.0 when the ratio is close to 1.0. - - - var ratio = Math.abs(ang2) / (TAU / 4); - if (Math.abs(1.0 - ratio) < 0.0000001) { - ratio = 1.0; - } - - var segments = Math.max(Math.ceil(ratio), 1); - - ang2 /= segments; - - for (var i = 0; i < segments; i++) { - curves.push(approxUnitArc(ang1, ang2)); - ang1 += ang2; - } - - return curves.map(function (curve) { - var _mapToEllipse = mapToEllipse(curve[0], rx, ry, cosphi, sinphi, centerx, centery), - x1 = _mapToEllipse.x, - y1 = _mapToEllipse.y; - - var _mapToEllipse2 = mapToEllipse(curve[1], rx, ry, cosphi, sinphi, centerx, centery), - x2 = _mapToEllipse2.x, - y2 = _mapToEllipse2.y; - - var _mapToEllipse3 = mapToEllipse(curve[2], rx, ry, cosphi, sinphi, centerx, centery), - x = _mapToEllipse3.x, - y = _mapToEllipse3.y; - - return { x1: x1, y1: y1, x2: x2, y2: y2, x: x, y: y }; - }); -}; - -exports.default = arcToBezier; -module.exports = exports.default; -},{}],510:[function(_dereq_,module,exports){ -'use strict' - -var parse = _dereq_('parse-svg-path') -var abs = _dereq_('abs-svg-path') -var normalize = _dereq_('normalize-svg-path') -var isSvgPath = _dereq_('is-svg-path') -var assert = _dereq_('assert') - -module.exports = pathBounds - - -function pathBounds(path) { - // ES6 string tpl call - if (Array.isArray(path) && path.length === 1 && typeof path[0] === 'string') path = path[0] - - // svg path string - if (typeof path === 'string') { - assert(isSvgPath(path), 'String is not an SVG path.') - path = parse(path) - } - - assert(Array.isArray(path), 'Argument should be a string or an array of path segments.') - - path = abs(path) - path = normalize(path) - - if (!path.length) return [0, 0, 0, 0] - - var bounds = [Infinity, Infinity, -Infinity, -Infinity] - - for (var i = 0, l = path.length; i < l; i++) { - var points = path[i].slice(1) - - for (var j = 0; j < points.length; j += 2) { - if (points[j + 0] < bounds[0]) bounds[0] = points[j + 0] - if (points[j + 1] < bounds[1]) bounds[1] = points[j + 1] - if (points[j + 0] > bounds[2]) bounds[2] = points[j + 0] - if (points[j + 1] > bounds[3]) bounds[3] = points[j + 1] - } - } - - return bounds -} - -},{"abs-svg-path":48,"assert":56,"is-svg-path":407,"normalize-svg-path":511,"parse-svg-path":443}],511:[function(_dereq_,module,exports){ -'use strict' - -module.exports = normalize - -var arcToCurve = _dereq_('svg-arc-to-cubic-bezier') - -function normalize(path){ - // init state - var prev - var result = [] - var bezierX = 0 - var bezierY = 0 - var startX = 0 - var startY = 0 - var quadX = null - var quadY = null - var x = 0 - var y = 0 - - for (var i = 0, len = path.length; i < len; i++) { - var seg = path[i] - var command = seg[0] - - switch (command) { - case 'M': - startX = seg[1] - startY = seg[2] - break - case 'A': - var curves = arcToCurve({ - px: x, - py: y, - cx: seg[6], - cy: seg[7], - rx: seg[1], - ry: seg[2], - xAxisRotation: seg[3], - largeArcFlag: seg[4], - sweepFlag: seg[5] - }) - - // null-curves - if (!curves.length) continue - - for (var j = 0, c; j < curves.length; j++) { - c = curves[j] - seg = ['C', c.x1, c.y1, c.x2, c.y2, c.x, c.y] - if (j < curves.length - 1) result.push(seg) - } - - break - case 'S': - // default control point - var cx = x - var cy = y - if (prev == 'C' || prev == 'S') { - cx += cx - bezierX // reflect the previous command's control - cy += cy - bezierY // point relative to the current point - } - seg = ['C', cx, cy, seg[1], seg[2], seg[3], seg[4]] - break - case 'T': - if (prev == 'Q' || prev == 'T') { - quadX = x * 2 - quadX // as with 'S' reflect previous control point - quadY = y * 2 - quadY - } else { - quadX = x - quadY = y - } - seg = quadratic(x, y, quadX, quadY, seg[1], seg[2]) - break - case 'Q': - quadX = seg[1] - quadY = seg[2] - seg = quadratic(x, y, seg[1], seg[2], seg[3], seg[4]) - break - case 'L': - seg = line(x, y, seg[1], seg[2]) - break - case 'H': - seg = line(x, y, seg[1], y) - break - case 'V': - seg = line(x, y, x, seg[1]) - break - case 'Z': - seg = line(x, y, startX, startY) - break - } - - // update state - prev = command - x = seg[seg.length - 2] - y = seg[seg.length - 1] - if (seg.length > 4) { - bezierX = seg[seg.length - 4] - bezierY = seg[seg.length - 3] - } else { - bezierX = x - bezierY = y - } - result.push(seg) - } - - return result -} - -function line(x1, y1, x2, y2){ - return ['C', x1, y1, x2, y2, x2, y2] -} - -function quadratic(x1, y1, cx, cy, x2, y2){ - return [ - 'C', - x1/3 + (2/3) * cx, - y1/3 + (2/3) * cy, - x2/3 + (2/3) * cx, - y2/3 + (2/3) * cy, - x2, - y2 - ] -} - -},{"svg-arc-to-cubic-bezier":509}],512:[function(_dereq_,module,exports){ -'use strict' - -var pathBounds = _dereq_('svg-path-bounds') -var parsePath = _dereq_('parse-svg-path') -var drawPath = _dereq_('draw-svg-path') -var isSvgPath = _dereq_('is-svg-path') -var bitmapSdf = _dereq_('bitmap-sdf') - -var canvas = document.createElement('canvas') -var ctx = canvas.getContext('2d') - - -module.exports = pathSdf - - -function pathSdf (path, options) { - if (!isSvgPath(path)) throw Error('Argument should be valid svg path string') - - if (!options) options = {} - - var w, h - if (options.shape) { - w = options.shape[0] - h = options.shape[1] - } - else { - w = canvas.width = options.w || options.width || 200 - h = canvas.height = options.h || options.height || 200 - } - var size = Math.min(w, h) - - var stroke = options.stroke || 0 - - var viewbox = options.viewbox || options.viewBox || pathBounds(path) - var scale = [w / (viewbox[2] - viewbox[0]), h / (viewbox[3] - viewbox[1])] - var maxScale = Math.min(scale[0] || 0, scale[1] || 0) / 2 - - //clear ctx - ctx.fillStyle = 'black' - ctx.fillRect(0, 0, w, h) - - ctx.fillStyle = 'white' - - if (stroke) { - if (typeof stroke != 'number') stroke = 1 - if (stroke > 0) { - ctx.strokeStyle = 'white' - } - else { - ctx.strokeStyle = 'black' - } - - ctx.lineWidth = Math.abs(stroke) - } - - ctx.translate(w * .5, h * .5) - ctx.scale(maxScale, maxScale) - - //if canvas svg paths api is available - if (isPath2DSupported()) { - var path2d = new Path2D(path) - ctx.fill(path2d) - stroke && ctx.stroke(path2d) - } - //fallback to bezier-curves - else { - var segments = parsePath(path) - drawPath(ctx, segments) - ctx.fill() - stroke && ctx.stroke() - } - - ctx.setTransform(1, 0, 0, 1, 0, 0); - - var data = bitmapSdf(ctx, { - cutoff: options.cutoff != null ? options.cutoff : .5, - radius: options.radius != null ? options.radius : size * .5 - }) - - return data -} - -function isPath2DSupported () { - var ctx = document.createElement('canvas').getContext('2d') - ctx.canvas.width = ctx.canvas.height = 1 - - var path = new Path2D('M0,0h1v1h-1v-1Z') - - ctx.fillStyle = 'black' - ctx.fill(path) - - var idata = ctx.getImageData(0,0,1,1) - - return idata && idata.data && idata.data[3] === 255 -} - -},{"bitmap-sdf":81,"draw-svg-path":153,"is-svg-path":407,"parse-svg-path":443,"svg-path-bounds":510}],513:[function(_dereq_,module,exports){ -(function (process){ -'use strict' - -module.exports = textGet - -var vectorizeText = _dereq_('vectorize-text') - -var globals = window || process.global || {} -var __TEXT_CACHE = globals.__TEXT_CACHE || {} -globals.__TEXT_CACHE = {} - -function unwrap(mesh) { - var cells = mesh.cells - var positions = mesh.positions - var data = new Float32Array(cells.length * 6) - var ptr = 0 - var shapeX = 0 - for(var i=0; i0) { - shapeX += 0.02 - } - } - - var data = new Float32Array(bufferSize) - var ptr = 0 - var xOffset = -0.5 * shapeX - for(var i=0; i= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); - } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); - }, - clone: function() { - return tinycolor(this.toString()); - }, - - _applyModification: function(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() { - return this._applyModification(lighten, arguments); - }, - brighten: function() { - return this._applyModification(brighten, arguments); - }, - darken: function() { - return this._applyModification(darken, arguments); - }, - desaturate: function() { - return this._applyModification(desaturate, arguments); - }, - saturate: function() { - return this._applyModification(saturate, arguments); - }, - greyscale: function() { - return this._applyModification(greyscale, arguments); - }, - spin: function() { - return this._applyModification(spin, arguments); - }, - - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); - }, - analogous: function() { - return this._applyCombination(analogous, arguments); - }, - complement: function() { - return this._applyCombination(complement, arguments); - }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); - }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); - }, - triad: function() { - return this._applyCombination(triad, arguments); - }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); - } -}; - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -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); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -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 format = 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; - format = 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; - format = "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; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } - } - - a = boundAlpha(a); - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - - -// Conversion Functions -// -------------------- - -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ - return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 - }; -} - -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - - if(max == min) { - h = s = 0; // achromatic - } - 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: h, s: s, l: l }; -} - -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { - var r, g, b; - - h = bound01(h, 360); - s = bound01(s, 100); - l = bound01(l, 100); - - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - } - - if(s === 0) { - r = g = b = l; // achromatic - } - 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 }; -} - -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; - - var d = max - min; - s = max === 0 ? 0 : d / max; - - if(max == min) { - h = 0; // achromatic - } - 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: h, s: s, v: v }; -} - -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - 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 }; -} - -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b, allow3Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - // Return a 3 character hex if possible - 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(""); -} - -// `rgbaToHex` -// Converts an RGBA color plus alpha transparency to hex -// Assumes r, g, b are contained in the set [0, 255] and -// a in [0, 1]. Returns a 4 or 8 character rgba hex -function rgbaToHex(r, g, b, a, allow4Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)), - pad2(convertDecimalToHex(a)) - ]; - - // Return a 4 character hex if possible - 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(""); -} - -// `rgbaToArgbHex` -// Converts an RGBA color to an ARGB Hex8 string -// Rarely used, but required for "toFilter()" -function rgbaToArgbHex(r, g, b, a) { - - var hex = [ - pad2(convertDecimalToHex(a)), - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - return hex.join(""); -} - -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } - return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); -}; - -tinycolor.random = function() { - return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() - }); -}; - - -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// - -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 = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); - rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); - rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(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); -} - -// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -// Values outside of this range will be wrapped into this range. -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); -} - -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// - -function complement(color) { - var hsl = tinycolor(color).toHsl(); - hsl.h = (hsl.h + 180) % 360; - return tinycolor(hsl); -} - -function triad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function tetrad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -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: h, s: s, v: v})); - v = (v + modification) % 1; - } - - return ret; -} - -// Utility Functions -// --------------------- - -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); -}; - - -// Readability Functions -// --------------------- -// false -// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false -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; - -}; - -// `mostReadable` -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Optionally returns Black or White if the most readable color is unreadable. -// *Example* -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" -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":level,"size":size}) || !includeFallbackColors) { - return bestColor; - } - else { - args.includeFallbackColors=false; - return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); - } -}; - - -// Big List of Colors -// ------------------ -// -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" -}; - -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); - - -// Utilities -// --------- - -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; - for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } - } - return flipped; -} - -// Return a valid alpha value [0,1] with all invalid values being set to 1 -function boundAlpha(a) { - a = parseFloat(a); - - if (isNaN(a) || a < 0 || a > 1) { - a = 1; - } - - return a; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } - - var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); - - // Automatically convert percentage into number - if (processPercent) { - n = parseInt(n * max, 10) / 100; - } - - // Handle floating point rounding errors - if ((Math.abs(n - max) < 0.000001)) { - return 1; - } - - // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} - -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} - -// Parse a base-16 hex value into a base-10 integer -function parseIntFromHex(val) { - return parseInt(val, 16); -} - -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} - -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} - -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} - -// Replace a decimal with it's percentage value -function convertToPercentage(n) { - if (n <= 1) { - n = (n * 100) + "%"; - } - - return n; -} - -// Converts a decimal to a hex value -function convertDecimalToHex(d) { - return Math.round(parseFloat(d) * 255).toString(16); -} -// Converts a hex value to a decimal -function convertHexToDecimal(h) { - return (parseIntFromHex(h) / 255); -} - -var matchers = (function() { - - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; - - // - var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; - - // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. - var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; - - // Actual matching. - // Parentheses and commas are optional, but not required. - // Whitespace can take the place of commas or opening paren - 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})$/ - }; -})(); - -// `isValidCSSUnit` -// Take in a single string / number and check to see if it looks like a CSS unit -// (see `matchers` above for definition). -function isValidCSSUnit(color) { - return !!matchers.CSS_UNIT.exec(color); -} - -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -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" }; - } - - // Try to match string input using regular expressions. - // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] - // Just return an object and let the conversion functions handle that. - // This way the result will be the same whether the tinycolor is initialized with string or object. - 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) { - // return valid WCAG2 parms for isReadable. - // If input parms are invalid, return {"level":"AA", "size":"small"} - 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":level, "size":size}; -} - -// Node: Export function -if (typeof module !== "undefined" && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define === 'function' && define.amd) { - define(function () {return tinycolor;}); -} -// Browser: Expose to window -else { - window.tinycolor = tinycolor; -} - -})(Math); - -},{}],515:[function(_dereq_,module,exports){ -/* @module to-float32 */ - -'use strict' - -module.exports = float32 -module.exports.float32 = -module.exports.float = float32 -module.exports.fract32 = -module.exports.fract = fract32 - -// return fractional part of float32 array -function fract32 (arr) { - if (typeof arr === 'number') { - return float32(arr - float32(arr)) - } - - var fract = float32(arr) - for (var i = 0, l = fract.length; i < l; i++) { - fract[i] = arr[i] - fract[i] - } - return fract -} - -// make sure data is float32 array -function float32 (arr) { - if (arr instanceof Float32Array) return arr - if (typeof arr === 'number') { - return (new Float32Array([arr]))[0] - } - - var float = new Float32Array(arr) - float.set(arr) - return float -} - -},{}],516:[function(_dereq_,module,exports){ -'use strict' - -var parseUnit = _dereq_('parse-unit') - -module.exports = toPX - -var PIXELS_PER_INCH = 96 - -function getPropertyInPX(element, prop) { - var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop)) - return parts[0] * toPX(parts[1], element) -} - -//This brutal hack is needed -function getSizeBrutal(unit, element) { - var testDIV = document.createElement('div') - testDIV.style['font-size'] = '128' + unit - element.appendChild(testDIV) - var size = getPropertyInPX(testDIV, 'font-size') / 128 - element.removeChild(testDIV) - return size -} - -function toPX(str, element) { - element = element || document.body - str = (str || 'px').trim().toLowerCase() - if(element === window || element === document) { - element = document.body - } - switch(str) { - case '%': //Ambiguous, not sure if we should use width or height - return element.clientHeight / 100.0 - case 'ch': - case 'ex': - return getSizeBrutal(str, element) - case 'em': - return getPropertyInPX(element, 'font-size') - case 'rem': - return getPropertyInPX(document.body, 'font-size') - case 'vw': - return window.innerWidth/100 - case 'vh': - return window.innerHeight/100 - case 'vmin': - return Math.min(window.innerWidth, window.innerHeight) / 100 - case 'vmax': - return Math.max(window.innerWidth, window.innerHeight) / 100 - case 'in': - return PIXELS_PER_INCH - case 'cm': - return PIXELS_PER_INCH / 2.54 - case 'mm': - return PIXELS_PER_INCH / 25.4 - case 'pt': - return PIXELS_PER_INCH / 72 - case 'pc': - return PIXELS_PER_INCH / 6 - } - return 1 -} -},{"parse-unit":444}],517:[function(_dereq_,module,exports){ -// https://github.com/topojson/topojson-client Version 2.1.0. Copyright 2016 Mike Bostock. -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.topojson = global.topojson || {}))); -}(this, (function (exports) { 'use strict'; - -var identity = function(x) { - return x; -}; - -var transform = function(topology) { - if ((transform = topology.transform) == null) return identity; - var transform, - x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(point, i) { - if (!i) x0 = y0 = 0; - point[0] = (x0 += point[0]) * kx + dx; - point[1] = (y0 += point[1]) * ky + dy; - return point; - }; -}; - -var bbox = function(topology) { - var bbox = topology.bbox; - - function bboxPoint(p0) { - p1[0] = p0[0], p1[1] = p0[1], t(p1); - if (p1[0] < x0) x0 = p1[0]; - if (p1[0] > x1) x1 = p1[0]; - if (p1[1] < y0) y0 = p1[1]; - if (p1[1] > y1) y1 = p1[1]; - } - - function bboxGeometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(bboxGeometry); break; - case "Point": bboxPoint(o.coordinates); break; - case "MultiPoint": o.coordinates.forEach(bboxPoint); break; - } - } - - if (!bbox) { - var t = transform(topology), p0, p1 = new Array(2), name, - x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; - - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length; - while (++i < n) { - p0 = arc[i], p1[0] = p0[0], p1[1] = p0[1], t(p1, i); - if (p1[0] < x0) x0 = p1[0]; - if (p1[0] > x1) x1 = p1[0]; - if (p1[1] < y0) y0 = p1[1]; - if (p1[1] > y1) y1 = p1[1]; - } - }); - - for (name in topology.objects) { - bboxGeometry(topology.objects[name]); - } - - bbox = topology.bbox = [x0, y0, x1, y1]; - } - - return bbox; -}; - -var reverse = function(array, n) { - var t, j = array.length, i = j - n; - while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; -}; - -var feature = function(topology, o) { - return o.type === "GeometryCollection" - ? {type: "FeatureCollection", features: o.geometries.map(function(o) { return feature$1(topology, o); })} - : feature$1(topology, o); -}; - -function feature$1(topology, o) { - var id = o.id, - bbox = o.bbox, - properties = o.properties == null ? {} : o.properties, - geometry = object(topology, o); - return id == null && bbox == null ? {type: "Feature", properties: properties, geometry: geometry} - : bbox == null ? {type: "Feature", id: id, properties: properties, geometry: geometry} - : {type: "Feature", id: id, bbox: bbox, properties: properties, geometry: geometry}; -} - -function object(topology, o) { - var transformPoint = transform(topology), - arcs = topology.arcs; - - function arc(i, points) { - if (points.length) points.pop(); - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { - points.push(transformPoint(a[k].slice(), k)); - } - if (i < 0) reverse(points, n); - } - - function point(p) { - return transformPoint(p.slice()); - } - - function line(arcs) { - var points = []; - for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points); - if (points.length < 2) points.push(points[0].slice()); - return points; - } - - function ring(arcs) { - var points = line(arcs); - while (points.length < 4) points.push(points[0].slice()); - return points; - } - - function polygon(arcs) { - return arcs.map(ring); - } - - function geometry(o) { - var type = o.type, coordinates; - switch (type) { - case "GeometryCollection": return {type: type, geometries: o.geometries.map(geometry)}; - case "Point": coordinates = point(o.coordinates); break; - case "MultiPoint": coordinates = o.coordinates.map(point); break; - case "LineString": coordinates = line(o.arcs); break; - case "MultiLineString": coordinates = o.arcs.map(line); break; - case "Polygon": coordinates = polygon(o.arcs); break; - case "MultiPolygon": coordinates = o.arcs.map(polygon); break; - default: return null; - } - return {type: type, coordinates: coordinates}; - } - - return geometry(o); -} - -var stitch = function(topology, arcs) { - var stitchedArcs = {}, - fragmentByStart = {}, - fragmentByEnd = {}, - fragments = [], - emptyIndex = -1; - - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) { - t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - } - }); - - arcs.forEach(function(i) { - var e = ends(i), - start = e[0], - end = e[1], - f, g; - - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else { - f = [i]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [p1, p0] : [p0, p1]; - } - - function flush(fragmentByEnd, fragmentByStart) { - for (var k in fragmentByEnd) { - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; }); - fragments.push(f); - } - } - - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); }); - - return fragments; -}; - -var mesh = function(topology) { - return object(topology, meshArcs.apply(this, arguments)); -}; - -function meshArcs(topology, object$$1, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object$$1, filter); - else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; - return {type: "MultiLineString", arcs: stitch(topology, arcs)}; -} - -function extractArcs(topology, object$$1, filter) { - var arcs = [], - geomsByArc = [], - geom; - - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom}); - } - - function extract1(arcs) { - arcs.forEach(extract0); - } - - function extract2(arcs) { - arcs.forEach(extract1); - } - - function extract3(arcs) { - arcs.forEach(extract2); - } - - function geometry(o) { - switch (geom = o, o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "LineString": extract1(o.arcs); break; - case "MultiLineString": case "Polygon": extract2(o.arcs); break; - case "MultiPolygon": extract3(o.arcs); break; - } - } - - geometry(object$$1); - - geomsByArc.forEach(filter == null - ? function(geoms) { arcs.push(geoms[0].i); } - : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - - return arcs; -} - -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while (++i < n) a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} - -var merge = function(topology) { - return object(topology, mergeArcs.apply(this, arguments)); -}; - -function mergeArcs(topology, objects) { - var polygonsByArc = {}, - polygons = [], - groups = []; - - objects.forEach(geometry); - - function geometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(geometry); break; - case "Polygon": extract(o.arcs); break; - case "MultiPolygon": o.arcs.forEach(extract); break; - } - } - - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); - } - - function area(ring) { - return planarRingArea(object(topology, {type: "Polygon", arcs: [ring]}).coordinates[0]); - } - - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], - neighbors = [polygon]; - polygon._ = 1; - groups.push(group); - while (polygon = neighbors.pop()) { - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - - polygons.forEach(function(polygon) { - delete polygon._; - }); - - return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { - arcs.push(arc); - } - }); - }); - }); - - // Stitch the arcs into one or more rings. - arcs = stitch(topology, arcs); - - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) { - if ((ki = area(arcs[i])) > k) { - t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - } - } - - return arcs; - }) - }; -} - -var bisect = function(a, x) { - var lo = 0, hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; -}; - -var neighbors = function(objects) { - var indexesByArc = {}, // arc index -> array of object indexes - neighbors = objects.map(function() { return []; }); - - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [i]; - }); - } - - function polygon(arcs, i) { - arcs.forEach(function(arc) { line(arc, i); }); - } - - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { geometry(o, i); }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); } - }; - - objects.forEach(geometry); - - for (var i in indexesByArc) { - for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) { - for (var k = j + 1; k < m; ++k) { - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - } - - return neighbors; -}; - -var quantize = function(topology, n) { - if (!((n = Math.floor(n)) >= 2)) throw new Error("n must be ≥2"); - if (topology.transform) throw new Error("already quantized"); - var bb = bbox(topology), name, - dx = bb[0], kx = (bb[2] - dx) / (n - 1) || 1, - dy = bb[1], ky = (bb[3] - dy) / (n - 1) || 1; - - function quantizePoint(p) { - p[0] = Math.round((p[0] - dx) / kx); - p[1] = Math.round((p[1] - dy) / ky); - } - - function quantizeGeometry(o) { - switch (o.type) { - case "GeometryCollection": o.geometries.forEach(quantizeGeometry); break; - case "Point": quantizePoint(o.coordinates); break; - case "MultiPoint": o.coordinates.forEach(quantizePoint); break; - } - } - - topology.arcs.forEach(function(arc) { - var i = 1, - j = 1, - n = arc.length, - pi = arc[0], - x0 = pi[0] = Math.round((pi[0] - dx) / kx), - y0 = pi[1] = Math.round((pi[1] - dy) / ky), - pj, - x1, - y1; - - for (; i < n; ++i) { - pi = arc[i]; - x1 = Math.round((pi[0] - dx) / kx); - y1 = Math.round((pi[1] - dy) / ky); - if (x1 !== x0 || y1 !== y0) { - pj = arc[j++]; - pj[0] = x1 - x0, x0 = x1; - pj[1] = y1 - y0, y0 = y1; - } - } - - if (j < 2) { - pj = arc[j++]; - pj[0] = 0; - pj[1] = 0; - } - - arc.length = j; - }); - - for (name in topology.objects) { - quantizeGeometry(topology.objects[name]); - } - - topology.transform = { - scale: [kx, ky], - translate: [dx, dy] - }; - - return topology; -}; - -var untransform = function(topology) { - if ((transform = topology.transform) == null) return identity; - var transform, - x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function(point, i) { - if (!i) x0 = y0 = 0; - var x1 = Math.round((point[0] - dx) / kx), - y1 = Math.round((point[1] - dy) / ky); - point[0] = x1 - x0, x0 = x1; - point[1] = y1 - y0, y0 = y1; - return point; - }; -}; - -exports.bbox = bbox; -exports.feature = feature; -exports.mesh = mesh; -exports.meshArcs = meshArcs; -exports.merge = merge; -exports.mergeArcs = mergeArcs; -exports.neighbors = neighbors; -exports.quantize = quantize; -exports.transform = transform; -exports.untransform = untransform; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{}],518:[function(_dereq_,module,exports){ -"use strict" - -module.exports = triangulateCube - -var perm = _dereq_("permutation-rank") -var sgn = _dereq_("permutation-parity") -var gamma = _dereq_("gamma") - -function triangulateCube(dimension) { - if(dimension < 0) { - return [ ] - } - if(dimension === 0) { - return [ [0] ] - } - var dfactorial = Math.round(gamma(dimension+1))|0 - var result = [] - for(var i=0; i Math.max(vy, vz)) { - u[2] = 1 - } else if(vy > Math.max(vx, vz)) { - u[0] = 1 - } else { - u[1] = 1 - } - - var vv = 0 - var uv = 0 - for(var i=0; i<3; ++i ) { - vv += v[i] * v[i] - uv += u[i] * v[i] - } - for(var i=0; i<3; ++i) { - u[i] -= (uv / vv) * v[i] - } - normalize3(u, u) - return u -} - -function TurntableController(zoomMin, zoomMax, center, up, right, radius, theta, phi) { - this.center = filterVector(center) - this.up = filterVector(up) - this.right = filterVector(right) - this.radius = filterVector([radius]) - this.angle = filterVector([theta, phi]) - this.angle.bounds = [[-Infinity,-Math.PI/2], [Infinity,Math.PI/2]] - this.setDistanceLimits(zoomMin, zoomMax) - - this.computedCenter = this.center.curve(0) - this.computedUp = this.up.curve(0) - this.computedRight = this.right.curve(0) - this.computedRadius = this.radius.curve(0) - this.computedAngle = this.angle.curve(0) - this.computedToward = [0,0,0] - this.computedEye = [0,0,0] - this.computedMatrix = new Array(16) - for(var i=0; i<16; ++i) { - this.computedMatrix[i] = 0.5 - } - - this.recalcMatrix(0) -} - -var proto = TurntableController.prototype - -proto.setDistanceLimits = function(minDist, maxDist) { - if(minDist > 0) { - minDist = Math.log(minDist) - } else { - minDist = -Infinity - } - if(maxDist > 0) { - maxDist = Math.log(maxDist) - } else { - maxDist = Infinity - } - maxDist = Math.max(maxDist, minDist) - this.radius.bounds[0][0] = minDist - this.radius.bounds[1][0] = maxDist -} - -proto.getDistanceLimits = function(out) { - var bounds = this.radius.bounds[0] - if(out) { - out[0] = Math.exp(bounds[0][0]) - out[1] = Math.exp(bounds[1][0]) - return out - } - return [ Math.exp(bounds[0][0]), Math.exp(bounds[1][0]) ] -} - -proto.recalcMatrix = function(t) { - //Recompute curves - this.center.curve(t) - this.up.curve(t) - this.right.curve(t) - this.radius.curve(t) - this.angle.curve(t) - - //Compute frame for camera matrix - var up = this.computedUp - var right = this.computedRight - var uu = 0.0 - var ur = 0.0 - for(var i=0; i<3; ++i) { - ur += up[i] * right[i] - uu += up[i] * up[i] - } - var ul = Math.sqrt(uu) - var rr = 0.0 - for(var i=0; i<3; ++i) { - right[i] -= up[i] * ur / uu - rr += right[i] * right[i] - up[i] /= ul - } - var rl = Math.sqrt(rr) - for(var i=0; i<3; ++i) { - right[i] /= rl - } - - //Compute toward vector - var toward = this.computedToward - cross(toward, up, right) - normalize3(toward, toward) - - //Compute angular parameters - var radius = Math.exp(this.computedRadius[0]) - var theta = this.computedAngle[0] - var phi = this.computedAngle[1] - - var ctheta = Math.cos(theta) - var stheta = Math.sin(theta) - var cphi = Math.cos(phi) - var sphi = Math.sin(phi) - - var center = this.computedCenter - - var wx = ctheta * cphi - var wy = stheta * cphi - var wz = sphi - - var sx = -ctheta * sphi - var sy = -stheta * sphi - var sz = cphi - - var eye = this.computedEye - var mat = this.computedMatrix - for(var i=0; i<3; ++i) { - var x = wx * right[i] + wy * toward[i] + wz * up[i] - mat[4*i+1] = sx * right[i] + sy * toward[i] + sz * up[i] - mat[4*i+2] = x - mat[4*i+3] = 0.0 - } - - var ax = mat[1] - var ay = mat[5] - var az = mat[9] - var bx = mat[2] - var by = mat[6] - var bz = mat[10] - var cx = ay * bz - az * by - var cy = az * bx - ax * bz - var cz = ax * by - ay * bx - var cl = len3(cx, cy, cz) - cx /= cl - cy /= cl - cz /= cl - mat[0] = cx - mat[4] = cy - mat[8] = cz - - for(var i=0; i<3; ++i) { - eye[i] = center[i] + mat[2+4*i]*radius - } - - for(var i=0; i<3; ++i) { - var rr = 0.0 - for(var j=0; j<3; ++j) { - rr += mat[i+4*j] * eye[j] - } - mat[12+i] = -rr - } - mat[15] = 1.0 -} - -proto.getMatrix = function(t, result) { - this.recalcMatrix(t) - var mat = this.computedMatrix - if(result) { - for(var i=0; i<16; ++i) { - result[i] = mat[i] - } - return result - } - return mat -} - -var zAxis = [0,0,0] -proto.rotate = function(t, dtheta, dphi, droll) { - this.angle.move(t, dtheta, dphi) - if(droll) { - this.recalcMatrix(t) - - var mat = this.computedMatrix - zAxis[0] = mat[2] - zAxis[1] = mat[6] - zAxis[2] = mat[10] - - var up = this.computedUp - var right = this.computedRight - var toward = this.computedToward - - for(var i=0; i<3; ++i) { - mat[4*i] = up[i] - mat[4*i+1] = right[i] - mat[4*i+2] = toward[i] - } - rotateM(mat, mat, droll, zAxis) - for(var i=0; i<3; ++i) { - up[i] = mat[4*i] - right[i] = mat[4*i+1] - } - - this.up.set(t, up[0], up[1], up[2]) - this.right.set(t, right[0], right[1], right[2]) - } -} - -proto.pan = function(t, dx, dy, dz) { - dx = dx || 0.0 - dy = dy || 0.0 - dz = dz || 0.0 - - this.recalcMatrix(t) - var mat = this.computedMatrix - - var dist = Math.exp(this.computedRadius[0]) - - var ux = mat[1] - var uy = mat[5] - var uz = mat[9] - var ul = len3(ux, uy, uz) - ux /= ul - uy /= ul - uz /= ul - - var rx = mat[0] - var ry = mat[4] - var rz = mat[8] - var ru = rx * ux + ry * uy + rz * uz - rx -= ux * ru - ry -= uy * ru - rz -= uz * ru - var rl = len3(rx, ry, rz) - rx /= rl - ry /= rl - rz /= rl - - var vx = rx * dx + ux * dy - var vy = ry * dx + uy * dy - var vz = rz * dx + uz * dy - this.center.move(t, vx, vy, vz) - - //Update z-component of radius - var radius = Math.exp(this.computedRadius[0]) - radius = Math.max(1e-4, radius + dz) - this.radius.set(t, Math.log(radius)) -} - -proto.translate = function(t, dx, dy, dz) { - this.center.move(t, - dx||0.0, - dy||0.0, - dz||0.0) -} - -//Recenters the coordinate axes -proto.setMatrix = function(t, mat, axes, noSnap) { - - //Get the axes for tare - var ushift = 1 - if(typeof axes === 'number') { - ushift = (axes)|0 - } - if(ushift < 0 || ushift > 3) { - ushift = 1 - } - var vshift = (ushift + 2) % 3 - var fshift = (ushift + 1) % 3 - - //Recompute state for new t value - if(!mat) { - this.recalcMatrix(t) - mat = this.computedMatrix - } - - //Get right and up vectors - var ux = mat[ushift] - var uy = mat[ushift+4] - var uz = mat[ushift+8] - if(!noSnap) { - var ul = len3(ux, uy, uz) - ux /= ul - uy /= ul - uz /= ul - } else { - var ax = Math.abs(ux) - var ay = Math.abs(uy) - var az = Math.abs(uz) - var am = Math.max(ax,ay,az) - if(ax === am) { - ux = (ux < 0) ? -1 : 1 - uy = uz = 0 - } else if(az === am) { - uz = (uz < 0) ? -1 : 1 - ux = uy = 0 - } else { - uy = (uy < 0) ? -1 : 1 - ux = uz = 0 - } - } - - var rx = mat[vshift] - var ry = mat[vshift+4] - var rz = mat[vshift+8] - var ru = rx * ux + ry * uy + rz * uz - rx -= ux * ru - ry -= uy * ru - rz -= uz * ru - var rl = len3(rx, ry, rz) - rx /= rl - ry /= rl - rz /= rl - - var fx = uy * rz - uz * ry - var fy = uz * rx - ux * rz - var fz = ux * ry - uy * rx - var fl = len3(fx, fy, fz) - fx /= fl - fy /= fl - fz /= fl - - this.center.jump(t, ex, ey, ez) - this.radius.idle(t) - this.up.jump(t, ux, uy, uz) - this.right.jump(t, rx, ry, rz) - - var phi, theta - if(ushift === 2) { - var cx = mat[1] - var cy = mat[5] - var cz = mat[9] - var cr = cx * rx + cy * ry + cz * rz - var cf = cx * fx + cy * fy + cz * fz - if(tu < 0) { - phi = -Math.PI/2 - } else { - phi = Math.PI/2 - } - theta = Math.atan2(cf, cr) - } else { - var tx = mat[2] - var ty = mat[6] - var tz = mat[10] - var tu = tx * ux + ty * uy + tz * uz - var tr = tx * rx + ty * ry + tz * rz - var tf = tx * fx + ty * fy + tz * fz - - phi = Math.asin(clamp1(tu)) - theta = Math.atan2(tf, tr) - } - - this.angle.jump(t, theta, phi) - - this.recalcMatrix(t) - var dx = mat[2] - var dy = mat[6] - var dz = mat[10] - - var imat = this.computedMatrix - invert44(imat, mat) - var w = imat[15] - var ex = imat[12] / w - var ey = imat[13] / w - var ez = imat[14] / w - - var gs = Math.exp(this.computedRadius[0]) - this.center.jump(t, ex-dx*gs, ey-dy*gs, ez-dz*gs) -} - -proto.lastT = function() { - return Math.max( - this.center.lastT(), - this.up.lastT(), - this.right.lastT(), - this.radius.lastT(), - this.angle.lastT()) -} - -proto.idle = function(t) { - this.center.idle(t) - this.up.idle(t) - this.right.idle(t) - this.radius.idle(t) - this.angle.idle(t) -} - -proto.flush = function(t) { - this.center.flush(t) - this.up.flush(t) - this.right.flush(t) - this.radius.flush(t) - this.angle.flush(t) -} - -proto.setDistance = function(t, d) { - if(d > 0) { - this.radius.set(t, Math.log(d)) - } -} - -proto.lookAt = function(t, eye, center, up) { - this.recalcMatrix(t) - - eye = eye || this.computedEye - center = center || this.computedCenter - up = up || this.computedUp - - var ux = up[0] - var uy = up[1] - var uz = up[2] - var ul = len3(ux, uy, uz) - if(ul < 1e-6) { - return - } - ux /= ul - uy /= ul - uz /= ul - - var tx = eye[0] - center[0] - var ty = eye[1] - center[1] - var tz = eye[2] - center[2] - var tl = len3(tx, ty, tz) - if(tl < 1e-6) { - return - } - tx /= tl - ty /= tl - tz /= tl - - var right = this.computedRight - var rx = right[0] - var ry = right[1] - var rz = right[2] - var ru = ux*rx + uy*ry + uz*rz - rx -= ru * ux - ry -= ru * uy - rz -= ru * uz - var rl = len3(rx, ry, rz) - - if(rl < 0.01) { - rx = uy * tz - uz * ty - ry = uz * tx - ux * tz - rz = ux * ty - uy * tx - rl = len3(rx, ry, rz) - if(rl < 1e-6) { - return - } - } - rx /= rl - ry /= rl - rz /= rl - - this.up.set(t, ux, uy, uz) - this.right.set(t, rx, ry, rz) - this.center.set(t, center[0], center[1], center[2]) - this.radius.set(t, Math.log(tl)) - - var fx = uy * rz - uz * ry - var fy = uz * rx - ux * rz - var fz = ux * ry - uy * rx - var fl = len3(fx, fy, fz) - fx /= fl - fy /= fl - fz /= fl - - var tu = ux*tx + uy*ty + uz*tz - var tr = rx*tx + ry*ty + rz*tz - var tf = fx*tx + fy*ty + fz*tz - - var phi = Math.asin(clamp1(tu)) - var theta = Math.atan2(tf, tr) - - var angleState = this.angle._state - var lastTheta = angleState[angleState.length-1] - var lastPhi = angleState[angleState.length-2] - lastTheta = lastTheta % (2.0 * Math.PI) - var dp = Math.abs(lastTheta + 2.0 * Math.PI - theta) - var d0 = Math.abs(lastTheta - theta) - var dn = Math.abs(lastTheta - 2.0 * Math.PI - theta) - if(dp < d0) { - lastTheta += 2.0 * Math.PI - } - if(dn < d0) { - lastTheta -= 2.0 * Math.PI - } - - this.angle.jump(this.angle.lastT(), lastTheta, lastPhi) - this.angle.set(t, theta, phi) -} - -function createTurntableController(options) { - options = options || {} - - var center = options.center || [0,0,0] - var up = options.up || [0,1,0] - var right = options.right || findOrthoPair(up) - var radius = options.radius || 1.0 - var theta = options.theta || 0.0 - var phi = options.phi || 0.0 - - center = [].slice.call(center, 0, 3) - - up = [].slice.call(up, 0, 3) - normalize3(up, up) - - right = [].slice.call(right, 0, 3) - normalize3(right, right) - - if('eye' in options) { - var eye = options.eye - var toward = [ - eye[0]-center[0], - eye[1]-center[1], - eye[2]-center[2] - ] - cross(right, toward, up) - if(len3(right[0], right[1], right[2]) < 1e-6) { - right = findOrthoPair(up) - } else { - normalize3(right, right) - } - - radius = len3(toward[0], toward[1], toward[2]) - - var ut = dot3(up, toward) / radius - var rt = dot3(right, toward) / radius - phi = Math.acos(ut) - theta = Math.acos(rt) - } - - //Use logarithmic coordinates for radius - radius = Math.log(radius) - - //Return the controller - return new TurntableController( - options.zoomMin, - options.zoomMax, - center, - up, - right, - radius, - theta, - phi) -} -},{"filtered-vector":215,"gl-mat4/invert":254,"gl-mat4/rotate":258,"gl-vec3/cross":317,"gl-vec3/dot":322,"gl-vec3/normalize":339}],520:[function(_dereq_,module,exports){ -"use strict" - -module.exports = twoProduct - -var SPLITTER = +(Math.pow(2, 27) + 1.0) - -function twoProduct(a, b, result) { - var x = a * b - - var c = SPLITTER * a - var abig = c - a - var ahi = c - abig - var alo = a - ahi - - var d = SPLITTER * b - var bbig = d - b - var bhi = d - bbig - var blo = b - bhi - - var err1 = x - (ahi * bhi) - var err2 = err1 - (alo * bhi) - var err3 = err2 - (ahi * blo) - - var y = alo * blo - err3 - - if(result) { - result[0] = y - result[1] = x - return result - } - - return [ y, x ] -} -},{}],521:[function(_dereq_,module,exports){ -"use strict" - -module.exports = fastTwoSum - -function fastTwoSum(a, b, result) { - var x = a + b - var bv = x - a - var av = x - bv - var br = b - bv - var ar = a - av - if(result) { - result[0] = ar + br - result[1] = x - return result - } - return [ar+br, x] -} -},{}],522:[function(_dereq_,module,exports){ -(function (global,Buffer){ -'use strict' - -var bits = _dereq_('bit-twiddle') -var dup = _dereq_('dup') - -//Legacy pool support -if(!global.__TYPEDARRAY_POOL) { - global.__TYPEDARRAY_POOL = { - UINT8 : dup([32, 0]) - , UINT16 : dup([32, 0]) - , UINT32 : dup([32, 0]) - , INT8 : dup([32, 0]) - , INT16 : dup([32, 0]) - , INT32 : dup([32, 0]) - , FLOAT : dup([32, 0]) - , DOUBLE : dup([32, 0]) - , DATA : dup([32, 0]) - , UINT8C : dup([32, 0]) - , BUFFER : dup([32, 0]) - } -} - -var hasUint8C = (typeof Uint8ClampedArray) !== 'undefined' -var POOL = global.__TYPEDARRAY_POOL - -//Upgrade pool -if(!POOL.UINT8C) { - POOL.UINT8C = dup([32, 0]) -} -if(!POOL.BUFFER) { - POOL.BUFFER = dup([32, 0]) -} - -//New technique: Only allocate from ArrayBufferView and Buffer -var DATA = POOL.DATA - , BUFFER = POOL.BUFFER - -exports.free = function free(array) { - if(Buffer.isBuffer(array)) { - BUFFER[bits.log2(array.length)].push(array) - } else { - if(Object.prototype.toString.call(array) !== '[object ArrayBuffer]') { - array = array.buffer - } - if(!array) { - return - } - var n = array.length || array.byteLength - var log_n = bits.log2(n)|0 - DATA[log_n].push(array) - } -} - -function freeArrayBuffer(buffer) { - if(!buffer) { - return - } - var n = buffer.length || buffer.byteLength - var log_n = bits.log2(n) - DATA[log_n].push(buffer) -} - -function freeTypedArray(array) { - freeArrayBuffer(array.buffer) -} - -exports.freeUint8 = -exports.freeUint16 = -exports.freeUint32 = -exports.freeInt8 = -exports.freeInt16 = -exports.freeInt32 = -exports.freeFloat32 = -exports.freeFloat = -exports.freeFloat64 = -exports.freeDouble = -exports.freeUint8Clamped = -exports.freeDataView = freeTypedArray - -exports.freeArrayBuffer = freeArrayBuffer - -exports.freeBuffer = function freeBuffer(array) { - BUFFER[bits.log2(array.length)].push(array) -} - -exports.malloc = function malloc(n, dtype) { - if(dtype === undefined || dtype === 'arraybuffer') { - return mallocArrayBuffer(n) - } else { - switch(dtype) { - case 'uint8': - return mallocUint8(n) - case 'uint16': - return mallocUint16(n) - case 'uint32': - return mallocUint32(n) - case 'int8': - return mallocInt8(n) - case 'int16': - return mallocInt16(n) - case 'int32': - return mallocInt32(n) - case 'float': - case 'float32': - return mallocFloat(n) - case 'double': - case 'float64': - return mallocDouble(n) - case 'uint8_clamped': - return mallocUint8Clamped(n) - case 'buffer': - return mallocBuffer(n) - case 'data': - case 'dataview': - return mallocDataView(n) - - default: - return null - } - } - return null -} - -function mallocArrayBuffer(n) { - var n = bits.nextPow2(n) - var log_n = bits.log2(n) - var d = DATA[log_n] - if(d.length > 0) { - return d.pop() - } - return new ArrayBuffer(n) -} -exports.mallocArrayBuffer = mallocArrayBuffer - -function mallocUint8(n) { - return new Uint8Array(mallocArrayBuffer(n), 0, n) -} -exports.mallocUint8 = mallocUint8 - -function mallocUint16(n) { - return new Uint16Array(mallocArrayBuffer(2*n), 0, n) -} -exports.mallocUint16 = mallocUint16 - -function mallocUint32(n) { - return new Uint32Array(mallocArrayBuffer(4*n), 0, n) -} -exports.mallocUint32 = mallocUint32 - -function mallocInt8(n) { - return new Int8Array(mallocArrayBuffer(n), 0, n) -} -exports.mallocInt8 = mallocInt8 - -function mallocInt16(n) { - return new Int16Array(mallocArrayBuffer(2*n), 0, n) -} -exports.mallocInt16 = mallocInt16 - -function mallocInt32(n) { - return new Int32Array(mallocArrayBuffer(4*n), 0, n) -} -exports.mallocInt32 = mallocInt32 - -function mallocFloat(n) { - return new Float32Array(mallocArrayBuffer(4*n), 0, n) -} -exports.mallocFloat32 = exports.mallocFloat = mallocFloat - -function mallocDouble(n) { - return new Float64Array(mallocArrayBuffer(8*n), 0, n) -} -exports.mallocFloat64 = exports.mallocDouble = mallocDouble - -function mallocUint8Clamped(n) { - if(hasUint8C) { - return new Uint8ClampedArray(mallocArrayBuffer(n), 0, n) - } else { - return mallocUint8(n) - } -} -exports.mallocUint8Clamped = mallocUint8Clamped - -function mallocDataView(n) { - return new DataView(mallocArrayBuffer(n), 0, n) -} -exports.mallocDataView = mallocDataView - -function mallocBuffer(n) { - n = bits.nextPow2(n) - var log_n = bits.log2(n) - var cache = BUFFER[log_n] - if(cache.length > 0) { - return cache.pop() - } - return new Buffer(n) -} -exports.mallocBuffer = mallocBuffer - -exports.clearCache = function clearCache() { - for(var i=0; i<32; ++i) { - POOL.UINT8[i].length = 0 - POOL.UINT16[i].length = 0 - POOL.UINT32[i].length = 0 - POOL.INT8[i].length = 0 - POOL.INT16[i].length = 0 - POOL.INT32[i].length = 0 - POOL.FLOAT[i].length = 0 - POOL.DOUBLE[i].length = 0 - POOL.UINT8C[i].length = 0 - DATA[i].length = 0 - BUFFER[i].length = 0 - } -} -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_("buffer").Buffer) -},{"bit-twiddle":80,"buffer":93,"dup":155}],523:[function(_dereq_,module,exports){ -"use strict"; "use restrict"; - -module.exports = UnionFind; - -function UnionFind(count) { - this.roots = new Array(count); - this.ranks = new Array(count); - - for(var i=0; i 8192) { - throw new Error("vectorize-text: String too long (sorry, this will get fixed later)") - } - var height = 3 * size - if(canvas.height < height) { - canvas.height = height - } - - context.fillStyle = "#000" - context.fillRect(0, 0, canvas.width, canvas.height) - - context.fillStyle = "#fff" - context.fillText(str, size, 2*size) - - //Cut pixels from image - var pixelData = context.getImageData(0, 0, width, height) - var pixels = ndarray(pixelData.data, [height, width, 4]) - - return pixels.pick(-1,-1,0).transpose(1,0) -} - -function getContour(pixels, doSimplify) { - var contour = surfaceNets(pixels, 128) - if(doSimplify) { - return simplify(contour.cells, contour.positions, 0.25) - } - return { - edges: contour.cells, - positions: contour.positions - } -} - -function processPixelsImpl(pixels, options, size, simplify) { - //Extract contour - var contour = getContour(pixels, simplify) - - //Apply warp to positions - var positions = transformPositions(contour.positions, options, size) - var edges = contour.edges - var flip = "ccw" === options.orientation - - //Clean up the PSLG, resolve self intersections, etc. - cleanPSLG(positions, edges) - - //If triangulate flag passed, triangulate the result - if(options.polygons || options.polygon || options.polyline) { - var result = toPolygonCrappy(edges, positions) - var nresult = new Array(result.length) - for(var i=0; iAssumes that an ES5 platform where, if {@code WeakMap} is - * already present, then it conforms to the anticipated ES6 - * specification. To run this file on an ES5 or almost ES5 - * implementation where the {@code WeakMap} specification does not - * quite conform, run repairES5.js first. - * - *

Even though WeakMapModule is not global, the linter thinks it - * is, which is why it is in the overrides list below. - * - *

NOTE: Before using this WeakMap emulation in a non-SES - * environment, see the note below about hiddenRecord. - * - * @author Mark S. Miller - * @requires crypto, ArrayBuffer, Uint8Array, navigator, console - * @overrides WeakMap, ses, Proxy - * @overrides WeakMapModule - */ - -/** - * This {@code WeakMap} emulation is observably equivalent to the - * ES-Harmony WeakMap, but with leakier garbage collection properties. - * - *

As with true WeakMaps, in this emulation, a key does not - * retain maps indexed by that key and (crucially) a map does not - * retain the keys it indexes. A map by itself also does not retain - * the values associated with that map. - * - *

However, the values associated with a key in some map are - * retained so long as that key is retained and those associations are - * not overridden. For example, when used to support membranes, all - * values exported from a given membrane will live for the lifetime - * they would have had in the absence of an interposed membrane. Even - * when the membrane is revoked, all objects that would have been - * reachable in the absence of revocation will still be reachable, as - * far as the GC can tell, even though they will no longer be relevant - * to ongoing computation. - * - *

The API implemented here is approximately the API as implemented - * in FF6.0a1 and agreed to by MarkM, Andreas Gal, and Dave Herman, - * rather than the offially approved proposal page. TODO(erights): - * upgrade the ecmascript WeakMap proposal page to explain this API - * change and present to EcmaScript committee for their approval. - * - *

The first difference between the emulation here and that in - * FF6.0a1 is the presence of non enumerable {@code get___, has___, - * set___, and delete___} methods on WeakMap instances to represent - * what would be the hidden internal properties of a primitive - * implementation. Whereas the FF6.0a1 WeakMap.prototype methods - * require their {@code this} to be a genuine WeakMap instance (i.e., - * an object of {@code [[Class]]} "WeakMap}), since there is nothing - * unforgeable about the pseudo-internal method names used here, - * nothing prevents these emulated prototype methods from being - * applied to non-WeakMaps with pseudo-internal methods of the same - * names. - * - *

Another difference is that our emulated {@code - * WeakMap.prototype} is not itself a WeakMap. A problem with the - * current FF6.0a1 API is that WeakMap.prototype is itself a WeakMap - * providing ambient mutability and an ambient communications - * channel. Thus, if a WeakMap is already present and has this - * problem, repairES5.js wraps it in a safe wrappper in order to - * prevent access to this channel. (See - * PATCH_MUTABLE_FROZEN_WEAKMAP_PROTO in repairES5.js). - */ - -/** - * If this is a full secureable ES5 platform and the ES-Harmony {@code WeakMap} is - * absent, install an approximate emulation. - * - *

If WeakMap is present but cannot store some objects, use our approximate - * emulation as a wrapper. - * - *

If this is almost a secureable ES5 platform, then WeakMap.js - * should be run after repairES5.js. - * - *

See {@code WeakMap} for documentation of the garbage collection - * properties of this WeakMap emulation. - */ -(function WeakMapModule() { - "use strict"; - - if (typeof ses !== 'undefined' && ses.ok && !ses.ok()) { - // already too broken, so give up - return; - } - - /** - * In some cases (current Firefox), we must make a choice betweeen a - * WeakMap which is capable of using all varieties of host objects as - * keys and one which is capable of safely using proxies as keys. See - * comments below about HostWeakMap and DoubleWeakMap for details. - * - * This function (which is a global, not exposed to guests) marks a - * WeakMap as permitted to do what is necessary to index all host - * objects, at the cost of making it unsafe for proxies. - * - * Do not apply this function to anything which is not a genuine - * fresh WeakMap. - */ - function weakMapPermitHostObjects(map) { - // identity of function used as a secret -- good enough and cheap - if (map.permitHostObjects___) { - map.permitHostObjects___(weakMapPermitHostObjects); - } - } - if (typeof ses !== 'undefined') { - ses.weakMapPermitHostObjects = weakMapPermitHostObjects; - } - - // IE 11 has no Proxy but has a broken WeakMap such that we need to patch - // it using DoubleWeakMap; this flag tells DoubleWeakMap so. - var doubleWeakMapCheckSilentFailure = false; - - // Check if there is already a good-enough WeakMap implementation, and if so - // exit without replacing it. - if (typeof WeakMap === 'function') { - var HostWeakMap = WeakMap; - // There is a WeakMap -- is it good enough? - if (typeof navigator !== 'undefined' && - /Firefox/.test(navigator.userAgent)) { - // We're now *assuming not*, because as of this writing (2013-05-06) - // Firefox's WeakMaps have a miscellany of objects they won't accept, and - // we don't want to make an exhaustive list, and testing for just one - // will be a problem if that one is fixed alone (as they did for Event). - - // If there is a platform that we *can* reliably test on, here's how to - // do it: - // var problematic = ... ; - // var testHostMap = new HostWeakMap(); - // try { - // testHostMap.set(problematic, 1); // Firefox 20 will throw here - // if (testHostMap.get(problematic) === 1) { - // return; - // } - // } catch (e) {} - - } else { - // IE 11 bug: WeakMaps silently fail to store frozen objects. - var testMap = new HostWeakMap(); - var testObject = Object.freeze({}); - testMap.set(testObject, 1); - if (testMap.get(testObject) !== 1) { - doubleWeakMapCheckSilentFailure = true; - // Fall through to installing our WeakMap. - } else { - module.exports = WeakMap; - return; - } - } - } - - var hop = Object.prototype.hasOwnProperty; - var gopn = Object.getOwnPropertyNames; - var defProp = Object.defineProperty; - var isExtensible = Object.isExtensible; - - /** - * Security depends on HIDDEN_NAME being both unguessable and - * undiscoverable by untrusted code. - * - *

Given the known weaknesses of Math.random() on existing - * browsers, it does not generate unguessability we can be confident - * of. - * - *

It is the monkey patching logic in this file that is intended - * to ensure undiscoverability. The basic idea is that there are - * three fundamental means of discovering properties of an object: - * The for/in loop, Object.keys(), and Object.getOwnPropertyNames(), - * as well as some proposed ES6 extensions that appear on our - * whitelist. The first two only discover enumerable properties, and - * we only use HIDDEN_NAME to name a non-enumerable property, so the - * only remaining threat should be getOwnPropertyNames and some - * proposed ES6 extensions that appear on our whitelist. We monkey - * patch them to remove HIDDEN_NAME from the list of properties they - * returns. - * - *

TODO(erights): On a platform with built-in Proxies, proxies - * could be used to trap and thereby discover the HIDDEN_NAME, so we - * need to monkey patch Proxy.create, Proxy.createFunction, etc, in - * order to wrap the provided handler with the real handler which - * filters out all traps using HIDDEN_NAME. - * - *

TODO(erights): Revisit Mike Stay's suggestion that we use an - * encapsulated function at a not-necessarily-secret name, which - * uses the Stiegler shared-state rights amplification pattern to - * reveal the associated value only to the WeakMap in which this key - * is associated with that value. Since only the key retains the - * function, the function can also remember the key without causing - * leakage of the key, so this doesn't violate our general gc - * goals. In addition, because the name need not be a guarded - * secret, we could efficiently handle cross-frame frozen keys. - */ - var HIDDEN_NAME_PREFIX = 'weakmap:'; - var HIDDEN_NAME = HIDDEN_NAME_PREFIX + 'ident:' + Math.random() + '___'; - - if (typeof crypto !== 'undefined' && - typeof crypto.getRandomValues === 'function' && - typeof ArrayBuffer === 'function' && - typeof Uint8Array === 'function') { - var ab = new ArrayBuffer(25); - var u8s = new Uint8Array(ab); - crypto.getRandomValues(u8s); - HIDDEN_NAME = HIDDEN_NAME_PREFIX + 'rand:' + - Array.prototype.map.call(u8s, function(u8) { - return (u8 % 36).toString(36); - }).join('') + '___'; - } - - function isNotHiddenName(name) { - return !( - name.substr(0, HIDDEN_NAME_PREFIX.length) == HIDDEN_NAME_PREFIX && - name.substr(name.length - 3) === '___'); - } - - /** - * Monkey patch getOwnPropertyNames to avoid revealing the - * HIDDEN_NAME. - * - *

The ES5.1 spec requires each name to appear only once, but as - * of this writing, this requirement is controversial for ES6, so we - * made this code robust against this case. If the resulting extra - * search turns out to be expensive, we can probably relax this once - * ES6 is adequately supported on all major browsers, iff no browser - * versions we support at that time have relaxed this constraint - * without providing built-in ES6 WeakMaps. - */ - defProp(Object, 'getOwnPropertyNames', { - value: function fakeGetOwnPropertyNames(obj) { - return gopn(obj).filter(isNotHiddenName); - } - }); - - /** - * getPropertyNames is not in ES5 but it is proposed for ES6 and - * does appear in our whitelist, so we need to clean it too. - */ - if ('getPropertyNames' in Object) { - var originalGetPropertyNames = Object.getPropertyNames; - defProp(Object, 'getPropertyNames', { - value: function fakeGetPropertyNames(obj) { - return originalGetPropertyNames(obj).filter(isNotHiddenName); - } - }); - } - - /** - *

To treat objects as identity-keys with reasonable efficiency - * on ES5 by itself (i.e., without any object-keyed collections), we - * need to add a hidden property to such key objects when we - * can. This raises several issues: - *

    - *
  • Arranging to add this property to objects before we lose the - * chance, and - *
  • Hiding the existence of this new property from most - * JavaScript code. - *
  • Preventing certification theft, where one object is - * created falsely claiming to be the key of an association - * actually keyed by another object. - *
  • Preventing value theft, where untrusted code with - * access to a key object but not a weak map nevertheless - * obtains access to the value associated with that key in that - * weak map. - *
- * We do so by - *
    - *
  • Making the name of the hidden property unguessable, so "[]" - * indexing, which we cannot intercept, cannot be used to access - * a property without knowing the name. - *
  • Making the hidden property non-enumerable, so we need not - * worry about for-in loops or {@code Object.keys}, - *
  • monkey patching those reflective methods that would - * prevent extensions, to add this hidden property first, - *
  • monkey patching those methods that would reveal this - * hidden property. - *
- * Unfortunately, because of same-origin iframes, we cannot reliably - * add this hidden property before an object becomes - * non-extensible. Instead, if we encounter a non-extensible object - * without a hidden record that we can detect (whether or not it has - * a hidden record stored under a name secret to us), then we just - * use the key object itself to represent its identity in a brute - * force leaky map stored in the weak map, losing all the advantages - * of weakness for these. - */ - function getHiddenRecord(key) { - if (key !== Object(key)) { - throw new TypeError('Not an object: ' + key); - } - var hiddenRecord = key[HIDDEN_NAME]; - if (hiddenRecord && hiddenRecord.key === key) { return hiddenRecord; } - if (!isExtensible(key)) { - // Weak map must brute force, as explained in doc-comment above. - return void 0; - } - - // The hiddenRecord and the key point directly at each other, via - // the "key" and HIDDEN_NAME properties respectively. The key - // field is for quickly verifying that this hidden record is an - // own property, not a hidden record from up the prototype chain. - // - // NOTE: Because this WeakMap emulation is meant only for systems like - // SES where Object.prototype is frozen without any numeric - // properties, it is ok to use an object literal for the hiddenRecord. - // This has two advantages: - // * It is much faster in a performance critical place - // * It avoids relying on Object.create(null), which had been - // problematic on Chrome 28.0.1480.0. See - // https://code.google.com/p/google-caja/issues/detail?id=1687 - hiddenRecord = { key: key }; - - // When using this WeakMap emulation on platforms where - // Object.prototype might not be frozen and Object.create(null) is - // reliable, use the following two commented out lines instead. - // hiddenRecord = Object.create(null); - // hiddenRecord.key = key; - - // Please contact us if you need this to work on platforms where - // Object.prototype might not be frozen and - // Object.create(null) might not be reliable. - - try { - defProp(key, HIDDEN_NAME, { - value: hiddenRecord, - writable: false, - enumerable: false, - configurable: false - }); - return hiddenRecord; - } catch (error) { - // Under some circumstances, isExtensible seems to misreport whether - // the HIDDEN_NAME can be defined. - // The circumstances have not been isolated, but at least affect - // Node.js v0.10.26 on TravisCI / Linux, but not the same version of - // Node.js on OS X. - return void 0; - } - } - - /** - * Monkey patch operations that would make their argument - * non-extensible. - * - *

The monkey patched versions throw a TypeError if their - * argument is not an object, so it should only be done to functions - * that should throw a TypeError anyway if their argument is not an - * object. - */ - (function(){ - var oldFreeze = Object.freeze; - defProp(Object, 'freeze', { - value: function identifyingFreeze(obj) { - getHiddenRecord(obj); - return oldFreeze(obj); - } - }); - var oldSeal = Object.seal; - defProp(Object, 'seal', { - value: function identifyingSeal(obj) { - getHiddenRecord(obj); - return oldSeal(obj); - } - }); - var oldPreventExtensions = Object.preventExtensions; - defProp(Object, 'preventExtensions', { - value: function identifyingPreventExtensions(obj) { - getHiddenRecord(obj); - return oldPreventExtensions(obj); - } - }); - })(); - - function constFunc(func) { - func.prototype = null; - return Object.freeze(func); - } - - var calledAsFunctionWarningDone = false; - function calledAsFunctionWarning() { - // Future ES6 WeakMap is currently (2013-09-10) expected to reject WeakMap() - // but we used to permit it and do it ourselves, so warn only. - if (!calledAsFunctionWarningDone && typeof console !== 'undefined') { - calledAsFunctionWarningDone = true; - console.warn('WeakMap should be invoked as new WeakMap(), not ' + - 'WeakMap(). This will be an error in the future.'); - } - } - - var nextId = 0; - - var OurWeakMap = function() { - if (!(this instanceof OurWeakMap)) { // approximate test for new ...() - calledAsFunctionWarning(); - } - - // We are currently (12/25/2012) never encountering any prematurely - // non-extensible keys. - var keys = []; // brute force for prematurely non-extensible keys. - var values = []; // brute force for corresponding values. - var id = nextId++; - - function get___(key, opt_default) { - var index; - var hiddenRecord = getHiddenRecord(key); - if (hiddenRecord) { - return id in hiddenRecord ? hiddenRecord[id] : opt_default; - } else { - index = keys.indexOf(key); - return index >= 0 ? values[index] : opt_default; - } - } - - function has___(key) { - var hiddenRecord = getHiddenRecord(key); - if (hiddenRecord) { - return id in hiddenRecord; - } else { - return keys.indexOf(key) >= 0; - } - } - - function set___(key, value) { - var index; - var hiddenRecord = getHiddenRecord(key); - if (hiddenRecord) { - hiddenRecord[id] = value; - } else { - index = keys.indexOf(key); - if (index >= 0) { - values[index] = value; - } else { - // Since some browsers preemptively terminate slow turns but - // then continue computing with presumably corrupted heap - // state, we here defensively get keys.length first and then - // use it to update both the values and keys arrays, keeping - // them in sync. - index = keys.length; - values[index] = value; - // If we crash here, values will be one longer than keys. - keys[index] = key; - } - } - return this; - } - - function delete___(key) { - var hiddenRecord = getHiddenRecord(key); - var index, lastIndex; - if (hiddenRecord) { - return id in hiddenRecord && delete hiddenRecord[id]; - } else { - index = keys.indexOf(key); - if (index < 0) { - return false; - } - // Since some browsers preemptively terminate slow turns but - // then continue computing with potentially corrupted heap - // state, we here defensively get keys.length first and then use - // it to update both the keys and the values array, keeping - // them in sync. We update the two with an order of assignments, - // such that any prefix of these assignments will preserve the - // key/value correspondence, either before or after the delete. - // Note that this needs to work correctly when index === lastIndex. - lastIndex = keys.length - 1; - keys[index] = void 0; - // If we crash here, there's a void 0 in the keys array, but - // no operation will cause a "keys.indexOf(void 0)", since - // getHiddenRecord(void 0) will always throw an error first. - values[index] = values[lastIndex]; - // If we crash here, values[index] cannot be found here, - // because keys[index] is void 0. - keys[index] = keys[lastIndex]; - // If index === lastIndex and we crash here, then keys[index] - // is still void 0, since the aliasing killed the previous key. - keys.length = lastIndex; - // If we crash here, keys will be one shorter than values. - values.length = lastIndex; - return true; - } - } - - return Object.create(OurWeakMap.prototype, { - get___: { value: constFunc(get___) }, - has___: { value: constFunc(has___) }, - set___: { value: constFunc(set___) }, - delete___: { value: constFunc(delete___) } - }); - }; - - OurWeakMap.prototype = Object.create(Object.prototype, { - get: { - /** - * Return the value most recently associated with key, or - * opt_default if none. - */ - value: function get(key, opt_default) { - return this.get___(key, opt_default); - }, - writable: true, - configurable: true - }, - - has: { - /** - * Is there a value associated with key in this WeakMap? - */ - value: function has(key) { - return this.has___(key); - }, - writable: true, - configurable: true - }, - - set: { - /** - * Associate value with key in this WeakMap, overwriting any - * previous association if present. - */ - value: function set(key, value) { - return this.set___(key, value); - }, - writable: true, - configurable: true - }, - - 'delete': { - /** - * Remove any association for key in this WeakMap, returning - * whether there was one. - * - *

Note that the boolean return here does not work like the - * {@code delete} operator. The {@code delete} operator returns - * whether the deletion succeeds at bringing about a state in - * which the deleted property is absent. The {@code delete} - * operator therefore returns true if the property was already - * absent, whereas this {@code delete} method returns false if - * the association was already absent. - */ - value: function remove(key) { - return this.delete___(key); - }, - writable: true, - configurable: true - } - }); - - if (typeof HostWeakMap === 'function') { - (function() { - // If we got here, then the platform has a WeakMap but we are concerned - // that it may refuse to store some key types. Therefore, make a map - // implementation which makes use of both as possible. - - // In this mode we are always using double maps, so we are not proxy-safe. - // This combination does not occur in any known browser, but we had best - // be safe. - if (doubleWeakMapCheckSilentFailure && typeof Proxy !== 'undefined') { - Proxy = undefined; - } - - function DoubleWeakMap() { - if (!(this instanceof OurWeakMap)) { // approximate test for new ...() - calledAsFunctionWarning(); - } - - // Preferable, truly weak map. - var hmap = new HostWeakMap(); - - // Our hidden-property-based pseudo-weak-map. Lazily initialized in the - // 'set' implementation; thus we can avoid performing extra lookups if - // we know all entries actually stored are entered in 'hmap'. - var omap = undefined; - - // Hidden-property maps are not compatible with proxies because proxies - // can observe the hidden name and either accidentally expose it or fail - // to allow the hidden property to be set. Therefore, we do not allow - // arbitrary WeakMaps to switch to using hidden properties, but only - // those which need the ability, and unprivileged code is not allowed - // to set the flag. - // - // (Except in doubleWeakMapCheckSilentFailure mode in which case we - // disable proxies.) - var enableSwitching = false; - - function dget(key, opt_default) { - if (omap) { - return hmap.has(key) ? hmap.get(key) - : omap.get___(key, opt_default); - } else { - return hmap.get(key, opt_default); - } - } - - function dhas(key) { - return hmap.has(key) || (omap ? omap.has___(key) : false); - } - - var dset; - if (doubleWeakMapCheckSilentFailure) { - dset = function(key, value) { - hmap.set(key, value); - if (!hmap.has(key)) { - if (!omap) { omap = new OurWeakMap(); } - omap.set(key, value); - } - return this; - }; - } else { - dset = function(key, value) { - if (enableSwitching) { - try { - hmap.set(key, value); - } catch (e) { - if (!omap) { omap = new OurWeakMap(); } - omap.set___(key, value); - } - } else { - hmap.set(key, value); - } - return this; - }; - } - - function ddelete(key) { - var result = !!hmap['delete'](key); - if (omap) { return omap.delete___(key) || result; } - return result; - } - - return Object.create(OurWeakMap.prototype, { - get___: { value: constFunc(dget) }, - has___: { value: constFunc(dhas) }, - set___: { value: constFunc(dset) }, - delete___: { value: constFunc(ddelete) }, - permitHostObjects___: { value: constFunc(function(token) { - if (token === weakMapPermitHostObjects) { - enableSwitching = true; - } else { - throw new Error('bogus call to permitHostObjects___'); - } - })} - }); - } - DoubleWeakMap.prototype = OurWeakMap.prototype; - module.exports = DoubleWeakMap; - - // define .constructor to hide OurWeakMap ctor - Object.defineProperty(WeakMap.prototype, 'constructor', { - value: WeakMap, - enumerable: false, // as default .constructor is - configurable: true, - writable: true - }); - })(); - } else { - // There is no host WeakMap, so we must use the emulation. - - // Emulated WeakMaps are incompatible with native proxies (because proxies - // can observe the hidden name), so we must disable Proxy usage (in - // ArrayLike and Domado, currently). - if (typeof Proxy !== 'undefined') { - Proxy = undefined; - } - - module.exports = OurWeakMap; - } -})(); - -},{}],530:[function(_dereq_,module,exports){ -var hiddenStore = _dereq_('./hidden-store.js'); - -module.exports = createStore; - -function createStore() { - var key = {}; - - return function (obj) { - if ((typeof obj !== 'object' || obj === null) && - typeof obj !== 'function' - ) { - throw new Error('Weakmap-shim: Key must be object') - } - - var store = obj.valueOf(key); - return store && store.identity === key ? - store : hiddenStore(obj, key); - }; -} - -},{"./hidden-store.js":531}],531:[function(_dereq_,module,exports){ -module.exports = hiddenStore; - -function hiddenStore(obj, key) { - var store = { identity: key }; - var valueOf = obj.valueOf; - - Object.defineProperty(obj, "valueOf", { - value: function (value) { - return value !== key ? - valueOf.apply(this, arguments) : store; - }, - writable: true - }); - - return store; -} - -},{}],532:[function(_dereq_,module,exports){ -// Original - @Gozola. -// https://gist.github.com/Gozala/1269991 -// This is a reimplemented version (with a few bug fixes). - -var createStore = _dereq_('./create-store.js'); - -module.exports = weakMap; - -function weakMap() { - var privates = createStore(); - - return { - 'get': function (key, fallback) { - var store = privates(key) - return store.hasOwnProperty('value') ? - store.value : fallback - }, - 'set': function (key, value) { - privates(key).value = value; - return this; - }, - 'has': function(key) { - return 'value' in privates(key); - }, - 'delete': function (key) { - return delete privates(key).value; - } - } -} - -},{"./create-store.js":530}],533:[function(_dereq_,module,exports){ -var getContext = _dereq_('get-canvas-context') - -module.exports = function getWebGLContext (opt) { - return getContext('webgl', opt) -} - -},{"get-canvas-context":221}],534:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Traditional Chinese calendar for jQuery v2.0.2. - Written by Nicolas Riesco (enquiries@nicolasriesco.net) December 2016. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -var gregorianCalendar = main.instance(); - -/** Implementation of the traditional Chinese calendar. - Source of calendar tables https://github.com/isee15/Lunar-Solar-Calendar-Converter . - @class ChineseCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function ChineseCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -ChineseCalendar.prototype = new main.baseCalendar; - -assign(ChineseCalendar.prototype, { - /** The calendar name. - @memberof ChineseCalendar */ - name: 'Chinese', - /** Julian date of start of Gregorian epoch: 1 January 0001 CE. - @memberof GregorianCalendar */ - jdEpoch: 1721425.5, - /** true if has a year zero, false if not. - @memberof ChineseCalendar */ - hasYearZero: false, - /** The minimum month number. - This calendar uses month indices to account for intercalary months. - @memberof ChineseCalendar */ - minMonth: 0, - /** The first month in the year. - This calendar uses month indices to account for intercalary months. - @memberof ChineseCalendar */ - firstMonth: 0, - /** The minimum day number. - @memberof ChineseCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof ChineseCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Chinese', - epochs: ['BEC', 'EC'], - monthNumbers: function(date, padded) { - if (typeof date === 'string') { - var match = date.match(MONTH_NUMBER_REGEXP); - return (match) ? match[0] : ''; - } - - var year = this._validateYear(date); - var monthIndex = date.month(); - - var month = '' + this.toChineseMonth(year, monthIndex); - - if (padded && month.length < 2) { - month = "0" + month; - } - - if (this.isIntercalaryMonth(year, monthIndex)) { - month += 'i'; - } - - return month; - }, - monthNames: function(date) { - if (typeof date === 'string') { - var match = date.match(MONTH_NAME_REGEXP); - return (match) ? match[0] : ''; - } - - var year = this._validateYear(date); - var monthIndex = date.month(); - - var month = this.toChineseMonth(year, monthIndex); - - var monthName = ['一月','二月','三月','四月','五月','六月', - '七月','八月','九月','十月','十一月','十二月'][month - 1]; - - if (this.isIntercalaryMonth(year, monthIndex)) { - monthName = '闰' + monthName; - } - - return monthName; - }, - monthNamesShort: function(date) { - if (typeof date === 'string') { - var match = date.match(MONTH_SHORT_NAME_REGEXP); - return (match) ? match[0] : ''; - } - - var year = this._validateYear(date); - var monthIndex = date.month(); - - var month = this.toChineseMonth(year, monthIndex); - - var monthName = ['一','二','三','四','五','六', - '七','八','九','十','十一','十二'][month - 1]; - - if (this.isIntercalaryMonth(year, monthIndex)) { - monthName = '闰' + monthName; - } - - return monthName; - }, - parseMonth: function(year, monthString) { - year = this._validateYear(year); - var month = parseInt(monthString); - var isIntercalary; - - if (!isNaN(month)) { - var i = monthString[monthString.length - 1]; - isIntercalary = (i === 'i' || i === 'I'); - } else { - if (monthString[0] === '闰') { - isIntercalary = true; - monthString = monthString.substring(1); - } - if (monthString[monthString.length - 1] === '月') { - monthString = monthString.substring(0, monthString.length - 1); - } - month = 1 + - ['一','二','三','四','五','六', - '七','八','九','十','十一','十二'].indexOf(monthString); - } - - var monthIndex = this.toMonthIndex(year, month, isIntercalary); - return monthIndex; - }, - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - digits: null, - dateFormat: 'yyyy/mm/dd', - firstDay: 1, - isRTL: false - } - }, - - /** Check that a candidate date is from the same calendar and is valid. - @memberof BaseCalendar - @private - @param year {CDate|number} The date or the year to validate. - @param error {string} Error message if invalid. - @return {number} The year. - @throws Error if year out of range. */ - _validateYear: function(year, error) { - if (year.year) { - year = year.year(); - } - - if (typeof year !== 'number' || year < 1888 || year > 2111) { - throw error.replace(/\{0\}/, this.local.name); - } - - return year; - }, - - /** Retrieve the month index (i.e. accounting for intercalary months). - @memberof ChineseCalendar - @param year {number} The year. - @param month {number} The month (1 for first month). - @param [isIntercalary=false] {boolean} If month is intercalary. - @return {number} The month index (0 for first month). - @throws Error if an invalid month/year or a different calendar used. */ - toMonthIndex: function(year, month, isIntercalary) { - // compute intercalary month in the year (0 if none) - var intercalaryMonth = this.intercalaryMonth(year); - - // validate month - var invalidIntercalaryMonth = - (isIntercalary && month !== intercalaryMonth); - if (invalidIntercalaryMonth || month < 1 || month > 12) { - throw main.local.invalidMonth - .replace(/\{0\}/, this.local.name); - } - - // compute month index - var monthIndex; - - if (!intercalaryMonth) { - monthIndex = month - 1; - } else if(!isIntercalary && month <= intercalaryMonth) { - monthIndex = month - 1; - } else { - monthIndex = month; - } - - return monthIndex; - }, - - /** Retrieve the month (i.e. accounting for intercalary months). - @memberof ChineseCalendar - @param year {CDate|number} The date or the year to examine. - @param monthIndex {number} The month index (0 for first month). - @return {number} The month (1 for first month). - @throws Error if an invalid month/year or a different calendar used. */ - toChineseMonth: function(year, monthIndex) { - if (year.year) { - year = year.year(); - monthIndex = year.month(); - } - - // compute intercalary month in the year (0 if none) - var intercalaryMonth = this.intercalaryMonth(year); - - // validate month - var maxMonthIndex = (intercalaryMonth) ? 12 : 11; - if (monthIndex < 0 || monthIndex > maxMonthIndex) { - throw main.local.invalidMonth - .replace(/\{0\}/, this.local.name); - } - - // compute Chinese month - var month; - - if (!intercalaryMonth) { - month = monthIndex + 1; - } else if(monthIndex < intercalaryMonth) { - month = monthIndex + 1; - } else { - month = monthIndex; - } - - return month; - }, - - /** Determine the intercalary month of a year (if any). - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The intercalary month number, or 0 if none. - @throws Error if an invalid year or a different calendar used. */ - intercalaryMonth: function(year) { - year = this._validateYear(year); - - var monthDaysTable = LUNAR_MONTH_DAYS[year - LUNAR_MONTH_DAYS[0]]; - var intercalaryMonth = monthDaysTable >> 13; - - return intercalaryMonth; - }, - - /** Determine whether this date is an intercalary month. - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [monthIndex] {number} The month index to examine. - @return {boolean} true if this is an intercalary month, false if not. - @throws Error if an invalid year or a different calendar used. */ - isIntercalaryMonth: function(year, monthIndex) { - if (year.year) { - year = year.year(); - monthIndex = year.month(); - } - - var intercalaryMonth = this.intercalaryMonth(year); - - return !!intercalaryMonth && intercalaryMonth === monthIndex; - }, - - /** Determine whether this date is in a leap year. - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - return (this.intercalaryMonth(year) !== 0); - }, - - /** Determine the week of the year for a date - ISO 8601. - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [monthIndex] {number} The month index to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, monthIndex, day) { - // compute Chinese new year - var validatedYear = - this._validateYear(year, main.local.invalidyear); - var packedDate = - CHINESE_NEW_YEAR[validatedYear - CHINESE_NEW_YEAR[0]]; - - var y = (packedDate >> 9) & 0xFFF; - var m = (packedDate >> 5) & 0x0F; - var d = packedDate & 0x1F; - - // find first Thrusday of the year - var firstThursday; - firstThursday = gregorianCalendar.newDate(y, m, d); - firstThursday.add(4 - (firstThursday.dayOfWeek() || 7), 'd'); - - // compute days from first Thursday - var offset = - this.toJD(year, monthIndex, day) - firstThursday.toJD(); - return 1 + Math.floor(offset / 7); - }, - - /** Retrieve the number of months in a year. - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - return (this.leapYear(year)) ? 13 : 12; - }, - - /** Retrieve the number of days in a month. - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [monthIndex] {number} The month index. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, monthIndex) { - if (year.year) { - monthIndex = year.month(); - year = year.year(); - } - - year = this._validateYear(year); - - var monthDaysTable = LUNAR_MONTH_DAYS[year - LUNAR_MONTH_DAYS[0]]; - - var intercalaryMonth = monthDaysTable >> 13; - var maxMonthIndex = (intercalaryMonth) ? 12 : 11; - if (monthIndex > maxMonthIndex) { - throw main.local.invalidMonth - .replace(/\{0\}/, this.local.name); - } - - var daysInMonth = (monthDaysTable & (1 << (12 - monthIndex))) ? - 30 : 29; - - return daysInMonth; - }, - - /** Determine whether this date is a week day. - @memberof ChineseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [monthIndex] {number} The month index to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, monthIndex, day) { - return (this.dayOfWeek(year, monthIndex, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof ChineseCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [monthIndex] {number} The month index to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, monthIndex, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = this._validateYear(date.year()); - monthIndex = date.month(); - day = date.day(); - - var isIntercalary = this.isIntercalaryMonth(year, monthIndex); - var month = this.toChineseMonth(year, monthIndex); - - var solar = toSolar(year, month, day, isIntercalary); - - return gregorianCalendar.toJD(solar.year, solar.month, solar.day); - }, - - /** Create a new date from a Julian date. - @memberof ChineseCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - var date = gregorianCalendar.fromJD(jd); - var lunar = toLunar(date.year(), date.month(), date.day()); - var monthIndex = this.toMonthIndex( - lunar.year, lunar.month, lunar.isIntercalary); - return this.newDate(lunar.year, monthIndex, lunar.day); - }, - - /** Create a new date from a string. - @memberof ChineseCalendar - @param dateString {string} String representing a Chinese date - @return {CDate} The new date. - @throws Error if an invalid date. */ - fromString: function(dateString) { - var match = dateString.match(DATE_REGEXP); - - var year = this._validateYear(+match[1]); - - var month = +match[2]; - var isIntercalary = !!match[3]; - var monthIndex = this.toMonthIndex(year, month, isIntercalary); - - var day = +match[4]; - - return this.newDate(year, monthIndex, day); - }, - - /** Add period(s) to a date. - Cater for no year zero. - @memberof ChineseCalendar - @param date {CDate} The starting date. - @param offset {number} The number of periods to adjust by. - @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day. - @return {CDate} The updated date. - @throws Error if a different calendar used. */ - add: function(date, offset, period) { - var year = date.year(); - var monthIndex = date.month(); - var isIntercalary = this.isIntercalaryMonth(year, monthIndex); - var month = this.toChineseMonth(year, monthIndex); - - var cdate = Object.getPrototypeOf(ChineseCalendar.prototype) - .add.call(this, date, offset, period); - - if (period === 'y') { - // Resync month - var resultYear = cdate.year(); - var resultMonthIndex = cdate.month(); - - // Using the fact the month index of an intercalary month - // equals its month number: - var resultCanBeIntercalaryMonth = - this.isIntercalaryMonth(resultYear, month); - - var correctedMonthIndex = - (isIntercalary && resultCanBeIntercalaryMonth) ? - this.toMonthIndex(resultYear, month, true) : - this.toMonthIndex(resultYear, month, false); - - if (correctedMonthIndex !== resultMonthIndex) { - cdate.month(correctedMonthIndex); - } - } - - return cdate; - }, -}); - -// Used by ChineseCalendar.prototype.fromString -var DATE_REGEXP = /^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m; -var MONTH_NUMBER_REGEXP = /^\d?\d[iI]?/m; -var MONTH_NAME_REGEXP = /^闰?十?[一二三四五六七八九]?月/m; -var MONTH_SHORT_NAME_REGEXP = /^闰?十?[一二三四五六七八九]?/m; - -// Chinese calendar implementation -main.calendars.chinese = ChineseCalendar; - -// Chinese calendar tables from year 1888 to 2111 -// -// Source: -// https://github.com/isee15/Lunar-Solar-Calendar-Converter.git - -// Table of intercalary months and days per month from year 1888 to 2111 -// -// bit (12 - i): days in the i^th month -// (= 0 if i^th lunar month has 29 days) -// (= 1 if i^th lunar month has 30 days) -// (first month in lunar year is i = 0) -// bits (13,14,15,16): intercalary month -// (= 0 if lunar year has no intercalary month) -var LUNAR_MONTH_DAYS = [1887, 0x1694, 0x16aa, 0x4ad5, - 0xab6, 0xc4b7, 0x4ae, 0xa56, 0xb52a, 0x1d2a, 0xd54, 0x75aa, 0x156a, - 0x1096d, 0x95c, 0x14ae, 0xaa4d, 0x1a4c, 0x1b2a, 0x8d55, 0xad4, - 0x135a, 0x495d, 0x95c, 0xd49b, 0x149a, 0x1a4a, 0xbaa5, 0x16a8, - 0x1ad4, 0x52da, 0x12b6, 0xe937, 0x92e, 0x1496, 0xb64b, 0xd4a, - 0xda8, 0x95b5, 0x56c, 0x12ae, 0x492f, 0x92e, 0xcc96, 0x1a94, - 0x1d4a, 0xada9, 0xb5a, 0x56c, 0x726e, 0x125c, 0xf92d, 0x192a, - 0x1a94, 0xdb4a, 0x16aa, 0xad4, 0x955b, 0x4ba, 0x125a, 0x592b, - 0x152a, 0xf695, 0xd94, 0x16aa, 0xaab5, 0x9b4, 0x14b6, 0x6a57, - 0xa56, 0x1152a, 0x1d2a, 0xd54, 0xd5aa, 0x156a, 0x96c, 0x94ae, - 0x14ae, 0xa4c, 0x7d26, 0x1b2a, 0xeb55, 0xad4, 0x12da, 0xa95d, - 0x95a, 0x149a, 0x9a4d, 0x1a4a, 0x11aa5, 0x16a8, 0x16d4, 0xd2da, - 0x12b6, 0x936, 0x9497, 0x1496, 0x1564b, 0xd4a, 0xda8, 0xd5b4, - 0x156c, 0x12ae, 0xa92f, 0x92e, 0xc96, 0x6d4a, 0x1d4a, 0x10d65, - 0xb58, 0x156c, 0xb26d, 0x125c, 0x192c, 0x9a95, 0x1a94, 0x1b4a, - 0x4b55, 0xad4, 0xf55b, 0x4ba, 0x125a, 0xb92b, 0x152a, 0x1694, - 0x96aa, 0x15aa, 0x12ab5, 0x974, 0x14b6, 0xca57, 0xa56, 0x1526, - 0x8e95, 0xd54, 0x15aa, 0x49b5, 0x96c, 0xd4ae, 0x149c, 0x1a4c, - 0xbd26, 0x1aa6, 0xb54, 0x6d6a, 0x12da, 0x1695d, 0x95a, 0x149a, - 0xda4b, 0x1a4a, 0x1aa4, 0xbb54, 0x16b4, 0xada, 0x495b, 0x936, - 0xf497, 0x1496, 0x154a, 0xb6a5, 0xda4, 0x15b4, 0x6ab6, 0x126e, - 0x1092f, 0x92e, 0xc96, 0xcd4a, 0x1d4a, 0xd64, 0x956c, 0x155c, - 0x125c, 0x792e, 0x192c, 0xfa95, 0x1a94, 0x1b4a, 0xab55, 0xad4, - 0x14da, 0x8a5d, 0xa5a, 0x1152b, 0x152a, 0x1694, 0xd6aa, 0x15aa, - 0xab4, 0x94ba, 0x14b6, 0xa56, 0x7527, 0xd26, 0xee53, 0xd54, 0x15aa, - 0xa9b5, 0x96c, 0x14ae, 0x8a4e, 0x1a4c, 0x11d26, 0x1aa4, 0x1b54, - 0xcd6a, 0xada, 0x95c, 0x949d, 0x149a, 0x1a2a, 0x5b25, 0x1aa4, - 0xfb52, 0x16b4, 0xaba, 0xa95b, 0x936, 0x1496, 0x9a4b, 0x154a, - 0x136a5, 0xda4, 0x15ac]; - -// Table of Chinese New Years from year 1888 to 2111 -// -// bits (0 to 4): solar day -// bits (5 to 8): solar month -// bits (9 to 20): solar year -var CHINESE_NEW_YEAR = [1887, 0xec04c, 0xec23f, 0xec435, 0xec649, - 0xec83e, 0xeca51, 0xecc46, 0xece3a, 0xed04d, 0xed242, 0xed436, - 0xed64a, 0xed83f, 0xeda53, 0xedc48, 0xede3d, 0xee050, 0xee244, - 0xee439, 0xee64d, 0xee842, 0xeea36, 0xeec4a, 0xeee3e, 0xef052, - 0xef246, 0xef43a, 0xef64e, 0xef843, 0xefa37, 0xefc4b, 0xefe41, - 0xf0054, 0xf0248, 0xf043c, 0xf0650, 0xf0845, 0xf0a38, 0xf0c4d, - 0xf0e42, 0xf1037, 0xf124a, 0xf143e, 0xf1651, 0xf1846, 0xf1a3a, - 0xf1c4e, 0xf1e44, 0xf2038, 0xf224b, 0xf243f, 0xf2653, 0xf2848, - 0xf2a3b, 0xf2c4f, 0xf2e45, 0xf3039, 0xf324d, 0xf3442, 0xf3636, - 0xf384a, 0xf3a3d, 0xf3c51, 0xf3e46, 0xf403b, 0xf424e, 0xf4443, - 0xf4638, 0xf484c, 0xf4a3f, 0xf4c52, 0xf4e48, 0xf503c, 0xf524f, - 0xf5445, 0xf5639, 0xf584d, 0xf5a42, 0xf5c35, 0xf5e49, 0xf603e, - 0xf6251, 0xf6446, 0xf663b, 0xf684f, 0xf6a43, 0xf6c37, 0xf6e4b, - 0xf703f, 0xf7252, 0xf7447, 0xf763c, 0xf7850, 0xf7a45, 0xf7c39, - 0xf7e4d, 0xf8042, 0xf8254, 0xf8449, 0xf863d, 0xf8851, 0xf8a46, - 0xf8c3b, 0xf8e4f, 0xf9044, 0xf9237, 0xf944a, 0xf963f, 0xf9853, - 0xf9a47, 0xf9c3c, 0xf9e50, 0xfa045, 0xfa238, 0xfa44c, 0xfa641, - 0xfa836, 0xfaa49, 0xfac3d, 0xfae52, 0xfb047, 0xfb23a, 0xfb44e, - 0xfb643, 0xfb837, 0xfba4a, 0xfbc3f, 0xfbe53, 0xfc048, 0xfc23c, - 0xfc450, 0xfc645, 0xfc839, 0xfca4c, 0xfcc41, 0xfce36, 0xfd04a, - 0xfd23d, 0xfd451, 0xfd646, 0xfd83a, 0xfda4d, 0xfdc43, 0xfde37, - 0xfe04b, 0xfe23f, 0xfe453, 0xfe648, 0xfe83c, 0xfea4f, 0xfec44, - 0xfee38, 0xff04c, 0xff241, 0xff436, 0xff64a, 0xff83e, 0xffa51, - 0xffc46, 0xffe3a, 0x10004e, 0x100242, 0x100437, 0x10064b, 0x100841, - 0x100a53, 0x100c48, 0x100e3c, 0x10104f, 0x101244, 0x101438, - 0x10164c, 0x101842, 0x101a35, 0x101c49, 0x101e3d, 0x102051, - 0x102245, 0x10243a, 0x10264e, 0x102843, 0x102a37, 0x102c4b, - 0x102e3f, 0x103053, 0x103247, 0x10343b, 0x10364f, 0x103845, - 0x103a38, 0x103c4c, 0x103e42, 0x104036, 0x104249, 0x10443d, - 0x104651, 0x104846, 0x104a3a, 0x104c4e, 0x104e43, 0x105038, - 0x10524a, 0x10543e, 0x105652, 0x105847, 0x105a3b, 0x105c4f, - 0x105e45, 0x106039, 0x10624c, 0x106441, 0x106635, 0x106849, - 0x106a3d, 0x106c51, 0x106e47, 0x10703c, 0x10724f, 0x107444, - 0x107638, 0x10784c, 0x107a3f, 0x107c53, 0x107e48]; - -function toLunar(yearOrDate, monthOrResult, day, result) { - var solarDate; - var lunarDate; - - if(typeof yearOrDate === 'object') { - solarDate = yearOrDate; - lunarDate = monthOrResult || {}; - - } else { - var isValidYear = (typeof yearOrDate === 'number') && - (yearOrDate >= 1888) && (yearOrDate <= 2111); - if(!isValidYear) - throw new Error("Solar year outside range 1888-2111"); - - var isValidMonth = (typeof monthOrResult === 'number') && - (monthOrResult >= 1) && (monthOrResult <= 12); - if(!isValidMonth) - throw new Error("Solar month outside range 1 - 12"); - - var isValidDay = (typeof day === 'number') && (day >= 1) && (day <= 31); - if(!isValidDay) - throw new Error("Solar day outside range 1 - 31"); - - solarDate = { - year: yearOrDate, - month: monthOrResult, - day: day, - }; - lunarDate = result || {}; - } - - // Compute Chinese new year and lunar year - var chineseNewYearPackedDate = - CHINESE_NEW_YEAR[solarDate.year - CHINESE_NEW_YEAR[0]]; - - var packedDate = (solarDate.year << 9) | (solarDate.month << 5) - | solarDate.day; - - lunarDate.year = (packedDate >= chineseNewYearPackedDate) ? - solarDate.year : - solarDate.year - 1; - - chineseNewYearPackedDate = - CHINESE_NEW_YEAR[lunarDate.year - CHINESE_NEW_YEAR[0]]; - - var y = (chineseNewYearPackedDate >> 9) & 0xFFF; - var m = (chineseNewYearPackedDate >> 5) & 0x0F; - var d = chineseNewYearPackedDate & 0x1F; - - // Compute days from new year - var daysFromNewYear; - - var chineseNewYearJSDate = new Date(y, m -1, d); - var jsDate = new Date(solarDate.year, solarDate.month - 1, solarDate.day); - - daysFromNewYear = Math.round( - (jsDate - chineseNewYearJSDate) / (24 * 3600 * 1000)); - - // Compute lunar month and day - var monthDaysTable = LUNAR_MONTH_DAYS[lunarDate.year - LUNAR_MONTH_DAYS[0]]; - - var i; - for(i = 0; i < 13; i++) { - var daysInMonth = (monthDaysTable & (1 << (12 - i))) ? 30 : 29; - - if (daysFromNewYear < daysInMonth) { - break; - } - - daysFromNewYear -= daysInMonth; - } - - var intercalaryMonth = monthDaysTable >> 13; - if (!intercalaryMonth || i < intercalaryMonth) { - lunarDate.isIntercalary = false; - lunarDate.month = 1 + i; - } else if (i === intercalaryMonth) { - lunarDate.isIntercalary = true; - lunarDate.month = i; - } else { - lunarDate.isIntercalary = false; - lunarDate.month = i; - } - - lunarDate.day = 1 + daysFromNewYear; - - return lunarDate; -} - -function toSolar(yearOrDate, monthOrResult, day, isIntercalaryOrResult, result) { - var solarDate; - var lunarDate; - - if(typeof yearOrDate === 'object') { - lunarDate = yearOrDate; - solarDate = monthOrResult || {}; - - } else { - var isValidYear = (typeof yearOrDate === 'number') && - (yearOrDate >= 1888) && (yearOrDate <= 2111); - if(!isValidYear) - throw new Error("Lunar year outside range 1888-2111"); - - var isValidMonth = (typeof monthOrResult === 'number') && - (monthOrResult >= 1) && (monthOrResult <= 12); - if(!isValidMonth) - throw new Error("Lunar month outside range 1 - 12"); - - var isValidDay = (typeof day === 'number') && (day >= 1) && (day <= 30); - if(!isValidDay) - throw new Error("Lunar day outside range 1 - 30"); - - var isIntercalary; - if(typeof isIntercalaryOrResult === 'object') { - isIntercalary = false; - solarDate = isIntercalaryOrResult; - } else { - isIntercalary = !!isIntercalaryOrResult; - solarDate = result || {}; - } - - lunarDate = { - year: yearOrDate, - month: monthOrResult, - day: day, - isIntercalary: isIntercalary, - }; - } - - // Compute days from new year - var daysFromNewYear; - - daysFromNewYear = lunarDate.day - 1; - - var monthDaysTable = LUNAR_MONTH_DAYS[lunarDate.year - LUNAR_MONTH_DAYS[0]]; - var intercalaryMonth = monthDaysTable >> 13; - - var monthsFromNewYear; - if (!intercalaryMonth) { - monthsFromNewYear = lunarDate.month - 1; - } else if (lunarDate.month > intercalaryMonth) { - monthsFromNewYear = lunarDate.month; - } else if (lunarDate.isIntercalary) { - monthsFromNewYear = lunarDate.month; - } else { - monthsFromNewYear = lunarDate.month - 1; - } - - for(var i = 0; i < monthsFromNewYear; i++) { - var daysInMonth = (monthDaysTable & (1 << (12 - i))) ? 30 : 29; - daysFromNewYear += daysInMonth; - } - - // Compute Chinese new year - var packedDate = CHINESE_NEW_YEAR[lunarDate.year - CHINESE_NEW_YEAR[0]]; - - var y = (packedDate >> 9) & 0xFFF; - var m = (packedDate >> 5) & 0x0F; - var d = packedDate & 0x1F; - - // Compute solar date - var jsDate = new Date(y, m - 1, d + daysFromNewYear); - - solarDate.year = jsDate.getFullYear(); - solarDate.month = 1 + jsDate.getMonth(); - solarDate.day = jsDate.getDate(); - - return solarDate; -} - - -},{"../main":548,"object-assign":437}],535:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Coptic calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) February 2010. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Coptic calendar. - See http://en.wikipedia.org/wiki/Coptic_calendar. - See also Calendrical Calculations: The Millennium Edition - (http://emr.cs.iit.edu/home/reingold/calendar-book/index.shtml). - @class CopticCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function CopticCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -CopticCalendar.prototype = new main.baseCalendar; - -assign(CopticCalendar.prototype, { - /** The calendar name. - @memberof CopticCalendar */ - name: 'Coptic', - /** Julian date of start of Coptic epoch: 29 August 284 CE (Gregorian). - @memberof CopticCalendar */ - jdEpoch: 1825029.5, - /** Days per month in a common year. - @memberof CopticCalendar */ - daysPerMonth: [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 5], - /** true if has a year zero, false if not. - @memberof CopticCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof CopticCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof CopticCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof CopticCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof CopticCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Coptic', - epochs: ['BAM', 'AM'], - monthNames: ['Thout', 'Paopi', 'Hathor', 'Koiak', 'Tobi', 'Meshir', - 'Paremhat', 'Paremoude', 'Pashons', 'Paoni', 'Epip', 'Mesori', 'Pi Kogi Enavot'], - monthNamesShort: ['Tho', 'Pao', 'Hath', 'Koi', 'Tob', 'Mesh', - 'Pat', 'Pad', 'Pash', 'Pao', 'Epi', 'Meso', 'PiK'], - dayNames: ['Tkyriaka', 'Pesnau', 'Pshoment', 'Peftoou', 'Ptiou', 'Psoou', 'Psabbaton'], - dayNamesShort: ['Tky', 'Pes', 'Psh', 'Pef', 'Pti', 'Pso', 'Psa'], - dayNamesMin: ['Tk', 'Pes', 'Psh', 'Pef', 'Pt', 'Pso', 'Psa'], - digits: null, - dateFormat: 'dd/mm/yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof CopticCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = date.year() + (date.year() < 0 ? 1 : 0); // No year zero - return year % 4 === 3 || year % 4 === -1; - }, - - /** Retrieve the number of months in a year. - @memberof CopticCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, - main.local.invalidYear || main.regionalOptions[''].invalidYear); - return 13; - }, - - /** Determine the week of the year for a date. - @memberof CopticCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number) the month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof CopticCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 13 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof CopticCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param month {number} The month to examine. - @param day {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof CopticCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number) the month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year(); - if (year < 0) { year++; } // No year zero - return date.day() + (date.month() - 1) * 30 + - (year - 1) * 365 + Math.floor(year / 4) + this.jdEpoch - 1; - }, - - /** Create a new date from a Julian date. - @memberof CopticCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - var c = Math.floor(jd) + 0.5 - this.jdEpoch; - var year = Math.floor((c - Math.floor((c + 366) / 1461)) / 365) + 1; - if (year <= 0) { year--; } // No year zero - c = Math.floor(jd) + 0.5 - this.newDate(year, 1, 1).toJD(); - var month = Math.floor(c / 30) + 1; - var day = c - (month - 1) * 30 + 1; - return this.newDate(year, month, day); - } -}); - -// Coptic calendar implementation -main.calendars.coptic = CopticCalendar; - - -},{"../main":548,"object-assign":437}],536:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Discworld calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) January 2016. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Discworld calendar - Unseen University version. - See also http://wiki.lspace.org/mediawiki/Discworld_calendar - and http://discworld.wikia.com/wiki/Discworld_calendar. - @class DiscworldCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function DiscworldCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -DiscworldCalendar.prototype = new main.baseCalendar; - -assign(DiscworldCalendar.prototype, { - /** The calendar name. - @memberof DiscworldCalendar */ - name: 'Discworld', - /** Julian date of start of Discworld epoch: 1 January 0001 CE. - @memberof DiscworldCalendar */ - jdEpoch: 1721425.5, - /** Days per month in a common year. - @memberof DiscworldCalendar */ - daysPerMonth: [16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32], - /** true if has a year zero, false if not. - @memberof DiscworldCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof DiscworldCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof DiscworldCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof DiscworldCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof DiscworldCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Discworld', - epochs: ['BUC', 'UC'], - monthNames: ['Ick', 'Offle', 'February', 'March', 'April', 'May', 'June', - 'Grune', 'August', 'Spune', 'Sektober', 'Ember', 'December'], - monthNamesShort: ['Ick', 'Off', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Gru', 'Aug', 'Spu', 'Sek', 'Emb', 'Dec'], - dayNames: ['Sunday', 'Octeday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - dayNamesShort: ['Sun', 'Oct', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - dayNamesMin: ['Su', 'Oc', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - digits: null, - dateFormat: 'yyyy/mm/dd', - firstDay: 2, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return false; - }, - - /** Retrieve the number of months in a year. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return 13; - }, - - /** Retrieve the number of days in a year. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return 400; - }, - - /** Determine the week of the year for a date. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 8) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1]; - }, - - /** Retrieve the number of days in a week. - @memberof DiscworldCalendar - @return {number} The number of days. */ - daysInWeek: function() { - return 8; - }, - - /** Retrieve the day of the week for a date. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The day of the week: 0 to number of days - 1. - @throws Error if an invalid date or a different calendar used. */ - dayOfWeek: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - return (date.day() + 1) % 8; - }, - - /** Determine whether this date is a week day. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - var dow = this.dayOfWeek(year, month, day); - return (dow >= 2 && dow <= 6); - }, - - /** Retrieve additional information about a date. - @memberof DiscworldCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {object} Additional information - contents depends on calendar. - @throws Error if an invalid date or a different calendar used. */ - extraInfo: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - return {century: centuries[Math.floor((date.year() - 1) / 100) + 1] || ''}; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof DiscworldCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year() + (date.year() < 0 ? 1 : 0); - month = date.month(); - day = date.day(); - return day + (month > 1 ? 16 : 0) + (month > 2 ? (month - 2) * 32 : 0) + - (year - 1) * 400 + this.jdEpoch - 1; - }, - - /** Create a new date from a Julian date. - @memberof DiscworldCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - jd = Math.floor(jd + 0.5) - Math.floor(this.jdEpoch) - 1; - var year = Math.floor(jd / 400) + 1; - jd -= (year - 1) * 400; - jd += (jd > 15 ? 16 : 0); - var month = Math.floor(jd / 32) + 1; - var day = jd - (month - 1) * 32 + 1; - return this.newDate(year <= 0 ? year - 1 : year, month, day); - } -}); - -// Names of the centuries -var centuries = { - 20: 'Fruitbat', - 21: 'Anchovy' -}; - -// Discworld calendar implementation -main.calendars.discworld = DiscworldCalendar; - - -},{"../main":548,"object-assign":437}],537:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Ethiopian calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) February 2010. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Ethiopian calendar. - See http://en.wikipedia.org/wiki/Ethiopian_calendar. - See also Calendrical Calculations: The Millennium Edition - (http://emr.cs.iit.edu/home/reingold/calendar-book/index.shtml). - @class EthiopianCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function EthiopianCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -EthiopianCalendar.prototype = new main.baseCalendar; - -assign(EthiopianCalendar.prototype, { - /** The calendar name. - @memberof EthiopianCalendar */ - name: 'Ethiopian', - /** Julian date of start of Ethiopian epoch: 27 August 8 CE (Gregorian). - @memberof EthiopianCalendar */ - jdEpoch: 1724220.5, - /** Days per month in a common year. - @memberof EthiopianCalendar */ - daysPerMonth: [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 5], - /** true if has a year zero, false if not. - @memberof EthiopianCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof EthiopianCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof EthiopianCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof EthiopianCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof EthiopianCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Ethiopian', - epochs: ['BEE', 'EE'], - monthNames: ['Meskerem', 'Tikemet', 'Hidar', 'Tahesas', 'Tir', 'Yekatit', - 'Megabit', 'Miazia', 'Genbot', 'Sene', 'Hamle', 'Nehase', 'Pagume'], - monthNamesShort: ['Mes', 'Tik', 'Hid', 'Tah', 'Tir', 'Yek', - 'Meg', 'Mia', 'Gen', 'Sen', 'Ham', 'Neh', 'Pag'], - dayNames: ['Ehud', 'Segno', 'Maksegno', 'Irob', 'Hamus', 'Arb', 'Kidame'], - dayNamesShort: ['Ehu', 'Seg', 'Mak', 'Iro', 'Ham', 'Arb', 'Kid'], - dayNamesMin: ['Eh', 'Se', 'Ma', 'Ir', 'Ha', 'Ar', 'Ki'], - digits: null, - dateFormat: 'dd/mm/yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof EthiopianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = date.year() + (date.year() < 0 ? 1 : 0); // No year zero - return year % 4 === 3 || year % 4 === -1; - }, - - /** Retrieve the number of months in a year. - @memberof EthiopianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, - main.local.invalidYear || main.regionalOptions[''].invalidYear); - return 13; - }, - - /** Determine the week of the year for a date. - @memberof EthiopianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof EthiopianCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 13 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof EthiopianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof EthiopianCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year(); - if (year < 0) { year++; } // No year zero - return date.day() + (date.month() - 1) * 30 + - (year - 1) * 365 + Math.floor(year / 4) + this.jdEpoch - 1; - }, - - /** Create a new date from a Julian date. - @memberof EthiopianCalendar - @param jd {number} the Julian date to convert. - @return {CDate} the equivalent date. */ - fromJD: function(jd) { - var c = Math.floor(jd) + 0.5 - this.jdEpoch; - var year = Math.floor((c - Math.floor((c + 366) / 1461)) / 365) + 1; - if (year <= 0) { year--; } // No year zero - c = Math.floor(jd) + 0.5 - this.newDate(year, 1, 1).toJD(); - var month = Math.floor(c / 30) + 1; - var day = c - (month - 1) * 30 + 1; - return this.newDate(year, month, day); - } -}); - -// Ethiopian calendar implementation -main.calendars.ethiopian = EthiopianCalendar; - - -},{"../main":548,"object-assign":437}],538:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Hebrew calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Hebrew civil calendar. - Based on code from http://www.fourmilab.ch/documents/calendar/. - See also http://en.wikipedia.org/wiki/Hebrew_calendar. - @class HebrewCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function HebrewCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -HebrewCalendar.prototype = new main.baseCalendar; - -assign(HebrewCalendar.prototype, { - /** The calendar name. - @memberof HebrewCalendar */ - name: 'Hebrew', - /** Julian date of start of Hebrew epoch: 7 October 3761 BCE. - @memberof HebrewCalendar */ - jdEpoch: 347995.5, - /** Days per month in a common year. - @memberof HebrewCalendar */ - daysPerMonth: [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 29], - /** true if has a year zero, false if not. - @memberof HebrewCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof HebrewCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof HebrewCalendar */ - firstMonth: 7, - /** The minimum day number. - @memberof HebrewCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof HebrewCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Hebrew', - epochs: ['BAM', 'AM'], - monthNames: ['Nisan', 'Iyar', 'Sivan', 'Tammuz', 'Av', 'Elul', - 'Tishrei', 'Cheshvan', 'Kislev', 'Tevet', 'Shevat', 'Adar', 'Adar II'], - monthNamesShort: ['Nis', 'Iya', 'Siv', 'Tam', 'Av', 'Elu', 'Tis', 'Che', 'Kis', 'Tev', 'She', 'Ada', 'Ad2'], - dayNames: ['Yom Rishon', 'Yom Sheni', 'Yom Shlishi', 'Yom Revi\'i', 'Yom Chamishi', 'Yom Shishi', 'Yom Shabbat'], - dayNamesShort: ['Ris', 'She', 'Shl', 'Rev', 'Cha', 'Shi', 'Sha'], - dayNamesMin: ['Ri','She','Shl','Re','Ch','Shi','Sha'], - digits: null, - dateFormat: 'dd/mm/yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return this._leapYear(date.year()); - }, - - /** Determine whether this date is in a leap year. - @memberof HebrewCalendar - @private - @param year {number} The year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - _leapYear: function(year) { - year = (year < 0 ? year + 1 : year); - return mod(year * 7 + 1, 19) < 7; - }, - - /** Retrieve the number of months in a year. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return this._leapYear(year.year ? year.year() : year) ? 13 : 12; - }, - - /** Determine the week of the year for a date. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a year. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - year = date.year(); - return this.toJD((year === -1 ? +1 : year + 1), 7, 1) - this.toJD(year, 7, 1); - }, - - /** Retrieve the number of days in a month. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - if (year.year) { - month = year.month(); - year = year.year(); - } - this._validate(year, month, this.minDay, main.local.invalidMonth); - return (month === 12 && this.leapYear(year) ? 30 : // Adar I - (month === 8 && mod(this.daysInYear(year), 10) === 5 ? 30 : // Cheshvan in shlemah year - (month === 9 && mod(this.daysInYear(year), 10) === 3 ? 29 : // Kislev in chaserah year - this.daysPerMonth[month - 1]))); - }, - - /** Determine whether this date is a week day. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return this.dayOfWeek(year, month, day) !== 6; - }, - - /** Retrieve additional information about a date - year type. - @memberof HebrewCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {object} Additional information - contents depends on calendar. - @throws Error if an invalid date or a different calendar used. */ - extraInfo: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - return {yearType: (this.leapYear(date) ? 'embolismic' : 'common') + ' ' + - ['deficient', 'regular', 'complete'][this.daysInYear(date) % 10 - 3]}; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof HebrewCalendar - @param year {CDate)|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year(); - month = date.month(); - day = date.day(); - var adjYear = (year <= 0 ? year + 1 : year); - var jd = this.jdEpoch + this._delay1(adjYear) + - this._delay2(adjYear) + day + 1; - if (month < 7) { - for (var m = 7; m <= this.monthsInYear(year); m++) { - jd += this.daysInMonth(year, m); - } - for (var m = 1; m < month; m++) { - jd += this.daysInMonth(year, m); - } - } - else { - for (var m = 7; m < month; m++) { - jd += this.daysInMonth(year, m); - } - } - return jd; - }, - - /** Test for delay of start of new year and to avoid - Sunday, Wednesday, or Friday as start of the new year. - @memberof HebrewCalendar - @private - @param year {number} The year to examine. - @return {number} The days to offset by. */ - _delay1: function(year) { - var months = Math.floor((235 * year - 234) / 19); - var parts = 12084 + 13753 * months; - var day = months * 29 + Math.floor(parts / 25920); - if (mod(3 * (day + 1), 7) < 3) { - day++; - } - return day; - }, - - /** Check for delay in start of new year due to length of adjacent years. - @memberof HebrewCalendar - @private - @param year {number} The year to examine. - @return {number} The days to offset by. */ - _delay2: function(year) { - var last = this._delay1(year - 1); - var present = this._delay1(year); - var next = this._delay1(year + 1); - return ((next - present) === 356 ? 2 : ((present - last) === 382 ? 1 : 0)); - }, - - /** Create a new date from a Julian date. - @memberof HebrewCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - jd = Math.floor(jd) + 0.5; - var year = Math.floor(((jd - this.jdEpoch) * 98496.0) / 35975351.0) - 1; - while (jd >= this.toJD((year === -1 ? +1 : year + 1), 7, 1)) { - year++; - } - var month = (jd < this.toJD(year, 1, 1)) ? 7 : 1; - while (jd > this.toJD(year, month, this.daysInMonth(year, month))) { - month++; - } - var day = jd - this.toJD(year, month, 1) + 1; - return this.newDate(year, month, day); - } -}); - -// Modulus function which works for non-integers. -function mod(a, b) { - return a - (b * Math.floor(a / b)); -} - -// Hebrew calendar implementation -main.calendars.hebrew = HebrewCalendar; - - -},{"../main":548,"object-assign":437}],539:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Islamic calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Islamic or '16 civil' calendar. - Based on code from http://www.iranchamber.com/calendar/converter/iranian_calendar_converter.php. - See also http://en.wikipedia.org/wiki/Islamic_calendar. - @class IslamicCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function IslamicCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -IslamicCalendar.prototype = new main.baseCalendar; - -assign(IslamicCalendar.prototype, { - /** The calendar name. - @memberof IslamicCalendar */ - name: 'Islamic', - /** Julian date of start of Islamic epoch: 16 July 622 CE. - @memberof IslamicCalendar */ - jdEpoch: 1948439.5, - /** Days per month in a common year. - @memberof IslamicCalendar */ - daysPerMonth: [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29], - /** true if has a year zero, false if not. - @memberof IslamicCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof IslamicCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof IslamicCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof IslamicCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof IslamicCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Islamic', - epochs: ['BH', 'AH'], - monthNames: ['Muharram', 'Safar', 'Rabi\' al-awwal', 'Rabi\' al-thani', 'Jumada al-awwal', 'Jumada al-thani', - 'Rajab', 'Sha\'aban', 'Ramadan', 'Shawwal', 'Dhu al-Qi\'dah', 'Dhu al-Hijjah'], - monthNamesShort: ['Muh', 'Saf', 'Rab1', 'Rab2', 'Jum1', 'Jum2', 'Raj', 'Sha\'', 'Ram', 'Shaw', 'DhuQ', 'DhuH'], - dayNames: ['Yawm al-ahad', 'Yawm al-ithnayn', 'Yawm ath-thulaathaa\'', - 'Yawm al-arbi\'aa\'', 'Yawm al-khamīs', 'Yawm al-jum\'a', 'Yawm as-sabt'], - dayNamesShort: ['Aha', 'Ith', 'Thu', 'Arb', 'Kha', 'Jum', 'Sab'], - dayNamesMin: ['Ah','It','Th','Ar','Kh','Ju','Sa'], - digits: null, - dateFormat: 'yyyy/mm/dd', - firstDay: 6, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof IslamicCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return (date.year() * 11 + 14) % 30 < 11; - }, - - /** Determine the week of the year for a date. - @memberof IslamicCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a year. - @memberof IslamicCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function(year) { - return (this.leapYear(year) ? 355 : 354); - }, - - /** Retrieve the number of days in a month. - @memberof IslamicCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 12 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof IslamicCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return this.dayOfWeek(year, month, day) !== 5; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof IslamicCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year(); - month = date.month(); - day = date.day(); - year = (year <= 0 ? year + 1 : year); - return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + - Math.floor((3 + (11 * year)) / 30) + this.jdEpoch - 1; - }, - - /** Create a new date from a Julian date. - @memberof IslamicCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - jd = Math.floor(jd) + 0.5; - var year = Math.floor((30 * (jd - this.jdEpoch) + 10646) / 10631); - year = (year <= 0 ? year - 1 : year); - var month = Math.min(12, Math.ceil((jd - 29 - this.toJD(year, 1, 1)) / 29.5) + 1); - var day = jd - this.toJD(year, month, 1) + 1; - return this.newDate(year, month, day); - } -}); - -// Islamic (16 civil) calendar implementation -main.calendars.islamic = IslamicCalendar; - - -},{"../main":548,"object-assign":437}],540:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Julian calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Julian calendar. - Based on code from http://www.fourmilab.ch/documents/calendar/. - See also http://en.wikipedia.org/wiki/Julian_calendar. - @class JulianCalendar - @augments BaseCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function JulianCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -JulianCalendar.prototype = new main.baseCalendar; - -assign(JulianCalendar.prototype, { - /** The calendar name. - @memberof JulianCalendar */ - name: 'Julian', - /** Julian date of start of Julian epoch: 1 January 0001 AD = 30 December 0001 BCE. - @memberof JulianCalendar */ - jdEpoch: 1721423.5, - /** Days per month in a common year. - @memberof JulianCalendar */ - daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], - /** true if has a year zero, false if not. - @memberof JulianCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof JulianCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof JulianCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof JulianCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof JulianCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Julian', - epochs: ['BC', 'AD'], - monthNames: ['January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December'], - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - digits: null, - dateFormat: 'mm/dd/yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof JulianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = (date.year() < 0 ? date.year() + 1 : date.year()); // No year zero - return (year % 4) === 0; - }, - - /** Determine the week of the year for a date - ISO 8601. - @memberof JulianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Thursday of this week starting on Monday - var checkDate = this.newDate(year, month, day); - checkDate.add(4 - (checkDate.dayOfWeek() || 7), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof JulianCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof JulianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} True if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof JulianCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year(); - month = date.month(); - day = date.day(); - if (year < 0) { year++; } // No year zero - // Jean Meeus algorithm, "Astronomical Algorithms", 1991 - if (month <= 2) { - year--; - month += 12; - } - return Math.floor(365.25 * (year + 4716)) + - Math.floor(30.6001 * (month + 1)) + day - 1524.5; - }, - - /** Create a new date from a Julian date. - @memberof JulianCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - // Jean Meeus algorithm, "Astronomical Algorithms", 1991 - var a = Math.floor(jd + 0.5); - var b = a + 1524; - var c = Math.floor((b - 122.1) / 365.25); - var d = Math.floor(365.25 * c); - var e = Math.floor((b - d) / 30.6001); - var month = e - Math.floor(e < 14 ? 1 : 13); - var year = c - Math.floor(month > 2 ? 4716 : 4715); - var day = b - d - Math.floor(30.6001 * e); - if (year <= 0) { year--; } // No year zero - return this.newDate(year, month, day); - } -}); - -// Julian calendar implementation -main.calendars.julian = JulianCalendar; - - -},{"../main":548,"object-assign":437}],541:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Mayan calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Mayan Long Count calendar. - See also http://en.wikipedia.org/wiki/Mayan_calendar. - @class MayanCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function MayanCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -MayanCalendar.prototype = new main.baseCalendar; - -assign(MayanCalendar.prototype, { - /** The calendar name. - @memberof MayanCalendar */ - name: 'Mayan', - /** Julian date of start of Mayan epoch: 11 August 3114 BCE. - @memberof MayanCalendar */ - jdEpoch: 584282.5, - /** true if has a year zero, false if not. - @memberof MayanCalendar */ - hasYearZero: true, - /** The minimum month number. - @memberof MayanCalendar */ - minMonth: 0, - /** The first month in the year. - @memberof MayanCalendar */ - firstMonth: 0, - /** The minimum day number. - @memberof MayanCalendar */ - minDay: 0, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof MayanCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. - @property haabMonths {string[]} The names of the Haab months. - @property tzolkinMonths {string[]} The names of the Tzolkin months. */ - regionalOptions: { // Localisations - '': { - name: 'Mayan', - epochs: ['', ''], - monthNames: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '10', '11', '12', '13', '14', '15', '16', '17'], - monthNamesShort: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '10', '11', '12', '13', '14', '15', '16', '17'], - dayNames: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '10', '11', '12', '13', '14', '15', '16', '17', '18', '19'], - dayNamesShort: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '10', '11', '12', '13', '14', '15', '16', '17', '18', '19'], - dayNamesMin: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - '10', '11', '12', '13', '14', '15', '16', '17', '18', '19'], - digits: null, - dateFormat: 'YYYY.m.d', - firstDay: 0, - isRTL: false, - haabMonths: ['Pop', 'Uo', 'Zip', 'Zotz', 'Tzec', 'Xul', 'Yaxkin', 'Mol', 'Chen', 'Yax', - 'Zac', 'Ceh', 'Mac', 'Kankin', 'Muan', 'Pax', 'Kayab', 'Cumku', 'Uayeb'], - tzolkinMonths: ['Imix', 'Ik', 'Akbal', 'Kan', 'Chicchan', 'Cimi', 'Manik', 'Lamat', 'Muluc', 'Oc', - 'Chuen', 'Eb', 'Ben', 'Ix', 'Men', 'Cib', 'Caban', 'Etznab', 'Cauac', 'Ahau'] - } - }, - - /** Determine whether this date is in a leap year. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return false; - }, - - /** Format the year, if not a simple sequential number. - @memberof MayanCalendar - @param year {CDate|number} The date to format or the year to format. - @return {string} The formatted year. - @throws Error if an invalid year or a different calendar used. */ - formatYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - year = date.year(); - var baktun = Math.floor(year / 400); - year = year % 400; - year += (year < 0 ? 400 : 0); - var katun = Math.floor(year / 20); - return baktun + '.' + katun + '.' + (year % 20); - }, - - /** Convert from the formatted year back to a single number. - @memberof MayanCalendar - @param years {string} The year as n.n.n. - @return {number} The sequential year. - @throws Error if an invalid value is supplied. */ - forYear: function(years) { - years = years.split('.'); - if (years.length < 3) { - throw 'Invalid Mayan year'; - } - var year = 0; - for (var i = 0; i < years.length; i++) { - var y = parseInt(years[i], 10); - if (Math.abs(y) > 19 || (i > 0 && y < 0)) { - throw 'Invalid Mayan year'; - } - year = year * 20 + y; - } - return year; - }, - - /** Retrieve the number of months in a year. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return 18; - }, - - /** Determine the week of the year for a date. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - this._validate(year, month, day, main.local.invalidDate); - return 0; - }, - - /** Retrieve the number of days in a year. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return 360; - }, - - /** Retrieve the number of days in a month. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - this._validate(year, month, this.minDay, main.local.invalidMonth); - return 20; - }, - - /** Retrieve the number of days in a week. - @memberof MayanCalendar - @return {number} The number of days. */ - daysInWeek: function() { - return 5; // Just for formatting - }, - - /** Retrieve the day of the week for a date. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The day of the week: 0 to number of days - 1. - @throws Error if an invalid date or a different calendar used. */ - dayOfWeek: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - return date.day(); - }, - - /** Determine whether this date is a week day. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - this._validate(year, month, day, main.local.invalidDate); - return true; - }, - - /** Retrieve additional information about a date - Haab and Tzolkin equivalents. - @memberof MayanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {object} Additional information - contents depends on calendar. - @throws Error if an invalid date or a different calendar used. */ - extraInfo: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - var jd = date.toJD(); - var haab = this._toHaab(jd); - var tzolkin = this._toTzolkin(jd); - return {haabMonthName: this.local.haabMonths[haab[0] - 1], - haabMonth: haab[0], haabDay: haab[1], - tzolkinDayName: this.local.tzolkinMonths[tzolkin[0] - 1], - tzolkinDay: tzolkin[0], tzolkinTrecena: tzolkin[1]}; - }, - - /** Retrieve Haab date from a Julian date. - @memberof MayanCalendar - @private - @param jd {number} The Julian date. - @return {number[]} Corresponding Haab month and day. */ - _toHaab: function(jd) { - jd -= this.jdEpoch; - var day = mod(jd + 8 + ((18 - 1) * 20), 365); - return [Math.floor(day / 20) + 1, mod(day, 20)]; - }, - - /** Retrieve Tzolkin date from a Julian date. - @memberof MayanCalendar - @private - @param jd {number} The Julian date. - @return {number[]} Corresponding Tzolkin day and trecena. */ - _toTzolkin: function(jd) { - jd -= this.jdEpoch; - return [amod(jd + 20, 20), amod(jd + 4, 13)]; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof MayanCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - return date.day() + (date.month() * 20) + (date.year() * 360) + this.jdEpoch; - }, - - /** Create a new date from a Julian date. - @memberof MayanCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - jd = Math.floor(jd) + 0.5 - this.jdEpoch; - var year = Math.floor(jd / 360); - jd = jd % 360; - jd += (jd < 0 ? 360 : 0); - var month = Math.floor(jd / 20); - var day = jd % 20; - return this.newDate(year, month, day); - } -}); - -// Modulus function which works for non-integers. -function mod(a, b) { - return a - (b * Math.floor(a / b)); -} - -// Modulus function which returns numerator if modulus is zero. -function amod(a, b) { - return mod(a - 1, b) + 1; -} - -// Mayan calendar implementation -main.calendars.mayan = MayanCalendar; - - -},{"../main":548,"object-assign":437}],542:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Nanakshahi calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) January 2016. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Nanakshahi calendar. - See also https://en.wikipedia.org/wiki/Nanakshahi_calendar. - @class NanakshahiCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function NanakshahiCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -NanakshahiCalendar.prototype = new main.baseCalendar; - -var gregorian = main.instance('gregorian'); - -assign(NanakshahiCalendar.prototype, { - /** The calendar name. - @memberof NanakshahiCalendar */ - name: 'Nanakshahi', - /** Julian date of start of Nanakshahi epoch: 14 March 1469 CE. - @memberof NanakshahiCalendar */ - jdEpoch: 2257673.5, - /** Days per month in a common year. - @memberof NanakshahiCalendar */ - daysPerMonth: [31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30], - /** true if has a year zero, false if not. - @memberof NanakshahiCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof NanakshahiCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof NanakshahiCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof NanakshahiCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof NanakshahiCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Nanakshahi', - epochs: ['BN', 'AN'], - monthNames: ['Chet', 'Vaisakh', 'Jeth', 'Harh', 'Sawan', 'Bhadon', - 'Assu', 'Katak', 'Maghar', 'Poh', 'Magh', 'Phagun'], - monthNamesShort: ['Che', 'Vai', 'Jet', 'Har', 'Saw', 'Bha', 'Ass', 'Kat', 'Mgr', 'Poh', 'Mgh', 'Pha'], - dayNames: ['Somvaar', 'Mangalvar', 'Budhvaar', 'Veervaar', 'Shukarvaar', 'Sanicharvaar', 'Etvaar'], - dayNamesShort: ['Som', 'Mangal', 'Budh', 'Veer', 'Shukar', 'Sanichar', 'Et'], - dayNamesMin: ['So', 'Ma', 'Bu', 'Ve', 'Sh', 'Sa', 'Et'], - digits: null, - dateFormat: 'dd-mm-yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof NanakshahiCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, - main.local.invalidYear || main.regionalOptions[''].invalidYear); - return gregorian.leapYear(date.year() + (date.year() < 1 ? 1 : 0) + 1469); - }, - - /** Determine the week of the year for a date. - @memberof NanakshahiCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Monday of this week starting on Monday - var checkDate = this.newDate(year, month, day); - checkDate.add(1 - (checkDate.dayOfWeek() || 7), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof NanakshahiCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 12 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof NanakshahiCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof NanakshahiCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidMonth); - var year = date.year(); - if (year < 0) { year++; } // No year zero - var doy = date.day(); - for (var m = 1; m < date.month(); m++) { - doy += this.daysPerMonth[m - 1]; - } - return doy + gregorian.toJD(year + 1468, 3, 13); - }, - - /** Create a new date from a Julian date. - @memberof NanakshahiCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - jd = Math.floor(jd + 0.5); - var year = Math.floor((jd - (this.jdEpoch - 1)) / 366); - while (jd >= this.toJD(year + 1, 1, 1)) { - year++; - } - var day = jd - Math.floor(this.toJD(year, 1, 1) + 0.5) + 1; - var month = 1; - while (day > this.daysInMonth(year, month)) { - day -= this.daysInMonth(year, month); - month++; - } - return this.newDate(year, month, day); - } -}); - -// Nanakshahi calendar implementation -main.calendars.nanakshahi = NanakshahiCalendar; - - -},{"../main":548,"object-assign":437}],543:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Nepali calendar for jQuery v2.0.2. - Written by Artur Neumann (ict.projects{at}nepal.inf.org) April 2013. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Nepali civil calendar. - Based on the ideas from - http://codeissue.com/articles/a04e050dea7468f/algorithm-to-convert-english-date-to-nepali-date-using-c-net - and http://birenj2ee.blogspot.com/2011/04/nepali-calendar-in-java.html - See also http://en.wikipedia.org/wiki/Nepali_calendar - and https://en.wikipedia.org/wiki/Bikram_Samwat. - @class NepaliCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function NepaliCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -NepaliCalendar.prototype = new main.baseCalendar; - -assign(NepaliCalendar.prototype, { - /** The calendar name. - @memberof NepaliCalendar */ - name: 'Nepali', - /** Julian date of start of Nepali epoch: 14 April 57 BCE. - @memberof NepaliCalendar */ - jdEpoch: 1700709.5, - /** Days per month in a common year. - @memberof NepaliCalendar */ - daysPerMonth: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - /** true if has a year zero, false if not. - @memberof NepaliCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof NepaliCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof NepaliCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof NepaliCalendar */ - minDay: 1, - /** The number of days in the year. - @memberof NepaliCalendar */ - daysPerYear: 365, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof NepaliCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Nepali', - epochs: ['BBS', 'ABS'], - monthNames: ['Baisakh', 'Jestha', 'Ashadh', 'Shrawan', 'Bhadra', 'Ashwin', - 'Kartik', 'Mangsir', 'Paush', 'Mangh', 'Falgun', 'Chaitra'], - monthNamesShort: ['Bai', 'Je', 'As', 'Shra', 'Bha', 'Ash', 'Kar', 'Mang', 'Pau', 'Ma', 'Fal', 'Chai'], - dayNames: ['Aaitabaar', 'Sombaar', 'Manglbaar', 'Budhabaar', 'Bihibaar', 'Shukrabaar', 'Shanibaar'], - dayNamesShort: ['Aaita', 'Som', 'Mangl', 'Budha', 'Bihi', 'Shukra', 'Shani'], - dayNamesMin: ['Aai', 'So', 'Man', 'Bu', 'Bi', 'Shu', 'Sha'], - digits: null, - dateFormat: 'dd/mm/yyyy', - firstDay: 1, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof NepaliCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - return this.daysInYear(year) !== this.daysPerYear; - }, - - /** Determine the week of the year for a date. - @memberof NepaliCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a year. - @memberof NepaliCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - year = date.year(); - if (typeof this.NEPALI_CALENDAR_DATA[year] === 'undefined') { - return this.daysPerYear; - } - var daysPerYear = 0; - for (var month_number = this.minMonth; month_number <= 12; month_number++) { - daysPerYear += this.NEPALI_CALENDAR_DATA[year][month_number]; - } - return daysPerYear; - }, - - /** Retrieve the number of days in a month. - @memberof NepaliCalendar - @param year {CDate|number| The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - if (year.year) { - month = year.month(); - year = year.year(); - } - this._validate(year, month, this.minDay, main.local.invalidMonth); - return (typeof this.NEPALI_CALENDAR_DATA[year] === 'undefined' ? - this.daysPerMonth[month - 1] : this.NEPALI_CALENDAR_DATA[year][month]); - }, - - /** Determine whether this date is a week day. - @memberof NepaliCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return this.dayOfWeek(year, month, day) !== 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof NepaliCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(nepaliYear, nepaliMonth, nepaliDay) { - var date = this._validate(nepaliYear, nepaliMonth, nepaliDay, main.local.invalidDate); - nepaliYear = date.year(); - nepaliMonth = date.month(); - nepaliDay = date.day(); - var gregorianCalendar = main.instance(); - var gregorianDayOfYear = 0; // We will add all the days that went by since - // the 1st. January and then we can get the Gregorian Date - var nepaliMonthToCheck = nepaliMonth; - var nepaliYearToCheck = nepaliYear; - this._createMissingCalendarData(nepaliYear); - // Get the correct year - var gregorianYear = nepaliYear - (nepaliMonthToCheck > 9 || (nepaliMonthToCheck === 9 && - nepaliDay >= this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][0]) ? 56 : 57); - // First we add the amount of days in the actual Nepali month as the day of year in the - // Gregorian one because at least this days are gone since the 1st. Jan. - if (nepaliMonth !== 9) { - gregorianDayOfYear = nepaliDay; - nepaliMonthToCheck--; - } - // Now we loop throw all Nepali month and add the amount of days to gregorianDayOfYear - // we do this till we reach Paush (9th month). 1st. January always falls in this month - while (nepaliMonthToCheck !== 9) { - if (nepaliMonthToCheck <= 0) { - nepaliMonthToCheck = 12; - nepaliYearToCheck--; - } - gregorianDayOfYear += this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][nepaliMonthToCheck]; - nepaliMonthToCheck--; - } - // If the date that has to be converted is in Paush (month no. 9) we have to do some other calculation - if (nepaliMonth === 9) { - // Add the days that are passed since the first day of Paush and substract the - // amount of days that lie between 1st. Jan and 1st Paush - gregorianDayOfYear += nepaliDay - this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][0]; - // For the first days of Paush we are now in negative values, - // because in the end of the gregorian year we substract - // 365 / 366 days (P.S. remember math in school + - gives -) - if (gregorianDayOfYear < 0) { - gregorianDayOfYear += gregorianCalendar.daysInYear(gregorianYear); - } - } - else { - gregorianDayOfYear += this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][9] - - this.NEPALI_CALENDAR_DATA[nepaliYearToCheck][0]; - } - return gregorianCalendar.newDate(gregorianYear, 1 ,1).add(gregorianDayOfYear, 'd').toJD(); - }, - - /** Create a new date from a Julian date. - @memberof NepaliCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - var gregorianCalendar = main.instance(); - var gregorianDate = gregorianCalendar.fromJD(jd); - var gregorianYear = gregorianDate.year(); - var gregorianDayOfYear = gregorianDate.dayOfYear(); - var nepaliYear = gregorianYear + 56; //this is not final, it could be also +57 but +56 is always true for 1st Jan. - this._createMissingCalendarData(nepaliYear); - var nepaliMonth = 9; // Jan 1 always fall in Nepali month Paush which is the 9th month of Nepali calendar. - // Get the Nepali day in Paush (month 9) of 1st January - var dayOfFirstJanInPaush = this.NEPALI_CALENDAR_DATA[nepaliYear][0]; - // Check how many days are left of Paush . - // Days calculated from 1st Jan till the end of the actual Nepali month, - // we use this value to check if the gregorian Date is in the actual Nepali month. - var daysSinceJanFirstToEndOfNepaliMonth = - this.NEPALI_CALENDAR_DATA[nepaliYear][nepaliMonth] - dayOfFirstJanInPaush + 1; - // If the gregorian day-of-year is smaller o equal than the sum of days between the 1st January and - // the end of the actual nepali month we found the correct nepali month. - // Example: - // The 4th February 2011 is the gregorianDayOfYear 35 (31 days of January + 4) - // 1st January 2011 is in the nepali year 2067, where 1st. January is in the 17th day of Paush (9th month) - // In 2067 Paush has 30days, This means (30-17+1=14) there are 14days between 1st January and end of Paush - // (including 17th January) - // The gregorianDayOfYear (35) is bigger than 14, so we check the next month - // The next nepali month (Mangh) has 29 days - // 29+14=43, this is bigger than gregorianDayOfYear(35) so, we found the correct nepali month - while (gregorianDayOfYear > daysSinceJanFirstToEndOfNepaliMonth) { - nepaliMonth++; - if (nepaliMonth > 12) { - nepaliMonth = 1; - nepaliYear++; - } - daysSinceJanFirstToEndOfNepaliMonth += this.NEPALI_CALENDAR_DATA[nepaliYear][nepaliMonth]; - } - // The last step is to calculate the nepali day-of-month - // to continue our example from before: - // we calculated there are 43 days from 1st. January (17 Paush) till end of Mangh (29 days) - // when we subtract from this 43 days the day-of-year of the the Gregorian date (35), - // we know how far the searched day is away from the end of the Nepali month. - // So we simply subtract this number from the amount of days in this month (30) - var nepaliDayOfMonth = this.NEPALI_CALENDAR_DATA[nepaliYear][nepaliMonth] - - (daysSinceJanFirstToEndOfNepaliMonth - gregorianDayOfYear); - return this.newDate(nepaliYear, nepaliMonth, nepaliDayOfMonth); - }, - - /** Creates missing data in the NEPALI_CALENDAR_DATA table. - This data will not be correct but just give an estimated result. Mostly -/+ 1 day - @private - @param nepaliYear {number} The missing year number. */ - _createMissingCalendarData: function(nepaliYear) { - var tmp_calendar_data = this.daysPerMonth.slice(0); - tmp_calendar_data.unshift(17); - for (var nepaliYearToCreate = (nepaliYear - 1); nepaliYearToCreate < (nepaliYear + 2); nepaliYearToCreate++) { - if (typeof this.NEPALI_CALENDAR_DATA[nepaliYearToCreate] === 'undefined') { - this.NEPALI_CALENDAR_DATA[nepaliYearToCreate] = tmp_calendar_data; - } - } - }, - - NEPALI_CALENDAR_DATA: { - // These data are from http://www.ashesh.com.np - 1970: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1971: [18, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], - 1972: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - 1973: [19, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 1974: [19, 31, 31, 32, 30, 31, 31, 30, 29, 30, 29, 30, 30], - 1975: [18, 31, 31, 32, 32, 30, 31, 30, 29, 30, 29, 30, 30], - 1976: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 1977: [18, 31, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], - 1978: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1979: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 1980: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 1981: [18, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 1982: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1983: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 1984: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 1985: [18, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 1986: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1987: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 1988: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 1989: [18, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 1990: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1991: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], - // These data are from http://nepalicalendar.rat32.com/index.php - 1992: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 1993: [18, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 1994: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1995: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - 1996: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 1997: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1998: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 1999: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2000: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2001: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2002: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2003: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2004: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2005: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2006: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2007: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2008: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], - 2009: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2010: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2011: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2012: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 2013: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2014: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2015: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2016: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 2017: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2018: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2019: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2020: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 2021: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2022: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - 2023: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2024: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 2025: [18, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2026: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2027: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2028: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2029: [18, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], - 2030: [17, 31, 32, 31, 32, 31, 30, 30, 30, 30, 30, 30, 31], - 2031: [17, 31, 32, 31, 32, 31, 31, 31, 31, 31, 31, 31, 31], - 2032: [17, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32], - 2033: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2034: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2035: [17, 30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], - 2036: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2037: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2038: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2039: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 2040: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2041: [18, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2042: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2043: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 2044: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2045: [18, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2046: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2047: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 2048: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2049: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - 2050: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2051: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 2052: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2053: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - 2054: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2055: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 29, 30], - 2056: [17, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], - 2057: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2058: [17, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2059: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2060: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2061: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2062: [17, 30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], - 2063: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2064: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2065: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2066: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], - 2067: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2068: [17, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2069: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2070: [17, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], - 2071: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2072: [17, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2073: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], - 2074: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 2075: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2076: [16, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - 2077: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], - 2078: [17, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], - 2079: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], - 2080: [16, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], - // These data are from http://www.ashesh.com.np/nepali-calendar/ - 2081: [17, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2082: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2083: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], - 2084: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], - 2085: [17, 31, 32, 31, 32, 31, 31, 30, 30, 29, 30, 30, 30], - 2086: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2087: [16, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30], - 2088: [16, 30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30], - 2089: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2090: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2091: [16, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30], - 2092: [16, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2093: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2094: [17, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], - 2095: [17, 31, 31, 32, 31, 31, 31, 30, 29, 30, 30, 30, 30], - 2096: [17, 30, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], - 2097: [17, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30], - 2098: [17, 31, 31, 32, 31, 31, 31, 29, 30, 29, 30, 30, 31], - 2099: [17, 31, 31, 32, 31, 31, 31, 30, 29, 29, 30, 30, 30], - 2100: [17, 31, 32, 31, 32, 30, 31, 30, 29, 30, 29, 30, 30] - } -}); - -// Nepali calendar implementation -main.calendars.nepali = NepaliCalendar; - - -},{"../main":548,"object-assign":437}],544:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Persian calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the Persian or Jalali calendar. - Based on code from http://www.iranchamber.com/calendar/converter/iranian_calendar_converter.php. - See also http://en.wikipedia.org/wiki/Iranian_calendar. - @class PersianCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function PersianCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -PersianCalendar.prototype = new main.baseCalendar; - -assign(PersianCalendar.prototype, { - /** The calendar name. - @memberof PersianCalendar */ - name: 'Persian', - /** Julian date of start of Persian epoch: 19 March 622 CE. - @memberof PersianCalendar */ - jdEpoch: 1948320.5, - /** Days per month in a common year. - @memberof PersianCalendar */ - daysPerMonth: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29], - /** true if has a year zero, false if not. - @memberof PersianCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof PersianCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof PersianCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof PersianCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof PersianCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Persian', - epochs: ['BP', 'AP'], - monthNames: ['Farvardin', 'Ordibehesht', 'Khordad', 'Tir', 'Mordad', 'Shahrivar', - 'Mehr', 'Aban', 'Azar', 'Day', 'Bahman', 'Esfand'], - monthNamesShort: ['Far', 'Ord', 'Kho', 'Tir', 'Mor', 'Sha', 'Meh', 'Aba', 'Aza', 'Day', 'Bah', 'Esf'], - dayNames: ['Yekshambe', 'Doshambe', 'Seshambe', 'Chæharshambe', 'Panjshambe', 'Jom\'e', 'Shambe'], - dayNamesShort: ['Yek', 'Do', 'Se', 'Chæ', 'Panj', 'Jom', 'Sha'], - dayNamesMin: ['Ye','Do','Se','Ch','Pa','Jo','Sh'], - digits: null, - dateFormat: 'yyyy/mm/dd', - firstDay: 6, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof PersianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return (((((date.year() - (date.year() > 0 ? 474 : 473)) % 2820) + - 474 + 38) * 682) % 2816) < 682; - }, - - /** Determine the week of the year for a date. - @memberof PersianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Saturday of this week starting on Saturday - var checkDate = this.newDate(year, month, day); - checkDate.add(-((checkDate.dayOfWeek() + 1) % 7), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof PersianCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 12 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof PersianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return this.dayOfWeek(year, month, day) !== 5; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof PersianCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - year = date.year(); - month = date.month(); - day = date.day(); - var epBase = year - (year >= 0 ? 474 : 473); - var epYear = 474 + mod(epBase, 2820); - return day + (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) + - Math.floor((epYear * 682 - 110) / 2816) + (epYear - 1) * 365 + - Math.floor(epBase / 2820) * 1029983 + this.jdEpoch - 1; - }, - - /** Create a new date from a Julian date. - @memberof PersianCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - jd = Math.floor(jd) + 0.5; - var depoch = jd - this.toJD(475, 1, 1); - var cycle = Math.floor(depoch / 1029983); - var cyear = mod(depoch, 1029983); - var ycycle = 2820; - if (cyear !== 1029982) { - var aux1 = Math.floor(cyear / 366); - var aux2 = mod(cyear, 366); - ycycle = Math.floor(((2134 * aux1) + (2816 * aux2) + 2815) / 1028522) + aux1 + 1; - } - var year = ycycle + (2820 * cycle) + 474; - year = (year <= 0 ? year - 1 : year); - var yday = jd - this.toJD(year, 1, 1) + 1; - var month = (yday <= 186 ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30)); - var day = jd - this.toJD(year, month, 1) + 1; - return this.newDate(year, month, day); - } -}); - -// Modulus function which works for non-integers. -function mod(a, b) { - return a - (b * Math.floor(a / b)); -} - -// Persian (Jalali) calendar implementation -main.calendars.persian = PersianCalendar; -main.calendars.jalali = PersianCalendar; - - -},{"../main":548,"object-assign":437}],545:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Taiwanese (Minguo) calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) February 2010. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -var gregorianCalendar = main.instance(); - -/** Implementation of the Taiwanese calendar. - See http://en.wikipedia.org/wiki/Minguo_calendar. - @class TaiwanCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function TaiwanCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -TaiwanCalendar.prototype = new main.baseCalendar; - -assign(TaiwanCalendar.prototype, { - /** The calendar name. - @memberof TaiwanCalendar */ - name: 'Taiwan', - /** Julian date of start of Taiwan epoch: 1 January 1912 CE (Gregorian). - @memberof TaiwanCalendar */ - jdEpoch: 2419402.5, - /** Difference in years between Taiwan and Gregorian calendars. - @memberof TaiwanCalendar */ - yearsOffset: 1911, - /** Days per month in a common year. - @memberof TaiwanCalendar */ - daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], - /** true if has a year zero, false if not. - @memberof TaiwanCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof TaiwanCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof TaiwanCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof TaiwanCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof TaiwanCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Taiwan', - epochs: ['BROC', 'ROC'], - monthNames: ['January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December'], - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - digits: null, - dateFormat: 'yyyy/mm/dd', - firstDay: 1, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof TaiwanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = this._t2gYear(date.year()); - return gregorianCalendar.leapYear(year); - }, - - /** Determine the week of the year for a date - ISO 8601. - @memberof TaiwanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = this._t2gYear(date.year()); - return gregorianCalendar.weekOfYear(year, date.month(), date.day()); - }, - - /** Retrieve the number of days in a month. - @memberof TaiwanCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof TaiwanCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof TaiwanCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - var year = this._t2gYear(date.year()); - return gregorianCalendar.toJD(year, date.month(), date.day()); - }, - - /** Create a new date from a Julian date. - @memberof TaiwanCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - var date = gregorianCalendar.fromJD(jd); - var year = this._g2tYear(date.year()); - return this.newDate(year, date.month(), date.day()); - }, - - /** Convert Taiwanese to Gregorian year. - @memberof TaiwanCalendar - @private - @param year {number} The Taiwanese year. - @return {number} The corresponding Gregorian year. */ - _t2gYear: function(year) { - return year + this.yearsOffset + (year >= -this.yearsOffset && year <= -1 ? 1 : 0); - }, - - /** Convert Gregorian to Taiwanese year. - @memberof TaiwanCalendar - @private - @param year {number} The Gregorian year. - @return {number} The corresponding Taiwanese year. */ - _g2tYear: function(year) { - return year - this.yearsOffset - (year >= 1 && year <= this.yearsOffset ? 1 : 0); - } -}); - -// Taiwan calendar implementation -main.calendars.taiwan = TaiwanCalendar; - - -},{"../main":548,"object-assign":437}],546:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Thai calendar for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) February 2010. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -var gregorianCalendar = main.instance(); - -/** Implementation of the Thai calendar. - See http://en.wikipedia.org/wiki/Thai_calendar. - @class ThaiCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function ThaiCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -ThaiCalendar.prototype = new main.baseCalendar; - -assign(ThaiCalendar.prototype, { - /** The calendar name. - @memberof ThaiCalendar */ - name: 'Thai', - /** Julian date of start of Thai epoch: 1 January 543 BCE (Gregorian). - @memberof ThaiCalendar */ - jdEpoch: 1523098.5, - /** Difference in years between Thai and Gregorian calendars. - @memberof ThaiCalendar */ - yearsOffset: 543, - /** Days per month in a common year. - @memberof ThaiCalendar */ - daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], - /** true if has a year zero, false if not. - @memberof ThaiCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof ThaiCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof ThaiCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof ThaiCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof ThaiCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Thai', - epochs: ['BBE', 'BE'], - monthNames: ['January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December'], - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - digits: null, - dateFormat: 'dd/mm/yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof ThaiCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = this._t2gYear(date.year()); - return gregorianCalendar.leapYear(year); - }, - - /** Determine the week of the year for a date - ISO 8601. - @memberof ThaiCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - var year = this._t2gYear(date.year()); - return gregorianCalendar.weekOfYear(year, date.month(), date.day()); - }, - - /** Retrieve the number of days in a month. - @memberof ThaiCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof ThaiCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof ThaiCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - var year = this._t2gYear(date.year()); - return gregorianCalendar.toJD(year, date.month(), date.day()); - }, - - /** Create a new date from a Julian date. - @memberof ThaiCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - var date = gregorianCalendar.fromJD(jd); - var year = this._g2tYear(date.year()); - return this.newDate(year, date.month(), date.day()); - }, - - /** Convert Thai to Gregorian year. - @memberof ThaiCalendar - @private - @param year {number} The Thai year. - @return {number} The corresponding Gregorian year. */ - _t2gYear: function(year) { - return year - this.yearsOffset - (year >= 1 && year <= this.yearsOffset ? 1 : 0); - }, - - /** Convert Gregorian to Thai year. - @memberof ThaiCalendar - @private - @param year {number} The Gregorian year. - @return {number} The corresponding Thai year. */ - _g2tYear: function(year) { - return year + this.yearsOffset + (year >= -this.yearsOffset && year <= -1 ? 1 : 0); - } -}); - -// Thai calendar implementation -main.calendars.thai = ThaiCalendar; - - -},{"../main":548,"object-assign":437}],547:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - UmmAlQura calendar for jQuery v2.0.2. - Written by Amro Osama March 2013. - Modified by Binnooh.com & www.elm.sa - 2014 - Added dates back to 1276 Hijri year. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var main = _dereq_('../main'); -var assign = _dereq_('object-assign'); - - -/** Implementation of the UmmAlQura or 'saudi' calendar. - See also http://en.wikipedia.org/wiki/Islamic_calendar#Saudi_Arabia.27s_Umm_al-Qura_calendar. - http://www.ummulqura.org.sa/About.aspx - http://www.staff.science.uu.nl/~gent0113/islam/ummalqura.htm - @class UmmAlQuraCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function UmmAlQuraCalendar(language) { - this.local = this.regionalOptions[language || ''] || this.regionalOptions['']; -} - -UmmAlQuraCalendar.prototype = new main.baseCalendar; - -assign(UmmAlQuraCalendar.prototype, { - /** The calendar name. - @memberof UmmAlQuraCalendar */ - name: 'UmmAlQura', - //jdEpoch: 1948440, // Julian date of start of UmmAlQura epoch: 14 March 1937 CE - //daysPerMonth: // Days per month in a common year, replaced by a method. - /** true if has a year zero, false if not. - @memberof UmmAlQuraCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof UmmAlQuraCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof UmmAlQuraCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof UmmAlQuraCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof UmmAlQuraCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Umm al-Qura', - epochs: ['BH', 'AH'], - monthNames: ['Al-Muharram', 'Safar', 'Rabi\' al-awwal', 'Rabi\' Al-Thani', 'Jumada Al-Awwal', 'Jumada Al-Thani', - 'Rajab', 'Sha\'aban', 'Ramadan', 'Shawwal', 'Dhu al-Qi\'dah', 'Dhu al-Hijjah'], - monthNamesShort: ['Muh', 'Saf', 'Rab1', 'Rab2', 'Jum1', 'Jum2', 'Raj', 'Sha\'', 'Ram', 'Shaw', 'DhuQ', 'DhuH'], - dayNames: ['Yawm al-Ahad', 'Yawm al-Ithnain', 'Yawm al-Thalāthā’', 'Yawm al-Arba‘ā’', 'Yawm al-Khamīs', 'Yawm al-Jum‘a', 'Yawm al-Sabt'], - dayNamesMin: ['Ah', 'Ith', 'Th', 'Ar', 'Kh', 'Ju', 'Sa'], - digits: null, - dateFormat: 'yyyy/mm/dd', - firstDay: 6, - isRTL: true - } - }, - - /** Determine whether this date is in a leap year. - @memberof UmmAlQuraCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function (year) { - var date = this._validate(year, this.minMonth, this.minDay, main.local.invalidYear); - return (this.daysInYear(date.year()) === 355); - }, - - /** Determine the week of the year for a date. - @memberof UmmAlQuraCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function (year, month, day) { - // Find Sunday of this week starting on Sunday - var checkDate = this.newDate(year, month, day); - checkDate.add(-checkDate.dayOfWeek(), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a year. - @memberof UmmAlQuraCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function (year) { - var daysCount = 0; - for (var i = 1; i <= 12; i++) { - daysCount += this.daysInMonth(year, i); - } - return daysCount; - }, - - /** Retrieve the number of days in a month. - @memberof UmmAlQuraCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function (year, month) { - var date = this._validate(year, month, this.minDay, main.local.invalidMonth); - var mcjdn = date.toJD() - 2400000 + 0.5; // Modified Chronological Julian Day Number (MCJDN) - // the MCJDN's of the start of the lunations in the Umm al-Qura calendar are stored in the 'ummalqura_dat' array - var index = 0; - for (var i = 0; i < ummalqura_dat.length; i++) { - if (ummalqura_dat[i] > mcjdn) { - return (ummalqura_dat[index] - ummalqura_dat[index - 1]); - } - index++; - } - return 30; // Unknown outside - }, - - /** Determine whether this date is a week day. - @memberof UmmAlQuraCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function (year, month, day) { - return this.dayOfWeek(year, month, day) !== 5; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof UmmAlQuraCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function (year, month, day) { - var date = this._validate(year, month, day, main.local.invalidDate); - var index = (12 * (date.year() - 1)) + date.month() - 15292; - var mcjdn = date.day() + ummalqura_dat[index - 1] - 1; - return mcjdn + 2400000 - 0.5; // Modified Chronological Julian Day Number (MCJDN) - }, - - /** Create a new date from a Julian date. - @memberof UmmAlQuraCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function (jd) { - var mcjdn = jd - 2400000 + 0.5; // Modified Chronological Julian Day Number (MCJDN) - // the MCJDN's of the start of the lunations in the Umm al-Qura calendar - // are stored in the 'ummalqura_dat' array - var index = 0; - for (var i = 0; i < ummalqura_dat.length; i++) { - if (ummalqura_dat[i] > mcjdn) break; - index++; - } - var lunation = index + 15292; //UmmAlQura Lunation Number - var ii = Math.floor((lunation - 1) / 12); - var year = ii + 1; - var month = lunation - 12 * ii; - var day = mcjdn - ummalqura_dat[index - 1] + 1; - return this.newDate(year, month, day); - }, - - /** Determine whether a date is valid for this calendar. - @memberof UmmAlQuraCalendar - @param year {number} The year to examine. - @param month {number} The month to examine. - @param day {number} The day to examine. - @return {boolean} true if a valid date, false if not. */ - isValid: function(year, month, day) { - var valid = main.baseCalendar.prototype.isValid.apply(this, arguments); - if (valid) { - year = (year.year != null ? year.year : year); - valid = (year >= 1276 && year <= 1500); - } - return valid; - }, - - /** Check that a candidate date is from the same calendar and is valid. - @memberof UmmAlQuraCalendar - @private - @param year {CDate|number} The date to validate or the year to validate. - @param month {number} The month to validate. - @param day {number} The day to validate. - @param error {string} Error message if invalid. - @throws Error if different calendars used or invalid date. */ - _validate: function(year, month, day, error) { - var date = main.baseCalendar.prototype._validate.apply(this, arguments); - if (date.year < 1276 || date.year > 1500) { - throw error.replace(/\{0\}/, this.local.name); - } - return date; - } -}); - -// UmmAlQura calendar implementation -main.calendars.ummalqura = UmmAlQuraCalendar; - -var ummalqura_dat = [ - 20, 50, 79, 109, 138, 168, 197, 227, 256, 286, 315, 345, 374, 404, 433, 463, 492, 522, 551, 581, - 611, 641, 670, 700, 729, 759, 788, 818, 847, 877, 906, 936, 965, 995, 1024, 1054, 1083, 1113, 1142, 1172, - 1201, 1231, 1260, 1290, 1320, 1350, 1379, 1409, 1438, 1468, 1497, 1527, 1556, 1586, 1615, 1645, 1674, 1704, 1733, 1763, - 1792, 1822, 1851, 1881, 1910, 1940, 1969, 1999, 2028, 2058, 2087, 2117, 2146, 2176, 2205, 2235, 2264, 2294, 2323, 2353, - 2383, 2413, 2442, 2472, 2501, 2531, 2560, 2590, 2619, 2649, 2678, 2708, 2737, 2767, 2796, 2826, 2855, 2885, 2914, 2944, - 2973, 3003, 3032, 3062, 3091, 3121, 3150, 3180, 3209, 3239, 3268, 3298, 3327, 3357, 3386, 3416, 3446, 3476, 3505, 3535, - 3564, 3594, 3623, 3653, 3682, 3712, 3741, 3771, 3800, 3830, 3859, 3889, 3918, 3948, 3977, 4007, 4036, 4066, 4095, 4125, - 4155, 4185, 4214, 4244, 4273, 4303, 4332, 4362, 4391, 4421, 4450, 4480, 4509, 4539, 4568, 4598, 4627, 4657, 4686, 4716, - 4745, 4775, 4804, 4834, 4863, 4893, 4922, 4952, 4981, 5011, 5040, 5070, 5099, 5129, 5158, 5188, 5218, 5248, 5277, 5307, - 5336, 5366, 5395, 5425, 5454, 5484, 5513, 5543, 5572, 5602, 5631, 5661, 5690, 5720, 5749, 5779, 5808, 5838, 5867, 5897, - 5926, 5956, 5985, 6015, 6044, 6074, 6103, 6133, 6162, 6192, 6221, 6251, 6281, 6311, 6340, 6370, 6399, 6429, 6458, 6488, - 6517, 6547, 6576, 6606, 6635, 6665, 6694, 6724, 6753, 6783, 6812, 6842, 6871, 6901, 6930, 6960, 6989, 7019, 7048, 7078, - 7107, 7137, 7166, 7196, 7225, 7255, 7284, 7314, 7344, 7374, 7403, 7433, 7462, 7492, 7521, 7551, 7580, 7610, 7639, 7669, - 7698, 7728, 7757, 7787, 7816, 7846, 7875, 7905, 7934, 7964, 7993, 8023, 8053, 8083, 8112, 8142, 8171, 8201, 8230, 8260, - 8289, 8319, 8348, 8378, 8407, 8437, 8466, 8496, 8525, 8555, 8584, 8614, 8643, 8673, 8702, 8732, 8761, 8791, 8821, 8850, - 8880, 8909, 8938, 8968, 8997, 9027, 9056, 9086, 9115, 9145, 9175, 9205, 9234, 9264, 9293, 9322, 9352, 9381, 9410, 9440, - 9470, 9499, 9529, 9559, 9589, 9618, 9648, 9677, 9706, 9736, 9765, 9794, 9824, 9853, 9883, 9913, 9943, 9972, 10002, 10032, - 10061, 10090, 10120, 10149, 10178, 10208, 10237, 10267, 10297, 10326, 10356, 10386, 10415, 10445, 10474, 10504, 10533, 10562, 10592, 10621, - 10651, 10680, 10710, 10740, 10770, 10799, 10829, 10858, 10888, 10917, 10947, 10976, 11005, 11035, 11064, 11094, 11124, 11153, 11183, 11213, - 11242, 11272, 11301, 11331, 11360, 11389, 11419, 11448, 11478, 11507, 11537, 11567, 11596, 11626, 11655, 11685, 11715, 11744, 11774, 11803, - 11832, 11862, 11891, 11921, 11950, 11980, 12010, 12039, 12069, 12099, 12128, 12158, 12187, 12216, 12246, 12275, 12304, 12334, 12364, 12393, - 12423, 12453, 12483, 12512, 12542, 12571, 12600, 12630, 12659, 12688, 12718, 12747, 12777, 12807, 12837, 12866, 12896, 12926, 12955, 12984, - 13014, 13043, 13072, 13102, 13131, 13161, 13191, 13220, 13250, 13280, 13310, 13339, 13368, 13398, 13427, 13456, 13486, 13515, 13545, 13574, - 13604, 13634, 13664, 13693, 13723, 13752, 13782, 13811, 13840, 13870, 13899, 13929, 13958, 13988, 14018, 14047, 14077, 14107, 14136, 14166, - 14195, 14224, 14254, 14283, 14313, 14342, 14372, 14401, 14431, 14461, 14490, 14520, 14550, 14579, 14609, 14638, 14667, 14697, 14726, 14756, - 14785, 14815, 14844, 14874, 14904, 14933, 14963, 14993, 15021, 15051, 15081, 15110, 15140, 15169, 15199, 15228, 15258, 15287, 15317, 15347, - 15377, 15406, 15436, 15465, 15494, 15524, 15553, 15582, 15612, 15641, 15671, 15701, 15731, 15760, 15790, 15820, 15849, 15878, 15908, 15937, - 15966, 15996, 16025, 16055, 16085, 16114, 16144, 16174, 16204, 16233, 16262, 16292, 16321, 16350, 16380, 16409, 16439, 16468, 16498, 16528, - 16558, 16587, 16617, 16646, 16676, 16705, 16734, 16764, 16793, 16823, 16852, 16882, 16912, 16941, 16971, 17001, 17030, 17060, 17089, 17118, - 17148, 17177, 17207, 17236, 17266, 17295, 17325, 17355, 17384, 17414, 17444, 17473, 17502, 17532, 17561, 17591, 17620, 17650, 17679, 17709, - 17738, 17768, 17798, 17827, 17857, 17886, 17916, 17945, 17975, 18004, 18034, 18063, 18093, 18122, 18152, 18181, 18211, 18241, 18270, 18300, - 18330, 18359, 18388, 18418, 18447, 18476, 18506, 18535, 18565, 18595, 18625, 18654, 18684, 18714, 18743, 18772, 18802, 18831, 18860, 18890, - 18919, 18949, 18979, 19008, 19038, 19068, 19098, 19127, 19156, 19186, 19215, 19244, 19274, 19303, 19333, 19362, 19392, 19422, 19452, 19481, - 19511, 19540, 19570, 19599, 19628, 19658, 19687, 19717, 19746, 19776, 19806, 19836, 19865, 19895, 19924, 19954, 19983, 20012, 20042, 20071, - 20101, 20130, 20160, 20190, 20219, 20249, 20279, 20308, 20338, 20367, 20396, 20426, 20455, 20485, 20514, 20544, 20573, 20603, 20633, 20662, - 20692, 20721, 20751, 20780, 20810, 20839, 20869, 20898, 20928, 20957, 20987, 21016, 21046, 21076, 21105, 21135, 21164, 21194, 21223, 21253, - 21282, 21312, 21341, 21371, 21400, 21430, 21459, 21489, 21519, 21548, 21578, 21607, 21637, 21666, 21696, 21725, 21754, 21784, 21813, 21843, - 21873, 21902, 21932, 21962, 21991, 22021, 22050, 22080, 22109, 22138, 22168, 22197, 22227, 22256, 22286, 22316, 22346, 22375, 22405, 22434, - 22464, 22493, 22522, 22552, 22581, 22611, 22640, 22670, 22700, 22730, 22759, 22789, 22818, 22848, 22877, 22906, 22936, 22965, 22994, 23024, - 23054, 23083, 23113, 23143, 23173, 23202, 23232, 23261, 23290, 23320, 23349, 23379, 23408, 23438, 23467, 23497, 23527, 23556, 23586, 23616, - 23645, 23674, 23704, 23733, 23763, 23792, 23822, 23851, 23881, 23910, 23940, 23970, 23999, 24029, 24058, 24088, 24117, 24147, 24176, 24206, - 24235, 24265, 24294, 24324, 24353, 24383, 24413, 24442, 24472, 24501, 24531, 24560, 24590, 24619, 24648, 24678, 24707, 24737, 24767, 24796, - 24826, 24856, 24885, 24915, 24944, 24974, 25003, 25032, 25062, 25091, 25121, 25150, 25180, 25210, 25240, 25269, 25299, 25328, 25358, 25387, - 25416, 25446, 25475, 25505, 25534, 25564, 25594, 25624, 25653, 25683, 25712, 25742, 25771, 25800, 25830, 25859, 25888, 25918, 25948, 25977, - 26007, 26037, 26067, 26096, 26126, 26155, 26184, 26214, 26243, 26272, 26302, 26332, 26361, 26391, 26421, 26451, 26480, 26510, 26539, 26568, - 26598, 26627, 26656, 26686, 26715, 26745, 26775, 26805, 26834, 26864, 26893, 26923, 26952, 26982, 27011, 27041, 27070, 27099, 27129, 27159, - 27188, 27218, 27248, 27277, 27307, 27336, 27366, 27395, 27425, 27454, 27484, 27513, 27542, 27572, 27602, 27631, 27661, 27691, 27720, 27750, - 27779, 27809, 27838, 27868, 27897, 27926, 27956, 27985, 28015, 28045, 28074, 28104, 28134, 28163, 28193, 28222, 28252, 28281, 28310, 28340, - 28369, 28399, 28428, 28458, 28488, 28517, 28547, 28577, - // From 1356 - 28607, 28636, 28665, 28695, 28724, 28754, 28783, 28813, 28843, 28872, 28901, 28931, 28960, 28990, 29019, 29049, 29078, 29108, 29137, 29167, - 29196, 29226, 29255, 29285, 29315, 29345, 29375, 29404, 29434, 29463, 29492, 29522, 29551, 29580, 29610, 29640, 29669, 29699, 29729, 29759, - 29788, 29818, 29847, 29876, 29906, 29935, 29964, 29994, 30023, 30053, 30082, 30112, 30141, 30171, 30200, 30230, 30259, 30289, 30318, 30348, - 30378, 30408, 30437, 30467, 30496, 30526, 30555, 30585, 30614, 30644, 30673, 30703, 30732, 30762, 30791, 30821, 30850, 30880, 30909, 30939, - 30968, 30998, 31027, 31057, 31086, 31116, 31145, 31175, 31204, 31234, 31263, 31293, 31322, 31352, 31381, 31411, 31441, 31471, 31500, 31530, - 31559, 31589, 31618, 31648, 31676, 31706, 31736, 31766, 31795, 31825, 31854, 31884, 31913, 31943, 31972, 32002, 32031, 32061, 32090, 32120, - 32150, 32180, 32209, 32239, 32268, 32298, 32327, 32357, 32386, 32416, 32445, 32475, 32504, 32534, 32563, 32593, 32622, 32652, 32681, 32711, - 32740, 32770, 32799, 32829, 32858, 32888, 32917, 32947, 32976, 33006, 33035, 33065, 33094, 33124, 33153, 33183, 33213, 33243, 33272, 33302, - 33331, 33361, 33390, 33420, 33450, 33479, 33509, 33539, 33568, 33598, 33627, 33657, 33686, 33716, 33745, 33775, 33804, 33834, 33863, 33893, - 33922, 33952, 33981, 34011, 34040, 34069, 34099, 34128, 34158, 34187, 34217, 34247, 34277, 34306, 34336, 34365, 34395, 34424, 34454, 34483, - 34512, 34542, 34571, 34601, 34631, 34660, 34690, 34719, 34749, 34778, 34808, 34837, 34867, 34896, 34926, 34955, 34985, 35015, 35044, 35074, - 35103, 35133, 35162, 35192, 35222, 35251, 35280, 35310, 35340, 35370, 35399, 35429, 35458, 35488, 35517, 35547, 35576, 35605, 35635, 35665, - 35694, 35723, 35753, 35782, 35811, 35841, 35871, 35901, 35930, 35960, 35989, 36019, 36048, 36078, 36107, 36136, 36166, 36195, 36225, 36254, - 36284, 36314, 36343, 36373, 36403, 36433, 36462, 36492, 36521, 36551, 36580, 36610, 36639, 36669, 36698, 36728, 36757, 36786, 36816, 36845, - 36875, 36904, 36934, 36963, 36993, 37022, 37052, 37081, 37111, 37141, 37170, 37200, 37229, 37259, 37288, 37318, 37347, 37377, 37406, 37436, - 37465, 37495, 37524, 37554, 37584, 37613, 37643, 37672, 37701, 37731, 37760, 37790, 37819, 37849, 37878, 37908, 37938, 37967, 37997, 38027, - 38056, 38085, 38115, 38144, 38174, 38203, 38233, 38262, 38292, 38322, 38351, 38381, 38410, 38440, 38469, 38499, 38528, 38558, 38587, 38617, - 38646, 38676, 38705, 38735, 38764, 38794, 38823, 38853, 38882, 38912, 38941, 38971, 39001, 39030, 39059, 39089, 39118, 39148, 39178, 39208, - 39237, 39267, 39297, 39326, 39355, 39385, 39414, 39444, 39473, 39503, 39532, 39562, 39592, 39621, 39650, 39680, 39709, 39739, 39768, 39798, - 39827, 39857, 39886, 39916, 39946, 39975, 40005, 40035, 40064, 40094, 40123, 40153, 40182, 40212, 40241, 40271, 40300, 40330, 40359, 40389, - 40418, 40448, 40477, 40507, 40536, 40566, 40595, 40625, 40655, 40685, 40714, 40744, 40773, 40803, 40832, 40862, 40892, 40921, 40951, 40980, - 41009, 41039, 41068, 41098, 41127, 41157, 41186, 41216, 41245, 41275, 41304, 41334, 41364, 41393, 41422, 41452, 41481, 41511, 41540, 41570, - 41599, 41629, 41658, 41688, 41718, 41748, 41777, 41807, 41836, 41865, 41894, 41924, 41953, 41983, 42012, 42042, 42072, 42102, 42131, 42161, - 42190, 42220, 42249, 42279, 42308, 42337, 42367, 42397, 42426, 42456, 42485, 42515, 42545, 42574, 42604, 42633, 42662, 42692, 42721, 42751, - 42780, 42810, 42839, 42869, 42899, 42929, 42958, 42988, 43017, 43046, 43076, 43105, 43135, 43164, 43194, 43223, 43253, 43283, 43312, 43342, - 43371, 43401, 43430, 43460, 43489, 43519, 43548, 43578, 43607, 43637, 43666, 43696, 43726, 43755, 43785, 43814, 43844, 43873, 43903, 43932, - 43962, 43991, 44021, 44050, 44080, 44109, 44139, 44169, 44198, 44228, 44258, 44287, 44317, 44346, 44375, 44405, 44434, 44464, 44493, 44523, - 44553, 44582, 44612, 44641, 44671, 44700, 44730, 44759, 44788, 44818, 44847, 44877, 44906, 44936, 44966, 44996, 45025, 45055, 45084, 45114, - 45143, 45172, 45202, 45231, 45261, 45290, 45320, 45350, 45380, 45409, 45439, 45468, 45498, 45527, 45556, 45586, 45615, 45644, 45674, 45704, - 45733, 45763, 45793, 45823, 45852, 45882, 45911, 45940, 45970, 45999, 46028, 46058, 46088, 46117, 46147, 46177, 46206, 46236, 46265, 46295, - 46324, 46354, 46383, 46413, 46442, 46472, 46501, 46531, 46560, 46590, 46620, 46649, 46679, 46708, 46738, 46767, 46797, 46826, 46856, 46885, - 46915, 46944, 46974, 47003, 47033, 47063, 47092, 47122, 47151, 47181, 47210, 47240, 47269, 47298, 47328, 47357, 47387, 47417, 47446, 47476, - 47506, 47535, 47565, 47594, 47624, 47653, 47682, 47712, 47741, 47771, 47800, 47830, 47860, 47890, 47919, 47949, 47978, 48008, 48037, 48066, - 48096, 48125, 48155, 48184, 48214, 48244, 48273, 48303, 48333, 48362, 48392, 48421, 48450, 48480, 48509, 48538, 48568, 48598, 48627, 48657, - 48687, 48717, 48746, 48776, 48805, 48834, 48864, 48893, 48922, 48952, 48982, 49011, 49041, 49071, 49100, 49130, 49160, 49189, 49218, 49248, - 49277, 49306, 49336, 49365, 49395, 49425, 49455, 49484, 49514, 49543, 49573, 49602, 49632, 49661, 49690, 49720, 49749, 49779, 49809, 49838, - 49868, 49898, 49927, 49957, 49986, 50016, 50045, 50075, 50104, 50133, 50163, 50192, 50222, 50252, 50281, 50311, 50340, 50370, 50400, 50429, - 50459, 50488, 50518, 50547, 50576, 50606, 50635, 50665, 50694, 50724, 50754, 50784, 50813, 50843, 50872, 50902, 50931, 50960, 50990, 51019, - 51049, 51078, 51108, 51138, 51167, 51197, 51227, 51256, 51286, 51315, 51345, 51374, 51403, 51433, 51462, 51492, 51522, 51552, 51582, 51611, - 51641, 51670, 51699, 51729, 51758, 51787, 51816, 51846, 51876, 51906, 51936, 51965, 51995, 52025, 52054, 52083, 52113, 52142, 52171, 52200, - 52230, 52260, 52290, 52319, 52349, 52379, 52408, 52438, 52467, 52497, 52526, 52555, 52585, 52614, 52644, 52673, 52703, 52733, 52762, 52792, - 52822, 52851, 52881, 52910, 52939, 52969, 52998, 53028, 53057, 53087, 53116, 53146, 53176, 53205, 53235, 53264, 53294, 53324, 53353, 53383, - 53412, 53441, 53471, 53500, 53530, 53559, 53589, 53619, 53648, 53678, 53708, 53737, 53767, 53796, 53825, 53855, 53884, 53913, 53943, 53973, - 54003, 54032, 54062, 54092, 54121, 54151, 54180, 54209, 54239, 54268, 54297, 54327, 54357, 54387, 54416, 54446, 54476, 54505, 54535, 54564, - 54593, 54623, 54652, 54681, 54711, 54741, 54770, 54800, 54830, 54859, 54889, 54919, 54948, 54977, 55007, 55036, 55066, 55095, 55125, 55154, - 55184, 55213, 55243, 55273, 55302, 55332, 55361, 55391, 55420, 55450, 55479, 55508, 55538, 55567, 55597, 55627, 55657, 55686, 55716, 55745, - 55775, 55804, 55834, 55863, 55892, 55922, 55951, 55981, 56011, 56040, 56070, 56100, 56129, 56159, 56188, 56218, 56247, 56276, 56306, 56335, - 56365, 56394, 56424, 56454, 56483, 56513, 56543, 56572, 56601, 56631, 56660, 56690, 56719, 56749, 56778, 56808, 56837, 56867, 56897, 56926, - 56956, 56985, 57015, 57044, 57074, 57103, 57133, 57162, 57192, 57221, 57251, 57280, 57310, 57340, 57369, 57399, 57429, 57458, 57487, 57517, - 57546, 57576, 57605, 57634, 57664, 57694, 57723, 57753, 57783, 57813, 57842, 57871, 57901, 57930, 57959, 57989, 58018, 58048, 58077, 58107, - 58137, 58167, 58196, 58226, 58255, 58285, 58314, 58343, 58373, 58402, 58432, 58461, 58491, 58521, 58551, 58580, 58610, 58639, 58669, 58698, - 58727, 58757, 58786, 58816, 58845, 58875, 58905, 58934, 58964, 58994, 59023, 59053, 59082, 59111, 59141, 59170, 59200, 59229, 59259, 59288, - 59318, 59348, 59377, 59407, 59436, 59466, 59495, 59525, 59554, 59584, 59613, 59643, 59672, 59702, 59731, 59761, 59791, 59820, 59850, 59879, - 59909, 59939, 59968, 59997, 60027, 60056, 60086, 60115, 60145, 60174, 60204, 60234, 60264, 60293, 60323, 60352, 60381, 60411, 60440, 60469, - 60499, 60528, 60558, 60588, 60618, 60648, 60677, 60707, 60736, 60765, 60795, 60824, 60853, 60883, 60912, 60942, 60972, 61002, 61031, 61061, - 61090, 61120, 61149, 61179, 61208, 61237, 61267, 61296, 61326, 61356, 61385, 61415, 61445, 61474, 61504, 61533, 61563, 61592, 61621, 61651, - 61680, 61710, 61739, 61769, 61799, 61828, 61858, 61888, 61917, 61947, 61976, 62006, 62035, 62064, 62094, 62123, 62153, 62182, 62212, 62242, - 62271, 62301, 62331, 62360, 62390, 62419, 62448, 62478, 62507, 62537, 62566, 62596, 62625, 62655, 62685, 62715, 62744, 62774, 62803, 62832, - 62862, 62891, 62921, 62950, 62980, 63009, 63039, 63069, 63099, 63128, 63157, 63187, 63216, 63246, 63275, 63305, 63334, 63363, 63393, 63423, - 63453, 63482, 63512, 63541, 63571, 63600, 63630, 63659, 63689, 63718, 63747, 63777, 63807, 63836, 63866, 63895, 63925, 63955, 63984, 64014, - 64043, 64073, 64102, 64131, 64161, 64190, 64220, 64249, 64279, 64309, 64339, 64368, 64398, 64427, 64457, 64486, 64515, 64545, 64574, 64603, - 64633, 64663, 64692, 64722, 64752, 64782, 64811, 64841, 64870, 64899, 64929, 64958, 64987, 65017, 65047, 65076, 65106, 65136, 65166, 65195, - 65225, 65254, 65283, 65313, 65342, 65371, 65401, 65431, 65460, 65490, 65520, 65549, 65579, 65608, 65638, 65667, 65697, 65726, 65755, 65785, - 65815, 65844, 65874, 65903, 65933, 65963, 65992, 66022, 66051, 66081, 66110, 66140, 66169, 66199, 66228, 66258, 66287, 66317, 66346, 66376, - 66405, 66435, 66465, 66494, 66524, 66553, 66583, 66612, 66641, 66671, 66700, 66730, 66760, 66789, 66819, 66849, 66878, 66908, 66937, 66967, - 66996, 67025, 67055, 67084, 67114, 67143, 67173, 67203, 67233, 67262, 67292, 67321, 67351, 67380, 67409, 67439, 67468, 67497, 67527, 67557, - 67587, 67617, 67646, 67676, 67705, 67735, 67764, 67793, 67823, 67852, 67882, 67911, 67941, 67971, 68000, 68030, 68060, 68089, 68119, 68148, - 68177, 68207, 68236, 68266, 68295, 68325, 68354, 68384, 68414, 68443, 68473, 68502, 68532, 68561, 68591, 68620, 68650, 68679, 68708, 68738, - 68768, 68797, 68827, 68857, 68886, 68916, 68946, 68975, 69004, 69034, 69063, 69092, 69122, 69152, 69181, 69211, 69240, 69270, 69300, 69330, - 69359, 69388, 69418, 69447, 69476, 69506, 69535, 69565, 69595, 69624, 69654, 69684, 69713, 69743, 69772, 69802, 69831, 69861, 69890, 69919, - 69949, 69978, 70008, 70038, 70067, 70097, 70126, 70156, 70186, 70215, 70245, 70274, 70303, 70333, 70362, 70392, 70421, 70451, 70481, 70510, - 70540, 70570, 70599, 70629, 70658, 70687, 70717, 70746, 70776, 70805, 70835, 70864, 70894, 70924, 70954, 70983, 71013, 71042, 71071, 71101, - 71130, 71159, 71189, 71218, 71248, 71278, 71308, 71337, 71367, 71397, 71426, 71455, 71485, 71514, 71543, 71573, 71602, 71632, 71662, 71691, - 71721, 71751, 71781, 71810, 71839, 71869, 71898, 71927, 71957, 71986, 72016, 72046, 72075, 72105, 72135, 72164, 72194, 72223, 72253, 72282, - 72311, 72341, 72370, 72400, 72429, 72459, 72489, 72518, 72548, 72577, 72607, 72637, 72666, 72695, 72725, 72754, 72784, 72813, 72843, 72872, - 72902, 72931, 72961, 72991, 73020, 73050, 73080, 73109, 73139, 73168, 73197, 73227, 73256, 73286, 73315, 73345, 73375, 73404, 73434, 73464, - 73493, 73523, 73552, 73581, 73611, 73640, 73669, 73699, 73729, 73758, 73788, 73818, 73848, 73877, 73907, 73936, 73965, 73995, 74024, 74053, - 74083, 74113, 74142, 74172, 74202, 74231, 74261, 74291, 74320, 74349, 74379, 74408, 74437, 74467, 74497, 74526, 74556, 74586, 74615, 74645, - 74675, 74704, 74733, 74763, 74792, 74822, 74851, 74881, 74910, 74940, 74969, 74999, 75029, 75058, 75088, 75117, 75147, 75176, 75206, 75235, - 75264, 75294, 75323, 75353, 75383, 75412, 75442, 75472, 75501, 75531, 75560, 75590, 75619, 75648, 75678, 75707, 75737, 75766, 75796, 75826, - 75856, 75885, 75915, 75944, 75974, 76003, 76032, 76062, 76091, 76121, 76150, 76180, 76210, 76239, 76269, 76299, 76328, 76358, 76387, 76416, - 76446, 76475, 76505, 76534, 76564, 76593, 76623, 76653, 76682, 76712, 76741, 76771, 76801, 76830, 76859, 76889, 76918, 76948, 76977, 77007, - 77036, 77066, 77096, 77125, 77155, 77185, 77214, 77243, 77273, 77302, 77332, 77361, 77390, 77420, 77450, 77479, 77509, 77539, 77569, 77598, - 77627, 77657, 77686, 77715, 77745, 77774, 77804, 77833, 77863, 77893, 77923, 77952, 77982, 78011, 78041, 78070, 78099, 78129, 78158, 78188, - 78217, 78247, 78277, 78307, 78336, 78366, 78395, 78425, 78454, 78483, 78513, 78542, 78572, 78601, 78631, 78661, 78690, 78720, 78750, 78779, - 78808, 78838, 78867, 78897, 78926, 78956, 78985, 79015, 79044, 79074, 79104, 79133, 79163, 79192, 79222, 79251, 79281, 79310, 79340, 79369, - 79399, 79428, 79458, 79487, 79517, 79546, 79576, 79606, 79635, 79665, 79695, 79724, 79753, 79783, 79812, 79841, 79871, 79900, 79930, 79960, - 79990]; - - -},{"../main":548,"object-assign":437}],548:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Calendars for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var assign = _dereq_('object-assign'); - - -function Calendars() { - this.regionalOptions = []; - this.regionalOptions[''] = { - invalidCalendar: 'Calendar {0} not found', - invalidDate: 'Invalid {0} date', - invalidMonth: 'Invalid {0} month', - invalidYear: 'Invalid {0} year', - differentCalendars: 'Cannot mix {0} and {1} dates' - }; - this.local = this.regionalOptions['']; - this.calendars = {}; - this._localCals = {}; -} - -/** Create the calendars plugin. -

Provides support for various world calendars in a consistent manner.

- @class Calendars - @example _exports.instance('julian').newDate(2014, 12, 25) */ -assign(Calendars.prototype, { - - /** Obtain a calendar implementation and localisation. - @memberof Calendars - @param [name='gregorian'] {string} The name of the calendar, e.g. 'gregorian', 'persian', 'islamic'. - @param [language=''] {string} The language code to use for localisation (default is English). - @return {Calendar} The calendar and localisation. - @throws Error if calendar not found. */ - instance: function(name, language) { - name = (name || 'gregorian').toLowerCase(); - language = language || ''; - var cal = this._localCals[name + '-' + language]; - if (!cal && this.calendars[name]) { - cal = new this.calendars[name](language); - this._localCals[name + '-' + language] = cal; - } - if (!cal) { - throw (this.local.invalidCalendar || this.regionalOptions[''].invalidCalendar). - replace(/\{0\}/, name); - } - return cal; - }, - - /** Create a new date - for today if no other parameters given. - @memberof Calendars - @param year {CDate|number} The date to copy or the year for the date. - @param [month] {number} The month for the date. - @param [day] {number} The day for the date. - @param [calendar='gregorian'] {BaseCalendar|string} The underlying calendar or the name of the calendar. - @param [language=''] {string} The language to use for localisation (default English). - @return {CDate} The new date. - @throws Error if an invalid date. */ - newDate: function(year, month, day, calendar, language) { - calendar = (year != null && year.year ? year.calendar() : (typeof calendar === 'string' ? - this.instance(calendar, language) : calendar)) || this.instance(); - return calendar.newDate(year, month, day); - }, - - /** A simple digit substitution function for localising numbers via the Calendar digits option. - @member Calendars - @param digits {string[]} The substitute digits, for 0 through 9. - @return {function} The substitution function. */ - substituteDigits: function(digits) { - return function(value) { - return (value + '').replace(/[0-9]/g, function(digit) { - return digits[digit]; - }); - } - }, - - /** Digit substitution function for localising Chinese style numbers via the Calendar digits option. - @member Calendars - @param digits {string[]} The substitute digits, for 0 through 9. - @param powers {string[]} The characters denoting powers of 10, i.e. 1, 10, 100, 1000. - @return {function} The substitution function. */ - substituteChineseDigits: function(digits, powers) { - return function(value) { - var localNumber = ''; - var power = 0; - while (value > 0) { - var units = value % 10; - localNumber = (units === 0 ? '' : digits[units] + powers[power]) + localNumber; - power++; - value = Math.floor(value / 10); - } - if (localNumber.indexOf(digits[1] + powers[1]) === 0) { - localNumber = localNumber.substr(1); - } - return localNumber || digits[0]; - } - } -}); - -/** Generic date, based on a particular calendar. - @class CDate - @param calendar {BaseCalendar} The underlying calendar implementation. - @param year {number} The year for this date. - @param month {number} The month for this date. - @param day {number} The day for this date. - @return {CDate} The date object. - @throws Error if an invalid date. */ -function CDate(calendar, year, month, day) { - this._calendar = calendar; - this._year = year; - this._month = month; - this._day = day; - if (this._calendar._validateLevel === 0 && - !this._calendar.isValid(this._year, this._month, this._day)) { - throw (_exports.local.invalidDate || _exports.regionalOptions[''].invalidDate). - replace(/\{0\}/, this._calendar.local.name); - } -} - -/** Pad a numeric value with leading zeroes. - @private - @param value {number} The number to format. - @param length {number} The minimum length. - @return {string} The formatted number. */ -function pad(value, length) { - value = '' + value; - return '000000'.substring(0, length - value.length) + value; -} - -assign(CDate.prototype, { - - /** Create a new date. - @memberof CDate - @param [year] {CDate|number} The date to copy or the year for the date (default this date). - @param [month] {number} The month for the date. - @param [day] {number} The day for the date. - @return {CDate} The new date. - @throws Error if an invalid date. */ - newDate: function(year, month, day) { - return this._calendar.newDate((year == null ? this : year), month, day); - }, - - /** Set or retrieve the year for this date. - @memberof CDate - @param [year] {number} The year for the date. - @return {number|CDate} The date's year (if no parameter) or the updated date. - @throws Error if an invalid date. */ - year: function(year) { - return (arguments.length === 0 ? this._year : this.set(year, 'y')); - }, - - /** Set or retrieve the month for this date. - @memberof CDate - @param [month] {number} The month for the date. - @return {number|CDate} The date's month (if no parameter) or the updated date. - @throws Error if an invalid date. */ - month: function(month) { - return (arguments.length === 0 ? this._month : this.set(month, 'm')); - }, - - /** Set or retrieve the day for this date. - @memberof CDate - @param [day] {number} The day for the date. - @return {number|CData} The date's day (if no parameter) or the updated date. - @throws Error if an invalid date. */ - day: function(day) { - return (arguments.length === 0 ? this._day : this.set(day, 'd')); - }, - - /** Set new values for this date. - @memberof CDate - @param year {number} The year for the date. - @param month {number} The month for the date. - @param day {number} The day for the date. - @return {CDate} The updated date. - @throws Error if an invalid date. */ - date: function(year, month, day) { - if (!this._calendar.isValid(year, month, day)) { - throw (_exports.local.invalidDate || _exports.regionalOptions[''].invalidDate). - replace(/\{0\}/, this._calendar.local.name); - } - this._year = year; - this._month = month; - this._day = day; - return this; - }, - - /** Determine whether this date is in a leap year. - @memberof CDate - @return {boolean} true if this is a leap year, false if not. */ - leapYear: function() { - return this._calendar.leapYear(this); - }, - - /** Retrieve the epoch designator for this date, e.g. BCE or CE. - @memberof CDate - @return {string} The current epoch. */ - epoch: function() { - return this._calendar.epoch(this); - }, - - /** Format the year, if not a simple sequential number. - @memberof CDate - @return {string} The formatted year. */ - formatYear: function() { - return this._calendar.formatYear(this); - }, - - /** Retrieve the month of the year for this date, - i.e. the month's position within a numbered year. - @memberof CDate - @return {number} The month of the year: minMonth to months per year. */ - monthOfYear: function() { - return this._calendar.monthOfYear(this); - }, - - /** Retrieve the week of the year for this date. - @memberof CDate - @return {number} The week of the year: 1 to weeks per year. */ - weekOfYear: function() { - return this._calendar.weekOfYear(this); - }, - - /** Retrieve the number of days in the year for this date. - @memberof CDate - @return {number} The number of days in this year. */ - daysInYear: function() { - return this._calendar.daysInYear(this); - }, - - /** Retrieve the day of the year for this date. - @memberof CDate - @return {number} The day of the year: 1 to days per year. */ - dayOfYear: function() { - return this._calendar.dayOfYear(this); - }, - - /** Retrieve the number of days in the month for this date. - @memberof CDate - @return {number} The number of days. */ - daysInMonth: function() { - return this._calendar.daysInMonth(this); - }, - - /** Retrieve the day of the week for this date. - @memberof CDate - @return {number} The day of the week: 0 to number of days - 1. */ - dayOfWeek: function() { - return this._calendar.dayOfWeek(this); - }, - - /** Determine whether this date is a week day. - @memberof CDate - @return {boolean} true if a week day, false if not. */ - weekDay: function() { - return this._calendar.weekDay(this); - }, - - /** Retrieve additional information about this date. - @memberof CDate - @return {object} Additional information - contents depends on calendar. */ - extraInfo: function() { - return this._calendar.extraInfo(this); - }, - - /** Add period(s) to a date. - @memberof CDate - @param offset {number} The number of periods to adjust by. - @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day. - @return {CDate} The updated date. */ - add: function(offset, period) { - return this._calendar.add(this, offset, period); - }, - - /** Set a portion of the date. - @memberof CDate - @param value {number} The new value for the period. - @param period {string} One of 'y' for year, 'm' for month, 'd' for day. - @return {CDate} The updated date. - @throws Error if not a valid date. */ - set: function(value, period) { - return this._calendar.set(this, value, period); - }, - - /** Compare this date to another date. - @memberof CDate - @param date {CDate} The other date. - @return {number} -1 if this date is before the other date, - 0 if they are equal, or +1 if this date is after the other date. */ - compareTo: function(date) { - if (this._calendar.name !== date._calendar.name) { - throw (_exports.local.differentCalendars || _exports.regionalOptions[''].differentCalendars). - replace(/\{0\}/, this._calendar.local.name).replace(/\{1\}/, date._calendar.local.name); - } - var c = (this._year !== date._year ? this._year - date._year : - this._month !== date._month ? this.monthOfYear() - date.monthOfYear() : - this._day - date._day); - return (c === 0 ? 0 : (c < 0 ? -1 : +1)); - }, - - /** Retrieve the calendar backing this date. - @memberof CDate - @return {BaseCalendar} The calendar implementation. */ - calendar: function() { - return this._calendar; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof CDate - @return {number} The equivalent Julian date. */ - toJD: function() { - return this._calendar.toJD(this); - }, - - /** Create a new date from a Julian date. - @memberof CDate - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - return this._calendar.fromJD(jd); - }, - - /** Convert this date to a standard (Gregorian) JavaScript Date. - @memberof CDate - @return {Date} The equivalent JavaScript date. */ - toJSDate: function() { - return this._calendar.toJSDate(this); - }, - - /** Create a new date from a standard (Gregorian) JavaScript Date. - @memberof CDate - @param jsd {Date} The JavaScript date to convert. - @return {CDate} The equivalent date. */ - fromJSDate: function(jsd) { - return this._calendar.fromJSDate(jsd); - }, - - /** Convert to a string for display. - @memberof CDate - @return {string} This date as a string. */ - toString: function() { - return (this.year() < 0 ? '-' : '') + pad(Math.abs(this.year()), 4) + - '-' + pad(this.month(), 2) + '-' + pad(this.day(), 2); - } -}); - -/** Basic functionality for all calendars. - Other calendars should extend this: -
OtherCalendar.prototype = new BaseCalendar;
- @class BaseCalendar */ -function BaseCalendar() { - this.shortYearCutoff = '+10'; -} - -assign(BaseCalendar.prototype, { - _validateLevel: 0, // "Stack" to turn validation on/off - - /** Create a new date within this calendar - today if no parameters given. - @memberof BaseCalendar - @param year {CDate|number} The date to duplicate or the year for the date. - @param [month] {number} The month for the date. - @param [day] {number} The day for the date. - @return {CDate} The new date. - @throws Error if not a valid date or a different calendar used. */ - newDate: function(year, month, day) { - if (year == null) { - return this.today(); - } - if (year.year) { - this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - day = year.day(); - month = year.month(); - year = year.year(); - } - return new CDate(this, year, month, day); - }, - - /** Create a new date for today. - @memberof BaseCalendar - @return {CDate} Today's date. */ - today: function() { - return this.fromJSDate(new Date()); - }, - - /** Retrieve the epoch designator for this date. - @memberof BaseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {string} The current epoch. - @throws Error if an invalid year or a different calendar used. */ - epoch: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, - _exports.local.invalidYear || _exports.regionalOptions[''].invalidYear); - return (date.year() < 0 ? this.local.epochs[0] : this.local.epochs[1]); - }, - - /** Format the year, if not a simple sequential number - @memberof BaseCalendar - @param year {CDate|number} The date to format or the year to format. - @return {string} The formatted year. - @throws Error if an invalid year or a different calendar used. */ - formatYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, - _exports.local.invalidYear || _exports.regionalOptions[''].invalidYear); - return (date.year() < 0 ? '-' : '') + pad(Math.abs(date.year()), 4) - }, - - /** Retrieve the number of months in a year. - @memberof BaseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of months. - @throws Error if an invalid year or a different calendar used. */ - monthsInYear: function(year) { - this._validate(year, this.minMonth, this.minDay, - _exports.local.invalidYear || _exports.regionalOptions[''].invalidYear); - return 12; - }, - - /** Calculate the month's ordinal position within the year - - for those calendars that don't start at month 1! - @memberof BaseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param month {number} The month to examine. - @return {number} The ordinal position, starting from minMonth. - @throws Error if an invalid year/month or a different calendar used. */ - monthOfYear: function(year, month) { - var date = this._validate(year, month, this.minDay, - _exports.local.invalidMonth || _exports.regionalOptions[''].invalidMonth); - return (date.month() + this.monthsInYear(date) - this.firstMonth) % - this.monthsInYear(date) + this.minMonth; - }, - - /** Calculate actual month from ordinal position, starting from minMonth. - @memberof BaseCalendar - @param year {number} The year to examine. - @param ord {number} The month's ordinal position. - @return {number} The month's number. - @throws Error if an invalid year/month. */ - fromMonthOfYear: function(year, ord) { - var m = (ord + this.firstMonth - 2 * this.minMonth) % - this.monthsInYear(year) + this.minMonth; - this._validate(year, m, this.minDay, - _exports.local.invalidMonth || _exports.regionalOptions[''].invalidMonth); - return m; - }, - - /** Retrieve the number of days in a year. - @memberof BaseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {number} The number of days. - @throws Error if an invalid year or a different calendar used. */ - daysInYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, - _exports.local.invalidYear || _exports.regionalOptions[''].invalidYear); - return (this.leapYear(date) ? 366 : 365); - }, - - /** Retrieve the day of the year for a date. - @memberof BaseCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The day of the year. - @throws Error if an invalid date or a different calendar used. */ - dayOfYear: function(year, month, day) { - var date = this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - return date.toJD() - this.newDate(date.year(), - this.fromMonthOfYear(date.year(), this.minMonth), this.minDay).toJD() + 1; - }, - - /** Retrieve the number of days in a week. - @memberof BaseCalendar - @return {number} The number of days. */ - daysInWeek: function() { - return 7; - }, - - /** Retrieve the day of the week for a date. - @memberof BaseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The day of the week: 0 to number of days - 1. - @throws Error if an invalid date or a different calendar used. */ - dayOfWeek: function(year, month, day) { - var date = this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - return (Math.floor(this.toJD(date)) + 2) % this.daysInWeek(); - }, - - /** Retrieve additional information about a date. - @memberof BaseCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {object} Additional information - contents depends on calendar. - @throws Error if an invalid date or a different calendar used. */ - extraInfo: function(year, month, day) { - this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - return {}; - }, - - /** Add period(s) to a date. - Cater for no year zero. - @memberof BaseCalendar - @param date {CDate} The starting date. - @param offset {number} The number of periods to adjust by. - @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day. - @return {CDate} The updated date. - @throws Error if a different calendar used. */ - add: function(date, offset, period) { - this._validate(date, this.minMonth, this.minDay, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - return this._correctAdd(date, this._add(date, offset, period), offset, period); - }, - - /** Add period(s) to a date. - @memberof BaseCalendar - @private - @param date {CDate} The starting date. - @param offset {number} The number of periods to adjust by. - @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day. - @return {CDate} The updated date. */ - _add: function(date, offset, period) { - this._validateLevel++; - if (period === 'd' || period === 'w') { - var jd = date.toJD() + offset * (period === 'w' ? this.daysInWeek() : 1); - var d = date.calendar().fromJD(jd); - this._validateLevel--; - return [d.year(), d.month(), d.day()]; - } - try { - var y = date.year() + (period === 'y' ? offset : 0); - var m = date.monthOfYear() + (period === 'm' ? offset : 0); - var d = date.day();// + (period === 'd' ? offset : 0) + - //(period === 'w' ? offset * this.daysInWeek() : 0); - var resyncYearMonth = function(calendar) { - while (m < calendar.minMonth) { - y--; - m += calendar.monthsInYear(y); - } - var yearMonths = calendar.monthsInYear(y); - while (m > yearMonths - 1 + calendar.minMonth) { - y++; - m -= yearMonths; - yearMonths = calendar.monthsInYear(y); - } - }; - if (period === 'y') { - if (date.month() !== this.fromMonthOfYear(y, m)) { // Hebrew - m = this.newDate(y, date.month(), this.minDay).monthOfYear(); - } - m = Math.min(m, this.monthsInYear(y)); - d = Math.min(d, this.daysInMonth(y, this.fromMonthOfYear(y, m))); - } - else if (period === 'm') { - resyncYearMonth(this); - d = Math.min(d, this.daysInMonth(y, this.fromMonthOfYear(y, m))); - } - var ymd = [y, this.fromMonthOfYear(y, m), d]; - this._validateLevel--; - return ymd; - } - catch (e) { - this._validateLevel--; - throw e; - } - }, - - /** Correct a candidate date after adding period(s) to a date. - Handle no year zero if necessary. - @memberof BaseCalendar - @private - @param date {CDate} The starting date. - @param ymd {number[]} The added date. - @param offset {number} The number of periods to adjust by. - @param period {string} One of 'y' for year, 'm' for month, 'w' for week, 'd' for day. - @return {CDate} The updated date. */ - _correctAdd: function(date, ymd, offset, period) { - if (!this.hasYearZero && (period === 'y' || period === 'm')) { - if (ymd[0] === 0 || // In year zero - (date.year() > 0) !== (ymd[0] > 0)) { // Crossed year zero - var adj = {y: [1, 1, 'y'], m: [1, this.monthsInYear(-1), 'm'], - w: [this.daysInWeek(), this.daysInYear(-1), 'd'], - d: [1, this.daysInYear(-1), 'd']}[period]; - var dir = (offset < 0 ? -1 : +1); - ymd = this._add(date, offset * adj[0] + dir * adj[1], adj[2]); - } - } - return date.date(ymd[0], ymd[1], ymd[2]); - }, - - /** Set a portion of the date. - @memberof BaseCalendar - @param date {CDate} The starting date. - @param value {number} The new value for the period. - @param period {string} One of 'y' for year, 'm' for month, 'd' for day. - @return {CDate} The updated date. - @throws Error if an invalid date or a different calendar used. */ - set: function(date, value, period) { - this._validate(date, this.minMonth, this.minDay, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - var y = (period === 'y' ? value : date.year()); - var m = (period === 'm' ? value : date.month()); - var d = (period === 'd' ? value : date.day()); - if (period === 'y' || period === 'm') { - d = Math.min(d, this.daysInMonth(y, m)); - } - return date.date(y, m, d); - }, - - /** Determine whether a date is valid for this calendar. - @memberof BaseCalendar - @param year {number} The year to examine. - @param month {number} The month to examine. - @param day {number} The day to examine. - @return {boolean} true if a valid date, false if not. */ - isValid: function(year, month, day) { - this._validateLevel++; - var valid = (this.hasYearZero || year !== 0); - if (valid) { - var date = this.newDate(year, month, this.minDay); - valid = (month >= this.minMonth && month - this.minMonth < this.monthsInYear(date)) && - (day >= this.minDay && day - this.minDay < this.daysInMonth(date)); - } - this._validateLevel--; - return valid; - }, - - /** Convert the date to a standard (Gregorian) JavaScript Date. - @memberof BaseCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {Date} The equivalent JavaScript date. - @throws Error if an invalid date or a different calendar used. */ - toJSDate: function(year, month, day) { - var date = this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - return _exports.instance().fromJD(this.toJD(date)).toJSDate(); - }, - - /** Convert the date from a standard (Gregorian) JavaScript Date. - @memberof BaseCalendar - @param jsd {Date} The JavaScript date. - @return {CDate} The equivalent calendar date. */ - fromJSDate: function(jsd) { - return this.fromJD(_exports.instance().fromJSDate(jsd).toJD()); - }, - - /** Check that a candidate date is from the same calendar and is valid. - @memberof BaseCalendar - @private - @param year {CDate|number} The date to validate or the year to validate. - @param [month] {number} The month to validate. - @param [day] {number} The day to validate. - @param error {string} Rrror message if invalid. - @throws Error if different calendars used or invalid date. */ - _validate: function(year, month, day, error) { - if (year.year) { - if (this._validateLevel === 0 && this.name !== year.calendar().name) { - throw (_exports.local.differentCalendars || _exports.regionalOptions[''].differentCalendars). - replace(/\{0\}/, this.local.name).replace(/\{1\}/, year.calendar().local.name); - } - return year; - } - try { - this._validateLevel++; - if (this._validateLevel === 1 && !this.isValid(year, month, day)) { - throw error.replace(/\{0\}/, this.local.name); - } - var date = this.newDate(year, month, day); - this._validateLevel--; - return date; - } - catch (e) { - this._validateLevel--; - throw e; - } - } -}); - -/** Implementation of the Proleptic Gregorian Calendar. - See http://en.wikipedia.org/wiki/Gregorian_calendar - and http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar. - @class GregorianCalendar - @augments BaseCalendar - @param [language=''] {string} The language code (default English) for localisation. */ -function GregorianCalendar(language) { - this.local = this.regionalOptions[language] || this.regionalOptions['']; -} - -GregorianCalendar.prototype = new BaseCalendar; - -assign(GregorianCalendar.prototype, { - /** The calendar name. - @memberof GregorianCalendar */ - name: 'Gregorian', - /** Julian date of start of Gregorian epoch: 1 January 0001 CE. - @memberof GregorianCalendar */ - jdEpoch: 1721425.5, - /** Days per month in a common year. - @memberof GregorianCalendar */ - daysPerMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], - /** true if has a year zero, false if not. - @memberof GregorianCalendar */ - hasYearZero: false, - /** The minimum month number. - @memberof GregorianCalendar */ - minMonth: 1, - /** The first month in the year. - @memberof GregorianCalendar */ - firstMonth: 1, - /** The minimum day number. - @memberof GregorianCalendar */ - minDay: 1, - - /** Localisations for the plugin. - Entries are objects indexed by the language code ('' being the default US/English). - Each object has the following attributes. - @memberof GregorianCalendar - @property name {string} The calendar name. - @property epochs {string[]} The epoch names. - @property monthNames {string[]} The long names of the months of the year. - @property monthNamesShort {string[]} The short names of the months of the year. - @property dayNames {string[]} The long names of the days of the week. - @property dayNamesShort {string[]} The short names of the days of the week. - @property dayNamesMin {string[]} The minimal names of the days of the week. - @property dateFormat {string} The date format for this calendar. - See the options on formatDate for details. - @property firstDay {number} The number of the first day of the week, starting at 0. - @property isRTL {number} true if this localisation reads right-to-left. */ - regionalOptions: { // Localisations - '': { - name: 'Gregorian', - epochs: ['BCE', 'CE'], - monthNames: ['January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December'], - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - digits: null, - dateFormat: 'mm/dd/yyyy', - firstDay: 0, - isRTL: false - } - }, - - /** Determine whether this date is in a leap year. - @memberof GregorianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @return {boolean} true if this is a leap year, false if not. - @throws Error if an invalid year or a different calendar used. */ - leapYear: function(year) { - var date = this._validate(year, this.minMonth, this.minDay, - _exports.local.invalidYear || _exports.regionalOptions[''].invalidYear); - var year = date.year() + (date.year() < 0 ? 1 : 0); // No year zero - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); - }, - - /** Determine the week of the year for a date - ISO 8601. - @memberof GregorianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {number} The week of the year, starting from 1. - @throws Error if an invalid date or a different calendar used. */ - weekOfYear: function(year, month, day) { - // Find Thursday of this week starting on Monday - var checkDate = this.newDate(year, month, day); - checkDate.add(4 - (checkDate.dayOfWeek() || 7), 'd'); - return Math.floor((checkDate.dayOfYear() - 1) / 7) + 1; - }, - - /** Retrieve the number of days in a month. - @memberof GregorianCalendar - @param year {CDate|number} The date to examine or the year of the month. - @param [month] {number} The month. - @return {number} The number of days in this month. - @throws Error if an invalid month/year or a different calendar used. */ - daysInMonth: function(year, month) { - var date = this._validate(year, month, this.minDay, - _exports.local.invalidMonth || _exports.regionalOptions[''].invalidMonth); - return this.daysPerMonth[date.month() - 1] + - (date.month() === 2 && this.leapYear(date.year()) ? 1 : 0); - }, - - /** Determine whether this date is a week day. - @memberof GregorianCalendar - @param year {CDate|number} The date to examine or the year to examine. - @param [month] {number} The month to examine. - @param [day] {number} The day to examine. - @return {boolean} true if a week day, false if not. - @throws Error if an invalid date or a different calendar used. */ - weekDay: function(year, month, day) { - return (this.dayOfWeek(year, month, day) || 7) < 6; - }, - - /** Retrieve the Julian date equivalent for this date, - i.e. days since January 1, 4713 BCE Greenwich noon. - @memberof GregorianCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {number} The equivalent Julian date. - @throws Error if an invalid date or a different calendar used. */ - toJD: function(year, month, day) { - var date = this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - year = date.year(); - month = date.month(); - day = date.day(); - if (year < 0) { year++; } // No year zero - // Jean Meeus algorithm, "Astronomical Algorithms", 1991 - if (month < 3) { - month += 12; - year--; - } - var a = Math.floor(year / 100); - var b = 2 - a + Math.floor(a / 4); - return Math.floor(365.25 * (year + 4716)) + - Math.floor(30.6001 * (month + 1)) + day + b - 1524.5; - }, - - /** Create a new date from a Julian date. - @memberof GregorianCalendar - @param jd {number} The Julian date to convert. - @return {CDate} The equivalent date. */ - fromJD: function(jd) { - // Jean Meeus algorithm, "Astronomical Algorithms", 1991 - var z = Math.floor(jd + 0.5); - var a = Math.floor((z - 1867216.25) / 36524.25); - a = z + 1 + a - Math.floor(a / 4); - var b = a + 1524; - var c = Math.floor((b - 122.1) / 365.25); - var d = Math.floor(365.25 * c); - var e = Math.floor((b - d) / 30.6001); - var day = b - d - Math.floor(e * 30.6001); - var month = e - (e > 13.5 ? 13 : 1); - var year = c - (month > 2.5 ? 4716 : 4715); - if (year <= 0) { year--; } // No year zero - return this.newDate(year, month, day); - }, - - /** Convert this date to a standard (Gregorian) JavaScript Date. - @memberof GregorianCalendar - @param year {CDate|number} The date to convert or the year to convert. - @param [month] {number} The month to convert. - @param [day] {number} The day to convert. - @return {Date} The equivalent JavaScript date. - @throws Error if an invalid date or a different calendar used. */ - toJSDate: function(year, month, day) { - var date = this._validate(year, month, day, - _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate); - var jsd = new Date(date.year(), date.month() - 1, date.day()); - jsd.setHours(0); - jsd.setMinutes(0); - jsd.setSeconds(0); - jsd.setMilliseconds(0); - // Hours may be non-zero on daylight saving cut-over: - // > 12 when midnight changeover, but then cannot generate - // midnight datetime, so jump to 1AM, otherwise reset. - jsd.setHours(jsd.getHours() > 12 ? jsd.getHours() + 2 : 0); - return jsd; - }, - - /** Create a new date from a standard (Gregorian) JavaScript Date. - @memberof GregorianCalendar - @param jsd {Date} The JavaScript date to convert. - @return {CDate} The equivalent date. */ - fromJSDate: function(jsd) { - return this.newDate(jsd.getFullYear(), jsd.getMonth() + 1, jsd.getDate()); - } -}); - -// Singleton manager -var _exports = module.exports = new Calendars(); - -// Date template -_exports.cdate = CDate; - -// Base calendar template -_exports.baseCalendar = BaseCalendar; - -// Gregorian calendar implementation -_exports.calendars.gregorian = GregorianCalendar; - - -},{"object-assign":437}],549:[function(_dereq_,module,exports){ -/* - * World Calendars - * https://github.com/alexcjohnson/world-calendars - * - * Batch-converted from kbwood/calendars - * Many thanks to Keith Wood and all of the contributors to the original project! - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* http://keith-wood.name/calendars.html - Calendars extras for jQuery v2.0.2. - Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009. - Available under the MIT (http://keith-wood.name/licence.html) license. - Please attribute the author if you use it. */ - -var assign = _dereq_('object-assign'); -var main = _dereq_('./main'); - - -assign(main.regionalOptions[''], { - invalidArguments: 'Invalid arguments', - invalidFormat: 'Cannot format a date from another calendar', - missingNumberAt: 'Missing number at position {0}', - unknownNameAt: 'Unknown name at position {0}', - unexpectedLiteralAt: 'Unexpected literal at position {0}', - unexpectedText: 'Additional text found at end' -}); -main.local = main.regionalOptions['']; - -assign(main.cdate.prototype, { - - /** Format this date. - Found in the jquery.calendars.plus.js module. - @memberof CDate - @param [format] {string} The date format to use (see formatDate). - @param [settings] {object} Options for the formatDate function. - @return {string} The formatted date. */ - formatDate: function(format, settings) { - if (typeof format !== 'string') { - settings = format; - format = ''; - } - return this._calendar.formatDate(format || '', this, settings); - } -}); - -assign(main.baseCalendar.prototype, { - - UNIX_EPOCH: main.instance().newDate(1970, 1, 1).toJD(), - SECS_PER_DAY: 24 * 60 * 60, - TICKS_EPOCH: main.instance().jdEpoch, // 1 January 0001 CE - TICKS_PER_DAY: 24 * 60 * 60 * 10000000, - - /** Date form for ATOM (RFC 3339/ISO 8601). - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - ATOM: 'yyyy-mm-dd', - /** Date form for cookies. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - COOKIE: 'D, dd M yyyy', - /** Date form for full date. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - FULL: 'DD, MM d, yyyy', - /** Date form for ISO 8601. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - ISO_8601: 'yyyy-mm-dd', - /** Date form for Julian date. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - JULIAN: 'J', - /** Date form for RFC 822. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - RFC_822: 'D, d M yy', - /** Date form for RFC 850. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - RFC_850: 'DD, dd-M-yy', - /** Date form for RFC 1036. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - RFC_1036: 'D, d M yy', - /** Date form for RFC 1123. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - RFC_1123: 'D, d M yyyy', - /** Date form for RFC 2822. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - RFC_2822: 'D, d M yyyy', - /** Date form for RSS (RFC 822). - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - RSS: 'D, d M yy', - /** Date form for Windows ticks. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - TICKS: '!', - /** Date form for Unix timestamp. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - TIMESTAMP: '@', - /** Date form for W3c (ISO 8601). - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar */ - W3C: 'yyyy-mm-dd', - - /** Format a date object into a string value. - The format can be combinations of the following: -
    -
  • d - day of month (no leading zero)
  • -
  • dd - day of month (two digit)
  • -
  • o - day of year (no leading zeros)
  • -
  • oo - day of year (three digit)
  • -
  • D - day name short
  • -
  • DD - day name long
  • -
  • w - week of year (no leading zero)
  • -
  • ww - week of year (two digit)
  • -
  • m - month of year (no leading zero)
  • -
  • mm - month of year (two digit)
  • -
  • M - month name short
  • -
  • MM - month name long
  • -
  • yy - year (two digit)
  • -
  • yyyy - year (four digit)
  • -
  • YYYY - formatted year
  • -
  • J - Julian date (days since January 1, 4713 BCE Greenwich noon)
  • -
  • @ - Unix timestamp (s since 01/01/1970)
  • -
  • ! - Windows ticks (100ns since 01/01/0001)
  • -
  • '...' - literal text
  • -
  • '' - single quote
  • -
- Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar - @param [format] {string} The desired format of the date (defaults to calendar format). - @param date {CDate} The date value to format. - @param [settings] {object} Addition options, whose attributes include: - @property [dayNamesShort] {string[]} Abbreviated names of the days from Sunday. - @property [dayNames] {string[]} Names of the days from Sunday. - @property [monthNamesShort] {string[]} Abbreviated names of the months. - @property [monthNames] {string[]} Names of the months. - @property [calculateWeek] {CalendarsPickerCalculateWeek} Function that determines week of the year. - @property [localNumbers=false] {boolean} true to localise numbers (if available), - false to use normal Arabic numerals. - @return {string} The date in the above format. - @throws Errors if the date is from a different calendar. */ - formatDate: function(format, date, settings) { - if (typeof format !== 'string') { - settings = date; - date = format; - format = ''; - } - if (!date) { - return ''; - } - if (date.calendar() !== this) { - throw main.local.invalidFormat || main.regionalOptions[''].invalidFormat; - } - format = format || this.local.dateFormat; - settings = settings || {}; - var dayNamesShort = settings.dayNamesShort || this.local.dayNamesShort; - var dayNames = settings.dayNames || this.local.dayNames; - var monthNumbers = settings.monthNumbers || this.local.monthNumbers; - var monthNamesShort = settings.monthNamesShort || this.local.monthNamesShort; - var monthNames = settings.monthNames || this.local.monthNames; - var calculateWeek = settings.calculateWeek || this.local.calculateWeek; - // Check whether a format character is doubled - var doubled = function(match, step) { - var matches = 1; - while (iFormat + matches < format.length && format.charAt(iFormat + matches) === match) { - matches++; - } - iFormat += matches - 1; - return Math.floor(matches / (step || 1)) > 1; - }; - // Format a number, with leading zeroes if necessary - var formatNumber = function(match, value, len, step) { - var num = '' + value; - if (doubled(match, step)) { - while (num.length < len) { - num = '0' + num; - } - } - return num; - }; - // Format a name, short or long as requested - var formatName = function(match, value, shortNames, longNames) { - return (doubled(match) ? longNames[value] : shortNames[value]); - }; - // Format month number - // (e.g. Chinese calendar needs to account for intercalary months) - var calendar = this; - var formatMonth = function(date) { - return (typeof monthNumbers === 'function') ? - monthNumbers.call(calendar, date, doubled('m')) : - localiseNumbers(formatNumber('m', date.month(), 2)); - }; - // Format a month name, short or long as requested - var formatMonthName = function(date, useLongName) { - if (useLongName) { - return (typeof monthNames === 'function') ? - monthNames.call(calendar, date) : - monthNames[date.month() - calendar.minMonth]; - } else { - return (typeof monthNamesShort === 'function') ? - monthNamesShort.call(calendar, date) : - monthNamesShort[date.month() - calendar.minMonth]; - } - }; - // Localise numbers if requested and available - var digits = this.local.digits; - var localiseNumbers = function(value) { - return (settings.localNumbers && digits ? digits(value) : value); - }; - var output = ''; - var literal = false; - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !doubled("'")) { - literal = false; - } - else { - output += format.charAt(iFormat); - } - } - else { - switch (format.charAt(iFormat)) { - case 'd': output += localiseNumbers(formatNumber('d', date.day(), 2)); break; - case 'D': output += formatName('D', date.dayOfWeek(), - dayNamesShort, dayNames); break; - case 'o': output += formatNumber('o', date.dayOfYear(), 3); break; - case 'w': output += formatNumber('w', date.weekOfYear(), 2); break; - case 'm': output += formatMonth(date); break; - case 'M': output += formatMonthName(date, doubled('M')); break; - case 'y': - output += (doubled('y', 2) ? date.year() : - (date.year() % 100 < 10 ? '0' : '') + date.year() % 100); - break; - case 'Y': - doubled('Y', 2); - output += date.formatYear(); - break; - case 'J': output += date.toJD(); break; - case '@': output += (date.toJD() - this.UNIX_EPOCH) * this.SECS_PER_DAY; break; - case '!': output += (date.toJD() - this.TICKS_EPOCH) * this.TICKS_PER_DAY; break; - case "'": - if (doubled("'")) { - output += "'"; - } - else { - literal = true; - } - break; - default: - output += format.charAt(iFormat); - } - } - } - return output; - }, - - /** Parse a string value into a date object. - See formatDate for the possible formats, plus: -
    -
  • * - ignore rest of string
  • -
- Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar - @param format {string} The expected format of the date ('' for default calendar format). - @param value {string} The date in the above format. - @param [settings] {object} Additional options whose attributes include: - @property [shortYearCutoff] {number} The cutoff year for determining the century. - @property [dayNamesShort] {string[]} Abbreviated names of the days from Sunday. - @property [dayNames] {string[]} Names of the days from Sunday. - @property [monthNamesShort] {string[]} Abbreviated names of the months. - @property [monthNames] {string[]} Names of the months. - @return {CDate} The extracted date value or null if value is blank. - @throws Errors if the format and/or value are missing, - if the value doesn't match the format, or if the date is invalid. */ - parseDate: function(format, value, settings) { - if (value == null) { - throw main.local.invalidArguments || main.regionalOptions[''].invalidArguments; - } - value = (typeof value === 'object' ? value.toString() : value + ''); - if (value === '') { - return null; - } - format = format || this.local.dateFormat; - settings = settings || {}; - var shortYearCutoff = settings.shortYearCutoff || this.shortYearCutoff; - shortYearCutoff = (typeof shortYearCutoff !== 'string' ? shortYearCutoff : - this.today().year() % 100 + parseInt(shortYearCutoff, 10)); - var dayNamesShort = settings.dayNamesShort || this.local.dayNamesShort; - var dayNames = settings.dayNames || this.local.dayNames; - var parseMonth = settings.parseMonth || this.local.parseMonth; - var monthNumbers = settings.monthNumbers || this.local.monthNumbers; - var monthNamesShort = settings.monthNamesShort || this.local.monthNamesShort; - var monthNames = settings.monthNames || this.local.monthNames; - var jd = -1; - var year = -1; - var month = -1; - var day = -1; - var doy = -1; - var shortYear = false; - var literal = false; - // Check whether a format character is doubled - var doubled = function(match, step) { - var matches = 1; - while (iFormat + matches < format.length && format.charAt(iFormat + matches) === match) { - matches++; - } - iFormat += matches - 1; - return Math.floor(matches / (step || 1)) > 1; - }; - // Extract a number from the string value - var getNumber = function(match, step) { - var isDoubled = doubled(match, step); - var size = [2, 3, isDoubled ? 4 : 2, isDoubled ? 4 : 2, 10, 11, 20]['oyYJ@!'.indexOf(match) + 1]; - var digits = new RegExp('^-?\\d{1,' + size + '}'); - var num = value.substring(iValue).match(digits); - if (!num) { - throw (main.local.missingNumberAt || main.regionalOptions[''].missingNumberAt). - replace(/\{0\}/, iValue); - } - iValue += num[0].length; - return parseInt(num[0], 10); - }; - // Extract a month number from the string value - var calendar = this; - var getMonthNumber = function() { - if (typeof monthNumbers === 'function') { - doubled('m'); // update iFormat - var month = monthNumbers.call(calendar, value.substring(iValue)); - iValue += month.length; - return month; - } - - return getNumber('m'); - }; - // Extract a name from the string value and convert to an index - var getName = function(match, shortNames, longNames, step) { - var names = (doubled(match, step) ? longNames : shortNames); - for (var i = 0; i < names.length; i++) { - if (value.substr(iValue, names[i].length).toLowerCase() === names[i].toLowerCase()) { - iValue += names[i].length; - return i + calendar.minMonth; - } - } - throw (main.local.unknownNameAt || main.regionalOptions[''].unknownNameAt). - replace(/\{0\}/, iValue); - }; - // Extract a month number from the string value - var getMonthName = function() { - if (typeof monthNames === 'function') { - var month = doubled('M') ? - monthNames.call(calendar, value.substring(iValue)) : - monthNamesShort.call(calendar, value.substring(iValue)); - iValue += month.length; - return month; - } - - return getName('M', monthNamesShort, monthNames); - }; - // Confirm that a literal character matches the string value - var checkLiteral = function() { - if (value.charAt(iValue) !== format.charAt(iFormat)) { - throw (main.local.unexpectedLiteralAt || - main.regionalOptions[''].unexpectedLiteralAt).replace(/\{0\}/, iValue); - } - iValue++; - }; - var iValue = 0; - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !doubled("'")) { - literal = false; - } - else { - checkLiteral(); - } - } - else { - switch (format.charAt(iFormat)) { - case 'd': day = getNumber('d'); break; - case 'D': getName('D', dayNamesShort, dayNames); break; - case 'o': doy = getNumber('o'); break; - case 'w': getNumber('w'); break; - case 'm': month = getMonthNumber(); break; - case 'M': month = getMonthName(); break; - case 'y': - var iSave = iFormat; - shortYear = !doubled('y', 2); - iFormat = iSave; - year = getNumber('y', 2); - break; - case 'Y': year = getNumber('Y', 2); break; - case 'J': - jd = getNumber('J') + 0.5; - if (value.charAt(iValue) === '.') { - iValue++; - getNumber('J'); - } - break; - case '@': jd = getNumber('@') / this.SECS_PER_DAY + this.UNIX_EPOCH; break; - case '!': jd = getNumber('!') / this.TICKS_PER_DAY + this.TICKS_EPOCH; break; - case '*': iValue = value.length; break; - case "'": - if (doubled("'")) { - checkLiteral(); - } - else { - literal = true; - } - break; - default: checkLiteral(); - } - } - } - if (iValue < value.length) { - throw main.local.unexpectedText || main.regionalOptions[''].unexpectedText; - } - if (year === -1) { - year = this.today().year(); - } - else if (year < 100 && shortYear) { - year += (shortYearCutoff === -1 ? 1900 : this.today().year() - - this.today().year() % 100 - (year <= shortYearCutoff ? 0 : 100)); - } - if (typeof month === 'string') { - month = parseMonth.call(this, year, month); - } - if (doy > -1) { - month = 1; - day = doy; - for (var dim = this.daysInMonth(year, month); day > dim; dim = this.daysInMonth(year, month)) { - month++; - day -= dim; - } - } - return (jd > -1 ? this.fromJD(jd) : this.newDate(year, month, day)); - }, - - /** A date may be specified as an exact value or a relative one. - Found in the jquery.calendars.plus.js module. - @memberof BaseCalendar - @param dateSpec {CDate|number|string} The date as an object or string in the given format or - an offset - numeric days from today, or string amounts and periods, e.g. '+1m +2w'. - @param defaultDate {CDate} The date to use if no other supplied, may be null. - @param currentDate {CDate} The current date as a possible basis for relative dates, - if null today is used (optional) - @param [dateFormat] {string} The expected date format - see formatDate. - @param [settings] {object} Additional options whose attributes include: - @property [shortYearCutoff] {number} The cutoff year for determining the century. - @property [dayNamesShort] {string[]} Abbreviated names of the days from Sunday. - @property [dayNames] {string[]} Names of the days from Sunday. - @property [monthNamesShort] {string[]} Abbreviated names of the months. - @property [monthNames] {string[]} Names of the months. - @return {CDate} The decoded date. */ - determineDate: function(dateSpec, defaultDate, currentDate, dateFormat, settings) { - if (currentDate && typeof currentDate !== 'object') { - settings = dateFormat; - dateFormat = currentDate; - currentDate = null; - } - if (typeof dateFormat !== 'string') { - settings = dateFormat; - dateFormat = ''; - } - var calendar = this; - var offsetString = function(offset) { - try { - return calendar.parseDate(dateFormat, offset, settings); - } - catch (e) { - // Ignore - } - offset = offset.toLowerCase(); - var date = (offset.match(/^c/) && currentDate ? - currentDate.newDate() : null) || calendar.today(); - var pattern = /([+-]?[0-9]+)\s*(d|w|m|y)?/g; - var matches = pattern.exec(offset); - while (matches) { - date.add(parseInt(matches[1], 10), matches[2] || 'd'); - matches = pattern.exec(offset); - } - return date; - }; - defaultDate = (defaultDate ? defaultDate.newDate() : null); - dateSpec = (dateSpec == null ? defaultDate : - (typeof dateSpec === 'string' ? offsetString(dateSpec) : (typeof dateSpec === 'number' ? - (isNaN(dateSpec) || dateSpec === Infinity || dateSpec === -Infinity ? defaultDate : - calendar.today().add(dateSpec, 'd')) : calendar.newDate(dateSpec)))); - return dateSpec; - } -}); - - -},{"./main":548,"object-assign":437}],550:[function(_dereq_,module,exports){ -module.exports = _dereq_('cwise-compiler')({ - args: ['array', { - offset: [1], - array: 0 - }, 'scalar', 'scalar', 'index'], - pre: { - "body": "{}", - "args": [], - "thisVars": [], - "localVars": [] - }, - post: { - "body": "{}", - "args": [], - "thisVars": [], - "localVars": [] - }, - body: { - "body": "{\n var _inline_1_da = _inline_1_arg0_ - _inline_1_arg3_\n var _inline_1_db = _inline_1_arg1_ - _inline_1_arg3_\n if((_inline_1_da >= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }", - "args": [{ - "name": "_inline_1_arg0_", - "lvalue": false, - "rvalue": true, - "count": 1 - }, { - "name": "_inline_1_arg1_", - "lvalue": false, - "rvalue": true, - "count": 1 - }, { - "name": "_inline_1_arg2_", - "lvalue": false, - "rvalue": true, - "count": 1 - }, { - "name": "_inline_1_arg3_", - "lvalue": false, - "rvalue": true, - "count": 2 - }, { - "name": "_inline_1_arg4_", - "lvalue": false, - "rvalue": true, - "count": 1 - }], - "thisVars": [], - "localVars": ["_inline_1_da", "_inline_1_db"] - }, - funcName: 'zeroCrossings' -}) - -},{"cwise-compiler":134}],551:[function(_dereq_,module,exports){ -"use strict" - -module.exports = findZeroCrossings - -var core = _dereq_("./lib/zc-core") - -function findZeroCrossings(array, level) { - var cross = [] - level = +level || 0.0 - core(array.hi(array.shape[0]-1), cross, level) - return cross -} -},{"./lib/zc-core":550}],552:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * All paths are tuned for maximum scalability of the arrowhead, - * ie throughout arrowwidth=0.3..3 the head is joined smoothly - * to the line, with the line coming from the left and ending at (0, 0). - * - * `backoff` is the distance to move the arrowhead and the end of the line, - * in order that the arrowhead points to the desired place, either at - * the tip of the arrow or (in the case of circle or square) - * the center of the symbol. - * - * `noRotate`, if truthy, says that this arrowhead should not rotate with the - * arrow. That's the case for squares, which should always be straight, and - * circles, for which it's irrelevant. - */ - -module.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 - } -]; - -},{}],553:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var ARROWPATHS = _dereq_('./arrow_paths'); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var cartesianConstants = _dereq_('../../plots/cartesian/constants'); -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - - -module.exports = templatedArray('annotation', { - visible: { - valType: 'boolean', - - dflt: true, - editType: 'calc+arraydraw', - - }, - - text: { - valType: 'string', - - editType: 'calc+arraydraw', - - }, - textangle: { - valType: 'angle', - dflt: 0, - - editType: 'calc+arraydraw', - - }, - font: fontAttrs({ - editType: 'calc+arraydraw', - colorEditType: 'arraydraw', - - }), - width: { - valType: 'number', - min: 1, - dflt: null, - - editType: 'calc+arraydraw', - - }, - height: { - valType: 'number', - min: 1, - dflt: null, - - editType: 'calc+arraydraw', - - }, - opacity: { - valType: 'number', - min: 0, - max: 1, - dflt: 1, - - editType: 'arraydraw', - - }, - align: { - valType: 'enumerated', - values: ['left', 'center', 'right'], - dflt: 'center', - - editType: 'arraydraw', - - }, - valign: { - valType: 'enumerated', - values: ['top', 'middle', 'bottom'], - dflt: 'middle', - - editType: 'arraydraw', - - }, - bgcolor: { - valType: 'color', - dflt: 'rgba(0,0,0,0)', - - editType: 'arraydraw', - - }, - bordercolor: { - valType: 'color', - dflt: 'rgba(0,0,0,0)', - - editType: 'arraydraw', - - }, - borderpad: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'calc+arraydraw', - - }, - borderwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'calc+arraydraw', - - }, - // arrow - showarrow: { - valType: 'boolean', - dflt: true, - - editType: 'calc+arraydraw', - - }, - arrowcolor: { - valType: 'color', - - editType: 'arraydraw', - - }, - arrowhead: { - valType: 'integer', - min: 0, - max: ARROWPATHS.length, - dflt: 1, - - editType: 'arraydraw', - - }, - startarrowhead: { - valType: 'integer', - min: 0, - max: ARROWPATHS.length, - dflt: 1, - - editType: 'arraydraw', - - }, - arrowside: { - valType: 'flaglist', - flags: ['end', 'start'], - extras: ['none'], - dflt: 'end', - - editType: 'arraydraw', - - }, - arrowsize: { - valType: 'number', - min: 0.3, - dflt: 1, - - editType: 'calc+arraydraw', - - }, - startarrowsize: { - valType: 'number', - min: 0.3, - dflt: 1, - - editType: 'calc+arraydraw', - - }, - arrowwidth: { - valType: 'number', - min: 0.1, - - editType: 'calc+arraydraw', - - }, - standoff: { - valType: 'number', - min: 0, - dflt: 0, - - editType: 'calc+arraydraw', - - }, - startstandoff: { - valType: 'number', - min: 0, - dflt: 0, - - editType: 'calc+arraydraw', - - }, - ax: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - ay: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - axref: { - valType: 'enumerated', - dflt: 'pixel', - values: [ - 'pixel', - cartesianConstants.idRegex.x.toString() - ], - - editType: 'calc', - - }, - ayref: { - valType: 'enumerated', - dflt: 'pixel', - values: [ - 'pixel', - cartesianConstants.idRegex.y.toString() - ], - - editType: 'calc', - - }, - // positioning - xref: { - valType: 'enumerated', - values: [ - 'paper', - cartesianConstants.idRegex.x.toString() - ], - - editType: 'calc', - - }, - x: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - xanchor: { - valType: 'enumerated', - values: ['auto', 'left', 'center', 'right'], - dflt: 'auto', - - editType: 'calc+arraydraw', - - }, - xshift: { - valType: 'number', - dflt: 0, - - editType: 'calc+arraydraw', - - }, - yref: { - valType: 'enumerated', - values: [ - 'paper', - cartesianConstants.idRegex.y.toString() - ], - - editType: 'calc', - - }, - y: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - yanchor: { - valType: 'enumerated', - values: ['auto', 'top', 'middle', 'bottom'], - dflt: 'auto', - - editType: 'calc+arraydraw', - - }, - yshift: { - valType: 'number', - dflt: 0, - - editType: 'calc+arraydraw', - - }, - clicktoshow: { - valType: 'enumerated', - values: [false, 'onoff', 'onout'], - dflt: false, - - editType: 'arraydraw', - - }, - xclick: { - valType: 'any', - - editType: 'arraydraw', - - }, - yclick: { - valType: 'any', - - editType: 'arraydraw', - - }, - hovertext: { - valType: 'string', - - editType: 'arraydraw', - - }, - hoverlabel: { - bgcolor: { - valType: 'color', - - editType: 'arraydraw', - - }, - bordercolor: { - valType: 'color', - - editType: 'arraydraw', - - }, - font: fontAttrs({ - editType: 'arraydraw', - - }), - editType: 'arraydraw' - }, - captureevents: { - valType: 'boolean', - - editType: 'arraydraw', - - }, - editType: 'calc', - - _deprecated: { - ref: { - valType: 'string', - - editType: 'calc', - - } - } -}); - -},{"../../plot_api/plot_template":734,"../../plots/cartesian/constants":750,"../../plots/font_attributes":771,"./arrow_paths":552}],554:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); - -var draw = _dereq_('./draw').draw; - - -module.exports = function calcAutorange(gd) { - var fullLayout = gd._fullLayout; - var annotationList = Lib.filterVisible(fullLayout.annotations); - - if(annotationList.length && gd._fullData.length) { - return Lib.syncOrAsync([draw, annAutorange], gd); - } -}; - -function annAutorange(gd) { - var fullLayout = gd._fullLayout; - - // find the bounding boxes for each of these annotations' - // relative to their anchor points - // use the arrow and the text bg rectangle, - // as the whole anno may include hidden text in its bbox - Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { - var xa = Axes.getFromId(gd, ann.xref); - var ya = Axes.getFromId(gd, ann.yref); - - ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); - }); -} - -function calcAxisExpansion(ann, ax) { - var axId = ax._id; - var letter = axId.charAt(0); - var pos = ann[letter]; - var apos = ann['a' + letter]; - var ref = 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 === ref) { - // expand for the arrowhead (padded by arrowhead) - var extremeArrowHead = Axes.findExtremes(ax, [ax.r2c(pos)], { - ppadplus: headPlus, - ppadminus: headMinus - }); - // again for the textbox (padded by textbox) - 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; -} - -},{"../../lib":696,"../../plots/cartesian/axes":744,"./draw":559}],555:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); -var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - -module.exports = { - hasClickToShow: hasClickToShow, - onClick: onClick -}; - -/* - * hasClickToShow: does the given hoverData have ANY annotations which will - * turn ON if we click here? (used by hover events to set cursor) - * - * gd: graphDiv - * hoverData: a hoverData array, as included with the *plotly_hover* or - * *plotly_click* events in the `points` attribute - * - * returns: boolean - */ -function hasClickToShow(gd, hoverData) { - var sets = getToggleSets(gd, hoverData); - return sets.on.length > 0 || sets.explicitOff.length > 0; -} - -/* - * onClick: perform the toggling (via Plotly.update) implied by clicking - * at this hoverData - * - * gd: graphDiv - * hoverData: a hoverData array, as included with the *plotly_hover* or - * *plotly_click* events in the `points` attribute - * - * returns: Promise that the update is complete - */ -function onClick(gd, hoverData) { - var toggleSets = getToggleSets(gd, hoverData); - var onSet = toggleSets.on; - var offSet = toggleSets.off.concat(toggleSets.explicitOff); - var update = {}; - var annotationsOut = gd._fullLayout.annotations; - var i, editHelpers; - - if(!(onSet.length || offSet.length)) return; - - for(i = 0; i < onSet.length; i++) { - editHelpers = arrayEditor(gd.layout, 'annotations', annotationsOut[onSet[i]]); - editHelpers.modifyItem('visible', true); - Lib.extendFlat(update, editHelpers.getUpdateObj()); - } - - for(i = 0; i < offSet.length; i++) { - editHelpers = arrayEditor(gd.layout, 'annotations', annotationsOut[offSet[i]]); - editHelpers.modifyItem('visible', false); - Lib.extendFlat(update, editHelpers.getUpdateObj()); - } - - return Registry.call('update', gd, {}, update); -} - -/* - * getToggleSets: find the annotations which will turn on or off at this - * hoverData - * - * gd: graphDiv - * hoverData: a hoverData array, as included with the *plotly_hover* or - * *plotly_click* events in the `points` attribute - * - * returns: { - * on: Array (indices of annotations to turn on), - * off: Array (indices to turn off because you're not hovering on them), - * explicitOff: Array (indices to turn off because you *are* hovering on them) - * } - */ -function getToggleSets(gd, hoverData) { - var annotations = gd._fullLayout.annotations, - onSet = [], - offSet = [], - explicitOffSet = [], - hoverLen = (hoverData || []).length; - - var i, j, anni, showMode, pointj, xa, ya, 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]; - xa = pointj.xaxis; - ya = pointj.yaxis; - - if(xa._id === anni.xref && - ya._id === anni.yref && - xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && - ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) - ) { - // match! toggle this annotation - // regardless of its clicktoshow mode - // but if it's onout mode, off is implicit - if(anni.visible) { - if(showMode === 'onout') toggleType = offSet; - else toggleType = explicitOffSet; - } - else { - toggleType = onSet; - } - toggleType.push(i); - break; - } - } - - if(j === hoverLen) { - // no match - only turn this annotation OFF, and only if - // showmode is 'onout' - if(anni.visible && showMode === 'onout') offSet.push(i); - } - } - } - - return {on: onSet, off: offSet, explicitOff: explicitOffSet}; -} - -// to handle log axes until v2 -function clickData2r(d, ax) { - return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); -} - -},{"../../lib":696,"../../plot_api/plot_template":734,"../../registry":827}],556:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../color'); - -// defaults common to 'annotations' and 'annotations3d' -module.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) - ); - - Lib.coerceFont(coerce, 'hoverlabel.font', { - family: globalHoverLabel.font.family, - size: globalHoverLabel.font.size, - color: globalHoverLabel.font.color || hoverBorder - }); - } - - coerce('captureevents', !!hoverText); -}; - -},{"../../lib":696,"../color":570}],557:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var toLogRange = _dereq_('../../lib/to_log_range'); - -/* - * convertCoords: when converting an axis between log and linear - * you need to alter any annotations on that axis to keep them - * pointing at the same data point. - * In v2.0 this will become obsolete - * - * gd: the plot div - * ax: the axis being changed - * newType: the type it's getting - * doExtra: function(attr, val) from inside relayout that sets the attribute. - * Use this to make the changes as it's aware if any other changes in the - * same relayout call should override this conversion. - */ -module.exports = function convertCoords(gd, ax, newType, doExtra) { - ax = ax || {}; - - var toLog = (newType === 'log') && (ax.type === 'linear'), - fromLog = (newType === 'linear') && (ax.type === 'log'); - - if(!(toLog || fromLog)) return; - - var annotations = gd._fullLayout.annotations, - axLetter = ax._id.charAt(0), - ann, - attrPrefix; - - function convert(attr) { - var currentVal = ann[attr], - newVal = null; - - if(toLog) newVal = toLogRange(currentVal, ax.range); - else newVal = Math.pow(10, currentVal); - - // if conversion failed, delete the value so it gets a default value - 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); - } -}; - -},{"../../lib/to_log_range":722,"fast-isnumeric":214}],558:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var handleAnnotationCommonDefaults = _dereq_('./common_defaults'); -var attributes = _dereq_('./attributes'); - - -module.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; - - // positioning - var axLetters = ['x', 'y'], - arrowPosDflt = [-10, -30], - gdMock = {_fullLayout: fullLayout}; - for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i]; - - // xref, yref - var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); - - if(axRef !== 'paper') { - var ax = Axes.getFromId(gdMock, axRef); - ax._annIndices.push(annOut._index); - } - - // x, y - Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); - - if(showArrow) { - var arrowPosAttr = 'a' + axLetter, - // axref, ayref - aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); - - // for now the arrow can only be on the same axis or specified as pixels - // TODO: sometime it might be interesting to allow it to be on *any* axis - // but that would require updates to drawing & autorange code and maybe more - if(aaxRef !== 'pixel' && aaxRef !== axRef) { - aaxRef = annOut[arrowPosAttr] = 'pixel'; - } - - // ax, ay - var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; - Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); - } - - // xanchor, yanchor - coerce(axLetter + 'anchor'); - - // xshift, yshift - coerce(axLetter + 'shift'); - } - - // if you have one coordinate you should have both - Lib.noneOrAll(annIn, annOut, ['x', 'y']); - - // if you have one part of arrow length you should have both - if(showArrow) { - Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); - } - - if(clickToShow) { - var xClick = coerce('xclick'); - var yClick = coerce('yclick'); - - // put the actual click data to bind to into private attributes - // so we don't have to do this little bit of logic on every hover event - annOut._xclick = (xClick === undefined) ? - annOut.x : - Axes.cleanPosition(xClick, gdMock, annOut.xref); - annOut._yclick = (yClick === undefined) ? - annOut.y : - Axes.cleanPosition(yClick, gdMock, annOut.yref); - } -} - -},{"../../lib":696,"../../plots/array_container_defaults":740,"../../plots/cartesian/axes":744,"./attributes":553,"./common_defaults":556}],559:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Registry = _dereq_('../../registry'); -var Plots = _dereq_('../../plots/plots'); -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Color = _dereq_('../color'); -var Drawing = _dereq_('../drawing'); -var Fx = _dereq_('../fx'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var setCursor = _dereq_('../../lib/setcursor'); -var dragElement = _dereq_('../dragelement'); -var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - -var drawArrowHead = _dereq_('./draw_arrow_head'); - -// Annotations are stored in gd.layout.annotations, an array of objects -// index can point to one item in this array, -// or non-numeric to simply add a new one -// or -1 to modify all existing -// opt can be the full options object, or one key (to be set to value) -// or undefined to simply redraw -// if opt is blank, val can be 'add' or a full options object to add a new -// annotation at that point in the array, or 'remove' to delete this one - -module.exports = { - draw: draw, - drawOne: drawOne, - drawRaw: drawRaw -}; - -/* - * draw: draw all annotations without any new modifications - */ -function draw(gd) { - var fullLayout = gd._fullLayout; - - fullLayout._infolayer.selectAll('.annotation').remove(); - - for(var i = 0; i < fullLayout.annotations.length; i++) { - if(fullLayout.annotations[i].visible) { - drawOne(gd, i); - } - } - - return Plots.previousPromises(gd); -} - -/* - * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications - * - * index (int): the annotation to draw - */ -function drawOne(gd, index) { - var fullLayout = gd._fullLayout; - var options = fullLayout.annotations[index] || {}; - var xa = Axes.getFromId(gd, options.xref); - var ya = Axes.getFromId(gd, options.yref); - - drawRaw(gd, options, index, false, xa, ya); -} - -/** - * drawRaw: draw a single annotation, potentially with modifications - * - * @param {DOM element} gd - * @param {object} options : this annotation's fullLayout options - * @param {integer} index : index in 'annotations' container of the annotation to draw - * @param {string} subplotId : id of the annotation's subplot - * - use false for 2d (i.e. cartesian or paper-ref) annotations - * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px - * @param {object | undefined} ya : ... y-axis - */ -function drawRaw(gd, options, index, subplotId, xa, ya) { - var fullLayout = gd._fullLayout; - var gs = gd._fullLayout._size; - var edits = gd._context.edits; - - var className, containerStr; - - if(subplotId) { - className = 'annotation-' + subplotId; - containerStr = subplotId + '.annotations'; - } else { - className = 'annotation'; - containerStr = 'annotations'; - } - - var editHelpers = arrayEditor(gd.layout, containerStr, options); - var modifyBase = editHelpers.modifyBase; - var modifyItem = editHelpers.modifyItem; - var getUpdateObj = editHelpers.getUpdateObj; - - // remove the existing annotation if there is one - fullLayout._infolayer - .selectAll('.' + className + '[data-index="' + index + '"]') - .remove(); - - var annClipID = 'clip' + fullLayout._uid + '_ann' + index; - - // this annotation is gone - quit now after deleting it - // TODO: use d3 idioms instead of deleting and redrawing every time - if(!options._input || options.visible === false) { - d3.selectAll('#' + annClipID).remove(); - return; - } - - // calculated pixel positions - // x & y each will get text, head, and tail as appropriate - var annPosPx = {x: {}, y: {}}, - textangle = +options.textangle || 0; - - // create the components - // made a single group to contain all, so opacity can work right - // with border/arrow together this could handle a whole bunch of - // cleanup at this point, but works for now - var annGroup = fullLayout._infolayer.append('g') - .classed(className, true) - .attr('data-index', String(index)) - .style('opacity', options.opacity); - - // another group for text+background so that they can rotate together - var annTextGroup = annGroup.append('g') - .classed('annotation-text-g', true); - - var editTextPosition = edits[options.showarrow ? 'annotationTail' : 'annotationPosition']; - var textEvents = options.captureevents || edits.annotationText || editTextPosition; - - var annTextGroupInner = annTextGroup.append('g') - .style('pointer-events', textEvents ? 'all' : null) - .call(setCursor, 'pointer') - .on('click', function() { - gd._dragging = false; - - var eventData = { - index: index, - annotation: options._input, - fullAnnotation: options, - event: d3.event - }; - - if(subplotId) { - eventData.subplotId = subplotId; - } - - gd.emit('plotly_clickannotation', eventData); - }); - - if(options.hovertext) { - annTextGroupInner - .on('mouseover', function() { - var hoverOptions = options.hoverlabel; - var hoverFont = hoverOptions.font; - var bBox = this.getBoundingClientRect(); - var bBoxRef = gd.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 - }, { - container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node(), - gd: gd - }); - }) - .on('mouseout', function() { - Fx.loneUnhover(fullLayout._hoverlayer.node()); - }); - } - - var borderwidth = options.borderwidth, - borderpad = options.borderpad, - 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 annText = annTextGroupInner.append('text') - .classed('annotation-text', true) - .text(options.text); - - function textLayout(s) { - s.call(Drawing.font, font) - .attr({ - 'text-anchor': { - left: 'start', - right: 'end' - }[options.align] || 'middle' - }); - - svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); - return s; - } - - function drawGraphicalElements() { - // if the text has *only* a link, make the whole box into a link - 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, anchor) { - if(anchor === 'auto') { - if(v < 1 / 3) anchor = 'left'; - else if(v > 2 / 3) anchor = 'right'; - else anchor = 'center'; - } - return { - center: 0, - middle: 0, - left: 0.5, - bottom: -0.5, - right: -0.5, - top: 0.5 - }[anchor]; - } - - var annotationIsOffscreen = false; - var letters = ['x', 'y']; - - for(var i = 0; i < letters.length; i++) { - var axLetter = letters[i], - axRef = options[axLetter + 'ref'] || axLetter, - tailRef = options['a' + axLetter + 'ref'], - ax = {x: xa, y: ya}[axLetter], - dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, - // note that these two can be either positive or negative - annSizeFromWidth = outerWidth * Math.cos(dimAngle), - annSizeFromHeight = outerHeight * Math.sin(dimAngle), - // but this one is the positive total size - annSize = Math.abs(annSizeFromWidth) + Math.abs(annSizeFromHeight), - anchor = options[axLetter + 'anchor'], - overallShift = options[axLetter + 'shift'] * (axLetter === 'x' ? 1 : -1), - posPx = annPosPx[axLetter], - basePx, - textPadShift, - alignPosition, - autoAlignFraction, - textShift; - - /* - * calculate the *primary* pixel position - * which is the arrowhead if there is one, - * otherwise the text anchor point - */ - if(ax) { - // check if annotation is off screen, to bypass DOM manipulations - 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 { - if(axLetter === 'x') { - alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; - } - else { - alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; - } - autoAlignFraction = options.showarrow ? 0.5 : alignPosition; - } - - // now translate this into pixel positions of head, tail, and text - // as well as paddings for autorange - if(options.showarrow) { - posPx.head = basePx; - - var arrowLength = options['a' + axLetter]; - - // with an arrow, the text rotates around the anchor point - textShift = annSizeFromWidth * shiftFraction(0.5, options.xanchor) - - annSizeFromHeight * shiftFraction(0.5, options.yanchor); - - if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail - textPadShift = textShift; - } - else { - posPx.tail = basePx + arrowLength; - // tail is specified in px from head, so autorange also pads vs head - textPadShift = textShift + arrowLength; - } - - posPx.text = posPx.tail + textShift; - - // constrain pixel/paper referenced so the draggers are at least - // partially visible - 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), - 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 { - // with no arrow, the text rotates and *then* we put the anchor - // relative to the new bounding box - textShift = annSize * shiftFraction(autoAlignFraction, anchor); - textPadShift = textShift; - posPx.text = basePx + textShift; - } - - posPx.text += overallShift; - textShift += overallShift; - textPadShift += overallShift; - - // padplus/minus are used by autorange - options['_' + axLetter + 'padplus'] = (annSize / 2) + textPadShift; - options['_' + axLetter + 'padminus'] = (annSize / 2) - textPadShift; - - // size/shift are used during dragging - options['_' + axLetter + 'size'] = annSize; - options['_' + axLetter + 'shift'] = textShift; - } - - // We have everything we need for calcAutorange at this point, - // we can safely exit - unless we're currently dragging the plot - if(!gd._dragging && 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); - } - 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); - } - - 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)); - - /* - * rotate text and background - * we already calculated the text center position *as rotated* - * because we needed that for autoranging anyway, so now whether - * we have an arrow or not, we rotate about the text center. - */ - annTextGroup.attr({transform: 'rotate(' + textangle + ',' + - annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - - /* - * add the arrow - * uses options[arrowwidth,arrowcolor,arrowhead] for styling - * dx and dy are normally zero, but when you are dragging the textbox - * while the head stays put, dx and dy are the pixel offsets - */ - var drawArrow = function(dx, dy) { - annGroup - .selectAll('.annotation-arrow-g') - .remove(); - - var headX = annPosPx.x.head, - headY = annPosPx.y.head, - tailX = annPosPx.x.tail + dx, - tailY = annPosPx.y.tail + dy, - textX = annPosPx.x.text + dx, - textY = annPosPx.y.text + dy, - - // find the edge of the text box, where we'll start the arrow: - // create transform matrix to rotate the text box corners - transform = Lib.rotationXYMatrix(textangle, textX, textY), - applyTransform = Lib.apply2DTransform(transform), - applyTransform2 = Lib.apply2DTransform2(transform), - - // calculate and transform bounding box - width = +annTextBG.attr('width'), - height = +annTextBG.attr('height'), - xLeft = textX - 0.5 * width, - xRight = xLeft + width, - yTop = textY - 0.5 * height, - yBottom = yTop + height, - edges = [ - [xLeft, yTop, xLeft, yBottom], - [xLeft, yBottom, xRight, yBottom], - [xRight, yBottom, xRight, yTop], - [xRight, yTop, xLeft, yTop] - ].map(applyTransform2); - - // Remove the line if it ends inside the box. Use ray - // casting for rotated boxes: see which edges intersect a - // line from the arrowhead to far away and reduce with xor - // to get the parity of the number of intersections. - 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)) { - // no line or arrow - so quit drawArrow now - 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, - arrowColor = options.arrowcolor, - 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); - - // the arrow dragger is a small square right at the head, then a line to the tail, - // all expanded by a stroke width of 6px plus the arrow line width - if(edits.annotationPosition && arrow.node().parentNode && !subplotId) { - var arrowDragHeadX = headX; - var arrowDragHeadY = headY; - if(options.standoff) { - var arrowLength = Math.sqrt(Math.pow(headX - tailX, 2) + Math.pow(headY - tailY, 2)); - arrowDragHeadX += options.standoff * (tailX - headX) / arrowLength; - arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; - } - 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: 'translate(' + 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; - - // dragger for the arrow & head: translates the whole thing - // (head/tail/text) all together - dragElement.init({ - element: arrowDrag.node(), - gd: gd, - prepFn: function() { - var pos = Drawing.getTranslate(annTextGroupInner); - - annx0 = pos.x; - anny0 = pos.y; - if(xa && xa.autorange) { - modifyBase(xa._name + '.autorange', true); - } - if(ya && ya.autorange) { - modifyBase(ya._name + '.autorange', true); - } - }, - moveFn: function(dx, dy) { - var annxy0 = applyTransform(annx0, anny0), - xcenter = annxy0[0] + dx, - ycenter = annxy0[1] + dy; - annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); - - if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); - } - - if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); - } - - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - annTextGroup.attr({ - transform: 'rotate(' + textangle + ',' + - xcenter + ',' + ycenter + ')' - }); - }, - doneFn: function() { - Registry.call('relayout', gd, getUpdateObj()); - var notesBox = document.querySelector('.js-notes-box-panel'); - if(notesBox) notesBox.redraw(notesBox.selectedObj); - } - }); - } - }; - - if(options.showarrow) drawArrow(0, 0); - - // user dragging the annotation (text, not arrow) - if(editTextPosition) { - var baseTextTransform; - - // dragger for the textbox: if there's an arrow, just drag the - // textbox and tail, leave the head untouched - dragElement.init({ - element: annTextGroupInner.node(), - gd: gd, - prepFn: function() { - baseTextTransform = annTextGroup.attr('transform'); - }, - moveFn: function(dx, dy) { - var csr = 'pointer'; - if(options.showarrow) { - if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); - } else { - modifyItem('ax', options.ax + dx); - } - - if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); - } else { - modifyItem('ay', options.ay + dy); - } - - drawArrow(dx, dy); - } - else if(!subplotId) { - var xUpdate, yUpdate; - if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); - - } else { - var widthFraction = options._xsize / gs.w, - xLeft = options.x + (options._xshift - options.xshift) / gs.w - - widthFraction / 2; - - xUpdate = dragElement.align(xLeft + dx / gs.w, - widthFraction, 0, 1, options.xanchor); - } - - if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); - } else { - var heightFraction = options._ysize / gs.h, - yBottom = options.y - (options._yshift + options.yshift) / gs.h - - heightFraction / 2; - - yUpdate = dragElement.align(yBottom - dy / gs.h, - heightFraction, 0, 1, options.yanchor); - } - modifyItem('x', xUpdate); - modifyItem('y', yUpdate); - if(!xa || !ya) { - csr = dragElement.getCursor( - xa ? 0.5 : xUpdate, - ya ? 0.5 : yUpdate, - options.xanchor, options.yanchor - ); - } - } - else return; - - annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform - }); - - setCursor(annTextGroupInner, csr); - }, - doneFn: function() { - setCursor(annTextGroupInner); - Registry.call('relayout', gd, 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: gd}) - .call(textLayout) - .on('edit', function(_text) { - options.text = _text; - this.call(textLayout); - - modifyItem('text', _text); - - if(xa && xa.autorange) { - modifyBase(xa._name + '.autorange', true); - } - if(ya && ya.autorange) { - modifyBase(ya._name + '.autorange', true); - } - - Registry.call('relayout', gd, getUpdateObj()); - }); - } - else annText.call(textLayout); -} - -},{"../../lib":696,"../../lib/setcursor":716,"../../lib/svg_text_utils":720,"../../plot_api/plot_template":734,"../../plots/cartesian/axes":744,"../../plots/plots":808,"../../registry":827,"../color":570,"../dragelement":592,"../drawing":595,"../fx":612,"./draw_arrow_head":560,"d3":148}],560:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); - -var Color = _dereq_('../color'); - -var ARROWPATHS = _dereq_('./arrow_paths'); - -/** - * Add arrowhead(s) to a path or line element - * - * @param {d3.selection} el3: a d3-selected line or path element - * - * @param {string} ends: 'none', 'start', 'end', or 'start+end' for which ends get arrowheads - * - * @param {object} options: style information. Must have all the following: - * @param {number} options.arrowhead: end head style - see ./arrow_paths - * @param {number} options.startarrowhead: start head style - see ./arrow_paths - * @param {number} options.arrowsize: relative size of the end head vs line width - * @param {number} options.startarrowsize: relative size of the start head vs line width - * @param {number} options.standoff: distance in px to move the end arrow point from its target - * @param {number} options.startstandoff: distance in px to move the start arrow point from its target - * @param {number} options.arrowwidth: width of the arrow line - * @param {string} options.arrowcolor: color of the arrow line, for the head to match - * Note that the opacity of this color is ignored, as it's assumed the container - * of both the line and head has opacity applied to it so there isn't greater opacity - * where they overlap. - */ -module.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), - 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), - 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(), - // using dash to hide the backOff region of the path. - // if we ever allow dash for the arrow we'll have to - // do better than this hack... maybe just manually - // combine the two - 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: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' - }) - .style({ - fill: Color.rgb(options.arrowcolor), - 'stroke-width': 0 - }); - } - - if(doStart) drawhead(startHeadStyle, start, startRot, startScale); - if(doEnd) drawhead(headStyle, end, endRot, scale); -}; - -},{"../color":570,"./arrow_paths":552,"d3":148}],561:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var drawModule = _dereq_('./draw'); -var clickModule = _dereq_('./click'); - -module.exports = { - moduleType: 'component', - name: 'annotations', - - layoutAttributes: _dereq_('./attributes'), - supplyLayoutDefaults: _dereq_('./defaults'), - includeBasePlot: _dereq_('../../plots/cartesian/include_components')('annotations'), - - calcAutorange: _dereq_('./calc_autorange'), - draw: drawModule.draw, - drawOne: drawModule.drawOne, - drawRaw: drawModule.drawRaw, - - hasClickToShow: clickModule.hasClickToShow, - onClick: clickModule.onClick, - - convertCoords: _dereq_('./convert_coords') -}; - -},{"../../plots/cartesian/include_components":755,"./attributes":553,"./calc_autorange":554,"./click":555,"./convert_coords":557,"./defaults":558,"./draw":559}],562:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var annAtts = _dereq_('../annotations/attributes'); -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - -module.exports = overrideAll(templatedArray('annotation', { - visible: annAtts.visible, - x: { - valType: 'any', - - - }, - y: { - valType: 'any', - - - }, - z: { - valType: 'any', - - - }, - ax: { - valType: 'number', - - - }, - ay: { - valType: 'number', - - - }, - - xanchor: annAtts.xanchor, - xshift: annAtts.xshift, - yanchor: annAtts.yanchor, - yshift: annAtts.yshift, - - text: annAtts.text, - textangle: annAtts.textangle, - font: annAtts.font, - width: annAtts.width, - height: annAtts.height, - opacity: annAtts.opacity, - align: annAtts.align, - valign: annAtts.valign, - bgcolor: annAtts.bgcolor, - bordercolor: annAtts.bordercolor, - borderpad: annAtts.borderpad, - borderwidth: annAtts.borderwidth, - showarrow: annAtts.showarrow, - arrowcolor: annAtts.arrowcolor, - arrowhead: annAtts.arrowhead, - startarrowhead: annAtts.startarrowhead, - arrowside: annAtts.arrowside, - arrowsize: annAtts.arrowsize, - startarrowsize: annAtts.startarrowsize, - arrowwidth: annAtts.arrowwidth, - standoff: annAtts.standoff, - startstandoff: annAtts.startstandoff, - hovertext: annAtts.hovertext, - hoverlabel: annAtts.hoverlabel, - captureevents: annAtts.captureevents, - - // maybes later? - // clicktoshow: annAtts.clicktoshow, - // xclick: annAtts.xclick, - // yclick: annAtts.yclick, - - // not needed! - // axref: 'pixel' - // ayref: 'pixel' - // xref: 'x' - // yref: 'y - // zref: 'z' -}), 'calc', 'from-root'); - -},{"../../plot_api/edit_types":727,"../../plot_api/plot_template":734,"../annotations/attributes":553}],563:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); - -module.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]); - }; -} - -},{"../../lib":696,"../../plots/cartesian/axes":744}],564:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); -var handleAnnotationCommonDefaults = _dereq_('../annotations/common_defaults'); -var attributes = _dereq_('./attributes'); - -module.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'; - - // mock in such way that getFromId grabs correct 3D 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'); - - // if you have one coordinate you should all three - Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); - - // hard-set here for completeness - 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'; - - // TODO maybe default values should be bigger than the 2D case? - coerce('ax', -10); - coerce('ay', -30); - - // if you have one part of arrow length you should have both - Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); - } -} - -},{"../../lib":696,"../../plots/array_container_defaults":740,"../../plots/cartesian/axes":744,"../annotations/common_defaults":556,"./attributes":562}],565:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var drawRaw = _dereq_('../annotations/draw').drawRaw; -var project = _dereq_('../../plots/gl3d/project'); -var axLetters = ['x', 'y', 'z']; - -module.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); - } - } -}; - -},{"../../plots/gl3d/project":796,"../annotations/draw":559}],566:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); - -module.exports = { - moduleType: 'component', - name: 'annotations3d', - - schema: { - subplots: { - scene: {annotations: _dereq_('./attributes')} - } - }, - - layoutAttributes: _dereq_('./attributes'), - handleDefaults: _dereq_('./defaults'), - includeBasePlot: includeGL3D, - - convert: _dereq_('./convert'), - draw: _dereq_('./draw') -}; - -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); - } - } -} - -},{"../../lib":696,"../../registry":827,"./attributes":562,"./convert":563,"./defaults":564,"./draw":565}],567:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -// a trimmed down version of: -// https://github.com/alexcjohnson/world-calendars/blob/master/dist/index.js - -module.exports = _dereq_('world-calendars/dist/main'); - -_dereq_('world-calendars/dist/plus'); - -_dereq_('world-calendars/dist/calendars/chinese'); -_dereq_('world-calendars/dist/calendars/coptic'); -_dereq_('world-calendars/dist/calendars/discworld'); -_dereq_('world-calendars/dist/calendars/ethiopian'); -_dereq_('world-calendars/dist/calendars/hebrew'); -_dereq_('world-calendars/dist/calendars/islamic'); -_dereq_('world-calendars/dist/calendars/julian'); -_dereq_('world-calendars/dist/calendars/mayan'); -_dereq_('world-calendars/dist/calendars/nanakshahi'); -_dereq_('world-calendars/dist/calendars/nepali'); -_dereq_('world-calendars/dist/calendars/persian'); -_dereq_('world-calendars/dist/calendars/taiwan'); -_dereq_('world-calendars/dist/calendars/thai'); -_dereq_('world-calendars/dist/calendars/ummalqura'); - -},{"world-calendars/dist/calendars/chinese":534,"world-calendars/dist/calendars/coptic":535,"world-calendars/dist/calendars/discworld":536,"world-calendars/dist/calendars/ethiopian":537,"world-calendars/dist/calendars/hebrew":538,"world-calendars/dist/calendars/islamic":539,"world-calendars/dist/calendars/julian":540,"world-calendars/dist/calendars/mayan":541,"world-calendars/dist/calendars/nanakshahi":542,"world-calendars/dist/calendars/nepali":543,"world-calendars/dist/calendars/persian":544,"world-calendars/dist/calendars/taiwan":545,"world-calendars/dist/calendars/thai":546,"world-calendars/dist/calendars/ummalqura":547,"world-calendars/dist/main":548,"world-calendars/dist/plus":549}],568:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var calendars = _dereq_('./calendars'); - -var Lib = _dereq_('../../lib'); -var constants = _dereq_('../../constants/numerical'); - -var EPOCHJD = constants.EPOCHJD; -var ONEDAY = constants.ONEDAY; - -var attributes = { - valType: 'enumerated', - values: Object.keys(calendars.calendars), - - editType: 'calc', - dflt: 'gregorian' -}; - -var handleDefaults = function(contIn, contOut, attr, dflt) { - var attrs = {}; - attrs[attr] = attributes; - - return Lib.coerce(contIn, contOut, attrs, attr, dflt); -}; - -var handleTraceDefaults = function(traceIn, traceOut, coords, layout) { - for(var i = 0; i < coords.length; i++) { - handleDefaults(traceIn, traceOut, coords[i] + 'calendar', layout.calendar); - } -}; - -// each calendar needs its own default canonical tick. I would love to use -// 2000-01-01 (or even 0000-01-01) for them all but they don't necessarily -// all support either of those dates. Instead I'll use the most significant -// number they *do* support, biased toward the present day. -var CANONICAL_TICK = { - chinese: '2000-01-01', - coptic: '2000-01-01', - discworld: '2000-01-01', - ethiopian: '2000-01-01', - hebrew: '5000-01-01', - islamic: '1000-01-01', - julian: '2000-01-01', - mayan: '5000-01-01', - nanakshahi: '1000-01-01', - nepali: '2000-01-01', - persian: '1000-01-01', - jalali: '1000-01-01', - taiwan: '1000-01-01', - thai: '2000-01-01', - ummalqura: '1400-01-01' -}; - -// Start on a Sunday - for week ticks -// Discworld and Mayan calendars don't have 7-day weeks but we're going to give them -// 7-day week ticks so start on our Sundays. -// If anyone really cares we can customize the auto tick spacings for these calendars. -var CANONICAL_SUNDAY = { - chinese: '2000-01-02', - coptic: '2000-01-03', - discworld: '2000-01-03', - ethiopian: '2000-01-05', - hebrew: '5000-01-01', - islamic: '1000-01-02', - julian: '2000-01-03', - mayan: '5000-01-01', - nanakshahi: '1000-01-05', - nepali: '2000-01-05', - persian: '1000-01-01', - jalali: '1000-01-01', - taiwan: '1000-01-04', - thai: '2000-01-04', - ummalqura: '1400-01-06' -}; - -var DFLTRANGE = { - chinese: ['2000-01-01', '2001-01-01'], - coptic: ['1700-01-01', '1701-01-01'], - discworld: ['1800-01-01', '1801-01-01'], - ethiopian: ['2000-01-01', '2001-01-01'], - hebrew: ['5700-01-01', '5701-01-01'], - islamic: ['1400-01-01', '1401-01-01'], - julian: ['2000-01-01', '2001-01-01'], - mayan: ['5200-01-01', '5201-01-01'], - nanakshahi: ['0500-01-01', '0501-01-01'], - nepali: ['2000-01-01', '2001-01-01'], - persian: ['1400-01-01', '1401-01-01'], - jalali: ['1400-01-01', '1401-01-01'], - taiwan: ['0100-01-01', '0101-01-01'], - thai: ['2500-01-01', '2501-01-01'], - ummalqura: ['1400-01-01', '1401-01-01'] -}; - -/* - * convert d3 templates to world-calendars templates, so our users only need - * to know d3's specifiers. Map space padding to no padding, and unknown fields - * to an ugly placeholder - */ -var UNKNOWN = '##'; -var d3ToWorldCalendars = { - 'd': {'0': 'dd', '-': 'd'}, // 2-digit or unpadded day of month - 'e': {'0': 'd', '-': 'd'}, // alternate, always unpadded day of month - 'a': {'0': 'D', '-': 'D'}, // short weekday name - 'A': {'0': 'DD', '-': 'DD'}, // full weekday name - 'j': {'0': 'oo', '-': 'o'}, // 3-digit or unpadded day of the year - 'W': {'0': 'ww', '-': 'w'}, // 2-digit or unpadded week of the year (Monday first) - 'm': {'0': 'mm', '-': 'm'}, // 2-digit or unpadded month number - 'b': {'0': 'M', '-': 'M'}, // short month name - 'B': {'0': 'MM', '-': 'MM'}, // full month name - 'y': {'0': 'yy', '-': 'yy'}, // 2-digit year (map unpadded to zero-padded) - 'Y': {'0': 'yyyy', '-': 'yyyy'}, // 4-digit year (map unpadded to zero-padded) - 'U': UNKNOWN, // Sunday-first week of the year - 'w': UNKNOWN, // day of the week [0(sunday),6] - // combined format, we replace the date part with the world-calendar version - // and the %X stays there for d3 to handle with time parts - 'c': {'0': 'D M d %X yyyy', '-': 'D M d %X yyyy'}, - 'x': {'0': 'mm/dd/yyyy', '-': 'mm/dd/yyyy'} -}; - -function worldCalFmt(fmt, x, calendar) { - var dateJD = Math.floor((x + 0.05) / ONEDAY) + EPOCHJD, - cDate = getCal(calendar).fromJD(dateJD), - i = 0, - modifier, directive, directiveLen, directiveObj, replacementPart; - while((i = fmt.indexOf('%', i)) !== -1) { - modifier = fmt.charAt(i + 1); - if(modifier === '0' || modifier === '-' || modifier === '_') { - directiveLen = 3; - directive = fmt.charAt(i + 2); - if(modifier === '_') modifier = '-'; - } - else { - directive = modifier; - modifier = '0'; - directiveLen = 2; - } - directiveObj = d3ToWorldCalendars[directive]; - if(!directiveObj) { - i += directiveLen; - } - else { - // code is recognized as a date part but world-calendars doesn't support it - if(directiveObj === UNKNOWN) replacementPart = UNKNOWN; - - // format the cDate according to the translated directive - else replacementPart = cDate.formatDate(directiveObj[modifier]); - - fmt = fmt.substr(0, i) + replacementPart + fmt.substr(i + directiveLen); - i += replacementPart.length; - } - } - return fmt; -} - -// cache world calendars, so we don't have to reinstantiate -// during each date-time conversion -var allCals = {}; -function getCal(calendar) { - var calendarObj = allCals[calendar]; - if(calendarObj) return calendarObj; - - calendarObj = allCals[calendar] = calendars.instance(calendar); - return calendarObj; -} - -function makeAttrs(description) { - return Lib.extendFlat({}, attributes, { description: description }); -} - -function makeTraceAttrsDescription(coord) { - return 'Sets the calendar system to use with `' + coord + '` date data.'; -} - -var xAttrs = { - xcalendar: makeAttrs(makeTraceAttrsDescription('x')) -}; - -var xyAttrs = Lib.extendFlat({}, xAttrs, { - ycalendar: makeAttrs(makeTraceAttrsDescription('y')) -}); - -var xyzAttrs = Lib.extendFlat({}, xyAttrs, { - zcalendar: makeAttrs(makeTraceAttrsDescription('z')) -}); - -var axisAttrs = makeAttrs([ - 'Sets the calendar system to use for `range` and `tick0`', - 'if this is a date axis. This does not set the calendar for', - 'interpreting data on this axis, that\'s specified in the trace', - 'or via the global `layout.calendar`' -].join(' ')); - -module.exports = { - moduleType: 'component', - name: 'calendars', - - schema: { - traces: { - scatter: xyAttrs, - bar: xyAttrs, - box: xyAttrs, - heatmap: xyAttrs, - contour: xyAttrs, - histogram: xyAttrs, - histogram2d: xyAttrs, - histogram2dcontour: xyAttrs, - scatter3d: xyzAttrs, - surface: xyzAttrs, - mesh3d: xyzAttrs, - scattergl: xyAttrs, - ohlc: xAttrs, - candlestick: xAttrs - }, - layout: { - calendar: makeAttrs([ - 'Sets the default calendar system to use for interpreting and', - 'displaying dates throughout the plot.' - ].join(' ')) - }, - subplots: { - xaxis: {calendar: axisAttrs}, - yaxis: {calendar: axisAttrs}, - scene: { - xaxis: {calendar: axisAttrs}, - // TODO: it's actually redundant to include yaxis and zaxis here - // because in the scene attributes these are the same object so merging - // into one merges into them all. However, I left them in for parity with - // cartesian, where yaxis is unused until we Plotschema.get() when we - // use its presence or absence to determine whether to delete attributes - // from yaxis if they only apply to x (rangeselector/rangeslider) - yaxis: {calendar: axisAttrs}, - zaxis: {calendar: axisAttrs} - }, - polar: { - radialaxis: {calendar: axisAttrs} - } - }, - transforms: { - filter: { - valuecalendar: makeAttrs([ - 'Sets the calendar system to use for `value`, if it is a date.' - ].join(' ')), - targetcalendar: makeAttrs([ - 'Sets the calendar system to use for `target`, if it is an', - 'array of dates. If `target` is a string (eg *x*) we use the', - 'corresponding trace attribute (eg `xcalendar`) if it exists,', - 'even if `targetcalendar` is provided.' - ].join(' ')) - } - } - }, - - layoutAttributes: attributes, - - handleDefaults: handleDefaults, - handleTraceDefaults: handleTraceDefaults, - - CANONICAL_SUNDAY: CANONICAL_SUNDAY, - CANONICAL_TICK: CANONICAL_TICK, - DFLTRANGE: DFLTRANGE, - - getCal: getCal, - worldCalFmt: worldCalFmt -}; - -},{"../../constants/numerical":673,"../../lib":696,"./calendars":567}],569:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -// IMPORTANT - default colors should be in hex for compatibility -exports.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 -]; - -exports.defaultLine = '#444'; - -exports.lightLine = '#eee'; - -exports.background = '#fff'; - -exports.borderLine = '#BEC8D9'; - -// with axis.color and Color.interp we aren't using lightLine -// itself anymore, instead interpolating between axis.color -// and the background color using tinycolor.mix. lightFraction -// gives back exactly lightLine if the other colors are defaults. -exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); - -},{}],570:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var tinycolor = _dereq_('tinycolor2'); -var isNumeric = _dereq_('fast-isnumeric'); - -var color = module.exports = {}; - -var colorAttrs = _dereq_('./attributes'); -color.defaults = colorAttrs.defaults; -var defaultLine = color.defaultLine = colorAttrs.defaultLine; -color.lightLine = colorAttrs.lightLine; -var background = color.background = colorAttrs.background; - -/* - * tinyRGB: turn a tinycolor into an rgb string, but - * unlike the built-in tinycolor.toRgbString this never includes alpha - */ -color.tinyRGB = function(tc) { - var c = tc.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, op) { - var c = tinycolor(cstr).toRgb(); - return 'rgba(' + Math.round(c.r) + ', ' + - Math.round(c.g) + ', ' + Math.round(c.b) + ', ' + op + ')'; -}; - -// combine two colors into one apparent color -// if back has transparency or is missing, -// color.background is assumed behind it -color.combine = function(front, back) { - var fc = tinycolor(front).toRgb(); - if(fc.a === 1) return tinycolor(front).toRgbString(); - - var bc = tinycolor(back || background).toRgb(), - bcflat = bc.a === 1 ? bc : { - r: 255 * (1 - bc.a) + bc.r * bc.a, - g: 255 * (1 - bc.a) + bc.g * bc.a, - b: 255 * (1 - bc.a) + bc.b * bc.a - }, - fcflat = { - r: bcflat.r * (1 - fc.a) + fc.r * fc.a, - g: bcflat.g * (1 - fc.a) + fc.g * fc.a, - b: bcflat.b * (1 - fc.a) + fc.b * fc.a - }; - return tinycolor(fcflat).toRgbString(); -}; - -/* - * Create a color that contrasts with cstr. - * - * If cstr is a dark color, we lighten it; if it's light, we darken. - * - * If lightAmount / darkAmount are used, we adjust by these percentages, - * otherwise we go all the way to white or black. - */ -color.contrast = function(cstr, lightAmount, darkAmount) { - var tc = tinycolor(cstr); - - if(tc.getAlpha() !== 1) tc = tinycolor(color.combine(cstr, background)); - - var newColor = tc.isDark() ? - (lightAmount ? tc.lighten(lightAmount) : background) : - (darkAmount ? tc.darken(darkAmount) : defaultLine); - - return newColor.toString(); -}; - -color.stroke = function(s, c) { - var tc = tinycolor(c); - s.style({'stroke': color.tinyRGB(tc), 'stroke-opacity': tc.getAlpha()}); -}; - -color.fill = function(s, c) { - var tc = tinycolor(c); - s.style({ - 'fill': color.tinyRGB(tc), - 'fill-opacity': tc.getAlpha() - }); -}; - -// search container for colors with the deprecated rgb(fractions) format -// and convert them to rgb(0-255 values) -color.clean = function(container) { - if(!container || typeof container !== 'object') return; - - var keys = Object.keys(container), - i, - j, - key, - val; - - for(i = 0; i < keys.length; i++) { - key = keys[i]; - val = container[key]; - - // only sanitize keys that end in "color" or "colorscale" - 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)) { - // colorscales have the format [[0, color1], [frac, color2], ... [1, colorN]] - for(j = 0; j < val.length; j++) { - if(Array.isArray(val[j])) val[j][1] = cleanOne(val[j][1]); - } - } - // recurse into arrays of objects, and plain objects - 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') 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*/), - 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]); - - // all parts must be non-negative numbers - if(!(parts[i] >= 0)) return val; - // alpha>1 gets clipped to 1 - if(i === 3) { - if(parts[i] > 1) parts[i] = 1; - } - // r, g, b must be < 1 (ie 1 itself is not allowed) - 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 + ')'; -} - -},{"./attributes":569,"fast-isnumeric":214,"tinycolor2":514}],571:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var axesAttrs = _dereq_('../../plots/cartesian/layout_attributes'); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; - - -module.exports = overrideAll({ -// TODO: only right is supported currently -// orient: { -// valType: 'enumerated', -// -// values: ['left', 'right', 'top', 'bottom'], -// dflt: 'right', -// -// }, - thicknessmode: { - valType: 'enumerated', - values: ['fraction', 'pixels'], - - dflt: 'pixels', - - }, - thickness: { - valType: 'number', - - min: 0, - dflt: 30, - - }, - lenmode: { - valType: 'enumerated', - values: ['fraction', 'pixels'], - - dflt: 'fraction', - - }, - len: { - valType: 'number', - min: 0, - dflt: 1, - - - }, - x: { - valType: 'number', - dflt: 1.02, - min: -2, - max: 3, - - - }, - xanchor: { - valType: 'enumerated', - values: ['left', 'center', 'right'], - dflt: 'left', - - - }, - xpad: { - valType: 'number', - - min: 0, - dflt: 10, - - }, - y: { - valType: 'number', - - dflt: 0.5, - min: -2, - max: 3, - - }, - yanchor: { - valType: 'enumerated', - values: ['top', 'middle', 'bottom'], - - dflt: 'middle', - - }, - ypad: { - valType: 'number', - - min: 0, - dflt: 10, - - }, - // 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, - - }, - bgcolor: { - valType: 'color', - - dflt: 'rgba(0,0,0,0)', - - }, - // tick and title properties named and function exactly as in axes - tickmode: axesAttrs.tickmode, - nticks: axesAttrs.nticks, - tick0: axesAttrs.tick0, - dtick: axesAttrs.dtick, - tickvals: axesAttrs.tickvals, - ticktext: axesAttrs.ticktext, - ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), - ticklen: axesAttrs.ticklen, - tickwidth: axesAttrs.tickwidth, - tickcolor: axesAttrs.tickcolor, - showticklabels: axesAttrs.showticklabels, - tickfont: fontAttrs({ - - }), - 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, - showexponent: axesAttrs.showexponent, - title: { - valType: 'string', - - - }, - titlefont: fontAttrs({ - - }), - titleside: { - valType: 'enumerated', - values: ['right', 'top', 'bottom'], - - dflt: 'top', - - } -}, 'colorbars', 'from-root'); - -},{"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/cartesian/layout_attributes":757,"../../plots/font_attributes":771}],572:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var drawColorbar = _dereq_('./draw'); - -/** - * connectColorbar: create a colorbar from a trace, using its module to - * describe the connection. - * - * @param {DOM element} gd - * - * @param {Array} cd - * calcdata entry for this trace. cd[0].trace is the trace itself, and the - * colorbar object will be stashed in cd[0].t.cb - * - * @param {object|function} moduleOpts - * may be a function(gd, cd) to override the standard handling below. If - * an object, should have these keys: - * @param {Optional(string)} moduleOpts.container - * name of the container inside the trace where the colorbar and colorscale - * attributes live (ie 'marker', 'line') - omit if they're at the trace root. - * @param {string} moduleOpts.min - * name of the attribute holding the value of the minimum color - * @param {string} moduleOpts.max - * name of the attribute holding the value of the maximum color - * @param {Optional(string)} moduleOpts.vals - * name of the attribute holding the (numeric) color data - * used only if min/max fail. May be omitted if these are always - * pre-calculated. - */ -module.exports = function connectColorbar(gd, cd, moduleOpts) { - if(typeof moduleOpts === 'function') return moduleOpts(gd, cd); - - var trace = cd[0].trace; - var cbId = 'cb' + trace.uid; - var containerName = moduleOpts.container; - var container = containerName ? trace[containerName] : trace; - - gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); - if(!container || !container.showscale) return; - - var cb = cd[0].t.cb = drawColorbar(gd, cbId); - - cb.fillgradient(container.colorscale) - .zrange([container[moduleOpts.min], container[moduleOpts.max]]) - .options(container.colorbar)(); -}; - -},{"./draw":575}],573:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.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' - } -}; - -},{}],574:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Template = _dereq_('../../plot_api/plot_template'); - -var handleTickValueDefaults = _dereq_('../../plots/cartesian/tick_value_defaults'); -var handleTickMarkDefaults = _dereq_('../../plots/cartesian/tick_mark_defaults'); -var handleTickLabelDefaults = _dereq_('../../plots/cartesian/tick_label_defaults'); - -var attributes = _dereq_('./attributes'); - - -module.exports = function colorbarDefaults(containerIn, containerOut, layout) { - var colorbarOut = Template.newContainer(containerOut, 'colorbar'), - colorbarIn = containerIn.colorbar || {}; - - function coerce(attr, dflt) { - return Lib.coerce(colorbarIn, colorbarOut, attributes, attr, dflt); - } - - var thicknessmode = coerce('thicknessmode'); - coerce('thickness', (thicknessmode === 'fraction') ? - 30 / (layout.width - layout.margin.l - layout.margin.r) : - 30 - ); - - var lenmode = coerce('lenmode'); - coerce('len', (lenmode === 'fraction') ? - 1 : - layout.height - layout.margin.t - layout.margin.b - ); - - coerce('x'); - coerce('xanchor'); - coerce('xpad'); - coerce('y'); - coerce('yanchor'); - coerce('ypad'); - Lib.noneOrAll(colorbarIn, colorbarOut, ['x', 'y']); - - coerce('outlinecolor'); - coerce('outlinewidth'); - coerce('bordercolor'); - coerce('borderwidth'); - coerce('bgcolor'); - - handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); - - var opts = {outerTicks: false, font: layout.font}; - handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); - handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); - - coerce('title', layout._dfltTitle.colorbar); - Lib.coerceFont(coerce, 'titlefont', layout.font); - coerce('titleside'); -}; - -},{"../../lib":696,"../../plot_api/plot_template":734,"../../plots/cartesian/tick_label_defaults":764,"../../plots/cartesian/tick_mark_defaults":765,"../../plots/cartesian/tick_value_defaults":766,"./attributes":571}],575:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); - -var Plots = _dereq_('../../plots/plots'); -var Registry = _dereq_('../../registry'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var dragElement = _dereq_('../dragelement'); -var Lib = _dereq_('../../lib'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var setCursor = _dereq_('../../lib/setcursor'); -var Drawing = _dereq_('../drawing'); -var Color = _dereq_('../color'); -var Titles = _dereq_('../titles'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var alignmentConstants = _dereq_('../../constants/alignment'); -var LINE_SPACING = alignmentConstants.LINE_SPACING; -var FROM_TL = alignmentConstants.FROM_TL; -var FROM_BR = alignmentConstants.FROM_BR; - -var handleAxisDefaults = _dereq_('../../plots/cartesian/axis_defaults'); -var handleAxisPositionDefaults = _dereq_('../../plots/cartesian/position_defaults'); -var axisLayoutAttrs = _dereq_('../../plots/cartesian/layout_attributes'); - -var attributes = _dereq_('./attributes'); -var cn = _dereq_('./constants').cn; - -module.exports = function draw(gd, id) { - // opts: options object, containing everything from attributes - // plus a few others that are the equivalent of the colorbar "data" - var opts = {}; - for(var k in attributes) { - opts[k] = null; - } - // 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 - opts.fillcolor = null; - // line.color has the same options as fillcolor - opts.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) - opts.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 - opts.filllevels = null; - // for continuous colorscales: fill with a gradient instead of explicit levels - // value should be the colorscale [[0, c0], [v1, c1], ..., [1, cEnd]] - opts.fillgradient = null; - // when using a gradient, we need the data range specified separately - opts.zrange = null; - - function component() { - var fullLayout = gd._fullLayout, - gs = fullLayout._size; - if((typeof opts.fillcolor !== 'function') && - (typeof opts.line.color !== 'function') && - !opts.fillgradient) { - fullLayout._infolayer.selectAll('g.' + id).remove(); - return; - } - var zrange = opts.zrange || (d3.extent(((typeof opts.fillcolor === 'function') ? - opts.fillcolor : opts.line.color).domain())); - var linelevels = []; - var filllevels = []; - var linecolormap = typeof opts.line.color === 'function' ? - opts.line.color : function() { return opts.line.color; }; - var fillcolormap = typeof opts.fillcolor === 'function' ? - opts.fillcolor : function() { return opts.fillcolor; }; - var l; - var i; - - var l0 = opts.levels.end + opts.levels.size / 100, - ls = opts.levels.size, - zr0 = (1.001 * zrange[0] - 0.001 * zrange[1]), - zr1 = (1.001 * zrange[1] - 0.001 * zrange[0]); - for(i = 0; i < 1e5; i++) { - l = opts.levels.start + i * ls; - if(ls > 0 ? (l >= l0) : (l <= l0)) break; - if(l > zr0 && l < zr1) linelevels.push(l); - } - - if(opts.fillgradient) { - filllevels = [0]; - } - else if(typeof opts.fillcolor === 'function') { - if(opts.filllevels) { - l0 = opts.filllevels.end + opts.filllevels.size / 100; - ls = opts.filllevels.size; - for(i = 0; i < 1e5; i++) { - l = opts.filllevels.start + i * ls; - if(ls > 0 ? (l >= l0) : (l <= l0)) break; - if(l > zrange[0] && l < zrange[1]) filllevels.push(l); - } - } - else { - filllevels = linelevels.map(function(v) { - return v - opts.levels.size / 2; - }); - filllevels.push(filllevels[filllevels.length - 1] + - opts.levels.size); - } - } - else if(opts.fillcolor && typeof opts.fillcolor === 'string') { - // doesn't matter what this value is, with a single value - // we'll make a single fill rect covering the whole bar - filllevels = [0]; - } - - if(opts.levels.size < 0) { - linelevels.reverse(); - filllevels.reverse(); - } - - // now make a Plotly Axes object to scale with and draw ticks - // TODO: does not support orientation other than right - - // we calculate pixel sizes based on the specified graph size, - // not the actual (in case something pushed the margins around) - // which is a little odd but avoids an odd iterative effect - // when the colorbar itself is pushing the margins. - // but then the fractional size is calculated based on the - // actual graph size, so that the axes will size correctly. - var plotHeight = gs.h, - plotWidth = gs.w, - thickPx = Math.round(opts.thickness * - (opts.thicknessmode === 'fraction' ? plotWidth : 1)), - thickFrac = thickPx / gs.w, - lenPx = Math.round(opts.len * - (opts.lenmode === 'fraction' ? plotHeight : 1)), - lenFrac = lenPx / gs.h, - xpadFrac = opts.xpad / gs.w, - yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2, - ypadFrac = opts.ypad / gs.h, - - // x positioning: do it initially just for left anchor, - // then fix at the end (since we don't know the width yet) - xLeft = Math.round(opts.x * gs.w + opts.xpad), - // for dragging... this is getting a little muddled... - xLeftFrac = opts.x - thickFrac * - ({middle: 0.5, right: 1}[opts.xanchor]||0), - - // y positioning we can do correctly from the start - yBottomFrac = opts.y + lenFrac * - (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5), - yBottomPx = Math.round(gs.h * (1 - yBottomFrac)), - yTopPx = yBottomPx - lenPx, - titleEl, - 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, - tickfont: opts.tickfont, - tickangle: opts.tickangle, - tickformat: opts.tickformat, - exponentformat: opts.exponentformat, - separatethousands: opts.separatethousands, - showexponent: opts.showexponent, - showtickprefix: opts.showtickprefix, - tickprefix: opts.tickprefix, - showticksuffix: opts.showticksuffix, - ticksuffix: opts.ticksuffix, - title: opts.title, - titlefont: opts.titlefont, - showline: true, - anchor: 'free', - position: 1 - }, - cbAxisOut = { - type: 'linear', - _id: 'y' + id - }, - axisOptions = { - letter: 'y', - font: fullLayout.font, - noHover: true, - calendar: fullLayout.calendar // not really necessary (yet?) - }; - - // Coerce w.r.t. Axes layoutAttributes: - // re-use axes.js logic without updating _fullData - function coerce(attr, dflt) { - return Lib.coerce(cbAxisIn, cbAxisOut, axisLayoutAttrs, attr, dflt); - } - - // Prepare the Plotly axis object - handleAxisDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions, fullLayout); - handleAxisPositionDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions); - - // position can't go in through supplyDefaults - // because that restricts it to [0,1] - cbAxisOut.position = opts.x + xpadFrac + thickFrac; - - // save for other callers to access this axis - component.axis = cbAxisOut; - - if(['top', 'bottom'].indexOf(opts.titleside) !== -1) { - cbAxisOut.titleside = opts.titleside; - cbAxisOut.titlex = opts.x + xpadFrac; - cbAxisOut.titley = yBottomFrac + - (opts.titleside === 'top' ? lenFrac - ypadFrac : ypadFrac); - } - - if(opts.line.color && opts.tickmode === 'auto') { - cbAxisOut.tickmode = 'linear'; - cbAxisOut.tick0 = opts.levels.start; - var dtick = opts.levels.size; - // expand if too many contours, so we don't get too many ticks - var autoNtick = Lib.constrain( - (yBottomPx - yTopPx) / 50, 4, 15) + 1, - 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 the contours are at round multiples, reset tick0 - // so they're still at round multiples. Otherwise, - // keep the first label on the first contour level - if((Math.abs(opts.levels.start) / - opts.levels.size + 1e-6) % 1 < 2e-6) { - cbAxisOut.tick0 = 0; - } - } - cbAxisOut.dtick = dtick; - } - - // set domain after init, because we may want to - // allow it outside [0,1] - cbAxisOut.domain = [ - yBottomFrac + ypadFrac, - yBottomFrac + lenFrac - ypadFrac - ]; - cbAxisOut.setScale(); - - // now draw the elements - var container = Lib.ensureSingle(fullLayout._infolayer, 'g', id, function(s) { - s.classed(cn.colorbar, true) - .each(function() { - var s = d3.select(this); - s.append('rect').classed(cn.cbbg, true); - s.append('g').classed(cn.cbfills, true); - s.append('g').classed(cn.cblines, true); - s.append('g').classed(cn.cbaxis, true).classed(cn.crisp, true); - s.append('g').classed(cn.cbtitleunshift, true) - .append('g').classed(cn.cbtitle, true); - s.append('rect').classed(cn.cboutline, true); - s.select('.cbtitle').datum(0); - }); - }); - - container.attr('transform', 'translate(' + Math.round(gs.l) + - ',' + Math.round(gs.t) + ')'); - // TODO: this opposite transform is a hack until we make it - // more rational which items get this offset - var titleCont = container.select('.cbtitleunshift') - .attr('transform', 'translate(-' + - Math.round(gs.l) + ',-' + - Math.round(gs.t) + ')'); - - cbAxisOut._axislayer = container.select('.cbaxis'); - var titleHeight = 0; - if(['top', 'bottom'].indexOf(opts.titleside) !== -1) { - // draw the title so we know how much room it needs - // when we squish the axis. This one only applies to - // top or bottom titles, not right side. - var x = gs.l + (opts.x + xpadFrac) * gs.w, - fontSize = cbAxisOut.titlefont.size, - y; - - if(opts.titleside === 'top') { - y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h + - gs.t + 3 + fontSize * 0.75; - } - else { - y = (1 - (yBottomFrac + ypadFrac)) * gs.h + - gs.t - 3 - fontSize * 0.25; - } - drawTitle(cbAxisOut._id + 'title', { - attributes: {x: x, y: y, 'text-anchor': 'start'} - }); - } - - function drawAxis() { - if(['top', 'bottom'].indexOf(opts.titleside) !== -1) { - // squish the axis top to make room for the title - var titleGroup = container.select('.cbtitle'), - titleText = titleGroup.select('text'), - titleTrans = - [-opts.outlinewidth / 2, opts.outlinewidth / 2], - mathJaxNode = titleGroup - .select('.h' + cbAxisOut._id + 'title-math-group') - .node(), - lineSize = 15.6; - if(titleText.node()) { - lineSize = - parseInt(titleText.node().style.fontSize, 10) * LINE_SPACING; - } - if(mathJaxNode) { - titleHeight = Drawing.bBox(mathJaxNode).height; - if(titleHeight > lineSize) { - // not entirely sure how mathjax is doing - // vertical alignment, but this seems to work. - titleTrans[1] -= (titleHeight - lineSize) / 2; - } - } - else if(titleText.node() && - !titleText.classed(cn.jsPlaceholder)) { - titleHeight = Drawing.bBox(titleText.node()).height; - } - if(titleHeight) { - // buffer btwn colorbar and title - // TODO: configurable - titleHeight += 5; - - if(opts.titleside === 'top') { - cbAxisOut.domain[1] -= titleHeight / gs.h; - titleTrans[1] *= -1; - } - else { - cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = svgTextUtils.lineCount(titleText); - titleTrans[1] += (1 - nlines) * lineSize; - } - - titleGroup.attr('transform', - 'translate(' + titleTrans + ')'); - - cbAxisOut.setScale(); - } - } - - container.selectAll('.cbfills,.cblines') - .attr('transform', 'translate(0,' + - Math.round(gs.h * (1 - cbAxisOut.domain[1])) + ')'); - - cbAxisOut._axislayer.attr('transform', 'translate(0,' + - Math.round(-gs.t) + ')'); - - var fills = container.select('.cbfills') - .selectAll('rect.cbfill') - .data(filllevels); - fills.enter().append('rect') - .classed(cn.cbfill, true) - .style('stroke', 'none'); - fills.exit().remove(); - - var zBounds = zrange - .map(cbAxisOut.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(cbAxisOut.c2p) - .map(Math.round); - - // offset the side adjoining the next rectangle so they - // overlap, to prevent antialiasing gaps - z[1] = Lib.constrain(z[1] + (z[1] > z[0]) ? 1 : -1, zBounds[0], zBounds[1]); - - // Colorbar cannot currently support opacities so we - // use an opaque fill even when alpha channels present - var fillEl = d3.select(this).attr({ - x: xLeft, - width: Math.max(thickPx, 2), - y: d3.min(z), - height: Math.max(d3.max(z) - d3.min(z), 2), - }); - - if(opts.fillgradient) { - Drawing.gradient(fillEl, gd, id, 'vertical', - opts.fillgradient, 'fill'); - } - else { - // Tinycolor can't handle exponents and - // at this scale, removing it makes no difference. - var colorString = fillcolormap(d).replace('e-', ''); - fillEl.attr('fill', tinycolor(colorString).toHexString()); - } - }); - - var lines = container.select('.cblines') - .selectAll('path.cbline') - .data(opts.line.color && opts.line.width ? - linelevels : []); - lines.enter().append('path') - .classed(cn.cbline, true); - lines.exit().remove(); - lines.each(function(d) { - d3.select(this) - .attr('d', 'M' + xLeft + ',' + - (Math.round(cbAxisOut.c2p(d)) + (opts.line.width / 2) % 1) + - 'h' + thickPx) - .call(Drawing.lineGroupStyle, - opts.line.width, linecolormap(d), opts.line.dash); - }); - - // force full redraw of labels and ticks - cbAxisOut._axislayer.selectAll('g.' + cbAxisOut._id + 'tick,path') - .remove(); - - cbAxisOut._pos = xLeft + thickPx + - (opts.outlinewidth||0) / 2 - (opts.ticks === 'outside' ? 1 : 0); - cbAxisOut.side = 'right'; - - // separate out axis and title drawing, - // so we don't need such complicated logic in Titles.draw - // if title is on the top or bottom, we've already drawn it - // this title call only handles side=right - return Lib.syncOrAsync([ - function() { - return Axes.doTicksSingle(gd, cbAxisOut, true); - }, - function() { - if(['top', 'bottom'].indexOf(opts.titleside) === -1) { - var fontSize = cbAxisOut.titlefont.size, - y = cbAxisOut._offset + cbAxisOut._length / 2, - x = gs.l + (cbAxisOut.position || 0) * gs.w + ((cbAxisOut.side === 'right') ? - 10 + fontSize * ((cbAxisOut.showticklabels ? 1 : 0.5)) : - -10 - fontSize * ((cbAxisOut.showticklabels ? 0.5 : 0))); - - // 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. - drawTitle('h' + cbAxisOut._id + 'title', { - avoid: { - selection: d3.select(gd).selectAll('g.' + cbAxisOut._id + 'tick'), - side: opts.titleside, - offsetLeft: gs.l, - offsetTop: 0, - maxShift: fullLayout.width - }, - attributes: {x: x, y: y, 'text-anchor': 'middle'}, - transform: {rotate: '-90', offset: 0} - }); - } - }]); - } - - function drawTitle(titleClass, titleOpts) { - var trace = getTrace(); - var propName = 'colorbar.title'; - var containerName = trace._module.colorbar.container; - if(containerName) propName = containerName + '.' + propName; - - var dfltTitleOpts = { - propContainer: cbAxisOut, - propName: propName, - traceIndex: trace.index, - placeholder: fullLayout._dfltTitle.colorbar, - containerGroup: container.select('.cbtitle') - }; - - // this class-to-rotate thing with convertToTspans is - // getting hackier and hackier... delete groups with the - // wrong class (in case earlier the colorbar was drawn on - // a different side, I think?) - var otherClass = titleClass.charAt(0) === 'h' ? - titleClass.substr(1) : ('h' + titleClass); - container.selectAll('.' + otherClass + ',.' + otherClass + '-math-group') - .remove(); - - Titles.draw(gd, titleClass, - extendFlat(dfltTitleOpts, titleOpts || {})); - } - - function positionCB() { - // wait for the axis & title to finish rendering before - // continuing positioning - // TODO: why are we redrawing multiple times now with this? - // I guess autoMargin doesn't like being post-promise? - var innerWidth = thickPx + opts.outlinewidth / 2 + - Drawing.bBox(cbAxisOut._axislayer.node()).width; - titleEl = titleCont.select('text'); - if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { - var mathJaxNode = titleCont - .select('.h' + cbAxisOut._id + 'title-math-group') - .node(), - titleWidth; - if(mathJaxNode && - ['top', 'bottom'].indexOf(opts.titleside) !== -1) { - titleWidth = Drawing.bBox(mathJaxNode).width; - } - else { - // note: the formula below works for all titlesides, - // (except for top/bottom mathjax, above) - // but the weird gs.l is because the titleunshift - // transform gets removed by Drawing.bBox - titleWidth = - Drawing.bBox(titleCont.node()).right - - xLeft - gs.l; - } - innerWidth = Math.max(innerWidth, titleWidth); - } - - var outerwidth = 2 * opts.xpad + innerWidth + - opts.borderwidth + opts.outlinewidth / 2, - outerheight = yBottomPx - yTopPx; - - container.select('.cbbg').attr({ - x: xLeft - opts.xpad - - (opts.borderwidth + opts.outlinewidth) / 2, - y: yTopPx - yExtraPx, - width: Math.max(outerwidth, 2), - height: Math.max(outerheight + 2 * yExtraPx, 2) - }) - .call(Color.fill, opts.bgcolor) - .call(Color.stroke, opts.bordercolor) - .style({'stroke-width': opts.borderwidth}); - - container.selectAll('.cboutline').attr({ - x: xLeft, - y: yTopPx + opts.ypad + - (opts.titleside === 'top' ? titleHeight : 0), - width: Math.max(thickPx, 2), - height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2) - }) - .call(Color.stroke, opts.outlinecolor) - .style({ - fill: 'None', - 'stroke-width': opts.outlinewidth - }); - - // fix positioning for xanchor!='left' - var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * - outerwidth; - container.attr('transform', - 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); - - // auto margin adjustment - var marginOpts = {}; - var tFrac = FROM_TL[opts.yanchor]; - var bFrac = FROM_BR[opts.yanchor]; - if(opts.lenmode === 'pixels') { - marginOpts.y = opts.y; - marginOpts.t = outerheight * tFrac; - marginOpts.b = outerheight * bFrac; - } - else { - marginOpts.t = marginOpts.b = 0; - marginOpts.yt = opts.y + opts.len * tFrac; - marginOpts.yb = opts.y - opts.len * bFrac; - } - - var lFrac = FROM_TL[opts.xanchor]; - var rFrac = FROM_BR[opts.xanchor]; - if(opts.thicknessmode === 'pixels') { - marginOpts.x = opts.x; - marginOpts.l = outerwidth * lFrac; - marginOpts.r = outerwidth * rFrac; - } - else { - var extraThickness = outerwidth - thickPx; - marginOpts.l = extraThickness * lFrac; - marginOpts.r = extraThickness * rFrac; - marginOpts.xl = opts.x - opts.thickness * lFrac; - marginOpts.xr = opts.x + opts.thickness * rFrac; - } - Plots.autoMargin(gd, id, marginOpts); - } - - var cbDone = Lib.syncOrAsync([ - Plots.previousPromises, - drawAxis, - Plots.previousPromises, - positionCB - ], gd); - - if(cbDone && cbDone.then) (gd._promises || []).push(cbDone); - - // dragging... - if(gd._context.edits.colorbarPosition) { - var t0, - xf, - yf; - - dragElement.init({ - element: container.node(), - gd: gd, - prepFn: function() { - t0 = container.attr('transform'); - setCursor(container); - }, - moveFn: function(dx, dy) { - container.attr('transform', - t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); - - xf = dragElement.align(xLeftFrac + (dx / gs.w), thickFrac, - 0, 1, opts.xanchor); - yf = dragElement.align(yBottomFrac - (dy / gs.h), lenFrac, - 0, 1, opts.yanchor); - - var csr = dragElement.getCursor(xf, yf, - opts.xanchor, opts.yanchor); - setCursor(container, csr); - }, - doneFn: function() { - setCursor(container); - - if(xf !== undefined && yf !== undefined) { - Registry.call('restyle', - gd, - {'colorbar.x': xf, 'colorbar.y': yf}, - getTrace().index - ); - } - } - }); - } - return cbDone; - } - - function getTrace() { - var idNum = id.substr(2), - i, - trace; - for(i = 0; i < gd._fullData.length; i++) { - trace = gd._fullData[i]; - if(trace.uid === idNum) return trace; - } - } - - // setter/getters for every item defined in opts - Object.keys(opts).forEach(function(name) { - component[name] = function(v) { - // getter - if(!arguments.length) return opts[name]; - - // setter - for multi-part properties, - // set only the parts that are provided - opts[name] = Lib.isPlainObject(opts[name]) ? - Lib.extendFlat(opts[name], v) : - v; - - return component; - }; - }); - - // or use .options to set multiple options at once via a dictionary - component.options = function(o) { - for(var name in o) { - // in case something random comes through - // that's not an option, ignore it - if(typeof component[name] === 'function') { - component[name](o[name]); - } - } - return component; - }; - - component._opts = opts; - - return component; -}; - -},{"../../constants/alignment":668,"../../lib":696,"../../lib/extend":685,"../../lib/setcursor":716,"../../lib/svg_text_utils":720,"../../plots/cartesian/axes":744,"../../plots/cartesian/axis_defaults":746,"../../plots/cartesian/layout_attributes":757,"../../plots/cartesian/position_defaults":760,"../../plots/plots":808,"../../registry":827,"../color":570,"../dragelement":592,"../drawing":595,"../titles":661,"./attributes":571,"./constants":573,"d3":148,"tinycolor2":514}],576:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); - - -module.exports = function hasColorbar(container) { - return Lib.isPlainObject(container.colorbar); -}; - -},{"../../lib":696}],577:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var palettes = _dereq_('./scales.js'); -var paletteStr = Object.keys(palettes); - -function code(s) { - return '`' + s + '`'; -} - -/** - * Make colorscale attribute declarations for - * - * - colorscale, - * - (c|z)auto, (c|z)min, (c|z)max, - * - autocolorscale, reversescale, - * - showscale (optionally) - * - color (optionally) - * - * @param {string} context (dflt: '', i.e. from trace root): - * the container this is in ('', *marker*, *marker.line* etc) - * - * @param {object} opts: - * - cLetter {string} (dflt: 'c'): - * leading letter for 'min', 'max and 'auto' attribute (either 'z' or 'c') - * - * - colorAttr {string} (dflt: 'z' if `cLetter: 'z'`, 'color' if `cLetter: 'c'`): - * (for descriptions) sets the name of the color attribute that maps to the colorscale. - * - * N.B. if `colorAttr: 'color'`, we include the `color` declaration here. - * - * - onlyIfNumerical {string} (dflt: false' if `cLetter: 'z'`, true if `cLetter: 'c'`): - * (for descriptions) set to true if colorscale attribute only - * - * - colorscaleDflt {string}: - * overrides the colorscale dflt - * - * - autoColorDflt {boolean} (dflt true): - * normally autocolorscale.dflt is `true`, but pass `false` to override - * - * - noScale {boolean} (dflt: true if `context: 'marker.line'`, false otherwise): - * set to `false` to not include showscale attribute (e.g. for 'marker.line') - * - * - showScaleDflt {boolean} (dflt: true if `cLetter: 'z'`, false otherwise) - * - * - editTypeOverride {boolean} (dflt: ''): - * most of these attributes already require a recalc, but the ones that do not - * have editType *style* or *plot* unless you override (presumably with *calc*) - * - * @return {object} - */ -module.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 minFull = code(contextHead + min); - var maxFull = code(contextHead + max); - var minmaxFull = minFull + ' and ' + maxFull; - var autoImpliedEdits = {}; - autoImpliedEdits[min] = autoImpliedEdits[max] = undefined; - var minmaxImpliedEdits = {}; - minmaxImpliedEdits[auto] = false; - - var attrs = {}; - - if(colorAttr === 'color') { - attrs.color = { - valType: 'color', - arrayOk: true, - - editType: editTypeOverride || 'style', - - }; - } - - attrs[auto] = { - valType: 'boolean', - - dflt: true, - editType: 'calc', - impliedEdits: autoImpliedEdits, - - }; - - attrs[min] = { - valType: 'number', - - dflt: null, - editType: editTypeOverride || 'plot', - impliedEdits: minmaxImpliedEdits, - - }; - - attrs[max] = { - valType: 'number', - - dflt: null, - editType: editTypeOverride || 'plot', - impliedEdits: minmaxImpliedEdits, - - }; - - attrs.colorscale = { - valType: 'colorscale', - - editType: 'calc', - dflt: colorscaleDflt, - impliedEdits: {autocolorscale: false}, - - }; - - attrs.autocolorscale = { - valType: 'boolean', - - // gets overrode in 'heatmap' & 'surface' for backwards comp. - dflt: opts.autoColorDflt === false ? false : true, - editType: 'calc', - impliedEdits: {colorscale: undefined}, - - }; - - attrs.reversescale = { - valType: 'boolean', - - dflt: false, - editType: 'calc', - - }; - - if(!noScale) { - attrs.showscale = { - valType: 'boolean', - - dflt: showScaleDflt, - editType: 'calc', - - }; - } - - return attrs; -}; - -},{"./scales.js":589}],578:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); - -var scales = _dereq_('./scales'); -var flipScale = _dereq_('./flip_scale'); - - -module.exports = function calc(trace, vals, containerStr, cLetter) { - var container = trace; - var inputContainer = trace._input; - var fullInputContainer = trace._fullInput; - - // set by traces with groupby transforms - var updateStyle = trace.updateStyle; - - function doUpdate(attr, inputVal, fullVal) { - if(fullVal === undefined) fullVal = inputVal; - - if(updateStyle) { - updateStyle(trace._input, containerStr ? (containerStr + '.' + attr) : attr, inputVal); - } - else { - inputContainer[attr] = inputVal; - } - - container[attr] = fullVal; - if(fullInputContainer && (trace !== trace._fullInput)) { - if(updateStyle) { - updateStyle(trace._fullInput, containerStr ? (containerStr + '.' + attr) : attr, fullVal); - } - else { - fullInputContainer[attr] = fullVal; - } - } - } - - if(containerStr) { - container = Lib.nestedProperty(container, containerStr).get(); - inputContainer = Lib.nestedProperty(inputContainer, containerStr).get(); - fullInputContainer = Lib.nestedProperty(fullInputContainer, containerStr).get() || {}; - } - - var autoAttr = cLetter + 'auto'; - var minAttr = cLetter + 'min'; - var maxAttr = cLetter + 'max'; - var auto = container[autoAttr]; - var min = container[minAttr]; - var max = container[maxAttr]; - var scl = container.colorscale; - - if(auto !== false || min === undefined) { - min = Lib.aggNums(Math.min, null, vals); - } - - if(auto !== false || max === undefined) { - max = Lib.aggNums(Math.max, null, vals); - } - - if(min === max) { - min -= 0.5; - max += 0.5; - } - - doUpdate(minAttr, min); - doUpdate(maxAttr, max); - - /* - * If auto was explicitly false but min or max was missing, - * we filled in the missing piece here but later the trace does - * not look auto. - * Otherwise make sure the trace still looks auto as far as later - * changes are concerned. - */ - doUpdate(autoAttr, (auto !== false || (min === undefined && max === undefined))); - - if(container.autocolorscale) { - if(min * max < 0) scl = scales.RdBu; - else if(min >= 0) scl = scales.Reds; - else scl = scales.Blues; - - // reversescale is handled at the containerOut level - doUpdate('colorscale', scl, container.reversescale ? flipScale(scl) : scl); - - // We pushed a colorscale back to input, which will change the default autocolorscale next time - // to avoid spurious redraws from Plotly.react, update resulting autocolorscale now - // This is a conscious decision so that changing the data later does not unexpectedly - // give you a new colorscale - if(!inputContainer.autocolorscale) { - doUpdate('autocolorscale', false); - } - } -}; - -},{"../../lib":696,"./flip_scale":582,"./scales":589}],579:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var scales = _dereq_('./scales'); - - -module.exports = scales.RdBu; - -},{"./scales":589}],580:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -var Lib = _dereq_('../../lib'); - -var hasColorbar = _dereq_('../colorbar/has_colorbar'); -var colorbarDefaults = _dereq_('../colorbar/defaults'); -var isValidScale = _dereq_('./is_valid_scale'); -var flipScale = _dereq_('./flip_scale'); - - -module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, opts) { - var prefix = opts.prefix, - cLetter = opts.cLetter, - containerStr = prefix.slice(0, prefix.length - 1), - containerIn = prefix ? - Lib.nestedProperty(traceIn, containerStr).get() || {} : - traceIn, - containerOut = prefix ? - Lib.nestedProperty(traceOut, containerStr).get() || {} : - traceOut, - minIn = containerIn[cLetter + 'min'], - maxIn = containerIn[cLetter + 'max'], - sclIn = containerIn.colorscale; - - var validMinMax = isNumeric(minIn) && isNumeric(maxIn) && (minIn < maxIn); - coerce(prefix + cLetter + 'auto', !validMinMax); - coerce(prefix + cLetter + 'min'); - coerce(prefix + cLetter + 'max'); - - // handles both the trace case (autocolorscale is false by default) and - // the marker and marker.line case (autocolorscale is true by default) - var autoColorscaleDflt; - if(sclIn !== undefined) autoColorscaleDflt = !isValidScale(sclIn); - coerce(prefix + 'autocolorscale', autoColorscaleDflt); - var sclOut = coerce(prefix + 'colorscale'); - - // reversescale is handled at the containerOut level - var reverseScale = coerce(prefix + 'reversescale'); - if(reverseScale) containerOut.colorscale = flipScale(sclOut); - - // ... until Scatter.colorbar can handle marker line colorbars - if(prefix === 'marker.line.') return; - - if(!opts.noScale) { - // handles both the trace case where the dflt is listed in attributes and - // the marker case where the dflt is determined by hasColorbar - var showScaleDflt; - if(prefix) showScaleDflt = hasColorbar(containerIn); - - var showScale = coerce(prefix + 'showscale', showScaleDflt); - if(showScale) colorbarDefaults(containerIn, containerOut, layout); - } -}; - -},{"../../lib":696,"../colorbar/defaults":574,"../colorbar/has_colorbar":576,"./flip_scale":582,"./is_valid_scale":586,"fast-isnumeric":214}],581:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -/** - * Extract colorscale into numeric domain and color range. - * - * @param {array} scl colorscale array of arrays - * @param {number} cmin minimum color value (used to clamp scale) - * @param {number} cmax maximum color value (used to clamp scale) - */ -module.exports = function extractScale(scl, cmin, cmax) { - var N = scl.length, - domain = new Array(N), - range = new Array(N); - - for(var i = 0; i < N; i++) { - var si = scl[i]; - - domain[i] = cmin + si[0] * (cmax - cmin); - range[i] = si[1]; - } - - return { - domain: domain, - range: range - }; -}; - -},{}],582:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -module.exports = function flipScale(scl) { - var N = scl.length, - sclNew = new Array(N), - si; - - for(var i = N - 1, j = 0; i >= 0; i--, j++) { - si = scl[i]; - sclNew[j] = [1 - si[0], si[1]]; - } - - return sclNew; -}; - -},{}],583:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var scales = _dereq_('./scales'); -var defaultScale = _dereq_('./default_scale'); -var isValidScaleArray = _dereq_('./is_valid_scale_array'); - - -module.exports = 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(); - // occasionally scl is double-JSON encoded... - if(typeof scl === 'string') parseScale(); - } - - if(!isValidScaleArray(scl)) return dflt; - return scl; -}; - -},{"./default_scale":579,"./is_valid_scale_array":587,"./scales":589}],584:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var Lib = _dereq_('../../lib'); -var isValidScale = _dereq_('./is_valid_scale'); - -module.exports = function hasColorscale(trace, containerStr) { - var container = containerStr ? - Lib.nestedProperty(trace, containerStr).get() || {} : - trace; - var color = container.color; - - 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) - ) - ); -}; - -},{"../../lib":696,"./is_valid_scale":586,"fast-isnumeric":214}],585:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -exports.scales = _dereq_('./scales'); - -exports.defaultScale = _dereq_('./default_scale'); - -exports.attributes = _dereq_('./attributes'); - -exports.handleDefaults = _dereq_('./defaults'); - -exports.calc = _dereq_('./calc'); - -exports.hasColorscale = _dereq_('./has_colorscale'); - -exports.isValidScale = _dereq_('./is_valid_scale'); - -exports.getScale = _dereq_('./get_scale'); - -exports.flipScale = _dereq_('./flip_scale'); - -exports.extractScale = _dereq_('./extract_scale'); - -exports.makeColorScaleFunc = _dereq_('./make_color_scale_func'); - -},{"./attributes":577,"./calc":578,"./default_scale":579,"./defaults":580,"./extract_scale":581,"./flip_scale":582,"./get_scale":583,"./has_colorscale":584,"./is_valid_scale":586,"./make_color_scale_func":588,"./scales":589}],586:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var scales = _dereq_('./scales'); -var isValidScaleArray = _dereq_('./is_valid_scale_array'); - - -module.exports = function isValidScale(scl) { - if(scales[scl] !== undefined) return true; - else return isValidScaleArray(scl); -}; - -},{"./is_valid_scale_array":587,"./scales":589}],587:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var tinycolor = _dereq_('tinycolor2'); - - -module.exports = 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 si = scl[i]; - - if(si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) { - return false; - } - - highestVal = +si[0]; - } - - return true; -}; - -},{"tinycolor2":514}],588:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); -var isNumeric = _dereq_('fast-isnumeric'); - -var Color = _dereq_('../color'); - -/** - * General colorscale function generator. - * - * @param {object} specs output of Colorscale.extractScale or precomputed domain, range. - * - domain {array} - * - range {array} - * - * @param {object} opts - * - noNumericCheck {boolean} if true, scale func bypasses numeric checks - * - returnArray {boolean} if true, scale func return 4-item array instead of color strings - * - * @return {function} - */ -module.exports = function makeColorScaleFunc(specs, opts) { - opts = opts || {}; - - var domain = specs.domain, - range = specs.range, - N = range.length, - _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, - returnArray = opts.returnArray, - 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; - }; - } - - // colorbar draw looks into the d3 scale closure for domain and range - - sclFunc.domain = _sclFunc.domain; - - sclFunc.range = function() { return range; }; - - return sclFunc; -}; - -function colorArray2rbga(colorArray) { - var colorObj = { - r: colorArray[0], - g: colorArray[1], - b: colorArray[2], - a: colorArray[3] - }; - - return tinycolor(colorObj).toRgbString(); -} - -},{"../color":570,"d3":148,"fast-isnumeric":214,"tinycolor2":514}],589:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -module.exports = { - '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 - // www.sandia.gov/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf - '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.000000, '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.000000, 'rgb(255,233,69)'] - ] -}; - -},{}],590:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -// for automatic alignment on dragging, <1/3 means left align, -// >2/3 means right, and between is center. Pick the right fraction -// based on where you are, and return the fraction corresponding to -// that position on the object -module.exports = function align(v, dv, v0, v1, anchor) { - var vmin = (v - v0) / (v1 - v0), - vmax = vmin + dv / (v1 - v0), - vc = (vmin + vmax) / 2; - - // explicitly specified anchor - if(anchor === 'left' || anchor === 'bottom') return vmin; - if(anchor === 'center' || anchor === 'middle') return vc; - if(anchor === 'right' || anchor === 'top') return vmax; - - // automatic based on position - if(vmin < (2 / 3) - vc) return vmin; - if(vmax > (4 / 3) - vc) return vmax; - return vc; -}; - -},{}],591:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); - - -// set cursors pointing toward the closest corner/side, -// to indicate alignment -// x and y are 0-1, fractions of the plot area -var cursorset = [ - ['sw-resize', 's-resize', 'se-resize'], - ['w-resize', 'move', 'e-resize'], - ['nw-resize', 'n-resize', 'ne-resize'] -]; - -module.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]; -}; - -},{"../../lib":696}],592:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var mouseOffset = _dereq_('mouse-event-offset'); -var hasHover = _dereq_('has-hover'); -var supportsPassive = _dereq_('has-passive-events'); - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); - -var constants = _dereq_('../../plots/cartesian/constants'); -var interactConstants = _dereq_('../../constants/interactions'); - -var dragElement = module.exports = {}; - -dragElement.align = _dereq_('./align'); -dragElement.getCursor = _dereq_('./cursor'); - -var unhover = _dereq_('./unhover'); -dragElement.unhover = unhover.wrapped; -dragElement.unhoverRaw = unhover.raw; - - -/** - * Abstracts click & drag interactions - * - * During the interaction, a "coverSlip" element - a transparent - * div covering the whole page - is created, which has two key effects: - * - Lets you drag beyond the boundaries of the plot itself without - * dropping (but if you drag all the way out of the browser window the - * interaction will end) - * - Freezes the cursor: whatever mouse cursor the drag element had when the - * interaction started gets copied to the coverSlip for use until mouseup - * - * If the user executes a drag bigger than MINDRAG, callbacks will fire as: - * prepFn, moveFn (1 or more times), doneFn - * If the user does not drag enough, prepFn and clickFn will fire. - * - * Note: If you cancel contextmenu, clickFn will fire even with a right click - * (unlike native events) so you'll get a `plotly_click` event. Cancel context eg: - * gd.addEventListener('contextmenu', function(e) { e.preventDefault(); }); - * TODO: we should probably turn this into a `config` parameter, so we can fix it - * such that if you *don't* cancel contextmenu, we can prevent partial drags, which - * put you in a weird state. - * - * If the user clicks multiple times quickly, clickFn will fire each time - * but numClicks will increase to help you recognize doubleclicks. - * - * @param {object} options with keys: - * element (required) the DOM element to drag - * prepFn (optional) function(event, startX, startY) - * executed on mousedown - * startX and startY are the clientX and clientY pixel position - * of the mousedown event - * moveFn (optional) function(dx, dy) - * executed on move, ONLY after we've exceeded MINDRAG - * (we keep executing moveFn if you move back to where you started) - * dx and dy are the net pixel offset of the drag, - * dragged is true/false, has the mouse moved enough to - * constitute a drag - * doneFn (optional) function(e) - * executed on mouseup, ONLY if we exceeded MINDRAG (so you can be - * sure that moveFn has been called at least once) - * numClicks is how many clicks we've registered within - * a doubleclick time - * e is the original mouseup event - * clickFn (optional) function(numClicks, e) - * executed on mouseup if we have NOT exceeded MINDRAG (ie moveFn - * has not been called at all) - * numClicks is how many clicks we've registered within - * a doubleclick time - * e is the original mousedown event - * clampFn (optional, function(dx, dy) return [dx2, dy2]) - * Provide custom clamping function for small displacements. - * By default, clamping is done using `minDrag` to x and y displacements - * independently. - */ -dragElement.init = function init(options) { - var gd = options.gd; - var numClicks = 1; - var DBLCLICKDELAY = interactConstants.DBLCLICKDELAY; - var element = options.element; - - var startX, - startY, - newMouseDownTime, - cursor, - dragCover, - initialEvent, - initialTarget, - rightClick; - - if(!gd._mouseDownTime) gd._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) { - e.preventDefault(); - - // make dragging and dragged into properties of gd - // so that others can look at and modify them - gd._dragged = false; - gd._dragging = true; - var offset = pointerOffset(e); - startX = offset[0]; - startY = offset[1]; - initialTarget = e.target; - initialEvent = e; - rightClick = e.buttons === 2 || e.ctrlKey; - - // fix Fx.hover for touch events - if(typeof e.clientX === 'undefined' && typeof e.clientY === 'undefined') { - e.clientX = startX; - e.clientY = startY; - } - - newMouseDownTime = (new Date()).getTime(); - if(newMouseDownTime - gd._mouseDownTime < DBLCLICKDELAY) { - // in a click train - numClicks += 1; - } - else { - // new click train - numClicks = 1; - gd._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) { - // document acts as a dragcover for mobile, bc we can't create dragcover dynamically - dragCover = document; - cursor = window.getComputedStyle(document.documentElement).cursor; - document.documentElement.style.cursor = window.getComputedStyle(element).cursor; - } - - document.addEventListener('mousemove', onMove); - document.addEventListener('mouseup', onDone); - document.addEventListener('touchmove', onMove); - document.addEventListener('touchend', onDone); - - 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) { - gd._dragged = true; - dragElement.unhover(gd); - } - - if(gd._dragged && options.moveFn && !rightClick) options.moveFn(dx, dy); - - return; - } - - function onDone(e) { - document.removeEventListener('mousemove', onMove); - document.removeEventListener('mouseup', onDone); - document.removeEventListener('touchmove', onMove); - document.removeEventListener('touchend', onDone); - - e.preventDefault(); - - if(hasHover) { - Lib.removeElement(dragCover); - } - else if(cursor) { - dragCover.documentElement.style.cursor = cursor; - cursor = null; - } - - if(!gd._dragging) { - gd._dragged = false; - return; - } - gd._dragging = false; - - // don't count as a dblClick unless the mouseUp is also within - // the dblclick delay - if((new Date()).getTime() - gd._mouseDownTime > DBLCLICKDELAY) { - numClicks = Math.max(numClicks - 1, 1); - } - - if(gd._dragged) { - if(options.doneFn) options.doneFn(); - } - else { - if(options.clickFn) options.clickFn(numClicks, initialEvent); - - // If we haven't dragged, this should be a click. But because of the - // coverSlip changing the element, the natural system might not generate one, - // so we need to make our own. But right clicks don't normally generate - // click events, only contextmenu events, which happen on mousedown. - 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); - } - } - - finishDrag(gd); - - gd._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 finishDrag(gd) { - gd._dragging = false; - if(gd._replotPending) Registry.call('plot', gd); -} - -function pointerOffset(e) { - return mouseOffset( - e.changedTouches ? e.changedTouches[0] : e, - document.body - ); -} - -},{"../../constants/interactions":672,"../../lib":696,"../../plots/cartesian/constants":750,"../../registry":827,"./align":590,"./cursor":591,"./unhover":593,"has-hover":393,"has-passive-events":394,"mouse-event-offset":419}],593:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -var Events = _dereq_('../../lib/events'); -var throttle = _dereq_('../../lib/throttle'); -var getGraphDiv = _dereq_('../../lib/get_graph_div'); - -var hoverConstants = _dereq_('../fx/constants'); - -var unhover = module.exports = {}; - - -unhover.wrapped = function(gd, evt, subplot) { - gd = getGraphDiv(gd); - - // Important, clear any queued hovers - if(gd._fullLayout) { - throttle.clear(gd._fullLayout._uid + hoverConstants.HOVERID); - } - - unhover.raw(gd, evt, subplot); -}; - - -// remove hover effects on mouse out, and emit unhover event -unhover.raw = function unhoverRaw(gd, evt) { - var fullLayout = gd._fullLayout; - var oldhoverdata = gd._hoverdata; - - if(!evt) evt = {}; - if(evt.target && - Events.triggerHandler(gd, 'plotly_beforehover', evt) === false) { - return; - } - - fullLayout._hoverlayer.selectAll('g').remove(); - fullLayout._hoverlayer.selectAll('line').remove(); - fullLayout._hoverlayer.selectAll('circle').remove(); - gd._hoverdata = undefined; - - if(evt.target && oldhoverdata) { - gd.emit('plotly_unhover', { - event: evt, - points: oldhoverdata - }); - } -}; - -},{"../../lib/events":684,"../../lib/get_graph_div":691,"../../lib/throttle":721,"../fx/constants":607}],594:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -exports.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', - -}; - -},{}],595:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); -var tinycolor = _dereq_('tinycolor2'); - -var Registry = _dereq_('../../registry'); -var Color = _dereq_('../color'); -var Colorscale = _dereq_('../colorscale'); -var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); - -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); -var alignment = _dereq_('../../constants/alignment'); -var LINE_SPACING = alignment.LINE_SPACING; -var DESELECTDIM = _dereq_('../../constants/interactions').DESELECTDIM; - -var subTypes = _dereq_('../../traces/scatter/subtypes'); -var makeBubbleSizeFn = _dereq_('../../traces/scatter/make_bubble_size_func'); - -var drawing = module.exports = {}; - -// ----------------------------------------------------- -// styling functions for plot elements -// ----------------------------------------------------- - -drawing.font = function(s, family, size, color) { - // also allow the form font(s, {family, size, color}) - if(Lib.isPlainObject(family)) { - color = family.color; - size = family.size; - family = family.family; - } - if(family) s.style('font-family', family); - if(size + 1) s.style('font-size', size + 'px'); - if(color) s.call(Color.fill, color); -}; - -/* - * Positioning helpers - * Note: do not use `setPosition` with nodes modified by - * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` - * instead, so that elements get updated to match. - */ -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); -}; - -/** Translate node - * - * @param {object} d : calcdata point item - * @param {sel} sel : d3 selction of node to translate - * @param {object} xa : corresponding full xaxis object - * @param {object} ya : corresponding full yaxis object - * - * @return {boolean} : - * true if selection got translated - * false if selection could not get translated - */ -drawing.translatePoint = function(d, sel, xa, ya) { - var x = xa.c2p(d.x); - var y = ya.c2p(d.y); - - if(isNumeric(x) && isNumeric(y) && sel.node()) { - // for multiline text this works better - if(sel.node().nodeName === 'text') { - sel.attr('x', x).attr('y', y); - } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); - } - } else { - return false; - } - - return true; -}; - -drawing.translatePoints = function(s, xa, ya) { - s.each(function(d) { - var sel = d3.select(this); - drawing.translatePoint(d, sel, xa, ya); - }); -}; - -drawing.hideOutsideRangePoint = function(d, sel, xa, ya, xcalendar, ycalendar) { - sel.attr( - 'display', - (xa.isPtWithinRange(d, xcalendar) && ya.isPtWithinRange(d, ycalendar)) ? null : 'none' - ); -}; - -drawing.hideOutsideRangePoints = function(traceGroups, subplot) { - if(!subplot._hasClipOnAxisFalse) return; - - var xa = subplot.xaxis; - var ya = subplot.yaxis; - - traceGroups.each(function(d) { - var trace = d[0].trace; - var xcalendar = trace.xcalendar; - var ycalendar = trace.ycalendar; - var selector = trace.type === 'bar' ? '.bartext' : '.point,.textpoint'; - - traceGroups.selectAll(selector).each(function(d) { - drawing.hideOutsideRangePoint(d, d3.select(this), xa, ya, xcalendar, ycalendar); - }); - }); -}; - -drawing.crispRound = function(gd, lineWidth, dflt) { - // for lines that disable antialiasing we want to - // make sure the width is an integer, and at least 1 if it's nonzero - - if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; - - // but not for static plots - these don't get antialiased anyway. - if(gd._context.staticPlot) return lineWidth; - - if(lineWidth < 1) return 1; - return Math.round(lineWidth); -}; - -drawing.singleLineStyle = function(d, s, lw, lc, ld) { - s.style('fill', 'none'); - var line = (((d || [])[0] || {}).trace || {}).line || {}, - lw1 = lw || line.width||0, - dash = ld || line.dash || ''; - - Color.stroke(s, lc || line.color); - drawing.dashLine(s, dash, lw1); -}; - -drawing.lineGroupStyle = function(s, lw, lc, ld) { - s.style('fill', 'none') - .each(function(d) { - var line = (((d || [])[0] || {}).trace || {}).line || {}, - lw1 = lw || line.width||0, - dash = ld || line.dash || ''; - - d3.select(this) - .call(Color.stroke, lc || 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'; - } - // otherwise user wrote the dasharray themselves - leave it be - - return dash; -}; - -// Same as fillGroupStyle, except in this case the selection may be a transition -drawing.singleFillStyle = function(sel) { - var node = d3.select(sel.node()); - var data = node.data(); - var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; - if(fillcolor) { - sel.call(Color.fill, fillcolor); - } -}; - -drawing.fillGroupStyle = function(s) { - s.style('stroke-width', 0) - .each(function(d) { - var shape = d3.select(this); - shape.call(Color.fill, d[0].trace.fillcolor); - }); -}; - -var SYMBOLDEFS = _dereq_('./symbol_defs'); - -drawing.symbolNames = []; -drawing.symbolFuncs = []; -drawing.symbolNeedLines = {}; -drawing.symbolNoDot = {}; -drawing.symbolNoFill = {}; -drawing.symbolList = []; - -Object.keys(SYMBOLDEFS).forEach(function(k) { - var symDef = SYMBOLDEFS[k]; - drawing.symbolList = drawing.symbolList.concat( - [symDef.n, k, symDef.n + 100, k + '-open']); - drawing.symbolNames[symDef.n] = k; - drawing.symbolFuncs[symDef.n] = symDef.f; - if(symDef.needLine) { - drawing.symbolNeedLines[symDef.n] = true; - } - if(symDef.noDot) { - drawing.symbolNoDot[symDef.n] = true; - } - else { - drawing.symbolList = drawing.symbolList.concat( - [symDef.n + 200, k + '-dot', symDef.n + 300, k + '-open-dot']); - } - if(symDef.noFill) { - drawing.symbolNoFill[symDef.n] = true; - } -}); -var MAXSYMBOL = drawing.symbolNames.length, - // add a dot in the middle of the symbol - DOTPATH = 'M0,0.5L0.5,0L0,-0.5L-0.5,0Z'; - -drawing.symbolNumber = function(v) { - 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; } - } - if((v % 100 >= MAXSYMBOL) || v >= 400) { return 0; } - return Math.floor(Math.max(v, 0)); -}; - -function makePointPath(symbolNumber, r) { - var base = symbolNumber % 100; - return drawing.symbolFuncs[base](r) + (symbolNumber >= 200 ? DOTPATH : ''); -} - -var HORZGRADIENT = {x1: 1, x2: 0, y1: 0, y2: 0}; -var VERTGRADIENT = {x1: 0, x2: 0, y1: 1, y2: 0}; -var stopFormatter = d3.format('~.1f'); -var gradientInfo = { - radial: {node: 'radialGradient'}, - radialreversed: {node: 'radialGradient', reversed: true}, - horizontal: {node: 'linearGradient', attrs: HORZGRADIENT}, - horizontalreversed: {node: 'linearGradient', attrs: HORZGRADIENT, reversed: true}, - vertical: {node: 'linearGradient', attrs: VERTGRADIENT}, - verticalreversed: {node: 'linearGradient', attrs: VERTGRADIENT, reversed: true} -}; - -/** - * gradient: create and apply a gradient fill - * - * @param {object} sel: d3 selection to apply this gradient to - * You can use `selection.call(Drawing.gradient, ...)` - * @param {DOM element} gd: the graph div `sel` is part of - * @param {string} gradientID: a unique (within this plot) identifier - * for this gradient, so that we don't create unnecessary definitions - * @param {string} type: 'radial', 'horizontal', or 'vertical', optionally with - * 'reversed' at the end. Normally radial goes center to edge, - * horizontal goes right to left, and vertical goes bottom to top - * @param {array} colorscale: as in attribute values, [[fraction, color], ...] - * @param {string} prop: the property to apply to, 'fill' or 'stroke' - */ -drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) { - var len = colorscale.length; - var info = gradientInfo[type]; - 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 fullID = 'g' + gd._fullLayout._uid + '-' + gradientID; - - var gradient = gd._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 tc = tinycolor(d[1]); - d3.select(this).attr({ - offset: d[0] + '%', - 'stop-color': Color.tinyRGB(tc), - 'stop-opacity': tc.getAlpha() - }); - }); - }); - - sel.style(prop, 'url(#' + fullID + ')') - .style(prop + '-opacity', null); -}; - -/* - * Make the gradients container and clear out any previous gradients. - * We never collect all the gradients we need in one place, - * so we can't ever remove gradients that have stopped being useful, - * except all at once before a full redraw. - * The upside of this is arbitrary points can share gradient defs - */ -drawing.initGradients = function(gd) { - var gradientsGroup = Lib.ensureSingle(gd._fullLayout._defs, 'g', 'gradients'); - gradientsGroup.selectAll('linearGradient,radialGradient').remove(); -}; - - -drawing.pointStyle = function(s, trace, gd) { - if(!s.size()) return; - - var fns = drawing.makePointStyleFns(trace); - - s.each(function(d) { - drawing.singlePointStyle(d, d3.select(this), trace, fns, gd); - }); -}; - -drawing.singlePointStyle = function(d, sel, trace, fns, gd) { - var marker = trace.marker; - var markerLine = marker.line; - - sel.style('opacity', - fns.selectedOpacityFn ? fns.selectedOpacityFn(d) : - (d.mo === undefined ? marker.opacity : d.mo) - ); - - if(fns.ms2mrc) { - var r; - - // handle multi-trace graph edit case - if(d.ms === 'various' || marker.size === 'various') { - r = 3; - } else { - r = fns.ms2mrc(d.ms); - } - - // store the calculated size so hover can use it - d.mrc = r; - - if(fns.selectedSizeFn) { - r = d.mrc = fns.selectedSizeFn(d); - } - - // turn the symbol into a sanitized number - var x = drawing.symbolNumber(d.mx || marker.symbol) || 0; - - // save if this marker is open - // because that impacts how to handle colors - d.om = x % 200 >= 100; - - sel.attr('d', makePointPath(x, r)); - } - - var perPointGradient = false; - var fillColor, lineColor, lineWidth; - - // 'so' is suspected outliers, for box plots - 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); - // weird case: array wasn't long enough to apply to every point - 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 || 'rgba(0,0,0,0)'; - } - - if(fns.selectedColorFn) { - fillColor = fns.selectedColorFn(d); - } - } - - if(d.om) { - // open markers can't have zero linewidth, default to 1px, - // and use fill color as stroke color - sel.call(Color.stroke, fillColor) - .style({ - 'stroke-width': (lineWidth || 1) + 'px', - fill: 'none' - }); - } else { - sel.style('stroke-width', lineWidth + 'px'); - - var markerGradient = marker.gradient; - - var gradientType = d.mgt; - if(gradientType) perPointGradient = true; - else gradientType = markerGradient && markerGradient.type; - - // for legend - arrays will propagate through here, but we don't need - // to treat it as per-point. - if(Array.isArray(gradientType)) { - gradientType = gradientType[0]; - if(!gradientInfo[gradientType]) gradientType = 0; - } - - 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, gd, gradientID, gradientType, - [[0, gradientColor], [1, fillColor]], 'fill'); - } else { - Color.fill(sel, fillColor); - } - - if(lineWidth) { - Color.stroke(sel, lineColor); - } - } -}; - -drawing.makePointStyleFns = function(trace) { - var out = {}; - var marker = trace.marker; - - // allow array marker and marker line colors to be - // scaled by given max and min to colorscales - 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 mo = marker.opacity; - var smo = selectedMarker.opacity; - var usmo = unselectedMarker.opacity; - var smoIsDefined = smo !== undefined; - var usmoIsDefined = usmo !== undefined; - - if(Lib.isArrayOrTypedArray(mo) || smoIsDefined || usmoIsDefined) { - out.selectedOpacityFn = function(d) { - var base = d.mo === undefined ? marker.opacity : d.mo; - - if(d.selected) { - return smoIsDefined ? smo : base; - } else { - return usmoIsDefined ? usmo : DESELECTDIM * base; - } - }; - } - - var mc = marker.color; - var smc = selectedMarker.color; - var usmc = unselectedMarker.color; - - if(smc || usmc) { - out.selectedColorFn = function(d) { - var base = d.mcc || mc; - - if(d.selected) { - return smc || base; - } else { - return usmc || base; - } - }; - } - - var ms = marker.size; - var sms = selectedMarker.size; - var usms = unselectedMarker.size; - var smsIsDefined = sms !== undefined; - var usmsIsDefined = usms !== undefined; - - if(Registry.traceIs(trace, 'symbols') && (smsIsDefined || usmsIsDefined)) { - out.selectedSizeFn = function(d) { - var base = d.mrc || ms / 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 tc = textFont.color; - var stc = selectedTextFont.color; - var utc = unselectedTextFont.color; - - out.selectedTextColorFn = function(d) { - var base = d.tc || tc; - - 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(pt, d) { - pt.style('opacity', fns.selectedOpacityFn(d)); - }); - } - - if(fns.selectedColorFn) { - seq.push(function(pt, d) { - Color.fill(pt, fns.selectedColorFn(d)); - }); - } - - if(fns.selectedSizeFn) { - seq.push(function(pt, d) { - var mx = d.mx || marker.symbol || 0; - var mrc2 = fns.selectedSizeFn(d); - - pt.attr('d', makePointPath(drawing.symbolNumber(mx), mrc2)); - - // save for Drawing.selectedTextStyle - d.mrc2 = mrc2; - }); - } - - if(seq.length) { - s.each(function(d) { - var pt = d3.select(this); - for(var i = 0; i < seq.length; i++) { - seq[i](pt, d); - } - }); - } -}; - -drawing.tryColorscale = function(marker, prefix) { - var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker; - - if(cont) { - var scl = cont.colorscale; - var colorArray = cont.color; - - if(scl && Lib.isArrayOrTypedArray(colorArray)) { - return Colorscale.makeColorScaleFunc( - Colorscale.extractScale(scl, cont.cmin, cont.cmax) - ); - } - } - return Lib.identity; -}; - -var TEXTOFFSETSIGN = { - start: 1, end: -1, middle: 0, bottom: 1, top: -1 -}; - -function textPointPosition(s, textPosition, fontSize, markerRadius) { - 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'; - - // if markers are shown, offset a little more than - // the nominal marker size - // ie 2/1.6 * nominal, bcs some markers are a bit bigger - 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; - - // fix the overall text group position - s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); -} - -function extracTextFontSize(d, trace) { - var fontSize = d.ts || trace.textfont.size; - return (isNumeric(fontSize) && fontSize > 0) ? fontSize : 0; -} - -// draw text at points -drawing.textPointStyle = function(s, trace, gd) { - if(!s.size()) return; - - var selectedTextColorFn; - - if(trace.selectedpoints) { - var fns = drawing.makeSelectedTextStyleFns(trace); - selectedTextColorFn = fns.selectedTextColorFn; - } - - s.each(function(d) { - var p = d3.select(this); - var text = Lib.extractOption(d, trace, 'tx', 'text'); - - if(!text && text !== 0) { - p.remove(); - return; - } - - 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, - d.tf || trace.textfont.family, - fontSize, - fontColor) - .text(text) - .call(svgTextUtils.convertToTspans, gd) - .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 tc = fns.selectedTextColorFn(d); - var tp = d.tp || trace.textposition; - var fontSize = extracTextFontSize(d, trace); - - Color.fill(tx, tc); - textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc); - }); -}; - -// generalized Catmull-Rom splines, per -// http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf -var CatmullRomExp = 0.5; -drawing.smoothopen = function(pts, smoothness) { - if(pts.length < 3) { return 'M' + pts.join('L');} - var path = 'M' + pts[0], - tangents = [], 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], - pLast = pts.length - 1, - tangents = [makeTangent(pts[pLast], - pts[0], pts[1], smoothness)], - 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; -}; - -function makeTangent(prevpt, thispt, nextpt, smoothness) { - var d1x = prevpt[0] - thispt[0], - d1y = prevpt[1] - thispt[1], - d2x = nextpt[0] - thispt[0], - d2y = nextpt[1] - thispt[1], - d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2), - d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2), - numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness, - numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness, - denom1 = 3 * d2a * (d1a + d2a), - denom2 = 3 * d1a * (d1a + d2a); - return [ - [ - d3.round(thispt[0] + (denom1 && numx / denom1), 2), - d3.round(thispt[1] + (denom1 && numy / denom1), 2) - ], [ - d3.round(thispt[0] - (denom2 && numx / denom2), 2), - d3.round(thispt[1] - (denom2 && numy / denom2), 2) - ] - ]; -} - -// step paths - returns a generator function for paths -// with the given step shape -var STEPPATH = { - hv: function(p0, p1) { - return 'H' + d3.round(p1[0], 2) + 'V' + d3.round(p1[1], 2); - }, - vh: function(p0, p1) { - return 'V' + d3.round(p1[1], 2) + 'H' + d3.round(p1[0], 2); - }, - hvh: function(p0, p1) { - return 'H' + d3.round((p0[0] + p1[0]) / 2, 2) + 'V' + - d3.round(p1[1], 2) + 'H' + d3.round(p1[0], 2); - }, - vhv: function(p0, p1) { - return 'V' + d3.round((p0[1] + p1[1]) / 2, 2) + 'H' + - d3.round(p1[0], 2) + 'V' + d3.round(p1[1], 2); - } -}; -var STEPLINEAR = function(p0, p1) { - return 'L' + d3.round(p1[0], 2) + ',' + d3.round(p1[1], 2); -}; -drawing.steps = function(shape) { - var onestep = STEPPATH[shape] || STEPLINEAR; - return function(pts) { - var path = 'M' + d3.round(pts[0][0], 2) + ',' + d3.round(pts[0][1], 2); - for(var i = 1; i < pts.length; i++) { - path += onestep(pts[i - 1], pts[i]); - } - return path; - }; -}; - -// off-screen svg render testing element, shared by the whole page -// uses the id 'js-plotly-tester' and stores it in drawing.tester -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' - }); - }); - - // browsers differ on how they describe the bounding rect of - // the svg if its contents spill over... so make a 1x1px - // reference point we can measure off of. - 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; -}; - -/* - * use our offscreen tester to get a clientRect for an element, - * in a reference frame where it isn't translated (or transformed) and - * its anchor point is at (0,0) - * always returns a copy of the bbox, so the caller can modify it safely - * - * @param {SVGElement} node: the element to measure. If possible this should be - * a or MathJax element that's already passed through - * `convertToTspans` because in that case we can cache the results, but it's - * possible to pass in any svg element. - * - * @param {boolean} inTester: is this element already in `drawing.tester`? - * If you are measuring a dummy element, rather than one you really intend - * to use on the plot, making it in `drawing.tester` in the first place - * allows us to test faster because it cuts out cloning and appending it. - * - * @param {string} hash: for internal use only, if we already know the cache key - * for this element beforehand. - * - * @return {object}: a plain object containing the width, height, left, right, - * top, and bottom of `node` - */ -drawing.savedBBoxes = {}; -var savedBBoxesCount = 0; -var maxSavedBBoxes = 10000; - -drawing.bBox = function(node, inTester, hash) { - /* - * Cache elements we've already measured so we don't have to - * remeasure the same thing many times - * We have a few bBox callers though who pass a node larger than - * a or a MathJax , such as an axis group containing many labels. - * These will not generate a hash (unless we figure out an appropriate - * hash key for them) and thus we will not hash them. - */ - 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) { - /* - * If we have only one child element, which is itself hashable, make - * a new hash from this element plus its x,y,transform - * These bounding boxes *include* x,y,transform - mostly for use by - * callers trying to avoid overlaps (ie titles) - */ - 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) { - // in this case, just varying x and y, don't bother caching - // the final bBox because the alteration is quick. - 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; - } - /* - * else we have a transform - rather than make a complicated - * (and error-prone and probably slow) transform parser/calculator, - * just continue on calculating the boundingClientRect of the group - * and use the new composite hash to cache it. - * That said, `innerNode.transform.baseVal` is an array of - * `SVGTransform` objects, that *do* seem to have a nice matrix - * multiplication interface that we could use to avoid making - * another getBoundingClientRect call... - */ - 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(); - - // copy the node to test into the tester - testNode = node.cloneNode(true); - tester.appendChild(testNode); - } - - // standardize its position (and newline tspans if any) - 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 - }; - - // make sure we don't have too many saved boxes, - // or a long session could overload on memory - // by saving boxes for long-gone elements - if(savedBBoxesCount >= maxSavedBBoxes) { - drawing.savedBBoxes = {}; - savedBBoxesCount = 0; - } - - // cache this bbox - if(hash) drawing.savedBBoxes[hash] = bb; - savedBBoxesCount++; - - return Lib.extendFlat({}, bb); -}; - -// capture everything about a node (at least in our usage) that -// impacts its bounding box, given that bBox clears x, y, and transform -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'); -} - -/* - * make a robust clipPath url from a local id - * note! We'd better not be exporting from a page - * with a or the svg will not be portable! - */ -drawing.setClipUrl = function(s, localId) { - if(!localId) { - s.attr('clip-path', null); - return; - } - - if(drawing.baseUrl === undefined) { - var base = d3.select('base'); - - // Stash base url once and for all! - // We may have to stash this elsewhere when - // we'll try to support for child windows - // more info -> https://github.com/plotly/plotly.js/issues/702 - if(base.size() && base.attr('href')) { - drawing.baseUrl = window.location.href.split('#')[0]; - } else { - drawing.baseUrl = ''; - } - } - - s.attr('clip-path', 'url(' + drawing.baseUrl + '#' + localId + ')'); -}; - -drawing.getTranslate = function(element) { - // Note the separator [^\d] between x and y in this regex - // We generally use ',' but IE will convert it to ' ' - var re = /.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/, - getter = element.attr ? 'attr' : 'getAttribute', - transform = element[getter]('transform') || ''; - - var translate = transform.replace(re, function(match, p1, p2) { - return [p1, p2].join(' '); - }) - .split(' '); - - return { - x: +translate[0] || 0, - y: +translate[1] || 0 - }; -}; - -drawing.setTranslate = function(element, x, y) { - - var re = /(\btranslate\(.*?\);?)/, - getter = element.attr ? 'attr' : 'getAttribute', - setter = element.attr ? 'attr' : 'setAttribute', - transform = element[getter]('transform') || ''; - - x = x || 0; - y = y || 0; - - transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; - transform = transform.trim(); - - element[setter]('transform', transform); - - return transform; -}; - -drawing.getScale = function(element) { - - var re = /.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/, - getter = element.attr ? 'attr' : 'getAttribute', - transform = element[getter]('transform') || ''; - - var translate = transform.replace(re, function(match, p1, p2) { - return [p1, p2].join(' '); - }) - .split(' '); - - return { - x: +translate[0] || 1, - y: +translate[1] || 1 - }; -}; - -drawing.setScale = function(element, x, y) { - - var re = /(\bscale\(.*?\);?)/, - getter = element.attr ? 'attr' : 'getAttribute', - setter = element.attr ? 'attr' : 'setAttribute', - transform = element[getter]('transform') || ''; - - x = x || 1; - y = y || 1; - - transform = transform.replace(re, '').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; - - // The same scale transform for every point: - 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 = [ - 'translate(' + x + ',' + y + ')', - 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', - ]; - } - - if(existingTransform) { - transforms.push(existingTransform); - } - - el.attr('transform', transforms.join(' ')); - }); -}; - -},{"../../constants/alignment":668,"../../constants/interactions":672,"../../constants/xmlns_namespaces":674,"../../lib":696,"../../lib/svg_text_utils":720,"../../registry":827,"../../traces/scatter/make_bubble_size_func":1060,"../../traces/scatter/subtypes":1067,"../color":570,"../colorscale":585,"./symbol_defs":596,"d3":148,"fast-isnumeric":214,"tinycolor2":514}],596:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); - -/** Marker symbol definitions - * users can specify markers either by number or name - * add 100 (or '-open') and you get an open marker - * open markers have no fill and use line color as the stroke color - * add 200 (or '-dot') and you get a dot in the middle - * add both and you get both - */ - -module.exports = { - circle: { - n: 0, - f: function(r) { - var rs = d3.round(r, 2); - return 'M' + rs + ',0A' + rs + ',' + rs + ' 0 1,1 0,-' + rs + - 'A' + rs + ',' + rs + ' 0 0,1 ' + rs + ',0Z'; - } - }, - square: { - n: 1, - f: function(r) { - var rs = d3.round(r, 2); - return 'M' + rs + ',' + rs + 'H-' + rs + 'V-' + rs + 'H' + rs + 'Z'; - } - }, - diamond: { - n: 2, - f: function(r) { - var rd = d3.round(r * 1.3, 2); - return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z'; - } - }, - cross: { - n: 3, - f: function(r) { - var rc = d3.round(r * 0.4, 2), - rc2 = d3.round(r * 1.2, 2); - return 'M' + rc2 + ',' + rc + 'H' + rc + 'V' + rc2 + 'H-' + rc + - 'V' + rc + 'H-' + rc2 + 'V-' + rc + 'H-' + rc + 'V-' + rc2 + - 'H' + rc + 'V-' + rc + 'H' + rc2 + 'Z'; - } - }, - x: { - n: 4, - f: function(r) { - var rx = d3.round(r * 0.8 / Math.sqrt(2), 2), - ne = 'l' + rx + ',' + rx, - se = 'l' + rx + ',-' + rx, - sw = 'l-' + rx + ',-' + rx, - nw = 'l-' + rx + ',' + rx; - return 'M0,' + rx + ne + se + sw + se + sw + nw + sw + nw + ne + nw + ne + 'Z'; - } - }, - 'triangle-up': { - n: 5, - f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); - return 'M-' + rt + ',' + r2 + 'H' + rt + 'L0,-' + rs + 'Z'; - } - }, - 'triangle-down': { - n: 6, - f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); - return 'M-' + rt + ',-' + r2 + 'H' + rt + 'L0,' + rs + 'Z'; - } - }, - 'triangle-left': { - n: 7, - f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); - return 'M' + r2 + ',-' + rt + 'V' + rt + 'L-' + rs + ',0Z'; - } - }, - 'triangle-right': { - n: 8, - f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); - return 'M-' + r2 + ',-' + rt + 'V' + rt + 'L' + rs + ',0Z'; - } - }, - 'triangle-ne': { - n: 9, - f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); - return 'M-' + r2 + ',-' + r1 + 'H' + r1 + 'V' + r2 + 'Z'; - } - }, - 'triangle-se': { - n: 10, - f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); - return 'M' + r1 + ',-' + r2 + 'V' + r1 + 'H-' + r2 + 'Z'; - } - }, - 'triangle-sw': { - n: 11, - f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); - return 'M' + r2 + ',' + r1 + 'H-' + r1 + 'V-' + r2 + 'Z'; - } - }, - 'triangle-nw': { - n: 12, - f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); - return 'M-' + r1 + ',' + r2 + 'V-' + r1 + 'H' + r2 + 'Z'; - } - }, - pentagon: { - n: 13, - f: function(r) { - var x1 = d3.round(r * 0.951, 2), - x2 = d3.round(r * 0.588, 2), - y0 = d3.round(-r, 2), - y1 = d3.round(r * -0.309, 2), - y2 = d3.round(r * 0.809, 2); - return 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2 + 'H-' + x2 + - 'L-' + x1 + ',' + y1 + 'L0,' + y0 + 'Z'; - } - }, - hexagon: { - n: 14, - f: function(r) { - var y0 = d3.round(r, 2), - y1 = d3.round(r / 2, 2), - x = d3.round(r * Math.sqrt(3) / 2, 2); - return 'M' + x + ',-' + y1 + 'V' + y1 + 'L0,' + y0 + - 'L-' + x + ',' + y1 + 'V-' + y1 + 'L0,-' + y0 + 'Z'; - } - }, - hexagon2: { - n: 15, - f: function(r) { - var x0 = d3.round(r, 2), - x1 = d3.round(r / 2, 2), - y = d3.round(r * Math.sqrt(3) / 2, 2); - return 'M-' + x1 + ',' + y + 'H' + x1 + 'L' + x0 + - ',0L' + x1 + ',-' + y + 'H-' + x1 + 'L-' + x0 + ',0Z'; - } - }, - octagon: { - n: 16, - f: function(r) { - var a = d3.round(r * 0.924, 2), - b = d3.round(r * 0.383, 2); - return '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) { - var rs = r * 1.4, - x1 = d3.round(rs * 0.225, 2), - x2 = d3.round(rs * 0.951, 2), - x3 = d3.round(rs * 0.363, 2), - x4 = d3.round(rs * 0.588, 2), - y0 = d3.round(-rs, 2), - y1 = d3.round(rs * -0.309, 2), - y3 = d3.round(rs * 0.118, 2), - y4 = d3.round(rs * 0.809, 2), - y5 = d3.round(rs * 0.382, 2); - return 'M' + x1 + ',' + y1 + 'H' + x2 + 'L' + x3 + ',' + y3 + - 'L' + x4 + ',' + y4 + 'L0,' + y5 + 'L-' + x4 + ',' + y4 + - 'L-' + x3 + ',' + y3 + 'L-' + x2 + ',' + y1 + 'H-' + x1 + - 'L0,' + y0 + 'Z'; - } - }, - hexagram: { - n: 18, - f: function(r) { - var y = d3.round(r * 0.66, 2), - x1 = d3.round(r * 0.38, 2), - x2 = d3.round(r * 0.76, 2); - return 'M-' + x2 + ',0l-' + x1 + ',-' + y + 'h' + x2 + - 'l' + x1 + ',-' + y + 'l' + x1 + ',' + y + 'h' + x2 + - 'l-' + x1 + ',' + y + 'l' + x1 + ',' + y + 'h-' + x2 + - 'l-' + x1 + ',' + y + 'l-' + x1 + ',-' + y + 'h-' + x2 + 'Z'; - } - }, - 'star-triangle-up': { - n: 19, - f: function(r) { - var x = d3.round(r * Math.sqrt(3) * 0.8, 2), - y1 = d3.round(r * 0.8, 2), - y2 = d3.round(r * 1.6, 2), - rc = d3.round(r * 4, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; - return 'M-' + x + ',' + y1 + aPart + x + ',' + y1 + - aPart + '0,-' + y2 + aPart + '-' + x + ',' + y1 + 'Z'; - } - }, - 'star-triangle-down': { - n: 20, - f: function(r) { - var x = d3.round(r * Math.sqrt(3) * 0.8, 2), - y1 = d3.round(r * 0.8, 2), - y2 = d3.round(r * 1.6, 2), - rc = d3.round(r * 4, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; - return 'M' + x + ',-' + y1 + aPart + '-' + x + ',-' + y1 + - aPart + '0,' + y2 + aPart + x + ',-' + y1 + 'Z'; - } - }, - 'star-square': { - n: 21, - f: function(r) { - var rp = d3.round(r * 1.1, 2), - rc = d3.round(r * 2, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; - return 'M-' + rp + ',-' + rp + aPart + '-' + rp + ',' + rp + - aPart + rp + ',' + rp + aPart + rp + ',-' + rp + - aPart + '-' + rp + ',-' + rp + 'Z'; - } - }, - 'star-diamond': { - n: 22, - f: function(r) { - var rp = d3.round(r * 1.4, 2), - rc = d3.round(r * 1.9, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; - return 'M-' + rp + ',0' + aPart + '0,' + rp + - aPart + rp + ',0' + aPart + '0,-' + rp + - aPart + '-' + rp + ',0' + 'Z'; - } - }, - 'diamond-tall': { - n: 23, - f: function(r) { - var x = d3.round(r * 0.7, 2), - y = d3.round(r * 1.4, 2); - return 'M0,' + y + 'L' + x + ',0L0,-' + y + 'L-' + x + ',0Z'; - } - }, - 'diamond-wide': { - n: 24, - f: function(r) { - var x = d3.round(r * 1.4, 2), - y = d3.round(r * 0.7, 2); - return 'M0,' + y + 'L' + x + ',0L0,-' + y + 'L-' + x + ',0Z'; - } - }, - hourglass: { - n: 25, - f: function(r) { - var rs = d3.round(r, 2); - return 'M' + rs + ',' + rs + 'H-' + rs + 'L' + rs + ',-' + rs + 'H-' + rs + 'Z'; - }, - noDot: true - }, - bowtie: { - n: 26, - f: function(r) { - var rs = d3.round(r, 2); - return 'M' + rs + ',' + rs + 'V-' + rs + 'L-' + rs + ',' + rs + 'V-' + rs + 'Z'; - }, - noDot: true - }, - 'circle-cross': { - n: 27, - f: function(r) { - var rs = d3.round(r, 2); - return '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) { - var rs = d3.round(r, 2), - rc = d3.round(r / Math.sqrt(2), 2); - return 'M' + rc + ',' + rc + 'L-' + rc + ',-' + rc + - 'M' + rc + ',-' + rc + 'L-' + rc + ',' + rc + - '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) { - var rs = d3.round(r, 2); - return '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) { - var rs = d3.round(r, 2); - return '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) { - var rd = d3.round(r * 1.3, 2); - return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z' + - 'M0,-' + rd + 'V' + rd + 'M-' + rd + ',0H' + rd; - }, - needLine: true, - noDot: true - }, - 'diamond-x': { - n: 32, - f: function(r) { - var rd = d3.round(r * 1.3, 2), - r2 = d3.round(r * 0.65, 2); - return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z' + - 'M-' + r2 + ',-' + r2 + 'L' + r2 + ',' + r2 + - 'M-' + r2 + ',' + r2 + 'L' + r2 + ',-' + r2; - }, - needLine: true, - noDot: true - }, - 'cross-thin': { - n: 33, - f: function(r) { - var rc = d3.round(r * 1.4, 2); - return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'x-thin': { - n: 34, - f: function(r) { - var rx = d3.round(r, 2); - return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx + - 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx; - }, - needLine: true, - noDot: true, - noFill: true - }, - asterisk: { - n: 35, - f: function(r) { - var rc = d3.round(r * 1.2, 2); - var rs = d3.round(r * 0.85, 2); - return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc + - 'M' + rs + ',' + rs + 'L-' + rs + ',-' + rs + - 'M' + rs + ',-' + rs + 'L-' + rs + ',' + rs; - }, - needLine: true, - noDot: true, - noFill: true - }, - hash: { - n: 36, - f: function(r) { - var r1 = d3.round(r / 2, 2), - r2 = d3.round(r, 2); - return 'M' + r1 + ',' + r2 + 'V-' + r2 + - 'm-' + r2 + ',0V' + r2 + - 'M' + r2 + ',' + r1 + 'H-' + r2 + - 'm0,-' + r2 + 'H' + r2; - }, - needLine: true, - noFill: true - }, - 'y-up': { - n: 37, - f: function(r) { - var x = d3.round(r * 1.2, 2), - y0 = d3.round(r * 1.6, 2), - y1 = d3.round(r * 0.8, 2); - return 'M-' + x + ',' + y1 + 'L0,0M' + x + ',' + y1 + 'L0,0M0,-' + y0 + 'L0,0'; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'y-down': { - n: 38, - f: function(r) { - var x = d3.round(r * 1.2, 2), - y0 = d3.round(r * 1.6, 2), - y1 = d3.round(r * 0.8, 2); - return 'M-' + x + ',-' + y1 + 'L0,0M' + x + ',-' + y1 + 'L0,0M0,' + y0 + 'L0,0'; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'y-left': { - n: 39, - f: function(r) { - var y = d3.round(r * 1.2, 2), - x0 = d3.round(r * 1.6, 2), - x1 = d3.round(r * 0.8, 2); - return 'M' + x1 + ',' + y + 'L0,0M' + x1 + ',-' + y + 'L0,0M-' + x0 + ',0L0,0'; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'y-right': { - n: 40, - f: function(r) { - var y = d3.round(r * 1.2, 2), - x0 = d3.round(r * 1.6, 2), - x1 = d3.round(r * 0.8, 2); - return 'M-' + x1 + ',' + y + 'L0,0M-' + x1 + ',-' + y + 'L0,0M' + x0 + ',0L0,0'; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'line-ew': { - n: 41, - f: function(r) { - var rc = d3.round(r * 1.4, 2); - return 'M' + rc + ',0H-' + rc; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'line-ns': { - n: 42, - f: function(r) { - var rc = d3.round(r * 1.4, 2); - return 'M0,' + rc + 'V-' + rc; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'line-ne': { - n: 43, - f: function(r) { - var rx = d3.round(r, 2); - return 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx; - }, - needLine: true, - noDot: true, - noFill: true - }, - 'line-nw': { - n: 44, - f: function(r) { - var rx = d3.round(r, 2); - return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx; - }, - needLine: true, - noDot: true, - noFill: true - } -}; - -},{"d3":148}],597:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -module.exports = { - visible: { - valType: 'boolean', - - editType: 'calc', - - }, - type: { - valType: 'enumerated', - values: ['percent', 'constant', 'sqrt', 'data'], - - editType: 'calc', - - }, - symmetric: { - valType: 'boolean', - - editType: 'calc', - - }, - array: { - valType: 'data_array', - editType: 'calc', - - }, - arrayminus: { - valType: 'data_array', - editType: 'calc', - - }, - value: { - valType: 'number', - min: 0, - dflt: 10, - - editType: 'calc', - - }, - valueminus: { - valType: 'number', - min: 0, - dflt: 10, - - editType: 'calc', - - }, - 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', - - }, - thickness: { - valType: 'number', - min: 0, - dflt: 2, - - editType: 'style', - - }, - width: { - valType: 'number', - min: 0, - - editType: 'plot', - - }, - editType: 'calc', - - _deprecated: { - opacity: { - valType: 'number', - - editType: 'style', - - } - } -}; - -},{}],598:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -var Registry = _dereq_('../../registry'); -var Axes = _dereq_('../../plots/cartesian/axes'); - -var makeComputeError = _dereq_('./compute_error'); - - -module.exports = function calc(gd) { - var calcdata = gd.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 xa = Axes.getFromId(gd, trace.xaxis); - var ya = Axes.getFromId(gd, trace.yaxis); - calcOneAxis(calcTrace, trace, xa, 'x'); - calcOneAxis(calcTrace, trace, ya, 'y'); - } - } -}; - -function calcOneAxis(calcTrace, trace, axis, coord) { - var opts = trace['error_' + coord] || {}, - isVisible = (opts.visible && ['linear', 'log'].indexOf(axis.type) !== -1), - vals = []; - - if(!isVisible) return; - - var computeError = makeComputeError(opts); - - for(var i = 0; i < calcTrace.length; i++) { - var calcPt = calcTrace[i]; - - var iIn = calcPt.i; - - // for types that don't include `i` in each calcdata point - if(iIn === undefined) iIn = i; - - // for stacked area inserted points - // TODO: errorbars have been tested cursorily with stacked area, - // but not thoroughly. It's not even really clear what you want to do: - // Should it just be calculated based on that trace's size data? - // Should you add errors from below in quadrature? - // And what about normalization, where in principle the errors shrink - // again when you get up to the top end? - // One option would be to forbid errorbars with stacking until we - // decide how to handle these questions. - 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], - hat = calcPt[coord + 'h'] = calcCoord + errors[1]; - vals.push(shoe, hat); - } - } - - var extremes = Axes.findExtremes(axis, vals, {padded: true}); - var axId = axis._id; - trace._extremes[axId].min = trace._extremes[axId].min.concat(extremes.min); - trace._extremes[axId].max = trace._extremes[axId].max.concat(extremes.max); -} - -},{"../../plots/cartesian/axes":744,"../../registry":827,"./compute_error":599,"fast-isnumeric":214}],599:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -/** - * Error bar computing function generator - * - * N.B. The generated function does not clean the dataPt entries. Non-numeric - * entries result in undefined error magnitudes. - * - * @param {object} opts error bar attributes - * - * @return {function} : - * @param {numeric} dataPt data point from where to compute the error magnitude - * @param {number} index index of dataPt in its corresponding data array - * @return {array} - * - error[0] : error magnitude in the negative direction - * - error[1] : " " " " positive " - */ -module.exports = function makeComputeError(opts) { - var type = opts.type, - 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]; - // in case one is present and the other is missing, fill in 0 - // so we still see the present one. Mostly useful during manual - // data entry. - if(!isNaN(val) || !isNaN(valMinus)) { - return [valMinus || 0, val || 0]; - } - return [NaN, NaN]; - }; - } - } - else { - var computeErrorValue = makeComputeErrorValue(type, opts.value), - computeErrorValueMinus = makeComputeErrorValue(type, opts.valueminus); - - if(symmetric || opts.valueminus === undefined) { - return function computeError(dataPt) { - var val = computeErrorValue(dataPt); - return [val, val]; - }; - } - else { - return function computeError(dataPt) { - return [ - computeErrorValueMinus(dataPt), - computeErrorValue(dataPt) - ]; - }; - } - } -}; - -/** - * Compute error bar magnitude (for all types except data) - * - * @param {string} type error bar type - * @param {numeric} value error bar value - * - * @return {function} : - * @param {numeric} 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)); - }; - } -} - -},{}],600:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Template = _dereq_('../../plot_api/plot_template'); - -var attributes = _dereq_('./attributes'); - - -module.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 !== undefined || - containerIn.value !== undefined || - containerIn.type === 'sqrt' - ); - - var visible = coerce('visible', hasErrorBars); - - if(visible === false) return; - - var type = coerce('type', 'array' in containerIn ? 'data' : 'percent'), - 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); - } -}; - -},{"../../lib":696,"../../plot_api/plot_template":734,"../../registry":827,"./attributes":597,"fast-isnumeric":214}],601:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; - -var attributes = _dereq_('./attributes'); - -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; - -module.exports = { - moduleType: 'component', - name: 'errorbars', - - schema: { - traces: { - scatter: xyAttrs, - bar: xyAttrs, - histogram: xyAttrs, - scatter3d: overrideAll(xyzAttrs, 'calc', 'nested'), - scattergl: overrideAll(xyAttrs, 'calc', 'nested') - } - }, - - supplyDefaults: _dereq_('./defaults'), - - calc: _dereq_('./calc'), - makeComputeError: _dereq_('./compute_error'), - - plot: _dereq_('./plot'), - style: _dereq_('./style'), - hoverInfo: 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; - } -} - -},{"../../lib":696,"../../plot_api/edit_types":727,"./attributes":597,"./calc":598,"./compute_error":599,"./defaults":600,"./plot":602,"./style":603}],602:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var Drawing = _dereq_('../drawing'); -var subTypes = _dereq_('../../traces/scatter/subtypes'); - -module.exports = function plot(traces, plotinfo, transitionOpts) { - var isNew; - - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - - var hasAnimation = transitionOpts && transitionOpts.duration > 0; - - traces.each(function(d) { - var trace = d[0].trace, - // || {} is in case the trace (specifically scatterternary) - // doesn't support error bars at all, but does go through - // the scatter.plot mechanics, which calls ErrorBars.plot - // internally - xObj = trace.error_x || {}, - yObj = trace.error_y || {}; - - var keyFunc; - - if(trace.ids) { - keyFunc = function(d) {return d.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); - - errorbars.each(function(d) { - var errorbar = d3.select(this); - var coords = errorCoords(d, xa, ya); - - if(sparse && !d.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; // bar - - - if(!coords.noYS) path += 'm-' + yw + ',0h' + (2 * yw); // shoe - - isNew = !yerror.size(); - - if(isNew) { - yerror = errorbar.append('path') - .style('vector-effect', '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; // bar - - if(!coords.noXS) path += 'm0,-' + xw + 'v' + (2 * xw); // shoe - - isNew = !xerror.size(); - - if(isNew) { - xerror = errorbar.append('path') - .style('vector-effect', '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(); - }); - }); -}; - -// compute the coordinates of the error-bar objects -function errorCoords(d, xa, ya) { - var out = { - x: xa.c2p(d.x), - y: ya.c2p(d.y) - }; - - // calculate the error bar size and hat and shoe locations - if(d.yh !== undefined) { - out.yh = ya.c2p(d.yh); - out.ys = ya.c2p(d.ys); - - // if the shoes go off-scale (ie log scale, error bars past zero) - // clip the bar and hide the shoes - if(!isNumeric(out.ys)) { - out.noYS = true; - out.ys = ya.c2p(d.ys, true); - } - } - - if(d.xh !== undefined) { - out.xh = xa.c2p(d.xh); - out.xs = xa.c2p(d.xs); - - if(!isNumeric(out.xs)) { - out.noXS = true; - out.xs = xa.c2p(d.xs, true); - } - } - - return out; -} - -},{"../../traces/scatter/subtypes":1067,"../drawing":595,"d3":148,"fast-isnumeric":214}],603:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); - -var Color = _dereq_('../color'); - - -module.exports = function style(traces) { - traces.each(function(d) { - var trace = d[0].trace, - yObj = trace.error_y || {}, - 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); - }); -}; - -},{"../color":570,"d3":148}],604:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var fontAttrs = _dereq_('../../plots/font_attributes'); - -module.exports = { - hoverlabel: { - bgcolor: { - valType: 'color', - - arrayOk: true, - editType: 'none', - - }, - bordercolor: { - valType: 'color', - - arrayOk: true, - editType: 'none', - - }, - font: fontAttrs({ - arrayOk: true, - editType: 'none', - - }), - namelength: { - valType: 'integer', - min: -1, - arrayOk: true, - - editType: 'none', - - }, - editType: 'calc' - } -}; - -},{"../../plots/font_attributes":771}],605:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); - -module.exports = function calc(gd) { - var calcdata = gd.calcdata; - var fullLayout = gd._fullLayout; - - function makeCoerceHoverInfo(trace) { - return function(val) { - return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); - }; - } - - for(var i = 0; i < calcdata.length; i++) { - var cd = calcdata[i]; - var trace = cd[0].trace; - - // don't include hover calc fields for pie traces - // as calcdata items might be sorted by value and - // won't match the data array order. - if(Registry.traceIs(trace, 'pie')) continue; - - var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - - fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); - - if(!trace.hoverlabel) continue; - - fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - fillFn(trace.hoverlabel.font.size, cd, 'hts'); - fillFn(trace.hoverlabel.font.color, cd, 'htc'); - fillFn(trace.hoverlabel.font.family, cd, 'htf'); - fillFn(trace.hoverlabel.namelength, cd, 'hnl'); - } -}; - -function paste(traceAttr, cd, cdAttr, fn) { - fn = fn || Lib.identity; - - if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = fn(traceAttr); - } -} - -},{"../../lib":696,"../../registry":827}],606:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Registry = _dereq_('../../registry'); -var hover = _dereq_('./hover').hover; - -module.exports = function click(gd, evt, subplot) { - var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); - - // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. - // Ternary, for example, didn't, but it was caught because tested. - if(subplot !== undefined) { - // The true flag at the end causes it to re-run the hover computation to figure out *which* - // point is being clicked. Without this, clicking is somewhat unreliable. - hover(gd, evt, subplot, true); - } - - function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } - - if(gd._hoverdata && evt && evt.target) { - if(annotationsDone && annotationsDone.then) { - annotationsDone.then(emitClick); - } - else emitClick(); - - // why do we get a double event without this??? - if(evt.stopImmediatePropagation) evt.stopImmediatePropagation(); - } -}; - -},{"../../registry":827,"./hover":610}],607:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.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' -}; - -},{}],608:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var attributes = _dereq_('./attributes'); -var handleHoverLabelDefaults = _dereq_('./hoverlabel_defaults'); - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); -}; - -},{"../../lib":696,"./attributes":604,"./hoverlabel_defaults":611}],609:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); - -// look for either subplot or xaxis and yaxis attributes -// does not handle splom case -exports.getSubplot = function getSubplot(trace) { - return trace.subplot || (trace.xaxis + trace.yaxis) || trace.geo; -}; - -// is trace in given list of subplots? -// does handle splom case -exports.isTraceInSubplots = function isTraceInSubplot(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(exports.getSubplot(trace)) !== -1; -}; - -// convenience functions for mapping all relevant axes -exports.flat = function flat(subplots, v) { - var out = new Array(subplots.length); - for(var i = 0; i < subplots.length; i++) { - out[i] = v; - } - return out; -}; - -exports.p2c = function p2c(axArray, v) { - var out = new Array(axArray.length); - for(var i = 0; i < axArray.length; i++) { - out[i] = axArray[i].p2c(v); - } - return out; -}; - -exports.getDistanceFunction = function getDistanceFunction(mode, dx, dy, dxy) { - if(mode === 'closest') return dxy || exports.quadrature(dx, dy); - return mode === 'x' ? dx : dy; -}; - -exports.getClosest = function getClosest(cd, distfn, pointData) { - // do we already have a point number? (array mode only) - if(pointData.index !== false) { - if(pointData.index >= 0 && pointData.index < cd.length) { - pointData.distance = 0; - } - else pointData.index = false; - } - else { - // apply the distance function to each data point - // this is the longest loop... if this bogs down, we may need - // to create pre-sorted data (by x or y), not sure how to - // do this for 'closest' - for(var i = 0; i < cd.length; i++) { - var newDistance = distfn(cd[i]); - if(newDistance <= pointData.distance) { - pointData.index = i; - pointData.distance = newDistance; - } - } - } - return pointData; -}; - -/* - * pseudo-distance function for hover effects on areas: inside the region - * distance is finite (`passVal`), outside it's Infinity. - * - * @param {number} v0: signed difference between the current position and the left edge - * @param {number} v1: signed difference between the current position and the right edge - * @param {number} passVal: the value to return on success - */ -exports.inbox = function inbox(v0, v1, passVal) { - return (v0 * v1 < 0 || v0 === 0) ? passVal : Infinity; -}; - -exports.quadrature = function quadrature(dx, dy) { - return function(di) { - var x = dx(di), - y = dy(di); - return Math.sqrt(x * x + y * y); - }; -}; - -/** Fill event data point object for hover and selection. - * Invokes _module.eventData if present. - * - * N.B. note that point 'index' corresponds to input data array index - * whereas 'number' is its post-transform version. - * - * If the hovered/selected pt corresponds to an multiple input points - * (e.g. for histogram and transformed traces), 'pointNumbers` and 'pointIndices' - * are include in the event data. - * - * @param {object} pt - * @param {object} trace - * @param {object} cd - * @return {object} - */ -exports.makeEventData = function makeEventData(pt, trace, cd) { - // hover uses 'index', select uses 'pointNumber' - var pointNumber = 'index' in pt ? pt.index : pt.pointNumber; - - var out = { - data: trace._input, - fullData: trace, - curveNumber: trace.index, - pointNumber: 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, pt, trace, cd, pointNumber); - } else { - if('xVal' in pt) out.x = pt.xVal; - else if('x' in pt) out.x = pt.x; - - if('yVal' in pt) out.y = pt.yVal; - else if('y' in pt) out.y = pt.y; - - if(pt.xa) out.xaxis = pt.xa; - if(pt.ya) out.yaxis = pt.ya; - if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; - } - - exports.appendArrayPointValue(out, trace, pointNumber); - - return out; -}; - -/** Appends values inside array attributes corresponding to given point number - * - * @param {object} pointData : point data object (gets mutated here) - * @param {object} trace : full trace object - * @param {number|Array(number)} pointNumber : point number. May be a length-2 array - * [row, col] to dig into 2D arrays - */ -exports.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] === undefined) { - var val = Lib.nestedProperty(trace, astr).get(); - var pointVal = getPointData(val, pointNumber); - - if(pointVal !== undefined) pointData[key] = pointVal; - } - } -}; - -/** - * Appends values inside array attributes corresponding to given point number array - * For use when pointData references a plot entity that arose (or potentially arose) - * from multiple points in the input data - * - * @param {object} pointData : point data object (gets mutated here) - * @param {object} trace : full trace object - * @param {Array(number)|Array(Array(number))} pointNumbers : Array of point numbers. - * Each entry in the array may itself be a length-2 array [row, col] to dig into 2D arrays - */ -exports.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] === undefined) { - 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' -}; - -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]; - } -} - -},{"../../lib":696}],610:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); -var tinycolor = _dereq_('tinycolor2'); - -var Lib = _dereq_('../../lib'); -var Events = _dereq_('../../lib/events'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var overrideCursor = _dereq_('../../lib/override_cursor'); -var Drawing = _dereq_('../drawing'); -var Color = _dereq_('../color'); -var dragElement = _dereq_('../dragelement'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Registry = _dereq_('../../registry'); - -var helpers = _dereq_('./helpers'); -var constants = _dereq_('./constants'); - -// hover labels for multiple horizontal bars get tilted by some angle, -// then need to be offset differently if they overlap -var YANGLE = constants.YANGLE; -var YA_RADIANS = Math.PI * YANGLE / 180; - -// expansion of projected height -var YFACTOR = 1 / Math.sin(YA_RADIANS); - -// to make the appropriate post-rotation x offset, -// you need both x and y offsets -var YSHIFTX = Math.cos(YA_RADIANS); -var YSHIFTY = Math.sin(YA_RADIANS); - -// size and display constants for hover text -var HOVERARROWSIZE = constants.HOVERARROWSIZE; -var HOVERTEXTPAD = constants.HOVERTEXTPAD; - -// fx.hover: highlight data on hover -// evt can be a mousemove event, or an object with data about what points -// to hover on -// {xpx,ypx[,hovermode]} - pixel locations from top left -// (with optional overriding hovermode) -// {xval,yval[,hovermode]} - data values -// [{curveNumber,(pointNumber|xval and/or yval)}] - -// array of specific points to highlight -// pointNumber is a single integer if gd.data[curveNumber] is 1D, -// or a two-element array if it's 2D -// xval and yval are data values, -// 1D data may specify either or both, -// 2D data must specify both -// subplot is an id string (default "xy") -// makes use of gl.hovermode, which can be: -// x (find the points with the closest x values, ie a column), -// closest (find the single closest point) -// internally there are two more that occasionally get used: -// y (pick out a row - only used for multiple horizontal bar charts) -// array (used when the user specifies an explicit -// array of points to hover on) -// -// We wrap the hovers in a timer, to limit their frequency. -// The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot, noHoverEvent) { - gd = Lib.getGraphDiv(gd); - - Lib.throttle( - gd._fullLayout._uid + constants.HOVERID, - constants.HOVERMINTIME, - function() { _hover(gd, evt, subplot, noHoverEvent); } - ); -}; - -/* - * Draw a single hover item in a pre-existing svg container somewhere - * hoverItem should have keys: - * - x and y (or x0, x1, y0, and y1): - * the pixel position to mark, relative to opts.container - * - xLabel, yLabel, zLabel, text, and name: - * info to go in the label - * - color: - * the background color for the label. - * - idealAlign (optional): - * 'left' or 'right' for which side of the x/y box to try to put this on first - * - borderColor (optional): - * color for the border, defaults to strongest contrast with color - * - fontFamily (optional): - * string, the font for this label, defaults to constants.HOVERFONT - * - fontSize (optional): - * the label font size, defaults to constants.HOVERFONTSIZE - * - fontColor (optional): - * defaults to borderColor - * opts should have keys: - * - bgColor: - * the background color this is against, used if the trace is - * non-opaque, and for the name, which goes outside the box - * - container: - * a or element to add the hover label to - * - outerContainer: - * normally a parent of `container`, sets the bounding box to use to - * constrain the hover label and determine whether to show it on the left or right - */ -exports.loneHover = function loneHover(hoverItem, opts) { - var pointData = { - 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, - - // filler to make createHoverText happy - trace: { - index: 0, - hoverinfo: '' - }, - xa: {_offset: 0}, - ya: {_offset: 0}, - index: 0 - }; - - var container3 = d3.select(opts.container); - var outerContainer3 = opts.outerContainer ? - d3.select(opts.outerContainer) : container3; - - var fullOpts = { - hovermode: 'closest', - rotateLabels: false, - bgColor: opts.bgColor || Color.background, - container: container3, - outerContainer: outerContainer3 - }; - - var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); - alignHoverText(hoverLabel, fullOpts.rotateLabels); - - return hoverLabel.node(); -}; - -exports.multiHovers = function multiHovers(hoverItems, opts) { - - if(!Array.isArray(hoverItems)) { - hoverItems = [hoverItems]; - } - - var pointsData = hoverItems.map(function(hoverItem) { - 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, - - // filler to make createHoverText happy - trace: { - index: 0, - hoverinfo: '' - }, - xa: {_offset: 0}, - ya: {_offset: 0}, - index: 0 - }; - }); - - - var container3 = d3.select(opts.container), - outerContainer3 = opts.outerContainer ? - d3.select(opts.outerContainer) : container3; - - var fullOpts = { - hovermode: 'closest', - rotateLabels: false, - bgColor: opts.bgColor || Color.background, - container: container3, - outerContainer: outerContainer3 - }; - - var hoverLabel = createHoverText(pointsData, fullOpts, opts.gd); - - // Fix vertical overlap - var tooltipSpacing = 5; - var lastBottomY = 0; - hoverLabel - .sort(function(a, b) {return a.y0 - b.y0;}) - .each(function(d) { - 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; - }); - - - alignHoverText(hoverLabel, fullOpts.rotateLabels); - - return hoverLabel.node(); -}; - -// The actual implementation is here: -function _hover(gd, evt, subplot, noHoverEvent) { - if(!subplot) subplot = 'xy'; - - // if the user passed in an array of subplots, - // use those instead of finding overlayed plots - var subplots = Array.isArray(subplot) ? subplot : [subplot]; - - var fullLayout = gd._fullLayout; - var plots = fullLayout._plots || []; - var plotinfo = plots[subplot]; - var hasCartesian = fullLayout._has('cartesian'); - - // list of all overlaid subplots to look at - if(plotinfo) { - var overlayedSubplots = plotinfo.overlays.map(function(pi) { - return pi.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++) { - var spId = subplots[i]; - - // 'cartesian' case - var plotObj = plots[spId]; - if(plotObj) { - supportsCompare = true; - - // TODO make sure that fullLayout_plots axis refs - // get updated properly so that we don't have - // to use Axes.getFromId in general. - - xaArray[i] = Axes.getFromId(gd, plotObj.xaxis._id); - yaArray[i] = Axes.getFromId(gd, plotObj.yaxis._id); - continue; - } - - // other subplot types - var _subplot = fullLayout[spId]._subplot; - xaArray[i] = _subplot.xaxis; - yaArray[i] = _subplot.yaxis; - } - - var hovermode = evt.hovermode || fullLayout.hovermode; - - if(hovermode && !supportsCompare) hovermode = 'closest'; - - if(['x', 'y', 'closest'].indexOf(hovermode) === -1 || !gd.calcdata || - gd.querySelector('.zoombox') || gd._dragging) { - return dragElement.unhoverRaw(gd, evt); - } - - var hoverdistance = fullLayout.hoverdistance === -1 ? Infinity : fullLayout.hoverdistance; - var spikedistance = fullLayout.spikedistance === -1 ? Infinity : fullLayout.spikedistance; - - // hoverData: the set of candidate points we've found to highlight - var hoverData = []; - - // searchData: the data to search in. Mostly this is just a copy of - // gd.calcdata, filtered to the subplot and overlays we're on - // but if a point array is supplied it will be a mapping - // of indicated curves - var searchData = []; - - // [x|y]valArray: the axis values of the hover event - // mapped onto each of the currently selected overlaid subplots - var xvalArray, yvalArray; - - var itemnum, curvenum, cd, trace, subplotId, subploti, mode, - xval, yval, pointData, closedataPreviousLength; - - // spikePoints: the set of candidate points we've found to draw spikes to - var spikePoints = { - hLinePoint: null, - vLinePoint: null - }; - - // does subplot have one (or more) horizontal traces? - // This is used to determine whether we rotate the labels or not - var hasOneHorizontalTrace = false; - - // Figure out what we're hovering on: - // mouse location or user-supplied data - - if(Array.isArray(evt)) { - // user specified an array of points to highlight - hovermode = 'array'; - for(itemnum = 0; itemnum < evt.length; itemnum++) { - cd = gd.calcdata[evt[itemnum].curveNumber||0]; - trace = cd[0].trace; - if(cd[0].trace.hoverinfo !== 'skip') { - searchData.push(cd); - if(trace.orientation === 'h') { - hasOneHorizontalTrace = true; - } - } - } - } - else { - for(curvenum = 0; curvenum < gd.calcdata.length; curvenum++) { - cd = gd.calcdata[curvenum]; - trace = cd[0].trace; - if(trace.hoverinfo !== 'skip' && helpers.isTraceInSubplots(trace, subplots)) { - searchData.push(cd); - if(trace.orientation === 'h') { - hasOneHorizontalTrace = true; - } - } - } - - // [x|y]px: the pixels (from top left) of the mouse location - // on the currently selected plot area - // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation - var hasUserCalledHover = !evt.target; - 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 { - // fire the beforehover event and quit if it returns false - // note that we're only calling this on real mouse events, so - // manual calls to fx.hover will always run. - if(Events.triggerHandler(gd, 'plotly_beforehover', evt) === false) { - return; - } - - var dbb = evt.target.getBoundingClientRect(); - - xpx = evt.clientX - dbb.left; - ypx = evt.clientY - dbb.top; - - // in case hover was called from mouseout into hovertext, - // it's possible you're not actually over the plot anymore - if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { - return dragElement.unhoverRaw(gd, 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, gd); - return dragElement.unhoverRaw(gd, evt); - } - } - - // the pixel distance to beat as a matching point - // in 'x' or 'y' mode this resets for each trace - var distance = Infinity; - - // find the closest point in each trace - // this is minimum dx and/or dy, depending on mode - // and the pixel position for the label (labelXpx, labelYpx) - for(curvenum = 0; curvenum < searchData.length; curvenum++) { - cd = searchData[curvenum]; - - // filter out invisible or broken data - if(!cd || !cd[0] || !cd[0].trace || cd[0].trace.visible !== true) continue; - - trace = cd[0].trace; - - // Explicitly bail out for these two. I don't know how to otherwise prevent - // the rest of this function from running and failing - if(['carpet', 'contourcarpet'].indexOf(trace._module.name) !== -1) continue; - - if(trace.type === 'splom') { - // splom traces do not generate overlay subplots, - // it is safe to assume here splom traces correspond to the 0th subplot - subploti = 0; - subplotId = subplots[subploti]; - } else { - subplotId = helpers.getSubplot(trace); - subploti = subplots.indexOf(subplotId); - } - - // within one trace mode can sometimes be overridden - mode = hovermode; - - // container for new point, also used to pass info into module.hoverPoints - pointData = { - // trace properties - cd: cd, - trace: 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: undefined, - ySpike: undefined, - - // where and how to display the hover label - color: Color.defaultLine, // trace color - name: trace.name, - x0: undefined, - x1: undefined, - y0: undefined, - y1: undefined, - xLabelVal: undefined, - yLabelVal: undefined, - zLabelVal: undefined, - text: undefined - }; - - // add ref to subplot object (non-cartesian case) - if(fullLayout[subplotId]) { - pointData.subplot = fullLayout[subplotId]._subplot; - } - // add ref to splom scene - if(fullLayout._splomScenes && fullLayout._splomScenes[trace.uid]) { - pointData.scene = fullLayout._splomScenes[trace.uid]; - } - - closedataPreviousLength = hoverData.length; - - // for a highlighting array, figure out what - // we're searching for with this element - 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 { - xval = xvalArray[subploti]; - yval = yvalArray[subploti]; - } - - // Now if there is range to look in, find the points to hover. - if(hoverdistance !== 0) { - if(trace._module && trace._module.hoverPoints) { - var newPoints = trace._module.hoverPoints(pointData, xval, yval, mode, fullLayout._hoverlayer); - 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); - } - } - - // in closest mode, remove any existing (farther) points - // and don't look any farther than this latest point (or points, some - // traces like box & violin make multiple hover labels at once) - if(hovermode === 'closest' && hoverData.length > closedataPreviousLength) { - hoverData.splice(0, closedataPreviousLength); - distance = hoverData[0].distance; - } - - // Now if there is range to look in, find the points to draw the spikelines - // Do it only if there is no hoverData - if(hasCartesian && (spikedistance !== 0)) { - if(hoverData.length === 0) { - pointData.distance = spikedistance; - pointData.index = false; - var closestPoints = trace._module.hoverPoints(pointData, xval, yval, 'closest', fullLayout._hoverlayer); - if(closestPoints) { - closestPoints = closestPoints.filter(function(point) { - // some hover points, like scatter fills, do not allow spikes, - // so will generate a hover point but without a valid spikeDistance - return point.spikeDistance <= spikedistance; - }); - } - if(closestPoints && closestPoints.length) { - var tmpPoint; - var closestVPoints = closestPoints.filter(function(point) { - return point.xa.showspikes; - }); - 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; - }); - 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; - } - } - } - } - } - } - } - - function selectClosestPoint(pointsData, spikedistance) { - var resultPoint = null; - var minDistance = Infinity; - var thisSpikeDistance; - for(var i = 0; i < pointsData.length; i++) { - thisSpikeDistance = pointsData[i].spikeDistance; - if(thisSpikeDistance < minDistance && thisSpikeDistance <= spikedistance) { - resultPoint = pointsData[i]; - minDistance = thisSpikeDistance; - } - } - return resultPoint; - } - - function fillSpikePoint(point) { - if(!point) return null; - return { - xa: point.xa, - ya: point.ya, - x: point.xSpike !== undefined ? point.xSpike : (point.x0 + point.x1) / 2, - y: point.ySpike !== undefined ? 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: fullLayout, - container: fullLayout._hoverlayer, - outerContainer: fullLayout._paperdiv, - event: evt - }; - var oldspikepoints = gd._spikepoints, - newspikepoints = { - vLinePoint: spikePoints.vLinePoint, - hLinePoint: spikePoints.hLinePoint - }; - gd._spikepoints = newspikepoints; - - // Now if it is not restricted by spikedistance option, set the points to draw the spikelines - if(hasCartesian && (spikedistance !== 0)) { - if(hoverData.length !== 0) { - var tmpHPointData = hoverData.filter(function(point) { - return point.ya.showspikes; - }); - var tmpHPoint = selectClosestPoint(tmpHPointData, spikedistance); - spikePoints.hLinePoint = fillSpikePoint(tmpHPoint); - - var tmpVPointData = hoverData.filter(function(point) { - return point.xa.showspikes; - }); - var tmpVPoint = selectClosestPoint(tmpVPointData, spikedistance); - spikePoints.vLinePoint = fillSpikePoint(tmpVPoint); - } - } - - // if hoverData is empty check for the spikes to draw and quit if there are none - if(hoverData.length === 0) { - var result = dragElement.unhoverRaw(gd, evt); - if(hasCartesian && ((spikePoints.hLinePoint !== null) || (spikePoints.vLinePoint !== null))) { - if(spikesChanged(oldspikepoints)) { - createSpikelines(spikePoints, spikelineOpts); - } - } - return result; - } - - if(hasCartesian) { - if(spikesChanged(oldspikepoints)) { - createSpikelines(spikePoints, spikelineOpts); - } - } - - hoverData.sort(function(d1, d2) { return d1.distance - d2.distance; }); - - // lastly, emit custom hover/unhover events - var oldhoverdata = gd._hoverdata; - var newhoverdata = []; - - // pull out just the data that's useful to - // other people and send it to the event - for(itemnum = 0; itemnum < hoverData.length; itemnum++) { - var pt = hoverData[itemnum]; - newhoverdata.push(helpers.makeEventData(pt, pt.trace, pt.cd)); - } - - gd._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 labelOpts = { - hovermode: hovermode, - rotateLabels: rotateLabels, - bgColor: bgColor, - container: fullLayout._hoverlayer, - outerContainer: fullLayout._paperdiv, - commonLabelOpts: fullLayout.hoverlabel, - hoverdistance: fullLayout.hoverdistance - }; - - var hoverLabels = createHoverText(hoverData, labelOpts, gd); - - hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya', fullLayout); - - alignHoverText(hoverLabels, rotateLabels); - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true - // we should improve the "fx" API so other plots can use it without these hack. - if(evt.target && evt.target.tagName) { - var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); - overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : ''); - } - - // don't emit events if called manually - if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; - - if(oldhoverdata) { - gd.emit('plotly_unhover', { - event: evt, - points: oldhoverdata - }); - } - - gd.emit('plotly_hover', { - event: evt, - points: gd._hoverdata, - xaxes: xaArray, - yaxes: yaArray, - xvals: xvalArray, - yvals: yvalArray - }); -} - -function createHoverText(hoverData, opts, gd) { - var hovermode = opts.hovermode; - var rotateLabels = opts.rotateLabels; - var bgColor = opts.bgColor; - var container = opts.container; - var outerContainer = opts.outerContainer; - var commonLabelOpts = opts.commonLabelOpts || {}; - - // opts.fontFamily/Size are used for the common label - // and as defaults for each hover label, though the individual labels - // can override this. - var fontFamily = opts.fontFamily || constants.HOVERFONT; - var fontSize = opts.fontSize || constants.HOVERFONTSIZE; - - var c0 = hoverData[0]; - var xa = c0.xa; - var ya = c0.ya; - var commonAttr = hovermode === 'y' ? 'yLabel' : 'xLabel'; - var t0 = c0[commonAttr]; - var t00 = (String(t0) || '').split(' ')[0]; - var outerContainerBB = outerContainer.node().getBoundingClientRect(); - var outerTop = outerContainerBB.top; - var outerWidth = outerContainerBB.width; - var outerHeight = outerContainerBB.height; - - // show the common label, if any, on the axis - // never show a common label in array mode, - // even if sometimes there could be one - var showCommonLabel = ( - (t0 !== undefined) && - (c0.distance <= opts.hoverdistance) && - (hovermode === 'x' || hovermode === 'y') - ); - - // all hover traces hoverinfo must contain the hovermode - // to have common labels - if(showCommonLabel) { - var allHaveZ = true; - var i, traceHoverinfo; - for(i = 0; i < hoverData.length; i++) { - if(allHaveZ && hoverData[i].zLabel === undefined) allHaveZ = false; - - traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; - var parts = Array.isArray(traceHoverinfo) ? traceHoverinfo : traceHoverinfo.split('+'); - if(parts.indexOf('all') === -1 && - parts.indexOf(hovermode) === -1) { - showCommonLabel = false; - break; - } - } - - // xyz labels put all info in their main label, so have no need of a common label - if(allHaveZ) showCommonLabel = false; - } - - var commonLabel = container.selectAll('g.axistext') - .data(showCommonLabel ? [0] : []); - commonLabel.enter().append('g') - .classed('axistext', true); - commonLabel.exit().remove(); - - 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) { - // prohibit tex interpretation until we can handle - // tex and regular text together - s.attr('data-notex', 1); - }); - - var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine; - var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor); - var contrastColor = Color.contrast(commonBgColor); - - lpath.style({ - fill: commonBgColor, - stroke: commonStroke - }); - - ltext.text(t0) - .call(Drawing.font, - commonLabelOpts.font.family || fontFamily, - commonLabelOpts.font.size || fontSize, - commonLabelOpts.font.color || contrastColor - ) - .call(svgTextUtils.positionText, 0, 0) - .call(svgTextUtils.convertToTspans, gd); - - label.attr('transform', ''); - - var tbb = ltext.node().getBoundingClientRect(); - if(hovermode === 'x') { - ltext.attr('text-anchor', 'middle') - .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? - (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); - - var topsign = xa.side === 'top' ? '-' : ''; - lpath.attr('d', 'M0,0' + - 'L' + HOVERARROWSIZE + ',' + topsign + HOVERARROWSIZE + - 'H' + (HOVERTEXTPAD + tbb.width / 2) + - 'v' + topsign + (HOVERTEXTPAD * 2 + tbb.height) + - 'H-' + (HOVERTEXTPAD + tbb.width / 2) + - 'V' + topsign + HOVERARROWSIZE + 'H-' + HOVERARROWSIZE + 'Z'); - - label.attr('transform', 'translate(' + - (xa._offset + (c0.x0 + c0.x1) / 2) + ',' + - (ya._offset + (xa.side === 'top' ? 0 : ya._length)) + ')'); - } - else { - ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(svgTextUtils.positionText, - (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2); - - var leftsign = ya.side === 'right' ? '' : '-'; - lpath.attr('d', 'M0,0' + - 'L' + leftsign + HOVERARROWSIZE + ',' + HOVERARROWSIZE + - 'V' + (HOVERTEXTPAD + tbb.height / 2) + - 'h' + leftsign + (HOVERTEXTPAD * 2 + tbb.width) + - 'V-' + (HOVERTEXTPAD + tbb.height / 2) + - 'H' + leftsign + HOVERARROWSIZE + 'V-' + HOVERARROWSIZE + 'Z'); - - label.attr('transform', 'translate(' + - (xa._offset + (ya.side === 'right' ? xa._length : 0)) + ',' + - (ya._offset + (c0.y0 + c0.y1) / 2) + ')'); - } - // remove the "close but not quite" points - // because of error bars, only take up to a space - hoverData = hoverData.filter(function(d) { - return (d.zLabelVal !== undefined) || - (d[commonAttr] || '').split(' ')[0] === t00; - }); - }); - - // show all the individual labels - - // first create the objects - var hoverLabels = container.selectAll('g.hovertext') - .data(hoverData, function(d) { - return [d.trace.index, d.index, d.x0, d.y0, d.name, d.attr, d.xa, d.ya || ''].join(','); - }); - hoverLabels.enter().append('g') - .classed('hovertext', true) - .each(function() { - var g = d3.select(this); - // trace name label (rect and text.name) - g.append('rect') - .call(Color.fill, Color.addOpacity(bgColor, 0.8)); - g.append('text').classed('name', true); - // trace data label (path and text.nums) - g.append('path') - .style('stroke-width', '1px'); - g.append('text').classed('nums', true) - .call(Drawing.font, fontFamily, fontSize); - }); - hoverLabels.exit().remove(); - - // then put the text in, position the pointer to the data, - // and figure out sizes - hoverLabels.each(function(d) { - var g = d3.select(this).attr('transform', ''); - var name = ''; - var text = ''; - - // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; - // color for 'nums' part of the label - var numsColor = Color.combine( - Color.opacity(color0) ? color0 : Color.defaultLine, - bgColor - ); - // color for 'name' part of the label - var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, - bgColor - ); - // find a contrasting color for border and text - var contrastColor = d.borderColor || Color.contrast(numsColor); - - // to get custom 'name' labels pass cleanPoint - if(d.nameOverride !== undefined) d.name = d.nameOverride; - - if(d.name) { - // strip out our pseudo-html elements from d.name (if it exists at all) - name = svgTextUtils.plainText(d.name || ''); - - var nameLength = Math.round(d.nameLength); - - if(nameLength > -1 && name.length > nameLength) { - if(nameLength > 3) name = name.substr(0, nameLength - 3) + '...'; - else name = name.substr(0, nameLength); - } - } - - if(d.zLabel !== undefined) { - if(d.xLabel !== undefined) text += 'x: ' + d.xLabel + '
'; - if(d.yLabel !== undefined) text += 'y: ' + d.yLabel + '
'; - text += (text ? 'z: ' : '') + d.zLabel; - } - else if(showCommonLabel && d[hovermode + 'Label'] === t0) { - text = d[(hovermode === 'x' ? 'y' : 'x') + 'Label'] || ''; - } - else if(d.xLabel === undefined) { - if(d.yLabel !== undefined) text = d.yLabel; - } - else if(d.yLabel === undefined) text = d.xLabel; - else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - - if((d.text || d.text === 0) && !Array.isArray(d.text)) { - text += (text ? '
' : '') + d.text; - } - - // used by other modules (initially just ternary) that - // manage their own hoverinfo independent of cleanPoint - // the rest of this will still apply, so such modules - // can still put things in (x|y|z)Label, text, and name - // and hoverinfo will still determine their visibility - if(d.extraText !== undefined) text += (text ? '
' : '') + d.extraText; - - // if 'text' is empty at this point, - // put 'name' in main label and don't show secondary label - if(text === '') { - // if 'name' is also empty, remove entire label - if(name === '') g.remove(); - text = name; - } - - // main label - var tx = g.select('text.nums') - .call(Drawing.font, - d.fontFamily || fontFamily, - d.fontSize || fontSize, - d.fontColor || contrastColor) - .text(text) - .attr('data-notex', 1) - .call(svgTextUtils.positionText, 0, 0) - .call(svgTextUtils.convertToTspans, gd); - - var tx2 = g.select('text.name'); - var tx2width = 0; - - // secondary label for non-empty 'name' - if(name && name !== text) { - tx2.call(Drawing.font, - d.fontFamily || fontFamily, - d.fontSize || fontSize, - nameColor) - .text(name) - .attr('data-notex', 1) - .call(svgTextUtils.positionText, 0, 0) - .call(svgTextUtils.convertToTspans, gd); - tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; - } - else { - tx2.remove(); - g.select('rect').remove(); - } - - g.select('path') - .style({ - fill: numsColor, - stroke: contrastColor - }); - var tbb = tx.node().getBoundingClientRect(); - 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 txTotalWidth = tbb.width + HOVERARROWSIZE + HOVERTEXTPAD + tx2width; - var anchorStartOK, anchorEndOK; - - d.ty0 = outerTop - tbb.top; - d.bx = tbb.width + 2 * HOVERTEXTPAD; - d.by = tbb.height + 2 * HOVERTEXTPAD; - d.anchor = 'start'; - d.txwidth = tbb.width; - d.tx2width = tx2width; - d.offset = 0; - - 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'; - } - 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'; - } - - tx.attr('text-anchor', d.anchor); - if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); - }); - - return hoverLabels; -} - -// Make groups of touching points, and within each group -// move each point so that no labels overlap, but the average -// label position is the same as it was before moving. Indicentally, -// this is equivalent to saying all the labels are on equal linear -// springs about their initial position. Initially, each point is -// its own group, but as we find overlaps we will clump the points. -// -// Also, there are hard constraints at the edges of the graphs, -// that push all groups to the middle so they are visible. I don't -// know what happens if the group spans all the way from one edge to -// the other, though it hardly matters - there's just too much -// information then. -function hoverAvoidOverlaps(hoverData, ax, fullLayout) { - var nummoves = 0; - - var axSign = 1; - - // make groups of touching points - var pointgroups = hoverData.map(function(d, i) { - var axis = d[ax]; - var axIsX = axis._id.charAt(0) === 'x'; - var rng = axis.range; - if(!i && rng && ((rng[0] > rng[1]) !== axIsX)) axSign = -1; - return [{ - i: i, - traceIndex: d.trace.index, - dp: 0, - pos: d.pos, - posref: d.posref, - size: d.by * (axIsX ? YFACTOR : 1) / 2, - pmin: 0, - pmax: (axIsX ? fullLayout.width : fullLayout.height) - }]; - }) - .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(grp) { - var minPt = grp[0]; - var maxPt = grp[grp.length - 1]; - - // overlap with the top - positive vals are overlaps - topOverlap = minPt.pmin - minPt.pos - minPt.dp + minPt.size; - - // overlap with the bottom - positive vals are overlaps - bottomOverlap = maxPt.pos + maxPt.dp + maxPt.size - minPt.pmax; - - // check for min overlap first, so that we always - // see the largest labels - // allow for .01px overlap, so we don't get an - // infinite loop from rounding errors - if(topOverlap > 0.01) { - for(j = grp.length - 1; j >= 0; j--) grp[j].dp += topOverlap; - donepositioning = false; - } - if(bottomOverlap < 0.01) return; - if(topOverlap < -0.01) { - // make sure we're not pushing back and forth - for(j = grp.length - 1; j >= 0; j--) grp[j].dp -= bottomOverlap; - donepositioning = false; - } - if(!donepositioning) return; - - // no room to fix positioning, delete off-screen points - - // first see how many points we need to delete - var deleteCount = 0; - for(i = 0; i < grp.length; i++) { - pti = grp[i]; - if(pti.pos + pti.dp + pti.size > minPt.pmax) deleteCount++; - } - - // start by deleting points whose data is off screen - for(i = grp.length - 1; i >= 0; i--) { - if(deleteCount <= 0) break; - pti = grp[i]; - - // pos has already been constrained to [pmin,pmax] - // so look for points close to that to delete - if(pti.pos > minPt.pmax - 1) { - pti.del = true; - deleteCount--; - } - } - for(i = 0; i < grp.length; i++) { - if(deleteCount <= 0) break; - pti = grp[i]; - - // pos has already been constrained to [pmin,pmax] - // so look for points close to that to delete - if(pti.pos < minPt.pmin + 1) { - pti.del = true; - deleteCount--; - - // shift the whole group minus into this new space - bottomOverlap = pti.size * 2; - for(j = grp.length - 1; j >= 0; j--) grp[j].dp -= bottomOverlap; - } - } - // then delete points that go off the bottom - for(i = grp.length - 1; i >= 0; i--) { - if(deleteCount <= 0) break; - pti = grp[i]; - if(pti.pos + pti.dp + pti.size > minPt.pmax) { - pti.del = true; - deleteCount--; - } - } - } - - // loop through groups, combining them if they overlap, - // until nothing moves - while(!donepositioning && nummoves <= hoverData.length) { - // to avoid infinite loops, don't move more times - // than there are traces - nummoves++; - - // assume nothing will move in this iteration, - // reverse this if it does - donepositioning = true; - i = 0; - while(i < pointgroups.length - 1) { - // the higher (g0) and lower (g1) point group - var g0 = pointgroups[i]; - var g1 = pointgroups[i + 1]; - - // the lowest point in the higher group (p0) - // the highest point in the lower group (p1) - var p0 = g0[g0.length - 1]; - var p1 = g1[0]; - topOverlap = p0.pos + p0.dp + p0.size - p1.pos - p1.dp + p1.size; - - // Only group points that lie on the same axes - if(topOverlap > 0.01 && (p0.pmin === p1.pmin) && (p0.pmax === p1.pmax)) { - // push the new point(s) added to this group out of the way - for(j = g1.length - 1; j >= 0; j--) g1[j].dp += topOverlap; - - // add them to the group - g0.push.apply(g0, g1); - pointgroups.splice(i + 1, 1); - - // adjust for minimum average movement - sumdp = 0; - for(j = g0.length - 1; j >= 0; j--) sumdp += g0[j].dp; - bottomOverlap = sumdp / g0.length; - for(j = g0.length - 1; j >= 0; j--) g0[j].dp -= bottomOverlap; - donepositioning = false; - } - else i++; - } - - // check if we're going off the plot on either side and fix - pointgroups.forEach(constrainGroup); - } - - // now put these offsets into hoverData - for(i = pointgroups.length - 1; i >= 0; i--) { - var grp = pointgroups[i]; - for(j = grp.length - 1; j >= 0; j--) { - var pt = grp[j]; - var hoverPt = hoverData[pt.i]; - hoverPt.offset = pt.dp; - hoverPt.del = pt.del; - } - } -} - -function alignHoverText(hoverLabels, rotateLabels) { - // finally set the text positioning relative to the data and draw the - // box around it - hoverLabels.each(function(d) { - var g = d3.select(this); - if(d.del) { - g.remove(); - return; - } - - var horzSign = d.anchor === 'end' ? -1 : 1; - var tx = g.select('text.nums'); - var alignShift = {start: 1, end: -1, middle: 0}[d.anchor]; - var txx = alignShift * (HOVERARROWSIZE + HOVERTEXTPAD); - var tx2x = txx + alignShift * (d.txwidth + HOVERTEXTPAD); - var offsetX = 0; - var offsetY = d.offset; - - if(d.anchor === 'middle') { - txx -= d.tx2width / 2; - tx2x += d.txwidth / 2 + HOVERTEXTPAD; - } - if(rotateLabels) { - offsetY *= -YSHIFTY; - offsetX = d.offset * YSHIFTX; - } - - g.select('path').attr('d', d.anchor === 'middle' ? - // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : - // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + - 'Z')); - - tx.call(svgTextUtils.positionText, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); - - if(d.tx2width) { - g.select('text.name') - .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); - g.select('rect') - .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); - } - }); -} - -function cleanPoint(d, hovermode) { - var index = d.index; - var trace = d.trace || {}; - var cd0 = d.cd[0]; - var cd = d.cd[index] || {}; - - var getVal = Array.isArray(index) ? - function(calcKey, traceKey) { - return Lib.castOption(cd0, index, calcKey) || - Lib.extractOption({}, trace, '', traceKey); - } : - function(calcKey, traceKey) { - return Lib.extractOption(cd, trace, calcKey, traceKey); - }; - - function fill(key, calcKey, traceKey) { - var val = getVal(calcKey, traceKey); - if(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('nameLength', 'hnl', 'hoverlabel.namelength'); - - d.posref = hovermode === 'y' ? - (d.xa._offset + (d.x0 + d.x1) / 2) : - (d.ya._offset + (d.y0 + d.y1) / 2); - - // then constrain all the positions to be on the plot - 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); - - // and convert the x and y label values into formatted text - if(d.xLabelVal !== undefined) { - d.xLabel = ('xLabel' in d) ? d.xLabel : Axes.hoverLabelText(d.xa, d.xLabelVal); - d.xVal = d.xa.c2d(d.xLabelVal); - } - if(d.yLabelVal !== undefined) { - d.yLabel = ('yLabel' in d) ? d.yLabel : Axes.hoverLabelText(d.ya, d.yLabelVal); - d.yVal = d.ya.c2d(d.yLabelVal); - } - - // Traces like heatmaps generate the zLabel in their hoverPoints function - if(d.zLabelVal !== undefined && d.zLabel === undefined) { - d.zLabel = String(d.zLabelVal); - } - - // for box means and error bars, add the range to the label - 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 !== undefined) { - d.xLabel += ' +' + xeText + ' / -' + - Axes.tickText(d.xa, d.xa.c2l(d.xerrneg), 'hover').text; - } - else d.xLabel += ' ± ' + xeText; - - // small distance penalty for error bars, so that if there are - // traces with errors and some without, the error bar label will - // hoist up to the point - 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 !== undefined) { - 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 !== 'all') { - infomode = Array.isArray(infomode) ? infomode : infomode.split('+'); - if(infomode.indexOf('x') === -1) d.xLabel = undefined; - if(infomode.indexOf('y') === -1) d.yLabel = undefined; - if(infomode.indexOf('z') === -1) d.zLabel = undefined; - if(infomode.indexOf('text') === -1) d.text = undefined; - if(infomode.indexOf('name') === -1) d.name = undefined; - } - - return d; -} - -function createSpikelines(closestPoints, opts) { - var container = opts.container; - var fullLayout = opts.fullLayout; - var evt = opts.event; - var showY = !!closestPoints.hLinePoint; - var showX = !!closestPoints.vLinePoint; - - var xa, ya; - - // Remove old spikeline items - container.selectAll('.spikeline').remove(); - - if(!(showX || showY)) return; - - var contrastColor = Color.combine(fullLayout.plot_bgcolor, fullLayout.paper_bgcolor); - - // Horizontal line (to y-axis) - if(showY) { - var hLinePoint = closestPoints.hLinePoint; - var hLinePointX, hLinePointY; - - xa = hLinePoint && hLinePoint.xa; - ya = hLinePoint && hLinePoint.ya; - var ySnap = ya.spikesnap; - - if(ySnap === 'cursor') { - hLinePointX = evt.pointerX; - hLinePointY = evt.pointerY; - } else { - hLinePointX = xa._offset + hLinePoint.x; - hLinePointY = ya._offset + hLinePoint.y; - } - var dfltHLineColor = tinycolor.readability(hLinePoint.color, contrastColor) < 1.5 ? - Color.contrast(contrastColor) : hLinePoint.color; - var yMode = ya.spikemode; - var yThickness = ya.spikethickness; - var yColor = ya.spikecolor || dfltHLineColor; - var yBB = ya._boundingBox; - var xEdge = ((yBB.left + yBB.right) / 2) < hLinePointX ? yBB.right : yBB.left; - 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) { - xBase = ya._counterSpan[0]; - xEndSpike = ya._counterSpan[1]; - } - - // Foreground horizontal line (to y-axis) - container.insert('line', ':first-child') - .attr({ - x1: xBase, - x2: xEndSpike, - y1: hLinePointY, - y2: hLinePointY, - 'stroke-width': yThickness, - stroke: yColor, - 'stroke-dasharray': Drawing.dashStyle(ya.spikedash, yThickness) - }) - .classed('spikeline', true) - .classed('crisp', true); - - // Background horizontal Line (to y-axis) - 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); - } - // Y axis marker - if(yMode.indexOf('marker') !== -1) { - container.insert('circle', ':first-child') - .attr({ - cx: xEdge + (ya.side !== 'right' ? yThickness : -yThickness), - cy: hLinePointY, - r: yThickness, - fill: yColor - }) - .classed('spikeline', true); - } - } - - if(showX) { - var vLinePoint = closestPoints.vLinePoint; - var vLinePointX, vLinePointY; - - xa = vLinePoint && vLinePoint.xa; - ya = vLinePoint && vLinePoint.ya; - var xSnap = xa.spikesnap; - - if(xSnap === 'cursor') { - vLinePointX = evt.pointerX; - vLinePointY = evt.pointerY; - } else { - vLinePointX = xa._offset + vLinePoint.x; - vLinePointY = ya._offset + vLinePoint.y; - } - var dfltVLineColor = tinycolor.readability(vLinePoint.color, contrastColor) < 1.5 ? - Color.contrast(contrastColor) : vLinePoint.color; - var xMode = xa.spikemode; - var xThickness = xa.spikethickness; - var xColor = xa.spikecolor || dfltVLineColor; - var xBB = xa._boundingBox; - var yEdge = ((xBB.top + xBB.bottom) / 2) < vLinePointY ? xBB.bottom : xBB.top; - 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) { - yBase = xa._counterSpan[0]; - yEndSpike = xa._counterSpan[1]; - } - - // Foreground vertical line (to x-axis) - container.insert('line', ':first-child') - .attr({ - x1: vLinePointX, - x2: vLinePointX, - y1: yBase, - y2: yEndSpike, - 'stroke-width': xThickness, - stroke: xColor, - 'stroke-dasharray': Drawing.dashStyle(xa.spikedash, xThickness) - }) - .classed('spikeline', true) - .classed('crisp', true); - - // Background vertical line (to x-axis) - 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); - } - - // X axis marker - if(xMode.indexOf('marker') !== -1) { - container.insert('circle', ':first-child') - .attr({ - cx: vLinePointX, - cy: yEdge - (xa.side !== 'top' ? xThickness : -xThickness), - r: xThickness, - fill: xColor - }) - .classed('spikeline', true); - } - } -} - -function hoverChanged(gd, evt, oldhoverdata) { - // don't emit any events if nothing changed - if(!oldhoverdata || oldhoverdata.length !== gd._hoverdata.length) return true; - - for(var i = oldhoverdata.length - 1; i >= 0; i--) { - var oldPt = oldhoverdata[i]; - var newPt = gd._hoverdata[i]; - if(oldPt.curveNumber !== newPt.curveNumber || - String(oldPt.pointNumber) !== String(newPt.pointNumber)) { - return true; - } - } - return false; -} - -function spikesChanged(gd, oldspikepoints) { - // don't relayout the plot because of new spikelines if spikelines points didn't change - if(!oldspikepoints) return true; - if(oldspikepoints.vLinePoint !== gd._spikepoints.vLinePoint || - oldspikepoints.hLinePoint !== gd._spikepoints.hLinePoint - ) return true; - return false; -} - -},{"../../lib":696,"../../lib/events":684,"../../lib/override_cursor":707,"../../lib/svg_text_utils":720,"../../plots/cartesian/axes":744,"../../registry":827,"../color":570,"../dragelement":592,"../drawing":595,"./constants":607,"./helpers":609,"d3":148,"fast-isnumeric":214,"tinycolor2":514}],611:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); - -module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts) { - opts = opts || {}; - - coerce('hoverlabel.bgcolor', opts.bgcolor); - coerce('hoverlabel.bordercolor', opts.bordercolor); - coerce('hoverlabel.namelength', opts.namelength); - Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); -}; - -},{"../../lib":696}],612:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var Lib = _dereq_('../../lib'); -var dragElement = _dereq_('../dragelement'); -var helpers = _dereq_('./helpers'); -var layoutAttributes = _dereq_('./layout_attributes'); -var hoverModule = _dereq_('./hover'); - -module.exports = { - moduleType: 'component', - name: 'fx', - - constants: _dereq_('./constants'), - schema: { - layout: layoutAttributes - }, - - attributes: _dereq_('./attributes'), - layoutAttributes: layoutAttributes, - - supplyLayoutGlobalDefaults: _dereq_('./layout_global_defaults'), - supplyDefaults: _dereq_('./defaults'), - supplyLayoutDefaults: _dereq_('./layout_defaults'), - - calc: _dereq_('./calc'), - - getDistanceFunction: helpers.getDistanceFunction, - getClosest: helpers.getClosest, - inbox: helpers.inbox, - quadrature: helpers.quadrature, - appendArrayPointValue: helpers.appendArrayPointValue, - - castHoverOption: castHoverOption, - castHoverinfo: castHoverinfo, - - hover: hoverModule.hover, - unhover: dragElement.unhover, - - loneHover: hoverModule.loneHover, - multiHovers: hoverModule.multiHovers, - loneUnhover: loneUnhover, - - click: _dereq_('./click') -}; - -function loneUnhover(containerOrSelection) { - // duck type whether the arg is a d3 selection because ie9 doesn't - // handle instanceof like modern browsers do. - var selection = Lib.isD3Selection(containerOrSelection) ? - containerOrSelection : - d3.select(containerOrSelection); - - selection.selectAll('g.hovertext').remove(); - selection.selectAll('.spikeline').remove(); -} - -// helpers for traces that use Fx.loneHover - -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); -} - -},{"../../lib":696,"../dragelement":592,"./attributes":604,"./calc":605,"./click":606,"./constants":607,"./defaults":608,"./helpers":609,"./hover":610,"./layout_attributes":613,"./layout_defaults":614,"./layout_global_defaults":615,"d3":148}],613:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var constants = _dereq_('./constants'); - -var fontAttrs = _dereq_('../../plots/font_attributes')({ - editType: 'none', - -}); -fontAttrs.family.dflt = constants.HOVERFONT; -fontAttrs.size.dflt = constants.HOVERFONTSIZE; - -module.exports = { - clickmode: { - valType: 'flaglist', - - flags: ['event', 'select'], - dflt: 'event', - editType: 'plot', - extras: ['none'], - - }, - dragmode: { - valType: 'enumerated', - - values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable'], - dflt: 'zoom', - editType: 'modebar', - - }, - hovermode: { - valType: 'enumerated', - - values: ['x', 'y', 'closest', false], - editType: 'modebar', - - }, - hoverdistance: { - valType: 'integer', - min: -1, - dflt: 20, - - editType: 'none', - - }, - spikedistance: { - valType: 'integer', - min: -1, - dflt: 20, - - editType: 'none', - - }, - hoverlabel: { - bgcolor: { - valType: 'color', - - editType: 'none', - - }, - bordercolor: { - valType: 'color', - - editType: 'none', - - }, - font: fontAttrs, - namelength: { - valType: 'integer', - min: -1, - dflt: 15, - - editType: 'none', - - }, - editType: 'none' - }, - selectdirection: { - valType: 'enumerated', - - values: ['h', 'v', 'd', 'any'], - dflt: 'any', - - editType: 'none' - } -}; - -},{"../../plots/font_attributes":771,"./constants":607}],614:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var layoutAttributes = _dereq_('./layout_attributes'); - -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); - } - - var clickmode = coerce('clickmode'); - - var dragMode = coerce('dragmode'); - if(dragMode === 'select') coerce('selectdirection'); - - var hovermodeDflt; - if(layoutOut._has('cartesian')) { - if(clickmode.indexOf('select') > -1) { - hovermodeDflt = 'closest'; - } else { - // flag for 'horizontal' plots: - // determines the state of the mode bar 'compare' hovermode button - layoutOut._isHoriz = isHoriz(fullData); - hovermodeDflt = layoutOut._isHoriz ? 'y' : 'x'; - } - } - else hovermodeDflt = 'closest'; - - var hoverMode = coerce('hovermode', hovermodeDflt); - if(hoverMode) { - coerce('hoverdistance'); - coerce('spikedistance'); - } - - // if only mapbox or geo subplots is present on graph, - // reset 'zoom' dragmode to 'pan' until 'zoom' is implemented, - // so that the correct modebar button is active - var hasMapbox = layoutOut._has('mapbox'); - var hasGeo = layoutOut._has('geo'); - var len = layoutOut._basePlotModules.length; - - if(layoutOut.dragmode === 'zoom' && ( - ((hasMapbox || hasGeo) && len === 1) || - (hasMapbox && hasGeo && len === 2) - )) { - layoutOut.dragmode = 'pan'; - } -}; - -function isHoriz(fullData) { - var out = true; - - for(var i = 0; i < fullData.length; i++) { - var trace = fullData[i]; - - if(trace.orientation !== 'h') { - out = false; - break; - } - } - - return out; -} - -},{"../../lib":696,"./layout_attributes":613}],615:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var handleHoverLabelDefaults = _dereq_('./hoverlabel_defaults'); -var layoutAttributes = _dereq_('./layout_attributes'); - -module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); - } - - handleHoverLabelDefaults(layoutIn, layoutOut, coerce); -}; - -},{"../../lib":696,"./hoverlabel_defaults":611,"./layout_attributes":613}],616:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var counterRegex = _dereq_('../../lib/regex').counter; -var domainAttrs = _dereq_('../../plots/domain').attributes; -var cartesianIdRegex = _dereq_('../../plots/cartesian/constants').idRegex; -var Template = _dereq_('../../plot_api/plot_template'); - -var gridAttrs = { - rows: { - valType: 'integer', - min: 1, - - editType: 'plot', - - }, - roworder: { - valType: 'enumerated', - values: ['top to bottom', 'bottom to top'], - dflt: 'top to bottom', - - editType: 'plot', - - }, - columns: { - valType: 'integer', - min: 1, - - editType: 'plot', - - }, - subplots: { - valType: 'info_array', - freeLength: true, - dimensions: 2, - items: {valType: 'enumerated', values: [counterRegex('xy').toString(), ''], editType: 'plot'}, - - editType: 'plot', - - }, - xaxes: { - valType: 'info_array', - freeLength: true, - items: {valType: 'enumerated', values: [cartesianIdRegex.x.toString(), ''], editType: 'plot'}, - - editType: 'plot', - - }, - yaxes: { - valType: 'info_array', - freeLength: true, - items: {valType: 'enumerated', values: [cartesianIdRegex.y.toString(), ''], editType: 'plot'}, - - editType: 'plot', - - }, - pattern: { - valType: 'enumerated', - values: ['independent', 'coupled'], - dflt: 'coupled', - - editType: 'plot', - - }, - xgap: { - valType: 'number', - min: 0, - max: 1, - - editType: 'plot', - - }, - ygap: { - valType: 'number', - min: 0, - max: 1, - - editType: 'plot', - - }, - domain: domainAttrs({name: 'grid', editType: 'plot', noGridCell: true}, { - - }), - xside: { - valType: 'enumerated', - values: ['bottom', 'bottom plot', 'top plot', 'top'], - dflt: 'bottom plot', - - editType: 'plot', - - }, - yside: { - valType: 'enumerated', - values: ['left', 'left plot', 'right plot', 'right'], - dflt: 'left plot', - - editType: 'plot', - - }, - 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; -} - -// the shape of the grid - this needs to be done BEFORE supplyDataDefaults -// so that non-subplot traces can place themselves in the grid -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) - }; -} - -// coerce x or y sizing attributes and return an array of domains for this direction -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; -} - -// the (cartesian) contents of the grid - this needs to happen AFTER supplyDataDefaults -// so that we know what cartesian subplots are available -function contentDefaults(layoutIn, layoutOut) { - var gridOut = layoutOut.grid; - // make sure we got to the end of handleGridSizing - 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] !== undefined && axisMap[xId] !== j) || - (axisMap[yId] !== undefined && 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 i0, inc, iFinal; - - if(side.length < 8) { - // grid edge - ie not "* plot" - make these as free axes - // since we're not guaranteed to have a subplot there at all - anchors[axisId] = 'free'; - } - else if(axLetter === 'x') { - if((side.charAt(0) === 't') === reversed) { - i0 = 0; - inc = 1; - iFinal = rows; - } - else { - i0 = rows - 1; - inc = -1; - iFinal = -1; - } - if(hasSubplotGrid) { - var column = axisMap[axisId]; - for(i = i0; 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 = i0; 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')) { - i0 = 0; - inc = 1; - iFinal = columns; - } - else { - i0 = columns - 1; - inc = -1; - iFinal = -1; - } - if(hasSubplotGrid) { - var row = axisMap[axisId]; - for(i = i0; 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 = i0; 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(i, axisId) { - if(axesAllowed.indexOf(axisId) !== -1 && axisMap[axisId] === undefined) { - out[i] = axisId; - axisMap[axisId] = i; - } - else out[i] = ''; - } - - if(Array.isArray(axesIn)) { - for(i = 0; i < len; i++) { - fillOneAxis(i, axesIn[i]); - } - } - else { - // default axis list is the first `len` axis ids - fillOneAxis(0, axLetter); - for(i = 1; i < len; i++) { - fillOneAxis(i, axLetter + (i + 1)); - } - } - - return out; -} - -module.exports = { - moduleType: 'component', - name: 'grid', - - schema: { - layout: {grid: gridAttrs} - }, - - layoutAttributes: gridAttrs, - sizeDefaults: sizeDefaults, - contentDefaults: contentDefaults -}; - -},{"../../lib":696,"../../lib/regex":712,"../../plot_api/plot_template":734,"../../plots/cartesian/constants":750,"../../plots/domain":770}],617:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var cartesianConstants = _dereq_('../../plots/cartesian/constants'); -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - - -module.exports = templatedArray('image', { - visible: { - valType: 'boolean', - - dflt: true, - editType: 'arraydraw', - - }, - - source: { - valType: 'string', - - editType: 'arraydraw', - - }, - - layer: { - valType: 'enumerated', - values: ['below', 'above'], - dflt: 'above', - - editType: 'arraydraw', - - }, - - sizex: { - valType: 'number', - - dflt: 0, - editType: 'arraydraw', - - }, - - sizey: { - valType: 'number', - - dflt: 0, - editType: 'arraydraw', - - }, - - sizing: { - valType: 'enumerated', - values: ['fill', 'contain', 'stretch'], - dflt: 'contain', - - editType: 'arraydraw', - - }, - - opacity: { - valType: 'number', - - min: 0, - max: 1, - dflt: 1, - editType: 'arraydraw', - - }, - - x: { - valType: 'any', - - dflt: 0, - editType: 'arraydraw', - - }, - - y: { - valType: 'any', - - dflt: 0, - editType: 'arraydraw', - - }, - - xanchor: { - valType: 'enumerated', - values: ['left', 'center', 'right'], - dflt: 'left', - - editType: 'arraydraw', - - }, - - yanchor: { - valType: 'enumerated', - values: ['top', 'middle', 'bottom'], - dflt: 'top', - - editType: 'arraydraw', - - }, - - xref: { - valType: 'enumerated', - values: [ - 'paper', - cartesianConstants.idRegex.x.toString() - ], - dflt: 'paper', - - editType: 'arraydraw', - - }, - - yref: { - valType: 'enumerated', - values: [ - 'paper', - cartesianConstants.idRegex.y.toString() - ], - dflt: 'paper', - - editType: 'arraydraw', - - }, - editType: 'arraydraw' -}); - -},{"../../plot_api/plot_template":734,"../../plots/cartesian/constants":750}],618:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var toLogRange = _dereq_('../../lib/to_log_range'); - -/* - * convertCoords: when converting an axis between log and linear - * you need to alter any images on that axis to keep them - * pointing at the same data point. - * In v2.0 this will become obsolete (or perhaps size will still need conversion?) - * we convert size by declaring that the maximum extent *in data units* should be - * the same, assuming the image is anchored by its center (could remove that restriction - * if we think it's important) even though the actual left and right values will not be - * quite the same since the scale becomes nonlinear (and central anchor means the pixel - * center of the image, not the data units center) - * - * gd: the plot div - * ax: the axis being changed - * newType: the type it's getting - * doExtra: function(attr, val) from inside relayout that sets the attribute. - * Use this to make the changes as it's aware if any other changes in the - * same relayout call should override this conversion. - */ -module.exports = function convertCoords(gd, ax, newType, doExtra) { - ax = ax || {}; - - var toLog = (newType === 'log') && (ax.type === 'linear'), - fromLog = (newType === 'linear') && (ax.type === 'log'); - - if(!(toLog || fromLog)) return; - - var images = gd._fullLayout.images, - axLetter = ax._id.charAt(0), - image, - 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], - currentSize = image['size' + axLetter], - newPos = null, - newSize = null; - - if(toLog) { - newPos = toLogRange(currentPos, ax.range); - - // this is the inverse of the conversion we do in fromLog below - // so that the conversion is reversible (notice the fromLog conversion - // is like sinh, and this one looks like arcsinh) - 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 conversion failed, delete the value so it can get a default later on - if(!isNumeric(newPos)) { - newPos = null; - newSize = null; - } - else if(!isNumeric(newSize)) newSize = null; - - doExtra(attrPrefix + axLetter, newPos); - doExtra(attrPrefix + 'size' + axLetter, newSize); - } - } -}; - -},{"../../lib/to_log_range":722,"fast-isnumeric":214}],619:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var name = 'images'; - -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - var opts = { - name: 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 }, - axLetters = ['x', 'y']; - - for(var i = 0; i < 2; i++) { - // 'paper' is the fallback axref - var axLetter = axLetters[i], - axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); - - Axes.coercePosition(imageOut, gdMock, coerce, axRef, axLetter, 0); - } - - return imageOut; -} - -},{"../../lib":696,"../../plots/array_container_defaults":740,"../../plots/cartesian/axes":744,"./attributes":617}],620:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var Drawing = _dereq_('../drawing'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); - -module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, - imageDataAbove = [], - imageDataSubplot = {}, - imageDataBelow = [], - subplot, - i; - - // Sort into top, subplot, and bottom layers - 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 = img.xref + img.yref; - - var plotinfo = fullLayout._plots[subplot]; - - if(!plotinfo) { - // Fall back to _imageLowerLayer in case the requested subplot doesn't exist. - // This can happen if you reference the image to an x / y axis combination - // that doesn't have any data on it (and layer is below) - 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 } - } - }; - - - // Images must be converted to dataURL's for exporting. - function setImage(d) { - var thisImage = d3.select(this); - - if(this.img && this.img.src === d.source) { - return; - } - - thisImage.attr('xmlns', xmlnsNamespaces.svg); - - var imagePromise = new Promise(function(resolve) { - - var img = new Image(); - this.img = img; - - // If not set, a `tainted canvas` error is thrown - img.setAttribute('crossOrigin', 'anonymous'); - img.onerror = errorHandler; - img.onload = function() { - var canvas = document.createElement('canvas'); - canvas.width = this.width; - canvas.height = this.height; - - var ctx = canvas.getContext('2d'); - ctx.drawImage(this, 0, 0); - - var dataURL = canvas.toDataURL('image/png'); - - thisImage.attr('xlink:href', dataURL); - - // resolve promise in onload handler instead of on 'load' to support IE11 - // see https://github.com/plotly/plotly.js/issues/1685 - // for more details - resolve(); - }; - - - thisImage.on('error', errorHandler); - - img.src = d.source; - - function errorHandler() { - thisImage.remove(); - resolve(); - } - }.bind(this)); - - gd._promises.push(imagePromise); - } - - function applyAttributes(d) { - var thisImage = d3.select(this); - - // Axes if specified - var xa = Axes.getFromId(gd, d.xref), - ya = Axes.getFromId(gd, d.yref); - - var size = fullLayout._size, - width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, - height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; - - // Offsets for anchor positioning - var xOffset = width * anchors.x[d.xanchor].offset, - yOffset = height * anchors.y[d.yanchor].offset; - - var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; - - // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, - yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; - - - // Construct the proper aspectRatio attribute - switch(d.sizing) { - case 'fill': - sizing += ' slice'; - break; - - case 'stretch': - sizing = 'none'; - break; - } - - thisImage.attr({ - x: xPos, - y: yPos, - width: width, - height: height, - preserveAspectRatio: sizing, - opacity: d.opacity - }); - - - // Set proper clipping on images - var xId = xa ? xa._id : '', - yId = ya ? ya._id : '', - clipAxes = xId + yId; - - thisImage.call(Drawing.setClipUrl, clipAxes ? - ('clip' + fullLayout._uid + clipAxes) : - null - ); - } - - var imagesBelow = fullLayout._imageLowerLayer.selectAll('image') - .data(imageDataBelow), - 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]; - - // filter out overlaid plots (which havd their images on the main plot) - // and gl2d plots (which don't support below images, at least not yet) - if(!subplotObj.imagelayer) continue; - - var imagesOnSubplot = subplotObj.imagelayer.selectAll('image') - // even if there are no images on this subplot, we need to run - // enter and exit in case there were previously - .data(imageDataSubplot[subplot] || []); - - imagesOnSubplot.enter().append('image'); - imagesOnSubplot.exit().remove(); - - imagesOnSubplot.each(function(d) { - setImage.bind(this)(d); - applyAttributes.bind(this)(d); - }); - } -}; - -},{"../../constants/xmlns_namespaces":674,"../../plots/cartesian/axes":744,"../drawing":595,"d3":148}],621:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = { - moduleType: 'component', - name: 'images', - - layoutAttributes: _dereq_('./attributes'), - supplyLayoutDefaults: _dereq_('./defaults'), - includeBasePlot: _dereq_('../../plots/cartesian/include_components')('images'), - - draw: _dereq_('./draw'), - - convertCoords: _dereq_('./convert_coords') -}; - -},{"../../plots/cartesian/include_components":755,"./attributes":617,"./convert_coords":618,"./defaults":619,"./draw":620}],622:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -/** - * Determine the position anchor property of x/y xanchor/yanchor components. - * - * - values < 1/3 align the low side at that fraction, - * - values [1/3, 2/3] align the center at that fraction, - * - values > 2/3 align the right at that fraction. - */ - -exports.isRightAnchor = function isRightAnchor(opts) { - return ( - opts.xanchor === 'right' || - (opts.xanchor === 'auto' && opts.x >= 2 / 3) - ); -}; - -exports.isCenterAnchor = function isCenterAnchor(opts) { - return ( - opts.xanchor === 'center' || - (opts.xanchor === 'auto' && opts.x > 1 / 3 && opts.x < 2 / 3) - ); -}; - -exports.isBottomAnchor = function isBottomAnchor(opts) { - return ( - opts.yanchor === 'bottom' || - (opts.yanchor === 'auto' && opts.y <= 1 / 3) - ); -}; - -exports.isMiddleAnchor = function isMiddleAnchor(opts) { - return ( - opts.yanchor === 'middle' || - (opts.yanchor === 'auto' && opts.y > 1 / 3 && opts.y < 2 / 3) - ); -}; - -},{}],623:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var fontAttrs = _dereq_('../../plots/font_attributes'); -var colorAttrs = _dereq_('../color/attributes'); - - -module.exports = { - bgcolor: { - valType: 'color', - - editType: 'legend', - - }, - bordercolor: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'legend', - - }, - borderwidth: { - valType: 'number', - min: 0, - dflt: 0, - - editType: 'legend', - - }, - font: fontAttrs({ - editType: 'legend', - - }), - orientation: { - valType: 'enumerated', - values: ['v', 'h'], - dflt: 'v', - - editType: 'legend', - - }, - traceorder: { - valType: 'flaglist', - flags: ['reversed', 'grouped'], - extras: ['normal'], - - editType: 'legend', - - }, - tracegroupgap: { - valType: 'number', - min: 0, - dflt: 10, - - editType: 'legend', - - }, - x: { - valType: 'number', - min: -2, - max: 3, - dflt: 1.02, - - editType: 'legend', - - }, - xanchor: { - valType: 'enumerated', - values: ['auto', 'left', 'center', 'right'], - dflt: 'left', - - editType: 'legend', - - }, - y: { - valType: 'number', - min: -2, - max: 3, - dflt: 1, - - editType: 'legend', - - }, - yanchor: { - valType: 'enumerated', - values: ['auto', 'top', 'middle', 'bottom'], - dflt: 'auto', - - editType: 'legend', - - }, - editType: 'legend' -}; - -},{"../../plots/font_attributes":771,"../color/attributes":569}],624:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = { - scrollBarWidth: 6, - scrollBarMinHeight: 20, - scrollBarColor: '#808BA4', - scrollBarMargin: 4, - textOffsetX: 40 -}; - -},{}],625:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Template = _dereq_('../../plot_api/plot_template'); - -var attributes = _dereq_('./attributes'); -var basePlotLayoutAttributes = _dereq_('../../plots/layout_attributes'); -var helpers = _dereq_('./helpers'); - - -module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { - var containerIn = layoutIn.legend || {}; - - var legendTraceCount = 0; - var legendReallyHasATrace = false; - var defaultOrder = 'normal'; - - var defaultX, defaultY, defaultXAnchor, defaultYAnchor; - - for(var i = 0; i < fullData.length; i++) { - var trace = fullData[i]; - - if(!trace.visible) continue; - - // Note that we explicitly count any trace that is either shown or - // *would* be shown by default, toward the two traces you need to - // ensure the legend is shown by default, because this can still help - // disambiguate. - if(trace.showlegend || trace._dfltShowLegend) { - legendTraceCount++; - if(trace.showlegend) { - legendReallyHasATrace = true; - // Always show the legend by default if there's a pie, - // or if there's only one trace but it's explicitly shown - if(Registry.traceIs(trace, 'pie') || - trace._input.showlegend === true - ) { - legendTraceCount++; - } - } - } - - if((Registry.traceIs(trace, 'bar') && layoutOut.barmode === 'stack') || - ['tonextx', 'tonexty'].indexOf(trace.fill) !== -1) { - defaultOrder = helpers.isGrouped({traceorder: defaultOrder}) ? - 'grouped+reversed' : 'reversed'; - } - - if(trace.legendgroup !== undefined && trace.legendgroup !== '') { - defaultOrder = helpers.isReversed({traceorder: defaultOrder}) ? - 'reversed+grouped' : 'grouped'; - } - } - - var showLegend = Lib.coerce(layoutIn, layoutOut, - basePlotLayoutAttributes, 'showlegend', - legendReallyHasATrace && legendTraceCount > 1); - - if(showLegend === false) return; - - var containerOut = Template.newContainer(layoutOut, 'legend'); - - function coerce(attr, dflt) { - return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); - } - - coerce('bgcolor', layoutOut.paper_bgcolor); - coerce('bordercolor'); - coerce('borderwidth'); - Lib.coerceFont(coerce, 'font', layoutOut.font); - - coerce('orientation'); - if(containerOut.orientation === 'h') { - var xaxis = layoutIn.xaxis; - if(xaxis && xaxis.rangeslider && xaxis.rangeslider.visible) { - defaultX = 0; - defaultXAnchor = 'left'; - defaultY = 1.1; - defaultYAnchor = 'bottom'; - } - else { - defaultX = 0; - defaultXAnchor = 'left'; - defaultY = -0.1; - defaultYAnchor = 'top'; - } - } - - coerce('traceorder', defaultOrder); - if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); - - coerce('x', defaultX); - coerce('xanchor', defaultXAnchor); - coerce('y', defaultY); - coerce('yanchor', defaultYAnchor); - Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); -}; - -},{"../../lib":696,"../../plot_api/plot_template":734,"../../plots/layout_attributes":799,"../../registry":827,"./attributes":623,"./helpers":629}],626:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Lib = _dereq_('../../lib'); -var Plots = _dereq_('../../plots/plots'); -var Registry = _dereq_('../../registry'); -var Events = _dereq_('../../lib/events'); -var dragElement = _dereq_('../dragelement'); -var Drawing = _dereq_('../drawing'); -var Color = _dereq_('../color'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var handleClick = _dereq_('./handle_click'); - -var constants = _dereq_('./constants'); -var interactConstants = _dereq_('../../constants/interactions'); -var alignmentConstants = _dereq_('../../constants/alignment'); -var LINE_SPACING = alignmentConstants.LINE_SPACING; -var FROM_TL = alignmentConstants.FROM_TL; -var FROM_BR = alignmentConstants.FROM_BR; - -var getLegendData = _dereq_('./get_legend_data'); -var style = _dereq_('./style'); -var helpers = _dereq_('./helpers'); -var anchorUtils = _dereq_('./anchor_utils'); - -var DBLCLICKDELAY = interactConstants.DBLCLICKDELAY; - -module.exports = function draw(gd) { - var fullLayout = gd._fullLayout; - var clipId = 'legend' + fullLayout._uid; - - if(!fullLayout._infolayer || !gd.calcdata) return; - - if(!gd._legendMouseDownTime) gd._legendMouseDownTime = 0; - - var opts = fullLayout.legend; - var legendData = fullLayout.showlegend && getLegendData(gd.calcdata, opts); - var hiddenSlices = fullLayout.hiddenlabels || []; - - if(!fullLayout.showlegend || !legendData.length) { - fullLayout._infolayer.selectAll('.legend').remove(); - fullLayout._topdefs.select('#' + clipId).remove(); - - Plots.autoMargin(gd, 'legend'); - return; - } - - var maxLength = 0; - for(var i = 0; i < legendData.length; i++) { - for(var j = 0; j < legendData[i].length; j++) { - var item = legendData[i][j][0]; - var trace = item.trace; - var isPie = Registry.traceIs(trace, 'pie'); - var name = isPie ? item.label : trace.name; - maxLength = Math.max(maxLength, name && name.length || 0); - } - } - - var firstRender = false; - var legend = Lib.ensureSingle(fullLayout._infolayer, 'g', 'legend', function(s) { - s.attr('pointer-events', 'all'); - firstRender = true; - }); - - var clipPath = Lib.ensureSingleById(fullLayout._topdefs, 'clipPath', clipId, function(s) { - s.append('rect'); - }); - - var bg = Lib.ensureSingle(legend, 'rect', 'bg', function(s) { - s.attr('shape-rendering', 'crispEdges'); - }); - - bg.call(Color.stroke, opts.bordercolor) - .call(Color.fill, opts.bgcolor) - .style('stroke-width', opts.borderwidth + 'px'); - - var scrollBox = Lib.ensureSingle(legend, 'g', 'scrollbox'); - - var scrollBar = Lib.ensureSingle(legend, 'rect', 'scrollbar', function(s) { - s.attr({ - rx: 20, - ry: 3, - width: 0, - height: 0 - }) - .call(Color.fill, '#808BA4'); - }); - - 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.call(style, gd) - .style('opacity', function(d) { - var trace = d[0].trace; - if(Registry.traceIs(trace, 'pie')) { - 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, gd, maxLength) - .call(setupTraceToggle, gd); - }); - - Lib.syncOrAsync([Plots.previousPromises, - function() { - if(firstRender) { - computeLegendDimensions(gd, groups, traces); - expandMargin(gd); - } - - // Position and size the legend - var lxMin = 0, - lxMax = fullLayout.width, - lyMin = 0, - lyMax = fullLayout.height; - - computeLegendDimensions(gd, groups, traces); - - if(opts._height > lyMax) { - // If the legend doesn't fit in the plot area, - // do not expand the vertical margins. - expandHorizontalMargin(gd); - } else { - expandMargin(gd); - } - - // Scroll section must be executed after repositionLegend. - // It requires the legend width, height, x and y to position the scrollbox - // and these values are mutated in repositionLegend. - var gs = fullLayout._size, - lx = gs.l + gs.w * opts.x, - ly = gs.t + gs.h * (1 - opts.y); - - if(anchorUtils.isRightAnchor(opts)) { - lx -= opts._width; - } - else if(anchorUtils.isCenterAnchor(opts)) { - lx -= opts._width / 2; - } - - if(anchorUtils.isBottomAnchor(opts)) { - ly -= opts._height; - } - else if(anchorUtils.isMiddleAnchor(opts)) { - ly -= opts._height / 2; - } - - // Make sure the legend left and right sides are visible - var legendWidth = opts._width, - legendWidthMax = gs.w; - - if(legendWidth > legendWidthMax) { - lx = gs.l; - legendWidth = legendWidthMax; - } - else { - if(lx + legendWidth > lxMax) lx = lxMax - legendWidth; - if(lx < lxMin) lx = lxMin; - legendWidth = Math.min(lxMax - lx, opts._width); - } - - // Make sure the legend top and bottom are visible - // (legends with a scroll bar are not allowed to stretch beyond the extended - // margins) - var legendHeight = opts._height, - legendHeightMax = gs.h; - - if(legendHeight > legendHeightMax) { - ly = gs.t; - legendHeight = legendHeightMax; - } - else { - if(ly + legendHeight > lyMax) ly = lyMax - legendHeight; - if(ly < lyMin) ly = lyMin; - legendHeight = Math.min(lyMax - ly, opts._height); - } - - // Set size and position of all the elements that make up a legend: - // legend, background and border, scroll box and scroll bar - Drawing.setTranslate(legend, lx, ly); - - // to be safe, remove previous listeners - scrollBar.on('.drag', null); - legend.on('wheel', null); - - if(opts._height <= legendHeight || gd._context.staticPlot) { - // if scrollbar should not be shown. - bg.attr({ - width: legendWidth - opts.borderwidth, - height: legendHeight - opts.borderwidth, - x: opts.borderwidth / 2, - y: opts.borderwidth / 2 - }); - - Drawing.setTranslate(scrollBox, 0, 0); - - clipPath.select('rect').attr({ - width: legendWidth - 2 * opts.borderwidth, - height: legendHeight - 2 * opts.borderwidth, - x: opts.borderwidth, - y: opts.borderwidth - }); - - Drawing.setClipUrl(scrollBox, clipId); - - Drawing.setRect(scrollBar, 0, 0, 0, 0); - delete opts._scrollY; - } - else { - var scrollBarHeight = Math.max(constants.scrollBarMinHeight, - legendHeight * legendHeight / opts._height); - var scrollBarYMax = legendHeight - - scrollBarHeight - - 2 * constants.scrollBarMargin; - var scrollBoxYMax = opts._height - legendHeight; - var scrollRatio = scrollBarYMax / scrollBoxYMax; - - var scrollBoxY = Math.min(opts._scrollY || 0, scrollBoxYMax); - - // increase the background and clip-path width - // by the scrollbar width and margin - bg.attr({ - width: legendWidth - - 2 * opts.borderwidth + - constants.scrollBarWidth + - constants.scrollBarMargin, - height: legendHeight - opts.borderwidth, - x: opts.borderwidth / 2, - y: opts.borderwidth / 2 - }); - - clipPath.select('rect').attr({ - width: legendWidth - - 2 * opts.borderwidth + - constants.scrollBarWidth + - constants.scrollBarMargin, - height: legendHeight - 2 * opts.borderwidth, - x: opts.borderwidth, - y: opts.borderwidth + scrollBoxY - }); - - Drawing.setClipUrl(scrollBox, clipId); - - scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); - - legend.on('wheel', function() { - scrollBoxY = Lib.constrain( - opts._scrollY + - d3.event.deltaY / scrollBarYMax * scrollBoxYMax, - 0, scrollBoxYMax); - scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); - if(scrollBoxY !== 0 && scrollBoxY !== scrollBoxYMax) { - d3.event.preventDefault(); - } - }); - - var eventY0, scrollBoxY0; - - var drag = d3.behavior.drag() - .on('dragstart', function() { - eventY0 = d3.event.sourceEvent.clientY; - scrollBoxY0 = scrollBoxY; - }) - .on('drag', function() { - var e = d3.event.sourceEvent; - if(e.buttons === 2 || e.ctrlKey) return; - - scrollBoxY = Lib.constrain( - (e.clientY - eventY0) / scrollRatio + scrollBoxY0, - 0, scrollBoxYMax); - scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); - }); - - scrollBar.call(drag); - } - - - function scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio) { - opts._scrollY = gd._fullLayout.legend._scrollY = scrollBoxY; - Drawing.setTranslate(scrollBox, 0, -scrollBoxY); - - Drawing.setRect( - scrollBar, - legendWidth, - constants.scrollBarMargin + scrollBoxY * scrollRatio, - constants.scrollBarWidth, - scrollBarHeight - ); - clipPath.select('rect').attr({ - y: opts.borderwidth + scrollBoxY - }); - } - - if(gd._context.edits.legendPosition) { - var xf, yf, x0, y0; - - legend.classed('cursor-move', true); - - dragElement.init({ - element: legend.node(), - gd: gd, - prepFn: function() { - var transform = Drawing.getTranslate(legend); - - x0 = transform.x; - y0 = transform.y; - }, - moveFn: function(dx, dy) { - var newX = x0 + dx, - newY = y0 + dy; - - Drawing.setTranslate(legend, newX, newY); - - xf = dragElement.align(newX, 0, gs.l, gs.l + gs.w, opts.xanchor); - yf = dragElement.align(newY, 0, gs.t + gs.h, gs.t, opts.yanchor); - }, - doneFn: function() { - if(xf !== undefined && yf !== undefined) { - Registry.call('relayout', gd, {'legend.x': xf, 'legend.y': yf}); - } - }, - clickFn: function(numClicks, e) { - var clickedTrace = fullLayout._infolayer.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(gd, legend, clickedTrace, numClicks, e); - } - } - }); - } - }], gd); -}; - -function clickOrDoubleClick(gd, 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: gd.data, - layout: gd.layout, - frames: gd._transitionData._frames, - config: gd._context, - fullData: gd._fullData, - fullLayout: gd._fullLayout - }; - - if(trace._group) { - evtData.group = trace._group; - } - if(trace.type === 'pie') { - evtData.label = legendItem.datum()[0].label; - } - - var clickVal = Events.triggerHandler(gd, 'plotly_legendclick', evtData); - if(clickVal === false) return; - - if(numClicks === 1) { - legend._clickTimeout = setTimeout(function() { - handleClick(legendItem, gd, numClicks); - }, DBLCLICKDELAY); - } - else if(numClicks === 2) { - if(legend._clickTimeout) clearTimeout(legend._clickTimeout); - gd._legendMouseDownTime = 0; - - var dblClickVal = Events.triggerHandler(gd, 'plotly_legenddoubleclick', evtData); - if(dblClickVal !== false) handleClick(legendItem, gd, numClicks); - } -} - -function drawTexts(g, gd, maxLength) { - var legendItem = g.data()[0][0]; - var fullLayout = gd._fullLayout; - var trace = legendItem.trace; - var isPie = Registry.traceIs(trace, 'pie'); - var traceIndex = trace.index; - var name = isPie ? legendItem.label : trace.name; - var isEditable = gd._context.edits.legendText && !isPie; - - var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); - - textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(isEditable ? ensureLength(name, maxLength) : name); - - svgTextUtils.positionText(textEl, constants.textOffsetX, 0); - - function textLayout(s) { - svgTextUtils.convertToTspans(s, gd, function() { - computeTextDimensions(g, gd); - }); - } - - if(isEditable) { - textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) - .call(textLayout) - .on('edit', function(newName) { - this.text(ensureLength(newName, maxLength)) - .call(textLayout); - - 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; - } - - return Registry.call('restyle', gd, update, traceIndex); - }); - } else { - textLayout(textEl); - } -} - -/* - * Make sure we have a reasonably clickable region. - * If this string is missing or very short, pad it with spaces out to at least - * 4 characters, up to the max length of other labels, on the assumption that - * most characters are wider than spaces so a string of spaces will usually be - * no wider than the real labels. - */ -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, gd) { - var newMouseDownTime, - numClicks = 1; - - var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); - }); - - traceToggle.on('mousedown', function() { - newMouseDownTime = (new Date()).getTime(); - if(newMouseDownTime - gd._legendMouseDownTime < DBLCLICKDELAY) { - // in a click train - numClicks += 1; - } - else { - // new click train - numClicks = 1; - gd._legendMouseDownTime = newMouseDownTime; - } - }); - traceToggle.on('mouseup', function() { - if(gd._dragged || gd._editing) return; - var legend = gd._fullLayout.legend; - - if((new Date()).getTime() - gd._legendMouseDownTime > DBLCLICKDELAY) { - numClicks = Math.max(numClicks - 1, 1); - } - - clickOrDoubleClick(gd, legend, g, numClicks, d3.event); - }); -} - -function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0]; - - if(!legendItem.trace.showlegend) { - g.remove(); - return; - } - - var mathjaxGroup = g.select('g[class*=math-group]'); - var mathjaxNode = mathjaxGroup.node(); - var opts = gd._fullLayout.legend; - var lineHeight = opts.font.size * LINE_SPACING; - var height, width; - - if(mathjaxNode) { - var mathjaxBB = Drawing.bBox(mathjaxNode); - - height = mathjaxBB.height; - width = mathjaxBB.width; - - Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); - } - else { - var text = g.select('.legendtext'); - var textLines = svgTextUtils.lineCount(text); - var textNode = text.node(); - - height = lineHeight * textLines; - width = textNode ? Drawing.bBox(textNode).width : 0; - - // approximation to height offset to center the font - // to avoid getBoundingClientRect - var textY = lineHeight * (0.3 + (1 - textLines) / 2); - svgTextUtils.positionText(text, constants.textOffsetX, textY); - } - - height = Math.max(height, 16) + 3; - - legendItem.height = height; - legendItem.width = width; -} - -function computeLegendDimensions(gd, groups, traces) { - var fullLayout = gd._fullLayout; - var opts = fullLayout.legend; - var borderwidth = opts.borderwidth; - var isGrouped = helpers.isGrouped(opts); - - var extraWidth = 0; - - opts._width = 0; - opts._height = 0; - - if(helpers.isVertical(opts)) { - if(isGrouped) { - groups.each(function(d, i) { - Drawing.setTranslate(this, 0, i * opts.tracegroupgap); - }); - } - - traces.each(function(d) { - var legendItem = d[0], - textHeight = legendItem.height, - textWidth = legendItem.width; - - Drawing.setTranslate(this, - borderwidth, - (5 + borderwidth + opts._height + textHeight / 2)); - - opts._height += textHeight; - opts._width = Math.max(opts._width, textWidth); - }); - - opts._width += 45 + borderwidth * 2; - opts._height += 10 + borderwidth * 2; - - if(isGrouped) { - opts._height += (opts._lgroupsLength - 1) * opts.tracegroupgap; - } - - extraWidth = 40; - } - else if(isGrouped) { - var groupXOffsets = [opts._width], - groupData = groups.data(); - - for(var i = 0, n = groupData.length; i < n; i++) { - var textWidths = groupData[i].map(function(legendItemArray) { - return legendItemArray[0].width; - }); - - var groupWidth = 40 + Math.max.apply(null, textWidths); - - opts._width += opts.tracegroupgap + groupWidth; - - groupXOffsets.push(opts._width); - } - - groups.each(function(d, i) { - Drawing.setTranslate(this, groupXOffsets[i], 0); - }); - - groups.each(function() { - var group = d3.select(this), - groupTraces = group.selectAll('g.traces'), - groupHeight = 0; - - groupTraces.each(function(d) { - var legendItem = d[0], - textHeight = legendItem.height; - - Drawing.setTranslate(this, - 0, - (5 + borderwidth + groupHeight + textHeight / 2)); - - groupHeight += textHeight; - }); - - opts._height = Math.max(opts._height, groupHeight); - }); - - opts._height += 10 + borderwidth * 2; - opts._width += borderwidth * 2; - } - else { - var rowHeight = 0, - maxTraceHeight = 0, - maxTraceWidth = 0, - offsetX = 0, - fullTracesWidth = 0, - traceGap = opts.tracegroupgap || 5, - oneRowLegend; - - // calculate largest width for traces and use for width of all legend items - traces.each(function(d) { - maxTraceWidth = Math.max(40 + d[0].width, maxTraceWidth); - fullTracesWidth += 40 + d[0].width + traceGap; - }); - - // check if legend fits in one row - oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap; - traces.each(function(d) { - var legendItem = d[0], - traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth; - - if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) { - offsetX = 0; - rowHeight = rowHeight + maxTraceHeight; - opts._height = opts._height + maxTraceHeight; - // reset for next row - maxTraceHeight = 0; - } - - Drawing.setTranslate(this, - (borderwidth + offsetX), - (5 + borderwidth + legendItem.height / 2) + rowHeight); - - opts._width += traceGap + traceWidth; - opts._height = Math.max(opts._height, legendItem.height); - - // keep track of tallest trace in group - offsetX += traceGap + traceWidth; - maxTraceHeight = Math.max(legendItem.height, maxTraceHeight); - }); - - opts._width += borderwidth * 2; - opts._height += 10 + borderwidth * 2; - - } - - // make sure we're only getting full pixels - opts._width = Math.ceil(opts._width); - opts._height = Math.ceil(opts._height); - - var isEditable = ( - gd._context.edits.legendText || - gd._context.edits.legendPosition - ); - - traces.each(function(d) { - var legendItem = d[0]; - var bg = d3.select(this).select('.legendtoggle'); - - Drawing.setRect(bg, - 0, - -legendItem.height / 2, - (isEditable ? 0 : opts._width) + extraWidth, - legendItem.height - ); - }); -} - -function expandMargin(gd) { - var fullLayout = gd._fullLayout, - opts = fullLayout.legend; - - var xanchor = 'left'; - if(anchorUtils.isRightAnchor(opts)) { - xanchor = 'right'; - } - else if(anchorUtils.isCenterAnchor(opts)) { - xanchor = 'center'; - } - - var yanchor = 'top'; - if(anchorUtils.isBottomAnchor(opts)) { - yanchor = 'bottom'; - } - else if(anchorUtils.isMiddleAnchor(opts)) { - yanchor = 'middle'; - } - - // lastly check if the margin auto-expand has changed - Plots.autoMargin(gd, 'legend', { - x: opts.x, - y: opts.y, - l: opts._width * (FROM_TL[xanchor]), - r: opts._width * (FROM_BR[xanchor]), - b: opts._height * (FROM_BR[yanchor]), - t: opts._height * (FROM_TL[yanchor]) - }); -} - -function expandHorizontalMargin(gd) { - var fullLayout = gd._fullLayout, - opts = fullLayout.legend; - - var xanchor = 'left'; - if(anchorUtils.isRightAnchor(opts)) { - xanchor = 'right'; - } - else if(anchorUtils.isCenterAnchor(opts)) { - xanchor = 'center'; - } - - // lastly check if the margin auto-expand has changed - Plots.autoMargin(gd, 'legend', { - x: opts.x, - y: 0.5, - l: opts._width * (FROM_TL[xanchor]), - r: opts._width * (FROM_BR[xanchor]), - b: 0, - t: 0 - }); -} - -},{"../../constants/alignment":668,"../../constants/interactions":672,"../../lib":696,"../../lib/events":684,"../../lib/svg_text_utils":720,"../../plots/plots":808,"../../registry":827,"../color":570,"../dragelement":592,"../drawing":595,"./anchor_utils":622,"./constants":624,"./get_legend_data":627,"./handle_click":628,"./helpers":629,"./style":631,"d3":148}],627:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../../registry'); -var helpers = _dereq_('./helpers'); - - -module.exports = function getLegendData(calcdata, opts) { - var lgroupToTraces = {}, - lgroups = [], - hasOneNonBlankGroup = false, - slicesShown = {}, - lgroupi = 0; - - var i, j; - - function addOneItem(legendGroup, legendItem) { - // each '' legend group is treated as a separate group - if(legendGroup === '' || !helpers.isGrouped(opts)) { - var uniqueGroup = '~~i' + lgroupi; // TODO: check this against fullData legendgroups? - - 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]); - } - - // build an { legendgroup: [cd0, cd0], ... } object - for(i = 0; i < calcdata.length; i++) { - var cd = calcdata[i]; - var cd0 = cd[0]; - var trace = cd0.trace; - var lgroup = trace.legendgroup; - - if(!trace.visible || !trace.showlegend) continue; - - if(Registry.traceIs(trace, 'pie')) { - if(!slicesShown[lgroup]) slicesShown[lgroup] = {}; - - for(j = 0; j < cd.length; j++) { - var labelj = cd[j].label; - - if(!slicesShown[lgroup][labelj]) { - addOneItem(lgroup, { - label: labelj, - color: cd[j].color, - i: cd[j].i, - trace: trace, - pts: cd[j].pts - }); - - slicesShown[lgroup][labelj] = true; - } - } - } - - else addOneItem(lgroup, cd0); - } - - // won't draw a legend in this case - if(!lgroups.length) return []; - - // rearrange lgroupToTraces into a d3-friendly array of arrays - var lgroupsLength = lgroups.length, - ltraces, - legendData; - - if(hasOneNonBlankGroup && helpers.isGrouped(opts)) { - legendData = new Array(lgroupsLength); - - for(i = 0; i < lgroupsLength; i++) { - ltraces = lgroupToTraces[lgroups[i]]; - legendData[i] = helpers.isReversed(opts) ? ltraces.reverse() : ltraces; - } - } - else { - // collapse all groups into one if all groups are blank - legendData = [new Array(lgroupsLength)]; - - for(i = 0; i < lgroupsLength; i++) { - ltraces = lgroupToTraces[lgroups[i]][0]; - legendData[0][helpers.isReversed(opts) ? lgroupsLength - i - 1 : i] = ltraces; - } - lgroupsLength = 1; - } - - // needed in repositionLegend - opts._lgroupsLength = lgroupsLength; - return legendData; -}; - -},{"../../registry":827,"./helpers":629}],628:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); - -var SHOWISOLATETIP = true; - -module.exports = function handleClick(g, gd, numClicks) { - if(gd._dragged || gd._editing) return; - - var hiddenSlices = gd._fullLayout.hiddenlabels ? - gd._fullLayout.hiddenlabels.slice() : - []; - - var legendItem = g.data()[0][0]; - var fullData = gd._fullData; - var fullTrace = legendItem.trace; - var legendgroup = fullTrace.legendgroup; - - var i, j, kcont, key, keys, val; - var attrUpdate = {}; - var attrIndices = []; - var carrs = []; - var carrIdx = []; - - function insertUpdate(traceIndex, key, value) { - var attrIndex = attrIndices.indexOf(traceIndex); - var valueArray = attrUpdate[key]; - if(!valueArray) { - valueArray = attrUpdate[key] = []; - } - - if(attrIndices.indexOf(traceIndex) === -1) { - attrIndices.push(traceIndex); - attrIndex = attrIndices.length - 1; - } - - valueArray[attrIndex] = value; - - return attrIndex; - } - - function setVisibility(fullTrace, visibility) { - var fullInput = fullTrace._fullInput; - if(Registry.hasTransform(fullInput, 'groupby')) { - var kcont = carrs[fullInput.index]; - if(!kcont) { - var groupbyIndices = Registry.getTransformIndices(fullInput, 'groupby'); - var lastGroupbyIndex = groupbyIndices[groupbyIndices.length - 1]; - kcont = Lib.keyedContainer(fullInput, 'transforms[' + lastGroupbyIndex + '].styles', 'target', 'value.visible'); - carrs[fullInput.index] = kcont; - } - - var curState = kcont.get(fullTrace._group); - - // If not specified, assume visible. This happens if there are other style - // properties set for a group but not the visibility. There are many similar - // ways to do this (e.g. why not just `curState = fullTrace.visible`??? The - // answer is: because it breaks other things like groupby trace names in - // subtle ways.) - if(curState === undefined) { - curState = true; - } - - if(curState !== false) { - // true -> legendonly. All others toggle to true: - kcont.set(fullTrace._group, visibility); - } - carrIdx[fullInput.index] = insertUpdate(fullInput.index, 'visible', fullInput.visible === false ? false : true); - } else { - // false -> false (not possible since will not be visible in legend) - // true -> legendonly - // legendonly -> true - var nextVisibility = fullInput.visible === false ? false : visibility; - - insertUpdate(fullInput.index, 'visible', nextVisibility); - } - } - - if(numClicks === 1 && SHOWISOLATETIP && gd.data && gd._context.showTips) { - Lib.notifier(Lib._(gd, 'Double-click on legend to isolate one trace'), 'long'); - SHOWISOLATETIP = false; - } else { - SHOWISOLATETIP = false; - } - - if(Registry.traceIs(fullTrace, 'pie')) { - var thisLabel = legendItem.label, - thisLabelIndex = hiddenSlices.indexOf(thisLabel); - - if(numClicks === 1) { - if(thisLabelIndex === -1) hiddenSlices.push(thisLabel); - else hiddenSlices.splice(thisLabelIndex, 1); - } else if(numClicks === 2) { - hiddenSlices = []; - gd.calcdata[0].forEach(function(d) { - if(thisLabel !== d.label) { - hiddenSlices.push(d.label); - } - }); - if(gd._fullLayout.hiddenlabels && gd._fullLayout.hiddenlabels.length === hiddenSlices.length && thisLabelIndex === -1) { - hiddenSlices = []; - } - } - - Registry.call('relayout', gd, 'hiddenlabels', hiddenSlices); - } else { - var hasLegendgroup = legendgroup && legendgroup.length; - var traceIndicesInGroup = []; - var tracei; - if(hasLegendgroup) { - for(i = 0; i < fullData.length; i++) { - tracei = fullData[i]; - if(!tracei.visible) continue; - if(tracei.legendgroup === legendgroup) { - traceIndicesInGroup.push(i); - } - } - } - - if(numClicks === 1) { - var nextVisibility; - - switch(fullTrace.visible) { - case true: - nextVisibility = 'legendonly'; - break; - case false: - nextVisibility = false; - break; - case 'legendonly': - nextVisibility = true; - break; - } - - if(hasLegendgroup) { - for(i = 0; i < fullData.length; i++) { - if(fullData[i].visible !== false && fullData[i].legendgroup === legendgroup) { - setVisibility(fullData[i], nextVisibility); - } - } - } else { - setVisibility(fullTrace, nextVisibility); - } - } else if(numClicks === 2) { - // Compute the clicked index. expandedIndex does what we want for expanded traces - // but also culls hidden traces. That means we have some work to do. - var isClicked, isInGroup, otherState; - var isIsolated = true; - for(i = 0; i < fullData.length; i++) { - isClicked = fullData[i] === fullTrace; - if(isClicked) continue; - - isInGroup = (hasLegendgroup && fullData[i].legendgroup === legendgroup); - - if(!isInGroup && fullData[i].visible === true && !Registry.traceIs(fullData[i], 'notLegendIsolatable')) { - isIsolated = false; - break; - } - } - - for(i = 0; i < fullData.length; i++) { - // False is sticky; we don't change it. - if(fullData[i].visible === false) continue; - - if(Registry.traceIs(fullData[i], 'notLegendIsolatable')) { - continue; - } - - switch(fullTrace.visible) { - case 'legendonly': - setVisibility(fullData[i], true); - break; - case true: - otherState = isIsolated ? true : 'legendonly'; - isClicked = fullData[i] === fullTrace; - isInGroup = isClicked || (hasLegendgroup && fullData[i].legendgroup === legendgroup); - setVisibility(fullData[i], isInGroup ? 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 = attrUpdate[key] = attrUpdate[key] || []; - val[carrIdx[i]] = update[key]; - } - } - - // The length of the value arrays should be equal and any unspecified - // values should be explicitly undefined for them to get properly culled - // as updates and not accidentally reset to the default value. This fills - // out sparse arrays with the required number of undefined values: - keys = Object.keys(attrUpdate); - for(i = 0; i < keys.length; i++) { - key = keys[i]; - for(j = 0; j < attrIndices.length; j++) { - // Use hasOwnPropety to protect against falsey values: - if(!attrUpdate[key].hasOwnProperty(j)) { - attrUpdate[key][j] = undefined; - } - } - } - - Registry.call('restyle', gd, attrUpdate, attrIndices); - } -}; - -},{"../../lib":696,"../../registry":827}],629:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -exports.isGrouped = function isGrouped(legendLayout) { - return (legendLayout.traceorder || '').indexOf('grouped') !== -1; -}; - -exports.isVertical = function isVertical(legendLayout) { - return legendLayout.orientation !== 'h'; -}; - -exports.isReversed = function isReversed(legendLayout) { - return (legendLayout.traceorder || '').indexOf('reversed') !== -1; -}; - -},{}],630:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -module.exports = { - moduleType: 'component', - name: 'legend', - - layoutAttributes: _dereq_('./attributes'), - supplyLayoutDefaults: _dereq_('./defaults'), - - draw: _dereq_('./draw'), - style: _dereq_('./style') -}; - -},{"./attributes":623,"./defaults":625,"./draw":626,"./style":631}],631:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../drawing'); -var Color = _dereq_('../color'); - -var subTypes = _dereq_('../../traces/scatter/subtypes'); -var stylePie = _dereq_('../../traces/pie/style_one'); - -module.exports = function style(s, gd) { - s.each(function(d) { - var traceGroup = d3.select(this); - - var layers = Lib.ensureSingle(traceGroup, 'g', 'layers'); - layers.style('opacity', d[0].trace.opacity); - - 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(styleBars) - .each(styleBoxes) - .each(stylePies) - .each(styleLines) - .each(stylePoints) - .each(styleCandles) - .each(styleOHLC); - - function styleLines(d) { - var trace = d[0].trace; - var showFill = trace.visible && trace.fill && trace.fill !== 'none'; - var showLine = subTypes.hasLines(trace); - var contours = trace.contours; - 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; - } - } - - // with fill and no markers or text, move the line and fill up a bit - // so it's more centered - var markersOrText = subTypes.hasMarkers(trace) || subTypes.hasText(trace); - var anyFill = showFill || showGradientFill; - var anyLine = showLine || showGradientLine; - var pathStart = (markersOrText || !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 + 'h30v6h-30z') - .call(showFill ? Drawing.fillGroupStyle : fillGradient); - - var line = this3.select('.legendlines').selectAll('path') - .data(showLine || showGradientLine ? [d] : []); - line.enter().append('path').classed('js-line', true); - line.exit().remove(); - - // this is ugly... but you can't apply a gradient to a perfectly - // horizontal or vertical line. Presumably because then - // the system doesn't know how to scale vertical variation, even - // though there *is* no vertical variation in this case. - // so add an invisibly small angle to the line - // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) - .call(showLine ? Drawing.lineGroupStyle : lineGradient); - - function fillGradient(s) { - if(s.size()) { - var gradientID = 'legendfill-' + trace.uid; - Drawing.gradient(s, gd, gradientID, 'horizontalreversed', - trace.colorscale, 'fill'); - } - } - - function lineGradient(s) { - if(s.size()) { - var gradientID = 'legendline-' + trace.uid; - Drawing.lineGroupStyle(s); - Drawing.gradient(s, gd, gradientID, 'horizontalreversed', - trace.colorscale, 'stroke'); - } - } - - } - - function stylePoints(d) { - var d0 = d[0]; - var trace = d0.trace; - var showMarkers = subTypes.hasMarkers(trace); - var showText = subTypes.hasText(trace); - var showLines = subTypes.hasLines(trace); - var dMod, tMod; - - // 'scatter3d' don't use gd.calcdata, - // use d0.trace to infer arrayOk attributes - - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(); - var valToBound = (Lib.isArrayOrTypedArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : - valIn; - - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; - } - return valToBound; - } - - function pickFirst(array) { return array[0]; } - - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}; - var tEdit = {}; - - if(showMarkers) { - 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]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - - var ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.ms = ms; - tEdit.marker.size = ms; - } - - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; - } - - 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); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - - // always show legend items in base state - tMod.selectedpoints = null; - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - // make sure marker is on the bottom, in case it enters after text - pts.enter().insert('path', ':first-child') - .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod, gd); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); - } - - function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; - - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); - - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); - } - - function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box-violin') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); - - 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, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendcandle') - .data(trace.type === 'candlestick' && trace.visible ? [d, d] : []); - pts.enter().append('path').classed('legendcandle', true) - .attr('d', function(_, i) { - if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing - return 'M15,0H8M8,-6V6H-8Z'; // decreasing - }) - .attr('transform', 'translate(20,0)') - .style('stroke-miterlimit', 1); - pts.exit().remove(); - pts.each(function(_, i) { - var container = trace[i ? 'increasing' : 'decreasing']; - var w = container.line.width, - p = d3.select(this); - - p.style('stroke-width', w + 'px') - .call(Color.fill, container.fillcolor); - - if(w) { - Color.stroke(p, container.line.color); - } - }); - } - - function styleOHLC(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendohlc') - .data(trace.type === 'ohlc' && trace.visible ? [d, d] : []); - pts.enter().append('path').classed('legendohlc', true) - .attr('d', function(_, i) { - if(i) return 'M-15,0H0M-8,-6V0'; // increasing - return 'M15,0H0M8,6V0'; // decreasing - }) - .attr('transform', 'translate(20,0)') - .style('stroke-miterlimit', 1); - pts.exit().remove(); - pts.each(function(_, i) { - var container = trace[i ? 'increasing' : 'decreasing']; - var w = container.line.width, - p = d3.select(this); - - p.style('fill', 'none') - .call(Drawing.dashLine, container.line.dash, w); - - if(w) { - Color.stroke(p, container.line.color); - } - }); - } - - function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - - if(pts.size()) pts.call(stylePie, d[0], trace); - } -}; - -},{"../../lib":696,"../../registry":827,"../../traces/pie/style_one":1029,"../../traces/scatter/subtypes":1067,"../color":570,"../drawing":595,"d3":148}],632:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../../registry'); -var Plots = _dereq_('../../plots/plots'); -var axisIds = _dereq_('../../plots/cartesian/axis_ids'); -var Lib = _dereq_('../../lib'); -var Icons = _dereq_('../../../build/ploticon'); - -var _ = Lib._; - -var modeBarButtons = module.exports = {}; - -/** - * ModeBar buttons configuration - * - * @param {string} name - * name / id of the buttons (for tracking) - * @param {string} title - * text that appears while hovering over the button, - * enter null, false or '' for no hover text - * @param {string} icon - * svg icon object associated with the button - * can be linked to Plotly.Icons to use the default plotly icons - * @param {string} [gravity] - * icon positioning - * @param {function} click - * click handler associated with the button, a function of - * 'gd' (the main graph object) and - * 'ev' (the event object) - * @param {string} [attr] - * attribute associated with button, - * use this with 'val' to keep track of the state - * @param {*} [val] - * initial 'attr' value, can be a function of gd - * @param {boolean} [toggle] - * is the button a toggle button? - */ - -modeBarButtons.toImage = { - name: 'toImage', - title: function(gd) { - var opts = gd._context.toImageButtonOptions || {}; - var format = opts.format || 'png'; - return format === 'png' ? - _(gd, 'Download plot as a png') : // legacy text - _(gd, 'Download plot'); // generic non-PNG text - }, - icon: Icons.camera, - click: function(gd) { - var toImageButtonOptions = gd._context.toImageButtonOptions; - var opts = {format: toImageButtonOptions.format || 'png'}; - - Lib.notifier(_(gd, 'Taking snapshot - this may take a few seconds'), 'long'); - - if(opts.format !== 'svg' && Lib.isIE()) { - Lib.notifier(_(gd, 'IE only supports svg. Changing format to svg.'), 'long'); - opts.format = 'svg'; - } - - ['filename', 'width', 'height', 'scale'].forEach(function(key) { - if(toImageButtonOptions[key]) { - opts[key] = toImageButtonOptions[key]; - } - }); - - Registry.call('downloadImage', gd, opts) - .then(function(filename) { - Lib.notifier(_(gd, 'Snapshot succeeded') + ' - ' + filename, 'long'); - }) - .catch(function() { - Lib.notifier(_(gd, 'Sorry, there was a problem downloading your snapshot!'), 'long'); - }); - } -}; - -modeBarButtons.sendDataToCloud = { - name: 'sendDataToCloud', - title: function(gd) { return _(gd, 'Edit in Chart Studio'); }, - icon: Icons.disk, - click: function(gd) { - Plots.sendDataToCloud(gd); - } -}; - -modeBarButtons.zoom2d = { - name: 'zoom2d', - title: function(gd) { return _(gd, 'Zoom'); }, - attr: 'dragmode', - val: 'zoom', - icon: Icons.zoombox, - click: handleCartesian -}; - -modeBarButtons.pan2d = { - name: 'pan2d', - title: function(gd) { return _(gd, 'Pan'); }, - attr: 'dragmode', - val: 'pan', - icon: Icons.pan, - click: handleCartesian -}; - -modeBarButtons.select2d = { - name: 'select2d', - title: function(gd) { return _(gd, 'Box Select'); }, - attr: 'dragmode', - val: 'select', - icon: Icons.selectbox, - click: handleCartesian -}; - -modeBarButtons.lasso2d = { - name: 'lasso2d', - title: function(gd) { return _(gd, 'Lasso Select'); }, - attr: 'dragmode', - val: 'lasso', - icon: Icons.lasso, - click: handleCartesian -}; - -modeBarButtons.zoomIn2d = { - name: 'zoomIn2d', - title: function(gd) { return _(gd, 'Zoom in'); }, - attr: 'zoom', - val: 'in', - icon: Icons.zoom_plus, - click: handleCartesian -}; - -modeBarButtons.zoomOut2d = { - name: 'zoomOut2d', - title: function(gd) { return _(gd, 'Zoom out'); }, - attr: 'zoom', - val: 'out', - icon: Icons.zoom_minus, - click: handleCartesian -}; - -modeBarButtons.autoScale2d = { - name: 'autoScale2d', - title: function(gd) { return _(gd, 'Autoscale'); }, - attr: 'zoom', - val: 'auto', - icon: Icons.autoscale, - click: handleCartesian -}; - -modeBarButtons.resetScale2d = { - name: 'resetScale2d', - title: function(gd) { return _(gd, 'Reset axes'); }, - attr: 'zoom', - val: 'reset', - icon: Icons.home, - click: handleCartesian -}; - -modeBarButtons.hoverClosestCartesian = { - name: 'hoverClosestCartesian', - title: function(gd) { return _(gd, 'Show closest data on hover'); }, - attr: 'hovermode', - val: 'closest', - icon: Icons.tooltip_basic, - gravity: 'ne', - click: handleCartesian -}; - -modeBarButtons.hoverCompareCartesian = { - name: 'hoverCompareCartesian', - title: function(gd) { return _(gd, 'Compare data on hover'); }, - attr: 'hovermode', - val: function(gd) { - return gd._fullLayout._isHoriz ? 'y' : 'x'; - }, - icon: Icons.tooltip_compare, - gravity: 'ne', - click: handleCartesian -}; - -function handleCartesian(gd, ev) { - var button = ev.currentTarget; - var astr = button.getAttribute('data-attr'); - var val = button.getAttribute('data-val') || true; - var fullLayout = gd._fullLayout; - var aobj = {}; - var axList = axisIds.list(gd, null, true); - var allSpikesEnabled = 'on'; - - var ax, i; - - if(astr === 'zoom') { - var mag = (val === 'in') ? 0.5 : 2, - r0 = (1 + mag) / 2, - r1 = (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._rangeInitial === undefined) { - aobj[axName + '.autorange'] = true; - } - else { - var rangeInitial = ax._rangeInitial.slice(); - aobj[axName + '.range[0]'] = rangeInitial[0]; - aobj[axName + '.range[1]'] = rangeInitial[1]; - } - if(ax._showSpikeInitial !== undefined) { - 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 = [ - r0 * rangeNow[0] + r1 * rangeNow[1], - r0 * rangeNow[1] + r1 * rangeNow[0] - ]; - - aobj[axName + '.range[0]'] = ax.l2r(rangeNew[0]); - aobj[axName + '.range[1]'] = ax.l2r(rangeNew[1]); - } - } - } - fullLayout._cartesianSpikesEnabled = allSpikesEnabled; - } - else { - // if ALL traces have orientation 'h', 'hovermode': 'x' otherwise: 'y' - if(astr === 'hovermode' && (val === 'x' || val === 'y')) { - val = fullLayout._isHoriz ? 'y' : 'x'; - button.setAttribute('data-val', val); - } else if(astr === 'hovermode' && val === 'closest') { - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - if(allSpikesEnabled === 'on' && !ax.showspikes) { - allSpikesEnabled = 'off'; - } - } - fullLayout._cartesianSpikesEnabled = allSpikesEnabled; - } - - aobj[astr] = val; - } - - Registry.call('relayout', gd, aobj); -} - -modeBarButtons.zoom3d = { - name: 'zoom3d', - title: function(gd) { return _(gd, 'Zoom'); }, - attr: 'scene.dragmode', - val: 'zoom', - icon: Icons.zoombox, - click: handleDrag3d -}; - -modeBarButtons.pan3d = { - name: 'pan3d', - title: function(gd) { return _(gd, 'Pan'); }, - attr: 'scene.dragmode', - val: 'pan', - icon: Icons.pan, - click: handleDrag3d -}; - -modeBarButtons.orbitRotation = { - name: 'orbitRotation', - title: function(gd) { return _(gd, 'Orbital rotation'); }, - attr: 'scene.dragmode', - val: 'orbit', - icon: Icons['3d_rotate'], - click: handleDrag3d -}; - -modeBarButtons.tableRotation = { - name: 'tableRotation', - title: function(gd) { return _(gd, 'Turntable rotation'); }, - attr: 'scene.dragmode', - val: 'turntable', - icon: Icons['z-axis'], - click: handleDrag3d -}; - -function handleDrag3d(gd, ev) { - var button = ev.currentTarget; - var attr = button.getAttribute('data-attr'); - var val = button.getAttribute('data-val') || true; - var sceneIds = gd._fullLayout._subplots.gl3d; - var layoutUpdate = {}; - - var parts = attr.split('.'); - - for(var i = 0; i < sceneIds.length; i++) { - layoutUpdate[sceneIds[i] + '.' + parts[1]] = val; - } - - // for multi-type subplots - var val2d = (val === 'pan') ? val : 'zoom'; - layoutUpdate.dragmode = val2d; - - Registry.call('relayout', gd, layoutUpdate); -} - -modeBarButtons.resetCameraDefault3d = { - name: 'resetCameraDefault3d', - title: function(gd) { return _(gd, 'Reset camera to default'); }, - attr: 'resetDefault', - icon: Icons.home, - click: handleCamera3d -}; - -modeBarButtons.resetCameraLastSave3d = { - name: 'resetCameraLastSave3d', - title: function(gd) { return _(gd, 'Reset camera to last save'); }, - attr: 'resetLastSave', - icon: Icons.movie, - click: handleCamera3d -}; - -function handleCamera3d(gd, ev) { - var button = ev.currentTarget; - var attr = button.getAttribute('data-attr'); - var fullLayout = gd._fullLayout; - var sceneIds = fullLayout._subplots.gl3d; - var aobj = {}; - - for(var i = 0; i < sceneIds.length; i++) { - var sceneId = sceneIds[i], - key = sceneId + '.camera', - scene = fullLayout[sceneId]._scene; - - if(attr === 'resetDefault') { - aobj[key] = null; - } - else if(attr === 'resetLastSave') { - aobj[key] = Lib.extendDeep({}, scene.cameraInitial); - } - } - - Registry.call('relayout', gd, aobj); -} - -modeBarButtons.hoverClosest3d = { - name: 'hoverClosest3d', - title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, - attr: 'hovermode', - val: null, - toggle: true, - icon: Icons.tooltip_basic, - gravity: 'ne', - click: handleHover3d -}; - -function handleHover3d(gd, ev) { - var button = ev.currentTarget; - var val = button._previousVal || false; - var layout = gd.layout; - var fullLayout = gd._fullLayout; - var sceneIds = fullLayout._subplots.gl3d; - - var axes = ['xaxis', 'yaxis', 'zaxis']; - var spikeAttrs = ['showspikes', 'spikesides', 'spikethickness', 'spikecolor']; - - // initialize 'current spike' object to be stored in the DOM - var currentSpikes = {}; - var axisSpikes = {}; - var layoutUpdate = {}; - - if(val) { - layoutUpdate = Lib.extendDeep(layout, val); - button._previousVal = null; - } - else { - layoutUpdate = { - 'allaxes.showspikes': false - }; - - for(var i = 0; i < sceneIds.length; i++) { - var sceneId = sceneIds[i], - sceneLayout = fullLayout[sceneId], - sceneSpikes = currentSpikes[sceneId] = {}; - - sceneSpikes.hovermode = sceneLayout.hovermode; - layoutUpdate[sceneId + '.hovermode'] = false; - - // copy all the current spike attrs - for(var j = 0; j < 3; j++) { - var axis = axes[j]; - axisSpikes = sceneSpikes[axis] = {}; - - for(var k = 0; k < spikeAttrs.length; k++) { - var spikeAttr = spikeAttrs[k]; - axisSpikes[spikeAttr] = sceneLayout[axis][spikeAttr]; - } - } - } - - button._previousVal = Lib.extendDeep({}, currentSpikes); - } - - Registry.call('relayout', gd, layoutUpdate); -} - -modeBarButtons.zoomInGeo = { - name: 'zoomInGeo', - title: function(gd) { return _(gd, 'Zoom in'); }, - attr: 'zoom', - val: 'in', - icon: Icons.zoom_plus, - click: handleGeo -}; - -modeBarButtons.zoomOutGeo = { - name: 'zoomOutGeo', - title: function(gd) { return _(gd, 'Zoom out'); }, - attr: 'zoom', - val: 'out', - icon: Icons.zoom_minus, - click: handleGeo -}; - -modeBarButtons.resetGeo = { - name: 'resetGeo', - title: function(gd) { return _(gd, 'Reset'); }, - attr: 'reset', - val: null, - icon: Icons.autoscale, - click: handleGeo -}; - -modeBarButtons.hoverClosestGeo = { - name: 'hoverClosestGeo', - title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, - attr: 'hovermode', - val: null, - toggle: true, - icon: Icons.tooltip_basic, - gravity: 'ne', - click: toggleHover -}; - -function handleGeo(gd, ev) { - var button = ev.currentTarget; - var attr = button.getAttribute('data-attr'); - var val = button.getAttribute('data-val') || true; - var fullLayout = gd._fullLayout; - var geoIds = fullLayout._subplots.geo; - - for(var i = 0; i < geoIds.length; i++) { - var id = geoIds[i]; - var geoLayout = fullLayout[id]; - - if(attr === 'zoom') { - var scale = geoLayout.projection.scale; - var newScale = (val === 'in') ? 2 * scale : 0.5 * scale; - - Registry.call('relayout', gd, id + '.projection.scale', newScale); - } else if(attr === 'reset') { - resetView(gd, 'geo'); - } - } -} - -modeBarButtons.hoverClosestGl2d = { - name: 'hoverClosestGl2d', - title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, - attr: 'hovermode', - val: null, - toggle: true, - icon: Icons.tooltip_basic, - gravity: 'ne', - click: toggleHover -}; - -modeBarButtons.hoverClosestPie = { - name: 'hoverClosestPie', - title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, - attr: 'hovermode', - val: 'closest', - icon: Icons.tooltip_basic, - gravity: 'ne', - click: toggleHover -}; - -function toggleHover(gd) { - var fullLayout = gd._fullLayout; - - var onHoverVal; - if(fullLayout._has('cartesian')) { - onHoverVal = fullLayout._isHoriz ? 'y' : 'x'; - } - else onHoverVal = 'closest'; - - var newHover = gd._fullLayout.hovermode ? false : onHoverVal; - - Registry.call('relayout', gd, 'hovermode', newHover); -} - -// buttons when more then one plot types are present - -modeBarButtons.toggleHover = { - name: 'toggleHover', - title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, - attr: 'hovermode', - val: null, - toggle: true, - icon: Icons.tooltip_basic, - gravity: 'ne', - click: function(gd, ev) { - toggleHover(gd); - - // the 3d hovermode update must come - // last so that layout.hovermode update does not - // override scene?.hovermode?.layout. - handleHover3d(gd, ev); - } -}; - -modeBarButtons.resetViews = { - name: 'resetViews', - title: function(gd) { return _(gd, 'Reset views'); }, - icon: Icons.home, - click: function(gd, ev) { - var button = ev.currentTarget; - - button.setAttribute('data-attr', 'zoom'); - button.setAttribute('data-val', 'reset'); - handleCartesian(gd, ev); - - button.setAttribute('data-attr', 'resetLastSave'); - handleCamera3d(gd, ev); - - resetView(gd, 'geo'); - resetView(gd, 'mapbox'); - } -}; - -modeBarButtons.toggleSpikelines = { - name: 'toggleSpikelines', - title: function(gd) { return _(gd, 'Toggle Spike Lines'); }, - icon: Icons.spikeline, - attr: '_cartesianSpikesEnabled', - val: 'on', - click: function(gd) { - var fullLayout = gd._fullLayout; - - fullLayout._cartesianSpikesEnabled = fullLayout._cartesianSpikesEnabled === 'on' ? 'off' : 'on'; - - var aobj = setSpikelineVisibility(gd); - - Registry.call('relayout', gd, aobj); - } -}; - -function setSpikelineVisibility(gd) { - var fullLayout = gd._fullLayout; - var axList = axisIds.list(gd, null, true); - var aobj = {}; - - var ax, axName; - - for(var i = 0; i < axList.length; i++) { - ax = axList[i]; - axName = ax._name; - aobj[axName + '.showspikes'] = fullLayout._cartesianSpikesEnabled === 'on' ? true : ax._showSpikeInitial; - } - - return aobj; -} - -modeBarButtons.resetViewMapbox = { - name: 'resetViewMapbox', - title: function(gd) { return _(gd, 'Reset view'); }, - attr: 'reset', - icon: Icons.home, - click: function(gd) { - resetView(gd, 'mapbox'); - } -}; - -function resetView(gd, subplotType) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots[subplotType]; - var aObj = {}; - - for(var i = 0; i < subplotIds.length; i++) { - var id = subplotIds[i]; - var subplotObj = fullLayout[id]._subplot; - var viewInitial = subplotObj.viewInitial; - var viewKeys = Object.keys(viewInitial); - - for(var j = 0; j < viewKeys.length; j++) { - var key = viewKeys[j]; - aObj[id + '.' + key] = viewInitial[key]; - } - } - - Registry.call('relayout', gd, aObj); -} - -},{"../../../build/ploticon":2,"../../lib":696,"../../plots/cartesian/axis_ids":747,"../../plots/plots":808,"../../registry":827}],633:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -exports.manage = _dereq_('./manage'); - -},{"./manage":634}],634:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var axisIds = _dereq_('../../plots/cartesian/axis_ids'); -var scatterSubTypes = _dereq_('../../traces/scatter/subtypes'); -var Registry = _dereq_('../../registry'); - -var createModeBar = _dereq_('./modebar'); -var modeBarButtons = _dereq_('./buttons'); - -/** - * ModeBar wrapper around 'create' and 'update', - * chooses buttons to pass to ModeBar constructor based on - * plot type and plot config. - * - * @param {object} gd main plot object - * - */ -module.exports = function manageModeBar(gd) { - var fullLayout = gd._fullLayout, - context = gd._context, - modeBar = fullLayout._modeBar; - - if(!context.displayModeBar) { - 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 { - buttonGroups = getButtonGroups( - gd, - context.modeBarButtonsToRemove, - context.modeBarButtonsToAdd - ); - } - - if(modeBar) modeBar.update(gd, buttonGroups); - else fullLayout._modeBar = createModeBar(gd, buttonGroups); -}; - -// logic behind which buttons are displayed by default -function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { - var fullLayout = gd._fullLayout; - var fullData = gd._fullData; - - var hasCartesian = fullLayout._has('cartesian'); - var hasGL3D = fullLayout._has('gl3d'); - var hasGeo = fullLayout._has('geo'); - var hasPie = fullLayout._has('pie'); - var hasGL2D = fullLayout._has('gl2d'); - var hasTernary = fullLayout._has('ternary'); - var hasMapbox = fullLayout._has('mapbox'); - var hasPolar = fullLayout._has('polar'); - var allAxesFixed = areAllAxesFixed(fullLayout); - - var groups = []; - - function addGroup(newGroup) { - if(!newGroup.length) return; - - var out = []; - - for(var i = 0; i < newGroup.length; i++) { - var button = newGroup[i]; - if(buttonsToRemove.indexOf(button) !== -1) continue; - out.push(modeBarButtons[button]); - } - - groups.push(out); - } - - // buttons common to all plot types - addGroup(['toImage', 'sendDataToCloud']); - - var zoomGroup = []; - var hoverGroup = []; - var resetGroup = []; - var dragModeGroup = []; - - if((hasCartesian || hasGL2D || hasPie || hasTernary) + hasGeo + hasGL3D + hasMapbox + hasPolar > 1) { - // graphs with more than one plot types get 'union buttons' - // which reset the view or toggle hover labels across all subplots. - 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) { - hoverGroup = ['toggleHover']; - resetGroup = ['resetViewMapbox']; - } - else if(hasGL2D) { - hoverGroup = ['hoverClosestGl2d']; - } - else if(hasPie) { - hoverGroup = ['hoverClosestPie']; - } - else { // hasPolar, hasTernary - // always show at least one hover icon. - hoverGroup = ['toggleHover']; - } - // if we have cartesian, allow switching between closest and compare - // regardless of what other types are on the plot, since they'll all - // just treat any truthy hovermode as 'closest' - if(hasCartesian) { - hoverGroup = ['toggleSpikelines', 'hoverClosestCartesian', 'hoverCompareCartesian']; - } - - 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 || hasGeo) { - dragModeGroup = ['pan2d']; - } - else if(hasPolar) { - dragModeGroup = ['zoom2d']; - } - if(isSelectable(fullData)) { - dragModeGroup.push('select2d', 'lasso2d'); - } - - addGroup(dragModeGroup); - addGroup(zoomGroup.concat(resetGroup)); - addGroup(hoverGroup); - - 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; -} - -// look for traces that support selection -// to be updated as we add more selectPoints handlers -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; - } - } - // assume that in general if the trace module has selectPoints, - // then it's selectable. Scatter is an exception to this because it must - // have markers or text, not just be a scatter type. - else selectable = true; - } - - return selectable; -} - -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; -} - -// fill in custom buttons referring to default mode bar buttons -function fillCustomButton(customButtons) { - 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] !== undefined) { - customButtons[i][j] = modeBarButtons[button]; - } - else { - throw new Error([ - '*modeBarButtons* configuration options', - 'invalid button name' - ].join(' ')); - } - } - } - } - - return customButtons; -} - -},{"../../plots/cartesian/axis_ids":747,"../../registry":827,"../../traces/scatter/subtypes":1067,"./buttons":632,"./modebar":635}],635:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var Lib = _dereq_('../../lib'); -var Icons = _dereq_('../../../build/ploticon'); -var Parser = new DOMParser(); - -/** - * UI controller for interactive plots - * @Class - * @Param {object} opts - * @Param {object} opts.buttons nested arrays of grouped buttons config objects - * @Param {object} opts.container container div to append modeBar - * @Param {object} opts.graphInfo primary plot object containing data and layout - */ -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; - -/** - * Update modeBar (buttons and logo) - * - * @param {object} graphInfo primary plot object containing data and layout - * @param {array of arrays} buttons nested arrays of grouped buttons to initialize - * - */ -proto.update = function(graphInfo, buttons) { - this.graphInfo = graphInfo; - - var context = this.graphInfo._context, - fullLayout = this.graphInfo._fullLayout, - modeBarId = 'modebar-' + fullLayout._uid; - - this.element.setAttribute('id', modeBarId); - this._uid = modeBarId; - - if(context.displayModeBar === 'hover') { - this.element.className = 'modebar modebar--hover'; - } - else this.element.className = 'modebar'; - - if(fullLayout.modebar.orientation === 'v') { - this.element.className += ' vertical'; - buttons = buttons.reverse(); - } - - Lib.deleteRelatedStyleRule(modeBarId); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId, 'background-color: ' + fullLayout.modebar.bgcolor); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId + ' .modebar-btn .icon path', 'fill: ' + fullLayout.modebar.color); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId + ' .modebar-btn:hover .icon path', 'fill: ' + fullLayout.modebar.activecolor); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId + ' .modebar-btn.active .icon path', 'fill: ' + fullLayout.modebar.activecolor); - - // if buttons or logo have changed, redraw modebar interior - 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.displaylogo) { - if(fullLayout.modebar.orientation === 'v') { - this.element.prepend(this.getLogo()); - } else { - this.element.appendChild(this.getLogo()); - } - - 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); - }); -}; - -/** - * Empty div for containing a group of buttons - * @Return {HTMLelement} - */ -proto.createGroup = function() { - var group = document.createElement('div'); - group.className = 'modebar-group'; - - return group; -}; - -/** - * Create a new button div and set constant and configurable attributes - * @Param {object} config (see ./buttons.js for more info) - * @Return {HTMLelement} - */ -proto.createButton = function(config) { - var _this = this, - button = document.createElement('a'); - - button.setAttribute('rel', 'tooltip'); - button.className = 'modebar-btn'; - - var title = config.title; - if(title === undefined) title = config.name; - // for localization: allow title to be a callable that takes gd as arg - else if(typeof title === 'function') title = title(this.graphInfo); - - if(title || title === 0) button.setAttribute('data-title', title); - - if(config.attr !== undefined) button.setAttribute('data-attr', config.attr); - - var val = config.val; - if(val !== undefined) { - 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(ev) { - config.click(_this.graphInfo, ev); - - // only needed for 'hoverClosestGeo' which does not call relayout - _this.updateActiveButton(ev.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; -}; - -/** - * Add an icon to a button - * @Param {object} thisIcon - * @Param {number} thisIcon.width - * @Param {string} thisIcon.path - * @Param {string} thisIcon.color - * @Return {HTMLelement} - */ -proto.createIcon = function(thisIcon) { - var iconHeight = isNumeric(thisIcon.height) ? - Number(thisIcon.height) : - thisIcon.ascent - thisIcon.descent, - svgNS = 'http://www.w3.org/2000/svg', - 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 !== undefined) { - // Legacy icon transform calculation - 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; -}; - -/** - * Updates active button with attribute specified in layout - * @Param {object} graphInfo plot object containing data and layout - * @Return {HTMLelement} - */ -proto.updateActiveButton = function(buttonClicked) { - var fullLayout = this.graphInfo._fullLayout, - dataAttrClicked = (buttonClicked !== undefined) ? - buttonClicked.getAttribute('data-attr') : - null; - - this.buttonElements.forEach(function(button) { - var thisval = button.getAttribute('data-val') || true, - dataAttr = button.getAttribute('data-attr'), - isToggleButton = (button.getAttribute('data-toggle') === 'true'), - button3 = d3.select(button); - - // Use 'data-toggle' and 'buttonClicked' to toggle buttons - // that have no one-to-one equivalent in fullLayout - 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); - } - - }); -}; - -/** - * Check if modeBar is configured as button configuration argument - * - * @Param {object} buttons 2d array of grouped button config objects - * @Return {boolean} - */ -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; -}; - -/** - * @return {HTMLDivElement} The logo image wrapped in a group - */ -proto.getLogo = function() { - var group = this.createGroup(), - a = document.createElement('a'); - - a.href = 'https://plot.ly/'; - a.target = '_blank'; - a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly')); - 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(gd, buttons) { - var fullLayout = gd._fullLayout; - - var modeBar = new ModeBar({ - graphInfo: gd, - container: fullLayout._paperdiv.node(), - buttons: buttons - }); - - if(fullLayout._privateplot) { - d3.select(modeBar.element).append('span') - .classed('badge-private float--left', true) - .text('PRIVATE'); - } - - return modeBar; -} - -module.exports = createModeBar; - -},{"../../../build/ploticon":2,"../../lib":696,"d3":148,"fast-isnumeric":214}],636:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var fontAttrs = _dereq_('../../plots/font_attributes'); -var colorAttrs = _dereq_('../color/attributes'); -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - -var buttonAttrs = templatedArray('button', { - visible: { - valType: 'boolean', - - dflt: true, - editType: 'plot', - - }, - step: { - valType: 'enumerated', - - values: ['month', 'year', 'day', 'hour', 'minute', 'second', 'all'], - dflt: 'month', - editType: 'plot', - - }, - stepmode: { - valType: 'enumerated', - - values: ['backward', 'todate'], - dflt: 'backward', - editType: 'plot', - - }, - count: { - valType: 'number', - - min: 0, - dflt: 1, - editType: 'plot', - - }, - label: { - valType: 'string', - - editType: 'plot', - - }, - editType: 'plot', - -}); - -module.exports = { - visible: { - valType: 'boolean', - - editType: 'plot', - - }, - - buttons: buttonAttrs, - - x: { - valType: 'number', - min: -2, - max: 3, - - editType: 'plot', - - }, - xanchor: { - valType: 'enumerated', - values: ['auto', 'left', 'center', 'right'], - dflt: 'left', - - editType: 'plot', - - }, - y: { - valType: 'number', - min: -2, - max: 3, - - editType: 'plot', - - }, - yanchor: { - valType: 'enumerated', - values: ['auto', 'top', 'middle', 'bottom'], - dflt: 'bottom', - - editType: 'plot', - - }, - - font: fontAttrs({ - editType: 'plot', - - }), - - bgcolor: { - valType: 'color', - dflt: colorAttrs.lightLine, - - editType: 'plot', - - }, - activecolor: { - valType: 'color', - - editType: 'plot', - - }, - bordercolor: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'plot', - - }, - borderwidth: { - valType: 'number', - min: 0, - dflt: 0, - - editType: 'plot', - - }, - editType: 'plot' -}; - -},{"../../plot_api/plot_template":734,"../../plots/font_attributes":771,"../color/attributes":569}],637:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -module.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 -}; - -},{}],638:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../color'); -var Template = _dereq_('../../plot_api/plot_template'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var constants = _dereq_('./constants'); - - -module.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: 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]; -} - -},{"../../lib":696,"../../plot_api/plot_template":734,"../../plots/array_container_defaults":740,"../color":570,"./attributes":636,"./constants":637}],639:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Registry = _dereq_('../../registry'); -var Plots = _dereq_('../../plots/plots'); -var Color = _dereq_('../color'); -var Drawing = _dereq_('../drawing'); -var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var axisIds = _dereq_('../../plots/cartesian/axis_ids'); -var anchorUtils = _dereq_('../legend/anchor_utils'); - -var alignmentConstants = _dereq_('../../constants/alignment'); -var LINE_SPACING = alignmentConstants.LINE_SPACING; -var FROM_TL = alignmentConstants.FROM_TL; -var FROM_BR = alignmentConstants.FROM_BR; - -var constants = _dereq_('./constants'); -var getUpdateObject = _dereq_('./get_update_object'); - - -module.exports = function draw(gd) { - var fullLayout = gd._fullLayout; - - var selectors = fullLayout._infolayer.selectAll('.rangeselector') - .data(makeSelectorData(gd), 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), - axisLayout = d, - 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(d) { - var button = d3.select(this); - var update = getUpdateObject(axisLayout, d); - - d._isActive = isActive(axisLayout, d, update); - - button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d, gd); - - button.on('click', function() { - if(gd._dragged) return; - - Registry.call('relayout', gd, update); - }); - - button.on('mouseover', function() { - d._isHovered = true; - button.call(drawButtonRect, selectorLayout, d); - }); - - button.on('mouseout', function() { - d._isHovered = false; - button.call(drawButtonRect, selectorLayout, d); - }); - }); - - reposition(gd, buttons, selectorLayout, axisLayout._name, selector); - }); - -}; - -function makeSelectorData(gd) { - var axes = axisIds.list(gd, '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, gd) { - function textLayout(s) { - svgTextUtils.convertToTspans(s, gd); - } - - var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); - }); - - text.call(Drawing.font, selectorLayout.font) - .text(getLabel(d)) - .call(textLayout); -} - -function getLabel(opts) { - if(opts.label) return opts.label; - - if(opts.step === 'all') return 'all'; - - return opts.count + opts.step.charAt(0); -} - -function reposition(gd, 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); - - // TODO add MathJax support - - // TODO add buttongap attribute - - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); - - rect.attr({ - x: 0, - y: 0, - width: wEff, - height: height - }); - - svgTextUtils.positionText(text, wEff / 2, - height / 2 - ((tLines - 1) * tHeight / 2) + 3); - - width += wEff + 5; - }); - - var graphSize = gd._fullLayout._size; - var lx = graphSize.l + graphSize.w * opts.x; - var ly = graphSize.t + graphSize.h * (1 - opts.y); - - var xanchor = 'left'; - if(anchorUtils.isRightAnchor(opts)) { - lx -= width; - xanchor = 'right'; - } - if(anchorUtils.isCenterAnchor(opts)) { - lx -= width / 2; - xanchor = 'center'; - } - - var yanchor = 'top'; - if(anchorUtils.isBottomAnchor(opts)) { - ly -= height; - yanchor = 'bottom'; - } - if(anchorUtils.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(gd, 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', 'translate(' + lx + ',' + ly + ')'); -} - -},{"../../constants/alignment":668,"../../lib":696,"../../lib/svg_text_utils":720,"../../plots/cartesian/axis_ids":747,"../../plots/plots":808,"../../registry":827,"../color":570,"../drawing":595,"../legend/anchor_utils":622,"./constants":637,"./get_update_object":640,"d3":148}],640:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); - -module.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, - count = buttonLayout.count; - - var range0; - - switch(buttonLayout.stepmode) { - case 'backward': - range0 = axisLayout.l2r(+d3.time[step].utc.offset(base, -count)); - break; - - case 'todate': - var base2 = d3.time[step].utc.offset(base, -count); - - range0 = axisLayout.l2r(+d3.time[step].utc.ceil(base2)); - break; - } - - var range1 = currentRange[1]; - - return [range0, range1]; -} - -},{"d3":148}],641:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = { - moduleType: 'component', - name: 'rangeselector', - - schema: { - subplots: { - xaxis: {rangeselector: _dereq_('./attributes')} - } - }, - - layoutAttributes: _dereq_('./attributes'), - handleDefaults: _dereq_('./defaults'), - - draw: _dereq_('./draw') -}; - -},{"./attributes":636,"./defaults":638,"./draw":639}],642:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var colorAttributes = _dereq_('../color/attributes'); - -module.exports = { - bgcolor: { - valType: 'color', - dflt: colorAttributes.background, - - editType: 'plot', - - }, - bordercolor: { - valType: 'color', - dflt: colorAttributes.defaultLine, - - editType: 'plot', - - }, - borderwidth: { - valType: 'integer', - dflt: 0, - min: 0, - - editType: 'plot', - - }, - autorange: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - impliedEdits: {'range[0]': undefined, 'range[1]': undefined}, - - }, - range: { - valType: 'info_array', - - items: [ - {valType: 'any', editType: 'calc', impliedEdits: {'^autorange': false}}, - {valType: 'any', editType: 'calc', impliedEdits: {'^autorange': false}} - ], - editType: 'calc', - impliedEdits: {'autorange': false}, - - }, - thickness: { - valType: 'number', - dflt: 0.15, - min: 0, - max: 1, - - editType: 'plot', - - }, - visible: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - editType: 'calc' -}; - -},{"../color/attributes":569}],643:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var listAxes = _dereq_('../../plots/cartesian/axis_ids').list; -var getAutoRange = _dereq_('../../plots/cartesian/autorange').getAutoRange; -var constants = _dereq_('./constants'); - -module.exports = function calcAutorange(gd) { - var axes = listAxes(gd, 'x', true); - - // Compute new slider range using axis autorange if necessary. - // - // Copy back range to input range slider container to skip - // this step in subsequent draw calls. - - 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(gd, ax); - } - } -}; - -},{"../../plots/cartesian/autorange":743,"../../plots/cartesian/axis_ids":747,"./constants":644}],644:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.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 -}; - -},{}],645:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Template = _dereq_('../../plot_api/plot_template'); -var axisIds = _dereq_('../../plots/cartesian/axis_ids'); - -var attributes = _dereq_('./attributes'); -var oppAxisAttrs = _dereq_('./oppaxis_attributes'); - -module.exports = function handleDefaults(layoutIn, layoutOut, axName) { - var axIn = layoutIn[axName]; - var axOut = layoutOut[axName]; - - if(!(axIn.rangeslider || layoutOut._requestRangeslider[axOut._id])) return; - - // not super proud of this (maybe store _ in axis object instead - 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()); - } - } - } - - // to map back range slider (auto) range - containerOut._input = containerIn; -}; - -},{"../../lib":696,"../../plot_api/plot_template":734,"../../plots/cartesian/axis_ids":747,"./attributes":642,"./oppaxis_attributes":648}],646:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Registry = _dereq_('../../registry'); -var Plots = _dereq_('../../plots/plots'); - -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../drawing'); -var Color = _dereq_('../color'); -var Titles = _dereq_('../titles'); - -var Cartesian = _dereq_('../../plots/cartesian'); -var Axes = _dereq_('../../plots/cartesian/axes'); - -var dragElement = _dereq_('../dragelement'); -var setCursor = _dereq_('../../lib/setcursor'); - -var constants = _dereq_('./constants'); - -module.exports = function(gd) { - var fullLayout = gd._fullLayout, - rangeSliderData = makeRangeSliderData(fullLayout); - - /* - * - * - * < .... range plot /> - * - * - * - * - * - * - * - * - * - * - * ... - */ - - function keyFunction(axisOpts) { - return axisOpts._name; - } - - var rangeSliders = fullLayout._infolayer - .selectAll('g.' + constants.containerClassName) - .data(rangeSliderData, keyFunction); - - rangeSliders.enter().append('g') - .classed(constants.containerClassName, true) - .attr('pointer-events', 'all'); - - // remove exiting sliders and their corresponding clip paths - rangeSliders.exit().each(function(axisOpts) { - var opts = axisOpts[constants.name]; - fullLayout._topdefs.select('#' + opts._clipId).remove(); - }).remove(); - - // return early if no range slider is visible - if(rangeSliderData.length === 0) return; - - // for all present range sliders - rangeSliders.each(function(axisOpts) { - var rangeSlider = d3.select(this), - opts = axisOpts[constants.name], - oppAxisOpts = fullLayout[Axes.id2name(axisOpts.anchor)], - oppAxisRangeOpts = opts[Axes.id2name(axisOpts.anchor)]; - - // update range - // Expand slider range to the axis range - // TODO: what if the ranges are reversed? - if(opts.range) { - var outRange = opts.range; - var axRange = axisOpts.range; - - outRange[0] = axisOpts.l2r(Math.min(axisOpts.r2l(outRange[0]), axisOpts.r2l(axRange[0]))); - outRange[1] = axisOpts.l2r(Math.max(axisOpts.r2l(outRange[1]), axisOpts.r2l(axRange[1]))); - opts._input.range = outRange.slice(); - } - - axisOpts.cleanRange('rangeslider.range'); - - - // update range slider dimensions - - var margin = fullLayout.margin; - var graphSize = fullLayout._size; - var domain = axisOpts.domain; - var tickHeight = (axisOpts._boundingBox || {}).height || 0; - - var oppBottom = Infinity; - var subplotData = Axes.getSubplots(gd, axisOpts); - for(var i = 0; i < subplotData.length; i++) { - var oppAxis = Axes.getFromId(gd, subplotData[i].substr(subplotData[i].indexOf('y'))); - oppBottom = Math.min(oppBottom, oppAxis.domain[0]); - } - - opts._id = constants.name + axisOpts._id; - opts._clipId = opts._id + '-' + fullLayout._uid; - - opts._width = graphSize.w * (domain[1] - domain[0]); - opts._height = (fullLayout.height - margin.b - margin.t) * opts.thickness; - opts._offsetShift = Math.floor(opts.borderwidth / 2); - - var x = Math.round(margin.l + (graphSize.w * domain[0])); - - var y = Math.round( - graphSize.t + graphSize.h * (1 - oppBottom) + - tickHeight + - opts._offsetShift + constants.extraPad - ); - - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - - // update data <--> pixel coordinate conversion methods - - var range0 = axisOpts.r2l(opts.range[0]), - range1 = axisOpts.r2l(opts.range[1]), - dist = range1 - range0; - - opts.p2d = function(v) { - return (v / opts._width) * dist + range0; - }; - - opts.d2p = function(v) { - return (v - range0) / dist * opts._width; - }; - - opts._rl = [range0, range1]; - - if(oppAxisRangeOpts.rangemode !== 'match') { - var range0OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[0]), - range1OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[1]), - distOppAxis = range1OppAxis - range0OppAxis; - - opts.d2pOppAxis = function(v) { - return (v - range0OppAxis) / distOppAxis * opts._height; - }; - } - - // update inner nodes - - rangeSlider - .call(drawBg, gd, axisOpts, opts) - .call(addClipPath, gd, axisOpts, opts) - .call(drawRangePlot, gd, axisOpts, opts) - .call(drawMasks, gd, axisOpts, opts, oppAxisRangeOpts) - .call(drawSlideBox, gd, axisOpts, opts) - .call(drawGrabbers, gd, axisOpts, opts); - - // setup drag element - setupDragElement(rangeSlider, gd, axisOpts, opts); - - // update current range - setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRangeOpts); - - // title goes next to range slider instead of tick labels, so - // just take it over and draw it from here - if(axisOpts.side === 'bottom') { - Titles.draw(gd, axisOpts._id + 'title', { - propContainer: axisOpts, - propName: axisOpts._name + '.title', - placeholder: fullLayout._dfltTitle.x, - attributes: { - x: axisOpts._offset + axisOpts._length / 2, - y: y + opts._height + opts._offsetShift + 10 + 1.5 * axisOpts.titlefont.size, - 'text-anchor': 'middle' - } - }); - } - - // update margins - Plots.autoMargin(gd, opts._id, { - x: domain[0], - y: oppBottom, - l: 0, - r: 0, - t: 0, - b: opts._height + margin.b + tickHeight, - pad: constants.extraPad + opts._offsetShift * 2 - }); - }); -}; - -function makeRangeSliderData(fullLayout) { - var axes = Axes.list({ _fullLayout: fullLayout }, 'x', true), - name = constants.name, - out = []; - - if(fullLayout._has('gl2d')) return out; - - for(var i = 0; i < axes.length; i++) { - var ax = axes[i]; - - if(ax[name] && ax[name].visible) out.push(ax); - } - - return out; -} - -function setupDragElement(rangeSlider, gd, axisOpts, opts) { - var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(), - grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(), - grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); - - rangeSlider.on('mousedown', function() { - var event = d3.event, - target = event.target, - startX = event.clientX, - offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts._rl[0]), - maxVal = opts.d2p(axisOpts._rl[1]); - - var dragCover = dragElement.coverSlip(); - - dragCover.addEventListener('mousemove', mouseMove); - dragCover.addEventListener('mouseup', mouseUp); - - function mouseMove(e) { - var delta = +e.clientX - startX; - var pixelMin, pixelMax, cursor; - - switch(target) { - case slideBox: - cursor = 'ew-resize'; - pixelMin = minVal + delta; - pixelMax = maxVal + delta; - break; - - case grabAreaMin: - cursor = 'col-resize'; - pixelMin = minVal + delta; - pixelMax = maxVal; - break; - - case grabAreaMax: - cursor = 'col-resize'; - 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, gd, axisOpts, opts); - } - - function mouseUp() { - dragCover.removeEventListener('mousemove', mouseMove); - dragCover.removeEventListener('mouseup', mouseUp); - Lib.removeElement(dragCover); - } - }); -} - -function setDataRange(rangeSlider, gd, axisOpts, opts) { - - function clamp(v) { - return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); - } - - var dataMin = clamp(opts.p2d(opts._pixelMin)), - dataMax = clamp(opts.p2d(opts._pixelMax)); - - window.requestAnimationFrame(function() { - Registry.call('relayout', gd, axisOpts._name + '.range', [dataMin, dataMax]); - }); -} - -function setPixelRange(rangeSlider, gd, 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])), - 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])), - 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); - } - - // add offset for crispier corners - // https://github.com/plotly/plotly.js/pull/1409 - var offset = 0.5; - - var xMin = Math.round(clampHandle(pixelMin - hw2)) - offset, - xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; - - rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); - - rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); -} - -function drawBg(rangeSlider, gd, axisOpts, opts) { - var bg = 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(gd, opts.borderwidth); - - bg.attr({ - width: opts._width + borderCorrect, - height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', - fill: opts.bgcolor, - stroke: opts.bordercolor, - 'stroke-width': lw - }); -} - -function addClipPath(rangeSlider, gd, axisOpts, opts) { - var fullLayout = gd._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, gd, axisOpts, opts) { - var subplotData = Axes.getSubplots(gd, axisOpts), - calcData = gd.calcdata; - - var rangePlots = rangeSlider.selectAll('g.' + constants.rangePlotClassName) - .data(subplotData, Lib.identity); - - rangePlots.enter().append('g') - .attr('class', function(id) { return constants.rangePlotClassName + ' ' + id; }) - .call(Drawing.setClipUrl, opts._clipId); - - rangePlots.order(); - - rangePlots.exit().remove(); - - var mainplotinfo; - - rangePlots.each(function(id, i) { - var plotgroup = d3.select(this), - isMainPlot = (i === 0); - - var oppAxisOpts = Axes.getFromId(gd, id, 'y'), - oppAxisName = oppAxisOpts._name, - 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: gd._context - }; - - mockFigure.layout[oppAxisName] = { - type: oppAxisOpts.type, - domain: [0, 1], - range: oppAxisRangeOpts.rangemode !== 'match' ? oppAxisRangeOpts.range.slice() : oppAxisOpts.range.slice(), - calendar: oppAxisOpts.calendar - }; - - Plots.supplyDefaults(mockFigure); - - var xa = mockFigure._fullLayout.xaxis; - var ya = mockFigure._fullLayout[oppAxisName]; - - var plotinfo = { - id: id, - plotgroup: plotgroup, - xaxis: xa, - yaxis: ya, - isRangePlot: true - }; - - if(isMainPlot) mainplotinfo = plotinfo; - else { - plotinfo.mainplot = 'xy'; - plotinfo.mainplotinfo = mainplotinfo; - } - - Cartesian.rangePlot(gd, plotinfo, filterRangePlotCalcData(calcData, id)); - }); -} - -function filterRangePlotCalcData(calcData, subplotId) { - var out = []; - - for(var i = 0; i < calcData.length; i++) { - var calcTrace = calcData[i], - trace = calcTrace[0].trace; - - if(trace.xaxis + trace.yaxis === subplotId) { - out.push(calcTrace); - } - } - - return out; -} - -function drawMasks(rangeSlider, gd, 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); - - // masks used for oppAxis zoom - 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, gd, axisOpts, opts) { - if(gd._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, gd, 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); - - // - if(gd._context.staticPlot) return; - - var grabAreaFixAttrs = { - width: constants.grabAreaWidth, - x: 0, - y: 0, - fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor - }; - - 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); -} - -},{"../../lib":696,"../../lib/setcursor":716,"../../plots/cartesian":756,"../../plots/cartesian/axes":744,"../../plots/plots":808,"../../registry":827,"../color":570,"../dragelement":592,"../drawing":595,"../titles":661,"./constants":644,"d3":148}],647:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var attrs = _dereq_('./attributes'); -var oppAxisAttrs = _dereq_('./oppaxis_attributes'); - -module.exports = { - moduleType: 'component', - name: 'rangeslider', - - schema: { - subplots: { - xaxis: { - rangeslider: Lib.extendFlat({}, attrs, { - yaxis: oppAxisAttrs - }) - } - } - }, - - layoutAttributes: _dereq_('./attributes'), - handleDefaults: _dereq_('./defaults'), - calcAutorange: _dereq_('./calc_autorange'), - draw: _dereq_('./draw') -}; - -},{"../../lib":696,"./attributes":642,"./calc_autorange":643,"./defaults":645,"./draw":646,"./oppaxis_attributes":648}],648:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.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', - - }, - range: { - valType: 'info_array', - - items: [ - {valType: 'any', editType: 'plot'}, - {valType: 'any', editType: 'plot'} - ], - editType: 'plot', - - }, - editType: 'calc' -}; - -},{}],649:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var annAttrs = _dereq_('../annotations/attributes'); -var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; -var dash = _dereq_('../drawing/attributes').dash; -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - -module.exports = templatedArray('shape', { - visible: { - valType: 'boolean', - - dflt: true, - editType: 'calc+arraydraw', - - }, - - type: { - valType: 'enumerated', - values: ['circle', 'rect', 'path', 'line'], - - editType: 'calc+arraydraw', - - }, - - layer: { - valType: 'enumerated', - values: ['below', 'above'], - dflt: 'above', - - editType: 'arraydraw', - - }, - - xref: extendFlat({}, annAttrs.xref, { - - }), - xsizemode: { - valType: 'enumerated', - values: ['scaled', 'pixel'], - dflt: 'scaled', - - editType: 'calc+arraydraw', - - }, - xanchor: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - x0: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - x1: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - - yref: extendFlat({}, annAttrs.yref, { - - }), - ysizemode: { - valType: 'enumerated', - values: ['scaled', 'pixel'], - dflt: 'scaled', - - editType: 'calc+arraydraw', - - }, - yanchor: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - y0: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - y1: { - valType: 'any', - - editType: 'calc+arraydraw', - - }, - - path: { - valType: 'string', - - editType: 'calc+arraydraw', - - }, - - opacity: { - valType: 'number', - min: 0, - max: 1, - dflt: 1, - - editType: 'arraydraw', - - }, - 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', - - }, - editType: 'arraydraw' -}); - -},{"../../lib/extend":685,"../../plot_api/plot_template":734,"../../traces/scatter/attributes":1043,"../annotations/attributes":553,"../drawing/attributes":594}],650:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); - -var constants = _dereq_('./constants'); -var helpers = _dereq_('./helpers'); - - -module.exports = function calcAutorange(gd) { - var fullLayout = gd._fullLayout, - shapeList = Lib.filterVisible(fullLayout.shapes); - - if(!shapeList.length || !gd._fullData.length) return; - - for(var i = 0; i < shapeList.length; i++) { - var shape = shapeList[i]; - shape._extremes = {}; - - var ax, bounds; - - if(shape.xref !== 'paper') { - var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0, - vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; - ax = Axes.getFromId(gd, shape.xref); - - bounds = shapeBounds(ax, vx0, vx1, shape.path, constants.paramIsX); - if(bounds) { - shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcXPaddingOptions(shape)); - } - } - - if(shape.yref !== 'paper') { - var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0, - vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; - ax = Axes.getFromId(gd, shape.yref); - - bounds = shapeBounds(ax, vy0, vy1, shape.path, 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, v0, v1, path, isYAxis) { - var ppad = lineWidth / 2, - axisDirectionReverted = isYAxis; - - if(sizeMode === 'pixel') { - var coords = path ? - helpers.extractPathCoords(path, isYAxis ? constants.paramIsY : constants.paramIsX) : - [v0, v1]; - var maxValue = Lib.aggNums(Math.max, null, coords), - minValue = Lib.aggNums(Math.min, null, coords), - beforePad = minValue < 0 ? Math.abs(minValue) + ppad : ppad, - afterPad = maxValue > 0 ? maxValue + ppad : ppad; - - return { - ppad: ppad, - ppadplus: axisDirectionReverted ? beforePad : afterPad, - ppadminus: axisDirectionReverted ? afterPad : beforePad - }; - } else { - return {ppad: ppad}; - } -} - -function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; - - if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; - if(!path) return; - - var min = Infinity, - max = -Infinity, - segments = path.match(constants.segmentRE), - i, - segment, - drawnParam, - params, - 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 === undefined) 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]; -} - -},{"../../lib":696,"../../plots/cartesian/axes":744,"./constants":651,"./helpers":654}],651:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -module.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 - } -}; - -},{}],652:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var helpers = _dereq_('./helpers'); - - -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - handleArrayContainerDefaults(layoutIn, layoutOut, { - name: 'shapes', - handleItemDefaults: handleShapeDefaults - }); -}; - -function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { - function coerce(attr, dflt) { - return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); - } - - var visible = coerce('visible'); - - if(!visible) return; - - coerce('layer'); - coerce('opacity'); - coerce('fillcolor'); - coerce('line.color'); - coerce('line.width'); - coerce('line.dash'); - - var dfltType = shapeIn.path ? 'path' : 'rect', - shapeType = coerce('type', dfltType), - xSizeMode = coerce('xsizemode'), - ySizeMode = coerce('ysizemode'); - - // positioning - var axLetters = ['x', 'y']; - for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i], - attrAnchor = axLetter + 'anchor', - sizeMode = axLetter === 'x' ? xSizeMode : ySizeMode, - gdMock = {_fullLayout: fullLayout}, - ax, - pos2r, - r2pos; - - // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); - - if(axRef !== 'paper') { - ax = Axes.getFromId(gdMock, axRef); - ax._shapeIndices.push(shapeOut._index); - r2pos = helpers.rangeToShapePosition(ax); - pos2r = helpers.shapePositionToRange(ax); - } - else { - pos2r = r2pos = Lib.identity; - } - - // Coerce x0, x1, y0, y1 - if(shapeType !== 'path') { - var dflt0 = 0.25, - dflt1 = 0.75; - - // hack until V2.0 when log has regular range behavior - make it look like other - // ranges to send to coerce, then put it back after - // this is all to give reasonable default position behavior on log axes, which is - // a pretty unimportant edge case so we could just ignore this. - var attr0 = axLetter + '0', - attr1 = axLetter + '1', - in0 = shapeIn[attr0], - 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); - } - - // hack part 2 - shapeOut[attr0] = r2pos(shapeOut[attr0]); - shapeOut[attr1] = r2pos(shapeOut[attr1]); - shapeIn[attr0] = in0; - shapeIn[attr1] = in1; - } - - // Coerce xanchor and yanchor - if(sizeMode === 'pixel') { - // Hack for log axis described above - var inAnchor = shapeIn[attrAnchor]; - shapeIn[attrAnchor] = pos2r(shapeIn[attrAnchor], true); - - Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attrAnchor, 0.25); - - // Hack part 2 - shapeOut[attrAnchor] = r2pos(shapeOut[attrAnchor]); - shapeIn[attrAnchor] = inAnchor; - } - } - - if(shapeType === 'path') { - coerce('path'); - } - else { - Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); - } -} - -},{"../../lib":696,"../../plots/array_container_defaults":740,"../../plots/cartesian/axes":744,"./attributes":649,"./helpers":654}],653:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Color = _dereq_('../color'); -var Drawing = _dereq_('../drawing'); -var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - -var dragElement = _dereq_('../dragelement'); -var setCursor = _dereq_('../../lib/setcursor'); - -var constants = _dereq_('./constants'); -var helpers = _dereq_('./helpers'); - - -// Shapes are stored in gd.layout.shapes, an array of objects -// index can point to one item in this array, -// or non-numeric to simply add a new one -// or -1 to modify all existing -// opt can be the full options object, or one key (to be set to value) -// or undefined to simply redraw -// if opt is blank, val can be 'add' or a full options object to add a new -// annotation at that point in the array, or 'remove' to delete this one - -module.exports = { - draw: draw, - drawOne: drawOne -}; - -function draw(gd) { - var fullLayout = gd._fullLayout; - - // Remove previous shapes before drawing new in shapes in fullLayout.shapes - fullLayout._shapeUpperLayer.selectAll('path').remove(); - fullLayout._shapeLowerLayer.selectAll('path').remove(); - - for(var k in fullLayout._plots) { - var shapelayer = fullLayout._plots[k].shapelayer; - if(shapelayer) shapelayer.selectAll('path').remove(); - } - - for(var i = 0; i < fullLayout.shapes.length; i++) { - if(fullLayout.shapes[i].visible) { - drawOne(gd, i); - } - } - - // may need to resurrect this if we put text (LaTeX) in shapes - // return Plots.previousPromises(gd); -} - -function drawOne(gd, index) { - // remove the existing shape if there is one. - // because indices can change, we need to look in all shape layers - gd._fullLayout._paperdiv - .selectAll('.shapelayer [data-index="' + index + '"]') - .remove(); - - var options = gd._fullLayout.shapes[index] || {}; - - // this shape is gone - quit now after deleting it - // TODO: use d3 idioms instead of deleting and redrawing every time - if(!options._input || options.visible === false) return; - - if(options.layer !== 'below') { - drawShape(gd._fullLayout._shapeUpperLayer); - } - else if(options.xref === 'paper' || options.yref === 'paper') { - drawShape(gd._fullLayout._shapeLowerLayer); - } - else { - var plotinfo = gd._fullLayout._plots[options.xref + options.yref]; - if(plotinfo) { - var mainPlot = plotinfo.mainplotinfo || plotinfo; - drawShape(mainPlot.shapelayer); - } - else { - // Fall back to _shapeLowerLayer in case the requested subplot doesn't exist. - // This can happen if you reference the shape to an x / y axis combination - // that doesn't have any data on it (and layer is below) - drawShape(gd._fullLayout._shapeLowerLayer); - } - } - - function drawShape(shapeLayer) { - var attrs = { - 'data-index': index, - 'fill-rule': 'evenodd', - d: getPathString(gd, options) - }, - lineColor = options.line.width ? - options.line.color : 'rgba(0,0,0,0)'; - - var path = shapeLayer.append('path') - .attr(attrs) - .style('opacity', options.opacity) - .call(Color.stroke, lineColor) - .call(Color.fill, options.fillcolor) - .call(Drawing.dashLine, options.line.dash, options.line.width); - - setClipPath(path, gd, options); - - if(gd._context.edits.shapePosition) setupDragElement(gd, path, options, index, shapeLayer); - } -} - -function setClipPath(shapePath, gd, shapeOptions) { - // note that for layer="below" the clipAxes can be different from the - // subplot we're drawing this in. This could cause problems if the shape - // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); - - shapePath.call(Drawing.setClipUrl, clipAxes ? - ('clip' + gd._fullLayout._uid + clipAxes) : - null - ); -} - -function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer) { - 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 editHelpers = arrayEditor(gd.layout, 'shapes', shapeOptions); - var modifyItem = editHelpers.modifyItem; - - var x0, y0, x1, y1, xAnchor, yAnchor; - var n0, s0, w0, e0, optN, optS, optW, optE; - var pathIn; - - // setup conversion functions - var xa = Axes.getFromId(gd, shapeOptions.xref), - ya = Axes.getFromId(gd, shapeOptions.yref), - x2p = helpers.getDataToPixel(gd, xa), - y2p = helpers.getDataToPixel(gd, ya, true), - p2x = helpers.getPixelToData(gd, xa), - p2y = helpers.getPixelToData(gd, ya, true); - - var sensoryElement = obtainSensoryElement(); - var dragOptions = { - element: sensoryElement.node(), - gd: gd, - prepFn: startDrag, - doneFn: endDrag, - clickFn: abortDrag - }, - dragMode; - - dragElement.init(dragOptions); - - sensoryElement.node().onmousemove = updateDragMode; - - function obtainSensoryElement() { - return isLine ? createLineDragHandles() : shapePath; - } - - function createLineDragHandles() { - var minSensoryWidth = 10, - sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth); - - // Helper shapes group - // Note that by setting the `data-index` attr, it is ensured that - // the helper group is purged in this modules `draw` function - var g = shapeLayer.append('g') - .attr('data-index', index); - - // Helper path for moving - g.append('path') - .attr('d', shapePath.attr('d')) - .style({ - 'cursor': 'move', - 'stroke-width': sensoryWidth, - 'stroke-opacity': '0' // ensure not visible - }); - - // Helper circles for resizing - var circleStyle = { - 'fill-opacity': '0' // ensure not visible - }; - var circleRadius = sensoryWidth / 2 > minSensoryWidth ? sensoryWidth / 2 : minSensoryWidth; - - g.append('circle') - .attr({ - 'data-line-point': 'start-point', - 'cx': xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x0 : x2p(shapeOptions.x0), - 'cy': yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y0 : y2p(shapeOptions.y0), - '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), - 'cy': yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y1 : y2p(shapeOptions.y1), - 'r': circleRadius - }) - .style(circleStyle) - .classed('cursor-grab', true); - - return g; - } - - function updateDragMode(evt) { - 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 { - // element might not be on screen at time of setup, - // so obtain bounding box here - var dragBBox = dragOptions.element.getBoundingClientRect(); - - // choose 'move' or 'resize' - // based on initial position of cursor within the drag element - var w = dragBBox.right - dragBBox.left, - h = dragBBox.bottom - dragBBox.top, - x = evt.clientX - dragBBox.left, - y = evt.clientY - dragBBox.top, - cursor = (!isPath && w > MINWIDTH && h > MINHEIGHT && !evt.shiftKey) ? - dragElement.getCursor(x / w, 1 - y / h) : - 'move'; - - setCursor(shapePath, cursor); - - // possible values 'move', 'sw', 'w', 'se', 'e', 'ne', 'n', 'nw' and 'w' - dragMode = cursor.split('-')[0]; - } - } - - function startDrag(evt) { - // setup update strings and initial values - if(xPixelSized) { - xAnchor = x2p(shapeOptions.xanchor); - } - if(yPixelSized) { - yAnchor = y2p(shapeOptions.yanchor); - } - - if(shapeOptions.type === 'path') { - pathIn = shapeOptions.path; - } - else { - x0 = xPixelSized ? shapeOptions.x0 : x2p(shapeOptions.x0); - y0 = yPixelSized ? shapeOptions.y0 : y2p(shapeOptions.y0); - x1 = xPixelSized ? shapeOptions.x1 : x2p(shapeOptions.x1); - y1 = yPixelSized ? shapeOptions.y1 : y2p(shapeOptions.y1); - } - - if(x0 < x1) { - w0 = x0; - optW = 'x0'; - e0 = x1; - optE = 'x1'; - } - else { - w0 = x1; - optW = 'x1'; - e0 = x0; - optE = 'x0'; - } - - // For fixed size shapes take opposing direction of y-axis into account. - // Hint: For data sized shapes this is done by the y2p function. - if((!yPixelSized && y0 < y1) || (yPixelSized && y0 > y1)) { - n0 = y0; - optN = 'y0'; - s0 = y1; - optS = 'y1'; - } - else { - n0 = y1; - optN = 'y1'; - s0 = y0; - optS = 'y0'; - } - - // setup dragMode and the corresponding handler - updateDragMode(evt); - renderVisualCues(shapeLayer, shapeOptions); - deactivateClipPathTemporarily(shapePath, shapeOptions, gd); - dragOptions.moveFn = (dragMode === 'move') ? moveShape : resizeShape; - } - - function endDrag() { - setCursor(shapePath); - removeVisualCues(shapeLayer); - - // Don't rely on clipPath being activated during re-layout - setClipPath(shapePath, gd, shapeOptions); - Registry.call('relayout', gd, editHelpers.getUpdateObj()); - } - - function abortDrag() { - removeVisualCues(shapeLayer); - } - - function moveShape(dx, dy) { - if(shapeOptions.type === 'path') { - var noOp = function(coord) { return coord; }, - moveX = noOp, - moveY = noOp; - - if(xPixelSized) { - modifyItem('xanchor', shapeOptions.xanchor = p2x(xAnchor + dx)); - } else { - moveX = function moveX(x) { return p2x(x2p(x) + dx); }; - if(xa && xa.type === 'date') moveX = helpers.encodeDate(moveX); - } - - if(yPixelSized) { - modifyItem('yanchor', shapeOptions.yanchor = p2y(yAnchor + dy)); - } else { - moveY = function moveY(y) { return p2y(y2p(y) + dy); }; - if(ya && ya.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(x0 + dx)); - modifyItem('x1', shapeOptions.x1 = p2x(x1 + dx)); - } - - if(yPixelSized) { - modifyItem('yanchor', shapeOptions.yanchor = p2y(yAnchor + dy)); - } else { - modifyItem('y0', shapeOptions.y0 = p2y(y0 + dy)); - modifyItem('y1', shapeOptions.y1 = p2y(y1 + dy)); - } - } - - shapePath.attr('d', getPathString(gd, shapeOptions)); - renderVisualCues(shapeLayer, shapeOptions); - } - - function resizeShape(dx, dy) { - if(isPath) { - // TODO: implement path resize, don't forget to update dragMode code - var noOp = function(coord) { return coord; }, - moveX = noOp, - moveY = noOp; - - if(xPixelSized) { - modifyItem('xanchor', shapeOptions.xanchor = p2x(xAnchor + dx)); - } else { - moveX = function moveX(x) { return p2x(x2p(x) + dx); }; - if(xa && xa.type === 'date') moveX = helpers.encodeDate(moveX); - } - - if(yPixelSized) { - modifyItem('yanchor', shapeOptions.yanchor = p2y(yAnchor + dy)); - } else { - moveY = function moveY(y) { return p2y(y2p(y) + dy); }; - if(ya && ya.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 = x0 + dx; - var newY0 = yPixelSized ? y0 - dy : y0 + 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 = x1 + dx; - var newY1 = yPixelSized ? y1 - dy : y1 + dy; - modifyItem('x1', shapeOptions.x1 = xPixelSized ? newX1 : p2x(newX1)); - modifyItem('y1', shapeOptions.y1 = yPixelSized ? newY1 : p2y(newY1)); - } - } - else { - var newN = (~dragMode.indexOf('n')) ? n0 + dy : n0, - newS = (~dragMode.indexOf('s')) ? s0 + dy : s0, - newW = (~dragMode.indexOf('w')) ? w0 + dx : w0, - newE = (~dragMode.indexOf('e')) ? e0 + dx : e0; - - // Do things in opposing direction for y-axis. - // Hint: for data-sized shapes the reversal of axis direction is done in p2y. - if(~dragMode.indexOf('n') && yPixelSized) newN = n0 - dy; - if(~dragMode.indexOf('s') && yPixelSized) newS = s0 - dy; - - // Update shape eventually. Again, be aware of the - // opposing direction of the y-axis of fixed size shapes. - 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(gd, shapeOptions)); - renderVisualCues(shapeLayer, shapeOptions); - } - - function renderVisualCues(shapeLayer, shapeOptions) { - if(xPixelSized || yPixelSized) { - renderAnchor(); - } - - function renderAnchor() { - var isNotPath = shapeOptions.type !== 'path'; - - // d3 join with dummy data to satisfy d3 data-binding - var visualCues = shapeLayer.selectAll('.visual-cue').data([0]); - - // Enter - var strokeWidth = 1; - visualCues.enter() - .append('path') - .attr({ - 'fill': '#fff', - 'fill-rule': 'evenodd', - 'stroke': '#000', - 'stroke-width': strokeWidth - }) - .classed('visual-cue', true); - - // Update - var posX = x2p( - xPixelSized ? - shapeOptions.xanchor : - Lib.midRange( - isNotPath ? - [shapeOptions.x0, shapeOptions.x1] : - helpers.extractPathCoords(shapeOptions.path, constants.paramIsX)) - ); - var posY = y2p( - yPixelSized ? - shapeOptions.yanchor : - Lib.midRange( - isNotPath ? - [shapeOptions.y0, shapeOptions.y1] : - helpers.extractPathCoords(shapeOptions.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(shapeLayer) { - shapeLayer.selectAll('.visual-cue').remove(); - } - - function deactivateClipPathTemporarily(shapePath, shapeOptions, gd) { - var xref = shapeOptions.xref, - yref = shapeOptions.yref, - xa = Axes.getFromId(gd, xref), - ya = Axes.getFromId(gd, yref); - - var clipAxes = ''; - if(xref !== 'paper' && !xa.autorange) clipAxes += xref; - if(yref !== 'paper' && !ya.autorange) clipAxes += yref; - - shapePath.call(Drawing.setClipUrl, clipAxes ? - 'clip' + gd._fullLayout._uid + clipAxes : - null - ); - } -} - -function getPathString(gd, options) { - var type = options.type, - xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - gs = gd._fullLayout._size, - x2r, x2p, y2r, y2p, - x0, x1, y0, y1; - - if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; - } - else { - x2p = function(v) { return gs.l + gs.w * v; }; - } - - if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; - } - else { - y2p = function(v) { return gs.t + gs.h * (1 - v); }; - } - - if(type === 'path') { - if(xa && xa.type === 'date') x2p = helpers.decodeDate(x2p); - if(ya && ya.type === 'date') y2p = helpers.decodeDate(y2p); - return convertPath(options, x2p, y2p); - } - - if(options.xsizemode === 'pixel') { - var xAnchorPos = x2p(options.xanchor); - x0 = xAnchorPos + options.x0; - x1 = xAnchorPos + options.x1; - } - else { - x0 = x2p(options.x0); - x1 = x2p(options.x1); - } - - if(options.ysizemode === 'pixel') { - var yAnchorPos = y2p(options.yanchor); - y0 = yAnchorPos - options.y0; - y1 = yAnchorPos - options.y1; - } - else { - y0 = y2p(options.y0); - y1 = y2p(options.y1); - } - - if(type === 'line') return 'M' + x0 + ',' + y0 + 'L' + x1 + ',' + y1; - if(type === 'rect') return 'M' + x0 + ',' + y0 + 'H' + x1 + 'V' + y1 + 'H' + x0 + 'Z'; - // circle - var cx = (x0 + x1) / 2, - cy = (y0 + y1) / 2, - rx = Math.abs(cx - x0), - ry = Math.abs(cy - y0), - rArc = 'A' + rx + ',' + ry, - rightPt = (cx + rx) + ',' + cy, - 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, - xSizemode = options.xsizemode, - ySizemode = options.ysizemode, - xAnchor = options.xanchor, - yAnchor = options.yanchor; - - - return pathIn.replace(constants.segmentRE, function(segment) { - var paramNumber = 0, - segmentType = segment.charAt(0), - xParams = constants.paramIsX[segmentType], - yParams = constants.paramIsY[segmentType], - 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 movePath(pathIn, moveX, moveY) { - return pathIn.replace(constants.segmentRE, function(segment) { - var paramNumber = 0, - segmentType = segment.charAt(0), - xParams = constants.paramIsX[segmentType], - yParams = constants.paramIsY[segmentType], - 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; - }); -} - -},{"../../lib":696,"../../lib/setcursor":716,"../../plot_api/plot_template":734,"../../plots/cartesian/axes":744,"../../registry":827,"../color":570,"../dragelement":592,"../drawing":595,"./constants":651,"./helpers":654}],654:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var constants = _dereq_('./constants'); - -var Lib = _dereq_('../../lib'); - -// special position conversion functions... category axis positions can't be -// specified by their data values, because they don't make a continuous mapping. -// so these have to be specified in terms of the category serial numbers, -// but can take fractional values. Other axis types we specify position based on -// the actual data values. -// TODO: in V2.0 (when log axis ranges are in data units) range and shape position -// will be identical, so rangeToShapePosition and shapePositionToRange can be -// removed entirely. - -exports.rangeToShapePosition = function(ax) { - return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; -}; - -exports.shapePositionToRange = function(ax) { - return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; -}; - -exports.decodeDate = function(convertToPx) { - return function(v) { - if(v.replace) v = v.replace('_', ' '); - return convertToPx(v); - }; -}; - -exports.encodeDate = function(convertToDate) { - return function(v) { return convertToDate(v).replace(' ', '_'); }; -}; - -exports.extractPathCoords = function(path, paramsToUse) { - var extractedCoordinates = []; - - var segments = path.match(constants.segmentRE); - segments.forEach(function(segment) { - var relevantParamIdx = paramsToUse[segment.charAt(0)].drawn; - if(relevantParamIdx === undefined) return; - - var params = segment.substr(1).match(constants.paramRE); - if(!params || params.length < relevantParamIdx) return; - - extractedCoordinates.push(Lib.cleanNumber(params[relevantParamIdx])); - }); - - return extractedCoordinates; -}; - -exports.getDataToPixel = function(gd, axis, isVertical) { - var gs = gd._fullLayout._size, - dataToPixel; - - if(axis) { - var d2r = exports.shapePositionToRange(axis); - - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; - - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); - } - else if(isVertical) { - dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; - } - else { - dataToPixel = function(v) { return gs.l + gs.w * v; }; - } - - return dataToPixel; -}; - -exports.getPixelToData = function(gd, axis, isVertical) { - var gs = gd._fullLayout._size, - pixelToData; - - if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; - } - else if(isVertical) { - pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; - } - else { - pixelToData = function(p) { return (p - gs.l) / gs.w; }; - } - - return pixelToData; -}; - -/** - * Based on the given stroke width, rounds the passed - * position value to represent either a full or half pixel. - * - * In case of an odd stroke width (e.g. 1), this measure ensures - * that a stroke positioned at the returned position isn't rendered - * blurry due to anti-aliasing. - * - * In case of an even stroke width (e.g. 2), this measure ensures - * that the position value is transformed to a full pixel value - * so that anti-aliasing doesn't take effect either. - * - * @param {number} pos The raw position value to be transformed - * @param {number} strokeWidth The stroke width - * @returns {number} either an integer or a .5 decimal number - */ -exports.roundPositionForSharpStrokeRendering = function(pos, strokeWidth) { - var strokeWidthIsOdd = Math.round(strokeWidth % 2) === 1; - var posValAsInt = Math.round(pos); - - return strokeWidthIsOdd ? posValAsInt + 0.5 : posValAsInt; -}; - -},{"../../lib":696,"./constants":651}],655:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var drawModule = _dereq_('./draw'); - -module.exports = { - moduleType: 'component', - name: 'shapes', - - layoutAttributes: _dereq_('./attributes'), - supplyLayoutDefaults: _dereq_('./defaults'), - includeBasePlot: _dereq_('../../plots/cartesian/include_components')('shapes'), - - calcAutorange: _dereq_('./calc_autorange'), - draw: drawModule.draw, - drawOne: drawModule.drawOne -}; - -},{"../../plots/cartesian/include_components":755,"./attributes":649,"./calc_autorange":650,"./defaults":652,"./draw":653}],656:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var fontAttrs = _dereq_('../../plots/font_attributes'); -var padAttrs = _dereq_('../../plots/pad_attributes'); -var extendDeepAll = _dereq_('../../lib/extend').extendDeepAll; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var animationAttrs = _dereq_('../../plots/animation_attributes'); -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; -var constants = _dereq_('./constants'); - -var stepsAttrs = templatedArray('step', { - visible: { - valType: 'boolean', - - dflt: true, - - }, - method: { - valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update', 'skip'], - dflt: 'restyle', - - - }, - args: { - valType: 'info_array', - - freeLength: true, - items: [ - { valType: 'any' }, - { valType: 'any' }, - { valType: 'any' } - ], - - }, - label: { - valType: 'string', - - - }, - value: { - valType: 'string', - - - }, - execute: { - valType: 'boolean', - - dflt: true, - - } -}); - -module.exports = overrideAll(templatedArray('slider', { - visible: { - valType: 'boolean', - - dflt: true, - - }, - - active: { - valType: 'number', - - min: 0, - dflt: 0, - - }, - - steps: stepsAttrs, - - lenmode: { - valType: 'enumerated', - values: ['fraction', 'pixels'], - - dflt: 'fraction', - - }, - len: { - valType: 'number', - min: 0, - dflt: 1, - - - }, - x: { - valType: 'number', - min: -2, - max: 3, - dflt: 0, - - - }, - pad: extendDeepAll({}, padAttrs, { - - }, {t: {dflt: 20}}), - xanchor: { - valType: 'enumerated', - values: ['auto', 'left', 'center', 'right'], - dflt: 'left', - - - }, - y: { - valType: 'number', - min: -2, - max: 3, - dflt: 0, - - - }, - yanchor: { - valType: 'enumerated', - values: ['auto', 'top', 'middle', 'bottom'], - dflt: 'top', - - - }, - - transition: { - duration: { - valType: 'number', - - min: 0, - dflt: 150, - - }, - easing: { - valType: 'enumerated', - values: animationAttrs.transition.easing.values, - - dflt: 'cubic-in-out', - - } - }, - - currentvalue: { - visible: { - valType: 'boolean', - - dflt: true, - - }, - - xanchor: { - valType: 'enumerated', - values: ['left', 'center', 'right'], - dflt: 'left', - - - }, - - offset: { - valType: 'number', - dflt: 10, - - - }, - - prefix: { - valType: 'string', - - - }, - - suffix: { - valType: 'string', - - - }, - - font: fontAttrs({ - - }) - }, - - font: fontAttrs({ - - }), - - activebgcolor: { - valType: 'color', - - dflt: constants.gripBgActiveColor, - - }, - bgcolor: { - valType: 'color', - - dflt: constants.railBgColor, - - }, - bordercolor: { - valType: 'color', - dflt: constants.railBorderColor, - - - }, - borderwidth: { - valType: 'number', - min: 0, - dflt: constants.railBorderWidth, - - - }, - ticklen: { - valType: 'number', - min: 0, - dflt: constants.tickLength, - - - }, - tickcolor: { - valType: 'color', - dflt: constants.tickColor, - - - }, - tickwidth: { - valType: 'number', - min: 0, - dflt: 1, - - - }, - minorticklen: { - valType: 'number', - min: 0, - dflt: constants.minorTickLength, - - - } -}), 'arraydraw', 'from-root'); - -},{"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plot_api/plot_template":734,"../../plots/animation_attributes":739,"../../plots/font_attributes":771,"../../plots/pad_attributes":807,"./constants":657}],657:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -module.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, -}; - -},{}],658:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var constants = _dereq_('./constants'); - -var name = constants.name; -var stepAttrs = attributes.steps; - - -module.exports = function slidersDefaults(layoutIn, layoutOut) { - handleArrayContainerDefaults(layoutIn, layoutOut, { - name: 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 it has fewer than two options, it's not really a slider - 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'); - } -} - -},{"../../lib":696,"../../plots/array_container_defaults":740,"./attributes":656,"./constants":657}],659:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Plots = _dereq_('../../plots/plots'); -var Color = _dereq_('../color'); -var Drawing = _dereq_('../drawing'); -var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var anchorUtils = _dereq_('../legend/anchor_utils'); -var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - -var constants = _dereq_('./constants'); -var alignmentConstants = _dereq_('../../constants/alignment'); -var LINE_SPACING = alignmentConstants.LINE_SPACING; -var FROM_TL = alignmentConstants.FROM_TL; -var FROM_BR = alignmentConstants.FROM_BR; - -module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout, gd); - - // draw a container for *all* sliders: - var sliders = fullLayout._infolayer - .selectAll('g.' + constants.containerClassName) - .data(sliderData.length > 0 ? [0] : []); - - sliders.enter().append('g') - .classed(constants.containerClassName, true) - .style('cursor', 'ew-resize'); - - function clearSlider(sliderOpts) { - if(sliderOpts._commandObserver) { - sliderOpts._commandObserver.remove(); - delete sliderOpts._commandObserver; - } - - // Most components don't need to explicitly remove autoMargin, because - // marginPushers does this - but slider updates don't go through - // a full replot so we need to explicitly remove it. - Plots.autoMargin(gd, autoMarginId(sliderOpts)); - } - - sliders.exit().each(function() { - d3.select(this).selectAll('g.' + constants.groupClassName) - .each(clearSlider); - }) - .remove(); - - // Return early if no menus visible: - 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(); - - // Find the dimensions of the sliders: - for(var i = 0; i < sliderData.length; i++) { - var sliderOpts = sliderData[i]; - findDimensions(gd, sliderOpts); - } - - sliderGroups.each(function(sliderOpts) { - var gSlider = d3.select(this); - - computeLabelSteps(sliderOpts); - - Plots.manageCommandObserver(gd, sliderOpts, sliderOpts._visibleSteps, function(data) { - // NB: Same as below. This is *not* always the same as sliderOpts since - // if a new set of steps comes in, the reference in this callback would - // be invalid. We need to refetch it from the slider group, which is - // the join data that creates this slider. So if this slider still exists, - // the group should be valid, *to the best of my knowledge.* If not, - // we'd have to look it up by d3 data join index/key. - var opts = gSlider.data()[0]; - - if(opts.active === data.index) return; - if(opts._dragging) return; - - setActive(gd, gSlider, opts, data.index, false, true); - }); - - drawSlider(gd, d3.select(this), sliderOpts); - }); -}; - -function autoMarginId(sliderOpts) { - return constants.autoMarginIdRoot + sliderOpts._index; -} - -// This really only just filters by visibility: -function makeSliderData(fullLayout, gd) { - var contOpts = fullLayout[constants.name], - sliderData = []; - - for(var i = 0; i < contOpts.length; i++) { - var item = contOpts[i]; - if(!item.visible) continue; - item._gd = gd; - sliderData.push(item); - } - - return sliderData; -} - -// This is set in the defaults step: -function keyFunction(opts) { - return opts._index; -} - -// Compute the dimensions (mutates sliderOpts): -function findDimensions(gd, sliderOpts) { - var sliderLabels = Drawing.tester.selectAll('g.' + constants.labelGroupClass) - .data(sliderOpts._visibleSteps); - - sliderLabels.enter().append('g') - .classed(constants.labelGroupClass, true); - - // loop over fake buttons to find width / height - 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 - ); - - // calculate some overall dimensions - some of these are needed for - // calculating the currentValue dimensions - var graphSize = gd._fullLayout._size; - dims.lx = graphSize.l + graphSize.w * sliderOpts.x; - dims.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); - - if(sliderOpts.lenmode === 'fraction') { - // fraction: - dims.outerLength = Math.round(graphSize.w * sliderOpts.len); - } else { - // pixels: - dims.outerLength = sliderOpts.len; - } - - // The length of the rail, *excluding* padding on either end: - 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; - - // loop over all possible values for currentValue to find the - // area we need for it - dims.currentValueMaxWidth = 0; - dims.currentValueHeight = 0; - dims.currentValueTotalHeight = 0; - dims.currentValueMaxLines = 1; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - 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(anchorUtils.isRightAnchor(sliderOpts)) { - dims.lx -= dims.outerLength; - xanchor = 'right'; - } - if(anchorUtils.isCenterAnchor(sliderOpts)) { - dims.lx -= dims.outerLength / 2; - xanchor = 'center'; - } - - var yanchor = 'top'; - if(anchorUtils.isBottomAnchor(sliderOpts)) { - dims.ly -= dims.height; - yanchor = 'bottom'; - } - if(anchorUtils.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(gd, autoMarginId(sliderOpts), marginOpts); -} - -function drawSlider(gd, sliderGroup, sliderOpts) { - // This is related to the other long notes in this file regarding what happens - // when slider steps disappear. This particular fix handles what happens when - // the *current* slider step is removed. The drawing functions will error out - // when they fail to find it, so the fix for now is that it will just draw the - // slider in the first position but will not execute the command. - if(!((sliderOpts.steps[sliderOpts.active] || {}).visible)) { - sliderOpts.active = sliderOpts._visibleSteps[0]._index; - } - - // These are carefully ordered for proper z-ordering: - sliderGroup - .call(drawCurrentValue, sliderOpts) - .call(drawRail, sliderOpts) - .call(drawLabelGroup, sliderOpts) - .call(drawTicks, sliderOpts) - .call(drawTouchRect, gd, sliderOpts) - .call(drawGrip, gd, sliderOpts); - - var dims = sliderOpts._dims; - - // Position the rectangle: - 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 x0, textAnchor; - - switch(sliderOpts.currentvalue.xanchor) { - case 'right': - // This is anchored left and adjusted by the width of the longest label - // so that the prefix doesn't move. The goal of this is to emphasize - // what's actually changing and make the update less distracting. - x0 = dims.inputAreaLength - constants.currentValueInset - dims.currentValueMaxWidth; - textAnchor = 'left'; - break; - case 'center': - x0 = dims.inputAreaLength * 0.5; - textAnchor = 'middle'; - break; - default: - x0 = constants.currentValueInset; - textAnchor = 'left'; - } - - var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .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; - 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 y0 = (dims.currentValueMaxLines + 1 - lines) * - sliderOpts.currentvalue.font.size * LINE_SPACING; - - svgTextUtils.positionText(text, x0, y0); - - return text; -} - -function drawGrip(sliderGroup, gd, sliderOpts) { - var grip = Lib.ensureSingle(sliderGroup, 'rect', constants.gripRectClass, function(s) { - s.call(attachGripEvents, gd, 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.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); - }); - - text.call(Drawing.font, sliderOpts.font) - .text(data.step.label) - .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(gd, sliderGroup, sliderOpts, normalizedPosition, doTransition) { - var quantizedPosition = Math.round(normalizedPosition * (sliderOpts._stepCount - 1)); - var quantizedIndex = sliderOpts._visibleSteps[quantizedPosition]._index; - - if(quantizedIndex !== sliderOpts.active) { - setActive(gd, sliderGroup, sliderOpts, quantizedIndex, true, doTransition); - } -} - -function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { - var previousActive = sliderOpts.active; - sliderOpts.active = index; - - // due to templating, it's possible this slider doesn't even exist yet - arrayEditor(gd.layout, constants.name, sliderOpts) - .applyUpdate('active', index); - - var step = sliderOpts.steps[sliderOpts.active]; - - sliderGroup.call(setGripPosition, sliderOpts, doTransition); - sliderGroup.call(drawCurrentValue, sliderOpts); - - gd.emit('plotly_sliderchange', { - slider: sliderOpts, - step: sliderOpts.steps[sliderOpts.active], - interaction: doCallback, - previousActive: previousActive - }); - - if(step && step.method && doCallback) { - if(sliderGroup._nextMethod) { - // If we've already queued up an update, just overwrite it with the most recent: - sliderGroup._nextMethod.step = step; - sliderGroup._nextMethod.doCallback = doCallback; - sliderGroup._nextMethod.doTransition = doTransition; - } else { - sliderGroup._nextMethod = {step: step, doCallback: doCallback, doTransition: doTransition}; - sliderGroup._nextMethodRaf = window.requestAnimationFrame(function() { - var _step = sliderGroup._nextMethod.step; - if(!_step.method) return; - - if(_step.execute) { - Plots.executeAPICommand(gd, _step.method, _step.args); - } - - sliderGroup._nextMethod = null; - sliderGroup._nextMethodRaf = null; - }); - } - } -} - -function attachGripEvents(item, gd, sliderGroup) { - var node = sliderGroup.node(); - var $gd = d3.select(gd); - - // NB: This is *not* the same as sliderOpts itself! These callbacks - // are in a closure so this array won't actually be correct if the - // steps have changed since this was initialized. The sliderGroup, - // however, has not changed since that *is* the slider, so it must - // be present to receive mouse events. - function getSliderOpts() { - return sliderGroup.data()[0]; - } - - item.on('mousedown', function() { - var sliderOpts = getSliderOpts(); - gd.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(gd, sliderGroup, sliderOpts, normalizedPosition, true); - sliderOpts._dragging = true; - - $gd.on('mousemove', function() { - var sliderOpts = getSliderOpts(); - var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]); - handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, false); - }); - - $gd.on('mouseup', function() { - var sliderOpts = getSliderOpts(); - sliderOpts._dragging = false; - grip.call(Color.fill, sliderOpts.bgcolor); - $gd.on('mouseup', null); - $gd.on('mousemove', null); - - gd.emit('plotly_sliderend', { - slider: sliderOpts, - step: sliderOpts.steps[sliderOpts.active] - }); - }); - }); -} - -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 this is true, then *this component* is already invoking its own command - // and has triggered its own animation. - if(sliderOpts._invokingCommand) return; - - var el = grip; - if(doTransition && sliderOpts.transition.duration > 0) { - el = el.transition() - .duration(sliderOpts.transition.duration) - .ease(sliderOpts.transition.easing); - } - - // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. - // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); -} - -// Convert a number from [0-1] to a pixel position relative to the slider group container: -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)); -} - -// Convert a position relative to the slider group to a nubmer in [0, 1] -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, gd, sliderOpts) { - var dims = sliderOpts._dims; - var rect = Lib.ensureSingle(sliderGroup, 'rect', constants.railTouchRectClass, function(s) { - s.call(attachGripEvents, gd, 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 - ); -} - -},{"../../constants/alignment":668,"../../lib":696,"../../lib/svg_text_utils":720,"../../plot_api/plot_template":734,"../../plots/plots":808,"../color":570,"../drawing":595,"../legend/anchor_utils":622,"./constants":657,"d3":148}],660:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var constants = _dereq_('./constants'); - -module.exports = { - moduleType: 'component', - name: constants.name, - - layoutAttributes: _dereq_('./attributes'), - supplyLayoutDefaults: _dereq_('./defaults'), - - draw: _dereq_('./draw') -}; - -},{"./attributes":656,"./constants":657,"./defaults":658,"./draw":659}],661:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var Plots = _dereq_('../../plots/plots'); -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../drawing'); -var Color = _dereq_('../color'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var interactConstants = _dereq_('../../constants/interactions'); - -module.exports = { - draw: draw -}; - -var numStripRE = / [XY][0-9]* /; - -/** - * Titles - (re)draw titles on the axes and plot: - * @param {DOM element} gd - the graphDiv - * @param {string} titleClass - the css class of this title - * @param {object} options - how and what to draw - * propContainer - the layout object containing `title` and `titlefont` - * attributes that apply to this title - * propName - the full name of the title property (for Plotly.relayout) - * [traceIndex] - include only if this property applies to one trace - * (such as a colorbar title) - then editing pipes to Plotly.restyle - * instead of Plotly.relayout - * placeholder - placeholder text for an empty editable title - * [avoid] {object} - include if this title should move to avoid other elements - * selection - d3 selection of elements to avoid - * side - which direction to move if there is a conflict - * [offsetLeft] - if these elements are subject to a translation - * wrt the title element - * [offsetTop] - * attributes {object} - position and alignment attributes - * x - pixels - * y - pixels - * text-anchor - start|middle|end - * transform {object} - how to transform the title after positioning - * rotate - degrees - * offset - shift up/down in the rotated frame (unused?) - * containerGroup - if an svg element already exists to hold this - * title, include here. Otherwise it will go in fullLayout._infolayer - * - * @return {selection} d3 selection of title container group - */ -function draw(gd, titleClass, options) { - 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 fullLayout = gd._fullLayout; - var titlefont = cont.titlefont || {}; - var font = titlefont.family; - var fontSize = titlefont.size; - var fontColor = titlefont.color; - - var opacity = 1; - var isplaceholder = false; - var txt = (cont.title || '').trim(); - - // only make this title editable if we positively identify its property - // as one that has editing enabled. - var editAttr; - if(prop === 'title') editAttr = 'titleText'; - else if(prop.indexOf('axis') !== -1) editAttr = 'axisTitleText'; - else if(prop.indexOf('colorbar' !== -1)) editAttr = 'colorbarTitleText'; - var editable = gd._context.edits[editAttr]; - - if(txt === '') opacity = 0; - // look for placeholder text while stripping out numbers from eg X2, Y3 - // this is just for backward compatibility with the old version that had - // "Click to enter X2 title" and may have gotten saved in some old plots, - // we don't want this to show up when these are displayed. - else if(txt.replace(numStripRE, ' % ') === placeholder.replace(numStripRE, ' % ')) { - opacity = 0.2; - isplaceholder = true; - if(!editable) txt = ''; - } - - var elShouldExist = txt || editable; - - if(!group) { - group = Lib.ensureSingle(fullLayout._infolayer, 'g', 'g-' + titleClass); - } - - var el = group.selectAll('text') - .data(elShouldExist ? [0] : []); - el.enter().append('text'); - el.text(txt) - // this is hacky, but convertToTspans uses the class - // to determine whether to rotate mathJax... - // so we need to clear out any old class and put the - // correct one (only relevant for colorbars, at least - // for now) - ie don't use .classed - .attr('class', titleClass); - el.exit().remove(); - - if(!elShouldExist) return group; - - function titleLayout(titleEl) { - Lib.syncOrAsync([drawTitle, scootTitle], titleEl); - } - - function drawTitle(titleEl) { - var transformVal; - - if(transform) { - transformVal = ''; - if(transform.rotate) { - transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; - } - if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; - } - } else { - transformVal = null; - } - - titleEl.attr('transform', transformVal); - - titleEl.style({ - 'font-family': font, - 'font-size': d3.round(fontSize, 2) + 'px', - fill: Color.rgb(fontColor), - opacity: opacity * Color.opacity(fontColor), - 'font-weight': Plots.fontWeight - }) - .attr(attributes) - .call(svgTextUtils.convertToTspans, gd); - - return Plots.previousPromises(gd); - } - - function scootTitle(titleElIn) { - var titleGroup = d3.select(titleElIn.node().parentNode); - - if(avoid && avoid.selection && avoid.side && txt) { - titleGroup.attr('transform', null); - - // move toward avoid.side (= left, right, top, bottom) if needed - // can include pad (pixels, default 2) - var shift = 0; - var backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side]; - var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1; - var pad = isNumeric(avoid.pad) ? avoid.pad : 2; - var titlebb = Drawing.bBox(titleGroup.node()); - var paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }; - var maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); - // Prevent the title going off the paper - if(maxshift < 0) shift = maxshift; - else { - // so we don't have to offset each avoided element, - // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0; - var offsetTop = avoid.offsetTop || 0; - titlebb.left -= offsetLeft; - titlebb.right -= offsetLeft; - titlebb.top -= offsetTop; - titlebb.bottom -= offsetTop; - - // iterate over a set of elements (avoid.selection) - // to avoid collisions with - avoid.selection.each(function() { - var avoidbb = Drawing.bBox(this); - - if(Lib.bBoxIntersect(titlebb, avoidbb, pad)) { - shift = Math.max(shift, shiftSign * ( - avoidbb[avoid.side] - titlebb[backside]) + pad); - } - }); - shift = Math.min(maxshift, 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', - 'translate(' + shiftTemplate + ')'); - } - } - } - - el.call(titleLayout); - - function setPlaceholder() { - opacity = 0; - isplaceholder = true; - el.text(placeholder) - .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(); - else el.on('.opacity', null); - - el.call(svgTextUtils.makeEditable, {gd: gd}) - .on('edit', function(text) { - if(traceIndex !== undefined) { - Registry.call('restyle', gd, prop, text, traceIndex); - } else { - Registry.call('relayout', gd, 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); - }); - } - el.classed('js-placeholder', isplaceholder); - - return group; -} - -},{"../../constants/interactions":672,"../../lib":696,"../../lib/svg_text_utils":720,"../../plots/plots":808,"../../registry":827,"../color":570,"../drawing":595,"d3":148,"fast-isnumeric":214}],662:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var fontAttrs = _dereq_('../../plots/font_attributes'); -var colorAttrs = _dereq_('../color/attributes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var padAttrs = _dereq_('../../plots/pad_attributes'); -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - -var buttonsAttrs = templatedArray('button', { - visible: { - valType: 'boolean', - - - }, - method: { - valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update', 'skip'], - dflt: 'restyle', - - - }, - args: { - valType: 'info_array', - - freeLength: true, - items: [ - {valType: 'any'}, - {valType: 'any'}, - {valType: 'any'} - ], - - }, - label: { - valType: 'string', - - dflt: '', - - }, - execute: { - valType: 'boolean', - - dflt: true, - - } -}); - -module.exports = overrideAll(templatedArray('updatemenu', { - _arrayAttrRegexps: [/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/], - - visible: { - valType: 'boolean', - - - }, - - type: { - valType: 'enumerated', - values: ['dropdown', 'buttons'], - dflt: 'dropdown', - - - }, - - direction: { - valType: 'enumerated', - values: ['left', 'right', 'up', 'down'], - dflt: 'down', - - - }, - - active: { - valType: 'integer', - - min: -1, - dflt: 0, - - }, - - showactive: { - valType: 'boolean', - - dflt: true, - - }, - - buttons: buttonsAttrs, - - x: { - valType: 'number', - min: -2, - max: 3, - dflt: -0.05, - - - }, - xanchor: { - valType: 'enumerated', - values: ['auto', 'left', 'center', 'right'], - dflt: 'right', - - - }, - y: { - valType: 'number', - min: -2, - max: 3, - dflt: 1, - - - }, - yanchor: { - valType: 'enumerated', - values: ['auto', 'top', 'middle', 'bottom'], - dflt: 'top', - - - }, - - pad: extendFlat({}, padAttrs, { - - }), - - font: fontAttrs({ - - }), - - bgcolor: { - valType: 'color', - - - }, - bordercolor: { - valType: 'color', - dflt: colorAttrs.borderLine, - - - }, - borderwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'arraydraw', - - } -}), 'arraydraw', 'from-root'); - -},{"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plot_api/plot_template":734,"../../plots/font_attributes":771,"../../plots/pad_attributes":807,"../color/attributes":569}],663:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -module.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: '▼' - } -}; - -},{}],664:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var constants = _dereq_('./constants'); - -var name = constants.name; -var buttonAttrs = attributes.buttons; - - -module.exports = function updateMenusDefaults(layoutIn, layoutOut) { - var opts = { - name: 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('label'); - coerce('execute'); - } -} - -},{"../../lib":696,"../../plots/array_container_defaults":740,"./attributes":662,"./constants":663}],665:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); - -var Plots = _dereq_('../../plots/plots'); -var Color = _dereq_('../color'); -var Drawing = _dereq_('../drawing'); -var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var anchorUtils = _dereq_('../legend/anchor_utils'); -var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - -var LINE_SPACING = _dereq_('../../constants/alignment').LINE_SPACING; - -var constants = _dereq_('./constants'); -var ScrollBox = _dereq_('./scrollbox'); - -module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, - menuData = Lib.filterVisible(fullLayout[constants.name]); - - /* Update menu data is bound to the header-group. - * The items in the header group are always present. - * - * Upon clicking on a header its corresponding button - * data is bound to the button-group. - * - * We draw all headers in one group before all buttons - * so that the buttons *always* appear above the headers. - * - * Note that only one set of buttons are visible at once. - * - * - * - * - * - * - * - * - * - * ... - * - * - * - * - * ... - */ - - function clearAutoMargin(menuOpts) { - Plots.autoMargin(gd, autoMarginId(menuOpts)); - } - - // draw update menu container - 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() { - // Most components don't need to explicitly remove autoMargin, because - // marginPushers does this - but updatemenu updates don't go through - // a full replot so we need to explicitly remove it. - // This is for removing *all* updatemenus, removing individuals is - // handled below, in headerGroups.exit - d3.select(this).selectAll('g.' + constants.headerGroupClassName) - .each(clearAutoMargin); - }).remove(); - - // return early if no update menus are visible - if(menuData.length === 0) return; - - // join header group - var headerGroups = menus.selectAll('g.' + constants.headerGroupClassName) - .data(menuData, keyFunction); - - headerGroups.enter().append('g') - .classed(constants.headerGroupClassName, true); - - // draw dropdown button container - var gButton = Lib.ensureSingle(menus, 'g', constants.dropdownButtonGroupClassName, function(s) { - s.style('pointer-events', 'all'); - }); - - // find dimensions before plotting anything (this mutates menuOpts) - for(var i = 0; i < menuData.length; i++) { - var menuOpts = menuData[i]; - findDimensions(gd, menuOpts); - } - - // setup scrollbox - var scrollBoxId = 'updatemenus' + fullLayout._uid, - scrollBox = new ScrollBox(gd, gButton, scrollBoxId); - - // remove exiting header, remove dropped buttons and reset margins - if(headerGroups.enter().size()) { - // make sure gButton is on top of all headers - gButton.node().parentNode.appendChild(gButton.node()); - gButton.call(removeAllButtons); - } - - headerGroups.exit().each(function(menuOpts) { - gButton.call(removeAllButtons); - clearAutoMargin(menuOpts); - }).remove(); - - // draw headers! - headerGroups.each(function(menuOpts) { - var gHeader = d3.select(this); - - var _gButton = menuOpts.type === 'dropdown' ? gButton : null; - Plots.manageCommandObserver(gd, menuOpts, menuOpts.buttons, function(data) { - setActive(gd, menuOpts, menuOpts.buttons[data.index], gHeader, _gButton, scrollBox, data.index, true); - }); - - if(menuOpts.type === 'dropdown') { - drawHeader(gd, gHeader, gButton, scrollBox, menuOpts); - - // if this menu is active, update the dropdown container - if(isActive(gButton, menuOpts)) { - drawButtons(gd, gHeader, gButton, scrollBox, menuOpts); - } - } else { - drawButtons(gd, gHeader, null, null, menuOpts); - } - - }); -}; - -// Note that '_index' is set at the default step, -// it corresponds to the menu index in the user layout update menu container. -// Because a menu can be set invisible, -// this is a more 'consistent' field than the index in the menuData. -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(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex, isSilentUpdate) { - // update 'active' attribute in menuOpts - menuOpts.active = buttonIndex; - - // due to templating, it's possible this slider doesn't even exist yet - arrayEditor(gd.layout, constants.name, menuOpts) - .applyUpdate('active', buttonIndex); - - if(menuOpts.type === 'buttons') { - drawButtons(gd, gHeader, null, null, menuOpts); - } - else if(menuOpts.type === 'dropdown') { - // fold up buttons and redraw header - gButton.attr(constants.menuIndexAttrName, '-1'); - - drawHeader(gd, gHeader, gButton, scrollBox, menuOpts); - - if(!isSilentUpdate) { - drawButtons(gd, gHeader, gButton, scrollBox, menuOpts); - } - } -} - -function drawHeader(gd, 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, gd) - .call(setItemPosition, menuOpts, posOpts, positionOverrides); - - // draw drop arrow at the right edge - var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .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(gd, gHeader, gButton, scrollBox, menuOpts); - }); - - header.on('mouseover', function() { - header.call(styleOnMouseOver); - }); - - header.on('mouseout', function() { - header.call(styleOnMouseOut, menuOpts); - }); - - // translate header group - Drawing.setTranslate(gHeader, dims.lx, dims.ly); -} - -function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { - // If this is a set of buttons, set pointer events = all since we play - // some minor games with which container is which in order to simplify - // the drawing of *either* buttons or menus - 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 x0 = 0; - var y0 = 0; - var dims = menuOpts._dims; - - var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; - - if(menuOpts.type === 'dropdown') { - if(isVertical) { - y0 = dims.headerHeight + constants.gapButtonHeader; - } else { - x0 = dims.headerWidth + constants.gapButtonHeader; - } - } - - if(menuOpts.type === 'dropdown' && menuOpts.direction === 'up') { - y0 = -constants.gapButtonHeader + constants.gapButton - dims.openHeight; - } - - if(menuOpts.type === 'dropdown' && menuOpts.direction === 'left') { - x0 = -constants.gapButtonHeader + constants.gapButton - dims.openWidth; - } - - var posOpts = { - x: dims.lx + x0 + menuOpts.pad.l, - y: dims.ly + y0 + 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, gd) - .call(setItemPosition, menuOpts, posOpts); - - button.on('click', function() { - // skip `dragend` events - if(d3.event.defaultPrevented) return; - - setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - - if(buttonOpts.execute) { - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); - } - - gd.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(gd, gHeader, gButton, scrollBox, menuOpts, scrollBoxPosition); - } - else { - hideScrollBox(scrollBox); - } - } -} - -function drawScrollBox(gd, gHeader, gButton, scrollBox, menuOpts, position) { - // enable the scrollbox - var direction = menuOpts.direction; - var isVertical = (direction === 'up' || direction === 'down'); - var dims = menuOpts._dims; - - var active = menuOpts.active, - translateX, translateY, - 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, - 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, gd) { - item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts, gd); -} - -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, gd) { - var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); - }); - - text.call(Drawing.font, menuOpts.font) - .text(itemOpts.label) - .call(svgTextUtils.convertToTspans, gd); -} - -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); -} - -// find item dimensions (this mutates menuOpts) -function findDimensions(gd, 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; - - // loop over fake buttons to find width / height - fakeButtons.each(function(buttonOpts, i) { - var button = d3.select(this); - - button.call(drawItem, menuOpts, buttonOpts, gd); - - var text = button.select('.' + constants.itemTextClassName); - - // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width; - var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); - - // height is determined by item text - 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); - - // Store per-item sizes since a row of horizontal buttons, for example, - // don't all need to be the same width: - dims.widths[i] = wEff; - dims.heights[i] = hEff; - - // Height and width of individual element: - 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 = gd._fullLayout._size; - dims.lx = graphSize.l + graphSize.w * menuOpts.x; - dims.ly = graphSize.t + graphSize.h * (1 - menuOpts.y); - - var xanchor = 'left'; - if(anchorUtils.isRightAnchor(menuOpts)) { - dims.lx -= paddedWidth; - xanchor = 'right'; - } - if(anchorUtils.isCenterAnchor(menuOpts)) { - dims.lx -= paddedWidth / 2; - xanchor = 'center'; - } - - var yanchor = 'top'; - if(anchorUtils.isBottomAnchor(menuOpts)) { - dims.ly -= paddedHeight; - yanchor = 'bottom'; - } - if(anchorUtils.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(gd, 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; -} - -// set item positions (mutates posOpts) -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(); -} - -},{"../../constants/alignment":668,"../../lib":696,"../../lib/svg_text_utils":720,"../../plot_api/plot_template":734,"../../plots/plots":808,"../color":570,"../drawing":595,"../legend/anchor_utils":622,"./constants":663,"./scrollbox":667,"d3":148}],666:[function(_dereq_,module,exports){ -arguments[4][660][0].apply(exports,arguments) -},{"./attributes":662,"./constants":663,"./defaults":664,"./draw":665,"dup":660}],667:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = ScrollBox; - -var d3 = _dereq_('d3'); - -var Color = _dereq_('../color'); -var Drawing = _dereq_('../drawing'); - -var Lib = _dereq_('../../lib'); - -/** - * Helper class to setup a scroll box - * - * @class - * @param gd Plotly's graph div - * @param container Container to be scroll-boxed (as a D3 selection) - * @param {string} id Id for the clip path to implement the scroll box - */ -function ScrollBox(gd, container, id) { - this.gd = gd; - this.container = container; - this.id = id; - - // See ScrollBox.prototype.enable for further definition - this.position = null; // scrollbox position - this.translateX = null; // scrollbox horizontal translation - this.translateY = null; // scrollbox vertical translation - this.hbar = null; // horizontal scrollbar D3 selection - this.vbar = null; // vertical scrollbar D3 selection - - // element to capture pointer events - 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 - }); -} - -// scroll bar dimensions -ScrollBox.barWidth = 2; -ScrollBox.barLength = 20; -ScrollBox.barRadius = 2; -ScrollBox.barPad = 1; -ScrollBox.barColor = '#808BA4'; - -/** - * If needed, setup a clip path and scrollbars - * - * @method - * @param {Object} position - * @param {number} position.l Left side position (in pixels) - * @param {number} position.t Top side (in pixels) - * @param {number} position.w Width (in pixels) - * @param {number} position.h Height (in pixels) - * @param {string} [position.direction='down'] - * Either 'down', 'left', 'right' or 'up' - * @param {number} [translateX=0] Horizontal offset (in pixels) - * @param {number} [translateY=0] Vertical offset (in pixels) - */ -ScrollBox.prototype.enable = function enable(position, translateX, translateY) { - var fullLayout = this.gd._fullLayout, - fullWidth = fullLayout.width, - fullHeight = fullLayout.height; - - // compute position of scrollbox - this.position = position; - - var l = this.position.l, - w = this.position.w, - t = this.position.t, - h = this.position.h, - direction = this.position.direction, - isDown = (direction === 'down'), - isLeft = (direction === 'left'), - isRight = (direction === 'right'), - isUp = (direction === 'up'), - boxW = w, - boxH = h, - boxL, boxR, - 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) { - // anchor to top side - boxT = t; - boxB = Math.min(boxT + boxH, fullHeight); - boxH = boxB - boxT; - } - else { - // anchor to bottom side - boxB = t + boxH; - boxT = Math.max(boxB - boxH, 0); - boxH = boxB - boxT; - } - } - else { - boxT = t; - boxB = boxT + boxH; - - if(isLeft) { - // anchor to right side - boxR = l + boxW; - boxL = Math.max(boxR - boxW, 0); - boxW = boxR - boxL; - } - else { - // anchor to left side - boxL = l; - boxR = Math.min(boxL + boxW, fullWidth); - boxW = boxR - boxL; - } - } - - this._box = { - l: boxL, - t: boxT, - w: boxW, - h: boxH - }; - - // compute position of horizontal scroll bar - var needsHorizontalScrollBar = (w > boxW), - hbarW = ScrollBox.barLength + 2 * ScrollBox.barPad, - hbarH = ScrollBox.barWidth + 2 * ScrollBox.barPad, - // draw horizontal scrollbar on the bottom side - hbarL = l, - 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 - }); - - // hbar center moves between hbarXMin and hbarXMin + hbarTranslateMax - this._hbarXMin = hbarL + hbarW / 2; - this._hbarTranslateMax = boxW - hbarW; - } - else { - delete this.hbar; - delete this._hbarXMin; - delete this._hbarTranslateMax; - } - - // compute position of vertical scroll bar - var needsVerticalScrollBar = (h > boxH), - vbarW = ScrollBox.barWidth + 2 * ScrollBox.barPad, - vbarH = ScrollBox.barLength + 2 * ScrollBox.barPad, - // draw vertical scrollbar on the right side - vbarL = l + w, - 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 - }); - - // vbar center moves between vbarYMin and vbarYMin + vbarTranslateMax - this._vbarYMin = vbarT + vbarH / 2; - this._vbarTranslateMax = boxH - vbarH; - } - else { - delete this.vbar; - delete this._vbarYMin; - delete this._vbarTranslateMax; - } - - // setup a clip path (if scroll bars are needed) - var clipId = this.id, - clipL = boxL - 0.5, - clipR = (needsVerticalScrollBar) ? boxR + vbarW + 0.5 : boxR + 0.5, - clipT = boxT - 0.5, - 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.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; - } - - // set up drag listeners (if scroll bars are needed) - 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); - } - } - - // set scrollbox translation - this.setTranslate(translateX, translateY); -}; - -/** - * If present, remove clip-path and scrollbars - * - * @method - */ -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; - } -}; - -/** - * Handles scroll box drag events - * - * @method - */ -ScrollBox.prototype._onBoxDrag = function onBarDrag() { - var translateX = this.translateX, - translateY = this.translateY; - - if(this.hbar) { - translateX -= d3.event.dx; - } - - if(this.vbar) { - translateY -= d3.event.dy; - } - - this.setTranslate(translateX, translateY); -}; - -/** - * Handles scroll box wheel events - * - * @method - */ -ScrollBox.prototype._onBoxWheel = function onBarWheel() { - var translateX = this.translateX, - translateY = this.translateY; - - if(this.hbar) { - translateX += d3.event.deltaY; - } - - if(this.vbar) { - translateY += d3.event.deltaY; - } - - this.setTranslate(translateX, translateY); -}; - -/** - * Handles scroll bar drag events - * - * @method - */ -ScrollBox.prototype._onBarDrag = function onBarDrag() { - var translateX = this.translateX, - translateY = this.translateY; - - if(this.hbar) { - var xMin = translateX + this._hbarXMin, - xMax = xMin + this._hbarTranslateMax, - x = Lib.constrain(d3.event.x, xMin, xMax), - xf = (x - xMin) / (xMax - xMin); - - var translateXMax = this.position.w - this._box.w; - - translateX = xf * translateXMax; - } - - if(this.vbar) { - var yMin = translateY + this._vbarYMin, - yMax = yMin + this._vbarTranslateMax, - y = Lib.constrain(d3.event.y, yMin, yMax), - yf = (y - yMin) / (yMax - yMin); - - var translateYMax = this.position.h - this._box.h; - - translateY = yf * translateYMax; - } - - this.setTranslate(translateX, translateY); -}; - -/** - * Set clip path and scroll bar translate transform - * - * @method - * @param {number} [translateX=0] Horizontal offset (in pixels) - * @param {number} [translateY=0] Vertical offset (in pixels) - */ -ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) { - // store translateX and translateY (needed by mouse event handlers) - var translateXMax = this.position.w - this._box.w, - 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 xf = translateX / translateXMax; - - this.hbar.call(Drawing.setTranslate, - translateX + xf * this._hbarTranslateMax, - translateY); - } - - if(this.vbar) { - var yf = translateY / translateYMax; - - this.vbar.call(Drawing.setTranslate, - translateX, - translateY + yf * this._vbarTranslateMax); - } -}; - -},{"../../lib":696,"../color":570,"../drawing":595,"d3":148}],668:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -// fraction of some size to get to a named position -module.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 midline - // (to use when we don't calculate this shift from Drawing.bBox) - // To be precise this should be half the cap height (capital letter) - // of the font, and according to wikipedia: - // an "average" font might have a cap height of 70% of the em - // https://en.wikipedia.org/wiki/Em_(typography)#History - MID_SHIFT: 0.35, - - OPPOSITE_SIDE: { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - } -}; - -},{}],669:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = { - COMPARISON_OPS: ['=', '!=', '<', '>=', '>', '<='], - COMPARISON_OPS2: ['=', '<', '>=', '>', '<='], - INTERVAL_OPS: ['[]', '()', '[)', '(]', '][', ')(', '](', ')['], - SET_OPS: ['{}', '}{'], - CONSTRAINT_REDUCTION: { - // for contour constraints, open/closed endpoints are equivalent - '=': '=', - - '<': '<', - '<=': '<', - - '>': '>', - '>=': '>', - - '[]': '[]', - '()': '[]', - '[)': '[]', - '(]': '[]', - - '][': '][', - ')(': '][', - '](': '][', - ')[': '][' - } -}; - -},{}],670:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -module.exports = { - solid: [[], 0], - dot: [[0.5, 1], 200], - dash: [[0.5, 1], 50], - longdash: [[0.5, 1], 10], - dashdot: [[0.5, 0.625, 0.875, 1], 50], - longdashdot: [[0.5, 0.7, 0.8, 1], 10] -}; - -},{}],671:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -module.exports = { - circle: '●', - 'circle-open': '○', - square: '■', - 'square-open': '□', - diamond: '◆', - 'diamond-open': '◇', - cross: '+', - x: '❌' -}; - -},{}],672:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -module.exports = { - /** - * Timing information for interactive elements - */ - SHOW_PLACEHOLDER: 100, - HIDE_PLACEHOLDER: 1000, - - // ms between first mousedown and 2nd mouseup to constitute dblclick... - // we don't seem to have access to the system setting - DBLCLICKDELAY: 300, - - // opacity dimming fraction for points that are not in selection - DESELECTDIM: 0.2 -}; - -},{}],673:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -module.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: undefined, - - /* - * 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 / 10000, - - /* - * 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 - */ - ONEAVGYEAR: 31557600000, // 365.25 days - ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR - ONEDAY: 86400000, - ONEHOUR: 3600000, - ONEMIN: 60000, - ONESEC: 1000, - - /* - * 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: 2440587.5, - - /* - * 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: '\u2212' -}; - -},{}],674:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.xmlns = 'http://www.w3.org/2000/xmlns/'; -exports.svg = 'http://www.w3.org/2000/svg'; -exports.xlink = 'http://www.w3.org/1999/xlink'; - -// the 'old' d3 quirk got fix in v3.5.7 -// https://github.com/mbostock/d3/commit/a6f66e9dd37f764403fc7c1f26be09ab4af24fed -exports.svgAttrs = { - xmlns: exports.svg, - 'xmlns:xlink': exports.xlink -}; - -},{}],675:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -// package version injected by `npm run preprocess` -exports.version = '1.42.5'; - -// inject promise polyfill -_dereq_('es6-promise').polyfill(); - -// inject plot css -_dereq_('../build/plotcss'); - -// inject default MathJax config -_dereq_('./fonts/mathjax_config'); - -// include registry module and expose register method -var Registry = _dereq_('./registry'); -var register = exports.register = Registry.register; - -// expose plot api methods -var plotApi = _dereq_('./plot_api'); -var methodNames = Object.keys(plotApi); -for(var i = 0; i < methodNames.length; i++) { - var name = methodNames[i]; - exports[name] = plotApi[name]; - register({ - moduleType: 'apiMethod', - name: name, - fn: plotApi[name] - }); -} - -// scatter is the only trace included by default -register(_dereq_('./traces/scatter')); - -// register all registrable components modules -register([ - _dereq_('./components/fx'), - _dereq_('./components/legend'), - _dereq_('./components/annotations'), - _dereq_('./components/annotations3d'), - _dereq_('./components/shapes'), - _dereq_('./components/images'), - _dereq_('./components/updatemenus'), - _dereq_('./components/sliders'), - _dereq_('./components/rangeslider'), - _dereq_('./components/rangeselector'), - _dereq_('./components/grid'), - _dereq_('./components/errorbars') -]); - -// locales en and en-US are required for default behavior -register([ - _dereq_('./locale-en'), - _dereq_('./locale-en-us') -]); - -// plot icons -exports.Icons = _dereq_('../build/ploticon'); - -// unofficial 'beta' plot methods, use at your own risk -exports.Plots = _dereq_('./plots/plots'); -exports.Fx = _dereq_('./components/fx'); -exports.Snapshot = _dereq_('./snapshot'); -exports.PlotSchema = _dereq_('./plot_api/plot_schema'); -exports.Queue = _dereq_('./lib/queue'); - -// export d3 used in the bundle -exports.d3 = _dereq_('d3'); - -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":561,"./components/annotations3d":566,"./components/errorbars":601,"./components/fx":612,"./components/grid":616,"./components/images":621,"./components/legend":630,"./components/rangeselector":641,"./components/rangeslider":647,"./components/shapes":655,"./components/sliders":660,"./components/updatemenus":666,"./fonts/mathjax_config":676,"./lib/queue":711,"./locale-en":725,"./locale-en-us":724,"./plot_api":729,"./plot_api/plot_schema":733,"./plots/plots":808,"./registry":827,"./snapshot":832,"./traces/scatter":1055,"d3":148,"es6-promise":203}],676:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/* global MathJax:false */ - -/** - * Check and configure MathJax - */ -if(typeof MathJax !== 'undefined') { - exports.MathJax = true; - - var globalConfig = (window.PlotlyConfig || {}).MathJaxConfig !== 'local'; - - if(globalConfig) { - MathJax.Hub.Config({ - messageStyle: 'none', - skipStartupTypeset: true, - displayAlign: 'left', - tex2jax: { - inlineMath: [['$', '$'], ['\\(', '\\)']] - } - }); - MathJax.Hub.Configured(); - } - -} else { - exports.MathJax = false; -} - -},{}],677:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var modModule = _dereq_('./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; } - -/** - * is sector a full circle? - * ... this comes up a lot in SVG path-drawing routines - * - * N.B. we consider all sectors that span more that 2pi 'full' circles - * - * @param {2-item array} aBnds : angular bounds in *radians* - * @return {boolean} - */ -function isFullCircle(aBnds) { - return Math.abs(aBnds[1] - aBnds[0]) > twoPI - 1e-15; -} - -/** - * angular delta between angle 'a' and 'b' - * solution taken from: https://stackoverflow.com/a/2007279 - * - * @param {number} a : first angle in *radians* - * @param {number} b : second angle in *radians* - * @return {number} angular delta in *radians* - */ -function angleDelta(a, b) { - return modHalf(b - a, twoPI); -} - -/** - * angular distance between angle 'a' and 'b' - * - * @param {number} a : first angle in *radians* - * @param {number} b : second angle in *radians* - * @return {number} angular distance in *radians* - */ -function angleDist(a, b) { - return Math.abs(angleDelta(a, b)); -} - -/** - * is angle inside sector? - * - * @param {number} a : angle to test in *radians* - * @param {2-item array} aBnds : sector's angular bounds in *radians* - * @param {boolean} - */ -function isAngleInsideSector(a, aBnds) { - if(isFullCircle(aBnds)) return true; - - var s0, s1; - - if(aBnds[0] < aBnds[1]) { - s0 = aBnds[0]; - s1 = aBnds[1]; - } else { - s0 = aBnds[1]; - s1 = aBnds[0]; - } - - s0 = mod(s0, twoPI); - s1 = mod(s1, twoPI); - if(s0 > s1) s1 += twoPI; - - var a0 = mod(a, twoPI); - var a1 = a0 + twoPI; - - return (a0 >= s0 && a0 <= s1) || (a1 >= s0 && a1 <= s1); -} - -/** - * is pt (r,a) inside sector? - * - * @param {number} r : pt's radial coordinate - * @param {number} a : pt's angular coordinate in *radians* - * @param {2-item array} rBnds : sector's radial bounds - * @param {2-item array} aBnds : sector's angular bounds in *radians* - * @return {boolean} - */ -function isPtInsideSector(r, a, rBnds, aBnds) { - if(!isAngleInsideSector(a, aBnds)) return false; - - var r0, r1; - - if(rBnds[0] < rBnds[1]) { - r0 = rBnds[0]; - r1 = rBnds[1]; - } else { - r0 = rBnds[1]; - r1 = rBnds[0]; - } - - return r >= r0 && r <= r1; -} - -// common to pathArc, pathSector and pathAnnulus -function _path(r0, r1, a0, a1, cx, cy, isClosed) { - cx = cx || 0; - cy = cy || 0; - - var isCircle = isFullCircle([a0, a1]); - var aStart, aMid, aEnd; - var rStart, rEnd; - - if(isCircle) { - aStart = 0; - aMid = PI; - aEnd = twoPI; - } else { - if(a0 < a1) { - aStart = a0; - aEnd = a1; - } else { - aStart = a1; - aEnd = a0; - } - } - - if(r0 < r1) { - rStart = r0; - rEnd = r1; - } else { - rStart = r1; - rEnd = r0; - } - - // N.B. svg coordinates here, where y increases downward - function pt(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] + ' ' + pt(r, a); - } - - var p; - - if(isCircle) { - if(rStart === null) { - p = 'M' + pt(rEnd, aStart) + - arc(rEnd, aMid, 0) + - arc(rEnd, aEnd, 0) + 'Z'; - } else { - p = 'M' + pt(rStart, aStart) + - arc(rStart, aMid, 0) + - arc(rStart, aEnd, 0) + 'Z' + - 'M' + pt(rEnd, aStart) + - arc(rEnd, aMid, 1) + - arc(rEnd, aEnd, 1) + 'Z'; - } - } else { - if(rStart === null) { - p = 'M' + pt(rEnd, aStart) + arc(rEnd, aEnd, 0); - if(isClosed) p += 'L0,0Z'; - } else { - p = 'M' + pt(rStart, aStart) + - 'L' + pt(rEnd, aStart) + - arc(rEnd, aEnd, 0) + - 'L' + pt(rStart, aEnd) + - arc(rStart, aStart, 1) + 'Z'; - } - } - - return p; -} - -/** - * path an arc - * - * @param {number} r : radius - * @param {number} a0 : first angular coordinate in *radians* - * @param {number} a1 : second angular coordinate in *radians* - * @param {number (optional)} cx : x coordinate of center - * @param {number (optional)} cy : y coordinate of center - * @return {string} svg path - */ -function pathArc(r, a0, a1, cx, cy) { - return _path(null, r, a0, a1, cx, cy, 0); -} - -/** - * path a sector - * - * @param {number} r : radius - * @param {number} a0 : first angular coordinate in *radians* - * @param {number} a1 : second angular coordinate in *radians* - * @param {number (optional)} cx : x coordinate of center - * @param {number (optional)} cy : y coordinate of center - * @return {string} svg path - */ -function pathSector(r, a0, a1, cx, cy) { - return _path(null, r, a0, a1, cx, cy, 1); -} - -/** - * path an annulus - * - * @param {number} r0 : first radial coordinate - * @param {number} r1 : second radial coordinate - * @param {number} a0 : first angular coordinate in *radians* - * @param {number} a1 : second angular coordinate in *radians* - * @param {number (optional)} cx : x coordinate of center - * @param {number (optional)} cy : y coordinate of center - * @return {string} svg path - */ -function pathAnnulus(r0, r1, a0, a1, cx, cy) { - return _path(r0, r1, a0, a1, cx, cy, 1); -} - -module.exports = { - deg2rad: deg2rad, - rad2deg: rad2deg, - angleDelta: angleDelta, - angleDist: angleDist, - isFullCircle: isFullCircle, - isAngleInsideSector: isAngleInsideSector, - isPtInsideSector: isPtInsideSector, - pathArc: pathArc, - pathSector: pathSector, - pathAnnulus: pathAnnulus -}; - -},{"./mod":703}],678:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var isArray = Array.isArray; - -// IE9 fallbacks - -var ab = (typeof ArrayBuffer === 'undefined' || !ArrayBuffer.isView) ? - {isView: function() { return false; }} : - ArrayBuffer; - -var dv = (typeof DataView === 'undefined') ? - function() {} : - DataView; - -function isTypedArray(a) { - return ab.isView(a) && !(a instanceof dv); -} -exports.isTypedArray = isTypedArray; - -function isArrayOrTypedArray(a) { - return isArray(a) || isTypedArray(a); -} -exports.isArrayOrTypedArray = isArrayOrTypedArray; - -/* - * Test whether an input object is 1D. - * - * Assumes we already know the object is an array. - * - * Looks only at the first element, if the dimensionality is - * not consistent we won't figure that out here. - */ -function isArray1D(a) { - return !isArrayOrTypedArray(a[0]); -} -exports.isArray1D = isArray1D; - -/* - * Ensures an array has the right amount of storage space. If it doesn't - * exist, it creates an array. If it does exist, it returns it if too - * short or truncates it in-place. - * - * The goal is to just reuse memory to avoid a bit of excessive garbage - * collection. - */ -exports.ensureArray = function(out, n) { - // TODO: typed array support here? This is only used in - // traces/carpet/compute_control_points - if(!isArray(out)) out = []; - - // If too long, truncate. (If too short, it will grow - // automatically so we don't care about that case) - out.length = n; - - return out; -}; - -/* - * TypedArray-compatible concatenation of n arrays - * if all arrays are the same type it will preserve that type, - * otherwise it falls back on Array. - * Also tries to avoid copying, in case one array has zero length - * But never mutates an existing array - */ -exports.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) { - // TODO: in principle we could upgrade here, - // ie keep typed array but convert all to Float64Array? - _constructor = false; - } - } - - totalLen += leni; - } - } - - if(!totalLen) return []; - if(!args.length) return arg0; - - if(allArray) return arg0.concat.apply(arg0, args); - if(_constructor) { - // matching typed arrays - 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; - } - - // mismatched types or Array + typed - 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; -}; - -},{}],679:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -var BADNUM = _dereq_('../constants/numerical').BADNUM; - -// precompile for speed -var JUNK = /^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g; - -/** - * cleanNumber: remove common leading and trailing cruft - * Always returns either a number or BADNUM. - */ -module.exports = function cleanNumber(v) { - if(typeof v === 'string') { - v = v.replace(JUNK, ''); - } - - if(isNumeric(v)) return Number(v); - - return BADNUM; -}; - -},{"../constants/numerical":673,"fast-isnumeric":214}],680:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * Clear gl frame (if any). This is a common pattern as - * we usually set `preserveDrawingBuffer: true` during - * gl context creation (e.g. via `reglUtils.prepare`). - * - * @param {DOM node or object} gd : graph div object - */ -module.exports = function clearGlCanvases(gd) { - var fullLayout = gd._fullLayout; - - if(fullLayout._glcanvas && fullLayout._glcanvas.size()) { - fullLayout._glcanvas.each(function(d) { - if(d.regl) d.regl.clear({color: true, depth: true}); - }); - } -}; - -},{}],681:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * Clear responsive handlers (if any). - * - * @param {DOM node or object} gd : graph div object - */ -module.exports = function clearResponsive(gd) { - if(gd._responsiveChartHandler) { - window.removeEventListener('resize', gd._responsiveChartHandler); - delete gd._responsiveChartHandler; - } -}; - -},{}],682:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var tinycolor = _dereq_('tinycolor2'); - -var baseTraceAttrs = _dereq_('../plots/attributes'); -var getColorscale = _dereq_('../components/colorscale/get_scale'); -var colorscaleNames = Object.keys(_dereq_('../components/colorscale/scales')); -var nestedProperty = _dereq_('./nested_property'); -var counterRegex = _dereq_('./regex').counter; -var DESELECTDIM = _dereq_('../constants/interactions').DESELECTDIM; -var modHalf = _dereq_('./mod').modHalf; -var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; - -exports.valObjectMeta = { - data_array: { - // You can use *dflt=[] to force said array to exist though. - - - - coerceFunction: function(v, propOut, dflt) { - // TODO maybe `v: {type: 'float32', vals: [/* ... */]}` also - if(isArrayOrTypedArray(v)) propOut.set(v); - else if(dflt !== undefined) propOut.set(dflt); - } - }, - enumerated: { - - - - 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': { - - - - coerceFunction: function(v, propOut, dflt) { - if(v === true || v === false) propOut.set(v); - else propOut.set(dflt); - } - }, - number: { - - - - coerceFunction: function(v, propOut, dflt, opts) { - if(!isNumeric(v) || - (opts.min !== undefined && v < opts.min) || - (opts.max !== undefined && v > opts.max)) { - propOut.set(dflt); - } - else propOut.set(+v); - } - }, - integer: { - - - - coerceFunction: function(v, propOut, dflt, opts) { - if(v % 1 || !isNumeric(v) || - (opts.min !== undefined && v < opts.min) || - (opts.max !== undefined && v > opts.max)) { - propOut.set(dflt); - } - else propOut.set(+v); - } - }, - string: { - - - // TODO 'values shouldn't be in there (edge case: 'dash' in Scatter) - - 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: { - - - - coerceFunction: function(v, propOut, dflt) { - if(tinycolor(v).isValid()) propOut.set(v); - else propOut.set(dflt); - } - }, - colorlist: { - - - - 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: { - - - - coerceFunction: function(v, propOut, dflt) { - propOut.set(getColorscale(v, dflt)); - } - }, - angle: { - - - - coerceFunction: function(v, propOut, dflt) { - if(v === 'auto') propOut.set('auto'); - else if(!isNumeric(v)) propOut.set(dflt); - else propOut.set(modHalf(+v, 360)); - } - }, - subplotid: { - - - - 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: { - - - - coerceFunction: function(v, propOut, dflt, opts) { - if(typeof v !== 'string') { - propOut.set(dflt); - return; - } - if((opts.extras || []).indexOf(v) !== -1) { - propOut.set(v); - return; - } - var vParts = v.split('+'), - i = 0; - while(i < vParts.length) { - var vi = vParts[i]; - if(opts.flags.indexOf(vi) === -1 || vParts.indexOf(vi) < i) { - vParts.splice(i, 1); - } - else i++; - } - if(!vParts.length) propOut.set(dflt); - else propOut.set(vParts.join('+')); - } - }, - any: { - - - - coerceFunction: function(v, propOut, dflt) { - if(v === undefined) propOut.set(dflt); - else propOut.set(v); - } - }, - info_array: { - - - // 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 - - coerceFunction: function(v, propOut, dflt, opts) { - - // simplified coerce function just for array items - function coercePart(v, opts, dflt) { - var out; - var propPart = {set: function(v) { out = v; }}; - - if(dflt === undefined) dflt = opts.dflt; - - exports.valObjectMeta[opts.valType].coerceFunction(v, propPart, dflt, opts); - - return out; - } - - var twoD = opts.dimensions === 2 || (opts.dimensions === '1-2' && Array.isArray(v) && Array.isArray(v[0])); - - if(!Array.isArray(v)) { - propOut.set(dflt); - return; - } - - var items = opts.items; - var vOut = []; - var arrayItems = Array.isArray(items); - var arrayItems2D = arrayItems && twoD && Array.isArray(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 = Array.isArray(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 !== undefined) vOut[i][j] = vNew; - } - } - } - else { - for(i = 0; i < len; i++) { - vNew = coercePart(v[i], arrayItems ? items[i] : items, dflt[i]); - if(vNew !== undefined) vOut[i] = vNew; - } - } - - propOut.set(vOut); - }, - validateFunction: function(v, opts) { - if(!Array.isArray(v)) return false; - - var items = opts.items; - var arrayItems = Array.isArray(items); - var twoD = opts.dimensions === 2; - - // when free length is off, input and declared lengths must match - if(!opts.freeLength && v.length !== items.length) return false; - - // valid when all input items are valid - for(var i = 0; i < v.length; i++) { - if(twoD) { - if(!Array.isArray(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; - } - } -}; - -/** - * Ensures that container[attribute] has a valid value. - * - * attributes[attribute] is an object with possible keys: - * - valType: data_array, enumerated, boolean, ... as in valObjectMeta - * - values: (enumerated only) array of allowed vals - * - min, max: (number, integer only) inclusive bounds on allowed vals - * either or both may be omitted - * - dflt: if attribute is invalid or missing, use this default - * if dflt is provided as an argument to lib.coerce it takes precedence - * as a convenience, returns the value it finally set - */ -exports.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 === undefined && template) { - v = nestedProperty(template, attribute).get(); - // already used the template value, so short-circuit the second check - template = 0; - } - - if(dflt === undefined) dflt = opts.dflt; - - /** - * arrayOk: value MAY be an array, then we do no value checking - * at this point, because it can be more complicated than the - * individual form (eg. some array vals can be numbers, even if the - * single values must be color strings) - */ - if(opts.arrayOk && isArrayOrTypedArray(v)) { - propOut.set(v); - return v; - } - - var coerceFunction = exports.valObjectMeta[opts.valType].coerceFunction; - coerceFunction(v, propOut, dflt, opts); - - var out = propOut.get(); - // in case v was provided but invalid, try the template again so it still - // overrides the regular default - if(template && out === dflt && !validate(v, opts)) { - v = nestedProperty(template, attribute).get(); - coerceFunction(v, propOut, dflt, opts); - out = propOut.get(); - } - return out; -}; - -/** - * Variation on coerce - * - * Uses coerce to get attribute value if user input is valid, - * returns attribute default if user input it not valid or - * returns false if there is no user input. - */ -exports.coerce2 = function(containerIn, containerOut, attributes, attribute, dflt) { - var propIn = nestedProperty(containerIn, attribute), - propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt), - valIn = propIn.get(); - - return (valIn !== undefined && valIn !== null) ? propOut : false; -}; - -/* - * Shortcut to coerce the three font attributes - * - * 'coerce' is a lib.coerce wrapper with implied first three arguments - */ -exports.coerceFont = function(coerce, attr, dfltObj) { - var out = {}; - - dfltObj = dfltObj || {}; - - out.family = coerce(attr + '.family', dfltObj.family); - out.size = coerce(attr + '.size', dfltObj.size); - out.color = coerce(attr + '.color', dfltObj.color); - - return out; -}; - -/** Coerce shortcut for 'hoverinfo' - * handling 1-vs-multi-trace dflt logic - * - * @param {object} traceIn : user trace object - * @param {object} traceOut : full trace object (requires _module ref) - * @param {object} layoutOut : full layout object (require _dataLength ref) - * @return {any} : the coerced value - */ -exports.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 exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); -}; - -/** Coerce shortcut for [un]selected.marker.opacity, - * which has special default logic, to ensure that it corresponds to the - * default selection behavior while allowing to be overtaken by any other - * [un]selected attribute. - * - * N.B. This must be called *after* coercing all the other [un]selected attrs, - * to give the intended result. - * - * @param {object} traceOut : fullData item - * @param {function} coerce : lib.coerce wrapper with implied first three arguments - */ -exports.coerceSelectionMarkerOpacity = function(traceOut, coerce) { - if(!traceOut.marker) return; - - var mo = traceOut.marker.opacity; - // you can still have a `marker` container with no markers if there's text - if(mo === undefined) return; - - var smoDflt; - var usmoDflt; - - // Don't give [un]selected.marker.opacity a default value if - // marker.opacity is an array: handle this during style step. - // - // Only give [un]selected.marker.opacity a default value if you don't - // set any other [un]selected attributes. - if(!isArrayOrTypedArray(mo) && !traceOut.selected && !traceOut.unselected) { - smoDflt = mo; - usmoDflt = DESELECTDIM * mo; - } - - coerce('selected.marker.opacity', smoDflt); - coerce('unselected.marker.opacity', usmoDflt); -}; - -function validate(value, opts) { - var valObjectDef = exports.valObjectMeta[opts.valType]; - - if(opts.arrayOk && isArrayOrTypedArray(value)) return true; - - if(valObjectDef.validateFunction) { - return valObjectDef.validateFunction(value, opts); - } - - var failed = {}, - out = failed, - propMock = { set: function(v) { out = v; } }; - - // 'failed' just something mutable that won't be === anything else - - valObjectDef.coerceFunction(value, propMock, failed, opts); - return out !== failed; -} -exports.validate = validate; - -},{"../components/colorscale/get_scale":583,"../components/colorscale/scales":589,"../constants/interactions":672,"../plots/attributes":741,"./array":678,"./mod":703,"./nested_property":704,"./regex":712,"fast-isnumeric":214,"tinycolor2":514}],683:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var Loggers = _dereq_('./loggers'); -var mod = _dereq_('./mod').mod; - -var constants = _dereq_('../constants/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 = _dereq_('../registry'); - -var utcFormat = d3.time.format.utc; - -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; -// special regex for chinese calendars to support yyyy-mmi-dd etc for intercalary months -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; - -// for 2-digit years, the first year we map them onto -var YFIRST = new Date().getFullYear() - 70; - -function isWorldCalendar(calendar) { - return ( - calendar && - Registry.componentsRegistry.calendars && - typeof calendar === 'string' && calendar !== 'gregorian' - ); -} - -/* - * dateTick0: get the canonical tick for this calendar - * - * bool sunday is for week ticks, shift it to a Sunday. - */ -exports.dateTick0 = function(calendar, sunday) { - if(isWorldCalendar(calendar)) { - return sunday ? - Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : - Registry.getComponentMethod('calendars', 'CANONICAL_TICK')[calendar]; - } - else { - return sunday ? '2000-01-02' : '2000-01-01'; - } -}; - -/* - * dfltRange: for each calendar, give a valid default range - */ -exports.dfltRange = function(calendar) { - if(isWorldCalendar(calendar)) { - return Registry.getComponentMethod('calendars', 'DFLTRANGE')[calendar]; - } - else { - return ['2000-01-01', '2001-01-01']; - } -}; - -// is an object a javascript date? -exports.isJSDate = function(v) { - return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; -}; - -// The absolute limits of our date-time system -// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms -// but we use dateTime2ms to calculate them (after defining it!) -var MIN_MS, MAX_MS; - -/** - * dateTime2ms - turn a date object or string s into milliseconds - * (relative to 1970-01-01, per javascript standard) - * optional calendar (string) to use a non-gregorian calendar - * - * Returns BADNUM if it doesn't find a date - * - * strings should have the form: - * - * -?YYYY-mm-ddHH:MM:SS.sss? - * - * : space (our normal standard) or T or t (ISO-8601) - * : Z, z, or [+\-]HH:?MM and we THROW IT AWAY - * this format comes from https://tools.ietf.org/html/rfc3339#section-5.6 - * but we allow it even with a space as the separator - * - * May truncate after any full field, and sss can be any length - * even >3 digits, though javascript dates truncate to milliseconds, - * we keep as much as javascript numeric precision can hold, but we only - * report back up to 100 microsecond precision, because most dates support - * this precision (close to 1970 support more, very far away support less) - * - * Expanded to support negative years to -9999 but you must always - * give 4 digits, except for 2-digit positive years which we assume are - * near the present time. - * Note that we follow ISO 8601:2004: there *is* a year 0, which - * is 1BC/BCE, and -1===2BC etc. - * - * World calendars: not all of these *have* agreed extensions to this full range, - * if you have another calendar system but want a date range outside its validity, - * you can use a gregorian date string prefixed with 'G' or 'g'. - * - * Where to cut off 2-digit years between 1900s and 2000s? - * from http://support.microsoft.com/kb/244664: - * 1930-2029 (the most retro of all...) - * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): - * 1950-2049 - * by Java, from http://stackoverflow.com/questions/2024273/: - * now-80 - now+19 - * or FileMaker Pro, from - * http://www.filemaker.com/12help/html/add_view_data.4.21.html: - * now-70 - now+29 - * but python strptime etc, via - * http://docs.python.org/py3k/library/time.html: - * 1969-2068 (super forward-looking, but static, not sliding!) - * - * lets go with now-70 to now+29, and if anyone runs into this problem - * they can learn the hard way not to use 2-digit years, as no choice we - * make now will cover all possibilities. mostly this will all be taken - * care of in initial parsing, should only be an issue for hand-entered data - * currently (2016) this range is: - * 1946-2045 - */ -exports.dateTime2ms = function(s, calendar) { - // first check if s is a date object - if(exports.isJSDate(s)) { - // Convert to the UTC milliseconds that give the same - // hours as this date has in the local timezone - 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; - } - // otherwise only accept strings and numbers - if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; - - s = String(s); - - var isWorld = isWorldCalendar(calendar); - - // to handle out-of-range dates in international calendars, accept - // 'G' as a prefix to force the built-in gregorian calendar. - var s0 = s.charAt(0); - if(isWorld && (s0 === 'G' || s0 === '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], - m = match[3] || '1', - d = Number(match[5] || 1), - H = Number(match[7] || 0), - M = Number(match[9] || 0), - S = Number(match[11] || 0); - - if(isWorld) { - // disallow 2-digit years for world calendars - 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; } // Invalid ... date - - if(!cDate) return BADNUM; - - return ((cDate.toJD() - EPOCHJD) * ONEDAY) + - (H * ONEHOUR) + (M * ONEMIN) + (S * ONESEC); - } - - if(y.length === 2) { - y = (Number(y) + 2000 - YFIRST) % 100 + YFIRST; - } - else y = Number(y); - - // new Date uses months from 0; subtract 1 here just so we - // don't have to do it again during the validity test below - m -= 1; - - // javascript takes new Date(0..99,m,d) to mean 1900-1999, so - // to support years 0-99 we need to use setFullYear explicitly - // Note that 2000 is a leap year. - var date = new Date(Date.UTC(2000, 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 = exports.MIN_MS = exports.dateTime2ms('-9999'); -MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); - -// is string s a date? (see above) -exports.isDateTime = function(s, calendar) { - return (exports.dateTime2ms(s, calendar) !== BADNUM); -}; - -// pad a number with zeroes, to given # of digits before the decimal point -function lpad(val, digits) { - return String(val + Math.pow(10, digits)).substr(1); -} - -/** - * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss - * Crop any trailing zeros in time, except never stop right after hours - * (we could choose to crop '-01' from date too but for now we always - * show the whole date) - * Optional range r is the data range that applies, also in ms. - * If rng is big, the later parts of time will be omitted - */ -var NINETYDAYS = 90 * ONEDAY; -var THREEHOURS = 3 * ONEHOUR; -var FIVEMIN = 5 * ONEMIN; -exports.ms2DateTime = function(ms, r, calendar) { - if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; - - if(!r) r = 0; - - var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10), - msRounded = Math.round(ms - msecTenths / 10), - dateStr, h, m, s, msec10, d; - - if(isWorldCalendar(calendar)) { - var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD, - timeMs = Math.floor(mod(ms, ONEDAY)); - try { - dateStr = Registry.getComponentMethod('calendars', 'getCal')(calendar) - .fromJD(dateJD).formatDate('yyyy-mm-dd'); - } - catch(e) { - // invalid date in this calendar - fall back to Gyyyy-mm-dd - dateStr = utcFormat('G%Y-%m-%d')(new Date(msRounded)); - } - - // yyyy does NOT guarantee 4-digit years. YYYY mostly does, but does - // other things for a few calendars, so we can't trust it. Just pad - // it manually (after the '-' if there is one) - if(dateStr.charAt(0) === '-') { - while(dateStr.length < 11) dateStr = '-0' + dateStr.substr(1); - } - else { - while(dateStr.length < 10) dateStr = '0' + dateStr; - } - - // TODO: if this is faster, we could use this block for extracting - // the time components of regular gregorian too - 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 = utcFormat('%Y-%m-%d')(d); - - // <90 days: add hours and minutes - never *only* add hours - h = (r < NINETYDAYS) ? d.getUTCHours() : 0; - m = (r < NINETYDAYS) ? d.getUTCMinutes() : 0; - // <3 hours: add seconds - s = (r < THREEHOURS) ? d.getUTCSeconds() : 0; - // <5 minutes: add ms (plus one extra digit, this is msec*10) - msec10 = (r < FIVEMIN) ? d.getUTCMilliseconds() * 10 + msecTenths : 0; - } - - return includeTime(dateStr, h, m, s, msec10); -}; - -// For converting old-style milliseconds to date strings, -// we use the local timezone rather than UTC like we use -// everywhere else, both for backward compatibility and -// because that's how people mostly use javasript date objects. -// Clip one extra day off our date range though so we can't get -// thrown beyond the range by the timezone shift. -exports.ms2DateTimeLocal = function(ms) { - if(!(ms >= MIN_MS + ONEDAY && ms <= MAX_MS - ONEDAY)) return BADNUM; - - var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10), - d = new Date(Math.round(ms - msecTenths / 10)), - dateStr = d3.time.format('%Y-%m-%d')(d), - h = d.getHours(), - m = d.getMinutes(), - s = d.getSeconds(), - msec10 = d.getUTCMilliseconds() * 10 + msecTenths; - - return includeTime(dateStr, h, m, s, msec10); -}; - -function includeTime(dateStr, h, m, s, msec10) { - // include each part that has nonzero data in or after it - 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; -} - -// normalize date format to date string, in case it starts as -// a Date object or milliseconds -// optional dflt is the return value if cleaning fails -exports.cleanDate = function(v, dflt, calendar) { - // let us use cleanDate to provide a missing default without an error - if(v === BADNUM) return dflt; - if(exports.isJSDate(v) || (typeof v === 'number' && isFinite(v))) { - // do not allow milliseconds (old) or jsdate objects (inherently - // described as gregorian dates) with world calendars - if(isWorldCalendar(calendar)) { - Loggers.error('JS Dates and milliseconds are incompatible with world calendars', v); - return dflt; - } - - // NOTE: if someone puts in a year as a number rather than a string, - // this will mistakenly convert it thinking it's milliseconds from 1970 - // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds - v = exports.ms2DateTimeLocal(+v); - if(!v && dflt !== undefined) return dflt; - } - else if(!exports.isDateTime(v, calendar)) { - Loggers.error('unrecognized date', v); - return dflt; - } - return v; -}; - -/* - * Date formatting for ticks and hovertext - */ - -/* - * modDateFormat: Support world calendars, and add one item to - * d3's vocabulary: - * %{n}f where n is the max number of digits of fractional seconds - */ -var fracMatch = /%\d?f/g; -function modDateFormat(fmt, x, formatter, calendar) { - - fmt = fmt.replace(fracMatch, function(match) { - var digits = Math.min(+(match.charAt(1)) || 6, 6), - fracSecs = ((x / 1000 % 1) + 2) - .toFixed(digits) - .substr(2).replace(/0+$/, '') || '0'; - return fracSecs; - }); - - var d = new Date(Math.floor(x + 0.05)); - - if(isWorldCalendar(calendar)) { - try { - fmt = Registry.getComponentMethod('calendars', 'worldCalFmt')(fmt, x, calendar); - } - catch(e) { - return 'Invalid'; - } - } - return formatter(fmt)(d); -} - -/* - * formatTime: create a time string from: - * x: milliseconds - * tr: tickround ('M', 'S', or # digits) - * only supports UTC times (where every day is 24 hours and 0 is at midnight) - */ -var MAXSECONDS = [59, 59.9, 59.99, 59.999, 59.9999]; -function formatTime(x, tr) { - var timePart = mod(x + 0.05, ONEDAY); - - var timeStr = lpad(Math.floor(timePart / ONEHOUR), 2) + ':' + - lpad(mod(Math.floor(timePart / ONEMIN), 60), 2); - - if(tr !== 'M') { - if(!isNumeric(tr)) tr = 0; // should only be 'S' - - /* - * this is a weird one - and shouldn't come up unless people - * monkey with tick0 in weird ways, but we need to do something! - * IN PARTICULAR we had better not display garbage (see below) - * for numbers we always round to the nearest increment of the - * precision we're showing, and this seems like the right way to - * handle seconds and milliseconds, as they have a decimal point - * and people will interpret that to mean rounding like numbers. - * but for larger increments we floor the value: it's always - * 2013 until the ball drops on the new year. We could argue about - * which field it is where we start rounding (should 12:08:59 - * round to 12:09 if we're stopping at minutes?) but for now I'll - * say we round seconds but floor everything else. BUT that means - * we need to never round up to 60 seconds, ie 23:59:60 - */ - var sec = Math.min(mod(x / ONESEC, 60), MAXSECONDS[tr]); - - var secStr = (100 + sec).toFixed(tr).substr(1); - if(tr > 0) { - secStr = secStr.replace(/0+$/, '').replace(/[\.]$/, ''); - } - - timeStr += ':' + secStr; - } - return timeStr; -} - -/* - * formatDate: turn a date into tick or hover label text. - * - * x: milliseconds, the value to convert - * fmt: optional, an explicit format string (d3 format, even for world calendars) - * tr: tickround ('y', 'm', 'd', 'M', 'S', or # digits) - * used if no explicit fmt is provided - * formatter: locale-aware d3 date formatter for standard gregorian calendars - * should be the result of exports.getD3DateFormat(gd) - * calendar: optional string, the world calendar system to use - * - * returns the date/time as a string, potentially with the leading portion - * on a separate line (after '\n') - * Note that this means if you provide an explicit format which includes '\n' - * the axis may choose to strip things after it when they don't change from - * one tick to the next (as it does with automatic formatting) - */ -exports.formatDate = function(x, fmt, tr, formatter, calendar, extraFormat) { - calendar = isWorldCalendar(calendar) && calendar; - - if(!fmt) { - if(tr === 'y') fmt = extraFormat.year; - else if(tr === 'm') fmt = extraFormat.month; - else if(tr === 'd') { - fmt = extraFormat.dayMonth + '\n' + extraFormat.year; - } - else { - return formatTime(x, tr) + '\n' + modDateFormat(extraFormat.dayMonthYear, x, formatter, calendar); - } - } - - return modDateFormat(fmt, x, formatter, calendar); -}; - -/* - * incrementMonth: make a new milliseconds value from the given one, - * having changed the month - * - * special case for world calendars: multiples of 12 are treated as years, - * even for calendar systems that don't have (always or ever) 12 months/year - * TODO: perhaps we need a different code for year increments to support this? - * - * ms (number): the initial millisecond value - * dMonth (int): the (signed) number of months to shift - * calendar (string): the calendar system to use - * - * changing month does not (and CANNOT) always preserve day, since - * months have different lengths. The worst example of this is: - * d = new Date(1970,0,31); d.setMonth(1) -> Feb 31 turns into Mar 3 - * - * But we want to be able to iterate over the last day of each month, - * regardless of what its number is. - * So shift 3 days forward, THEN set the new month, then unshift: - * 1/31 -> 2/28 (or 29) -> 3/31 -> 4/30 -> ... - * - * Note that odd behavior still exists if you start from the 26th-28th: - * 1/28 -> 2/28 -> 3/31 - * but at least you can't shift any dates into the wrong month, - * and ticks on these days incrementing by month would be very unusual - */ -var THREEDAYS = 3 * ONEDAY; -exports.incrementMonth = function(ms, dMonth, calendar) { - calendar = isWorldCalendar(calendar) && calendar; - - // pull time out and operate on pure dates, then add time back at the end - // this gives maximum precision - not that we *normally* care if we're - // incrementing by month, but better to be safe! - var timeMs = mod(ms, ONEDAY); - ms = Math.round(ms - timeMs); - - if(calendar) { - try { - var dateJD = Math.round(ms / ONEDAY) + EPOCHJD, - calInstance = Registry.getComponentMethod('calendars', 'getCal')(calendar), - 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 ' + ms + ' in calendar ' + calendar); - // then keep going in gregorian even though the result will be 'Invalid' - } - } - - var y = new Date(ms + THREEDAYS); - return y.setUTCMonth(y.getUTCMonth() + dMonth) + timeMs - THREEDAYS; -}; - -/* - * findExactDates: what fraction of data is exact days, months, or years? - * - * data: array of millisecond values - * calendar (string) the calendar to test against - */ -exports.findExactDates = function(data, calendar) { - var exactYears = 0, - exactMonths = 0, - exactDays = 0, - blankCount = 0, - d, - di; - - var calInstance = ( - isWorldCalendar(calendar) && - Registry.getComponentMethod('calendars', 'getCal')(calendar) - ); - - for(var i = 0; i < data.length; i++) { - di = data[i]; - - // not date data at all - if(!isNumeric(di)) { - blankCount ++; - continue; - } - - // not an exact date - if(di % ONEDAY) continue; - - if(calInstance) { - try { - d = calInstance.fromJD(di / ONEDAY + EPOCHJD); - if(d.day() === 1) { - if(d.month() === 1) exactYears++; - else exactMonths++; - } - else exactDays++; - } - catch(e) { - // invalid date in this calendar - ignore it here. - } - } - else { - d = new Date(di); - 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 - }; -}; - -},{"../constants/numerical":673,"../registry":827,"./loggers":700,"./mod":703,"d3":148,"fast-isnumeric":214}],684:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -/* global jQuery:false */ - -var EventEmitter = _dereq_('events').EventEmitter; - -var Events = { - - init: function(plotObj) { - - /* - * If we have already instantiated an emitter for this plot - * return early. - */ - if(plotObj._ev instanceof EventEmitter) return plotObj; - - var ev = new EventEmitter(); - var internalEv = new EventEmitter(); - - /* - * Assign to plot._ev while we still live in a land - * where plot is a DOM element with stuff attached to it. - * In the future we can make plot the event emitter itself. - */ - plotObj._ev = ev; - - /* - * Create a second event handler that will manage events *internally*. - * This allows parts of plotly to respond to thing like relayout without - * having to use the user-facing event handler. They cannot peacefully - * coexist on the same handler because a user invoking - * plotObj.removeAllListeners() would detach internal events, breaking - * plotly. - */ - plotObj._internalEv = internalEv; - - /* - * Assign bound methods from the ev to the plot object. These methods - * will reference the 'this' of plot._ev even though they are methods - * of plot. This will keep the event machinery away from the plot object - * which currently is often a DOM element but presents an API that will - * continue to function when plot becomes an emitter. Not all EventEmitter - * methods have been bound to `plot` as some do not currently add value to - * the Plotly event API. - */ - plotObj.on = ev.on.bind(ev); - plotObj.once = ev.once.bind(ev); - plotObj.removeListener = ev.removeListener.bind(ev); - plotObj.removeAllListeners = ev.removeAllListeners.bind(ev); - - /* - * Create functions for managing internal events. These are *only* triggered - * by the mirroring of external events via the emit function. - */ - plotObj._internalOn = internalEv.on.bind(internalEv); - plotObj._internalOnce = internalEv.once.bind(internalEv); - plotObj._removeInternalListener = internalEv.removeListener.bind(internalEv); - plotObj._removeAllInternalListeners = internalEv.removeAllListeners.bind(internalEv); - - /* - * We must wrap emit to continue to support JQuery events. The idea - * is to check to see if the user is using JQuery events, if they are - * we emit JQuery events to trigger user handlers as well as the EventEmitter - * events. - */ - plotObj.emit = function(event, data) { - if(typeof jQuery !== 'undefined') { - jQuery(plotObj).trigger(event, data); - } - - ev.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 jQuery exists run all its handlers for this event and - * collect the return value of the LAST handler function - */ - if(typeof jQuery !== 'undefined') { - jQueryHandlerValue = jQuery(plotObj).triggerHandler(event, data); - } - - /* - * Now run all the node style event handlers - */ - var ev = plotObj._ev; - if(!ev) return jQueryHandlerValue; - - var handlers = ev._events[event]; - if(!handlers) return jQueryHandlerValue; - - // making sure 'this' is the EventEmitter instance - function apply(handler) { - // The 'once' case, we can't just call handler() as we need - // the return value here. So, - // - remove handler - // - call listener and grab return value! - // - stash 'fired' key to not call handler twice - if(handler.listener) { - ev.removeListener(event, handler.listener); - if(!handler.fired) { - handler.fired = true; - return handler.listener.apply(ev, [data]); - } - } else { - return handler.apply(ev, [data]); - } - } - - // handlers can be function or an array of functions - handlers = Array.isArray(handlers) ? handlers : [handlers]; - - var i; - for(i = 0; i < handlers.length - 1; i++) { - apply(handlers[i]); - } - // now call the final handler and collect its value - nodeEventHandlerValue = apply(handlers[i]); - - /* - * Return either the jQuery handler value if it exists or the - * nodeEventHandler value. jQuery event value supersedes nodejs - * events for backwards compatibility reasons. - */ - return jQueryHandlerValue !== undefined ? - 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; - } - -}; - -module.exports = Events; - -},{"events":92}],685:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isPlainObject = _dereq_('./is_plain_object.js'); -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; -} - -exports.extendFlat = function() { - return _extend(arguments, false, false, false); -}; - -exports.extendDeep = function() { - return _extend(arguments, true, false, false); -}; - -exports.extendDeepAll = function() { - return _extend(arguments, true, true, false); -}; - -exports.extendDeepNoArrays = function() { - return _extend(arguments, true, false, true); -}; - -/* - * Inspired by https://github.com/justmoon/node-extend/blob/master/index.js - * All credit to the jQuery authors for perfecting this amazing utility. - * - * API difference with jQuery version: - * - No optional boolean (true -> deep extend) first argument, - * use `extendFlat` for first-level only extend and - * use `extendDeep` for a deep extend. - * - * Other differences with jQuery version: - * - Uses a modern (and faster) isPlainObject routine. - * - Expected to work with object {} and array [] arguments only. - * - Does not check for circular structure. - * FYI: jQuery only does a check across one level. - * Warning: this might result in infinite loops. - * - */ -function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { - var target = inputs[0], - length = inputs.length; - - var input, key, src, copy, copyIsArray, clone, allPrimitives; - - // TODO does this do the right thing for typed arrays? - - 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); // reset target and continue to next block - } - } - - for(var i = 1; i < length; i++) { - input = inputs[i]; - - for(key in input) { - src = target[key]; - copy = input[key]; - - // Stop early and just transfer the array if array copies are disallowed: - if(noArrayCopies && isArray(copy)) { - target[key] = copy; - } - - // recurse if we're merging plain objects or arrays - else if(isDeep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if(copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - - // never move original objects, clone them - target[key] = _extend([clone, copy], isDeep, keepAllKeys, noArrayCopies); - } - - // don't bring in undefined values, except for extendDeepAll - else if(typeof copy !== 'undefined' || keepAllKeys) { - target[key] = copy; - } - } - } - - return target; -} - -},{"./is_plain_object.js":697}],686:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -/** - * Return news array containing only the unique items - * found in input array. - * - * IMPORTANT: Note that items are considered unique - * if `String({})` is unique. For example; - * - * Lib.filterUnique([ { a: 1 }, { b: 2 } ]) - * - * returns [{ a: 1 }] - * - * and - * - * Lib.filterUnique([ '1', 1 ]) - * - * returns ['1'] - * - * - * @param {array} array base array - * @return {array} new filtered array - */ -module.exports = function filterUnique(array) { - var seen = {}, - out = [], - 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; -}; - -},{}],687:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** Filter out object items with visible !== true - * insider array container. - * - * @param {array of objects} container - * @return {array of objects} of length <= container - * - */ -module.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) { - return item[0].trace.visible === true; -} - -function isCalcData(cont) { - return ( - Array.isArray(cont) && - Array.isArray(cont[0]) && - cont[0][0] && - cont[0][0].trace - ); -} - -},{}],688:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var countryRegex = _dereq_('country-regex'); -var Lib = _dereq_('../lib'); - - -// make list of all country iso3 ids from at runtime -var countryIds = Object.keys(countryRegex); - -var locationmodeToIdFinder = { - 'ISO-3': Lib.identity, - 'USA-states': Lib.identity, - 'country names': countryNameToISO3 -}; - -exports.locationToFeature = function(locationmode, location, features) { - if(!location || typeof location !== 'string') return false; - - var locationId = getLocationId(locationmode, location); - - if(locationId) { - for(var i = 0; i < features.length; i++) { - var feature = features[i]; - - if(feature.id === locationId) return feature; - } - - Lib.log([ - 'Location with id', locationId, - 'does not have a matching topojson feature at this resolution.' - ].join(' ')); - } - - return false; -}; - -function getLocationId(locationmode, location) { - var idFinder = locationmodeToIdFinder[locationmode]; - return idFinder(location); -} - -function countryNameToISO3(countryName) { - for(var i = 0; i < countryIds.length; i++) { - var iso3 = countryIds[i], - regex = new RegExp(countryRegex[iso3]); - - if(regex.test(countryName.trim().toLowerCase())) return iso3; - } - - Lib.log('Unrecognized country name: ' + countryName + '.'); - - return false; -} - -},{"../lib":696,"country-regex":122}],689:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var BADNUM = _dereq_('../constants/numerical').BADNUM; - -/** - * Convert calcTrace to GeoJSON 'MultiLineString' coordinate arrays - * - * @param {object} calcTrace - * gd.calcdata item. - * Note that calcTrace[i].lonlat is assumed to be defined - * - * @return {array} - * return line coords array (or array of arrays) - * - */ -exports.calcTraceToLineCoords = function(calcTrace) { - var trace = calcTrace[0].trace; - var connectgaps = trace.connectgaps; - - var coords = []; - var lineString = []; - - for(var i = 0; i < calcTrace.length; i++) { - var calcPt = calcTrace[i]; - var lonlat = calcPt.lonlat; - - if(lonlat[0] !== BADNUM) { - lineString.push(lonlat); - } else if(!connectgaps && lineString.length > 0) { - coords.push(lineString); - lineString = []; - } - } - - if(lineString.length > 0) { - coords.push(lineString); - } - - return coords; -}; - - -/** - * Make line ('LineString' or 'MultiLineString') GeoJSON - * - * @param {array} coords - * results form calcTraceToLineCoords - * @return {object} out - * GeoJSON object - * - */ -exports.makeLine = function(coords) { - if(coords.length === 1) { - return { - type: 'LineString', - coordinates: coords[0] - }; - } else { - return { - type: 'MultiLineString', - coordinates: coords - }; - } -}; - -/** - * Make polygon ('Polygon' or 'MultiPolygon') GeoJSON - * - * @param {array} coords - * results form calcTraceToLineCoords - * @return {object} out - * GeoJSON object - */ -exports.makePolygon = function(coords) { - if(coords.length === 1) { - return { - type: 'Polygon', - coordinates: coords - }; - } else { - var _coords = new Array(coords.length); - - for(var i = 0; i < coords.length; i++) { - _coords[i] = [coords[i]]; - } - - return { - type: 'MultiPolygon', - coordinates: _coords - }; - } -}; - -/** - * Make blank GeoJSON - * - * @return {object} - * Blank GeoJSON object - * - */ -exports.makeBlank = function() { - return { - type: 'Point', - coordinates: [] - }; -}; - -},{"../constants/numerical":673}],690:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var mod = _dereq_('./mod').mod; - -/* - * look for intersection of two line segments - * (1->2 and 3->4) - returns array [x,y] if they do, null if not - */ -exports.segmentsIntersect = segmentsIntersect; -function segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { - var a = x2 - x1, - b = x3 - x1, - c = x4 - x3, - d = y2 - y1, - e = y3 - y1, - f = y4 - y3, - det = a * f - c * d; - // parallel lines? intersection is undefined - // ignore the case where they are colinear - if(det === 0) return null; - var t = (b * f - c * e) / det, - u = (b * d - a * e) / det; - // segments do not intersect? - if(u < 0 || u > 1 || t < 0 || t > 1) return null; - - return {x: x1 + a * t, y: y1 + d * t}; -} - -/* - * find the minimum distance between two line segments (1->2 and 3->4) - */ -exports.segmentDistance = function segmentDistance(x1, y1, x2, y2, x3, y3, x4, y4) { - if(segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4)) return 0; - - // the two segments and their lengths squared - var x12 = x2 - x1; - var y12 = y2 - y1; - var x34 = x4 - x3; - var y34 = y4 - y3; - var l2_12 = x12 * x12 + y12 * y12; - var l2_34 = x34 * x34 + y34 * y34; - - // calculate distance squared, then take the sqrt at the very end - var dist2 = Math.min( - perpDistance2(x12, y12, l2_12, x3 - x1, y3 - y1), - perpDistance2(x12, y12, l2_12, x4 - x1, y4 - y1), - perpDistance2(x34, y34, l2_34, x1 - x3, y1 - y3), - perpDistance2(x34, y34, l2_34, x2 - x3, y2 - y3) - ); - - return Math.sqrt(dist2); -}; - -/* - * distance squared from segment ab to point c - * [xab, yab] is the vector b-a - * [xac, yac] is the vector c-a - * l2_ab is the length squared of (b-a), just to simplify calculation - */ -function perpDistance2(xab, yab, l2_ab, xac, yac) { - var fc_ab = (xac * xab + yac * yab); - if(fc_ab < 0) { - // point c is closer to point a - return xac * xac + yac * yac; - } - else if(fc_ab > l2_ab) { - // point c is closer to point b - var xbc = xac - xab; - var ybc = yac - yab; - return xbc * xbc + ybc * ybc; - } - else { - // perpendicular distance is the shortest - var crossProduct = xac * yab - yac * xab; - return crossProduct * crossProduct / l2_ab; - } -} - -// a very short-term cache for getTextLocation, just because -// we're often looping over the same locations multiple times -// invalidated as soon as we look at a different path -var locationCache, workingPath, workingTextWidth; - -// turn a path and position along it into x, y, and angle for the given text -exports.getTextLocation = function getTextLocation(path, totalPathLen, positionOnPath, textWidth) { - if(path !== workingPath || textWidth !== workingTextWidth) { - locationCache = {}; - workingPath = path; - workingTextWidth = textWidth; - } - if(locationCache[positionOnPath]) { - return locationCache[positionOnPath]; - } - - // for the angle, use points on the path separated by the text width - // even though due to curvature, the text will cover a bit more than that - var p0 = path.getPointAtLength(mod(positionOnPath - textWidth / 2, totalPathLen)); - var p1 = path.getPointAtLength(mod(positionOnPath + textWidth / 2, totalPathLen)); - // note: atan handles 1/0 nicely - var theta = Math.atan((p1.y - p0.y) / (p1.x - p0.x)); - // center the text at 2/3 of the center position plus 1/3 the p0/p1 midpoint - // that's the average position of this segment, assuming it's roughly quadratic - var pCenter = path.getPointAtLength(mod(positionOnPath, totalPathLen)); - var x = (pCenter.x * 4 + p0.x + p1.x) / 6; - var y = (pCenter.y * 4 + p0.y + p1.y) / 6; - - var out = {x: x, y: y, theta: theta}; - locationCache[positionOnPath] = out; - return out; -}; - -exports.clearLocationCache = function() { - workingPath = null; -}; - -/* - * Find the segment of `path` that's within the visible area - * given by `bounds` {left, right, top, bottom}, to within a - * precision of `buffer` px - * - * returns: undefined if nothing is visible, else object: - * { - * min: position where the path first enters bounds, or 0 if it - * starts within bounds - * max: position where the path last exits bounds, or the path length - * if it finishes within bounds - * len: max - min, ie the length of visible path - * total: the total path length - just included so the caller doesn't - * need to call path.getTotalLength() again - * isClosed: true iff the start and end points of the path are both visible - * and are at the same point - * } - * - * Works by starting from either end and repeatedly finding the distance from - * that point to the plot area, and if it's outside the plot, moving along the - * path by that distance (because the plot must be at least that far away on - * the path). Note that if a path enters, exits, and re-enters the plot, we - * will not capture this behavior. - */ -exports.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 pt = path.getPointAtLength(len); - - // hold on to the start and end points for `closed` - if(len === 0) pt0 = pt; - else if(len === pTotal) ptTotal = pt; - - var dx = (pt.x < left) ? left - pt.x : (pt.x > right ? pt.x - right : 0); - var dy = (pt.y < top) ? top - pt.y : (pt.y > bottom ? pt.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 - }; -}; - -/** - * Find point on SVG path corresponding to a given constraint coordinate - * - * @param {SVGPathElement} path - * @param {Number} val : constraint coordinate value - * @param {String} coord : 'x' or 'y' the constraint coordinate - * @param {Object} opts : - * - {Number} pathLength : supply total path length before hand - * - {Number} tolerance - * - {Number} iterationLimit - * @return {SVGPoint} - */ -exports.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; - - // if path starts at a val greater than the path tail (like on vertical violins), - // we must flip the sign of the computed diff. - var mul = path.getPointAtLength(0)[coord] > path.getPointAtLength(pathLength)[coord] ? -1 : 1; - - var i = 0; - var b0 = 0; - var b1 = pathLength; - var mid; - var pt; - var diff; - - while(i < iterationLimit) { - mid = (b0 + b1) / 2; - pt = path.getPointAtLength(mid); - diff = pt[coord] - val; - - if(Math.abs(diff) < tolerance) { - return pt; - } else { - if(mul * diff > 0) { - b1 = mid; - } else { - b0 = mid; - } - i++; - } - } - return pt; -}; - -},{"./mod":703}],691:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * Allow referencing a graph DOM element either directly - * or by its id string - * - * @param {HTMLDivElement|string} gd: a graph element or its id - * - * @returns {HTMLDivElement} the DOM element of the graph - */ -module.exports = function(gd) { - var gdElement; - - if(typeof gd === 'string') { - gdElement = document.getElementById(gd); - - if(gdElement === null) { - throw new Error('No DOM element with id \'' + gd + '\' exists on the page.'); - } - - return gdElement; - } - else if(gd === null || gd === undefined) { - throw new Error('DOM element provided is null or undefined'); - } - - return gd; // otherwise assume that gd is a DOM element -}; - -},{}],692:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var tinycolor = _dereq_('tinycolor2'); -var rgba = _dereq_('color-normalize'); - -var Colorscale = _dereq_('../components/colorscale'); -var colorDflt = _dereq_('../components/color/attributes').defaultLine; -var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; - -var colorDfltRgba = rgba(colorDflt); -var opacityDflt = 1; - -function calculateColor(colorIn, opacityIn) { - var colorOut = colorIn; - colorOut[3] *= opacityIn; - return colorOut; -} - -function validateColor(colorIn) { - if(isNumeric(colorIn)) return colorDfltRgba; - - var colorOut = rgba(colorIn); - - return colorOut.length ? colorOut : colorDfltRgba; -} - -function validateOpacity(opacityIn) { - return isNumeric(opacityIn) ? opacityIn : opacityDflt; -} - -function formatColor(containerIn, opacityIn, len) { - var colorIn = containerIn.color; - var isArrayColorIn = isArrayOrTypedArray(colorIn); - var isArrayOpacityIn = isArrayOrTypedArray(opacityIn); - var colorOut = []; - - var sclFunc, getColor, getOpacity, colori, opacityi; - - if(containerIn.colorscale !== undefined) { - sclFunc = Colorscale.makeColorScaleFunc( - Colorscale.extractScale( - containerIn.colorscale, - containerIn.cmin, - containerIn.cmax - ) - ); - } - else { - sclFunc = validateColor; - } - - if(isArrayColorIn) { - getColor = function(c, i) { - // FIXME: there is double work, considering that sclFunc does the opposite - return c[i] === undefined ? colorDfltRgba : rgba(sclFunc(c[i])); - }; - } - else getColor = validateColor; - - if(isArrayOpacityIn) { - getOpacity = function(o, i) { - return o[i] === undefined ? opacityDflt : validateOpacity(o[i]); - }; - } - else getOpacity = validateOpacity; - - if(isArrayColorIn || isArrayOpacityIn) { - for(var i = 0; i < len; i++) { - colori = getColor(colorIn, i); - opacityi = getOpacity(opacityIn, i); - colorOut[i] = calculateColor(colori, opacityi); - } - } - else colorOut = calculateColor(rgba(colorIn), opacityIn); - - return colorOut; -} - -function parseColorScale(colorscale, alpha) { - if(alpha === undefined) alpha = 1; - - return colorscale.map(function(elem) { - var index = elem[0]; - var color = tinycolor(elem[1]); - var rgb = color.toRgb(); - return { - index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] - }; - }); -} - -module.exports = { - formatColor: formatColor, - parseColorScale: parseColorScale -}; - -},{"../components/color/attributes":569,"../components/colorscale":585,"./array":678,"color-normalize":108,"fast-isnumeric":214,"tinycolor2":514}],693:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var identity = _dereq_('./identity'); - -function wrap(d) {return [d];} - -module.exports = { - - // The D3 data binding concept and the General Update Pattern promotes the idea of - // traversing into the scenegraph by using the `.data(fun, keyFun)` call. - // The `fun` is most often a `repeat`, ie. the elements beneath a `` element need - // access to the same data, or a `descend`, which fans a scenegraph node into a bunch of - // of elements, e.g. points, lines, rows, requiring an array as input. - // The role of the `keyFun` is to identify what elements are being entered/exited/updated, - // otherwise D3 reverts to using a plain index which would screw up `transition`s. - keyFun: function(d) {return d.key;}, - repeat: wrap, - descend: identity, - - // Plotly.js uses a convention of storing the actual contents of the `calcData` as the - // element zero of a container array. These helpers are just used for clarity as a - // newcomer to the codebase may not know what the `[0]` is, and whether there can be further - // elements (not atm). - wrap: wrap, - unwrap: function(d) {return d[0];} -}; - -},{"./identity":695}],694:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var toSuperScript = _dereq_('superscript-text'); -var fixEntities = _dereq_('./svg_text_utils').convertEntities; - -function fixSuperScript(x) { - var idx = 0; - - while((idx = x.indexOf('', idx)) >= 0) { - var nidx = x.indexOf('', idx); - if(nidx < idx) break; - - x = x.slice(0, idx) + toSuperScript(x.slice(idx + 5, nidx)) + x.slice(nidx + 6); - } - - return x; -} - -function fixBR(x) { - return x.replace(/\/g, '\n'); -} - -function stripTags(x) { - return x.replace(/\<.*\>/g, ''); -} - -function convertHTMLToUnicode(html) { - return '' + - fixEntities( - stripTags( - fixSuperScript( - fixBR( - html)))); -} - -module.exports = convertHTMLToUnicode; - -},{"./svg_text_utils":720,"superscript-text":507}],695:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -// Simple helper functions -// none of these need any external deps - -module.exports = function identity(d) { return d; }; - -},{}],696:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var numConstants = _dereq_('../constants/numerical'); -var FP_SAFE = numConstants.FP_SAFE; -var BADNUM = numConstants.BADNUM; - -var lib = module.exports = {}; - -lib.nestedProperty = _dereq_('./nested_property'); -lib.keyedContainer = _dereq_('./keyed_container'); -lib.relativeAttr = _dereq_('./relative_attr'); -lib.isPlainObject = _dereq_('./is_plain_object'); -lib.toLogRange = _dereq_('./to_log_range'); -lib.relinkPrivateKeys = _dereq_('./relink_private'); - -var arrayModule = _dereq_('./array'); -lib.isTypedArray = arrayModule.isTypedArray; -lib.isArrayOrTypedArray = arrayModule.isArrayOrTypedArray; -lib.isArray1D = arrayModule.isArray1D; -lib.ensureArray = arrayModule.ensureArray; -lib.concat = arrayModule.concat; - -var modModule = _dereq_('./mod'); -lib.mod = modModule.mod; -lib.modHalf = modModule.modHalf; - -var coerceModule = _dereq_('./coerce'); -lib.valObjectMeta = coerceModule.valObjectMeta; -lib.coerce = coerceModule.coerce; -lib.coerce2 = coerceModule.coerce2; -lib.coerceFont = coerceModule.coerceFont; -lib.coerceHoverinfo = coerceModule.coerceHoverinfo; -lib.coerceSelectionMarkerOpacity = coerceModule.coerceSelectionMarkerOpacity; -lib.validate = coerceModule.validate; - -var datesModule = _dereq_('./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 = _dereq_('./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; - -var statsModule = _dereq_('./stats'); -lib.aggNums = statsModule.aggNums; -lib.len = statsModule.len; -lib.mean = statsModule.mean; -lib.midRange = statsModule.midRange; -lib.variance = statsModule.variance; -lib.stdev = statsModule.stdev; -lib.interp = statsModule.interp; - -var matrixModule = _dereq_('./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.apply2DTransform = matrixModule.apply2DTransform; -lib.apply2DTransform2 = matrixModule.apply2DTransform2; - -var anglesModule = _dereq_('./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 geom2dModule = _dereq_('./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 = _dereq_('./extend'); -lib.extendFlat = extendModule.extendFlat; -lib.extendDeep = extendModule.extendDeep; -lib.extendDeepAll = extendModule.extendDeepAll; -lib.extendDeepNoArrays = extendModule.extendDeepNoArrays; - -var loggersModule = _dereq_('./loggers'); -lib.log = loggersModule.log; -lib.warn = loggersModule.warn; -lib.error = loggersModule.error; - -var regexModule = _dereq_('./regex'); -lib.counterRegex = regexModule.counter; - -var throttleModule = _dereq_('./throttle'); -lib.throttle = throttleModule.throttle; -lib.throttleDone = throttleModule.done; -lib.clearThrottle = throttleModule.clear; - -lib.getGraphDiv = _dereq_('./get_graph_div'); - -lib.clearResponsive = _dereq_('./clear_responsive'); - -lib.makeTraceGroups = _dereq_('./make_trace_groups'); - -lib._ = _dereq_('./localize'); - -lib.notifier = _dereq_('./notifier'); - -lib.filterUnique = _dereq_('./filter_unique'); -lib.filterVisible = _dereq_('./filter_visible'); -lib.pushUnique = _dereq_('./push_unique'); - -lib.cleanNumber = _dereq_('./clean_number'); - -lib.ensureNumber = function num(v) { - if(!isNumeric(v)) return BADNUM; - v = Number(v); - if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; - return isNumeric(v) ? Number(v) : BADNUM; -}; - -/** - * Is v a valid array index? Accepts numeric strings as well as numbers. - * - * @param {any} v: the value to test - * @param {Optional[integer]} len: the array length we are indexing - * - * @return {bool}: v is a valid array index - */ -lib.isIndex = function(v, len) { - if(len !== undefined && v >= len) return false; - return isNumeric(v) && (v >= 0) && (v % 1 === 0); -}; - -lib.noop = _dereq_('./noop'); -lib.identity = _dereq_('./identity'); - -/** - * create an array of length 'cnt' filled with 'v' at all indices - * - * @param {any} v - * @param {number} cnt - * @return {array} - */ -lib.repeat = function(v, cnt) { - var out = new Array(cnt); - for(var i = 0; i < cnt; i++) { - out[i] = v; - } - return out; -}; - -/** - * swap x and y of the same attribute in container cont - * specify attr with a ? in place of x/y - * you can also swap other things than x/y by providing part1 and part2 - */ -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], - xp = lib.nestedProperty(cont, attr.replace('?', part1)), - yp = lib.nestedProperty(cont, attr.replace('?', part2)), - temp = xp.get(); - xp.set(yp.get()); - yp.set(temp); - } -}; - -/** - * SVG painter's algo worked around with reinsertion - */ -lib.raiseToTop = function raiseToTop(elem) { - elem.parentNode.appendChild(elem); -}; - -/** - * cancel a possibly pending transition; returned selection may be used by caller - */ -lib.cancelTransition = function(selection) { - return selection.transition().duration(0); -}; - -// constrain - restrict a number v to be between v0 and v1 -lib.constrain = function(v, v0, v1) { - if(v0 > v1) return Math.max(v1, Math.min(v0, v)); - return Math.max(v0, Math.min(v1, v)); -}; - -/** - * do two bounding boxes from getBoundingClientRect, - * ie {left,right,top,bottom,width,height}, overlap? - * takes optional padding pixels - */ -lib.bBoxIntersect = function(a, b, pad) { - pad = pad || 0; - return (a.left <= b.right + pad && - b.left <= a.right + pad && - a.top <= b.bottom + pad && - b.top <= a.bottom + pad); -}; - -/* - * simpleMap: alternative to Array.map that only - * passes on the element and up to 2 extra args you - * provide (but not the array index or the whole array) - * - * array: the array to map it to - * func: the function to apply - * x1, x2: optional extra args - */ -lib.simpleMap = function(array, func, x1, x2) { - var len = array.length, - out = new Array(len); - for(var i = 0; i < len; i++) out[i] = func(array[i], x1, x2); - return out; -}; - -/** - * Random string generator - * - * @param {object} existing - * pass in strings to avoid as keys with truthy values - * @param {int} bits - * bits of information in the output string, default 24 - * @param {int} base - * base of string representation, default 16. Should be a power of 2. - */ -lib.randstr = function randstr(existing, bits, base, _recursion) { - if(!base) base = 16; - if(bits === undefined) 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) { - /* - * An environment to contain all option setters and - * getters that collectively modify opts. - * - * You can call up opts from any function in new object - * as this.optname || this.opt - * - * See FitOpts for example of usage - */ - if(!opt) opt = {}; - if(!optname) optname = 'opt'; - - var self = {}; - self.optionList = []; - - self._newoption = function(optObj) { - optObj[optname] = opt; - self[optObj.name] = optObj; - self.optionList.push(optObj); - }; - - self['_' + optname] = opt; - return self; -}; - -/** - * lib.smooth: smooth arrayIn by convolving with - * a hann window with given full width at half max - * bounce the ends in, so the output has the same length as the input - */ -lib.smooth = function(arrayIn, FWHM) { - FWHM = Math.round(FWHM) || 0; // only makes sense for integers - if(FWHM < 2) return arrayIn; - - var alen = arrayIn.length, - alen2 = 2 * alen, - wlen = 2 * FWHM - 1, - w = new Array(wlen), - arrayOut = new Array(alen), - i, - j, - k, - v; - - // first make the window array - for(i = 0; i < wlen; i++) { - w[i] = (1 - Math.cos(Math.PI * (i + 1) / FWHM)) / (2 * FWHM); - } - - // now do the convolution - for(i = 0; i < alen; i++) { - v = 0; - for(j = 0; j < wlen; j++) { - k = i + j + 1 - FWHM; - - // multibounce - if(k < -alen) k -= alen2 * Math.round(k / alen2); - else if(k >= alen2) k -= alen2 * Math.floor(k / alen2); - - // single bounce - if(k < 0) k = - 1 - k; - else if(k >= alen) k = alen2 - 1 - k; - - v += arrayIn[k] * w[j]; - } - arrayOut[i] = v; - } - - return arrayOut; -}; - -/** - * syncOrAsync: run a sequence of functions synchronously - * as long as its returns are not promises (ie have no .then) - * includes one argument arg to send to all functions... - * this is mainly just to prevent us having to make wrapper functions - * when the only purpose of the wrapper is to reference gd - * and a final step to be executed at the end - * TODO: if there's an error and everything is sync, - * this doesn't happen yet because we want to make sure - * that it gets reported - */ -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) - .then(undefined, lib.promiseError); - } - } - - return finalStep && finalStep(arg); -}; - - -/** - * Helper to strip trailing slash, from - * http://stackoverflow.com/questions/6680825/return-string-without-trailing-slash - */ -lib.stripTrailingSlash = function(str) { - if(str.substr(-1) === '/') return str.substr(0, str.length - 1); - return str; -}; - -lib.noneOrAll = function(containerIn, containerOut, attrList) { - /** - * some attributes come together, so if you have one of them - * in the input, you should copy the default values of the others - * to the input as well. - */ - if(!containerIn) return; - - var hasAny = false, - hasAll = true, - i, - val; - - for(i = 0; i < attrList.length; i++) { - val = containerIn[attrList[i]]; - if(val !== undefined && val !== null) hasAny = true; - else hasAll = false; - } - - if(hasAny && !hasAll) { - for(i = 0; i < attrList.length; i++) { - containerIn[attrList[i]] = containerOut[attrList[i]]; - } - } -}; - -/** merges calcdata field (given by cdAttr) with traceAttr values - * - * N.B. Loop over minimum of cd.length and traceAttr.length - * i.e. it does not try to fill in beyond traceAttr.length-1 - * - * @param {array} traceAttr : trace attribute - * @param {object} cd : calcdata trace - * @param {string} cdAttr : calcdata key - */ -lib.mergeArray = function(traceAttr, cd, cdAttr) { - if(lib.isArrayOrTypedArray(traceAttr)) { - var imax = Math.min(traceAttr.length, cd.length); - for(var i = 0; i < imax; i++) cd[i][cdAttr] = traceAttr[i]; - } -}; - -/** fills calcdata field (given by cdAttr) with traceAttr values - * or function of traceAttr values (e.g. some fallback) - * - * N.B. Loops over all cd items. - * - * @param {array} traceAttr : trace attribute - * @param {object} cd : calcdata trace - * @param {string} cdAttr : calcdata key - * @param {function} [fn] : optional function to apply to each array item - */ -lib.fillArray = function(traceAttr, cd, cdAttr, fn) { - fn = fn || lib.identity; - - if(lib.isArrayOrTypedArray(traceAttr)) { - for(var i = 0; i < cd.length; i++) { - cd[i][cdAttr] = fn(traceAttr[i]); - } - } -}; - -/** Handler for trace-wide vs per-point options - * - * @param {object} trace : (full) trace object - * @param {number} ptNumber : index of the point in question - * @param {string} astr : attribute string - * @param {function} [fn] : optional function to apply to each array item - * - * @return {any} - */ -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; - } -}; - -/** Extract option from calcdata item, correctly falling back to - * trace value if not found. - * - * @param {object} calcPt : calcdata[i][j] item - * @param {object} trace : (full) trace object - * @param {string} calcKey : calcdata key - * @param {string} traceKey : aka trace attribute string - * @return {any} - */ -lib.extractOption = function(calcPt, trace, calcKey, traceKey) { - if(calcKey in calcPt) return calcPt[calcKey]; - - // fallback to trace value, - // must check if value isn't itself an array - // which means the trace attribute has a corresponding - // calcdata key, but its value is falsy - 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; -} - -/** Tag selected calcdata items - * - * N.B. note that point 'index' corresponds to input data array index - * whereas 'number' is its post-transform version. - * - * @param {array} calcTrace - * @param {object} trace - * - selectedpoints {array} - * - _indexToPoints {object} - * @param {ptNumber2cdIndex} ptNumber2cdIndex (optional) - * optional map object for trace types that do not have 1-to-1 point number to - * calcdata item index correspondence (e.g. histogram) - */ -lib.tagSelected = function(calcTrace, trace, ptNumber2cdIndex) { - var selectedpoints = trace.selectedpoints; - var indexToPoints = trace._indexToPoints; - var ptIndex2ptNumber; - - // make pt index-to-number map object, which takes care of transformed traces - if(indexToPoints) { - ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints); - } - - function isCdIndexValid(v) { - return v !== undefined && v < calcTrace.length; - } - - for(var i = 0; i < selectedpoints.length; i++) { - var ptIndex = selectedpoints[i]; - - if(lib.isIndex(ptIndex)) { - 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; - } -}; - -/** Returns target as set by 'target' transform attribute - * - * @param {object} trace : full trace object - * @param {object} transformOpts : transform option object - * - target (string} : - * either an attribute string referencing an array in the trace object, or - * a set array. - * - * @return {array or false} : the target array (NOT a copy!!) or false if invalid - */ -lib.getTargetArray = function(trace, transformOpts) { - var target = transformOpts.target; - - if(typeof target === 'string' && target) { - var array = lib.nestedProperty(trace, target).get(); - return Array.isArray(array) ? array : false; - } else if(Array.isArray(target)) { - return target; - } - - return false; -}; - -/** - * modified version of jQuery's extend to strip out private objs and functions, - * and cut arrays down to first or 1 elements - * because extend-like algorithms are hella slow - * obj2 is assumed to already be clean of these things (including no arrays) - */ -lib.minExtend = function(obj1, obj2) { - var objOut = {}; - if(typeof obj2 !== 'object') obj2 = {}; - var arrayLen = 3, - keys = Object.keys(obj1), - 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)) objOut[k] = v.slice(0, arrayLen); - else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); - 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.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.isPlotDiv = function(el) { - var el3 = d3.select(el); - return el3.node() instanceof HTMLElement && - el3.size() && - el3.classed('js-plotly-plot'); -}; - -lib.removeElement = function(el) { - var elParent = el && el.parentNode; - if(elParent) elParent.removeChild(el); -}; - -/** - * for dynamically adding style rules - * makes one stylesheet that contains all rules added - * by all calls to this function - */ -lib.addStyleRule = function(selector, styleString) { - lib.addRelatedStyleRule('global', selector, styleString); -}; - -/** - * for dynamically adding style rules - * to a stylesheet uniquely identified by a uid - */ -lib.addRelatedStyleRule = function(uid, selector, styleString) { - var id = 'plotly.js-style-' + uid, - style = document.getElementById(id); - if(!style) { - style = document.createElement('style'); - style.setAttribute('id', id); - // WebKit hack :( - 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 lib.warn('addStyleRule failed'); -}; - -/** - * to remove from the page a stylesheet identified by a given uid - */ -lib.deleteRelatedStyleRule = function(uid) { - var id = 'plotly.js-style-' + uid, - style = document.getElementById(id); - if(style) lib.removeElement(style); -}; - -lib.isIE = function() { - return typeof window.navigator.msSaveBlob !== 'undefined'; -}; - -/** - * Duck typing to recognize a d3 selection, mostly for IE9's benefit - * because it doesn't handle instanceof like modern browsers - */ -lib.isD3Selection = function(obj) { - return obj && (typeof obj.classed === 'function'); -}; - -/** - * Append element to DOM only if not present. - * - * @param {d3 selection} parent : parent selection of the element in question - * @param {string} nodeType : node type of element to append - * @param {string} className (optional) : class name of element in question - * @param {fn} enterFn (optional) : optional fn applied to entering elements only - * @return {d3 selection} selection of new layer - * - * Previously, we were using the following pattern: - * - * ``` - * var sel = parent.selectAll('.' + className) - * .data([0]); - * - * sel.enter().append(nodeType) - * .classed(className, true); - * - * return sel; - * ``` - * - * in numerous places in our codebase to achieve the same behavior. - * - * The logic below performs much better, mostly as we are using - * `.select` instead `.selectAll` that is `querySelector` instead of - * `querySelectorAll`. - * - */ -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; -}; - -/** - * Same as Lib.ensureSingle, but using id as selector. - * This version is mostly used for clipPath nodes. - * - * @param {d3 selection} parent : parent selection of the element in question - * @param {string} nodeType : node type of element to append - * @param {string} id : id of element in question - * @param {fn} enterFn (optional) : optional fn applied to entering elements only - * @return {d3 selection} selection of new layer - */ -lib.ensureSingleById = function(parent, nodeType, id, enterFn) { - var sel = parent.select(nodeType + '#' + id); - if(sel.size()) return sel; - - var layer = parent.append(nodeType).attr('id', id); - if(enterFn) layer.call(enterFn); - - return layer; -}; - -/** - * Converts a string path to an object. - * - * When given a string containing an array element, it will create a `null` - * filled array of the given size. - * - * @example - * lib.objectFromPath('nested.test[2].path', 'value'); - * // returns { nested: { test: [null, null, { path: 'value' }]} - * - * @param {string} path to nested value - * @param {*} any value to be set - * - * @return {Object} the constructed object with a full nested path - */ -lib.objectFromPath = function(path, value) { - var keys = path.split('.'), - tmpObj, - 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; -}; - -/** - * Iterate through an object in-place, converting dotted properties to objects. - * - * Examples: - * - * lib.expandObjectPaths({'nested.test.path': 'value'}); - * => { nested: { test: {path: 'value'}}} - * - * It also handles array notation, e.g.: - * - * lib.expandObjectPaths({'foo[1].bar': 'value'}); - * => { foo: [null, {bar: value}] } - * - * It handles merges the results when two properties are specified in parallel: - * - * lib.expandObjectPaths({'foo[1].bar': 10, 'foo[0].bar': 20}); - * => { foo: [{bar: 10}, {bar: 20}] } - * - * It does NOT, however, merge mulitple mutliply-nested arrays:: - * - * lib.expandObjectPaths({'marker[1].range[1]': 5, 'marker[1].range[0]': 4}) - * => { marker: [null, {range: 4}] } - */ - -// Store this to avoid recompiling regex on *every* prop since this may happen many -// many times for animations. Could maybe be inside the function. Not sure about -// scoping vs. recompilation tradeoff, but at least it's not just inlining it into -// the inner loop. -var dottedPropertyRegex = /^([^\[\.]+)\.(.+)?/; -var indexedPropertyRegex = /^([^\.]+)\[([0-9]+)\](\.)?(.+)?/; - -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]; - - 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]; - idx = parseInt(match[2]); - - delete data[key]; - - data[prop] = data[prop] || []; - - if(match[3] === '.') { - // This is the case where theere are subsequent properties into which - // we must recurse, e.g. transforms[0].value - trailingPath = match[4]; - dest = data[prop][idx] = data[prop][idx] || {}; - - // NB: Extend deep no arrays prevents this from working on multiple - // nested properties in the same object, e.g. - // - // { - // foo[0].bar[1].range - // foo[0].bar[0].range - // } - // - // In this case, the extendDeepNoArrays will overwrite one array with - // the other, so that both properties *will not* be present in the - // result. Fixing this would require a more intelligent tracking - // of changes and merging than extendDeepNoArrays currently accomplishes. - lib.extendDeepNoArrays(dest, lib.objectFromPath(trailingPath, lib.expandObjectPaths(datum))); - } else { - // This is the case where this property is the end of the line, - // e.g. xaxis.range[0] - data[prop][idx] = lib.expandObjectPaths(datum); - } - } else { - data[key] = lib.expandObjectPaths(data[key]); - } - } - } - } - - return data; -}; - -/** - * Converts value to string separated by the provided separators. - * - * @example - * lib.numSeparate(2016, '.,'); - * // returns '2016' - * - * @example - * lib.numSeparate(3000, '.,', true); - * // returns '3,000' - * - * @example - * lib.numSeparate(1234.56, '|,') - * // returns '1,234|56' - * - * @param {string|number} value the value to be converted - * @param {string} separators string of decimal, then thousands separators - * @param {boolean} separatethousands boolean, 4-digit integers are separated if true - * - * @return {string} the value that has been separated - */ -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})/, - decimalSep = separators.charAt(0), - thouSep = separators.charAt(1); - - var x = value.split('.'), - x1 = x[0], - x2 = x.length > 1 ? decimalSep + x[1] : ''; - - // Years are ignored for thousands separators - if(thouSep && (x.length > 1 || x1.length > 4 || separatethousands)) { - while(thousandsRe.test(x1)) { - x1 = x1.replace(thousandsRe, '$1' + thouSep + '$2'); - } - } - - return x1 + x2; -}; - -var TEMPLATE_STRING_REGEX = /%{([^\s%{}]*)}/g; -var SIMPLE_PROPERTY_REGEX = /^\w*$/; - -/* - * Substitute values from an object into a string - * - * Examples: - * Lib.templateString('name: %{trace}', {trace: 'asdf'}) --> 'name: asdf' - * Lib.templateString('name: %{trace[0].name}', {trace: [{name: 'asdf'}]}) --> 'name: asdf' - * - * @param {string} input string containing %{...} template strings - * @param {obj} data object containing substitution values - * - * @return {string} templated string - */ - -lib.templateString = function(string, obj) { - // Not all that useful, but cache nestedProperty instantiation - // just in case it speeds things up *slightly*: - var getterCache = {}; - - return string.replace(TEMPLATE_STRING_REGEX, function(dummy, key) { - if(SIMPLE_PROPERTY_REGEX.test(key)) { - return obj[key] || ''; - } - getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get; - return getterCache[key]() || ''; - }); -}; - -/* - * alphanumeric string sort, tailored for subplot IDs like scene2, scene10, x10y13 etc - */ -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; -}; - -// repeatable pseudorandom generator -var randSeed = 2000000000; - -lib.seedPseudoRandom = function() { - randSeed = 2000000000; -}; - -lib.pseudoRandom = function() { - var lastVal = randSeed; - randSeed = (69069 * randSeed + 1) % 4294967296; - // don't let consecutive vals be too close together - // gets away from really trying to be random, in favor of better local uniformity - if(Math.abs(randSeed - lastVal) < 429496729) return lib.pseudoRandom(); - return randSeed / 4294967296; -}; - -},{"../constants/numerical":673,"./angles":677,"./array":678,"./clean_number":679,"./clear_responsive":681,"./coerce":682,"./dates":683,"./extend":685,"./filter_unique":686,"./filter_visible":687,"./geometry2d":690,"./get_graph_div":691,"./identity":695,"./is_plain_object":697,"./keyed_container":698,"./localize":699,"./loggers":700,"./make_trace_groups":701,"./matrix":702,"./mod":703,"./nested_property":704,"./noop":705,"./notifier":706,"./push_unique":710,"./regex":712,"./relative_attr":713,"./relink_private":714,"./search":715,"./stats":718,"./throttle":721,"./to_log_range":722,"d3":148,"fast-isnumeric":214}],697:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -// more info: http://stackoverflow.com/questions/18531624/isplainobject-thing -module.exports = function isPlainObject(obj) { - - // We need to be a little less strict in the `imagetest` container because - // of how async image requests are handled. - // - // N.B. isPlainObject(new Constructor()) will return true in `imagetest` - 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) === Object.prototype - ); -}; - -},{}],698:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var nestedProperty = _dereq_('./nested_property'); - -var SIMPLE_PROPERTY_REGEX = /^\w*$/; - -// bitmask for deciding what's updated. Sometimes the name needs to be updated, -// sometimes the value needs to be updated, and sometimes both do. This is just -// a simple way to track what's updated such that it's a simple OR operation to -// assimilate new updates. -// -// The only exception is the UNSET bit that tracks when we need to explicitly -// unset and remove the property. This concrn arises because of the special -// way in which nestedProperty handles null/undefined. When you specify `null`, -// it prunes any unused items in the tree. I ran into some issues with it getting -// null vs undefined confused, so UNSET is just a bit that forces the property -// update to send `null`, removing the property explicitly rather than setting -// it to undefined. -var NONE = 0; -var NAME = 1; -var VALUE = 2; -var BOTH = 3; -var UNSET = 4; - -module.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 || ''; - - // Construct an index: - 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; - - // create the base array if necessary - if(!arr) { - if(!baseProp || changeType === UNSET) return; - - arr = []; - baseProp.set(arr); - } - - var idx = indexLookup[name]; - if(idx === undefined) { - 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 it's not an unset, force that bit to be unset. This is all related to the fact - // that undefined and null are a bit specially implemented in nestedProperties. - 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 === undefined) { - return undefined; - } else if(isSimpleValueProp) { - return arr[idx][valueName]; - } else { - return nestedProperty(arr[idx], valueName).get(); - } - }, - rename: function(name, newName) { - var idx = indexLookup[name]; - - if(idx === undefined) 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 === undefined) return obj; - - var object = arr[idx]; - if(Object.keys(object).length > 2) { - // This object contains more than just the key/value, so unset - // the value without modifying the entry otherwise: - 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 { - // Perform this update *strictly* so we can check whether the result's - // been pruned. If so, it's a removal. If not, it's a value unset only. - nestedProperty(object, valueName).set(null); - - // Now check if the top level nested property has any keys left. If so, - // the object still has values so we only want to unset the key. If not, - // the entire object can be removed since there's no other data. - // var topLevelKeys = Object.keys(object[valueName.split('.')[0]] || []); - - changeTypes[idx] = changeTypes[idx] | VALUE | UNSET; - } - - return obj; - }, - constructUpdate: function() { - var astr, idx; - var update = {}; - var changed = Object.keys(changeTypes); - for(var i = 0; i < changed.length; i++) { - idx = changed[i]; - 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; -}; - -},{"./nested_property":704}],699:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../registry'); - -/** - * localize: translate a string for the current locale - * - * @param {object} gd: the graphDiv for context - * gd._context.locale determines the language (& optional region/country) - * the dictionary for each locale may either be supplied in - * gd._context.locales or globally via Plotly.register - * @param {string} s: the string to translate - */ -module.exports = function localize(gd, s) { - var locale = gd._context.locale; - - /* - * Priority of lookup: - * contextDicts[locale], - * registeredDicts[locale], - * contextDicts[baseLocale], (if baseLocale is distinct) - * registeredDicts[baseLocale] - * Return the first translation we find. - * This way if you have a regionalization you are allowed to specify - * only what's different from the base locale, everything else will - * fall back on the base. - */ - for(var i = 0; i < 2; i++) { - var locales = gd._context.locales; - for(var j = 0; j < 2; j++) { - var dict = (locales[locale] || {}).dictionary; - if(dict) { - var out = dict[s]; - if(out) return out; - } - locales = Registry.localeRegistry; - } - - var baseLocale = locale.split('-')[0]; - if(baseLocale === locale) break; - locale = baseLocale; - } - - return s; -}; - -},{"../registry":827}],700:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/* eslint-disable no-console */ - -var config = _dereq_('../plot_api/plot_config'); - -var loggers = module.exports = {}; - -/** - * ------------------------------------------ - * debugging tools - * ------------------------------------------ - */ - -loggers.log = function() { - if(config.logging > 1) { - var messages = ['LOG:']; - - for(var i = 0; i < arguments.length; i++) { - messages.push(arguments[i]); - } - - apply(console.trace || console.log, messages); - } -}; - -loggers.warn = function() { - if(config.logging > 0) { - var messages = ['WARN:']; - - for(var i = 0; i < arguments.length; i++) { - messages.push(arguments[i]); - } - - apply(console.trace || console.log, messages); - } -}; - -loggers.error = function() { - if(config.logging > 0) { - var messages = ['ERROR:']; - - for(var i = 0; i < arguments.length; i++) { - messages.push(arguments[i]); - } - - apply(console.error, messages); - } -}; - -/* - * Robust apply, for IE9 where console.log doesn't support - * apply like other functions do - */ -function apply(f, args) { - if(f && f.apply) { - try { - // `this` should always be console, since here we're always - // applying a method of the console object. - f.apply(console, args); - return; - } - catch(e) { /* in case apply failed, fall back on the code below */ } - } - - // no apply - just try calling the function on each arg independently - for(var i = 0; i < args.length; i++) { - try { - f(args[i]); - } - catch(e) { - // still fails - last resort simple console.log - console.log(args[i]); - } - } -} - -},{"../plot_api/plot_config":732}],701:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -/** - * General helper to manage trace groups based on calcdata - * - * @param {d3.selection} traceLayer: a selection containing a single group - * to draw these traces into - * @param {array} cdModule: array of calcdata items for this - * module and subplot combination. Assumes the calcdata item for each - * trace is an array with the fullData trace attached to the first item. - * @param {string} cls: the class attribute to give each trace group - * so you can give multiple classes separated by spaces - */ -module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { - var traces = traceLayer.selectAll('g.' + cls.replace(/\s/g, '.')) - .data(cdModule, function(cd) { return cd[0].trace.uid; }); - - traces.exit().remove(); - - traces.enter().append('g') - .attr('class', cls); - - traces.order(); - - return traces; -}; - -},{}],702:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -exports.init2dArray = function(rowLength, colLength) { - var array = new Array(rowLength); - for(var i = 0; i < rowLength; i++) array[i] = new Array(colLength); - return array; -}; - -/** - * transpose a (possibly ragged) 2d array z. inspired by - * http://stackoverflow.com/questions/17428587/ - * transposing-a-2d-array-in-javascript - */ -exports.transposeRagged = function(z) { - var maxlen = 0, - zlen = z.length, - i, - j; - // Maximum row length: - 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; -}; - -// our own dot function so that we don't need to include numeric -exports.dot = function(x, y) { - if(!(x.length && y.length) || x.length !== y.length) return null; - - var len = x.length, - out, - i; - - if(x[0].length) { - // mat-vec or mat-mat - out = new Array(len); - for(i = 0; i < len; i++) out[i] = exports.dot(x[i], y); - } - else if(y[0].length) { - // vec-mat - var yTranspose = exports.transposeRagged(y); - out = new Array(yTranspose.length); - for(i = 0; i < yTranspose.length; i++) out[i] = exports.dot(x, yTranspose[i]); - } - else { - // vec-vec - out = 0; - for(i = 0; i < len; i++) out += x[i] * y[i]; - } - - return out; -}; - -// translate by (x,y) -exports.translationMatrix = function(x, y) { - return [[1, 0, x], [0, 1, y], [0, 0, 1]]; -}; - -// rotate by alpha around (0,0) -exports.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]]; -}; - -// rotate by alpha around (x,y) -exports.rotationXYMatrix = function(a, x, y) { - return exports.dot( - exports.dot(exports.translationMatrix(x, y), - exports.rotationMatrix(a)), - exports.translationMatrix(-x, -y)); -}; - -// applies a 2D transformation matrix to either x and y params or an [x,y] array -exports.apply2DTransform = function(transform) { - return function() { - var args = arguments; - if(args.length === 3) { - args = args[0]; - }// from map - var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; - return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); - }; -}; - -// applies a 2D transformation matrix to an [x1,y1,x2,y2] array (to transform a segment) -exports.apply2DTransform2 = function(transform) { - var at = exports.apply2DTransform(transform); - return function(xys) { - return at(xys.slice(0, 2)).concat(at(xys.slice(2, 4))); - }; -}; - -},{}],703:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * sanitized modulus function that always returns in the range [0, d) - * rather than (-d, 0] if v is negative - */ -function mod(v, d) { - var out = v % d; - return out < 0 ? out + d : out; -} - -/** - * sanitized modulus function that always returns in the range [-d/2, d/2] - * rather than (-d, 0] if v is negative - */ -function modHalf(v, d) { - return Math.abs(v) > (d / 2) ? - v - Math.round(v / d) * d : - v; -} - -module.exports = { - mod: mod, - modHalf: modHalf -}; - -},{}],704:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; - -/** - * convert a string s (such as 'xaxis.range[0]') - * representing a property of nested object into set and get methods - * also return the string and object so we don't have to keep track of them - * allows [-1] for an array index, to set a property inside all elements - * of an array - * eg if obj = {arr: [{a: 1}, {a: 2}]} - * you can do p = nestedProperty(obj, 'arr[-1].a') - * but you cannot set the array itself this way, to do that - * just set the whole array. - * eg if obj = {arr: [1, 2, 3]} - * you can't do nestedProperty(obj, 'arr[-1]').set(5) - * but you can do nestedProperty(obj, 'arr').set([5, 5, 5]) - */ -module.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 j = 0, - propParts = propStr.split('.'), - indexed, - indices, - i; - - // check for parts of the nesting hierarchy that are numbers (ie array elements) - while(j < propParts.length) { - // look for non-bracket chars, then any number of [##] blocks - indexed = String(propParts[j]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/); - if(indexed) { - if(indexed[1]) propParts[j] = indexed[1]; - // allow propStr to start with bracketed array indices - 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, - curPart, - allSame, - out, - i, - 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 undefined; - } - curCont = curCont[curPart]; - if(typeof curCont !== 'object' || curCont === null) { - return undefined; - } - } - - // only hit this if parts.length === 1 - if(typeof curCont !== 'object' || curCont === null) return undefined; - - out = curCont[parts[i]]; - if(out === null) return undefined; - return out; - }; -} - -/* - * Can this value be deleted? We can delete `undefined`, and `null` except INSIDE an - * *args* array. - * - * Previously we also deleted some `{}` and `[]`, in order to try and make set/unset - * a net noop; but this causes far more complication than it's worth, and still had - * lots of exceptions. See https://github.com/plotly/plotly.js/issues/1410 - * - * *args* arrays get passed directly to API methods and we should respect null if - * the user put it there, but otherwise null is deleted as we use it as code - * in restyle/relayout/update for "delete this value" whereas undefined means - * "ignore this edit" - */ -var ARGS_PATTERN = /(^|\.)args\[/; -function isDeletable(val, propStr) { - return (val === undefined) || (val === null && !propStr.match(ARGS_PATTERN)); -} - -function npSet(cont, parts, propStr) { - return function(val) { - var curCont = cont, - propPart = '', - containerLevels = [[cont, propPart]], - toDelete = isDeletable(val, propStr), - curPart, - 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'; - } - - // handle special -1 array index - 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]]; - - // The one bit of pruning we still do: drop `undefined` from the end of arrays. - // In case someone has already unset previous items, continue until we hit a - // non-undefined value. - if(Array.isArray(curCont) && +parts[i] === curCont.length - 1) { - while(curCont.length && curCont[curCont.length - 1] === undefined) { - 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; -} - -// handle special -1 array index -function setArrayAll(containerArray, innerParts, val, propStr) { - var arrayVal = isArrayOrTypedArray(val), - allSet = true, - thisVal = val, - thisPropStr = propStr.replace('-1', 0), - deleteThis = arrayVal ? false : isDeletable(val, thisPropStr), - firstPart = innerParts[0], - 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; -} - -/** - * make new sub-container as needed. - * returns false if there's no container and none is needed - * because we're only deleting an attribute - */ -function checkNewContainer(container, part, nextPart, toDelete) { - if(container[part] === undefined) { - 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 - }; -} - -},{"./array":678,"fast-isnumeric":214}],705:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -// Simple helper functions -// none of these need any external deps - -module.exports = function noop() {}; - -},{}],706:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var NOTEDATA = []; - -/** - * notifier - * @param {String} text The person's user name - * @param {Number} [delay=1000] The delay time in milliseconds - * or 'long' which provides 2000 ms delay time. - * @return {undefined} this function does not return a value - */ -module.exports = function(text, displayLength) { - if(NOTEDATA.indexOf(text) !== -1) return; - - NOTEDATA.push(text); - - var ts = 1000; - if(isNumeric(displayLength)) ts = displayLength; - else if(displayLength === 'long') ts = 3000; - - 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]); - } - - note.transition() - .duration(700) - .style('opacity', 1) - .transition() - .delay(ts) - .call(killNote); - }); -}; - -},{"d3":148,"fast-isnumeric":214}],707:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var setCursor = _dereq_('./setcursor'); - -var STASHATTR = 'data-savedcursor'; -var NO_CURSOR = '!!'; - -/* - * works with our CSS cursor classes (see css/_cursor.scss) - * to override a previous cursor set on d3 single-element selections, - * by moving the name of the original cursor to the data-savedcursor attr. - * omit cursor to revert to the previously set value. - */ -module.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); - } -}; - -},{"./setcursor":716}],708:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var dot = _dereq_('./matrix').dot; -var BADNUM = _dereq_('../constants/numerical').BADNUM; - -var polygon = module.exports = {}; - -/** - * Turn an array of [x, y] pairs into a polygon object - * that can test if points are inside it - * - * @param ptsIn Array of [x, y] pairs - * - * @returns polygon Object {xmin, xmax, ymin, ymax, pts, contains} - * (x|y)(min|max) are the bounding rect of the polygon - * pts is the original array, with the first pair repeated at the end - * contains is a function: (pt, omitFirstEdge) - * pt is the [x, y] pair to test - * omitFirstEdge truthy means points exactly on the first edge don't - * count. This is for use adding one polygon to another so we - * don't double-count the edge where they meet. - * returns boolean: is pt inside the polygon (including on its edges) - */ -polygon.tester = function tester(ptsIn) { - var pts = ptsIn.slice(), - xmin = pts[0][0], - xmax = xmin, - ymin = pts[0][1], - ymax = ymin, - i; - - 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]); - } - - // do we have a rectangle? Handle this here, so we can use the same - // tester for the rectangular case without sacrificing speed - - var isRect = false, - rectFirstEdgeTest; - - if(pts.length === 5) { - if(pts[0][0] === pts[1][0]) { // vert, horz, vert, horz - if(pts[2][0] === pts[3][0] && - pts[0][1] === pts[3][1] && - pts[1][1] === pts[2][1]) { - isRect = true; - rectFirstEdgeTest = function(pt) { return pt[0] === pts[0][0]; }; - } - } - else if(pts[0][1] === pts[1][1]) { // horz, vert, horz, vert - if(pts[2][1] === pts[3][1] && - pts[0][0] === pts[3][0] && - pts[1][0] === pts[2][0]) { - isRect = true; - rectFirstEdgeTest = function(pt) { return pt[1] === pts[0][1]; }; - } - } - } - - function rectContains(pt, omitFirstEdge) { - var x = pt[0], - y = pt[1]; - - if(x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { - // pt is outside the bounding box of polygon - return false; - } - if(omitFirstEdge && rectFirstEdgeTest(pt)) return false; - - return true; - } - - function contains(pt, omitFirstEdge) { - var x = pt[0], - y = pt[1]; - - if(x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { - // pt is outside the bounding box of polygon - return false; - } - - var imax = pts.length, - x1 = pts[0][0], - y1 = pts[0][1], - crossings = 0, - i, - x0, - y0, - xmini, - ycross; - - for(i = 1; i < imax; i++) { - // find all crossings of a vertical line upward from pt with - // polygon segments - // crossings exactly at xmax don't count, unless the point is - // exactly on the segment, then it counts as inside. - x0 = x1; - y0 = y1; - x1 = pts[i][0]; - y1 = pts[i][1]; - xmini = Math.min(x0, x1); - - // outside the bounding box of this segment, it's only a crossing - // if it's below the box. - if(x < xmini || x > Math.max(x0, x1) || y > Math.max(y0, y1)) { - continue; - } - else if(y < Math.min(y0, y1)) { - // don't count the left-most point of the segment as a crossing - // because we don't want to double-count adjacent crossings - // UNLESS the polygon turns past vertical at exactly this x - // Note that this is repeated below, but we can't factor it out - // because - if(x !== xmini) crossings++; - } - // inside the bounding box, check the actual line intercept - else { - // vertical segment - we know already that the point is exactly - // on the segment, so mark the crossing as exactly at the point. - if(x1 === x0) ycross = y; - // any other angle - else ycross = y0 + (x - x0) * (y1 - y0) / (x1 - x0); - - // exactly on the edge: counts as inside the polygon, unless it's the - // first edge and we're omitting it. - if(y === ycross) { - if(i === 1 && omitFirstEdge) return false; - return true; - } - - if(y <= ycross && x !== xmini) crossings++; - } - } - - // if we've gotten this far, odd crossings means inside, even is outside - return crossings % 2 === 1; - } - - // detect if poly is degenerate - 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: xmin, - xmax: xmax, - ymin: ymin, - ymax: ymax, - pts: pts, - contains: isRect ? rectContains : contains, - isRect: isRect, - degenerate: degenerate - }; -}; - -/** - * Test if a segment of a points array is bent or straight - * - * @param pts Array of [x, y] pairs - * @param start the index of the proposed start of the straight section - * @param end the index of the proposed end point - * @param tolerance the max distance off the line connecting start and end - * before the line counts as bent - * @returns boolean: true means this segment is bent, false means straight - */ -var isBent = polygon.isSegmentBent = function isBent(pts, start, end, tolerance) { - var startPt = pts[start], - segment = [pts[end][0] - startPt[0], pts[end][1] - startPt[1]], - segmentSquared = dot(segment, segment), - segmentLen = Math.sqrt(segmentSquared), - unitPerp = [-segment[1] / segmentLen, segment[0] / segmentLen], - i, - part, - 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; -}; - -/** - * Make a filtering polygon, to minimize the number of segments - * - * @param pts Array of [x, y] pairs (must start with at least 1 pair) - * @param tolerance the maximum deviation from straight allowed for - * removing points to simplify the polygon - * - * @returns Object {addPt, raw, filtered} - * addPt is a function(pt: [x, y] pair) to add a raw point and - * continue filtering - * raw is all the input points - * filtered is the resulting filtered Array of [x, y] pairs - */ -polygon.filter = function filter(pts, tolerance) { - var ptsFiltered = [pts[0]], - doneRawIndex = 0, - doneFilteredIndex = 0; - - function addPt(pt) { - pts.push(pt); - var prevFilterLen = ptsFiltered.length, - iLast = doneRawIndex; - ptsFiltered.splice(doneFilteredIndex + 1); - - for(var i = iLast + 1; i < pts.length; i++) { - if(i === pts.length - 1 || isBent(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: addPt, - raw: pts, - filtered: ptsFiltered - }; -}; - -},{"../constants/numerical":673,"./matrix":702}],709:[function(_dereq_,module,exports){ -(function (global){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var showNoWebGlMsg = _dereq_('./show_no_webgl_msg'); - -// Note that this module should be ONLY required into -// files corresponding to regl trace modules -// so that bundles with non-regl only don't include -// regl and all its bytes. -var createRegl = _dereq_('regl'); - -/** - * Idempotent version of createRegl. Create regl instances - * in the correct canvases with the correct attributes and - * options - * - * @param {DOM node or object} gd : graph div object - * @param {array} extensions : list of extension to pass to createRegl - * - * @return {boolean} true if all createRegl calls succeeded, false otherwise - */ -module.exports = function prepareRegl(gd, extensions) { - var fullLayout = gd._fullLayout; - var success = true; - - fullLayout._glcanvas.each(function(d) { - if(d.regl) return; - // only parcoords needs pick layer - if(d.pick && !fullLayout._has('parcoords')) return; - - try { - d.regl = createRegl({ - canvas: this, - attributes: { - antialias: !d.pick, - preserveDrawingBuffer: true - }, - pixelRatio: gd._context.plotGlPixelRatio || global.devicePixelRatio, - extensions: extensions || [] - }); - } catch(e) { - success = false; - } - - if(success) { - this.addEventListener('webglcontextlost', function(event) { - if(gd && gd.emit) { - gd.emit('plotly_webglcontextlost', { - event: event, - layer: d.key - }); - } - }, false); - } - }); - - if(!success) { - showNoWebGlMsg({container: fullLayout._glcontainer.node()}); - } - return success; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./show_no_webgl_msg":717,"regl":478}],710:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * Push array with unique items - * - * Ignores falsy items, except 0 so we can use it to construct arrays of indices. - * - * @param {array} array - * array to be filled - * @param {any} item - * item to be or not to be inserted - * @return {array} - * ref to array (now possibly containing one more item) - * - */ -module.exports = function pushUnique(array, item) { - if(item instanceof RegExp) { - var itemStr = item.toString(), - i; - for(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; -}; - -},{}],711:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../lib'); -var config = _dereq_('../plot_api/plot_config'); - - -/** - * Copy arg array *without* removing `undefined` values from objects. - * - * @param gd - * @param args - * @returns {Array} - */ -function copyArgArray(gd, args) { - var copy = []; - var arg; - - for(var i = 0; i < args.length; i++) { - arg = args[i]; - - if(arg === gd) 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; -} - - -// ----------------------------------------------------- -// Undo/Redo queue for plots -// ----------------------------------------------------- - - -var queue = {}; - -// TODO: disable/enable undo and redo buttons appropriately - -/** - * Add an item to the undoQueue for a graphDiv - * - * @param gd - * @param undoFunc Function undo this operation - * @param undoArgs Args to supply undoFunc with - * @param redoFunc Function to redo this operation - * @param redoArgs Args to supply redoFunc with - */ -queue.add = function(gd, undoFunc, undoArgs, redoFunc, redoArgs) { - var queueObj, - queueIndex; - - // make sure we have the queue and our position in it - gd.undoQueue = gd.undoQueue || {index: 0, queue: [], sequence: false}; - queueIndex = gd.undoQueue.index; - - // if we're already playing an undo or redo, or if this is an auto operation - // (like pane resize... any others?) then we don't save this to the undo queue - if(gd.autoplay) { - if(!gd.undoQueue.inSequence) gd.autoplay = false; - return; - } - - // if we're not in a sequence or are just starting, we need a new queue item - if(!gd.undoQueue.sequence || gd.undoQueue.beginSequence) { - queueObj = {undo: {calls: [], args: []}, redo: {calls: [], args: []}}; - gd.undoQueue.queue.splice(queueIndex, gd.undoQueue.queue.length - queueIndex, queueObj); - gd.undoQueue.index += 1; - } else { - queueObj = gd.undoQueue.queue[queueIndex - 1]; - } - gd.undoQueue.beginSequence = false; - - // we unshift to handle calls for undo in a forward for loop later - if(queueObj) { - queueObj.undo.calls.unshift(undoFunc); - queueObj.undo.args.unshift(undoArgs); - queueObj.redo.calls.push(redoFunc); - queueObj.redo.args.push(redoArgs); - } - - if(gd.undoQueue.queue.length > config.queueLength) { - gd.undoQueue.queue.shift(); - gd.undoQueue.index--; - } -}; - -/** - * Begin a sequence of undoQueue changes - * - * @param gd - */ -queue.startSequence = function(gd) { - gd.undoQueue = gd.undoQueue || {index: 0, queue: [], sequence: false}; - gd.undoQueue.sequence = true; - gd.undoQueue.beginSequence = true; -}; - -/** - * Stop a sequence of undoQueue changes - * - * Call this *after* you're sure your undo chain has ended - * - * @param gd - */ -queue.stopSequence = function(gd) { - gd.undoQueue = gd.undoQueue || {index: 0, queue: [], sequence: false}; - gd.undoQueue.sequence = false; - gd.undoQueue.beginSequence = false; -}; - -/** - * Move one step back in the undo queue, and undo the object there. - * - * @param gd - */ -queue.undo = function undo(gd) { - var queueObj, i; - - if(gd.framework && gd.framework.isPolar) { - gd.framework.undo(); - return; - } - if(gd.undoQueue === undefined || - isNaN(gd.undoQueue.index) || - gd.undoQueue.index <= 0) { - return; - } - - // index is pointing to next *forward* queueObj, point to the one we're undoing - gd.undoQueue.index--; - - // get the queueObj for instructions on how to undo - queueObj = gd.undoQueue.queue[gd.undoQueue.index]; - - // this sequence keeps things from adding to the queue during undo/redo - gd.undoQueue.inSequence = true; - for(i = 0; i < queueObj.undo.calls.length; i++) { - queue.plotDo(gd, queueObj.undo.calls[i], queueObj.undo.args[i]); - } - gd.undoQueue.inSequence = false; - gd.autoplay = false; -}; - -/** - * Redo the current object in the undo, then move forward in the queue. - * - * @param gd - */ -queue.redo = function redo(gd) { - var queueObj, i; - - if(gd.framework && gd.framework.isPolar) { - gd.framework.redo(); - return; - } - if(gd.undoQueue === undefined || - isNaN(gd.undoQueue.index) || - gd.undoQueue.index >= gd.undoQueue.queue.length) { - return; - } - - // get the queueObj for instructions on how to undo - queueObj = gd.undoQueue.queue[gd.undoQueue.index]; - - // this sequence keeps things from adding to the queue during undo/redo - gd.undoQueue.inSequence = true; - for(i = 0; i < queueObj.redo.calls.length; i++) { - queue.plotDo(gd, queueObj.redo.calls[i], queueObj.redo.args[i]); - } - gd.undoQueue.inSequence = false; - gd.autoplay = false; - - // index is pointing to the thing we just redid, move it - gd.undoQueue.index++; -}; - -/** - * Called by undo/redo to make the actual changes. - * - * Not meant to be called publically, but included for mocking out in tests. - * - * @param gd - * @param func - * @param args - */ -queue.plotDo = function(gd, func, args) { - gd.autoplay = true; - - // this *won't* copy gd and it preserves `undefined` properties! - args = copyArgArray(gd, args); - - // call the supplied function - func.apply(null, args); -}; - -module.exports = queue; - -},{"../lib":696,"../plot_api/plot_config":732}],712:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/* - * make a regex for matching counter ids/names ie xaxis, xaxis2, xaxis10... - * - * @param {string} head: the head of the pattern, eg 'x' matches 'x', 'x2', 'x10' etc. - * 'xy' is a special case for cartesian subplots: it matches 'x2y3' etc - * @param {Optional(string)} tail: a fixed piece after the id - * eg counterRegex('scene', '.annotations') for scene2.annotations etc. - * @param {boolean} openEnded: if true, the string may continue past the match. - */ -exports.counter = function(head, tail, openEnded) { - var fullTail = (tail || '') + (openEnded ? '' : '$'); - if(head === 'xy') { - return new RegExp('^x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?' + fullTail); - } - return new RegExp('^' + head + '([2-9]|[1-9][0-9]+)?' + fullTail); -}; - -},{}],713:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -// ASCEND: chop off the last nesting level - either [] or . - to ascend -// the attribute tree. the remaining attrString is in match[1] -var ASCEND = /^(.*)(\.[^\.\[\]]+|\[\d\])$/; - -// SIMPLEATTR: is this an un-nested attribute? (no dots or brackets) -var SIMPLEATTR = /^[^\.\[\]]+$/; - -/* - * calculate a relative attribute string, similar to a relative path - * - * @param {string} baseAttr: - * an attribute string, such as 'annotations[3].x'. The "current location" - * is the attribute string minus the last component ('annotations[3]') - * @param {string} relativeAttr: - * a route to the desired attribute string, using '^' to ascend - * - * @return {string} attrString: - * for example: - * relativeAttr('annotations[3].x', 'y') = 'annotations[3].y' - * relativeAttr('annotations[3].x', '^[2].z') = 'annotations[2].z' - * relativeAttr('annotations[3].x', '^^margin') = 'margin' - * relativeAttr('annotations[3].x', '^^margin.r') = 'margin.r' - */ -module.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; -}; - -},{}],714:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; -var isPlainObject = _dereq_('./is_plain_object'); - -/** - * Relink private _keys and keys with a function value from one container - * to the new container. - * Relink means copying if object is pass-by-value and adding a reference - * if object is pass-by-ref. - * This prevents deepCopying massive structures like a webgl context. - */ -module.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 it already exists at this point, it's something - // that we recreate each time around, so ignore it - if(k in toContainer) continue; - - toContainer[k] = fromVal; - } - else if(isArrayOrTypedArray(fromVal) && isArrayOrTypedArray(toVal) && isPlainObject(fromVal[0])) { - - // filter out data_array items that can contain user objects - // most of the time the toVal === fromVal check will catch these early - // but if the user makes new ones we also don't want to recurse in. - if(k === 'customdata' || k === 'ids') continue; - - // recurse into arrays containers - 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)) { - - // recurse into objects, but only if they still exist - relinkPrivateKeys(toVal, fromVal); - - if(!Object.keys(toVal).length) delete toContainer[k]; - } - } -}; - -},{"./array":678,"./is_plain_object":697}],715:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var loggers = _dereq_('./loggers'); -var identity = _dereq_('./identity'); - -// don't trust floating point equality - fraction of bin size to call -// "on the line" and ensure that they go the right way specified by -// linelow -var roundingError = 1e-9; - - -/** - * findBin - find the bin for val - note that it can return outside the - * bin range any pos. or neg. integer for linear bins, or -1 or - * bins.length-1 for explicit. - * bins is either an object {start,size,end} or an array length #bins+1 - * bins can be either increasing or decreasing but must be monotonic - * for linear bins, we can just calculate. For listed bins, run a binary - * search linelow (truthy) says the bin boundary should be attributed to - * the lower bin rather than the default upper bin - */ -exports.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 n1 = 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); - // c is just to avoid infinite loops if there's an error - while(n1 < n2 && c++ < 100) { - n = Math.floor((n1 + n2) / 2); - if(test(bins[n], val)) n1 = n + 1; - else n2 = n; - } - if(c > 90) loggers.log('Long binary search...'); - return n1 - 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; } - -exports.sorterAsc = function(a, b) { return a - b; }; -exports.sorterDes = function(a, b) { return b - a; }; - -/** - * find distinct values in an array, lumping together ones that appear to - * just be off by a rounding error - * return the distinct values and the minimum difference between any two - */ -exports.distinctVals = function(valsIn) { - var vals = valsIn.slice(); // otherwise we sort the original array... - vals.sort(exports.sorterAsc); - - var l = vals.length - 1, - minDiff = (vals[l] - vals[0]) || 1, - errDiff = minDiff / (l || 1) / 10000, - v2 = [vals[0]]; - - for(var i = 0; i < l; i++) { - // make sure values aren't just off by a rounding error - if(vals[i + 1] > vals[i] + errDiff) { - minDiff = Math.min(minDiff, vals[i + 1] - vals[i]); - v2.push(vals[i + 1]); - } - } - - return {vals: v2, minDiff: minDiff}; -}; - -/** - * return the smallest element from (sorted) array arrayIn that's bigger than val, - * or (reverse) the largest element smaller than val - * used to find the best tick given the minimum (non-rounded) tick - * particularly useful for date/time where things are not powers of 10 - * binary search is probably overkill here... - */ -exports.roundUp = function(val, arrayIn, reverse) { - var low = 0, - high = arrayIn.length - 1, - mid, - c = 0, - dlow = reverse ? 0 : 1, - dhigh = reverse ? 1 : 0, - rounded = reverse ? Math.ceil : Math.floor; - // c is just to avoid infinite loops if there's an error - while(low < high && c++ < 100) { - mid = rounded((low + high) / 2); - if(arrayIn[mid] <= val) low = mid + dlow; - else high = mid - dhigh; - } - return arrayIn[low]; -}; - -/** - * Tweak to Array.sort(sortFn) that improves performance for pre-sorted arrays - * - * Note that newer browsers (such as Chrome v70+) are starting to pick up - * on pre-sorted arrays which may render the following optimization unnecessary - * in the future. - * - * Motivation: sometimes we need to sort arrays but the input is likely to - * already be sorted. Browsers don't seem to pick up on pre-sorted arrays, - * and in fact Chrome is actually *slower* sorting pre-sorted arrays than purely - * random arrays. FF is at least faster if the array is pre-sorted, but still - * not as fast as it could be. - * Here's how this plays out sorting a length-1e6 array: - * - * Calls to Sort FN | Chrome bare | FF bare | Chrome tweak | FF tweak - * | v68.0 Mac | v61.0 Mac| | - * ------------------+---------------+-----------+----------------+------------ - * ordered | 30.4e6 | 10.1e6 | 1e6 | 1e6 - * reversed | 29.4e6 | 9.9e6 | 1e6 + reverse | 1e6 + reverse - * random | ~21e6 | ~18.7e6 | ~21e6 | ~18.7e6 - * - * So this is a substantial win for pre-sorted (ordered or exactly reversed) - * arrays. Including this wrapper on an unsorted array adds a penalty that will - * in general be only a few calls to the sort function. The only case this - * penalty will be significant is if the array is mostly sorted but there are - * a few unsorted items near the end, but the penalty is still at most N calls - * out of (for N=1e6) ~20N total calls - * - * @param {Array} array: the array, to be sorted in place - * @param {function} sortFn: As in Array.sort, function(a, b) that puts - * item a before item b if the return is negative, a after b if positive, - * and no change if zero. - * @return {Array}: the original array, sorted in place. - */ -exports.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(); -}; - -/** - * find index in array 'arr' that minimizes 'fn' - * - * @param {array} arr : array where to search - * @param {fn (optional)} fn : function to minimize, - * if not given, fn is the identity function - * @return {integer} - */ -exports.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; -}; - -},{"./identity":695,"./loggers":700,"fast-isnumeric":214}],716:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -// works with our CSS cursor classes (see css/_cursor.scss) -// to apply cursors to d3 single-element selections. -// omit cursor to revert to the default. -module.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); -}; - -},{}],717:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Color = _dereq_('../components/color'); - -var noop = function() {}; - - -/** - * Prints a no webgl error message into the scene container - * @param {scene instance} scene - * - * Expects 'scene' to have property 'container' - * - */ -module.exports = function showNoWebGlMsg(scene) { - for(var prop in scene) { - if(typeof scene[prop] === 'function') scene[prop] = noop; - } - - scene.destroy = function() { - scene.container.parentNode.removeChild(scene.container); - }; - - var div = document.createElement('div'); - div.className = 'no-webgl'; - div.style.cursor = 'pointer'; - div.style.fontSize = '24px'; - div.style.color = Color.defaults[0]; - div.style.position = 'absolute'; - div.style.left = div.style.top = '0px'; - div.style.width = div.style.height = '100%'; - div.style['background-color'] = Color.lightLine; - div.style['z-index'] = 30; - - var p = document.createElement('p'); - p.textContent = 'WebGL is not supported by your browser - visit https://get.webgl.org for more info'; - p.style.position = 'relative'; - p.style.top = '50%'; - p.style.left = '50%'; - p.style.height = '30%'; - p.style.width = '50%'; - p.style.margin = '-15% 0 0 -25%'; - - div.appendChild(p); - scene.container.appendChild(div); - scene.container.style.background = '#FFFFFF'; - scene.container.onclick = function() { - window.open('https://get.webgl.org'); - }; - - // return before setting up camera and onrender methods - return false; -}; - -},{"../components/color":570}],718:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; - -/** - * aggNums() returns the result of an aggregate function applied to an array of - * values, where non-numerical values have been tossed out. - * - * @param {function} f - aggregation function (e.g., Math.min) - * @param {Number} v - initial value (continuing from previous calls) - * if there's no continuing value, use null for selector-type - * functions (max,min), or 0 for summations - * @param {Array} a - array to aggregate (may be nested, we will recurse, - * but all elements must have the same dimension) - * @param {Number} len - maximum length of a to aggregate - * @return {Number} - result of f applied to a starting from v - */ -exports.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] = exports.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; -}; - -/** - * mean & std dev functions using aggNums, so it handles non-numerics nicely - * even need to use aggNums instead of .length, to toss out non-numerics - */ -exports.len = function(data) { - return exports.aggNums(function(a) { return a + 1; }, 0, data); -}; - -exports.mean = function(data, len) { - if(!len) len = exports.len(data); - return exports.aggNums(function(a, b) { return a + b; }, 0, data) / len; -}; - -exports.midRange = function(numArr) { - if(numArr === undefined || numArr.length === 0) return undefined; - return (exports.aggNums(Math.max, null, numArr) + exports.aggNums(Math.min, null, numArr)) / 2; -}; - -exports.variance = function(data, len, mean) { - if(!len) len = exports.len(data); - if(!isNumeric(mean)) mean = exports.mean(data, len); - - return exports.aggNums(function(a, b) { - return a + Math.pow(b - mean, 2); - }, 0, data) / len; -}; - -exports.stdev = function(data, len, mean) { - return Math.sqrt(exports.variance(data, len, mean)); -}; - -/** - * interp() computes a percentile (quantile) for a given distribution. - * We interpolate the distribution (to compute quantiles, we follow method #10 here: - * http://www.amstat.org/publications/jse/v14n3/langford.html). - * Typically the index or rank (n * arr.length) may be non-integer. - * For reference: ends are clipped to the extreme values in the array; - * For box plots: index you get is half a point too high (see - * http://en.wikipedia.org/wiki/Percentile#Nearest_rank) but note that this definition - * indexes from 1 rather than 0, so we subtract 1/2 (instead of add). - * - * @param {Array} arr - This array contains the values that make up the distribution. - * @param {Number} n - Between 0 and 1, n = p/100 is such that we compute the p^th percentile. - * For example, the 50th percentile (or median) corresponds to n = 0.5 - * @return {Number} - percentile - */ -exports.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)]; -}; - -},{"./array":678,"fast-isnumeric":214}],719:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var rgba = _dereq_('color-normalize'); - -function str2RgbaArray(color) { - if(!color) return [0, 0, 0, 1]; - return rgba(color); -} - -module.exports = str2RgbaArray; - -},{"color-normalize":108}],720:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -/* global MathJax:false */ - -var d3 = _dereq_('d3'); - -var Lib = _dereq_('../lib'); -var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); -var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; - -// text converter - -function getSize(_selection, _dimension) { - return _selection.node().getBoundingClientRect()[_dimension]; -} - -var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; - -exports.convertToTspans = function(_context, gd, _callback) { - var str = _context.text(); - - // Until we get tex integrated more fully (so it can be used along with non-tex) - // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!_context.attr('data-notex')) && - (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) { - // at least in Chrome, pointer-events does not seem - // to be honored in children of elements - // so if we have an anchor, we have to make the - // whole element respond - _context.style('pointer-events', 'all'); - } - - exports.positionText(_context); - - if(_callback) _callback.call(_context); - } - - if(tex) { - ((gd && gd._promises) || []).push(new Promise(function(resolve) { - _context.style('display', 'none'); - var fontSize = parseInt(_context.node().style.fontSize, 10); - var config = {fontSize: 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()); - - // stitch the glyph defs - if(_glyphDefs && _glyphDefs.node()) { - newSvg.node().insertBefore(_glyphDefs.node().cloneNode(true), - newSvg.node().firstChild); - } - - newSvg.attr({ - 'class': svgClass, - height: _svgBBox.height, - preserveAspectRatio: 'xMinYMin meet' - }) - .style({overflow: 'visible', 'pointer-events': 'none'}); - - var fill = _context.node().style.fill || 'black'; - newSvg.select('g').attr({fill: fill, stroke: fill}); - - var newSvgW = getSize(newSvg, 'width'), - newSvgH = getSize(newSvg, 'height'), - newX = +_context.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], - // font baseline is about 1/4 fontSize below centerline - textHeight = fontSize || getSize(_context, 'height'), - dy = -textHeight / 4; - - if(svgClass[0] === 'y') { - mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' - }); - newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); - } - else if(svgClass[0] === 'l') { - newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); - } - else if(svgClass[0] === 'a') { - newSvg.attr({x: 0, y: dy}); - } - else { - newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); - } - - if(_callback) _callback.call(_context, mathjaxGroup); - resolve(mathjaxGroup); - }); - })); - } - else showText(); - - return _context; -}; - - -// MathJax - -var LT_MATCH = /(<|<|<)/g; -var GT_MATCH = /(>|>|>)/g; - -function cleanEscapesForTex(s) { - return s.replace(LT_MATCH, '\\lt ') - .replace(GT_MATCH, '\\gt '); -} - -function texToSVG(_texString, _config, _callback) { - - var originalRenderer, - originalConfig, - originalProcessSectionDelay, - tmpDiv; - - MathJax.Hub.Queue( - function() { - originalConfig = Lib.extendDeepAll({}, MathJax.Hub.config); - - originalProcessSectionDelay = MathJax.Hub.processSectionDelay; - if(MathJax.Hub.processSectionDelay !== undefined) { - // MathJax 2.5+ - MathJax.Hub.processSectionDelay = 0; - } - - return MathJax.Hub.Config({ - messageStyle: 'none', - tex2jax: { - inlineMath: [['$', '$'], ['\\(', '\\)']] - }, - displayAlign: 'left', - }); - }, - function() { - // Get original renderer - originalRenderer = MathJax.Hub.config.menuSettings.renderer; - if(originalRenderer !== 'SVG') { - return MathJax.Hub.setRenderer('SVG'); - } - }, - function() { - var randomID = 'math-output-' + Lib.randstr({}, 64); - tmpDiv = d3.select('body').append('div') - .attr({id: randomID}) - .style({visibility: 'hidden', position: 'absolute'}) - .style({'font-size': _config.fontSize + 'px'}) - .text(cleanEscapesForTex(_texString)); - - return MathJax.Hub.Typeset(tmpDiv.node()); - }, - function() { - var glyphDefs = d3.select('body').select('#MathJax_SVG_glyphs'); - - if(tmpDiv.select('.MathJax_SVG').empty() || !tmpDiv.select('svg').node()) { - Lib.log('There was an error in the tex syntax.', _texString); - _callback(); - } - else { - var svgBBox = tmpDiv.select('svg').node().getBoundingClientRect(); - _callback(tmpDiv.select('.MathJax_SVG'), glyphDefs, svgBBox); - } - - tmpDiv.remove(); - - if(originalRenderer !== 'SVG') { - return MathJax.Hub.setRenderer(originalRenderer); - } - }, - function() { - if(originalProcessSectionDelay !== undefined) { - MathJax.Hub.processSectionDelay = originalProcessSectionDelay; - } - return MathJax.Hub.Config(originalConfig); - }); -} - -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%', - b: 'font-weight:bold', - i: 'font-style:italic', - a: 'cursor:pointer', - span: '', - em: 'font-style:italic;font-weight:bold' -}; - -// baseline shifts for sub and sup -var SHIFT_DY = { - sub: '0.3em', - sup: '-0.6em' -}; -// reset baseline by adding a tspan (empty except for a zero-width space) -// with dy of -70% * SHIFT_DY (because font-size=70%) -var RESET_DY = { - sub: '-0.21em', - sup: '0.42em' -}; -var ZERO_WIDTH_SPACE = '\u200b'; - -/* - * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript - * and related attack vectors. The empty items are there for IE, that in various - * versions treats relative paths as having different flavors of no protocol, while - * other browsers have these explicitly inherit the protocol of the page they're in. - */ -var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; - -var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); - -var NEWLINES = /(\r\n?|\n)/g; - -var SPLIT_TAGS = /(<[^<>]*>)/; - -var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; - -var BR_TAG = //i; - -/* - * style and href: pull them out of either single or double quotes. Also - * - target: (_blank|_self|_parent|_top|framename) - * note that you can't use target to get a popup but if you use popup, - * a `framename` will be passed along as the name of the popup window. - * per the spec, cannot contain whitespace. - * for backward compatibility we default to '_blank' - * - popup: a custom one for us to enable popup (new window) links. String - * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' - * note that at least in Chrome, you need to give at least one property - * in this string or the page will open in a new tab anyway. We follow this - * convention and will not make a popup if this string is empty. - * per the spec, cannot contain whitespace. - * - * Because we hack in other attributes with style (sub & sup), drop any trailing - * semicolon in user-supplied styles so we can consistently append the tag-dependent style - * - * These are for tag attributes; Chrome anyway will convert entities in - * attribute values, but not in attribute names - * you can test this by for example: - * > p = document.createElement('p') - * > p.innerHTML = 'Hi' - * > p.innerHTML - * <- 'Hi' - */ -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; - -// dedicated matcher for these quoted regexes, that can return their results -// in two different places -function getQuotedMatch(_str, re) { - if(!_str) return null; - var match = _str.match(re); - var result = match && (match[3] || match[4]); - return result && convertEntities(result); -} - -var COLORMATCH = /(^|;)\s*color:/; - -exports.plainText = function(_str) { - // strip out our pseudo-html so we have a readable - // version to put into text fields - return (_str || '').replace(STRIP_TAGS, ' '); -}; - -/* - * N.B. HTML entities are listed without the leading '&' and trailing ';' - * https://www.freeformatter.com/html-entities.html - * - * FWIW if we wanted to support the full set, it has 2261 entries: - * https://www.w3.org/TR/html5/entities.json - * though I notice that some of these are duplicates and/or are missing ";" - * eg: "&", "&", "&", and "&" all map to "&" - * We no longer need to include numeric entities here, these are now handled - * by String.fromCodePoint/fromCharCode - * - * Anyway the only ones that are really important to allow are the HTML special - * chars <, >, and &, because these ones can trigger special processing if not - * replaced by the corresponding entity. - */ -var entityToUnicode = { - mu: 'μ', - amp: '&', - lt: '<', - gt: '>', - nbsp: ' ', - times: '×', - plusmn: '±', - deg: '°' -}; - -// NOTE: in general entities can contain uppercase too (so [a-zA-Z]) but all the -// ones we support use only lowercase. If we ever change that, update the regex. -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) === '#') { - // cannot use String.fromCodePoint in IE - outChar = fromCodePoint( - innerMatch.charAt(1) === 'x' ? - parseInt(innerMatch.substr(2), 16) : - parseInt(innerMatch.substr(1), 10) - ); - } - else outChar = entityToUnicode[innerMatch]; - - // as in regular HTML, if we didn't decode the entity just - // leave the raw text in place. - return outChar || fullMatch; - }); -} -exports.convertEntities = convertEntities; - -function fromCodePoint(code) { - // Don't allow overflow. In Chrome this turns into � but I feel like it's - // more useful to just not convert it at all. - if(code > 0x10FFFF) return; - var stringFromCodePoint = String.fromCodePoint; - if(stringFromCodePoint) return stringFromCodePoint(code); - - // IE doesn't have String.fromCodePoint - // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint - var stringFromCharCode = String.fromCharCode; - if(code <= 0xFFFF) return stringFromCharCode(code); - return stringFromCharCode( - (code >> 10) + 0xD7C0, - (code % 0x400) + 0xDC00 - ); -} - -/* - * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these - * to containerNode - * - * @param {svg text element} containerNode: the node to insert this text into - * @param {string} str: the pseudo-html string to convert to svg - * - * @returns {bool}: does the result contain any links? We need to handle the text element - * somewhat differently if it does, so just keep track of this when it happens. - */ -function buildSVGText(containerNode, str) { - /* - * Normalize behavior between IE and others wrt newlines and whitespace:pre - * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 - * Chrome and FF display \n, \r, or \r\n as a space in this mode. - * I feel like at some point we turned these into
but currently we don't so - * I'm just going to cement what we do now in Chrome and FF - */ - str = str.replace(NEWLINES, ' '); - - var hasLink = false; - - // as we're building the text, keep track of what elements we're nested inside - // nodeStack will be an array of {node, type, style, href, target, popup} - // where only type: 'a' gets the last 3 and node is only added when it's created - 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 i = 1; i < oldNodeStack.length; i++) { - enterNode(oldNodeStack[i]); - } - } - } - - function enterNode(nodeSpec) { - var type = nodeSpec.type; - var nodeAttrs = {}; - var nodeType; - - if(type === 'a') { - nodeType = 'a'; - var target = nodeSpec.target; - var href = nodeSpec.href; - var popup = nodeSpec.popup; - if(href) { - nodeAttrs = { - 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', - target: target, - 'xlink:xlink:href': href - }; - if(popup) { - // security: href and target are not inserted as code but - // as attributes. popup is, but limited to /[A-Za-z0-9_=,]/ - nodeAttrs.onclick = 'window.open(this.href.baseVal,this.target.baseVal,"' + - popup + '");return false;'; - } - } - } - else nodeType = 'tspan'; - - if(nodeSpec.style) nodeAttrs.style = nodeSpec.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 = nodeSpec.node = newNode; - nodeStack.push(nodeSpec); - } - - function addTextNode(node, text) { - node.appendChild(document.createTextNode(text)); - } - - function exitNode(type) { - // A bare closing tag can't close the root node. If we encounter this it - // means there's an extra closing tag that can just be ignored: - 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 === undefined) { - addTextNode(currentNode, convertEntities(parti)); - } - else { - // tag - open or close - if(match[1]) { - exitNode(tagType); - } - else { - var extra = match[4]; - - var nodeSpec = {type: tagType}; - - // now add style, from both the tag name and any extra css - // Most of the svg css that users will care about is just like html, - // but font color is different (uses fill). Let our users ignore this. - 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) { - // check safe protocols - var dummyAnchor = document.createElement('a'); - dummyAnchor.href = href; - if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { - // Decode href to allow both already encoded and not encoded - // URIs. Without decoding prior encoding, an already encoded - // URI would be encoded twice producing a semantically different URI. - nodeSpec.href = encodeURI(decodeURI(href)); - nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; - nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); - } - } - } - - enterNode(nodeSpec); - } - } - } - - return hasLink; -} - -exports.lineCount = function lineCount(s) { - return s.selectAll('tspan.line').size() || 1; -}; - -exports.positionText = function positionText(s, x, y) { - return s.each(function() { - var text = d3.select(this); - - function setOrGet(attr, val) { - if(val === undefined) { - 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, - alignV = options.verticalAlign || 'top', - bRect = _base.node().getBoundingClientRect(), - cRect = container.node().getBoundingClientRect(), - thisRect, - getTop, - 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 { // default: top - 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 { // default: left - getLeft = function() { return bRect.left; }; - } - - return function() { - thisRect = this.node().getBoundingClientRect(); - this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', - 'z-index': 1000 - }); - return this; - }; -} - -/* - * Editable title - * @param {d3.selection} context: the element being edited. Normally text, - * but if it isn't, you should provide the styling options - * @param {object} options: - * @param {div} options.gd: graphDiv - * @param {d3.selection} options.delegate: item to bind events to if not this - * @param {boolean} options.immediate: start editing now (true) or on click (false, default) - * @param {string} options.fill: font color if not as shown - * @param {string} options.background: background color if not as shown - * @param {string} options.text: initial text, if not as shown - * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element - * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element - */ - -exports.makeEditable = function(context, options) { - var gd = 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}); - // also hide any mathjax svg - var svgClass = handlerElement.attr('class'), - 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(gd); - 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 === undefined) 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() { - gd._editing = false; - context.text(this.textContent) - .style({opacity: 1}); - var svgClass = d3.select(this).attr('class'), - 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; - gd._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) { - gd._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'); -}; - -},{"../constants/alignment":668,"../constants/xmlns_namespaces":674,"../lib":696,"d3":148}],721:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var timerCache = {}; - -/** - * Throttle a callback. `callback` executes synchronously only if - * more than `minInterval` milliseconds have already elapsed since the latest - * call (if any). Otherwise we wait until `minInterval` is over and execute the - * last callback received while waiting. - * So the first and last events in a train are always executed (eventually) - * but some of the events in the middle can be dropped. - * - * @param {string} id: an identifier to mark events to throttle together - * @param {number} minInterval: minimum time, in milliseconds, between - * invocations of `callback` - * @param {function} callback: the function to throttle. `callback` itself - * should be a purely synchronous function. - */ -exports.throttle = function throttle(id, minInterval, callback) { - var cache = timerCache[id]; - var now = Date.now(); - - if(!cache) { - /* - * Throw out old items before making a new one, to prevent the cache - * getting overgrown, for example from old plots that have been replaced. - * 1 minute age is arbitrary. - */ - for(var idi in timerCache) { - if(timerCache[idi].ts < now - 60000) { - delete timerCache[idi]; - } - } - cache = timerCache[id] = {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); -}; - -exports.done = function(id) { - var cache = timerCache[id]; - 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; - }; - }); -}; - -/** - * Clear the throttle cache for one or all timers - * @param {optional string} id: - * if provided, clear just this timer - * if omitted, clear all timers (mainly useful for testing) - */ -exports.clear = function(id) { - if(id) { - _clearTimeout(timerCache[id]); - delete timerCache[id]; - } - else { - for(var idi in timerCache) exports.clear(idi); - } -}; - -function _clearTimeout(cache) { - if(cache && cache.timer !== null) { - clearTimeout(cache.timer); - cache.timer = null; - } -} - -},{}],722:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -/** - * convert a linear value into a logged value, folding negative numbers into - * the given range - */ -module.exports = function toLogRange(val, range) { - if(val > 0) return Math.log(val) / Math.LN10; - - // move a negative value reference to a log axis - just put the - // result at the lowest range value on the plot (or if the range also went negative, - // one millionth of the top of the range) - 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; -}; - -},{"fast-isnumeric":214}],723:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var topojsonUtils = module.exports = {}; - -var locationmodeToLayer = _dereq_('../plots/geo/constants').locationmodeToLayer; -var topojsonFeature = _dereq_('topojson-client').feature; - - -topojsonUtils.getTopojsonName = function(geoLayout) { - return [ - geoLayout.scope.replace(/ /g, '-'), '_', - geoLayout.resolution.toString(), 'm' - ].join(''); -}; - -topojsonUtils.getTopojsonPath = function(topojsonURL, topojsonName) { - return topojsonURL + topojsonName + '.json'; -}; - -topojsonUtils.getTopojsonFeatures = function(trace, topojson) { - var layer = locationmodeToLayer[trace.locationmode], - obj = topojson.objects[layer]; - - return topojsonFeature(topojson, obj).features; -}; - -},{"../plots/geo/constants":773,"topojson-client":517}],724:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = { - moduleType: 'locale', - name: 'en-US', - dictionary: { - 'Click to enter Colorscale title': 'Click to enter Colorscale title' - }, - format: { - date: '%m/%d/%Y' - } -}; - -},{}],725:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.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' - } -}; - -},{}],726:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../registry'); - -/* - * containerArrayMatch: does this attribute string point into a - * layout container array? - * - * @param {String} astr: an attribute string, like *annotations[2].text* - * - * @returns {Object | false} Returns false if `astr` doesn't match a container - * array. If it does, returns: - * {array: {String}, index: {Number}, property: {String}} - * ie the attribute string for the array, the index within the array (or '' - * if the whole array) and the property within that (or '' if the whole array - * or the whole object) - */ -module.exports = function containerArrayMatch(astr) { - var rootContainers = Registry.layoutArrayContainers, - regexpContainers = Registry.layoutArrayRegexes, - rootPart = astr.split('[')[0], - arrayStr, - match; - - // look for regexp matches first, because they may be nested inside root matches - // eg updatemenus[i].buttons is nested inside updatemenus - for(var i = 0; i < regexpContainers.length; i++) { - match = astr.match(regexpContainers[i]); - if(match && match.index === 0) { - arrayStr = match[0]; - break; - } - } - - // now look for root matches - 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] || ''}; -}; - -},{"../registry":827}],727:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../lib'); -var extendFlat = Lib.extendFlat; -var isPlainObject = Lib.isPlainObject; - -var traceOpts = { - valType: 'flaglist', - extras: ['none'], - flags: ['calc', 'clearAxisTypes', 'plot', 'style', 'markerSize', 'colorbars'], - -}; - -var layoutOpts = { - valType: 'flaglist', - extras: ['none'], - flags: [ - 'calc', 'plot', 'legend', 'ticks', 'axrange', - 'layoutstyle', 'modebar', 'camera', 'arraydraw' - ], - -}; - -// flags for inside restyle/relayout include a few extras -// that shouldn't be used in attributes, to deal with certain -// combinations and conditionals efficiently -var traceEditTypeFlags = traceOpts.flags.slice() - .concat(['fullReplot']); - -var layoutEditTypeFlags = layoutOpts.flags.slice() - .concat('layoutReplot'); - -module.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: overrideAll -}; - -function falseObj(keys) { - var out = {}; - for(var i = 0; i < keys.length; i++) out[keys[i]] = false; - return out; -} - -/** - * For attributes that are largely copied from elsewhere into a plot type that doesn't - * support partial redraws - overrides the editType field of all attributes in the object - * - * @param {object} attrs: the attributes to override. Will not be mutated. - * @param {string} editTypeOverride: the new editType to use - * @param {'nested'|'from-root'} overrideContainers: - * - 'nested' will override editType for nested containers but not the root. - * - 'from-root' will also override editType of the root container. - * Containers below the absolute top level (trace or layout root) DO need an - * editType even if they are not `valObject`s themselves (eg `scatter.marker`) - * to handle the case where you edit the whole container. - * - * @return {object} a new attributes object with `editType` modified as directed - */ -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 { - // don't provide an editType for the _deprecated container - return overrideAll(attr, editTypeOverride, - (key.charAt(0) === '_') ? 'nested' : 'from-root'); - } -} - -},{"../lib":696}],728:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); -var m4FromQuat = _dereq_('gl-mat4/fromQuat'); - -var Registry = _dereq_('../registry'); -var Lib = _dereq_('../lib'); -var Plots = _dereq_('../plots/plots'); -var AxisIds = _dereq_('../plots/cartesian/axis_ids'); -var cleanId = AxisIds.cleanId; -var getFromTrace = AxisIds.getFromTrace; -var Color = _dereq_('../components/color'); - - -// clear the promise queue if one of them got rejected -exports.clearPromiseQueue = function(gd) { - if(Array.isArray(gd._promises) && gd._promises.length > 0) { - Lib.log('Clearing previous rejected promises from queue.'); - } - - gd._promises = []; -}; - -// make a few changes to the layout right away -// before it gets used for anything -// backward compatibility and cleanup of nonstandard options -exports.cleanLayout = function(layout) { - var i, j; - - if(!layout) layout = {}; - - // cannot have (x|y)axis1, numbering goes axis, axis2, axis3... - 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 sceneAttrRegex = (Plots.subplotsRegistry.gl3d || {}).attrRegex; - - var keys = Object.keys(layout); - for(i = 0; i < keys.length; i++) { - var key = keys[i]; - - // modifications to cartesian axes - 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); - - // old method of axis type - isdate and islog (before category existed) - 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'; - } - delete ax.islog; - delete ax.isdate; - delete ax.categories; // replaced by _categories - - // prune empty domain arrays made before the new nestedProperty - if(emptyContainer(ax, 'domain')) delete ax.domain; - - // autotick -> tickmode - if(ax.autotick !== undefined) { - if(ax.tickmode === undefined) { - ax.tickmode = ax.autotick ? 'auto' : 'linear'; - } - delete ax.autotick; - } - } - - // modifications for 3D scenes - else if(sceneAttrRegex && sceneAttrRegex.test(key)) { - var scene = layout[key]; - - // clean old Camera coords - var cameraposition = scene.cameraposition; - - if(Array.isArray(cameraposition) && cameraposition[0].length === 4) { - var rotation = cameraposition[0], - center = cameraposition[1], - radius = cameraposition[2], - mat = m4FromQuat([], rotation), - 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: mat[1], y: mat[5], z: mat[9]} - }; - - delete scene.cameraposition; - } - } - } - - 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 legend = layout.legend; - if(legend) { - // check for old-style legend positioning (x or y is +/- 100) - 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'; - } - } - - /* - * Moved from rotate -> orbit for dragmode - */ - if(layout.dragmode === 'rotate') layout.dragmode = 'orbit'; - - // sanitize rgb(fractions) and rgba(fractions) that old tinycolor - // supported, but new tinycolor does not because they're not valid css - Color.clean(layout); - - return layout; -}; - -function cleanAxRef(container, attr) { - var valIn = container[attr], - axLetter = attr.charAt(0); - if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); - } -} - -/* - * cleanData: Make a few changes to the data for backward compatibility - * before it gets used for anything. Modifies the data traces users provide. - * - * Important: if you're going to add something here that modifies a data array, - * update it in place so the new array === the old one. - */ -exports.cleanData = function(data) { - for(var tracei = 0; tracei < data.length; tracei++) { - var trace = data[tracei]; - var i; - - // use xbins to bin data in x, and ybins to bin data in y - if(trace.type === 'histogramy' && 'xbins' in trace && !('ybins' in trace)) { - trace.ybins = trace.xbins; - delete trace.xbins; - } - - // error_y.opacity is obsolete - merge into color - if(trace.error_y && 'opacity' in trace.error_y) { - var dc = Color.defaults, - yeColor = trace.error_y.color || - (Registry.traceIs(trace, 'bar') ? Color.defaultLine : dc[tracei % dc.length]); - trace.error_y.color = Color.addOpacity( - Color.rgb(yeColor), - Color.opacity(yeColor) * trace.error_y.opacity); - delete trace.error_y.opacity; - } - - // convert bardir to orientation, and put the data into - // the axes it's eventually going to be used with - if('bardir' in trace) { - if(trace.bardir === 'h' && (Registry.traceIs(trace, 'bar') || - trace.type.substr(0, 9) === 'histogram')) { - trace.orientation = 'h'; - exports.swapXYData(trace); - } - delete trace.bardir; - } - - // now we have only one 1D histogram type, and whether - // it uses x or y data depends on trace.orientation - if(trace.type === 'histogramy') exports.swapXYData(trace); - if(trace.type === 'histogramx' || trace.type === 'histogramy') { - trace.type = 'histogram'; - } - - // scl->scale, reversescl->reversescale - if('scl' in trace) { - trace.colorscale = trace.scl; - delete trace.scl; - } - if('reversescl' in trace) { - trace.reversescale = trace.reversescl; - delete trace.reversescl; - } - - // axis ids x1 -> x, y1-> y - if(trace.xaxis) trace.xaxis = cleanId(trace.xaxis, 'x'); - if(trace.yaxis) trace.yaxis = cleanId(trace.yaxis, 'y'); - - // scene ids scene1 -> scene - if(Registry.traceIs(trace, 'gl3d') && trace.scene) { - trace.scene = Plots.subplotsRegistry.gl3d.cleanId(trace.scene); - } - - if(!Registry.traceIs(trace, 'pie') && !Registry.traceIs(trace, 'bar')) { - 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); - } - } - - // fix typo in colorscale definition - 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'; - } - } - - // fix typo in surface 'highlight*' definitions - 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; - } - } - } - - // fixes from converting finance from transforms to real trace types - 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); - - // now figure out something smart to do with the separate direction - // names we removed - if((increasingName !== false) && (decreasingName !== false)) { - // both sub-names existed: base name previously had no effect - // so ignore it and try to find a shared part of the sub-names - - var newName = commonPrefix( - increasingName, decreasingName, - increasingShowlegend, decreasingShowlegend - ); - // if no common part, leave whatever name was (or wasn't) there - if(newName) trace.name = newName; - } - else if((increasingName || decreasingName) && !trace.name) { - // one sub-name existed but not the base name - just use the sub-name - trace.name = increasingName || decreasingName; - } - } - - // transforms backward compatibility fixes - 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': - // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: - 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; - } - } - } - - // prune empty containers made before the new nestedProperty - 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; - } - - // sanitize rgb(fractions) and rgba(fractions) that old tinycolor - // supported, but new tinycolor does not because they're not valid css - Color.clean(trace); - - // remove obsolete autobin(x|y) attributes, but only if true - // if false, this needs to happen in Histogram.calc because it - // can be a one-time autobin so we need to know the results before - // we can push them back into the trace. - if(trace.autobinx) { - delete trace.autobinx; - delete trace.xbins; - } - if(trace.autobiny) { - delete trace.autobiny; - delete trace.ybins; - } - } -}; - -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 only one is shown in the legend, use that - if(show1 && !show2) return name1; - if(show2 && !show1) return name2; - - // if both or neither are in the legend, check if one is blank (or whitespace) - // and use the other one - // note that hover labels can still use the name even if the legend doesn't - 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(); -} - -// textposition - support partial attributes (ie just 'top') -// and incorrect use of middle / center etc. -function cleanTextPosition(textposition) { - var posY = 'middle', - posX = 'center'; - 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); -} - - -// swap all the data and data attributes associated with x and y -exports.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, - 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('+'); - } -}; - -// coerce traceIndices input to array of trace indices -exports.coerceTraceIndices = function(gd, traceIndices) { - if(isNumeric(traceIndices)) { - return [traceIndices]; - } - else if(!Array.isArray(traceIndices) || !traceIndices.length) { - return gd.data.map(function(_, i) { return i; }); - } - else if(Array.isArray(traceIndices)) { - var traceIndicesOut = []; - for(var i = 0; i < traceIndices.length; i++) { - if(Lib.isIndex(traceIndices[i], gd.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; -}; - -/** - * Manages logic around array container item creation / deletion / update - * that nested property alone can't handle. - * - * @param {Object} np - * nested property of update attribute string about trace or layout object - * @param {*} newVal - * update value passed to restyle / relayout / update - * @param {Object} undoit - * undo hash (N.B. undoit may be mutated here). - * - */ -exports.manageArrayContainers = function(np, newVal, undoit) { - var obj = np.obj, - parts = np.parts, - pLength = parts.length, - pLast = parts[pLength - 1]; - - var pLastIsNumber = isNumeric(pLast); - - // delete item - if(pLastIsNumber && newVal === null) { - - // Clear item in array container when new value is null - var contPath = parts.slice(0, pLength - 1).join('.'), - cont = Lib.nestedProperty(obj, contPath).get(); - cont.splice(pLast, 1); - - // Note that nested property clears null / undefined at end of - // array container, but not within them. - } - // create item - else if(pLastIsNumber && np.get() === undefined) { - - // When adding a new item, make sure undo command will remove it - if(np.get() === undefined) undoit[np.astr] = null; - - np.set(newVal); - } - // update item - else { - - // If the last part of attribute string isn't a number, - // np.set is all we need. - np.set(newVal); - } -}; - -/* - * Match the part to strip off to turn an attribute into its parent - * really it should be either '.some_characters' or '[number]' - * but we're a little more permissive here and match either - * '.not_brackets_or_dot' or '[not_brackets_or_dot]' - */ -var ATTR_TAIL_RE = /(\.[^\[\]\.]+|\[[^\[\]\.]+\])$/; - -function getParent(attr) { - var tail = attr.search(ATTR_TAIL_RE); - if(tail > 0) return attr.substr(0, tail); -} - -/* - * hasParent: does an attribute object contain a parent of the given attribute? - * for example, given 'images[2].x' do we also have 'images' or 'images[2]'? - * - * @param {Object} aobj - * update object, whose keys are attribute strings and values are their new settings - * @param {string} attr - * the attribute string to test against - * @returns {Boolean} - * is a parent of attr present in aobj? - */ -exports.hasParent = function(aobj, attr) { - var attrParent = getParent(attr); - while(attrParent) { - if(attrParent in aobj) return true; - attrParent = getParent(attrParent); - } - return false; -}; - -/** - * Empty out types for all axes containing these traces so we auto-set them again - * - * @param {object} gd - * @param {[integer]} traces: trace indices to search for axes to clear the types of - * @param {object} layoutUpdate: any update being done concurrently to the layout, - * which may supercede clearing the axis types - */ -var axLetters = ['x', 'y', 'z']; -exports.clearAxisTypes = function(gd, traces, layoutUpdate) { - for(var i = 0; i < traces.length; i++) { - var trace = gd._fullData[i]; - for(var j = 0; j < 3; j++) { - var ax = getFromTrace(gd, trace, axLetters[j]); - - // do not clear log type - that's never an auto result so must have been intentional - if(ax && ax.type !== 'log') { - var axAttr = ax._name; - var sceneName = ax._id.substr(1); - if(sceneName.substr(0, 5) === 'scene') { - if(layoutUpdate[sceneName] !== undefined) continue; - axAttr = sceneName + '.' + axAttr; - } - var typeAttr = axAttr + '.type'; - - if(layoutUpdate[axAttr] === undefined && layoutUpdate[typeAttr] === undefined) { - Lib.nestedProperty(gd.layout, typeAttr).set(null); - } - } - } - } -}; - -},{"../components/color":570,"../lib":696,"../plots/cartesian/axis_ids":747,"../plots/plots":808,"../registry":827,"fast-isnumeric":214,"gl-mat4/fromQuat":251}],729:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var main = _dereq_('./plot_api'); - -exports.plot = main.plot; -exports.newPlot = main.newPlot; -exports.restyle = main.restyle; -exports.relayout = main.relayout; -exports.redraw = main.redraw; -exports.update = main.update; -exports.react = main.react; -exports.extendTraces = main.extendTraces; -exports.prependTraces = main.prependTraces; -exports.addTraces = main.addTraces; -exports.deleteTraces = main.deleteTraces; -exports.moveTraces = main.moveTraces; -exports.purge = main.purge; -exports.addFrames = main.addFrames; -exports.deleteFrames = main.deleteFrames; -exports.animate = main.animate; -exports.setPlotConfig = main.setPlotConfig; - -exports.toImage = _dereq_('./to_image'); -exports.validate = _dereq_('./validate'); -exports.downloadImage = _dereq_('../snapshot/download'); - -var templateApi = _dereq_('./template_api'); -exports.makeTemplate = templateApi.makeTemplate; -exports.validateTemplate = templateApi.validateTemplate; - -},{"../snapshot/download":829,"./plot_api":731,"./template_api":736,"./to_image":737,"./validate":738}],730:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var nestedProperty = _dereq_('../lib/nested_property'); -var isPlainObject = _dereq_('../lib/is_plain_object'); -var noop = _dereq_('../lib/noop'); -var Loggers = _dereq_('../lib/loggers'); -var sorterAsc = _dereq_('../lib/search').sorterAsc; -var Registry = _dereq_('../registry'); - - -exports.containerArrayMatch = _dereq_('./container_array_match'); - -var isAddVal = exports.isAddVal = function isAddVal(val) { - return val === 'add' || isPlainObject(val); -}; - -var isRemoveVal = exports.isRemoveVal = function isRemoveVal(val) { - return val === null || val === 'remove'; -}; - -/* - * applyContainerArrayChanges: for managing arrays of layout components in relayout - * handles them all with a consistent interface. - * - * Here are the supported actions -> relayout calls -> edits we get here - * (as prepared in _relayout): - * - * add an empty obj -> {'annotations[2]': 'add'} -> {2: {'': 'add'}} - * add a specific obj -> {'annotations[2]': {attrs}} -> {2: {'': {attrs}}} - * delete an obj -> {'annotations[2]': 'remove'} -> {2: {'': 'remove'}} - * -> {'annotations[2]': null} -> {2: {'': null}} - * delete the whole array -> {'annotations': 'remove'} -> {'': {'': 'remove'}} - * -> {'annotations': null} -> {'': {'': null}} - * edit an object -> {'annotations[2].text': 'boo'} -> {2: {'text': 'boo'}} - * - * You can combine many edits to different objects. Objects are added and edited - * in ascending order, then removed in descending order. - * For example, starting with [a, b, c], if you want to: - * - replace b with d: - * {'annotations[1]': d, 'annotations[2]': null} (b is item 2 after adding d) - * - add a new item d between a and b, and edit b: - * {'annotations[1]': d, 'annotations[2].x': newX} (b is item 2 after adding d) - * - delete b and edit c: - * {'annotations[1]': null, 'annotations[2].x': newX} (c is edited before b is removed) - * - * You CANNOT combine adding/deleting an item at index `i` with edits to the same index `i` - * You CANNOT combine replacing/deleting the whole array with anything else (for the same array). - * - * @param {HTMLDivElement} gd - * the DOM element of the graph container div - * @param {Lib.nestedProperty} componentType: the array we are editing - * @param {Object} edits - * the changes to make; keys are indices to edit, values are themselves objects: - * {attr: newValue} of changes to make to that index (with add/remove behavior - * in special values of the empty attr) - * @param {Object} flags - * the flags for which actions we're going to perform to display these (and - * any other) changes. If we're already `recalc`ing, we don't need to redraw - * individual items - * - * @returns {bool} `true` if it managed to complete drawing of the changes - * `false` would mean the parent should replot. - */ -exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, edits, flags) { - var componentType = np.astr, - supplyComponentDefaults = Registry.getComponentMethod(componentType, 'supplyLayoutDefaults'), - draw = Registry.getComponentMethod(componentType, 'draw'), - drawOne = Registry.getComponentMethod(componentType, 'drawOne'), - replotLater = flags.replot || flags.recalc || (supplyComponentDefaults === noop) || - (draw === noop), - layout = gd.layout, - fullLayout = gd._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)) np.set(null); - else if(Array.isArray(fullVal)) np.set(fullVal); - else { - Loggers.warn('Unrecognized full array edit value', componentType, fullVal); - return true; - } - - if(replotLater) return false; - - supplyComponentDefaults(layout, fullLayout); - draw(gd); - return true; - } - - var componentNums = Object.keys(edits).map(Number).sort(sorterAsc), - componentArrayIn = np.get(), - componentArray = componentArrayIn || [], - // componentArrayFull is used just to keep splices in line between - // full and input arrays, so private keys can be copied over after - // redoing supplyDefaults - // TODO: this assumes componentArray is in gd.layout - which will not be - // true after we extend this to restyle - componentArrayFull = nestedProperty(fullLayout, componentType).get(); - - var deletes = [], - firstIndexChange = -1, - maxIndex = componentArray.length, - i, - j, - componentNum, - objEdits, - objKeys, - objVal, - adding; - - // first make the add and edit changes - 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 !== undefined) { - 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++) { - nestedProperty(componentArray[componentNum], objKeys[j]).set(objEdits[objKeys[j]]); - } - } - } - - // now do deletes - for(i = deletes.length - 1; i >= 0; i--) { - componentArray.splice(deletes[i], 1); - // TODO: this drops private keys that had been stored in componentArrayFull - // does this have any ill effects? - if(componentArrayFull) componentArrayFull.splice(deletes[i], 1); - } - - if(!componentArray.length) np.set(null); - else if(!componentArrayIn) np.set(componentArray); - - if(replotLater) return false; - - supplyComponentDefaults(layout, fullLayout); - - // finally draw all the components we need to - // if we added or removed any, redraw all after it - if(drawOne !== noop) { - var indicesToDraw; - if(firstIndexChange === -1) { - // there's no re-indexing to do, so only redraw components that changed - indicesToDraw = componentNums; - } - else { - // in case the component array was shortened, we still need do call - // drawOne on the latter items so they get properly removed - 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(gd, indicesToDraw[i]); - } - } - else draw(gd); - - return true; -}; - -},{"../lib/is_plain_object":697,"../lib/loggers":700,"../lib/nested_property":704,"../lib/noop":705,"../lib/search":715,"../registry":827,"./container_array_match":726}],731:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); -var hasHover = _dereq_('has-hover'); - -var Lib = _dereq_('../lib'); -var Events = _dereq_('../lib/events'); -var Queue = _dereq_('../lib/queue'); - -var Registry = _dereq_('../registry'); -var PlotSchema = _dereq_('./plot_schema'); -var Plots = _dereq_('../plots/plots'); -var Polar = _dereq_('../plots/polar/legacy'); - -var Axes = _dereq_('../plots/cartesian/axes'); -var Drawing = _dereq_('../components/drawing'); -var Color = _dereq_('../components/color'); -var connectColorbar = _dereq_('../components/colorbar/connect'); -var initInteractions = _dereq_('../plots/cartesian/graph_interact').initInteractions; -var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); -var svgTextUtils = _dereq_('../lib/svg_text_utils'); - -var defaultConfig = _dereq_('./plot_config'); -var manageArrays = _dereq_('./manage_arrays'); -var helpers = _dereq_('./helpers'); -var subroutines = _dereq_('./subroutines'); -var editTypes = _dereq_('./edit_types'); - -var AX_NAME_PATTERN = _dereq_('../plots/cartesian/constants').AX_NAME_PATTERN; - -var numericNameWarningCount = 0; -var numericNameWarningCountLimit = 5; - -/** - * Main plot-creation function - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * @param {array of objects} data - * array of traces, containing the data and display information for each trace - * @param {object} layout - * object describing the overall display of the plot, - * all the stuff that doesn't pertain to any individual trace - * @param {object} config - * configuration options (see ./plot_config.js for more info) - * - * OR - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * @param {object} figure - * object containing `data`, `layout`, `config`, and `frames` members - * - */ -exports.plot = function(gd, data, layout, config) { - var frames; - - gd = Lib.getGraphDiv(gd); - - // Events.init is idempotent and bails early if gd has already been init'd - Events.init(gd); - - if(Lib.isPlainObject(data)) { - var obj = data; - data = obj.data; - layout = obj.layout; - config = obj.config; - frames = obj.frames; - } - - var okToPlot = Events.triggerHandler(gd, 'plotly_beforeplot', [data, layout, config]); - if(okToPlot === false) return Promise.reject(); - - // if there's no data or layout, and this isn't yet a plotly plot - // container, log a warning to help plotly.js users debug - if(!data && !layout && !Lib.isPlotDiv(gd)) { - Lib.warn('Calling Plotly.plot as if redrawing ' + - 'but this container doesn\'t yet have a plot.', gd); - } - - function addFrames() { - if(frames) { - return exports.addFrames(gd, frames); - } - } - - // transfer configuration options to gd until we move over to - // a more OO like model - setPlotContext(gd, config); - - if(!layout) layout = {}; - - // hook class for plots main container (in case of plotly.js - // this won't be #embedded-graph or .js-tab-contents) - d3.select(gd).classed('js-plotly-plot', true); - - // off-screen getBoundingClientRect testing space, - // in #js-plotly-tester (and stored as Drawing.tester) - // so we can share cached text across tabs - Drawing.makeTester(); - - // clear stashed base url - delete Drawing.baseUrl; - - // collect promises for any async actions during plotting - // any part of the plotting code can push to gd._promises, then - // before we move to the next step, we check that they're all - // complete, and empty out the promise list again. - if(!Array.isArray(gd._promises)) gd._promises = []; - - var graphWasEmpty = ((gd.data || []).length === 0 && Array.isArray(data)); - - // if there is already data on the graph, append the new data - // if you only want to redraw, pass a non-array for data - if(Array.isArray(data)) { - helpers.cleanData(data); - - if(graphWasEmpty) gd.data = data; - else gd.data.push.apply(gd.data, data); - - // for routines outside graph_obj that want a clean tab - // (rather than appending to an existing one) gd.empty - // is used to determine whether to make a new tab - gd.empty = false; - } - - if(!gd.layout || graphWasEmpty) gd.layout = helpers.cleanLayout(layout); - - // if the user is trying to drag the axes, allow new data and layout - // to come in but don't allow a replot. - if(gd._dragging && !gd._transitioning) { - // signal to drag handler that after everything else is done - // we need to replot, because something has changed - gd._replotPending = true; - return Promise.reject(); - } else { - // we're going ahead with a replot now - gd._replotPending = false; - } - - Plots.supplyDefaults(gd); - - var fullLayout = gd._fullLayout; - var hasCartesian = fullLayout._has('cartesian'); - - // Legacy polar plots - if(!fullLayout._has('polar') && data && data[0] && data[0].r) { - Lib.log('Legacy polar charts are deprecated!'); - return plotPolar(gd, data, layout); - } - - // so we don't try to re-call Plotly.plot from inside - // legend and colorbar, if margins changed - fullLayout._replotting = true; - - // make or remake the framework if we need to - if(graphWasEmpty) makePlotFramework(gd); - - // polar need a different framework - if(gd.framework !== makePlotFramework) { - gd.framework = makePlotFramework; - makePlotFramework(gd); - } - - // clear gradient defs on each .plot call, because we know we'll loop through all traces - Drawing.initGradients(gd); - - // save initial show spikes once per graph - if(graphWasEmpty) Axes.saveShowSpikeInitial(gd); - - // prepare the data and find the autorange - - // generate calcdata, if we need to - // to force redoing calcdata, just delete it before calling Plotly.plot - var recalc = !gd.calcdata || gd.calcdata.length !== (gd._fullData || []).length; - if(recalc) Plots.doCalcdata(gd); - - // in case it has changed, attach fullData traces to calcdata - for(var i = 0; i < gd.calcdata.length; i++) { - gd.calcdata[i][0].trace = gd._fullData[i]; - } - - // make the figure responsive - if(gd._context.responsive) { - if(!gd._responsiveChartHandler) { - // Keep a reference to the resize handler to purge it down the road - gd._responsiveChartHandler = function() {Plots.resize(gd);}; - - // Listen to window resize - window.addEventListener('resize', gd._responsiveChartHandler); - } - } else { - Lib.clearResponsive(gd); - } - - /* - * start async-friendly code - now we're actually drawing things - */ - - var oldmargins = JSON.stringify(fullLayout._size); - - // draw framework first so that margin-pushing - // components can position themselves correctly - var drawFrameworkCalls = 0; - function drawFramework() { - var basePlotModules = fullLayout._basePlotModules; - - for(var i = 0; i < basePlotModules.length; i++) { - if(basePlotModules[i].drawFramework) { - basePlotModules[i].drawFramework(gd); - } - } - - 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, - 'width': '100%', - 'height': '100%', - 'overflow': 'visible', - 'pointer-events': 'none' - }); - } - - if(fullLayout._glcanvas) { - fullLayout._glcanvas - .attr('width', fullLayout.width) - .attr('height', fullLayout.height); - - var regl = fullLayout._glcanvas.data()[0].regl; - if(regl) { - // Unfortunately, this can happen when relayouting to large - // width/height on some browsers. - if(Math.floor(fullLayout.width) !== regl._gl.drawingBufferWidth || - Math.floor(fullLayout.height) !== 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([], {}, gd._fullData, fullLayout); - Plots.supplyDefaults(gd); - fullLayout = gd._fullLayout; - Plots.doCalcdata(gd); - drawFrameworkCalls++; - return drawFramework(); - } - } - } - } - - return Plots.previousPromises(gd); - } - - // draw anything that can affect margins. - function marginPushers() { - var calcdata = gd.calcdata; - var i, cd, trace; - - // First reset the list of things that are allowed to change the margins - // So any deleted traces or components will be wiped out of the - // automargin calculation. - // This means *every* margin pusher must be listed here, even if it - // doesn't actually try to push the margins until later. - Plots.clearAutoMarginIds(gd); - - subroutines.drawMarginPushers(gd); - Axes.allowAutoMargin(gd); - - for(i = 0; i < calcdata.length; i++) { - cd = calcdata[i]; - trace = cd[0].trace; - var colorbarOpts = trace._module.colorbar; - if(trace.visible !== true || !colorbarOpts) { - Plots.autoMargin(gd, 'cb' + trace.uid); - } - else connectColorbar(gd, cd, colorbarOpts); - } - - Plots.doAutoMargin(gd); - return Plots.previousPromises(gd); - } - - // in case the margins changed, draw margin pushers again - function marginPushersAgain() { - if(JSON.stringify(fullLayout._size) === oldmargins) return; - - return Lib.syncOrAsync([ - marginPushers, - subroutines.layoutStyles - ], gd); - } - - function positionAndAutorange() { - if(!recalc) { - doAutoRangeAndConstraints(); - return; - } - - // TODO: autosize extra for text markers and images - // see https://github.com/plotly/plotly.js/issues/1111 - return Lib.syncOrAsync([ - Registry.getComponentMethod('shapes', 'calcAutorange'), - Registry.getComponentMethod('annotations', 'calcAutorange'), - doAutoRangeAndConstraints, - Registry.getComponentMethod('rangeslider', 'calcAutorange') - ], gd); - } - - function doAutoRangeAndConstraints() { - if(gd._transitioning) return; - - subroutines.doAutoRangeAndConstraints(gd); - - // store initial ranges *after* enforcing constraints, otherwise - // we will never look like we're at the initial ranges - if(graphWasEmpty) Axes.saveRangeInitial(gd); - } - - // draw ticks, titles, and calculate axis scaling (._b, ._m) - function drawAxes() { - return Axes.doTicks(gd, graphWasEmpty ? '' : 'redraw'); - } - - var seq = [ - Plots.previousPromises, - addFrames, - drawFramework, - marginPushers, - marginPushersAgain - ]; - - if(hasCartesian) seq.push(positionAndAutorange); - - seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); - - seq.push( - subroutines.drawData, - subroutines.finalDraw, - initInteractions, - Plots.addLinks, - Plots.rehover, - // 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 - ); - - // even if everything we did was synchronous, return a promise - // so that the caller doesn't care which route we took - var plotDone = Lib.syncOrAsync(seq, gd); - if(!plotDone || !plotDone.then) plotDone = Promise.resolve(); - - return plotDone.then(function() { - emitAfterPlot(gd); - return gd; - }); -}; - -function emitAfterPlot(gd) { - var fullLayout = gd._fullLayout; - - if(fullLayout._redrawFromAutoMarginCount) { - fullLayout._redrawFromAutoMarginCount--; - } else { - gd.emit('plotly_afterplot'); - } -} - -exports.setPlotConfig = function setPlotConfig(obj) { - return Lib.extendFlat(defaultConfig, obj); -}; - -function setBackground(gd, bgColor) { - try { - gd._fullLayout._paper.style('background', bgColor); - } catch(e) { - Lib.error(e); - } -} - -function opaqueSetBackground(gd, bgColor) { - var blend = Color.combine(bgColor, 'white'); - setBackground(gd, blend); -} - -function setPlotContext(gd, config) { - if(!gd._context) gd._context = Lib.extendDeep({}, defaultConfig); - var context = gd._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]; - } - } - } - - // map plot3dPixelRatio to plotGlPixelRatio for backward compatibility - if(config.plot3dPixelRatio && !context.plotGlPixelRatio) { - context.plotGlPixelRatio = context.plot3dPixelRatio; - } - - // now deal with editable and edits - first editable overrides - // everything, then edits refines - var editable = config.editable; - if(editable !== undefined) { - // we're not going to *use* context.editable, we're only going to - // use context.edits... but keep it for the record - 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]; - } - } - } - } - - // staticPlot forces a bunch of others: - 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; - } - - // make sure hover-only devices have mode bar visible - if(context.displayModeBar === 'hover' && !hasHover) { - context.displayModeBar = true; - } - - // default and fallback for setBackground - if(context.setBackground === 'transparent' || typeof context.setBackground !== 'function') { - context.setBackground = setBackground; - } - - // Check if gd has a specified widht/height to begin with - context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0; - context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0; -} - -function plotPolar(gd, data, layout) { - // build or reuse the container skeleton - var plotContainer = d3.select(gd).selectAll('.plot-container') - .data([0]); - plotContainer.enter() - .insert('div', ':first-child') - .classed('plot-container plotly', true); - var paperDiv = plotContainer.selectAll('.svg-container') - .data([0]); - paperDiv.enter().append('div') - .classed('svg-container', true) - .style('position', 'relative'); - - // empty it everytime for now - paperDiv.html(''); - - // fulfill gd requirements - if(data) gd.data = data; - if(layout) gd.layout = layout; - Polar.manager.fillLayout(gd); - - // resize canvas - paperDiv.style({ - width: gd._fullLayout.width + 'px', - height: gd._fullLayout.height + 'px' - }); - - // instantiate framework - gd.framework = Polar.manager.framework(gd); - - // plot - gd.framework({data: gd.data, layout: gd.layout}, paperDiv.node()); - - // set undo point - gd.framework.setUndoPoint(); - - // get the resulting svg for extending it - var polarPlotSVG = gd.framework.svg(); - - // editable title - var opacity = 1; - var txt = gd._fullLayout.title; - if(txt === '' || !txt) opacity = 0; - - var titleLayout = function() { - this.call(svgTextUtils.convertToTspans, gd); - // TODO: html/mathjax - // TODO: center title - }; - - var title = polarPlotSVG.select('.title-group text') - .call(titleLayout); - - if(gd._context.edits.titleText) { - var placeholderText = Lib._(gd, 'Click to enter Plot title'); - if(!txt || txt === placeholderText) { - opacity = 0.2; - // placeholder is not going through convertToTspans - // so needs explicit data-unformatted - title.attr({'data-unformatted': placeholderText}) - .text(placeholderText) - .style({opacity: opacity}) - .on('mouseover.opacity', function() { - d3.select(this).transition().duration(100) - .style('opacity', 1); - }) - .on('mouseout.opacity', function() { - d3.select(this).transition().duration(1000) - .style('opacity', 0); - }); - } - - var setContenteditable = function() { - this.call(svgTextUtils.makeEditable, {gd: gd}) - .on('edit', function(text) { - gd.framework({layout: {title: text}}); - this.text(text) - .call(titleLayout); - this.call(setContenteditable); - }) - .on('cancel', function() { - var txt = this.attr('data-unformatted'); - this.text(txt).call(titleLayout); - }); - }; - title.call(setContenteditable); - } - - gd._context.setBackground(gd, gd._fullLayout.paper_bgcolor); - Plots.addLinks(gd); - - return Promise.resolve(); -} - -// convenience function to force a full redraw, mostly for use by plotly.js -exports.redraw = function(gd) { - gd = Lib.getGraphDiv(gd); - - if(!Lib.isPlotDiv(gd)) { - throw new Error('This element is not a Plotly plot: ' + gd); - } - - helpers.cleanData(gd.data); - helpers.cleanLayout(gd.layout); - - gd.calcdata = undefined; - return exports.plot(gd).then(function() { - gd.emit('plotly_redraw'); - return gd; - }); -}; - -/** - * Convenience function to make idempotent plot option obvious to users. - * - * @param gd - * @param {Object[]} data - * @param {Object} layout - * @param {Object} config - */ -exports.newPlot = function(gd, data, layout, config) { - gd = Lib.getGraphDiv(gd); - - // remove gl contexts - Plots.cleanPlot([], {}, gd._fullData || [], gd._fullLayout || {}); - - Plots.purge(gd); - return exports.plot(gd, data, layout, config); -}; - -/** - * Wrap negative indicies to their positive counterparts. - * - * @param {Number[]} indices An array of indices - * @param {Number} maxIndex The maximum index allowable (arr.length - 1) - */ -function positivifyIndices(indices, maxIndex) { - var parentLength = maxIndex + 1, - positiveIndices = [], - i, - index; - - for(i = 0; i < indices.length; i++) { - index = indices[i]; - if(index < 0) { - positiveIndices.push(parentLength + index); - } else { - positiveIndices.push(index); - } - } - return positiveIndices; -} - -/** - * Ensures that an index array for manipulating gd.data is valid. - * - * Intended for use with addTraces, deleteTraces, and moveTraces. - * - * @param gd - * @param indices - * @param arrayName - */ -function assertIndexArray(gd, indices, arrayName) { - var i, - index; - - for(i = 0; i < indices.length; i++) { - index = indices[i]; - - // validate that indices are indeed integers - if(index !== parseInt(index, 10)) { - throw new Error('all values in ' + arrayName + ' must be integers'); - } - - // check that all indices are in bounds for given gd.data array length - if(index >= gd.data.length || index < -gd.data.length) { - throw new Error(arrayName + ' must be valid indices for gd.data.'); - } - - // check that indices aren't repeated - if(indices.indexOf(index, i + 1) > -1 || - index >= 0 && indices.indexOf(-gd.data.length + index) > -1 || - index < 0 && indices.indexOf(gd.data.length + index) > -1) { - throw new Error('each index in ' + arrayName + ' must be unique.'); - } - } -} - -/** - * Private function used by Plotly.moveTraces to check input args - * - * @param gd - * @param currentIndices - * @param newIndices - */ -function checkMoveTracesArgs(gd, currentIndices, newIndices) { - - // check that gd has attribute 'data' and 'data' is array - if(!Array.isArray(gd.data)) { - throw new Error('gd.data must be an array.'); - } - - // validate currentIndices array - if(typeof currentIndices === 'undefined') { - throw new Error('currentIndices is a required argument.'); - } else if(!Array.isArray(currentIndices)) { - currentIndices = [currentIndices]; - } - assertIndexArray(gd, currentIndices, 'currentIndices'); - - // validate newIndices array if it exists - if(typeof newIndices !== 'undefined' && !Array.isArray(newIndices)) { - newIndices = [newIndices]; - } - if(typeof newIndices !== 'undefined') { - assertIndexArray(gd, newIndices, 'newIndices'); - } - - // check currentIndices and newIndices are the same length if newIdices exists - if(typeof newIndices !== 'undefined' && currentIndices.length !== newIndices.length) { - throw new Error('current and new indices must be of equal length.'); - } - -} -/** - * A private function to reduce the type checking clutter in addTraces. - * - * @param gd - * @param traces - * @param newIndices - */ -function checkAddTracesArgs(gd, traces, newIndices) { - var i, value; - - // check that gd has attribute 'data' and 'data' is array - if(!Array.isArray(gd.data)) { - throw new Error('gd.data must be an array.'); - } - - // make sure traces exists - if(typeof traces === 'undefined') { - throw new Error('traces must be defined.'); - } - - // make sure traces is an array - if(!Array.isArray(traces)) { - traces = [traces]; - } - - // make sure each value in traces is an object - 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'); - } - } - - // make sure we have an index for each trace - 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' - ); - } -} - -/** - * A private function to reduce the type checking clutter in spliceTraces. - * Get all update Properties from gd.data. Validate inputs and outputs. - * Used by prependTrace and extendTraces - * - * @param gd - * @param update - * @param indices - * @param maxPoints - */ -function assertExtendTracesArgs(gd, update, indices, maxPoints) { - - var maxPointsIsObject = Lib.isPlainObject(maxPoints); - - if(!Array.isArray(gd.data)) { - throw new Error('gd.data must be an array'); - } - if(!Lib.isPlainObject(update)) { - 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(gd, indices, 'indices'); - - for(var key in update) { - - /* - * Verify that the attribute to be updated contains as many trace updates - * as indices. Failure must result in throw and no-op - */ - if(!Array.isArray(update[key]) || update[key].length !== indices.length) { - throw new Error('attribute ' + key + ' must be an array of length equal to indices array length'); - } - - /* - * if maxPoints is an object it must match keys and array lengths of 'update' 1:1 - */ - if(maxPointsIsObject && - (!(key in maxPoints) || !Array.isArray(maxPoints[key]) || - maxPoints[key].length !== update[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'); - } - } -} - -/** - * A private function to reduce the type checking clutter in spliceTraces. - * - * @param {Object|HTMLDivElement} gd - * @param {Object} update - * @param {Number[]} indices - * @param {Number||Object} maxPoints - * @return {Object[]} - */ -function getExtendProperties(gd, update, indices, maxPoints) { - - var maxPointsIsObject = Lib.isPlainObject(maxPoints), - updateProps = []; - var trace, target, prop, insert, maxp; - - // allow scalar index to represent a single trace position - if(!Array.isArray(indices)) indices = [indices]; - - // negative indices are wrapped around to their positive value. Equivalent to python indexing. - indices = positivifyIndices(indices, gd.data.length - 1); - - // loop through all update keys and traces and harvest validated data. - for(var key in update) { - - for(var j = 0; j < indices.length; j++) { - - /* - * Choose the trace indexed by the indices map argument and get the prop setter-getter - * instance that references the key and value for this particular trace. - */ - trace = gd.data[indices[j]]; - prop = Lib.nestedProperty(trace, key); - - /* - * Target is the existing gd.data.trace.dataArray value like "x" or "marker.size" - * Target must exist as an Array to allow the extend operation to be performed. - */ - target = prop.get(); - insert = update[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); - } - - /* - * maxPoints may be an object map or a scalar. If object select the key:value, else - * Use the scalar maxPoints for all key and trace combinations. - */ - maxp = maxPointsIsObject ? maxPoints[key][j] : maxPoints; - - // could have chosen null here, -1 just tells us to not take a window - if(!isNumeric(maxp)) maxp = -1; - - /* - * Wrap the nestedProperty in an object containing required data - * for lengthening and windowing this particular trace - key combination. - * Flooring maxp mirrors the behaviour of floats in the Array.slice JSnative function. - */ - updateProps.push({ - prop: prop, - target: target, - insert: insert, - maxp: Math.floor(maxp) - }); - } - } - - // all target and insertion data now validated - return updateProps; -} - -/** - * A private function to key Extend and Prepend traces DRY - * - * @param {Object|HTMLDivElement} gd - * @param {Object} update - * @param {Number[]} indices - * @param {Number||Object} maxPoints - * @param {Function} updateArray - * @return {Object} - */ -function spliceTraces(gd, update, indices, maxPoints, updateArray) { - assertExtendTracesArgs(gd, update, indices, maxPoints); - - var updateProps = getExtendProperties(gd, update, indices, maxPoints); - var undoUpdate = {}; - var undoPoints = {}; - - for(var i = 0; i < updateProps.length; i++) { - var prop = updateProps[i].prop; - var maxp = updateProps[i].maxp; - - // return new array and remainder - var out = updateArray(updateProps[i].target, updateProps[i].insert, maxp); - prop.set(out[0]); - - // build the inverse update object for the undo operation - if(!Array.isArray(undoUpdate[prop.astr])) undoUpdate[prop.astr] = []; - undoUpdate[prop.astr].push(out[1]); - - // build the matching maxPoints undo object containing original trace lengths - 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; -} - -/** - * extend && prepend traces at indices with update arrays, window trace lengths to maxPoints - * - * Extend and Prepend have identical APIs. Prepend inserts an array at the head while Extend - * inserts an array off the tail. Prepend truncates the tail of the array - counting maxPoints - * from the head, whereas Extend truncates the head of the array, counting backward maxPoints - * from the tail. - * - * If maxPoints is undefined, nonNumeric, negative or greater than extended trace length no - * truncation / windowing will be performed. If its zero, well the whole trace is truncated. - * - * @param {Object|HTMLDivElement} gd The graph div - * @param {Object} update The key:array map of target attributes to extend - * @param {Number|Number[]} indices The locations of traces to be extended - * @param {Number|Object} [maxPoints] Number of points for trace window after lengthening. - * - */ -exports.extendTraces = function extendTraces(gd, update, indices, maxPoints) { - gd = Lib.getGraphDiv(gd); - - 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(gd, update, indices, maxPoints, updateArray); - var promise = exports.redraw(gd); - var undoArgs = [gd, undo.update, indices, undo.maxPoints]; - Queue.add(gd, exports.prependTraces, undoArgs, extendTraces, arguments); - - return promise; -}; - -exports.prependTraces = function prependTraces(gd, update, indices, maxPoints) { - gd = Lib.getGraphDiv(gd); - - 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(gd, update, indices, maxPoints, updateArray); - var promise = exports.redraw(gd); - var undoArgs = [gd, undo.update, indices, undo.maxPoints]; - Queue.add(gd, exports.extendTraces, undoArgs, prependTraces, arguments); - - return promise; -}; - -/** - * Add data traces to an existing graph div. - * - * @param {Object|HTMLDivElement} gd The graph div - * @param {Object[]} gd.data The array of traces we're adding to - * @param {Object[]|Object} traces The object or array of objects to add - * @param {Number[]|Number} [newIndices=[gd.data.length]] Locations to add traces - * - */ -exports.addTraces = function addTraces(gd, traces, newIndices) { - gd = Lib.getGraphDiv(gd); - - var currentIndices = [], - undoFunc = exports.deleteTraces, - redoFunc = addTraces, - undoArgs = [gd, currentIndices], - redoArgs = [gd, traces], // no newIndices here - i, - promise; - - // all validation is done elsewhere to remove clutter here - checkAddTracesArgs(gd, traces, newIndices); - - // make sure traces is an array - if(!Array.isArray(traces)) { - traces = [traces]; - } - - // make sure traces do not repeat existing ones - traces = traces.map(function(trace) { - return Lib.extendFlat({}, trace); - }); - - helpers.cleanData(traces); - - // add the traces to gd.data (no redrawing yet!) - for(i = 0; i < traces.length; i++) { - gd.data.push(traces[i]); - } - - // to continue, we need to call moveTraces which requires currentIndices - for(i = 0; i < traces.length; i++) { - currentIndices.push(-traces.length + i); - } - - // if the user didn't define newIndices, they just want the traces appended - // i.e., we can simply redraw and be done - if(typeof newIndices === 'undefined') { - promise = exports.redraw(gd); - Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - return promise; - } - - // make sure indices is property defined - if(!Array.isArray(newIndices)) { - newIndices = [newIndices]; - } - - try { - - // this is redundant, but necessary to not catch later possible errors! - checkMoveTracesArgs(gd, currentIndices, newIndices); - } - catch(error) { - - // something went wrong, reset gd to be safe and rethrow error - gd.data.splice(gd.data.length - traces.length, traces.length); - throw error; - } - - // if we're here, the user has defined specific places to place the new traces - // this requires some extra work that moveTraces will do - Queue.startSequence(gd); - Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - promise = exports.moveTraces(gd, currentIndices, newIndices); - Queue.stopSequence(gd); - return promise; -}; - -/** - * Delete traces at `indices` from gd.data array. - * - * @param {Object|HTMLDivElement} gd The graph div - * @param {Object[]} gd.data The array of traces we're removing from - * @param {Number|Number[]} indices The indices - */ -exports.deleteTraces = function deleteTraces(gd, indices) { - gd = Lib.getGraphDiv(gd); - - var traces = [], - undoFunc = exports.addTraces, - redoFunc = deleteTraces, - undoArgs = [gd, traces, indices], - redoArgs = [gd, indices], - i, - deletedTrace; - - // make sure indices are defined - if(typeof indices === 'undefined') { - throw new Error('indices must be an integer or array of integers.'); - } else if(!Array.isArray(indices)) { - indices = [indices]; - } - assertIndexArray(gd, indices, 'indices'); - - // convert negative indices to positive indices - indices = positivifyIndices(indices, gd.data.length - 1); - - // we want descending here so that splicing later doesn't affect indexing - indices.sort(Lib.sorterDes); - for(i = 0; i < indices.length; i += 1) { - deletedTrace = gd.data.splice(indices[i], 1)[0]; - traces.push(deletedTrace); - } - - var promise = exports.redraw(gd); - Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - - return promise; -}; - -/** - * Move traces at currentIndices array to locations in newIndices array. - * - * If newIndices is omitted, currentIndices will be moved to the end. E.g., - * these are equivalent: - * - * Plotly.moveTraces(gd, [1, 2, 3], [-3, -2, -1]) - * Plotly.moveTraces(gd, [1, 2, 3]) - * - * @param {Object|HTMLDivElement} gd The graph div - * @param {Object[]} gd.data The array of traces we're removing from - * @param {Number|Number[]} currentIndices The locations of traces to be moved - * @param {Number|Number[]} [newIndices] The locations to move traces to - * - * Example calls: - * - * // move trace i to location x - * Plotly.moveTraces(gd, i, x) - * - * // move trace i to end of array - * Plotly.moveTraces(gd, i) - * - * // move traces i, j, k to end of array (i != j != k) - * Plotly.moveTraces(gd, [i, j, k]) - * - * // move traces [i, j, k] to [x, y, z] (i != j != k) (x != y != z) - * Plotly.moveTraces(gd, [i, j, k], [x, y, z]) - * - * // reorder all traces (assume there are 5--a, b, c, d, e) - * Plotly.moveTraces(gd, [b, d, e, a, c]) // same as 'move to end' - */ -exports.moveTraces = function moveTraces(gd, currentIndices, newIndices) { - gd = Lib.getGraphDiv(gd); - - var newData = [], - movingTraceMap = [], - undoFunc = moveTraces, - redoFunc = moveTraces, - undoArgs = [gd, newIndices, currentIndices], - redoArgs = [gd, currentIndices, newIndices], - i; - - // to reduce complexity here, check args elsewhere - // this throws errors where appropriate - checkMoveTracesArgs(gd, currentIndices, newIndices); - - // make sure currentIndices is an array - currentIndices = Array.isArray(currentIndices) ? currentIndices : [currentIndices]; - - // if undefined, define newIndices to point to the end of gd.data array - if(typeof newIndices === 'undefined') { - newIndices = []; - for(i = 0; i < currentIndices.length; i++) { - newIndices.push(-currentIndices.length + i); - } - } - - // make sure newIndices is an array if it's user-defined - newIndices = Array.isArray(newIndices) ? newIndices : [newIndices]; - - // convert negative indices to positive indices (they're the same length) - currentIndices = positivifyIndices(currentIndices, gd.data.length - 1); - newIndices = positivifyIndices(newIndices, gd.data.length - 1); - - // at this point, we've coerced the index arrays into predictable forms - - // get the traces that aren't being moved around - for(i = 0; i < gd.data.length; i++) { - - // if index isn't in currentIndices, include it in ignored! - if(currentIndices.indexOf(i) === -1) { - newData.push(gd.data[i]); - } - } - - // get a mapping of indices to moving traces - for(i = 0; i < currentIndices.length; i++) { - movingTraceMap.push({newIndex: newIndices[i], trace: gd.data[currentIndices[i]]}); - } - - // reorder this mapping by newIndex, ascending - movingTraceMap.sort(function(a, b) { - return a.newIndex - b.newIndex; - }); - - // now, add the moving traces back in, in order! - for(i = 0; i < movingTraceMap.length; i += 1) { - newData.splice(movingTraceMap[i].newIndex, 0, movingTraceMap[i].trace); - } - - gd.data = newData; - - var promise = exports.redraw(gd); - Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - - return promise; -}; - -/** - * restyle: update trace attributes of an existing plot - * - * Can be called two ways. - * - * Signature 1: - * @param {String | HTMLDivElement} gd - * the id or DOM element of the graph container div - * @param {String} astr - * attribute string (like `'marker.symbol'`) to update - * @param {*} val - * value to give this attribute - * @param {Number[] | Number} [traces] - * integer or array of integers for the traces to alter (all if omitted) - * - * Signature 2: - * @param {String | HTMLDivElement} gd - * (as in signature 1) - * @param {Object} aobj - * attribute object `{astr1: val1, astr2: val2 ...}` - * allows setting multiple attributes simultaneously - * @param {Number[] | Number} [traces] - * (as in signature 1) - * - * `val` (or `val1`, `val2` ... in the object form) can be an array, - * to apply different values to each trace. - * - * If the array is too short, it will wrap around (useful for - * style files that want to specify cyclical default values). - */ -exports.restyle = function restyle(gd, astr, val, _traces) { - gd = Lib.getGraphDiv(gd); - helpers.clearPromiseQueue(gd); - - var aobj = {}; - if(typeof astr === 'string') aobj[astr] = val; - else if(Lib.isPlainObject(astr)) { - // the 3-arg form - aobj = Lib.extendFlat({}, astr); - if(_traces === undefined) _traces = val; - } - else { - Lib.warn('Restyle fail.', astr, val, _traces); - return Promise.reject(); - } - - if(Object.keys(aobj).length) gd.changed = true; - - var traces = helpers.coerceTraceIndices(gd, _traces); - - var specs = _restyle(gd, aobj, traces); - var flags = specs.flags; - - // clear calcdata and/or axis types if required so they get regenerated - if(flags.calc) gd.calcdata = undefined; - if(flags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, {}); - - // fill in redraw sequence - var seq = []; - - if(flags.fullReplot) { - seq.push(exports.plot); - } else { - seq.push(Plots.previousPromises); - - // maybe only call Plots.supplyDataDefaults in the splom case, - // to skip over long and slow axes defaults - Plots.supplyDefaults(gd); - - if(flags.markerSize) { - Plots.doCalcdata(gd); - addAxRangeSequence(seq); - - // TODO - // if all axes have autorange:false, then - // proceed to subroutines.doTraceStyle(), - // otherwise we must go through addAxRangeSequence, - // which in general must redraws 'all' axes - } - - if(flags.style) seq.push(subroutines.doTraceStyle); - if(flags.colorbars) seq.push(subroutines.doColorBars); - - seq.push(emitAfterPlot); - } - - seq.push(Plots.rehover); - - Queue.add(gd, - restyle, [gd, specs.undoit, specs.traces], - restyle, [gd, specs.redoit, specs.traces] - ); - - var plotDone = Lib.syncOrAsync(seq, gd); - if(!plotDone || !plotDone.then) plotDone = Promise.resolve(); - - return plotDone.then(function() { - gd.emit('plotly_restyle', specs.eventData); - return gd; - }); -}; - -// for undo: undefined initial vals must be turned into nulls -// so that we unset rather than ignore them -function undefinedToNull(val) { - if(val === undefined) return null; - return val; -} - -function _restyle(gd, aobj, traces) { - var fullLayout = gd._fullLayout, - fullData = gd._fullData, - data = gd.data, - i; - - // initialize flags - var flags = editTypes.traceFlags(); - - // copies of the change (and previous values of anything affected) - // for the undo / redo queue - var redoit = {}, - undoit = {}, - axlist; - - // make a new empty vals array for undoit - function a0() { return traces.map(function() { return undefined; }); } - - // for autoranging multiple axes - 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'; } - - // for attrs that interact (like scales & autoscales), save the - // old vals before making the change - // val=undefined will not set a value, just record what the value was. - // val=null will delete the attribute - // attr can be an array to set several at once (all to the same val) - function doextra(attr, val, i) { - if(Array.isArray(attr)) { - attr.forEach(function(a) { doextra(a, val, i); }); - return; - } - // quit if explicitly setting this elsewhere - if(attr in aobj || helpers.hasParent(aobj, attr)) return; - - var extraparam; - if(attr.substr(0, 6) === 'LAYOUT') { - extraparam = Lib.nestedProperty(gd.layout, attr.replace('LAYOUT', '')); - } else { - extraparam = Lib.nestedProperty(data[traces[i]], attr); - } - - if(!(attr in undoit)) { - undoit[attr] = a0(); - } - if(undoit[attr][i] === undefined) { - undoit[attr][i] = undefinedToNull(extraparam.get()); - } - if(val !== undefined) { - 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; - }; - } - - // now make the changes to gd.data (and occasionally gd.layout) - // and figure out what kind of graphics update we need to do - for(var ai in aobj) { - if(helpers.hasParent(aobj, ai)) { - throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously'); - } - - var vi = aobj[ai], - cont, - contFull, - param, - oldVal, - newVal, - valObject; - - // Backward compatibility shim for turning histogram autobin on, - // or freezing previous autobinned values. - // Replace obsolete `autobin(x|y): true` with `(x|y)bins: null` - // and `autobin(x|y): false` with the `(x|y)bins` in `fullData` - if(ai === 'autobinx' || ai === 'autobiny') { - ai = ai.charAt(ai.length - 1) + 'bins'; - if(Array.isArray(vi)) vi = vi.map(arrayBins(ai)); - else if(vi === false) vi = traces.map(allBins(ai)); - else vi = null; - } - - redoit[ai] = vi; - - if(ai.substr(0, 6) === 'LAYOUT') { - param = Lib.nestedProperty(gd.layout, ai.replace('LAYOUT', '')); - undoit[ai] = [undefinedToNull(param.get())]; - // since we're allowing val to be an array, allow it here too, - // even though that's meaningless - param.set(Array.isArray(vi) ? vi[0] : vi); - // ironically, the layout attrs in restyle only require replot, - // not relayout - flags.calc = true; - continue; - } - - // set attribute in gd.data - undoit[ai] = a0(); - for(i = 0; i < traces.length; i++) { - cont = data[traces[i]]; - contFull = fullData[traces[i]]; - param = Lib.nestedProperty(cont, ai); - oldVal = param.get(); - newVal = Array.isArray(vi) ? vi[i % vi.length] : vi; - - if(newVal === undefined) continue; - - var finalPart = param.parts[param.parts.length - 1]; - var prefix = ai.substr(0, ai.length - finalPart.length - 1); - var prefixDot = prefix ? prefix + '.' : ''; - var innerContFull = prefix ? - Lib.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(ai, impliedKey), valObject.impliedEdits[impliedKey], i); - } - } - - // changing colorbar size modes, - // make the resulting size not change - // note that colorbar fractional sizing is based on the - // original plot size, before anything (like a colorbar) - // increases the margins - else if((finalPart === 'thicknessmode' || finalPart === 'lenmode') && - oldVal !== newVal && - (newVal === 'fraction' || newVal === 'pixels') && - innerContFull - ) { - var gs = fullLayout._size; - var orient = innerContFull.orient; - var topOrBottom = (orient === 'top') || (orient === 'bottom'); - if(finalPart === 'thicknessmode') { - var thicknorm = topOrBottom ? gs.h : gs.w; - doextra(prefixDot + 'thickness', innerContFull.thickness * - (newVal === 'fraction' ? 1 / thicknorm : thicknorm), i); - } - else { - var lennorm = topOrBottom ? gs.w : gs.h; - doextra(prefixDot + 'len', innerContFull.len * - (newVal === 'fraction' ? 1 / lennorm : lennorm), i); - } - } - - else if(ai === 'type' && (newVal === 'pie') !== (oldVal === 'pie')) { - var labelsTo = 'x', - 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') { - Lib.nestedProperty(cont, 'marker.color') - .set(Lib.nestedProperty(cont, 'marker.colors').get()); - - // super kludgy - but if all pies are gone we won't remove them otherwise - fullLayout._pielayer.selectAll('g.trace').remove(); - } else if(Registry.traceIs(cont, 'cartesian')) { - Lib.nestedProperty(cont, 'marker.colors') - .set(Lib.nestedProperty(cont, 'marker.color').get()); - } - } - - undoit[ai][i] = undefinedToNull(oldVal); - // set the new value - if val is an array, it's one el per trace - // first check for attributes that get more complex alterations - var swapAttrs = [ - 'swapxy', 'swapxyaxes', 'orientation', 'orientationaxes' - ]; - if(swapAttrs.indexOf(ai) !== -1) { - // setting an orientation: make sure it's changing - // before we swap everything else - if(ai === 'orientation') { - param.set(newVal); - // obnoxious that we need this level of coupling... but in order to - // properly handle setting orientation to `null` we need to mimic - // the logic inside Bars.supplyDefaults for default orientation - var defaultOrientation = (cont.x && !cont.y) ? 'h' : 'v'; - if((param.get() || defaultOrientation) === contFull.orientation) { - continue; - } - } - // orientationaxes has no value, - // it flips everything and the axes - else if(ai === '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) { - // TODO: use manageArrays.applyContainerArrayChanges here too - helpers.manageArrayContainers(param, newVal, undoit); - flags.calc = true; - } - else { - if(valObject) { - // must redo calcdata when restyling array values of arrayOk attributes - // ... but no need to this for regl-based traces - if(valObject.arrayOk && - !Registry.traceIs(contFull, 'regl') && - (Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal)) - ) { - flags.calc = true; - } - else editTypes.update(flags, valObject); - } - else { - /* - * if we couldn't find valObject, assume a full recalc. - * This can happen if you're changing type and making - * some other edits too, so the modules we're - * looking at don't have these attributes in them. - */ - flags.calc = true; - } - - // all the other ones, just modify that one attribute - param.set(newVal); - } - } - - // swap the data attributes of the relevant x and y axes? - if(['swapxyaxes', 'orientationaxes'].indexOf(ai) !== -1) { - Axes.swap(gd, traces); + + if (promiseToString === '[object Promise]' && !P.cast) { + return; } + } - // swap hovermode if set to "compare x/y data" - if(ai === 'orientationaxes') { - var hovermode = Lib.nestedProperty(gd.layout, 'hovermode'); - if(hovermode.get() === 'x') { - hovermode.set('y'); - } else if(hovermode.get() === 'y') { - hovermode.set('x'); - } - } + local.Promise = Promise; +} - // Major enough changes deserve autoscale and - // non-reversed axes so people don't get confused - // - // Note: autobin (or its new analog bin clearing) is not included here - // since we're not pushing bins back to gd.data, so if we have bin - // info it was explicitly provided by the user. - if(['orientation', 'type'].indexOf(ai) !== -1) { - axlist = []; - for(i = 0; i < traces.length; i++) { - var trace = data[traces[i]]; +polyfill(); +// Strange compat.. +Promise.polyfill = polyfill; +Promise.Promise = Promise; - if(Registry.traceIs(trace, 'cartesian')) { - addToAxlist(trace.xaxis || 'x'); - addToAxlist(trace.yaxis || 'y'); - } - } +return Promise; - doextra(axlist.map(autorangeAttr), true, 0); - doextra(axlist.map(rangeAttr), [0, 1], 0); - } - } +}))); - if(flags.calc || flags.plot) { - flags.fullReplot = true; - } +}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":25}],10:[function(_dereq_,module,exports){ +/** + * inspired by is-number + * but significantly simplified and sped up by ignoring number and string constructors + * ie these return false: + * new Number(1) + * new String('1') + */ + +'use strict'; + +var allBlankCharCodes = _dereq_('is-string-blank'); + +module.exports = function(n) { + var type = typeof n; + if(type === 'string') { + var original = n; + n = +n; + // whitespace strings cast to zero - filter them out + if(n===0 && allBlankCharCodes(original)) return false; + } + else if(type !== 'number') return false; + + return n - n < 1; +}; - return { - flags: flags, - undoit: undoit, - redoit: redoit, - traces: traces, - eventData: Lib.extendDeepNoArrays([], [redoit, traces]) - }; -} +},{"is-string-blank":15}],11:[function(_dereq_,module,exports){ +module.exports = fromQuat; /** - * relayout: update layout attributes of an existing plot - * - * Can be called two ways: - * - * Signature 1: - * @param {String | HTMLDivElement} gd - * the id or dom element of the graph container div - * @param {String} astr - * attribute string (like `'xaxis.range[0]'`) to update - * @param {*} val - * value to give this attribute + * Creates a matrix from a quaternion rotation. * - * Signature 2: - * @param {String | HTMLDivElement} gd - * (as in signature 1) - * @param {Object} aobj - * attribute object `{astr1: val1, astr2: val2 ...}` - * allows setting multiple attributes simultaneously + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @returns {mat4} out */ -exports.relayout = function relayout(gd, astr, val) { - gd = Lib.getGraphDiv(gd); - helpers.clearPromiseQueue(gd); - - if(gd.framework && gd.framework.isPolar) { - return Promise.resolve(gd); - } - - 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) gd.changed = true; - - var specs = _relayout(gd, aobj); - var flags = specs.flags; - - // clear calcdata if required - if(flags.calc) gd.calcdata = undefined; - - // fill in redraw sequence - - // even if we don't have anything left in aobj, - // something may have happened within relayout that we - // need to wait for - var seq = [Plots.previousPromises]; - - if(flags.layoutReplot) { - seq.push(subroutines.layoutReplot); - } - else if(Object.keys(aobj).length) { - axRangeSupplyDefaultsByPass(gd, flags, specs) || Plots.supplyDefaults(gd); +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, - 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); + 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; - seq.push(emitAfterPlot); - } + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; - seq.push(Plots.rehover); + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; - Queue.add(gd, - relayout, [gd, specs.undoit], - relayout, [gd, specs.redoit] - ); + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; - var plotDone = Lib.syncOrAsync(seq, gd); - if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd); + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; - return plotDone.then(function() { - gd.emit('plotly_relayout', specs.eventData); - return gd; - }); + return out; }; +},{}],12:[function(_dereq_,module,exports){ +(function (global){ +'use strict' + +var isBrowser = _dereq_('is-browser') +var hasHover + +if (typeof global.matchMedia === 'function') { + hasHover = !global.matchMedia('(hover: none)').matches +} +else { + hasHover = isBrowser +} + +module.exports = hasHover -// Optimization mostly for large splom traces where -// Plots.supplyDefaults can take > 100ms -function axRangeSupplyDefaultsByPass(gd, flags, specs) { - var k; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":14}],13:[function(_dereq_,module,exports){ +'use strict' + +var isBrowser = _dereq_('is-browser') + +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 +} + +module.exports = isBrowser && detect() - if(!flags.axrange) return false; +},{"is-browser":14}],14:[function(_dereq_,module,exports){ +module.exports = true; +},{}],15:[function(_dereq_,module,exports){ +'use strict'; + +/** + * Is this string all whitespace? + * This solution kind of makes my brain hurt, but it's significantly faster + * than !str.trim() or any other solution I could find. + * + * whitespace codes from: http://en.wikipedia.org/wiki/Whitespace_character + * and verified with: + * + * for(var i = 0; i < 65536; i++) { + * var s = String.fromCharCode(i); + * if(+s===0 && !s.trim()) console.log(i, s); + * } + * + * which counts a couple of these as *not* whitespace, but finds nothing else + * that *is* whitespace. Note that charCodeAt stops at 16 bits, but it appears + * that there are no whitespace characters above this, and code points above + * this do not map onto white space characters. + */ + +module.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; +} - for(k in flags) { - if(k !== 'axrange' && flags[k]) return false; - } +},{}],16:[function(_dereq_,module,exports){ +var rootPosition = { left: 0, top: 0 } - for(k in specs.rangesAltered) { - var axName = Axes.id2name(k); - var axIn = gd.layout[axName]; - var axOut = gd._fullLayout[axName]; - axOut.autorange = axIn.autorange; - axOut.range = axIn.range.slice(); - axOut.cleanRange(); - } - return true; +module.exports = mouseEventOffset +function mouseEventOffset (ev, target, out) { + target = target || ev.currentTarget || ev.srcElement + if (!Array.isArray(out)) { + out = [ 0, 0 ] + } + var cx = ev.clientX || 0 + var cy = ev.clientY || 0 + var rect = getBoundingClientOffset(target) + out[0] = cx - rect.left + out[1] = cy - rect.top + return out } -function addAxRangeSequence(seq, rangesAltered) { - // N.B. leave as sequence of subroutines (for now) instead of - // subroutine of its own so that finalDraw always gets - // executed after drawData - var doTicks = rangesAltered ? - function(gd) { return Axes.doTicks(gd, Object.keys(rangesAltered), true); } : - function(gd) { return Axes.doTicks(gd, 'redraw'); }; - - seq.push( - subroutines.doAutoRangeAndConstraints, - doTicks, - subroutines.drawData, - subroutines.finalDraw - ); +function getBoundingClientOffset (element) { + if (element === window || + element === document || + element === document.body) { + return rootPosition + } else { + return element.getBoundingClientRect() + } } -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(gd, aobj) { - var layout = gd.layout, - fullLayout = gd._fullLayout, - keys = Object.keys(aobj), - axes = Axes.list(gd), - arrayEdits = {}, - arrayStr, - i, - j; - - // look for 'allaxes', split out into all axes - // in case of 3D the axis are nested within a scene which is held in _id - 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), - axisAttr = (scene.indexOf('scene') !== -1) ? (scene + '.') : '', - newkey = keys[i].replace('allaxes', axisAttr + axes[j]._name); - - if(!aobj[newkey]) aobj[newkey] = aobj[keys[i]]; - } - - delete aobj[keys[i]]; - } - } - - // initialize flags - var flags = editTypes.layoutFlags(); - - // copies of the change (and previous values of anything affected) - // for the undo / redo queue - var redoit = {}, - undoit = {}; - - // for attrs that interact (like scales & autoscales), save the - // old vals before making the change - // val=undefined will not set a value, just record what the value was. - // attr can be an array to set several at once (all to the same val) - function doextra(attr, val) { - if(Array.isArray(attr)) { - attr.forEach(function(a) { doextra(a, val); }); - return; - } - - // if we have another value for this attribute (explicitly or - // via a parent) do not override with this auto-generated extra - if(attr in aobj || helpers.hasParent(aobj, attr)) return; - - var p = Lib.nestedProperty(layout, attr); - if(!(attr in undoit)) { - undoit[attr] = undefinedToNull(p.get()); - } - if(val !== undefined) p.set(val); - } +},{}],17:[function(_dereq_,module,exports){ +/* + * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc + * @license MIT + * @preserve Project Home: https://github.com/voidqk/polybooljs + */ - // for constraint enforcement: keep track of all axes (as {id: name}) - // we're editing the (auto)range of, so we can tell the others constrained - // to scale with them that it's OK for them to shrink - var rangesAltered = {}; - var axId; +var BuildLog = _dereq_('./lib/build-log'); +var Epsilon = _dereq_('./lib/epsilon'); +var Intersecter = _dereq_('./lib/intersecter'); +var SegmentChainer = _dereq_('./lib/segment-chainer'); +var SegmentSelector = _dereq_('./lib/segment-selector'); +var GeoJSON = _dereq_('./lib/geojson'); - function recordAlteredAxis(pleafPlus) { - var axId = Axes.name2id(pleafPlus.split('.')[0]); - rangesAltered[axId] = 1; - return axId; - } +var buildLog = false; +var epsilon = Epsilon(); - // alter gd.layout - for(var ai in aobj) { - if(helpers.hasParent(aobj, ai)) { - throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously'); - } +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); + }, - var p = Lib.nestedProperty(layout, ai); - var vi = aobj[ai]; - var plen = p.parts.length; - // p.parts may end with an index integer if the property is an array - var pend = plen - 1; - while(pend > 0 && typeof p.parts[pend] !== 'string') pend--; - // last property in chain (leaf node) - var pleaf = p.parts[pend]; - // leaf plus immediate parent - var pleafPlus = p.parts[pend - 1] + '.' + pleaf; - // trunk nodes (everything except the leaf) - var ptrunk = p.parts.slice(0, pend).join('.'); - var parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(); - var parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); - var vOld = p.get(); + // 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 + }; + }, - if(vi === undefined) continue; + // GeoJSON converters + polygonFromGeoJSON: function(geojson){ + return GeoJSON.toPolygon(PolyBool, geojson); + }, + polygonToGeoJSON: function(poly){ + return GeoJSON.fromPolygon(PolyBool, epsilon, poly); + }, - redoit[ai] = vi; + // 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); + } +}; - // axis reverse is special - it is its own inverse - // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : undefinedToNull(vOld); +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); +} - var valObject = PlotSchema.getLayoutValObject(fullLayout, p.parts); +if (typeof window === 'object') + window.PolyBool = PolyBool; - if(valObject && valObject.impliedEdits && vi !== null) { - for(var impliedKey in valObject.impliedEdits) { - doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey]); - } - } +module.exports = PolyBool; - // Setting width or height to null must reset the graph's width / height - // back to its initial value as computed during the first pass in Plots.plotAutoSize. - // - // To do so, we must manually set them back here using the _initialAutoSize cache. - // can't use impliedEdits for this because behavior depends on vi - if(['width', 'height'].indexOf(ai) !== -1) { - if(vi) { - doextra('autosize', null); - // currently we don't support autosize one dim only - so - // explicitly set the other one. Note that doextra will - // ignore this if the same relayout call also provides oppositeAttr - var oppositeAttr = ai === 'height' ? 'width' : 'height'; - doextra(oppositeAttr, fullLayout[oppositeAttr]); - } - else { - fullLayout[ai] = gd._initialAutoSize[ai]; - } - } - else if(ai === 'autosize') { - // depends on vi here too, so again can't use impliedEdits - doextra('width', vi ? null : fullLayout.width); - doextra('height', vi ? null : fullLayout.height); - } - // check autorange vs range - else if(pleafPlus.match(AX_RANGE_RE)) { - recordAlteredAxis(pleafPlus); - Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); - } - else if(pleafPlus.match(AX_AUTORANGE_RE)) { - recordAlteredAxis(pleafPlus); - Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); - var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); - if(axFull._inputDomain) { - // if we're autoranging and this axis has a constrained domain, - // reset it so we don't get locked into a shrunken size - axFull._input.domain = axFull._inputDomain.slice(); - } - } - else if(pleafPlus.match(AX_DOMAIN_RE)) { - Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); - } +},{"./lib/build-log":18,"./lib/epsilon":19,"./lib/geojson":20,"./lib/intersecter":21,"./lib/segment-chainer":23,"./lib/segment-selector":24}],18:[function(_dereq_,module,exports){ +// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - // toggling axis type between log and linear: we need to convert - // positions for components that are still using linearized values, - // not data values like newer components. - // previously we did this for log <-> not-log, but now only do it - // for log <-> linear - if(pleaf === 'type') { - var ax = parentIn, - toLog = parentFull.type === 'linear' && vi === 'log', - fromLog = parentFull.type === 'log' && vi === 'linear'; +// +// used strictly for logging the processing of the algorithm... only useful if you intend on +// looking under the covers (for pretty UI's or debugging) +// - if(toLog || fromLog) { - if(!ax || !ax.range) { - // 2D never gets here, but 3D does - // I don't think this is needed, but left here in case there - // are edge cases I'm not thinking of. - doextra(ptrunk + '.autorange', true); - } - else if(!parentFull.autorange) { - // toggling log without autorange: need to also recalculate ranges - // because log axes use linearized values for range endpoints - var r0 = ax.range[0], - r1 = ax.range[1]; - if(toLog) { - // if both limits are negative, autorange - if(r0 <= 0 && r1 <= 0) { - doextra(ptrunk + '.autorange', true); - } - // if one is negative, set it 6 orders below the other. - if(r0 <= 0) r0 = r1 / 1e6; - else if(r1 <= 0) r1 = r0 / 1e6; - // now set the range values as appropriate - doextra(ptrunk + '.range[0]', Math.log(r0) / Math.LN10); - doextra(ptrunk + '.range[1]', Math.log(r1) / Math.LN10); - } - else { - doextra(ptrunk + '.range[0]', Math.pow(10, r0)); - doextra(ptrunk + '.range[1]', Math.pow(10, r1)); - } - } - else if(toLog) { - // just make sure the range is positive and in the right - // order, it'll get recalculated later - ax.range = (ax.range[1] > ax.range[0]) ? [1, 2] : [2, 1]; - } +function BuildLog(){ + var my; + var nextSegmentId = 0; + var curVert = false; - // clear polar view initial stash for radial range so that - // value get recomputed in correct units - 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']; - } + function push(type, data){ + my.list.push({ + type: type, + data: data ? JSON.parse(JSON.stringify(data)) : void 0 + }); + return my; + } - // Annotations and images also need to convert to/from linearized coords - // Shapes do not need this :) - Registry.getComponentMethod('annotations', 'convertCoords')(gd, parentFull, vi, doextra); - Registry.getComponentMethod('images', 'convertCoords')(gd, parentFull, vi, doextra); - } - else { - // any other type changes: the range from the previous type - // will not make sense, so autorange it. - doextra(ptrunk + '.autorange', true); - doextra(ptrunk + '.range', null); - } - Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); - } - else if(pleaf.match(AX_NAME_PATTERN)) { - var fullProp = Lib.nestedProperty(fullLayout, ai).get(), - newType = (vi || {}).type; + my = { + list: [], + segmentId: function(){ + return nextSegmentId++; + }, + checkIntersection: function(seg1, seg2){ + return push('check', { seg1: seg1, seg2: seg2 }); + }, + segmentChop: function(seg, end){ + push('div_seg', { seg: seg, pt: end }); + return push('chop', { seg: seg, pt: end }); + }, + statusRemove: function(seg){ + return push('pop_seg', { seg: seg }); + }, + segmentUpdate: function(seg){ + return push('seg_update', { seg: seg }); + }, + segmentNew: function(seg, primary){ + return push('new_seg', { seg: seg, primary: primary }); + }, + segmentRemove: function(seg){ + return push('rem_seg', { seg: seg }); + }, + tempStatus: function(seg, above, below){ + return push('temp_status', { seg: seg, above: above, below: below }); + }, + rewind: function(seg){ + return push('rewind', { seg: seg }); + }, + status: function(seg, above, below){ + return push('status', { seg: seg, above: above, below: below }); + }, + vert: function(x){ + if (x === curVert) + return my; + curVert = x; + return push('vert', { x: 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: segs }); + }, + chainStart: function(seg){ + return push('chain_start', { seg: seg }); + }, + chainRemoveHead: function(index, pt){ + return push('chain_rem_head', { index: index, pt: pt }); + }, + chainRemoveTail: function(index, pt){ + return push('chain_rem_tail', { index: index, pt: pt }); + }, + chainNew: function(pt1, pt2){ + return push('chain_new', { pt1: pt1, pt2: pt2 }); + }, + chainMatch: function(index){ + return push('chain_match', { index: index }); + }, + chainClose: function(index){ + return push('chain_close', { index: index }); + }, + chainAddHead: function(index, pt){ + return push('chain_add_head', { index: index, pt: pt }); + }, + chainAddTail: function(index, pt){ + return push('chain_add_tail', { index: index, pt: pt, }); + }, + chainConnect: function(index1, index2){ + return push('chain_con', { index1: index1, index2: index2 }); + }, + chainReverse: function(index){ + return push('chain_rev', { index: index }); + }, + chainJoin: function(index1, index2){ + return push('chain_join', { index1: index1, index2: index2 }); + }, + done: function(){ + return push('done'); + } + }; + return my; +} - // This can potentially cause strange behavior if the autotype is not - // numeric (linear, because we don't auto-log) but the previous type - // was log. That's a very strange edge case though - if(!newType || newType === '-') newType = 'linear'; - Registry.getComponentMethod('annotations', 'convertCoords')(gd, fullProp, newType, doextra); - Registry.getComponentMethod('images', 'convertCoords')(gd, fullProp, newType, doextra); - } +module.exports = BuildLog; - // alter gd.layout +},{}],19:[function(_dereq_,module,exports){ +// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - // collect array component edits for execution all together - // so we can ensure consistent behavior adding/removing items - // and order-independence for add/remove/edit all together in - // one relayout call - var containerArrayMatch = manageArrays.containerArrayMatch(ai); - if(containerArrayMatch) { - arrayStr = containerArrayMatch.array; - i = containerArrayMatch.index; - var propStr = containerArrayMatch.property; - var componentArray = Lib.nestedProperty(layout, arrayStr); - var obji = (componentArray || [])[i] || {}; - var updateValObject = valObject || {editType: 'calc'}; +// +// provides the raw computation functions that takes epsilon into account +// +// zero is defined to be between (-epsilon, epsilon) exclusive +// - if(i !== '' && propStr === '') { - // special handling of undoit if we're adding or removing an element - // ie 'annotations[2]' which can be {...} (add) or null, - // does not work when replacing the entire array - if(manageArrays.isAddVal(vi)) { - undoit[ai] = null; - } else if(manageArrays.isRemoveVal(vi)) { - undoit[ai] = obji; - } else { - Lib.warn('unrecognized full object value', aobj); - } - } - editTypes.update(flags, updateValObject); +function Epsilon(eps){ + if (typeof eps !== 'number') + eps = 0.0000000001; // sane default? sure why not + var my = { + epsilon: function(v){ + if (typeof v === 'number') + eps = v; + return eps; + }, + pointAboveOrOnLine: function(pt, left, right){ + var Ax = left[0]; + var Ay = left[1]; + var Bx = right[0]; + var By = right[1]; + var Cx = pt[0]; + var Cy = pt[1]; + return (Bx - Ax) * (Cy - Ay) - (By - Ay) * (Cx - Ax) >= -eps; + }, + pointBetween: function(p, left, right){ + // p must be collinear with left->right + // returns false if p == left, p == right, or 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]; - // prepare the edits object we'll send to applyContainerArrayChanges - if(!arrayEdits[arrayStr]) arrayEdits[arrayStr] = {}; - var objEdits = arrayEdits[arrayStr][i]; - if(!objEdits) objEdits = arrayEdits[arrayStr][i] = {}; - objEdits[propStr] = vi; + var dot = d_px_lx * d_rx_lx + d_py_ly * d_ry_ly; + // if `dot` is 0, then `p` == `left` or `left` == `right` (reject) + // if `dot` is less than 0, then `p` is to the left of `left` (reject) + if (dot < eps) + return false; - delete aobj[ai]; - } - // handle axis reversal explicitly, as there's no 'reverse' attribute - else if(pleaf === 'reverse') { - if(parentIn.range) parentIn.range.reverse(); - else { - doextra(ptrunk + '.autorange', true); - parentIn.range = [1, 0]; - } + var sqlen = d_rx_lx * d_rx_lx + d_ry_ly * d_ry_ly; + // if `dot` > `sqlen`, then `p` is to the right of `right` (reject) + // therefore, if `dot - sqlen` is greater than 0, then `p` is to the right of `right` (reject) + if (dot - sqlen > -eps) + return false; - if(parentFull.autorange) flags.calc = true; - else flags.plot = true; - } - else { - if((fullLayout._has('scatter-like') && fullLayout._has('regl')) && - (ai === 'dragmode' && - (vi === 'lasso' || vi === 'select') && - !(vOld === 'lasso' || vOld === 'select')) - ) { - flags.plot = true; - } - else if(valObject) editTypes.update(flags, valObject); - else flags.calc = true; + return true; + }, + pointsSameX: function(p1, p2){ + return Math.abs(p1[0] - p2[0]) < eps; + }, + pointsSameY: function(p1, p2){ + return Math.abs(p1[1] - p2[1]) < eps; + }, + pointsSame: function(p1, p2){ + return my.pointsSameX(p1, p2) && my.pointsSameY(p1, p2); + }, + pointsCompare: function(p1, p2){ + // returns -1 if p1 is smaller, 1 if p2 is smaller, 0 if equal + if (my.pointsSameX(p1, p2)) + return my.pointsSameY(p1, p2) ? 0 : (p1[1] < p2[1] ? -1 : 1); + return p1[0] < p2[0] ? -1 : 1; + }, + pointsCollinear: function(pt1, pt2, pt3){ + // does pt1->pt2->pt3 make a straight line? + // essentially this is just checking to see if the slope(pt1->pt2) === slope(pt2->pt3) + // if slopes are equal, then they must be collinear, because they share pt2 + 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(a0, a1, b0, b1){ + // returns false if the lines are coincident (e.g., parallel or on top of each other) + // + // returns an object if the lines intersect: + // { + // pt: [x, y], where the intersection point is at + // alongA: where intersection point is along A, + // alongB: where intersection point is along B + // } + // + // alongA and alongB will each be one of: -2, -1, 0, 1, 2 + // + // with the following meaning: + // + // -2 intersection point is before segment's first point + // -1 intersection point is directly on segment's first point + // 0 intersection point is between segment's first and second points (exclusive) + // 1 intersection point is directly on segment's second point + // 2 intersection point is after segment's second point + var adx = a1[0] - a0[0]; + var ady = a1[1] - a0[1]; + var bdx = b1[0] - b0[0]; + var bdy = b1[1] - b0[1]; - p.set(vi); - } - } + var axb = adx * bdy - ady * bdx; + if (Math.abs(axb) < eps) + return false; // lines are coincident - // now we've collected component edits - execute them all together - for(arrayStr in arrayEdits) { - var finished = manageArrays.applyContainerArrayChanges(gd, - Lib.nestedProperty(layout, arrayStr), arrayEdits[arrayStr], flags); - if(!finished) flags.plot = true; - } + var dx = a0[0] - b0[0]; + var dy = a0[1] - b0[1]; - // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } - } - } - } - } + var A = (bdx * dy - bdy * dx) / axb; + var B = (adx * dy - ady * dx) / axb; - // If the autosize changed or height or width was explicitly specified, - // this triggers a redraw - // TODO: do we really need special aobj.height/width handling here? - // couldn't editType do this? - if(updateAutosize(gd) || aobj.height || aobj.width) flags.plot = true; + var ret = { + alongA: 0, + alongB: 0, + pt: [ + a0[0] + A * adx, + a0[1] + A * ady + ] + }; - if(flags.plot || flags.calc) { - flags.layoutReplot = true; - } + // categorize where intersection point is along A and B - // now all attribute mods are done, as are - // redo and undo so we can save them + 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; - return { - flags: flags, - rangesAltered: rangesAltered, - undoit: undoit, - redoit: redoit, - eventData: Lib.extendDeep({}, redoit) - }; -} + 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; -/* - * updateAutosize: we made a change, does it change the autosize result? - * puts the new size into fullLayout - * returns true if either height or width changed - */ -function updateAutosize(gd) { - var fullLayout = gd._fullLayout; - var oldWidth = fullLayout.width; - var oldHeight = fullLayout.height; + return ret; + }, + pointInsideRegion: function(pt, region){ + var x = pt[0]; + var y = pt[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]; - // calculate autosizing - if(gd.layout.autosize) Plots.plotAutoSize(gd, gd.layout, fullLayout); + // if y is between curr_y and last_y, and + // x is to the right of the boundary created by the line + 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 - return (fullLayout.width !== oldWidth) || (fullLayout.height !== oldHeight); + last_x = curr_x; + last_y = curr_y; + } + return inside; + } + }; + return my; } -/** - * update: update trace and layout attributes of an existing plot - * - * @param {String | HTMLDivElement} gd - * the id or DOM element of the graph container div - * @param {Object} traceUpdate - * attribute object `{astr1: val1, astr2: val2 ...}` - * corresponding to updates in the plot's traces - * @param {Object} layoutUpdate - * attribute object `{astr1: val1, astr2: val2 ...}` - * corresponding to updates in the plot's layout - * @param {Number[] | Number} [traces] - * integer or array of integers for the traces to alter (all if omitted) - * - */ -exports.update = function update(gd, traceUpdate, layoutUpdate, _traces) { - gd = Lib.getGraphDiv(gd); - helpers.clearPromiseQueue(gd); - - if(gd.framework && gd.framework.isPolar) { - return Promise.resolve(gd); - } +module.exports = Epsilon; - if(!Lib.isPlainObject(traceUpdate)) traceUpdate = {}; - if(!Lib.isPlainObject(layoutUpdate)) layoutUpdate = {}; +},{}],20:[function(_dereq_,module,exports){ +// (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - if(Object.keys(traceUpdate).length) gd.changed = true; - if(Object.keys(layoutUpdate).length) gd.changed = true; +// +// convert between PolyBool polygon format and GeoJSON formats (Polygon and MultiPolygon) +// - var traces = helpers.coerceTraceIndices(gd, _traces); +var GeoJSON = { + // convert a GeoJSON object to a PolyBool polygon + toPolygon: function(PolyBool, geojson){ - var restyleSpecs = _restyle(gd, Lib.extendFlat({}, traceUpdate), traces); - var restyleFlags = restyleSpecs.flags; + // converts list of LineString's to segments + function GeoPoly(coords){ + // check for empty coords + if (coords.length <= 0) + return PolyBool.segments({ inverted: false, regions: [] }); - var relayoutSpecs = _relayout(gd, Lib.extendFlat({}, layoutUpdate)); - var relayoutFlags = relayoutSpecs.flags; + // convert LineString to segments + function LineString(ls){ + // remove tail which should be the same as head + var reg = ls.slice(0, ls.length - 1); + return PolyBool.segments({ inverted: false, regions: [reg] }); + } - // clear calcdata and/or axis types if required - if(restyleFlags.calc || relayoutFlags.calc) gd.calcdata = undefined; - if(restyleFlags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, layoutUpdate); + // the first LineString is considered the outside + var out = LineString(coords[0]); - // fill in redraw sequence - var seq = []; + // the rest of the LineStrings are considered interior holes, so subtract them from the + // current result + for (var i = 1; i < coords.length; i++) + out = PolyBool.selectDifference(PolyBool.combine(out, LineString(coords[i]))); - if(restyleFlags.fullReplot && relayoutFlags.layoutReplot) { - var data = gd.data, - layout = gd.layout; + return out; + } - // clear existing data/layout on gd - // so that Plotly.plot doesn't try to extend them - gd.data = undefined; - gd.layout = undefined; + if (geojson.type === 'Polygon'){ + // single polygon, so just convert it and we're done + return PolyBool.polygon(GeoPoly(geojson.coordinates)); + } + else if (geojson.type === 'MultiPolygon'){ + // multiple polygons, so union all the polygons together + 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'); + }, - seq.push(function() { return exports.plot(gd, data, layout); }); - } - else if(restyleFlags.fullReplot) { - seq.push(exports.plot); - } - else if(relayoutFlags.layoutReplot) { - seq.push(subroutines.layoutReplot); - } - else { - seq.push(Plots.previousPromises); - axRangeSupplyDefaultsByPass(gd, relayoutFlags, relayoutSpecs) || Plots.supplyDefaults(gd); + // convert a PolyBool polygon to a GeoJSON object + fromPolygon: function(PolyBool, eps, poly){ + // make sure out polygon is clean + poly = PolyBool.polygon(PolyBool.segments(poly)); - if(restyleFlags.style) seq.push(subroutines.doTraceStyle); - if(restyleFlags.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); + // test if r1 is inside r2 + function regionInsideRegion(r1, r2){ + // we're guaranteed no lines intersect (because the polygon is clean), but a vertex + // could be on the edge -- so we just average pt[0] and pt[1] to produce a point on the + // edge of the first line, which cannot be on an edge + return eps.pointInsideRegion([ + (r1[0][0] + r1[1][0]) * 0.5, + (r1[0][1] + r1[1][1]) * 0.5 + ], r2); + } - seq.push(emitAfterPlot); - } + // calculate inside heirarchy + // + // _____________________ _______ roots -> A -> F + // | A | | F | | | + // | _______ _______ | | ___ | +-- B +-- G + // | | B | | C | | | | | | | | + // | | ___ | | ___ | | | | | | | +-- D + // | | | D | | | | E | | | | | G | | | + // | | |___| | | |___| | | | | | | +-- C + // | |_______| |_______| | | |___| | | + // |_____________________| |_______| +-- E - seq.push(Plots.rehover); + function newNode(region){ + return { + region: region, + children: [] + }; + } - Queue.add(gd, - update, [gd, restyleSpecs.undoit, relayoutSpecs.undoit, restyleSpecs.traces], - update, [gd, restyleSpecs.redoit, relayoutSpecs.redoit, restyleSpecs.traces] - ); + var roots = newNode(null); - var plotDone = Lib.syncOrAsync(seq, gd); - if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd); + function addChild(root, region){ + // first check if we're inside any children + for (var i = 0; i < root.children.length; i++){ + var child = root.children[i]; + if (regionInsideRegion(region, child.region)){ + // we are, so insert inside them instead + addChild(child, region); + return; + } + } - return plotDone.then(function() { - gd.emit('plotly_update', { - data: restyleSpecs.eventData, - layout: relayoutSpecs.eventData - }); + // not inside any children, so check to see if any children are inside us + var node = newNode(region); + for (var i = 0; i < root.children.length; i++){ + var child = root.children[i]; + if (regionInsideRegion(child.region, region)){ + // oops... move the child beneath us, and remove them from root + node.children.push(child); + root.children.splice(i, 1); + i--; + } + } - return gd; - }); -}; + // now we can add ourselves + root.children.push(node); + } -/** - * Plotly.react: - * A plot/update method that takes the full plot state (same API as plot/newPlot) - * and diffs to determine the minimal update pathway - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * @param {array of objects} data - * array of traces, containing the data and display information for each trace - * @param {object} layout - * object describing the overall display of the plot, - * all the stuff that doesn't pertain to any individual trace - * @param {object} config - * configuration options (see ./plot_config.js for more info) - * - * OR - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * @param {object} figure - * object containing `data`, `layout`, `config`, and `frames` members - * - */ -exports.react = function(gd, data, layout, config) { - var frames, plotDone; + // add all regions to the root + for (var i = 0; i < poly.regions.length; i++){ + var region = poly.regions[i]; + if (region.length < 3) // regions must have at least 3 points (sanity check) + continue; + addChild(roots, region); + } - function addFrames() { return exports.addFrames(gd, frames); } + // with our heirarchy, we can distinguish between exterior borders, and interior holes + // the root nodes are exterior, children are interior, children's children are exterior, + // children's children's children are interior, etc - gd = Lib.getGraphDiv(gd); + // while we're at it, exteriors are counter-clockwise, and interiors are clockwise - var oldFullData = gd._fullData; - var oldFullLayout = gd._fullLayout; + function forceWinding(region, clockwise){ + // first, see if we're clockwise or counter-clockwise + // https://en.wikipedia.org/wiki/Shoelace_formula + var winding = 0; + var last_x = region[region.length - 1][0]; + var last_y = region[region.length - 1][1]; + var copy = []; + for (var i = 0; i < region.length; i++){ + var curr_x = region[i][0]; + var curr_y = region[i][1]; + copy.push([curr_x, curr_y]); // create a copy while we're at it + winding += curr_y * last_x - curr_x * last_y; + last_x = curr_x; + last_y = curr_y; + } + // this assumes Cartesian coordinates (Y is positive going up) + var isclockwise = winding < 0; + if (isclockwise !== clockwise) + copy.reverse(); + // while we're here, the last point must be the first point... + copy.push([copy[0][0], copy[0][1]]); + return copy; + } - // you can use this as the initial draw as well as to update - if(!Lib.isPlotDiv(gd) || !oldFullData || !oldFullLayout) { - plotDone = exports.newPlot(gd, data, layout, config); - } - else { + var geopolys = []; - if(Lib.isPlainObject(data)) { - var obj = data; - data = obj.data; - layout = obj.layout; - config = obj.config; - frames = obj.frames; - } + function addExterior(node){ + var poly = [forceWinding(node.region, false)]; + geopolys.push(poly); + // children of exteriors are interior + for (var i = 0; i < node.children.length; i++) + poly.push(getInterior(node.children[i])); + } - var configChanged = false; - // assume that if there's a config at all, we're reacting to it too, - // and completely replace the previous config - if(config) { - var oldConfig = Lib.extendDeep({}, gd._context); - gd._context = undefined; - setPlotContext(gd, config); - configChanged = diffConfig(oldConfig, gd._context); - } + function getInterior(node){ + // children of interiors are exterior + for (var i = 0; i < node.children.length; i++) + addExterior(node.children[i]); + // return the clockwise interior + return forceWinding(node.region, true); + } - gd.data = data || []; - helpers.cleanData(gd.data); - gd.layout = layout || {}; - helpers.cleanLayout(gd.layout); + // root nodes are exterior + for (var i = 0; i < roots.children.length; i++) + addExterior(roots.children[i]); - // "true" skips updating calcdata and remapping arrays from calcTransforms, - // which supplyDefaults usually does at the end, but we may need to NOT do - // if the diff (which we haven't determined yet) says we'll recalc - Plots.supplyDefaults(gd, {skipUpdateCalc: true}); + // lastly, construct the approrpriate GeoJSON object - var newFullData = gd._fullData; - var newFullLayout = gd._fullLayout; - var immutable = newFullLayout.datarevision === undefined; + if (geopolys.length <= 0) // empty GeoJSON Polygon + return { type: 'Polygon', coordinates: [] }; + if (geopolys.length == 1) // use a GeoJSON Polygon + return { type: 'Polygon', coordinates: geopolys[0] }; + return { // otherwise, use a GeoJSON MultiPolygon + type: 'MultiPolygon', + coordinates: geopolys + }; + } +}; - var restyleFlags = diffData(gd, oldFullData, newFullData, immutable); - var relayoutFlags = diffLayout(gd, oldFullLayout, newFullLayout, immutable); +module.exports = GeoJSON; - // TODO: how to translate this part of relayout to Plotly.react? - // // Setting width or height to null must reset the graph's width / height - // // back to its initial value as computed during the first pass in Plots.plotAutoSize. - // // - // // To do so, we must manually set them back here using the _initialAutoSize cache. - // if(['width', 'height'].indexOf(ai) !== -1 && vi === null) { - // fullLayout[ai] = gd._initialAutoSize[ai]; - // } +},{}],21:[function(_dereq_,module,exports){ +// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - if(updateAutosize(gd)) relayoutFlags.layoutReplot = true; +// +// this is the core work-horse +// - // clear calcdata if required - if(restyleFlags.calc || relayoutFlags.calc) gd.calcdata = undefined; - // otherwise do the calcdata updates and calcTransform array remaps that we skipped earlier - else Plots.supplyDefaultsUpdateCalc(gd.calcdata, newFullData); +var LinkedList = _dereq_('./linked-list'); - // Note: what restyle/relayout use impliedEdits and clearAxisTypes for - // must be handled by the user when using Plotly.react. +function Intersecter(selfIntersection, eps, buildLog){ + // selfIntersection is true/false depending on the phase of the overall algorithm - // fill in redraw sequence - var seq = []; + // + // segment creation + // - if(frames) { - gd._transitionData = {}; - Plots.createTransitionData(gd); - seq.push(addFrames); - } + function segmentNew(start, end){ + return { + id: buildLog ? buildLog.segmentId() : -1, + start: start, + end: end, + myFill: { + above: null, // is there fill above us? + below: null // is there fill below us? + }, + otherFill: null + }; + } - if(restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) { - gd._fullLayout._skipDefaults = true; - seq.push(exports.plot); - } - 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(gd, indices[i]); - } - } - else { - var draw = Registry.getComponentMethod(componentType, 'draw'); - if(draw === Lib.noop) { - throw new Error('cannot draw components: ' + componentType); - } - draw(gd); - } - } - } + function segmentCopy(start, end, seg){ + return { + id: buildLog ? buildLog.segmentId() : -1, + start: start, + end: end, + myFill: { + above: seg.myFill.above, + below: seg.myFill.below + }, + otherFill: null + }; + } - seq.push(Plots.previousPromises); - if(restyleFlags.style) seq.push(subroutines.doTraceStyle); - if(restyleFlags.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); - } + // + // event logic + // - seq.push(Plots.rehover); + var event_root = LinkedList.create(); - plotDone = Lib.syncOrAsync(seq, gd); - if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd); - } + function eventCompare(p1_isStart, p1_1, p1_2, p2_isStart, p2_1, p2_2){ + // compare the selected points first + var comp = eps.pointsCompare(p1_1, p2_1); + if (comp !== 0) + return comp; + // the selected points are the same - return plotDone.then(function() { - gd.emit('plotly_react', { - data: data, - layout: layout - }); + if (eps.pointsSame(p1_2, p2_2)) // if the non-selected points are the same too... + return 0; // then the segments are equal - return gd; - }); + if (p1_isStart !== p2_isStart) // if one is a start and the other isn't... + return p1_isStart ? 1 : -1; // favor the one that isn't the start -}; + // otherwise, we'll have to calculate which one is below the other manually + return eps.pointAboveOrOnLine(p1_2, + p2_isStart ? p2_1 : p2_2, // order matters + p2_isStart ? p2_2 : p2_1 + ) ? 1 : -1; + } -function diffData(gd, oldFullData, newFullData, immutable) { - if(oldFullData.length !== newFullData.length) { - return { - fullReplot: true, - calc: true - }; - } + function eventAdd(ev, other_pt){ + event_root.insertBefore(ev, function(here){ + // should ev be inserted before here? + var comp = eventCompare( + ev .isStart, ev .pt, other_pt, + here.isStart, here.pt, here.other.pt + ); + return comp < 0; + }); + } - var flags = editTypes.traceFlags(); - flags.arrays = {}; - var i, trace; + function eventAddSegmentStart(seg, primary){ + var ev_start = LinkedList.node({ + isStart: true, + pt: seg.start, + seg: seg, + primary: primary, + other: null, + status: null + }); + eventAdd(ev_start, seg.end); + return ev_start; + } - function getTraceValObject(parts) { - return PlotSchema.getTraceValObject(trace, parts); - } + function eventAddSegmentEnd(ev_start, seg, primary){ + var ev_end = LinkedList.node({ + isStart: false, + pt: seg.end, + seg: seg, + primary: primary, + other: ev_start, + status: null + }); + ev_start.other = ev_end; + eventAdd(ev_end, ev_start.pt); + } - var diffOpts = { - getValObject: getTraceValObject, - flags: flags, - immutable: immutable, - gd: gd - }; + function eventAddSegment(seg, primary){ + var ev_start = eventAddSegmentStart(seg, primary); + eventAddSegmentEnd(ev_start, seg, primary); + return ev_start; + } + function eventUpdateEnd(ev, end){ + // slides an end backwards + // (start)------------(end) to: + // (start)---(end) - var seenUIDs = {}; + if (buildLog) + buildLog.segmentChop(ev.seg, end); - for(i = 0; i < oldFullData.length; i++) { - trace = newFullData[i]._fullInput; - if(Plots.hasMakesDataTransform(trace)) trace = newFullData[i]; - if(seenUIDs[trace.uid]) continue; - seenUIDs[trace.uid] = 1; + ev.other.remove(); + ev.seg.end = end; + ev.other.pt = end; + eventAdd(ev.other, ev.pt); + } - getDiffFlags(oldFullData[i]._fullInput, trace, [], diffOpts); - } + function eventDivide(ev, pt){ + var ns = segmentCopy(pt, ev.seg.end, ev.seg); + eventUpdateEnd(ev, pt); + return eventAddSegment(ns, ev.primary); + } - if(flags.calc || flags.plot) { - flags.fullReplot = true; - } + function calculate(primaryPolyInverted, secondaryPolyInverted){ + // if selfIntersection is true then there is no secondary polygon, so that isn't used - return flags; -} + // + // status logic + // -function diffLayout(gd, oldFullLayout, newFullLayout, immutable) { - var flags = editTypes.layoutFlags(); - flags.arrays = {}; + var status_root = LinkedList.create(); - function getLayoutValObject(parts) { - return PlotSchema.getLayoutValObject(newFullLayout, parts); - } + function statusCompare(ev1, ev2){ + var a1 = ev1.seg.start; + var a2 = ev1.seg.end; + var b1 = ev2.seg.start; + var b2 = ev2.seg.end; - var diffOpts = { - getValObject: getLayoutValObject, - flags: flags, - immutable: immutable, - gd: gd - }; + if (eps.pointsCollinear(a1, b1, b2)){ + if (eps.pointsCollinear(a2, b1, b2)) + return 1;//eventCompare(true, a1, a2, true, b1, b2); + return eps.pointAboveOrOnLine(a2, b1, b2) ? 1 : -1; + } + return eps.pointAboveOrOnLine(a1, b1, b2) ? 1 : -1; + } - getDiffFlags(oldFullLayout, newFullLayout, [], diffOpts); + function statusFindSurrounding(ev){ + return status_root.findTransition(function(here){ + var comp = statusCompare(ev, here.ev); + return comp > 0; + }); + } - if(flags.plot || flags.calc) { - flags.layoutReplot = true; - } + function checkIntersection(ev1, ev2){ + // returns the segment equal to ev1, or false if nothing equal - return flags; -} + var seg1 = ev1.seg; + var seg2 = ev2.seg; + var a1 = seg1.start; + var a2 = seg1.end; + var b1 = seg2.start; + var b2 = seg2.end; -function getDiffFlags(oldContainer, newContainer, outerparts, opts) { - var valObject, key; + if (buildLog) + buildLog.checkIntersection(seg1, seg2); - var getValObject = opts.getValObject; - var flags = opts.flags; - var immutable = opts.immutable; - var inArray = opts.inArray; - var arrayIndex = opts.arrayIndex; + var i = eps.linesIntersect(a1, a2, b1, b2); - function changed() { - var editType = valObject.editType; - if(inArray && editType.indexOf('arraydraw') !== -1) { - Lib.pushUnique(flags.arrays[inArray], arrayIndex); - return; - } - editTypes.update(flags, valObject); - } + if (i === false){ + // segments are parallel or coincident - function valObjectCanBeDataArray(valObject) { - return valObject.valType === 'data_array' || valObject.arrayOk; - } + // if points aren't collinear, then the segments are parallel, so no intersections + if (!eps.pointsCollinear(a1, a2, b1)) + return false; + // otherwise, segments are on top of each other somehow (aka coincident) - for(key in oldContainer) { - // short-circuit based on previous calls or previous keys that already maximized the pathway - if(flags.calc) return; + if (eps.pointsSame(a1, b2) || eps.pointsSame(a2, b1)) + return false; // segments touch at endpoints... no intersection - var oldVal = oldContainer[key]; - var newVal = newContainer[key]; + var a1_equ_b1 = eps.pointsSame(a1, b1); + var a2_equ_b2 = eps.pointsSame(a2, b2); - if(key.charAt(0) === '_' || typeof oldVal === 'function' || oldVal === newVal) continue; + if (a1_equ_b1 && a2_equ_b2) + return ev2; // segments are exactly equal - // FIXME: ax.tick0 and dtick get filled in during plotting (except for geo subplots), - // and unlike other auto values they don't make it back into the input, - // so newContainer won't have them. - if((key === 'tick0' || key === 'dtick') && outerparts[0] !== 'geo') { - var tickMode = newContainer.tickmode; - if(tickMode === 'auto' || tickMode === 'array' || !tickMode) continue; - } - // FIXME: Similarly for axis ranges for 3D - // contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them. - if(key === 'range' && newContainer.autorange) continue; - if((key === 'zmin' || key === 'zmax') && newContainer.type === 'contourcarpet') continue; + var a1_between = !a1_equ_b1 && eps.pointBetween(a1, b1, b2); + var a2_between = !a2_equ_b2 && eps.pointBetween(a2, b1, b2); - var parts = outerparts.concat(key); - valObject = getValObject(parts); + // handy for debugging: + // buildLog.log({ + // a1_equ_b1: a1_equ_b1, + // a2_equ_b2: a2_equ_b2, + // a1_between: a1_between, + // a2_between: a2_between + // }); - // in case type changed, we may not even *have* a valObject. - if(!valObject) continue; + if (a1_equ_b1){ + if (a2_between){ + // (a1)---(a2) + // (b1)----------(b2) + eventDivide(ev2, a2); + } + else{ + // (a1)----------(a2) + // (b1)---(b2) + eventDivide(ev1, b2); + } + return ev2; + } + else if (a1_between){ + if (!a2_equ_b2){ + // make a2 equal to b2 + if (a2_between){ + // (a1)---(a2) + // (b1)-----------------(b2) + eventDivide(ev2, a2); + } + else{ + // (a1)----------(a2) + // (b1)----------(b2) + eventDivide(ev1, b2); + } + } - if(valObject._compareAsJSON && JSON.stringify(oldVal) === JSON.stringify(newVal)) continue; + // (a1)---(a2) + // (b1)----------(b2) + eventDivide(ev2, a1); + } + } + else{ + // otherwise, lines intersect at i.pt, which may or may not be between the endpoints - var valType = valObject.valType; - var i; + // is A divided between its endpoints? (exclusive) + if (i.alongA === 0){ + if (i.alongB === -1) // yes, at exactly b1 + eventDivide(ev1, b1); + else if (i.alongB === 0) // yes, somewhere between B's endpoints + eventDivide(ev1, i.pt); + else if (i.alongB === 1) // yes, at exactly b2 + eventDivide(ev1, b2); + } - var canBeDataArray = valObjectCanBeDataArray(valObject); - var wasArray = Array.isArray(oldVal); - var nowArray = Array.isArray(newVal); + // is B divided between its endpoints? (exclusive) + if (i.alongB === 0){ + if (i.alongA === -1) // yes, at exactly a1 + eventDivide(ev2, a1); + else if (i.alongA === 0) // yes, somewhere between A's endpoints (exclusive) + eventDivide(ev2, i.pt); + else if (i.alongA === 1) // yes, at exactly a2 + eventDivide(ev2, a2); + } + } + return false; + } - // hack for traces that modify the data in supplyDefaults, like - // converting 1D to 2D arrays, which will always create new objects - if(wasArray && nowArray) { - var inputKey = '_input_' + key; - var oldValIn = oldContainer[inputKey]; - var newValIn = newContainer[inputKey]; - if(Array.isArray(oldValIn) && oldValIn === newValIn) continue; - } + // + // main event loop + // + var segments = []; + while (!event_root.isEmpty()){ + var ev = event_root.getHead(); - if(newVal === undefined) { - if(canBeDataArray && wasArray) flags.calc = true; - else changed(); - } - else if(valObject._isLinkedToArray) { - var arrayEditIndices = []; - var extraIndices = false; - if(!inArray) flags.arrays[key] = arrayEditIndices; + if (buildLog) + buildLog.vert(ev.pt[0]); - 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; - } - } + if (ev.isStart){ - 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 (buildLog) + buildLog.segmentNew(ev.seg, ev.primary); - // put this at the end so that we know our collected array indices are sorted - // but the check for length changes happens up front so we can short-circuit - // diffing if appropriate - 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) { + var surrounding = statusFindSurrounding(ev); + var above = surrounding.before ? surrounding.before.ev : null; + var below = surrounding.after ? surrounding.after.ev : null; - // don't try to diff two data arrays. If immutable we know the data changed, - // if not, assume it didn't and let `layout.datarevision` tell us if it did - if(immutable) { - flags.calc = true; - } - } - else if(wasArray !== nowArray) { - flags.calc = true; - } - else changed(); - } - else if(wasArray && nowArray) { - // info array, colorscale, 'any' - these are short, just stringify. - // I don't *think* that covers up any real differences post-validation, does it? - // otherwise we need to dive in 1 (info_array) or 2 (colorscale) levels and compare - // all elements. - if(oldVal.length !== newVal.length || String(oldVal) !== String(newVal)) { - changed(); - } - } - else { - changed(); - } - } + if (buildLog){ + buildLog.tempStatus( + ev.seg, + above ? above.seg : false, + below ? below.seg : false + ); + } - for(key in newContainer) { - if(!(key in oldContainer || key.charAt(0) === '_' || typeof newContainer[key] === 'function')) { - valObject = getValObject(outerparts.concat(key)); + function checkBothIntersections(){ + if (above){ + var eve = checkIntersection(ev, above); + if (eve) + return eve; + } + if (below) + return checkIntersection(ev, below); + return false; + } - if(valObjectCanBeDataArray(valObject) && Array.isArray(newContainer[key])) { - flags.calc = true; - return; - } - else changed(); - } - } -} + var eve = checkBothIntersections(); + if (eve){ + // ev and eve are equal + // we'll keep eve and throw away ev -/* - * simple diff for config - for now, just treat all changes as equivalent - */ -function diffConfig(oldConfig, newConfig) { - var key; + // merge ev.seg's fill information into eve.seg - 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; - } - } - } -} + if (selfIntersection){ + var toggle; // are we a toggling edge? + if (ev.seg.myFill.below === null) + toggle = true; + else + toggle = ev.seg.myFill.above !== ev.seg.myFill.below; -/** - * Animate to a frame, sequence of frame, frame group, or frame definition - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * - * @param {string or object or array of strings or array of objects} frameOrGroupNameOrFrameList - * a single frame, array of frames, or group to which to animate. The intent is - * inferred by the type of the input. Valid inputs are: - * - * - string, e.g. 'groupname': animate all frames of a given `group` in the order - * in which they are defined via `Plotly.addFrames`. - * - * - array of strings, e.g. ['frame1', frame2']: a list of frames by name to which - * to animate in sequence - * - * - object: {data: ...}: a frame definition to which to animate. The frame is not - * and does not need to be added via `Plotly.addFrames`. It may contain any of - * the properties of a frame, including `data`, `layout`, and `traces`. The - * frame is used as provided and does not use the `baseframe` property. - * - * - array of objects, e.g. [{data: ...}, {data: ...}]: a list of frame objects, - * each following the same rules as a single `object`. - * - * @param {object} animationOpts - * configuration for the animation - */ -exports.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { - gd = Lib.getGraphDiv(gd); + // merge two segments that belong to the same polygon + // think of this as sandwiching two segments together, where `eve.seg` is + // the bottom -- this will cause the above fill flag to toggle + if (toggle) + eve.seg.myFill.above = !eve.seg.myFill.above; + } + else{ + // merge two segments that belong to different polygons + // each segment has distinct knowledge, so no special logic is needed + // note that this can only happen once per segment in this phase, because we + // are guaranteed that all self-intersections are gone + eve.seg.otherFill = ev.seg.myFill; + } - if(!Lib.isPlotDiv(gd)) { - throw new Error( - 'This element is not a Plotly plot: ' + gd + '. It\'s likely that you\'ve failed ' + - 'to create a plot before animating it. For more details, see ' + - 'https://plot.ly/javascript/animations/' - ); - } + if (buildLog) + buildLog.segmentUpdate(eve.seg); - var trans = gd._transitionData; + ev.other.remove(); + ev.remove(); + } - // This is the queue of frames that will be animated as soon as possible. They - // are popped immediately upon the *start* of a transition: - if(!trans._frameQueue) { - trans._frameQueue = []; - } + if (event_root.getHead() !== ev){ + // something was inserted before us in the event queue, so loop back around and + // process it before continuing + if (buildLog) + buildLog.rewind(ev.seg); + continue; + } - animationOpts = Plots.supplyAnimationDefaults(animationOpts); - var transitionOpts = animationOpts.transition; - var frameOpts = animationOpts.frame; + // + // calculate fill flags + // + if (selfIntersection){ + var toggle; // are we a toggling edge? + if (ev.seg.myFill.below === null) // if we are a new segment... + toggle = true; // then we toggle + else // we are a segment that has previous knowledge from a division + toggle = ev.seg.myFill.above !== ev.seg.myFill.below; // calculate toggle - // Since frames are popped immediately, an empty queue only means all frames have - // *started* to transition, not that the animation is complete. To solve that, - // track a separate counter that increments at the same time as frames are added - // to the queue, but decrements only when the transition is complete. - if(trans._frameWaitingCnt === undefined) { - trans._frameWaitingCnt = 0; - } + // next, calculate whether we are filled below us + if (!below){ // if nothing is below us... + // we are filled below us if the polygon is inverted + ev.seg.myFill.below = primaryPolyInverted; + } + else{ + // otherwise, we know the answer -- it's the same if whatever is below + // us is filled above it + ev.seg.myFill.below = below.seg.myFill.above; + } - function getTransitionOpts(i) { - if(Array.isArray(transitionOpts)) { - if(i >= transitionOpts.length) { - return transitionOpts[0]; - } else { - return transitionOpts[i]; - } - } else { - return transitionOpts; - } - } + // since now we know if we're filled below us, we can calculate whether + // we're filled above us by applying toggle to whatever is below us + if (toggle) + ev.seg.myFill.above = !ev.seg.myFill.below; + else + ev.seg.myFill.above = ev.seg.myFill.below; + } + else{ + // now we fill in any missing transition information, since we are all-knowing + // at this point + + if (ev.seg.otherFill === null){ + // if we don't have other information, then we need to figure out if we're + // inside the other polygon + var inside; + if (!below){ + // if nothing is below us, then we're inside if the other polygon is + // inverted + inside = + ev.primary ? secondaryPolyInverted : primaryPolyInverted; + } + else{ // otherwise, something is below us + // so copy the below segment's other polygon's above + if (ev.primary === below.primary) + inside = below.seg.otherFill.above; + else + inside = below.seg.myFill.above; + } + ev.seg.otherFill = { + above: inside, + below: inside + }; + } + } - function getFrameOpts(i) { - if(Array.isArray(frameOpts)) { - if(i >= frameOpts.length) { - return frameOpts[0]; - } else { - return frameOpts[i]; - } - } else { - return frameOpts; - } - } + if (buildLog){ + buildLog.status( + ev.seg, + above ? above.seg : false, + below ? below.seg : false + ); + } - // Execute a callback after the wrapper function has been called n times. - // This is used to defer the resolution until a transition has resovled *and* - // the frame has completed. If it's not done this way, then we get a race - // condition in which the animation might resolve before a transition is complete - // or vice versa. - function callbackOnNthTime(cb, n) { - var cnt = 0; - return function() { - if(cb && ++cnt === n) { - return cb(); - } - }; - } + // insert the status and remember it for later removal + ev.other.status = surrounding.insert(LinkedList.node({ ev: ev })); + } + else{ + var st = ev.status; - return new Promise(function(resolve, reject) { - function discardExistingFrames() { - if(trans._frameQueue.length === 0) { - return; - } + if (st === null){ + throw new Error('PolyBool: Zero-length segment detected; your epsilon is ' + + 'probably too small or too large'); + } - while(trans._frameQueue.length) { - var next = trans._frameQueue.pop(); - if(next.onInterrupt) { - next.onInterrupt(); - } - } + // removing the status will create two new adjacent edges, so we'll need to check + // for those + if (status_root.exists(st.prev) && status_root.exists(st.next)) + checkIntersection(st.prev.ev, st.next.ev); - gd.emit('plotly_animationinterrupted', []); - } + if (buildLog) + buildLog.statusRemove(st.ev.seg); - function queueFrames(frameList) { - if(frameList.length === 0) return; + // remove the status + st.remove(); - for(var i = 0; i < frameList.length; i++) { - var computedFrame; + // if we've reached this point, we've calculated everything there is to know, so + // save the segment for reporting + if (!ev.primary){ + // make sure `seg.myFill` actually points to the primary polygon though + var s = ev.seg.myFill; + ev.seg.myFill = ev.seg.otherFill; + ev.seg.otherFill = s; + } + segments.push(ev.seg); + } - if(frameList[i].type === 'byname') { - // If it's a named frame, compute it: - computedFrame = Plots.computeFrame(gd, frameList[i].name); - } else { - // Otherwise we must have been given a simple object, so treat - // the input itself as the computed frame. - computedFrame = frameList[i].data; - } + // remove the event and continue + event_root.getHead().remove(); + } - var frameOpts = getFrameOpts(i); - var transitionOpts = getTransitionOpts(i); + if (buildLog) + buildLog.done(); - // It doesn't make much sense for the transition duration to be greater than - // the frame duration, so limit it: - transitionOpts.duration = Math.min(transitionOpts.duration, frameOpts.duration); + return segments; + } - var nextFrame = { - frame: computedFrame, - name: frameList[i].name, - frameOpts: frameOpts, - transitionOpts: transitionOpts, - }; - if(i === frameList.length - 1) { - // The last frame in this .animate call stores the promise resolve - // and reject callbacks. This is how we ensure that the animation - // loop (which may exist as a result of a *different* .animate call) - // still resolves or rejecdts this .animate call's promise. once it's - // complete. - nextFrame.onComplete = callbackOnNthTime(resolve, 2); - nextFrame.onInterrupt = reject; - } + // return the appropriate API depending on what we're doing + if (!selfIntersection){ + // performing combination of polygons, so only deal with already-processed segments + return { + calculate: function(segments1, inverted1, segments2, inverted2){ + // segmentsX come from the self-intersection API, or this API + // invertedX is whether we treat that list of segments as an inverted polygon or not + // returns segments that can be used for further operations + 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); + } + }; + } - trans._frameQueue.push(nextFrame); - } + // otherwise, performing self-intersection, so deal with regions + return { + addRegion: function(region){ + // regions are a list of points: + // [ [0, 0], [100, 0], [50, 100] ] + // you can add multiple regions before running calculate + var pt1; + var pt2 = region[region.length - 1]; + for (var i = 0; i < region.length; i++){ + pt1 = pt2; + pt2 = region[i]; - // Set it as never having transitioned to a frame. This will cause the animation - // loop to immediately transition to the next frame (which, for immediate mode, - // is the first frame in the list since all others would have been discarded - // below) - if(animationOpts.mode === 'immediate') { - trans._lastFrameAt = -Infinity; - } + var forward = eps.pointsCompare(pt1, pt2); + if (forward === 0) // points are equal, so we have a zero-length segment + continue; // just skip it - // Only it's not already running, start a RAF loop. This could be avoided in the - // case that there's only one frame, but it significantly complicated the logic - // and only sped things up by about 5% or so for a lorenz attractor simulation. - // It would be a fine thing to implement, but the benefit of that optimization - // doesn't seem worth the extra complexity. - if(!trans._animationRaf) { - beginAnimationLoop(); - } - } + eventAddSegment( + segmentNew( + forward < 0 ? pt1 : pt2, + forward < 0 ? pt2 : pt1 + ), + true + ); + } + }, + calculate: function(inverted){ + // is the polygon inverted? + // returns segments + return calculate(inverted, false); + } + }; +} - function stopAnimationLoop() { - gd.emit('plotly_animated'); +module.exports = Intersecter; - // Be sure to unset also since it's how we know whether a loop is already running: - window.cancelAnimationFrame(trans._animationRaf); - trans._animationRaf = null; - } +},{"./linked-list":22}],22:[function(_dereq_,module,exports){ +// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - function nextFrame() { - if(trans._currentFrame && trans._currentFrame.onComplete) { - // Execute the callback and unset it to ensure it doesn't - // accidentally get called twice - trans._currentFrame.onComplete(); - } +// +// simple linked list implementation that allows you to traverse down nodes and save positions +// - var newFrame = trans._currentFrame = trans._frameQueue.shift(); +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; + } +}; - if(newFrame) { - // Since it's sometimes necessary to do deep digging into frame data, - // we'll consider it not 100% impossible for nulls or numbers to sneak through, - // so check when casting the name, just to be absolutely certain: - var stringName = newFrame.name ? newFrame.name.toString() : null; - gd._fullLayout._currentFrame = stringName; +module.exports = LinkedList; - trans._lastFrameAt = Date.now(); - trans._timeToNext = newFrame.frameOpts.duration; +},{}],23:[function(_dereq_,module,exports){ +// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - // This is simply called and it's left to .transition to decide how to manage - // interrupting current transitions. That means we don't need to worry about - // how it resolves or what happens after this: - Plots.transition(gd, - newFrame.frame.data, - newFrame.frame.layout, - helpers.coerceTraceIndices(gd, newFrame.frame.traces), - newFrame.frameOpts, - newFrame.transitionOpts - ).then(function() { - if(newFrame.onComplete) { - newFrame.onComplete(); - } +// +// converts a list of segments into a list of regions, while also removing unnecessary verticies +// - }); +function SegmentChainer(segments, eps, buildLog){ + var chains = []; + var regions = []; - gd.emit('plotly_animatingframe', { - name: stringName, - frame: newFrame.frame, - animation: { - frame: newFrame.frameOpts, - transition: newFrame.transitionOpts, - } - }); - } else { - // If there are no more frames, then stop the RAF loop: - stopAnimationLoop(); - } - } + 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; + } - function beginAnimationLoop() { - gd.emit('plotly_animating'); + if (buildLog) + buildLog.chainStart(seg); - // If no timer is running, then set last frame = long ago so that the next - // frame is immediately transitioned: - trans._lastFrameAt = -Infinity; - trans._timeToNext = 0; - trans._runningTransitions = 0; - trans._currentFrame = null; + // search for two chains that this segment matches + 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(index, matches_head, matches_pt1){ + // return true if we've matched twice + next_match.index = index; + 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; // we've matched twice, we're done here + } + 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; + } + } - var doFrame = function() { - // This *must* be requested before nextFrame since nextFrame may decide - // to cancel it if there's nothing more to animated: - trans._animationRaf = window.requestAnimationFrame(doFrame); + if (next_match === first_match){ + // we didn't match anything, so create a new chain + chains.push([ pt1, pt2 ]); + if (buildLog) + buildLog.chainNew(pt1, pt2); + return; + } - // Check if we're ready for a new frame: - if(Date.now() - trans._lastFrameAt > trans._timeToNext) { - nextFrame(); - } - }; + if (next_match === second_match){ + // we matched a single chain - doFrame(); - } + if (buildLog) + buildLog.chainMatch(first_match.index); - // This is an animate-local counter that helps match up option input list - // items with the particular frame. - var configCounter = 0; - function setTransitionConfig(frame) { - if(Array.isArray(transitionOpts)) { - if(configCounter >= transitionOpts.length) { - frame.transitionOpts = transitionOpts[configCounter]; - } else { - frame.transitionOpts = transitionOpts[0]; - } - } else { - frame.transitionOpts = transitionOpts; - } - configCounter++; - return frame; - } + // add the other point to the apporpriate end, and check to see if we've closed the + // chain into a loop - // Disambiguate what's sort of frames have been received - var i, frame; - var frameList = []; - var allFrames = frameOrGroupNameOrFrameList === undefined || frameOrGroupNameOrFrameList === null; - var isFrameArray = Array.isArray(frameOrGroupNameOrFrameList); - var isSingleFrame = !allFrames && !isFrameArray && Lib.isPlainObject(frameOrGroupNameOrFrameList); + var index = first_match.index; + var pt = first_match.matches_pt1 ? pt2 : pt1; // if we matched pt1, then we add pt2, etc + var addToHead = first_match.matches_head; // if we matched at head, then add to the head - if(isSingleFrame) { - // In this case, a simple object has been passed to animate. - frameList.push({ - type: 'object', - data: setTransitionConfig(Lib.extendFlat({}, frameOrGroupNameOrFrameList)) - }); - } else if(allFrames || ['string', 'number'].indexOf(typeof frameOrGroupNameOrFrameList) !== -1) { - // In this case, null or undefined has been passed so that we want to - // animate *all* currently defined frames - for(i = 0; i < trans._frames.length; i++) { - frame = trans._frames[i]; + 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(!frame) continue; + if (eps.pointsCollinear(grow2, grow, pt)){ + // grow isn't needed because it's directly between grow2 and pt: + // grow2 ---grow---> pt + if (addToHead){ + if (buildLog) + buildLog.chainRemoveHead(first_match.index, pt); + chain.shift(); + } + else{ + if (buildLog) + buildLog.chainRemoveTail(first_match.index, pt); + chain.pop(); + } + grow = grow2; // old grow is gone... new grow is what grow2 was + } - 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); - // In this case, there's an array and this frame is a string name: - frameList.push({ - type: 'byname', - name: frameOrName, - data: setTransitionConfig({name: frameOrName}) - }); - } else if(Lib.isPlainObject(frameOrName)) { - frameList.push({ - type: 'object', - data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) - }); - } - } - } + if (eps.pointsSame(oppo, pt)){ + // we're closing the loop, so remove chain from chains + chains.splice(index, 1); - // Verify that all of these frames actually exist; return and reject if not: - 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 (eps.pointsCollinear(oppo2, oppo, grow)){ + // oppo isn't needed because it's directly between oppo2 and grow: + // 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 the mode is either next or immediate, then all currently queued frames must - // be dumped and the corresponding .animate promises rejected. - if(['next', 'immediate'].indexOf(animationOpts.mode) !== -1) { - discardExistingFrames(); - } + if (buildLog) + buildLog.chainClose(first_match.index); - if(animationOpts.direction === 'reverse') { - frameList.reverse(); - } + // we have a closed chain! + regions.push(chain); + return; + } - var currentFrame = gd._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; - } - } + // not closing a loop, so just add it to the apporpriate side + if (addToHead){ + if (buildLog) + buildLog.chainAddHead(first_match.index, pt); + chain.unshift(pt); + } + else{ + if (buildLog) + buildLog.chainAddTail(first_match.index, pt); + chain.push(pt); + } + return; + } - 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; - } - } + // otherwise, we matched two chains, so we need to combine those chains together - if(frameList.length > 0) { - queueFrames(frameList); - } else { - // This is the case where there were simply no frames. It's a little strange - // since there's not much to do: - gd.emit('plotly_animated'); - resolve(); - } - }); -}; + function reverseChain(index){ + if (buildLog) + buildLog.chainReverse(index); + chains[index].reverse(); // gee, that's easy + } -/** - * Register new frames - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * - * @param {array of objects} frameList - * list of frame definitions, in which each object includes any of: - * - name: {string} name of frame to add - * - data: {array of objects} trace data - * - layout {object} layout definition - * - traces {array} trace indices - * - baseframe {string} name of frame from which this frame gets defaults - * - * @param {array of integers} indices - * an array of integer indices matching the respective frames in `frameList`. If not - * provided, an index will be provided in serial order. If already used, the frame - * will be overwritten. - */ -exports.addFrames = function(gd, frameList, indices) { - gd = Lib.getGraphDiv(gd); + function appendChain(index1, index2){ + // index1 gets index2 appended to it, and index2 is removed + var chain1 = chains[index1]; + var chain2 = chains[index2]; + var tail = chain1[chain1.length - 1]; + var tail2 = chain1[chain1.length - 2]; + var head = chain2[0]; + var head2 = chain2[1]; - if(frameList === null || frameList === undefined) { - return Promise.resolve(); - } + if (eps.pointsCollinear(tail2, tail, head)){ + // tail isn't needed because it's directly between tail2 and head + // tail2 ---tail---> head + if (buildLog) + buildLog.chainRemoveTail(index1, tail); + chain1.pop(); + tail = tail2; // old tail is gone... new tail is what tail2 was + } - if(!Lib.isPlotDiv(gd)) { - throw new Error( - 'This element is not a Plotly plot: ' + gd + '. It\'s likely that you\'ve failed ' + - 'to create a plot before adding frames. For more details, see ' + - 'https://plot.ly/javascript/animations/' - ); - } + if (eps.pointsCollinear(tail, head, head2)){ + // head isn't needed because it's directly between tail and head2 + // tail ---head---> head2 + if (buildLog) + buildLog.chainRemoveHead(index2, head); + chain2.shift(); + } - var i, frame, j, idx; - var _frames = gd._transitionData._frames; - var _frameHash = gd._transitionData._frameHash; + 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(!Array.isArray(frameList)) { - throw new Error('addFrames failure: frameList must be an Array of frame definitions' + frameList); - } + if (buildLog) + buildLog.chainConnect(F, S); - // Create a sorted list of insertions since we run into lots of problems if these - // aren't in ascending order of index: - // - // Strictly for sorting. Make sure this is guaranteed to never collide with any - // already-exisisting indices: - var bigIndex = _frames.length + frameList.length * 2; + var reverseF = chains[F].length < chains[S].length; // reverse the shorter chain, if needed + if (first_match.matches_head){ + if (second_match.matches_head){ + if (reverseF){ + // <<<< F <<<< --- >>>> S >>>> + reverseChain(F); + // >>>> F >>>> --- >>>> S >>>> + appendChain(F, S); + } + else{ + // <<<< F <<<< --- >>>> S >>>> + reverseChain(S); + // <<<< F <<<< --- <<<< S <<<< logically same as: + // >>>> S >>>> --- >>>> F >>>> + appendChain(S, F); + } + } + else{ + // <<<< F <<<< --- <<<< S <<<< logically same as: + // >>>> S >>>> --- >>>> F >>>> + appendChain(S, F); + } + } + else{ + if (second_match.matches_head){ + // >>>> F >>>> --- >>>> S >>>> + appendChain(F, S); + } + else{ + if (reverseF){ + // >>>> F >>>> --- <<<< S <<<< + reverseChain(F); + // <<<< F <<<< --- <<<< S <<<< logically same as: + // >>>> S >>>> --- >>>> F >>>> + appendChain(S, F); + } + else{ + // >>>> F >>>> --- <<<< S <<<< + reverseChain(S); + // >>>> F >>>> --- >>>> S >>>> + appendChain(F, S); + } + } + } + }); - var insertions = []; - var _frameHashLocal = {}; - for(i = frameList.length - 1; i >= 0; i--) { - if(!Lib.isPlainObject(frameList[i])) continue; + return regions; +} - // The entire logic for checking for this type of name collision can be removed once we migrate to ES6 and - // use a Map instead of an Object instance, as Map keys aren't converted to strings. - var lookupName = frameList[i].name; - var name = (_frameHash[lookupName] || _frameHashLocal[lookupName] || {}).name; - var newName = frameList[i].name; - var collisionPresent = _frameHash[name] || _frameHashLocal[name]; +module.exports = SegmentChainer; - if(name && newName && typeof newName === 'number' && collisionPresent && numericNameWarningCount < numericNameWarningCountLimit) { - numericNameWarningCount++; +},{}],24:[function(_dereq_,module,exports){ +// (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc +// MIT License +// Project Home: https://github.com/voidqk/polybooljs - 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.'); +// +// filter a list of segments based on boolean operations +// - 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.'); - } - } +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){ + // copy the segment to the results, while also calculating the fill status + 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 + }); + } + }); - _frameHashLocal[lookupName] = {name: lookupName}; + if (buildLog) + buildLog.selected(result); - insertions.push({ - frame: Plots.supplyFrameDefaults(frameList[i]), - index: (indices && indices[i] !== undefined && indices[i] !== null) ? indices[i] : bigIndex + i - }); - } + return result; +} - // Sort this, taking note that undefined insertions end up at the end: - insertions.sort(function(a, b) { - if(a.index > b.index) return -1; - if(a.index < b.index) return 1; - return 0; - }); +var SegmentSelector = { + union: function(segments, buildLog){ // primary | secondary + // above1 below1 above2 below2 Keep? Value + // 0 0 0 0 => no 0 + // 0 0 0 1 => yes filled below 2 + // 0 0 1 0 => yes filled above 1 + // 0 0 1 1 => no 0 + // 0 1 0 0 => yes filled below 2 + // 0 1 0 1 => yes filled below 2 + // 0 1 1 0 => no 0 + // 0 1 1 1 => no 0 + // 1 0 0 0 => yes filled above 1 + // 1 0 0 1 => no 0 + // 1 0 1 0 => yes filled above 1 + // 1 0 1 1 => no 0 + // 1 1 0 0 => no 0 + // 1 1 0 1 => no 0 + // 1 1 1 0 => no 0 + // 1 1 1 1 => no 0 + return select(segments, [ + 0, 2, 1, 0, + 2, 2, 0, 0, + 1, 0, 1, 0, + 0, 0, 0, 0 + ], buildLog); + }, + intersect: function(segments, buildLog){ // primary & secondary + // above1 below1 above2 below2 Keep? Value + // 0 0 0 0 => no 0 + // 0 0 0 1 => no 0 + // 0 0 1 0 => no 0 + // 0 0 1 1 => no 0 + // 0 1 0 0 => no 0 + // 0 1 0 1 => yes filled below 2 + // 0 1 1 0 => no 0 + // 0 1 1 1 => yes filled below 2 + // 1 0 0 0 => no 0 + // 1 0 0 1 => no 0 + // 1 0 1 0 => yes filled above 1 + // 1 0 1 1 => yes filled above 1 + // 1 1 0 0 => no 0 + // 1 1 0 1 => yes filled below 2 + // 1 1 1 0 => yes filled above 1 + // 1 1 1 1 => no 0 + return select(segments, [ + 0, 0, 0, 0, + 0, 2, 0, 2, + 0, 0, 1, 1, + 0, 2, 1, 0 + ], buildLog); + }, + difference: function(segments, buildLog){ // primary - secondary + // above1 below1 above2 below2 Keep? Value + // 0 0 0 0 => no 0 + // 0 0 0 1 => no 0 + // 0 0 1 0 => no 0 + // 0 0 1 1 => no 0 + // 0 1 0 0 => yes filled below 2 + // 0 1 0 1 => no 0 + // 0 1 1 0 => yes filled below 2 + // 0 1 1 1 => no 0 + // 1 0 0 0 => yes filled above 1 + // 1 0 0 1 => yes filled above 1 + // 1 0 1 0 => no 0 + // 1 0 1 1 => no 0 + // 1 1 0 0 => no 0 + // 1 1 0 1 => yes filled above 1 + // 1 1 1 0 => yes filled below 2 + // 1 1 1 1 => no 0 + return select(segments, [ + 0, 0, 0, 0, + 2, 0, 2, 0, + 1, 1, 0, 0, + 0, 1, 2, 0 + ], buildLog); + }, + differenceRev: function(segments, buildLog){ // secondary - primary + // above1 below1 above2 below2 Keep? Value + // 0 0 0 0 => no 0 + // 0 0 0 1 => yes filled below 2 + // 0 0 1 0 => yes filled above 1 + // 0 0 1 1 => no 0 + // 0 1 0 0 => no 0 + // 0 1 0 1 => no 0 + // 0 1 1 0 => yes filled above 1 + // 0 1 1 1 => yes filled above 1 + // 1 0 0 0 => no 0 + // 1 0 0 1 => yes filled below 2 + // 1 0 1 0 => no 0 + // 1 0 1 1 => yes filled below 2 + // 1 1 0 0 => no 0 + // 1 1 0 1 => no 0 + // 1 1 1 0 => no 0 + // 1 1 1 1 => no 0 + return select(segments, [ + 0, 2, 1, 0, + 0, 0, 1, 1, + 0, 2, 0, 2, + 0, 0, 0, 0 + ], buildLog); + }, + xor: function(segments, buildLog){ // primary ^ secondary + // above1 below1 above2 below2 Keep? Value + // 0 0 0 0 => no 0 + // 0 0 0 1 => yes filled below 2 + // 0 0 1 0 => yes filled above 1 + // 0 0 1 1 => no 0 + // 0 1 0 0 => yes filled below 2 + // 0 1 0 1 => no 0 + // 0 1 1 0 => no 0 + // 0 1 1 1 => yes filled above 1 + // 1 0 0 0 => yes filled above 1 + // 1 0 0 1 => no 0 + // 1 0 1 0 => no 0 + // 1 0 1 1 => yes filled below 2 + // 1 1 0 0 => no 0 + // 1 1 0 1 => yes filled above 1 + // 1 1 1 0 => yes filled below 2 + // 1 1 1 1 => no 0 + return select(segments, [ + 0, 2, 1, 0, + 2, 0, 0, 1, + 1, 0, 0, 2, + 0, 1, 2, 0 + ], buildLog); + } +}; - var ops = []; - var revops = []; - var frameCount = _frames.length; +module.exports = SegmentSelector; - for(i = insertions.length - 1; i >= 0; i--) { - frame = insertions[i].frame; +},{}],25:[function(_dereq_,module,exports){ +// shim for using process in browser +var process = module.exports = {}; - if(typeof frame.name === 'number') { - Lib.warn('Warning: addFrames accepts frames with numeric names, but the numbers are' + - 'implicitly cast to strings'); +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - } +var cachedSetTimeout; +var cachedClearTimeout; - if(!frame.name) { - // Repeatedly assign a default name, incrementing the counter each time until - // we get a name that's not in the hashed lookup table: - while(_frameHash[(frame.name = 'frame ' + gd._transitionData._counter++)]); +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; } - - if(_frameHash[frame.name]) { - // If frame is present, overwrite its definition: - 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]}); + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; } else { - // Otherwise insert it at the end of the list: - 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++; + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); } } - var undoFunc = Plots.modifyFrames, - redoFunc = Plots.modifyFrames, - undoArgs = [gd, revops], - redoArgs = [gd, ops]; - - if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - - return Plots.modifyFrames(gd, ops); -}; - -/** - * Delete frame - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - * - * @param {array of integers} frameList - * list of integer indices of frames to be deleted - */ -exports.deleteFrames = function(gd, frameList) { - gd = Lib.getGraphDiv(gd); - if(!Lib.isPlotDiv(gd)) { - throw new Error('This element is not a Plotly plot: ' + gd); +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } } - var i, idx; - var _frames = gd._transitionData._frames; - var ops = []; - var revops = []; - if(!frameList) { - frameList = []; - for(i = 0; i < _frames.length; i++) { - frameList.push(i); - } - } - frameList = frameList.slice(0); - frameList.sort(); +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; - 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]}); +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); } +} - var undoFunc = Plots.modifyFrames, - redoFunc = Plots.modifyFrames, - undoArgs = [gd, revops], - redoArgs = [gd, ops]; +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - return Plots.modifyFrames(gd, ops); +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } }; -/** - * Purge a graph container div back to its initial pre-Plotly.plot state - * - * @param {string id or DOM element} gd - * the id or DOM element of the graph container div - */ -exports.purge = function purge(gd) { - gd = Lib.getGraphDiv(gd); - - var fullLayout = gd._fullLayout || {}; - var fullData = gd._fullData || []; - - // remove gl contexts - Plots.cleanPlot([], {}, fullData, fullLayout); - - // purge properties - Plots.purge(gd); +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; - // purge event emitter methods - Events.purge(gd); +function noop() {} - // remove plot container - if(fullLayout._container) fullLayout._container.remove(); +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; - // in contrast to Plotly.Plots.purge which does NOT clear _context! - delete gd._context; +process.listeners = function (name) { return [] } - return gd; +process.binding = function (name) { + throw new Error('process.binding is not supported'); }; -// ------------------------------------------------------- -// makePlotFramework: Create the plot container and axes -// ------------------------------------------------------- -function makePlotFramework(gd) { - var gd3 = d3.select(gd); - var fullLayout = gd._fullLayout; - - // Plot container - fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') - .classed('plot-container', true) - .classed('plotly', true); - - // Make the svg container - fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); - fullLayout._paperdiv.enter().append('div') - .classed('svg-container', true) - .style('position', 'relative'); +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; - // Make the graph containers - // start fresh each time we get here, so we know the order comes out - // right, rather than enter/exit which can muck up the order - // TODO: sort out all the ordering so we don't have to - // explicitly delete anything - // FIXME: parcoords reuses this object, not the best pattern - fullLayout._glcontainer = fullLayout._paperdiv.selectAll('.gl-container') - .data([{}]); +},{}],26:[function(_dereq_,module,exports){ +// TinyColor v1.4.1 +// https://github.com/bgrins/TinyColor +// Brian Grinstead, MIT License - fullLayout._glcontainer.enter().append('div') - .classed('gl-container', true); +(function(Math) { - fullLayout._paperdiv.selectAll('.main-svg').remove(); +var trimLeft = /^\s+/, + trimRight = /\s+$/, + tinyCounter = 0, + mathRound = Math.round, + mathMin = Math.min, + mathMax = Math.max, + mathRandom = Math.random; - fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child') - .classed('main-svg', true); +function tinycolor (color, opts) { - fullLayout._toppaper = fullLayout._paperdiv.append('svg') - .classed('main-svg', true); + color = (color) ? color : ''; + opts = opts || { }; - if(!fullLayout._uid) { - var otherUids = {}; - d3.selectAll('defs').each(function() { - if(this.id) otherUids[this.id.split('-')[1]] = 1; - }); - fullLayout._uid = Lib.randstr(otherUids); + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) { + return color; + } + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) { + return new tinycolor(color, opts); } - 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); - - // lower shape/image layer - note that this is behind - // all subplots data/grids but above the backgrounds - // except inset subplots, whose backgrounds are drawn - // inside their own group so that they appear above - // the data for the main subplot - // lower shapes and images which are fully referenced to - // a subplot still get drawn within the subplot's group - // so they will work correctly on insets - 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); - - // single cartesian layer for the whole plot - fullLayout._cartesianlayer = fullLayout._paper.append('g').classed('cartesianlayer', true); - - // single polar layer for the whole plot - fullLayout._polarlayer = fullLayout._paper.append('g').classed('polarlayer', true); - - // single ternary layer for the whole plot - fullLayout._ternarylayer = fullLayout._paper.append('g').classed('ternarylayer', true); - - // single geo layer for the whole plot - fullLayout._geolayer = fullLayout._paper.append('g').classed('geolayer', true); + 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 = mathRound(100*this._a) / 100, + this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; - // single pie layer for the whole plot - fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true); + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) { this._r = mathRound(this._r); } + if (this._g < 1) { this._g = mathRound(this._g); } + if (this._b < 1) { this._b = mathRound(this._b); } - // fill in image server scrape-svg - fullLayout._glimages = fullLayout._paper.append('g').classed('glimages', true); + this._ok = rgb.ok; + this._tc_id = tinyCounter++; +} - // lastly upper shapes, info (legend, annotations) and hover layers go on top - // these are in a different svg element normally, but get collapsed into a single - // svg when exporting (after inserting 3D) - // upper shapes/images are only those drawn above the whole plot, including subplots - 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); +tinycolor.prototype = { + isDark: function() { + return this.getBrightness() < 128; + }, + isLight: function() { + return !this.isDark(); + }, + isValid: function() { + return this._ok; + }, + getOriginalInput: function() { + return this._originalInput; + }, + getFormat: function() { + return this._format; + }, + getAlpha: function() { + return this._a; + }, + getBrightness: function() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r/255; + GsRGB = rgb.g/255; + BsRGB = rgb.b/255; - 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._toppaper.append('g').classed('hoverlayer', true); + 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(value) { + this._a = boundAlpha(value); + this._roundA = mathRound(100*this._a) / 100; + return this; + }, + toHsv: function() { + 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() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); + return (this._a == 1) ? + "hsv(" + h + ", " + s + "%, " + v + "%)" : + "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; + }, + toHsl: function() { + 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() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); + return (this._a == 1) ? + "hsl(" + h + ", " + s + "%, " + l + "%)" : + "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; + }, + toHex: function(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function(allow3Char) { + return '#' + this.toHex(allow3Char); + }, + toHex8: function(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function(allow4Char) { + return '#' + this.toHex8(allow4Char); + }, + toRgb: function() { + return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; + }, + toRgbString: function() { + return (this._a == 1) ? + "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : + "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function() { + return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; + }, + toPercentageRgbString: function() { + return (this._a == 1) ? + "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : + "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function() { + if (this._a === 0) { + return "transparent"; + } - gd.emit('plotly_framework'); -} + if (this._a < 1) { + return false; + } -},{"../components/color":570,"../components/colorbar/connect":572,"../components/drawing":595,"../constants/xmlns_namespaces":674,"../lib":696,"../lib/events":684,"../lib/queue":711,"../lib/svg_text_utils":720,"../plots/cartesian/axes":744,"../plots/cartesian/constants":750,"../plots/cartesian/graph_interact":754,"../plots/plots":808,"../plots/polar/legacy":816,"../registry":827,"./edit_types":727,"./helpers":728,"./manage_arrays":730,"./plot_config":732,"./plot_schema":733,"./subroutines":735,"d3":148,"fast-isnumeric":214,"has-hover":393}],732:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function(secondColor) { + var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; -'use strict'; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } -/** - * This will be transferred over to gd and overridden by - * config args to Plotly.plot. - * - * The defaults are the appropriate settings for plotly.js, - * so we get the right experience without any config argument. - */ + return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; + }, + toString: function(format) { + var formatSet = !!format; + format = format || this._format; -module.exports = { + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - // no interactivity, for export or image generation - staticPlot: false, + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); + } + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } - // base URL for the 'Edit in Chart Studio' (aka sendDataToCloud) mode bar button - // and the showLink/sendData on-graph link - plotlyServerURL: 'https://plot.ly', + return formattedString || this.toHexString(); + }, + clone: function() { + return tinycolor(this.toString()); + }, - /* - * we can edit titles, move annotations, etc - sets all pieces of `edits` - * unless a separate `edits` config item overrides individual parts - */ - editable: false, - edits: { - /* - * annotationPosition: the main anchor of the annotation, which is the - * text (if no arrow) or the arrow (which drags the whole thing leaving - * the arrow length & direction unchanged) - */ - annotationPosition: false, - // just for annotations with arrows, change the length and direction of the arrow - annotationTail: false, - annotationText: false, - axisTitleText: false, - colorbarPosition: false, - colorbarTitleText: false, - legendPosition: false, - // edit the trace name fields from the legend - legendText: false, - shapePosition: false, - // the global `layout.title` - titleText: false + _applyModification: function(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() { + return this._applyModification(lighten, arguments); + }, + brighten: function() { + return this._applyModification(brighten, arguments); + }, + darken: function() { + return this._applyModification(darken, arguments); + }, + desaturate: function() { + return this._applyModification(desaturate, arguments); + }, + saturate: function() { + return this._applyModification(saturate, arguments); + }, + greyscale: function() { + return this._applyModification(greyscale, arguments); + }, + spin: function() { + return this._applyModification(spin, arguments); }, - /* - * DO autosize once regardless of layout.autosize - * (use default width or height values otherwise) - */ - autosizable: false, + _applyCombination: function(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); + }, + analogous: function() { + return this._applyCombination(analogous, arguments); + }, + complement: function() { + return this._applyCombination(complement, arguments); + }, + monochromatic: function() { + return this._applyCombination(monochromatic, arguments); + }, + splitcomplement: function() { + return this._applyCombination(splitcomplement, arguments); + }, + triad: function() { + return this._applyCombination(triad, arguments); + }, + tetrad: function() { + return this._applyCombination(tetrad, arguments); + } +}; - /* - * responsive: determines whether to change the layout size when window is resized. - * In v2, this option will be removed and will always be true. - */ - responsive: false, +// If input is an object, force 1 into "1.0" to handle ratios properly +// String input requires "1.0" as input, so 1 will be treated as 1 +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; + } - // set the length of the undo/redo queue - queueLength: 0, + return tinycolor(color, opts); +}; - // if we DO autosize, do we fill the container or the screen? - fillFrame: false, +// Given a string or object, convert that input to RGB +// Possible string inputs: +// +// "red" +// "#f00" or "f00" +// "#ff0000" or "ff0000" +// "#ff000000" or "ff000000" +// "rgb 255 0 0" or "rgb (255, 0, 0)" +// "rgb 1.0 0 0" or "rgb (1, 0, 0)" +// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" +// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" +// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" +// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" +// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" +// +function inputToRGB(color) { - // if we DO autosize, set the frame margins in percents of plot size - frameMargins: 0, + var rgb = { r: 0, g: 0, b: 0 }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; - // mousewheel or two-finger scroll zooms the plot - scrollZoom: false, + if (typeof color == "string") { + color = stringInputToObject(color); + } - // double click interaction (false, 'reset', 'autosize' or 'reset+autosize') - doubleClick: 'reset+autosize', + if (typeof color == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = 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; + format = "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; + format = "hsl"; + } - // new users see some hints about interactivity - showTips: true, + if (color.hasOwnProperty("a")) { + a = color.a; + } + } - // enable axis pan/zoom drag handles - showAxisDragHandles: true, + a = boundAlpha(a); - /* - * enable direct range entry at the pan/zoom drag points - * (drag handles must be enabled above) - */ - showAxisRangeEntryBoxes: true, + return { + ok: ok, + format: color.format || format, + r: mathMin(255, mathMax(rgb.r, 0)), + g: mathMin(255, mathMax(rgb.g, 0)), + b: mathMin(255, mathMax(rgb.b, 0)), + a: a + }; +} - // link to open this plot in plotly - showLink: false, - // if we show a link, does it contain data or just link to a plotly file? - sendData: true, +// Conversion Functions +// -------------------- - // text appearing in the sendData link - linkText: 'Edit chart', +// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: +// - // false or function adding source(s) to linkText - showSources: false, +// `rgbToRgb` +// Handle bounds / percentage checking to conform to CSS color spec +// +// *Assumes:* r, g, b in [0, 255] or [0, 1] +// *Returns:* { r, g, b } in [0, 255] +function rgbToRgb(r, g, b){ + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; +} - // display the mode bar (true, false, or 'hover') - displayModeBar: 'hover', +// `rgbToHsl` +// Converts an RGB color value to HSL. +// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] +// *Returns:* { h, s, l } in [0,1] +function rgbToHsl(r, g, b) { - /* - * remove mode bar button by name - * (see ../components/modebar/buttons.js for the list of names) - */ - modeBarButtonsToRemove: [], + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); - /* - * add mode bar button using config objects - * (see ./components/modebar/buttons.js for list of arguments) - */ - modeBarButtonsToAdd: [], + var max = mathMax(r, g, b), min = mathMin(r, g, b); + var h, s, l = (max + min) / 2; - /* - * 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) - */ - modeBarButtons: false, + if(max == min) { + h = s = 0; // achromatic + } + 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; + } - // statically override options for toImage modebar button - // allowed keys are format, filename, width, height, scale - // see ../components/modebar/buttons.js - toImageButtonOptions: {}, + h /= 6; + } - // add the plotly logo on the end of the mode bar - displaylogo: true, + return { h: h, s: s, l: l }; +} - // increase the pixel ratio for Gl plot images - plotGlPixelRatio: 2, +// `hslToRgb` +// Converts an HSL color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] +function hslToRgb(h, s, l) { + var r, g, b; - /* - * background setting function - * 'transparent' sets the background `layout.paper_color` - * 'opaque' blends bg color with white ensuring an opaque background - * or any other custom function of gd - */ - setBackground: 'transparent', + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); - // URL to topojson files used in geo charts - topojsonURL: 'https://cdn.plot.ly/', + function hue2rgb(p, q, t) { + if(t < 0) t += 1; + if(t > 1) t -= 1; + if(t < 1/6) return p + (q - p) * 6 * t; + if(t < 1/2) return q; + if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; + return p; + } - /* - * 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. - */ - mapboxAccessToken: null, + if(s === 0) { + r = g = b = l; // achromatic + } + 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); + } - /* - * Turn all console logging on or off (errors will be thrown) - * This should ONLY be set via Plotly.setPlotConfig - * 0: no logs - * 1: warnings and errors, but not informational messages - * 2: verbose logs - */ - logging: 1, + return { r: r * 255, g: g * 255, b: b * 255 }; +} - /* - * Set global transform to be applied to all traces with no - * specification needed - */ - globalTransforms: [], +// `rgbToHsv` +// Converts an RGB color value to HSV +// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] +// *Returns:* { h, s, v } in [0,1] +function rgbToHsv(r, g, b) { - /* - * Which localization should we use? - * Should be a string like 'en' or 'en-US'. - */ - locale: 'en-US', + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); - /* - * 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. - */ - locales: {} -}; + var max = mathMax(r, g, b), min = mathMin(r, g, b); + var h, s, v = max; -},{}],733:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var d = max - min; + s = max === 0 ? 0 : d / max; + if(max == min) { + h = 0; // achromatic + } + 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: h, s: s, v: v }; +} -'use strict'; +// `hsvToRgb` +// Converts an HSV color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { -var Registry = _dereq_('../registry'); -var Lib = _dereq_('../lib'); + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); -var baseAttributes = _dereq_('../plots/attributes'); -var baseLayoutAttributes = _dereq_('../plots/layout_attributes'); -var frameAttributes = _dereq_('../plots/frame_attributes'); -var animationAttributes = _dereq_('../plots/animation_attributes'); + 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]; -// polar attributes are not part of the Registry yet -var polarAreaAttrs = _dereq_('../plots/polar/legacy/area_attributes'); -var polarAxisAttrs = _dereq_('../plots/polar/legacy/axis_attributes'); + return { r: r * 255, g: g * 255, b: b * 255 }; +} -var editTypes = _dereq_('./edit_types'); +// `rgbToHex` +// Converts an RGB color to hex +// Assumes r, g, and b are contained in the set [0, 255] +// Returns a 3 or 6 character hex +function rgbToHex(r, g, b, allow3Char) { -var extendFlat = Lib.extendFlat; -var extendDeepAll = Lib.extendDeepAll; -var isPlainObject = Lib.isPlainObject; + var hex = [ + pad2(mathRound(r).toString(16)), + pad2(mathRound(g).toString(16)), + pad2(mathRound(b).toString(16)) + ]; -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]; + // Return a 3 character hex if possible + 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); + } -exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; -exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; -exports.DEPRECATED = DEPRECATED; -exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; + return hex.join(""); +} -/** Outputs the full plotly.js plot schema - * - * @return {object} - * - defs - * - traces - * - layout - * - transforms - * - frames - * - animations - * - config (coming soon ...) - */ -exports.get = function() { - var traces = {}; +// `rgbaToHex` +// Converts an RGBA color plus alpha transparency to hex +// Assumes r, g, b are contained in the set [0, 255] and +// a in [0, 1]. Returns a 4 or 8 character rgba hex +function rgbaToHex(r, g, b, a, allow4Char) { - Registry.allTypes.concat('area').forEach(function(type) { - traces[type] = getTraceAttributes(type); - }); + var hex = [ + pad2(mathRound(r).toString(16)), + pad2(mathRound(g).toString(16)), + pad2(mathRound(b).toString(16)), + pad2(convertDecimalToHex(a)) + ]; - var transforms = {}; + // Return a 4 character hex if possible + 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); + } - Object.keys(Registry.transformsRegistry).forEach(function(type) { - transforms[type] = getTransformAttributes(type); - }); + return hex.join(""); +} - return { - defs: { - valObjects: Lib.valObjectMeta, - metaKeys: UNDERSCORE_ATTRS.concat(['description', 'role', 'editType', 'impliedEdits']), - editType: { - traces: editTypes.traces, - layout: editTypes.layout - }, - impliedEdits: { - - } - }, +// `rgbaToArgbHex` +// Converts an RGBA color to an ARGB Hex8 string +// Rarely used, but required for "toFilter()" +function rgbaToArgbHex(r, g, b, a) { - traces: traces, - layout: getLayoutAttributes(), + var hex = [ + pad2(convertDecimalToHex(a)), + pad2(mathRound(r).toString(16)), + pad2(mathRound(g).toString(16)), + pad2(mathRound(b).toString(16)) + ]; - transforms: transforms, + return hex.join(""); +} - frames: getFramesAttributes(), - animation: formatAttributes(animationAttributes) - }; +// `equals` +// Can be called with any tinycolor input +tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) { return false; } + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); }; -/** - * Crawl the attribute tree, recursively calling a callback function - * - * @param {object} attrs - * The node of the attribute tree (e.g. the root) from which recursion originates - * @param {Function} callback - * A callback function with the signature: - * @callback callback - * @param {object} attr an attribute - * @param {String} attrName name string - * @param {object[]} attrs all the attributes - * @param {Number} level the recursion level, 0 at the root - * @param {String} fullAttrString full attribute name (ie 'marker.line') - * @param {Number} [specifiedLevel] - * The level in the tree, in order to let the callback function detect descend or backtrack, - * typically unsupplied (implied 0), just used by the self-recursive call. - * The necessity arises because the tree traversal is not controlled by callback return values. - * The decision to not use callback return values for controlling tree pruning arose from - * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions - * precedes the callback call. - * @param {string} [attrString] - * the path to the current attribute, as an attribute string (ie 'marker.line') - * typically unsupplied, but you may supply it if you want to disambiguate which attrs tree you - * are starting from - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.crawl = function(attrs, callback, specifiedLevel, attrString) { - var level = specifiedLevel || 0; - attrString = attrString || ''; +tinycolor.random = function() { + return tinycolor.fromRatio({ + r: mathRandom(), + g: mathRandom(), + b: mathRandom() + }); +}; - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; - if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; +// Modification Functions +// ---------------------- +// Thanks to less.js for some of the basics here +// - var fullAttrString = (attrString ? attrString + '.' : '') + attrName; - callback(attr, attrName, attrs, level, fullAttrString); +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); +} - if(exports.isValObject(attr)) return; +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); +} - if(isPlainObject(attr) && attrName !== 'impliedEdits') { - exports.crawl(attr, callback, level + 1, fullAttrString); - } - }); -}; +function greyscale(color) { + return tinycolor(color).desaturate(100); +} -/** Is object a value object (or a container object)? - * - * @param {object} obj - * @return {boolean} - * returns true for a valid value object and - * false for tree nodes in the attribute hierarchy - */ -exports.isValObject = function(obj) { - return obj && obj.valType !== undefined; -}; +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); +} -/** - * Find all data array attributes in a given trace object - including - * `arrayOk` attributes. - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * - * @return {array} arrayAttributes - * list of array attributes for the given trace - */ -exports.findArrayAttributes = function(trace) { - var arrayAttributes = []; - var stack = []; - var isArrayStack = []; - var baseContainer, baseAttrName; +function brighten(color, amount) { + amount = (amount === 0) ? 0 : (amount || 10); + var rgb = tinycolor(color).toRgb(); + rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); + rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); + rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); + return tinycolor(rgb); +} - function callback(attr, attrName, attrs, level) { - stack = stack.slice(0, level).concat([attrName]); - isArrayStack = isArrayStack.slice(0, level).concat([attr && attr._isLinkedToArray]); +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); +} - var splittableAttr = ( - attr && - (attr.valType === 'data_array' || attr.arrayOk === true) && - !(stack[level - 1] === 'colorbar' && (attrName === 'ticktext' || attrName === 'tickvals')) - ); +// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. +// Values outside of this range will be wrapped into this range. +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); +} - // Manually exclude 'colorbar.tickvals' and 'colorbar.ticktext' for now - // which are declared as `valType: 'data_array'` but scale independently of - // the coordinate arrays. - // - // Down the road, we might want to add a schema field (e.g `uncorrelatedArray: true`) - // to distinguish attributes of the likes. +// Combination Functions +// --------------------- +// Thanks to jQuery xColor for some of the ideas behind these +// - if(!splittableAttr) return; +function complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); +} - crawlIntoTrace(baseContainer, 0, ''); - } +function triad(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) + ]; +} - function crawlIntoTrace(container, i, astrPartial) { - var item = container[stack[i]]; - var newAstrPartial = astrPartial + stack[i]; - if(i === stack.length - 1) { - if(Lib.isArrayOrTypedArray(item)) { - arrayAttributes.push(baseAttrName + newAstrPartial); - } - } - else { - if(isArrayStack[i]) { - if(Array.isArray(item)) { - for(var j = 0; j < item.length; j++) { - if(Lib.isPlainObject(item[j])) { - crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].'); - } - } - } - } - else if(Lib.isPlainObject(item)) { - crawlIntoTrace(item, i + 1, newAstrPartial + '.'); - } - } - } +function tetrad(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) + ]; +} - baseContainer = trace; - baseAttrName = ''; - exports.crawl(baseAttributes, callback); - if(trace._module && trace._module.attributes) { - exports.crawl(trace._module.attributes, callback); - } +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}) + ]; +} - var transforms = trace.transforms; - if(transforms) { - for(var i = 0; i < transforms.length; i++) { - var transform = transforms[i]; - var module = transform._module; +function analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; - if(module) { - baseAttrName = 'transforms[' + i + '].'; - baseContainer = transform; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; - exports.crawl(module.attributes, callback); - } - } + for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); } + return ret; +} - return arrayAttributes; -}; - -/* - * Find the valObject for one attribute in an existing trace - * - * @param {object} trace - * full trace object that contains a reference to `_module.attributes` - * @param {object} parts - * an array of parts, like ['transforms', 1, 'value'] - * typically from nestedProperty(...).parts - * - * @return {object|false} - * the valObject for this attribute, or the last found parent - * in some cases the innermost valObject will not exist, for example - * `valType: 'any'` attributes where we might set a part of the attribute. - * In that case, stop at the deepest valObject we *do* find. - */ -exports.getTraceValObject = function(trace, parts) { - var head = parts[0]; - var i = 1; // index to start recursing from - var moduleAttrs, valObject; +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; - 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; // start recursing only inside the transform - } - else if(trace.type === 'area') { - valObject = polarAreaAttrs[head]; + while (results--) { + ret.push(tinycolor({ h: h, s: s, v: v})); + v = (v + modification) % 1; } - else { - // first look in the module for this trace - // components have already merged their trace attributes in here - 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]; + return ret; +} - // then look in the subplot attributes - if(!valObject) { - var subplotModule = _module.basePlotModule; - if(subplotModule && subplotModule.attributes) { - valObject = subplotModule.attributes[head]; - } - } +// Utility Functions +// --------------------- - // finally look in the global attributes - if(!valObject) valObject = baseAttributes[head]; - } +tinycolor.mix = function(color1, color2, amount) { + amount = (amount === 0) ? 0 : (amount || 50); - return recurseIntoValObject(valObject, parts, i); + 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); }; -/* - * Find the valObject for one layout attribute - * - * @param {array} parts - * an array of parts, like ['annotations', 1, 'x'] - * typically from nestedProperty(...).parts - * - * @return {object|false} - * the valObject for this attribute, or the last found parent - * in some cases the innermost valObject will not exist, for example - * `valType: 'any'` attributes where we might set a part of the attribute. - * In that case, stop at the deepest valObject we *do* find. - */ -exports.getLayoutValObject = function(fullLayout, parts) { - var valObject = layoutHeadAttr(fullLayout, parts[0]); - return recurseIntoValObject(valObject, parts, 1); +// Readability Functions +// --------------------- +// false +// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false +tinycolor.isReadable = function(color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; - // otherwise take the first attributes we find - if(!out && _module.layoutAttributes) out = _module.layoutAttributes; - } + out = false; - // a module can also override the behavior of base (and component) module layout attrs - // again see gl2d for initial use case - var baseOverrides = _module.baseLayoutAttrOverrides; - if(baseOverrides && head in baseOverrides) return baseOverrides[head]; - } - if(out) return out; + 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; - // look for layout attributes contributed by traces on the plot - 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]; - } - } - } +}; - /* - * Next look in components. - * Components that define a schema have already merged this into - * base and subplot attribute defs, so ignore these. - * Others (older style) all put all their attributes - * inside a container matching the module `name` - * eg `attributes` (array) or `legend` (object) - */ - for(key in Registry.componentsRegistry) { - _module = Registry.componentsRegistry[key]; - if(!_module.schema && (head === _module.name)) { - return _module.layoutAttributes; +// `mostReadable` +// Given a base color and a list of possible foreground or background +// colors for that base, returns the most readable color. +// Optionally returns Black or White if the most readable color is unreadable. +// *Example* +// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" +// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" +// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" +// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" +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(head in baseLayoutAttributes) return baseLayoutAttributes[head]; - - // Polar doesn't populate _modules or _basePlotModules - // just fall back on these when the others fail - if(head === 'radialaxis' || head === 'angularaxis') { - return polarAxisAttrs[head]; + if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { + return bestColor; } - return polarAxisAttrs.layout[head] || false; -} + else { + args.includeFallbackColors=false; + return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); + } +}; -function recurseIntoValObject(valObject, parts, i) { - if(!valObject) return false; - if(valObject._isLinkedToArray) { - // skip array index, abort if we try to dive into an array without an index - if(isIndex(parts[i])) i++; - else if(i < parts.length) return false; - } +// Big List of Colors +// ------------------ +// +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" +}; - // now recurse as far as we can. Occasionally we have an attribute - // setting an internal part below what's in the schema; just return - // the innermost schema item we find. - for(; i < parts.length; i++) { - var newValObject = valObject[parts[i]]; - if(isPlainObject(newValObject)) valObject = newValObject; - else break; +// Make it easy to access colors via `hexNames[hex]` +var hexNames = tinycolor.hexNames = flip(names); - 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; +// Utilities +// --------- - 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; - } +// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` +function flip(o) { + var flipped = { }; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; } } - - return valObject; + return flipped; } -// note: this is different from Lib.isIndex, this one doesn't accept numeric -// strings, only actual numbers. -function isIndex(val) { - return val === Math.round(val) && val >= 0; +// Return a valid alpha value [0,1] with all invalid values being set to 1 +function boundAlpha(a) { + a = parseFloat(a); + + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + + return a; } -function getTraceAttributes(type) { - var _module, basePlotModule; +// Take input from [0, n] and return it as [0, 1] +function bound01(n, max) { + if (isOnePointZero(n)) { n = "100%"; } - if(type === 'area') { - _module = { attributes: polarAreaAttrs }; - basePlotModule = {}; - } - else { - _module = Registry.modules[type]._module, - basePlotModule = _module.basePlotModule; + var processPercent = isPercentage(n); + n = mathMin(max, mathMax(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; } - var attributes = {}; + // Handle floating point rounding errors + if ((Math.abs(n - max) < 0.000001)) { + return 1; + } - // make 'type' the first attribute in the object - attributes.type = null; + // Convert into [0, 1] range if it isn't already + return (n % max) / parseFloat(max); +} +// Force a number between 0 and 1 +function clamp01(val) { + return mathMin(1, mathMax(0, val)); +} - var copyBaseAttributes = extendDeepAll({}, baseAttributes); - var copyModuleAttributes = extendDeepAll({}, _module.attributes); +// Parse a base-16 hex value into a base-10 integer +function parseIntFromHex(val) { + return parseInt(val, 16); +} - // prune global-level trace attributes that are already defined in a trace - exports.crawl(copyModuleAttributes, function(attr, attrName, attrs, level, fullAttrString) { - Lib.nestedProperty(copyBaseAttributes, fullAttrString).set(undefined); - // Prune undefined attributes - if(attr === undefined) Lib.nestedProperty(copyModuleAttributes, fullAttrString).set(undefined); - }); +// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 +// +function isOnePointZero(n) { + return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; +} - // base attributes (same for all trace types) - extendDeepAll(attributes, copyBaseAttributes); +// Check to see if string passed in is a percentage +function isPercentage(n) { + return typeof n === "string" && n.indexOf('%') != -1; +} - // module attributes - extendDeepAll(attributes, copyModuleAttributes); +// Force a hex value to have 2 characters +function pad2(c) { + return c.length == 1 ? '0' + c : '' + c; +} - // subplot attributes - if(basePlotModule.attributes) { - extendDeepAll(attributes, basePlotModule.attributes); +// Replace a decimal with it's percentage value +function convertToPercentage(n) { + if (n <= 1) { + n = (n * 100) + "%"; } - // 'type' gets overwritten by baseAttributes; reset it here - attributes.type = type; + return n; +} - var out = { - meta: _module.meta || {}, - attributes: formatAttributes(attributes), - }; +// Converts a decimal to a hex value +function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); +} +// Converts a hex value to a decimal +function convertHexToDecimal(h) { + return (parseIntFromHex(h) / 255); +} - // trace-specific layout attributes - if(_module.layoutAttributes) { - var layoutAttributes = {}; +var matchers = (function() { - extendDeepAll(layoutAttributes, _module.layoutAttributes); - out.layoutAttributes = formatAttributes(layoutAttributes); - } + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; - return out; -} + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; -function getLayoutAttributes() { - var layoutAttributes = {}; - var key, _module; + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; - // global layout attributes - extendDeepAll(layoutAttributes, baseLayoutAttributes); + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + 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*\\)?"; - // add base plot module layout attributes - for(key in Registry.subplotsRegistry) { - _module = Registry.subplotsRegistry[key]; + 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})$/ + }; +})(); - if(!_module.layoutAttributes) continue; +// `isValidCSSUnit` +// Take in a single string / number and check to see if it looks like a CSS unit +// (see `matchers` above for definition). +function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); +} - 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); - } +// `stringInputToObject` +// Permissive string parsing. Take in a number of formats, and output an object +// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` +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" }; } - // polar layout attributes - layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + 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" + }; + } - // add registered components layout attributes - for(key in Registry.componentsRegistry) { - _module = Registry.componentsRegistry[key]; - var schema = _module.schema; + return false; +} - /* - * Components with defined schema have already been merged in at register time - * but a few components define attributes that apply only to xaxis - * not yaxis (rangeselector, rangeslider) - delete from y schema. - * Note that the input attributes for xaxis/yaxis are the same object - * so it's not possible to only add them to xaxis from the start. - * If we ever have such asymmetry the other way, or anywhere else, - * we will need to extend both this code and mergeComponentAttrsToSubplot - * (which will not find yaxis only for example) - */ - 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]; - } - } - // older style without schema need to be explicitly merged in now - else if(_module.layoutAttributes) { - insertAttrs(layoutAttributes, _module.layoutAttributes, _module.name); - } +function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + 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":level, "size":size}; +} - return { - layoutAttributes: formatAttributes(layoutAttributes) - }; +// Node: Export function +if (typeof module !== "undefined" && module.exports) { + module.exports = tinycolor; +} +// AMD/requirejs: Define the module +else if (typeof define === 'function' && define.amd) { + define(function () {return tinycolor;}); +} +// Browser: Expose to window +else { + window.tinycolor = tinycolor; } -function getTransformAttributes(type) { - var _module = Registry.transformsRegistry[type]; - var attributes = extendDeepAll({}, _module.attributes); +})(Math); - // add registered components transform attributes - Object.keys(Registry.componentsRegistry).forEach(function(k) { - var _module = Registry.componentsRegistry[k]; +},{}],27:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(_module.schema && _module.schema.transforms && _module.schema.transforms[type]) { - Object.keys(_module.schema.transforms[type]).forEach(function(v) { - insertAttrs(attributes, _module.schema.transforms[type][v], v); - }); - } - }); +'use strict'; - return { - attributes: formatAttributes(attributes) - }; -} +/** + * All paths are tuned for maximum scalability of the arrowhead, + * ie throughout arrowwidth=0.3..3 the head is joined smoothly + * to the line, with the line coming from the left and ending at (0, 0). + * + * `backoff` is the distance to move the arrowhead and the end of the line, + * in order that the arrowhead points to the desired place, either at + * the tip of the arrow or (in the case of circle or square) + * the center of the symbol. + * + * `noRotate`, if truthy, says that this arrowhead should not rotate with the + * arrow. That's the case for squares, which should always be straight, and + * circles, for which it's irrelevant. + */ -function getFramesAttributes() { - var attrs = { - frames: Lib.extendDeepAll({}, frameAttributes) - }; +module.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 + } +]; - formatAttributes(attrs); +},{}],28:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return attrs.frames; -} +'use strict'; -function formatAttributes(attrs) { - mergeValTypeAndRole(attrs); - formatArrayContainers(attrs); - stringify(attrs); +var ARROWPATHS = _dereq_('./arrow_paths'); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var cartesianConstants = _dereq_('../../plots/cartesian/constants'); +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - return attrs; -} -function mergeValTypeAndRole(attrs) { +module.exports = templatedArray('annotation', { + visible: { + valType: 'boolean', + + dflt: true, + editType: 'calc+arraydraw', + + }, + + text: { + valType: 'string', + + editType: 'calc+arraydraw', + + }, + textangle: { + valType: 'angle', + dflt: 0, + + editType: 'calc+arraydraw', + + }, + font: fontAttrs({ + editType: 'calc+arraydraw', + colorEditType: 'arraydraw', + + }), + width: { + valType: 'number', + min: 1, + dflt: null, + + editType: 'calc+arraydraw', + + }, + height: { + valType: 'number', + min: 1, + dflt: null, + + editType: 'calc+arraydraw', + + }, + opacity: { + valType: 'number', + min: 0, + max: 1, + dflt: 1, + + editType: 'arraydraw', + + }, + align: { + valType: 'enumerated', + values: ['left', 'center', 'right'], + dflt: 'center', + + editType: 'arraydraw', + + }, + valign: { + valType: 'enumerated', + values: ['top', 'middle', 'bottom'], + dflt: 'middle', + + editType: 'arraydraw', + + }, + bgcolor: { + valType: 'color', + dflt: 'rgba(0,0,0,0)', + + editType: 'arraydraw', + + }, + bordercolor: { + valType: 'color', + dflt: 'rgba(0,0,0,0)', + + editType: 'arraydraw', + + }, + borderpad: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'calc+arraydraw', + + }, + borderwidth: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'calc+arraydraw', + + }, + // arrow + showarrow: { + valType: 'boolean', + dflt: true, + + editType: 'calc+arraydraw', + + }, + arrowcolor: { + valType: 'color', + + editType: 'arraydraw', + + }, + arrowhead: { + valType: 'integer', + min: 0, + max: ARROWPATHS.length, + dflt: 1, + + editType: 'arraydraw', + + }, + startarrowhead: { + valType: 'integer', + min: 0, + max: ARROWPATHS.length, + dflt: 1, + + editType: 'arraydraw', + + }, + arrowside: { + valType: 'flaglist', + flags: ['end', 'start'], + extras: ['none'], + dflt: 'end', + + editType: 'arraydraw', + + }, + arrowsize: { + valType: 'number', + min: 0.3, + dflt: 1, + + editType: 'calc+arraydraw', + + }, + startarrowsize: { + valType: 'number', + min: 0.3, + dflt: 1, + + editType: 'calc+arraydraw', + + }, + arrowwidth: { + valType: 'number', + min: 0.1, + + editType: 'calc+arraydraw', + + }, + standoff: { + valType: 'number', + min: 0, + dflt: 0, + + editType: 'calc+arraydraw', + + }, + startstandoff: { + valType: 'number', + min: 0, + dflt: 0, + + editType: 'calc+arraydraw', + + }, + ax: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + ay: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + axref: { + valType: 'enumerated', + dflt: 'pixel', + values: [ + 'pixel', + cartesianConstants.idRegex.x.toString() + ], + + editType: 'calc', + + }, + ayref: { + valType: 'enumerated', + dflt: 'pixel', + values: [ + 'pixel', + cartesianConstants.idRegex.y.toString() + ], + + editType: 'calc', + + }, + // positioning + xref: { + valType: 'enumerated', + values: [ + 'paper', + cartesianConstants.idRegex.x.toString() + ], + + editType: 'calc', + + }, + x: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + xanchor: { + valType: 'enumerated', + values: ['auto', 'left', 'center', 'right'], + dflt: 'auto', + + editType: 'calc+arraydraw', + + }, + xshift: { + valType: 'number', + dflt: 0, + + editType: 'calc+arraydraw', + + }, + yref: { + valType: 'enumerated', + values: [ + 'paper', + cartesianConstants.idRegex.y.toString() + ], + + editType: 'calc', + + }, + y: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + yanchor: { + valType: 'enumerated', + values: ['auto', 'top', 'middle', 'bottom'], + dflt: 'auto', + + editType: 'calc+arraydraw', + + }, + yshift: { + valType: 'number', + dflt: 0, + + editType: 'calc+arraydraw', + + }, + clicktoshow: { + valType: 'enumerated', + values: [false, 'onoff', 'onout'], + dflt: false, + + editType: 'arraydraw', + + }, + xclick: { + valType: 'any', + + editType: 'arraydraw', + + }, + yclick: { + valType: 'any', + + editType: 'arraydraw', + + }, + hovertext: { + valType: 'string', + + editType: 'arraydraw', + + }, + hoverlabel: { + bgcolor: { + valType: 'color', + + editType: 'arraydraw', + + }, + bordercolor: { + valType: 'color', + + editType: 'arraydraw', + + }, + font: fontAttrs({ + editType: 'arraydraw', + + }), + editType: 'arraydraw' + }, + captureevents: { + valType: 'boolean', + + editType: 'arraydraw', + + }, + editType: 'calc', - function makeSrcAttr(attrName) { - return { + _deprecated: { + ref: { valType: 'string', + editType: 'calc', - editType: 'none' - }; - } - - function callback(attr, attrName, attrs) { - if(exports.isValObject(attr)) { - if(attr.valType === 'data_array') { - // all 'data_array' attrs have role 'data' - attr.role = 'data'; - // all 'data_array' attrs have a corresponding 'src' attr - attrs[attrName + 'src'] = makeSrcAttr(attrName); - } - else if(attr.arrayOk === true) { - // all 'arrayOk' attrs have a corresponding 'src' attr - attrs[attrName + 'src'] = makeSrcAttr(attrName); - } - } - else if(isPlainObject(attr)) { - // all attrs container objects get role 'object' - attr.role = 'object'; } } +}); - exports.crawl(attrs, callback); -} - -function formatArrayContainers(attrs) { +},{"../../plot_api/plot_template":193,"../../plots/cartesian/constants":209,"../../plots/font_attributes":230,"./arrow_paths":27}],29:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - function callback(attr, attrName, attrs) { - if(!attr) return; - var itemName = attr[IS_LINKED_TO_ARRAY]; +'use strict'; - if(!itemName) return; +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); - delete attr[IS_LINKED_TO_ARRAY]; +var draw = _dereq_('./draw').draw; - attrs[attrName] = { items: {} }; - attrs[attrName].items[itemName] = attr; - attrs[attrName].role = 'object'; - } - exports.crawl(attrs, callback); -} +module.exports = function calcAutorange(gd) { + var fullLayout = gd._fullLayout; + var annotationList = Lib.filterVisible(fullLayout.annotations); -// this can take around 10ms and should only be run from PlotSchema.get(), -// to ensure JSON.stringify(PlotSchema.get()) gives the intended result. -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 { - // as JSON.stringify(/test/) // => {} - if(attr[k] instanceof RegExp) { - attr[k] = attr[k].toString(); - } - } - } + if(annotationList.length && gd._fullData.length) { + return Lib.syncOrAsync([draw, annAutorange], gd); } +}; - walk(attrs); -} - -function assignPolarLayoutAttrs(layoutAttributes) { - extendFlat(layoutAttributes, { - radialaxis: polarAxisAttrs.radialaxis, - angularaxis: polarAxisAttrs.angularaxis - }); +function annAutorange(gd) { + var fullLayout = gd._fullLayout; - extendFlat(layoutAttributes, polarAxisAttrs.layout); + // find the bounding boxes for each of these annotations' + // relative to their anchor points + // use the arrow and the text bg rectangle, + // as the whole anno may include hidden text in its bbox + Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { + var xa = Axes.getFromId(gd, ann.xref); + var ya = Axes.getFromId(gd, ann.yref); - return layoutAttributes; + ann._extremes = {}; + if(xa) calcAxisExpansion(ann, xa); + if(ya) calcAxisExpansion(ann, ya); + }); } -function handleBasePlotModule(layoutAttributes, _module, astr) { - var np = Lib.nestedProperty(layoutAttributes, astr), - attrs = extendDeepAll({}, _module.layoutAttributes); - - attrs[IS_SUBPLOT_OBJ] = true; - np.set(attrs); -} +function calcAxisExpansion(ann, ax) { + var axId = ax._id; + var letter = axId.charAt(0); + var pos = ann[letter]; + var apos = ann['a' + letter]; + var ref = 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; -function insertAttrs(baseAttrs, newAttrs, astr) { - var np = Lib.nestedProperty(baseAttrs, astr); + if(aref === ref) { + // expand for the arrowhead (padded by arrowhead) + var extremeArrowHead = Axes.findExtremes(ax, [ax.r2c(pos)], { + ppadplus: headPlus, + ppadminus: headMinus + }); + // again for the textbox (padded by textbox) + 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) + }); + } - np.set(extendDeepAll(np.get() || {}, newAttrs)); + ann._extremes[axId] = extremes; } -},{"../lib":696,"../plots/animation_attributes":739,"../plots/attributes":741,"../plots/frame_attributes":772,"../plots/layout_attributes":799,"../plots/polar/legacy/area_attributes":814,"../plots/polar/legacy/axis_attributes":815,"../registry":827,"./edit_types":727}],734:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plots/cartesian/axes":203,"./draw":34}],30:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Lib = _dereq_('../lib'); -var plotAttributes = _dereq_('../plots/attributes'); - -var TEMPLATEITEMNAME = 'templateitemname'; - -var templateAttrs = { - name: { - valType: 'string', - - editType: 'none', - - } -}; -templateAttrs[TEMPLATEITEMNAME] = { - valType: 'string', - - editType: 'calc', - -}; - -/** - * templatedArray: decorate an attributes object with templating (and array) - * properties. - * - * @param {string} name: the singular form of the array name. Sets - * `_isLinkedToArray` to this, so the schema knows to treat this as an array. - * @param {object} attrs: the item attributes. Since all callers are expected - * to be constructing this object on the spot, we mutate it here for - * performance, rather than extending a new object with it. - * - * @returns {object}: the decorated `attrs` object - */ -exports.templatedArray = function(name, attrs) { - attrs._isLinkedToArray = name; - attrs.name = templateAttrs.name; - attrs[TEMPLATEITEMNAME] = templateAttrs[TEMPLATEITEMNAME]; - return attrs; -}; - -/** - * traceTemplater: logic for matching traces to trace templates - * - * @param {object} dataTemplate: collection of {traceType: [{template}, ...]} - * ie each type the template applies to contains a list of template objects, - * to be provided cyclically to data traces of that type. - * - * @returns {object}: {newTrace}, a function: - * newTrace(traceIn): that takes the input traceIn, coerces its type, then - * uses that type to find the next template to apply. returns the output - * traceOut with template attached, ready to continue supplyDefaults. - */ -exports.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]; - // cycle through traces in the template set for this type - var typei = traceCounts[traceType] % typeTemplates.length; - traceCounts[traceType]++; - traceOut._template = typeTemplates[typei]; - } - else { - // TODO: anything we should do for types missing from the template? - // try to apply some other type? Or just bail as we do here? - // Actually I think yes, we should apply other types; would be nice - // if all scatter* could inherit from each other, and if histogram - // could inherit from bar, etc... but how to specify this? And do we - // compose them, or if a type is present require it to be complete? - // Actually this could apply to layout too - 3D annotations - // inheriting from 2D, axes of different types inheriting from each - // other... - } - return traceOut; - } - - return { - newTrace: newTrace - // TODO: function to figure out what's left & what didn't work - }; -}; - -/** - * newContainer: Create a new sub-container inside `container` and propagate any - * applicable template to it. If there's no template, still propagates - * `undefined` so relinkPrivate will not retain an old template! - * - * @param {object} container: the outer container, should already have _template - * if there *is* a template for this plot - * @param {string} name: the key of the new container to make - * @param {string} baseName: if applicable, a base attribute to take the - * template from, ie for xaxis3 the base would be xaxis - * - * @returns {object}: an object for inclusion _full*, empty except for the - * appropriate template piece - */ -exports.newContainer = function(container, name, baseName) { - var template = container._template; - var part = template && (template[name] || (baseName && template[baseName])); - if(!Lib.isPlainObject(part)) part = null; +var Lib = _dereq_('../../lib'); +var Registry = _dereq_('../../registry'); +var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - var out = container[name] = {_template: part}; - return out; +module.exports = { + hasClickToShow: hasClickToShow, + onClick: onClick }; -/** - * arrayTemplater: special logic for templating both defaults and specific items - * in a container array (annotations etc) - * - * @param {object} container: the outer container, should already have _template - * if there *is* a template for this plot - * @param {string} name: the name of the array to template (ie 'annotations') - * will be used to find default ('annotationdefaults' object) and specific - * ('annotations' array) template specs. - * @param {string} inclusionAttr: the attribute determining this item's - * inclusion in the output, usually 'visible' or 'enabled' +/* + * hasClickToShow: does the given hoverData have ANY annotations which will + * turn ON if we click here? (used by hover events to set cursor) * - * @returns {object}: {newItem, defaultItems}, both functions: - * newItem(itemIn): create an output item, bare except for the correct - * template and name(s), as the base for supplyDefaults - * defaultItems(): to be called after all newItem calls, return any - * specific template items that have not already beeen included, - * also as bare output items ready for supplyDefaults. - */ -exports.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) { - // include name and templateitemname in the output object for ALL - // container array items. Note: you could potentially use different - // name and templateitemname, if you're using one template to make - // another template. templateitemname would be the name in the original - // template, and name is the new "subclassed" item name. - var out = {name: itemIn.name, _input: itemIn}; - var templateItemName = out[TEMPLATEITEMNAME] = itemIn[TEMPLATEITEMNAME]; - - // no itemname: use the default template - if(!validItemName(templateItemName)) { - out._template = defaultsTemplate; - return out; - } - - // look for an item matching this itemname - // note these do not inherit from the default template, only the item. - for(var i = 0; i < templateItems.length; i++) { - var templateItem = templateItems[i]; - if(templateItem.name === templateItemName) { - // Note: it's OK to use a template item more than once - // but using it at least once will stop it from generating - // a default item at the end. - usedNames[templateItemName] = 1; - out._template = templateItem; - return out; - } - } - - // Didn't find a matching template item, so since this item is intended - // to only be modifications it's most likely broken. Hide it unless - // it's explicitly marked visible - in which case it gets NO template, - // not even the default. - out[inclusionAttr] = itemIn[inclusionAttr] || false; - // special falsy value we can look for in validateTemplate - out._template = false; - return out; - } - - function defaultItems() { - var out = []; - for(var i = 0; i < templateItems.length; i++) { - var templateItem = templateItems[i]; - var name = templateItem.name; - // only allow named items to be added as defaults, - // and only allow each name once - if(validItemName(name) && !usedNames[name]) { - var outi = { - _template: templateItem, - name: name, - _input: {_templateitemname: name} - }; - outi[TEMPLATEITEMNAME] = templateItem[TEMPLATEITEMNAME]; - out.push(outi); - usedNames[name] = 1; - } - } - return out; - } + * gd: graphDiv + * hoverData: a hoverData array, as included with the *plotly_hover* or + * *plotly_click* events in the `points` attribute + * + * returns: boolean + */ +function hasClickToShow(gd, hoverData) { + var sets = getToggleSets(gd, hoverData); + return sets.on.length > 0 || sets.explicitOff.length > 0; +} - return { - newItem: newItem, - defaultItems: defaultItems - }; -}; +/* + * onClick: perform the toggling (via Plotly.update) implied by clicking + * at this hoverData + * + * gd: graphDiv + * hoverData: a hoverData array, as included with the *plotly_hover* or + * *plotly_click* events in the `points` attribute + * + * returns: Promise that the update is complete + */ +function onClick(gd, hoverData) { + var toggleSets = getToggleSets(gd, hoverData); + var onSet = toggleSets.on; + var offSet = toggleSets.off.concat(toggleSets.explicitOff); + var update = {}; + var annotationsOut = gd._fullLayout.annotations; + var i, editHelpers; -function validItemName(name) { - return name && typeof name === 'string'; -} + if(!(onSet.length || offSet.length)) return; -function arrayDefaultKey(name) { - var lastChar = name.length - 1; - if(name.charAt(lastChar) !== 's') { - Lib.warn('bad argument to arrayDefaultKey: ' + name); + for(i = 0; i < onSet.length; i++) { + editHelpers = arrayEditor(gd.layout, 'annotations', annotationsOut[onSet[i]]); + editHelpers.modifyItem('visible', true); + Lib.extendFlat(update, editHelpers.getUpdateObj()); } - return name.substr(0, name.length - 1) + 'defaults'; + + for(i = 0; i < offSet.length; i++) { + editHelpers = arrayEditor(gd.layout, 'annotations', annotationsOut[offSet[i]]); + editHelpers.modifyItem('visible', false); + Lib.extendFlat(update, editHelpers.getUpdateObj()); + } + + return Registry.call('update', gd, {}, update); } -exports.arrayDefaultKey = arrayDefaultKey; -/** - * arrayEditor: helper for editing array items that may have come from - * template defaults (in which case they will not exist in the input yet) +/* + * getToggleSets: find the annotations which will turn on or off at this + * hoverData * - * @param {object} parentIn: the input container (eg gd.layout) - * @param {string} containerStr: the attribute string for the container inside - * `parentIn`. - * @param {object} itemOut: the _full* item (eg gd._fullLayout.annotations[0]) - * that we'll be editing. Assumed to have been created by `arrayTemplater`. + * gd: graphDiv + * hoverData: a hoverData array, as included with the *plotly_hover* or + * *plotly_click* events in the `points` attribute * - * @returns {object}: {modifyBase, modifyItem, getUpdateObj, applyUpdate}, all functions: - * modifyBase(attr, value): Add an update that's *not* related to the item. - * `attr` is the full attribute string. - * modifyItem(attr, value): Add an update to the item. `attr` is just the - * portion of the attribute string inside the item. - * getUpdateObj(): Get the final constructed update object, to use in - * `restyle` or `relayout`. Also resets the update object in case this - * update was canceled. - * applyUpdate(attr, value): optionally add an update `attr: value`, - * then apply it to `parent` which should be the parent of `containerIn`, - * ie the object to which `containerStr` is the attribute string. + * returns: { + * on: Array (indices of annotations to turn on), + * off: Array (indices to turn off because you're not hovering on them), + * explicitOff: Array (indices to turn off because you *are* hovering on them) + * } */ -exports.arrayEditor = function(parentIn, containerStr, itemOut) { - var lengthIn = (Lib.nestedProperty(parentIn, containerStr).get() || []).length; - var index = itemOut._index; - // Check that we are indeed off the end of this container. - // Otherwise a devious user could put a key `_templateitemname` in their - // own input and break lots of things. - var templateItemName = (index >= lengthIn) && (itemOut._input || {})._templateitemname; - if(templateItemName) index = lengthIn; - var itemStr = containerStr + '[' + index + ']'; +function getToggleSets(gd, hoverData) { + var annotations = gd._fullLayout.annotations; + var onSet = []; + var offSet = []; + var explicitOffSet = []; + var hoverLen = (hoverData || []).length; - var update; - function resetUpdate() { - update = {}; - if(templateItemName) { - update[itemStr] = {}; - update[itemStr][TEMPLATEITEMNAME] = templateItemName; - } - } - resetUpdate(); + var i, j, anni, showMode, pointj, xa, ya, toggleType; - function modifyBase(attr, value) { - update[attr] = value; - } + for(i = 0; i < annotations.length; i++) { + anni = annotations[i]; + showMode = anni.clicktoshow; - function modifyItem(attr, value) { - if(templateItemName) { - // we're making a new object: edit that object - Lib.nestedProperty(update[itemStr], attr).set(value); - } - else { - // we're editing an existing object: include *just* the edit - update[itemStr + '.' + attr] = value; - } - } + if(showMode) { + for(j = 0; j < hoverLen; j++) { + pointj = hoverData[j]; + xa = pointj.xaxis; + ya = pointj.yaxis; - function getUpdateObj() { - var updateOut = update; - resetUpdate(); - return updateOut; - } + if(xa._id === anni.xref && + ya._id === anni.yref && + xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && + ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) + ) { + // match! toggle this annotation + // regardless of its clicktoshow mode + // but if it's onout mode, off is implicit + if(anni.visible) { + if(showMode === 'onout') toggleType = offSet; + else toggleType = explicitOffSet; + } + else { + toggleType = onSet; + } + toggleType.push(i); + break; + } + } - function applyUpdate(attr, value) { - if(attr) modifyItem(attr, value); - var updateToApply = getUpdateObj(); - for(var key in updateToApply) { - Lib.nestedProperty(parentIn, key).set(updateToApply[key]); + if(j === hoverLen) { + // no match - only turn this annotation OFF, and only if + // showmode is 'onout' + if(anni.visible && showMode === 'onout') offSet.push(i); + } } } - return { - modifyBase: modifyBase, - modifyItem: modifyItem, - getUpdateObj: getUpdateObj, - applyUpdate: applyUpdate - }; -}; + return {on: onSet, off: offSet, explicitOff: explicitOffSet}; +} + +// to handle log axes until v2 +function clickData2r(d, ax) { + return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); +} -},{"../lib":696,"../plots/attributes":741}],735:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plot_api/plot_template":193,"../../registry":243}],31:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -108032,1816 +15346,1471 @@ 'use strict'; -var d3 = _dereq_('d3'); -var Registry = _dereq_('../registry'); -var Plots = _dereq_('../plots/plots'); - -var Lib = _dereq_('../lib'); -var clearGlCanvases = _dereq_('../lib/clear_gl_canvases'); - -var Color = _dereq_('../components/color'); -var Drawing = _dereq_('../components/drawing'); -var Titles = _dereq_('../components/titles'); -var ModeBar = _dereq_('../components/modebar'); +var Lib = _dereq_('../../lib'); +var Color = _dereq_('../color'); -var Axes = _dereq_('../plots/cartesian/axes'); -var alignmentConstants = _dereq_('../constants/alignment'); -var axisConstraints = _dereq_('../plots/cartesian/constraints'); -var enforceAxisConstraints = axisConstraints.enforce; -var cleanAxisConstraints = axisConstraints.clean; -var doAutoRange = _dereq_('../plots/cartesian/autorange').doAutoRange; +// defaults common to 'annotations' and 'annotations3d' +module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { + coerce('opacity'); + var bgColor = coerce('bgcolor'); -exports.layoutStyles = function(gd) { - return Lib.syncOrAsync([Plots.doAutoMargin, lsInner], gd); -}; + var borderColor = coerce('bordercolor'); + var borderOpacity = Color.opacity(borderColor); -function overlappingDomain(xDomain, yDomain, domains) { - for(var i = 0; i < domains.length; i++) { - var existingX = domains[i][0], - existingY = domains[i][1]; + coerce('borderpad'); - if(existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) { - continue; - } - if(existingY[0] < yDomain[1] && existingY[1] > yDomain[0]) { - return true; - } - } - return false; -} + var borderWidth = coerce('borderwidth'); + var showArrow = coerce('showarrow'); -function lsInner(gd) { - var fullLayout = gd._fullLayout; - var gs = fullLayout._size; - var pad = gs.p; - var axList = Axes.list(gd, '', true); - var i, subplot, plotinfo, xa, ya; + coerce('text', showArrow ? ' ' : fullLayout._dfltTitle.annotation); + coerce('textangle'); + Lib.coerceFont(coerce, 'font', fullLayout.font); - fullLayout._paperdiv.style({ - width: (gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroWidth && !gd.layout.width) ? '100%' : fullLayout.width + 'px', - height: (gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroHeight && !gd.layout.height) ? '100%' : fullLayout.height + 'px' - }) - .selectAll('.main-svg') - .call(Drawing.setSize, fullLayout.width, fullLayout.height); - gd._context.setBackground(gd, fullLayout.paper_bgcolor); + coerce('width'); + coerce('align'); - exports.drawMainTitle(gd); - ModeBar.manage(gd); + var h = coerce('height'); + if(h) coerce('valign'); - // _has('cartesian') means SVG specifically, not GL2D - but GL2D - // can still get here because it makes some of the SVG structure - // for shared features like selections. - if(!fullLayout._has('cartesian')) { - return gd._promises.length && Promise.all(gd._promises); - } + if(showArrow) { + var arrowside = coerce('arrowside'); + var arrowhead; + var arrowsize; - function getLinePosition(ax, counterAx, side) { - var lwHalf = ax._lw / 2; + if(arrowside.indexOf('end') !== -1) { + arrowhead = coerce('arrowhead'); + arrowsize = coerce('arrowsize'); + } - if(ax._id.charAt(0) === 'x') { - if(!counterAx) return gs.t + gs.h * (1 - (ax.position || 0)) + (lwHalf % 1); - else if(side === 'top') return counterAx._offset - pad - lwHalf; - return counterAx._offset + counterAx._length + pad + lwHalf; + 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'); - if(!counterAx) return gs.l + gs.w * (ax.position || 0) + (lwHalf % 1); - else if(side === 'right') return counterAx._offset + counterAx._length + pad + lwHalf; - return counterAx._offset - pad - lwHalf; } - // some preparation of axis position info - for(i = 0; i < axList.length; i++) { - var ax = axList[i]; + var hoverText = coerce('hovertext'); + var globalHoverLabel = fullLayout.hoverlabel || {}; - // reset scale in case the margins have changed - ax.setScale(); + if(hoverText) { + var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || + (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) + ); - var counterAx = ax._anchorAxis; + var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || + Color.contrast(hoverBG) + ); - // clear axis line positions, to be set in the subplot loop below - ax._linepositions = {}; + Lib.coerceFont(coerce, 'hoverlabel.font', { + family: globalHoverLabel.font.family, + size: globalHoverLabel.font.size, + color: globalHoverLabel.font.color || hoverBorder + }); + } - // stash crispRounded linewidth so we don't need to pass gd all over the place - ax._lw = Drawing.crispRound(gd, ax.linewidth, 1); + coerce('captureevents', !!hoverText); +}; - // figure out the main axis line and main mirror line position. - // it's easier to follow the logic if we handle these separately from - // ax._linepositions, which are only used by mirror=allticks - // for non-main-subplot ticks, and mirror=all(ticks)? for zero line - // hiding logic - ax._mainLinePosition = getLinePosition(ax, counterAx, ax.side); - ax._mainMirrorPosition = (ax.mirror && counterAx) ? - getLinePosition(ax, counterAx, - alignmentConstants.OPPOSITE_SIDE[ax.side]) : null; +},{"../../lib":159,"../color":43}],32:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // Figure out which subplot to draw ticks, labels, & axis lines on - // do this as a separate loop so we already have all the - // _mainAxis and _anchorAxis links set - ax._mainSubplot = findMainSubplot(ax, fullLayout); - } - // figure out which backgrounds we need to draw, - // and in which layers to put them - var lowerBackgroundIDs = []; - var backgroundIds = []; - var lowerDomains = []; - // no need to draw background when paper and plot color are the same color, - // activate mode just for large splom (which benefit the most from this - // optimization), but this could apply to all cartesian subplots. - var noNeedForBg = ( - Color.opacity(fullLayout.paper_bgcolor) === 1 && - Color.opacity(fullLayout.plot_bgcolor) === 1 && - fullLayout.paper_bgcolor === fullLayout.plot_bgcolor - ); +'use strict'; - for(subplot in fullLayout._plots) { - plotinfo = fullLayout._plots[subplot]; +var isNumeric = _dereq_('fast-isnumeric'); +var toLogRange = _dereq_('../../lib/to_log_range'); - if(plotinfo.mainplot) { - // mainplot is a reference to the main plot this one is overlaid on - // so if it exists, this is an overlaid plot and we don't need to - // give it its own background - if(plotinfo.bg) { - plotinfo.bg.remove(); - } - plotinfo.bg = undefined; - } else { - var xDomain = plotinfo.xaxis.domain; - var yDomain = plotinfo.yaxis.domain; - var plotgroup = plotinfo.plotgroup; +/* + * convertCoords: when converting an axis between log and linear + * you need to alter any annotations on that axis to keep them + * pointing at the same data point. + * In v2.0 this will become obsolete + * + * gd: the plot div + * ax: the axis being changed + * newType: the type it's getting + * doExtra: function(attr, val) from inside relayout that sets the attribute. + * Use this to make the changes as it's aware if any other changes in the + * same relayout call should override this conversion. + */ +module.exports = function convertCoords(gd, ax, newType, doExtra) { + ax = ax || {}; - if(overlappingDomain(xDomain, yDomain, lowerDomains)) { - 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 toLog = (newType === 'log') && (ax.type === 'linear'); + var fromLog = (newType === 'linear') && (ax.type === 'log'); - // now create all the lower-layer backgrounds at once now that - // we have the list of subplots that need them - var lowerBackgrounds = fullLayout._bgLayer.selectAll('.bg') - .data(lowerBackgroundIDs); + if(!(toLog || fromLog)) return; - lowerBackgrounds.enter().append('rect') - .classed('bg', true); + var annotations = gd._fullLayout.annotations; + var axLetter = ax._id.charAt(0); + var ann; + var attrPrefix; - lowerBackgrounds.exit().remove(); + function convert(attr) { + var currentVal = ann[attr]; + var newVal = null; - lowerBackgrounds.each(function(subplot) { - fullLayout._plots[subplot].bg = d3.select(this); - }); + if(toLog) newVal = toLogRange(currentVal, ax.range); + else newVal = Math.pow(10, currentVal); - // style all backgrounds - for(i = 0; i < backgroundIds.length; i++) { - plotinfo = fullLayout._plots[backgroundIds[i]]; - xa = plotinfo.xaxis; - ya = plotinfo.yaxis; + // if conversion failed, delete the value so it gets a default value + if(!isNumeric(newVal)) newVal = null; - if(plotinfo.bg) { - plotinfo.bg - .call(Drawing.setRect, - xa._offset - pad, ya._offset - pad, - xa._length + 2 * pad, ya._length + 2 * pad) - .call(Color.fill, fullLayout.plot_bgcolor) - .style('stroke-width', 0); - } + doExtra(attrPrefix + attr, newVal); } - if(!fullLayout._hasOnlyLargeSploms) { - for(subplot in fullLayout._plots) { - plotinfo = fullLayout._plots[subplot]; - xa = plotinfo.xaxis; - ya = plotinfo.yaxis; - - // Clip so that data only shows up on the plot area. - 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'); - }); + for(var i = 0; i < annotations.length; i++) { + ann = annotations[i]; + attrPrefix = 'annotations[' + i + '].'; - plotinfo.clipRect = plotClip.select('rect').attr({ - width: xa._length, - height: ya._length - }); + if(ann[axLetter + 'ref'] === ax._id) convert(axLetter); + if(ann['a' + axLetter + 'ref'] === ax._id) convert('a' + axLetter); + } +}; - Drawing.setTranslate(plotinfo.plot, xa._offset, ya._offset); +},{"../../lib/to_log_range":182,"fast-isnumeric":10}],33:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var plotClipId; - var layerClipId; - if(plotinfo._hasClipOnAxisFalse) { - plotClipId = null; - layerClipId = clipId; - } else { - plotClipId = clipId; - layerClipId = null; - } +'use strict'; - Drawing.setClipUrl(plotinfo.plot, plotClipId); +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - // stash layer clipId value (null or same as clipId) - // to DRY up Drawing.setClipUrl calls on trace-module and trace layers - // downstream - plotinfo.layerClipId = layerClipId; - } - } +var handleAnnotationCommonDefaults = _dereq_('./common_defaults'); +var attributes = _dereq_('./attributes'); - 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; - } +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + handleArrayContainerDefaults(layoutIn, layoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults + }); +}; - function xLinePathFree(y) { - return 'M' + xa._offset + ',' + y + 'h' + xa._length; +function handleAnnotationDefaults(annIn, annOut, fullLayout) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); } - function yLinePath(x) { - return 'M' + x + ',' + yLinesYTop + 'V' + yLinesYBottom; - } + var visible = coerce('visible'); + var clickToShow = coerce('clicktoshow'); - function yLinePathFree(x) { - return 'M' + x + ',' + ya._offset + 'v' + ya._length; - } + if(!(visible || clickToShow)) return; - function mainPath(ax, pathFn, pathFnFree) { - if(!ax.showline || subplot !== ax._mainSubplot) return ''; - if(!ax._anchorAxis) return pathFnFree(ax._mainLinePosition); - var out = pathFn(ax._mainLinePosition); - if(ax.mirror) out += pathFn(ax._mainMirrorPosition); - return out; - } + handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); - for(subplot in fullLayout._plots) { - plotinfo = fullLayout._plots[subplot]; - xa = plotinfo.xaxis; - ya = plotinfo.yaxis; + var showArrow = annOut.showarrow; - /* - * x lines get longer where they meet y lines, to make a crisp corner. - * The x lines get the padding (margin.pad) plus the y line width to - * fill up the corner nicely. Free x lines are excluded - they always - * span exactly the data area of the plot - * - * | XXXXX - * | XXXXX - * | - * +------ - * x1 - * ----- - * x2 - */ - var xPath = 'M0,0'; - if(shouldShowLinesOrTicks(xa, subplot)) { - leftYLineWidth = findCounterAxisLineWidth(xa, 'left', ya, axList); - xLinesXLeft = xa._offset - (leftYLineWidth ? (pad + leftYLineWidth) : 0); - rightYLineWidth = findCounterAxisLineWidth(xa, 'right', ya, axList); - xLinesXRight = xa._offset + xa._length + (rightYLineWidth ? (pad + rightYLineWidth) : 0); - xLinesYBottom = getLinePosition(xa, ya, 'bottom'); - xLinesYTop = getLinePosition(xa, ya, 'top'); + // positioning + var axLetters = ['x', 'y']; + var arrowPosDflt = [-10, -30]; + var gdMock = {_fullLayout: fullLayout}; - // save axis line positions for extra ticks to reference - // each subplot that gets ticks from "allticks" gets an entry: - // [left or bottom, right or top] - extraSubplot = (!xa._anchorAxis || subplot !== xa._mainSubplot); - if(extraSubplot && (xa.mirror === 'allticks' || xa.mirror === 'all')) { - xa._linepositions[subplot] = [xLinesYBottom, xLinesYTop]; - } + for(var i = 0; i < 2; i++) { + var axLetter = axLetters[i]; - xPath = mainPath(xa, xLinePath, xLinePathFree); - if(extraSubplot && xa.showline && (xa.mirror === 'all' || xa.mirror === 'allticks')) { - xPath += xLinePath(xLinesYBottom) + xLinePath(xLinesYTop); - } + // xref, yref + var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper'); - plotinfo.xlines - .style('stroke-width', xa._lw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); + if(axRef !== 'paper') { + var ax = Axes.getFromId(gdMock, axRef); + ax._annIndices.push(annOut._index); } - plotinfo.xlines.attr('d', xPath); - /* - * y lines that meet x axes get longer only by margin.pad, because - * the x axes fill in the corner space. Free y axes, like free x axes, - * always span exactly the data area of the plot - * - * | | XXXX - * y2| y1| XXXX - * | | XXXX - * | - * +----- - */ - var yPath = 'M0,0'; - if(shouldShowLinesOrTicks(ya, subplot)) { - connectYBottom = findCounterAxisLineWidth(ya, 'bottom', xa, axList); - yLinesYBottom = ya._offset + ya._length + (connectYBottom ? pad : 0); - connectYTop = findCounterAxisLineWidth(ya, 'top', xa, axList); - yLinesYTop = ya._offset - (connectYTop ? pad : 0); - yLinesXLeft = getLinePosition(ya, xa, 'left'); - yLinesXRight = getLinePosition(ya, xa, 'right'); + // x, y + Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); - extraSubplot = (!ya._anchorAxis || subplot !== ya._mainSubplot); - if(extraSubplot && (ya.mirror === 'allticks' || ya.mirror === 'all')) { - ya._linepositions[subplot] = [yLinesXLeft, yLinesXRight]; - } + if(showArrow) { + var arrowPosAttr = 'a' + axLetter; + // axref, ayref + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); - yPath = mainPath(ya, yLinePath, yLinePathFree); - if(extraSubplot && ya.showline && (ya.mirror === 'all' || ya.mirror === 'allticks')) { - yPath += yLinePath(yLinesXLeft) + yLinePath(yLinesXRight); + // for now the arrow can only be on the same axis or specified as pixels + // TODO: sometime it might be interesting to allow it to be on *any* axis + // but that would require updates to drawing & autorange code and maybe more + if(aaxRef !== 'pixel' && aaxRef !== axRef) { + aaxRef = annOut[arrowPosAttr] = 'pixel'; } - plotinfo.ylines - .style('stroke-width', ya._lw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + // ax, ay + var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4; + Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } - plotinfo.ylines.attr('d', yPath); - } - - Axes.makeClipPaths(gd); - return gd._promises.length && Promise.all(gd._promises); -} + // xanchor, yanchor + coerce(axLetter + 'anchor'); -function findMainSubplot(ax, fullLayout) { - var subplotList = fullLayout._subplots; - var ids = subplotList.cartesian.concat(subplotList.gl2d || []); - var mockGd = {_fullLayout: fullLayout}; + // xshift, yshift + coerce(axLetter + 'shift'); + } - var isX = ax._id.charAt(0) === 'x'; - var anchorAx = ax._mainAxis._anchorAxis; - var mainSubplotID = ''; - var nextBestMainSubplotID = ''; - var anchorID = ''; + // if you have one coordinate you should have both + Lib.noneOrAll(annIn, annOut, ['x', 'y']); - // First try the main ID with the anchor - if(anchorAx) { - anchorID = anchorAx._mainAxis._id; - mainSubplotID = isX ? (ax._id + anchorID) : (anchorID + ax._id); + // if you have one part of arrow length you should have both + if(showArrow) { + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); } - // Then look for a subplot with the counteraxis overlaying the anchor - // If that fails just use the first subplot including this axis - if(!mainSubplotID || !fullLayout._plots[mainSubplotID]) { - mainSubplotID = ''; + if(clickToShow) { + var xClick = coerce('xclick'); + var yClick = coerce('yclick'); - for(var j = 0; j < ids.length; j++) { - var id = ids[j]; - var yIndex = id.indexOf('y'); - var idPart = isX ? id.substr(0, yIndex) : id.substr(yIndex); - var counterPart = isX ? id.substr(yIndex) : id.substr(0, yIndex); - - if(idPart === ax._id) { - if(!nextBestMainSubplotID) nextBestMainSubplotID = id; - var counterAx = Axes.getFromId(mockGd, counterPart); - if(anchorID && counterAx.overlaying === anchorID) { - mainSubplotID = id; - break; - } - } - } + // put the actual click data to bind to into private attributes + // so we don't have to do this little bit of logic on every hover event + annOut._xclick = (xClick === undefined) ? + annOut.x : + Axes.cleanPosition(xClick, gdMock, annOut.xref); + annOut._yclick = (yClick === undefined) ? + annOut.y : + Axes.cleanPosition(yClick, gdMock, annOut.yref); } - - return mainSubplotID || nextBestMainSubplotID; } -function shouldShowLinesOrTicks(ax, subplot) { - return (ax.ticks || ax.showline) && - (subplot === ax._mainSubplot || ax.mirror === 'all' || ax.mirror === 'allticks'); -} +},{"../../lib":159,"../../plots/array_container_defaults":199,"../../plots/cartesian/axes":203,"./attributes":28,"./common_defaults":31}],34:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -/* - * should we draw a line on counterAx at this side of ax? - * It's assumed that counterAx is known to overlay the subplot we're working on - * but it may not be its main axis. - */ -function shouldShowLineThisSide(ax, side, counterAx) { - // does counterAx get a line at all? - if(!counterAx.showline || !counterAx._lw) return false; +'use strict'; - // are we drawing *all* lines for counterAx? - if(counterAx.mirror === 'all' || counterAx.mirror === 'allticks') return true; +var d3 = _dereq_('d3'); - var anchorAx = counterAx._anchorAxis; +var Registry = _dereq_('../../registry'); +var Plots = _dereq_('../../plots/plots'); +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var Color = _dereq_('../color'); +var Drawing = _dereq_('../drawing'); +var Fx = _dereq_('../fx'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var setCursor = _dereq_('../../lib/setcursor'); +var dragElement = _dereq_('../dragelement'); +var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - // is this a free axis? free axes can only have a subplot side-line with all(ticks)? mirroring - if(!anchorAx) return false; +var drawArrowHead = _dereq_('./draw_arrow_head'); - // in order to handle cases where the user forgot to anchor this axis correctly - // (because its default anchor has the same domain on the relevant end) - // check whether the relevant position is the same. - 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]; -} +// Annotations are stored in gd.layout.annotations, an array of objects +// index can point to one item in this array, +// or non-numeric to simply add a new one +// or -1 to modify all existing +// opt can be the full options object, or one key (to be set to value) +// or undefined to simply redraw +// if opt is blank, val can be 'add' or a full options object to add a new +// annotation at that point in the array, or 'remove' to delete this one + +module.exports = { + draw: draw, + drawOne: drawOne, + drawRaw: drawRaw +}; /* - * Is there another axis intersecting `side` end of `ax`? - * First look at `counterAx` (the axis for this subplot), - * then at all other potential counteraxes on or overlaying this subplot. - * Take the line width from the first one that has a line. + * draw: draw all annotations without any new modifications */ -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; +function draw(gd) { + var fullLayout = gd._fullLayout; + + fullLayout._infolayer.selectAll('.annotation').remove(); + + for(var i = 0; i < fullLayout.annotations.length; i++) { + if(fullLayout.annotations[i].visible) { + drawOne(gd, i); } } - return 0; + + return Plots.previousPromises(gd); } -exports.drawMainTitle = function(gd) { +/* + * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications + * + * index (int): the annotation to draw + */ +function drawOne(gd, index) { var fullLayout = gd._fullLayout; + var options = fullLayout.annotations[index] || {}; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); - Titles.draw(gd, 'gtitle', { - propContainer: fullLayout, - propName: 'title', - placeholder: fullLayout._dfltTitle.plot, - attributes: { - x: fullLayout.width / 2, - y: fullLayout._size.t / 2, - 'text-anchor': 'middle' - } - }); -}; - -exports.doTraceStyle = function(gd) { - var calcdata = gd.calcdata; - var editStyleCalls = []; - var i; + if(xa) xa.setScale(); + if(ya) ya.setScale(); - for(i = 0; i < calcdata.length; i++) { - var cd = calcdata[i]; - var cd0 = cd[0] || {}; - var trace = cd0.trace || {}; - var _module = trace._module || {}; + drawRaw(gd, options, index, false, xa, ya); +} - // See if we need to do arraysToCalcdata - // call it regardless of what change we made, in case - // supplyDefaults brought in an array that was already - // in gd.data but not in gd._fullData previously - var arraysToCalcdata = _module.arraysToCalcdata; - if(arraysToCalcdata) arraysToCalcdata(cd, trace); +/** + * drawRaw: draw a single annotation, potentially with modifications + * + * @param {DOM element} gd + * @param {object} options : this annotation's fullLayout options + * @param {integer} index : index in 'annotations' container of the annotation to draw + * @param {string} subplotId : id of the annotation's subplot + * - use false for 2d (i.e. cartesian or paper-ref) annotations + * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px + * @param {object | undefined} ya : ... y-axis + */ +function drawRaw(gd, options, index, subplotId, xa, ya) { + var fullLayout = gd._fullLayout; + var gs = gd._fullLayout._size; + var edits = gd._context.edits; - var editStyle = _module.editStyle; - if(editStyle) editStyleCalls.push({fn: editStyle, cd0: cd0}); - } + var className, containerStr; - if(editStyleCalls.length) { - for(i = 0; i < editStyleCalls.length; i++) { - var edit = editStyleCalls[i]; - edit.fn(gd, edit.cd0); - } - clearGlCanvases(gd); - exports.redrawReglTraces(gd); + if(subplotId) { + className = 'annotation-' + subplotId; + containerStr = subplotId + '.annotations'; + } else { + className = 'annotation'; + containerStr = 'annotations'; } - Plots.style(gd); - Registry.getComponentMethod('legend', 'draw')(gd); - - return Plots.previousPromises(gd); -}; + var editHelpers = arrayEditor(gd.layout, containerStr, options); + var modifyBase = editHelpers.modifyBase; + var modifyItem = editHelpers.modifyItem; + var getUpdateObj = editHelpers.getUpdateObj; -exports.doColorBars = function(gd) { - for(var i = 0; i < gd.calcdata.length; i++) { - var cdi0 = gd.calcdata[i][0]; + // remove the existing annotation if there is one + fullLayout._infolayer + .selectAll('.' + className + '[data-index="' + index + '"]') + .remove(); - if((cdi0.t || {}).cb) { - var trace = cdi0.trace, - cb = cdi0.t.cb; + var annClipID = 'clip' + fullLayout._uid + '_ann' + index; - if(Registry.traceIs(trace, 'contour')) { - cb.line({ - width: trace.contours.showlines !== false ? - trace.line.width : 0, - dash: trace.line.dash, - color: trace.contours.coloring === 'line' ? - cb._opts.line.color : trace.line.color - }); - } - var moduleOpts = trace._module.colorbar; - var containerName = moduleOpts.container; - var opts = (containerName ? trace[containerName] : trace).colorbar; - cb.options(opts)(); - } + // this annotation is gone - quit now after deleting it + // TODO: use d3 idioms instead of deleting and redrawing every time + if(!options._input || options.visible === false) { + d3.selectAll('#' + annClipID).remove(); + return; } - return Plots.previousPromises(gd); -}; - -// force plot() to redo the layout and replot with the modified layout -exports.layoutReplot = function(gd) { - var layout = gd.layout; - gd.layout = undefined; - return Registry.call('plot', gd, '', layout); -}; + // calculated pixel positions + // x & y each will get text, head, and tail as appropriate + var annPosPx = {x: {}, y: {}}; + var textangle = +options.textangle || 0; -exports.doLegend = function(gd) { - Registry.getComponentMethod('legend', 'draw')(gd); - return Plots.previousPromises(gd); -}; + // create the components + // made a single group to contain all, so opacity can work right + // with border/arrow together this could handle a whole bunch of + // cleanup at this point, but works for now + var annGroup = fullLayout._infolayer.append('g') + .classed(className, true) + .attr('data-index', String(index)) + .style('opacity', options.opacity); -exports.doTicksRelayout = function(gd) { - Axes.doTicks(gd, 'redraw'); + // another group for text+background so that they can rotate together + var annTextGroup = annGroup.append('g') + .classed('annotation-text-g', true); - if(gd._fullLayout._hasOnlyLargeSploms) { - Registry.subplotsRegistry.splom.updateGrid(gd); - clearGlCanvases(gd); - exports.redrawReglTraces(gd); - } + var editTextPosition = edits[options.showarrow ? 'annotationTail' : 'annotationPosition']; + var textEvents = options.captureevents || edits.annotationText || editTextPosition; - exports.drawMainTitle(gd); - return Plots.previousPromises(gd); -}; + var annTextGroupInner = annTextGroup.append('g') + .style('pointer-events', textEvents ? 'all' : null) + .call(setCursor, 'pointer') + .on('click', function() { + gd._dragging = false; -exports.doModeBar = function(gd) { - var fullLayout = gd._fullLayout; + var eventData = { + index: index, + annotation: options._input, + fullAnnotation: options, + event: d3.event + }; - ModeBar.manage(gd); + if(subplotId) { + eventData.subplotId = subplotId; + } - for(var i = 0; i < fullLayout._basePlotModules.length; i++) { - var updateFx = fullLayout._basePlotModules[i].updateFx; - if(updateFx) updateFx(gd); - } + gd.emit('plotly_clickannotation', eventData); + }); - return Plots.previousPromises(gd); -}; + if(options.hovertext) { + annTextGroupInner + .on('mouseover', function() { + var hoverOptions = options.hoverlabel; + var hoverFont = hoverOptions.font; + var bBox = this.getBoundingClientRect(); + var bBoxRef = gd.getBoundingClientRect(); -exports.doCamera = function(gd) { - var fullLayout = gd._fullLayout; - var sceneIds = fullLayout._subplots.gl3d; + 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 + }, { + container: fullLayout._hoverlayer.node(), + outerContainer: fullLayout._paper.node(), + gd: gd + }); + }) + .on('mouseout', function() { + Fx.loneUnhover(fullLayout._hoverlayer.node()); + }); + } - for(var i = 0; i < sceneIds.length; i++) { - var sceneLayout = fullLayout[sceneIds[i]]; - var scene = sceneLayout._scene; + var borderwidth = options.borderwidth; + var borderpad = options.borderpad; + var borderfull = borderwidth + borderpad; - scene.setCamera(sceneLayout.camera); - } -}; + var annTextBG = annTextGroupInner.append('rect') + .attr('class', 'bg') + .style('stroke-width', borderwidth + 'px') + .call(Color.stroke, options.bordercolor) + .call(Color.fill, options.bgcolor); -exports.drawData = function(gd) { - var fullLayout = gd._fullLayout; - var calcdata = gd.calcdata; - var i; + var isSizeConstrained = options.width || options.height; - // remove old colorbars explicitly - for(i = 0; i < calcdata.length; i++) { - var trace = calcdata[i][0].trace; - if(trace.visible !== true || !trace._module.colorbar) { - fullLayout._infolayer.select('.cb' + trace.uid).remove(); - } - } + var annTextClip = fullLayout._topclips + .selectAll('#' + annClipID) + .data(isSizeConstrained ? [0] : []); - clearGlCanvases(gd); + annTextClip.enter().append('clipPath') + .classed('annclip', true) + .attr('id', annClipID) + .append('rect'); + annTextClip.exit().remove(); - // loop over the base plot modules present on graph - var basePlotModules = fullLayout._basePlotModules; - for(i = 0; i < basePlotModules.length; i++) { - basePlotModules[i].plot(gd); - } + var font = options.font; - exports.redrawReglTraces(gd); + var text = fullLayout.meta ? + Lib.templateString(options.text, {meta: fullLayout.meta}) : + options.text; - // styling separate from drawing - Plots.style(gd); + var annText = annTextGroupInner.append('text') + .classed('annotation-text', true) + .text(text); - // show annotations and shapes - Registry.getComponentMethod('shapes', 'draw')(gd); - Registry.getComponentMethod('annotations', 'draw')(gd); + function textLayout(s) { + s.call(Drawing.font, font) + .attr({ + 'text-anchor': { + left: 'start', + right: 'end' + }[options.align] || 'middle' + }); - // Mark the first render as complete - fullLayout._replotting = false; + svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); + return s; + } - return Plots.previousPromises(gd); -}; + function drawGraphicalElements() { + // if the text has *only* a link, make the whole box into a link + 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'}); -// Draw (or redraw) all regl-based traces in one go, -// useful during drag and selection where buffers of targeted traces are updated, -// but all traces need to be redrawn following clearGlCanvases. -// -// Note that _module.plot for regl trace does NOT draw things -// on the canvas, they only update the buffers. -// Drawing is perform here. -// -// TODO try adding per-subplot option using gl.SCISSOR_TEST for -// non-overlaying, disjoint subplots. -// -// TODO try to include parcoords in here. -// https://github.com/plotly/plotly.js/issues/3069 -exports.redrawReglTraces = function(gd) { - var fullLayout = gd._fullLayout; + wholeLink.node().appendChild(annTextBG.node()); + } - if(fullLayout._has('regl')) { - var fullData = gd._fullData; - var cartesianIds = []; - var polarIds = []; - var i, sp; + 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); - if(fullLayout._hasOnlyLargeSploms) { - fullLayout._splomGrid.draw(); + function shiftFraction(v, anchor) { + if(anchor === 'auto') { + if(v < 1 / 3) anchor = 'left'; + else if(v > 2 / 3) anchor = 'right'; + else anchor = 'center'; + } + return { + center: 0, + middle: 0, + left: 0.5, + bottom: -0.5, + right: -0.5, + top: 0.5 + }[anchor]; } - // N.B. - // - Loop over fullData (not _splomScenes) to preserve splom trace-to-trace ordering - // - Fill list if subplot ids (instead of fullLayout._subplots) to handle cases where all traces - // of a given module are `visible !== true` - for(i = 0; i < fullData.length; i++) { - var trace = fullData[i]; + 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: xa, y: ya}[axLetter]; + var dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180; + // note that these two can be either positive or negative + var annSizeFromWidth = outerWidth * Math.cos(dimAngle); + var annSizeFromHeight = outerHeight * Math.sin(dimAngle); + // but this one is the positive total size + 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; - if(trace.visible === true) { - 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); + /* + * calculate the *primary* pixel position + * which is the arrowhead if there is one, + * otherwise the text anchor point + */ + if(ax) { + // check if annotation is off screen, to bypass DOM manipulations + 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 { + if(axLetter === 'x') { + alignPosition = options[axLetter]; + basePx = gs.l + gs.w * alignPosition; + } + else { + alignPosition = 1 - options[axLetter]; + basePx = gs.t + gs.h * alignPosition; + } + autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } - } - for(i = 0; i < cartesianIds.length; i++) { - sp = fullLayout._plots[cartesianIds[i]]; - if(sp._scene) sp._scene.draw(); - } + // now translate this into pixel positions of head, tail, and text + // as well as paddings for autorange + if(options.showarrow) { + posPx.head = basePx; - for(i = 0; i < polarIds.length; i++) { - sp = fullLayout[polarIds[i]]._subplot; - if(sp._scene) sp._scene.draw(); - } - } -}; + var arrowLength = options['a' + axLetter]; -exports.doAutoRangeAndConstraints = function(gd) { - var axList = Axes.list(gd, '', true); + // with an arrow, the text rotates around the anchor point + textShift = annSizeFromWidth * shiftFraction(0.5, options.xanchor) - + annSizeFromHeight * shiftFraction(0.5, options.yanchor); - for(var i = 0; i < axList.length; i++) { - var ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - } + if(tailRef === axRef) { + posPx.tail = ax._offset + ax.r2p(arrowLength); + // tail is data-referenced: autorange pads the text in px from the tail + textPadShift = textShift; + } + else { + posPx.tail = basePx + arrowLength; + // tail is specified in px from head, so autorange also pads vs head + textPadShift = textShift + arrowLength; + } - enforceAxisConstraints(gd); -}; + posPx.text = posPx.tail + textShift; -// An initial paint must be completed before these components can be -// correctly sized and the whole plot re-margined. fullLayout._replotting must -// be set to false before these will work properly. -exports.finalDraw = function(gd) { - Registry.getComponentMethod('shapes', 'draw')(gd); - Registry.getComponentMethod('images', 'draw')(gd); - Registry.getComponentMethod('annotations', 'draw')(gd); - // TODO: rangesliders really belong in marginPushers but they need to be - // drawn after data - can we at least get the margin pushing part separated - // out and done earlier? - Registry.getComponentMethod('rangeslider', 'draw')(gd); - // TODO: rangeselector only needs to be here (in addition to drawMarginPushers) - // because the margins need to be fully determined before we can call - // autorange and update axis ranges (which rangeselector needs to know which - // button is active). Can we break out its automargin step from its draw step? - Registry.getComponentMethod('rangeselector', 'draw')(gd); -}; + // constrain pixel/paper referenced so the draggers are at least + // partially visible + 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; + } + } -exports.drawMarginPushers = function(gd) { - Registry.getComponentMethod('legend', 'draw')(gd); - Registry.getComponentMethod('rangeselector', 'draw')(gd); - Registry.getComponentMethod('sliders', 'draw')(gd); - Registry.getComponentMethod('updatemenus', 'draw')(gd); -}; + posPx.tail += overallShift; + posPx.head += overallShift; + } + else { + // with no arrow, the text rotates and *then* we put the anchor + // relative to the new bounding box + textShift = annSize * shiftFraction(autoAlignFraction, anchor); + textPadShift = textShift; + posPx.text = basePx + textShift; + } -},{"../components/color":570,"../components/drawing":595,"../components/modebar":633,"../components/titles":661,"../constants/alignment":668,"../lib":696,"../lib/clear_gl_canvases":680,"../plots/cartesian/autorange":743,"../plots/cartesian/axes":744,"../plots/cartesian/constraints":752,"../plots/plots":808,"../registry":827,"d3":148}],736:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + posPx.text += overallShift; + textShift += overallShift; + textPadShift += overallShift; + // padplus/minus are used by autorange + options['_' + axLetter + 'padplus'] = (annSize / 2) + textPadShift; + options['_' + axLetter + 'padminus'] = (annSize / 2) - textPadShift; -'use strict'; + // size/shift are used during dragging + options['_' + axLetter + 'size'] = annSize; + options['_' + axLetter + 'shift'] = textShift; + } -var Lib = _dereq_('../lib'); -var isPlainObject = Lib.isPlainObject; -var PlotSchema = _dereq_('./plot_schema'); -var Plots = _dereq_('../plots/plots'); -var plotAttributes = _dereq_('../plots/attributes'); -var Template = _dereq_('./plot_template'); -var dfltConfig = _dereq_('./plot_config'); + // We have everything we need for calcAutorange at this point, + // we can safely exit - unless we're currently dragging the plot + if(!gd._dragging && annotationIsOffscreen) { + annTextGroupInner.remove(); + return; + } -/** - * Plotly.makeTemplate: create a template off an existing figure to reuse - * style attributes on other figures. - * - * Note: separated from the rest of templates because otherwise we get circular - * references due to PlotSchema. - * - * @param {object|DOM element} figure: The figure to base the template on - * should contain a trace array `figure.data` - * and a layout object `figure.layout` - * @returns {object} template: the extracted template - can then be used as - * `layout.template` in another figure. - */ -exports.makeTemplate = function(figure) { - figure = Lib.extendDeep({_context: dfltConfig}, {data: figure.data, layout: figure.layout}); - Plots.supplyDefaults(figure); - var data = figure.data || []; - var layout = figure.layout || {}; - // copy over a few items to help follow the schema - layout._basePlotModules = figure._fullLayout._basePlotModules; - layout._modules = figure._fullLayout._modules; + var xShift = 0; + var yShift = 0; - var template = { - data: {}, - layout: {} - }; + 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); + } - /* - * Note: we do NOT validate template values, we just take what's in the - * user inputs data and layout, not the validated values in fullData and - * fullLayout. Even if we were to validate here, there's no guarantee that - * these values would still be valid when applied to a new figure, which - * may contain different trace modes, different axes, etc. So it's - * important that when applying a template we still validate the template - * values, rather than just using them as defaults. - */ + if(hasMathjax) { + mathjaxGroup.select('svg').attr({ + x: borderfull + xShift - 1, + y: borderfull + yShift + }) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null, gd); + } + else { + var texty = borderfull + yShift - anntextBB.top; + var textx = borderfull + xShift - anntextBB.left; - data.forEach(function(trace) { - // TODO: What if no style info is extracted for this trace. We may - // not want an empty object as the null value. - // TODO: allow transforms to contribute to templates? - // as it stands they are ignored, which may be for the best... + annText.call(svgTextUtils.positionText, textx, texty) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null, gd); + } - var traceTemplate = {}; - walkStyleKeys(trace, traceTemplate, getTraceInfo.bind(null, trace)); + annTextClip.select('rect').call(Drawing.setRect, borderfull, borderfull, + annWidth, annHeight); - var traceType = Lib.coerce(trace, {}, plotAttributes, 'type'); - var typeTemplates = template.data[traceType]; - if(!typeTemplates) typeTemplates = template.data[traceType] = []; - typeTemplates.push(traceTemplate); - }); + annTextBG.call(Drawing.setRect, borderwidth / 2, borderwidth / 2, + outerWidth - borderwidth, outerHeight - borderwidth); - walkStyleKeys(layout, template.layout, getLayoutInfo.bind(null, layout)); + annTextGroupInner.call(Drawing.setTranslate, + Math.round(annPosPx.x.text - outerWidth / 2), + Math.round(annPosPx.y.text - outerHeight / 2)); - /* - * Compose the new template with an existing one to the same effect - * - * NOTE: there's a possibility of slightly different behavior: if the plot - * has an invalid value and the old template has a valid value for the same - * attribute, the plot will use the old template value but this routine - * will pull the invalid value (resulting in the original default). - * In the general case it's not possible to solve this with a single value, - * since valid options can be context-dependent. It could be solved with - * a *list* of values, but that would be huge complexity for little gain. - */ - delete template.layout.template; - var oldTemplate = layout.template; - if(isPlainObject(oldTemplate)) { - var oldLayoutTemplate = oldTemplate.layout; + /* + * rotate text and background + * we already calculated the text center position *as rotated* + * because we needed that for autoranging anyway, so now whether + * we have an arrow or not, we rotate about the text center. + */ + annTextGroup.attr({transform: 'rotate(' + textangle + ',' + + annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - var i, traceType, oldTypeTemplates, oldTypeLen, typeTemplates, typeLen; + /* + * add the arrow + * uses options[arrowwidth,arrowcolor,arrowhead] for styling + * dx and dy are normally zero, but when you are dragging the textbox + * while the head stays put, dx and dy are the pixel offsets + */ + var drawArrow = function(dx, dy) { + annGroup + .selectAll('.annotation-arrow-g') + .remove(); - 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]); - } - } - } - } + 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; + + // find the edge of the text box, where we'll start the arrow: + // create transform matrix to rotate the text box corners + var transform = Lib.rotationXYMatrix(textangle, textX, textY); + var applyTransform = Lib.apply2DTransform(transform); + var applyTransform2 = Lib.apply2DTransform2(transform); + + // calculate and transform bounding box + 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); - return template; -}; + // Remove the line if it ends inside the box. Use ray + // casting for rotated boxes: see which edges intersect a + // line from the arrowhead to far away and reduce with xor + // to get the parity of the number of intersections. + 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)) { + // no line or arrow - so quit drawArrow now + return; + } -function mergeTemplates(oldTemplate, newTemplate) { - // we don't care about speed here, just make sure we have a totally - // distinct object from the previous template - oldTemplate = Lib.extendDeep({}, oldTemplate); + 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; + } + }); - // sort keys so we always get annotationdefaults before annotations etc - // so arrayTemplater will work right - var oldKeys = Object.keys(oldTemplate).sort(); - var i, j; + var strokewidth = options.arrowwidth; + var arrowColor = options.arrowcolor; + var arrowSide = options.arrowside; - function mergeOne(oldVal, newVal, key) { - if(isPlainObject(newVal) && isPlainObject(oldVal)) { - mergeTemplates(oldVal, newVal); - } - else if(Array.isArray(newVal) && Array.isArray(oldVal)) { - // Note: omitted `inclusionAttr` from arrayTemplater here, - // it's irrelevant as we only want the resulting `_template`. - var templater = Template.arrayTemplater({_template: oldTemplate}, key); - 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); + var arrowGroup = annGroup.append('g') + .style({opacity: Color.opacity(arrowColor)}) + .classed('annotation-arrow-g', true); - // templateitemname only applies to receiving plots - for(j = 0; j < newVal.length; j++) delete newVal[j].templateitemname; - } - } + var arrow = arrowGroup.append('path') + .attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) + .style('stroke-width', strokewidth + 'px') + .call(Color.stroke, Color.rgb(arrowColor)); - 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; + drawArrowHead(arrow, arrowSide, options); - // if this is a base key from the old template (eg xaxis), look for - // extended keys (eg xaxis2) in the new template to merge into - 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); + // the arrow dragger is a small square right at the head, then a line to the tail, + // all expanded by a stroke width of 6px plus the arrow line width + if(edits.annotationPosition && arrow.node().parentNode && !subplotId) { + var arrowDragHeadX = headX; + var arrowDragHeadY = headY; + if(options.standoff) { + var arrowLength = Math.sqrt(Math.pow(headX - tailX, 2) + Math.pow(headY - tailY, 2)); + arrowDragHeadX += options.standoff * (tailX - headX) / arrowLength; + arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; } - } - } - } -} + 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: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + }) + .style('stroke-width', (strokewidth + 6) + 'px') + .call(Color.stroke, 'rgba(0,0,0,0)') + .call(Color.fill, 'rgba(0,0,0,0)'); -function getBaseKey(key) { - return key.replace(/[0-9]+$/, ''); -} + var annx0, anny0; -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); - } - } + // dragger for the arrow & head: translates the whole thing + // (head/tail/text) all together + dragElement.init({ + element: arrowDrag.node(), + gd: gd, + prepFn: function() { + var pos = Drawing.getTranslate(annTextGroupInner); - // we'll get an attr if path starts with a valid part, then has an - // invalid ending. Make sure we got all the way to the end. - if(pathAttr && (pathAttr === attr)) continue; + annx0 = pos.x; + anny0 = pos.y; + if(xa && xa.autorange) { + modifyBase(xa._name + '.autorange', true); + } + if(ya && ya.autorange) { + modifyBase(ya._name + '.autorange', true); + } + }, + moveFn: function(dx, dy) { + var annxy0 = applyTransform(annx0, anny0); + var xcenter = annxy0[0] + dx; + var ycenter = annxy0[1] + dy; + annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - if(!attr || attr._noTemplating || - attr.valType === 'data_array' || - (attr.arrayOk && Array.isArray(child)) - ) { - continue; - } + modifyItem('x', xa ? + xa.p2r(xa.r2p(options.x) + dx) : + (options.x + (dx / gs.w))); + modifyItem('y', ya ? + ya.p2r(ya.r2p(options.y) + dy) : + (options.y - (dy / gs.h))); - 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]) { - // named array items: allow all attributes except data arrays - walkStyleKeys(item, templateOut, getAttributeInfo, - getNextPath(child, namedIndex, nextPath), - getNextPath(child, namedIndex, nextBasePath)); - namedIndex++; - usedNames[name] = 1; + if(options.axref === options.xref) { + modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); } - } - else if(!dfltDone) { - var dfltKey = Template.arrayDefaultKey(key); - var dfltPath = getNextPath(parent, dfltKey, path); - // getAttributeInfo will fail if we try to use dfltKey directly. - // Instead put this item into the next array element, then - // pull it out and move it to dfltKey. - 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); + if(options.ayref === options.yref) { + modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + } - dfltDone = true; + arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + annTextGroup.attr({ + transform: 'rotate(' + textangle + ',' + + xcenter + ',' + ycenter + ')' + }); + }, + doneFn: function() { + Registry.call('_guiRelayout', gd, getUpdateObj()); + var notesBox = document.querySelector('.js-notes-box-panel'); + if(notesBox) notesBox.redraw(notesBox.selectedObj); } - } + }); } - } - else { - var templateProp = Lib.nestedProperty(templateOut, nextPath); - templateProp.set(child); - } - } -} + }; + + if(options.showarrow) drawArrow(0, 0); + + // user dragging the annotation (text, not arrow) + if(editTextPosition) { + var baseTextTransform; + + // dragger for the textbox: if there's an arrow, just drag the + // textbox and tail, leave the head untouched + dragElement.init({ + element: annTextGroupInner.node(), + gd: gd, + prepFn: function() { + baseTextTransform = annTextGroup.attr('transform'); + }, + moveFn: function(dx, dy) { + var csr = 'pointer'; + if(options.showarrow) { + if(options.axref === options.xref) { + modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + } else { + modifyItem('ax', options.ax + dx); + } -function getLayoutInfo(layout, path) { - return PlotSchema.getLayoutValObject( - layout, Lib.nestedProperty({}, path).parts - ); -} + if(options.ayref === options.yref) { + modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + } else { + modifyItem('ay', options.ay + dy); + } -function getTraceInfo(trace, path) { - return PlotSchema.getTraceValObject( - trace, Lib.nestedProperty({}, path).parts - ); -} + drawArrow(dx, dy); + } + else if(!subplotId) { + var xUpdate, yUpdate; + if(xa) { + xUpdate = xa.p2r(xa.r2p(options.x) + dx); -function getNextPath(parent, key, path) { - var nextPath; - if(!path) nextPath = key; - else if(Array.isArray(parent)) nextPath = path + '[' + key + ']'; - else nextPath = path + '.' + key; + } else { + var widthFraction = options._xsize / gs.w; + var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; - return nextPath; -} + xUpdate = dragElement.align(xLeft + dx / gs.w, + widthFraction, 0, 1, options.xanchor); + } -/** - * validateTemplate: Test for consistency between the given figure and - * a template, either already included in the figure or given separately. - * Note that not every issue we identify here is necessarily a problem, - * it depends on what you're using the template for. - * - * @param {object|DOM element} figure: the plot, with {data, layout} members, - * to test the template against - * @param {Optional(object)} template: the template, with its own {data, layout}, - * to test. If omitted, we will look for a template already attached as the - * plot's `layout.template` attribute. - * - * @returns {array} array of error objects each containing: - * - {string} code - * error code ('missing', 'unused', 'reused', 'noLayout', 'noData') - * - {string} msg - * a full readable description of the issue. - */ -exports.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 = []; + if(ya) { + yUpdate = ya.p2r(ya.r2p(options.y) + dy); + } else { + var heightFraction = options._ysize / gs.h; + var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; - figure.layout = layout; - figure.layout.template = template; - Plots.supplyDefaults(figure); + yUpdate = dragElement.align(yBottom - dy / gs.h, + heightFraction, 0, 1, options.yanchor); + } + modifyItem('x', xUpdate); + modifyItem('y', yUpdate); + if(!xa || !ya) { + csr = dragElement.getCursor( + xa ? 0.5 : xUpdate, + ya ? 0.5 : yUpdate, + options.xanchor, options.yanchor + ); + } + } + else return; - var fullLayout = figure._fullLayout; - var fullData = figure._fullData; + annTextGroup.attr({ + transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + }); - 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 i; - for(i = 0; i < paths.length; i++) { - nextPaths.push(getNextPath(obj, key, paths[i])); - if(baseKey !== key) nextPaths.push(getNextPath(obj, baseKey, paths[i])); - } - for(i = 0; i < nextPaths.length; i++) { - layoutPaths[nextPaths[i]] = 1; + setCursor(annTextGroupInner, csr); + }, + doneFn: function() { + setCursor(annTextGroupInner); + Registry.call('_guiRelayout', gd, getUpdateObj()); + var notesBox = document.querySelector('.js-notes-box-panel'); + if(notesBox) notesBox.redraw(notesBox.selectedObj); } - 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(edits.annotationText) { + annText.call(svgTextUtils.makeEditable, {delegate: annTextGroupInner, gd: gd}) + .call(textLayout) + .on('edit', function(_text) { + options.text = _text; - if(!isPlainObject(layoutTemplate)) { - errorList.push({code: 'layout'}); - } - else { - crawlLayoutForContainers(fullLayout, ['layout']); - crawlLayoutTemplateForContainers(layoutTemplate, 'layout'); - } + this.call(textLayout); - 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) { - // this takes care of the case of traceType in the data but not - // the template - errorList.push({ - code: 'missing', - index: fullTrace._fullInput.index, - traceType: traceType - }); - } - } - for(traceType in dataTemplate) { - var templateCount = dataTemplate[traceType].length; - var dataCount = typeCount[traceType] || 0; - if(templateCount > dataCount) { - errorList.push({ - code: 'unused', - traceType: traceType, - templateCount: templateCount, - dataCount: dataCount - }); - } - else if(dataCount > templateCount) { - errorList.push({ - code: 'reused', - traceType: traceType, - templateCount: templateCount, - dataCount: dataCount - }); - } - } - } + modifyItem('text', _text); - // _template: false is when someone tried to modify an array item - // but there was no template with matching name - 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 - }); + if(xa && xa.autorange) { + modifyBase(xa._name + '.autorange', true); + } + if(ya && ya.autorange) { + modifyBase(ya._name + '.autorange', true); } - crawlForMissingTemplates(val, nextPath); - } - else if(Array.isArray(val) && hasPlainObject(val)) { - crawlForMissingTemplates(val, nextPath); - } - } - } - crawlForMissingTemplates({data: fullData, layout: fullLayout}, ''); - - if(errorList.length) return errorList.map(format); -}; - -function hasPlainObject(arr) { - for(var i = 0; i < arr.length; i++) { - if(isPlainObject(arr[i])) return true; - } -} -function format(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; + Registry.call('_guiRelayout', gd, getUpdateObj()); + }); } - opts.msg = msg; - - return opts; + else annText.call(textLayout); } -},{"../lib":696,"../plots/attributes":741,"../plots/plots":808,"./plot_config":732,"./plot_schema":733,"./plot_template":734}],737:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../lib/setcursor":178,"../../lib/svg_text_utils":180,"../../plot_api/plot_template":193,"../../plots/cartesian/axes":203,"../../plots/plots":236,"../../registry":243,"../color":43,"../dragelement":61,"../drawing":64,"../fx":82,"./draw_arrow_head":35,"d3":8}],35:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; -var plotApi = _dereq_('./plot_api'); -var Lib = _dereq_('../lib'); +'use strict'; -var helpers = _dereq_('../snapshot/helpers'); -var toSVG = _dereq_('../snapshot/tosvg'); -var svgToImg = _dereq_('../snapshot/svgtoimg'); +var d3 = _dereq_('d3'); -var attrs = { - format: { - valType: 'enumerated', - values: ['png', 'jpeg', 'webp', 'svg'], - dflt: 'png', - - }, - width: { - valType: 'number', - min: 1, - - }, - height: { - valType: 'number', - min: 1, - - }, - scale: { - valType: 'number', - min: 0, - dflt: 1, - - }, - setBackground: { - valType: 'any', - dflt: false, - - }, - imageDataOnly: { - valType: 'boolean', - dflt: false, - - } -}; +var Color = _dereq_('../color'); -var IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; +var ARROWPATHS = _dereq_('./arrow_paths'); -/** Plotly.toImage +/** + * Add arrowhead(s) to a path or line element * - * @param {object | string | HTML div} gd - * can either be a data/layout/config object - * or an existing graph
- * or an id to an existing graph
- * @param {object} opts (see above) - * @return {promise} + * @param {d3.selection} el3: a d3-selected line or path element + * + * @param {string} ends: 'none', 'start', 'end', or 'start+end' for which ends get arrowheads + * + * @param {object} options: style information. Must have all the following: + * @param {number} options.arrowhead: end head style - see ./arrow_paths + * @param {number} options.startarrowhead: start head style - see ./arrow_paths + * @param {number} options.arrowsize: relative size of the end head vs line width + * @param {number} options.startarrowsize: relative size of the start head vs line width + * @param {number} options.standoff: distance in px to move the end arrow point from its target + * @param {number} options.startstandoff: distance in px to move the start arrow point from its target + * @param {number} options.arrowwidth: width of the arrow line + * @param {string} options.arrowcolor: color of the arrow line, for the head to match + * Note that the opacity of this color is ignored, as it's assumed the container + * of both the line and head has opacity applied to it so there isn't greater opacity + * where they overlap. */ -function toImage(gd, opts) { - opts = opts || {}; +module.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 data; - var layout; - var config; + var start, end, startRot, endRot; - if(Lib.isPlainObject(gd)) { - data = gd.data || []; - layout = gd.layout || {}; - config = gd.config || {}; - } else { - gd = Lib.getGraphDiv(gd); - data = Lib.extendDeep([], gd.data); - layout = Lib.extendDeep({}, gd.layout); - config = gd._context; - } + if(el.nodeName === 'line') { + start = {x: +el3.attr('x1'), y: +el3.attr('y1')}; + end = {x: +el3.attr('x2'), y: +el3.attr('y2')}; - function isImpliedOrValid(attr) { - return !(attr in opts) || Lib.validate(opts[attr], attrs[attr]); - } + var dx = start.x - end.x; + var dy = start.y - end.y; - if(!isImpliedOrValid('width') || !isImpliedOrValid('height')) { - throw new Error('Height and width should be pixel values.'); - } + startRot = Math.atan2(dy, dx); + endRot = startRot + Math.PI; + if(backOff && startBackOff) { + if(backOff + startBackOff > Math.sqrt(dx * dx + dy * dy)) { + hideLine(); + return; + } + } - if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); - } + if(backOff) { + if(backOff * backOff > dx * dx + dy * dy) { + hideLine(); + return; + } + var backOffX = backOff * Math.cos(startRot); + var backOffY = backOff * Math.sin(startRot); - var fullOpts = {}; + end.x += backOffX; + end.y += backOffY; + el3.attr({x2: end.x, y2: end.y}); - function coerce(attr, dflt) { - return Lib.coerce(opts, fullOpts, attrs, attr, dflt); - } + } - var format = coerce('format'); - var width = coerce('width'); - var height = coerce('height'); - var scale = coerce('scale'); - var setBackground = coerce('setBackground'); - var imageDataOnly = coerce('imageDataOnly'); + if(startBackOff) { + if(startBackOff * startBackOff > dx * dx + dy * dy) { + hideLine(); + return; + } + var startBackOffX = startBackOff * Math.cos(startRot); + var startbackOffY = startBackOff * Math.sin(startRot); - // put the cloned div somewhere off screen before attaching to DOM - var clonedGd = document.createElement('div'); - clonedGd.style.position = 'absolute'; - clonedGd.style.left = '-5000px'; - document.body.appendChild(clonedGd); + start.x -= startBackOffX; + start.y -= startbackOffY; + el3.attr({x1: start.x, y1: start.y}); - // extend layout with image options - var layoutImage = Lib.extendFlat({}, layout); - if(width) layoutImage.width = width; - if(height) layoutImage.height = height; + } + } + else if(el.nodeName === 'path') { + var pathlen = el.getTotalLength(); + // using dash to hide the backOff region of the path. + // if we ever allow dash for the arrow we'll have to + // do better than this hack... maybe just manually + // combine the two + var dashArray = ''; - // extend config for static plot - var configImage = Lib.extendFlat({}, config, { - staticPlot: true, - setBackground: setBackground - }); + if(pathlen < backOff + startBackOff) { + hideLine(); + return; + } - var redrawFunc = helpers.getRedrawFunc(clonedGd); - function wait() { - return new Promise(function(resolve) { - setTimeout(resolve, helpers.getDelay(clonedGd._fullLayout)); - }); - } + var start0 = el.getPointAtLength(0); + var dstart = el.getPointAtLength(0.1); - function convert() { - return new Promise(function(resolve, reject) { - var svg = toSVG(clonedGd, format, scale); - var width = clonedGd._fullLayout.width; - var height = clonedGd._fullLayout.height; + startRot = Math.atan2(start0.y - dstart.y, start0.x - dstart.x); + start = el.getPointAtLength(Math.min(startBackOff, pathlen)); - plotApi.purge(clonedGd); - document.body.removeChild(clonedGd); + dashArray = '0px,' + startBackOff + 'px,'; - if(format === 'svg') { - if(imageDataOnly) { - return resolve(svg); - } else { - return resolve('data:image/svg+xml,' + encodeURIComponent(svg)); - } - } + var end0 = el.getPointAtLength(pathlen); + var dend = el.getPointAtLength(pathlen - 0.1); - var canvas = document.createElement('canvas'); - canvas.id = Lib.randstr(); + endRot = Math.atan2(end0.y - dend.y, end0.x - dend.x); + end = el.getPointAtLength(Math.max(0, pathlen - backOff)); - svgToImg({ - format: format, - width: width, - height: height, - scale: scale, - canvas: canvas, - svg: svg, - // ask svgToImg to return a Promise - // rather than EventEmitter - // leave EventEmitter for backward - // compatibility - promise: true - }) - .then(resolve) - .catch(reject); - }); - } + var shortening = dashArray ? startBackOff + backOff : backOff; + dashArray += (pathlen - shortening) + 'px,' + pathlen + 'px'; - function urlToImageData(url) { - if(imageDataOnly) { - return url.replace(IMAGE_URL_PREFIX, ''); - } else { - return url; - } + el3.style('stroke-dasharray', dashArray); } - return new Promise(function(resolve, reject) { - plotApi.plot(clonedGd, data, layoutImage, configImage) - .then(redrawFunc) - .then(wait) - .then(convert) - .then(function(url) { resolve(urlToImageData(url)); }) - .catch(function(err) { reject(err); }); - }); -} + 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: + 'translate(' + p.x + ',' + p.y + ')' + + (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + + 'scale(' + arrowScale + ')' + }) + .style({ + fill: Color.rgb(options.arrowcolor), + 'stroke-width': 0 + }); + } -module.exports = toImage; + if(doStart) drawhead(startHeadStyle, start, startRot, startScale); + if(doEnd) drawhead(headStyle, end, endRot, scale); +}; -},{"../lib":696,"../snapshot/helpers":831,"../snapshot/svgtoimg":833,"../snapshot/tosvg":835,"./plot_api":731}],738:[function(_dereq_,module,exports){ +},{"../color":43,"./arrow_paths":27,"d3":8}],36:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../lib'); -var Plots = _dereq_('../plots/plots'); -var PlotSchema = _dereq_('./plot_schema'); -var dfltConfig = _dereq_('./plot_config'); - -var isPlainObject = Lib.isPlainObject; -var isArray = Array.isArray; -var isArrayOrTypedArray = Lib.isArrayOrTypedArray; -/** - * Validate a data array and layout object. - * - * @param {array} data - * @param {object} layout - * - * @return {array} array of error objects each containing: - * - {string} code - * error code ('object', 'array', 'schema', 'unused', 'invisible' or 'value') - * - {string} container - * container where the error occurs ('data' or 'layout') - * - {number} trace - * trace index of the 'data' container where the error occurs - * - {array} path - * nested path to the key that causes the error - * - {string} astr - * attribute string variant of 'path' compatible with Plotly.restyle and - * Plotly.relayout. - * - {string} msg - * error message (shown in console in logger config argument is enable) - */ -module.exports = function validate(data, layout) { - var schema = PlotSchema.get(); - var errorList = []; - var gd = {_context: Lib.extendFlat({}, dfltConfig)}; +'use strict'; - var dataIn, layoutIn; +var drawModule = _dereq_('./draw'); +var clickModule = _dereq_('./click'); - if(isArray(data)) { - gd.data = Lib.extendDeep([], data); - dataIn = data; - } - else { - gd.data = []; - dataIn = []; - errorList.push(format('array', 'data')); - } +module.exports = { + moduleType: 'component', + name: 'annotations', - if(isPlainObject(layout)) { - gd.layout = Lib.extendDeep({}, layout); - layoutIn = layout; - } - else { - gd.layout = {}; - layoutIn = {}; - if(arguments.length > 1) { - errorList.push(format('object', 'layout')); - } - } + layoutAttributes: _dereq_('./attributes'), + supplyLayoutDefaults: _dereq_('./defaults'), + includeBasePlot: _dereq_('../../plots/cartesian/include_components')('annotations'), - // N.B. dataIn and layoutIn are in general not the same as - // gd.data and gd.layout after supplyDefaults as some attributes - // in gd.data and gd.layout (still) get mutated during this step. + calcAutorange: _dereq_('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, - Plots.supplyDefaults(gd); + hasClickToShow: clickModule.hasClickToShow, + onClick: clickModule.onClick, - var dataOut = gd._fullData, - len = dataIn.length; + convertCoords: _dereq_('./convert_coords') +}; - for(var i = 0; i < len; i++) { - var traceIn = dataIn[i], - base = ['data', i]; +},{"../../plots/cartesian/include_components":214,"./attributes":28,"./calc_autorange":29,"./click":30,"./convert_coords":32,"./defaults":33,"./draw":34}],37:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(!isPlainObject(traceIn)) { - errorList.push(format('object', base)); - continue; - } - var traceOut = dataOut[i], - traceType = traceOut.type, - traceSchema = schema.traces[traceType].attributes; +'use strict'; - // PlotSchema does something fancy with trace 'type', reset it here - // to make the trace schema compatible with Lib.validate. - traceSchema.type = { - valType: 'enumerated', - values: [traceType] - }; +var annAtts = _dereq_('../annotations/attributes'); +var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - if(traceOut.visible === false && traceIn.visible !== false) { - errorList.push(format('invisible', base)); - } +module.exports = overrideAll(templatedArray('annotation', { + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, - crawl(traceIn, traceOut, traceSchema, errorList, base); + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, - var transformsIn = traceIn.transforms, - transformsOut = traceOut.transforms; + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + startarrowhead: annAtts.startarrowhead, + arrowside: annAtts.arrowside, + arrowsize: annAtts.arrowsize, + startarrowsize: annAtts.startarrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + startstandoff: annAtts.startstandoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents, - if(transformsIn) { - if(!isArray(transformsIn)) { - errorList.push(format('array', base, ['transforms'])); - } + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, - base.push('transforms'); + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}), 'calc', 'from-root'); - for(var j = 0; j < transformsIn.length; j++) { - var path = ['transforms', j], - transformType = transformsIn[j].type; +},{"../../plot_api/edit_types":186,"../../plot_api/plot_template":193,"../annotations/attributes":28}],38:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(!isPlainObject(transformsIn[j])) { - errorList.push(format('object', base, path)); - continue; - } +'use strict'; - var transformSchema = schema.transforms[transformType] ? - schema.transforms[transformType].attributes : - {}; +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); - // add 'type' to transform schema to validate the transform type - transformSchema.type = { - valType: 'enumerated', - values: Object.keys(schema.transforms) - }; +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; - crawl(transformsIn[j], transformsOut[j], transformSchema, errorList, base, path); - } - } + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); } - var layoutOut = gd._fullLayout, - layoutSchema = fillLayoutSchema(schema, dataOut); - - crawl(layoutIn, layoutOut, layoutSchema, errorList, 'layout'); - - // return undefined if no validation errors were found - return (errorList.length === 0) ? void(0) : errorList; + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); }; -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]; +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; - // transforms are handled separately - if(k === 'transforms') continue; + var base = { + // this gets fill in on render + pdata: null, - var p = path.slice(); - p.push(k); + // to get setConvert to not execute cleanly + type: 'linear', - var valIn = objIn[k], - valOut = objOut[k]; + // don't try to update them on `editable: true` + autorange: false, - var nestedSchema = getNestedSchema(schema, k); - var isInfoArray = (nestedSchema || {}).valType === 'info_array'; - var isColorscale = (nestedSchema || {}).valType === 'colorscale'; - var items = (nestedSchema || {}).items; + // 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] + }; - if(!isInSchema(schema, k)) { - list.push(format('schema', base, p)); - } - else if(isPlainObject(valIn) && isPlainObject(valOut)) { - crawl(valIn, valOut, nestedSchema, list, base, p); - } - else if(isInfoArray && isArray(valIn)) { - if(valIn.length > valOut.length) { - list.push(format('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(format('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(format('value', base, p.concat(n, m), valInPart)); - } - else if(valOutPart !== valInPart && valOutPart !== +valInPart) { - list.push(format('dynamic', base, p.concat(n, m), valInPart, valOutPart)); - } - } - } - else { - list.push(format('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(format('value', base, p.concat(n), valInPart)); - } - else if(valOutPart !== valInPart && valOutPart !== +valInPart) { - list.push(format('dynamic', base, p.concat(n), valInPart, valOutPart)); - } - } - } - } - else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var _nestedSchema = items[Object.keys(items)[0]], - indexList = []; + 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]); + }; - var j, _p; + 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]); + }; +} - // loop over valOut items while keeping track of their - // corresponding input container index (given by _index) - for(j = 0; j < valOut.length; j++) { - var _index = valOut[j]._index || j; +},{"../../lib":159,"../../plots/cartesian/axes":203}],39:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - _p = p.slice(); - _p.push(_index); +'use strict'; - 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(format('invisible', base, _p)); - } - else crawl(valInj, valOutj, _nestedSchema, list, base, _p); - } - } +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = _dereq_('../annotations/common_defaults'); +var attributes = _dereq_('./attributes'); - // loop over valIn to determine where it went wrong for some items - for(j = 0; j < valIn.length; j++) { - _p = p.slice(); - _p.push(j); +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; - if(!isPlainObject(valIn[j])) { - list.push(format('object', base, _p, valIn[j])); - } - else if(indexList.indexOf(j) === -1) { - list.push(format('unused', base, _p)); - } - } - } - else if(!isPlainObject(valIn) && isPlainObject(valOut)) { - list.push(format('object', base, p, valIn)); - } - else if(!isArrayOrTypedArray(valIn) && isArrayOrTypedArray(valOut) && !isInfoArray && !isColorscale) { - list.push(format('array', base, p, valIn)); - } - else if(!(k in objOut)) { - list.push(format('unused', base, p, valIn)); - } - else if(!Lib.validate(valIn, nestedSchema)) { - list.push(format('value', base, p, valIn)); - } - else if(nestedSchema.valType === 'enumerated' && - ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) - ) { - list.push(format('dynamic', base, p, valIn, valOut)); - } +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); } - return list; -} - -// the 'full' layout schema depends on the traces types presents -function fillLayoutSchema(schema, dataOut) { - var layoutSchema = schema.layout.layoutAttributes; + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; - for(var i = 0; i < dataOut.length; i++) { - var traceOut = dataOut[i]; - var traceSchema = schema.traces[traceOut.type]; - var traceLayoutAttr = traceSchema.layoutAttributes; + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; - if(traceLayoutAttr) { - if(traceOut.subplot) { - Lib.extendFlat(layoutSchema[traceSchema.attributes.subplot.dflt], traceLayoutAttr); - } else { - Lib.extendFlat(layoutSchema, traceLayoutAttr); - } - } + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); } - return layoutSchema; -} - -// validation error codes -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; + var visible = coerce('visible'); + if(!visible) return; - return prefix + ' must be linked to an object container'; - }, - array: function(base, astr) { - var prefix; + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); - if(base === 'data') prefix = 'The data argument'; - else prefix = inBase(base) + 'key ' + astr; + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); - 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'; + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); - 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(' '); - } -}; + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; -function inBase(base) { - if(isArray(base)) return 'In data trace ' + base[1] + ', '; + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); - return 'In ' + base + ', '; -} + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; -function format(code, base, path, valIn, valOut) { - path = path || ''; + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); - var container, trace; + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } +} - // container is either 'data' or 'layout - // trace is the trace index if 'data', null otherwise +},{"../../lib":159,"../../plots/array_container_defaults":199,"../../plots/cartesian/axes":203,"../annotations/common_defaults":31,"./attributes":37}],40:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(isArray(base)) { - container = base[0]; - trace = base[1]; - } - else { - container = base; - trace = null; - } +'use strict'; - var astr = convertPathToAttributeString(path); - var msg = code2msgFunc[code](base, astr, valIn, valOut); +var drawRaw = _dereq_('../annotations/draw').drawRaw; +var project = _dereq_('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; - // log to console if logger config option is enabled - Lib.log(msg); +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; - return { - code: code, - container: container, - trace: trace, - path: path, - astr: astr, - msg: msg - }; -} + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; -function isInSchema(schema, key) { - var parts = splitKey(key), - keyMinusId = parts.keyMinusId, - id = parts.id; + 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((keyMinusId in schema) && schema[keyMinusId]._isSubplotObj && id) { - return true; - } + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } - return (key in schema); -} + 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] + ]); -function getNestedSchema(schema, key) { - if(key in schema) return schema[key]; + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; - var parts = splitKey(key); +},{"../../plots/gl3d/project":233,"../annotations/draw":34}],41:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return schema[parts.keyMinusId]; -} +'use strict'; -var idRegex = Lib.counterRegex('([a-z]+)'); +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); -function splitKey(key) { - var idMatch = key.match(idRegex); +module.exports = { + moduleType: 'component', + name: 'annotations3d', - return { - keyMinusId: idMatch && idMatch[1], - id: idMatch && idMatch[2] - }; -} + schema: { + subplots: { + scene: {annotations: _dereq_('./attributes')} + } + }, -function convertPathToAttributeString(path) { - if(!isArray(path)) return String(path); + layoutAttributes: _dereq_('./attributes'), + handleDefaults: _dereq_('./defaults'), + includeBasePlot: includeGL3D, - var astr = ''; + convert: _dereq_('./convert'), + draw: _dereq_('./draw') +}; - for(var i = 0; i < path.length; i++) { - var p = path[i]; +function includeGL3D(layoutIn, layoutOut) { + var GL3D = Registry.subplotsRegistry.gl3d; + if(!GL3D) return; - if(typeof p === 'number') { - astr = astr.substr(0, astr.length - 1) + '[' + p + ']'; - } - else { - astr += p; - } + var attrRegex = GL3D.attrRegex; - if(i < path.length - 1) astr += '.'; + 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); + } } - - return astr; } -},{"../lib":696,"../plots/plots":808,"./plot_config":732,"./plot_schema":733}],739:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../registry":243,"./attributes":37,"./convert":38,"./defaults":39,"./draw":40}],42:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -109850,196 +16819,206 @@ 'use strict'; -module.exports = { - mode: { - valType: 'enumerated', - dflt: 'afterall', - - values: ['immediate', 'next', 'afterall'], - - }, - direction: { - valType: 'enumerated', - - values: ['forward', 'reverse'], - dflt: 'forward', - - }, - fromcurrent: { - valType: 'boolean', - dflt: false, - - - }, - frame: { - duration: { - valType: 'number', - - min: 0, - dflt: 500, - - }, - redraw: { - valType: 'boolean', - - dflt: true, - - }, - }, - transition: { - duration: { - valType: 'number', - - min: 0, - dflt: 500, - - }, - 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' - ], - - - }, - } -}; -},{}],740:[function(_dereq_,module,exports){ +// IMPORTANT - default colors should be in hex for compatibility +exports.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 +]; + +exports.defaultLine = '#444'; + +exports.lightLine = '#eee'; + +exports.background = '#fff'; + +exports.borderLine = '#BEC8D9'; + +// with axis.color and Color.interp we aren't using lightLine +// itself anymore, instead interpolating between axis.color +// and the background color using tinycolor.mix. lightFraction +// gives back exactly lightLine if the other colors are defaults. +exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); + +},{}],43:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var Lib = _dereq_('../lib'); -var Template = _dereq_('../plot_api/plot_template'); +var tinycolor = _dereq_('tinycolor2'); +var isNumeric = _dereq_('fast-isnumeric'); -/** Convenience wrapper for making array container logic DRY and consistent - * - * @param {object} parentObjIn - * user input object where the container in question is linked - * (i.e. either a user trace object or the user layout object) - * - * @param {object} parentObjOut - * full object where the coerced container will be linked - * (i.e. either a full trace object or the full layout object) - * - * @param {object} opts - * options object: - * - name {string} - * name of the key linking the container in question - * - inclusionAttr {string} - * name of the item attribute for inclusion/exclusion. Default is 'visible'. - * Since inclusion is true, use eg 'enabled' instead of 'disabled'. - * - handleItemDefaults {function} - * defaults method to be called on each item in the array container in question - * - * Its arguments are: - * - itemIn {object} item in user layout - * - itemOut {object} item in full layout - * - parentObj {object} (as in closure) - * - opts {object} (as in closure) - * N.B. +var color = module.exports = {}; + +var colorAttrs = _dereq_('./attributes'); +color.defaults = colorAttrs.defaults; +var defaultLine = color.defaultLine = colorAttrs.defaultLine; +color.lightLine = colorAttrs.lightLine; +var background = color.background = colorAttrs.background; + +/* + * tinyRGB: turn a tinycolor into an rgb string, but + * unlike the built-in tinycolor.toRgbString this never includes alpha + */ +color.tinyRGB = function(tc) { + var c = tc.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, op) { + var c = tinycolor(cstr).toRgb(); + return 'rgba(' + Math.round(c.r) + ', ' + + Math.round(c.g) + ', ' + Math.round(c.b) + ', ' + op + ')'; +}; + +// combine two colors into one apparent color +// if back has transparency or is missing, +// color.background is assumed behind it +color.combine = function(front, back) { + var fc = tinycolor(front).toRgb(); + if(fc.a === 1) return tinycolor(front).toRgbString(); + + var bc = tinycolor(back || background).toRgb(); + var bcflat = bc.a === 1 ? bc : { + r: 255 * (1 - bc.a) + bc.r * bc.a, + g: 255 * (1 - bc.a) + bc.g * bc.a, + b: 255 * (1 - bc.a) + bc.b * bc.a + }; + var fcflat = { + r: bcflat.r * (1 - fc.a) + fc.r * fc.a, + g: bcflat.g * (1 - fc.a) + fc.g * fc.a, + b: bcflat.b * (1 - fc.a) + fc.b * fc.a + }; + return tinycolor(fcflat).toRgbString(); +}; + +/* + * Create a color that contrasts with cstr. * - * - opts is passed to handleItemDefaults so it can also store - * links to supplementary data (e.g. fullData for layout components) + * If cstr is a dark color, we lighten it; if it's light, we darken. * + * If lightAmount / darkAmount are used, we adjust by these percentages, + * otherwise we go all the way to white or black. */ -module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { - var name = opts.name; - var inclusionAttr = opts.inclusionAttr || 'visible'; +color.contrast = function(cstr, lightAmount, darkAmount) { + var tc = tinycolor(cstr); - var previousContOut = parentObjOut[name]; + if(tc.getAlpha() !== 1) tc = tinycolor(color.combine(cstr, background)); - var contIn = Lib.isArrayOrTypedArray(parentObjIn[name]) ? parentObjIn[name] : []; - var contOut = parentObjOut[name] = []; - var templater = Template.arrayTemplater(parentObjOut, name, inclusionAttr); - var i, itemOut; + var newColor = tc.isDark() ? + (lightAmount ? tc.lighten(lightAmount) : background) : + (darkAmount ? tc.darken(darkAmount) : defaultLine); - for(i = 0; i < contIn.length; i++) { - var itemIn = contIn[i]; + return newColor.toString(); +}; - if(!Lib.isPlainObject(itemIn)) { - itemOut = templater.newItem({}); - itemOut[inclusionAttr] = false; +color.stroke = function(s, c) { + var tc = tinycolor(c); + s.style({'stroke': color.tinyRGB(tc), 'stroke-opacity': tc.getAlpha()}); +}; + +color.fill = function(s, c) { + var tc = tinycolor(c); + s.style({ + 'fill': color.tinyRGB(tc), + 'fill-opacity': tc.getAlpha() + }); +}; + +// search container for colors with the deprecated rgb(fractions) format +// and convert them to rgb(0-255 values) +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]; + + // only sanitize keys that end in "color" or "colorscale" + 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 { - itemOut = templater.newItem(itemIn); + else if(key.substr(key.length - 10) === 'colorscale' && Array.isArray(val)) { + // colorscales have the format [[0, color1], [frac, color2], ... [1, colorN]] + for(j = 0; j < val.length; j++) { + if(Array.isArray(val[j])) val[j][1] = cleanOne(val[j][1]); + } + } + // recurse into arrays of objects, and plain objects + 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') color.clean(val); + } +}; - itemOut._index = i; +function cleanOne(val) { + if(isNumeric(val) || typeof val !== 'string') return val; - if(itemOut[inclusionAttr] !== false) { - opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts); - } + var valTrim = val.trim(); + if(valTrim.substr(0, 3) !== 'rgb') return val; - contOut.push(itemOut); - } + var match = valTrim.match(/^rgba?\s*\(([^()]*)\)$/); + if(!match) return val; - 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); - } + 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; - // in case this array gets its defaults rebuilt independent of the whole layout, - // relink the private keys just for this array. - if(Lib.isArrayOrTypedArray(previousContOut)) { - var len = Math.min(previousContOut.length, contOut.length); - for(i = 0; i < len; i++) { - Lib.relinkPrivateKeys(contOut[i], previousContOut[i]); + for(var i = 0; i < parts.length; i++) { + if(!parts[i].length) return val; + parts[i] = Number(parts[i]); + + // all parts must be non-negative numbers + if(!(parts[i] >= 0)) return val; + // alpha>1 gets clipped to 1 + if(i === 3) { + if(parts[i] > 1) parts[i] = 1; } + // r, g, b must be < 1 (ie 1 itself is not allowed) + else if(parts[i] >= 1) return val; } - return contOut; -}; + 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 + ')'; +} -},{"../lib":696,"../plot_api/plot_template":734}],741:[function(_dereq_,module,exports){ +},{"./attributes":42,"fast-isnumeric":10,"tinycolor2":26}],44:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110048,123 +17027,177 @@ 'use strict'; -var fxAttrs = _dereq_('../components/fx/attributes'); +var axesAttrs = _dereq_('../../plots/cartesian/layout_attributes'); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var extendFlat = _dereq_('../../lib/extend').extendFlat; +var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -module.exports = { - type: { + +module.exports = overrideAll({ +// TODO: only right is supported currently +// orient: { +// valType: 'enumerated', +// +// values: ['left', 'right', 'top', 'bottom'], +// dflt: 'right', +// +// }, + thicknessmode: { valType: 'enumerated', + values: ['fraction', 'pixels'], + + dflt: 'pixels', - values: [], // listed dynamically - dflt: 'scatter', - editType: 'calc+clearAxisTypes', - _noTemplating: true // we handle this at a higher level }, - visible: { + thickness: { + valType: 'number', + + min: 0, + dflt: 30, + + }, + lenmode: { valType: 'enumerated', - values: [true, false, 'legendonly'], + values: ['fraction', 'pixels'], - dflt: true, - editType: 'calc', + dflt: 'fraction', }, - showlegend: { - valType: 'boolean', + len: { + valType: 'number', + min: 0, + dflt: 1, - dflt: true, - editType: 'style', }, - legendgroup: { - valType: 'string', + x: { + valType: 'number', + dflt: 1.02, + min: -2, + max: 3, - dflt: '', - editType: 'style', }, - opacity: { + xanchor: { + valType: 'enumerated', + values: ['left', 'center', 'right'], + dflt: 'left', + + + }, + xpad: { valType: 'number', min: 0, - max: 1, - dflt: 1, - editType: 'style', + dflt: 10, }, - name: { - valType: 'string', + y: { + valType: 'number', - editType: 'style', + dflt: 0.5, + min: -2, + max: 3, }, - uid: { - valType: 'string', + yanchor: { + valType: 'enumerated', + values: ['top', 'middle', 'bottom'], + + dflt: 'middle', - editType: 'plot' }, - ids: { - valType: 'data_array', - editType: 'calc', + ypad: { + valType: 'number', - }, - customdata: { - valType: 'data_array', - editType: 'calc', + min: 0, + dflt: 10, }, - - // 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', + // 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', - editType: 'calc', + min: 0, + dflt: 0, }, - - hoverinfo: { - valType: 'flaglist', + bgcolor: { + valType: 'color', - flags: ['x', 'y', 'z', 'text', 'name'], - extras: ['all', 'none', 'skip'], - arrayOk: true, - dflt: 'all', - editType: 'none', + dflt: 'rgba(0,0,0,0)', }, - hoverlabel: fxAttrs.hoverlabel, - stream: { - token: { + // tick and title properties named and function exactly as in axes + tickmode: axesAttrs.tickmode, + nticks: axesAttrs.nticks, + tick0: axesAttrs.tick0, + dtick: axesAttrs.dtick, + tickvals: axesAttrs.tickvals, + ticktext: axesAttrs.ticktext, + ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklen: axesAttrs.ticklen, + tickwidth: axesAttrs.tickwidth, + tickcolor: axesAttrs.tickcolor, + showticklabels: axesAttrs.showticklabels, + tickfont: fontAttrs({ + + }), + 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, + showexponent: axesAttrs.showexponent, + title: { + text: { valType: 'string', - noBlank: true, - strict: true, - editType: 'calc', }, - maxpoints: { - valType: 'number', - min: 0, - max: 10000, - dflt: 500, + font: fontAttrs({ - editType: 'calc', + }), + side: { + valType: 'enumerated', + values: ['right', 'top', 'bottom'], - }, - editType: 'calc' + dflt: 'top', + + } }, - transforms: { - _isLinkedToArray: 'transform', - editType: 'calc', - + + _deprecated: { + title: { + valType: 'string', + + + }, + titlefont: fontAttrs({ + + }), + titleside: { + valType: 'enumerated', + values: ['right', 'top', 'bottom'], + + dflt: 'top', + + } } -}; +}, 'colorbars', 'from-root'); -},{"../components/fx/attributes":604}],742:[function(_dereq_,module,exports){ +},{"../../lib/extend":153,"../../plot_api/edit_types":186,"../../plots/cartesian/layout_attributes":216,"../../plots/font_attributes":230}],45:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110173,27 +17206,66 @@ 'use strict'; +var drawColorbar = _dereq_('./draw'); +var flipScale = _dereq_('../colorscale/helpers').flipScale; -module.exports = { - xaxis: { - valType: 'subplotid', - - dflt: 'x', - editType: 'calc+clearAxisTypes', - - }, - yaxis: { - valType: 'subplotid', - - dflt: 'y', - editType: 'calc+clearAxisTypes', - +/** + * connectColorbar: create a colorbar from a trace, using its module to + * describe the connection. + * + * @param {DOM element} gd + * + * @param {Array} cd + * calcdata entry for this trace. cd[0].trace is the trace itself, and the + * colorbar object will be stashed in cd[0].t.cb + * + * @param {object|function} moduleOpts + * may be a function(gd, cd) to override the standard handling below. If + * an object, should have these keys: + * @param {Optional(string)} moduleOpts.container + * name of the container inside the trace where the colorbar and colorscale + * attributes live (ie 'marker', 'line') - omit if they're at the trace root. + * @param {string} moduleOpts.min + * name of the attribute holding the value of the minimum color + * @param {string} moduleOpts.max + * name of the attribute holding the value of the maximum color + * @param {Optional(string)} moduleOpts.vals + * name of the attribute holding the (numeric) color data + * used only if min/max fail. May be omitted if these are always + * pre-calculated. + */ +module.exports = function connectColorbar(gd, cd, moduleOpts) { + if(typeof moduleOpts === 'function') return moduleOpts(gd, cd); + + var trace = cd[0].trace; + var cbId = 'cb' + trace.uid; + moduleOpts = Array.isArray(moduleOpts) ? moduleOpts : [moduleOpts]; + + for(var i = 0; i < moduleOpts.length; i++) { + var containerName = moduleOpts[i].container; + + var container = containerName ? trace[containerName] : trace; + + gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); + if(!container || !container.showscale) continue; + + var cb = cd[0].t.cb = drawColorbar(gd, cbId); + + var scl = container.reversescale ? + flipScale(container.colorscale) : + container.colorscale; + + cb.fillgradient(scl) + .zrange([container[moduleOpts[i].min], container[moduleOpts[i].max]]) + .options(container.colorbar)(); + + return; } }; -},{}],743:[function(_dereq_,module,exports){ +},{"../colorscale/helpers":54,"./draw":48}],46:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110202,481 +17274,790 @@ 'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); +module.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' + } +}; + +},{}],47:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; var Lib = _dereq_('../../lib'); -var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; +var Template = _dereq_('../../plot_api/plot_template'); -module.exports = { - getAutoRange: getAutoRange, - makePadFn: makePadFn, - doAutoRange: doAutoRange, - findExtremes: findExtremes, - concatExtremes: concatExtremes +var handleTickValueDefaults = _dereq_('../../plots/cartesian/tick_value_defaults'); +var handleTickMarkDefaults = _dereq_('../../plots/cartesian/tick_mark_defaults'); +var handleTickLabelDefaults = _dereq_('../../plots/cartesian/tick_label_defaults'); + +var attributes = _dereq_('./attributes'); + +module.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 thicknessmode = coerce('thicknessmode'); + coerce('thickness', (thicknessmode === 'fraction') ? + 30 / (layout.width - layout.margin.l - layout.margin.r) : + 30 + ); + + var lenmode = coerce('lenmode'); + coerce('len', (lenmode === 'fraction') ? + 1 : + layout.height - layout.margin.t - layout.margin.b + ); + + coerce('x'); + coerce('xanchor'); + coerce('xpad'); + coerce('y'); + coerce('yanchor'); + coerce('ypad'); + Lib.noneOrAll(colorbarIn, colorbarOut, ['x', 'y']); + + coerce('outlinecolor'); + coerce('outlinewidth'); + coerce('bordercolor'); + coerce('borderwidth'); + coerce('bgcolor'); + + handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); + + var opts = {outerTicks: false, font: layout.font}; + handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); + handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); + + coerce('title.text', layout._dfltTitle.colorbar); + Lib.coerceFont(coerce, 'title.font', layout.font); + coerce('title.side'); }; +},{"../../lib":159,"../../plot_api/plot_template":193,"../../plots/cartesian/tick_label_defaults":223,"../../plots/cartesian/tick_mark_defaults":224,"../../plots/cartesian/tick_value_defaults":225,"./attributes":44}],48:[function(_dereq_,module,exports){ /** - * getAutoRange - * - * Collects all _extremes values corresponding to a given axis - * and computes its auto range. - * - * Note that getAutoRange uses return values from findExtremes. - * - * @param {object} gd: - * graph div object with filled-in fullData and fullLayout, in particular - * with filled-in '_extremes' containers: - * { - * val: calcdata value, - * pad: extra pixels beyond this value, - * extrapad: bool, does this point want 5% extra padding - * } - * @param {object} ax: - * full axis object, in particular with filled-in '_traceIndices' - * and '_annIndices' / '_shapeIndices' if applicable - * @return {array} - * an array of [min, max]. These are calcdata for log and category axes - * and data for linear and date axes. - * - * TODO: we want to change log to data as well, but it's hard to do this - * maintaining backward compatibility. category will always have to use calcdata - * though, because otherwise values between categories (or outside all categories) - * would be impossible. - */ -function getAutoRange(gd, ax) { - var i, j; - var newRange = []; +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var getPad = makePadFn(ax); - var extremes = concatExtremes(gd, ax); - var minArray = extremes.min; - var maxArray = extremes.max; - if(minArray.length === 0 || maxArray.length === 0) { - return Lib.simpleMap(ax.range, ax.r2l); - } +'use strict'; - var minmin = minArray[0].val; - var maxmax = maxArray[0].val; +var d3 = _dereq_('d3'); +var tinycolor = _dereq_('tinycolor2'); - 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 Plots = _dereq_('../../plots/plots'); +var Registry = _dereq_('../../registry'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var dragElement = _dereq_('../dragelement'); +var Lib = _dereq_('../../lib'); +var extendFlat = _dereq_('../../lib/extend').extendFlat; +var setCursor = _dereq_('../../lib/setcursor'); +var Drawing = _dereq_('../drawing'); +var Color = _dereq_('../color'); +var Titles = _dereq_('../titles'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var alignmentConstants = _dereq_('../../constants/alignment'); +var LINE_SPACING = alignmentConstants.LINE_SPACING; +var FROM_TL = alignmentConstants.FROM_TL; +var FROM_BR = alignmentConstants.FROM_BR; - var axReverse = false; +var handleAxisDefaults = _dereq_('../../plots/cartesian/axis_defaults'); +var handleAxisPositionDefaults = _dereq_('../../plots/cartesian/position_defaults'); +var axisLayoutAttrs = _dereq_('../../plots/cartesian/layout_attributes'); - if(ax.range) { - var rng = Lib.simpleMap(ax.range, ax.r2l); - axReverse = rng[1] < rng[0]; - } - // one-time setting to easily reverse the axis - // when plotting from code - if(ax.autorange === 'reversed') { - axReverse = true; - ax.autorange = true; +var attributes = _dereq_('./attributes'); +var cn = _dereq_('./constants').cn; + +module.exports = function draw(gd, id) { + // opts: options object, containing everything from attributes + // plus a few others that are the equivalent of the colorbar "data" + var opts = {}; + for(var k in attributes) { + opts[k] = null; } + // 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 + opts.fillcolor = null; + // line.color has the same options as fillcolor + opts.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) + opts.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 + opts.filllevels = null; + // for continuous colorscales: fill with a gradient instead of explicit levels + // value should be the colorscale [[0, c0], [v1, c1], ..., [1, cEnd]] + opts.fillgradient = null; + // when using a gradient, we need the data range specified separately + opts.zrange = null; - var rangeMode = ax.rangemode; - var toZero = rangeMode === 'tozero'; - var nonNegative = rangeMode === 'nonnegative'; - var axLen = ax._length; - // don't allow padding to reduce the data to < 10% of the length - var minSpan = axLen / 10; + function component() { + var fullLayout = gd._fullLayout; + var gs = fullLayout._size; + if((typeof opts.fillcolor !== 'function') && + (typeof opts.line.color !== 'function') && + !opts.fillgradient) { + fullLayout._infolayer.selectAll('g.' + id).remove(); + return; + } + var zrange = opts.zrange || (d3.extent(((typeof opts.fillcolor === 'function') ? + opts.fillcolor : opts.line.color).domain())); + var linelevels = []; + var filllevels = []; + var linecolormap = typeof opts.line.color === 'function' ? + opts.line.color : function() { return opts.line.color; }; + var fillcolormap = typeof opts.fillcolor === 'function' ? + opts.fillcolor : function() { return opts.fillcolor; }; + var l; + var i; - var mbest = 0; - var minpt, maxpt, minbest, maxbest, dp, dv; + var l0 = opts.levels.end + opts.levels.size / 100; + var ls = opts.levels.size; + var zr0 = (1.001 * zrange[0] - 0.001 * zrange[1]); + var zr1 = (1.001 * zrange[1] - 0.001 * zrange[0]); + for(i = 0; i < 1e5; i++) { + l = opts.levels.start + i * ls; + if(ls > 0 ? (l >= l0) : (l <= l0)) break; + if(l > zr0 && l < zr1) linelevels.push(l); + } - for(i = 0; i < minArray.length; i++) { - minpt = minArray[i]; - for(j = 0; j < maxArray.length; j++) { - maxpt = maxArray[j]; - dv = maxpt.val - minpt.val; - if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); - if(dp > minSpan) { - if(dv / dp > mbest) { - minbest = minpt; - maxbest = maxpt; - mbest = dv / dp; - } - } - else if(dv / axLen > mbest) { - // in case of padding longer than the axis - // at least include the unpadded data values. - minbest = {val: minpt.val, pad: 0}; - maxbest = {val: maxpt.val, pad: 0}; - mbest = dv / axLen; + if(opts.fillgradient) { + filllevels = [0]; + } + else if(typeof opts.fillcolor === 'function') { + if(opts.filllevels) { + l0 = opts.filllevels.end + opts.filllevels.size / 100; + ls = opts.filllevels.size; + for(i = 0; i < 1e5; i++) { + l = opts.filllevels.start + i * ls; + if(ls > 0 ? (l >= l0) : (l <= l0)) break; + if(l > zrange[0] && l < zrange[1]) filllevels.push(l); } } + else { + filllevels = linelevels.map(function(v) { + return v - opts.levels.size / 2; + }); + filllevels.push(filllevels[filllevels.length - 1] + + opts.levels.size); + } + } + else if(opts.fillcolor && typeof opts.fillcolor === 'string') { + // doesn't matter what this value is, with a single value + // we'll make a single fill rect covering the whole bar + filllevels = [0]; } - } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); - } + if(opts.levels.size < 0) { + linelevels.reverse(); + filllevels.reverse(); + } - if(minmin === maxmax) { - var lower = minmin - 1; - var upper = minmin + 1; - if(toZero) { - if(minmin === 0) { - // The only value we have on this axis is 0, and we want to - // autorange so zero is one end. - // In principle this could be [0, 1] or [-1, 0] but usually - // 'tozero' pins 0 to the low end, so follow that. - newRange = [0, 1]; - } - else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); - // we're pushing a single value away from the edge due to its - // padding, with the other end clamped at zero - // 0.5 means don't push it farther than the center. - 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]; + // now make a Plotly Axes object to scale with and draw ticks + // TODO: does not support orientation other than right + + // we calculate pixel sizes based on the specified graph size, + // not the actual (in case something pushed the margins around) + // which is a little odd but avoids an odd iterative effect + // when the colorbar itself is pushing the margins. + // but then the fractional size is calculated based on the + // actual graph size, so that the axes will size correctly. + var plotHeight = gs.h; + var plotWidth = gs.w; + var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? plotWidth : 1)); + var thickFrac = thickPx / gs.w; + var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? plotHeight : 1)); + var lenFrac = lenPx / gs.h; + var xpadFrac = opts.xpad / gs.w; + var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2; + var ypadFrac = opts.ypad / gs.h; + + // x positioning: do it initially just for left anchor, + // then fix at the end (since we don't know the width yet) + var xLeft = Math.round(opts.x * gs.w + opts.xpad); + // for dragging... this is getting a little muddled... + var xLeftFrac = opts.x - thickFrac * ({middle: 0.5, right: 1}[opts.xanchor]||0); + + // y positioning we can do correctly from the start + var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5); + var yBottomPx = Math.round(gs.h * (1 - yBottomFrac)); + var yTopPx = yBottomPx - lenPx; + + var titleEl; + + 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, + tickfont: opts.tickfont, + tickangle: opts.tickangle, + tickformat: opts.tickformat, + exponentformat: opts.exponentformat, + 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: 'right', + position: 1 + }; + var cbAxisOut = { + type: 'linear', + _id: 'y' + id + }; + var axisOptions = { + letter: 'y', + font: fullLayout.font, + noHover: true, + noTickson: true, + calendar: fullLayout.calendar // not really necessary (yet?) + }; + + // Coerce w.r.t. Axes layoutAttributes: + // re-use axes.js logic without updating _fullData + function coerce(attr, dflt) { + return Lib.coerce(cbAxisIn, cbAxisOut, axisLayoutAttrs, attr, dflt); } - } - else { - if(toZero) { - if(minbest.val >= 0) { - minbest = {val: 0, pad: 0}; - } - if(maxbest.val <= 0) { - maxbest = {val: 0, pad: 0}; - } + + // Prepare the Plotly axis object + handleAxisDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions, fullLayout); + handleAxisPositionDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions); + + // position can't go in through supplyDefaults + // because that restricts it to [0,1] + cbAxisOut.position = opts.x + xpadFrac + thickFrac; + + // save for other callers to access this axis + component.axis = cbAxisOut; + + if(['top', 'bottom'].indexOf(opts.title.side) !== -1) { + cbAxisOut.title.side = opts.title.side; + cbAxisOut.titlex = opts.x + xpadFrac; + cbAxisOut.titley = yBottomFrac + + (opts.title.side === 'top' ? lenFrac - ypadFrac : ypadFrac); } - else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { - minbest = {val: 0, pad: 0}; - } - if(maxbest.val <= 0) { - maxbest = {val: 1, pad: 0}; + + if(opts.line.color && opts.tickmode === 'auto') { + cbAxisOut.tickmode = 'linear'; + cbAxisOut.tick0 = opts.levels.start; + var dtick = opts.levels.size; + // expand if too many contours, so we don't get too many ticks + var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 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 the contours are at round multiples, reset tick0 + // so they're still at round multiples. Otherwise, + // keep the first label on the first contour level + if((Math.abs(opts.levels.start) / + opts.levels.size + 1e-6) % 1 < 2e-6) { + cbAxisOut.tick0 = 0; + } } + cbAxisOut.dtick = dtick; } - // in case it changed again... - mbest = (maxbest.val - minbest.val) / - (axLen - getPad(minbest) - getPad(maxbest)); - - newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + // set domain after init, because we may want to + // allow it outside [0,1] + cbAxisOut.domain = [ + yBottomFrac + ypadFrac, + yBottomFrac + lenFrac - ypadFrac ]; - } - - // maintain reversal - if(axReverse) newRange.reverse(); + cbAxisOut.setScale(); - return Lib.simpleMap(newRange, ax.l2r || Number); -} + // now draw the elements + var container = Lib.ensureSingle(fullLayout._infolayer, 'g', id, function(s) { + s.classed(cn.colorbar, true) + .each(function() { + var s = d3.select(this); + s.append('rect').classed(cn.cbbg, true); + s.append('g').classed(cn.cbfills, true); + s.append('g').classed(cn.cblines, true); + s.append('g').classed(cn.cbaxis, true).classed(cn.crisp, true); + s.append('g').classed(cn.cbtitleunshift, true) + .append('g').classed(cn.cbtitle, true); + s.append('rect').classed(cn.cboutline, true); + s.select('.cbtitle').datum(0); + }); + }); -/* - * calculate the pixel padding for ax._min and ax._max entries with - * optional extrapad as 5% of the total axis length - */ -function makePadFn(ax) { - // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + container.attr('transform', 'translate(' + Math.round(gs.l) + + ',' + Math.round(gs.t) + ')'); + // TODO: this opposite transform is a hack until we make it + // more rational which items get this offset + var titleCont = container.select('.cbtitleunshift') + .attr('transform', 'translate(-' + + Math.round(gs.l) + ',-' + + Math.round(gs.t) + ')'); - // domain-constrained axes: base extrappad on the unconstrained - // domain so it's consistent as the domain changes - if((ax.constrain === 'domain') && ax._inputDomain) { - extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / - (ax.domain[1] - ax.domain[0]); - } + var axisLayer = container.select('.cbaxis'); - return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; -} + var titleHeight = 0; + if(['top', 'bottom'].indexOf(opts.title.side) !== -1) { + // draw the title so we know how much room it needs + // when we squish the axis. This one only applies to + // top or bottom titles, not right side. + var x = gs.l + (opts.x + xpadFrac) * gs.w; + var fontSize = cbAxisOut.title.font.size; + var y; -function concatExtremes(gd, ax) { - var axId = ax._id; - var fullData = gd._fullData; - var fullLayout = gd._fullLayout; - var minArray = []; - var maxArray = []; - var i, j, d; + if(opts.title.side === 'top') { + y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h + + gs.t + 3 + fontSize * 0.75; + } + else { + y = (1 - (yBottomFrac + ypadFrac)) * gs.h + + gs.t - 3 - fontSize * 0.25; + } + drawTitle(cbAxisOut._id + 'title', { + attributes: {x: x, y: y, 'text-anchor': 'start'} + }); + } - 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}); + function drawAxis() { + if(['top', 'bottom'].indexOf(opts.title.side) !== -1) { + // squish the axis top to make room for the title + var titleGroup = container.select('.cbtitle'); + var titleText = titleGroup.select('text'); + var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2]; + var mathJaxNode = titleGroup + .select('.h' + cbAxisOut._id + 'title-math-group') + .node(); + var lineSize = 15.6; + if(titleText.node()) { + lineSize = + parseInt(titleText.node().style.fontSize, 10) * LINE_SPACING; } - for(j = 0; j < extremes.max.length; j++) { - d = extremes.max[j]; - collapseMaxArray(maxArray, d.val, d.pad, {extrapad: d.extrapad}); + if(mathJaxNode) { + titleHeight = Drawing.bBox(mathJaxNode).height; + if(titleHeight > lineSize) { + // not entirely sure how mathjax is doing + // vertical alignment, but this seems to work. + titleTrans[1] -= (titleHeight - lineSize) / 2; + } + } + else if(titleText.node() && + !titleText.classed(cn.jsPlaceholder)) { + titleHeight = Drawing.bBox(titleText.node()).height; + } + if(titleHeight) { + // buffer btwn colorbar and title + // TODO: configurable + titleHeight += 5; + + if(opts.title.side === 'top') { + cbAxisOut.domain[1] -= titleHeight / gs.h; + titleTrans[1] *= -1; + } + else { + cbAxisOut.domain[0] += titleHeight / gs.h; + var nlines = svgTextUtils.lineCount(titleText); + titleTrans[1] += (1 - nlines) * lineSize; + } + + titleGroup.attr('transform', + 'translate(' + titleTrans + ')'); + + cbAxisOut.setScale(); } } - } - } - _concat(fullData, ax._traceIndices); - _concat(fullLayout.annotations || [], ax._annIndices || []); - _concat(fullLayout.shapes || [], ax._shapeIndices || []); + container.selectAll('.cbfills,.cblines') + .attr('transform', 'translate(0,' + + Math.round(gs.h * (1 - cbAxisOut.domain[1])) + ')'); - return {min: minArray, max: maxArray}; -} + axisLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); -function doAutoRange(gd, ax) { - if(!ax._length) ax.setScale(); + var fills = container.select('.cbfills') + .selectAll('rect.cbfill') + .data(filllevels); + fills.enter().append('rect') + .classed(cn.cbfill, true) + .style('stroke', 'none'); + fills.exit().remove(); - var axIn; + var zBounds = zrange + .map(cbAxisOut.c2p) + .map(Math.round) + .sort(function(a, b) { return a - b; }); - if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + 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(cbAxisOut.c2p) + .map(Math.round); - ax._r = ax.range.slice(); - ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // offset the side adjoining the next rectangle so they + // overlap, to prevent antialiasing gaps + z[1] = Lib.constrain(z[1] + (z[1] > z[0]) ? 1 : -1, zBounds[0], zBounds[1]); - // doAutoRange will get called on fullLayout, - // but we want to report its results back to layout + // Colorbar cannot currently support opacities so we + // use an opaque fill even when alpha channels present + var fillEl = d3.select(this).attr({ + x: xLeft, + width: Math.max(thickPx, 2), + y: d3.min(z), + height: Math.max(d3.max(z) - d3.min(z), 2), + }); - axIn = ax._input; - axIn.range = ax.range.slice(); - axIn.autorange = ax.autorange; - } + if(opts.fillgradient) { + Drawing.gradient(fillEl, gd, id, 'vertical', + opts.fillgradient, 'fill'); + } + else { + // Tinycolor can't handle exponents and + // at this scale, removing it makes no difference. + var colorString = fillcolormap(d).replace('e-', ''); + fillEl.attr('fill', tinycolor(colorString).toHexString()); + } + }); - if(ax._anchorAxis && ax._anchorAxis.rangeslider) { - var axeRangeOpts = ax._anchorAxis.rangeslider[ax._name]; - if(axeRangeOpts) { - if(axeRangeOpts.rangemode === 'auto') { - axeRangeOpts.range = getAutoRange(gd, ax); - } - } - axIn = ax._anchorAxis._input; - axIn.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts); - } -} + var lines = container.select('.cblines') + .selectAll('path.cbline') + .data(opts.line.color && opts.line.width ? + linelevels : []); + lines.enter().append('path') + .classed(cn.cbline, true); + lines.exit().remove(); + lines.each(function(d) { + d3.select(this) + .attr('d', 'M' + xLeft + ',' + + (Math.round(cbAxisOut.c2p(d)) + (opts.line.width / 2) % 1) + + 'h' + thickPx) + .call(Drawing.lineGroupStyle, + opts.line.width, linecolormap(d), opts.line.dash); + }); -/** - * findExtremes - * - * Find min/max extremes of an array of coordinates on a given axis. - * - * Note that findExtremes is called during `calc`, when we don't yet know the axis - * length; all the inputs should be based solely on the trace data, nothing - * about the axis layout. - * - * Note that `ppad` and `vpad` as well as their asymmetric variants refer to - * the before and after padding of the passed `data` array, not to the whole axis. - * - * @param {object} ax: full axis object - * relies on - * - ax.type - * - ax._m (just its sign) - * - ax.d2l - * @param {array} data: - * array of numbers (i.e. already run though ax.d2c) - * @param {object} options: - * available keys are: - * vpad: (number or number array) pad values (data value +-vpad) - * ppad: (number or number array) pad pixels (pixel location +-ppad) - * ppadplus, ppadminus, vpadplus, vpadminus: - * separate padding for each side, overrides symmetric - * padded: (boolean) add 5% padding to both ends - * (unless one end is overridden by tozero) - * tozero: (boolean) make sure to include zero if axis is linear, - * and make it a tight bound if possible - * - * @return {object} - * - min {array of objects} - * - max {array of objects} - * each object item has fields: - * - val {number} - * - pad {number} - * - extrappad {number} - */ -function findExtremes(ax, data, options) { - if(!options) options = {}; - if(!ax._m) ax.setScale(); + // force full redraw of labels and ticks + axisLayer.selectAll('g.' + cbAxisOut._id + 'tick,path').remove(); - var minArray = []; - var maxArray = []; + // separate out axis and title drawing, + // so we don't need such complicated logic in Titles.draw + // if title is on the top or bottom, we've already drawn it + // this title call only handles side=right + return Lib.syncOrAsync([ + function() { + var shift = xLeft + thickPx + + (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); - var len = data.length; - var extrapad = options.padded || false; - var tozero = options.tozero && (ax.type === 'linear' || ax.type === '-'); - var isLog = ax.type === 'log'; - var hasArrayOption = false; - var i, v, di, dmin, dmax, ppadiplus, ppadiminus, vmin, vmax; + var vals = Axes.calcTicks(cbAxisOut); + var transFn = Axes.makeTransFn(cbAxisOut); + var labelFns = Axes.makeLabelFns(cbAxisOut, shift); + var tickSign = Axes.getTickSigns(cbAxisOut)[2]; + + Axes.drawTicks(gd, cbAxisOut, { + vals: cbAxisOut.ticks === 'inside' ? Axes.clipEnds(cbAxisOut, vals) : vals, + layer: axisLayer, + path: Axes.makeTickPath(cbAxisOut, shift, tickSign), + transFn: transFn + }); - function makePadAccessor(item) { - if(Array.isArray(item)) { - hasArrayOption = true; - return function(i) { return Math.max(Number(item[i]||0), 0); }; - } - else { - var v = Math.max(Number(item||0), 0); - return function() { return v; }; + return Axes.drawLabels(gd, cbAxisOut, { + vals: vals, + layer: axisLayer, + transFn: transFn, + labelXFn: labelFns.labelXFn, + labelYFn: labelFns.labelYFn, + labelAnchorFn: labelFns.labelAnchorFn + }); + }, + function() { + if(['top', 'bottom'].indexOf(opts.title.side) === -1) { + var fontSize = cbAxisOut.title.font.size; + var y = cbAxisOut._offset + cbAxisOut._length / 2; + var x = gs.l + (cbAxisOut.position || 0) * gs.w + ((cbAxisOut.side === 'right') ? + 10 + fontSize * ((cbAxisOut.showticklabels ? 1 : 0.5)) : + -10 - fontSize * ((cbAxisOut.showticklabels ? 0.5 : 0))); + + // 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. + drawTitle('h' + cbAxisOut._id + 'title', { + avoid: { + selection: d3.select(gd).selectAll('g.' + cbAxisOut._id + 'tick'), + side: opts.title.side, + offsetLeft: gs.l, + offsetTop: 0, + maxShift: fullLayout.width + }, + attributes: {x: x, y: y, 'text-anchor': 'middle'}, + transform: {rotate: '-90', offset: 0} + }); + } + }]); } - } - var ppadplus = makePadAccessor((ax._m > 0 ? - options.ppadplus : options.ppadminus) || options.ppad || 0); - var ppadminus = makePadAccessor((ax._m > 0 ? - options.ppadminus : options.ppadplus) || options.ppad || 0); - var vpadplus = makePadAccessor(options.vpadplus || options.vpad); - var vpadminus = makePadAccessor(options.vpadminus || options.vpad); + function drawTitle(titleClass, titleOpts) { + var dfltTitleOpts = { + propContainer: cbAxisOut, + propName: getPropName('title'), + traceIndex: getTrace().index, + placeholder: fullLayout._dfltTitle.colorbar, + containerGroup: container.select('.cbtitle') + }; - if(!hasArrayOption) { - // with no arrays other than `data` we don't need to consider - // every point, only the extreme data points - vmin = Infinity; - vmax = -Infinity; + // this class-to-rotate thing with convertToTspans is + // getting hackier and hackier... delete groups with the + // wrong class (in case earlier the colorbar was drawn on + // a different side, I think?) + var otherClass = titleClass.charAt(0) === 'h' ? + titleClass.substr(1) : ('h' + titleClass); + container.selectAll('.' + otherClass + ',.' + otherClass + '-math-group') + .remove(); - if(isLog) { - for(i = 0; i < len; i++) { - v = data[i]; - // data is not linearized yet so we still have to filter out negative logs - 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; - } + Titles.draw(gd, titleClass, + extendFlat(dfltTitleOpts, titleOpts || {})); } - data = [vmin, vmax]; - len = 2; - } + function positionCB() { + // wait for the axis & title to finish rendering before + // continuing positioning + // TODO: why are we redrawing multiple times now with this? + // I guess autoMargin doesn't like being post-promise? + var innerWidth = thickPx + opts.outlinewidth / 2 + + Drawing.bBox(axisLayer.node()).width; + titleEl = titleCont.select('text'); + if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { + var mathJaxNode = titleCont + .select('.h' + cbAxisOut._id + 'title-math-group') + .node(); + var titleWidth; + if(mathJaxNode && + ['top', 'bottom'].indexOf(opts.title.side) !== -1) { + titleWidth = Drawing.bBox(mathJaxNode).width; + } + else { + // note: the formula below works for all title sides, + // (except for top/bottom mathjax, above) + // but the weird gs.l is because the titleunshift + // transform gets removed by Drawing.bBox + titleWidth = + Drawing.bBox(titleCont.node()).right - + xLeft - gs.l; + } + innerWidth = Math.max(innerWidth, titleWidth); + } - var collapseOpts = {tozero: tozero, extrapad: extrapad}; + var outerwidth = 2 * opts.xpad + innerWidth + + opts.borderwidth + opts.outlinewidth / 2; + var outerheight = yBottomPx - yTopPx; - function addItem(i) { - di = data[i]; - if(!isNumeric(di)) return; - ppadiplus = ppadplus(i); - ppadiminus = ppadminus(i); - vmin = di - vpadminus(i); - vmax = di + vpadplus(i); - // special case for log axes: if vpad makes this object span - // more than an order of mag, clip it to one order. This is so - // we don't have non-positive errors or absurdly large lower - // range due to rounding errors - if(isLog && vmin < vmax / 10) vmin = vmax / 10; + container.select('.cbbg').attr({ + x: xLeft - opts.xpad - + (opts.borderwidth + opts.outlinewidth) / 2, + y: yTopPx - yExtraPx, + width: Math.max(outerwidth, 2), + height: Math.max(outerheight + 2 * yExtraPx, 2) + }) + .call(Color.fill, opts.bgcolor) + .call(Color.stroke, opts.bordercolor) + .style({'stroke-width': opts.borderwidth}); - dmin = ax.c2l(vmin); - dmax = ax.c2l(vmax); + container.selectAll('.cboutline').attr({ + x: xLeft, + y: yTopPx + opts.ypad + + (opts.title.side === 'top' ? titleHeight : 0), + width: Math.max(thickPx, 2), + height: Math.max(outerheight - 2 * opts.ypad - titleHeight, 2) + }) + .call(Color.stroke, opts.outlinecolor) + .style({ + fill: 'None', + 'stroke-width': opts.outlinewidth + }); - 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); - } - } + // fix positioning for xanchor!='left' + var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * + outerwidth; + container.attr('transform', + 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); - // For efficiency covering monotonic or near-monotonic data, - // check a few points at both ends first and then sweep - // through the middle - var iMax = Math.min(6, len); - for(i = 0; i < iMax; i++) addItem(i); - for(i = len - 1; i >= iMax; i--) addItem(i); + // auto margin adjustment + var marginOpts = {}; + var tFrac = FROM_TL[opts.yanchor]; + var bFrac = FROM_BR[opts.yanchor]; + if(opts.lenmode === 'pixels') { + marginOpts.y = opts.y; + marginOpts.t = outerheight * tFrac; + marginOpts.b = outerheight * bFrac; + } + else { + marginOpts.t = marginOpts.b = 0; + marginOpts.yt = opts.y + opts.len * tFrac; + marginOpts.yb = opts.y - opts.len * bFrac; + } - return {min: minArray, max: maxArray}; -} + var lFrac = FROM_TL[opts.xanchor]; + var rFrac = FROM_BR[opts.xanchor]; + if(opts.thicknessmode === 'pixels') { + marginOpts.x = opts.x; + marginOpts.l = outerwidth * lFrac; + marginOpts.r = outerwidth * rFrac; + } + else { + var extraThickness = outerwidth - thickPx; + marginOpts.l = extraThickness * lFrac; + marginOpts.r = extraThickness * rFrac; + marginOpts.xl = opts.x - opts.thickness * lFrac; + marginOpts.xr = opts.x + opts.thickness * rFrac; + } + Plots.autoMargin(gd, id, marginOpts); + } -function collapseMinArray(array, newVal, newPad, opts) { - collapseArray(array, newVal, newPad, opts, lessOrEqual); -} + var cbDone = Lib.syncOrAsync([ + Plots.previousPromises, + drawAxis, + Plots.previousPromises, + positionCB + ], gd); -function collapseMaxArray(array, newVal, newPad, opts) { - collapseArray(array, newVal, newPad, opts, greaterOrEqual); -} + if(cbDone && cbDone.then) (gd._promises || []).push(cbDone); -/** - * collapseArray - * - * Takes items from 'array' and compares them to 'newVal', 'newPad'. - * - * @param {array} array: - * current set of min or max extremes - * @param {number} newVal: - * new value to compare against - * @param {number} newPad: - * pad value associated with 'newVal' - * @param {object} opts: - * - tozero {boolean} - * - extrapad {number} - * @param {function} atLeastAsExtreme: - * comparison function, use - * - lessOrEqual for min 'array' and - * - greaterOrEqual for max 'array' - * - * In practice, 'array' is either - * - 'extremes[ax._id].min' or - * - 'extremes[ax._id].max - * found in traces and layout items that affect autorange. - * - * Since we don't yet know the relationship between pixels and values - * (that's what we're trying to figure out!) AND we don't yet know how - * many pixels `extrapad` represents (it's going to be 5% of the length, - * but we don't want to have to redo calc just because length changed) - * two point must satisfy three criteria simultaneously for one to supersede the other: - * - at least as extreme a `val` - * - at least as big a `pad` - * - an unpadded point cannot supersede a padded point, but any other combination can - * - * Then: - * - If the item supersedes the new point, set includeThis false - * - If the new pt supersedes the item, delete it from 'array' - */ -function collapseArray(array, newVal, newPad, opts, atLeastAsExtreme) { - var tozero = opts.tozero; - var extrapad = opts.extrapad; - var includeThis = true; + // dragging... + if(gd._context.edits.colorbarPosition) { + var t0, + xf, + yf; + + dragElement.init({ + element: container.node(), + gd: gd, + prepFn: function() { + t0 = container.attr('transform'); + setCursor(container); + }, + moveFn: function(dx, dy) { + container.attr('transform', + t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); - 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--; + xf = dragElement.align(xLeftFrac + (dx / gs.w), thickFrac, + 0, 1, opts.xanchor); + yf = dragElement.align(yBottomFrac - (dy / gs.h), lenFrac, + 0, 1, opts.yanchor); + + var csr = dragElement.getCursor(xf, yf, + opts.xanchor, opts.yanchor); + setCursor(container, csr); + }, + doneFn: function() { + setCursor(container); + + if(xf !== undefined && yf !== undefined) { + var update = {}; + update[getPropName('x')] = xf; + update[getPropName('y')] = yf; + Registry.call('_guiRestyle', gd, update, getTrace().index); + } + } + }); } + return cbDone; } - if(includeThis) { - var clipAtZero = (tozero && newVal === 0); - array.push({ - val: newVal, - pad: clipAtZero ? 0 : newPad, - extrapad: clipAtZero ? false : extrapad - }); + + function getTrace() { + var idNum = id.substr(2); + for(var i = 0; i < gd._fullData.length; i++) { + var trace = gd._fullData[i]; + if(trace.uid === idNum) return trace; + } } -} -// In order to stop overflow errors, don't consider points -// too close to the limits of js floating point -function goodNumber(v) { - return isNumeric(v) && Math.abs(v) < FP_SAFE; -} + function getPropName(suffix) { + var trace = getTrace(); + var propName = 'colorbar.'; + var containerName = trace._module.colorbar.container; + if(containerName) propName = containerName + '.' + propName; + return propName + suffix; + } -function lessOrEqual(v0, v1) { return v0 <= v1; } -function greaterOrEqual(v0, v1) { return v0 >= v1; } + // setter/getters for every item defined in opts + Object.keys(opts).forEach(function(name) { + component[name] = function(v) { + // getter + if(!arguments.length) return opts[name]; + + // setter - for multi-part properties, + // set only the parts that are provided + opts[name] = Lib.isPlainObject(opts[name]) ? + Lib.extendFlat(opts[name], v) : + v; -},{"../../constants/numerical":673,"../../lib":696,"fast-isnumeric":214}],744:[function(_dereq_,module,exports){ + return component; + }; + }); + + // or use .options to set multiple options at once via a dictionary + component.options = function(o) { + for(var name in o) { + // in case something random comes through + // that's not an option, ignore it + if(typeof component[name] === 'function') { + component[name](o[name]); + } + } + return component; + }; + + component._opts = opts; + + return component; +}; + +},{"../../constants/alignment":138,"../../lib":159,"../../lib/extend":153,"../../lib/setcursor":178,"../../lib/svg_text_utils":180,"../../plots/cartesian/axes":203,"../../plots/cartesian/axis_defaults":205,"../../plots/cartesian/layout_attributes":216,"../../plots/cartesian/position_defaults":219,"../../plots/plots":236,"../../registry":243,"../color":43,"../dragelement":61,"../drawing":64,"../titles":131,"./attributes":44,"./constants":46,"d3":8,"tinycolor2":26}],49:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110686,3089 +18067,2498 @@ 'use strict'; -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); -var Plots = _dereq_('../../plots/plots'); - -var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var Titles = _dereq_('../../components/titles'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); - -var axAttrs = _dereq_('./layout_attributes'); -var cleanTicks = _dereq_('./clean_ticks'); -var constants = _dereq_('../../constants/numerical'); -var ONEAVGYEAR = constants.ONEAVGYEAR; -var ONEAVGMONTH = constants.ONEAVGMONTH; -var ONEDAY = constants.ONEDAY; -var ONEHOUR = constants.ONEHOUR; -var ONEMIN = constants.ONEMIN; -var ONESEC = constants.ONESEC; -var MINUS_SIGN = constants.MINUS_SIGN; -var BADNUM = constants.BADNUM; -var MID_SHIFT = _dereq_('../../constants/alignment').MID_SHIFT; -var LINE_SPACING = _dereq_('../../constants/alignment').LINE_SPACING; +module.exports = function hasColorbar(container) { + return Lib.isPlainObject(container.colorbar); +}; -var axes = module.exports = {}; +},{"../../lib":159}],50:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -axes.setConvert = _dereq_('./set_convert'); -var autoType = _dereq_('./axis_autotype'); +'use strict'; -var axisIds = _dereq_('./axis_ids'); -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 palettes = _dereq_('./scales.js').scales; +var paletteStr = Object.keys(palettes); -var autorange = _dereq_('./autorange'); -axes.getAutoRange = autorange.getAutoRange; -axes.findExtremes = autorange.findExtremes; +function code(s) { + return '`' + s + '`'; +} -/* - * find the list of possible axes to reference with an xref or yref attribute - * and coerce it to that list +/** + * Make colorscale attribute declarations for * - * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' - * but can be prefixed, like 'ax' for annotation's arrow x - * dflt: the default to coerce to, or blank to use the first axis (falling back on - * extraOption if there is no axis) - * extraOption: aside from existing axes with this letter, what non-axis value is allowed? - * Only required if it's different from `dflt` - */ -axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { - var axLetter = attr.charAt(attr.length - 1); - var axlist = gd._fullLayout._subplots[axLetter + 'axis']; - var refAttr = attr + 'ref'; - var attrDef = {}; - - if(!dflt) dflt = axlist[0] || extraOption; - if(!extraOption) extraOption = dflt; - - // data-ref annotations are not supported in gl2d yet - - attrDef[refAttr] = { - valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), - dflt: dflt - }; - - // xref, yref - return Lib.coerce(containerIn, containerOut, attrDef, refAttr); -}; - -/* - * coerce position attributes (range-type) that can be either on axes or absolute - * (paper or pixel) referenced. The biggest complication here is that we don't know - * before looking at the axis whether the value must be a number or not (it may be - * a date string), so we can't use the regular valType='number' machinery + * - colorscale, + * - (c|z)auto, (c|z)min, (c|z)max, + * - autocolorscale, reversescale, + * - showscale (optionally) + * - color (optionally) * - * axRef (string): the axis this position is referenced to, or: - * paper: fraction of the plot area - * pixel: pixels relative to some starting position - * attr (string): the attribute in containerOut we are coercing - * dflt (number): the default position, as a fraction or pixels. If the attribute - * is to be axis-referenced, this will be converted to an axis data value + * @param {string} context (dflt: '', i.e. from trace root): + * the container this is in ('', *marker*, *marker.line* etc) * - * Also cleans the values, since the attribute definition itself has to say - * valType: 'any' to handle date axes. This allows us to accept: - * - for category axes: category names, and convert them here into serial numbers. - * Note that this will NOT work for axis range endpoints, because we don't know - * the category list yet (it's set by ax.makeCalcdata during calc) - * but it works for component (note, shape, images) positions. - * - for date axes: JS Dates or milliseconds, and convert to date strings - * - for other types: coerce them to numbers + * @param {object} opts: + * - cLetter {string} (dflt: 'c'): + * leading letter for 'min', 'max and 'auto' attribute (either 'z' or 'c') + * + * - colorAttr {string} (dflt: 'z' if `cLetter: 'z'`, 'color' if `cLetter: 'c'`): + * (for descriptions) sets the name of the color attribute that maps to the colorscale. + * + * N.B. if `colorAttr: 'color'`, we include the `color` declaration here. + * + * - onlyIfNumerical {string} (dflt: false' if `cLetter: 'z'`, true if `cLetter: 'c'`): + * (for descriptions) set to true if colorscale attribute only + * + * - colorscaleDflt {string}: + * overrides the colorscale dflt + * + * - autoColorDflt {boolean} (dflt true): + * normally autocolorscale.dflt is `true`, but pass `false` to override + * + * - noScale {boolean} (dflt: true if `context: 'marker.line'`, false otherwise): + * set to `false` to not include showscale attribute (e.g. for 'marker.line') + * + * - showScaleDflt {boolean} (dflt: true if `cLetter: 'z'`, false otherwise) + * + * - editTypeOverride {boolean} (dflt: ''): + * most of these attributes already require a recalc, but the ones that do not + * have editType *style* or *plot* unless you override (presumably with *calc*) + * + * - anim {boolean) (dflt: undefined): is 'color' animatable? + * + * @return {object} */ -axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { - cleanPos = Lib.ensureNumber; - pos = coerce(attr, dflt); - } else { - var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); - pos = coerce(attr, dflt); - cleanPos = ax.cleanPos; - } - - containerOut[attr] = cleanPos(pos); -}; - -axes.cleanPosition = function(pos, gd, axRef) { - var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? - Lib.ensureNumber : - axes.getFromId(gd, axRef).cleanPos; - - return cleanPos(pos); -}; - -var getDataConversions = axes.getDataConversions = function(gd, trace, target, targetArray) { - var ax; +module.exports = function colorScaleAttrs(context, opts) { + context = context || ''; + opts = opts || {}; - // If target points to an axis, use the type we already have for that - // axis to find the data type. Otherwise use the values to autotype. - var d2cTarget = (target === 'x' || target === 'y' || target === 'z') ? - target : - targetArray; + 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 + '.') : ''; - // In the case of an array target, make a mock data array - // and call supplyDefaults to the data type and - // setup the data-to-calc method. - if(Array.isArray(d2cTarget)) { - ax = { - type: autoType(targetArray), - _categories: [] - }; - axes.setConvert(ax); + var colorAttr, colorAttrFull; - // build up ax._categories (usually done during ax.makeCalcdata() - if(ax.type === 'category') { - for(var i = 0; i < targetArray.length; i++) { - ax.d2c(targetArray[i]); - } - } + if('colorAttr' in opts) { + colorAttr = opts.colorAttr; + colorAttrFull = opts.colorAttr; } else { - ax = axes.getFromTrace(gd, trace, d2cTarget); + colorAttr = {z: 'z', c: 'color'}[cLetter]; + colorAttrFull = 'in ' + code(contextHead + colorAttr); } - // if 'target' has corresponding axis - // -> use setConvert method - if(ax) return {d2c: ax.d2c, c2d: ax.c2d}; - - // special case for 'ids' - // -> cast to String - if(d2cTarget === 'ids') return {d2c: toString, c2d: toString}; - - // otherwise (e.g. numeric-array of 'marker.color' or 'marker.size') - // -> cast to Number - - return {d2c: toNum, c2d: toNum}; -}; - -function toNum(v) { return +v; } -function toString(v) { return String(v); } - -axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { - return getDataConversions(gd, trace, target, targetArray).d2c; -}; - -// get counteraxis letter for this axis (name or id) -// this can also be used as the id for default counter axis -axes.counterLetter = function(id) { - var axLetter = id.charAt(0); - if(axLetter === 'x') return 'y'; - if(axLetter === 'y') return 'x'; -}; - -// incorporate a new minimum difference and first tick into -// forced -// note that _forceTick0 is linearized, so needs to be turned into -// a range value for setting tick0 -axes.minDtick = function(ax, newDiff, newFirst, allow) { - // doesn't make sense to do forced min dTick on log or category axes, - // and the plot itself may decide to cancel (ie non-grouped bars) - if(['log', 'category'].indexOf(ax.type) !== -1 || !allow) { - ax._minDtick = 0; - } - // undefined means there's nothing there yet - else if(ax._minDtick === undefined) { - ax._minDtick = newDiff; - ax._forceTick0 = newFirst; - } - else if(ax._minDtick) { - // existing minDtick is an integer multiple of newDiff - // (within rounding err) - // and forceTick0 can be shifted to newFirst - if((ax._minDtick / newDiff + 1e-6) % 1 < 2e-6 && - (((newFirst - ax._forceTick0) / newDiff % 1) + - 1.000001) % 1 < 2e-6) { - ax._minDtick = newDiff; - ax._forceTick0 = newFirst; - } - // 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 - else if((newDiff / ax._minDtick + 1e-6) % 1 > 2e-6 || - (((newFirst - ax._forceTick0) / ax._minDtick % 1) + - 1.000001) % 1 > 2e-6) { - ax._minDtick = 0; - } - } -}; + var effectDesc = onlyIfNumerical ? + ' Has an effect only if ' + colorAttrFull + 'is set to a numerical array.' : + ''; -// save a copy of the initial axis ranges in fullLayout -// use them in mode bar and dblclick events -axes.saveRangeInitial = function(gd, overwrite) { - var axList = axes.list(gd, '', true), - hasOneAxisChanged = false; + var auto = cLetter + 'auto'; + var min = cLetter + 'min'; + var max = cLetter + 'max'; + var minFull = code(contextHead + min); + var maxFull = code(contextHead + max); + var minmaxFull = minFull + ' and ' + maxFull; + var autoImpliedEdits = {}; + autoImpliedEdits[min] = autoImpliedEdits[max] = undefined; + var minmaxImpliedEdits = {}; + minmaxImpliedEdits[auto] = false; - for(var i = 0; i < axList.length; i++) { - var ax = axList[i]; + var attrs = {}; - var isNew = (ax._rangeInitial === undefined); - var hasChanged = ( - isNew || !( - ax.range[0] === ax._rangeInitial[0] && - ax.range[1] === ax._rangeInitial[1] - ) - ); + if(colorAttr === 'color') { + attrs.color = { + valType: 'color', + arrayOk: true, + + editType: editTypeOverride || 'style', + + }; - if((isNew && ax.autorange === false) || (overwrite && hasChanged)) { - ax._rangeInitial = ax.range.slice(); - hasOneAxisChanged = true; + if(opts.anim) { + attrs.color.anim = true; } } - return hasOneAxisChanged; -}; - -// save a copy of the initial spike visibility -axes.saveShowSpikeInitial = function(gd, overwrite) { - var axList = axes.list(gd, '', true), - hasOneAxisChanged = false, - allSpikesEnabled = 'on'; + attrs[auto] = { + valType: 'boolean', + + dflt: true, + editType: 'calc', + impliedEdits: autoImpliedEdits, + + }; - for(var i = 0; i < axList.length; i++) { - var ax = axList[i]; + attrs[min] = { + valType: 'number', + + dflt: null, + editType: editTypeOverride || 'plot', + impliedEdits: minmaxImpliedEdits, + + }; - var isNew = (ax._showSpikeInitial === undefined); - var hasChanged = ( - isNew || !( - ax.showspikes === ax._showspikes - ) - ); + attrs[max] = { + valType: 'number', + + dflt: null, + editType: editTypeOverride || 'plot', + impliedEdits: minmaxImpliedEdits, + + }; - if((isNew) || (overwrite && hasChanged)) { - ax._showSpikeInitial = ax.showspikes; - hasOneAxisChanged = true; - } + attrs.colorscale = { + valType: 'colorscale', + + editType: 'calc', + dflt: colorscaleDflt, + impliedEdits: {autocolorscale: false}, + + }; - if(allSpikesEnabled === 'on' && !ax.showspikes) { - allSpikesEnabled = 'off'; - } - } - gd._fullLayout._cartesianSpikesEnabled = allSpikesEnabled; - return hasOneAxisChanged; -}; + attrs.autocolorscale = { + valType: 'boolean', + + // gets overrode in 'heatmap' & 'surface' for backwards comp. + dflt: opts.autoColorDflt === false ? false : true, + editType: 'calc', + impliedEdits: {colorscale: undefined}, + + }; -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); + attrs.reversescale = { + valType: 'boolean', + + dflt: false, + editType: 'plot', + + }; - if(ax.type === 'category') { - return { - start: dataMin - 0.5, - end: dataMax + 0.5, - size: Math.max(1, Math.round(size) || 1), - _dataSpan: dataMax - dataMin, + if(!noScale) { + attrs.showscale = { + valType: 'boolean', + + dflt: showScaleDflt, + editType: 'calc', + }; } - if(!calendar) calendar = ax.calendar; - - // piggyback off tick code to make "nice" bin sizes and edges - 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: calendar - }; - } - axes.setConvert(dummyAx); + return attrs; +}; - size = size && cleanTicks.dtick(size, dummyAx.type); +},{"./scales.js":58}],51:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(size) { - dummyAx.dtick = size; - dummyAx.tick0 = cleanTicks.tick0(undefined, dummyAx.type, calendar); - } - else { - var size0; - if(nbins) size0 = ((dataMax - dataMin) / nbins); - else { - // totally auto: scale off std deviation so the highest bin is - // somewhat taller than the total number of bins, but don't let - // the size get smaller than the 'nice' rounded down minimum - // difference between values - 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)); +'use strict'; - // fallback if ax.d2c output BADNUMs - // e.g. when user try to plot categorical bins - // on a layout.xaxis.type: 'linear' - if(!isNumeric(size0)) size0 = 1; - } +var Lib = _dereq_('../../lib'); - axes.autoTicks(dummyAx, size0); - } +module.exports = function calc(gd, trace, opts) { + var fullLayout = gd._fullLayout; + var vals = opts.vals; + var containerStr = opts.containerStr; + var cLetter = opts.cLetter; + var container = containerStr ? + Lib.nestedProperty(trace, containerStr).get() : + trace; - var finalSize = dummyAx.dtick; - var binStart = axes.tickIncrement( - axes.tickFirst(dummyAx), finalSize, 'reverse', calendar); - var binEnd, bincount; + var autoAttr = cLetter + 'auto'; + var minAttr = cLetter + 'min'; + var maxAttr = cLetter + 'max'; + var auto = container[autoAttr]; + var min = container[minAttr]; + var max = container[maxAttr]; + var scl = container.colorscale; - // check for too many data points right at the edges of bins - // (>50% within 1% of bin edges) or all data points integral - // and offset the bins accordingly - if(typeof finalSize === 'number') { - binStart = autoShiftNumericBins(binStart, data, dummyAx, dataMin, dataMax); + if(auto !== false || min === undefined) { + min = Lib.aggNums(Math.min, null, vals); + } - bincount = 1 + Math.floor((dataMax - binStart) / finalSize); - binEnd = binStart + bincount * finalSize; + if(auto !== false || max === undefined) { + max = Lib.aggNums(Math.max, null, vals); } - else { - // month ticks - should be the only nonlinear kind we have at this point. - // dtick (as supplied by axes.autoTick) only has nonlinear values on - // date and log axes, but even if you display a histogram on a log axis - // we bin it on a linear axis (which one could argue against, but that's - // a separate issue) - if(dummyAx.dtick.charAt(0) === 'M') { - binStart = autoShiftMonthBins(binStart, data, finalSize, dataMin, calendar); - } - // calculate the endpoint for nonlinear ticks - you have to - // just increment until you're done - binEnd = binStart; - bincount = 0; - while(binEnd <= dataMax) { - binEnd = axes.tickIncrement(binEnd, finalSize, false, calendar); - bincount++; - } + if(min === max) { + min -= 0.5; + max += 0.5; } - return { - start: ax.c2r(binStart, 0, calendar), - end: ax.c2r(binEnd, 0, calendar), - size: finalSize, - _dataSpan: dataMax - dataMin - }; + container['_' + minAttr] = container[minAttr] = min; + container['_' + maxAttr] = container[maxAttr] = max; + + if(container.autocolorscale) { + if(min * max < 0) scl = fullLayout.colorscale.diverging; + else if(min >= 0) scl = fullLayout.colorscale.sequential; + else scl = fullLayout.colorscale.sequentialminus; + + container._colorscale = container.colorscale = scl; + } }; +},{"../../lib":159}],52:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -function autoShiftNumericBins(binStart, data, ax, dataMin, dataMax) { - var edgecount = 0, - midcount = 0, - intcount = 0, - blankCount = 0; +'use strict'; - function nearEdge(v) { - // is a value within 1% of a bin edge? - return (1 + (v - binStart) * 100 / ax.dtick) % 100 < 2; +var Lib = _dereq_('../../lib'); +var hasColorscale = _dereq_('./helpers').hasColorscale; + +module.exports = function crossTraceDefaults(fullData) { + function replace(cont, k) { + var val = cont['_' + k]; + if(val !== undefined) { + cont[k] = val; + } } - for(var i = 0; i < data.length; i++) { - if(data[i] % 1 === 0) intcount++; - else if(!isNumeric(data[i])) blankCount++; + function relinkColorAtts(trace, cAttrs) { + var cont = cAttrs.container ? + Lib.nestedProperty(trace, cAttrs.container).get() : + trace; - if(nearEdge(data[i])) edgecount++; - if(nearEdge(data[i] + ax.dtick / 2)) midcount++; + if(cont) { + var isAuto = cont.zauto || cont.cauto; + var minAttr = cAttrs.min; + var maxAttr = cAttrs.max; + + if(isAuto || cont[minAttr] === undefined) { + replace(cont, minAttr); + } + if(isAuto || cont[maxAttr] === undefined) { + replace(cont, maxAttr); + } + if(cont.autocolorscale) { + replace(cont, 'colorscale'); + } + } } - var dataCount = data.length - blankCount; - if(intcount === dataCount && ax.type !== 'date') { - // all integers: if bin size is <1, it's because - // that was specifically requested (large nbins) - // so respect that... but center the bins containing - // integers on those integers - if(ax.dtick < 1) { - binStart = dataMin - 0.5 * ax.dtick; + for(var i = 0; i < fullData.length; i++) { + var trace = fullData[i]; + var _module = trace._module; + + if(_module.colorbar) { + relinkColorAtts(trace, _module.colorbar); } - // otherwise start half an integer down regardless of - // the bin size, just enough to clear up endpoint - // ambiguity about which integers are in which bins. - else { - binStart -= 0.5; - if(binStart + ax.dtick < dataMin) binStart += ax.dtick; + + // TODO could generalize _module.colorscale and use it here? + + if(hasColorscale(trace, 'marker.line')) { + relinkColorAtts(trace, { + container: 'marker.line', + min: 'cmin', + max: 'cmax' + }); } - } - else if(midcount < dataCount * 0.1) { - if(edgecount > dataCount * 0.3 || - nearEdge(dataMin) || nearEdge(dataMax)) { - // lots of points at the edge, not many in the middle - // shift half a bin - var binshift = ax.dtick / 2; - binStart += (binStart + binshift < dataMin) ? binshift : -binshift; + + if(hasColorscale(trace, 'line')) { + relinkColorAtts(trace, { + container: 'line', + min: 'cmin', + max: 'cmax' + }); } } - return binStart; +}; + +},{"../../lib":159,"./helpers":54}],53:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); + +var Lib = _dereq_('../../lib'); +var hasColorbar = _dereq_('../colorbar/has_colorbar'); +var colorbarDefaults = _dereq_('../colorbar/defaults'); + +var isValidScale = _dereq_('./scales').isValid; + +function npMaybe(cont, prefix) { + var containerStr = prefix.slice(0, prefix.length - 1); + return prefix ? + Lib.nestedProperty(cont, containerStr).get() || {} : + cont; } +module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, opts) { + var prefix = opts.prefix; + var cLetter = opts.cLetter; + var containerIn = npMaybe(traceIn, prefix); + var containerOut = npMaybe(traceOut, prefix); + var template = npMaybe(traceOut._template || {}, prefix) || {}; -function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { - var stats = Lib.findExactDates(data, calendar); - // number of data points that needs to be an exact value - // to shift that increment to (near) the bin center - var threshold = 0.8; + var minIn = containerIn[cLetter + 'min']; + var maxIn = containerIn[cLetter + 'max']; + var validMinMax = isNumeric(minIn) && isNumeric(maxIn) && (minIn < maxIn); + coerce(prefix + cLetter + 'auto', !validMinMax); + coerce(prefix + cLetter + 'min'); + coerce(prefix + cLetter + 'max'); - if(stats.exactDays > threshold) { - var numMonths = Number(dtick.substr(1)); + // handles both the trace case (autocolorscale is false by default) and + // the marker and marker.line case (autocolorscale is true by default) + var sclIn = containerIn.colorscale; + var sclTemplate = template.colorscale; + var autoColorscaleDflt; + if(sclIn !== undefined) autoColorscaleDflt = !isValidScale(sclIn); + if(sclTemplate !== undefined) autoColorscaleDflt = !isValidScale(sclTemplate); + coerce(prefix + 'autocolorscale', autoColorscaleDflt); - if((stats.exactYears > threshold) && (numMonths % 12 === 0)) { - // The exact middle of a non-leap-year is 1.5 days into July - // so if we start the bins here, all but leap years will - // get hover-labeled as exact years. - binStart = axes.tickIncrement(binStart, 'M6', 'reverse') + ONEDAY * 1.5; - } - else if(stats.exactMonths > threshold) { - // Months are not as clean, but if we shift half the *longest* - // month (31/2 days) then 31-day months will get labeled exactly - // and shorter months will get labeled with the correct month - // but shifted 12-36 hours into it. - binStart = axes.tickIncrement(binStart, 'M1', 'reverse') + ONEDAY * 15.5; - } - else { - // Shifting half a day is exact, but since these are month bins it - // will always give a somewhat odd-looking label, until we do something - // smarter like showing the bin boundaries (or the bounds of the actual - // data in each bin) - binStart -= ONEDAY / 2; - } - var nextBinStart = axes.tickIncrement(binStart, dtick); + coerce(prefix + 'colorscale'); + coerce(prefix + 'reversescale'); - if(nextBinStart <= dataMin) return nextBinStart; + if(!opts.noScale && prefix !== 'marker.line.') { + // handles both the trace case where the dflt is listed in attributes and + // the marker case where the dflt is determined by hasColorbar + var showScaleDflt; + if(prefix) showScaleDflt = hasColorbar(containerIn); + + var showScale = coerce(prefix + 'showscale', showScaleDflt); + if(showScale) colorbarDefaults(containerIn, containerOut, layout); } - return binStart; -} +}; -// ---------------------------------------------------- -// Ticks and grids -// ---------------------------------------------------- +},{"../../lib":159,"../colorbar/defaults":47,"../colorbar/has_colorbar":49,"./scales":58,"fast-isnumeric":10}],54:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -// ensure we have tick0, dtick, and tick rounding calculated -axes.prepTicks = function(ax) { - var rng = Lib.simpleMap(ax.range, ax.r2l); +'use strict'; - // calculate max number of (auto) ticks to display based on plot size - if(ax.tickmode === 'auto' || !ax.dtick) { - var nt = ax.nticks, - minPx; - if(!nt) { - if(ax.type === 'category') { - minPx = ax.tickfont ? (ax.tickfont.size || 12) * 1.2 : 15; - nt = ax._length / minPx; - } - else { - minPx = ax._id.charAt(0) === 'y' ? 40 : 80; - nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; - } +var d3 = _dereq_('d3'); +var tinycolor = _dereq_('tinycolor2'); +var isNumeric = _dereq_('fast-isnumeric'); - // radial axes span half their domain, - // multiply nticks value by two to get correct number of auto ticks. - if(ax._name === 'radialaxis') nt *= 2; - } +var Lib = _dereq_('../../lib'); +var Color = _dereq_('../color'); - // add a couple of extra digits for filling in ticks when we - // have explicit tickvals without tick text - if(ax.tickmode === 'array') nt *= 100; +var isValidScale = _dereq_('./scales').isValid; - axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); - // check for a forced minimum dtick - if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { - ax.dtick = ax._minDtick; - ax.tick0 = ax.l2r(ax._forceTick0); +function hasColorscale(trace, containerStr) { + var container = containerStr ? + Lib.nestedProperty(trace, containerStr).get() || {} : + trace; + var color = container.color; + + var isArrayWithOneNumber = false; + if(Lib.isArrayOrTypedArray(color)) { + for(var i = 0; i < color.length; i++) { + if(isNumeric(color[i])) { + isArrayWithOneNumber = true; + break; + } } } - // check for missing tick0 - if(!ax.tick0) { - ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; - } + return ( + Lib.isPlainObject(container) && ( + isArrayWithOneNumber || + container.showscale === true || + (isNumeric(container.cmin) && isNumeric(container.cmax)) || + isValidScale(container.colorscale) || + Lib.isPlainObject(container.colorbar) + ) + ); +} - // ensure we don't try to make ticks below our minimum precision - // see https://github.com/plotly/plotly.js/issues/2892 - if(ax.type === 'date' && ax.dtick < 0.1) ax.dtick = 0.1; +/** + * Extract colorscale into numeric domain and color range. + * + * @param {object} cont colorscale container (e.g. trace, marker) + * - colorscale {array of arrays} + * - cmin/zmin {number} + * - cmax/zmax {number} + * - reversescale {boolean} + * @param {object} opts + * - cLetter {string} 'c' (for cmin/cmax) or 'z' (for zmin/zmax) + * + * @return {object} + * - domain {array} + * - range {array} + */ +function extractScale(cont, opts) { + var cLetter = opts.cLetter; - // now figure out rounding of tick values - autoTickRound(ax); -}; + var scl = cont.reversescale ? + flipScale(cont.colorscale) : + cont.colorscale; + + // minimum color value (used to clamp scale) + var cmin = cont[cLetter + 'min']; + // maximum color value (used to clamp scale) + var cmax = cont[cLetter + 'max']; + + var N = scl.length; + var domain = new Array(N); + var range = new Array(N); -// calculate the ticks: text, values, positioning -// if ticks are set to automatic, determine the right values (tick0,dtick) -// in any case, set tickround to # of digits to round tick labels to, -// or codes to this effect for log and date scales -axes.calcTicks = function calcTicks(ax) { - axes.prepTicks(ax); - var rng = Lib.simpleMap(ax.range, ax.r2l); + for(var i = 0; i < N; i++) { + var si = scl[i]; + domain[i] = cmin + si[0] * (cmax - cmin); + range[i] = si[1]; + } - // now that we've figured out the auto values for formatting - // in case we're missing some ticktext, we can break out for array ticks - if(ax.tickmode === 'array') return arrayTicks(ax); + return { + domain: domain, + range: range + }; +} - // find the first tick - ax._tmin = axes.tickFirst(ax); +function flipScale(scl) { + var N = scl.length; + var sclNew = new Array(N); - // add a tiny bit so we get ticks which may have rounded out - var startTick = rng[0] * 1.0001 - rng[1] * 0.0001; - var endTick = rng[1] * 1.0001 - rng[0] * 0.0001; - // check for reversed axis - var axrev = (rng[1] < rng[0]); + for(var i = N - 1, j = 0; i >= 0; i--, j++) { + var si = scl[i]; + sclNew[j] = [1 - si[0], si[1]]; + } + return sclNew; +} - // No visible ticks? Quit. - // I've only seen this on category axes with all categories off the edge. - if((ax._tmin < startTick) !== axrev) return []; +/** + * General colorscale function generator. + * + * @param {object} specs output of Colorscale.extractScale or precomputed domain, range. + * - domain {array} + * - range {array} + * + * @param {object} opts + * - noNumericCheck {boolean} if true, scale func bypasses numeric checks + * - returnArray {boolean} if true, scale func return 4-item array instead of color strings + * + * @return {function} + */ +function makeColorScaleFunc(specs, opts) { + opts = opts || {}; - // return the full set of tick vals - var vals = []; - if(ax.type === 'category') { - endTick = (axrev) ? Math.max(-0.5, endTick) : - Math.min(ax._categories.length - 0.5, endTick); + 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 xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(vals.length > maxTicks || x === xPrevious) break; - xPrevious = x; + var _sclFunc = d3.scale.linear() + .domain(domain) + .range(_range) + .clamp(true); - vals.push(x); - } + var noNumericCheck = opts.noNumericCheck; + var returnArray = opts.returnArray; + var sclFunc; - // If same angle over a full circle, the last tick vals is a duplicate. - // TODO must do something similar for angular date axes. - if(isAngular(ax) && Math.abs(rng[1] - rng[0]) === 360) { - vals.pop(); + 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; + }; } - // save the last tick as well as first, so we can - // show the exponent only on the last one - ax._tmax = vals[vals.length - 1]; + // colorbar draw looks into the d3 scale closure for domain and range - // for showing the rest of a date when the main tick label is only the - // latter part: ax._prevDateHead holds what we showed most recently. - // Start with it cleared and mark that we're in calcTicks (ie calculating a - // whole string of these so we should care what the previous date head was!) - ax._prevDateHead = ''; - ax._inCalcTicks = true; + sclFunc.domain = _sclFunc.domain; - var ticksOut = new Array(vals.length); - for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); + sclFunc.range = function() { return range; }; - ax._inCalcTicks = false; + return sclFunc; +} - return ticksOut; +function colorArray2rbga(colorArray) { + var colorObj = { + r: colorArray[0], + g: colorArray[1], + b: colorArray[2], + a: colorArray[3] + }; + + return tinycolor(colorObj).toRgbString(); +} + +module.exports = { + hasColorscale: hasColorscale, + extractScale: extractScale, + flipScale: flipScale, + makeColorScaleFunc: makeColorScaleFunc }; -function arrayTicks(ax) { - var vals = ax.tickvals, - text = ax.ticktext, - ticksOut = new Array(vals.length), - rng = Lib.simpleMap(ax.range, ax.r2l), - r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001, - r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001, - tickMin = Math.min(r0expanded, r1expanded), - tickMax = Math.max(r0expanded, r1expanded), - vali, - i, - j = 0; +},{"../../lib":159,"../color":43,"./scales":58,"d3":8,"fast-isnumeric":10,"tinycolor2":26}],55:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // without a text array, just format the given values as any other ticks - // except with more precision to the numbers - if(!Array.isArray(text)) text = []; +'use strict'; - // make sure showing ticks doesn't accidentally add new categories - var tickVal2l = ax.type === 'category' ? ax.d2l_noadd : ax.d2l; +var scales = _dereq_('./scales'); +var helpers = _dereq_('./helpers'); - // array ticks on log axes always show the full number - // (if no explicit ticktext overrides it) - 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); - } +module.exports = { + moduleType: 'component', + name: 'colorscale', - for(i = 0; i < vals.length; i++) { - vali = tickVal2l(vals[i]); - if(vali > tickMin && vali < tickMax) { - if(text[i] === undefined) ticksOut[j] = axes.tickText(ax, vali); - else ticksOut[j] = tickTextObj(ax, vali, String(text[i])); - j++; - } - } + attributes: _dereq_('./attributes'), + layoutAttributes: _dereq_('./layout_attributes'), - if(j < vals.length) ticksOut.splice(j, vals.length - j); + supplyLayoutDefaults: _dereq_('./layout_defaults'), + handleDefaults: _dereq_('./defaults'), + crossTraceDefaults: _dereq_('./cross_trace_defaults'), - return ticksOut; -} + calc: _dereq_('./calc'), -var roundBase10 = [2, 5, 10], - roundBase24 = [1, 2, 3, 6, 12], - roundBase60 = [1, 2, 5, 10, 15, 30], - // 2&3 day ticks are weird, but need something btwn 1&7 - roundDays = [1, 2, 3, 7, 14], - // approx. tick positions for log axes, showing all (1) and just 1, 2, 5 (2) - // these don't have to be exact, just close enough to round to the right value - roundLog1 = [-0.046, 0, 0.301, 0.477, 0.602, 0.699, 0.778, 0.845, 0.903, 0.954, 1], - roundLog2 = [-0.301, 0, 0.301, 0.699, 1], - // N.B. `thetaunit; 'radians' angular axes must be converted to degrees - roundAngles = [15, 30, 45, 90, 180]; + // ./scales.js is required in lib/coerce.js ; + // it needs to be a seperate module to avoid circular a dependency + scales: scales.scales, + defaultScale: scales.defaultScale, + getScale: scales.get, + isValidScale: scales.isValid, -function roundDTick(roughDTick, base, roundingSet) { - return base * Lib.roundUp(roughDTick / base, roundingSet); -} + hasColorscale: helpers.hasColorscale, + flipScale: helpers.flipScale, + extractScale: helpers.extractScale, + makeColorScaleFunc: helpers.makeColorScaleFunc +}; -// autoTicks: calculate best guess at pleasant ticks for this axis -// inputs: -// ax - an axis object -// roughDTick - rough tick spacing (to be turned into a nice round number) -// outputs (into ax): -// tick0: starting point for ticks (not necessarily on the graph) -// usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates -// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick -// if the ticks are spaced linearly (linear scale, categories, -// log with only full powers, date ticks < month), -// this will just be a number -// months: M# -// years: M# where # is 12*number of years -// log with linear ticks: L# where # is the linear tick spacing -// log showing powers plus some intermediates: -// D1 shows all digits, D2 shows 2 and 5 -axes.autoTicks = function(ax, roughDTick) { - var base; +},{"./attributes":50,"./calc":51,"./cross_trace_defaults":52,"./defaults":53,"./helpers":54,"./layout_attributes":56,"./layout_defaults":57,"./scales":58}],56:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - function getBase(v) { - return Math.pow(v, Math.floor(Math.log(roughDTick) / Math.LN10)); - } +'use strict'; - if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); - // the criteria below are all based on the rough spacing we calculate - // being > half of the final unit - so precalculate twice the rough val - var roughX2 = 2 * roughDTick; +var scales = _dereq_('./scales').scales; - 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, roundDays); - // get week ticks on sunday - // this will also move the base tick off 2000-01-01 if dtick is - // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - } - 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 { - // milliseconds - base = getBase(10); - ax.dtick = roundDTick(roughDTick, base, roundBase10); - } +var msg = 'Note that `autocolorscale` must be true for this attribute to work.'; + +module.exports = { + editType: 'calc', + sequential: { + valType: 'colorscale', + dflt: scales.Reds, + + editType: 'calc', + + }, + sequentialminus: { + valType: 'colorscale', + dflt: scales.Blues, + + editType: 'calc', + + }, + diverging: { + valType: 'colorscale', + dflt: scales.RdBu, + + editType: 'calc', + } - else if(ax.type === 'log') { - ax.tick0 = 0; - var rng = Lib.simpleMap(ax.range, ax.r2l); +}; - if(roughDTick > 0.7) { - // only show powers of 10 - ax.dtick = Math.ceil(roughDTick); - } - else if(Math.abs(rng[1] - rng[0]) < 1) { - // span is less than one power of 10 - var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); +},{"./scales":58}],57:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // ticks on a linear scale, labeled fully - roughDTick = Math.abs(Math.pow(10, rng[1]) - - Math.pow(10, rng[0])) / nt; - base = getBase(10); - ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); - } - else { - // include intermediates between powers of 10, - // labeled with small digits - // ax.dtick = "D2" (show 2 and 5) or "D1" (show all digits) - ax.dtick = (roughDTick > 0.3) ? 'D2' : 'D1'; - } - } - else if(ax.type === 'category') { - 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 { - // auto ticks always start at 0 - ax.tick0 = 0; - base = getBase(10); - ax.dtick = roundDTick(roughDTick, base, roundBase10); - } +'use strict'; - // prevent infinite loops - if(ax.dtick === 0) ax.dtick = 1; +var Lib = _dereq_('../../lib'); +var colorscaleAttrs = _dereq_('./layout_attributes'); +var Template = _dereq_('../../plot_api/plot_template'); - // TODO: this is from log axis histograms with autorange off - if(!isNumeric(ax.dtick) && typeof ax.dtick !== 'string') { - var olddtick = ax.dtick; - ax.dtick = 1; - throw 'ax.dtick error: ' + String(olddtick); +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var colorscaleIn = layoutIn.colorscale; + var colorscaleOut = Template.newContainer(layoutOut, 'colorscale'); + function coerce(attr, dflt) { + return Lib.coerce(colorscaleIn, colorscaleOut, colorscaleAttrs, attr, dflt); } + + coerce('sequential'); + coerce('sequentialminus'); + coerce('diverging'); }; -// after dtick is already known, find tickround = precision -// to display in tick labels -// for numeric ticks, integer # digits after . to round to -// for date ticks, the last date part to show (y,m,d,H,M,S) -// or an integer # digits past seconds -function autoTickRound(ax) { - var dtick = ax.dtick; +},{"../../lib":159,"../../plot_api/plot_template":193,"./layout_attributes":56}],58:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - ax._tickexponent = 0; - if(!isNumeric(dtick) && typeof dtick !== 'string') { - dtick = 1; - } +'use strict'; - if(ax.type === 'category') { - ax._tickround = null; - } - if(ax.type === 'date') { - // If tick0 is unusual, give tickround a bit more information - // not necessarily *all* the information in tick0 though, if it's really odd - // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 - // take off a leading minus (year < 0) and i (intercalary month) so length is consistent - var tick0ms = ax.r2l(ax.tick0), - tick0str = ax.l2r(tick0ms).replace(/(^-|i)/g, ''), - tick0len = tick0str.length; +var tinycolor = _dereq_('tinycolor2'); - if(String(dtick).charAt(0) === 'M') { - // any tick0 more specific than a year: alway show the full date - if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; - // show the month unless ticks are full multiples of a year - 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 { - // tickround is a number of digits of fractional seconds - // of any two adjacent ticks, at least one will have the maximum fractional digits - // of all possible ticks - so take the max. length of tick0 and the next one - var tick1len = ax.l2r(tick0ms + dtick).replace(/^-/, '').length; - ax._tickround = Math.max(tick0len, tick1len) - 20; +var scales = { + 'Greys': [ + [0, 'rgb(0,0,0)'], [1, 'rgb(255,255,255)'] + ], - // We shouldn't get here... but in case there's a situation I'm - // not thinking of where tick0str and tick1str are identical or - // something, fall back on maximum precision - if(ax._tickround < 0) ax._tickround = 4; - } - } - else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { - // linear or log (except D1, D2) - var rng = ax.range.map(ax.r2d || Number); - if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); - // 2 digits past largest digit of dtick - ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); + '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)'] + ], - var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); + '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)'] + ], - var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { - if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { - ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); - } - else ax._tickexponent = rangeexp; - } - } - // D1 or D2 (log) - else ax._tickround = null; -} + '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)'] + ], -// months and years don't have constant millisecond values -// (but a year is always 12 months so we only need months) -// log-scale ticks are also not consistently spaced, except -// for pure powers of 10 -// numeric ticks always have constant differences, other datetime ticks -// can all be calculated as constant number of milliseconds -axes.tickIncrement = function(x, dtick, axrev, calendar) { - var axSign = axrev ? -1 : 1; + 'Bluered': [ + [0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)'] + ], - // includes linear, all dates smaller than month, and pure 10^n in log - if(isNumeric(dtick)) return x + axSign * dtick; + // modified RdBu based on + // www.sandia.gov/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf + '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)'] + ], - // everything else is a string, one character plus a number - var tType = dtick.charAt(0), - dtSigned = axSign * Number(dtick.substr(1)); + // 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)'] + ], - // Dates: months (or years - see Lib.incrementMonth) - if(tType === 'M') return Lib.incrementMonth(x, dtSigned, calendar); + // 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)'] + ], - // Log scales: Linear, Digits - else if(tType === 'L') return Math.log(Math.pow(10, x) + dtSigned) / Math.LN10; + '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)'] + ], - // log10 of 2,5,10, or all digits (logs just have to be - // close enough to round) - else if(tType === 'D') { - var tickset = (dtick === 'D2') ? roundLog2 : roundLog1, - x2 = x + axSign * 0.01, - frac = Lib.roundUp(Lib.mod(x2, 1), tickset, axrev); + '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)'] + ], - return Math.floor(x2) + - Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; - } - else throw 'unrecognized dtick ' + String(dtick); -}; + '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)'] + ], -// calculate the first tick on an axis -axes.tickFirst = function(ax) { - var r2l = ax.r2l || Number, - rng = Lib.simpleMap(ax.range, r2l), - axrev = rng[1] < rng[0], - sRound = axrev ? Math.floor : Math.ceil, - // add a tiny extra bit to make sure we get ticks - // that may have been rounded out - r0 = rng[0] * 1.0001 - rng[1] * 0.0001, - dtick = ax.dtick, - tick0 = r2l(ax.tick0); + '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)'] + ], - if(isNumeric(dtick)) { - var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; + 'Hot': [ + [0, 'rgb(0,0,0)'], [0.3, 'rgb(230,0,0)'], + [0.6, 'rgb(255,210,0)'], [1, 'rgb(255,255,255)'] + ], - // make sure no ticks outside the category list - if(ax.type === 'category') { - tmin = Lib.constrain(tmin, 0, ax._categories.length - 1); - } - return tmin; - } + '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)'] + ], - var tType = dtick.charAt(0), - dtNum = Number(dtick.substr(1)); + '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)'] + ], - // Dates: months (or years) - if(tType === 'M') { - var cnt = 0, - t0 = tick0, - t1, - mult, - newDTick; + '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)'] + ], - // This algorithm should work for *any* nonlinear (but close to linear!) - // tick spacing. Limit to 10 iterations, for gregorian months it's normally <=3. - while(cnt < 10) { - t1 = axes.tickIncrement(t0, dtick, axrev, ax.calendar); - if((t1 - r0) * (t0 - r0) <= 0) { - // t1 and t0 are on opposite sides of r0! we've succeeded! - if(axrev) return Math.min(t0, t1); - return Math.max(t0, t1); - } - mult = (r0 - ((t0 + t1) / 2)) / (t1 - t0); - newDTick = tType + ((Math.abs(Math.round(mult)) || 1) * dtNum); - t0 = axes.tickIncrement(t0, newDTick, mult < 0 ? !axrev : axrev, ax.calendar); - cnt++; + '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.000000, '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.000000, '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; } - Lib.error('tickFirst did not converge', ax); - return t0; } - // Log scales: Linear, Digits - else if(tType === 'L') { - return Math.log(sRound( - (Math.pow(10, r0) - tick0) / dtNum) * dtNum + tick0) / Math.LN10; + if(typeof scl === 'string') { + parseScale(); + // occasionally scl is double-JSON encoded... + if(typeof scl === 'string') parseScale(); } - else if(tType === 'D') { - var tickset = (dtick === 'D2') ? roundLog2 : roundLog1, - frac = Lib.roundUp(Lib.mod(r0, 1), tickset, axrev); - return Math.floor(r0) + - Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; - } - else throw 'unrecognized dtick ' + String(dtick); -}; + if(!isValidScaleArray(scl)) return dflt; + return scl; +} -// draw the text for one tick. -// px,py are the location on gd.paper -// prefix is there so the x axis ticks can be dropped a line -// ax is the axis layout, x is the tick value -// hover is a (truthy) flag for whether to show numbers with a bit -// more precision for hovertext -axes.tickText = function(ax, x, hover) { - var out = tickTextObj(ax, x), - hideexp, - arrayMode = ax.tickmode === 'array', - extraPrecision = hover || arrayMode, - i, - tickVal2l = ax.type === 'category' ? ax.d2l_noadd : ax.d2l; - if(arrayMode && Array.isArray(ax.ticktext)) { - var rng = Lib.simpleMap(ax.range, ax.r2l), - minDiff = Math.abs(rng[1] - rng[0]) / 10000; - 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]); - return out; - } - } +function isValidScaleArray(scl) { + var highestVal = 0; - function isHidden(showAttr) { - var first_or_last; + if(!Array.isArray(scl) || scl.length < 2) return false; - if(showAttr === undefined) return true; - if(hover) return showAttr === 'none'; + if(!scl[0] || !scl[scl.length - 1]) return false; - first_or_last = { - first: ax._tmin, - last: ax._tmax - }[showAttr]; + if(+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false; - return showAttr !== 'all' && x !== first_or_last; - } + for(var i = 0; i < scl.length; i++) { + var si = scl[i]; - if(hover) { - hideexp = 'never'; - } else { - hideexp = ax.exponentformat !== 'none' && isHidden(ax.showexponent) ? 'hide' : ''; + if(si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) { + return false; + } + + highestVal = +si[0]; } - if(ax.type === 'date') formatDate(ax, out, hover, extraPrecision); - else if(ax.type === 'log') formatLog(ax, out, hover, extraPrecision, hideexp); - else if(ax.type === 'category') formatCategory(ax, out); - else if(isAngular(ax)) formatAngle(ax, out, hover, extraPrecision, hideexp); - else formatLinear(ax, out, hover, extraPrecision, hideexp); + return true; +} - // add prefix and suffix - if(ax.tickprefix && !isHidden(ax.showtickprefix)) out.text = ax.tickprefix + out.text; - if(ax.ticksuffix && !isHidden(ax.showticksuffix)) out.text += ax.ticksuffix; +function isValidScale(scl) { + if(scales[scl] !== undefined) return true; + else return isValidScaleArray(scl); +} - return out; +module.exports = { + scales: scales, + defaultScale: defaultScale, + + get: getScale, + isValid: isValidScale }; +},{"tinycolor2":26}],59:[function(_dereq_,module,exports){ /** - * create text for a hover label on this axis, with special handling of - * log axes (where negative values can't be displayed but can appear in hover text) - * - * @param {object} ax: the axis to format text for - * @param {number} val: calcdata value to format - * @param {Optional(number)} val2: a second value to display - * - * @returns {string} `val` formatted as a string appropriate to this axis, or - * `val` and `val2` as a range (ie ' - ') if `val2` is provided and - * it's different from `val`. - */ -axes.hoverLabelText = function(ax, val, val2) { - if(val2 !== BADNUM && val2 !== val) { - return axes.hoverLabelText(ax, val) + ' - ' + axes.hoverLabelText(ax, val2); - } +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - 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; - } +'use strict'; - // TODO: should we do something special if the axis calendar and - // the data calendar are different? Somehow display both dates with - // their system names? Right now it will just display in the axis calendar - // but users could add the other one as text. - return tx; + +// for automatic alignment on dragging, <1/3 means left align, +// >2/3 means right, and between is center. Pick the right fraction +// based on where you are, and return the fraction corresponding to +// that position on the object +module.exports = function align(v, dv, v0, v1, anchor) { + var vmin = (v - v0) / (v1 - v0); + var vmax = vmin + dv / (v1 - v0); + var vc = (vmin + vmax) / 2; + + // explicitly specified anchor + if(anchor === 'left' || anchor === 'bottom') return vmin; + if(anchor === 'center' || anchor === 'middle') return vc; + if(anchor === 'right' || anchor === 'top') return vmax; + + // automatic based on position + if(vmin < (2 / 3) - vc) return vmin; + if(vmax > (4 / 3) - vc) return vmax; + return vc; }; -function tickTextObj(ax, x, text) { - var tf = ax.tickfont || {}; +},{}],60:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return { - x: x, - dx: 0, - dy: 0, - text: text || '', - fontSize: tf.size, - font: tf.family, - fontColor: tf.color - }; -} -function formatDate(ax, out, hover, extraPrecision) { - var tr = ax._tickround, - fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax); +'use strict'; - if(extraPrecision) { - // second or sub-second precision: extra always shows max digits. - // for other fields, extra precision just adds one field. - if(isNumeric(tr)) tr = 4; - else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 4}[tr]; - } +var Lib = _dereq_('../../lib'); - var dateStr = Lib.formatDate(out.x, fmt, tr, ax._dateFormat, ax.calendar, ax._extraFormat), - headStr; - var splitIndex = dateStr.indexOf('\n'); - if(splitIndex !== -1) { - headStr = dateStr.substr(splitIndex + 1); - dateStr = dateStr.substr(0, splitIndex); - } +// set cursors pointing toward the closest corner/side, +// to indicate alignment +// x and y are 0-1, fractions of the plot area +var cursorset = [ + ['sw-resize', 's-resize', 'se-resize'], + ['w-resize', 'move', 'e-resize'], + ['nw-resize', 'n-resize', 'ne-resize'] +]; - if(extraPrecision) { - // if extraPrecision led to trailing zeros, strip them off - // actually, this can lead to removing even more zeros than - // in the original rounding, but that's fine because in these - // contexts uniformity is not so important (if there's even - // anything to be uniform with!) +module.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); - // can we remove the whole time part? - if(dateStr === '00:00:00' || dateStr === '00:00') { - dateStr = headStr; - headStr = ''; - } - else if(dateStr.length === 8) { - // strip off seconds if they're zero (zero fractional seconds - // are already omitted) - // but we never remove minutes and leave just hours - dateStr = dateStr.replace(/:00$/, ''); - } - } + 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); - if(headStr) { - if(hover) { - // hover puts it all on one line, so headPart works best up front - // except for year headPart: turn this into "Jan 1, 2000" etc. - if(tr === 'd') dateStr += ', ' + headStr; - else dateStr = headStr + (dateStr ? ', ' + dateStr : ''); - } - else if(!ax._inCalcTicks || (headStr !== ax._prevDateHead)) { - dateStr += '
' + headStr; - ax._prevDateHead = headStr; - } - } + return cursorset[y][x]; +}; - out.text = dateStr; -} +},{"../../lib":159}],61:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; -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); +var mouseOffset = _dereq_('mouse-event-offset'); +var hasHover = _dereq_('has-hover'); +var supportsPassive = _dereq_('has-passive-events'); - if(hideexp === 'never') { - // If this is a hover label, then we must *never* hide the exponent - // for the sake of display, which could give the wrong value by - // potentially many orders of magnitude. If hideexp was 'never', then - // it's now succeeded by preventing the other condition from automating - // this choice. Thus we can unset it so that the axis formatting takes - // precedence. - hideexp = ''; - } +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); - if(extraPrecision && (dtChar0 !== 'L')) { - dtick = 'L3'; - dtChar0 = 'L'; - } +var constants = _dereq_('../../plots/cartesian/constants'); +var interactConstants = _dereq_('../../constants/interactions'); - 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 + ''; +var dragElement = module.exports = {}; - 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); +dragElement.align = _dereq_('./align'); +dragElement.getCursor = _dereq_('./cursor'); - // if 9's are printed on log scale, move the 10's away a bit - 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); - } - } - } -} +var unhover = _dereq_('./unhover'); +dragElement.unhover = unhover.wrapped; +dragElement.unhoverRaw = unhover.raw; -function formatCategory(ax, out) { - var tt = ax._categories[Math.round(out.x)]; - if(tt === undefined) tt = ''; - out.text = String(tt); -} -function formatLinear(ax, out, hover, extraPrecision, hideexp) { - if(hideexp === 'never') { - // If this is a hover label, then we must *never* hide the exponent - // for the sake of display, which could give the wrong value by - // potentially many orders of magnitude. If hideexp was 'never', then - // it's now succeeded by preventing the other condition from automating - // this choice. Thus we can unset it so that the axis formatting takes - // precedence. - hideexp = ''; - } else if(ax.showexponent === 'all' && Math.abs(out.x / ax.dtick) < 1e-6) { - // don't add an exponent to zero if we're showing all exponents - // so the only reason you'd show an exponent on zero is if it's the - // ONLY tick to get an exponent (first or last) - hideexp = 'hide'; - } - out.text = numFormat(out.x, ax, hideexp, extraPrecision); -} +/** + * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * + * If the user executes a drag bigger than MINDRAG, callbacks will fire as: + * prepFn, moveFn (1 or more times), doneFn + * If the user does not drag enough, prepFn and clickFn will fire. + * + * Note: If you cancel contextmenu, clickFn will fire even with a right click + * (unlike native events) so you'll get a `plotly_click` event. Cancel context eg: + * gd.addEventListener('contextmenu', function(e) { e.preventDefault(); }); + * TODO: we should probably turn this into a `config` parameter, so we can fix it + * such that if you *don't* cancel contextmenu, we can prevent partial drags, which + * put you in a weird state. + * + * If the user clicks multiple times quickly, clickFn will fire each time + * but numClicks will increase to help you recognize doubleclicks. + * + * @param {object} options with keys: + * element (required) the DOM element to drag + * prepFn (optional) function(event, startX, startY) + * executed on mousedown + * startX and startY are the clientX and clientY pixel position + * of the mousedown event + * moveFn (optional) function(dx, dy) + * executed on move, ONLY after we've exceeded MINDRAG + * (we keep executing moveFn if you move back to where you started) + * dx and dy are the net pixel offset of the drag, + * dragged is true/false, has the mouse moved enough to + * constitute a drag + * doneFn (optional) function(e) + * executed on mouseup, ONLY if we exceeded MINDRAG (so you can be + * sure that moveFn has been called at least once) + * numClicks is how many clicks we've registered within + * a doubleclick time + * e is the original mouseup event + * clickFn (optional) function(numClicks, e) + * executed on mouseup if we have NOT exceeded MINDRAG (ie moveFn + * has not been called at all) + * numClicks is how many clicks we've registered within + * a doubleclick time + * e is the original mousedown event + * clampFn (optional, function(dx, dy) return [dx2, dy2]) + * Provide custom clamping function for small displacements. + * By default, clamping is done using `minDrag` to x and y displacements + * independently. + */ +dragElement.init = function init(options) { + var gd = options.gd; + var numClicks = 1; + var DBLCLICKDELAY = interactConstants.DBLCLICKDELAY; + var element = options.element; -function formatAngle(ax, out, hover, extraPrecision, hideexp) { - if(ax.thetaunit === 'radians' && !hover) { - var num = out.x / 180; + var startX, + startY, + newMouseDownTime, + cursor, + dragCover, + initialEvent, + initialTarget, + rightClick; - if(num === 0) { - out.text = '0'; - } else { - var frac = num2frac(num); + if(!gd._mouseDownTime) gd._mouseDownTime = 0; - if(frac[1] >= 100) { - out.text = numFormat(Lib.deg2rad(out.x), ax, hideexp, extraPrecision); - } else { - var isNeg = out.x < 0; + element.style.pointerEvents = 'all'; - if(frac[1] === 1) { - if(frac[0] === 1) out.text = 'π'; - else out.text = frac[0] + 'π'; - } else { - out.text = [ - '', frac[0], '', - '⁄', - '', frac[1], '', - 'π' - ].join(''); - } + element.onmousedown = onStart; - if(isNeg) out.text = MINUS_SIGN + out.text; - } + if(!supportsPassive) { + element.ontouchstart = onStart; + } + else { + if(element._ontouchstart) { + element.removeEventListener('touchstart', element._ontouchstart); } - } else { - out.text = numFormat(out.x, ax, hideexp, extraPrecision); + element._ontouchstart = onStart; + element.addEventListener('touchstart', onStart, {passive: false}); } -} -// inspired by -// https://github.com/yisibl/num2fraction/blob/master/index.js -function num2frac(num) { - function almostEq(a, b) { - return Math.abs(a - b) <= 1e-6; + function _clampFn(dx, dy, minDrag) { + if(Math.abs(dx) < minDrag) dx = 0; + if(Math.abs(dy) < minDrag) dy = 0; + return [dx, dy]; } - function findGCD(a, b) { - return almostEq(b, 0) ? a : findGCD(b, a % b); - } + var clampFn = options.clampFn || _clampFn; - function findPrecision(n) { - var e = 1; - while(!almostEq(Math.round(n * e) / e, n)) { - e *= 10; - } - return e; - } + function onStart(e) { + // make dragging and dragged into properties of gd + // so that others can look at and modify them + gd._dragged = false; + gd._dragging = true; + var offset = pointerOffset(e); + startX = offset[0]; + startY = offset[1]; + initialTarget = e.target; + initialEvent = e; + rightClick = e.buttons === 2 || e.ctrlKey; - var precision = findPrecision(num); - var number = num * precision; - var gcd = Math.abs(findGCD(number, precision)); + // fix Fx.hover for touch events + if(typeof e.clientX === 'undefined' && typeof e.clientY === 'undefined') { + e.clientX = startX; + e.clientY = startY; + } - return [ - // numerator - Math.round(number / gcd), - // denominator - Math.round(precision / gcd) - ]; -} + newMouseDownTime = (new Date()).getTime(); + if(newMouseDownTime - gd._mouseDownTime < DBLCLICKDELAY) { + // in a click train + numClicks += 1; + } + else { + // new click train + numClicks = 1; + gd._mouseDownTime = newMouseDownTime; + } -// format a number (tick value) according to the axis settings -// new, more reliable procedure than d3.round or similar: -// add half the rounding increment, then stringify and truncate -// also automatically switch to sci. notation -var SIPREFIXES = ['f', 'p', 'n', 'μ', 'm', '', 'k', 'M', 'G', 'T']; + if(options.prepFn) options.prepFn(e, startX, startY); -function isSIFormat(exponentFormat) { - return exponentFormat === 'SI' || exponentFormat === 'B'; -} + if(hasHover && !rightClick) { + dragCover = coverSlip(); + dragCover.style.cursor = window.getComputedStyle(element).cursor; + } + else if(!hasHover) { + // document acts as a dragcover for mobile, bc we can't create dragcover dynamically + dragCover = document; + cursor = window.getComputedStyle(document.documentElement).cursor; + document.documentElement.style.cursor = window.getComputedStyle(element).cursor; + } -// are we beyond the range of common SI prefixes? -// 10^-16 -> 1x10^-16 -// 10^-15 -> 1f -// ... -// 10^14 -> 100T -// 10^15 -> 1x10^15 -// 10^16 -> 1x10^16 -function beyondSI(exponent) { - return exponent > 14 || exponent < -15; -} + document.addEventListener('mouseup', onDone); + document.addEventListener('touchend', onDone); -function numFormat(v, ax, fmtoverride, hover) { - // negative? - var isNeg = v < 0, - // max number of digits past decimal point to show - tickRound = ax._tickround, - exponentFormat = fmtoverride || ax.exponentformat || 'B', - exponent = ax._tickexponent, - tickformat = axes.getTickFormat(ax), - separatethousands = ax.separatethousands; + if(options.dragmode !== false) { + e.preventDefault(); + document.addEventListener('mousemove', onMove); + document.addEventListener('touchmove', onMove); + } - // special case for hover: set exponent just for this value, and - // add a couple more digits of precision over tick labels - if(hover) { - // make a dummy axis obj to get the auto rounding and exponent - var ah = { - exponentformat: exponentFormat, - 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(ah); - tickRound = (Number(ah._tickround) || 0) + 4; - exponent = ah._tickexponent; - if(ax.hoverformat) tickformat = ax.hoverformat; + return; } - if(tickformat) return ax._numFormat(tickformat)(v).replace(/-/g, MINUS_SIGN); - - // 'epsilon' - rounding increment - var e = Math.pow(10, -tickRound) / 2; + function onMove(e) { + e.preventDefault(); - // exponentFormat codes: - // 'e' (1.2e+6, default) - // 'E' (1.2E+6) - // 'SI' (1.2M) - // 'B' (same as SI except 10^9=B not G) - // 'none' (1200000) - // 'power' (1.2x10^6) - // 'hide' (1.2, use 3rd argument=='hide' to eg - // only show exponent on last tick) - if(exponentFormat === 'none') exponent = 0; + 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]; - // take the sign out, put it back manually at the end - // - makes cases easier - v = Math.abs(v); - if(v < e) { - // 0 is just 0, but may get exponent if it's the last tick - v = '0'; - isNeg = false; - } - else { - v += e; - // take out a common exponent, if any - if(exponent) { - v *= Math.pow(10, -exponent); - tickRound += exponent; - } - // round the mantissa - 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 dp = v.indexOf('.') + 1; - if(dp) v = v.substr(0, dp + tickRound).replace(/\.?0+$/, ''); + if(dx || dy) { + gd._dragged = true; + dragElement.unhover(gd); } - // insert appropriate decimal point and thousands separator - v = Lib.numSeparate(v, ax._separators, separatethousands); - } - // add exponent - if(exponent && exponentFormat !== 'hide') { - if(isSIFormat(exponentFormat) && beyondSI(exponent)) exponentFormat = 'power'; + if(gd._dragged && options.moveFn && !rightClick) options.moveFn(dx, dy); - var signedExponent; - if(exponent < 0) signedExponent = MINUS_SIGN + -exponent; - else if(exponentFormat !== 'power') signedExponent = '+' + exponent; - else signedExponent = String(exponent); + return; + } - if(exponentFormat === 'e' || exponentFormat === 'E') { - v += exponentFormat + signedExponent; + function onDone(e) { + if(options.dragmode !== false) { + e.preventDefault(); + document.removeEventListener('mousemove', onMove); + document.removeEventListener('touchmove', onMove); } - else if(exponentFormat === 'power') { - v += '×10' + signedExponent + ''; + + document.removeEventListener('mouseup', onDone); + document.removeEventListener('touchend', onDone); + + if(hasHover) { + Lib.removeElement(dragCover); } - else if(exponentFormat === 'B' && exponent === 9) { - v += 'B'; + else if(cursor) { + dragCover.documentElement.style.cursor = cursor; + cursor = null; } - else if(isSIFormat(exponentFormat)) { - v += SIPREFIXES[exponent / 3 + 5]; + + if(!gd._dragging) { + gd._dragged = false; + return; } - } + gd._dragging = false; - // put sign back in and return - // replace standard minus character (which is technically a hyphen) - // with a true minus sign - if(isNeg) return MINUS_SIGN + v; - return v; -} + // don't count as a dblClick unless the mouseUp is also within + // the dblclick delay + if((new Date()).getTime() - gd._mouseDownTime > DBLCLICKDELAY) { + numClicks = Math.max(numClicks - 1, 1); + } -axes.getTickFormat = function(ax) { - var i; + if(gd._dragged) { + if(options.doneFn) options.doneFn(); + } + else { + if(options.clickFn) options.clickFn(numClicks, initialEvent); - function convertToMs(dtick) { - return typeof dtick !== 'string' ? dtick : Number(dtick.replace('M', '')) * ONEAVGMONTH; - } + // If we haven't dragged, this should be a click. But because of the + // coverSlip changing the element, the natural system might not generate one, + // so we need to make our own. But right clicks don't normally generate + // click events, only contextmenu events, which happen on mousedown. + if(!rightClick) { + var e2; - 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; + 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); } - } 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)); - } + finishDrag(gd); - 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); - } + gd._dragged = false; - 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; } - return tickstop ? tickstop.value : ax.tickformat; }; -// getSubplots - extract all subplot IDs we need -// as an array of items like 'xy', 'x2y', 'x2y2'... -// sorted by x (x,x2,x3...) then y -// optionally restrict to only subplots containing axis object ax -axes.getSubplots = function(gd, ax) { - var subplotObj = gd._fullLayout._subplots; - var allSubplots = subplotObj.cartesian.concat(subplotObj.gl2d || []); +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'; - var out = ax ? axes.findSubplotsWithAxis(allSubplots, ax) : allSubplots; + document.body.appendChild(cover); - out.sort(function(a, b) { - var aParts = a.substr(1).split('y'); - var bParts = b.substr(1).split('y'); + return cover; +} - if(aParts[0] === bParts[0]) return +aParts[1] - +bParts[1]; - return +aParts[0] - +bParts[0]; - }); +dragElement.coverSlip = coverSlip; - return out; -}; +function finishDrag(gd) { + gd._dragging = false; + if(gd._replotPending) Registry.call('plot', gd); +} -// find all subplots with axis 'ax' -axes.findSubplotsWithAxis = function(subplots, ax) { - var axMatch = new RegExp( - (ax._id.charAt(0) === 'x') ? ('^' + ax._id + 'y') : (ax._id + '$') +function pointerOffset(e) { + return mouseOffset( + e.changedTouches ? e.changedTouches[0] : e, + document.body ); - var subplotsWithAxis = []; +} - for(var i = 0; i < subplots.length; i++) { - var sp = subplots[i]; - if(axMatch.test(sp)) subplotsWithAxis.push(sp); - } +},{"../../constants/interactions":139,"../../lib":159,"../../plots/cartesian/constants":209,"../../registry":243,"./align":59,"./cursor":60,"./unhover":62,"has-hover":12,"has-passive-events":13,"mouse-event-offset":16}],62:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return subplotsWithAxis; -}; -// makeClipPaths: prepare clipPaths for all single axes and all possible xy pairings -axes.makeClipPaths = function(gd) { - var fullLayout = gd._fullLayout; +'use strict'; - // for more info: https://github.com/plotly/plotly.js/issues/2595 - if(fullLayout._hasOnlyLargeSploms) return; - var fullWidth = {_offset: 0, _length: fullLayout.width, _id: ''}; - var fullHeight = {_offset: 0, _length: fullLayout.height, _id: ''}; - var xaList = axes.list(gd, 'x', true); - var yaList = axes.list(gd, 'y', true); - var clipList = []; - var i, j; +var Events = _dereq_('../../lib/events'); +var throttle = _dereq_('../../lib/throttle'); +var getGraphDiv = _dereq_('../../lib/get_graph_div'); - 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 hoverConstants = _dereq_('../fx/constants'); - // selectors don't work right with camelCase tags, - // have to use class instead - // https://groups.google.com/forum/#!topic/d3-js/6EpAzQ2gU9I - var axClips = fullLayout._clips.selectAll('.axesclip') - .data(clipList, function(d) { return d.x._id + d.y._id; }); +var unhover = module.exports = {}; - 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(); +unhover.wrapped = function(gd, evt, subplot) { + gd = getGraphDiv(gd); - 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 - }); - }); + // Important, clear any queued hovers + if(gd._fullLayout) { + throttle.clear(gd._fullLayout._uid + hoverConstants.HOVERID); + } + + unhover.raw(gd, evt, subplot); }; -/** - * Main multi-axis drawing routine! - * - * @param {DOM element} gd : graph div - * @param {string or array of strings} arg : polymorphic argument - * @param {boolean} skipTitle : optional flag to skip axis title draw/update - * - * Signature 1: Axes.doTicks(gd, 'redraw') - * use this to clear and redraw all axes on graph - * - * Signature 2: Axes.doTicks(gd, '') - * use this to draw all axes on graph w/o the selectAll().remove() - * of the 'redraw' signature - * - * Signature 3: Axes.doTicks(gd, [axId, axId2, ...]) - * where the items are axis id string, - * use this to update multiple axes in one call - * - * N.B doTicks updates: - * - ax._r (stored range for use by zoom/pan) - * - ax._rl (stored linearized range for use by zoom/pan) - */ -axes.doTicks = function(gd, arg, skipTitle) { + +// remove hover effects on mouse out, and emit unhover event +unhover.raw = function unhoverRaw(gd, evt) { var fullLayout = gd._fullLayout; + var oldhoverdata = gd._hoverdata; - if(arg === 'redraw') { - fullLayout._paper.selectAll('g.subplot').each(function(d) { - var id = d[0]; - var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(!evt) evt = {}; + if(evt.target && + Events.triggerHandler(gd, 'plotly_beforehover', evt) === false) { + return; + } - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._hoverlayer.selectAll('g').remove(); + fullLayout._hoverlayer.selectAll('line').remove(); + fullLayout._hoverlayer.selectAll('circle').remove(); + gd._hoverdata = undefined; + + if(evt.target && oldhoverdata) { + gd.emit('plotly_unhover', { + event: evt, + points: oldhoverdata }); } +}; - var axList = (!arg || arg === 'redraw') ? axes.listIds(gd) : arg; - - Lib.syncOrAsync(axList.map(function(axid) { - return function() { - if(!axid) return; +},{"../../lib/events":152,"../../lib/get_graph_div":157,"../../lib/throttle":181,"../fx/constants":76}],63:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var axDone = axes.doTicksSingle(gd, axid, skipTitle); - var ax = axes.getFromId(gd, axid); - ax._r = ax.range.slice(); - ax._rl = Lib.simpleMap(ax._r, ax.r2l); +'use strict'; - return axDone; - }; - })); +exports.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', + }; +},{}],64:[function(_dereq_,module,exports){ /** - * Per-axis drawing routine! - * - * This routine draws axis ticks and much more (... grids, labels, title etc.) - * Supports multiple argument signatures. - * N.B. this thing is async in general (because of MathJax rendering) - * - * @param {DOM element} gd : graph div - * @param {string or object} arg : polymorphic argument - * @param {boolean} skipTitle : optional flag to skip axis title draw/update - * @return {promise} - * - * Signature 1: Axes.doTicks(gd, ax) - * where ax is an axis object as in fullLayout - * - * Signature 2: Axes.doTicks(gd, axId) - * where axId is a axis id string - */ -axes.doTicksSingle = function(gd, arg, skipTitle) { - var fullLayout = gd._fullLayout; - var independent = false; - var ax; +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(Lib.isPlainObject(arg)) { - ax = arg; - independent = true; - } else { - ax = axes.getFromId(gd, arg); - } - // set scaling to pixels - ax.setScale(); +'use strict'; - var axid = ax._id; - var axLetter = axid.charAt(0); - var counterLetter = axes.counterLetter(axid); - var vals = ax._vals = axes.calcTicks(ax); - var datafn = function(d) { return [d.text, d.x, ax.mirror, d.font, d.fontSize, d.fontColor].join('_'); }; - var tcls = axid + 'tick'; - var gcls = axid + 'grid'; - var zcls = axid + 'zl'; - var pad = (ax.linewidth || 1) / 2; - var labelStandoff = (ax.ticks === 'outside' ? ax.ticklen : 0); - var labelShift = 0; - var gridWidth = Drawing.crispRound(gd, ax.gridwidth, 1); - var zeroLineWidth = Drawing.crispRound(gd, ax.zerolinewidth, gridWidth); - var tickWidth = Drawing.crispRound(gd, ax.tickwidth, 1); - var sides, transfn, tickpathfn, subplots; - var tickLabels; - var i; +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); +var tinycolor = _dereq_('tinycolor2'); - if(ax._counterangle && ax.ticks === 'outside') { - var caRad = ax._counterangle * Math.PI / 180; - labelStandoff = ax.ticklen * Math.cos(caRad) + 1; - labelShift = ax.ticklen * Math.sin(caRad); - } +var Registry = _dereq_('../../registry'); +var Color = _dereq_('../color'); +var Colorscale = _dereq_('../colorscale'); +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); - if(ax.showticklabels && (ax.ticks === 'outside' || ax.showline)) { - labelStandoff += 0.2 * ax.tickfont.size; - } +var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); +var alignment = _dereq_('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; +var DESELECTDIM = _dereq_('../../constants/interactions').DESELECTDIM; - // positioning arguments for x vs y axes - if(axLetter === 'x') { - sides = ['bottom', 'top']; - transfn = ax._transfn || function(d) { - return 'translate(' + (ax._offset + ax.l2p(d.x)) + ',0)'; - }; - tickpathfn = function(shift, len) { - if(ax._counterangle) { - var caRad = ax._counterangle * Math.PI / 180; - return 'M0,' + shift + 'l' + (Math.sin(caRad) * len) + ',' + (Math.cos(caRad) * len); - } - else return 'M0,' + shift + 'v' + len; - }; - } - else if(axLetter === 'y') { - sides = ['left', 'right']; - transfn = ax._transfn || function(d) { - return 'translate(0,' + (ax._offset + ax.l2p(d.x)) + ')'; - }; - tickpathfn = function(shift, len) { - if(ax._counterangle) { - var caRad = ax._counterangle * Math.PI / 180; - return 'M' + shift + ',0l' + (Math.cos(caRad) * len) + ',' + (-Math.sin(caRad) * len); - } - else return 'M' + shift + ',0h' + len; - }; - } - else if(isAngular(ax)) { - sides = ['left', 'right']; - transfn = ax._transfn; - tickpathfn = function(shift, len) { - return 'M' + shift + ',0h' + len; - }; - } - else { - Lib.warn('Unrecognized doTicks axis:', axid); - return; - } +var subTypes = _dereq_('../../traces/scatter/subtypes'); +var makeBubbleSizeFn = _dereq_('../../traces/scatter/make_bubble_size_func'); - var axside = ax.side || sides[0]; - // which direction do the side[0], side[1], and free ticks go? - // then we flip if outside XOR y axis - var ticksign = [-1, 1, axside === sides[1] ? 1 : -1]; - if((ax.ticks !== 'inside') === (axLetter === 'x')) { - ticksign = ticksign.map(function(v) { return -v; }); - } +var drawing = module.exports = {}; - if(!ax.visible) return; +// ----------------------------------------------------- +// styling functions for plot elements +// ----------------------------------------------------- - if(ax._tickFilter) { - vals = vals.filter(ax._tickFilter); +drawing.font = function(s, family, size, color) { + // also allow the form font(s, {family, size, color}) + if(Lib.isPlainObject(family)) { + color = family.color; + size = family.size; + family = family.family; } + if(family) s.style('font-family', family); + if(size + 1) s.style('font-size', size + 'px'); + if(color) s.call(Color.fill, color); +}; - // Remove zero lines, grid lines, and inside ticks if they're within - // 1 pixel of the end. - // The key case here is removing zero lines when the axis bound is zero. - // Don't clip angular values. - var valsClipped = ax._valsClipped = isAngular(ax) ? - vals : - vals.filter(function(d) { return clipEnds(ax, d.x); }); - - function drawTicks(container, tickpath) { - var ticks = container.selectAll('path.' + tcls) - .data(ax.ticks === 'inside' ? valsClipped : vals, datafn); - - if(tickpath && ax.ticks) { - ticks.enter().append('path').classed(tcls, 1).classed('ticks', 1) - .classed('crisp', 1) - .call(Color.stroke, ax.tickcolor) - .style('stroke-width', tickWidth + 'px') - .attr('d', tickpath); - ticks.attr('transform', transfn); - ticks.exit().remove(); - } - else ticks.remove(); - } - - function drawLabels(container, position) { - // tick labels - for now just the main labels. - // TODO: mirror labels, esp for subplots - tickLabels = container.selectAll('g.' + tcls).data(vals, datafn); - - if(!isNumeric(position)) { - tickLabels.remove(); - drawAxTitle(); - return; - } - if(!ax.showticklabels) { - tickLabels.remove(); - drawAxTitle(); - calcBoundingBox(); - return; - } - - var labelx, labely, labelanchor, labelpos0, flipit; - if(axLetter === 'x') { - flipit = (axside === 'bottom') ? 1 : -1; - labelx = function(d) { return d.dx + labelShift * flipit; }; - labelpos0 = position + (labelStandoff + pad) * flipit; - labely = function(d) { - return d.dy + labelpos0 + d.fontSize * - ((axside === 'bottom') ? 1 : -0.2); - }; - labelanchor = function(angle) { - if(!isNumeric(angle) || angle === 0 || angle === 180) { - return 'middle'; - } - return (angle * flipit < 0) ? 'end' : 'start'; - }; - } - else if(axLetter === 'y') { - flipit = (axside === 'right') ? 1 : -1; - labely = function(d) { - return d.dy + d.fontSize * MID_SHIFT - labelShift * flipit; - }; - labelx = function(d) { - return d.dx + position + (labelStandoff + pad + - ((Math.abs(ax.tickangle) === 90) ? d.fontSize / 2 : 0)) * flipit; - }; - labelanchor = function(angle) { - if(isNumeric(angle) && Math.abs(angle) === 90) { - return 'middle'; - } - return axside === 'right' ? 'start' : 'end'; - }; - } - else if(isAngular(ax)) { - ax._labelShift = labelShift; - ax._labelStandoff = labelStandoff; - ax._pad = pad; - - labelx = ax._labelx; - labely = ax._labely; - labelanchor = ax._labelanchor; - } - - var maxFontSize = 0, - autoangle = 0, - labelsReady = []; - tickLabels.enter().append('g').classed(tcls, 1) - .append('text') - // only so tex has predictable alignment that we can - // alter later - .attr('text-anchor', 'middle') - .each(function(d) { - var thisLabel = d3.select(this), - newPromise = gd._promises.length; - thisLabel - .call(svgTextUtils.positionText, labelx(d), labely(d)) - .call(Drawing.font, d.font, d.fontSize, d.fontColor) - .text(d.text) - .call(svgTextUtils.convertToTspans, gd); - newPromise = gd._promises[newPromise]; - if(newPromise) { - // if we have an async label, we'll deal with that - // all here so take it out of gd._promises and - // instead position the label and promise this in - // labelsReady - labelsReady.push(gd._promises.pop().then(function() { - positionLabels(thisLabel, ax.tickangle); - })); - } - else { - // sync label: just position it now. - positionLabels(thisLabel, ax.tickangle); - } - }); - tickLabels.exit().remove(); - - tickLabels.each(function(d) { - maxFontSize = Math.max(maxFontSize, d.fontSize); - }); +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ +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); +}; - if(isAngular(ax)) { - tickLabels.each(function(d) { - d3.select(this).select('text') - .call(svgTextUtils.positionText, labelx(d), labely(d)); - }); - } +/** Translate node + * + * @param {object} d : calcdata point item + * @param {sel} sel : d3 selction of node to translate + * @param {object} xa : corresponding full xaxis object + * @param {object} ya : corresponding full yaxis object + * + * @return {boolean} : + * true if selection got translated + * false if selection could not get translated + */ +drawing.translatePoint = function(d, sel, xa, ya) { + var x = xa.c2p(d.x); + var y = ya.c2p(d.y); - // How much to shift a multi-line label to center it vertically. - function getAnchorHeight(lineCount, lineHeight, angle) { - var h = (lineCount - 1) * lineHeight; - if(axLetter === 'x') { - if(angle < -60 || 60 < angle) { - return -0.5 * h; - } else if(axside === 'top') { - return -h; - } - } else { - angle *= axside === 'left' ? 1 : -1; - if(angle < -30) { - return -h; - } else if(angle < 30) { - return -0.5 * h; - } - } - return 0; - } - - function positionLabels(s, angle) { - s.each(function(d) { - var anchor = labelanchor(angle, d); - var thisLabel = d3.select(this), - mathjaxGroup = thisLabel.select('.text-math-group'), - transform = transfn.call(thisLabel.node(), d) + - ((isNumeric(angle) && +angle !== 0) ? - (' rotate(' + angle + ',' + labelx(d) + ',' + - (labely(d) - d.fontSize / 2) + ')') : - ''); - var anchorHeight = getAnchorHeight( - svgTextUtils.lineCount(thisLabel), - LINE_SPACING * d.fontSize, - isNumeric(angle) ? +angle : 0); - if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; - } - if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ - transform: transform, - 'text-anchor': anchor - }); - } - else { - var mjShift = - Drawing.bBox(mathjaxGroup.node()).width * - {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + - (mjShift ? 'translate(' + mjShift + ',0)' : '')); - } - }); + if(isNumeric(x) && isNumeric(y) && sel.node()) { + // for multiline text this works better + if(sel.node().nodeName === 'text') { + sel.attr('x', x).attr('y', y); + } else { + sel.attr('transform', 'translate(' + x + ',' + y + ')'); } + } else { + return false; + } - // make sure all labels are correctly positioned at their base angle - // the positionLabels call above is only for newly drawn labels. - // do this without waiting, using the last calculated angle to - // minimize flicker, then do it again when we know all labels are - // there, putting back the prescribed angle to check for overlaps. - positionLabels(tickLabels, ax._lastangle || ax.tickangle); - - function allLabelsReady() { - return labelsReady.length && Promise.all(labelsReady); - } - - function fixLabelOverlaps() { - positionLabels(tickLabels, ax.tickangle); - - // check for auto-angling if x labels overlap - // don't auto-angle at all for log axes with - // base and digit format - if(axLetter === 'x' && !isNumeric(ax.tickangle) && - (ax.type !== 'log' || String(ax.dtick).charAt(0) !== 'D')) { - var lbbArray = []; - tickLabels.each(function(d) { - var s = d3.select(this), - thisLabel = s.select('.text-math-group'), - x = ax.l2p(d.x); - if(thisLabel.empty()) thisLabel = s.select('text'); - - var bb = Drawing.bBox(thisLabel.node()); - - 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 - }); - }); - for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { - // any overlap at all - set 30 degrees - autoangle = 30; - break; - } - } - if(autoangle) { - var tickspacing = Math.abs( - (vals[vals.length - 1].x - vals[0].x) * ax._m - ) / (vals.length - 1); - if(tickspacing < maxFontSize * 2.5) { - autoangle = 90; - } - positionLabels(tickLabels, autoangle); - } - ax._lastangle = autoangle; - } - - // update the axis title - // (so it can move out of the way if needed) - // TODO: separate out scoot so we don't need to do - // a full redraw of the title (mostly relevant for MathJax) - drawAxTitle(); - return axid + ' done'; - } + return true; +}; - function calcBoundingBox() { - if(ax.showticklabels) { - var gdBB = gd.getBoundingClientRect(); - var bBox = container.node().getBoundingClientRect(); +drawing.translatePoints = function(s, xa, ya) { + s.each(function(d) { + var sel = d3.select(this); + drawing.translatePoint(d, sel, xa, ya); + }); +}; - /* - * the way we're going to use this, the positioning that matters - * is relative to the origin of gd. This is important particularly - * if gd is scrollable, and may have been scrolled between the time - * we calculate this and the time we use it - */ +drawing.hideOutsideRangePoint = function(d, sel, xa, ya, xcalendar, ycalendar) { + sel.attr( + 'display', + (xa.isPtWithinRange(d, xcalendar) && ya.isPtWithinRange(d, ycalendar)) ? null : 'none' + ); +}; - ax._boundingBox = { - width: bBox.width, - height: bBox.height, - left: bBox.left - gdBB.left, - right: bBox.right - gdBB.left, - top: bBox.top - gdBB.top, - bottom: bBox.bottom - gdBB.top - }; - } else { - var gs = fullLayout._size; - var pos; +drawing.hideOutsideRangePoints = function(traceGroups, subplot) { + if(!subplot._hasClipOnAxisFalse) return; - // set dummy bbox for ticklabel-less axes + var xa = subplot.xaxis; + var ya = subplot.yaxis; - if(axLetter === 'x') { - pos = ax.anchor === 'free' ? - gs.t + gs.h * (1 - ax.position) : - gs.t + gs.h * (1 - ax._anchorAxis.domain[{bottom: 0, top: 1}[ax.side]]); - - ax._boundingBox = { - top: pos, - bottom: pos, - left: ax._offset, - right: ax._offset + ax._length, - width: ax._length, - height: 0 - }; - } else { - pos = ax.anchor === 'free' ? - gs.l + gs.w * ax.position : - gs.l + gs.w * ax._anchorAxis.domain[{left: 0, right: 1}[ax.side]]; - - ax._boundingBox = { - left: pos, - right: pos, - bottom: ax._offset + ax._length, - top: ax._offset, - height: ax._length, - width: 0 - }; - } - } + traceGroups.each(function(d) { + var trace = d[0].trace; + var xcalendar = trace.xcalendar; + var ycalendar = trace.ycalendar; + var selector = trace.type === 'bar' ? '.bartext' : '.point,.textpoint'; - /* - * for spikelines: what's the full domain of positions in the - * opposite direction that are associated with this axis? - * This means any axes that we make a subplot with, plus the - * position of the axis itself if it's free. - */ - if(subplots) { - var fullRange = ax._counterSpan = [Infinity, -Infinity]; + traceGroups.selectAll(selector).each(function(d) { + drawing.hideOutsideRangePoint(d, d3.select(this), xa, ya, xcalendar, ycalendar); + }); + }); +}; - for(i = 0; i < subplots.length; i++) { - var subplot = fullLayout._plots[subplots[i]]; - var counterAxis = subplot[(axLetter === 'x') ? 'yaxis' : 'xaxis']; +drawing.crispRound = function(gd, lineWidth, dflt) { + // for lines that disable antialiasing we want to + // make sure the width is an integer, and at least 1 if it's nonzero - extendRange(fullRange, [ - counterAxis._offset, - counterAxis._offset + counterAxis._length - ]); - } + if(!lineWidth || !isNumeric(lineWidth)) return dflt || 0; - if(ax.anchor === 'free') { - extendRange(fullRange, (axLetter === 'x') ? - [ax._boundingBox.bottom, ax._boundingBox.top] : - [ax._boundingBox.right, ax._boundingBox.left]); - } - } + // but not for static plots - these don't get antialiased anyway. + if(gd._context.staticPlot) return lineWidth; - function extendRange(range, newRange) { - range[0] = Math.min(range[0], newRange[0]); - range[1] = Math.max(range[1], newRange[1]); - } - } + if(lineWidth < 1) return 1; + return Math.round(lineWidth); +}; - function doAutoMargins() { - var pushKey = ax._name + '.automargin'; - if(axLetter !== 'x' && axLetter !== 'y') { return; } - if(!ax.automargin) { - Plots.autoMargin(gd, pushKey); - return; - } +drawing.singleLineStyle = function(d, s, lw, lc, ld) { + s.style('fill', 'none'); + var line = (((d || [])[0] || {}).trace || {}).line || {}; + var lw1 = lw || line.width||0; + var dash = ld || line.dash || ''; - var s = ax.side[0]; - var push = {x: 0, y: 0, r: 0, l: 0, t: 0, b: 0}; + Color.stroke(s, lc || line.color); + drawing.dashLine(s, dash, lw1); +}; - if(axLetter === 'x') { - push.y = (ax.anchor === 'free' ? ax.position : - ax._anchorAxis.domain[s === 't' ? 1 : 0]); - push[s] += ax._boundingBox.height; - } - else { - push.x = (ax.anchor === 'free' ? ax.position : - ax._anchorAxis.domain[s === 'r' ? 1 : 0]); - push[s] += ax._boundingBox.width; - } +drawing.lineGroupStyle = function(s, lw, lc, ld) { + s.style('fill', 'none') + .each(function(d) { + var line = (((d || [])[0] || {}).trace || {}).line || {}; + var lw1 = lw || line.width||0; + var dash = ld || line.dash || ''; - if(ax.title !== fullLayout._dfltTitle[axLetter]) { - push[s] += ax.titlefont.size; - } + d3.select(this) + .call(Color.stroke, lc || line.color) + .call(drawing.dashLine, dash, lw1); + }); +}; - Plots.autoMargin(gd, pushKey, push); - } +drawing.dashLine = function(s, dash, lineWidth) { + lineWidth = +lineWidth || 0; - var done = Lib.syncOrAsync([ - allLabelsReady, - fixLabelOverlaps, - calcBoundingBox, - doAutoMargins - ]); - if(done && done.then) gd._promises.push(done); - return done; - } + dash = drawing.dashStyle(dash, lineWidth); - function drawAxTitle() { - if(skipTitle) return; + s.style({ + 'stroke-dasharray': dash, + 'stroke-width': lineWidth + 'px' + }); +}; - // now this only applies to regular cartesian axes; colorbars and - // others ALWAYS call doTicks with skipTitle=true so they can - // configure their own titles. +drawing.dashStyle = function(dash, lineWidth) { + lineWidth = +lineWidth || 1; + var dlw = Math.max(lineWidth, 3); - // rangeslider takes over a bottom title so drop it here - if(ax.rangeslider && ax.rangeslider.visible && ax._boundingBox && ax.side === 'bottom') return; + 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'; + } + // otherwise user wrote the dasharray themselves - leave it be - var avoid = { - selection: tickLabels, - side: ax.side - }; - var axLetter = axid.charAt(0); - var gs = gd._fullLayout._size; - var offsetBase = 1.5; - var fontSize = ax.titlefont.size; + return dash; +}; - var transform, counterAxis, x, y; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; - if(tickLabels.size()) { - var translation = Drawing.getTranslate(tickLabels.node().parentNode); - avoid.offsetLeft = translation.x; - avoid.offsetTop = translation.y; +drawing.fillGroupStyle = function(s) { + s.style('stroke-width', 0) + .each(function(d) { + var shape = d3.select(this); + // N.B. 'd' won't be a calcdata item when + // fill !== 'none' on a segment-less and marker-less trace + if(d[0].trace) { + shape.call(Color.fill, d[0].trace.fillcolor); } + }); +}; - var titleStandoff = 10 + fontSize * offsetBase + - (ax.linewidth ? ax.linewidth - 1 : 0); +var SYMBOLDEFS = _dereq_('./symbol_defs'); - if(axLetter === 'x') { - counterAxis = (ax.anchor === 'free') ? - {_offset: gs.t + (1 - (ax.position || 0)) * gs.h, _length: 0} : - axisIds.getFromId(gd, ax.anchor); +drawing.symbolNames = []; +drawing.symbolFuncs = []; +drawing.symbolNeedLines = {}; +drawing.symbolNoDot = {}; +drawing.symbolNoFill = {}; +drawing.symbolList = []; - x = ax._offset + ax._length / 2; +Object.keys(SYMBOLDEFS).forEach(function(k) { + var symDef = SYMBOLDEFS[k]; + drawing.symbolList = drawing.symbolList.concat( + [symDef.n, k, symDef.n + 100, k + '-open']); + drawing.symbolNames[symDef.n] = k; + drawing.symbolFuncs[symDef.n] = symDef.f; + if(symDef.needLine) { + drawing.symbolNeedLines[symDef.n] = true; + } + if(symDef.noDot) { + drawing.symbolNoDot[symDef.n] = true; + } + else { + drawing.symbolList = drawing.symbolList.concat( + [symDef.n + 200, k + '-dot', symDef.n + 300, k + '-open-dot']); + } + if(symDef.noFill) { + drawing.symbolNoFill[symDef.n] = true; + } +}); - if(ax.side === 'top') { - y = -titleStandoff - fontSize * (ax.showticklabels ? 1 : 0); - } - else { - y = counterAxis._length + titleStandoff + - fontSize * (ax.showticklabels ? 1.5 : 0.5); - } - y += counterAxis._offset; +var MAXSYMBOL = drawing.symbolNames.length; +// add a dot in the middle of the symbol +var DOTPATH = 'M0,0.5L0.5,0L0,-0.5L-0.5,0Z'; - if(!avoid.side) avoid.side = 'bottom'; +drawing.symbolNumber = function(v) { + if(typeof v === 'string') { + var vbase = 0; + if(v.indexOf('-open') > 0) { + vbase = 100; + v = v.replace('-open', ''); } - else { - counterAxis = (ax.anchor === 'free') ? - {_offset: gs.l + (ax.position || 0) * gs.w, _length: 0} : - axisIds.getFromId(gd, ax.anchor); - - y = ax._offset + ax._length / 2; - if(ax.side === 'right') { - x = counterAxis._length + titleStandoff + - fontSize * (ax.showticklabels ? 1 : 0.5); - } - else { - x = -titleStandoff - fontSize * (ax.showticklabels ? 0.5 : 0); - } - x += counterAxis._offset; - - transform = {rotate: '-90', offset: 0}; - if(!avoid.side) avoid.side = 'left'; + if(v.indexOf('-dot') > 0) { + vbase += 200; + v = v.replace('-dot', ''); } - - Titles.draw(gd, axid + 'title', { - propContainer: ax, - propName: ax._name + '.title', - placeholder: fullLayout._dfltTitle[axLetter], - avoid: avoid, - transform: transform, - attributes: {x: x, y: y, 'text-anchor': 'middle'} - }); + v = drawing.symbolNames.indexOf(v); + if(v >= 0) { v += vbase; } } + if((v % 100 >= MAXSYMBOL) || v >= 400) { return 0; } + return Math.floor(Math.max(v, 0)); +}; + +function makePointPath(symbolNumber, r) { + var base = symbolNumber % 100; + return drawing.symbolFuncs[base](r) + (symbolNumber >= 200 ? DOTPATH : ''); +} + +var HORZGRADIENT = {x1: 1, x2: 0, y1: 0, y2: 0}; +var VERTGRADIENT = {x1: 0, x2: 0, y1: 1, y2: 0}; +var stopFormatter = d3.format('~.1f'); +var gradientInfo = { + radial: {node: 'radialGradient'}, + radialreversed: {node: 'radialGradient', reversed: true}, + horizontal: {node: 'linearGradient', attrs: HORZGRADIENT}, + horizontalreversed: {node: 'linearGradient', attrs: HORZGRADIENT, reversed: true}, + vertical: {node: 'linearGradient', attrs: VERTGRADIENT}, + verticalreversed: {node: 'linearGradient', attrs: VERTGRADIENT, reversed: true} +}; - function drawGrid(plotinfo, counteraxis) { - if(fullLayout._hasOnlyLargeSploms) return; - - var gridcontainer = plotinfo.gridlayer.selectAll('.' + axid); - var zlcontainer = plotinfo.zerolinelayer; - var gridpath = ax._gridpath || ((axLetter === 'x' ? - ('M0,' + counteraxis._offset + 'v') : - ('M' + counteraxis._offset + ',0h') - ) + counteraxis._length); - var grid = gridcontainer.selectAll('path.' + gcls) - .data((ax.showgrid === false) ? [] : valsClipped, datafn); - grid.enter().append('path').classed(gcls, 1) - .classed('crisp', 1) - .attr('d', gridpath) - .each(function(d) { - if(ax.zeroline && (ax.type === 'linear' || ax.type === '-') && - Math.abs(d.x) < ax.dtick / 100) { - d3.select(this).remove(); - } - }); - grid.attr('transform', transfn) - .call(Color.stroke, ax.gridcolor || '#ddd') - .style('stroke-width', gridWidth + 'px'); - if(typeof gridpath === 'function') grid.attr('d', gridpath); - grid.exit().remove(); - - // zero line - if(zlcontainer) { - var zlData = {x: 0, id: axid}; - var showZl = axes.shouldShowZeroLine(gd, ax, counteraxis); - var zl = zlcontainer.selectAll('path.' + zcls) - .data(showZl ? [zlData] : []); - zl.enter().append('path').classed(zcls, 1).classed('zl', 1) - .classed('crisp', 1) - .attr('d', gridpath) - .each(function() { - // use the fact that only one element can enter to trigger a sort. - // If several zerolines enter at the same time we will sort once per, - // but generally this should be a minimal overhead. - zlcontainer.selectAll('path').sort(function(da, db) { - return axisIds.idSort(da.id, db.id); - }); - }); - zl.attr('transform', transfn) - .call(Color.stroke, ax.zerolinecolor || Color.defaultLine) - .style('stroke-width', zeroLineWidth + 'px'); - zl.exit().remove(); +/** + * gradient: create and apply a gradient fill + * + * @param {object} sel: d3 selection to apply this gradient to + * You can use `selection.call(Drawing.gradient, ...)` + * @param {DOM element} gd: the graph div `sel` is part of + * @param {string} gradientID: a unique (within this plot) identifier + * for this gradient, so that we don't create unnecessary definitions + * @param {string} type: 'radial', 'horizontal', or 'vertical', optionally with + * 'reversed' at the end. Normally radial goes center to edge, + * horizontal goes right to left, and vertical goes bottom to top + * @param {array} colorscale: as in attribute values, [[fraction, color], ...] + * @param {string} prop: the property to apply to, 'fill' or 'stroke' + */ +drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) { + var len = colorscale.length; + var info = gradientInfo[type]; + 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]]; } - } - - if(independent) { - drawTicks(ax._axislayer, tickpathfn(ax._pos + pad * ticksign[2], ticksign[2] * ax.ticklen)); - if(ax._counteraxis) { - var fictionalPlotinfo = { - gridlayer: ax._gridlayer, - zerolinelayer: ax._zerolinelayer - }; - drawGrid(fictionalPlotinfo, ax._counteraxis); + else { + colorStops[i] = [stopFormatter(colorscale[i][0] * 100), colorscale[i][1]]; } - return drawLabels(ax._axislayer, ax._pos); } - else if(fullLayout._has('cartesian')) { - subplots = axes.getSubplots(gd, ax); - // keep track of which subplots (by main conteraxis) we've already - // drawn grids for, so we don't overdraw overlaying subplots - var finishedGrids = {}; - - subplots.map(function(subplot) { - var plotinfo = fullLayout._plots[subplot]; - var counterAxis = plotinfo[counterLetter + 'axis']; - - var mainCounterID = counterAxis._mainAxis._id; - if(finishedGrids[mainCounterID]) return; - finishedGrids[mainCounterID] = 1; - - drawGrid(plotinfo, counterAxis, subplot); - }); - - var mainSubplot = ax._mainSubplot; - var mainPlotinfo = fullLayout._plots[mainSubplot]; - var tickSubplots = []; - - if(ax.ticks) { - var mainSign = ticksign[2]; - var tickpath = tickpathfn(ax._mainLinePosition + pad * mainSign, mainSign * ax.ticklen); - if(ax._anchorAxis && ax.mirror && ax.mirror !== true) { - tickpath += tickpathfn(ax._mainMirrorPosition - pad * mainSign, -mainSign * ax.ticklen); - } - drawTicks(mainPlotinfo[axLetter + 'axislayer'], tickpath); + var fullID = 'g' + gd._fullLayout._uid + '-' + gradientID; - tickSubplots = Object.keys(ax._linepositions || {}); - } + var gradient = gd._fullLayout._defs.select('.gradients') + .selectAll('#' + fullID) + .data([type + colorStops.join(';')], Lib.identity); - tickSubplots.map(function(subplot) { - var plotinfo = fullLayout._plots[subplot]; + gradient.exit().remove(); - var container = plotinfo[axLetter + 'axislayer']; + gradient.enter() + .append(info.node) + .each(function() { + var el = d3.select(this); + if(info.attrs) el.attr(info.attrs); - // [bottom or left, top or right] - // free and main are handled above - var linepositions = ax._linepositions[subplot] || []; + el.attr('id', fullID); - function tickPathSide(sidei) { - var tsign = ticksign[sidei]; - return tickpathfn(linepositions[sidei] + pad * tsign, tsign * ax.ticklen); - } + var stops = el.selectAll('stop') + .data(colorStops); + stops.exit().remove(); + stops.enter().append('stop'); - drawTicks(container, tickPathSide(0) + tickPathSide(1)); + stops.each(function(d) { + var tc = tinycolor(d[1]); + d3.select(this).attr({ + offset: d[0] + '%', + 'stop-color': Color.tinyRGB(tc), + 'stop-opacity': tc.getAlpha() + }); + }); }); - var mainContainer = mainPlotinfo[axLetter + 'axislayer']; - - return drawLabels(mainContainer, ax._mainLinePosition); - } + sel.style(prop, 'url(#' + fullID + ')') + .style(prop + '-opacity', null); }; -axes.shouldShowZeroLine = function(gd, ax, counterAxis) { - var rng = Lib.simpleMap(ax.range, ax.r2l); - return ( - (rng[0] * rng[1] <= 0) && - ax.zeroline && - (ax.type === 'linear' || ax.type === '-') && - ax._valsClipped.length && - ( - clipEnds(ax, 0) || - !anyCounterAxLineAtZero(gd, ax, counterAxis, rng) || - hasBarsOrFill(gd, ax) - ) - ); +/* + * Make the gradients container and clear out any previous gradients. + * We never collect all the gradients we need in one place, + * so we can't ever remove gradients that have stopped being useful, + * except all at once before a full redraw. + * The upside of this is arbitrary points can share gradient defs + */ +drawing.initGradients = function(gd) { + var gradientsGroup = Lib.ensureSingle(gd._fullLayout._defs, 'g', 'gradients'); + gradientsGroup.selectAll('linearGradient,radialGradient').remove(); }; -function clipEnds(ax, l) { - var p = ax.l2p(l); - return (p > 1 && p < ax._length - 1); -} -function anyCounterAxLineAtZero(gd, ax, counterAxis, rng) { - var mainCounterAxis = counterAxis._mainAxis; - if(!mainCounterAxis) return; +drawing.pointStyle = function(s, trace, gd) { + if(!s.size()) return; - var fullLayout = gd._fullLayout; - var axLetter = ax._id.charAt(0); - var counterLetter = axes.counterLetter(ax._id); + var fns = drawing.makePointStyleFns(trace); - var zeroPosition = ax._offset + ( - ((Math.abs(rng[0]) < Math.abs(rng[1])) === (axLetter === 'x')) ? - 0 : ax._length - ); + s.each(function(d) { + drawing.singlePointStyle(d, d3.select(this), trace, fns, gd); + }); +}; - function lineNearZero(ax2) { - if(!ax2.showline || !ax2.linewidth) return false; - var tolerance = Math.max((ax2.linewidth + ax.zerolinewidth) / 2, 1); +drawing.singlePointStyle = function(d, sel, trace, fns, gd) { + var marker = trace.marker; + var markerLine = marker.line; - function closeEnough(pos2) { - return typeof pos2 === 'number' && Math.abs(pos2 - zeroPosition) < tolerance; - } + sel.style('opacity', + fns.selectedOpacityFn ? fns.selectedOpacityFn(d) : + (d.mo === undefined ? marker.opacity : d.mo) + ); - 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; - } + if(fns.ms2mrc) { + var r; + + // handle multi-trace graph edit case + if(d.ms === 'various' || marker.size === 'various') { + r = 3; + } else { + r = fns.ms2mrc(d.ms); } - } - var plotinfo = fullLayout._plots[counterAxis._mainSubplot]; - if(!(plotinfo.mainplotinfo || plotinfo).overlays.length) { - return lineNearZero(counterAxis, zeroPosition); - } + // store the calculated size so hover can use it + d.mrc = r; - var counterLetterAxes = axes.list(gd, counterLetter); - for(var i = 0; i < counterLetterAxes.length; i++) { - var counterAxis2 = counterLetterAxes[i]; - if( - counterAxis2._mainAxis === mainCounterAxis && - lineNearZero(counterAxis2, zeroPosition) - ) { - return true; + if(fns.selectedSizeFn) { + r = d.mrc = fns.selectedSizeFn(d); } - } -} - -function hasBarsOrFill(gd, ax) { - var fullData = gd._fullData; - var subplot = ax._mainSubplot; - var axLetter = ax._id.charAt(0); - for(var i = 0; i < fullData.length; i++) { - var trace = fullData[i]; + // turn the symbol into a sanitized number + var x = drawing.symbolNumber(d.mx || marker.symbol) || 0; - if(trace.visible === true && - (trace.xaxis + trace.yaxis) === subplot && - ( - Registry.traceIs(trace, 'bar') && trace.orientation === {x: 'h', y: 'v'}[axLetter] || - trace.fill && trace.fill.charAt(trace.fill.length - 1) === axLetter - ) - ) { - return true; - } - } - return false; -} + // save if this marker is open + // because that impacts how to handle colors + d.om = x % 200 >= 100; -/** - * Find all margin pushers for 2D axes and reserve them for later use - * Both label and rangeslider automargin calculations happen later so - * we need to explicitly allow their ids in order to not delete them. - * - * TODO: can we pull the actual automargin calls forward to avoid this hack? - * We're probably also doing multiple redraws in this case, would be faster - * if we can just do the whole calculation ahead of time and draw once. - */ -axes.allowAutoMargin = function(gd) { - var axList = axes.list(gd, '', true); - for(var i = 0; i < axList.length; i++) { - var ax = axList[i]; - if(ax.automargin) { - Plots.allowAutoMargin(gd, ax._name + '.automargin'); - } - if(ax.rangeslider && ax.rangeslider.visible) { - Plots.allowAutoMargin(gd, 'rangeslider' + ax._id); - } + sel.attr('d', makePointPath(x, r)); } -}; -// swap all the presentation attributes of the axes showing these traces -axes.swap = function(gd, traces) { - var axGroups = makeAxisGroups(gd, traces); + var perPointGradient = false; + var fillColor, lineColor, lineWidth; - for(var i = 0; i < axGroups.length; i++) { - swapAxisGroup(gd, axGroups[i].x, axGroups[i].y); - } -}; + // 'so' is suspected outliers, for box plots + if(d.so) { + lineWidth = markerLine.outlierwidth; + lineColor = markerLine.outliercolor; + fillColor = marker.outliercolor; + } else { + var markerLineWidth = (markerLine || {}).width; -function makeAxisGroups(gd, traces) { - var groups = [], - i, - j; + 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; - for(i = 0; i < traces.length; i++) { - var groupsi = [], - xi = gd._fullData[traces[i]].xaxis, - yi = gd._fullData[traces[i]].yaxis; - if(!xi || !yi) continue; // not a 2D cartesian trace? + if('mlc' in d) lineColor = d.mlcc = fns.lineScale(d.mlc); + // weird case: array wasn't long enough to apply to every point + else if(Lib.isArrayOrTypedArray(markerLine.color)) lineColor = Color.defaultLine; + else lineColor = markerLine.color; - for(j = 0; j < groups.length; j++) { - if(groups[j].x.indexOf(xi) !== -1 || groups[j].y.indexOf(yi) !== -1) { - groupsi.push(j); - } + if(Lib.isArrayOrTypedArray(marker.color)) { + fillColor = Color.defaultLine; + perPointGradient = true; } - if(!groupsi.length) { - groups.push({x: [xi], y: [yi]}); - continue; + if('mc' in d) { + fillColor = d.mcc = fns.markerScale(d.mc); + } else { + fillColor = marker.color || 'rgba(0,0,0,0)'; } - var group0 = groups[groupsi[0]], - 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); - } + if(fns.selectedColorFn) { + fillColor = fns.selectedColorFn(d); } - mergeAxisGroups(group0.x, [xi]); - mergeAxisGroups(group0.y, [yi]); } - return groups; -} + if(d.om) { + // open markers can't have zero linewidth, default to 1px, + // and use fill color as stroke color + sel.call(Color.stroke, fillColor) + .style({ + 'stroke-width': (lineWidth || 1) + 'px', + fill: 'none' + }); + } else { + sel.style('stroke-width', lineWidth + 'px'); -function mergeAxisGroups(intoSet, fromSet) { - for(var i = 0; i < fromSet.length; i++) { - if(intoSet.indexOf(fromSet[i]) === -1) intoSet.push(fromSet[i]); - } -} + var markerGradient = marker.gradient; -function swapAxisGroup(gd, xIds, yIds) { - var i, - j, - xFullAxes = [], - yFullAxes = [], - layout = gd.layout; + var gradientType = d.mgt; + if(gradientType) perPointGradient = true; + else gradientType = markerGradient && markerGradient.type; - for(i = 0; i < xIds.length; i++) xFullAxes.push(axes.getFromId(gd, xIds[i])); - for(i = 0; i < yIds.length; i++) yFullAxes.push(axes.getFromId(gd, yIds[i])); + // for legend - arrays will propagate through here, but we don't need + // to treat it as per-point. + if(Array.isArray(gradientType)) { + gradientType = gradientType[0]; + if(!gradientInfo[gradientType]) gradientType = 0; + } - var allAxKeys = Object.keys(axAttrs); + if(gradientType && gradientType !== 'none') { + var gradientColor = d.mgc; + if(gradientColor) perPointGradient = true; + else gradientColor = markerGradient.color; - var noSwapAttrs = [ - 'anchor', 'domain', 'overlaying', 'position', 'side', 'tickangle', 'editType' - ]; - var numericTypes = ['linear', 'log']; + var gradientID = trace.uid; + if(perPointGradient) gradientID += '-' + d.i; - for(i = 0; i < allAxKeys.length; i++) { - var keyi = allAxKeys[i], - xVal = xFullAxes[0][keyi], - yVal = yFullAxes[0][keyi], - allEqual = true, - coerceLinearX = false, - 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) { - // type is special - if we find a mixture of linear and log, - // coerce them all to linear on flipping - 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) { - // type is special - if we find a mixture of linear and log, - // coerce them all to linear on flipping - 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, gd._fullLayout._dfltTitle); + drawing.gradient(sel, gd, gradientID, gradientType, + [[0, gradientColor], [1, fillColor]], 'fill'); + } else { + Color.fill(sel, fillColor); } - } - // now swap x&y for any annotations anchored to these x & y - for(i = 0; i < gd._fullLayout.annotations.length; i++) { - var ann = gd._fullLayout.annotations[i]; - if(xIds.indexOf(ann.xref) !== -1 && - yIds.indexOf(ann.yref) !== -1) { - Lib.swapAttrs(layout.annotations[i], ['?']); + if(lineWidth) { + Color.stroke(sel, lineColor); } } -} +}; -function swapAxisAttrs(layout, key, xFullAxes, yFullAxes, dfltTitle) { - // in case the value is the default for either axis, - // look at the first axis in each list and see if - // this key's value is undefined - var np = Lib.nestedProperty, - xVal = np(layout[xFullAxes[0]._name], key).get(), - yVal = np(layout[yFullAxes[0]._name], key).get(), - i; - if(key === 'title') { - // special handling of placeholder titles - if(xVal === dfltTitle.x) { - xVal = dfltTitle.y; - } - if(yVal === dfltTitle.y) { - yVal = dfltTitle.x; - } - } +drawing.makePointStyleFns = function(trace) { + var out = {}; + var marker = trace.marker; - for(i = 0; i < xFullAxes.length; i++) { - np(layout, xFullAxes[i]._name + '.' + key).set(yVal); + // allow array marker and marker line colors to be + // scaled by given max and min to colorscales + 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; }; } - for(i = 0; i < yFullAxes.length; i++) { - np(layout, yFullAxes[i]._name + '.' + key).set(xVal); + + if(trace.selectedpoints) { + Lib.extendFlat(out, drawing.makeSelectedPointStyleFns(trace)); } -} -function isAngular(ax) { - return ax._id === 'angularaxis'; -} + return out; +}; -},{"../../components/color":570,"../../components/drawing":595,"../../components/titles":661,"../../constants/alignment":668,"../../constants/numerical":673,"../../lib":696,"../../lib/svg_text_utils":720,"../../plots/plots":808,"../../registry":827,"./autorange":743,"./axis_autotype":745,"./axis_ids":747,"./clean_ticks":749,"./layout_attributes":757,"./set_convert":763,"d3":148,"fast-isnumeric":214}],745:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +drawing.makeSelectedPointStyleFns = function(trace) { + var out = {}; + var selectedAttrs = trace.selected || {}; + var unselectedAttrs = trace.unselected || {}; -'use strict'; + var marker = trace.marker || {}; + var selectedMarker = selectedAttrs.marker || {}; + var unselectedMarker = unselectedAttrs.marker || {}; -var isNumeric = _dereq_('fast-isnumeric'); + var mo = marker.opacity; + var smo = selectedMarker.opacity; + var usmo = unselectedMarker.opacity; + var smoIsDefined = smo !== undefined; + var usmoIsDefined = usmo !== undefined; -var Lib = _dereq_('../../lib'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; + if(Lib.isArrayOrTypedArray(mo) || smoIsDefined || usmoIsDefined) { + out.selectedOpacityFn = function(d) { + var base = d.mo === undefined ? marker.opacity : d.mo; -module.exports = function autoType(array, calendar) { - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; -}; + if(d.selected) { + return smoIsDefined ? smo : base; + } else { + return usmoIsDefined ? usmo : DESELECTDIM * base; + } + }; + } -// is there at least one number in array? If not, we should leave -// ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; + var mc = marker.color; + var smc = selectedMarker.color; + var usmc = unselectedMarker.color; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; - } + if(smc || usmc) { + out.selectedColorFn = function(d) { + var base = d.mcc || mc; - return false; -} + if(d.selected) { + return smc || base; + } else { + return usmc || base; + } + }; + } -// does the array a have mostly dates rather than numbers? -// note: some values can be neither (such as blanks, text) -// 2- or 4-digit integers can be both, so require twice as many -// dates as non-dates, to exclude cases with mostly 2 & 4 digit -// numbers and a few dates -// as with categories, consider DISTINCT values only. -function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; - var seen = {}; + var ms = marker.size; + var sms = selectedMarker.size; + var usms = unselectedMarker.size; + var smsIsDefined = sms !== undefined; + var usmsIsDefined = usms !== undefined; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; - var stri = String(ai); - if(seen[stri]) continue; - seen[stri] = 1; + if(Registry.traceIs(trace, 'symbols') && (smsIsDefined || usmsIsDefined)) { + out.selectedSizeFn = function(d) { + var base = d.mrc || ms / 2; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(d.selected) { + return smsIsDefined ? sms / 2 : base; + } else { + return usmsIsDefined ? usms / 2 : base; + } + }; } - return (dcnt > ncnt * 2); -} + return out; +}; -// are the (x,y)-values in gd.data mostly text? -// require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; - var seen = {}; +drawing.makeSelectedTextStyleFns = function(trace) { + var out = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; - var stri = String(ai); - if(seen[stri]) continue; - seen[stri] = 1; + var selectedAttrs = trace.selected || {}; + var unselectedAttrs = trace.unselected || {}; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; - } + var textFont = trace.textfont || {}; + var selectedTextFont = selectedAttrs.textfont || {}; + var unselectedTextFont = unselectedAttrs.textfont || {}; - return curvecats > curvenums * 2; -} + var tc = textFont.color; + var stc = selectedTextFont.color; + var utc = unselectedTextFont.color; + + out.selectedTextColorFn = function(d) { + var base = d.tc || tc; + + if(d.selected) { + return stc || base; + } else { + if(utc) return utc; + else return stc ? base : Color.addOpacity(base, DESELECTDIM); + } + }; -},{"../../constants/numerical":673,"../../lib":696,"fast-isnumeric":214}],746:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return out; +}; -'use strict'; +drawing.selectedPointStyle = function(s, trace) { + if(!s.size() || !trace.selectedpoints) return; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); + var fns = drawing.makeSelectedPointStyleFns(trace); + var marker = trace.marker || {}; + var seq = []; -var layoutAttributes = _dereq_('./layout_attributes'); -var handleTickValueDefaults = _dereq_('./tick_value_defaults'); -var handleTickMarkDefaults = _dereq_('./tick_mark_defaults'); -var handleTickLabelDefaults = _dereq_('./tick_label_defaults'); -var handleCategoryOrderDefaults = _dereq_('./category_order_defaults'); -var handleLineGridDefaults = _dereq_('./line_grid_defaults'); -var setConvert = _dereq_('./set_convert'); + if(fns.selectedOpacityFn) { + seq.push(function(pt, d) { + pt.style('opacity', fns.selectedOpacityFn(d)); + }); + } -/** - * options: object containing: - * - * letter: 'x' or 'y' - * title: name of the axis (ie 'Colorbar') to go in default title - * font: the default font to inherit - * outerTicks: boolean, should ticks default to outside? - * showGrid: boolean, should gridlines be shown by default? - * noHover: boolean, this axis doesn't support hover effects? - * data: the plot data, used to manage categories - * bgColor: the plot background color, to calculate default gridline colors - */ -module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, options, layoutOut) { - var letter = options.letter; - var font = options.font || {}; - var splomStash = options.splomStash || {}; + if(fns.selectedColorFn) { + seq.push(function(pt, d) { + Color.fill(pt, fns.selectedColorFn(d)); + }); + } - var visible = coerce('visible', !options.cheateronly); + if(fns.selectedSizeFn) { + seq.push(function(pt, d) { + var mx = d.mx || marker.symbol || 0; + var mrc2 = fns.selectedSizeFn(d); - var axType = containerOut.type; + pt.attr('d', makePointPath(drawing.symbolNumber(mx), mrc2)); - if(axType === 'date') { - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); - handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + // save for Drawing.selectedTextStyle + d.mrc2 = mrc2; + }); } - setConvert(containerOut, layoutOut); + if(seq.length) { + s.each(function(d) { + var pt = d3.select(this); + for(var i = 0; i < seq.length; i++) { + seq[i](pt, d); + } + }); + } +}; - var autoRange = coerce('autorange', !containerOut.isValidRange(containerIn.range)); - if(autoRange && (axType === 'linear' || axType === '-')) coerce('rangemode'); +drawing.tryColorscale = function(marker, prefix) { + var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker; - coerce('range'); - containerOut.cleanRange(); + if(cont) { + var scl = cont.colorscale; + var colorArray = cont.color; - handleCategoryOrderDefaults(containerIn, containerOut, coerce, options); + if(scl && Lib.isArrayOrTypedArray(colorArray)) { + return Colorscale.makeColorScaleFunc( + Colorscale.extractScale(cont, {cLetter: 'c'}) + ); + } + } + return Lib.identity; +}; - if(axType !== 'category' && !options.noHover) coerce('hoverformat'); +var TEXTOFFSETSIGN = { + start: 1, end: -1, middle: 0, bottom: 1, top: -1 +}; - if(!visible) return containerOut; +function textPointPosition(s, textPosition, fontSize, markerRadius) { + var group = d3.select(s.node().parentNode); - var dfltColor = coerce('color'); - // if axis.color was provided, use it for fonts too; otherwise, - // inherit from global font color in case that was provided. - // Compare to dflt rather than to containerIn, so we can provide color via - // template too. - var dfltFontColor = (dfltColor !== layoutAttributes.color.dflt) ? dfltColor : font.color; - // try to get default title from splom trace, fallback to graph-wide value - var dfltTitle = splomStash.label || layoutOut._dfltTitle[letter]; + 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'; - coerce('title', dfltTitle); - Lib.coerceFont(coerce, 'titlefont', { - family: font.family, - size: Math.round(font.size * 1.2), - color: dfltFontColor - }); + // if markers are shown, offset a little more than + // the nominal marker size + // ie 2/1.6 * nominal, bcs some markers are a bit bigger + var r = markerRadius ? markerRadius / 0.8 + 1 : 0; - handleTickValueDefaults(containerIn, containerOut, coerce, axType); - handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options); - handleTickMarkDefaults(containerIn, containerOut, coerce, options); - handleLineGridDefaults(containerIn, containerOut, coerce, { - dfltColor: dfltColor, - bgColor: options.bgColor, - showGrid: options.showGrid, - attributes: layoutAttributes - }); + 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; - if(containerOut.showline || containerOut.ticks) coerce('mirror'); + // fix the overall text group position + s.attr('text-anchor', h); + group.attr('transform', 'translate(' + dx + ',' + dy + ')'); +} - if(options.automargin) coerce('automargin'); +function extracTextFontSize(d, trace) { + var fontSize = d.ts || trace.textfont.size; + return (isNumeric(fontSize) && fontSize > 0) ? fontSize : 0; +} - return containerOut; -}; +// draw text at points +drawing.textPointStyle = function(s, trace, gd) { + if(!s.size()) return; -},{"../../lib":696,"../../registry":827,"./category_order_defaults":748,"./layout_attributes":757,"./line_grid_defaults":759,"./set_convert":763,"./tick_label_defaults":764,"./tick_mark_defaults":765,"./tick_value_defaults":766}],747:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var selectedTextColorFn; -'use strict'; + if(trace.selectedpoints) { + var fns = drawing.makeSelectedTextStyleFns(trace); + selectedTextColorFn = fns.selectedTextColorFn; + } -var Registry = _dereq_('../../registry'); + s.each(function(d) { + var p = d3.select(this); + var text = Lib.extractOption(d, trace, 'tx', 'text'); -var constants = _dereq_('./constants'); + if(!text && text !== 0) { + p.remove(); + return; + } + var pos = d.tp || trace.textposition; + var fontSize = extracTextFontSize(d, trace); + var fontColor = selectedTextColorFn ? + selectedTextColorFn(d) : + (d.tc || trace.textfont.color); -// convert between axis names (xaxis, xaxis2, etc, elements of gd.layout) -// and axis id's (x, x2, etc). Would probably have ditched 'xaxis' -// completely in favor of just 'x' if it weren't ingrained in the API etc. -exports.id2name = function id2name(id) { - if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); - if(axNum === '1') axNum = ''; - return id.charAt(0) + 'axis' + axNum; + p.call(drawing.font, + d.tf || trace.textfont.family, + fontSize, + fontColor) + .text(text) + .call(svgTextUtils.convertToTspans, gd) + .call(textPointPosition, pos, fontSize, d.mrc); + }); }; -exports.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; -}; +drawing.selectedTextStyle = function(s, trace) { + if(!s.size() || !trace.selectedpoints) return; -exports.cleanId = function cleanId(id, axLetter) { - if(!id.match(constants.AX_ID_PATTERN)) return; - if(axLetter && id.charAt(0) !== axLetter) return; + var fns = drawing.makeSelectedTextStyleFns(trace); - var axNum = id.substr(1).replace(/^0+/, ''); - if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; -}; + s.each(function(d) { + var tx = d3.select(this); + var tc = fns.selectedTextColorFn(d); + var tp = d.tp || trace.textposition; + var fontSize = extracTextFontSize(d, trace); -// get all axis objects, as restricted in listNames -exports.list = function(gd, axLetter, only2d) { - var fullLayout = gd._fullLayout; - if(!fullLayout) return []; + Color.fill(tx, tc); + textPointPosition(tx, tp, fontSize, d.mrc2 || d.mrc); + }); +}; - var idList = exports.listIds(gd, axLetter); - var out = new Array(idList.length); +// generalized Catmull-Rom splines, per +// http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf +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; +}; - for(i = 0; i < idList.length; i++) { - var idi = idList[i]; - out[i] = fullLayout[idi.charAt(0) + 'axis' + idi.substr(1)]; +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) + ); - if(!only2d) { - var sceneIds3D = fullLayout._subplots.gl3d || []; + 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; +}; - for(i = 0; i < sceneIds3D.length; i++) { - var scene = fullLayout[sceneIds3D[i]]; +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 [ + [ + d3.round(thispt[0] + (denom1 && numx / denom1), 2), + d3.round(thispt[1] + (denom1 && numy / denom1), 2) + ], [ + d3.round(thispt[0] - (denom2 && numx / denom2), 2), + d3.round(thispt[1] - (denom2 && numy / denom2), 2) + ] + ]; +} - if(axLetter) out.push(scene[axLetter + 'axis']); - else out.push(scene.xaxis, scene.yaxis, scene.zaxis); - } +// step paths - returns a generator function for paths +// with the given step shape +var STEPPATH = { + hv: function(p0, p1) { + return 'H' + d3.round(p1[0], 2) + 'V' + d3.round(p1[1], 2); + }, + vh: function(p0, p1) { + return 'V' + d3.round(p1[1], 2) + 'H' + d3.round(p1[0], 2); + }, + hvh: function(p0, p1) { + return 'H' + d3.round((p0[0] + p1[0]) / 2, 2) + 'V' + + d3.round(p1[1], 2) + 'H' + d3.round(p1[0], 2); + }, + vhv: function(p0, p1) { + return 'V' + d3.round((p0[1] + p1[1]) / 2, 2) + 'H' + + d3.round(p1[0], 2) + 'V' + d3.round(p1[1], 2); } - - return out; +}; +var STEPLINEAR = function(p0, p1) { + return 'L' + d3.round(p1[0], 2) + ',' + d3.round(p1[1], 2); +}; +drawing.steps = function(shape) { + var onestep = STEPPATH[shape] || STEPLINEAR; + return function(pts) { + var path = 'M' + d3.round(pts[0][0], 2) + ',' + d3.round(pts[0][1], 2); + for(var i = 1; i < pts.length; i++) { + path += onestep(pts[i - 1], pts[i]); + } + return path; + }; }; -// get all axis ids, optionally restricted by letter -// this only makes sense for 2d axes -exports.listIds = function(gd, axLetter) { - var fullLayout = gd._fullLayout; - if(!fullLayout) return []; +// off-screen svg render testing element, shared by the whole page +// uses the id 'js-plotly-tester' and stores it in drawing.tester +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 subplotLists = fullLayout._subplots; - if(axLetter) return subplotLists[axLetter + 'axis']; - return subplotLists.xaxis.concat(subplotLists.yaxis); + // browsers differ on how they describe the bounding rect of + // the svg if its contents spill over... so make a 1x1px + // reference point we can measure off of. + 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; }; -// get an axis object from its id 'x','x2' etc -// optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it -exports.getFromId = function(gd, id, type) { - var fullLayout = gd._fullLayout; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated (or transformed) and + * its anchor point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + * + * @param {SVGElement} node: the element to measure. If possible this should be + * a or MathJax element that's already passed through + * `convertToTspans` because in that case we can cache the results, but it's + * possible to pass in any svg element. + * + * @param {boolean} inTester: is this element already in `drawing.tester`? + * If you are measuring a dummy element, rather than one you really intend + * to use on the plot, making it in `drawing.tester` in the first place + * allows us to test faster because it cuts out cloning and appending it. + * + * @param {string} hash: for internal use only, if we already know the cache key + * for this element beforehand. + * + * @return {object}: a plain object containing the width, height, left, right, + * top, and bottom of `node` + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; +var maxSavedBBoxes = 10000; - if(type === 'x') id = id.replace(/y[0-9]*/, ''); - else if(type === 'y') id = id.replace(/x[0-9]*/, ''); +drawing.bBox = function(node, inTester, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + 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) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.childNodes[0]; - return fullLayout[exports.id2name(id)]; -}; + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); -// get an axis object of specified type from the containing trace -exports.getFromTrace = function(gd, fullTrace, type) { - var fullLayout = gd._fullLayout; - var ax = null; + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + 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; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; - if(Registry.traceIs(fullTrace, 'gl3d')) { - var scene = fullTrace.scene; - if(scene.substr(0, 5) === 'scene') { - ax = fullLayout[scene][type + 'axis']; + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); } } - else { - ax = exports.getFromId(gd, fullTrace[type + 'axis'] || type); + var testNode, tester; + if(inTester) { + testNode = node; } + else { + tester = drawing.tester.node(); - return ax; -}; - -// sort x, x2, x10, y, y2, y10... -exports.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); -}; + // copy the node to test into the tester + testNode = node.cloneNode(true); + tester.appendChild(testNode); + } -},{"../../registry":827,"./constants":750}],748:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); -'use strict'; + var testRect = testNode.getBoundingClientRect(); + var refRect = drawing.testref + .node() + .getBoundingClientRect(); -function findCategories(ax, opts) { - var dataAttr = opts.dataAttr || ax._id.charAt(0); - var lookup = {}; - var axData; - var i, j; + if(!inTester) tester.removeChild(testNode); - if(opts.axData) { - // non-x/y case - axData = opts.axData; - } else { - // x/y case - axData = []; - for(i = 0; i < opts.data.length; i++) { - var trace = opts.data[i]; - if(trace[dataAttr + 'axis'] === ax._id) { - axData.push(trace); - } - } - } + 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 + }; - 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 !== undefined) { - lookup[v] = 1; - } - } + // make sure we don't have too many saved boxes, + // or a long session could overload on memory + // by saving boxes for long-gone elements + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } - return Object.keys(lookup); + // cache this bbox + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; + + return Lib.extendFlat({}, bb); +}; + +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +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'); } /** - * Fills in category* default and initial categories. + * Set clipPath URL in a way that work for all situations. * - * @param {object} containerIn : input axis object - * @param {object} containerOut : full axis object - * @param {function} coerce : Lib.coerce fn wrapper - * @param {object} opts : - * - data {array} : (full) data trace - * OR - * - axData {array} : (full) data associated with axis being coerced here - * - dataAttr {string} : attribute name corresponding to coordinate array + * In details, graphs on pages with HTML tags need to prepend + * the clip path ids with the page's base url EXCEPT during toImage exports. + * + * @param {d3 selection} s : node to add clip-path attribute + * @param {string} localId : local clip-path (w/o base url) id + * @param {DOM element || object} gd + * - context._baseUrl {string} + * - context._exportedPlot {boolean} */ -module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, coerce, opts) { - if(containerOut.type !== 'category') return; - - var arrayIn = containerIn.categoryarray; - var isValidArray = (Array.isArray(arrayIn) && arrayIn.length > 0); - - // override default 'categoryorder' value when non-empty array is supplied - var orderDefault; - if(isValidArray) orderDefault = 'array'; - - var order = coerce('categoryorder', orderDefault); - var array; - - // coerce 'categoryarray' only in array order case - if(order === 'array') { - array = coerce('categoryarray'); +drawing.setClipUrl = function(s, localId, gd) { + if(!localId) { + s.attr('clip-path', null); + return; } - // cannot set 'categoryorder' to 'array' with an invalid 'categoryarray' - if(!isValidArray && order === 'array') { - order = containerOut.categoryorder = 'trace'; - } + var context = gd._context; + var baseUrl = context._exportedPlot ? '' : (context._baseUrl || ''); - // set up things for makeCalcdata - 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(); - } - } + s.attr('clip-path', 'url(' + baseUrl + '#' + localId + ')'); }; -},{}],749:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - +drawing.getTranslate = function(element) { + // Note the separator [^\d] between x and y in this regex + // We generally use ',' but IE will convert it to ' ' + var re = /.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var transform = element[getter]('transform') || ''; -'use strict'; + var translate = transform.replace(re, function(match, p1, p2) { + return [p1, p2].join(' '); + }) + .split(' '); -var isNumeric = _dereq_('fast-isnumeric'); -var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; + return { + x: +translate[0] || 0, + y: +translate[1] || 0 + }; +}; -/** - * Return a validated dtick value for this axis - * - * @param {any} dtick: the candidate dtick. valid values are numbers and strings, - * and further constrained depending on the axis type. - * @param {string} axType: the axis type - */ -exports.dtick = function(dtick, axType) { - var isLog = axType === 'log'; - var isDate = axType === 'date'; - var isCat = axType === 'category'; - var dtickDflt = isDate ? ONEDAY : 1; +drawing.setTranslate = function(element, x, y) { + var re = /(\btranslate\(.*?\);?)/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var setter = element.attr ? 'attr' : 'setAttribute'; + var transform = element[getter]('transform') || ''; - if(!dtick) return dtickDflt; + x = x || 0; + y = y || 0; - if(isNumeric(dtick)) { - dtick = Number(dtick); - if(dtick <= 0) return dtickDflt; - if(isCat) { - // category dtick must be positive integers - return Math.max(1, Math.round(dtick)); - } - if(isDate) { - // date dtick must be at least 0.1ms (our current precision) - return Math.max(0.1, dtick); - } - return dtick; - } + transform = transform.replace(re, '').trim(); + transform += ' translate(' + x + ', ' + y + ')'; + transform = transform.trim(); - if(typeof dtick !== 'string' || !(isDate || isLog)) { - return dtickDflt; - } + element[setter]('transform', transform); - var prefix = dtick.charAt(0); - var dtickNum = dtick.substr(1); - dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; + return transform; +}; - 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; - } +drawing.getScale = function(element) { + var re = /.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var transform = element[getter]('transform') || ''; - return dtick; -}; + var translate = transform.replace(re, function(match, p1, p2) { + return [p1, p2].join(' '); + }) + .split(' '); -/** - * Return a validated tick0 for this axis - * - * @param {any} tick0: the candidate tick0. Valid values are numbers and strings, - * further constrained depending on the axis type - * @param {string} axType: the axis type - * @param {string} calendar: for date axes, the calendar to validate/convert with - * @param {any} dtick: an already valid dtick. Only used for D1 and D2 log dticks, - * which do not support tick0 at all. - */ -exports.tick0 = function(tick0, axType, calendar, dtick) { - if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); - } - if(dtick === 'D1' || dtick === 'D2') { - // D1 and D2 modes ignore tick0 entirely - return undefined; - } - // Aside from date axes, tick0 must be numeric - return isNumeric(tick0) ? Number(tick0) : 0; + return { + x: +translate[0] || 1, + y: +translate[1] || 1 + }; }; -},{"../../constants/numerical":673,"../../lib":696,"fast-isnumeric":214}],750:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; -var counterRegex = _dereq_('../../lib/regex').counter; +drawing.setScale = function(element, x, y) { + var re = /(\bscale\(.*?\);?)/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var setter = element.attr ? 'attr' : 'setAttribute'; + var transform = element[getter]('transform') || ''; + x = x || 1; + y = y || 1; -module.exports = { + transform = transform.replace(re, '').trim(); + transform += ' scale(' + x + ', ' + y + ')'; + transform = transform.trim(); - idRegex: { - x: counterRegex('x'), - y: counterRegex('y') - }, + element[setter]('transform', transform); - attrRegex: counterRegex('[xy]axis'), + return transform; +}; - // axis match regular expression - xAxisMatch: counterRegex('xaxis'), - yAxisMatch: counterRegex('yaxis'), +var SCALE_RE = /\s*sc.*/; - // 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]*$/, - AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, +drawing.setPointGroupScale = function(selection, xScale, yScale) { + xScale = xScale || 1; + yScale = yScale || 1; - // and for 2D subplots - SUBPLOT_PATTERN: /^x([0-9]*)y([0-9]*)$/, + if(!selection) return; - // pixels to move mouse before you stop clamping to starting point - MINDRAG: 8, + // The same scale transform for every point: + var scale = (xScale === 1 && yScale === 1) ? + '' : + ' scale(' + xScale + ',' + yScale + ')'; - // smallest dimension allowed for a select box - MINSELECT: 12, + selection.each(function() { + var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); + t += scale; + t = t.trim(); + this.setAttribute('transform', t); + }); +}; - // smallest dimension allowed for a zoombox - MINZOOM: 20, +var TEXT_POINT_LAST_TRANSLATION_RE = /translate\([^)]*\)\s*$/; - // width of axis drag regions - DRAGGERSIZE: 20, +drawing.setTextPointsScale = function(selection, xScale, yScale) { + if(!selection) return; - // max pixels off straight before a lasso select line counts as bent - BENDPX: 1.5, + selection.each(function() { + var transforms; + var el = d3.select(this); + var text = el.select('text'); - // delay before a redraw (relayout) after smooth panning and zooming - REDRAWDELAY: 50, + if(!text.node()) return; - // throttling limit (ms) for selectPoints calls - SELECTDELAY: 100, + var x = parseFloat(text.attr('x') || 0); + var y = parseFloat(text.attr('y') || 0); - // cache ID suffix for throttle - SELECTID: '-select', + var existingTransform = (el.attr('transform') || '').match(TEXT_POINT_LAST_TRANSLATION_RE); - // last resort axis ranges for x and y axes if we have no data - DFLTRANGEX: [-1, 6], - DFLTRANGEY: [-1, 4], + if(xScale === 1 && yScale === 1) { + transforms = []; + } else { + transforms = [ + 'translate(' + x + ',' + y + ')', + 'scale(' + xScale + ',' + yScale + ')', + 'translate(' + (-x) + ',' + (-y) + ')', + ]; + } - // Layers to keep trace types in the right order - // N.B. each 'unique' plot method must have its own layer - traceLayerClasses: [ - 'heatmaplayer', - 'contourcarpetlayer', 'contourlayer', - 'barlayer', - 'carpetlayer', - 'violinlayer', - 'boxlayer', - 'ohlclayer', - 'scattercarpetlayer', 'scatterlayer' - ], + if(existingTransform) { + transforms.push(existingTransform); + } - layerValue2layerClass: { - 'above traces': 'above', - 'below traces': 'below' - } + el.attr('transform', transforms.join(' ')); + }); }; -},{"../../lib/regex":712}],751:[function(_dereq_,module,exports){ +},{"../../constants/alignment":138,"../../constants/interactions":139,"../../constants/xmlns_namespaces":141,"../../lib":159,"../../lib/svg_text_utils":180,"../../registry":243,"../../traces/scatter/make_bubble_size_func":298,"../../traces/scatter/subtypes":305,"../color":43,"../colorscale":55,"./symbol_defs":65,"d3":8,"fast-isnumeric":10,"tinycolor2":26}],65:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -113778,3209 +20568,3412 @@ 'use strict'; -var Lib = _dereq_('../../lib'); -var id2name = _dereq_('./axis_ids').id2name; - - -module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { - var constraintGroups = layoutOut._axisConstraintGroups; - var thisID = containerOut._id; - var letter = thisID.charAt(0); +var d3 = _dereq_('d3'); - if(containerOut.fixedrange) return; +/** Marker symbol definitions + * users can specify markers either by number or name + * add 100 (or '-open') and you get an open marker + * open markers have no fill and use line color as the stroke color + * add 200 (or '-dot') and you get a dot in the middle + * add both and you get both + */ - // coerce the constraint mechanics even if this axis has no scaleanchor - // because it may be the anchor of another axis. - coerce('constrain'); - Lib.coerce(containerIn, containerOut, { - constraintoward: { - valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' +module.exports = { + circle: { + n: 0, + f: function(r) { + var rs = d3.round(r, 2); + return 'M' + rs + ',0A' + rs + ',' + rs + ' 0 1,1 0,-' + rs + + 'A' + rs + ',' + rs + ' 0 0,1 ' + rs + ',0Z'; } - }, 'constraintoward'); - - if(!containerIn.scaleanchor) return; - - var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); - - var scaleanchor = Lib.coerce(containerIn, containerOut, { - scaleanchor: { - valType: 'enumerated', - values: constraintOpts.linkableAxes + }, + square: { + n: 1, + f: function(r) { + var rs = d3.round(r, 2); + return 'M' + rs + ',' + rs + 'H-' + rs + 'V-' + rs + 'H' + rs + 'Z'; } - }, 'scaleanchor'); - - if(scaleanchor) { - var scaleratio = coerce('scaleratio'); - // TODO: I suppose I could do attribute.min: Number.MIN_VALUE to avoid zero, - // but that seems hacky. Better way to say "must be a positive number"? - // Of course if you use several super-tiny values you could eventually - // force a product of these to zero and all hell would break loose... - // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; - - updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - thisID, scaleanchor, scaleratio); - } - else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target' + - 'axis has fixed range.'); - } -}; - -function getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut) { - // If this axis is already part of a constraint group, we can't - // scaleanchor any other axis in that group, or we'd make a loop. - // Filter allAxisIds to enforce this, also matching axis types. - - var thisType = layoutOut[id2name(thisID)].type; - - var i, j, idj, axj; - - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType && !axj.fixedrange) linkableAxes.push(idj); - } - - for(i = 0; i < constraintGroups.length; i++) { - if(constraintGroups[i][thisID]) { - var thisGroup = constraintGroups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + }, + diamond: { + n: 2, + f: function(r) { + var rd = d3.round(r * 1.3, 2); + return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z'; + } + }, + cross: { + n: 3, + f: function(r) { + var rc = d3.round(r * 0.4, 2); + var rc2 = d3.round(r * 1.2, 2); + return 'M' + rc2 + ',' + rc + 'H' + rc + 'V' + rc2 + 'H-' + rc + + 'V' + rc + 'H-' + rc2 + 'V-' + rc + 'H-' + rc + 'V-' + rc2 + + 'H' + rc + 'V-' + rc + 'H' + rc2 + 'Z'; + } + }, + x: { + n: 4, + f: function(r) { + var rx = d3.round(r * 0.8 / Math.sqrt(2), 2); + var ne = 'l' + rx + ',' + rx; + var se = 'l' + rx + ',-' + rx; + var sw = 'l-' + rx + ',-' + rx; + var nw = 'l-' + rx + ',' + rx; + return 'M0,' + rx + ne + se + sw + se + sw + nw + sw + nw + ne + nw + ne + 'Z'; + } + }, + 'triangle-up': { + n: 5, + f: function(r) { + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); + return 'M-' + rt + ',' + r2 + 'H' + rt + 'L0,-' + rs + 'Z'; + } + }, + 'triangle-down': { + n: 6, + f: function(r) { + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); + return 'M-' + rt + ',-' + r2 + 'H' + rt + 'L0,' + rs + 'Z'; + } + }, + 'triangle-left': { + n: 7, + f: function(r) { + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); + return 'M' + r2 + ',-' + rt + 'V' + rt + 'L-' + rs + ',0Z'; + } + }, + 'triangle-right': { + n: 8, + f: function(r) { + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); + return 'M-' + r2 + ',-' + rt + 'V' + rt + 'L' + rs + ',0Z'; + } + }, + 'triangle-ne': { + n: 9, + f: function(r) { + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); + return 'M-' + r2 + ',-' + r1 + 'H' + r1 + 'V' + r2 + 'Z'; + } + }, + 'triangle-se': { + n: 10, + f: function(r) { + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); + return 'M' + r1 + ',-' + r2 + 'V' + r1 + 'H-' + r2 + 'Z'; + } + }, + 'triangle-sw': { + n: 11, + f: function(r) { + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); + return 'M' + r2 + ',' + r1 + 'H-' + r1 + 'V-' + r2 + 'Z'; + } + }, + 'triangle-nw': { + n: 12, + f: function(r) { + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); + return 'M-' + r1 + ',' + r2 + 'V-' + r1 + 'H' + r2 + 'Z'; + } + }, + pentagon: { + n: 13, + f: function(r) { + var x1 = d3.round(r * 0.951, 2); + var x2 = d3.round(r * 0.588, 2); + var y0 = d3.round(-r, 2); + var y1 = d3.round(r * -0.309, 2); + var y2 = d3.round(r * 0.809, 2); + return 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2 + 'H-' + x2 + + 'L-' + x1 + ',' + y1 + 'L0,' + y0 + 'Z'; + } + }, + hexagon: { + n: 14, + f: function(r) { + var y0 = d3.round(r, 2); + var y1 = d3.round(r / 2, 2); + var x = d3.round(r * Math.sqrt(3) / 2, 2); + return 'M' + x + ',-' + y1 + 'V' + y1 + 'L0,' + y0 + + 'L-' + x + ',' + y1 + 'V-' + y1 + 'L0,-' + y0 + 'Z'; + } + }, + hexagon2: { + n: 15, + f: function(r) { + var x0 = d3.round(r, 2); + var x1 = d3.round(r / 2, 2); + var y = d3.round(r * Math.sqrt(3) / 2, 2); + return 'M-' + x1 + ',' + y + 'H' + x1 + 'L' + x0 + + ',0L' + x1 + ',-' + y + 'H-' + x1 + 'L-' + x0 + ',0Z'; + } + }, + octagon: { + n: 16, + f: function(r) { + var a = d3.round(r * 0.924, 2); + var b = d3.round(r * 0.383, 2); + return '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) { + var rs = r * 1.4; + var x1 = d3.round(rs * 0.225, 2); + var x2 = d3.round(rs * 0.951, 2); + var x3 = d3.round(rs * 0.363, 2); + var x4 = d3.round(rs * 0.588, 2); + var y0 = d3.round(-rs, 2); + var y1 = d3.round(rs * -0.309, 2); + var y3 = d3.round(rs * 0.118, 2); + var y4 = d3.round(rs * 0.809, 2); + var y5 = d3.round(rs * 0.382, 2); + return 'M' + x1 + ',' + y1 + 'H' + x2 + 'L' + x3 + ',' + y3 + + 'L' + x4 + ',' + y4 + 'L0,' + y5 + 'L-' + x4 + ',' + y4 + + 'L-' + x3 + ',' + y3 + 'L-' + x2 + ',' + y1 + 'H-' + x1 + + 'L0,' + y0 + 'Z'; + } + }, + hexagram: { + n: 18, + f: function(r) { + var y = d3.round(r * 0.66, 2); + var x1 = d3.round(r * 0.38, 2); + var x2 = d3.round(r * 0.76, 2); + return 'M-' + x2 + ',0l-' + x1 + ',-' + y + 'h' + x2 + + 'l' + x1 + ',-' + y + 'l' + x1 + ',' + y + 'h' + x2 + + 'l-' + x1 + ',' + y + 'l' + x1 + ',' + y + 'h-' + x2 + + 'l-' + x1 + ',' + y + 'l-' + x1 + ',-' + y + 'h-' + x2 + 'Z'; + } + }, + 'star-triangle-up': { + n: 19, + f: function(r) { + var x = d3.round(r * Math.sqrt(3) * 0.8, 2); + var y1 = d3.round(r * 0.8, 2); + var y2 = d3.round(r * 1.6, 2); + var rc = d3.round(r * 4, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + return 'M-' + x + ',' + y1 + aPart + x + ',' + y1 + + aPart + '0,-' + y2 + aPart + '-' + x + ',' + y1 + 'Z'; + } + }, + 'star-triangle-down': { + n: 20, + f: function(r) { + var x = d3.round(r * Math.sqrt(3) * 0.8, 2); + var y1 = d3.round(r * 0.8, 2); + var y2 = d3.round(r * 1.6, 2); + var rc = d3.round(r * 4, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + return 'M' + x + ',-' + y1 + aPart + '-' + x + ',-' + y1 + + aPart + '0,' + y2 + aPart + x + ',-' + y1 + 'Z'; + } + }, + 'star-square': { + n: 21, + f: function(r) { + var rp = d3.round(r * 1.1, 2); + var rc = d3.round(r * 2, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + return 'M-' + rp + ',-' + rp + aPart + '-' + rp + ',' + rp + + aPart + rp + ',' + rp + aPart + rp + ',-' + rp + + aPart + '-' + rp + ',-' + rp + 'Z'; } - } - - return {linkableAxes: linkableAxes, thisGroup: null}; -} - - -/* - * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. - * - * constraintGroups: a list of objects. each object is - * {axis_id: scale_within_group}, where scale_within_group is - * only important relative to the rest of the group, and defines - * the relative scales between all axes in the group - * - * thisGroup: the group the current axis is already in - * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis - */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { - var i, j, groupi, keyj, thisGroupIndex; - - if(thisGroup === null) { - thisGroup = {}; - thisGroup[thisID] = 1; - thisGroupIndex = constraintGroups.length; - constraintGroups.push(thisGroup); - } - else { - thisGroupIndex = constraintGroups.indexOf(thisGroup); - } - - var thisGroupKeys = Object.keys(thisGroup); - - // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. - for(i = 0; i < constraintGroups.length; i++) { - groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; - for(j = 0; j < thisGroupKeys.length; j++) { - keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; - } - constraintGroups.splice(thisGroupIndex, 1); - return; + }, + 'star-diamond': { + n: 22, + f: function(r) { + var rp = d3.round(r * 1.4, 2); + var rc = d3.round(r * 1.9, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + return 'M-' + rp + ',0' + aPart + '0,' + rp + + aPart + rp + ',0' + aPart + '0,-' + rp + + aPart + '-' + rp + ',0' + 'Z'; } - } - - // otherwise, we insert the new scaleanchor axis as the base scale (1) - // in its group, and scale the rest of the group to it - if(scaleratio !== 1) { - for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + }, + 'diamond-tall': { + n: 23, + f: function(r) { + var x = d3.round(r * 0.7, 2); + var y = d3.round(r * 1.4, 2); + return 'M0,' + y + 'L' + x + ',0L0,-' + y + 'L-' + x + ',0Z'; } + }, + 'diamond-wide': { + n: 24, + f: function(r) { + var x = d3.round(r * 1.4, 2); + var y = d3.round(r * 0.7, 2); + return 'M0,' + y + 'L' + x + ',0L0,-' + y + 'L-' + x + ',0Z'; + } + }, + hourglass: { + n: 25, + f: function(r) { + var rs = d3.round(r, 2); + return 'M' + rs + ',' + rs + 'H-' + rs + 'L' + rs + ',-' + rs + 'H-' + rs + 'Z'; + }, + noDot: true + }, + bowtie: { + n: 26, + f: function(r) { + var rs = d3.round(r, 2); + return 'M' + rs + ',' + rs + 'V-' + rs + 'L-' + rs + ',' + rs + 'V-' + rs + 'Z'; + }, + noDot: true + }, + 'circle-cross': { + n: 27, + f: function(r) { + var rs = d3.round(r, 2); + return '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) { + var rs = d3.round(r, 2); + var rc = d3.round(r / Math.sqrt(2), 2); + return 'M' + rc + ',' + rc + 'L-' + rc + ',-' + rc + + 'M' + rc + ',-' + rc + 'L-' + rc + ',' + rc + + '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) { + var rs = d3.round(r, 2); + return '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) { + var rs = d3.round(r, 2); + return '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) { + var rd = d3.round(r * 1.3, 2); + return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z' + + 'M0,-' + rd + 'V' + rd + 'M-' + rd + ',0H' + rd; + }, + needLine: true, + noDot: true + }, + 'diamond-x': { + n: 32, + f: function(r) { + var rd = d3.round(r * 1.3, 2); + var r2 = d3.round(r * 0.65, 2); + return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z' + + 'M-' + r2 + ',-' + r2 + 'L' + r2 + ',' + r2 + + 'M-' + r2 + ',' + r2 + 'L' + r2 + ',-' + r2; + }, + needLine: true, + noDot: true + }, + 'cross-thin': { + n: 33, + f: function(r) { + var rc = d3.round(r * 1.4, 2); + return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'x-thin': { + n: 34, + f: function(r) { + var rx = d3.round(r, 2); + return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx + + 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx; + }, + needLine: true, + noDot: true, + noFill: true + }, + asterisk: { + n: 35, + f: function(r) { + var rc = d3.round(r * 1.2, 2); + var rs = d3.round(r * 0.85, 2); + return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc + + 'M' + rs + ',' + rs + 'L-' + rs + ',-' + rs + + 'M' + rs + ',-' + rs + 'L-' + rs + ',' + rs; + }, + needLine: true, + noDot: true, + noFill: true + }, + hash: { + n: 36, + f: function(r) { + var r1 = d3.round(r / 2, 2); + var r2 = d3.round(r, 2); + return 'M' + r1 + ',' + r2 + 'V-' + r2 + + 'm-' + r2 + ',0V' + r2 + + 'M' + r2 + ',' + r1 + 'H-' + r2 + + 'm0,-' + r2 + 'H' + r2; + }, + needLine: true, + noFill: true + }, + 'y-up': { + n: 37, + f: function(r) { + var x = d3.round(r * 1.2, 2); + var y0 = d3.round(r * 1.6, 2); + var y1 = d3.round(r * 0.8, 2); + return 'M-' + x + ',' + y1 + 'L0,0M' + x + ',' + y1 + 'L0,0M0,-' + y0 + 'L0,0'; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'y-down': { + n: 38, + f: function(r) { + var x = d3.round(r * 1.2, 2); + var y0 = d3.round(r * 1.6, 2); + var y1 = d3.round(r * 0.8, 2); + return 'M-' + x + ',-' + y1 + 'L0,0M' + x + ',-' + y1 + 'L0,0M0,' + y0 + 'L0,0'; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'y-left': { + n: 39, + f: function(r) { + var y = d3.round(r * 1.2, 2); + var x0 = d3.round(r * 1.6, 2); + var x1 = d3.round(r * 0.8, 2); + return 'M' + x1 + ',' + y + 'L0,0M' + x1 + ',-' + y + 'L0,0M-' + x0 + ',0L0,0'; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'y-right': { + n: 40, + f: function(r) { + var y = d3.round(r * 1.2, 2); + var x0 = d3.round(r * 1.6, 2); + var x1 = d3.round(r * 0.8, 2); + return 'M-' + x1 + ',' + y + 'L0,0M-' + x1 + ',-' + y + 'L0,0M' + x0 + ',0L0,0'; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'line-ew': { + n: 41, + f: function(r) { + var rc = d3.round(r * 1.4, 2); + return 'M' + rc + ',0H-' + rc; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'line-ns': { + n: 42, + f: function(r) { + var rc = d3.round(r * 1.4, 2); + return 'M0,' + rc + 'V-' + rc; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'line-ne': { + n: 43, + f: function(r) { + var rx = d3.round(r, 2); + return 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx; + }, + needLine: true, + noDot: true, + noFill: true + }, + 'line-nw': { + n: 44, + f: function(r) { + var rx = d3.round(r, 2); + return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx; + }, + needLine: true, + noDot: true, + noFill: true } - thisGroup[scaleanchor] = 1; -} +}; -},{"../../lib":696,"./axis_ids":747}],752:[function(_dereq_,module,exports){ +},{"d3":8}],66:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var id2name = _dereq_('./axis_ids').id2name; -var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; - -var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; - -var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; - - -exports.enforce = function enforceAxisConstraints(gd) { - var fullLayout = gd._fullLayout; - var constraintGroups = fullLayout._axisConstraintGroups || []; - - var i, j, axisID, ax, normScale, mode, factor; - - for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; - var axisIDs = Object.keys(group); - - var minScale = Infinity; - var maxScale = 0; - // mostly matchScale will be the same as minScale - // ie we expand axis ranges to encompass *everything* - // that's currently in any of their ranges, but during - // autorange of a subset of axes we will ignore other - // axes for this purpose. - var matchScale = Infinity; - var normScales = {}; - var axes = {}; - var hasAnyDomainConstraint = false; - - // find the (normalized) scale of each axis in the group - 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(); - - // set axis scale here so we can use _m rather than - // having to calculate it from length and range - ax.setScale(); - - // abs: inverted scales still satisfy the constraint - 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); - } - - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - maxScale = Math.max(maxScale, normScale); - - if(ax.constrain === 'domain') hasAnyDomainConstraint = true; - } - - // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; - - // now increase any ranges we need to until all normalized scales are equal - for(j = 0; j < axisIDs.length; j++) { - axisID = axisIDs[j]; - normScale = normScales[axisID]; - ax = axes[axisID]; - mode = ax.constrain; - - // even if the scale didn't change, if we're shrinking domain - // we need to recalculate in case `constraintoward` changed - if(normScale !== matchScale || mode === 'domain') { - factor = normScale / matchScale; - - if(mode === 'range') { - scaleZoom(ax, factor); - } - else { - // mode === 'domain' - - 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) { - // we've asked to magnify the axis more than we can just by - // enlarging the domain - so we need to constrict range - ax.domain = ax._input.domain = inputDomain.slice(); - scaleZoom(ax, factor); - continue; - } - - if(rangeShrunk < 1) { - // the range has previously been constricted by ^^, but we've - // switched to the domain-constricted regime, so reset range - ax.range = ax._input.range = ax._inputRange.slice(); - factor *= rangeShrunk; - } - - if(ax.autorange) { - /* - * range & factor may need to change because range was - * calculated for the larger scaling, so some pixel - * paddings may get cut off when we reduce the domain. - * - * This is easier than the regular autorange calculation - * because we already know the scaling `m`, but we still - * need to cut out impossible constraints (like - * annotations with super-long arrows). That's what - * outerMin/Max are for - if the expansion was going to - * go beyond the original domain, it must be impossible - */ - 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); - // extra tiny bit for rounding errors, in case we actually - // *are* expanding to the full domain - var outerMin = rangeCenter - halfRange * factor * 1.0001; - var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); - - updateDomain(ax, factor); - ax.setScale(); - var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); - var minArray = extremes.min; - var maxArray = extremes.max; - var newVal; - var k; - - for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; - if(newVal > outerMin && newVal < rangeMin) { - rangeMin = newVal; - } - } - - for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(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); - } - } - } - } -}; +module.exports = { + visible: { + valType: 'boolean', + + editType: 'calc', + + }, + type: { + valType: 'enumerated', + values: ['percent', 'constant', 'sqrt', 'data'], + + editType: 'calc', + + }, + symmetric: { + valType: 'boolean', + + editType: 'calc', + + }, + array: { + valType: 'data_array', + editType: 'calc', + + }, + arrayminus: { + valType: 'data_array', + editType: 'calc', + + }, + value: { + valType: 'number', + min: 0, + dflt: 10, + + editType: 'calc', + + }, + valueminus: { + valType: 'number', + min: 0, + dflt: 10, + + editType: 'calc', + + }, + 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', + + }, + thickness: { + valType: 'number', + min: 0, + dflt: 2, + + editType: 'style', + + }, + width: { + valType: 'number', + min: 0, + + editType: 'plot', + + }, + editType: 'calc', -// For use before autoranging, check if this axis was previously constrained -// by domain but no longer is -exports.clean = function cleanConstraints(gd, ax) { - if(ax._inputDomain) { - var isConstrained = false; - var axId = ax._id; - var constraintGroups = gd._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; + _deprecated: { + opacity: { + valType: 'number', + + editType: 'style', + } } }; -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 - ]; -} - -},{"../../constants/alignment":668,"../../constants/numerical":673,"./autorange":743,"./axis_ids":747,"./scale_zoom":761}],753:[function(_dereq_,module,exports){ +},{}],67:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); -var supportsPassive = _dereq_('has-passive-events'); +var isNumeric = _dereq_('fast-isnumeric'); var Registry = _dereq_('../../registry'); +var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Fx = _dereq_('../../components/fx'); -var setCursor = _dereq_('../../lib/setcursor'); -var dragElement = _dereq_('../../components/dragelement'); -var FROM_TL = _dereq_('../../constants/alignment').FROM_TL; -var clearGlCanvases = _dereq_('../../lib/clear_gl_canvases'); -var redrawReglTraces = _dereq_('../../plot_api/subroutines').redrawReglTraces; -var Plots = _dereq_('../plots'); +var makeComputeError = _dereq_('./compute_error'); -var doTicksSingle = _dereq_('./axes').doTicksSingle; -var getFromId = _dereq_('./axis_ids').getFromId; -var prepSelect = _dereq_('./select').prepSelect; -var clearSelect = _dereq_('./select').clearSelect; -var selectOnClick = _dereq_('./select').selectOnClick; -var scaleZoom = _dereq_('./scale_zoom'); +module.exports = function calc(gd) { + var calcdata = gd.calcdata; -var constants = _dereq_('./constants'); -var MINDRAG = constants.MINDRAG; -var MINZOOM = constants.MINZOOM; + 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 xa = Axes.getFromId(gd, trace.xaxis); + var ya = Axes.getFromId(gd, trace.yaxis); + calcOneAxis(calcTrace, trace, xa, 'x'); + calcOneAxis(calcTrace, trace, ya, 'y'); + } + } +}; -// flag for showing "doubleclick to zoom out" only at the beginning -var SHOWZOOMOUTTIP = true; +function calcOneAxis(calcTrace, trace, axis, coord) { + var opts = trace['error_' + coord] || {}; + var isVisible = (opts.visible && ['linear', 'log'].indexOf(axis.type) !== -1); + var vals = []; -// dragBox: create an element to drag one or more axis ends -// inputs: -// plotinfo - which subplot are we making dragboxes on? -// x,y,w,h - left, top, width, height of the box -// ns - how does this drag the vertical axis? -// 'n' - top only -// 's' - bottom only -// 'ns' - top and bottom together, difference unchanged -// ew - same for horizontal axis -function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { - // mouseDown stores ms of first mousedown event in the last - // DBLCLICKDELAY ms on the drag bars - // numClicks stores how many mousedowns have been seen - // within DBLCLICKDELAY so we can check for click or doubleclick events - // dragged stores whether a drag has occurred, so we don't have to - // redraw unnecessarily, ie if no move bigger than MINDRAG or MINZOOM px - var zoomlayer = gd._fullLayout._zoomlayer; - var isMainDrag = (ns + ew === 'nsew'); - var singleEnd = (ns + ew).length === 1; + if(!isVisible) return; - // main subplot x and y (i.e. found in plotinfo - the main ones) - var xa0, ya0; - // {ax._id: ax} hash objects - var xaHash, yaHash; - // xaHash/yaHash values (arrays) - var xaxes, yaxes; - // main axis offsets - var xs, ys; - // main axis lengths - var pw, ph; - // contains keys 'xaHash', 'yaHash', 'xaxes', and 'yaxes' - // which are the x/y {ax._id: ax} hash objects and their values - // for linked axis relative to this subplot - var links; - // set to ew/ns val when active, set to '' when inactive - var xActive, yActive; - // are all axes in this subplot are fixed? - var allFixedRanges; - // is subplot constrained? - var isSubplotConstrained; - // do we need to edit x/y ranges? - var editX, editY; - // graph-wide optimization flags - var hasScatterGl, hasSplom, hasSVG; - // collected changes to be made to the plot by relayout at the end - var updates; + var computeError = makeComputeError(opts); - function recomputeAxisLists() { - xa0 = plotinfo.xaxis; - ya0 = plotinfo.yaxis; - pw = xa0._length; - ph = ya0._length; - xs = xa0._offset; - ys = ya0._offset; + for(var i = 0; i < calcTrace.length; i++) { + var calcPt = calcTrace[i]; - xaHash = {}; - xaHash[xa0._id] = xa0; - yaHash = {}; - yaHash[ya0._id] = ya0; + var iIn = calcPt.i; - // if we're dragging two axes at once, also drag overlays - if(ns && ew) { - var overlays = plotinfo.overlays; - for(var i = 0; i < overlays.length; i++) { - var xa = overlays[i].xaxis; - xaHash[xa._id] = xa; - var ya = overlays[i].yaxis; - yaHash[ya._id] = ya; - } - } + // for types that don't include `i` in each calcdata point + if(iIn === undefined) iIn = i; - xaxes = hashValues(xaHash); - yaxes = hashValues(yaHash); - xActive = isDirectionActive(xaxes, ew); - yActive = isDirectionActive(yaxes, ns); - allFixedRanges = !yActive && !xActive; + // for stacked area inserted points + // TODO: errorbars have been tested cursorily with stacked area, + // but not thoroughly. It's not even really clear what you want to do: + // Should it just be calculated based on that trace's size data? + // Should you add errors from below in quadrature? + // And what about normalization, where in principle the errors shrink + // again when you get up to the top end? + // One option would be to forbid errorbars with stacking until we + // decide how to handle these questions. + else if(iIn === null) continue; - links = calcLinks(gd, xaHash, yaHash); - isSubplotConstrained = links.isSubplotConstrained; - editX = ew || isSubplotConstrained; - editY = ns || isSubplotConstrained; + var calcCoord = calcPt[coord]; - var fullLayout = gd._fullLayout; - hasScatterGl = fullLayout._has('scattergl'); - hasSplom = fullLayout._has('splom'); - hasSVG = fullLayout._has('svg'); + 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); + } } - recomputeAxisLists(); + 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); +} - var cursor = getDragCursor(yActive + xActive, gd._fullLayout.dragmode, isMainDrag); - var dragger = makeRectDragger(plotinfo, ns + ew + 'drag', cursor, x, y, w, h); +},{"../../lib":159,"../../plots/cartesian/axes":203,"../../registry":243,"./compute_error":68,"fast-isnumeric":10}],68:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // still need to make the element if the axes are disabled - // but nuke its events (except for maindrag which needs them for hover) - // and stop there - if(allFixedRanges && !isMainDrag) { - dragger.onmousedown = null; - dragger.style.pointerEvents = 'none'; - return dragger; - } - var dragOptions = { - element: dragger, - gd: gd, - plotinfo: plotinfo - }; +'use strict'; - dragOptions.prepFn = function(e, startX, startY) { - var dragModePrev = dragOptions.dragmode; - var dragModeNow = gd._fullLayout.dragmode; - if(dragModeNow !== dragModePrev) { - dragOptions.dragmode = dragModeNow; - } - recomputeAxisLists(); +/** + * Error bar computing function generator + * + * N.B. The generated function does not clean the dataPt entries. Non-numeric + * entries result in undefined error magnitudes. + * + * @param {object} opts error bar attributes + * + * @return {function} : + * @param {numeric} dataPt data point from where to compute the error magnitude + * @param {number} index index of dataPt in its corresponding data array + * @return {array} + * - error[0] : error magnitude in the negative direction + * - error[1] : " " " " positive " + */ +module.exports = function makeComputeError(opts) { + var type = opts.type; + var symmetric = opts.symmetric; - if(!allFixedRanges) { - if(isMainDrag) { - // main dragger handles all drag modes, and changes - // to pan (or to zoom if it already is pan) on shift - if(e.shiftKey) { - if(dragModeNow === 'pan') dragModeNow = 'zoom'; - else if(!isSelectOrLasso(dragModeNow)) dragModeNow = 'pan'; - } - else if(e.ctrlKey) { - dragModeNow = 'pan'; + 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]; + // in case one is present and the other is missing, fill in 0 + // so we still see the present one. Mostly useful during manual + // data entry. + if(!isNaN(val) || !isNaN(valMinus)) { + return [valMinus || 0, val || 0]; } - } - // all other draggers just pan - else dragModeNow = 'pan'; + return [NaN, NaN]; + }; } + } + else { + var computeErrorValue = makeComputeErrorValue(type, opts.value); + var computeErrorValueMinus = makeComputeErrorValue(type, opts.valueminus); - if(dragModeNow === 'lasso') dragOptions.minDrag = 1; - else dragOptions.minDrag = undefined; + if(symmetric || opts.valueminus === undefined) { + return function computeError(dataPt) { + var val = computeErrorValue(dataPt); + return [val, val]; + }; + } + else { + return function computeError(dataPt) { + return [ + computeErrorValueMinus(dataPt), + computeErrorValue(dataPt) + ]; + }; + } + } +}; - if(isSelectOrLasso(dragModeNow)) { - dragOptions.xaxes = xaxes; - dragOptions.yaxes = yaxes; - // this attaches moveFn, clickFn, doneFn on dragOptions - prepSelect(e, startX, startY, dragOptions, dragModeNow); - } else { - dragOptions.clickFn = clickFn; - if(isSelectOrLasso(dragModePrev)) { - // TODO Fix potential bug - // Note: clearing / resetting selection state only happens, when user - // triggers at least one interaction in pan/zoom mode. Otherwise, the - // select/lasso outlines are deleted (in plots.js.cleanPlot) but the selection - // cache isn't cleared. So when the user switches back to select/lasso and - // 'adds to a selection' with Shift, the "old", seemingly removed outlines - // are redrawn again because the selection cache still holds their coordinates. - // However, this isn't easily solved, since plots.js would need - // to have a reference to the dragOptions object (which holds the - // selection cache). - clearAndResetSelect(); - } +/** + * Compute error bar magnitude (for all types except data) + * + * @param {string} type error bar type + * @param {numeric} value error bar value + * + * @return {function} : + * @param {numeric} 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)); + }; + } +} - if(!allFixedRanges) { - if(dragModeNow === 'zoom') { - dragOptions.moveFn = zoomMove; - dragOptions.doneFn = zoomDone; +},{}],69:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // zoomMove takes care of the threshold, but we need to - // minimize this so that constrained zoom boxes will flip - // orientation at the right place - dragOptions.minDrag = 1; +'use strict'; - zoomPrep(e, startX, startY); - } else if(dragModeNow === 'pan') { - dragOptions.moveFn = plotDrag; - dragOptions.doneFn = dragTail; - } - } - } - }; +var isNumeric = _dereq_('fast-isnumeric'); - function clearAndResetSelect() { - // clear selection polygon cache (if any) - dragOptions.plotinfo.selection = false; - // clear selection outlines - clearSelect(zoomlayer); - } +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var Template = _dereq_('../../plot_api/plot_template'); - function clickFn(numClicks, evt) { - var clickmode = gd._fullLayout.clickmode; +var attributes = _dereq_('./attributes'); - removeZoombox(gd); - if(numClicks === 2 && !singleEnd) doubleClick(); +module.exports = function(traceIn, traceOut, defaultColor, opts) { + var objName = 'error_' + opts.axis; + var containerOut = Template.newContainer(traceOut, objName); + var containerIn = traceIn[objName] || {}; - if(isMainDrag) { - if(clickmode.indexOf('select') > -1) { - selectOnClick(evt, gd, xaxes, yaxes, plotinfo.id, dragOptions); - } + function coerce(attr, dflt) { + return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); + } - if(clickmode.indexOf('event') > -1) { - Fx.click(gd, evt, plotinfo.id); - } - } - else if(numClicks === 1 && singleEnd) { - var ax = ns ? ya0 : xa0, - end = (ns === 's' || ew === 'w') ? 0 : 1, - attrStr = ax._name + '.range[' + end + ']', - initialText = getEndText(ax, end), - hAlign = 'left', - vAlign = 'middle'; + var hasErrorBars = ( + containerIn.array !== undefined || + containerIn.value !== undefined || + containerIn.type === 'sqrt' + ); - if(ax.fixedrange) return; + var visible = coerce('visible', hasErrorBars); - if(ns) { - vAlign = (ns === 'n') ? 'top' : 'bottom'; - if(ax.side === 'right') hAlign = 'right'; - } - else if(ew === 'e') hAlign = 'right'; + if(visible === false) return; - if(gd._context.showAxisRangeEntryBoxes) { - d3.select(dragger) - .call(svgTextUtils.makeEditable, { - gd: gd, - immediate: true, - background: gd._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 !== undefined) { - Registry.call('relayout', gd, attrStr, v); - } - }); - } + 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'); + } - dragElement.init(dragOptions); + 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); + } +}; - var x0, - y0, - box, - lum, - path0, - dimmed, - zoomMode, - zb, - corners; +},{"../../lib":159,"../../plot_api/plot_template":193,"../../registry":243,"./attributes":66,"fast-isnumeric":10}],70:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // zoom takes over minDrag, so it also has to take over gd._dragged - var zoomDragged; +'use strict'; - function zoomPrep(e, startX, startY) { - var dragBBox = dragger.getBoundingClientRect(); - x0 = startX - dragBBox.left; - y0 = startY - dragBBox.top; - box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; - lum = gd._hmpixcount ? - (gd._hmlumcount / gd._hmpixcount) : - tinycolor(gd._fullLayout.plot_bgcolor).getLuminance(); - path0 = 'M0,0H' + pw + 'V' + ph + 'H0V0'; - dimmed = false; - zoomMode = 'xy'; - zoomDragged = false; +var Lib = _dereq_('../../lib'); +var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; + +var attributes = _dereq_('./attributes'); + +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; - zb = makeZoombox(zoomlayer, lum, xs, ys, path0); +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; - corners = makeCorners(zoomlayer, xs, ys); - } +module.exports = { + moduleType: 'component', + name: 'errorbars', - function zoomMove(dx0, dy0) { - if(gd._transitioningWithDuration) { - return false; + schema: { + traces: { + scatter: xyAttrs, + bar: xyAttrs, + histogram: xyAttrs, + scatter3d: overrideAll(xyzAttrs, 'calc', 'nested'), + scattergl: overrideAll(xyAttrs, 'calc', 'nested') } + }, - var x1 = Math.max(0, Math.min(pw, dx0 + x0)), - y1 = Math.max(0, Math.min(ph, dy0 + y0)), - dx = Math.abs(x1 - x0), - dy = Math.abs(y1 - y0); - - box.l = Math.min(x0, x1); - box.r = Math.max(x0, x1); - box.t = Math.min(y0, y1); - box.b = Math.max(y0, y1); - - function noZoom() { - zoomMode = ''; - box.r = box.l; - box.t = box.b; - corners.attr('d', 'M0,0Z'); - } + supplyDefaults: _dereq_('./defaults'), - if(isSubplotConstrained) { - if(dx > MINZOOM || dy > MINZOOM) { - zoomMode = 'xy'; - if(dx / pw > dy / ph) { - dy = dx * ph / pw; - if(y0 > y1) box.t = y0 - dy; - else box.b = y0 + dy; - } - else { - dx = dy * pw / ph; - if(x0 > x1) box.l = x0 - dx; - else box.r = x0 + dx; - } - corners.attr('d', xyCorners(box)); - } - else { - noZoom(); - } - } - // look for small drags in one direction or the other, - // and only drag the other axis - else if(!yActive || dy < Math.min(Math.max(dx * 0.6, MINDRAG), MINZOOM)) { - if(dx < MINDRAG || !xActive) { - noZoom(); - } else { - box.t = 0; - box.b = ph; - zoomMode = 'x'; - corners.attr('d', xCorners(box, y0)); - } - } - else if(!xActive || dx < Math.min(dy * 0.6, MINZOOM)) { - box.l = 0; - box.r = pw; - zoomMode = 'y'; - corners.attr('d', yCorners(box, x0)); - } - else { - zoomMode = 'xy'; - corners.attr('d', xyCorners(box)); - } - box.w = box.r - box.l; - box.h = box.b - box.t; + calc: _dereq_('./calc'), + makeComputeError: _dereq_('./compute_error'), - if(zoomMode) zoomDragged = true; - gd._dragged = zoomDragged; + plot: _dereq_('./plot'), + style: _dereq_('./style'), + hoverInfo: hoverInfo +}; - updateZoombox(zb, corners, box, path0, dimmed, lum); - dimmed = true; +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; } +} - function zoomDone() { - updates = {}; +},{"../../lib":159,"../../plot_api/edit_types":186,"./attributes":66,"./calc":67,"./compute_error":68,"./defaults":69,"./plot":71,"./style":72}],71:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // more strict than dragged, which allows you to come back to where you started - // and still count as dragged - if(Math.min(box.h, box.w) < MINDRAG * 2) { - return removeZoombox(gd); - } - // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') { - zoomAxRanges(xaxes, box.l / pw, box.r / pw, updates, links.xaxes); - } - if(zoomMode === 'xy' || zoomMode === 'y') { - zoomAxRanges(yaxes, (ph - box.b) / ph, (ph - box.t) / ph, updates, links.yaxes); - } +'use strict'; - removeZoombox(gd); - dragTail(); - showDoubleClickNotifier(gd); - } +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); - // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph]; - // wait a little after scrolling before redrawing - var redrawTimer = null; - var REDRAWDELAY = constants.REDRAWDELAY; - var mainplot = plotinfo.mainplot ? gd._fullLayout._plots[plotinfo.mainplot] : plotinfo; +var Drawing = _dereq_('../drawing'); +var subTypes = _dereq_('../../traces/scatter/subtypes'); - function zoomWheel(e) { - // deactivate mousewheel scrolling on embedded graphs - // devs can override this with layout._enablescrollzoom, - // but _ ensures this setting won't leave their page - if(!gd._context.scrollZoom && !gd._fullLayout._enablescrollzoom) { - return; - } +module.exports = function plot(gd, traces, plotinfo, transitionOpts) { + var isNew; - clearAndResetSelect(); + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - // If a transition is in progress, then disable any behavior: - if(gd._transitioningWithDuration) { - e.preventDefault(); - e.stopPropagation(); - return; - } + var hasAnimation = transitionOpts && transitionOpts.duration > 0; - var pc = gd.querySelector('.plotly'); + traces.each(function(d) { + var trace = d[0].trace; + // || {} is in case the trace (specifically scatterternary) + // doesn't support error bars at all, but does go through + // the scatter.plot mechanics, which calls ErrorBars.plot + // internally + var xObj = trace.error_x || {}; + var yObj = trace.error_y || {}; - recomputeAxisLists(); + var keyFunc; - // if the plot has scrollbars (more than a tiny excess) - // disable scrollzoom too. - if(pc.scrollHeight - pc.clientHeight > 10 || - pc.scrollWidth - pc.clientWidth > 10) { - return; + if(trace.ids) { + keyFunc = function(d) {return d.id;}; } - clearTimeout(redrawTimer); + var sparse = ( + subTypes.hasMarkers(trace) && + trace.marker.maxdisplayed > 0 + ); - var wheelDelta = -e.deltaY; - if(!isFinite(wheelDelta)) wheelDelta = e.wheelDelta / 10; - if(!isFinite(wheelDelta)) { - Lib.log('Did not find wheel motion attributes: ', e); - return; - } + if(!yObj.visible && !xObj.visible) d = []; - var zoom = Math.exp(-Math.min(Math.max(wheelDelta, -20), 20) / 200), - gbb = mainplot.draglayer.select('.nsewdrag') - .node().getBoundingClientRect(), - xfrac = (e.clientX - gbb.left) / gbb.width, - yfrac = (gbb.bottom - e.clientY) / gbb.height, - i; + var errorbars = d3.select(this).selectAll('g.errorbar') + .data(d, keyFunc); - function zoomWheelOneAxis(ax, centerFraction, zoom) { - if(ax.fixedrange) return; + errorbars.exit().remove(); - var axRange = Lib.simpleMap(ax.range, ax.r2l), - v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; - function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } - ax.range = axRange.map(doZoom); - } + if(!d.length) return; - if(editX) { - // if we're only zooming this axis because of constraints, - // zoom it about the center - if(!ew) xfrac = 0.5; + if(!xObj.visible) errorbars.selectAll('path.xerror').remove(); + if(!yObj.visible) errorbars.selectAll('path.yerror').remove(); - for(i = 0; i < xaxes.length; i++) { - zoomWheelOneAxis(xaxes[i], xfrac, zoom); - } + errorbars.style('opacity', 1); - scrollViewBox[2] *= zoom; - scrollViewBox[0] += scrollViewBox[2] * xfrac * (1 / zoom - 1); + var enter = errorbars.enter().append('g') + .classed('errorbar', true); + + if(hasAnimation) { + enter.style('opacity', 0).transition() + .duration(transitionOpts.duration) + .style('opacity', 1); } - if(editY) { - if(!ns) yfrac = 0.5; - for(i = 0; i < yaxes.length; i++) { - zoomWheelOneAxis(yaxes[i], yfrac, zoom); - } + Drawing.setClipUrl(errorbars, plotinfo.layerClipId, gd); - scrollViewBox[3] *= zoom; - scrollViewBox[1] += scrollViewBox[3] * (1 - yfrac) * (1 / zoom - 1); - } + errorbars.each(function(d) { + var errorbar = d3.select(this); + var coords = errorCoords(d, xa, ya); - // viewbox redraw at first - updateSubplots(scrollViewBox); - ticksAndAnnotations(ns, ew); + if(sparse && !d.vis) return; - // then replot after a delay to make sure - // no more scrolling is coming - redrawTimer = setTimeout(function() { - scrollViewBox = [0, 0, pw, ph]; - dragTail(); - }, REDRAWDELAY); + var path; - e.preventDefault(); - return; - } + var yerror = errorbar.select('path.yerror'); + if(yObj.visible && isNumeric(coords.x) && + isNumeric(coords.yh) && + isNumeric(coords.ys)) { + var yw = yObj.width; - // everything but the corners gets wheel zoom - if(ns.length * ew.length !== 1) { - attachWheelEventHandler(dragger, zoomWheel); - } + path = 'M' + (coords.x - yw) + ',' + + coords.yh + 'h' + (2 * yw) + // hat + 'm-' + yw + ',0V' + coords.ys; // bar - // plotDrag: move the plot in response to a drag - function plotDrag(dx, dy) { - // If a transition is in progress, then disable any behavior: - if(gd._transitioningWithDuration) { - return; - } - if(xActive === 'ew' || yActive === 'ns') { - if(xActive) dragAxList(xaxes, dx); - if(yActive) dragAxList(yaxes, dy); - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); - ticksAndAnnotations(yActive, xActive); - return; - } + if(!coords.noYS) path += 'm-' + yw + ',0h' + (2 * yw); // shoe - // dz: set a new value for one end (0 or 1) of an axis array axArray, - // and return a pixel shift for that end for the viewbox - // based on pixel drag distance d - // TODO: this makes (generally non-fatal) errors when you get - // near floating point limits - function dz(axArray, end, d) { - var otherEnd = 1 - end, - movedAx, - newLinearizedEnd; - for(var i = 0; i < axArray.length; i++) { - var axi = axArray[i]; - 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); + isNew = !yerror.size(); - // if l2r comes back false or undefined, it means we've dragged off - // the end of valid ranges - so stop. - if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; + if(isNew) { + yerror = errorbar.append('path') + .style('vector-effect', 'non-scaling-stroke') + .classed('yerror', true); + } else if(hasAnimation) { + yerror = yerror + .transition() + .duration(transitionOpts.duration) + .ease(transitionOpts.easing); + } + + yerror.attr('d', path); } - return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / - (movedAx._rl[end] - movedAx._rl[otherEnd]); - } + else yerror.remove(); - if(isSubplotConstrained && xActive && yActive) { - // dragging a corner of a constrained subplot: - // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; - var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; - dx = dxyFraction * pw; - dy = dxySign * dxyFraction * ph; - } + 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; - if(xActive === 'w') dx = dz(xaxes, 0, dx); - else if(xActive === 'e') dx = dz(xaxes, 1, -dx); - else if(!xActive) dx = 0; + path = 'M' + coords.xh + ',' + + (coords.y - xw) + 'v' + (2 * xw) + // hat + 'm0,-' + xw + 'H' + coords.xs; // bar - if(yActive === 'n') dy = dz(yaxes, 1, dy); - else if(yActive === 's') dy = dz(yaxes, 0, -dy); - else if(!yActive) dy = 0; + if(!coords.noXS) path += 'm0,-' + xw + 'v' + (2 * xw); // shoe - var x0 = (xActive === 'w') ? dx : 0; - var y0 = (yActive === 'n') ? dy : 0; + isNew = !xerror.size(); - if(isSubplotConstrained) { - var i; - if(!xActive && yActive.length === 1) { - // dragging one end of the y axis of a constrained subplot - // scale the other axis the same about its middle - for(i = 0; i < xaxes.length; i++) { - xaxes[i].range = xaxes[i]._r.slice(); - scaleZoom(xaxes[i], 1 - dy / ph); - } - dx = dy * pw / ph; - x0 = dx / 2; - } - if(!yActive && xActive.length === 1) { - for(i = 0; i < yaxes.length; i++) { - yaxes[i].range = yaxes[i]._r.slice(); - scaleZoom(yaxes[i], 1 - dx / pw); + if(isNew) { + xerror = errorbar.append('path') + .style('vector-effect', 'non-scaling-stroke') + .classed('xerror', true); + } else if(hasAnimation) { + xerror = xerror + .transition() + .duration(transitionOpts.duration) + .ease(transitionOpts.easing); } - dy = dx * ph / pw; - y0 = dy / 2; + + xerror.attr('d', path); } - } + else xerror.remove(); + }); + }); +}; - updateSubplots([x0, y0, pw - dx, ph - dy]); - ticksAndAnnotations(yActive, xActive); - } +// compute the coordinates of the error-bar objects +function errorCoords(d, xa, ya) { + var out = { + x: xa.c2p(d.x), + y: ya.c2p(d.y) + }; - // Draw ticks and annotations (and other components) when ranges change. - // Also records the ranges that have changed for use by update at the end. - function ticksAndAnnotations(ns, ew) { - var activeAxIds = [], - i; + // calculate the error bar size and hat and shoe locations + if(d.yh !== undefined) { + out.yh = ya.c2p(d.yh); + out.ys = ya.c2p(d.ys); - function pushActiveAxIds(axList) { - for(i = 0; i < axList.length; i++) { - if(!axList[i].fixedrange) activeAxIds.push(axList[i]._id); - } + // if the shoes go off-scale (ie log scale, error bars past zero) + // clip the bar and hide the shoes + if(!isNumeric(out.ys)) { + out.noYS = true; + out.ys = ya.c2p(d.ys, true); } + } - if(editX) { - pushActiveAxIds(xaxes); - pushActiveAxIds(links.xaxes); - } - if(editY) { - pushActiveAxIds(yaxes); - pushActiveAxIds(links.yaxes); - } + if(d.xh !== undefined) { + out.xh = xa.c2p(d.xh); + out.xs = xa.c2p(d.xs); - updates = {}; - for(i = 0; i < activeAxIds.length; i++) { - var axId = activeAxIds[i]; - doTicksSingle(gd, axId, true); - var ax = getFromId(gd, axId); - updates[ax._name + '.range[0]'] = ax.range[0]; - updates[ax._name + '.range[1]'] = ax.range[1]; + if(!isNumeric(out.xs)) { + out.noXS = true; + out.xs = xa.c2p(d.xs, true); } + } - function redrawObjs(objArray, method, shortCircuit) { - for(i = 0; i < objArray.length; i++) { - var obji = objArray[i]; - - if((ew && activeAxIds.indexOf(obji.xref) !== -1) || - (ns && activeAxIds.indexOf(obji.yref) !== -1)) { - method(gd, i); - // once is enough for images (which doesn't use the `i` arg anyway) - if(shortCircuit) return; - } - } - } + return out; +} - // annotations and shapes 'draw' method is slow, - // use the finer-grained 'drawOne' method instead +},{"../../traces/scatter/subtypes":305,"../drawing":64,"d3":8,"fast-isnumeric":10}],72:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - redrawObjs(gd._fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); - redrawObjs(gd._fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); - redrawObjs(gd._fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); - } - function doubleClick() { - if(gd._transitioningWithDuration) return; +'use strict'; - var doubleClickConfig = gd._context.doubleClick, - axList = (xActive ? xaxes : []).concat(yActive ? yaxes : []), - attrs = {}; +var d3 = _dereq_('d3'); - var ax, i, rangeInitial; +var Color = _dereq_('../color'); - // For reset+autosize mode: - // If *any* of the main axes is not at its initial range - // (or autoranged, if we have no initial range, to match the logic in - // doubleClickConfig === 'reset' below), we reset. - // If they are *all* at their initial ranges, then we autosize. - if(doubleClickConfig === 'reset+autosize') { - doubleClickConfig = 'autosize'; +module.exports = function style(traces) { + traces.each(function(d) { + var trace = d[0].trace; + var yObj = trace.error_y || {}; + var xObj = trace.error_x || {}; - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - if((ax._rangeInitial && ( - ax.range[0] !== ax._rangeInitial[0] || - ax.range[1] !== ax._rangeInitial[1] - )) || - (!ax._rangeInitial && !ax.autorange) - ) { - doubleClickConfig = 'reset'; - break; - } - } - } + var s = d3.select(this); - if(doubleClickConfig === 'autosize') { - // don't set the linked axes here, so relayout marks them as shrinkable - // and we autosize just to the requested axis/axes - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - if(!ax.fixedrange) attrs[ax._name + '.autorange'] = true; - } - } - else if(doubleClickConfig === 'reset') { - // when we're resetting, reset all linked axes too, so we get back - // to the fully-auto-with-constraints situation - if(xActive || isSubplotConstrained) axList = axList.concat(links.xaxes); - if(yActive && !isSubplotConstrained) axList = axList.concat(links.yaxes); + s.selectAll('path.yerror') + .style('stroke-width', yObj.thickness + 'px') + .call(Color.stroke, yObj.color); - if(isSubplotConstrained) { - if(!xActive) axList = axList.concat(xaxes); - else if(!yActive) axList = axList.concat(yaxes); - } + if(xObj.copy_ystyle) xObj = yObj; - for(i = 0; i < axList.length; i++) { - ax = axList[i]; + s.selectAll('path.xerror') + .style('stroke-width', xObj.thickness + 'px') + .call(Color.stroke, xObj.color); + }); +}; - if(!ax._rangeInitial) { - attrs[ax._name + '.autorange'] = true; - } - else { - rangeInitial = ax._rangeInitial; - attrs[ax._name + '.range[0]'] = rangeInitial[0]; - attrs[ax._name + '.range[1]'] = rangeInitial[1]; - } - } - } +},{"../color":43,"d3":8}],73:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - gd.emit('plotly_doubleclick', null); - Registry.call('relayout', gd, attrs); - } +'use strict'; - // dragTail - finish a drag event with a redraw - function dragTail() { - // put the subplot viewboxes back to default (Because we're going to) - // be repositioning the data in the relayout. But DON'T call - // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` - updateSubplots([0, 0, pw, ph]); +var fontAttrs = _dereq_('../../plots/font_attributes'); - // since we may have been redrawing some things during the drag, we may have - // accumulated MathJax promises - wait for them before we relayout. - Lib.syncOrAsync([ - Plots.previousPromises, - function() { Registry.call('relayout', gd, updates); } - ], gd); +module.exports = { + hoverlabel: { + bgcolor: { + valType: 'color', + + arrayOk: true, + editType: 'none', + + }, + bordercolor: { + valType: 'color', + + arrayOk: true, + editType: 'none', + + }, + font: fontAttrs({ + arrayOk: true, + editType: 'none', + + }), + namelength: { + valType: 'integer', + min: -1, + arrayOk: true, + + editType: 'none', + + }, + editType: 'calc' } +}; - // x/y scaleFactor stash, - // minimizes number of per-point DOM updates in updateSubplots below - var xScaleFactorOld, yScaleFactorOld; - - // updateSubplots - find all plot viewboxes that should be - // affected by this drag, and update them. look for all plots - // sharing an affected axis (including the one being dragged), - // includes also scattergl and splom logic. - function updateSubplots(viewBox) { - var fullLayout = gd._fullLayout; - var plotinfos = fullLayout._plots; - var subplots = fullLayout._subplots.cartesian; - var i, sp, xa, ya; +},{"../../plots/font_attributes":230}],74:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(hasSplom) { - Registry.subplotsRegistry.splom.drag(gd); - } +'use strict'; - if(hasScatterGl) { - for(i = 0; i < subplots.length; i++) { - sp = plotinfos[subplots[i]]; - xa = sp.xaxis; - ya = sp.yaxis; +var Lib = _dereq_('../../lib'); +var Registry = _dereq_('../../registry'); - if(sp._scene) { - var xrng = Lib.simpleMap(xa.range, xa.r2l); - var yrng = Lib.simpleMap(ya.range, ya.r2l); - sp._scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]}); - } - } - } +module.exports = function calc(gd) { + var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; - if(hasSplom || hasScatterGl) { - clearGlCanvases(gd); - redrawReglTraces(gd); - } + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } - if(hasSVG) { - var xScaleFactor = viewBox[2] / xa0._length; - var yScaleFactor = viewBox[3] / ya0._length; + for(var i = 0; i < calcdata.length; i++) { + var cd = calcdata[i]; + var trace = cd[0].trace; - for(i = 0; i < subplots.length; i++) { - sp = plotinfos[subplots[i]]; - xa = sp.xaxis; - ya = sp.yaxis; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - var xScaleFactor2, yScaleFactor2; - var clipDx, clipDy; + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); - if(editX2) { - xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); - } else { - xScaleFactor2 = getLinkedScaleFactor(xa, xScaleFactor, yScaleFactor); - clipDx = scaleAndGetShift(xa, xScaleFactor2); - } + if(trace.hovertemplate) fillFn(trace.hovertemplate, cd, 'ht'); - if(editY2) { - yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); - } else { - yScaleFactor2 = getLinkedScaleFactor(ya, xScaleFactor, yScaleFactor); - clipDy = scaleAndGetShift(ya, yScaleFactor2); - } + if(!trace.hoverlabel) continue; - // don't scale at all if neither axis is scalable here - if(!xScaleFactor2 && !yScaleFactor2) { - continue; - } + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverlabel.namelength, cd, 'hnl'); + } +}; - // but if only one is, reset the other axis scaling - if(!xScaleFactor2) xScaleFactor2 = 1; - if(!yScaleFactor2) yScaleFactor2 = 1; +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; - var plotDx = xa._offset - clipDx / xScaleFactor2; - var plotDy = ya._offset - clipDy / yScaleFactor2; + if(Array.isArray(traceAttr)) { + cd[0][cdAttr] = fn(traceAttr); + } +} - // TODO could be more efficient here: - // setTranslate and setScale do a lot of extra work - // when working independently, should perhaps combine - // them into a single routine. - sp.clipRect - .call(Drawing.setTranslate, clipDx, clipDy) - .call(Drawing.setScale, xScaleFactor2, yScaleFactor2); +},{"../../lib":159,"../../registry":243}],75:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - sp.plot - .call(Drawing.setTranslate, plotDx, plotDy) - .call(Drawing.setScale, 1 / xScaleFactor2, 1 / yScaleFactor2); +'use strict'; - // apply an inverse scale to individual points to counteract - // the scale of the trace group. - // apply only when scale changes, as adjusting the scale of - // all the points can be expansive. - if(xScaleFactor2 !== xScaleFactorOld || yScaleFactor2 !== yScaleFactorOld) { - Drawing.setPointGroupScale(sp.zoomScalePts, xScaleFactor2, yScaleFactor2); - Drawing.setTextPointsScale(sp.zoomScaleTxt, xScaleFactor2, yScaleFactor2); - } +var Registry = _dereq_('../../registry'); +var hover = _dereq_('./hover').hover; - Drawing.hideOutsideRangePoints(sp.clipOnAxisFalseTraces, sp); +module.exports = function click(gd, evt, subplot) { + var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); - // update x/y scaleFactor stash - xScaleFactorOld = xScaleFactor2; - yScaleFactorOld = yScaleFactor2; - } - } + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); } - // Find the appropriate scaling for this axis, if it's linked to the - // dragged axes by constraints. 0 is special, it means this axis shouldn't - // ever be scaled (will be converted to 1 if the other axis is scaled) - function getLinkedScaleFactor(ax, xScaleFactor, yScaleFactor) { - if(ax.fixedrange) return 0; + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } - if(editX && links.xaHash[ax._id]) { - return xScaleFactor; - } - if(editY && (isSubplotConstrained ? links.xaHash : links.yaHash)[ax._id]) { - return yScaleFactor; + if(gd._hoverdata && evt && evt.target) { + if(annotationsDone && annotationsDone.then) { + annotationsDone.then(emitClick); } - return 0; - } + else emitClick(); - function scaleAndGetShift(ax, scaleFactor) { - if(scaleFactor) { - ax.range = ax._r.slice(); - scaleZoom(ax, scaleFactor); - return getShift(ax, scaleFactor); - } - return 0; + // why do we get a double event without this??? + if(evt.stopImmediatePropagation) evt.stopImmediatePropagation(); } +}; - function getShift(ax, scaleFactor) { - return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; - } +},{"../../registry":243,"./hover":79}],76:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return dragger; -} +'use strict'; -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); - }); +module.exports = { + // hover labels for multiple horizontal bars get tilted by this angle + YANGLE: 60, - dragger3.call(setCursor, cursor); + // size and display constants for hover text - return dragger3.node(); -} + // pixel size of hover arrows + HOVERARROWSIZE: 6, + // pixels padding around text + HOVERTEXTPAD: 3, + // hover font + HOVERFONTSIZE: 13, + HOVERFONT: 'Arial, sans-serif', -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; -} + // minimum time (msec) between hover calls + HOVERMINTIME: 50, -function isDirectionActive(axList, activeVal) { - for(var i = 0; i < axList.length; i++) { - if(!axList[i].fixedrange) return activeVal; - } - return ''; -} + // ID suffix (with fullLayout._uid) for hover events in the throttle cache + HOVERID: '-hover' +}; -function getEndText(ax, end) { - var initialVal = ax.range[end], - diff = Math.abs(initialVal - ax.range[1 - end]), - dig; +},{}],77:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // TODO: this should basically be ax.r2d but we're doing extra - // rounding here... can we clean up at all? - if(ax.type === 'date') { - return initialVal; - } - else if(ax.type === 'log') { - dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; - return d3.format('.' + dig + 'g')(Math.pow(10, initialVal)); - } - else { // linear numeric (or category... but just show numbers here) - dig = Math.floor(Math.log(Math.abs(initialVal)) / Math.LN10) - - Math.floor(Math.log(diff) / Math.LN10) + 4; - return d3.format('.' + String(dig) + 'g')(initialVal); - } -} +'use strict'; -function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { - var i, - axi, - axRangeLinear0, - axRangeLinearSpan; +var Lib = _dereq_('../../lib'); +var attributes = _dereq_('./attributes'); +var handleHoverLabelDefaults = _dereq_('./hoverlabel_defaults'); - for(i = 0; i < axList.length; i++) { - axi = axList[i]; - if(axi.fixedrange) continue; +module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { + function coerce(attr, dflt) { + return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + } - axRangeLinear0 = axi._rl[0]; - axRangeLinearSpan = axi._rl[1] - axRangeLinear0; - axi.range = [ - axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), - axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) - ]; + handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); +}; - updates[axi._name + '.range[0]'] = axi.range[0]; - updates[axi._name + '.range[1]'] = axi.range[1]; - } +},{"../../lib":159,"./attributes":73,"./hoverlabel_defaults":80}],78:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // zoom linked axes about their centers - if(linkedAxes && linkedAxes.length) { - var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; +'use strict'; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); - } -} +var Lib = _dereq_('../../lib'); -function dragAxList(axList, pix) { - for(var i = 0; i < axList.length; i++) { - var axi = axList[i]; - if(!axi.fixedrange) { - axi.range = [ - axi.l2r(axi._rl[0] - pix / axi._m), - axi.l2r(axi._rl[1] - pix / axi._m) - ]; +// look for either subplot or xaxis and yaxis attributes +// does not handle splom case +exports.getSubplot = function getSubplot(trace) { + return trace.subplot || (trace.xaxis + trace.yaxis) || trace.geo; +}; + +// is trace in given list of subplots? +// does handle splom case +exports.isTraceInSubplots = function isTraceInSubplot(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; } -} -// common transform for dragging one end of an axis -// d>0 is compressing scale (cursor is over the plot, -// the axis end should move with the cursor) -// d<0 is expanding (cursor is off the plot, axis end moves -// nonlinearly so you can expand far) -function dZoom(d) { - return 1 - ((d >= 0) ? Math.min(d, 0.9) : - 1 / (1 / Math.max(d, -0.3) + 3.222)); -} + return subplots.indexOf(exports.getSubplot(trace)) !== -1; +}; -function getDragCursor(nsew, dragmode, isMainDrag) { - if(!nsew) return 'pointer'; - if(nsew === 'nsew') { - // in this case here, clear cursor and - // use the cursor style set on - if(isMainDrag) return ''; - if(dragmode === 'pan') return 'move'; - return 'crosshair'; +// convenience functions for mapping all relevant axes +exports.flat = function flat(subplots, v) { + var out = new Array(subplots.length); + for(var i = 0; i < subplots.length; i++) { + out[i] = v; } - return nsew.toLowerCase() + '-resize'; -} - -function makeZoombox(zoomlayer, lum, xs, ys, 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', 'translate(' + xs + ', ' + ys + ')') - .attr('d', path0 + 'Z'); -} - -function makeCorners(zoomlayer, xs, ys) { - return zoomlayer.append('path') - .attr('class', 'zoombox-corners') - .style({ - fill: Color.background, - stroke: Color.defaultLine, - 'stroke-width': 1, - opacity: 0 - }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') - .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); -} + return out; +}; -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); +exports.p2c = function p2c(axArray, v) { + var out = new Array(axArray.length); + for(var i = 0; i < axArray.length; i++) { + out[i] = axArray[i].p2c(v); } -} + return out; +}; -function removeZoombox(gd) { - d3.select(gd) - .selectAll('.zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners') - .remove(); -} +exports.getDistanceFunction = function getDistanceFunction(mode, dx, dy, dxy) { + if(mode === 'closest') return dxy || exports.quadrature(dx, dy); + return mode === 'x' ? dx : dy; +}; -function showDoubleClickNotifier(gd) { - if(SHOWZOOMOUTTIP && gd.data && gd._context.showTips) { - Lib.notifier(Lib._(gd, 'Double-click to zoom back out'), 'long'); - SHOWZOOMOUTTIP = false; +exports.getClosest = function getClosest(cd, distfn, pointData) { + // do we already have a point number? (array mode only) + if(pointData.index !== false) { + if(pointData.index >= 0 && pointData.index < cd.length) { + pointData.distance = 0; + } + else pointData.index = false; } -} - -function isSelectOrLasso(dragmode) { - return dragmode === 'lasso' || dragmode === 'select'; -} - -function xCorners(box, y0) { - return 'M' + - (box.l - 0.5) + ',' + (y0 - MINZOOM - 0.5) + - 'h-3v' + (2 * MINZOOM + 1) + 'h3ZM' + - (box.r + 0.5) + ',' + (y0 - MINZOOM - 0.5) + - 'h3v' + (2 * MINZOOM + 1) + 'h-3Z'; -} - -function yCorners(box, x0) { - return 'M' + - (x0 - MINZOOM - 0.5) + ',' + (box.t - 0.5) + - 'v-3h' + (2 * MINZOOM + 1) + 'v3ZM' + - (x0 - MINZOOM - 0.5) + ',' + (box.b + 0.5) + - 'v3h' + (2 * MINZOOM + 1) + 'v-3Z'; -} + else { + // apply the distance function to each data point + // this is the longest loop... if this bogs down, we may need + // to create pre-sorted data (by x or y), not sure how to + // do this for 'closest' + for(var i = 0; i < cd.length; i++) { + var newDistance = distfn(cd[i]); + if(newDistance <= pointData.distance) { + pointData.index = i; + pointData.distance = newDistance; + } + } + } + return pointData; +}; -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'; -} +/* + * pseudo-distance function for hover effects on areas: inside the region + * distance is finite (`passVal`), outside it's Infinity. + * + * @param {number} v0: signed difference between the current position and the left edge + * @param {number} v1: signed difference between the current position and the right edge + * @param {number} passVal: the value to return on success + */ +exports.inbox = function inbox(v0, v1, passVal) { + return (v0 * v1 < 0 || v0 === 0) ? passVal : Infinity; +}; -function calcLinks(gd, xaHash, yaHash) { - var constraintGroups = gd._fullLayout._axisConstraintGroups; - var isSubplotConstrained = false; - var xLinks = {}; - var yLinks = {}; - var xID, yID, xLinkID, yLinkID; +exports.quadrature = function quadrature(dx, dy) { + return function(di) { + var x = dx(di); + var y = dy(di); + return Math.sqrt(x * x + y * y); + }; +}; - for(var i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; - // check if any of the x axes we're dragging is in this constraint group - for(xID in xaHash) { - if(group[xID]) { - // put the rest of these axes into xLinks, if we're not already - // dragging them, so we know to scale these axes automatically too - // to match the changes in the dragged x axes - for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { - xLinks[xLinkID] = 1; - } - } +/** Fill event data point object for hover and selection. + * Invokes _module.eventData if present. + * + * N.B. note that point 'index' corresponds to input data array index + * whereas 'number' is its post-transform version. + * + * If the hovered/selected pt corresponds to an multiple input points + * (e.g. for histogram and transformed traces), 'pointNumbers` and 'pointIndices' + * are include in the event data. + * + * @param {object} pt + * @param {object} trace + * @param {object} cd + * @return {object} + */ +exports.makeEventData = function makeEventData(pt, trace, cd) { + // hover uses 'index', select uses 'pointNumber' + var pointNumber = 'index' in pt ? pt.index : pt.pointNumber; - // check if the x and y axes of THIS drag are linked - for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; - } - } - } + var out = { + data: trace._input, + fullData: trace, + curveNumber: trace.index, + pointNumber: pointNumber + }; - // now check if any of the y axes we're dragging is in this constraint group - // only look for outside links, as we've already checked for links within the dragger - for(yID in yaHash) { - if(group[yID]) { - for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { - yLinks[yLinkID] = 1; - } - } - } + 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(isSubplotConstrained) { - // merge xLinks and yLinks if the subplot is constrained, - // since we'll always apply both anyway and the two will contain - // duplicates - Lib.extendFlat(xLinks, yLinks); - yLinks = {}; - } + if(trace._module.eventData) { + out = trace._module.eventData(out, pt, trace, cd, pointNumber); + } else { + if('xVal' in pt) out.x = pt.xVal; + else if('x' in pt) out.x = pt.x; - var xaHashLinked = {}; - var xaxesLinked = []; - for(xLinkID in xLinks) { - var xa = getFromId(gd, xLinkID); - xaxesLinked.push(xa); - xaHashLinked[xa._id] = xa; - } + if('yVal' in pt) out.y = pt.yVal; + else if('y' in pt) out.y = pt.y; - var yaHashLinked = {}; - var yaxesLinked = []; - for(yLinkID in yLinks) { - var ya = getFromId(gd, yLinkID); - yaxesLinked.push(ya); - yaHashLinked[ya._id] = ya; + if(pt.xa) out.xaxis = pt.xa; + if(pt.ya) out.yaxis = pt.ya; + if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } - return { - xaHash: xaHashLinked, - yaHash: yaHashLinked, - xaxes: xaxesLinked, - yaxes: yaxesLinked, - isSubplotConstrained: isSubplotConstrained - }; -} + exports.appendArrayPointValue(out, trace, pointNumber); -// still seems to be some confusion about onwheel vs onmousewheel... -function attachWheelEventHandler(element, handler) { - if(!supportsPassive) { - if(element.onwheel !== undefined) element.onwheel = handler; - else if(element.onmousewheel !== undefined) element.onmousewheel = handler; + return out; +}; + +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number|Array(number)} pointNumber : point number. May be a length-2 array + * [row, col] to dig into 2D arrays + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + if(!arrayAttrs) { + return; } - else { - var wheelEventName = element.onwheel !== undefined ? 'wheel' : 'mousewheel'; - if(element._onwheel) { - element.removeEventListener(wheelEventName, element._onwheel); - } - element._onwheel = handler; + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key = getPointKey(astr); - element.addEventListener(wheelEventName, handler, {passive: false}); + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + var pointVal = getPointData(val, pointNumber); + + if(pointVal !== undefined) pointData[key] = pointVal; + } } -} +}; -function hashValues(hash) { - var out = []; - for(var k in hash) out.push(hash[k]); - return out; -} +/** + * Appends values inside array attributes corresponding to given point number array + * For use when pointData references a plot entity that arose (or potentially arose) + * from multiple points in the input data + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {Array(number)|Array(Array(number))} pointNumbers : Array of point numbers. + * Each entry in the array may itself be a length-2 array [row, col] to dig into 2D arrays + */ +exports.appendArrayMultiPointValues = function(pointData, trace, pointNumbers) { + var arrayAttrs = trace._arrayAttrs; -module.exports = { - makeDragBox: makeDragBox, + if(!arrayAttrs) { + return; + } - makeDragger: makeDragger, - makeRectDragger: makeRectDragger, - makeZoombox: makeZoombox, - makeCorners: makeCorners, + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key = getPointKey(astr); - updateZoombox: updateZoombox, - xyCorners: xyCorners, - transitionZoombox: transitionZoombox, - removeZoombox: removeZoombox, - showDoubleClickNotifier: showDoubleClickNotifier, + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + var keyVal = new Array(pointNumbers.length); - attachWheelEventHandler: attachWheelEventHandler + 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' }; -},{"../../components/color":570,"../../components/dragelement":592,"../../components/drawing":595,"../../components/fx":612,"../../constants/alignment":668,"../../lib":696,"../../lib/clear_gl_canvases":680,"../../lib/setcursor":716,"../../lib/svg_text_utils":720,"../../plot_api/subroutines":735,"../../registry":827,"../plots":808,"./axes":744,"./axis_ids":747,"./constants":750,"./scale_zoom":761,"./select":762,"d3":148,"has-passive-events":394,"tinycolor2":514}],754:[function(_dereq_,module,exports){ +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]; + } +} + +},{"../../lib":159}],79:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); +var tinycolor = _dereq_('tinycolor2'); -var Fx = _dereq_('../../components/fx'); -var dragElement = _dereq_('../../components/dragelement'); -var setCursor = _dereq_('../../lib/setcursor'); - -var makeDragBox = _dereq_('./dragbox').makeDragBox; -var DRAGGERSIZE = _dereq_('./constants').DRAGGERSIZE; +var Lib = _dereq_('../../lib'); +var Events = _dereq_('../../lib/events'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var overrideCursor = _dereq_('../../lib/override_cursor'); +var Drawing = _dereq_('../drawing'); +var Color = _dereq_('../color'); +var dragElement = _dereq_('../dragelement'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var Registry = _dereq_('../../registry'); -exports.initInteractions = function initInteractions(gd) { - var fullLayout = gd._fullLayout; +var helpers = _dereq_('./helpers'); +var constants = _dereq_('./constants'); - if(gd._context.staticPlot) { - // this sweeps up more than just cartesian drag elements... - d3.select(gd).selectAll('.drag').remove(); - return; - } +// hover labels for multiple horizontal bars get tilted by some angle, +// then need to be offset differently if they overlap +var YANGLE = constants.YANGLE; +var YA_RADIANS = Math.PI * YANGLE / 180; - if(!fullLayout._has('cartesian') && !fullLayout._has('splom')) return; +// expansion of projected height +var YFACTOR = 1 / Math.sin(YA_RADIANS); - var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { - // sort overlays last, then by x axis number, then y axis number - if((fullLayout._plots[a].mainplot && true) === - (fullLayout._plots[b].mainplot && true)) { - var aParts = a.split('y'), - 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; - }); +// to make the appropriate post-rotation x offset, +// you need both x and y offsets +var YSHIFTX = Math.cos(YA_RADIANS); +var YSHIFTY = Math.sin(YA_RADIANS); - subplots.forEach(function(subplot) { - var plotinfo = fullLayout._plots[subplot]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; +// size and display constants for hover text +var HOVERARROWSIZE = constants.HOVERARROWSIZE; +var HOVERTEXTPAD = constants.HOVERTEXTPAD; - // main and corner draggers need not be repeated for - // overlaid subplots - these draggers drag them all - if(!plotinfo.mainplot) { - // main dragger goes over the grids and data, so we use its - // mousemove events for all data hover effects - var maindrag = makeDragBox(gd, plotinfo, xa._offset, ya._offset, - xa._length, ya._length, 'ns', 'ew'); +// fx.hover: highlight data on hover +// evt can be a mousemove event, or an object with data about what points +// to hover on +// {xpx,ypx[,hovermode]} - pixel locations from top left +// (with optional overriding hovermode) +// {xval,yval[,hovermode]} - data values +// [{curveNumber,(pointNumber|xval and/or yval)}] - +// array of specific points to highlight +// pointNumber is a single integer if gd.data[curveNumber] is 1D, +// or a two-element array if it's 2D +// xval and yval are data values, +// 1D data may specify either or both, +// 2D data must specify both +// subplot is an id string (default "xy") +// makes use of gl.hovermode, which can be: +// x (find the points with the closest x values, ie a column), +// closest (find the single closest point) +// internally there are two more that occasionally get used: +// y (pick out a row - only used for multiple horizontal bar charts) +// array (used when the user specifies an explicit +// array of points to hover on) +// +// We wrap the hovers in a timer, to limit their frequency. +// The actual rendering is done by private function _hover. +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { + gd = Lib.getGraphDiv(gd); - maindrag.onmousemove = function(evt) { - // This is on `gd._fullLayout`, *not* fullLayout because the reference - // changes by the time this is called again. - gd._fullLayout._rehover = function() { - if(gd._fullLayout._hoversubplot === subplot) { - Fx.hover(gd, evt, subplot); - } - }; + Lib.throttle( + gd._fullLayout._uid + constants.HOVERID, + constants.HOVERMINTIME, + function() { _hover(gd, evt, subplot, noHoverEvent); } + ); +}; - Fx.hover(gd, evt, subplot); +/* + * Draw a single hover item in a pre-existing svg container somewhere + * hoverItem should have keys: + * - x and y (or x0, x1, y0, and y1): + * the pixel position to mark, relative to opts.container + * - xLabel, yLabel, zLabel, text, and name: + * info to go in the label + * - color: + * the background color for the label. + * - idealAlign (optional): + * 'left' or 'right' for which side of the x/y box to try to put this on first + * - borderColor (optional): + * color for the border, defaults to strongest contrast with color + * - fontFamily (optional): + * string, the font for this label, defaults to constants.HOVERFONT + * - fontSize (optional): + * the label font size, defaults to constants.HOVERFONTSIZE + * - fontColor (optional): + * defaults to borderColor + * opts should have keys: + * - bgColor: + * the background color this is against, used if the trace is + * non-opaque, and for the name, which goes outside the box + * - container: + * a or element to add the hover label to + * - outerContainer: + * normally a parent of `container`, sets the bounding box to use to + * constrain the hover label and determine whether to show it on the left or right + */ +exports.loneHover = function loneHover(hoverItem, opts) { + var pointData = { + 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, - // Note that we have *not* used the cached fullLayout variable here - // since that may be outdated when this is called as a callback later on - gd._fullLayout._lasthover = maindrag; - gd._fullLayout._hoversubplot = subplot; - }; + // optional extra bits of styling + borderColor: hoverItem.borderColor, + fontFamily: hoverItem.fontFamily, + fontSize: hoverItem.fontSize, + fontColor: hoverItem.fontColor, - /* - * IMPORTANT: - * We must check for the presence of the drag cover here. - * If we don't, a 'mouseout' event is triggered on the - * maindrag before each 'click' event, which has the effect - * of clearing the hoverdata; thus, cancelling the click event. - */ - maindrag.onmouseout = function(evt) { - if(gd._dragging) return; + // filler to make createHoverText happy + trace: hoverItem.trace || { + index: 0, + hoverinfo: '' + }, + xa: {_offset: 0}, + ya: {_offset: 0}, + index: 0, - // When the mouse leaves this maindrag, unset the hovered subplot. - // This may cause problems if it leaves the subplot directly *onto* - // another subplot, but that's a tiny corner case at the moment. - gd._fullLayout._hoversubplot = null; + hovertemplate: hoverItem.hovertemplate || false, + eventData: hoverItem.eventData || false, + hovertemplateLabels: hoverItem.hovertemplateLabels || false, + }; - dragElement.unhover(gd, evt); - }; + var container3 = d3.select(opts.container); + var outerContainer3 = opts.outerContainer ? + d3.select(opts.outerContainer) : container3; - // corner draggers - if(gd._context.showAxisDragHandles) { - makeDragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset - DRAGGERSIZE, - DRAGGERSIZE, DRAGGERSIZE, 'n', 'w'); - makeDragBox(gd, plotinfo, xa._offset + xa._length, ya._offset - DRAGGERSIZE, - DRAGGERSIZE, DRAGGERSIZE, 'n', 'e'); - makeDragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset + ya._length, - DRAGGERSIZE, DRAGGERSIZE, 's', 'w'); - makeDragBox(gd, plotinfo, xa._offset + xa._length, ya._offset + ya._length, - DRAGGERSIZE, DRAGGERSIZE, 's', 'e'); - } - } - if(gd._context.showAxisDragHandles) { - // x axis draggers - if you have overlaid plots, - // these drag each axis separately - if(subplot === xa._mainSubplot) { - // the y position of the main x axis line - var y0 = xa._mainLinePosition; - if(xa.side === 'top') y0 -= DRAGGERSIZE; - makeDragBox(gd, plotinfo, xa._offset + xa._length * 0.1, y0, - xa._length * 0.8, DRAGGERSIZE, '', 'ew'); - makeDragBox(gd, plotinfo, xa._offset, y0, - xa._length * 0.1, DRAGGERSIZE, '', 'w'); - makeDragBox(gd, plotinfo, xa._offset + xa._length * 0.9, y0, - xa._length * 0.1, DRAGGERSIZE, '', 'e'); - } - // y axis draggers - if(subplot === ya._mainSubplot) { - // the x position of the main y axis line - var x0 = ya._mainLinePosition; - if(ya.side !== 'right') x0 -= DRAGGERSIZE; - makeDragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.1, - DRAGGERSIZE, ya._length * 0.8, 'ns', ''); - makeDragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.9, - DRAGGERSIZE, ya._length * 0.1, 's', ''); - makeDragBox(gd, plotinfo, x0, ya._offset, - DRAGGERSIZE, ya._length * 0.1, 'n', ''); - } - } - }); + var fullOpts = { + hovermode: 'closest', + rotateLabels: false, + bgColor: opts.bgColor || Color.background, + container: container3, + outerContainer: outerContainer3 + }; + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); + alignHoverText(hoverLabel, fullOpts.rotateLabels); - // In case you mousemove over some hovertext, send it to Fx.hover too - // we do this so that we can put the hover text in front of everything, - // but still be able to interact with everything as if it isn't there - var hoverLayer = fullLayout._hoverlayer.node(); + return hoverLabel.node(); +}; - hoverLayer.onmousemove = function(evt) { - evt.target = gd._fullLayout._lasthover; - Fx.hover(gd, evt, fullLayout._hoversubplot); - }; +exports.multiHovers = function multiHovers(hoverItems, opts) { - hoverLayer.onclick = function(evt) { - evt.target = gd._fullLayout._lasthover; - Fx.click(gd, evt); - }; + if(!Array.isArray(hoverItems)) { + hoverItems = [hoverItems]; + } - // also delegate mousedowns... TODO: does this actually work? - hoverLayer.onmousedown = function(evt) { - gd._fullLayout._lasthover.onmousedown(evt); - }; + var pointsData = hoverItems.map(function(hoverItem) { + 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, - exports.updateFx(gd); -}; + // optional extra bits of styling + borderColor: hoverItem.borderColor, + fontFamily: hoverItem.fontFamily, + fontSize: hoverItem.fontSize, + fontColor: hoverItem.fontColor, -// Minimal set of update needed on 'modebar' edits. -// We only need to update the cursor style. -// -// Note that changing the axis configuration and/or the fixedrange attribute -// should trigger a full initInteractions. -exports.updateFx = function(gd) { - var fullLayout = gd._fullLayout; - var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair'; - setCursor(fullLayout._draggers, cursor); -}; + // filler to make createHoverText happy + trace: hoverItem.trace || { + index: 0, + hoverinfo: '' + }, + xa: {_offset: 0}, + ya: {_offset: 0}, + index: 0, -},{"../../components/dragelement":592,"../../components/fx":612,"../../lib/setcursor":716,"./constants":750,"./dragbox":753,"d3":148}],755:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + hovertemplate: hoverItem.hovertemplate || false, + eventData: hoverItem.eventData || false, + hovertemplateLabels: hoverItem.hovertemplateLabels || false, + }; + }); -'use strict'; + var container3 = d3.select(opts.container); + var outerContainer3 = opts.outerContainer ? d3.select(opts.outerContainer) : container3; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); + var fullOpts = { + hovermode: 'closest', + rotateLabels: false, + bgColor: opts.bgColor || Color.background, + container: container3, + outerContainer: outerContainer3 + }; -/** - * Factory function for checking component arrays for subplot references. - * - * @param {string} containerArrayName: the top-level array in gd.layout to check - * If an item in this container is found that references a cartesian x and/or y axis, - * ensure cartesian is marked as a base plot module and record the axes (and subplot - * if both refs are axes) in gd._fullLayout - * - * @return {function}: with args layoutIn (gd.layout) and layoutOut (gd._fullLayout) - * as expected of a component includeBasePlot method - */ -module.exports = function makeIncludeComponents(containerArrayName) { - return function includeComponents(layoutIn, layoutOut) { - var array = layoutIn[containerArrayName]; - if(!Array.isArray(array)) return; + var hoverLabel = createHoverText(pointsData, fullOpts, opts.gd); - 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'); + // Fix vertical overlap + var tooltipSpacing = 5; + var lastBottomY = 0; + hoverLabel + .sort(function(a, b) {return a.y0 - b.y0;}) + .each(function(d) { + var topY = d.y0 - d.by / 2; - for(var i = 0; i < array.length; i++) { - var itemi = array[i]; - if(!Lib.isPlainObject(itemi)) continue; + if((topY - tooltipSpacing) < lastBottomY) { + d.offset = (lastBottomY - topY) + tooltipSpacing; + } else { + d.offset = 0; + } - var xref = itemi.xref; - var yref = itemi.yref; + lastBottomY = topY + d.by + d.offset; + }); - 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; - } + alignHoverText(hoverLabel, fullOpts.rotateLabels); - /* - * Notice the logic here: only add a subplot for a component if - * it's referencing both x and y axes AND it's creating a new axis - * so for example if your plot already has xy and x2y2, an annotation - * on x2y or xy2 will not create a new subplot. - */ - if(newAxis && hasXref && hasYref) { - cartesianList.push(xref + yref); - } - } - } - }; + return hoverLabel.node(); }; -},{"../../lib":696,"../../registry":827}],756:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +// The actual implementation is here: +function _hover(gd, evt, subplot, noHoverEvent) { + if(!subplot) subplot = 'xy'; + // if the user passed in an array of subplots, + // use those instead of finding overlayed plots + var subplots = Array.isArray(subplot) ? subplot : [subplot]; -'use strict'; + var fullLayout = gd._fullLayout; + var plots = fullLayout._plots || []; + var plotinfo = plots[subplot]; + var hasCartesian = fullLayout._has('cartesian'); -var d3 = _dereq_('d3'); + // list of all overlaid subplots to look at + if(plotinfo) { + var overlayedSubplots = plotinfo.overlays.map(function(pi) { + return pi.id; + }); -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Plots = _dereq_('../plots'); -var Drawing = _dereq_('../../components/drawing'); + subplots = subplots.concat(overlayedSubplots); + } -var getModuleCalcData = _dereq_('../get_data').getModuleCalcData; -var axisIds = _dereq_('./axis_ids'); -var constants = _dereq_('./constants'); -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); + var len = subplots.length; + var xaArray = new Array(len); + var yaArray = new Array(len); + var supportsCompare = false; -var ensureSingle = Lib.ensureSingle; + for(var i = 0; i < len; i++) { + var spId = subplots[i]; -function ensureSingleAndAddDatum(parent, nodeType, className) { - return Lib.ensureSingle(parent, nodeType, className, function(s) { - s.datum(className); - }); -} + // 'cartesian' case + var plotObj = plots[spId]; + if(plotObj) { + supportsCompare = true; -exports.name = 'cartesian'; + // TODO make sure that fullLayout_plots axis refs + // get updated properly so that we don't have + // to use Axes.getFromId in general. -exports.attr = ['xaxis', 'yaxis']; + xaArray[i] = Axes.getFromId(gd, plotObj.xaxis._id); + yaArray[i] = Axes.getFromId(gd, plotObj.yaxis._id); + continue; + } -exports.idRoot = ['x', 'y']; + // other subplot types + var _subplot = fullLayout[spId]._subplot; + xaArray[i] = _subplot.xaxis; + yaArray[i] = _subplot.yaxis; + } -exports.idRegex = constants.idRegex; + var hovermode = evt.hovermode || fullLayout.hovermode; -exports.attrRegex = constants.attrRegex; + if(hovermode && !supportsCompare) hovermode = 'closest'; -exports.attributes = _dereq_('./attributes'); + if(['x', 'y', 'closest'].indexOf(hovermode) === -1 || !gd.calcdata || + gd.querySelector('.zoombox') || gd._dragging) { + return dragElement.unhoverRaw(gd, evt); + } -exports.layoutAttributes = _dereq_('./layout_attributes'); + var hoverdistance = fullLayout.hoverdistance === -1 ? Infinity : fullLayout.hoverdistance; + var spikedistance = fullLayout.spikedistance === -1 ? Infinity : fullLayout.spikedistance; -exports.supplyLayoutDefaults = _dereq_('./layout_defaults'); + // hoverData: the set of candidate points we've found to highlight + var hoverData = []; -exports.transitionAxes = _dereq_('./transition_axes'); + // searchData: the data to search in. Mostly this is just a copy of + // gd.calcdata, filtered to the subplot and overlays we're on + // but if a point array is supplied it will be a mapping + // of indicated curves + var searchData = []; -exports.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, xi, yi; + // [x|y]valArray: the axis values of the hover event + // mapped onto each of the currently selected overlaid subplots + var xvalArray, yvalArray; - for(i = 0; i < spAll.length; i++) { - var parts = spAll[i].split('y'); - allX[parts[0]] = 1; - allY['y' + parts[1]] = 1; - } + var itemnum, curvenum, cd, trace, subplotId, subploti, mode, + xval, yval, pointData, closedataPreviousLength; - // check for x axes with no subplot, and make one from the anchor of that x axis - for(i = 0; i < xList.length; i++) { - xi = xList[i]; - if(!allX[xi]) { - yi = (layoutIn[axisIds.id2name(xi)] || {}).anchor; - if(!constants.idRegex.y.test(yi)) yi = 'y'; - spSVG.push(xi + yi); - spAll.push(xi + yi); + // spikePoints: the set of candidate points we've found to draw spikes to + var spikePoints = { + hLinePoint: null, + vLinePoint: null + }; - if(!allY[yi]) { - allY[yi] = 1; - Lib.pushUnique(yList, yi); - } - } - } + // does subplot have one (or more) horizontal traces? + // This is used to determine whether we rotate the labels or not + var hasOneHorizontalTrace = false; - // same for y axes with no subplot - for(i = 0; i < yList.length; i++) { - yi = yList[i]; - if(!allY[yi]) { - xi = (layoutIn[axisIds.id2name(yi)] || {}).anchor; - if(!constants.idRegex.x.test(xi)) xi = 'x'; - spSVG.push(xi + yi); - spAll.push(xi + yi); + // Figure out what we're hovering on: + // mouse location or user-supplied data - if(!allX[xi]) { - allX[xi] = 1; - Lib.pushUnique(xList, xi); + if(Array.isArray(evt)) { + // user specified an array of points to highlight + hovermode = 'array'; + for(itemnum = 0; itemnum < evt.length; itemnum++) { + cd = gd.calcdata[evt[itemnum].curveNumber || 0]; + if(cd) { + trace = cd[0].trace; + if(cd[0].trace.hoverinfo !== 'skip') { + searchData.push(cd); + if(trace.orientation === 'h') { + hasOneHorizontalTrace = true; + } + } } } } - - // finally, if we've gotten here we're supposed to show cartesian... - // so if there are NO subplots at all, make one from the first - // x & y axes in the input layout - if(!spAll.length) { - xi = ''; - yi = ''; - for(var ki in layoutIn) { - if(constants.attrRegex.test(ki)) { - var axLetter = ki.charAt(0); - if(axLetter === 'x') { - if(!xi || (+ki.substr(5) < +xi.substr(5))) { - xi = ki; - } - } - else if(!yi || (+ki.substr(5) < +yi.substr(5))) { - yi = ki; + else { + for(curvenum = 0; curvenum < gd.calcdata.length; curvenum++) { + cd = gd.calcdata[curvenum]; + trace = cd[0].trace; + if(trace.hoverinfo !== 'skip' && helpers.isTraceInSubplots(trace, subplots)) { + searchData.push(cd); + if(trace.orientation === 'h') { + hasOneHorizontalTrace = true; } } } - xi = xi ? axisIds.name2id(xi) : 'x'; - yi = yi ? axisIds.name2id(yi) : 'y'; - xList.push(xi); - yList.push(yi); - spSVG.push(xi + yi); - } -}; - -/** - * Cartesian.plot - * - * @param {DOM div | object} gd - * @param {array | null} (optional) traces - * array of traces indices to plot - * if undefined, plots all cartesian traces, - * if null, plots no traces - * @param {object} (optional) transitionOpts - * transition option object - * @param {function} (optional) makeOnCompleteCallback - * transition make callback function from Plots.transition - */ -exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { - var fullLayout = gd._fullLayout; - var subplots = fullLayout._subplots.cartesian; - var calcdata = gd.calcdata; - var i; - - if(traces === null) { - // this means no updates required, must return here - // so that plotOne doesn't remove the trace layers - return; - } else if(!Array.isArray(traces)) { - // If traces is not provided, then it's a complete replot and missing - // traces are removed - traces = []; - for(i = 0; i < calcdata.length; i++) traces.push(i); - } - for(i = 0; i < subplots.length; i++) { - var subplot = subplots[i]; - var subplotInfo = fullLayout._plots[subplot]; + // [x|y]px: the pixels (from top left) of the mouse location + // on the currently selected plot area + // add pointerX|Y property for drawing the spikes in spikesnap 'cursor' situation + var hasUserCalledHover = !evt.target; + var xpx, ypx; - // Get all calcdata for this subplot: - var cdSubplot = []; - var pcd; + if(hasUserCalledHover) { + if('xpx' in evt) xpx = evt.xpx; + else xpx = xaArray[0]._length / 2; - for(var j = 0; j < calcdata.length; j++) { - var cd = calcdata[j]; - var trace = cd[0].trace; + if('ypx' in evt) ypx = evt.ypx; + else ypx = yaArray[0]._length / 2; + } + else { + // fire the beforehover event and quit if it returns false + // note that we're only calling this on real mouse events, so + // manual calls to fx.hover will always run. + if(Events.triggerHandler(gd, 'plotly_beforehover', evt) === false) { + return; + } - // Skip trace if whitelist provided and it's not whitelisted: - // if (Array.isArray(traces) && traces.indexOf(i) === -1) continue; - if(trace.xaxis + trace.yaxis === subplot) { - // XXX: Should trace carpet dependencies. Only replot all carpet plots if the carpet - // axis has actually changed: - // - // If this trace is specifically requested, add it to the list: - if(traces.indexOf(trace.index) !== -1 || trace.carpet) { - // Okay, so example: traces 0, 1, and 2 have fill = tonext. You animate - // traces 0 and 2. Trace 1 also needs to be updated, otherwise its fill - // is outdated. So this retroactively adds the previous trace if the - // traces are interdependent. - 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); - } + var dbb = evt.target.getBoundingClientRect(); - cdSubplot.push(cd); - } + xpx = evt.clientX - dbb.left; + ypx = evt.clientY - dbb.top; - // Track the previous trace on this subplot for the retroactive-add step - // above: - pcd = cd; + // in case hover was called from mouseout into hovertext, + // it's possible you're not actually over the plot anymore + if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { + return dragElement.unhoverRaw(gd, evt); } } - plotOne(gd, subplotInfo, cdSubplot, transitionOpts, makeOnCompleteCallback); - } -}; + evt.pointerX = xpx + xaArray[0]._offset; + evt.pointerY = ypx + yaArray[0]._offset; -function plotOne(gd, plotinfo, cdSubplot, transitionOpts, makeOnCompleteCallback) { - var traceLayerClasses = constants.traceLayerClasses; - var fullLayout = gd._fullLayout; - var modules = fullLayout._modules; - var _module, cdModuleAndOthers, cdModule; + if('xval' in evt) xvalArray = helpers.flat(subplots, evt.xval); + else xvalArray = helpers.p2c(xaArray, xpx); - var layerData = []; - var zoomScaleQueryParts = []; + if('yval' in evt) yvalArray = helpers.flat(subplots, evt.yval); + else yvalArray = helpers.p2c(yaArray, ypx); - for(var i = 0; i < modules.length; i++) { - _module = modules[i]; - var name = _module.name; - var categories = Registry.modules[name].categories; + if(!isNumeric(xvalArray[0]) || !isNumeric(yvalArray[0])) { + Lib.warn('Fx.hover failed', evt, gd); + return dragElement.unhoverRaw(gd, evt); + } + } - if(categories.svg) { - var className = (_module.layerName || name + 'layer'); - var plotMethod = _module.plot; + // the pixel distance to beat as a matching point + // in 'x' or 'y' mode this resets for each trace + var distance = Infinity; - // plot all visible traces of this type on this subplot at once - cdModuleAndOthers = getModuleCalcData(cdSubplot, plotMethod); - cdModule = cdModuleAndOthers[0]; - // don't need to search the found traces again - in fact we need to NOT - // so that if two modules share the same plotter we don't double-plot - cdSubplot = cdModuleAndOthers[1]; + // find the closest point in each trace + // this is minimum dx and/or dy, depending on mode + // and the pixel position for the label (labelXpx, labelYpx) + for(curvenum = 0; curvenum < searchData.length; curvenum++) { + cd = searchData[curvenum]; - if(cdModule.length) { - layerData.push({ - i: traceLayerClasses.indexOf(className), - className: className, - plotMethod: plotMethod, - cdModule: cdModule - }); - } + // filter out invisible or broken data + if(!cd || !cd[0] || !cd[0].trace || cd[0].trace.visible !== true) continue; - if(categories.zoomScale) { - zoomScaleQueryParts.push('.' + className); - } - } - } + trace = cd[0].trace; - layerData.sort(function(a, b) { return a.i - b.i; }); + // Explicitly bail out for these two. I don't know how to otherwise prevent + // the rest of this function from running and failing + if(['carpet', 'contourcarpet'].indexOf(trace._module.name) !== -1) continue; - var layers = plotinfo.plot.selectAll('g.mlayer') - .data(layerData, function(d) { return d.className; }); + if(trace.type === 'splom') { + // splom traces do not generate overlay subplots, + // it is safe to assume here splom traces correspond to the 0th subplot + subploti = 0; + subplotId = subplots[subploti]; + } else { + subplotId = helpers.getSubplot(trace); + subploti = subplots.indexOf(subplotId); + } - layers.enter().append('g') - .attr('class', function(d) { return d.className; }) - .classed('mlayer', true); + // within one trace mode can sometimes be overridden + mode = hovermode; - layers.exit().remove(); + // container for new point, also used to pass info into module.hoverPoints + pointData = { + // trace properties + cd: cd, + trace: trace, + xa: xaArray[subploti], + ya: yaArray[subploti], - layers.order(); + // 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, - layers.each(function(d) { - var sel = d3.select(this); - var className = d.className; + // 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 - d.plotMethod( - gd, plotinfo, d.cdModule, sel, - transitionOpts, makeOnCompleteCallback - ); + // 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, - // layers that allow `cliponaxis: false` - if(className !== 'scatterlayer' && className !== 'barlayer') { - Drawing.setClipUrl(sel, plotinfo.layerClipId); - } - }); + // in some cases the spikes have different positioning from the hover label + // they don't need x0/x1, just one position + xSpike: undefined, + ySpike: undefined, - // call Scattergl.plot separately - if(fullLayout._has('scattergl')) { - _module = Registry.getModule('scattergl'); - cdModule = getModuleCalcData(cdSubplot, _module)[0]; - _module.plot(gd, plotinfo, cdModule); - } + // where and how to display the hover label + color: Color.defaultLine, // trace color + name: trace.name, + x0: undefined, + x1: undefined, + y0: undefined, + y1: undefined, + xLabelVal: undefined, + yLabelVal: undefined, + zLabelVal: undefined, + text: undefined + }; - // stash "hot" selections for faster interaction on drag and scroll - if(!gd._context.staticPlot) { - if(plotinfo._hasClipOnAxisFalse) { - plotinfo.clipOnAxisFalseTraces = plotinfo.plot - .selectAll('.scatterlayer, .barlayer') - .selectAll('.trace'); + // add ref to subplot object (non-cartesian case) + if(fullLayout[subplotId]) { + pointData.subplot = fullLayout[subplotId]._subplot; + } + // add ref to splom scene + if(fullLayout._splomScenes && fullLayout._splomScenes[trace.uid]) { + pointData.scene = fullLayout._splomScenes[trace.uid]; } - if(zoomScaleQueryParts.length) { - var traces = plotinfo.plot - .selectAll(zoomScaleQueryParts.join(',')) - .selectAll('.trace'); + closedataPreviousLength = hoverData.length; - plotinfo.zoomScalePts = traces.selectAll('path.point'); - plotinfo.zoomScaleTxt = traces.selectAll('.textpoint'); + // for a highlighting array, figure out what + // we're searching for with this element + 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 { + xval = xvalArray[subploti]; + yval = yvalArray[subploti]; } - } -} - -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldPlots = oldFullLayout._plots || {}; - var newPlots = newFullLayout._plots || {}; - var oldSubplotList = oldFullLayout._subplots || {}; - var plotinfo; - var i, k; - // when going from a large splom graph to something else, - // we need to clear so that the new cartesian subplot - // can have the correct layer ordering - if(oldFullLayout._hasOnlyLargeSploms && !newFullLayout._hasOnlyLargeSploms) { - for(k in oldPlots) { - plotinfo = oldPlots[k]; - if(plotinfo.plotgroup) plotinfo.plotgroup.remove(); + // Now if there is range to look in, find the points to hover. + if(hoverdistance !== 0) { + if(trace._module && trace._module.hoverPoints) { + var newPoints = trace._module.hoverPoints(pointData, xval, yval, mode, fullLayout._hoverlayer); + 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); + } } - } - - 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(); + // in closest mode, remove any existing (farther) points + // and don't look any farther than this latest point (or points, some + // traces like box & violin make multiple hover labels at once) + if(hovermode === 'closest' && hoverData.length > closedataPreviousLength) { + hoverData.splice(0, closedataPreviousLength); + distance = hoverData[0].distance; } - } - // delete any titles we don't need anymore - // check if axis list has changed, and if so clear old titles - 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(); + // Now if there is range to look in, find the points to draw the spikelines + // Do it only if there is no hoverData + if(hasCartesian && (spikedistance !== 0)) { + if(hoverData.length === 0) { + pointData.distance = spikedistance; + pointData.index = false; + var closestPoints = trace._module.hoverPoints(pointData, xval, yval, 'closest', fullLayout._hoverlayer); + if(closestPoints) { + closestPoints = closestPoints.filter(function(point) { + // some hover points, like scatter fills, do not allow spikes, + // so will generate a hover point but without a valid spikeDistance + return point.spikeDistance <= spikedistance; + }); + } + if(closestPoints && closestPoints.length) { + var tmpPoint; + var closestVPoints = closestPoints.filter(function(point) { + return point.xa.showspikes; + }); + 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; + }); + 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; + } + } + } + } } } } - // if we've gotten rid of all cartesian traces, remove all the subplot svg items - 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; - } - // otherwise look for subplots we need to remove - else if(oldSubplotList.cartesian) { - for(i = 0; i < oldSubplotList.cartesian.length; i++) { - var oldSubplotId = oldSubplotList.cartesian[i]; - if(!newPlots[oldSubplotId]) { - var selector = '.' + oldSubplotId + ',.' + oldSubplotId + '-x,.' + oldSubplotId + '-y'; - oldFullLayout._cartesianlayer.selectAll(selector).remove(); - removeSubplotExtras(oldSubplotId, oldFullLayout); + function selectClosestPoint(pointsData, spikedistance) { + var resultPoint = null; + var minDistance = Infinity; + var thisSpikeDistance; + for(var i = 0; i < pointsData.length; i++) { + thisSpikeDistance = pointsData[i].spikeDistance; + if(thisSpikeDistance < minDistance && thisSpikeDistance <= spikedistance) { + resultPoint = pointsData[i]; + minDistance = thisSpikeDistance; } } + return resultPoint; } -}; - -exports.drawFramework = function(gd) { - var fullLayout = gd._fullLayout; - var subplotData = makeSubplotData(gd); - - 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 id = d[0]; - var plotinfo = fullLayout._plots[id]; - - plotinfo.plotgroup = d3.select(this); - makeSubplotLayer(gd, plotinfo); - - // make separate drag layers for each subplot, - // but append them to paper rather than the plot groups, - // so they end up on top of the rest - plotinfo.draglayer = ensureSingle(fullLayout._draggers, 'g', id); - }); -}; -exports.rangePlot = function(gd, plotinfo, cdSubplot) { - makeSubplotLayer(gd, plotinfo); - plotOne(gd, plotinfo, cdSubplot); - Plots.style(gd); -}; - -function makeSubplotData(gd) { - var fullLayout = gd._fullLayout; - var ids = fullLayout._subplots.cartesian; - var len = ids.length; - var i, j, id, plotinfo, xa, ya; - - // split 'regular' and 'overlaying' subplots - var regulars = []; - var overlays = []; + function fillSpikePoint(point) { + if(!point) return null; + return { + xa: point.xa, + ya: point.ya, + x: point.xSpike !== undefined ? point.xSpike : (point.x0 + point.x1) / 2, + y: point.ySpike !== undefined ? point.ySpike : (point.y0 + point.y1) / 2, + distance: point.distance, + spikeDistance: point.spikeDistance, + curveNumber: point.trace.index, + color: point.color, + pointNumber: point.index + }; + } - for(i = 0; i < len; i++) { - id = ids[i]; - plotinfo = fullLayout._plots[id]; - xa = plotinfo.xaxis; - ya = plotinfo.yaxis; + var spikelineOpts = { + fullLayout: fullLayout, + container: fullLayout._hoverlayer, + outerContainer: fullLayout._paperdiv, + event: evt + }; + var oldspikepoints = gd._spikepoints; + var newspikepoints = { + vLinePoint: spikePoints.vLinePoint, + hLinePoint: spikePoints.hLinePoint + }; + gd._spikepoints = newspikepoints; - var xa2 = xa._mainAxis; - var ya2 = ya._mainAxis; - var mainplot = xa2._id + ya2._id; - var mainplotinfo = fullLayout._plots[mainplot]; - plotinfo.overlays = []; + // Now if it is not restricted by spikedistance option, set the points to draw the spikelines + if(hasCartesian && (spikedistance !== 0)) { + if(hoverData.length !== 0) { + var tmpHPointData = hoverData.filter(function(point) { + return point.ya.showspikes; + }); + var tmpHPoint = selectClosestPoint(tmpHPointData, spikedistance); + spikePoints.hLinePoint = fillSpikePoint(tmpHPoint); - if(mainplot !== id && mainplotinfo) { - plotinfo.mainplot = mainplot; - plotinfo.mainplotinfo = mainplotinfo; - overlays.push(id); - } else { - plotinfo.mainplot = undefined; - plotinfo.mainPlotinfo = undefined; - regulars.push(id); + var tmpVPointData = hoverData.filter(function(point) { + return point.xa.showspikes; + }); + var tmpVPoint = selectClosestPoint(tmpVPointData, spikedistance); + spikePoints.vLinePoint = fillSpikePoint(tmpVPoint); } } - // fill in list of overlaying subplots in 'main plot' - for(i = 0; i < overlays.length; i++) { - id = overlays[i]; - plotinfo = fullLayout._plots[id]; - plotinfo.mainplotinfo.overlays.push(plotinfo); - } - - // put 'regular' subplot data before 'overlaying' - var subplotIds = regulars.concat(overlays); - var subplotData = new Array(len); - - for(i = 0; i < len; i++) { - id = subplotIds[i]; - plotinfo = fullLayout._plots[id]; - xa = plotinfo.xaxis; - ya = plotinfo.yaxis; - - // use info about axis layer and overlaying pattern - // to clean what need to be cleaned up in exit selection - var d = [id, xa.layer, ya.layer, xa.overlaying || '', ya.overlaying || '']; - for(j = 0; j < plotinfo.overlays.length; j++) { - d.push(plotinfo.overlays[j].id); + // if hoverData is empty check for the spikes to draw and quit if there are none + if(hoverData.length === 0) { + var result = dragElement.unhoverRaw(gd, evt); + if(hasCartesian && ((spikePoints.hLinePoint !== null) || (spikePoints.vLinePoint !== null))) { + if(spikesChanged(oldspikepoints)) { + createSpikelines(spikePoints, spikelineOpts); + } } - subplotData[i] = d; + return result; } - return subplotData; -} - -function makeSubplotLayer(gd, plotinfo) { - var plotgroup = plotinfo.plotgroup; - var id = plotinfo.id; - var xLayer = constants.layerValue2layerClass[plotinfo.xaxis.layer]; - var yLayer = constants.layerValue2layerClass[plotinfo.yaxis.layer]; - var hasOnlyLargeSploms = gd._fullLayout._hasOnlyLargeSploms; - - if(!plotinfo.mainplot) { - if(hasOnlyLargeSploms) { - // TODO could do even better - // - we don't need plot (but we would have to mock it in lsInner - // and other places - // - we don't (x|y)lines and (x|y)axislayer for most subplots - // usually just the bottom x and left y axes. - 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'); + if(hasCartesian) { + if(spikesChanged(oldspikepoints)) { + createSpikelines(spikePoints, spikelineOpts); } - else { - var backLayer = ensureSingle(plotgroup, 'g', 'layer-subplot'); - plotinfo.shapelayer = ensureSingle(backLayer, 'g', 'shapelayer'); - plotinfo.imagelayer = ensureSingle(backLayer, 'g', 'imagelayer'); + } - plotinfo.gridlayer = ensureSingle(plotgroup, 'g', 'gridlayer'); - plotinfo.zerolinelayer = ensureSingle(plotgroup, 'g', 'zerolinelayer'); + hoverData.sort(function(d1, d2) { return d1.distance - d2.distance; }); - ensureSingle(plotgroup, 'path', 'xlines-below'); - ensureSingle(plotgroup, 'path', 'ylines-below'); - plotinfo.overlinesBelow = ensureSingle(plotgroup, 'g', 'overlines-below'); + // lastly, emit custom hover/unhover events + var oldhoverdata = gd._hoverdata; + var newhoverdata = []; - ensureSingle(plotgroup, 'g', 'xaxislayer-below'); - ensureSingle(plotgroup, 'g', 'yaxislayer-below'); - plotinfo.overaxesBelow = ensureSingle(plotgroup, 'g', 'overaxes-below'); + // pull out just the data that's useful to + // other people and send it to the event + for(itemnum = 0; itemnum < hoverData.length; itemnum++) { + var pt = hoverData[itemnum]; + var eventData = helpers.makeEventData(pt, pt.trace, pt.cd); - plotinfo.plot = ensureSingle(plotgroup, 'g', 'plot'); - plotinfo.overplot = ensureSingle(plotgroup, 'g', 'overplot'); + var ht = false; + if(pt.cd[pt.index] && pt.cd[pt.index].ht) ht = pt.cd[pt.index].ht; + hoverData[itemnum].hovertemplate = ht || pt.trace.hovertemplate || false; + hoverData[itemnum].eventData = [eventData]; - plotinfo.xlines = ensureSingle(plotgroup, 'path', 'xlines-above'); - plotinfo.ylines = ensureSingle(plotgroup, 'path', 'ylines-above'); - plotinfo.overlinesAbove = ensureSingle(plotgroup, 'g', 'overlines-above'); + newhoverdata.push(eventData); + } - ensureSingle(plotgroup, 'g', 'xaxislayer-above'); - ensureSingle(plotgroup, 'g', 'yaxislayer-above'); - plotinfo.overaxesAbove = ensureSingle(plotgroup, 'g', 'overaxes-above'); + gd._hoverdata = newhoverdata; - // set refs to correct layers as determined by 'axis.layer' - 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 = id + '-x'; - var yId = id + '-y'; + var rotateLabels = ( + (hovermode === 'y' && (searchData.length > 1 || hoverData.length > 1)) || + (hovermode === 'closest' && hasOneHorizontalTrace && hoverData.length > 1) + ); - // now make the components of overlaid subplots - // overlays don't have backgrounds, and append all - // their other components to the corresponding - // extra groups of their main plots. + var bgColor = Color.combine( + fullLayout.plot_bgcolor || Color.background, + fullLayout.paper_bgcolor + ); - plotinfo.gridlayer = mainplotinfo.gridlayer; - plotinfo.zerolinelayer = mainplotinfo.zerolinelayer; + var labelOpts = { + hovermode: hovermode, + rotateLabels: rotateLabels, + bgColor: bgColor, + container: fullLayout._hoverlayer, + outerContainer: fullLayout._paperdiv, + commonLabelOpts: fullLayout.hoverlabel, + hoverdistance: fullLayout.hoverdistance + }; - ensureSingle(mainplotinfo.overlinesBelow, 'path', xId); - ensureSingle(mainplotinfo.overlinesBelow, 'path', yId); - ensureSingle(mainplotinfo.overaxesBelow, 'g', xId); - ensureSingle(mainplotinfo.overaxesBelow, 'g', yId); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); - plotinfo.plot = ensureSingle(mainplotinfo.overplot, 'g', id); + hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya', fullLayout); - ensureSingle(mainplotinfo.overlinesAbove, 'path', xId); - ensureSingle(mainplotinfo.overlinesAbove, 'path', yId); - ensureSingle(mainplotinfo.overaxesAbove, 'g', xId); - ensureSingle(mainplotinfo.overaxesAbove, 'g', yId); + alignHoverText(hoverLabels, rotateLabels); - // set refs to correct layers as determined by 'abovetraces' - 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); + // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + // we should improve the "fx" API so other plots can use it without these hack. + if(evt.target && evt.target.tagName) { + var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); + overrideCursor(d3.select(evt.target), hasClickToShow ? 'pointer' : ''); } - // common attributes for all subplots, overlays or not + // don't emit events if called manually + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; - if(!hasOnlyLargeSploms) { - 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); + if(oldhoverdata) { + gd.emit('plotly_unhover', { + event: evt, + points: oldhoverdata + }); } - plotinfo.xlines - .style('fill', 'none') - .classed('crisp', true); - - plotinfo.ylines - .style('fill', 'none') - .classed('crisp', true); + gd.emit('plotly_hover', { + event: evt, + points: gd._hoverdata, + xaxes: xaArray, + yaxes: yaArray, + xvals: xvalArray, + yvals: yvalArray + }); } -function purgeSubplotLayers(layers, fullLayout) { - if(!layers) return; - - var overlayIdsToRemove = {}; - - layers.each(function(d) { - var id = d[0]; - var plotgroup = d3.select(this); +var EXTRA_STRING_REGEX = /([\s\S]*)<\/extra>/; - plotgroup.remove(); - removeSubplotExtras(id, fullLayout); - overlayIdsToRemove[id] = true; +function createHoverText(hoverData, opts, gd) { + var hovermode = opts.hovermode; + var rotateLabels = opts.rotateLabels; + var bgColor = opts.bgColor; + var container = opts.container; + var outerContainer = opts.outerContainer; + var commonLabelOpts = opts.commonLabelOpts || {}; - // do not remove individual axis s here - // as other subplots may need them - }); + // opts.fontFamily/Size are used for the common label + // and as defaults for each hover label, though the individual labels + // can override this. + var fontFamily = opts.fontFamily || constants.HOVERFONT; + var fontSize = opts.fontSize || constants.HOVERFONTSIZE; - // must remove overlaid subplot trace layers 'manually' + var c0 = hoverData[0]; + var xa = c0.xa; + var ya = c0.ya; + var commonAttr = hovermode === 'y' ? 'yLabel' : 'xLabel'; + var t0 = c0[commonAttr]; + var t00 = (String(t0) || '').split(' ')[0]; + var outerContainerBB = outerContainer.node().getBoundingClientRect(); + var outerTop = outerContainerBB.top; + var outerWidth = outerContainerBB.width; + var outerHeight = outerContainerBB.height; - for(var k in fullLayout._plots) { - var subplotInfo = fullLayout._plots[k]; - var overlays = subplotInfo.overlays || []; + // show the common label, if any, on the axis + // never show a common label in array mode, + // even if sometimes there could be one + var showCommonLabel = ( + (t0 !== undefined) && + (c0.distance <= opts.hoverdistance) && + (hovermode === 'x' || hovermode === 'y') + ); - for(var j = 0; j < overlays.length; j++) { - var overlayInfo = overlays[j]; + // all hover traces hoverinfo must contain the hovermode + // to have common labels + if(showCommonLabel) { + var allHaveZ = true; + var i, traceHoverinfo; + for(i = 0; i < hoverData.length; i++) { + if(allHaveZ && hoverData[i].zLabel === undefined) allHaveZ = false; - if(overlayIdsToRemove[overlayInfo.id]) { - overlayInfo.plot.selectAll('.trace').remove(); + 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; + } } } + + // xyz labels put all info in their main label, so have no need of a common label + if(allHaveZ) showCommonLabel = false; } -} -function removeSubplotExtras(subplotId, fullLayout) { - fullLayout._draggers.selectAll('g.' + subplotId).remove(); - fullLayout._defs.select('#clip' + fullLayout._uid + subplotId + 'plot').remove(); -} + var commonLabel = container.selectAll('g.axistext') + .data(showCommonLabel ? [0] : []); + commonLabel.enter().append('g') + .classed('axistext', true); + commonLabel.exit().remove(); -exports.toSVG = function(gd) { - var imageRoot = gd._fullLayout._glimages; - var root = d3.select(gd).selectAll('.svg-container'); - var canvases = root.filter(function(d, i) {return i === root.size() - 1;}) - .selectAll('.gl-canvas-context, .gl-canvas-focus'); + 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) { + // prohibit tex interpretation until we can handle + // tex and regular text together + s.attr('data-notex', 1); + }); - function canvasToImage() { - var canvas = this; - var imageData = canvas.toDataURL('image/png'); - var image = imageRoot.append('svg:image'); + var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine; + var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor); + var contrastColor = Color.contrast(commonBgColor); - image.attr({ - xmlns: xmlnsNamespaces.svg, - 'xlink:href': imageData, - preserveAspectRatio: 'none', - x: 0, - y: 0, - width: canvas.width, - height: canvas.height + lpath.style({ + fill: commonBgColor, + stroke: commonStroke }); - } - - canvases.each(canvasToImage); -}; -exports.updateFx = _dereq_('./graph_interact').updateFx; + ltext.text(t0) + .call(Drawing.font, + commonLabelOpts.font.family || fontFamily, + commonLabelOpts.font.size || fontSize, + commonLabelOpts.font.color || contrastColor + ) + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); -},{"../../components/drawing":595,"../../constants/xmlns_namespaces":674,"../../lib":696,"../../registry":827,"../get_data":781,"../plots":808,"./attributes":742,"./axis_ids":747,"./constants":750,"./graph_interact":754,"./layout_attributes":757,"./layout_defaults":758,"./transition_axes":767,"d3":148}],757:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + label.attr('transform', ''); -'use strict'; + var tbb = ltext.node().getBoundingClientRect(); + if(hovermode === 'x') { + ltext.attr('text-anchor', 'middle') + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? + (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); -var fontAttrs = _dereq_('../font_attributes'); -var colorAttrs = _dereq_('../../components/color/attributes'); -var dash = _dereq_('../../components/drawing/attributes').dash; -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; + var topsign = xa.side === 'top' ? '-' : ''; + lpath.attr('d', 'M0,0' + + 'L' + HOVERARROWSIZE + ',' + topsign + HOVERARROWSIZE + + 'H' + (HOVERTEXTPAD + tbb.width / 2) + + 'v' + topsign + (HOVERTEXTPAD * 2 + tbb.height) + + 'H-' + (HOVERTEXTPAD + tbb.width / 2) + + 'V' + topsign + HOVERARROWSIZE + 'H-' + HOVERARROWSIZE + 'Z'); -var constants = _dereq_('./constants'); + label.attr('transform', 'translate(' + + (xa._offset + (c0.x0 + c0.x1) / 2) + ',' + + (ya._offset + (xa.side === 'top' ? 0 : ya._length)) + ')'); + } + else { + ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') + .call(svgTextUtils.positionText, + (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), + outerTop - tbb.top - tbb.height / 2); + var leftsign = ya.side === 'right' ? '' : '-'; + lpath.attr('d', 'M0,0' + + 'L' + leftsign + HOVERARROWSIZE + ',' + HOVERARROWSIZE + + 'V' + (HOVERTEXTPAD + tbb.height / 2) + + 'h' + leftsign + (HOVERTEXTPAD * 2 + tbb.width) + + 'V-' + (HOVERTEXTPAD + tbb.height / 2) + + 'H' + leftsign + HOVERARROWSIZE + 'V-' + HOVERARROWSIZE + 'Z'); -module.exports = { - visible: { - valType: 'boolean', - - editType: 'plot', - - }, - color: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'ticks', - - }, - title: { - valType: 'string', - - editType: 'ticks', - - }, - titlefont: fontAttrs({ - 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'], - 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, - - }, - autorange: { - valType: 'enumerated', - values: [true, false, 'reversed'], - dflt: true, - - editType: 'axrange', - impliedEdits: {'range[0]': undefined, 'range[1]': undefined}, - - }, - rangemode: { - valType: 'enumerated', - values: ['normal', 'tozero', 'nonnegative'], - dflt: 'normal', - - editType: 'plot', - - }, - range: { - valType: 'info_array', - - items: [ - {valType: 'any', editType: 'axrange', impliedEdits: {'^autorange': false}}, - {valType: 'any', editType: 'axrange', impliedEdits: {'^autorange': false}} - ], - editType: 'axrange', - impliedEdits: {'autorange': false}, - - }, - fixedrange: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - // scaleanchor: not used directly, just put here for reference - // values are any opposite-letter axis id - scaleanchor: { - valType: 'enumerated', - values: [ - constants.idRegex.x.toString(), - constants.idRegex.y.toString() - ], - - editType: 'plot', - - }, - scaleratio: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'plot', - - }, - constrain: { - valType: 'enumerated', - values: ['range', 'domain'], - dflt: 'range', - - editType: 'plot', - - }, - // constraintoward: not used directly, just put here for reference - constraintoward: { - valType: 'enumerated', - values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], - - editType: 'plot', - - }, - // ticks - tickmode: { - valType: 'enumerated', - values: ['auto', 'linear', 'array'], - - editType: 'ticks', - impliedEdits: {tick0: undefined, dtick: undefined}, - - }, - nticks: { - valType: 'integer', - min: 0, - dflt: 0, - - editType: 'ticks', - - }, - tick0: { - valType: 'any', - - editType: 'ticks', - impliedEdits: {tickmode: 'linear'}, - - }, - dtick: { - valType: 'any', - - editType: 'ticks', - impliedEdits: {tickmode: 'linear'}, - - }, - tickvals: { - valType: 'data_array', - editType: 'ticks', - - }, - ticktext: { - valType: 'data_array', - editType: 'ticks', - - }, - ticks: { - valType: 'enumerated', - values: ['outside', 'inside', ''], - - editType: 'ticks', - - }, - mirror: { - valType: 'enumerated', - values: [true, 'ticks', false, 'all', 'allticks'], - dflt: false, - - editType: 'ticks+layoutstyle', - - }, - ticklen: { - valType: 'number', - min: 0, - dflt: 5, - - editType: 'ticks', - - }, - tickwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'ticks', - - }, - tickcolor: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'ticks', - - }, - showticklabels: { - valType: 'boolean', - dflt: true, - - editType: 'ticks', - - }, - automargin: { - valType: 'boolean', - dflt: false, - - editType: 'ticks', - - }, - showspikes: { - valType: 'boolean', - dflt: false, - - editType: 'modebar', - - }, - spikecolor: { - valType: 'color', - dflt: null, - - editType: 'none', - - }, - spikethickness: { - valType: 'number', - dflt: 3, - - editType: 'none', - - }, - spikedash: extendFlat({}, dash, {dflt: 'dash', editType: 'none'}), - spikemode: { - valType: 'flaglist', - flags: ['toaxis', 'across', 'marker'], - - dflt: 'toaxis', - editType: 'none', - - }, - spikesnap: { - valType: 'enumerated', - values: ['data', 'cursor'], - dflt: 'data', - - editType: 'none', - - }, - tickfont: fontAttrs({ - editType: 'ticks', - - }), - tickangle: { - valType: 'angle', - dflt: 'auto', - - editType: 'ticks', - - }, - tickprefix: { - valType: 'string', - dflt: '', - - editType: 'ticks', - - }, - showtickprefix: { - valType: 'enumerated', - values: ['all', 'first', 'last', 'none'], - dflt: 'all', - - editType: 'ticks', - - }, - ticksuffix: { - valType: 'string', - dflt: '', - - editType: 'ticks', - - }, - showticksuffix: { - valType: 'enumerated', - values: ['all', 'first', 'last', 'none'], - dflt: 'all', - - editType: 'ticks', - - }, - showexponent: { - valType: 'enumerated', - values: ['all', 'first', 'last', 'none'], - dflt: 'all', - - editType: 'ticks', - - }, - exponentformat: { - valType: 'enumerated', - values: ['none', 'e', 'E', 'power', 'SI', 'B'], - dflt: 'B', - - editType: 'ticks', - - }, - separatethousands: { - valType: 'boolean', - dflt: false, - - editType: 'ticks', - - }, - tickformat: { - valType: 'string', - dflt: '', - - editType: 'ticks', - - }, - tickformatstops: templatedArray('tickformatstop', { - enabled: { - valType: 'boolean', - - dflt: true, - editType: 'ticks', - - }, - dtickrange: { - valType: 'info_array', - - items: [ - {valType: 'any', editType: 'ticks'}, - {valType: 'any', editType: 'ticks'} - ], - editType: 'ticks', - - }, - value: { - valType: 'string', - dflt: '', - - editType: 'ticks', - - }, - editType: 'ticks' - }), - hoverformat: { - valType: 'string', - dflt: '', - - editType: 'none', - - }, - // lines and grids - showline: { - valType: 'boolean', - dflt: false, - - editType: 'ticks+layoutstyle', - - }, - linecolor: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'layoutstyle', - - }, - linewidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'ticks+layoutstyle', - - }, - showgrid: { - valType: 'boolean', - - editType: 'ticks', - - }, - gridcolor: { - valType: 'color', - dflt: colorAttrs.lightLine, - - editType: 'ticks', - - }, - gridwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'ticks', - - }, - zeroline: { - valType: 'boolean', - - editType: 'ticks', - - }, - zerolinecolor: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'ticks', - - }, - zerolinewidth: { - valType: 'number', - dflt: 1, - - editType: 'ticks', - - }, - // 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', - - }, - // 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', - - }, - // 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', - - }, - layer: { - valType: 'enumerated', - values: ['above traces', 'below traces'], - dflt: 'above traces', - - editType: 'plot', - - }, - 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', - - }, - position: { - valType: 'number', - min: 0, - max: 1, - dflt: 0, - - editType: 'plot', - - }, - categoryorder: { - valType: 'enumerated', - values: [ - 'trace', 'category ascending', 'category descending', 'array' - /* , 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later - ], - dflt: 'trace', - - editType: 'calc', - - }, - categoryarray: { - valType: 'data_array', - - editType: 'calc', - - }, - editType: 'calc', + label.attr('transform', 'translate(' + + (xa._offset + (ya.side === 'right' ? xa._length : 0)) + ',' + + (ya._offset + (c0.y0 + c0.y1) / 2) + ')'); + } + // remove the "close but not quite" points + // because of error bars, only take up to a space + hoverData = hoverData.filter(function(d) { + return (d.zLabelVal !== undefined) || + (d[commonAttr] || '').split(' ')[0] === t00; + }); + }); - _deprecated: { - autotick: { - valType: 'boolean', - - editType: 'ticks', - + // show all the individual labels + + // first create the objects + var hoverLabels = container.selectAll('g.hovertext') + .data(hoverData, function(d) { + return [d.trace.index, d.index, d.x0, d.y0, d.name, d.attr, d.xa, d.ya || ''].join(','); + }); + hoverLabels.enter().append('g') + .classed('hovertext', true) + .each(function() { + var g = d3.select(this); + // trace name label (rect and text.name) + g.append('rect') + .call(Color.fill, Color.addOpacity(bgColor, 0.8)); + g.append('text').classed('name', true); + // trace data label (path and text.nums) + g.append('path') + .style('stroke-width', '1px'); + g.append('text').classed('nums', true) + .call(Drawing.font, fontFamily, fontSize); + }); + hoverLabels.exit().remove(); + + // then put the text in, position the pointer to the data, + // and figure out sizes + hoverLabels.each(function(d) { + var g = d3.select(this).attr('transform', ''); + var name = ''; + var text = ''; + + // combine possible non-opaque trace color with bgColor + var color0 = d.bgcolor || d.color; + // color for 'nums' part of the label + var numsColor = Color.combine( + Color.opacity(color0) ? color0 : Color.defaultLine, + bgColor + ); + // color for 'name' part of the label + var nameColor = Color.combine( + Color.opacity(d.color) ? d.color : Color.defaultLine, + bgColor + ); + // find a contrasting color for border and text + var contrastColor = d.borderColor || Color.contrast(numsColor); + + // to get custom 'name' labels pass cleanPoint + if(d.nameOverride !== undefined) d.name = d.nameOverride; + + if(d.name) { + name = svgTextUtils.plainText(d.name || '', { + len: d.nameLength, + allowedTags: ['br', 'sub', 'sup', 'b', 'i', 'em'] + }); + } + + if(d.zLabel !== undefined) { + if(d.xLabel !== undefined) text += 'x: ' + d.xLabel + '
'; + if(d.yLabel !== undefined) text += 'y: ' + d.yLabel + '
'; + text += (text ? 'z: ' : '') + d.zLabel; + } + else if(showCommonLabel && d[hovermode + 'Label'] === t0) { + text = d[(hovermode === 'x' ? 'y' : 'x') + 'Label'] || ''; + } + else if(d.xLabel === undefined) { + if(d.yLabel !== undefined) text = d.yLabel; + } + else if(d.yLabel === undefined) text = d.xLabel; + else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; + + if((d.text || d.text === 0) && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } + + // used by other modules (initially just ternary) that + // manage their own hoverinfo independent of cleanPoint + // the rest of this will still apply, so such modules + // can still put things in (x|y|z)Label, text, and name + // and hoverinfo will still determine their visibility + if(d.extraText !== undefined) text += (text ? '
' : '') + d.extraText; + + // if 'text' is empty at this point, + // and hovertemplate is not defined, + // put 'name' in main label and don't show secondary label + if(text === '' && !d.hovertemplate) { + // if 'name' is also empty, remove entire label + if(name === '') g.remove(); + text = name; + } + + // hovertemplate + var hovertemplate = d.hovertemplate || false; + var hovertemplateLabels = d.hovertemplateLabels || d; + var eventData = d.eventData[0] || {}; + if(hovertemplate) { + text = Lib.hovertemplateString(hovertemplate, hovertemplateLabels, eventData); + + text = text.replace(EXTRA_STRING_REGEX, function(match, extra) { + name = extra; // Assign name for secondary text label + return ''; // Remove from main text label + }); + } + + // main label + var tx = g.select('text.nums') + .call(Drawing.font, + d.fontFamily || fontFamily, + d.fontSize || fontSize, + d.fontColor || contrastColor) + .text(text) + .attr('data-notex', 1) + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); + + var tx2 = g.select('text.name'); + var tx2width = 0; + var tx2height = 0; + + // secondary label for non-empty 'name' + if(name && name !== text) { + tx2.call(Drawing.font, + d.fontFamily || fontFamily, + d.fontSize || fontSize, + nameColor) + .text(name) + .attr('data-notex', 1) + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); + + var t2bb = tx2.node().getBoundingClientRect(); + 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 tbb = tx.node().getBoundingClientRect(); + 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 txTotalWidth = tbb.width + HOVERARROWSIZE + HOVERTEXTPAD + tx2width; + var anchorStartOK, anchorEndOK; + + d.ty0 = outerTop - tbb.top; + d.bx = tbb.width + 2 * HOVERTEXTPAD; + d.by = Math.max(tbb.height + 2 * HOVERTEXTPAD, tx2height); + d.anchor = 'start'; + d.txwidth = tbb.width; + d.tx2width = tx2width; + d.offset = 0; + + 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'; + } + 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'; + } + + tx.attr('text-anchor', d.anchor); + if(tx2width) tx2.attr('text-anchor', d.anchor); + g.attr('transform', 'translate(' + htx + ',' + hty + ')' + + (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + }); + + return hoverLabels; +} + +// Make groups of touching points, and within each group +// move each point so that no labels overlap, but the average +// label position is the same as it was before moving. Indicentally, +// this is equivalent to saying all the labels are on equal linear +// springs about their initial position. Initially, each point is +// its own group, but as we find overlaps we will clump the points. +// +// Also, there are hard constraints at the edges of the graphs, +// that push all groups to the middle so they are visible. I don't +// know what happens if the group spans all the way from one edge to +// the other, though it hardly matters - there's just too much +// information then. +function hoverAvoidOverlaps(hoverData, ax, fullLayout) { + var nummoves = 0; + var axSign = 1; + + // make groups of touching points + var pointgroups = hoverData.map(function(d, i) { + var axis = d[ax]; + var axIsX = axis._id.charAt(0) === 'x'; + var rng = axis.range; + if(!i && rng && ((rng[0] > rng[1]) !== axIsX)) axSign = -1; + return [{ + i: i, + traceIndex: d.trace.index, + dp: 0, + pos: d.pos, + posref: d.posref, + size: d.by * (axIsX ? YFACTOR : 1) / 2, + pmin: 0, + pmax: (axIsX ? fullLayout.width : fullLayout.height) + }]; + }) + .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(grp) { + var minPt = grp[0]; + var maxPt = grp[grp.length - 1]; + + // overlap with the top - positive vals are overlaps + topOverlap = minPt.pmin - minPt.pos - minPt.dp + minPt.size; + + // overlap with the bottom - positive vals are overlaps + bottomOverlap = maxPt.pos + maxPt.dp + maxPt.size - minPt.pmax; + + // check for min overlap first, so that we always + // see the largest labels + // allow for .01px overlap, so we don't get an + // infinite loop from rounding errors + if(topOverlap > 0.01) { + for(j = grp.length - 1; j >= 0; j--) grp[j].dp += topOverlap; + donepositioning = false; + } + if(bottomOverlap < 0.01) return; + if(topOverlap < -0.01) { + // make sure we're not pushing back and forth + for(j = grp.length - 1; j >= 0; j--) grp[j].dp -= bottomOverlap; + donepositioning = false; + } + if(!donepositioning) return; + + // no room to fix positioning, delete off-screen points + + // first see how many points we need to delete + var deleteCount = 0; + for(i = 0; i < grp.length; i++) { + pti = grp[i]; + if(pti.pos + pti.dp + pti.size > minPt.pmax) deleteCount++; + } + + // start by deleting points whose data is off screen + for(i = grp.length - 1; i >= 0; i--) { + if(deleteCount <= 0) break; + pti = grp[i]; + + // pos has already been constrained to [pmin,pmax] + // so look for points close to that to delete + if(pti.pos > minPt.pmax - 1) { + pti.del = true; + deleteCount--; + } + } + for(i = 0; i < grp.length; i++) { + if(deleteCount <= 0) break; + pti = grp[i]; + + // pos has already been constrained to [pmin,pmax] + // so look for points close to that to delete + if(pti.pos < minPt.pmin + 1) { + pti.del = true; + deleteCount--; + + // shift the whole group minus into this new space + bottomOverlap = pti.size * 2; + for(j = grp.length - 1; j >= 0; j--) grp[j].dp -= bottomOverlap; + } + } + // then delete points that go off the bottom + for(i = grp.length - 1; i >= 0; i--) { + if(deleteCount <= 0) break; + pti = grp[i]; + if(pti.pos + pti.dp + pti.size > minPt.pmax) { + pti.del = true; + deleteCount--; + } } } -}; -},{"../../components/color/attributes":569,"../../components/drawing/attributes":594,"../../lib/extend":685,"../../plot_api/plot_template":734,"../font_attributes":771,"./constants":750}],758:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // loop through groups, combining them if they overlap, + // until nothing moves + while(!donepositioning && nummoves <= hoverData.length) { + // to avoid infinite loops, don't move more times + // than there are traces + nummoves++; + + // assume nothing will move in this iteration, + // reverse this if it does + donepositioning = true; + i = 0; + while(i < pointgroups.length - 1) { + // the higher (g0) and lower (g1) point group + var g0 = pointgroups[i]; + var g1 = pointgroups[i + 1]; + + // the lowest point in the higher group (p0) + // the highest point in the lower group (p1) + var p0 = g0[g0.length - 1]; + var p1 = g1[0]; + topOverlap = p0.pos + p0.dp + p0.size - p1.pos - p1.dp + p1.size; + + // Only group points that lie on the same axes + if(topOverlap > 0.01 && (p0.pmin === p1.pmin) && (p0.pmax === p1.pmax)) { + // push the new point(s) added to this group out of the way + for(j = g1.length - 1; j >= 0; j--) g1[j].dp += topOverlap; + + // add them to the group + g0.push.apply(g0, g1); + pointgroups.splice(i + 1, 1); + + // adjust for minimum average movement + sumdp = 0; + for(j = g0.length - 1; j >= 0; j--) sumdp += g0[j].dp; + bottomOverlap = sumdp / g0.length; + for(j = g0.length - 1; j >= 0; j--) g0[j].dp -= bottomOverlap; + donepositioning = false; + } + else i++; + } + + // check if we're going off the plot on either side and fix + pointgroups.forEach(constrainGroup); + } + + // now put these offsets into hoverData + for(i = pointgroups.length - 1; i >= 0; i--) { + var grp = pointgroups[i]; + for(j = grp.length - 1; j >= 0; j--) { + var pt = grp[j]; + var hoverPt = hoverData[pt.i]; + hoverPt.offset = pt.dp; + hoverPt.del = pt.del; + } + } +} + +function alignHoverText(hoverLabels, rotateLabels) { + // finally set the text positioning relative to the data and draw the + // box around it + hoverLabels.each(function(d) { + var g = d3.select(this); + if(d.del) { + g.remove(); + return; + } + + var horzSign = d.anchor === 'end' ? -1 : 1; + var tx = g.select('text.nums'); + var alignShift = {start: 1, end: -1, middle: 0}[d.anchor]; + var txx = alignShift * (HOVERARROWSIZE + HOVERTEXTPAD); + var tx2x = txx + alignShift * (d.txwidth + HOVERTEXTPAD); + var offsetX = 0; + var offsetY = d.offset; + + if(d.anchor === 'middle') { + txx -= d.tx2width / 2; + tx2x += d.txwidth / 2 + HOVERTEXTPAD; + } + if(rotateLabels) { + offsetY *= -YSHIFTY; + offsetX = d.offset * YSHIFTX; + } + + g.select('path').attr('d', d.anchor === 'middle' ? + // middle aligned: rect centered on data + ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + + 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + // left or right aligned: side rect with arrow to data + ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + + 'v' + (d.by / 2 - HOVERARROWSIZE) + + 'h' + (horzSign * d.bx) + + 'v-' + d.by + + 'H' + (horzSign * HOVERARROWSIZE + offsetX) + + 'V' + (offsetY - HOVERARROWSIZE) + + 'Z')); + + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + + if(d.tx2width) { + g.select('text.name') + .call(svgTextUtils.positionText, + tx2x + alignShift * HOVERTEXTPAD + offsetX, + offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + g.select('rect') + .call(Drawing.setRect, + tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, + offsetY - d.by / 2 - 1, + d.tx2width, d.by + 2); + } + }); +} + +function cleanPoint(d, hovermode) { + var index = d.index; + var trace = d.trace || {}; + var cd0 = d.cd[0]; + var cd = d.cd[index] || {}; + + var getVal = Array.isArray(index) ? + function(calcKey, traceKey) { + return Lib.castOption(cd0, index, calcKey) || + Lib.extractOption({}, trace, '', traceKey); + } : + function(calcKey, traceKey) { + return Lib.extractOption(cd, trace, calcKey, traceKey); + }; + + function fill(key, calcKey, traceKey) { + var val = getVal(calcKey, traceKey); + if(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('nameLength', 'hnl', 'hoverlabel.namelength'); + + 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); + + // then constrain all the positions to be on the plot + 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); + + // and convert the x and y label values into formatted text + if(d.xLabelVal !== undefined) { + d.xLabel = ('xLabel' in d) ? d.xLabel : Axes.hoverLabelText(d.xa, d.xLabelVal); + d.xVal = d.xa.c2d(d.xLabelVal); + } + if(d.yLabelVal !== undefined) { + d.yLabel = ('yLabel' in d) ? d.yLabel : Axes.hoverLabelText(d.ya, d.yLabelVal); + d.yVal = d.ya.c2d(d.yLabelVal); + } + + // Traces like heatmaps generate the zLabel in their hoverPoints function + if(d.zLabelVal !== undefined && d.zLabel === undefined) { + d.zLabel = String(d.zLabelVal); + } + + // for box means and error bars, add the range to the label + 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 !== undefined) { + d.xLabel += ' +' + xeText + ' / -' + + Axes.tickText(d.xa, d.xa.c2l(d.xerrneg), 'hover').text; + } + else d.xLabel += ' ± ' + xeText; + + // small distance penalty for error bars, so that if there are + // traces with errors and some without, the error bar label will + // hoist up to the point + 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 !== undefined) { + 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 = undefined; + if(infomode.indexOf('y') === -1) d.yLabel = undefined; + if(infomode.indexOf('z') === -1) d.zLabel = undefined; + if(infomode.indexOf('text') === -1) d.text = undefined; + if(infomode.indexOf('name') === -1) d.name = undefined; + } + + return d; +} + +function createSpikelines(closestPoints, opts) { + var container = opts.container; + var fullLayout = opts.fullLayout; + var evt = opts.event; + var showY = !!closestPoints.hLinePoint; + var showX = !!closestPoints.vLinePoint; + var xa, ya; -'use strict'; + // Remove old spikeline items + container.selectAll('.spikeline').remove(); -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); -var Template = _dereq_('../../plot_api/plot_template'); -var basePlotLayoutAttributes = _dereq_('../layout_attributes'); + if(!(showX || showY)) return; -var layoutAttributes = _dereq_('./layout_attributes'); -var handleTypeDefaults = _dereq_('./type_defaults'); -var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraint_defaults'); -var handlePositionDefaults = _dereq_('./position_defaults'); + var contrastColor = Color.combine(fullLayout.plot_bgcolor, fullLayout.paper_bgcolor); -var axisIds = _dereq_('./axis_ids'); -var id2name = axisIds.id2name; -var name2id = axisIds.name2id; + // Horizontal line (to y-axis) + if(showY) { + var hLinePoint = closestPoints.hLinePoint; + var hLinePointX, hLinePointY; -var Registry = _dereq_('../../registry'); -var traceIs = Registry.traceIs; -var getComponentMethod = Registry.getComponentMethod; + xa = hLinePoint && hLinePoint.xa; + ya = hLinePoint && hLinePoint.ya; + var ySnap = ya.spikesnap; -function appendList(cont, k, item) { - if(Array.isArray(cont[k])) cont[k].push(item); - else cont[k] = [item]; -} + if(ySnap === 'cursor') { + hLinePointX = evt.pointerX; + hLinePointY = evt.pointerY; + } else { + hLinePointX = xa._offset + hLinePoint.x; + hLinePointY = ya._offset + hLinePoint.y; + } + var dfltHLineColor = tinycolor.readability(hLinePoint.color, contrastColor) < 1.5 ? + Color.contrast(contrastColor) : hLinePoint.color; + var yMode = ya.spikemode; + var yThickness = ya.spikethickness; + var yColor = ya.spikecolor || dfltHLineColor; + var yBB = ya._boundingBox; + var xEdge = ((yBB.left + yBB.right) / 2) < hLinePointX ? yBB.right : yBB.left; + var xBase, xEndSpike; -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - var ax2traces = {}; - var xaCheater = {}; - var xaNonCheater = {}; - var outerTicks = {}; - var noGrids = {}; - var i, j; + if(yMode.indexOf('toaxis') !== -1 || yMode.indexOf('across') !== -1) { + if(yMode.indexOf('toaxis') !== -1) { + xBase = xEdge; + xEndSpike = hLinePointX; + } + if(yMode.indexOf('across') !== -1) { + xBase = ya._counterSpan[0]; + xEndSpike = ya._counterSpan[1]; + } - // look for axes in the data - for(i = 0; i < fullData.length; i++) { - var trace = fullData[i]; - if(!traceIs(trace, 'cartesian') && !traceIs(trace, 'gl2d')) continue; + // Foreground horizontal line (to y-axis) + container.insert('line', ':first-child') + .attr({ + x1: xBase, + x2: xEndSpike, + y1: hLinePointY, + y2: hLinePointY, + 'stroke-width': yThickness, + stroke: yColor, + 'stroke-dasharray': Drawing.dashStyle(ya.spikedash, yThickness) + }) + .classed('spikeline', true) + .classed('crisp', true); - 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); - } + // Background horizontal Line (to y-axis) + 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); } - - 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); - } + // Y axis marker + if(yMode.indexOf('marker') !== -1) { + container.insert('circle', ':first-child') + .attr({ + cx: xEdge + (ya.side !== 'right' ? yThickness : -yThickness), + cy: hLinePointY, + r: yThickness, + fill: yColor + }) + .classed('spikeline', true); } + } - // Two things trigger axis visibility: - // 1. is not carpet - // 2. carpet that's not cheater - if(!traceIs(trace, 'carpet') || (trace.type === 'carpet' && !trace._cheater)) { - if(xaName) xaNonCheater[xaName] = 1; - } + if(showX) { + var vLinePoint = closestPoints.vLinePoint; + var vLinePointX, vLinePointY; - // The above check for definitely-not-cheater is not adequate. This - // second list tracks which axes *could* be a cheater so that the - // full condition triggering hiding is: - // *could* be a cheater and *is not definitely visible* - if(trace.type === 'carpet' && trace._cheater) { - if(xaName) xaCheater[xaName] = 1; - } + xa = vLinePoint && vLinePoint.xa; + ya = vLinePoint && vLinePoint.ya; + var xSnap = xa.spikesnap; - // check for default formatting tweaks - if(traceIs(trace, '2dMap')) { - outerTicks[xaName] = 1; - outerTicks[yaName] = 1; + if(xSnap === 'cursor') { + vLinePointX = evt.pointerX; + vLinePointY = evt.pointerY; + } else { + vLinePointX = xa._offset + vLinePoint.x; + vLinePointY = ya._offset + vLinePoint.y; } + var dfltVLineColor = tinycolor.readability(vLinePoint.color, contrastColor) < 1.5 ? + Color.contrast(contrastColor) : vLinePoint.color; + var xMode = xa.spikemode; + var xThickness = xa.spikethickness; + var xColor = xa.spikecolor || dfltVLineColor; + var xBB = xa._boundingBox; + var yEdge = ((xBB.top + xBB.bottom) / 2) < vLinePointY ? xBB.bottom : xBB.top; + var yBase, yEndSpike; - if(traceIs(trace, 'oriented')) { - var positionAxis = trace.orientation === 'h' ? yaName : xaName; - noGrids[positionAxis] = 1; - } - } + if(xMode.indexOf('toaxis') !== -1 || xMode.indexOf('across') !== -1) { + if(xMode.indexOf('toaxis') !== -1) { + yBase = yEdge; + yEndSpike = vLinePointY; + } + if(xMode.indexOf('across') !== -1) { + yBase = xa._counterSpan[0]; + yEndSpike = xa._counterSpan[1]; + } - 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); + // Foreground vertical line (to x-axis) + container.insert('line', ':first-child') + .attr({ + x1: vLinePointX, + x2: vLinePointX, + y1: yBase, + y2: yEndSpike, + 'stroke-width': xThickness, + stroke: xColor, + 'stroke-dasharray': Drawing.dashStyle(xa.spikedash, xThickness) + }) + .classed('spikeline', true) + .classed('crisp', true); - // plot_bgcolor only makes sense if there's a (2D) plot! - // TODO: bgcolor for each subplot, to inherit from the main one - var plot_bgcolor = Color.background; - if(xIds.length && yIds.length) { - plot_bgcolor = Lib.coerce(layoutIn, layoutOut, basePlotLayoutAttributes, 'plot_bgcolor'); + // Background vertical line (to x-axis) + 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); + } + + // X axis marker + if(xMode.indexOf('marker') !== -1) { + container.insert('circle', ':first-child') + .attr({ + cx: vLinePointX, + cy: yEdge - (xa.side !== 'top' ? xThickness : -xThickness), + r: xThickness, + fill: xColor + }) + .classed('spikeline', true); + } } +} - var bgColor = Color.combine(plot_bgcolor, layoutOut.paper_bgcolor); +function hoverChanged(gd, evt, oldhoverdata) { + // don't emit any events if nothing changed + if(!oldhoverdata || oldhoverdata.length !== gd._hoverdata.length) return true; - var axName, axLetter, axLayoutIn, axLayoutOut; + for(var i = oldhoverdata.length - 1; i >= 0; i--) { + var oldPt = oldhoverdata[i]; + var newPt = gd._hoverdata[i]; - function coerce(attr, dflt) { - return Lib.coerce(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt); + if(oldPt.curveNumber !== newPt.curveNumber || + String(oldPt.pointNumber) !== String(newPt.pointNumber) || + String(oldPt.pointNumbers) !== String(newPt.pointNumbers) + ) { + return true; + } } + return false; +} - function coerce2(attr, dflt) { - return Lib.coerce2(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt); - } +function spikesChanged(gd, oldspikepoints) { + // don't relayout the plot because of new spikelines if spikelines points didn't change + if(!oldspikepoints) return true; + if(oldspikepoints.vLinePoint !== gd._spikepoints.vLinePoint || + oldspikepoints.hLinePoint !== gd._spikepoints.hLinePoint + ) return true; + return false; +} - function getCounterAxes(axLetter) { - return (axLetter === 'x') ? yIds : xIds; - } +},{"../../lib":159,"../../lib/events":152,"../../lib/override_cursor":170,"../../lib/svg_text_utils":180,"../../plots/cartesian/axes":203,"../../registry":243,"../color":43,"../dragelement":61,"../drawing":64,"./constants":76,"./helpers":78,"d3":8,"fast-isnumeric":10,"tinycolor2":26}],80:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var counterAxes = {x: getCounterAxes('x'), y: getCounterAxes('y')}; +'use strict'; - function getOverlayableAxes(axLetter, axName) { - var list = (axLetter === 'x') ? xNames : yNames; - var out = []; +var Lib = _dereq_('../../lib'); - for(var j = 0; j < list.length; j++) { - var axName2 = list[j]; +module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts) { + opts = opts || {}; - if(axName2 !== axName && !(layoutIn[axName2] || {}).overlaying) { - out.push(name2id(axName2)); - } - } + coerce('hoverlabel.bgcolor', opts.bgcolor); + coerce('hoverlabel.bordercolor', opts.bordercolor); + coerce('hoverlabel.namelength', opts.namelength); + Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); +}; - return out; - } +},{"../../lib":159}],81:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // first pass creates the containers, determines types, and handles most of the settings - for(i = 0; i < axNames.length; i++) { - axName = axNames[i]; - axLetter = axName.charAt(0); +'use strict'; - if(!Lib.isPlainObject(layoutIn[axName])) { - layoutIn[axName] = {}; +module.exports = function(opts, extra) { + opts = opts || {}; + extra = 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 = 'variable ' + quotedKeys[0]; + } else { + descPart = 'variables ' + quotedKeys.slice(0, -1).join(', ') + ' and ' + quotedKeys.slice(-1) + '.'; } + } - axLayoutIn = layoutIn[axName]; - axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + 'axis'); + var hovertemplate = { + valType: 'string', + + dflt: '', + arrayOk: true, + editType: 'none', + + }; - var traces = ax2traces[axName] || []; - axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; }); - axLayoutOut._annIndices = []; - axLayoutOut._shapeIndices = []; + return hovertemplate; +}; - // set up some private properties - axLayoutOut._name = axName; - var id = axLayoutOut._id = name2id(axName); +},{}],82:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var overlayableAxes = getOverlayableAxes(axLetter, axName); +'use strict'; - var defaultOptions = { - letter: axLetter, - font: layoutOut.font, - outerTicks: outerTicks[axName], - showGrid: !noGrids[axName], - data: traces, - bgColor: bgColor, - calendar: layoutOut.calendar, - automargin: true, - cheateronly: axLetter === 'x' && xaCheater[axName] && !xaNonCheater[axName], - splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[id] - }; +var d3 = _dereq_('d3'); +var Lib = _dereq_('../../lib'); +var dragElement = _dereq_('../dragelement'); +var helpers = _dereq_('./helpers'); +var layoutAttributes = _dereq_('./layout_attributes'); +var hoverModule = _dereq_('./hover'); - handleTypeDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions); - handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut); +module.exports = { + moduleType: 'component', + name: 'fx', - var spikecolor = coerce2('spikecolor'), - spikethickness = coerce2('spikethickness'), - spikedash = coerce2('spikedash'), - spikemode = coerce2('spikemode'), - spikesnap = coerce2('spikesnap'), - showSpikes = coerce('showspikes', !!spikecolor || !!spikethickness || !!spikedash || !!spikemode || !!spikesnap); + constants: _dereq_('./constants'), + schema: { + layout: layoutAttributes + }, - if(!showSpikes) { - delete axLayoutOut.spikecolor; - delete axLayoutOut.spikethickness; - delete axLayoutOut.spikedash; - delete axLayoutOut.spikemode; - delete axLayoutOut.spikesnap; - } + attributes: _dereq_('./attributes'), + layoutAttributes: layoutAttributes, - var positioningOptions = { - letter: axLetter, - counterAxes: counterAxes[axLetter], - overlayableAxes: overlayableAxes, - grid: layoutOut.grid - }; + supplyLayoutGlobalDefaults: _dereq_('./layout_global_defaults'), + supplyDefaults: _dereq_('./defaults'), + supplyLayoutDefaults: _dereq_('./layout_defaults'), - handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, positioningOptions); + calc: _dereq_('./calc'), - axLayoutOut._input = axLayoutIn; - } + getDistanceFunction: helpers.getDistanceFunction, + getClosest: helpers.getClosest, + inbox: helpers.inbox, + quadrature: helpers.quadrature, + appendArrayPointValue: helpers.appendArrayPointValue, - // quick second pass for range slider and selector defaults - var rangeSliderDefaults = getComponentMethod('rangeslider', 'handleDefaults'); - var rangeSelectorDefaults = getComponentMethod('rangeselector', 'handleDefaults'); + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, - for(i = 0; i < xNames.length; i++) { - axName = xNames[i]; - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; + hover: hoverModule.hover, + unhover: dragElement.unhover, - rangeSliderDefaults(layoutIn, layoutOut, axName); + loneHover: hoverModule.loneHover, + multiHovers: hoverModule.multiHovers, + loneUnhover: loneUnhover, - if(axLayoutOut.type === 'date') { - rangeSelectorDefaults( - axLayoutIn, - axLayoutOut, - layoutOut, - yNames, - axLayoutOut.calendar - ); - } + click: _dereq_('./click') +}; - coerce('fixedrange'); - } +function loneUnhover(containerOrSelection) { + // duck type whether the arg is a d3 selection because ie9 doesn't + // handle instanceof like modern browsers do. + var selection = Lib.isD3Selection(containerOrSelection) ? + containerOrSelection : + d3.select(containerOrSelection); - for(i = 0; i < yNames.length; i++) { - axName = yNames[i]; - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; + selection.selectAll('g.hovertext').remove(); + selection.selectAll('.spikeline').remove(); +} - var anchoredAxis = layoutOut[id2name(axLayoutOut.anchor)]; +// helpers for traces that use Fx.loneHover - var fixedRangeDflt = ( - anchoredAxis && - anchoredAxis.rangeslider && - anchoredAxis.rangeslider.visible - ); +function castHoverOption(trace, ptNumber, attr) { + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - coerce('fixedrange', fixedRangeDflt); +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } - // Finally, handle scale constraints. We need to do this after all axes have - // coerced both `type` (so we link only axes of the same type) and - // `fixedrange` (so we can avoid linking from OR TO a fixed axis). + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); +} - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - layoutOut._axisConstraintGroups = []; - var allAxisIds = counterAxes.x.concat(counterAxes.y); +},{"../../lib":159,"../dragelement":61,"./attributes":73,"./calc":74,"./click":75,"./constants":76,"./defaults":77,"./helpers":78,"./hover":79,"./layout_attributes":83,"./layout_defaults":84,"./layout_global_defaults":85,"d3":8}],83:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(i = 0; i < axNames.length; i++) { - axName = axNames[i]; - axLetter = axName.charAt(0); +'use strict'; - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; +var constants = _dereq_('./constants'); - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, allAxisIds, layoutOut); +var fontAttrs = _dereq_('../../plots/font_attributes')({ + editType: 'none', + +}); +fontAttrs.family.dflt = constants.HOVERFONT; +fontAttrs.size.dflt = constants.HOVERFONTSIZE; + +module.exports = { + clickmode: { + valType: 'flaglist', + + flags: ['event', 'select'], + dflt: 'event', + editType: 'plot', + extras: ['none'], + + }, + dragmode: { + valType: 'enumerated', + + values: ['zoom', 'pan', 'select', 'lasso', 'orbit', 'turntable', false], + dflt: 'zoom', + editType: 'modebar', + + }, + hovermode: { + valType: 'enumerated', + + values: ['x', 'y', 'closest', false], + editType: 'modebar', + + }, + hoverdistance: { + valType: 'integer', + min: -1, + dflt: 20, + + editType: 'none', + + }, + spikedistance: { + valType: 'integer', + min: -1, + dflt: 20, + + editType: 'none', + + }, + hoverlabel: { + bgcolor: { + valType: 'color', + + editType: 'none', + + }, + bordercolor: { + valType: 'color', + + editType: 'none', + + }, + font: fontAttrs, + namelength: { + valType: 'integer', + min: -1, + dflt: 15, + + editType: 'none', + + }, + editType: 'none' + }, + selectdirection: { + valType: 'enumerated', + + values: ['h', 'v', 'd', 'any'], + dflt: 'any', + + editType: 'none' } }; -},{"../../components/color":570,"../../lib":696,"../../plot_api/plot_template":734,"../../registry":827,"../layout_attributes":799,"./axis_defaults":746,"./axis_ids":747,"./constraint_defaults":751,"./layout_attributes":757,"./position_defaults":760,"./type_defaults":768}],759:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":230,"./constants":76}],84:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -116989,2910 +23982,2386 @@ 'use strict'; -var colorMix = _dereq_('tinycolor2').mix; -var lightFraction = _dereq_('../../components/color/attributes').lightFraction; var Lib = _dereq_('../../lib'); +var layoutAttributes = _dereq_('./layout_attributes'); -/** - * @param {object} opts : - * - dfltColor {string} : default axis color - * - bgColor {string} : combined subplot bg color - * - blend {number, optional} : blend percentage (to compute dflt grid color) - * - showLine {boolean} : show line by default - * - showGrid {boolean} : show grid by default - * - noZeroLine {boolean} : don't coerce zeroline* attributes - * - attributes {object} : attribute object associated with input containers - */ -module.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; +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } - var gridColorDflt = colorMix(dfltColor, opts.bgColor, opts.blend || lightFraction).toRgbString(); - var gridColor = coerce2('gridcolor', gridColorDflt); - var gridWidth = coerce2('gridwidth'); - var showGridLines = coerce('showgrid', opts.showGrid || !!gridColor || !!gridWidth); - - if(!showGridLines) { - delete containerOut.gridcolor; - delete containerOut.gridwidth; - } + var clickmode = coerce('clickmode'); - if(!opts.noZeroLine) { - var zeroLineColor = coerce2('zerolinecolor', dfltColor); - var zeroLineWidth = coerce2('zerolinewidth'); - var showZeroLine = coerce('zeroline', opts.showGrid || !!zeroLineColor || !!zeroLineWidth); + var dragMode = coerce('dragmode'); + if(dragMode === 'select') coerce('selectdirection'); - if(!showZeroLine) { - delete containerOut.zerolinecolor; - delete containerOut.zerolinewidth; + var hovermodeDflt; + if(layoutOut._has('cartesian')) { + if(clickmode.indexOf('select') > -1) { + hovermodeDflt = 'closest'; + } else { + // flag for 'horizontal' plots: + // determines the state of the mode bar 'compare' hovermode button + layoutOut._isHoriz = isHoriz(fullData); + hovermodeDflt = layoutOut._isHoriz ? 'y' : 'x'; } } -}; - -},{"../../components/color/attributes":569,"../../lib":696,"tinycolor2":514}],760:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -var Lib = _dereq_('../../lib'); - + else hovermodeDflt = 'closest'; -module.exports = function handlePositionDefaults(containerIn, containerOut, coerce, options) { - var counterAxes = options.counterAxes || []; - var overlayableAxes = options.overlayableAxes || []; - var letter = options.letter; - var grid = options.grid; + var hoverMode = coerce('hovermode', hovermodeDflt); + if(hoverMode) { + coerce('hoverdistance'); + coerce('spikedistance'); + } - var dfltAnchor, dfltDomain, dfltSide, dfltPosition; + // if only mapbox or geo subplots is present on graph, + // reset 'zoom' dragmode to 'pan' until 'zoom' is implemented, + // so that the correct modebar button is active + var hasMapbox = layoutOut._has('mapbox'); + var hasGeo = layoutOut._has('geo'); + var len = layoutOut._basePlotModules.length; - 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]; - } + if(layoutOut.dragmode === 'zoom' && ( + ((hasMapbox || hasGeo) && len === 1) || + (hasMapbox && hasGeo && len === 2) + )) { + layoutOut.dragmode = 'pan'; } +}; - // Even if there's a grid, this axis may not be in it - fall back on non-grid defaults - dfltDomain = dfltDomain || [0, 1]; - dfltAnchor = dfltAnchor || (isNumeric(containerIn.position) ? 'free' : (counterAxes[0] || 'free')); - dfltSide = dfltSide || (letter === 'x' ? 'bottom' : 'left'); - dfltPosition = dfltPosition || 0; - - var anchor = Lib.coerce(containerIn, containerOut, { - anchor: { - valType: 'enumerated', - values: ['free'].concat(counterAxes), - dflt: dfltAnchor - } - }, 'anchor'); +function isHoriz(fullData) { + var out = true; - if(anchor === 'free') coerce('position', dfltPosition); + for(var i = 0; i < fullData.length; i++) { + var trace = fullData[i]; - Lib.coerce(containerIn, containerOut, { - side: { - valType: 'enumerated', - values: letter === 'x' ? ['bottom', 'top'] : ['left', 'right'], - dflt: dfltSide + if(trace.orientation !== 'h') { + out = false; + break; } - }, 'side'); - - var overlaying = false; - if(overlayableAxes.length) { - overlaying = Lib.coerce(containerIn, containerOut, { - overlaying: { - valType: 'enumerated', - values: [false].concat(overlayableAxes), - dflt: false - } - }, 'overlaying'); - } - - if(!overlaying) { - // TODO: right now I'm copying this domain over to overlaying axes - // in ax.setscale()... but this means we still need (imperfect) logic - // in the axes popover to hide domain for the overlaying axis. - // perhaps I should make a private version _domain that all axes get??? - var domain = coerce('domain', dfltDomain); - if(domain[0] > domain[1] - 0.01) containerOut.domain = dfltDomain; - Lib.noneOrAll(containerIn.domain, containerOut.domain, dfltDomain); } - coerce('layer'); - - return containerOut; -}; + return out; +} -},{"../../lib":696,"fast-isnumeric":214}],761:[function(_dereq_,module,exports){ +},{"../../lib":159,"./layout_attributes":83}],85:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; +var Lib = _dereq_('../../lib'); +var handleHoverLabelDefaults = _dereq_('./hoverlabel_defaults'); +var layoutAttributes = _dereq_('./layout_attributes'); -module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) { - centerFraction = FROM_BL[ax.constraintoward || 'center']; +module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { + function coerce(attr, dflt) { + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } - 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) - ]; + handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../constants/alignment":668}],762:[function(_dereq_,module,exports){ +},{"../../lib":159,"./hoverlabel_defaults":80,"./layout_attributes":83}],86:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var polybool = _dereq_('polybooljs'); - -var Registry = _dereq_('../../registry'); -var Color = _dereq_('../../components/color'); -var Fx = _dereq_('../../components/fx'); - -var polygon = _dereq_('../../lib/polygon'); -var throttle = _dereq_('../../lib/throttle'); -var makeEventData = _dereq_('../../components/fx/helpers').makeEventData; -var getFromId = _dereq_('./axis_ids').getFromId; -var clearGlCanvases = _dereq_('../../lib/clear_gl_canvases'); -var redrawReglTraces = _dereq_('../../plot_api/subroutines').redrawReglTraces; - -var constants = _dereq_('./constants'); -var MINSELECT = constants.MINSELECT; - -var filteredPolygon = polygon.filter; -var polygonTester = polygon.tester; - -function getAxId(ax) { return ax._id; } - -function prepSelect(e, startX, startY, dragOptions, mode) { - var gd = dragOptions.gd; - var fullLayout = gd._fullLayout; - var zoomLayer = fullLayout._zoomlayer; - var dragBBox = dragOptions.element.getBoundingClientRect(); - var plotinfo = dragOptions.plotinfo; - var xs = plotinfo.xaxis._offset; - var ys = plotinfo.yaxis._offset; - var x0 = startX - dragBBox.left; - var y0 = startY - dragBBox.top; - var x1 = x0; - var y1 = y0; - var path0 = 'M' + x0 + ',' + y0; - var pw = dragOptions.xaxes[0]._length; - var ph = dragOptions.yaxes[0]._length; - var allAxes = dragOptions.xaxes.concat(dragOptions.yaxes); - var subtract = e.altKey; - - var filterPoly, selectionTester, mergedPolygons, currentPolygon; - var i, searchInfo, eventData; - - coerceSelectionsCache(e, gd, dragOptions); - - if(mode === 'lasso') { - filterPoly = filteredPolygon([[x0, y0]], constants.BENDPX); - } - - var outlines = zoomLayer.selectAll('path.select-outline-' + plotinfo.id).data([1, 2]); - - outlines.enter() - .append('path') - .attr('class', function(d) { return 'select-outline select-outline-' + d + ' select-outline-' + plotinfo.id; }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') - .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', 'translate(' + xs + ', ' + ys + ')') - .attr('d', 'M0,0Z'); - - - var throttleID = fullLayout._uid + constants.SELECTID; - var selection = []; - - // find the traces to search for selection points - var searchTraces = determineSearchTraces(gd, dragOptions.xaxes, - dragOptions.yaxes, dragOptions.subplot); - - function axValue(ax) { - var index = (ax._id.charAt(0) === 'y') ? 1 : 0; - return function(v) { return ax.p2d(v[index]); }; - } - - function ascending(a, b) { return a - b; } - - // allow subplots to override fillRangeItems routine - var fillRangeItems; - - if(plotinfo.fillRangeItems) { - fillRangeItems = plotinfo.fillRangeItems; - } else { - if(mode === 'select') { - fillRangeItems = function(eventData, poly) { - var ranges = eventData.range = {}; - - for(i = 0; i < allAxes.length; i++) { - var ax = allAxes[i]; - var axLetter = ax._id.charAt(0); - - ranges[ax._id] = [ - ax.p2d(poly[axLetter + 'min']), - ax.p2d(poly[axLetter + 'max']) - ].sort(ascending); - } - }; - } else { - fillRangeItems = function(eventData, poly, filterPoly) { - var dataPts = eventData.lassoPoints = {}; - - for(i = 0; i < allAxes.length; i++) { - var ax = allAxes[i]; - dataPts[ax._id] = filterPoly.filtered.map(axValue(ax)); - } - }; - } - } - - dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); - - var dx = Math.abs(x1 - x0), - dy = Math.abs(y1 - y0); - - if(mode === 'select') { - var direction = fullLayout.selectdirection; - - if(fullLayout.selectdirection === '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 = fullLayout.selectdirection; - } - - if(direction === 'h') { - // horizontal motion: make a vertical box - currentPolygon = [[x0, 0], [x0, ph], [x1, ph], [x1, 0]]; - currentPolygon.xmin = Math.min(x0, x1); - currentPolygon.xmax = Math.max(x0, x1); - currentPolygon.ymin = Math.min(0, ph); - currentPolygon.ymax = Math.max(0, ph); - // extras to guide users in keeping a straight selection - corners.attr('d', 'M' + currentPolygon.xmin + ',' + (y0 - MINSELECT) + - 'h-4v' + (2 * MINSELECT) + 'h4Z' + - 'M' + (currentPolygon.xmax - 1) + ',' + (y0 - MINSELECT) + - 'h4v' + (2 * MINSELECT) + 'h-4Z'); - - } - else if(direction === 'v') { - // vertical motion: make a horizontal box - currentPolygon = [[0, y0], [0, y1], [pw, y1], [pw, y0]]; - currentPolygon.xmin = Math.min(0, pw); - currentPolygon.xmax = Math.max(0, pw); - currentPolygon.ymin = Math.min(y0, y1); - currentPolygon.ymax = Math.max(y0, y1); - corners.attr('d', 'M' + (x0 - MINSELECT) + ',' + currentPolygon.ymin + - 'v-4h' + (2 * MINSELECT) + 'v4Z' + - 'M' + (x0 - MINSELECT) + ',' + (currentPolygon.ymax - 1) + - 'v4h' + (2 * MINSELECT) + 'v-4Z'); - } - else if(direction === 'd') { - // diagonal motion - currentPolygon = [[x0, y0], [x0, y1], [x1, y1], [x1, y0]]; - currentPolygon.xmin = Math.min(x0, x1); - currentPolygon.xmax = Math.max(x0, x1); - currentPolygon.ymin = Math.min(y0, y1); - currentPolygon.ymax = Math.max(y0, y1); - corners.attr('d', 'M0,0Z'); - } - } - else if(mode === 'lasso') { - filterPoly.addPt([x1, y1]); - currentPolygon = filterPoly.filtered; - } - - // create outline & tester - if(dragOptions.selectionDefs && dragOptions.selectionDefs.length) { - mergedPolygons = mergePolygons(dragOptions.mergedPolygons, currentPolygon, subtract); - currentPolygon.subtract = subtract; - selectionTester = multiTester(dragOptions.selectionDefs.concat([currentPolygon])); - } - else { - mergedPolygons = [currentPolygon]; - selectionTester = polygonTester(currentPolygon); - } - - // draw selection - drawSelection(mergedPolygons, outlines); - - - throttle.throttle( - throttleID, - constants.SELECTDELAY, - function() { - selection = []; - - var thisSelection, traceSelections = [], traceSelection; - for(i = 0; i < searchTraces.length; i++) { - searchInfo = searchTraces[i]; +var Lib = _dereq_('../../lib'); +var counterRegex = _dereq_('../../lib/regex').counter; +var domainAttrs = _dereq_('../../plots/domain').attributes; +var cartesianIdRegex = _dereq_('../../plots/cartesian/constants').idRegex; +var Template = _dereq_('../../plot_api/plot_template'); - traceSelection = searchInfo._module.selectPoints(searchInfo, selectionTester); - traceSelections.push(traceSelection); +var gridAttrs = { + rows: { + valType: 'integer', + min: 1, + + editType: 'plot', + + }, + roworder: { + valType: 'enumerated', + values: ['top to bottom', 'bottom to top'], + dflt: 'top to bottom', + + editType: 'plot', + + }, + columns: { + valType: 'integer', + min: 1, + + editType: 'plot', + + }, + subplots: { + valType: 'info_array', + freeLength: true, + dimensions: 2, + items: {valType: 'enumerated', values: [counterRegex('xy').toString(), ''], editType: 'plot'}, + + editType: 'plot', + + }, + xaxes: { + valType: 'info_array', + freeLength: true, + items: {valType: 'enumerated', values: [cartesianIdRegex.x.toString(), ''], editType: 'plot'}, + + editType: 'plot', + + }, + yaxes: { + valType: 'info_array', + freeLength: true, + items: {valType: 'enumerated', values: [cartesianIdRegex.y.toString(), ''], editType: 'plot'}, + + editType: 'plot', + + }, + pattern: { + valType: 'enumerated', + values: ['independent', 'coupled'], + dflt: 'coupled', + + editType: 'plot', + + }, + xgap: { + valType: 'number', + min: 0, + max: 1, + + editType: 'plot', + + }, + ygap: { + valType: 'number', + min: 0, + max: 1, + + editType: 'plot', + + }, + domain: domainAttrs({name: 'grid', editType: 'plot', noGridCell: true}, { + + }), + xside: { + valType: 'enumerated', + values: ['bottom', 'bottom plot', 'top plot', 'top'], + dflt: 'bottom plot', + + editType: 'plot', + + }, + yside: { + valType: 'enumerated', + values: ['left', 'left plot', 'right plot', 'right'], + dflt: 'left plot', + + editType: 'plot', + + }, + editType: 'plot' +}; - thisSelection = fillSelectionItem(traceSelection, searchInfo); +function getAxes(layout, grid, axLetter) { + var gridVal = grid[axLetter + 'axes']; + var splomVal = Object.keys((layout._splomAxes || {})[axLetter] || {}); - if(selection.length) { - for(var j = 0; j < thisSelection.length; j++) { - selection.push(thisSelection[j]); - } - } - else selection = thisSelection; - } + if(Array.isArray(gridVal)) return gridVal; + if(splomVal.length) return splomVal; +} - eventData = {points: selection}; - updateSelectedState(gd, searchTraces, eventData); - fillRangeItems(eventData, currentPolygon, filterPoly); - dragOptions.gd.emit('plotly_selecting', eventData); - } - ); - }; +// the shape of the grid - this needs to be done BEFORE supplyDataDefaults +// so that non-subplot traces can place themselves in the grid +function sizeDefaults(layoutIn, layoutOut) { + var gridIn = layoutIn.grid || {}; + var xAxes = getAxes(layoutOut, gridIn, 'x'); + var yAxes = getAxes(layoutOut, gridIn, 'y'); - dragOptions.clickFn = function(numClicks, evt) { - var clickmode = fullLayout.clickmode; + if(!layoutIn.grid && !xAxes && !yAxes) return; - corners.remove(); + 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 + ); - throttle.done(throttleID).then(function() { - throttle.clear(throttleID); - if(numClicks === 2) { - // clear selection on doubleclick - outlines.remove(); - for(i = 0; i < searchTraces.length; i++) { - searchInfo = searchTraces[i]; - searchInfo._module.selectPoints(searchInfo, false); - } + var dfltRows, dfltColumns; - updateSelectedState(gd, searchTraces); + if(hasSubplotGrid) { + dfltRows = gridIn.subplots.length; + dfltColumns = gridIn.subplots[0].length; + } + else { + if(hasYaxes) dfltRows = yAxes.length; + if(hasXaxes) dfltColumns = xAxes.length; + } - clearSelectionsCache(dragOptions); + var gridOut = Template.newContainer(layoutOut, 'grid'); - gd.emit('plotly_deselect', null); - } else { - if(clickmode.indexOf('select') > -1) { - selectOnClick(evt, gd, dragOptions.xaxes, dragOptions.yaxes, - dragOptions.subplot, dragOptions, outlines); - } + function coerce(attr, dflt) { + return Lib.coerce(gridIn, gridOut, gridAttrs, attr, dflt); + } - if(clickmode === 'event') { - // TODO: remove in v2 - this was probably never intended to work as it does, - // but in case anyone depends on it we don't want to break it now. - // Note that click-to-select introduced pre v2 also emitts proper - // event data when clickmode is having 'select' in its flag list. - gd.emit('plotly_selected', undefined); - } - } + var rows = coerce('rows', dfltRows); + var columns = coerce('columns', dfltColumns); - Fx.click(gd, evt); - }); - }; + if(!(rows * columns > 1)) { + delete layoutOut.grid; + return; + } - dragOptions.doneFn = function() { - corners.remove(); + if(!hasSubplotGrid && !hasXaxes && !hasYaxes) { + var useDefaultSubplots = coerce('pattern') === 'independent'; + if(useDefaultSubplots) hasSubplotGrid = true; + } + gridOut._hasSubplotGrid = hasSubplotGrid; - throttle.done(throttleID).then(function() { - throttle.clear(throttleID); - dragOptions.gd.emit('plotly_selected', eventData); + var rowOrder = coerce('roworder'); + var reversed = rowOrder === 'top to bottom'; - if(currentPolygon && dragOptions.selectionDefs) { - // save last polygons - currentPolygon.subtract = subtract; - dragOptions.selectionDefs.push(currentPolygon); + var dfltGapX = hasSubplotGrid ? 0.2 : 0.1; + var dfltGapY = hasSubplotGrid ? 0.3 : 0.1; - // we have to keep reference to arrays container - dragOptions.mergedPolygons.length = 0; - [].push.apply(dragOptions.mergedPolygons, mergedPolygons); - } - }); + 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 selectOnClick(evt, gd, xAxes, yAxes, subplot, dragOptions, polygonOutlines) { - var hoverData = gd._hoverdata; - var clickmode = gd._fullLayout.clickmode; - var sendEvents = clickmode.indexOf('event') > -1; - var selection = []; - var searchTraces, searchInfo, currentSelectionDef, selectionTester, traceSelection; - var thisTracesSelection, pointOrBinSelected, subtract, eventData, i; - - if(isHoverDataSet(hoverData)) { - coerceSelectionsCache(evt, gd, dragOptions); - searchTraces = determineSearchTraces(gd, xAxes, yAxes, subplot); - var clickedPtInfo = extractClickedPtInfo(hoverData, searchTraces); - var isBinnedTrace = clickedPtInfo.pointNumbers.length > 0; - +// coerce x or y sizing attributes and return an array of domains for this direction +function fillGridPositions(axLetter, coerce, dfltGap, dfltSide, len, reversed) { + var dirGap = coerce(axLetter + 'gap', dfltGap); + var domain = coerce('domain.' + axLetter); + coerce(axLetter + 'side', dfltSide); - // Note: potentially costly operation isPointOrBinSelected is - // called as late as possible through the use of an assignment - // in an if condition. - 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); - } + 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; +} - updateSelectedState(gd, searchTraces); +// the (cartesian) contents of the grid - this needs to happen AFTER supplyDataDefaults +// so that we know what cartesian subplots are available +function contentDefaults(layoutIn, layoutOut) { + var gridOut = layoutOut.grid; + // make sure we got to the end of handleGridSizing + if(!gridOut || !gridOut._domains) return; - clearSelectionsCache(dragOptions); + 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'; - if(sendEvents) { - gd.emit('plotly_deselect', null); - } - } else { - subtract = evt.shiftKey && - (pointOrBinSelected !== undefined ? - pointOrBinSelected : - isPointOrBinSelected(clickedPtInfo)); - currentSelectionDef = newPointSelectionDef(clickedPtInfo.pointNumber, clickedPtInfo.searchInfo, subtract); + var i, j, xId, yId, subplotId, subplotsOut, yPos; - var allSelectionDefs = dragOptions.selectionDefs.concat([currentSelectionDef]); - selectionTester = multiTester(allSelectionDefs); + var axisMap = gridOut._axisMap = {}; - for(i = 0; i < searchTraces.length; i++) { - traceSelection = searchTraces[i]._module.selectPoints(searchTraces[i], selectionTester); - thisTracesSelection = fillSelectionItem(traceSelection, searchTraces[i]); + if(hasSubplotGrid) { + var subplotsIn = gridIn.subplots || []; + subplotsOut = gridOut.subplots = new Array(rows); + var index = 1; - if(selection.length) { - for(var j = 0; j < thisTracesSelection.length; j++) { - selection.push(thisTracesSelection[j]); - } + 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 selection = thisTracesSelection; - } - - eventData = {points: selection}; - updateSelectedState(gd, searchTraces, eventData); + else subplotId = rowIn[j]; - if(currentSelectionDef && dragOptions) { - dragOptions.selectionDefs.push(currentSelectionDef); - } + rowOut[j] = ''; - if(polygonOutlines) drawSelection(dragOptions.mergedPolygons, polygonOutlines); + if(subplots.cartesian.indexOf(subplotId) !== -1) { + yPos = subplotId.indexOf('y'); + xId = subplotId.slice(0, yPos); + yId = subplotId.slice(yPos); + if((axisMap[xId] !== undefined && axisMap[xId] !== j) || + (axisMap[yId] !== undefined && axisMap[yId] !== i) + ) { + continue; + } - if(sendEvents) { - gd.emit('plotly_selected', eventData); + rowOut[j] = subplotId; + axisMap[xId] = j; + axisMap[yId] = i; + } } } } -} - -/** - * Constructs a new point selection definition object. - */ -function newPointSelectionDef(pointNumber, searchInfo, subtract) { - return { - pointNumber: pointNumber, - searchInfo: searchInfo, - subtract: subtract - }; -} + 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'); + } -function isPointSelectionDef(o) { - return 'pointNumber' in o && 'searchInfo' in o; -} + var anchors = gridOut._anchors = {}; + var reversed = gridOut.roworder === 'top to bottom'; -/* - * Constructs a new point number tester. - */ -function newPointNumTester(pointSelectionDef) { - return { - xmin: 0, - xmax: 0, - ymin: 0, - ymax: 0, - pts: [], - contains: function(pt, 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 - }; -} + for(var axisId in axisMap) { + var axLetter = axisId.charAt(0); + var side = gridOut[axLetter + 'side']; -/** - * Wraps multiple selection testers. - * - * @param {Array} list - An array of selection testers. - * - * @return a selection tester object with a contains function - * that can be called to evaluate a point against all wrapped - * selection testers that were passed in list. - */ -function multiTester(list) { - 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; + var i0, inc, iFinal; - for(var i = 0; i < list.length; i++) { - if(isPointSelectionDef(list[i])) { - testers.push(newPointNumTester(list[i])); - } else { - var tester = polygon.tester(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); + if(side.length < 8) { + // grid edge - ie not "* plot" - make these as free axes + // since we're not guaranteed to have a subplot there at all + anchors[axisId] = 'free'; } - } - - /** - * Tests if the given point is within this tester. - * - * @param {Array} pt - [0] is the x coordinate, [1] is the y coordinate of the point. - * @param {*} arg - An optional parameter to pass down to wrapped testers. - * @param {number} pointNumber - The point number of the point within the underlying data array. - * @param {number} searchInfo - An object identifying the trace the point is contained in. - * - * @return {boolean} true if point is considered to be selected, false otherwise. - */ - function contains(pt, arg, pointNumber, searchInfo) { - var contained = false; - for(var i = 0; i < testers.length; i++) { - if(testers[i].contains(pt, arg, pointNumber, searchInfo)) { - // if contained by subtract tester - exclude the point - contained = testers[i].subtract === false; + else if(axLetter === 'x') { + if((side.charAt(0) === 't') === reversed) { + i0 = 0; + inc = 1; + iFinal = rows; + } + else { + i0 = rows - 1; + inc = -1; + iFinal = -1; + } + if(hasSubplotGrid) { + var column = axisMap[axisId]; + for(i = i0; 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 = i0; 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')) { + i0 = 0; + inc = 1; + iFinal = columns; + } + else { + i0 = columns - 1; + inc = -1; + iFinal = -1; + } + if(hasSubplotGrid) { + var row = axisMap[axisId]; + for(i = i0; 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 = i0; i !== iFinal; i += inc) { + xId = gridOut.xaxes[i]; + if(subplots.cartesian.indexOf(xId + axisId) !== -1) { + anchors[axisId] = xId; + break; + } + } } } - - return contained; } - - return { - xmin: xmin, - xmax: xmax, - ymin: ymin, - ymax: ymax, - pts: [], - contains: contains, - isRect: false, - degenerate: false - }; } -function coerceSelectionsCache(evt, gd, dragOptions) { - var fullLayout = gd._fullLayout; - var zoomLayer = fullLayout._zoomlayer; - var plotinfo = dragOptions.plotinfo; +function fillGridAxes(axesIn, axesAllowed, len, axisMap, axLetter) { + var out = new Array(len); + var i; - var selectingOnSameSubplot = ( - fullLayout._lastSelectedSubplot && - fullLayout._lastSelectedSubplot === plotinfo.id - ); - var hasModifierKey = evt.shiftKey || evt.altKey; - if(selectingOnSameSubplot && hasModifierKey && - (plotinfo.selection && plotinfo.selection.selectionDefs) && !dragOptions.selectionDefs) { - // take over selection definitions from prev mode, if any - dragOptions.selectionDefs = plotinfo.selection.selectionDefs; - dragOptions.mergedPolygons = plotinfo.selection.mergedPolygons; - } else if(!hasModifierKey || !plotinfo.selection) { - clearSelectionsCache(dragOptions); + function fillOneAxis(i, axisId) { + if(axesAllowed.indexOf(axisId) !== -1 && axisMap[axisId] === undefined) { + out[i] = axisId; + axisMap[axisId] = i; + } + else out[i] = ''; } - // clear selection outline when selecting a different subplot - if(!selectingOnSameSubplot) { - clearSelect(zoomLayer); - fullLayout._lastSelectedSubplot = plotinfo.id; + if(Array.isArray(axesIn)) { + for(i = 0; i < len; i++) { + fillOneAxis(i, axesIn[i]); + } + } + else { + // default axis list is the first `len` axis ids + fillOneAxis(0, axLetter); + for(i = 1; i < len; i++) { + fillOneAxis(i, axLetter + (i + 1)); + } } -} - -function clearSelectionsCache(dragOptions) { - var plotinfo = dragOptions.plotinfo; - plotinfo.selection = {}; - plotinfo.selection.selectionDefs = dragOptions.selectionDefs = []; - plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = []; + return out; } -function determineSearchTraces(gd, xAxes, yAxes, subplot) { - var searchTraces = []; - var xAxisIds = xAxes.map(getAxId); - var yAxisIds = yAxes.map(getAxId); - var cd, trace, i; +module.exports = { + moduleType: 'component', + name: 'grid', - for(i = 0; i < gd.calcdata.length; i++) { - cd = gd.calcdata[i]; - trace = cd[0].trace; + schema: { + layout: {grid: gridAttrs} + }, - if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue; + layoutAttributes: gridAttrs, + sizeDefaults: sizeDefaults, + contentDefaults: contentDefaults +}; - if(subplot && (trace.subplot === subplot || trace.geo === subplot)) { - searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0])); - } else if( - trace.type === 'splom' && - // FIXME: make sure we don't have more than single axis for splom - trace._xaxes[xAxisIds[0]] && trace._yaxes[yAxisIds[0]] - ) { - var info = createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]); - info.scene = gd._fullLayout._splomScenes[trace.uid]; - searchTraces.push(info); - } else { - if(xAxisIds.indexOf(trace.xaxis) === -1) continue; - if(yAxisIds.indexOf(trace.yaxis) === -1) continue; +},{"../../lib":159,"../../lib/regex":174,"../../plot_api/plot_template":193,"../../plots/cartesian/constants":209,"../../plots/domain":229}],87:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - searchTraces.push(createSearchInfo(trace._module, cd, - getFromId(gd, trace.xaxis), getFromId(gd, trace.yaxis))); - } - } +'use strict'; - return searchTraces; +var cartesianConstants = _dereq_('../../plots/cartesian/constants'); +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - function createSearchInfo(module, calcData, xaxis, yaxis) { - return { - _module: module, - cd: calcData, - xaxis: xaxis, - yaxis: yaxis - }; - } -} -function drawSelection(polygons, outlines) { - var paths = []; - var i, d; +module.exports = templatedArray('image', { + visible: { + valType: 'boolean', + + dflt: true, + editType: 'arraydraw', + + }, - for(i = 0; i < polygons.length; i++) { - var ppts = polygons[i]; - paths.push(ppts.join('L') + 'L' + ppts[0]); - } + source: { + valType: 'string', + + editType: 'arraydraw', + + }, - d = polygons.length > 0 ? - 'M' + paths.join('M') + 'Z' : - 'M0,0Z'; - outlines.attr('d', d); -} + layer: { + valType: 'enumerated', + values: ['below', 'above'], + dflt: 'above', + + editType: 'arraydraw', + + }, -function isHoverDataSet(hoverData) { - return hoverData && - Array.isArray(hoverData) && - hoverData[0].hoverOnBox !== true; -} + sizex: { + valType: 'number', + + dflt: 0, + editType: 'arraydraw', + + }, -function extractClickedPtInfo(hoverData, searchTraces) { - var hoverDatum = hoverData[0]; - var pointNumber = -1; - var pointNumbers = []; - var searchInfo, i; + sizey: { + valType: 'number', + + dflt: 0, + editType: 'arraydraw', + + }, - for(i = 0; i < searchTraces.length; i++) { - searchInfo = searchTraces[i]; - if(hoverDatum.fullData._expandedIndex === searchInfo.cd[0].trace._expandedIndex) { + sizing: { + valType: 'enumerated', + values: ['fill', 'contain', 'stretch'], + dflt: 'contain', + + editType: 'arraydraw', + + }, - // Special case for box (and violin) - if(hoverDatum.hoverOnBox === true) { - break; - } + opacity: { + valType: 'number', + + min: 0, + max: 1, + dflt: 1, + editType: 'arraydraw', + + }, - // Hint: in some traces like histogram, one graphical element - // doesn't correspond to one particular data point, but to - // bins of data points. Thus, hoverDatum can have a binNumber - // property instead of pointNumber. - if(hoverDatum.pointNumber !== undefined) { - pointNumber = hoverDatum.pointNumber; - } else if(hoverDatum.binNumber !== undefined) { - pointNumber = hoverDatum.binNumber; - pointNumbers = hoverDatum.pointNumbers; - } + x: { + valType: 'any', + + dflt: 0, + editType: 'arraydraw', + + }, - break; - } - } + y: { + valType: 'any', + + dflt: 0, + editType: 'arraydraw', + + }, - return { - pointNumber: pointNumber, - pointNumbers: pointNumbers, - searchInfo: searchInfo - }; -} + xanchor: { + valType: 'enumerated', + values: ['left', 'center', 'right'], + dflt: 'left', + + editType: 'arraydraw', + + }, -function isPointOrBinSelected(clickedPtInfo) { - var trace = clickedPtInfo.searchInfo.cd[0].trace; - var ptNum = clickedPtInfo.pointNumber; - var ptNums = clickedPtInfo.pointNumbers; - var ptNumsSet = ptNums.length > 0; + yanchor: { + valType: 'enumerated', + values: ['top', 'middle', 'bottom'], + dflt: 'top', + + editType: 'arraydraw', + + }, - // When pointsNumbers is set (e.g. histogram's binning), - // it is assumed that when the first point of - // a bin is selected, all others are as well - var ptNumToTest = ptNumsSet ? ptNums[0] : ptNum; + xref: { + valType: 'enumerated', + values: [ + 'paper', + cartesianConstants.idRegex.x.toString() + ], + dflt: 'paper', + + editType: 'arraydraw', + + }, - // TODO potential performance improvement - // Primarily we need this function to determine if a click adds - // or subtracts from a selection. - // In cases `trace.selectedpoints` is a huge array, indexOf - // might be slow. One remedy would be to introduce a hash somewhere. - return trace.selectedpoints ? trace.selectedpoints.indexOf(ptNumToTest) > -1 : false; -} + yref: { + valType: 'enumerated', + values: [ + 'paper', + cartesianConstants.idRegex.y.toString() + ], + dflt: 'paper', + + editType: 'arraydraw', + + }, + editType: 'arraydraw' +}); -function isOnlyThisBinSelected(searchTraces, clickedPtInfo) { - var tracesWithSelectedPts = []; - var searchInfo, trace, isSameTrace, i; +},{"../../plot_api/plot_template":193,"../../plots/cartesian/constants":209}],88:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - 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; - } - } - } +'use strict'; - return false; -} +var isNumeric = _dereq_('fast-isnumeric'); +var toLogRange = _dereq_('../../lib/to_log_range'); -function isOnlyOnePointSelected(searchTraces) { - var len = 0; - var searchInfo, trace, i; +/* + * convertCoords: when converting an axis between log and linear + * you need to alter any images on that axis to keep them + * pointing at the same data point. + * In v2.0 this will become obsolete (or perhaps size will still need conversion?) + * we convert size by declaring that the maximum extent *in data units* should be + * the same, assuming the image is anchored by its center (could remove that restriction + * if we think it's important) even though the actual left and right values will not be + * quite the same since the scale becomes nonlinear (and central anchor means the pixel + * center of the image, not the data units center) + * + * gd: the plot div + * ax: the axis being changed + * newType: the type it's getting + * doExtra: function(attr, val) from inside relayout that sets the attribute. + * Use this to make the changes as it's aware if any other changes in the + * same relayout call should override this conversion. + */ +module.exports = function convertCoords(gd, ax, newType, doExtra) { + ax = ax || {}; - 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; + var toLog = (newType === 'log') && (ax.type === 'linear'); + var fromLog = (newType === 'linear') && (ax.type === 'log'); - len += trace.selectedpoints.length; - if(len > 1) return false; - } - } + if(!(toLog || fromLog)) return; - return len === 1; -} + var images = gd._fullLayout.images; + var axLetter = ax._id.charAt(0); + var image; + var attrPrefix; -function updateSelectedState(gd, searchTraces, eventData) { - var i, searchInfo, cd, trace; + for(var i = 0; i < images.length; i++) { + image = images[i]; + attrPrefix = 'images[' + i + '].'; - if(eventData) { - var pts = eventData.points || []; + if(image[axLetter + 'ref'] === ax._id) { + var currentPos = image[axLetter]; + var currentSize = image['size' + axLetter]; + var newPos = null; + var newSize = null; - for(i = 0; i < searchTraces.length; i++) { - trace = searchTraces[i].cd[0].trace; - trace.selectedpoints = []; - trace._input.selectedpoints = []; - } + if(toLog) { + newPos = toLogRange(currentPos, ax.range); - for(i = 0; i < pts.length; i++) { - var pt = pts[i]; - var data = pt.data; - var fullData = pt.fullData; + // this is the inverse of the conversion we do in fromLog below + // so that the conversion is reversible (notice the fromLog conversion + // is like sinh, and this one looks like arcsinh) + 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(pt.pointIndices) { - [].push.apply(data.selectedpoints, pt.pointIndices); - [].push.apply(fullData.selectedpoints, pt.pointIndices); - } else { - data.selectedpoints.push(pt.pointIndex); - fullData.selectedpoints.push(pt.pointIndex); + // if conversion failed, delete the value so it can get a default later on + if(!isNumeric(newPos)) { + newPos = null; + newSize = null; } + else if(!isNumeric(newSize)) newSize = null; + + doExtra(attrPrefix + axLetter, newPos); + doExtra(attrPrefix + 'size' + axLetter, newSize); } } - else { - for(i = 0; i < searchTraces.length; i++) { - trace = searchTraces[i].cd[0].trace; - delete trace.selectedpoints; - delete trace._input.selectedpoints; - } - } +}; - var hasRegl = false; +},{"../../lib/to_log_range":182,"fast-isnumeric":10}],89:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(i = 0; i < searchTraces.length; i++) { - searchInfo = searchTraces[i]; - cd = searchInfo.cd; - trace = cd[0].trace; +'use strict'; - if(Registry.traceIs(trace, 'regl')) { - hasRegl = true; - } +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - var _module = searchInfo._module; - var fn = _module.styleOnSelect || _module.style; - if(fn) fn(gd, cd); - } +var attributes = _dereq_('./attributes'); +var name = 'images'; - if(hasRegl) { - clearGlCanvases(gd); - redrawReglTraces(gd); - } -} +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: imageDefaults + }; -function mergePolygons(list, poly, subtract) { - var res; + handleArrayContainerDefaults(layoutIn, layoutOut, opts); +}; - if(subtract) { - res = polybool.difference({ - regions: list, - inverted: false - }, { - regions: [poly], - inverted: false - }); - return res.regions; +function imageDefaults(imageIn, imageOut, fullLayout) { + + function coerce(attr, dflt) { + return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } - res = polybool.union({ - regions: list, - inverted: false - }, { - regions: [poly], - inverted: false - }); + var source = coerce('source'); + var visible = coerce('visible', !!source); - return res.regions; -} + if(!visible) return imageOut; -function fillSelectionItem(selection, searchInfo) { - if(Array.isArray(selection)) { - var cd = searchInfo.cd; - var trace = searchInfo.cd[0].trace; + coerce('layer'); + coerce('xanchor'); + coerce('yanchor'); + coerce('sizex'); + coerce('sizey'); + coerce('sizing'); + coerce('opacity'); - for(var i = 0; i < selection.length; i++) { - selection[i] = makeEventData(selection[i], trace, cd); + var gdMock = { _fullLayout: fullLayout }; + var axLetters = ['x', 'y']; + + for(var i = 0; i < 2; i++) { + // 'paper' is the fallback axref + var axLetter = axLetters[i]; + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + + if(axRef !== 'paper') { + var ax = Axes.getFromId(gdMock, axRef); + ax._imgIndices.push(imageOut._index); } - } - return selection; -} + Axes.coercePosition(imageOut, gdMock, coerce, axRef, axLetter, 0); + } -function clearSelect(zoomlayer) { - // until we get around to persistent selections, remove the outline - // here. The selection itself will be removed when the plot redraws - // at the end. - zoomlayer.selectAll('.select-outline').remove(); + return imageOut; } -module.exports = { - prepSelect: prepSelect, - clearSelect: clearSelect, - selectOnClick: selectOnClick -}; - -},{"../../components/color":570,"../../components/fx":612,"../../components/fx/helpers":609,"../../lib/clear_gl_canvases":680,"../../lib/polygon":708,"../../lib/throttle":721,"../../plot_api/subroutines":735,"../../registry":827,"./axis_ids":747,"./constants":750,"polybooljs":456}],763:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plots/array_container_defaults":199,"../../plots/cartesian/axes":203,"./attributes":87}],90:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); +var Drawing = _dereq_('../drawing'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); -var Lib = _dereq_('../../lib'); -var cleanNumber = Lib.cleanNumber; -var ms2DateTime = Lib.ms2DateTime; -var dateTime2ms = Lib.dateTime2ms; -var ensureNumber = Lib.ensureNumber; +module.exports = function draw(gd) { + var fullLayout = gd._fullLayout; + var imageDataAbove = []; + var imageDataSubplot = {}; + var imageDataBelow = []; + var subplot; + var i; -var numConstants = _dereq_('../../constants/numerical'); -var FP_SAFE = numConstants.FP_SAFE; -var BADNUM = numConstants.BADNUM; -var LOG_CLIP = numConstants.LOG_CLIP; + // Sort into top, subplot, and bottom layers + for(i = 0; i < fullLayout.images.length; i++) { + var img = fullLayout.images[i]; -var constants = _dereq_('./constants'); -var axisIds = _dereq_('./axis_ids'); + if(img.visible) { + if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { + subplot = img.xref + img.yref; -function fromLog(v) { - return Math.pow(10, v); -} + var plotinfo = fullLayout._plots[subplot]; -/** - * Define the conversion functions for an axis data is used in 5 ways: - * - * d: data, in whatever form it's provided - * c: calcdata: turned into numbers, but not linearized - * l: linearized - same as c except for log axes (and other nonlinear - * mappings later?) this is used when we need to know if it's - * *possible* to show some data on this axis, without caring about - * the current range - * p: pixel value - mapped to the screen with current size and zoom - * r: ranges, tick0, and annotation positions match one of the above - * but are handled differently for different types: - * - linear and date: data format (d) - * - category: calcdata format (c), and will stay that way because - * the data format has no continuous mapping - * - log: linearized (l) format - * TODO: in v2.0 we plan to change it to data format. At that point - * shapes will work the same way as ranges, tick0, and annotations - * so they can use this conversion too. - * - * Creates/updates these conversion functions, and a few more utilities - * like cleanRange, and makeCalcdata - * - * also clears the autotick constraints ._minDtick, ._forceTick0 - */ -module.exports = function setConvert(ax, fullLayout) { - fullLayout = fullLayout || {}; + if(!plotinfo) { + // Fall back to _imageLowerLayer in case the requested subplot doesn't exist. + // This can happen if you reference the image to an x / y axis combination + // that doesn't have any data on it (and layer is below) + imageDataBelow.push(img); + continue; + } - var axLetter = (ax._id || 'x').charAt(0); + if(plotinfo.mainplot) { + subplot = plotinfo.mainplot.id; + } - function toLog(v, clip) { - if(v > 0) return Math.log(v) / Math.LN10; + if(!imageDataSubplot[subplot]) { + imageDataSubplot[subplot] = []; + } + imageDataSubplot[subplot].push(img); + } else if(img.layer === 'above') { + imageDataAbove.push(img); + } else { + imageDataBelow.push(img); + } + } + } - else if(v <= 0 && clip && ax.range && ax.range.length === 2) { - // clip NaN (ie past negative infinity) to LOG_CLIP axis - // length past the negative edge - var r0 = ax.range[0], - r1 = ax.range[1]; - return 0.5 * (r0 + r1 - 2 * LOG_CLIP * Math.abs(r0 - r1)); + + 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 } } + }; - else return BADNUM; - } - /* - * wrapped dateTime2ms that: - * - accepts ms numbers for backward compatibility - * - inserts a dummy arg so calendar is the 3rd arg (see notes below). - * - defaults to ax.calendar - */ - function dt2ms(v, _, calendar) { - // NOTE: Changed this behavior: previously we took any numeric value - // to be a ms, even if it was a string that could be a bare year. - // Now we convert it as a date if at all possible, and only try - // as (local) ms if that fails. - var ms = dateTime2ms(v, calendar || ax.calendar); - if(ms === BADNUM) { - if(isNumeric(v)) { - v = +v; - // keep track of tenths of ms, that `new Date` will drop - // same logic as in Lib.ms2DateTime - var msecTenths = Math.floor(Lib.mod(v + 0.05, 1) * 10); - var msRounded = Math.round(v - msecTenths / 10); - ms = dateTime2ms(new Date(msRounded)) + msecTenths / 10; - } - else return BADNUM; + // Images must be converted to dataURL's for exporting. + function setImage(d) { + var thisImage = d3.select(this); + + if(this.img && this.img.src === d.source) { + return; } - return ms; - } - // wrapped ms2DateTime to insert default ax.calendar - function ms2dt(v, r, calendar) { - return ms2DateTime(v, r, calendar || ax.calendar); - } + thisImage.attr('xmlns', xmlnsNamespaces.svg); + + var imagePromise = new Promise(function(resolve) { + + var img = new Image(); + this.img = img; + + // If not set, a `tainted canvas` error is thrown + img.setAttribute('crossOrigin', 'anonymous'); + img.onerror = errorHandler; + img.onload = function() { + var canvas = document.createElement('canvas'); + canvas.width = this.width; + canvas.height = this.height; + + var ctx = canvas.getContext('2d'); + ctx.drawImage(this, 0, 0); + + var dataURL = canvas.toDataURL('image/png'); + + thisImage.attr('xlink:href', dataURL); - function getCategoryName(v) { - return ax._categories[Math.round(v)]; - } + // resolve promise in onload handler instead of on 'load' to support IE11 + // see https://github.com/plotly/plotly.js/issues/1685 + // for more details + resolve(); + }; - /* - * setCategoryIndex: return the index of category v, - * inserting it in the list if it's not already there - * - * this will enter the categories in the order it - * encounters them, ie all the categories from the - * first data set, then all the ones from the second - * that aren't in the first etc. - * - * it is assumed that this function is being invoked in the - * already sorted category order; otherwise there would be - * a disconnect between the array and the index returned - */ - function setCategoryIndex(v) { - if(v !== null && v !== undefined) { - if(ax._categoriesMap === undefined) { - ax._categoriesMap = {}; - } - if(ax._categoriesMap[v] !== undefined) { - return ax._categoriesMap[v]; - } else { - ax._categories.push(v); + thisImage.on('error', errorHandler); - var curLength = ax._categories.length - 1; - ax._categoriesMap[v] = curLength; + img.src = d.source; - return curLength; + function errorHandler() { + thisImage.remove(); + resolve(); } - } - return BADNUM; + }.bind(this)); + + gd._promises.push(imagePromise); } - function getCategoryIndex(v) { - // d2l/d2c variant that that won't add categories but will also - // allow numbers to be mapped to the linearized axis positions - if(ax._categoriesMap) { - var index = ax._categoriesMap[v]; - if(index !== undefined) return index; - } + function applyAttributes(d) { + var thisImage = d3.select(this); - if(isNumeric(v)) return +v; - } + // Axes if specified + var xa = Axes.getFromId(gd, d.xref); + var ya = Axes.getFromId(gd, d.yref); - function l2p(v) { - if(!isNumeric(v)) return BADNUM; + var size = fullLayout._size; + var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; + var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; - // include 2 fractional digits on pixel, for PDF zooming etc - return d3.round(ax._b + ax._m * v, 2); - } + // Offsets for anchor positioning + var xOffset = width * anchors.x[d.xanchor].offset; + var yOffset = height * anchors.y[d.yanchor].offset; - function p2l(px) { return (px - ax._b) / ax._m; } + var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; - // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; - ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; + // Final positions + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; + var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; - ax.l2p = l2p; - ax.p2l = p2l; + // Construct the proper aspectRatio attribute + switch(d.sizing) { + case 'fill': + sizing += ' slice'; + break; - 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; + case 'stretch': + sizing = 'none'; + break; + } - /* - * now type-specific conversions for **ALL** other combinations - * they're all written out, instead of being combinations of each other, for - * both clarity and speed. - */ - if(['linear', '-'].indexOf(ax.type) !== -1) { - // all are data vals, but d and r need cleaning - ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; + thisImage.attr({ + x: xPos, + y: yPos, + width: width, + height: height, + preserveAspectRatio: sizing, + opacity: d.opacity + }); - ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; - ax.p2d = ax.p2r = p2l; - ax.cleanPos = ensureNumber; + // Set proper clipping on images + var xId = xa ? xa._id : ''; + var yId = ya ? ya._id : ''; + var clipAxes = xId + yId; + + Drawing.setClipUrl( + thisImage, + clipAxes ? ('clip' + fullLayout._uid + clipAxes) : null, + gd + ); } - else if(ax.type === 'log') { - // d and c are data vals, r and l are logged (but d and r need cleaning) - 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; + var imagesBelow = fullLayout._imageLowerLayer.selectAll('image') + .data(imageDataBelow); + var imagesAbove = fullLayout._imageUpperLayer.selectAll('image') + .data(imageDataAbove); - ax.c2r = toLog; - ax.l2d = fromLog; + imagesBelow.enter().append('image'); + imagesAbove.enter().append('image'); - ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; - ax.p2d = function(px) { return fromLog(p2l(px)); }; + imagesBelow.exit().remove(); + imagesAbove.exit().remove(); - ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; - ax.p2r = p2l; + imagesBelow.each(function(d) { + setImage.bind(this)(d); + applyAttributes.bind(this)(d); + }); + imagesAbove.each(function(d) { + setImage.bind(this)(d); + applyAttributes.bind(this)(d); + }); - ax.cleanPos = ensureNumber; - } - else if(ax.type === 'date') { - // r and d are date strings, l and c are ms + var allSubplots = Object.keys(fullLayout._plots); + for(i = 0; i < allSubplots.length; i++) { + subplot = allSubplots[i]; + var subplotObj = fullLayout._plots[subplot]; - /* - * Any of these functions with r and d on either side, calendar is the - * **3rd** argument. log has reserved the second argument. - * - * Unless you need the special behavior of the second arg (ms2DateTime - * uses this to limit precision, toLog uses true to clip negatives - * to offscreen low rather than undefined), it's safe to pass 0. - */ - ax.d2r = ax.r2d = Lib.identity; + // filter out overlaid plots (which havd their images on the main plot) + // and gl2d plots (which don't support below images, at least not yet) + if(!subplotObj.imagelayer) continue; - ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; + var imagesOnSubplot = subplotObj.imagelayer.selectAll('image') + // even if there are no images on this subplot, we need to run + // enter and exit in case there were previously + .data(imageDataSubplot[subplot] || []); - 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); }; + imagesOnSubplot.enter().append('image'); + imagesOnSubplot.exit().remove(); - ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; + imagesOnSubplot.each(function(d) { + setImage.bind(this)(d); + applyAttributes.bind(this)(d); + }); } - else if(ax.type === 'category') { - // d is categories (string) - // c and l are indices (numbers) - // r is categories or numbers - - ax.d2c = ax.d2l = setCategoryIndex; - ax.r2d = ax.c2d = ax.l2d = getCategoryName; - - ax.d2r = ax.d2l_noadd = getCategoryIndex; - - ax.r2c = function(v) { - var index = getCategoryIndex(v); - return index !== undefined ? index : ax.fraction2r(0.5); - }; +}; - ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryIndex; +},{"../../constants/xmlns_namespaces":141,"../../plots/cartesian/axes":203,"../drawing":64,"d3":8}],91:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - 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; +'use strict'; - ax.cleanPos = function(v) { - if(typeof v === 'string' && v !== '') return v; - return ensureNumber(v); - }; - } +module.exports = { + moduleType: 'component', + name: 'images', - // find the range value at the specified (linear) fraction of the axis - ax.fraction2r = function(v) { - var rl0 = ax.r2l(ax.range[0]), - rl1 = ax.r2l(ax.range[1]); - return ax.l2r(rl0 + v * (rl1 - rl0)); - }; + layoutAttributes: _dereq_('./attributes'), + supplyLayoutDefaults: _dereq_('./defaults'), + includeBasePlot: _dereq_('../../plots/cartesian/include_components')('images'), - // find the fraction of the range at the specified range value - ax.r2fraction = function(v) { - var rl0 = ax.r2l(ax.range[0]), - rl1 = ax.r2l(ax.range[1]); - return (ax.r2l(v) - rl0) / (rl1 - rl0); - }; + draw: _dereq_('./draw'), - /* - * cleanRange: make sure range is a couplet of valid & distinct values - * keep numbers away from the limits of floating point numbers, - * and dates away from the ends of our date system (+/- 9999 years) - * - * optional param rangeAttr: operate on a different attribute, like - * ax._r, rather than ax.range - */ - ax.cleanRange = function(rangeAttr, opts) { - if(!opts) opts = {}; - if(!rangeAttr) rangeAttr = 'range'; + convertCoords: _dereq_('./convert_coords') +}; - var range = Lib.nestedProperty(ax, rangeAttr).get(); - var i, dflt; +},{"../../plots/cartesian/include_components":214,"./attributes":87,"./convert_coords":88,"./defaults":89,"./draw":90}],92:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(ax.type === 'date') dflt = Lib.dfltRange(ax.calendar); - else if(axLetter === 'y') dflt = constants.DFLTRANGEY; - else dflt = opts.dfltRange || constants.DFLTRANGEX; +'use strict'; - // make sure we don't later mutate the defaults - dflt = dflt.slice(); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var colorAttrs = _dereq_('../color/attributes'); - if(!range || range.length !== 2) { - Lib.nestedProperty(ax, rangeAttr).set(dflt); - return; - } - if(ax.type === 'date') { - // check if milliseconds or js date objects are provided for range - // and convert to date strings - range[0] = Lib.cleanDate(range[0], BADNUM, ax.calendar); - range[1] = Lib.cleanDate(range[1], BADNUM, ax.calendar); - } +module.exports = { + bgcolor: { + valType: 'color', + + editType: 'legend', + + }, + bordercolor: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'legend', + + }, + borderwidth: { + valType: 'number', + min: 0, + dflt: 0, + + editType: 'legend', + + }, + font: fontAttrs({ + editType: 'legend', + + }), + orientation: { + valType: 'enumerated', + values: ['v', 'h'], + dflt: 'v', + + editType: 'legend', + + }, + traceorder: { + valType: 'flaglist', + flags: ['reversed', 'grouped'], + extras: ['normal'], + + editType: 'legend', + + }, + tracegroupgap: { + valType: 'number', + min: 0, + dflt: 10, + + editType: 'legend', + + }, + x: { + valType: 'number', + min: -2, + max: 3, + dflt: 1.02, + + editType: 'legend', + + }, + xanchor: { + valType: 'enumerated', + values: ['auto', 'left', 'center', 'right'], + dflt: 'left', + + editType: 'legend', + + }, + y: { + valType: 'number', + min: -2, + max: 3, + dflt: 1, + + editType: 'legend', + + }, + yanchor: { + valType: 'enumerated', + values: ['auto', 'top', 'middle', 'bottom'], + dflt: 'auto', + + editType: 'legend', + + }, + uirevision: { + valType: 'any', + + editType: 'none', + + }, + valign: { + valType: 'enumerated', + values: ['top', 'middle', 'bottom'], + dflt: 'middle', + + editType: 'legend', + + }, + editType: 'legend' +}; - for(i = 0; i < 2; i++) { - if(ax.type === 'date') { - if(!Lib.isDateTime(range[i], ax.calendar)) { - ax[rangeAttr] = dflt; - break; - } +},{"../../plots/font_attributes":230,"../color/attributes":42}],93:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(ax.r2l(range[0]) === ax.r2l(range[1])) { - // split by +/- 1 second - var linCenter = Lib.constrain(ax.r2l(range[0]), - Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); - range[0] = ax.l2r(linCenter - 1000); - range[1] = ax.l2r(linCenter + 1000); - break; - } - } - else { - if(!isNumeric(range[i])) { - if(isNumeric(range[1 - i])) { - range[i] = range[1 - i] * (i ? 10 : 0.1); - } - else { - ax[rangeAttr] = dflt; - break; - } - } +'use strict'; - if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; - else if(range[i] > FP_SAFE) range[i] = FP_SAFE; +module.exports = { + scrollBarWidth: 6, + scrollBarMinHeight: 20, + scrollBarColor: '#808BA4', + scrollBarMargin: 4, + textOffsetX: 40 +}; - if(range[0] === range[1]) { - // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger - var inc = Math.max(1, Math.abs(range[0] * 1e-6)); - range[0] -= inc; - range[1] += inc; - } - } - } - }; +},{}],94:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // set scaling to pixels - ax.setScale = function(usePrivateRange) { - var gs = fullLayout._size; - // TODO cleaner way to handle this case - if(!ax._categories) ax._categories = []; - // Add a map to optimize the performance of category collection - if(!ax._categoriesMap) ax._categoriesMap = {}; +'use strict'; - // make sure we have a domain (pull it in from the axis - // this one is overlaying if necessary) - if(ax.overlaying) { - var ax2 = axisIds.getFromId({ _fullLayout: fullLayout }, ax.overlaying); - ax.domain = ax2.domain; - } +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var Template = _dereq_('../../plot_api/plot_template'); - // While transitions are occuring, occurring, we get a double-transform - // issue if we transform the drawn layer *and* use the new axis range to - // draw the data. This allows us to construct setConvert using the pre- - // interaction values of the range: - var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range', - calendar = ax.calendar; - ax.cleanRange(rangeAttr); +var attributes = _dereq_('./attributes'); +var basePlotLayoutAttributes = _dereq_('../../plots/layout_attributes'); +var helpers = _dereq_('./helpers'); - var rl0 = ax.r2l(ax[rangeAttr][0], calendar), - rl1 = ax.r2l(ax[rangeAttr][1], calendar); - if(axLetter === 'y') { - ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; - ax._length = gs.h * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (rl0 - rl1); - ax._b = -ax._m * rl1; - } - else { - ax._offset = gs.l + ax.domain[0] * gs.w; - ax._length = gs.w * (ax.domain[1] - ax.domain[0]); - ax._m = ax._length / (rl1 - rl0); - ax._b = -ax._m * rl0; - } +module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { + var containerIn = layoutIn.legend || {}; - if(!isFinite(ax._m) || !isFinite(ax._b)) { - fullLayout._replotting = false; - throw new Error('Something went wrong with axis scaling'); - } - }; + var legendTraceCount = 0; + var legendReallyHasATrace = false; + var defaultOrder = 'normal'; - // makeCalcdata: takes an x or y array and converts it - // to a position on the axis object "ax" - // inputs: - // trace - a data object from gd.data - // axLetter - a string, either 'x' or 'y', for which item - // to convert (TODO: is this now always the same as - // the first letter of ax._id?) - // in case the expected data isn't there, make a list of - // integers based on the opposite data - ax.makeCalcdata = function(trace, axLetter) { - var arrayIn, arrayOut, i, len; + var defaultX, defaultY, defaultXAnchor, defaultYAnchor; - var axType = ax.type; - var cal = axType === 'date' && trace[axLetter + 'calendar']; + for(var i = 0; i < fullData.length; i++) { + var trace = fullData[i]; - if(axLetter in trace) { - arrayIn = trace[axLetter]; - len = trace._length || arrayIn.length; + if(!trace.visible) continue; - if(Lib.isTypedArray(arrayIn) && (axType === 'linear' || axType === 'log')) { - if(len === arrayIn.length) { - return arrayIn; - } else if(arrayIn.subarray) { - return arrayIn.subarray(0, len); + // Note that we explicitly count any trace that is either shown or + // *would* be shown by default, toward the two traces you need to + // ensure the legend is shown by default, because this can still help + // disambiguate. + if(trace.showlegend || trace._dfltShowLegend) { + legendTraceCount++; + if(trace.showlegend) { + legendReallyHasATrace = true; + // Always show the legend by default if there's a pie, + // or if there's only one trace but it's explicitly shown + if(Registry.traceIs(trace, 'pie') || + trace._input.showlegend === true + ) { + legendTraceCount++; } } - - arrayOut = new Array(len); - for(i = 0; i < len; i++) { - arrayOut[i] = ax.d2c(arrayIn[i], 0, cal); - } } - else { - var v0 = ((axLetter + '0') in trace) ? ax.d2c(trace[axLetter + '0'], 0, cal) : 0; - var dv = (trace['d' + axLetter]) ? Number(trace['d' + axLetter]) : 1; - // the opposing data, for size if we have x and dx etc - arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; - len = trace._length || arrayIn.length; - arrayOut = new Array(len); + if((Registry.traceIs(trace, 'bar') && layoutOut.barmode === 'stack') || + ['tonextx', 'tonexty'].indexOf(trace.fill) !== -1) { + defaultOrder = helpers.isGrouped({traceorder: defaultOrder}) ? + 'grouped+reversed' : 'reversed'; + } - for(i = 0; i < len; i++) { - arrayOut[i] = v0 + i * dv; - } + if(trace.legendgroup !== undefined && trace.legendgroup !== '') { + defaultOrder = helpers.isReversed({traceorder: defaultOrder}) ? + 'reversed+grouped' : 'grouped'; } + } - return arrayOut; - }; + var showLegend = Lib.coerce(layoutIn, layoutOut, + basePlotLayoutAttributes, 'showlegend', + legendReallyHasATrace && legendTraceCount > 1); + + if(showLegend === false && !containerIn.uirevision) return; + + var containerOut = Template.newContainer(layoutOut, 'legend'); - ax.isValidRange = function(range) { - return ( - Array.isArray(range) && - range.length === 2 && - isNumeric(ax.r2l(range[0])) && - isNumeric(ax.r2l(range[1])) - ); - }; + function coerce(attr, dflt) { + return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); + } - ax.isPtWithinRange = function(d, calendar) { - var coord = ax.c2l(d[axLetter], null, calendar); - var r0 = ax.r2l(ax.range[0]); - var r1 = ax.r2l(ax.range[1]); + coerce('uirevision', layoutOut.uirevision); - if(r0 < r1) { - return r0 <= coord && coord <= r1; - } else { - // Reversed axis case. - return r1 <= coord && coord <= r0; - } - }; + if(showLegend === false) return; - ax.clearCalc = function() { - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c - ax._categories = (ax._initialCategories || []).slice(); + coerce('bgcolor', layoutOut.paper_bgcolor); + coerce('bordercolor'); + coerce('borderwidth'); + Lib.coerceFont(coerce, 'font', layoutOut.font); - // Build the lookup map for initialized categories - ax._categoriesMap = {}; - for(var j = 0; j < ax._categories.length; j++) { - ax._categoriesMap[ax._categories[j]] = j; + coerce('orientation'); + if(containerOut.orientation === 'h') { + var xaxis = layoutIn.xaxis; + if(Registry.getComponentMethod('rangeslider', 'isVisible')(xaxis)) { + defaultX = 0; + defaultXAnchor = 'left'; + defaultY = 1.1; + defaultYAnchor = 'bottom'; + } + else { + defaultX = 0; + defaultXAnchor = 'left'; + defaultY = -0.1; + defaultYAnchor = 'top'; } - }; - - // Propagate localization into the axis so that - // methods in Axes can use it w/o having to pass fullLayout - // Default (non-d3) number formatting uses separators directly - // dates and d3-formatted numbers use the d3 locale - // Fall back on default format for dummy axes that don't care about formatting - var locale = fullLayout._d3locale; - if(ax.type === 'date') { - ax._dateFormat = locale ? locale.timeFormat.utc : d3.time.format.utc; - ax._extraFormat = fullLayout._extraFormat; } - // occasionally we need _numFormat to pass through - // even though it won't be needed by this axis - ax._separators = fullLayout.separators; - ax._numFormat = locale ? locale.numberFormat : d3.format; - // and for bar charts and box plots: reset forced minimum tick spacing - delete ax._minDtick; - delete ax._forceTick0; + coerce('traceorder', defaultOrder); + if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); + + coerce('x', defaultX); + coerce('xanchor', defaultXAnchor); + coerce('y', defaultY); + coerce('yanchor', defaultYAnchor); + coerce('valign'); + Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../constants/numerical":673,"../../lib":696,"./axis_ids":747,"./constants":750,"d3":148,"fast-isnumeric":214}],764:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plot_api/plot_template":193,"../../plots/layout_attributes":234,"../../registry":243,"./attributes":92,"./helpers":98}],95:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; +var d3 = _dereq_('d3'); + var Lib = _dereq_('../../lib'); -var layoutAttributes = _dereq_('./layout_attributes'); -var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); +var Plots = _dereq_('../../plots/plots'); +var Registry = _dereq_('../../registry'); +var Events = _dereq_('../../lib/events'); +var dragElement = _dereq_('../dragelement'); +var Drawing = _dereq_('../drawing'); +var Color = _dereq_('../color'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var handleClick = _dereq_('./handle_click'); -module.exports = function handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options) { - var showAttrDflt = getShowAttrDflt(containerIn); +var constants = _dereq_('./constants'); +var interactConstants = _dereq_('../../constants/interactions'); +var alignmentConstants = _dereq_('../../constants/alignment'); +var LINE_SPACING = alignmentConstants.LINE_SPACING; +var FROM_TL = alignmentConstants.FROM_TL; +var FROM_BR = alignmentConstants.FROM_BR; - var tickPrefix = coerce('tickprefix'); - if(tickPrefix) coerce('showtickprefix', showAttrDflt); +var getLegendData = _dereq_('./get_legend_data'); +var style = _dereq_('./style'); +var helpers = _dereq_('./helpers'); - var tickSuffix = coerce('ticksuffix', options.tickSuffixDflt); - if(tickSuffix) coerce('showticksuffix', showAttrDflt); +var DBLCLICKDELAY = interactConstants.DBLCLICKDELAY; - var showTickLabels = coerce('showticklabels'); - if(showTickLabels) { - var font = options.font || {}; - var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? - contColor : font.color; - Lib.coerceFont(coerce, 'tickfont', { - family: font.family, - size: font.size, - color: dfltFontColor - }); - coerce('tickangle'); +module.exports = function draw(gd) { + var fullLayout = gd._fullLayout; + var clipId = 'legend' + fullLayout._uid; - if(axType !== 'category') { - var tickFormat = coerce('tickformat'); - var tickformatStops = containerIn.tickformatstops; - if(Array.isArray(tickformatStops) && tickformatStops.length) { - handleArrayContainerDefaults(containerIn, containerOut, { - name: 'tickformatstops', - inclusionAttr: 'enabled', - handleItemDefaults: tickformatstopDefaults - }); - } - if(!tickFormat && axType !== 'date') { - coerce('showexponent', showAttrDflt); - coerce('exponentformat'); - coerce('separatethousands'); - } - } - } -}; + if(!fullLayout._infolayer || !gd.calcdata) return; -/* - * Attributes 'showexponent', 'showtickprefix' and 'showticksuffix' - * share values. - * - * If only 1 attribute is set, - * the remaining attributes inherit that value. - * - * If 2 attributes are set to the same value, - * the remaining attribute inherits that value. - * - * If 2 attributes are set to different values, - * the remaining is set to its dflt value. - * - */ -function getShowAttrDflt(containerIn) { - var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], - showAttrs = showAttrsAll.filter(function(a) { - return containerIn[a] !== undefined; - }), - sameVal = function(a) { - return containerIn[a] === containerIn[showAttrs[0]]; - }; + if(!gd._legendMouseDownTime) gd._legendMouseDownTime = 0; - if(showAttrs.every(sameVal) || showAttrs.length === 1) { - return containerIn[showAttrs[0]]; - } -} + var opts = fullLayout.legend; + var legendData = fullLayout.showlegend && getLegendData(gd.calcdata, opts); + var hiddenSlices = fullLayout.hiddenlabels || []; -function tickformatstopDefaults(valueIn, valueOut) { - function coerce(attr, dflt) { - return Lib.coerce(valueIn, valueOut, layoutAttributes.tickformatstops, attr, dflt); + if(!fullLayout.showlegend || !legendData.length) { + fullLayout._infolayer.selectAll('.legend').remove(); + fullLayout._topdefs.select('#' + clipId).remove(); + + Plots.autoMargin(gd, 'legend'); + return; } - var enabled = coerce('enabled'); - if(enabled) { - coerce('dtickrange'); - coerce('value'); + var maxLength = 0; + for(var i = 0; i < legendData.length; i++) { + for(var j = 0; j < legendData[i].length; j++) { + var item = legendData[i][j][0]; + var trace = item.trace; + var isPie = Registry.traceIs(trace, 'pie'); + var name = isPie ? item.label : trace.name; + maxLength = Math.max(maxLength, name && name.length || 0); + } } -} -},{"../../lib":696,"../array_container_defaults":740,"./layout_attributes":757}],765:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var firstRender = false; + var legend = Lib.ensureSingle(fullLayout._infolayer, 'g', 'legend', function(s) { + s.attr('pointer-events', 'all'); + firstRender = true; + }); + var clipPath = Lib.ensureSingleById(fullLayout._topdefs, 'clipPath', clipId, function(s) { + s.append('rect'); + }); -'use strict'; + var bg = Lib.ensureSingle(legend, 'rect', 'bg', function(s) { + s.attr('shape-rendering', 'crispEdges'); + }); -var Lib = _dereq_('../../lib'); + bg.call(Color.stroke, opts.bordercolor) + .call(Color.fill, opts.bgcolor) + .style('stroke-width', opts.borderwidth + 'px'); -var layoutAttributes = _dereq_('./layout_attributes'); + var scrollBox = Lib.ensureSingle(legend, 'g', 'scrollbox'); + var scrollBar = Lib.ensureSingle(legend, 'rect', 'scrollbar', function(s) { + s.attr({ + rx: 20, + ry: 3, + width: 0, + height: 0 + }) + .call(Color.fill, '#808BA4'); + }); -/** - * options: inherits outerTicks from axes.handleAxisDefaults - */ -module.exports = function handleTickDefaults(containerIn, containerOut, coerce, options) { - var tickLen = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'ticklen'), - tickWidth = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickwidth'), - tickColor = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickcolor', containerOut.color), - showTicks = coerce('ticks', (options.outerTicks || tickLen || tickWidth || tickColor) ? 'outside' : ''); + var groups = scrollBox.selectAll('g.groups') + .data(legendData); - if(!showTicks) { - delete containerOut.ticklen; - delete containerOut.tickwidth; - delete containerOut.tickcolor; - } -}; + groups.enter().append('g') + .attr('class', 'groups'); -},{"../../lib":696,"./layout_attributes":757}],766:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + groups.exit().remove(); + var traces = groups.selectAll('g.traces') + .data(Lib.identity); -'use strict'; + traces.enter().append('g').attr('class', 'traces'); + traces.exit().remove(); -var cleanTicks = _dereq_('./clean_ticks'); + traces.style('opacity', function(d) { + var trace = d[0].trace; + if(Registry.traceIs(trace, 'pie')) { + 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, gd, maxLength) + .call(setupTraceToggle, gd); + }) + .call(style, gd); + + Lib.syncOrAsync([Plots.previousPromises, + function() { + if(firstRender) { + computeLegendDimensions(gd, groups, traces); + expandMargin(gd); + } + // Position and size the legend + var lxMin = 0; + var lxMax = fullLayout.width; + var lyMin = 0; + var lyMax = fullLayout.height; -module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { - var tickmode; + computeLegendDimensions(gd, groups, traces); - if(containerIn.tickmode === 'array' && - (axType === 'log' || axType === 'date')) { - tickmode = containerOut.tickmode = 'auto'; - } - else { - var tickmodeDefault = - Array.isArray(containerIn.tickvals) ? 'array' : - containerIn.dtick ? 'linear' : - 'auto'; - tickmode = coerce('tickmode', tickmodeDefault); - } + if(opts._height > lyMax) { + // If the legend doesn't fit in the plot area, + // do not expand the vertical margins. + expandHorizontalMargin(gd); + } else { + expandMargin(gd); + } - if(tickmode === 'auto') coerce('nticks'); - else if(tickmode === 'linear') { - // dtick is usually a positive number, but there are some - // special strings available for log or date axes - // tick0 also has special logic - var dtick = containerOut.dtick = cleanTicks.dtick( - containerIn.dtick, axType); - containerOut.tick0 = cleanTicks.tick0( - containerIn.tick0, axType, containerOut.calendar, dtick); - } - else { - var tickvals = coerce('tickvals'); - if(tickvals === undefined) containerOut.tickmode = 'auto'; - else coerce('ticktext'); - } -}; + // Scroll section must be executed after repositionLegend. + // It requires the legend width, height, x and y to position the scrollbox + // and these values are mutated in repositionLegend. + var gs = fullLayout._size; + var lx = gs.l + gs.w * opts.x; + var ly = gs.t + gs.h * (1 - opts.y); -},{"./clean_ticks":749}],767:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(Lib.isRightAnchor(opts)) { + lx -= opts._width; + } + else if(Lib.isCenterAnchor(opts)) { + lx -= opts._width / 2; + } -'use strict'; + if(Lib.isBottomAnchor(opts)) { + ly -= opts._height; + } + else if(Lib.isMiddleAnchor(opts)) { + ly -= opts._height / 2; + } -var d3 = _dereq_('d3'); + // Make sure the legend left and right sides are visible + var legendWidth = opts._width; + var legendWidthMax = gs.w; -var Registry = _dereq_('../../registry'); -var Drawing = _dereq_('../../components/drawing'); -var Axes = _dereq_('./axes'); -var axisRegex = _dereq_('./constants').attrRegex; + if(legendWidth > legendWidthMax) { + lx = gs.l; + legendWidth = legendWidthMax; + } + else { + if(lx + legendWidth > lxMax) lx = lxMax - legendWidth; + if(lx < lxMin) lx = lxMin; + legendWidth = Math.min(lxMax - lx, opts._width); + } -module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCompleteCallback) { - var fullLayout = gd._fullLayout; - var axes = []; + // Make sure the legend top and bottom are visible + // (legends with a scroll bar are not allowed to stretch beyond the extended + // margins) + var legendHeight = opts._height; + var legendHeightMax = gs.h; - function computeUpdates(layout) { - var ai, attrList, match, axis, update; - var updates = {}; - - for(ai in layout) { - attrList = ai.split('.'); - match = attrList[0].match(axisRegex); - if(match) { - var axisLetter = ai.charAt(0); - var axisName = attrList[0]; - axis = fullLayout[axisName]; - update = {}; + if(legendHeight > legendHeightMax) { + ly = gs.t; + legendHeight = legendHeightMax; + } + else { + if(ly + legendHeight > lyMax) ly = lyMax - legendHeight; + if(ly < lyMin) ly = lyMin; + legendHeight = Math.min(lyMax - ly, opts._height); + } - if(Array.isArray(layout[ai])) { - update.to = layout[ai].slice(0); - } else { - if(Array.isArray(layout[ai].range)) { - update.to = layout[ai].range.slice(0); - } - } - if(!update.to) continue; + // Set size and position of all the elements that make up a legend: + // legend, background and border, scroll box and scroll bar + Drawing.setTranslate(legend, lx, ly); + + // to be safe, remove previous listeners + scrollBar.on('.drag', null); + legend.on('wheel', null); + + if(opts._height <= legendHeight || gd._context.staticPlot) { + // if scrollbar should not be shown. + bg.attr({ + width: legendWidth - opts.borderwidth, + height: legendHeight - opts.borderwidth, + x: opts.borderwidth / 2, + y: opts.borderwidth / 2 + }); + + Drawing.setTranslate(scrollBox, 0, 0); - update.axisName = axisName; - update.length = axis._length; + clipPath.select('rect').attr({ + width: legendWidth - 2 * opts.borderwidth, + height: legendHeight - 2 * opts.borderwidth, + x: opts.borderwidth, + y: opts.borderwidth + }); - axes.push(axisLetter); + Drawing.setClipUrl(scrollBox, clipId, gd); - updates[axisLetter] = update; + Drawing.setRect(scrollBar, 0, 0, 0, 0); + delete opts._scrollY; } - } + else { + var scrollBarHeight = Math.max(constants.scrollBarMinHeight, + legendHeight * legendHeight / opts._height); + var scrollBarYMax = legendHeight - + scrollBarHeight - + 2 * constants.scrollBarMargin; + var scrollBoxYMax = opts._height - legendHeight; + var scrollRatio = scrollBarYMax / scrollBoxYMax; - return updates; - } + var scrollBoxY = Math.min(opts._scrollY || 0, scrollBoxYMax); - function computeAffectedSubplots(fullLayout, updatedAxisIds, updates) { - var plotName; - var plotinfos = fullLayout._plots; - var affectedSubplots = []; - var toX, toY; + // increase the background and clip-path width + // by the scrollbar width and margin + bg.attr({ + width: legendWidth - + 2 * opts.borderwidth + + constants.scrollBarWidth + + constants.scrollBarMargin, + height: legendHeight - opts.borderwidth, + x: opts.borderwidth / 2, + y: opts.borderwidth / 2 + }); - for(plotName in plotinfos) { - var plotinfo = plotinfos[plotName]; + clipPath.select('rect').attr({ + width: legendWidth - + 2 * opts.borderwidth + + constants.scrollBarWidth + + constants.scrollBarMargin, + height: legendHeight - 2 * opts.borderwidth, + x: opts.borderwidth, + y: opts.borderwidth + scrollBoxY + }); - if(affectedSubplots.indexOf(plotinfo) !== -1) continue; + Drawing.setClipUrl(scrollBox, clipId, gd); - var x = plotinfo.xaxis._id; - var y = plotinfo.yaxis._id; - var fromX = plotinfo.xaxis.range; - var fromY = plotinfo.yaxis.range; + scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); - // Store the initial range at the beginning of this transition: - plotinfo.xaxis._r = plotinfo.xaxis.range.slice(); - plotinfo.yaxis._r = plotinfo.yaxis.range.slice(); + legend.on('wheel', function() { + scrollBoxY = Lib.constrain( + opts._scrollY + + d3.event.deltaY / scrollBarYMax * scrollBoxYMax, + 0, scrollBoxYMax); + scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); + if(scrollBoxY !== 0 && scrollBoxY !== scrollBoxYMax) { + d3.event.preventDefault(); + } + }); - if(updates[x]) { - toX = updates[x].to; - } else { - toX = fromX; + var eventY0, scrollBoxY0; + + var drag = d3.behavior.drag() + .on('dragstart', function() { + eventY0 = d3.event.sourceEvent.clientY; + scrollBoxY0 = scrollBoxY; + }) + .on('drag', function() { + var e = d3.event.sourceEvent; + if(e.buttons === 2 || e.ctrlKey) return; + + scrollBoxY = Lib.constrain( + (e.clientY - eventY0) / scrollRatio + scrollBoxY0, + 0, scrollBoxYMax); + scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); + }); + + scrollBar.call(drag); } - if(updates[y]) { - toY = updates[y].to; - } else { - toY = fromY; + + + function scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio) { + opts._scrollY = gd._fullLayout.legend._scrollY = scrollBoxY; + Drawing.setTranslate(scrollBox, 0, -scrollBoxY); + + Drawing.setRect( + scrollBar, + legendWidth, + constants.scrollBarMargin + scrollBoxY * scrollRatio, + constants.scrollBarWidth, + scrollBarHeight + ); + clipPath.select('rect').attr({ + y: opts.borderwidth + scrollBoxY + }); } - if(fromX[0] === toX[0] && fromX[1] === toX[1] && fromY[0] === toY[0] && fromY[1] === toY[1]) continue; + if(gd._context.edits.legendPosition) { + var xf, yf, x0, y0; + + legend.classed('cursor-move', true); + + dragElement.init({ + element: legend.node(), + gd: gd, + prepFn: function() { + var transform = Drawing.getTranslate(legend); + + x0 = transform.x; + y0 = transform.y; + }, + moveFn: function(dx, dy) { + var newX = x0 + dx; + var newY = y0 + dy; + + Drawing.setTranslate(legend, newX, newY); - if(updatedAxisIds.indexOf(x) !== -1 || updatedAxisIds.indexOf(y) !== -1) { - affectedSubplots.push(plotinfo); + xf = dragElement.align(newX, 0, gs.l, gs.l + gs.w, opts.xanchor); + yf = dragElement.align(newY, 0, gs.t + gs.h, gs.t, opts.yanchor); + }, + doneFn: function() { + if(xf !== undefined && yf !== undefined) { + Registry.call('_guiRelayout', gd, {'legend.x': xf, 'legend.y': yf}); + } + }, + clickFn: function(numClicks, e) { + var clickedTrace = fullLayout._infolayer.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(gd, legend, clickedTrace, numClicks, e); + } + } + }); } - } + }], gd); +}; - return affectedSubplots; - } +function clickOrDoubleClick(gd, legend, legendItem, numClicks, evt) { + var trace = legendItem.data()[0][0].trace; - var updates = computeUpdates(newLayout); - var updatedAxisIds = Object.keys(updates); - var affectedSubplots = computeAffectedSubplots(fullLayout, updatedAxisIds, updates); + var evtData = { + event: evt, + node: legendItem.node(), + curveNumber: trace.index, + expandedIndex: trace._expandedIndex, + data: gd.data, + layout: gd.layout, + frames: gd._transitionData._frames, + config: gd._context, + fullData: gd._fullData, + fullLayout: gd._fullLayout + }; - function updateLayoutObjs() { - function redrawObjs(objArray, method, shortCircuit) { - for(var i = 0; i < objArray.length; i++) { - method(gd, i); + if(trace._group) { + evtData.group = trace._group; + } + if(trace.type === 'pie') { + evtData.label = legendItem.datum()[0].label; + } - // once is enough for images (which doesn't use the `i` arg anyway) - if(shortCircuit) return; - } - } + var clickVal = Events.triggerHandler(gd, 'plotly_legendclick', evtData); + if(clickVal === false) return; - redrawObjs(fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); - redrawObjs(fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); - redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); + if(numClicks === 1) { + legend._clickTimeout = setTimeout(function() { + handleClick(legendItem, gd, numClicks); + }, DBLCLICKDELAY); } + else if(numClicks === 2) { + if(legend._clickTimeout) clearTimeout(legend._clickTimeout); + gd._legendMouseDownTime = 0; - if(!affectedSubplots.length) { - updateLayoutObjs(); - return false; + var dblClickVal = Events.triggerHandler(gd, 'plotly_legenddoubleclick', evtData); + if(dblClickVal !== false) handleClick(legendItem, gd, numClicks); } +} - function ticksAndAnnotations(xa, ya) { - var activeAxIds = [], - i; +function drawTexts(g, gd, maxLength) { + var legendItem = g.data()[0][0]; + var fullLayout = gd._fullLayout; + var trace = legendItem.trace; + var isPie = Registry.traceIs(trace, 'pie'); + var traceIndex = trace.index; + var name = isPie ? legendItem.label : trace.name; + var isEditable = gd._context.edits.legendText && !isPie; - activeAxIds = [xa._id, ya._id]; + var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); - for(i = 0; i < activeAxIds.length; i++) { - Axes.doTicksSingle(gd, activeAxIds[i], true); - } + textEl.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(isEditable ? ensureLength(name, maxLength) : name); - function redrawObjs(objArray, method, shortCircuit) { - for(i = 0; i < objArray.length; i++) { - var obji = objArray[i]; + svgTextUtils.positionText(textEl, constants.textOffsetX, 0); - if((activeAxIds.indexOf(obji.xref) !== -1) || - (activeAxIds.indexOf(obji.yref) !== -1)) { - method(gd, i); - } + function textLayout(s) { + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); + }); + } - // once is enough for images (which doesn't use the `i` arg anyway) - if(shortCircuit) return; - } - } + if(isEditable) { + textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) + .call(textLayout) + .on('edit', function(newName) { + this.text(ensureLength(newName, maxLength)) + .call(textLayout); - redrawObjs(fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); - redrawObjs(fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); - redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); - } + var fullInput = legendItem.trace._fullInput || {}; + var update = {}; - function unsetSubplotTransform(subplot) { - var xa2 = subplot.xaxis; - var ya2 = subplot.yaxis; + if(Registry.hasTransform(fullInput, 'groupby')) { + var groupbyIndices = Registry.getTransformIndices(fullInput, 'groupby'); + var index = groupbyIndices[groupbyIndices.length - 1]; - fullLayout._defs.select('#' + subplot.clipId + '> rect') - .call(Drawing.setTranslate, 0, 0) - .call(Drawing.setScale, 1, 1); + var kcont = Lib.keyedContainer(fullInput, 'transforms[' + index + '].styles', 'target', 'value.name'); - subplot.plot - .call(Drawing.setTranslate, xa2._offset, ya2._offset) - .call(Drawing.setScale, 1, 1); + kcont.set(legendItem.trace._group, newName); - var traceGroups = subplot.plot.selectAll('.scatterlayer .trace'); + update = kcont.constructUpdate(); + } else { + update.name = newName; + } - // This is specifically directed at scatter traces, applying an inverse - // scale to individual points to counteract the scale of the trace - // as a whole: - traceGroups.selectAll('.point') - .call(Drawing.setPointGroupScale, 1, 1); - traceGroups.selectAll('.textpoint') - .call(Drawing.setTextPointsScale, 1, 1); - traceGroups - .call(Drawing.hideOutsideRangePoints, subplot); + return Registry.call('_guiRestyle', gd, update, traceIndex); + }); + } else { + textLayout(textEl); } +} - function updateSubplot(subplot, progress) { - var axis, r0, r1; - var xUpdate = updates[subplot.xaxis._id]; - var yUpdate = updates[subplot.yaxis._id]; - - var viewBox = []; +/* + * Make sure we have a reasonably clickable region. + * If this string is missing or very short, pad it with spaces out to at least + * 4 characters, up to the max length of other labels, on the assumption that + * most characters are wider than spaces so a string of spaces will usually be + * no wider than the real labels. + */ +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; +} - if(xUpdate) { - axis = gd._fullLayout[xUpdate.axisName]; - r0 = axis._r; - r1 = xUpdate.to; - viewBox[0] = (r0[0] * (1 - progress) + progress * r1[0] - r0[0]) / (r0[1] - r0[0]) * subplot.xaxis._length; - var dx1 = r0[1] - r0[0]; - var dx2 = r1[1] - r1[0]; +function setupTraceToggle(g, gd) { + var newMouseDownTime; + var numClicks = 1; - axis.range[0] = r0[0] * (1 - progress) + progress * r1[0]; - axis.range[1] = r0[1] * (1 - progress) + progress * r1[1]; + var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { + s.style('cursor', 'pointer') + .attr('pointer-events', 'all') + .call(Color.fill, 'rgba(0,0,0,0)'); + }); - viewBox[2] = subplot.xaxis._length * ((1 - progress) + progress * dx2 / dx1); - } else { - viewBox[0] = 0; - viewBox[2] = subplot.xaxis._length; + traceToggle.on('mousedown', function() { + newMouseDownTime = (new Date()).getTime(); + if(newMouseDownTime - gd._legendMouseDownTime < DBLCLICKDELAY) { + // in a click train + numClicks += 1; } - - if(yUpdate) { - axis = gd._fullLayout[yUpdate.axisName]; - r0 = axis._r; - r1 = yUpdate.to; - viewBox[1] = (r0[1] * (1 - progress) + progress * r1[1] - r0[1]) / (r0[0] - r0[1]) * subplot.yaxis._length; - var dy1 = r0[1] - r0[0]; - var dy2 = r1[1] - r1[0]; - - axis.range[0] = r0[0] * (1 - progress) + progress * r1[0]; - axis.range[1] = r0[1] * (1 - progress) + progress * r1[1]; - - viewBox[3] = subplot.yaxis._length * ((1 - progress) + progress * dy2 / dy1); - } else { - viewBox[1] = 0; - viewBox[3] = subplot.yaxis._length; + else { + // new click train + numClicks = 1; + gd._legendMouseDownTime = newMouseDownTime; } + }); + traceToggle.on('mouseup', function() { + if(gd._dragged || gd._editing) return; + var legend = gd._fullLayout.legend; - ticksAndAnnotations(subplot.xaxis, subplot.yaxis); - - var xa2 = subplot.xaxis; - var ya2 = subplot.yaxis; + if((new Date()).getTime() - gd._legendMouseDownTime > DBLCLICKDELAY) { + numClicks = Math.max(numClicks - 1, 1); + } - var editX = !!xUpdate; - var editY = !!yUpdate; + clickOrDoubleClick(gd, legend, g, numClicks, d3.event); + }); +} - var xScaleFactor = editX ? xa2._length / viewBox[2] : 1, - yScaleFactor = editY ? ya2._length / viewBox[3] : 1; +function computeTextDimensions(g, gd) { + var legendItem = g.data()[0][0]; - var clipDx = editX ? viewBox[0] : 0, - clipDy = editY ? viewBox[1] : 0; + if(!legendItem.trace.showlegend) { + g.remove(); + return; + } - var fracDx = editX ? (viewBox[0] / viewBox[2] * xa2._length) : 0, - fracDy = editY ? (viewBox[1] / viewBox[3] * ya2._length) : 0; + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; - var plotDx = xa2._offset - fracDx, - plotDy = ya2._offset - fracDy; + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); - subplot.clipRect - .call(Drawing.setTranslate, clipDx, clipDy) - .call(Drawing.setScale, 1 / xScaleFactor, 1 / yScaleFactor); + height = mathjaxBB.height; + width = mathjaxBB.width; - subplot.plot - .call(Drawing.setTranslate, plotDx, plotDy) - .call(Drawing.setScale, xScaleFactor, yScaleFactor); + Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); + } else { + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); - // apply an inverse scale to individual points to counteract - // the scale of the trace group. - Drawing.setPointGroupScale(subplot.zoomScalePts, 1 / xScaleFactor, 1 / yScaleFactor); - Drawing.setTextPointsScale(subplot.zoomScaleTxt, 1 / xScaleFactor, 1 / yScaleFactor); - } + height = lineHeight * textLines; + width = textNode ? Drawing.bBox(textNode).width : 0; - var onComplete; - if(makeOnCompleteCallback) { - // This module makes the choice whether or not it notifies Plotly.transition - // about completion: - onComplete = makeOnCompleteCallback(); + // approximation to height offset to center the font + // to avoid getBoundingClientRect + var textY = lineHeight * (0.3 + (1 - textLines) / 2); + svgTextUtils.positionText(text, constants.textOffsetX, textY); } - function transitionComplete() { - var aobj = {}; - for(var i = 0; i < updatedAxisIds.length; i++) { - var axi = gd._fullLayout[updates[updatedAxisIds[i]].axisName]; - var to = updates[updatedAxisIds[i]].to; - aobj[axi._name + '.range[0]'] = to[0]; - aobj[axi._name + '.range[1]'] = to[1]; - - axi.range = to.slice(); - } + legendItem.lineHeight = lineHeight; + legendItem.height = Math.max(height, 16) + 3; + legendItem.width = width; +} - // Signal that this transition has completed: - onComplete && onComplete(); +function computeLegendDimensions(gd, groups, traces) { + var fullLayout = gd._fullLayout; + var opts = fullLayout.legend; + var borderwidth = opts.borderwidth; + var isGrouped = helpers.isGrouped(opts); - return Registry.call('relayout', gd, aobj).then(function() { - for(var i = 0; i < affectedSubplots.length; i++) { - unsetSubplotTransform(affectedSubplots[i]); - } - }); - } + var extraWidth = 0; - function transitionInterrupt() { - var aobj = {}; - for(var i = 0; i < updatedAxisIds.length; i++) { - var axi = gd._fullLayout[updatedAxisIds[i] + 'axis']; - aobj[axi._name + '.range[0]'] = axi.range[0]; - aobj[axi._name + '.range[1]'] = axi.range[1]; + opts._width = 0; + opts._height = 0; - axi.range = axi._r.slice(); + if(helpers.isVertical(opts)) { + if(isGrouped) { + groups.each(function(d, i) { + Drawing.setTranslate(this, 0, i * opts.tracegroupgap); + }); } - return Registry.call('relayout', gd, aobj).then(function() { - for(var i = 0; i < affectedSubplots.length; i++) { - unsetSubplotTransform(affectedSubplots[i]); - } - }); - } - - var t1, t2, raf; - var easeFn = d3.ease(transitionOpts.easing); + traces.each(function(d) { + var legendItem = d[0]; + var textHeight = legendItem.height; + var textWidth = legendItem.width; - gd._transitionData._interruptCallbacks.push(function() { - window.cancelAnimationFrame(raf); - raf = null; - return transitionInterrupt(); - }); + Drawing.setTranslate(this, + borderwidth, + (5 + borderwidth + opts._height + textHeight / 2)); - function doFrame() { - t2 = Date.now(); + opts._height += textHeight; + opts._width = Math.max(opts._width, textWidth); + }); - var tInterp = Math.min(1, (t2 - t1) / transitionOpts.duration); - var progress = easeFn(tInterp); + opts._width += 45 + borderwidth * 2; + opts._height += 10 + borderwidth * 2; - for(var i = 0; i < affectedSubplots.length; i++) { - updateSubplot(affectedSubplots[i], progress); + if(isGrouped) { + opts._height += (opts._lgroupsLength - 1) * opts.tracegroupgap; } - if(t2 - t1 > transitionOpts.duration) { - transitionComplete(); - raf = window.cancelAnimationFrame(doFrame); - } else { - raf = window.requestAnimationFrame(doFrame); - } + extraWidth = 40; } + else if(isGrouped) { + var groupXOffsets = [opts._width]; + var groupData = groups.data(); - t1 = Date.now(); - raf = window.requestAnimationFrame(doFrame); - - return Promise.resolve(); -}; - -},{"../../components/drawing":595,"../../registry":827,"./axes":744,"./constants":750,"d3":148}],768:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Registry = _dereq_('../../registry'); -var autoType = _dereq_('./axis_autotype'); + for(var i = 0, n = groupData.length; i < n; i++) { + var textWidths = groupData[i].map(function(legendItemArray) { + return legendItemArray[0].width; + }); -/* - * data: the plot data to use in choosing auto type - * name: axis object name (ie 'xaxis') if one should be stored - */ -module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { - var axType = coerce('type', (options.splomStash || {}).type); + var groupWidth = 40 + Math.max.apply(null, textWidths); - if(axType === '-') { - setAutoType(containerOut, options.data); + opts._width += opts.tracegroupgap + groupWidth; - if(containerOut.type === '-') { - containerOut.type = 'linear'; - } else { - // copy autoType back to input axis - // note that if this object didn't exist - // in the input layout, we have to put it in - // this happens in the main supplyDefaults function - containerIn.type = containerOut.type; + groupXOffsets.push(opts._width); } - } -}; - -function setAutoType(ax, data) { - // new logic: let people specify any type they want, - // only autotype if type is '-' - if(ax.type !== '-') return; - - var id = ax._id; - var axLetter = id.charAt(0); - - // support 3d - if(id.indexOf('scene') !== -1) id = axLetter; - - var d0 = getFirstNonEmptyTrace(data, id, axLetter); - if(!d0) return; - // first check for histograms, as the count direction - // should always default to a linear axis - if(d0.type === 'histogram' && - axLetter === {v: 'y', h: 'x'}[d0.orientation || 'v']) { - ax.type = 'linear'; - return; - } + groups.each(function(d, i) { + Drawing.setTranslate(this, groupXOffsets[i], 0); + }); - var calAttr = axLetter + 'calendar'; - var calendar = d0[calAttr]; - var i; + groups.each(function() { + var group = d3.select(this); + var groupTraces = group.selectAll('g.traces'); + var groupHeight = 0; - // check all boxes on this x axis to see - // if they're dates, numbers, or categories - if(isBoxWithoutPositionCoords(d0, axLetter)) { - var posLetter = getBoxPosLetter(d0); - var boxPositions = []; + groupTraces.each(function(d) { + var legendItem = d[0]; + var textHeight = legendItem.height; - for(i = 0; i < data.length; i++) { - var trace = data[i]; - if(!Registry.traceIs(trace, 'box-violin') || - (trace[axLetter + 'axis'] || axLetter) !== id) continue; + Drawing.setTranslate(this, + 0, + (5 + borderwidth + groupHeight + textHeight / 2)); - if(trace[posLetter] !== undefined) boxPositions.push(trace[posLetter][0]); - else if(trace.name !== undefined) boxPositions.push(trace.name); - else boxPositions.push('text'); + groupHeight += textHeight; + }); - if(trace[calAttr] !== calendar) calendar = undefined; - } + opts._height = Math.max(opts._height, groupHeight); + }); - ax.type = autoType(boxPositions, calendar); - } - else if(d0.type === 'splom') { - var dimensions = d0.dimensions; - var diag = d0._diag; - for(i = 0; i < dimensions.length; i++) { - var dim = dimensions[i]; - if(dim.visible && (diag[i][0] === id || diag[i][1] === id)) { - ax.type = autoType(dim.values, calendar); - break; - } - } + opts._height += 10 + borderwidth * 2; + opts._width += borderwidth * 2; } else { - ax.type = autoType(d0[axLetter] || [d0[axLetter + '0']], calendar); - } -} - -function getFirstNonEmptyTrace(data, id, axLetter) { - for(var i = 0; i < data.length; i++) { - var trace = data[i]; - - if(trace.type === 'splom' && - trace._length > 0 && - (trace['_' + axLetter + 'axes'] || {})[id] - ) { - return trace; - } - - if((trace[axLetter + 'axis'] || axLetter) === id) { - 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), - isBox = Registry.traceIs(trace, 'box-violin'), - isCandlestick = Registry.traceIs(trace._fullInput || {}, 'candlestick'); - - return ( - isBox && - !isCandlestick && - axLetter === posLetter && - trace[posLetter] === undefined && - trace[posLetter + '0'] === undefined - ); -} - -},{"../../registry":827,"./axis_autotype":745}],769:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var rowHeight = 0; + var maxTraceHeight = 0; + var maxTraceWidth = 0; + var offsetX = 0; + var fullTracesWidth = 0; + var traceGap = opts.tracegroupgap || 5; -'use strict'; + // calculate largest width for traces and use for width of all legend items + traces.each(function(d) { + maxTraceWidth = Math.max(40 + d[0].width, maxTraceWidth); + fullTracesWidth += 40 + d[0].width + traceGap; + }); -var Registry = _dereq_('../registry'); -var Lib = _dereq_('../lib'); + // check if legend fits in one row + var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap; -/* - * Create or update an observer. This function is designed to be - * idempotent so that it can be called over and over as the component - * updates, and will attach and detach listeners as needed. - * - * @param {optional object} container - * An object on which the observer is stored. This is the mechanism - * by which it is idempotent. If it already exists, another won't be - * added. Each time it's called, the value lookup table is updated. - * @param {array} commandList - * An array of commands, following either `buttons` of `updatemenus` - * or `steps` of `sliders`. - * @param {function} onchange - * A listener called when the value is changed. Receives data object - * with information about the new state. - */ -exports.manageCommandObserver = function(gd, container, commandList, onchange) { - var ret = {}; - var enabled = true; + traces.each(function(d) { + var legendItem = d[0]; + var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth; - if(container && container._commandObserver) { - ret = container._commandObserver; - } + if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) { + offsetX = 0; + rowHeight += maxTraceHeight; + opts._height += maxTraceHeight; + // reset for next row + maxTraceHeight = 0; + } - if(!ret.cache) { - ret.cache = {}; - } + Drawing.setTranslate(this, + (borderwidth + offsetX), + (5 + borderwidth + legendItem.height / 2) + rowHeight); - // Either create or just recompute this: - ret.lookupTable = {}; + opts._width += traceGap + traceWidth; - var binding = exports.hasSimpleAPICommandBindings(gd, commandList, ret.lookupTable); + // keep track of tallest trace in group + offsetX += traceGap + traceWidth; + maxTraceHeight = Math.max(legendItem.height, maxTraceHeight); + }); - if(container && container._commandObserver) { - if(!binding) { - // If container exists and there are no longer any bindings, - // remove existing: - if(container._commandObserver.remove) { - container._commandObserver.remove(); - container._commandObserver = null; - return ret; - } + if(oneRowLegend) { + opts._height = maxTraceHeight; } else { - // If container exists and there *are* bindings, then the lookup - // table should have been updated and check is already attached, - // so there's nothing to be done: - return ret; - - + opts._height += maxTraceHeight; } - } - - // Determine whether there's anything to do for this binding: - - if(binding) { - // Build the cache: - bindingValueHasChanged(gd, binding, ret.cache); - - ret.check = function check() { - if(!enabled) return; - var update = bindingValueHasChanged(gd, binding, ret.cache); + opts._width += borderwidth * 2; + opts._height += 10 + borderwidth * 2; + } - if(update.changed && onchange) { - // Disable checks for the duration of this command in order to avoid - // infinite loops: - if(ret.lookupTable[update.value] !== undefined) { - 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); - } - } + // make sure we're only getting full pixels + opts._width = Math.ceil(opts._width); + opts._height = Math.ceil(opts._height); - return update.changed; - }; + var isEditable = ( + gd._context.edits.legendText || + gd._context.edits.legendPosition + ); - var checkEvents = [ - 'plotly_relayout', - 'plotly_redraw', - 'plotly_restyle', - 'plotly_update', - 'plotly_animatingframe', - 'plotly_afterplot' - ]; + traces.each(function(d) { + var legendItem = d[0]; + var bg = d3.select(this).select('.legendtoggle'); - for(var i = 0; i < checkEvents.length; i++) { - gd._internalOn(checkEvents[i], ret.check); - } + Drawing.setRect(bg, + 0, + -legendItem.height / 2, + (isEditable ? 0 : opts._width) + extraWidth, + legendItem.height + ); + }); +} - ret.remove = function() { - for(var i = 0; i < checkEvents.length; i++) { - gd._removeInternalListener(checkEvents[i], ret.check); - } - }; - } else { - // TODO: It'd be really neat to actually give a *reason* for this, but at least a warning - // is a start - Lib.log('Unable to automatically bind plot updates to API command'); +function expandMargin(gd) { + var fullLayout = gd._fullLayout; + var opts = fullLayout.legend; - ret.lookupTable = {}; - ret.remove = function() {}; + var xanchor = 'left'; + if(Lib.isRightAnchor(opts)) { + xanchor = 'right'; + } + else if(Lib.isCenterAnchor(opts)) { + xanchor = 'center'; } - ret.disable = function disable() { - enabled = false; - }; + var yanchor = 'top'; + if(Lib.isBottomAnchor(opts)) { + yanchor = 'bottom'; + } + else if(Lib.isMiddleAnchor(opts)) { + yanchor = 'middle'; + } - ret.enable = function enable() { - enabled = true; - }; + // lastly check if the margin auto-expand has changed + Plots.autoMargin(gd, 'legend', { + x: opts.x, + y: opts.y, + l: opts._width * (FROM_TL[xanchor]), + r: opts._width * (FROM_BR[xanchor]), + b: opts._height * (FROM_BR[yanchor]), + t: opts._height * (FROM_TL[yanchor]) + }); +} - if(container) { - container._commandObserver = ret; +function expandHorizontalMargin(gd) { + var fullLayout = gd._fullLayout; + var opts = fullLayout.legend; + + var xanchor = 'left'; + if(Lib.isRightAnchor(opts)) { + xanchor = 'right'; + } + else if(Lib.isCenterAnchor(opts)) { + xanchor = 'center'; } - return ret; -}; + // lastly check if the margin auto-expand has changed + Plots.autoMargin(gd, 'legend', { + x: opts.x, + y: 0.5, + l: opts._width * (FROM_TL[xanchor]), + r: opts._width * (FROM_BR[xanchor]), + b: 0, + t: 0 + }); +} -/* - * This function checks to see if an array of objects containing - * method and args properties is compatible with automatic two-way - * binding. The criteria right now are that - * - * 1. multiple traces may be affected - * 2. only one property may be affected - * 3. the same property must be affected by all commands - */ -exports.hasSimpleAPICommandBindings = function(gd, commandList, bindingsByValue) { - var i; - var n = commandList.length; +},{"../../constants/alignment":138,"../../constants/interactions":139,"../../lib":159,"../../lib/events":152,"../../lib/svg_text_utils":180,"../../plots/plots":236,"../../registry":243,"../color":43,"../dragelement":61,"../drawing":64,"./constants":93,"./get_legend_data":96,"./handle_click":97,"./helpers":98,"./style":100,"d3":8}],96:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var refBinding; - for(i = 0; i < n; i++) { - var binding; - var command = commandList[i]; - var method = command.method; - var args = command.args; +'use strict'; - if(!Array.isArray(args)) args = []; +var Registry = _dereq_('../../registry'); +var helpers = _dereq_('./helpers'); - // If any command has no method, refuse to bind: - if(!method) { - return false; - } - var bindings = exports.computeAPICommandBindings(gd, method, args); - // Right now, handle one and *only* one property being set: - if(bindings.length !== 1) { - return false; - } +module.exports = function getLegendData(calcdata, opts) { + var lgroupToTraces = {}; + var lgroups = []; + var hasOneNonBlankGroup = false; + var slicesShown = {}; + var lgroupi = 0; + var i, j; - 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; - } - } - } + function addOneItem(legendGroup, legendItem) { + // each '' legend group is treated as a separate group + if(legendGroup === '' || !helpers.isGrouped(opts)) { + var uniqueGroup = '~~i' + lgroupi; // TODO: check this against fullData legendgroups? - binding = bindings[0]; - var value = binding.value; - if(Array.isArray(value)) { - if(value.length === 1) { - value = value[0]; - } else { - return false; - } + lgroups.push(uniqueGroup); + lgroupToTraces[uniqueGroup] = [[legendItem]]; + lgroupi++; } - if(bindingsByValue) { - bindingsByValue[value] = i; + else if(lgroups.indexOf(legendGroup) === -1) { + lgroups.push(legendGroup); + hasOneNonBlankGroup = true; + lgroupToTraces[legendGroup] = [[legendItem]]; } + else lgroupToTraces[legendGroup].push([legendItem]); } - return refBinding; -}; + // build an { legendgroup: [cd0, cd0], ... } object + for(i = 0; i < calcdata.length; i++) { + var cd = calcdata[i]; + var cd0 = cd[0]; + var trace = cd0.trace; + var lgroup = trace.legendgroup; -function bindingValueHasChanged(gd, binding, cache) { - var container, value, obj; - var changed = false; + if(!trace.visible || !trace.showlegend) continue; - if(binding.type === 'data') { - // If it's data, we need to get a trace. Based on the limited scope - // of what we cover, we can just take the first trace from the list, - // or otherwise just the first trace: - container = gd._fullData[binding.traces !== null ? binding.traces[0] : 0]; - } else if(binding.type === 'layout') { - container = gd._fullLayout; - } else { - return false; - } + if(Registry.traceIs(trace, 'pie')) { + if(!slicesShown[lgroup]) slicesShown[lgroup] = {}; - value = Lib.nestedProperty(container, binding.prop).get(); + for(j = 0; j < cd.length; j++) { + var labelj = cd[j].label; - obj = cache[binding.type] = cache[binding.type] || {}; + if(!slicesShown[lgroup][labelj]) { + addOneItem(lgroup, { + label: labelj, + color: cd[j].color, + i: cd[j].i, + trace: trace, + pts: cd[j].pts + }); - if(obj.hasOwnProperty(binding.prop)) { - if(obj[binding.prop] !== value) { - changed = true; + slicesShown[lgroup][labelj] = true; + } + } } + + else addOneItem(lgroup, cd0); } - obj[binding.prop] = value; + // won't draw a legend in this case + if(!lgroups.length) return []; - return { - changed: changed, - value: value - }; -} + // rearrange lgroupToTraces into a d3-friendly array of arrays + var lgroupsLength = lgroups.length; + var ltraces; + var legendData; -/* - * Execute an API command. There's really not much to this; it just provides - * a common hook so that implementations don't need to be synchronized across - * multiple components with the ability to invoke API commands. - * - * @param {string} method - * The name of the plotly command to execute. Must be one of 'animate', - * 'restyle', 'relayout', 'update'. - * @param {array} args - * A list of arguments passed to the API command - */ -exports.executeAPICommand = function(gd, method, args) { - if(method === 'skip') return Promise.resolve(); + if(hasOneNonBlankGroup && helpers.isGrouped(opts)) { + legendData = new Array(lgroupsLength); - var _method = Registry.apiMethodRegistry[method]; - var allArgs = [gd]; - if(!Array.isArray(args)) args = []; + for(i = 0; i < lgroupsLength; i++) { + ltraces = lgroupToTraces[lgroups[i]]; + legendData[i] = helpers.isReversed(opts) ? ltraces.reverse() : ltraces; + } + } + else { + // collapse all groups into one if all groups are blank + legendData = [new Array(lgroupsLength)]; - for(var i = 0; i < args.length; i++) { - allArgs.push(args[i]); + for(i = 0; i < lgroupsLength; i++) { + ltraces = lgroupToTraces[lgroups[i]][0]; + legendData[0][helpers.isReversed(opts) ? lgroupsLength - i - 1 : i] = ltraces; + } + lgroupsLength = 1; } - return _method.apply(null, allArgs).catch(function(err) { - Lib.warn('API call to Plotly.' + method + ' rejected.', err); - return Promise.reject(err); - }); + // needed in repositionLegend + opts._lgroupsLength = lgroupsLength; + return legendData; }; -exports.computeAPICommandBindings = function(gd, method, args) { - var bindings; - - if(!Array.isArray(args)) args = []; +},{"../../registry":243,"./helpers":98}],97:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - switch(method) { - case 'restyle': - bindings = computeDataBindings(gd, args); - break; - case 'relayout': - bindings = computeLayoutBindings(gd, args); - break; - case 'update': - bindings = computeDataBindings(gd, [args[0], args[2]]) - .concat(computeLayoutBindings(gd, [args[1]])); - break; - case 'animate': - bindings = computeAnimateBindings(gd, args); - break; - default: - // This is the case where intelligent logic about what affects - // this command is not implemented. It causes no ill effects. - // For example, addFrames simply won't bind to a control component. - bindings = []; - } - return bindings; -}; +'use strict'; -function computeAnimateBindings(gd, args) { - // We'll assume that the only relevant modification an animation - // makes that's meaningfully tracked is the frame: - 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 []; - } -} +var Lib = _dereq_('../../lib'); +var Registry = _dereq_('../../registry'); -function computeLayoutBindings(gd, args) { - var bindings = []; +var SHOWISOLATETIP = true; - var astr = args[0]; - var aobj = {}; - if(typeof astr === 'string') { - aobj[astr] = args[1]; - } else if(Lib.isPlainObject(astr)) { - aobj = astr; - } else { - return bindings; - } +module.exports = function handleClick(g, gd, numClicks) { + if(gd._dragged || gd._editing) return; - crawl(aobj, function(path, attrName, attr) { - bindings.push({type: 'layout', prop: path, value: attr}); - }, '', 0); + var hiddenSlices = gd._fullLayout.hiddenlabels ? + gd._fullLayout.hiddenlabels.slice() : + []; - return bindings; -} + var legendItem = g.data()[0][0]; + var fullData = gd._fullData; + var fullTrace = legendItem.trace; + var legendgroup = fullTrace.legendgroup; -function computeDataBindings(gd, args) { - var traces, astr, val, aobj; - var bindings = []; + var i, j, kcont, key, keys, val; + var attrUpdate = {}; + var attrIndices = []; + var carrs = []; + var carrIdx = []; - // Logic copied from Plotly.restyle: - astr = args[0]; - val = args[1]; - traces = args[2]; - aobj = {}; - if(typeof astr === 'string') { - aobj[astr] = val; - } else if(Lib.isPlainObject(astr)) { - // the 3-arg form - aobj = astr; + function insertUpdate(traceIndex, key, value) { + var attrIndex = attrIndices.indexOf(traceIndex); + var valueArray = attrUpdate[key]; + if(!valueArray) { + valueArray = attrUpdate[key] = []; + } - if(traces === undefined) { - traces = val; + if(attrIndices.indexOf(traceIndex) === -1) { + attrIndices.push(traceIndex); + attrIndex = attrIndices.length - 1; } - } else { - return bindings; - } - if(traces === undefined) { - // Explicitly assign this to null instead of undefined: - traces = null; + valueArray[attrIndex] = value; + + return attrIndex; } - crawl(aobj, function(path, attrName, attr) { - var thisTraces; - if(Array.isArray(attr)) { - var nAttr = Math.min(attr.length, gd.data.length); - if(traces) { - nAttr = Math.min(nAttr, traces.length); - } - thisTraces = []; - for(var j = 0; j < nAttr; j++) { - thisTraces[j] = traces ? traces[j] : j; + function setVisibility(fullTrace, visibility) { + var fullInput = fullTrace._fullInput; + if(Registry.hasTransform(fullInput, 'groupby')) { + var kcont = carrs[fullInput.index]; + if(!kcont) { + var groupbyIndices = Registry.getTransformIndices(fullInput, 'groupby'); + var lastGroupbyIndex = groupbyIndices[groupbyIndices.length - 1]; + kcont = Lib.keyedContainer(fullInput, 'transforms[' + lastGroupbyIndex + '].styles', 'target', 'value.visible'); + carrs[fullInput.index] = kcont; } - } else { - thisTraces = traces ? traces.slice(0) : null; - } - // Convert [7] to just 7 when traces is 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); - } + var curState = kcont.get(fullTrace._group); - bindings.push({ - type: 'data', - prop: path, - traces: thisTraces, - value: attr - }); - }, '', 0); + // If not specified, assume visible. This happens if there are other style + // properties set for a group but not the visibility. There are many similar + // ways to do this (e.g. why not just `curState = fullTrace.visible`??? The + // answer is: because it breaks other things like groupby trace names in + // subtle ways.) + if(curState === undefined) { + curState = true; + } - return bindings; -} + if(curState !== false) { + // true -> legendonly. All others toggle to true: + kcont.set(fullTrace._group, visibility); + } + carrIdx[fullInput.index] = insertUpdate(fullInput.index, 'visible', fullInput.visible === false ? false : true); + } else { + // false -> false (not possible since will not be visible in legend) + // true -> legendonly + // legendonly -> true + var nextVisibility = fullInput.visible === false ? false : visibility; -function crawl(attrs, callback, path, depth) { - Object.keys(attrs).forEach(function(attrName) { - var attr = attrs[attrName]; + insertUpdate(fullInput.index, 'visible', nextVisibility); + } + } - if(attrName[0] === '_') return; + if(numClicks === 1 && SHOWISOLATETIP && gd.data && gd._context.showTips) { + Lib.notifier(Lib._(gd, 'Double-click on legend to isolate one trace'), 'long'); + SHOWISOLATETIP = false; + } else { + SHOWISOLATETIP = false; + } - var thisPath = path + (depth > 0 ? '.' : '') + attrName; + if(Registry.traceIs(fullTrace, 'pie')) { + var thisLabel = legendItem.label; + var thisLabelIndex = hiddenSlices.indexOf(thisLabel); - if(Lib.isPlainObject(attr)) { - crawl(attr, callback, thisPath, depth + 1); - } else { - // Only execute the callback on leaf nodes: - callback(thisPath, attrName, attr); + if(numClicks === 1) { + if(thisLabelIndex === -1) hiddenSlices.push(thisLabel); + else hiddenSlices.splice(thisLabelIndex, 1); + } else if(numClicks === 2) { + hiddenSlices = []; + gd.calcdata[0].forEach(function(d) { + if(thisLabel !== d.label) { + hiddenSlices.push(d.label); + } + }); + if(gd._fullLayout.hiddenlabels && gd._fullLayout.hiddenlabels.length === hiddenSlices.length && thisLabelIndex === -1) { + hiddenSlices = []; + } } - }); -} -},{"../lib":696,"../registry":827}],770:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + Registry.call('_guiRelayout', gd, 'hiddenlabels', hiddenSlices); + } else { + var hasLegendgroup = legendgroup && legendgroup.length; + var traceIndicesInGroup = []; + var tracei; + if(hasLegendgroup) { + for(i = 0; i < fullData.length; i++) { + tracei = fullData[i]; + if(!tracei.visible) continue; + if(tracei.legendgroup === legendgroup) { + traceIndicesInGroup.push(i); + } + } + } -'use strict'; + if(numClicks === 1) { + var nextVisibility; -var extendFlat = _dereq_('../lib/extend').extendFlat; + switch(fullTrace.visible) { + case true: + nextVisibility = 'legendonly'; + break; + case false: + nextVisibility = false; + break; + case 'legendonly': + nextVisibility = true; + break; + } -/** - * Make a xy domain attribute group - * - * @param {object} opts - * @param {string} - * opts.name: name to be inserted in the default description - * @param {boolean} - * opts.trace: set to true for trace containers - * @param {string} - * opts.editType: editType for all pieces - * @param {boolean} - * opts.noGridCell: set to true to omit `row` and `column` - * - * @param {object} extra - * @param {string} - * extra.description: extra description. N.B we use - * a separate extra container to make it compatible with - * the compress_attributes transform. - * - * @return {object} attributes object containing {x,y} as specified - */ -exports.attributes = function(opts, extra) { - opts = opts || {}; - extra = extra || {}; + if(hasLegendgroup) { + for(i = 0; i < fullData.length; i++) { + if(fullData[i].visible !== false && fullData[i].legendgroup === legendgroup) { + setVisibility(fullData[i], nextVisibility); + } + } + } else { + setVisibility(fullTrace, nextVisibility); + } + } else if(numClicks === 2) { + // Compute the clicked index. expandedIndex does what we want for expanded traces + // but also culls hidden traces. That means we have some work to do. + var isClicked, isInGroup, otherState; + var isIsolated = true; + for(i = 0; i < fullData.length; i++) { + isClicked = fullData[i] === fullTrace; + if(isClicked) continue; - 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] - }; + isInGroup = (hasLegendgroup && fullData[i].legendgroup === legendgroup); - var namePart = opts.name ? opts.name + ' ' : ''; - var contPart = opts.trace ? 'trace ' : 'subplot '; - var descPart = extra.description ? ' ' + extra.description : ''; + if(!isInGroup && fullData[i].visible === true && !Registry.traceIs(fullData[i], 'notLegendIsolatable')) { + isIsolated = false; + break; + } + } - var out = { - x: extendFlat({}, base, { - - }), - y: extendFlat({}, base, { - - }), - editType: opts.editType - }; + for(i = 0; i < fullData.length; i++) { + // False is sticky; we don't change it. + if(fullData[i].visible === false) continue; - if(!opts.noGridCell) { - out.row = { - valType: 'integer', - min: 0, - dflt: 0, - - editType: opts.editType, - - }; - out.column = { - valType: 'integer', - min: 0, - dflt: 0, - - editType: opts.editType, - - }; - } + if(Registry.traceIs(fullData[i], 'notLegendIsolatable')) { + continue; + } - return out; -}; + switch(fullTrace.visible) { + case 'legendonly': + setVisibility(fullData[i], true); + break; + case true: + otherState = isIsolated ? true : 'legendonly'; + isClicked = fullData[i] === fullTrace; + isInGroup = isClicked || (hasLegendgroup && fullData[i].legendgroup === legendgroup); + setVisibility(fullData[i], isInGroup ? true : otherState); + break; + } + } + } -exports.defaults = function(containerOut, layout, coerce, dfltDomains) { - var dfltX = (dfltDomains && dfltDomains.x) || [0, 1]; - var dfltY = (dfltDomains && dfltDomains.y) || [0, 1]; + for(i = 0; i < carrs.length; i++) { + kcont = carrs[i]; + if(!kcont) continue; + var update = kcont.constructUpdate(); - var grid = layout.grid; - if(grid) { - var column = coerce('domain.column'); - if(column !== undefined) { - if(column < grid.columns) dfltX = grid._domains.x[column]; - else delete containerOut.domain.column; + var updateKeys = Object.keys(update); + for(j = 0; j < updateKeys.length; j++) { + key = updateKeys[j]; + val = attrUpdate[key] = attrUpdate[key] || []; + val[carrIdx[i]] = update[key]; + } } - var row = coerce('domain.row'); - if(row !== undefined) { - if(row < grid.rows) dfltY = grid._domains.y[row]; - else delete containerOut.domain.row; + // The length of the value arrays should be equal and any unspecified + // values should be explicitly undefined for them to get properly culled + // as updates and not accidentally reset to the default value. This fills + // out sparse arrays with the required number of undefined values: + keys = Object.keys(attrUpdate); + for(i = 0; i < keys.length; i++) { + key = keys[i]; + for(j = 0; j < attrIndices.length; j++) { + // Use hasOwnPropety to protect against falsey values: + if(!attrUpdate[key].hasOwnProperty(j)) { + attrUpdate[key][j] = undefined; + } + } } - } - coerce('domain.x', dfltX); - coerce('domain.y', dfltY); + Registry.call('_guiRestyle', gd, attrUpdate, attrIndices); + } }; -},{"../lib/extend":685}],771:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../registry":243}],98:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -/* - * make a font attribute group - * - * @param {object} opts - * @param {string} - * opts.description: where & how this font is used - * @param {optional bool} arrayOk: - * should each part (family, size, color) be arrayOk? default false. - * @param {string} editType: - * the editType for all pieces of this font - * @param {optional string} colorEditType: - * a separate editType just for color - * - * @return {object} attributes object containing {family, size, color} as specified - */ -module.exports = function(opts) { - var editType = opts.editType; - var colorEditType = opts.colorEditType; - if(colorEditType === undefined) colorEditType = editType; - var attrs = { - family: { - valType: 'string', - - noBlank: true, - strict: true, - editType: editType, - - }, - size: { - valType: 'number', - - min: 1, - editType: editType - }, - color: { - valType: 'color', - - editType: colorEditType - }, - editType: editType, - // blank strings so compress_attributes can remove - // TODO - that's uber hacky... better solution? - - }; - if(opts.arrayOk) { - attrs.family.arrayOk = true; - attrs.size.arrayOk = true; - attrs.color.arrayOk = true; - } +'use strict'; - return attrs; +exports.isGrouped = function isGrouped(legendLayout) { + return (legendLayout.traceorder || '').indexOf('grouped') !== -1; }; -},{}],772:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = { - _isLinkedToArray: 'frames_entry', +exports.isVertical = function isVertical(legendLayout) { + return legendLayout.orientation !== 'h'; +}; - group: { - valType: 'string', - - - }, - name: { - valType: 'string', - - - }, - traces: { - valType: 'any', - - - }, - baseframe: { - valType: 'string', - - - }, - data: { - valType: 'any', - - - }, - layout: { - valType: 'any', - - - } +exports.isReversed = function isReversed(legendLayout) { + return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],773:[function(_dereq_,module,exports){ +},{}],99:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -// projection names to d3 function name -exports.projNames = { - // d3.geo.projection - 'equirectangular': 'equirectangular', - 'mercator': 'mercator', - 'orthographic': 'orthographic', - 'natural earth': 'naturalEarth', - 'kavrayskiy7': 'kavrayskiy7', - 'miller': 'miller', - 'robinson': 'robinson', - 'eckert4': 'eckert4', - 'azimuthal equal area': 'azimuthalEqualArea', - 'azimuthal equidistant': 'azimuthalEquidistant', - 'conic equal area': 'conicEqualArea', - 'conic conformal': 'conicConformal', - 'conic equidistant': 'conicEquidistant', - 'gnomonic': 'gnomonic', - 'stereographic': 'stereographic', - 'mollweide': 'mollweide', - 'hammer': 'hammer', - 'transverse mercator': 'transverseMercator', - 'albers usa': 'albersUsa', - 'winkel tripel': 'winkel3', - 'aitoff': 'aitoff', - 'sinusoidal': 'sinusoidal' -}; - -// name of the axes -exports.axesNames = ['lonaxis', 'lataxis']; - -// max longitudinal angular span (EXPERIMENTAL) -exports.lonaxisSpan = { - 'orthographic': 180, - 'azimuthal equal area': 360, - 'azimuthal equidistant': 360, - 'conic conformal': 180, - 'gnomonic': 160, - 'stereographic': 180, - 'transverse mercator': 180, - '*': 360 -}; - -// max latitudinal angular span (EXPERIMENTAL) -exports.lataxisSpan = { - 'conic conformal': 150, - 'stereographic': 179.5, - '*': 180 -}; - -// defaults for each scope -exports.scopeDefaults = { - world: { - lonaxisRange: [-180, 180], - lataxisRange: [-90, 90], - projType: 'equirectangular', - projRotate: [0, 0, 0] - }, - usa: { - lonaxisRange: [-180, -50], - lataxisRange: [15, 80], - projType: 'albers usa' - }, - europe: { - lonaxisRange: [-30, 60], - lataxisRange: [30, 85], - projType: 'conic conformal', - projRotate: [15, 0, 0], - projParallels: [0, 60] - }, - asia: { - lonaxisRange: [22, 160], - lataxisRange: [-15, 55], - projType: 'mercator', - projRotate: [0, 0, 0] - }, - africa: { - lonaxisRange: [-30, 60], - lataxisRange: [-40, 40], - projType: 'mercator', - projRotate: [0, 0, 0] - }, - 'north america': { - lonaxisRange: [-180, -45], - lataxisRange: [5, 85], - projType: 'conic conformal', - projRotate: [-100, 0, 0], - projParallels: [29.5, 45.5] - }, - 'south america': { - lonaxisRange: [-100, -30], - lataxisRange: [-60, 15], - projType: 'mercator', - projRotate: [0, 0, 0] - } -}; - -// angular pad to avoid rounding error around clip angles -exports.clipPad = 1e-3; - -// map projection precision -exports.precision = 0.1; - -// default land and water fill colors -exports.landColor = '#F0DC82'; -exports.waterColor = '#3399FF'; - -// locationmode to layer name -exports.locationmodeToLayer = { - 'ISO-3': 'countries', - 'USA-states': 'subunits', - 'country names': 'countries' -}; - -// SVG element for a sphere (use to frame maps) -exports.sphereSVG = {type: 'Sphere'}; - -// N.B. base layer names must be the same as in the topojson files - -// base layer with a fill color -exports.fillLayers = { - ocean: 1, - land: 1, - lakes: 1 -}; - -// base layer with a only a line color -exports.lineLayers = { - subunits: 1, - countries: 1, - coastlines: 1, - rivers: 1, - frame: 1 -}; - -exports.layers = [ - 'bg', - 'ocean', 'land', 'lakes', - 'subunits', 'countries', 'coastlines', 'rivers', - 'lataxis', 'lonaxis', 'frame', - 'backplot', - 'frontplot' -]; -exports.layersForChoropleth = [ - 'bg', - 'ocean', 'land', - 'subunits', 'countries', 'coastlines', - 'lataxis', 'lonaxis', 'frame', - 'backplot', - 'rivers', 'lakes', - 'frontplot' -]; +module.exports = { + moduleType: 'component', + name: 'legend', -exports.layerNameToAdjective = { - ocean: 'ocean', - land: 'land', - lakes: 'lake', - subunits: 'subunit', - countries: 'country', - coastlines: 'coastline', - rivers: 'river', - frame: 'frame' + layoutAttributes: _dereq_('./attributes'), + supplyLayoutDefaults: _dereq_('./defaults'), + + draw: _dereq_('./draw'), + style: _dereq_('./style') }; -},{}],774:[function(_dereq_,module,exports){ +},{"./attributes":92,"./defaults":94,"./draw":95,"./style":100}],100:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -119901,3721 +26370,2452 @@ 'use strict'; -/* global PlotlyGeoAssets:false */ - var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Fx = _dereq_('../../components/fx'); -var Plots = _dereq_('../plots'); -var Axes = _dereq_('../cartesian/axes'); -var dragElement = _dereq_('../../components/dragelement'); -var prepSelect = _dereq_('../cartesian/select').prepSelect; -var selectOnClick = _dereq_('../cartesian/select').selectOnClick; - -var createGeoZoom = _dereq_('./zoom'); -var constants = _dereq_('./constants'); - -var topojsonUtils = _dereq_('../../lib/topojson_utils'); -var topojsonFeature = _dereq_('topojson-client').feature; - -_dereq_('./projections')(d3); - -function Geo(opts) { - this.id = opts.id; - this.graphDiv = opts.graphDiv; - this.container = opts.container; - this.topojsonURL = opts.topojsonURL; - this.isStatic = opts.staticPlot; - - this.topojsonName = null; - this.topojson = null; +var Drawing = _dereq_('../drawing'); +var Color = _dereq_('../color'); - this.projection = null; - this.viewInitial = null; - this.fitScale = null; - this.bounds = null; - this.midPt = null; +var subTypes = _dereq_('../../traces/scatter/subtypes'); +var stylePie = _dereq_('../../traces/pie/style_one'); - this.hasChoropleth = false; - this.traceHash = {}; +module.exports = function style(s, gd) { + s.each(function(d) { + var traceGroup = d3.select(this); - this.layers = {}; - this.basePaths = {}; - this.dataPaths = {}; - this.dataPoints = {}; + var layers = Lib.ensureSingle(traceGroup, 'g', 'layers'); + layers.style('opacity', d[0].trace.opacity); - this.clipDef = null; - this.clipRect = null; - this.bgRect = null; + // Marker vertical alignment + var valign = gd._fullLayout.legend.valign; + var lineHeight = d[0].lineHeight; + var height = d[0].height; + + if(valign === 'middle' || !lineHeight || !height) { + layers.attr('transform', null); + } else { + var factor = {top: 1, bottom: -1}[valign]; + var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); + layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + } - this.makeFramework(); -} + var fill = layers + .selectAll('g.legendfill') + .data([d]); + fill.enter().append('g') + .classed('legendfill', true); -var proto = Geo.prototype; + var line = layers + .selectAll('g.legendlines') + .data([d]); + line.enter().append('g') + .classed('legendlines', true); -module.exports = function createGeo(opts) { - return new Geo(opts); -}; + var symbol = layers + .selectAll('g.legendsymbols') + .data([d]); + symbol.enter().append('g') + .classed('legendsymbols', true); -proto.plot = function(geoCalcData, fullLayout, promises) { - var _this = this; - var geoLayout = fullLayout[this.id]; - var topojsonNameNew = topojsonUtils.getTopojsonName(geoLayout); + symbol.selectAll('g.legendpoints') + .data([d]) + .enter().append('g') + .classed('legendpoints', true); + }) + .each(styleBars) + .each(styleBoxes) + .each(stylePies) + .each(styleLines) + .each(stylePoints) + .each(styleCandles) + .each(styleOHLC); - if(_this.topojson === null || topojsonNameNew !== _this.topojsonName) { - _this.topojsonName = topojsonNameNew; + function styleLines(d) { + var trace = d[0].trace; + var showFill = trace.visible && trace.fill && trace.fill !== 'none'; + var showLine = subTypes.hasLines(trace); + var contours = trace.contours; + var showGradientLine = false; + var showGradientFill = false; - if(PlotlyGeoAssets.topojson[_this.topojsonName] === undefined) { - promises.push(_this.fetchTopojson().then(function(topojson) { - PlotlyGeoAssets.topojson[_this.topojsonName] = topojson; - _this.topojson = topojson; - _this.update(geoCalcData, fullLayout); - })); - } else { - _this.topojson = PlotlyGeoAssets.topojson[_this.topojsonName]; - _this.update(geoCalcData, fullLayout); - } - } else { - _this.update(geoCalcData, fullLayout); - } -}; + if(contours) { + var coloring = contours.coloring; -proto.fetchTopojson = function() { - var topojsonPath = topojsonUtils.getTopojsonPath( - this.topojsonURL, - this.topojsonName - ); - return new Promise(function(resolve, reject) { - d3.json(topojsonPath, function(err, topojson) { - if(err) { - if(err.status === 404) { - return reject(new Error([ - 'plotly.js could not find topojson file at', - topojsonPath, '.', - 'Make sure the *topojsonURL* plot config option', - 'is set properly.' - ].join(' '))); - } else { - return reject(new Error([ - 'unexpected error while fetching topojson file at', - topojsonPath - ].join(' '))); - } + if(coloring === 'lines') { + showGradientLine = true; + } + else { + showLine = coloring === 'none' || coloring === 'heatmap' || + contours.showlines; } - resolve(topojson); - }); - }); -}; - -proto.update = function(geoCalcData, fullLayout) { - var geoLayout = fullLayout[this.id]; - - var hasInvalidBounds = this.updateProjection(fullLayout, geoLayout); - if(hasInvalidBounds) return; - // important: maps with choropleth traces have a different layer order - this.hasChoropleth = false; - for(var i = 0; i < geoCalcData.length; i++) { - if(geoCalcData[i][0].trace.type === 'choropleth') { - this.hasChoropleth = true; - break; + if(contours.type === 'constraint') { + showFill = contours._operation !== '='; + } + else if(coloring === 'fill' || coloring === 'heatmap') { + showGradientFill = true; + } } - } - - if(!this.viewInitial) { - this.saveViewInitial(geoLayout); - } - - this.updateBaseLayers(fullLayout, geoLayout); - this.updateDims(fullLayout, geoLayout); - this.updateFx(fullLayout, geoLayout); - - Plots.generalUpdatePerTraceModule(this.graphDiv, this, geoCalcData, geoLayout); - var scatterLayer = this.layers.frontplot.select('.scatterlayer'); - this.dataPoints.point = scatterLayer.selectAll('.point'); - this.dataPoints.text = scatterLayer.selectAll('text'); - this.dataPaths.line = scatterLayer.selectAll('.js-line'); + // with fill and no markers or text, move the line and fill up a bit + // so it's more centered + var markersOrText = subTypes.hasMarkers(trace) || subTypes.hasText(trace); + var anyFill = showFill || showGradientFill; + var anyLine = showLine || showGradientLine; + var pathStart = (markersOrText || !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 choroplethLayer = this.layers.backplot.select('.choroplethlayer'); - this.dataPaths.choropleth = choroplethLayer.selectAll('path'); + var this3 = d3.select(this); - this.render(); -}; + 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 + 'h30v6h-30z') + .call(showFill ? Drawing.fillGroupStyle : fillGradient); -proto.updateProjection = function(fullLayout, geoLayout) { - var gs = fullLayout._size; - var domain = geoLayout.domain; - var projLayout = geoLayout.projection; - var rotation = projLayout.rotation || {}; - var center = geoLayout.center || {}; - - var projection = this.projection = getProjection(geoLayout); - - // set 'pre-fit' projection - projection - .center([center.lon - rotation.lon, center.lat - rotation.lat]) - .rotate([-rotation.lon, -rotation.lat, rotation.roll]) - .parallels(projLayout.parallels); - - // setup subplot extent [[x0,y0], [x1,y1]] - var extent = [[ - gs.l + gs.w * domain.x[0], - gs.t + gs.h * (1 - domain.y[1]) - ], [ - gs.l + gs.w * domain.x[1], - gs.t + gs.h * (1 - domain.y[0]) - ]]; - - var lonaxis = geoLayout.lonaxis; - var lataxis = geoLayout.lataxis; - var rangeBox = makeRangeBox(lonaxis.range, lataxis.range); - - // fit projection 'scale' and 'translate' to set lon/lat ranges - projection.fitExtent(extent, rangeBox); - - var b = this.bounds = projection.getBounds(rangeBox); - var s = this.fitScale = projection.scale(); - var t = projection.translate(); - - if( - !isFinite(b[0][0]) || !isFinite(b[0][1]) || - !isFinite(b[1][0]) || !isFinite(b[1][1]) || - isNaN(t[0]) || isNaN(t[0]) - ) { - var gd = this.graphDiv; - var attrToUnset = ['projection.rotation', 'center', 'lonaxis.range', 'lataxis.range']; - var msg = 'Invalid geo settings, relayout\'ing to default view.'; - var updateObj = {}; + var line = this3.select('.legendlines').selectAll('path') + .data(showLine || showGradientLine ? [d] : []); + line.enter().append('path').classed('js-line', true); + line.exit().remove(); - // clear all attribute that could cause invalid bounds, - // clear viewInitial to update reset-view behavior + // this is ugly... but you can't apply a gradient to a perfectly + // horizontal or vertical line. Presumably because then + // the system doesn't know how to scale vertical variation, even + // though there *is* no vertical variation in this case. + // so add an invisibly small angle to the line + // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari + line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + .call(showLine ? Drawing.lineGroupStyle : lineGradient); - for(var i = 0; i < attrToUnset.length; i++) { - updateObj[this.id + '.' + attrToUnset[i]] = null; + function fillGradient(s) { + if(s.size()) { + var gradientID = 'legendfill-' + trace.uid; + Drawing.gradient(s, gd, gradientID, 'horizontalreversed', + trace.colorscale, 'fill'); + } } - this.viewInitial = null; - - Lib.warn(msg); - gd._promises.push(Registry.call('relayout', gd, updateObj)); - return msg; - } - - // px coordinates of view mid-point, - // useful to update `geo.center` after interactions - var midPt = this.midPt = [ - (b[0][0] + b[1][0]) / 2, - (b[0][1] + b[1][1]) / 2 - ]; - - // adjust projection to user setting - projection - .scale(projLayout.scale * s) - .translate([t[0] + (midPt[0] - t[0]), t[1] + (midPt[1] - t[1])]) - .clipExtent(b); - - // the 'albers usa' projection does not expose a 'center' method - // so here's this hack to make it respond to 'geoLayout.center' - if(geoLayout._isAlbersUsa) { - var centerPx = projection([center.lon, center.lat]); - var tt = projection.translate(); - - projection.translate([ - tt[0] - (centerPx[0] - tt[0]), - tt[1] - (centerPx[1] - tt[1]) - ]); - } -}; - -proto.updateBaseLayers = function(fullLayout, geoLayout) { - var _this = this; - var topojson = _this.topojson; - var layers = _this.layers; - var basePaths = _this.basePaths; + function lineGradient(s) { + if(s.size()) { + var gradientID = 'legendline-' + trace.uid; + Drawing.lineGroupStyle(s); + Drawing.gradient(s, gd, gradientID, 'horizontalreversed', + trace.colorscale, 'stroke'); + } + } - function isAxisLayer(d) { - return (d === 'lonaxis' || d === 'lataxis'); } - function isLineLayer(d) { - return Boolean(constants.lineLayers[d]); - } + function stylePoints(d) { + var d0 = d[0]; + var trace = d0.trace; + var showMarkers = subTypes.hasMarkers(trace); + var showText = subTypes.hasText(trace); + var showLines = subTypes.hasLines(trace); + var dMod, tMod; - function isFillLayer(d) { - return Boolean(constants.fillLayers[d]); - } + // 'scatter3d' don't use gd.calcdata, + // use d0.trace to infer arrayOk attributes - var allLayers = this.hasChoropleth ? - constants.layersForChoropleth : - constants.layers; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(); + var valToBound = (Lib.isArrayOrTypedArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : + valIn; - var layerData = allLayers.filter(function(d) { - return (isLineLayer(d) || isFillLayer(d)) ? geoLayout['show' + d] : - isAxisLayer(d) ? geoLayout[d].showgrid : - true; - }); + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; + } - var join = _this.framework.selectAll('.layer') - .data(layerData, String); + function pickFirst(array) { return array[0]; } - join.exit().each(function(d) { - delete layers[d]; - delete basePaths[d]; - d3.select(this).remove(); - }); + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}; + var tEdit = {}; - join.enter().append('g') - .attr('class', function(d) { return 'layer ' + d; }) - .each(function(d) { - var layer = layers[d] = d3.select(this); + if(showMarkers) { + 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]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; - if(d === 'bg') { - _this.bgRect = layer.append('rect') - .style('pointer-events', 'all'); - } else if(isAxisLayer(d)) { - basePaths[d] = layer.append('path') - .style('fill', 'none'); - } else if(d === 'backplot') { - layer.append('g') - .classed('choroplethlayer', true); - } else if(d === 'frontplot') { - layer.append('g') - .classed('scatterlayer', true); - } else if(isLineLayer(d)) { - basePaths[d] = layer.append('path') - .style('fill', 'none') - .style('stroke-miterlimit', 2); - } else if(isFillLayer(d)) { - basePaths[d] = layer.append('path') - .style('stroke', 'none'); + var ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.ms = ms; + tEdit.marker.size = ms; } - }); - join.order(); + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } - join.each(function(d) { - var path = basePaths[d]; - var adj = constants.layerNameToAdjective[d]; + 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); + } - if(d === 'frame') { - path.datum(constants.sphereSVG); - } else if(isLineLayer(d) || isFillLayer(d)) { - path.datum(topojsonFeature(topojson, topojson.objects[d])); - } else if(isAxisLayer(d)) { - path.datum(makeGraticule(d, geoLayout)) - .call(Color.stroke, geoLayout[d].gridcolor) - .call(Drawing.dashLine, '', geoLayout[d].gridwidth); - } + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); - if(isLineLayer(d)) { - path.call(Color.stroke, geoLayout[adj + 'color']) - .call(Drawing.dashLine, '', geoLayout[adj + 'width']); - } else if(isFillLayer(d)) { - path.call(Color.fill, geoLayout[adj + 'color']); + // always show legend items in base state + tMod.selectedpoints = null; } - }); -}; -proto.updateDims = function(fullLayout, geoLayout) { - var b = this.bounds; - var hFrameWidth = (geoLayout.framewidth || 0) / 2; + var ptgroup = d3.select(this).select('g.legendpoints'); - var l = b[0][0] - hFrameWidth; - var t = b[0][1] - hFrameWidth; - var w = b[1][0] - l + hFrameWidth; - var h = b[1][1] - t + hFrameWidth; + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + // make sure marker is on the bottom, in case it enters after text + pts.enter().insert('path', ':first-child') + .classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - Drawing.setRect(this.clipRect, l, t, w, h); + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; - this.bgRect - .call(Drawing.setRect, l, t, w, h) - .call(Color.fill, geoLayout.bgcolor); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - this.xaxis._offset = l; - this.xaxis._length = w; + function styleBars(d) { + var trace = d[0].trace; + var marker = trace.marker || {}; + var markerLine = marker.line || {}; - this.yaxis._offset = t; - this.yaxis._length = h; -}; + var barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); -proto.updateFx = function(fullLayout, geoLayout) { - var _this = this; - var gd = _this.graphDiv; - var bgRect = _this.bgRect; - var dragMode = fullLayout.dragmode; - var clickMode = fullLayout.clickmode; + barpath.each(function(d) { + var p = d3.select(this); + var d0 = d[0]; + var w = (d0.mlw + 1 || markerLine.width + 1) - 1; - if(_this.isStatic) return; + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); - function zoomReset() { - var viewInitial = _this.viewInitial; - var updateObj = {}; + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - for(var k in viewInitial) { - updateObj[_this.id + '.' + k] = viewInitial[k]; - } + function styleBoxes(d) { + var trace = d[0].trace; - Registry.call('relayout', gd, updateObj); - gd.emit('plotly_doubleclick', null); - } + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box-violin') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); - function invert(lonlat) { - return _this.projection.invert([ - lonlat[0] + _this.xaxis._offset, - lonlat[1] + _this.yaxis._offset - ]); - } + pts.each(function() { + var w = trace.line.width; + var p = d3.select(this); - var fillRangeItems; + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); - if(dragMode === 'select') { - fillRangeItems = function(eventData, poly) { - var ranges = eventData.range = {}; - ranges[_this.id] = [ - invert([poly.xmin, poly.ymin]), - invert([poly.xmax, poly.ymax]) - ]; - }; - } else if(dragMode === 'lasso') { - fillRangeItems = function(eventData, poly, pts) { - var dataPts = eventData.lassoPoints = {}; - dataPts[_this.id] = pts.filtered.map(invert); - }; + if(w) { + Color.stroke(p, trace.line.color); + } + }); } - // Note: dragOptions is needed to be declared for all dragmodes because - // it's the object that holds persistent selection state. - var dragOptions = { - element: _this.bgRect.node(), - gd: gd, - plotinfo: { - id: _this.id, - xaxis: _this.xaxis, - yaxis: _this.yaxis, - fillRangeItems: fillRangeItems - }, - xaxes: [_this.xaxis], - yaxes: [_this.yaxis], - subplot: _this.id, - clickFn: function(numClicks) { - if(numClicks === 2) { - fullLayout._zoomlayer.selectAll('.select-outline').remove(); - } - } - }; + function styleCandles(d) { + var trace = d[0].trace; + + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendcandle') + .data(trace.type === 'candlestick' && trace.visible ? [d, d] : []); + pts.enter().append('path').classed('legendcandle', true) + .attr('d', function(_, i) { + if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing + return 'M15,0H8M8,-6V6H-8Z'; // decreasing + }) + .attr('transform', 'translate(20,0)') + .style('stroke-miterlimit', 1); + pts.exit().remove(); - if(dragMode === 'pan') { - bgRect.node().onmousedown = null; - bgRect.call(createGeoZoom(_this, geoLayout)); - bgRect.on('dblclick.zoom', zoomReset); - } - else if(dragMode === 'select' || dragMode === 'lasso') { - bgRect.on('.zoom', null); + pts.each(function(_, i) { + var container = trace[i ? 'increasing' : 'decreasing']; + var w = container.line.width; + var p = d3.select(this); - dragOptions.prepFn = function(e, startX, startY) { - prepSelect(e, startX, startY, dragOptions, dragMode); - }; + p.style('stroke-width', w + 'px') + .call(Color.fill, container.fillcolor); - dragElement.init(dragOptions); + if(w) { + Color.stroke(p, container.line.color); + } + }); } - bgRect.on('mousemove', function() { - var lonlat = _this.projection.invert(d3.mouse(this)); - - if(!lonlat || isNaN(lonlat[0]) || isNaN(lonlat[1])) { - return dragElement.unhover(gd, d3.event); - } + function styleOHLC(d) { + var trace = d[0].trace; - _this.xaxis.p2c = function() { return lonlat[0]; }; - _this.yaxis.p2c = function() { return lonlat[1]; }; + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendohlc') + .data(trace.type === 'ohlc' && trace.visible ? [d, d] : []); + pts.enter().append('path').classed('legendohlc', true) + .attr('d', function(_, i) { + if(i) return 'M-15,0H0M-8,-6V0'; // increasing + return 'M15,0H0M8,6V0'; // decreasing + }) + .attr('transform', 'translate(20,0)') + .style('stroke-miterlimit', 1); + pts.exit().remove(); - Fx.hover(gd, d3.event, _this.id); - }); + pts.each(function(_, i) { + var container = trace[i ? 'increasing' : 'decreasing']; + var w = container.line.width; + var p = d3.select(this); - bgRect.on('mouseout', function() { - if(gd._dragging) return; - dragElement.unhover(gd, d3.event); - }); + p.style('fill', 'none') + .call(Drawing.dashLine, container.line.dash, w); - bgRect.on('click', function() { - // For select and lasso the dragElement is handling clicks - if(dragMode !== 'select' && dragMode !== 'lasso') { - if(clickMode.indexOf('select') > -1) { - selectOnClick(d3.event, gd, [_this.xaxis], [_this.yaxis], - _this.id, dragOptions); + if(w) { + Color.stroke(p, container.line.color); } + }); + } - if(clickMode.indexOf('event') > -1) { - // TODO: like pie and mapbox, this doesn't support right-click - // actually this one is worse, as right-click starts a pan, or leaves - // select in a weird state. - // Also, only tangentially related, we should cancel hover during pan - Fx.click(gd, d3.event); - } - } - }); -}; + function stylePies(d) { + var trace = d[0].trace; -proto.makeFramework = function() { - var _this = this; - var fullLayout = _this.graphDiv._fullLayout; - var clipId = 'clip' + fullLayout._uid + _this.id; + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); - _this.clipDef = fullLayout._clips.append('clipPath') - .attr('id', clipId); + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; - _this.clipRect = _this.clipDef.append('rect'); +},{"../../lib":159,"../../registry":243,"../../traces/pie/style_one":279,"../../traces/scatter/subtypes":305,"../color":43,"../drawing":64,"d3":8}],101:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - _this.framework = d3.select(_this.container).append('g') - .attr('class', 'geo ' + _this.id) - .call(Drawing.setClipUrl, clipId); - // sane lonlat to px - _this.project = function(v) { - var px = _this.projection(v); - return px ? - [px[0] - _this.xaxis._offset, px[1] - _this.yaxis._offset] : - [null, null]; - }; +'use strict'; - _this.xaxis = { - _id: 'x', - c2p: function(v) { return _this.project(v)[0]; } - }; +var Registry = _dereq_('../../registry'); +var Plots = _dereq_('../../plots/plots'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); +var Lib = _dereq_('../../lib'); +var Icons = _dereq_('../../../build/ploticon'); - _this.yaxis = { - _id: 'y', - c2p: function(v) { return _this.project(v)[1]; } - }; +var _ = Lib._; - // mock axis for hover formatting - _this.mockAxis = { - type: 'linear', - showexponent: 'all', - exponentformat: 'B' - }; - Axes.setConvert(_this.mockAxis, fullLayout); -}; +var modeBarButtons = module.exports = {}; -proto.saveViewInitial = function(geoLayout) { - var center = geoLayout.center || {}; - var projLayout = geoLayout.projection; - var rotation = projLayout.rotation || {}; - - if(geoLayout._isScoped) { - this.viewInitial = { - 'center.lon': center.lon, - 'center.lat': center.lat, - 'projection.scale': projLayout.scale - }; - } else if(geoLayout._isClipped) { - this.viewInitial = { - 'projection.scale': projLayout.scale, - 'projection.rotation.lon': rotation.lon, - 'projection.rotation.lat': rotation.lat - }; - } else { - this.viewInitial = { - 'center.lon': center.lon, - 'center.lat': center.lat, - 'projection.scale': projLayout.scale, - 'projection.rotation.lon': rotation.lon - }; - } -}; +/** + * ModeBar buttons configuration + * + * @param {string} name + * name / id of the buttons (for tracking) + * @param {string} title + * text that appears while hovering over the button, + * enter null, false or '' for no hover text + * @param {string} icon + * svg icon object associated with the button + * can be linked to Plotly.Icons to use the default plotly icons + * @param {string} [gravity] + * icon positioning + * @param {function} click + * click handler associated with the button, a function of + * 'gd' (the main graph object) and + * 'ev' (the event object) + * @param {string} [attr] + * attribute associated with button, + * use this with 'val' to keep track of the state + * @param {*} [val] + * initial 'attr' value, can be a function of gd + * @param {boolean} [toggle] + * is the button a toggle button? + */ -// [hot code path] (re)draw all paths which depend on the projection -proto.render = function() { - var projection = this.projection; - var pathFn = projection.getPath(); - var k; +modeBarButtons.toImage = { + name: 'toImage', + title: function(gd) { + var opts = gd._context.toImageButtonOptions || {}; + var format = opts.format || 'png'; + return format === 'png' ? + _(gd, 'Download plot as a png') : // legacy text + _(gd, 'Download plot'); // generic non-PNG text + }, + icon: Icons.camera, + click: function(gd) { + var toImageButtonOptions = gd._context.toImageButtonOptions; + var opts = {format: toImageButtonOptions.format || 'png'}; - function translatePoints(d) { - var lonlatPx = projection(d.lonlat); - return lonlatPx ? - 'translate(' + lonlatPx[0] + ',' + lonlatPx[1] + ')' : - null; - } + Lib.notifier(_(gd, 'Taking snapshot - this may take a few seconds'), 'long'); - function hideShowPoints(d) { - return projection.isLonLatOverEdges(d.lonlat) ? 'none' : null; - } + if(opts.format !== 'svg' && Lib.isIE()) { + Lib.notifier(_(gd, 'IE only supports svg. Changing format to svg.'), 'long'); + opts.format = 'svg'; + } - for(k in this.basePaths) { - this.basePaths[k].attr('d', pathFn); - } + ['filename', 'width', 'height', 'scale'].forEach(function(key) { + if(toImageButtonOptions[key]) { + opts[key] = toImageButtonOptions[key]; + } + }); - for(k in this.dataPaths) { - this.dataPaths[k].attr('d', function(d) { return pathFn(d.geojson); }); + Registry.call('downloadImage', gd, opts) + .then(function(filename) { + Lib.notifier(_(gd, 'Snapshot succeeded') + ' - ' + filename, 'long'); + }) + .catch(function() { + Lib.notifier(_(gd, 'Sorry, there was a problem downloading your snapshot!'), 'long'); + }); } +}; - for(k in this.dataPoints) { - this.dataPoints[k] - .attr('display', hideShowPoints) - .attr('transform', translatePoints); +modeBarButtons.sendDataToCloud = { + name: 'sendDataToCloud', + title: function(gd) { return _(gd, 'Edit in Chart Studio'); }, + icon: Icons.disk, + click: function(gd) { + Plots.sendDataToCloud(gd); } }; -// Helper that wraps d3.geo[/* projection name /*]() which: -// -// - adds 'fitExtent' (available in d3 v4) -// - adds 'getPath', 'getBounds' convenience methods -// - scopes logic related to 'clipAngle' -// - adds 'isLonLatOverEdges' method -// - sets projection precision -// - sets methods that aren't always defined depending -// on the projection type to a dummy 'd3-esque' function, -// -// This wrapper alleviates subsequent code of (many) annoying if-statements. -function getProjection(geoLayout) { - var projLayout = geoLayout.projection; - var projType = projLayout.type; +modeBarButtons.zoom2d = { + name: 'zoom2d', + title: function(gd) { return _(gd, 'Zoom'); }, + attr: 'dragmode', + val: 'zoom', + icon: Icons.zoombox, + click: handleCartesian +}; - var projection = d3.geo[constants.projNames[projType]](); +modeBarButtons.pan2d = { + name: 'pan2d', + title: function(gd) { return _(gd, 'Pan'); }, + attr: 'dragmode', + val: 'pan', + icon: Icons.pan, + click: handleCartesian +}; - var clipAngle = geoLayout._isClipped ? - constants.lonaxisSpan[projType] / 2 : - null; +modeBarButtons.select2d = { + name: 'select2d', + title: function(gd) { return _(gd, 'Box Select'); }, + attr: 'dragmode', + val: 'select', + icon: Icons.selectbox, + click: handleCartesian +}; - var methods = ['center', 'rotate', 'parallels', 'clipExtent']; - var dummyFn = function(_) { return _ ? projection : []; }; +modeBarButtons.lasso2d = { + name: 'lasso2d', + title: function(gd) { return _(gd, 'Lasso Select'); }, + attr: 'dragmode', + val: 'lasso', + icon: Icons.lasso, + click: handleCartesian +}; - for(var i = 0; i < methods.length; i++) { - var m = methods[i]; - if(typeof projection[m] !== 'function') { - projection[m] = dummyFn; - } - } +modeBarButtons.zoomIn2d = { + name: 'zoomIn2d', + title: function(gd) { return _(gd, 'Zoom in'); }, + attr: 'zoom', + val: 'in', + icon: Icons.zoom_plus, + click: handleCartesian +}; - projection.isLonLatOverEdges = function(lonlat) { - if(projection(lonlat) === null) { - return true; - } +modeBarButtons.zoomOut2d = { + name: 'zoomOut2d', + title: function(gd) { return _(gd, 'Zoom out'); }, + attr: 'zoom', + val: 'out', + icon: Icons.zoom_minus, + click: handleCartesian +}; - if(clipAngle) { - var r = projection.rotate(); - var angle = d3.geo.distance(lonlat, [-r[0], -r[1]]); - var maxAngle = clipAngle * Math.PI / 180; - return angle > maxAngle; - } else { - return false; - } - }; +modeBarButtons.autoScale2d = { + name: 'autoScale2d', + title: function(gd) { return _(gd, 'Autoscale'); }, + attr: 'zoom', + val: 'auto', + icon: Icons.autoscale, + click: handleCartesian +}; - projection.getPath = function() { - return d3.geo.path().projection(projection); - }; +modeBarButtons.resetScale2d = { + name: 'resetScale2d', + title: function(gd) { return _(gd, 'Reset axes'); }, + attr: 'zoom', + val: 'reset', + icon: Icons.home, + click: handleCartesian +}; - projection.getBounds = function(object) { - return projection.getPath().bounds(object); - }; +modeBarButtons.hoverClosestCartesian = { + name: 'hoverClosestCartesian', + title: function(gd) { return _(gd, 'Show closest data on hover'); }, + attr: 'hovermode', + val: 'closest', + icon: Icons.tooltip_basic, + gravity: 'ne', + click: handleCartesian +}; - // adapted from d3 v4: - // https://github.com/d3/d3-geo/blob/master/src/projection/fit.js - projection.fitExtent = function(extent, object) { - var w = extent[1][0] - extent[0][0]; - var h = extent[1][1] - extent[0][1]; - var clip = projection.clipExtent && projection.clipExtent(); +modeBarButtons.hoverCompareCartesian = { + name: 'hoverCompareCartesian', + title: function(gd) { return _(gd, 'Compare data on hover'); }, + attr: 'hovermode', + val: function(gd) { + return gd._fullLayout._isHoriz ? 'y' : 'x'; + }, + icon: Icons.tooltip_compare, + gravity: 'ne', + click: handleCartesian +}; - projection - .scale(150) - .translate([0, 0]); +function handleCartesian(gd, ev) { + var button = ev.currentTarget; + var astr = button.getAttribute('data-attr'); + var val = button.getAttribute('data-val') || true; + var fullLayout = gd._fullLayout; + var aobj = {}; + var axList = axisIds.list(gd, null, true); + var allSpikesEnabled = 'on'; - if(clip) projection.clipExtent(null); + var ax, i; - var b = projection.getBounds(object); - var k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])); - var x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2; - var y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; + if(astr === 'zoom') { + var mag = (val === 'in') ? 0.5 : 2; + var r0 = (1 + mag) / 2; + var r1 = (1 - mag) / 2; + var axName; - if(clip) projection.clipExtent(clip); + for(i = 0; i < axList.length; i++) { + ax = axList[i]; - return projection - .scale(k * 150) - .translate([x, y]); - }; + if(!ax.fixedrange) { + axName = ax._name; + if(val === 'auto') aobj[axName + '.autorange'] = true; + else if(val === 'reset') { + if(ax._rangeInitial === undefined) { + aobj[axName + '.autorange'] = true; + } + else { + var rangeInitial = ax._rangeInitial.slice(); + aobj[axName + '.range[0]'] = rangeInitial[0]; + aobj[axName + '.range[1]'] = rangeInitial[1]; + } + if(ax._showSpikeInitial !== undefined) { + 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]), + ]; - projection.precision(constants.precision); + var rangeNew = [ + r0 * rangeNow[0] + r1 * rangeNow[1], + r0 * rangeNow[1] + r1 * rangeNow[0] + ]; - if(clipAngle) { - projection.clipAngle(clipAngle - constants.clipPad); + aobj[axName + '.range[0]'] = ax.l2r(rangeNew[0]); + aobj[axName + '.range[1]'] = ax.l2r(rangeNew[1]); + } + } + } + fullLayout._cartesianSpikesEnabled = allSpikesEnabled; } + else { + // if ALL traces have orientation 'h', 'hovermode': 'x' otherwise: 'y' + if(astr === 'hovermode' && (val === 'x' || val === 'y')) { + val = fullLayout._isHoriz ? 'y' : 'x'; + button.setAttribute('data-val', val); + } else if(astr === 'hovermode' && val === 'closest') { + for(i = 0; i < axList.length; i++) { + ax = axList[i]; + if(allSpikesEnabled === 'on' && !ax.showspikes) { + allSpikesEnabled = 'off'; + } + } + fullLayout._cartesianSpikesEnabled = allSpikesEnabled; + } - return projection; -} - -function makeGraticule(axisName, geoLayout) { - var axisLayout = geoLayout[axisName]; - var dtick = axisLayout.dtick; - var scopeDefaults = constants.scopeDefaults[geoLayout.scope]; - var lonaxisRange = scopeDefaults.lonaxisRange; - var lataxisRange = scopeDefaults.lataxisRange; - var step = axisName === 'lonaxis' ? [dtick] : [0, dtick]; + aobj[astr] = val; + } - return d3.geo.graticule() - .extent([ - [lonaxisRange[0], lataxisRange[0]], - [lonaxisRange[1], lataxisRange[1]] - ]) - .step(step); + Registry.call('_guiRelayout', gd, aobj); } -// Returns polygon GeoJSON corresponding to lon/lat range box -// with well-defined direction -// -// Note that clipPad padding is added around range to avoid aliasing. -function makeRangeBox(lon, lat) { - var clipPad = constants.clipPad; - var lon0 = lon[0] + clipPad; - var lon1 = lon[1] - clipPad; - var lat0 = lat[0] + clipPad; - var lat1 = lat[1] - clipPad; +modeBarButtons.zoom3d = { + name: 'zoom3d', + title: function(gd) { return _(gd, 'Zoom'); }, + attr: 'scene.dragmode', + val: 'zoom', + icon: Icons.zoombox, + click: handleDrag3d +}; - // to cross antimeridian w/o ambiguity - if(lon0 > 0 && lon1 < 0) lon1 += 360; +modeBarButtons.pan3d = { + name: 'pan3d', + title: function(gd) { return _(gd, 'Pan'); }, + attr: 'scene.dragmode', + val: 'pan', + icon: Icons.pan, + click: handleDrag3d +}; - var dlon4 = (lon1 - lon0) / 4; +modeBarButtons.orbitRotation = { + name: 'orbitRotation', + title: function(gd) { return _(gd, 'Orbital rotation'); }, + attr: 'scene.dragmode', + val: 'orbit', + icon: Icons['3d_rotate'], + click: handleDrag3d +}; - return { - type: 'Polygon', - coordinates: [[ - [lon0, lat0], - [lon0, lat1], - [lon0 + dlon4, lat1], - [lon0 + 2 * dlon4, lat1], - [lon0 + 3 * dlon4, lat1], - [lon1, lat1], - [lon1, lat0], - [lon1 - dlon4, lat0], - [lon1 - 2 * dlon4, lat0], - [lon1 - 3 * dlon4, lat0], - [lon0, lat0] - ]] - }; -} +modeBarButtons.tableRotation = { + name: 'tableRotation', + title: function(gd) { return _(gd, 'Turntable rotation'); }, + attr: 'scene.dragmode', + val: 'turntable', + icon: Icons['z-axis'], + click: handleDrag3d +}; -},{"../../components/color":570,"../../components/dragelement":592,"../../components/drawing":595,"../../components/fx":612,"../../lib":696,"../../lib/topojson_utils":723,"../../registry":827,"../cartesian/axes":744,"../cartesian/select":762,"../plots":808,"./constants":773,"./projections":779,"./zoom":780,"d3":148,"topojson-client":517}],775:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function handleDrag3d(gd, ev) { + var button = ev.currentTarget; + var attr = button.getAttribute('data-attr'); + var val = button.getAttribute('data-val') || true; + var sceneIds = gd._fullLayout._subplots.gl3d; + var layoutUpdate = {}; + var parts = attr.split('.'); -'use strict'; + for(var i = 0; i < sceneIds.length; i++) { + layoutUpdate[sceneIds[i] + '.' + parts[1]] = val; + } -var createGeo = _dereq_('./geo'); -var getSubplotCalcData = _dereq_('../../plots/get_data').getSubplotCalcData; -var counterRegex = _dereq_('../../lib').counterRegex; + // for multi-type subplots + var val2d = (val === 'pan') ? val : 'zoom'; + layoutUpdate.dragmode = val2d; -var GEO = 'geo'; + Registry.call('_guiRelayout', gd, layoutUpdate); +} -exports.name = GEO; +modeBarButtons.resetCameraDefault3d = { + name: 'resetCameraDefault3d', + title: function(gd) { return _(gd, 'Reset camera to default'); }, + attr: 'resetDefault', + icon: Icons.home, + click: handleCamera3d +}; -exports.attr = GEO; +modeBarButtons.resetCameraLastSave3d = { + name: 'resetCameraLastSave3d', + title: function(gd) { return _(gd, 'Reset camera to last save'); }, + attr: 'resetLastSave', + icon: Icons.movie, + click: handleCamera3d +}; -exports.idRoot = GEO; +function handleCamera3d(gd, ev) { + var button = ev.currentTarget; + var attr = button.getAttribute('data-attr'); + var fullLayout = gd._fullLayout; + var sceneIds = fullLayout._subplots.gl3d; + var aobj = {}; -exports.idRegex = exports.attrRegex = counterRegex(GEO); + for(var i = 0; i < sceneIds.length; i++) { + var sceneId = sceneIds[i]; + var key = sceneId + '.camera'; + var scene = fullLayout[sceneId]._scene; -exports.attributes = _dereq_('./layout/attributes'); + if(attr === 'resetDefault') { + aobj[key] = null; + } + else if(attr === 'resetLastSave') { + aobj[key] = Lib.extendDeep({}, scene.cameraInitial); + } + } -exports.layoutAttributes = _dereq_('./layout/layout_attributes'); + Registry.call('_guiRelayout', gd, aobj); +} -exports.supplyLayoutDefaults = _dereq_('./layout/defaults'); +modeBarButtons.hoverClosest3d = { + name: 'hoverClosest3d', + title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, + attr: 'hovermode', + val: null, + toggle: true, + icon: Icons.tooltip_basic, + gravity: 'ne', + click: handleHover3d +}; -exports.plot = function plotGeo(gd) { +function getNextHover3d(gd, ev) { + var button = ev.currentTarget; + var val = button._previousVal; var fullLayout = gd._fullLayout; - var calcData = gd.calcdata; - var geoIds = fullLayout._subplots[GEO]; - - /** - * If 'plotly-geo-assets.js' is not included, - * initialize object to keep reference to every loaded topojson - */ - if(window.PlotlyGeoAssets === undefined) { - window.PlotlyGeoAssets = {topojson: {}}; - } + var sceneIds = fullLayout._subplots.gl3d; - for(var i = 0; i < geoIds.length; i++) { - var geoId = geoIds[i]; - var geoCalcData = getSubplotCalcData(calcData, GEO, geoId); - var geoLayout = fullLayout[geoId]; - var geo = geoLayout._subplot; - - if(!geo) { - geo = createGeo({ - id: geoId, - graphDiv: gd, - container: fullLayout._geolayer.node(), - topojsonURL: gd._context.topojsonURL, - staticPlot: gd._context.staticPlot - }); + var axes = ['xaxis', 'yaxis', 'zaxis']; - fullLayout[geoId]._subplot = geo; - } + // initialize 'current spike' object to be stored in the DOM + var currentSpikes = {}; + var layoutUpdate = {}; - geo.plot(geoCalcData, fullLayout, gd._promises); + if(val) { + layoutUpdate = val; + button._previousVal = null; } -}; + else { + for(var i = 0; i < sceneIds.length; i++) { + var sceneId = sceneIds[i]; + var sceneLayout = fullLayout[sceneId]; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldGeoKeys = oldFullLayout._subplots[GEO] || []; + var hovermodeAStr = sceneId + '.hovermode'; + currentSpikes[hovermodeAStr] = sceneLayout.hovermode; + layoutUpdate[hovermodeAStr] = false; - for(var i = 0; i < oldGeoKeys.length; i++) { - var oldGeoKey = oldGeoKeys[i]; - var oldGeo = oldFullLayout[oldGeoKey]._subplot; - - if(!newFullLayout[oldGeoKey] && !!oldGeo) { - oldGeo.framework.remove(); - oldGeo.clipDef.remove(); + // copy all the current spike attrs + for(var j = 0; j < 3; j++) { + var axis = axes[j]; + var spikeAStr = sceneId + '.' + axis + '.showspikes'; + layoutUpdate[spikeAStr] = false; + currentSpikes[spikeAStr] = sceneLayout[axis].showspikes; + } } - } -}; - -exports.updateFx = function(gd) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots[GEO]; - for(var i = 0; i < subplotIds.length; i++) { - var subplotLayout = fullLayout[subplotIds[i]]; - var subplotObj = subplotLayout._subplot; - subplotObj.updateFx(fullLayout, subplotLayout); + button._previousVal = currentSpikes; } -}; + return layoutUpdate; +} -},{"../../lib":696,"../../plots/get_data":781,"./geo":774,"./layout/attributes":776,"./layout/defaults":777,"./layout/layout_attributes":778}],776:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function handleHover3d(gd, ev) { + var layoutUpdate = getNextHover3d(gd, ev); + Registry.call('_guiRelayout', gd, layoutUpdate); +} -'use strict'; +modeBarButtons.zoomInGeo = { + name: 'zoomInGeo', + title: function(gd) { return _(gd, 'Zoom in'); }, + attr: 'zoom', + val: 'in', + icon: Icons.zoom_plus, + click: handleGeo +}; +modeBarButtons.zoomOutGeo = { + name: 'zoomOutGeo', + title: function(gd) { return _(gd, 'Zoom out'); }, + attr: 'zoom', + val: 'out', + icon: Icons.zoom_minus, + click: handleGeo +}; -module.exports = { - geo: { - valType: 'subplotid', - - dflt: 'geo', - editType: 'calc', - - } +modeBarButtons.resetGeo = { + name: 'resetGeo', + title: function(gd) { return _(gd, 'Reset'); }, + attr: 'reset', + val: null, + icon: Icons.autoscale, + click: handleGeo }; -},{}],777:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +modeBarButtons.hoverClosestGeo = { + name: 'hoverClosestGeo', + title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, + attr: 'hovermode', + val: null, + toggle: true, + icon: Icons.tooltip_basic, + gravity: 'ne', + click: toggleHover +}; +function handleGeo(gd, ev) { + var button = ev.currentTarget; + var attr = button.getAttribute('data-attr'); + var val = button.getAttribute('data-val') || true; + var fullLayout = gd._fullLayout; + var geoIds = fullLayout._subplots.geo; -'use strict'; + for(var i = 0; i < geoIds.length; i++) { + var id = geoIds[i]; + var geoLayout = fullLayout[id]; -var handleSubplotDefaults = _dereq_('../../subplot_defaults'); -var constants = _dereq_('../constants'); -var layoutAttributes = _dereq_('./layout_attributes'); + if(attr === 'zoom') { + var scale = geoLayout.projection.scale; + var newScale = (val === 'in') ? 2 * scale : 0.5 * scale; -var axesNames = constants.axesNames; + Registry.call('_guiRelayout', gd, id + '.projection.scale', newScale); + } else if(attr === 'reset') { + resetView(gd, 'geo'); + } + } +} -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - handleSubplotDefaults(layoutIn, layoutOut, fullData, { - type: 'geo', - attributes: layoutAttributes, - handleDefaults: handleGeoDefaults, - partition: 'y' - }); +modeBarButtons.hoverClosestGl2d = { + name: 'hoverClosestGl2d', + title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, + attr: 'hovermode', + val: null, + toggle: true, + icon: Icons.tooltip_basic, + gravity: 'ne', + click: toggleHover }; -function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { - var show; - - var resolution = coerce('resolution'); - var scope = coerce('scope'); - var scopeParams = constants.scopeDefaults[scope]; - - var projType = coerce('projection.type', scopeParams.projType); - var isAlbersUsa = geoLayoutOut._isAlbersUsa = projType === 'albers usa'; +modeBarButtons.hoverClosestPie = { + name: 'hoverClosestPie', + title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, + attr: 'hovermode', + val: 'closest', + icon: Icons.tooltip_basic, + gravity: 'ne', + click: toggleHover +}; - // no other scopes are allowed for 'albers usa' projection - if(isAlbersUsa) scope = geoLayoutOut.scope = 'usa'; +function getNextHover(gd) { + var fullLayout = gd._fullLayout; - var isScoped = geoLayoutOut._isScoped = (scope !== 'world'); - var isConic = geoLayoutOut._isConic = projType.indexOf('conic') !== -1; - geoLayoutOut._isClipped = !!constants.lonaxisSpan[projType]; + if(fullLayout.hovermode) return false; - for(var i = 0; i < axesNames.length; i++) { - var axisName = axesNames[i]; - var dtickDflt = [30, 10][i]; - var rangeDflt; + if(fullLayout._has('cartesian')) { + return fullLayout._isHoriz ? 'y' : 'x'; + } + return 'closest'; +} - if(isScoped) { - rangeDflt = scopeParams[axisName + 'Range']; - } else { - var dfltSpans = constants[axisName + 'Span']; - var hSpan = (dfltSpans[projType] || dfltSpans['*']) / 2; - var rot = coerce( - 'projection.rotation.' + axisName.substr(0, 3), - scopeParams.projRotate[i] - ); - rangeDflt = [rot - hSpan, rot + hSpan]; - } +function toggleHover(gd) { + var newHover = getNextHover(gd); + Registry.call('_guiRelayout', gd, 'hovermode', newHover); +} - var range = coerce(axisName + '.range', rangeDflt); +// buttons when more then one plot types are present - coerce(axisName + '.tick0', range[0]); - coerce(axisName + '.dtick', dtickDflt); +modeBarButtons.toggleHover = { + name: 'toggleHover', + title: function(gd) { return _(gd, 'Toggle show closest data on hover'); }, + attr: 'hovermode', + val: null, + toggle: true, + icon: Icons.tooltip_basic, + gravity: 'ne', + click: function(gd, ev) { + var layoutUpdate = getNextHover3d(gd, ev); + layoutUpdate.hovermode = getNextHover(gd); - show = coerce(axisName + '.showgrid'); - if(show) { - coerce(axisName + '.gridcolor'); - coerce(axisName + '.gridwidth'); - } + Registry.call('_guiRelayout', gd, layoutUpdate); } +}; - var lonRange = geoLayoutOut.lonaxis.range; - var latRange = geoLayoutOut.lataxis.range; - - // to cross antimeridian w/o ambiguity - var lon0 = lonRange[0]; - var lon1 = lonRange[1]; - if(lon0 > 0 && lon1 < 0) lon1 += 360; - - var centerLon = (lon0 + lon1) / 2; - var projLon; - - if(!isAlbersUsa) { - var dfltProjRotate = isScoped ? scopeParams.projRotate : [centerLon, 0, 0]; +modeBarButtons.resetViews = { + name: 'resetViews', + title: function(gd) { return _(gd, 'Reset views'); }, + icon: Icons.home, + click: function(gd, ev) { + var button = ev.currentTarget; - projLon = coerce('projection.rotation.lon', dfltProjRotate[0]); - coerce('projection.rotation.lat', dfltProjRotate[1]); - coerce('projection.rotation.roll', dfltProjRotate[2]); + button.setAttribute('data-attr', 'zoom'); + button.setAttribute('data-val', 'reset'); + handleCartesian(gd, ev); - show = coerce('showcoastlines', !isScoped); - if(show) { - coerce('coastlinecolor'); - coerce('coastlinewidth'); - } + button.setAttribute('data-attr', 'resetLastSave'); + handleCamera3d(gd, ev); - show = coerce('showocean'); - if(show) coerce('oceancolor'); + resetView(gd, 'geo'); + resetView(gd, 'mapbox'); } +}; - var centerLonDflt; - var centerLatDflt; +modeBarButtons.toggleSpikelines = { + name: 'toggleSpikelines', + title: function(gd) { return _(gd, 'Toggle Spike Lines'); }, + icon: Icons.spikeline, + attr: '_cartesianSpikesEnabled', + val: 'on', + click: function(gd) { + var fullLayout = gd._fullLayout; - if(isAlbersUsa) { - // 'albers usa' does not have a 'center', - // these values were found using via: - // projection.invert([geoLayout.center.lon, geoLayoutIn.center.lat]) - centerLonDflt = -96.6; - centerLatDflt = 38.7; - } else { - centerLonDflt = isScoped ? centerLon : projLon; - centerLatDflt = (latRange[0] + latRange[1]) / 2; - } + fullLayout._cartesianSpikesEnabled = fullLayout._cartesianSpikesEnabled === 'on' ? 'off' : 'on'; - coerce('center.lon', centerLonDflt); - coerce('center.lat', centerLatDflt); + var aobj = setSpikelineVisibility(gd); - if(isConic) { - var dfltProjParallels = scopeParams.projParallels || [0, 60]; - coerce('projection.parallels', dfltProjParallels); + Registry.call('_guiRelayout', gd, aobj); } +}; - coerce('projection.scale'); - - show = coerce('showland'); - if(show) coerce('landcolor'); +function setSpikelineVisibility(gd) { + var fullLayout = gd._fullLayout; + var axList = axisIds.list(gd, null, true); + var aobj = {}; - show = coerce('showlakes'); - if(show) coerce('lakecolor'); + var ax, axName; - show = coerce('showrivers'); - if(show) { - coerce('rivercolor'); - coerce('riverwidth'); + for(var i = 0; i < axList.length; i++) { + ax = axList[i]; + axName = ax._name; + aobj[axName + '.showspikes'] = fullLayout._cartesianSpikesEnabled === 'on' ? true : ax._showSpikeInitial; } - show = coerce('showcountries', isScoped && scope !== 'usa'); - if(show) { - coerce('countrycolor'); - coerce('countrywidth'); - } + return aobj; +} - if(scope === 'usa' || (scope === 'north america' && resolution === 50)) { - // Only works for: - // USA states at 110m - // USA states + Canada provinces at 50m - coerce('showsubunits', true); - coerce('subunitcolor'); - coerce('subunitwidth'); +modeBarButtons.resetViewMapbox = { + name: 'resetViewMapbox', + title: function(gd) { return _(gd, 'Reset view'); }, + attr: 'reset', + icon: Icons.home, + click: function(gd) { + resetView(gd, 'mapbox'); } +}; + +function resetView(gd, subplotType) { + var fullLayout = gd._fullLayout; + var subplotIds = fullLayout._subplots[subplotType]; + var aObj = {}; + + for(var i = 0; i < subplotIds.length; i++) { + var id = subplotIds[i]; + var subplotObj = fullLayout[id]._subplot; + var viewInitial = subplotObj.viewInitial; + var viewKeys = Object.keys(viewInitial); - if(!isScoped) { - // Does not work in non-world scopes - show = coerce('showframe', true); - if(show) { - coerce('framecolor'); - coerce('framewidth'); + for(var j = 0; j < viewKeys.length; j++) { + var key = viewKeys[j]; + aObj[id + '.' + key] = viewInitial[key]; } } - coerce('bgcolor'); + Registry.call('_guiRelayout', gd, aObj); } -},{"../../subplot_defaults":822,"../constants":773,"./layout_attributes":778}],778:[function(_dereq_,module,exports){ +},{"../../../build/ploticon":2,"../../lib":159,"../../plots/cartesian/axis_ids":206,"../../plots/plots":236,"../../registry":243}],102:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var colorAttrs = _dereq_('../../../components/color/attributes'); -var domainAttrs = _dereq_('../../domain').attributes; -var constants = _dereq_('../constants'); -var overrideAll = _dereq_('../../../plot_api/edit_types').overrideAll; - -var geoAxesAttrs = { - range: { - valType: 'info_array', - - items: [ - {valType: 'number'}, - {valType: 'number'} - ], - - }, - showgrid: { - valType: 'boolean', - - dflt: false, - - }, - tick0: { - valType: 'number', - - - }, - dtick: { - valType: 'number', - - - }, - gridcolor: { - valType: 'color', - - dflt: colorAttrs.lightLine, - - }, - gridwidth: { - valType: 'number', - - min: 0, - dflt: 1, - - } -}; -module.exports = overrideAll({ - domain: domainAttrs({name: 'geo'}, { - - }), +'use strict'; - resolution: { - valType: 'enumerated', - values: [110, 50], - - dflt: 110, - coerceNumber: true, - - }, - scope: { - valType: 'enumerated', - - values: Object.keys(constants.scopeDefaults), - dflt: 'world', - - }, - projection: { - type: { - valType: 'enumerated', - - values: Object.keys(constants.projNames), - - }, - rotation: { - lon: { - valType: 'number', - - - }, - lat: { - valType: 'number', - - - }, - roll: { - valType: 'number', - - - } - }, - parallels: { - valType: 'info_array', - - items: [ - {valType: 'number'}, - {valType: 'number'} - ], - - }, - scale: { - valType: 'number', - - min: 0, - dflt: 1, - - }, - }, - center: { - lon: { - valType: 'number', - - - }, - lat: { - valType: 'number', - - - } - }, - showcoastlines: { - valType: 'boolean', - - - }, - coastlinecolor: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - - }, - coastlinewidth: { - valType: 'number', - - min: 0, - dflt: 1, - - }, - showland: { - valType: 'boolean', - - dflt: false, - - }, - landcolor: { - valType: 'color', - - dflt: constants.landColor, - - }, - showocean: { - valType: 'boolean', - - dflt: false, - - }, - oceancolor: { - valType: 'color', - - dflt: constants.waterColor, - - }, - showlakes: { - valType: 'boolean', - - dflt: false, - - }, - lakecolor: { - valType: 'color', - - dflt: constants.waterColor, - - }, - showrivers: { - valType: 'boolean', - - dflt: false, - - }, - rivercolor: { - valType: 'color', - - dflt: constants.waterColor, - - }, - riverwidth: { - valType: 'number', - - min: 0, - dflt: 1, - - }, - showcountries: { - valType: 'boolean', - - - }, - countrycolor: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - - }, - countrywidth: { - valType: 'number', - - min: 0, - dflt: 1, - - }, - showsubunits: { - valType: 'boolean', - - - }, - subunitcolor: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - - }, - subunitwidth: { - valType: 'number', - - min: 0, - dflt: 1, - - }, - showframe: { - valType: 'boolean', - - - }, - framecolor: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - - }, - framewidth: { - valType: 'number', - - min: 0, - dflt: 1, - - }, - bgcolor: { - valType: 'color', - - dflt: colorAttrs.background, - - }, - lonaxis: geoAxesAttrs, - lataxis: geoAxesAttrs -}, 'plot', 'from-root'); +exports.manage = _dereq_('./manage'); -},{"../../../components/color/attributes":569,"../../../plot_api/edit_types":727,"../../domain":770,"../constants":773}],779:[function(_dereq_,module,exports){ +},{"./manage":103}],103:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -/* - * Generated by https://github.com/etpinard/d3-geo-projection-picker - * - * which is hand-picks projection from https://github.com/d3/d3-geo-projection - * - * into a CommonJS require-able module. - */ 'use strict'; -/* eslint-disable */ +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); +var scatterSubTypes = _dereq_('../../traces/scatter/subtypes'); +var Registry = _dereq_('../../registry'); -function addProjectionsToD3(d3) { - d3.geo.project = function(object, projection) { - var stream = projection.stream; - if (!stream) throw new Error("not yet supported"); - return (object && d3_geo_projectObjectType.hasOwnProperty(object.type) ? d3_geo_projectObjectType[object.type] : d3_geo_projectGeometry)(object, stream); - }; - function d3_geo_projectFeature(object, stream) { - return { - type: "Feature", - id: object.id, - properties: object.properties, - geometry: d3_geo_projectGeometry(object.geometry, stream) - }; - } - function d3_geo_projectGeometry(geometry, stream) { - if (!geometry) return null; - if (geometry.type === "GeometryCollection") return { - type: "GeometryCollection", - geometries: object.geometries.map(function(geometry) { - return d3_geo_projectGeometry(geometry, stream); - }) - }; - if (!d3_geo_projectGeometryType.hasOwnProperty(geometry.type)) return null; - var sink = d3_geo_projectGeometryType[geometry.type]; - d3.geo.stream(geometry, stream(sink)); - return sink.result(); - } - var d3_geo_projectObjectType = { - Feature: d3_geo_projectFeature, - FeatureCollection: function(object, stream) { - return { - type: "FeatureCollection", - features: object.features.map(function(feature) { - return d3_geo_projectFeature(feature, stream); - }) - }; - } - }; - var d3_geo_projectPoints = [], d3_geo_projectLines = []; - var d3_geo_projectPoint = { - point: function(x, y) { - d3_geo_projectPoints.push([ x, y ]); - }, - result: function() { - var result = !d3_geo_projectPoints.length ? null : d3_geo_projectPoints.length < 2 ? { - type: "Point", - coordinates: d3_geo_projectPoints[0] - } : { - type: "MultiPoint", - coordinates: d3_geo_projectPoints - }; - d3_geo_projectPoints = []; - return result; - } - }; - var d3_geo_projectLine = { - lineStart: d3_geo_projectNoop, - point: function(x, y) { - d3_geo_projectPoints.push([ x, y ]); - }, - lineEnd: function() { - if (d3_geo_projectPoints.length) d3_geo_projectLines.push(d3_geo_projectPoints), - d3_geo_projectPoints = []; - }, - result: function() { - var result = !d3_geo_projectLines.length ? null : d3_geo_projectLines.length < 2 ? { - type: "LineString", - coordinates: d3_geo_projectLines[0] - } : { - type: "MultiLineString", - coordinates: d3_geo_projectLines - }; - d3_geo_projectLines = []; - return result; - } - }; - var d3_geo_projectPolygon = { - polygonStart: d3_geo_projectNoop, - lineStart: d3_geo_projectNoop, - point: function(x, y) { - d3_geo_projectPoints.push([ x, y ]); - }, - lineEnd: function() { - var n = d3_geo_projectPoints.length; - if (n) { - do d3_geo_projectPoints.push(d3_geo_projectPoints[0].slice()); while (++n < 4); - d3_geo_projectLines.push(d3_geo_projectPoints), d3_geo_projectPoints = []; - } - }, - polygonEnd: d3_geo_projectNoop, - result: function() { - if (!d3_geo_projectLines.length) return null; - var polygons = [], holes = []; - d3_geo_projectLines.forEach(function(ring) { - if (d3_geo_projectClockwise(ring)) polygons.push([ ring ]); else holes.push(ring); - }); - holes.forEach(function(hole) { - var point = hole[0]; - polygons.some(function(polygon) { - if (d3_geo_projectContains(polygon[0], point)) { - polygon.push(hole); - return true; - } - }) || polygons.push([ hole ]); - }); - d3_geo_projectLines = []; - return !polygons.length ? null : polygons.length > 1 ? { - type: "MultiPolygon", - coordinates: polygons - } : { - type: "Polygon", - coordinates: polygons[0] - }; - } - }; - var d3_geo_projectGeometryType = { - Point: d3_geo_projectPoint, - MultiPoint: d3_geo_projectPoint, - LineString: d3_geo_projectLine, - MultiLineString: d3_geo_projectLine, - Polygon: d3_geo_projectPolygon, - MultiPolygon: d3_geo_projectPolygon, - Sphere: d3_geo_projectPolygon - }; - function d3_geo_projectNoop() {} - function d3_geo_projectClockwise(ring) { - if ((n = ring.length) < 4) return false; - var i = 0, n, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area <= 0; - } - function d3_geo_projectContains(ring, point) { - var x = point[0], y = point[1], contains = false; - for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (yi > y ^ yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = !contains; - } - return contains; - } - var ε = 1e-6, ε2 = ε * ε, π = Math.PI, halfπ = π / 2, sqrtπ = Math.sqrt(π), radians = π / 180, degrees = 180 / π; - function sinci(x) { - return x ? x / Math.sin(x) : 1; - } - function sgn(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; - } - function asin(x) { - return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x); - } - function acos(x) { - return x > 1 ? 0 : x < -1 ? π : Math.acos(x); - } - function asqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; - } - var projection = d3.geo.projection, projectionMutator = d3.geo.projectionMutator; - d3.geo.interrupt = function(project) { - var lobes = [ [ [ [ -π, 0 ], [ 0, halfπ ], [ π, 0 ] ] ], [ [ [ -π, 0 ], [ 0, -halfπ ], [ π, 0 ] ] ] ]; - var bounds; - function forward(λ, φ) { - var sign = φ < 0 ? -1 : +1, hemilobes = lobes[+(φ < 0)]; - for (var i = 0, n = hemilobes.length - 1; i < n && λ > hemilobes[i][2][0]; ++i) ; - var coordinates = project(λ - hemilobes[i][1][0], φ); - coordinates[0] += project(hemilobes[i][1][0], sign * φ > sign * hemilobes[i][0][1] ? hemilobes[i][0][1] : φ)[0]; - return coordinates; - } - function reset() { - bounds = lobes.map(function(hemilobes) { - return hemilobes.map(function(lobe) { - var x0 = project(lobe[0][0], lobe[0][1])[0], x1 = project(lobe[2][0], lobe[2][1])[0], y0 = project(lobe[1][0], lobe[0][1])[1], y1 = project(lobe[1][0], lobe[1][1])[1], t; - if (y0 > y1) t = y0, y0 = y1, y1 = t; - return [ [ x0, y0 ], [ x1, y1 ] ]; - }); - }); - } - if (project.invert) forward.invert = function(x, y) { - var hemibounds = bounds[+(y < 0)], hemilobes = lobes[+(y < 0)]; - for (var i = 0, n = hemibounds.length; i < n; ++i) { - var b = hemibounds[i]; - if (b[0][0] <= x && x < b[1][0] && b[0][1] <= y && y < b[1][1]) { - var coordinates = project.invert(x - project(hemilobes[i][1][0], 0)[0], y); - coordinates[0] += hemilobes[i][1][0]; - return pointEqual(forward(coordinates[0], coordinates[1]), [ x, y ]) ? coordinates : null; +var createModeBar = _dereq_('./modebar'); +var modeBarButtons = _dereq_('./buttons'); + +/** + * ModeBar wrapper around 'create' and 'update', + * chooses buttons to pass to ModeBar constructor based on + * plot type and plot config. + * + * @param {object} gd main plot object + * + */ +module.exports = function manageModeBar(gd) { + var fullLayout = gd._fullLayout; + var context = gd._context; + var modeBar = fullLayout._modeBar; + + if(!context.displayModeBar && !context.watermark) { + if(modeBar) { + modeBar.destroy(); + delete fullLayout._modeBar; } - } - }; - var projection = d3.geo.projection(forward), stream_ = projection.stream; - projection.stream = function(stream) { - var rotate = projection.rotate(), rotateStream = stream_(stream), sphereStream = (projection.rotate([ 0, 0 ]), - stream_(stream)); - projection.rotate(rotate); - rotateStream.sphere = function() { - d3.geo.stream(sphere(), sphereStream); - }; - return rotateStream; - }; - projection.lobes = function(_) { - if (!arguments.length) return lobes.map(function(lobes) { - return lobes.map(function(lobe) { - return [ [ lobe[0][0] * 180 / π, lobe[0][1] * 180 / π ], [ lobe[1][0] * 180 / π, lobe[1][1] * 180 / π ], [ lobe[2][0] * 180 / π, lobe[2][1] * 180 / π ] ]; - }); - }); - lobes = _.map(function(lobes) { - return lobes.map(function(lobe) { - return [ [ lobe[0][0] * π / 180, lobe[0][1] * π / 180 ], [ lobe[1][0] * π / 180, lobe[1][1] * π / 180 ], [ lobe[2][0] * π / 180, lobe[2][1] * π / 180 ] ]; - }); - }); - reset(); - return projection; - }; - function sphere() { - var ε = 1e-6, coordinates = []; - for (var i = 0, n = lobes[0].length; i < n; ++i) { - var lobe = lobes[0][i], λ0 = lobe[0][0] * 180 / π, φ0 = lobe[0][1] * 180 / π, φ1 = lobe[1][1] * 180 / π, λ2 = lobe[2][0] * 180 / π, φ2 = lobe[2][1] * 180 / π; - coordinates.push(resample([ [ λ0 + ε, φ0 + ε ], [ λ0 + ε, φ1 - ε ], [ λ2 - ε, φ1 - ε ], [ λ2 - ε, φ2 + ε ] ], 30)); - } - for (var i = lobes[1].length - 1; i >= 0; --i) { - var lobe = lobes[1][i], λ0 = lobe[0][0] * 180 / π, φ0 = lobe[0][1] * 180 / π, φ1 = lobe[1][1] * 180 / π, λ2 = lobe[2][0] * 180 / π, φ2 = lobe[2][1] * 180 / π; - coordinates.push(resample([ [ λ2 - ε, φ2 - ε ], [ λ2 - ε, φ1 + ε ], [ λ0 + ε, φ1 + ε ], [ λ0 + ε, φ0 - ε ] ], 30)); - } - return { - type: "Polygon", - coordinates: [ d3.merge(coordinates) ] - }; - } - function resample(coordinates, m) { - var i = -1, n = coordinates.length, p0 = coordinates[0], p1, dx, dy, resampled = []; - while (++i < n) { - p1 = coordinates[i]; - dx = (p1[0] - p0[0]) / m; - dy = (p1[1] - p0[1]) / m; - for (var j = 0; j < m; ++j) resampled.push([ p0[0] + j * dx, p0[1] + j * dy ]); - p0 = p1; - } - resampled.push(p1); - return resampled; - } - function pointEqual(a, b) { - return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε; - } - return projection; - }; - function eckert4(λ, φ) { - var k = (2 + halfπ) * Math.sin(φ); - φ /= 2; - for (var i = 0, δ = Infinity; i < 10 && Math.abs(δ) > ε; i++) { - var cosφ = Math.cos(φ); - φ -= δ = (φ + Math.sin(φ) * (cosφ + 2) - k) / (2 * cosφ * (1 + cosφ)); - } - return [ 2 / Math.sqrt(π * (4 + π)) * λ * (1 + Math.cos(φ)), 2 * Math.sqrt(π / (4 + π)) * Math.sin(φ) ]; - } - eckert4.invert = function(x, y) { - var A = .5 * y * Math.sqrt((4 + π) / π), k = asin(A), c = Math.cos(k); - return [ x / (2 / Math.sqrt(π * (4 + π)) * (1 + c)), asin((k + A * (c + 2)) / (2 + halfπ)) ]; - }; - (d3.geo.eckert4 = function() { - return projection(eckert4); - }).raw = eckert4; - var hammerAzimuthalEqualArea = d3.geo.azimuthalEqualArea.raw; - function hammer(A, B) { - if (arguments.length < 2) B = A; - if (B === 1) return hammerAzimuthalEqualArea; - if (B === Infinity) return hammerQuarticAuthalic; - function forward(λ, φ) { - var coordinates = hammerAzimuthalEqualArea(λ / B, φ); - coordinates[0] *= A; - return coordinates; + return; } - forward.invert = function(x, y) { - var coordinates = hammerAzimuthalEqualArea.invert(x / A, y); - coordinates[0] *= B; - return coordinates; - }; - return forward; - } - function hammerProjection() { - var B = 2, m = projectionMutator(hammer), p = m(B); - p.coefficient = function(_) { - if (!arguments.length) return B; - return m(B = +_); - }; - return p; - } - function hammerQuarticAuthalic(λ, φ) { - return [ λ * Math.cos(φ) / Math.cos(φ /= 2), 2 * Math.sin(φ) ]; - } - hammerQuarticAuthalic.invert = function(x, y) { - var φ = 2 * asin(y / 2); - return [ x * Math.cos(φ / 2) / Math.cos(φ), φ ]; - }; - (d3.geo.hammer = hammerProjection).raw = hammer; - function kavrayskiy7(λ, φ) { - return [ 3 * λ / (2 * π) * Math.sqrt(π * π / 3 - φ * φ), φ ]; - } - kavrayskiy7.invert = function(x, y) { - return [ 2 / 3 * π * x / Math.sqrt(π * π / 3 - y * y), y ]; - }; - (d3.geo.kavrayskiy7 = function() { - return projection(kavrayskiy7); - }).raw = kavrayskiy7; - function miller(λ, φ) { - return [ λ, 1.25 * Math.log(Math.tan(π / 4 + .4 * φ)) ]; - } - miller.invert = function(x, y) { - return [ x, 2.5 * Math.atan(Math.exp(.8 * y)) - .625 * π ]; - }; - (d3.geo.miller = function() { - return projection(miller); - }).raw = miller; - function mollweideBromleyθ(Cp) { - return function(θ) { - var Cpsinθ = Cp * Math.sin(θ), i = 30, δ; - do θ -= δ = (θ + Math.sin(θ) - Cpsinθ) / (1 + Math.cos(θ)); while (Math.abs(δ) > ε && --i > 0); - return θ / 2; - }; - } - function mollweideBromley(Cx, Cy, Cp) { - var θ = mollweideBromleyθ(Cp); - function forward(λ, φ) { - return [ Cx * λ * Math.cos(φ = θ(φ)), Cy * Math.sin(φ) ]; + + if(!Array.isArray(context.modeBarButtonsToRemove)) { + throw new Error([ + '*modeBarButtonsToRemove* configuration options', + 'must be an array.' + ].join(' ')); } - forward.invert = function(x, y) { - var θ = asin(y / Cy); - return [ x / (Cx * Math.cos(θ)), asin((2 * θ + Math.sin(2 * θ)) / Cp) ]; - }; - return forward; - } - var mollweideθ = mollweideBromleyθ(π), mollweide = mollweideBromley(Math.SQRT2 / halfπ, Math.SQRT2, π); - (d3.geo.mollweide = function() { - return projection(mollweide); - }).raw = mollweide; - function naturalEarth(λ, φ) { - var φ2 = φ * φ, φ4 = φ2 * φ2; - return [ λ * (.8707 - .131979 * φ2 + φ4 * (-.013791 + φ4 * (.003971 * φ2 - .001529 * φ4))), φ * (1.007226 + φ2 * (.015085 + φ4 * (-.044475 + .028874 * φ2 - .005916 * φ4))) ]; - } - naturalEarth.invert = function(x, y) { - var φ = y, i = 25, δ; - do { - var φ2 = φ * φ, φ4 = φ2 * φ2; - φ -= δ = (φ * (1.007226 + φ2 * (.015085 + φ4 * (-.044475 + .028874 * φ2 - .005916 * φ4))) - y) / (1.007226 + φ2 * (.015085 * 3 + φ4 * (-.044475 * 7 + .028874 * 9 * φ2 - .005916 * 11 * φ4))); - } while (Math.abs(δ) > ε && --i > 0); - return [ x / (.8707 + (φ2 = φ * φ) * (-.131979 + φ2 * (-.013791 + φ2 * φ2 * φ2 * (.003971 - .001529 * φ2)))), φ ]; - }; - (d3.geo.naturalEarth = function() { - return projection(naturalEarth); - }).raw = naturalEarth; - var robinsonConstants = [ [ .9986, -.062 ], [ 1, 0 ], [ .9986, .062 ], [ .9954, .124 ], [ .99, .186 ], [ .9822, .248 ], [ .973, .31 ], [ .96, .372 ], [ .9427, .434 ], [ .9216, .4958 ], [ .8962, .5571 ], [ .8679, .6176 ], [ .835, .6769 ], [ .7986, .7346 ], [ .7597, .7903 ], [ .7186, .8435 ], [ .6732, .8936 ], [ .6213, .9394 ], [ .5722, .9761 ], [ .5322, 1 ] ]; - robinsonConstants.forEach(function(d) { - d[1] *= 1.0144; - }); - function robinson(λ, φ) { - var i = Math.min(18, Math.abs(φ) * 36 / π), i0 = Math.floor(i), di = i - i0, ax = (k = robinsonConstants[i0])[0], ay = k[1], bx = (k = robinsonConstants[++i0])[0], by = k[1], cx = (k = robinsonConstants[Math.min(19, ++i0)])[0], cy = k[1], k; - return [ λ * (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2), (φ > 0 ? halfπ : -halfπ) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) ]; - } - robinson.invert = function(x, y) { - var yy = y / halfπ, φ = yy * 90, i = Math.min(18, Math.abs(φ / 5)), i0 = Math.max(0, Math.floor(i)); - do { - var ay = robinsonConstants[i0][1], by = robinsonConstants[i0 + 1][1], cy = robinsonConstants[Math.min(19, i0 + 2)][1], u = cy - ay, v = cy - 2 * by + ay, t = 2 * (Math.abs(yy) - by) / u, c = v / u, di = t * (1 - c * t * (1 - 2 * c * t)); - if (di >= 0 || i0 === 1) { - φ = (y >= 0 ? 5 : -5) * (di + i); - var j = 50, δ; - do { - i = Math.min(18, Math.abs(φ) / 5); - i0 = Math.floor(i); - di = i - i0; - ay = robinsonConstants[i0][1]; - by = robinsonConstants[i0 + 1][1]; - cy = robinsonConstants[Math.min(19, i0 + 2)][1]; - φ -= (δ = (y >= 0 ? halfπ : -halfπ) * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - y) * degrees; - } while (Math.abs(δ) > ε2 && --j > 0); - break; - } - } while (--i0 >= 0); - var ax = robinsonConstants[i0][0], bx = robinsonConstants[i0 + 1][0], cx = robinsonConstants[Math.min(19, i0 + 2)][0]; - return [ x / (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2), φ * radians ]; - }; - (d3.geo.robinson = function() { - return projection(robinson); - }).raw = robinson; - function sinusoidal(λ, φ) { - return [ λ * Math.cos(φ), φ ]; - } - sinusoidal.invert = function(x, y) { - return [ x / Math.cos(y), y ]; - }; - (d3.geo.sinusoidal = function() { - return projection(sinusoidal); - }).raw = sinusoidal; - function aitoff(λ, φ) { - var cosφ = Math.cos(φ), sinciα = sinci(acos(cosφ * Math.cos(λ /= 2))); - return [ 2 * cosφ * Math.sin(λ) * sinciα, Math.sin(φ) * sinciα ]; - } - aitoff.invert = function(x, y) { - if (x * x + 4 * y * y > π * π + ε) return; - var λ = x, φ = y, i = 25; - do { - var sinλ = Math.sin(λ), sinλ_2 = Math.sin(λ / 2), cosλ_2 = Math.cos(λ / 2), sinφ = Math.sin(φ), cosφ = Math.cos(φ), sin_2φ = Math.sin(2 * φ), sin2φ = sinφ * sinφ, cos2φ = cosφ * cosφ, sin2λ_2 = sinλ_2 * sinλ_2, C = 1 - cos2φ * cosλ_2 * cosλ_2, E = C ? acos(cosφ * cosλ_2) * Math.sqrt(F = 1 / C) : F = 0, F, fx = 2 * E * cosφ * sinλ_2 - x, fy = E * sinφ - y, δxδλ = F * (cos2φ * sin2λ_2 + E * cosφ * cosλ_2 * sin2φ), δxδφ = F * (.5 * sinλ * sin_2φ - E * 2 * sinφ * sinλ_2), δyδλ = F * .25 * (sin_2φ * sinλ_2 - E * sinφ * cos2φ * sinλ), δyδφ = F * (sin2φ * cosλ_2 + E * sin2λ_2 * cosφ), denominator = δxδφ * δyδλ - δyδφ * δxδλ; - if (!denominator) break; - var δλ = (fy * δxδφ - fx * δyδφ) / denominator, δφ = (fx * δyδλ - fy * δxδλ) / denominator; - λ -= δλ, φ -= δφ; - } while ((Math.abs(δλ) > ε || Math.abs(δφ) > ε) && --i > 0); - return [ λ, φ ]; - }; - (d3.geo.aitoff = function() { - return projection(aitoff); - }).raw = aitoff; - function winkel3(λ, φ) { - var coordinates = aitoff(λ, φ); - return [ (coordinates[0] + λ / halfπ) / 2, (coordinates[1] + φ) / 2 ]; - } - winkel3.invert = function(x, y) { - var λ = x, φ = y, i = 25; - do { - var cosφ = Math.cos(φ), sinφ = Math.sin(φ), sin_2φ = Math.sin(2 * φ), sin2φ = sinφ * sinφ, cos2φ = cosφ * cosφ, sinλ = Math.sin(λ), cosλ_2 = Math.cos(λ / 2), sinλ_2 = Math.sin(λ / 2), sin2λ_2 = sinλ_2 * sinλ_2, C = 1 - cos2φ * cosλ_2 * cosλ_2, E = C ? acos(cosφ * cosλ_2) * Math.sqrt(F = 1 / C) : F = 0, F, fx = .5 * (2 * E * cosφ * sinλ_2 + λ / halfπ) - x, fy = .5 * (E * sinφ + φ) - y, δxδλ = .5 * F * (cos2φ * sin2λ_2 + E * cosφ * cosλ_2 * sin2φ) + .5 / halfπ, δxδφ = F * (sinλ * sin_2φ / 4 - E * sinφ * sinλ_2), δyδλ = .125 * F * (sin_2φ * sinλ_2 - E * sinφ * cos2φ * sinλ), δyδφ = .5 * F * (sin2φ * cosλ_2 + E * sin2λ_2 * cosφ) + .5, denominator = δxδφ * δyδλ - δyδφ * δxδλ, δλ = (fy * δxδφ - fx * δyδφ) / denominator, δφ = (fx * δyδλ - fy * δxδλ) / denominator; - λ -= δλ, φ -= δφ; - } while ((Math.abs(δλ) > ε || Math.abs(δφ) > ε) && --i > 0); - return [ λ, φ ]; - }; - (d3.geo.winkel3 = function() { - return projection(winkel3); - }).raw = winkel3; -} -module.exports = addProjectionsToD3; + if(!Array.isArray(context.modeBarButtonsToAdd)) { + throw new Error([ + '*modeBarButtonsToAdd* configuration options', + 'must be an array.' + ].join(' ')); + } -},{}],780:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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( + gd, + context.modeBarButtonsToRemove, + context.modeBarButtonsToAdd, + context.showSendToCloud + ); + } -'use strict'; + if(modeBar) modeBar.update(gd, buttonGroups); + else fullLayout._modeBar = createModeBar(gd, buttonGroups); +}; -var d3 = _dereq_('d3'); -var Lib = _dereq_('../../lib'); +// logic behind which buttons are displayed by default +function getButtonGroups(gd, buttonsToRemove, buttonsToAdd, showSendToCloud) { + var fullLayout = gd._fullLayout; + var fullData = gd._fullData; -var radians = Math.PI / 180; -var degrees = 180 / Math.PI; -var zoomstartStyle = {cursor: 'pointer'}; -var zoomendStyle = {cursor: 'auto'}; - -function createGeoZoom(geo, geoLayout) { - var projection = geo.projection; - var zoomConstructor; - - if(geoLayout._isScoped) { - zoomConstructor = zoomScoped; - } else if(geoLayout._isClipped) { - zoomConstructor = zoomClipped; - } else { - zoomConstructor = zoomNonClipped; - } + var hasCartesian = fullLayout._has('cartesian'); + var hasGL3D = fullLayout._has('gl3d'); + var hasGeo = fullLayout._has('geo'); + var hasPie = fullLayout._has('pie'); + var hasGL2D = fullLayout._has('gl2d'); + var hasTernary = fullLayout._has('ternary'); + var hasMapbox = fullLayout._has('mapbox'); + var hasPolar = fullLayout._has('polar'); + var allAxesFixed = areAllAxesFixed(fullLayout); - // TODO add a conic-specific zoom + var groups = []; - return zoomConstructor(geo, projection); -} + function addGroup(newGroup) { + if(!newGroup.length) return; -module.exports = createGeoZoom; + var out = []; -// common to all zoom types -function initZoom(geo, projection) { - return d3.behavior.zoom() - .translate(projection.translate()) - .scale(projection.scale()); -} + for(var i = 0; i < newGroup.length; i++) { + var button = newGroup[i]; + if(buttonsToRemove.indexOf(button) !== -1) continue; + out.push(modeBarButtons[button]); + } -// sync zoom updates with user & full layout -function sync(geo, projection, cb) { - var id = geo.id; - var gd = geo.graphDiv; - var userOpts = gd.layout[id]; - var fullOpts = gd._fullLayout[id]; + groups.push(out); + } - var eventData = {}; + // buttons common to all plot types + var commonGroup = ['toImage']; + if(showSendToCloud) commonGroup.push('sendDataToCloud'); + addGroup(commonGroup); - function set(propStr, val) { - var fullNp = Lib.nestedProperty(fullOpts, propStr); + var zoomGroup = []; + var hoverGroup = []; + var resetGroup = []; + var dragModeGroup = []; - if(fullNp.get() !== val) { - fullNp.set(val); - Lib.nestedProperty(userOpts, propStr).set(val); - eventData[id + '.' + propStr] = val; - } + if((hasCartesian || hasGL2D || hasPie || hasTernary) + hasGeo + hasGL3D + hasMapbox + hasPolar > 1) { + // graphs with more than one plot types get 'union buttons' + // which reset the view or toggle hover labels across all subplots. + 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) { + hoverGroup = ['toggleHover']; + resetGroup = ['resetViewMapbox']; + } + else if(hasGL2D) { + hoverGroup = ['hoverClosestGl2d']; + } + else if(hasPie) { + hoverGroup = ['hoverClosestPie']; } - - cb(set); - set('projection.scale', projection.scale() / geo.fitScale); - gd.emit('plotly_relayout', eventData); -} - -// zoom for scoped projections -function zoomScoped(geo, projection) { - var zoom = initZoom(geo, projection); - - function handleZoomstart() { - d3.select(this).style(zoomstartStyle); + else { // hasPolar, hasTernary + // always show at least one hover icon. + hoverGroup = ['toggleHover']; } - - function handleZoom() { - projection - .scale(d3.event.scale) - .translate(d3.event.translate); - geo.render(); + // if we have cartesian, allow switching between closest and compare + // regardless of what other types are on the plot, since they'll all + // just treat any truthy hovermode as 'closest' + if(hasCartesian) { + hoverGroup = ['toggleSpikelines', 'hoverClosestCartesian', 'hoverCompareCartesian']; } - function syncCb(set) { - var center = projection.invert(geo.midPt); - - set('center.lon', center[0]); - set('center.lat', center[1]); + if((hasCartesian || hasGL2D) && !allAxesFixed) { + zoomGroup = ['zoomIn2d', 'zoomOut2d', 'autoScale2d']; + if(resetGroup[0] !== 'resetViews') resetGroup = ['resetScale2d']; } - function handleZoomend() { - d3.select(this).style(zoomendStyle); - sync(geo, projection, syncCb); + if(hasGL3D) { + dragModeGroup = ['zoom3d', 'pan3d', 'orbitRotation', 'tableRotation']; } - - zoom - .on('zoomstart', handleZoomstart) - .on('zoom', handleZoom) - .on('zoomend', handleZoomend); - - return zoom; -} - -// zoom for non-clipped projections -function zoomNonClipped(geo, projection) { - var zoom = initZoom(geo, projection); - - var INSIDETOLORANCEPXS = 2; - - var mouse0, rotate0, translate0, lastRotate, zoomPoint, - mouse1, rotate1, point1, didZoom; - - function position(x) { return projection.invert(x); } - - function outside(x) { - var pos = position(x); - if(!pos) return true; - - var pt = projection(pos); - return ( - Math.abs(pt[0] - x[0]) > INSIDETOLORANCEPXS || - Math.abs(pt[1] - x[1]) > INSIDETOLORANCEPXS - ); + else if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { + dragModeGroup = ['zoom2d', 'pan2d']; } - - function handleZoomstart() { - d3.select(this).style(zoomstartStyle); - - mouse0 = d3.mouse(this); - rotate0 = projection.rotate(); - translate0 = projection.translate(); - lastRotate = rotate0; - zoomPoint = position(mouse0); - } - - function handleZoom() { - mouse1 = d3.mouse(this); - - if(outside(mouse0)) { - zoom.scale(projection.scale()); - zoom.translate(projection.translate()); - return; - } - - projection.scale(d3.event.scale); - projection.translate([translate0[0], d3.event.translate[1]]); - - if(!zoomPoint) { - mouse0 = mouse1; - zoomPoint = position(mouse0); - } - else if(position(mouse1)) { - point1 = position(mouse1); - rotate1 = [lastRotate[0] + (point1[0] - zoomPoint[0]), rotate0[1], rotate0[2]]; - projection.rotate(rotate1); - lastRotate = rotate1; - } - - didZoom = true; - geo.render(); + else if(hasMapbox || hasGeo) { + dragModeGroup = ['pan2d']; } - - function handleZoomend() { - d3.select(this).style(zoomendStyle); - if(didZoom) sync(geo, projection, syncCb); + else if(hasPolar) { + dragModeGroup = ['zoom2d']; } - - function syncCb(set) { - var rotate = projection.rotate(); - var center = projection.invert(geo.midPt); - - set('projection.rotation.lon', -rotate[0]); - set('center.lon', center[0]); - set('center.lat', center[1]); + if(isSelectable(fullData)) { + dragModeGroup.push('select2d', 'lasso2d'); } - zoom - .on('zoomstart', handleZoomstart) - .on('zoom', handleZoom) - .on('zoomend', handleZoomend); + addGroup(dragModeGroup); + addGroup(zoomGroup.concat(resetGroup)); + addGroup(hoverGroup); - return zoom; + return appendButtonsToGroups(groups, buttonsToAdd); } -// zoom for clipped projections -// inspired by https://www.jasondavies.com/maps/d3.geo.zoom.js -function zoomClipped(geo, projection) { - var view = {r: projection.rotate(), k: projection.scale()}, - zoom = initZoom(geo, projection), - event = d3_eventDispatch(zoom, 'zoomstart', 'zoom', 'zoomend'), - zooming = 0, - zoomOn = zoom.on; +function areAllAxesFixed(fullLayout) { + var axList = axisIds.list({_fullLayout: fullLayout}, null, true); - var zoomPoint; + for(var i = 0; i < axList.length; i++) { + if(!axList[i].fixedrange) { + return false; + } + } - zoom.on('zoomstart', function() { - d3.select(this).style(zoomstartStyle); + return true; +} - var mouse0 = d3.mouse(this), - rotate0 = projection.rotate(), - lastRotate = rotate0, - translate0 = projection.translate(), - q = quaternionFromEuler(rotate0); +// look for traces that support selection +// to be updated as we add more selectPoints handlers +function isSelectable(fullData) { + var selectable = false; - zoomPoint = position(projection, mouse0); + for(var i = 0; i < fullData.length; i++) { + if(selectable) break; - zoomOn.call(zoom, 'zoom', function() { - var mouse1 = d3.mouse(this); + var trace = fullData[i]; - projection.scale(view.k = d3.event.scale); + if(!trace._module || !trace._module.selectPoints) continue; - if(!zoomPoint) { - // if no zoomPoint, the mouse wasn't over the actual geography yet - // maybe this point is the start... we'll find out next time! - mouse0 = mouse1; - zoomPoint = position(projection, mouse0); + if(Registry.traceIs(trace, 'scatter-like')) { + if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { + selectable = true; } - // check if the point is on the map - // if not, don't do anything new but scale - // if it is, then we can assume between will exist below - // so we don't need the 'bank' function, whatever that is. - else if(position(projection, mouse1)) { - // go back to original projection temporarily - // except for scale... that's kind of independent? - projection - .rotate(rotate0) - .translate(translate0); - - // calculate the new params - var point1 = position(projection, mouse1), - between = rotateBetween(zoomPoint, point1), - newEuler = eulerFromQuaternion(multiply(q, between)), - rotateAngles = view.r = unRoll(newEuler, zoomPoint, lastRotate); - - if(!isFinite(rotateAngles[0]) || !isFinite(rotateAngles[1]) || - !isFinite(rotateAngles[2])) { - rotateAngles = lastRotate; - } - - // update the projection - projection.rotate(rotateAngles); - lastRotate = rotateAngles; + } else if(Registry.traceIs(trace, 'box-violin')) { + if(trace.boxpoints === 'all' || trace.points === 'all') { + selectable = true; } - - zoomed(event.of(this, arguments)); - }); - - zoomstarted(event.of(this, arguments)); - }) - .on('zoomend', function() { - d3.select(this).style(zoomendStyle); - zoomOn.call(zoom, 'zoom', null); - zoomended(event.of(this, arguments)); - sync(geo, projection, syncCb); - }) - .on('zoom.redraw', function() { - geo.render(); - }); - - function zoomstarted(dispatch) { - if(!zooming++) dispatch({type: 'zoomstart'}); - } - - function zoomed(dispatch) { - dispatch({type: 'zoom'}); - } - - function zoomended(dispatch) { - if(!--zooming) dispatch({type: 'zoomend'}); - } - - function syncCb(set) { - var _rotate = projection.rotate(); - set('projection.rotation.lon', -_rotate[0]); - set('projection.rotation.lat', -_rotate[1]); + } + // assume that in general if the trace module has selectPoints, + // then it's selectable. Scatter is an exception to this because it must + // have markers or text, not just be a scatter type. + else selectable = true; } - return d3.rebind(zoom, event, 'on'); -} - -// -- helper functions for zoomClipped - -function position(projection, point) { - var spherical = projection.invert(point); - return spherical && isFinite(spherical[0]) && isFinite(spherical[1]) && cartesian(spherical); -} - -function quaternionFromEuler(euler) { - var lambda = 0.5 * euler[0] * radians, - phi = 0.5 * euler[1] * radians, - gamma = 0.5 * euler[2] * radians, - sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda), - sinPhi = Math.sin(phi), cosPhi = Math.cos(phi), - sinGamma = Math.sin(gamma), cosGamma = Math.cos(gamma); - return [ - cosLambda * cosPhi * cosGamma + sinLambda * sinPhi * sinGamma, - sinLambda * cosPhi * cosGamma - cosLambda * sinPhi * sinGamma, - cosLambda * sinPhi * cosGamma + sinLambda * cosPhi * sinGamma, - cosLambda * cosPhi * sinGamma - sinLambda * sinPhi * cosGamma - ]; -} - -function multiply(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - return [ - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3, - a0 * b1 + a1 * b0 + a2 * b3 - a3 * b2, - a0 * b2 - a1 * b3 + a2 * b0 + a3 * b1, - a0 * b3 + a1 * b2 - a2 * b1 + a3 * b0 - ]; + return selectable; } -function rotateBetween(a, b) { - if(!a || !b) return; - var axis = cross(a, b), - norm = Math.sqrt(dot(axis, axis)), - halfgamma = 0.5 * Math.acos(Math.max(-1, Math.min(1, dot(a, b)))), - k = Math.sin(halfgamma) / norm; - return norm && [Math.cos(halfgamma), axis[2] * k, -axis[1] * k, axis[0] * k]; -} - -// input: -// rotateAngles: a calculated set of Euler angles -// pt: a point (cartesian in 3-space) to keep fixed -// roll0: an initial roll, to be preserved -// output: -// a set of Euler angles that preserve the projection of pt -// but set roll (output[2]) equal to roll0 -// note that this doesn't depend on the particular projection, -// just on the rotation angles -function unRoll(rotateAngles, pt, lastRotate) { - // calculate the fixed point transformed by these Euler angles - // but with the desired roll undone - var ptRotated = rotateCartesian(pt, 2, rotateAngles[0]); - ptRotated = rotateCartesian(ptRotated, 1, rotateAngles[1]); - ptRotated = rotateCartesian(ptRotated, 0, rotateAngles[2] - lastRotate[2]); - - var x = pt[0], - y = pt[1], - z = pt[2], - f = ptRotated[0], - g = ptRotated[1], - h = ptRotated[2], - - // the following essentially solves: - // ptRotated = rotateCartesian(rotateCartesian(pt, 2, newYaw), 1, newPitch) - // for newYaw and newPitch, as best it can - theta = Math.atan2(y, x) * degrees, - a = Math.sqrt(x * x + y * y), - b, - newYaw1; - - if(Math.abs(g) > a) { - newYaw1 = (g > 0 ? 90 : -90) - theta; - b = 0; - } else { - newYaw1 = Math.asin(g / a) * degrees - theta; - b = Math.sqrt(a * a - g * g); +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); } - var newYaw2 = 180 - newYaw1 - 2 * theta, - newPitch1 = (Math.atan2(h, f) - Math.atan2(z, b)) * degrees, - newPitch2 = (Math.atan2(h, f) - Math.atan2(z, -b)) * degrees; - - // which is closest to lastRotate[0,1]: newYaw/Pitch or newYaw2/Pitch2? - var dist1 = angleDistance(lastRotate[0], lastRotate[1], newYaw1, newPitch1), - dist2 = angleDistance(lastRotate[0], lastRotate[1], newYaw2, newPitch2); - - if(dist1 <= dist2) return [newYaw1, newPitch1, lastRotate[2]]; - else return [newYaw2, newPitch2, lastRotate[2]]; -} - -function angleDistance(yaw0, pitch0, yaw1, pitch1) { - var dYaw = angleMod(yaw1 - yaw0), - dPitch = angleMod(pitch1 - pitch0); - return Math.sqrt(dYaw * dYaw + dPitch * dPitch); -} - -// reduce an angle in degrees to [-180,180] -function angleMod(angle) { - return (angle % 360 + 540) % 360 - 180; -} - -// rotate a cartesian vector -// axis is 0 (x), 1 (y), or 2 (z) -// angle is in degrees -function rotateCartesian(vector, axis, angle) { - var angleRads = angle * radians, - vectorOut = vector.slice(), - ax1 = (axis === 0) ? 1 : 0, - ax2 = (axis === 2) ? 1 : 2, - cosa = Math.cos(angleRads), - sina = Math.sin(angleRads); - - vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina; - vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina; - - return vectorOut; -} -function eulerFromQuaternion(q) { - return [ - Math.atan2(2 * (q[0] * q[1] + q[2] * q[3]), 1 - 2 * (q[1] * q[1] + q[2] * q[2])) * degrees, - Math.asin(Math.max(-1, Math.min(1, 2 * (q[0] * q[2] - q[3] * q[1])))) * degrees, - Math.atan2(2 * (q[0] * q[3] + q[1] * q[2]), 1 - 2 * (q[2] * q[2] + q[3] * q[3])) * degrees - ]; -} - -function cartesian(spherical) { - var lambda = spherical[0] * radians, - phi = spherical[1] * radians, - cosPhi = Math.cos(phi); - return [ - cosPhi * Math.cos(lambda), - cosPhi * Math.sin(lambda), - Math.sin(phi) - ]; + return groups; } -function dot(a, b) { - var s = 0; - for(var i = 0, n = a.length; i < n; ++i) s += a[i] * b[i]; - return s; -} +// fill in custom buttons referring to default mode bar buttons +function fillCustomButton(customButtons) { + for(var i = 0; i < customButtons.length; i++) { + var buttonGroup = customButtons[i]; -function cross(a, b) { - return [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0] - ]; -} + for(var j = 0; j < buttonGroup.length; j++) { + var button = buttonGroup[j]; -// Like d3.dispatch, but for custom events abstracting native UI events. These -// events have a target component (such as a brush), a target element (such as -// the svg:g element containing the brush) and the standard arguments `d` (the -// target element's data) and `i` (the selection index of the target element). -function d3_eventDispatch(target) { - var i = 0, - n = arguments.length, - argumentz = []; - - while(++i < n) argumentz.push(arguments[i]); - - var dispatch = d3.dispatch.apply(null, argumentz); - - // Creates a dispatch context for the specified `thiz` (typically, the target - // DOM element that received the source event) and `argumentz` (typically, the - // data `d` and index `i` of the target element). The returned function can be - // used to dispatch an event to any registered listeners; the function takes a - // single argument as input, being the event to dispatch. The event must have - // a "type" attribute which corresponds to a type registered in the - // constructor. This context will automatically populate the "sourceEvent" and - // "target" attributes of the event, as well as setting the `d3.event` global - // for the duration of the notification. - dispatch.of = function(thiz, argumentz) { - return function(e1) { - var e0; - try { - e0 = e1.sourceEvent = d3.event; - e1.target = target; - d3.event = e1; - dispatch[e1.type].apply(thiz, argumentz); - } finally { - d3.event = e0; + if(typeof button === 'string') { + if(modeBarButtons[button] !== undefined) { + customButtons[i][j] = modeBarButtons[button]; + } + else { + throw new Error([ + '*modeBarButtons* configuration options', + 'invalid button name' + ].join(' ')); + } } - }; - }; + } + } - return dispatch; + return customButtons; } -},{"../../lib":696,"d3":148}],781:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":206,"../../registry":243,"../../traces/scatter/subtypes":305,"./buttons":101,"./modebar":104}],104:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Registry = _dereq_('../registry'); -var SUBPLOT_PATTERN = _dereq_('./cartesian/constants').SUBPLOT_PATTERN; - -/** - * Get calcdata trace(s) associated with a given subplot - * - * @param {array} calcData: as in gd.calcdata - * @param {string} type: subplot type - * @param {string} subplotId: subplot id to look for - * - * @return {array} array of calcdata traces - */ -exports.getSubplotCalcData = function(calcData, type, subplotId) { - var basePlotModule = Registry.subplotsRegistry[type]; - if(!basePlotModule) return []; - var attr = basePlotModule.attr; - var subplotCalcData = []; +'use strict'; - for(var i = 0; i < calcData.length; i++) { - var calcTrace = calcData[i]; - var trace = calcTrace[0].trace; +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); - if(trace[attr] === subplotId) subplotCalcData.push(calcTrace); - } +var Lib = _dereq_('../../lib'); +var Icons = _dereq_('../../../build/ploticon'); +var Parser = new DOMParser(); - return subplotCalcData; -}; /** - * Get calcdata trace(s) that can be plotted with a given module - * NOTE: this isn't necessarily just exactly matching trace type, - * if multiple trace types use the same plotting routine, they will be - * collected here. - * In order to not plot the same thing multiple times, we return two arrays, - * the calcdata we *will* plot with this module, and the ones we *won't* - * - * @param {array} calcdata: as in gd.calcdata - * @param {object|string|fn} arg1: - * the plotting module, or its name, or its plot method - * - * @return {array[array]} [foundCalcdata, remainingCalcdata] + * UI controller for interactive plots + * @Class + * @Param {object} opts + * @Param {object} opts.buttons nested arrays of grouped buttons config objects + * @Param {object} opts.container container div to append modeBar + * @Param {object} opts.graphInfo primary plot object containing data and layout */ -exports.getModuleCalcData = function(calcdata, arg1) { - 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]; - } +function ModeBar(opts) { + this.container = opts.container; + this.element = document.createElement('div'); - for(var i = 0; i < calcdata.length; i++) { - var cd = calcdata[i]; - var trace = cd[0].trace; - // N.B. 'legendonly' traces do not make it past here - if(trace.visible !== true) continue; + this.update(opts.graphInfo, opts.buttons); - // group calcdata trace not by 'module' (as the name of this function - // would suggest), but by 'module plot method' so that if some traces - // share the same module plot method (e.g. bar and histogram), we - // only call it one! - if(trace._module.plot === plotMethod) { - moduleCalcData.push(cd); - } else { - remainingCalcData.push(cd); - } - } + this.container.appendChild(this.element); +} - return [moduleCalcData, remainingCalcData]; -}; +var proto = ModeBar.prototype; /** - * Get the data trace(s) associated with a given subplot. - * - * @param {array} data plotly full data array. - * @param {string} type subplot type to look for. - * @param {string} subplotId subplot id to look for. + * Update modeBar (buttons and logo) * - * @return {array} list of trace objects. + * @param {object} graphInfo primary plot object containing data and layout + * @param {array of arrays} buttons nested arrays of grouped buttons to initialize * */ -exports.getSubplotData = function getSubplotData(data, type, subplotId) { - if(!Registry.subplotsRegistry[type]) return []; +proto.update = function(graphInfo, buttons) { + this.graphInfo = graphInfo; - var attr = Registry.subplotsRegistry[type].attr; - var subplotData = []; - var trace, subplotX, subplotY; + var context = this.graphInfo._context; + var fullLayout = this.graphInfo._fullLayout; + var modeBarId = 'modebar-' + fullLayout._uid; - if(type === 'gl2d') { - var spmatch = subplotId.match(SUBPLOT_PATTERN); - subplotX = 'x' + spmatch[1]; - subplotY = 'y' + spmatch[2]; - } + this.element.setAttribute('id', modeBarId); + this._uid = modeBarId; - for(var i = 0; i < data.length; i++) { - trace = data[i]; + this.element.className = 'modebar'; + if(context.displayModeBar === 'hover') this.element.className += ' modebar--hover ease-bg'; - 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); - } + if(fullLayout.modebar.orientation === 'v') { + this.element.className += ' vertical'; + buttons = buttons.reverse(); } - return subplotData; -}; - -},{"../registry":827,"./cartesian/constants":750}],782:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - + var style = fullLayout.modebar; + var bgSelector = context.displayModeBar === 'hover' ? '.js-plotly-plot .plotly:hover ' : ''; -'use strict'; + Lib.deleteRelatedStyleRule(modeBarId); + Lib.addRelatedStyleRule(modeBarId, bgSelector + '#' + modeBarId, '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 mouseChange = _dereq_('mouse-change'); -var mouseWheel = _dereq_('mouse-wheel'); -var mouseOffset = _dereq_('mouse-event-offset'); -var cartesianConstants = _dereq_('../cartesian/constants'); -var hasPassive = _dereq_('has-passive-events'); + // if buttons or logo have changed, redraw modebar interior + var needsNewButtons = !this.hasButtons(buttons); + var needsNewLogo = (this.hasLogo !== context.displaylogo); + var needsNewLocale = (this.locale !== context.locale); -module.exports = createCamera; + this.locale = context.locale; -function Camera2D(element, plot) { - this.element = element; - this.plot = plot; - this.mouseListener = null; - this.wheelListener = null; - this.lastInputTime = Date.now(); - this.lastPos = [0, 0]; - this.boxEnabled = false; - this.boxInited = false; - this.boxStart = [0, 0]; - this.boxEnd = [0, 0]; - this.dragStart = [0, 0]; -} + if(needsNewButtons || needsNewLogo || needsNewLocale) { + this.removeAllButtons(); + this.updateButtons(buttons); -function createCamera(scene) { - var element = scene.mouseContainer, - plot = scene.glplot, - result = new Camera2D(element, plot); - - function unSetAutoRange() { - scene.xaxis.autorange = false; - scene.yaxis.autorange = false; - } - - function getSubplotConstraint() { - // note: this assumes we only have one x and one y axis on this subplot - // when this constraint is lifted this block won't make sense - var constraints = scene.graphDiv._fullLayout._axisConstraintGroups; - var xaId = scene.xaxis._id; - var yaId = scene.yaxis._id; - for(var i = 0; i < constraints.length; i++) { - if(constraints[i][xaId] !== -1) { - if(constraints[i][yaId] !== -1) return true; - break; + if(context.watermark || context.displaylogo) { + var logoGroup = this.getLogo(); + if(context.watermark) { + logoGroup.className = logoGroup.className + ' watermark'; } - } - return false; - } - - result.mouseListener = mouseChange(element, handleInteraction); - // enable simple touch interactions - element.addEventListener('touchstart', function(ev) { - var xy = mouseOffset(ev.changedTouches[0], element); - handleInteraction(0, xy[0], xy[1]); - handleInteraction(1, xy[0], xy[1]); - - ev.preventDefault(); - }, hasPassive ? {passive: false} : false); - element.addEventListener('touchmove', function(ev) { - ev.preventDefault(); - var xy = mouseOffset(ev.changedTouches[0], element); - handleInteraction(1, xy[0], xy[1]); - - ev.preventDefault(); - }, hasPassive ? {passive: false} : false); - element.addEventListener('touchend', function(ev) { - handleInteraction(0, result.lastPos[0], result.lastPos[1]); - - ev.preventDefault(); - }, hasPassive ? {passive: false} : false); - - function handleInteraction(buttons, x, y) { - var dataBox = scene.calcDataBox(), - viewBox = plot.viewBox; - - var lastX = result.lastPos[0], - lastY = result.lastPos[1]; - - var MINDRAG = cartesianConstants.MINDRAG * plot.pixelRatio; - var MINZOOM = cartesianConstants.MINZOOM * plot.pixelRatio; - - var dx, dy; - - x *= plot.pixelRatio; - y *= plot.pixelRatio; - - // mouseChange gives y about top; convert to about bottom - y = (viewBox[3] - viewBox[1]) - y; - - function updateRange(i0, start, end) { - var range0 = Math.min(start, end), - range1 = Math.max(start, end); - - if(range0 !== range1) { - dataBox[i0] = range0; - dataBox[i0 + 2] = range1; - result.dataBox = dataBox; - scene.setRanges(dataBox); - } - else { - scene.selectBox.selectBox = [0, 0, 1, 1]; - scene.glplot.setDirty(); + if(fullLayout.modebar.orientation === 'v') { + this.element.insertBefore(logoGroup, this.element.childNodes[0]); + } else { + this.element.appendChild(logoGroup); } + + this.hasLogo = true; } + } - switch(scene.fullLayout.dragmode) { - case 'zoom': - if(buttons) { - var dataX = x / - (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + - dataBox[0]; - var dataY = y / - (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + - dataBox[1]; - - if(!result.boxInited) { - result.boxStart[0] = dataX; - result.boxStart[1] = dataY; - result.dragStart[0] = x; - result.dragStart[1] = y; - } + this.updateActiveButton(); +}; - result.boxEnd[0] = dataX; - result.boxEnd[1] = dataY; +proto.updateButtons = function(buttons) { + var _this = this; - // we need to mark the box as initialized right away - // so that we can tell the start and end points apart - result.boxInited = true; - - // but don't actually enable the box until the cursor moves - if(!result.boxEnabled && ( - result.boxStart[0] !== result.boxEnd[0] || - result.boxStart[1] !== result.boxEnd[1]) - ) { - result.boxEnabled = true; - } + this.buttons = buttons; + this.buttonElements = []; + this.buttonsNames = []; - // constrain aspect ratio if the axes require it - var smallDx = Math.abs(result.dragStart[0] - x) < MINZOOM; - var smallDy = Math.abs(result.dragStart[1] - y) < MINZOOM; - if(getSubplotConstraint() && !(smallDx && smallDy)) { - dx = result.boxEnd[0] - result.boxStart[0]; - dy = result.boxEnd[1] - result.boxStart[1]; - var dydx = (dataBox[3] - dataBox[1]) / (dataBox[2] - dataBox[0]); - - if(Math.abs(dx * dydx) > Math.abs(dy)) { - result.boxEnd[1] = result.boxStart[1] + - Math.abs(dx) * dydx * (dy >= 0 ? 1 : -1); - - // gl-select-box clips to the plot area bounds, - // which breaks the axis constraint, so don't allow - // this box to go out of bounds - if(result.boxEnd[1] < dataBox[1]) { - result.boxEnd[1] = dataBox[1]; - result.boxEnd[0] = result.boxStart[0] + - (dataBox[1] - result.boxStart[1]) / Math.abs(dydx); - } - else if(result.boxEnd[1] > dataBox[3]) { - result.boxEnd[1] = dataBox[3]; - result.boxEnd[0] = result.boxStart[0] + - (dataBox[3] - result.boxStart[1]) / Math.abs(dydx); - } - } - else { - result.boxEnd[0] = result.boxStart[0] + - Math.abs(dy) / dydx * (dx >= 0 ? 1 : -1); + this.buttons.forEach(function(buttonGroup) { + var group = _this.createGroup(); - if(result.boxEnd[0] < dataBox[0]) { - result.boxEnd[0] = dataBox[0]; - result.boxEnd[1] = result.boxStart[1] + - (dataBox[0] - result.boxStart[0]) * Math.abs(dydx); - } - else if(result.boxEnd[0] > dataBox[2]) { - result.boxEnd[0] = dataBox[2]; - result.boxEnd[1] = result.boxStart[1] + - (dataBox[2] - result.boxStart[0]) * Math.abs(dydx); - } - } - } - // otherwise clamp small changes to the origin so we get 1D zoom - else { - if(smallDx) result.boxEnd[0] = result.boxStart[0]; - if(smallDy) result.boxEnd[1] = result.boxStart[1]; - } - } - else if(result.boxEnabled) { - dx = result.boxStart[0] !== result.boxEnd[0]; - dy = result.boxStart[1] !== result.boxEnd[1]; - if(dx || dy) { - if(dx) { - updateRange(0, result.boxStart[0], result.boxEnd[0]); - scene.xaxis.autorange = false; - } - if(dy) { - updateRange(1, result.boxStart[1], result.boxEnd[1]); - scene.yaxis.autorange = false; - } - scene.relayoutCallback(); - } - else { - scene.glplot.setDirty(); - } - result.boxEnabled = false; - result.boxInited = false; - } - // if box was inited but button released then - reset the box - else if(result.boxInited) { - result.boxInited = false; - } - break; + 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); - case 'pan': - result.boxEnabled = false; - result.boxInited = false; - - if(buttons) { - if(!result.panning) { - result.dragStart[0] = x; - result.dragStart[1] = y; - } + var button = _this.createButton(buttonConfig); + _this.buttonElements.push(button); + group.appendChild(button); + }); - if(Math.abs(result.dragStart[0] - x) < MINDRAG) x = result.dragStart[0]; - if(Math.abs(result.dragStart[1] - y) < MINDRAG) y = result.dragStart[1]; + _this.element.appendChild(group); + }); +}; - dx = (lastX - x) * (dataBox[2] - dataBox[0]) / - (plot.viewBox[2] - plot.viewBox[0]); - dy = (lastY - y) * (dataBox[3] - dataBox[1]) / - (plot.viewBox[3] - plot.viewBox[1]); - - dataBox[0] += dx; - dataBox[2] += dx; - dataBox[1] += dy; - dataBox[3] += dy; - - scene.setRanges(dataBox); - - result.panning = true; - result.lastInputTime = Date.now(); - unSetAutoRange(); - scene.cameraChanged(); - scene.handleAnnotations(); - } - else if(result.panning) { - result.panning = false; - scene.relayoutCallback(); - } - break; - } +/** + * Empty div for containing a group of buttons + * @Return {HTMLelement} + */ +proto.createGroup = function() { + var group = document.createElement('div'); + group.className = 'modebar-group'; + return group; +}; - result.lastPos[0] = x; - result.lastPos[1] = y; - } +/** + * Create a new button div and set constant and configurable attributes + * @Param {object} config (see ./buttons.js for more info) + * @Return {HTMLelement} + */ +proto.createButton = function(config) { + var _this = this; + var button = document.createElement('a'); - result.wheelListener = mouseWheel(element, function(dx, dy) { - if(!scene.scrollZoom) return false; + button.setAttribute('rel', 'tooltip'); + button.className = 'modebar-btn'; - var dataBox = scene.calcDataBox(), - viewBox = plot.viewBox; + var title = config.title; + if(title === undefined) title = config.name; + // for localization: allow title to be a callable that takes gd as arg + else if(typeof title === 'function') title = title(this.graphInfo); - var lastX = result.lastPos[0], - lastY = result.lastPos[1]; + if(title || title === 0) button.setAttribute('data-title', title); - var scale = Math.exp(5.0 * dy / (viewBox[3] - viewBox[1])); + if(config.attr !== undefined) button.setAttribute('data-attr', config.attr); - var cx = lastX / - (viewBox[2] - viewBox[0]) * (dataBox[2] - dataBox[0]) + - dataBox[0]; - var cy = lastY / - (viewBox[3] - viewBox[1]) * (dataBox[3] - dataBox[1]) + - dataBox[1]; + var val = config.val; + if(val !== undefined) { + if(typeof val === 'function') val = val(this.graphInfo); + button.setAttribute('data-val', val); + } - dataBox[0] = (dataBox[0] - cx) * scale + cx; - dataBox[2] = (dataBox[2] - cx) * scale + cx; - dataBox[1] = (dataBox[1] - cy) * scale + cy; - dataBox[3] = (dataBox[3] - cy) * scale + cy; + var click = config.click; + if(typeof click !== 'function') { + throw new Error('must provide button \'click\' function in button config'); + } + else { + button.addEventListener('click', function(ev) { + config.click(_this.graphInfo, ev); - scene.setRanges(dataBox); + // only needed for 'hoverClosestGeo' which does not call relayout + _this.updateActiveButton(ev.currentTarget); + }); + } - result.lastInputTime = Date.now(); - unSetAutoRange(); - scene.cameraChanged(); - scene.handleAnnotations(); - scene.relayoutCallback(); + button.setAttribute('data-toggle', config.toggle || false); + if(config.toggle) d3.select(button).classed('active', true); - return true; - }, 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 result; -} + return button; +}; -},{"../cartesian/constants":750,"has-passive-events":394,"mouse-change":418,"mouse-event-offset":419,"mouse-wheel":421}],783:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - + * Add an icon to a button + * @Param {object} thisIcon + * @Param {number} thisIcon.width + * @Param {string} thisIcon.path + * @Param {string} thisIcon.color + * @Return {HTMLelement} + */ +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; -'use strict'; + if(thisIcon.path) { + icon = document.createElementNS(svgNS, 'svg'); + icon.setAttribute('viewBox', [0, 0, thisIcon.width, iconHeight].join(' ')); + icon.setAttribute('class', 'icon'); -var Axes = _dereq_('../cartesian/axes'); + var path = document.createElementNS(svgNS, 'path'); + path.setAttribute('d', thisIcon.path); -var convertHTMLToUnicode = _dereq_('../../lib/html2unicode'); -var str2RGBArray = _dereq_('../../lib/str2rgbarray'); + if(thisIcon.transform) { + path.setAttribute('transform', thisIcon.transform); + } + else if(thisIcon.ascent !== undefined) { + // Legacy icon transform calculation + path.setAttribute('transform', 'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')'); + } -function Axes2DOptions(scene) { - this.scene = scene; - this.gl = scene.gl; - this.pixelRatio = scene.pixelRatio; + icon.appendChild(path); + } - this.screenBox = [0, 0, 1, 1]; - this.viewBox = [0, 0, 1, 1]; - this.dataBox = [-1, -1, 1, 1]; + if(thisIcon.svg) { + var svgDoc = Parser.parseFromString(thisIcon.svg, 'application/xml'); + icon = svgDoc.childNodes[0]; + } - this.borderLineEnable = [false, false, false, false]; - this.borderLineWidth = [1, 1, 1, 1]; - this.borderLineColor = [ - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1] - ]; + icon.setAttribute('height', '1em'); + icon.setAttribute('width', '1em'); - this.ticks = [[], []]; - this.tickEnable = [true, true, false, false]; - this.tickPad = [15, 15, 15, 15]; - this.tickAngle = [0, 0, 0, 0]; - this.tickColor = [ - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1] - ]; - this.tickMarkLength = [0, 0, 0, 0]; - this.tickMarkWidth = [0, 0, 0, 0]; - this.tickMarkColor = [ - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1] - ]; + return icon; +}; - this.labels = ['x', 'y']; - this.labelEnable = [true, true, false, false]; - this.labelAngle = [0, Math.PI / 2, 0, 3.0 * Math.PI / 2]; - this.labelPad = [15, 15, 15, 15]; - this.labelSize = [12, 12]; - this.labelFont = ['sans-serif', 'sans-serif']; - this.labelColor = [ - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1] - ]; +/** + * Updates active button with attribute specified in layout + * @Param {object} graphInfo plot object containing data and layout + * @Return {HTMLelement} + */ +proto.updateActiveButton = function(buttonClicked) { + var fullLayout = this.graphInfo._fullLayout; + var dataAttrClicked = (buttonClicked !== undefined) ? + buttonClicked.getAttribute('data-attr') : + null; - this.title = ''; - this.titleEnable = true; - this.titleCenter = [0, 0, 0, 0]; - this.titleAngle = 0; - this.titleColor = [0, 0, 0, 1]; - this.titleFont = 'sans-serif'; - this.titleSize = 18; - - this.gridLineEnable = [true, true]; - this.gridLineColor = [ - [0, 0, 0, 0.5], - [0, 0, 0, 0.5] - ]; - this.gridLineWidth = [1, 1]; + 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); - this.zeroLineEnable = [true, true]; - this.zeroLineWidth = [1, 1]; - this.zeroLineColor = [ - [0, 0, 0, 1], - [0, 0, 0, 1] - ]; + // Use 'data-toggle' and 'buttonClicked' to toggle buttons + // that have no one-to-one equivalent in fullLayout + if(isToggleButton) { + if(dataAttr === dataAttrClicked) { + button3.classed('active', !button3.classed('active')); + } + } + else { + var val = (dataAttr === null) ? + dataAttr : + Lib.nestedProperty(fullLayout, dataAttr).get(); - this.borderColor = false; - this.backgroundColor = [0, 0, 0, 0]; + button3.classed('active', val === thisval); + } - this.static = this.scene.staticPlot; -} + }); +}; -var proto = Axes2DOptions.prototype; +/** + * Check if modeBar is configured as button configuration argument + * + * @Param {object} buttons 2d array of grouped button config objects + * @Return {boolean} + */ +proto.hasButtons = function(buttons) { + var currentButtons = this.buttons; -var AXES = ['xaxis', 'yaxis']; + if(!currentButtons) return false; -proto.merge = function(options) { + if(buttons.length !== currentButtons.length) return false; - // titles are rendered in SVG - this.titleEnable = false; - this.backgroundColor = str2RGBArray(options.plot_bgcolor); + 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; + } + } - var axisName, ax, axTitle, axMirror; - var hasAxisInDfltPos, hasAxisInAltrPos, hasSharedAxis, mirrorLines, mirrorTicks; - var i, j; + return true; +}; - for(i = 0; i < 2; ++i) { - axisName = AXES[i]; - var axisLetter = axisName.charAt(0); +/** + * @return {HTMLDivElement} The logo image wrapped in a group + */ +proto.getLogo = function() { + var group = this.createGroup(); + var a = document.createElement('a'); - // get options relevant to this subplot, - // '_name' is e.g. xaxis, xaxis2, yaxis, yaxis4 ... - ax = options[this.scene[axisName]._name]; + a.href = 'https://plot.ly/'; + a.target = '_blank'; + a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly')); + a.className = 'modebar-btn plotlyjsicon modebar-btn--logo'; - axTitle = ax.title === this.scene.fullLayout._dfltTitle[axisLetter] ? '' : ax.title; + a.appendChild(this.createIcon(Icons.newplotlylogo)); - for(j = 0; j <= 2; j += 2) { - this.labelEnable[i + j] = false; - this.labels[i + j] = convertHTMLToUnicode(axTitle); - this.labelColor[i + j] = str2RGBArray(ax.titlefont.color); - this.labelFont[i + j] = ax.titlefont.family; - this.labelSize[i + j] = ax.titlefont.size; - this.labelPad[i + j] = this.getLabelPad(axisName, ax); + group.appendChild(a); + return group; +}; - this.tickEnable[i + j] = false; - this.tickColor[i + j] = str2RGBArray((ax.tickfont || {}).color); - this.tickAngle[i + j] = (ax.tickangle === 'auto') ? - 0 : - Math.PI * -ax.tickangle / 180; - this.tickPad[i + j] = this.getTickPad(ax); +proto.removeAllButtons = function() { + while(this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + } - this.tickMarkLength[i + j] = 0; - this.tickMarkWidth[i + j] = ax.tickwidth || 0; - this.tickMarkColor[i + j] = str2RGBArray(ax.tickcolor); + this.hasLogo = false; +}; - this.borderLineEnable[i + j] = false; - this.borderLineColor[i + j] = str2RGBArray(ax.linecolor); - this.borderLineWidth[i + j] = ax.linewidth || 0; - } +proto.destroy = function() { + Lib.removeElement(this.container.querySelector('.modebar')); + Lib.deleteRelatedStyleRule(this._uid); +}; - hasSharedAxis = this.hasSharedAxis(ax); - hasAxisInDfltPos = this.hasAxisInDfltPos(axisName, ax) && !hasSharedAxis; - hasAxisInAltrPos = this.hasAxisInAltrPos(axisName, ax) && !hasSharedAxis; +function createModeBar(gd, buttons) { + var fullLayout = gd._fullLayout; - axMirror = ax.mirror || false; - mirrorLines = hasSharedAxis ? - (String(axMirror).indexOf('all') !== -1) : // 'all' or 'allticks' - !!axMirror; // all but false - mirrorTicks = hasSharedAxis ? - (axMirror === 'allticks') : - (String(axMirror).indexOf('ticks') !== -1); // 'ticks' or 'allticks' + var modeBar = new ModeBar({ + graphInfo: gd, + container: fullLayout._paperdiv.node(), + buttons: buttons + }); - // Axis titles and tick labels can only appear of one side of the scene - // and are never show on subplots that share existing axes. + if(fullLayout._privateplot) { + d3.select(modeBar.element).append('span') + .classed('badge-private float--left', true) + .text('PRIVATE'); + } - if(hasAxisInDfltPos) this.labelEnable[i] = true; - else if(hasAxisInAltrPos) this.labelEnable[i + 2] = true; + return modeBar; +} - if(hasAxisInDfltPos) this.tickEnable[i] = ax.showticklabels; - else if(hasAxisInAltrPos) this.tickEnable[i + 2] = ax.showticklabels; +module.exports = createModeBar; - // Grid lines and ticks can appear on both sides of the scene - // and can appear on subplot that share existing axes via `ax.mirror`. +},{"../../../build/ploticon":2,"../../lib":159,"d3":8,"fast-isnumeric":10}],105:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(hasAxisInDfltPos || mirrorLines) this.borderLineEnable[i] = ax.showline; - if(hasAxisInAltrPos || mirrorLines) this.borderLineEnable[i + 2] = ax.showline; +'use strict'; - if(hasAxisInDfltPos || mirrorTicks) this.tickMarkLength[i] = this.getTickMarkLength(ax); - if(hasAxisInAltrPos || mirrorTicks) this.tickMarkLength[i + 2] = this.getTickMarkLength(ax); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var colorAttrs = _dereq_('../color/attributes'); +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - this.gridLineEnable[i] = ax.showgrid; - this.gridLineColor[i] = str2RGBArray(ax.gridcolor); - this.gridLineWidth[i] = ax.gridwidth; +var buttonAttrs = templatedArray('button', { + visible: { + valType: 'boolean', + + dflt: true, + editType: 'plot', + + }, + step: { + valType: 'enumerated', + + values: ['month', 'year', 'day', 'hour', 'minute', 'second', 'all'], + dflt: 'month', + editType: 'plot', + + }, + stepmode: { + valType: 'enumerated', + + values: ['backward', 'todate'], + dflt: 'backward', + editType: 'plot', + + }, + count: { + valType: 'number', + + min: 0, + dflt: 1, + editType: 'plot', + + }, + label: { + valType: 'string', + + editType: 'plot', + + }, + editType: 'plot', + +}); - this.zeroLineEnable[i] = ax.zeroline; - this.zeroLineColor[i] = str2RGBArray(ax.zerolinecolor); - this.zeroLineWidth[i] = ax.zerolinewidth; - } -}; +module.exports = { + visible: { + valType: 'boolean', + + editType: 'plot', + + }, -// is an axis shared with an already-drawn subplot ? -proto.hasSharedAxis = function(ax) { - var scene = this.scene; - var subplotIds = scene.fullLayout._subplots.gl2d; - var list = Axes.findSubplotsWithAxis(subplotIds, ax); + buttons: buttonAttrs, - // if index === 0, then the subplot is already drawn as subplots - // are drawn in order. - return (list.indexOf(scene.id) !== 0); -}; + x: { + valType: 'number', + min: -2, + max: 3, + + editType: 'plot', + + }, + xanchor: { + valType: 'enumerated', + values: ['auto', 'left', 'center', 'right'], + dflt: 'left', + + editType: 'plot', + + }, + y: { + valType: 'number', + min: -2, + max: 3, + + editType: 'plot', + + }, + yanchor: { + valType: 'enumerated', + values: ['auto', 'top', 'middle', 'bottom'], + dflt: 'bottom', + + editType: 'plot', + + }, -// has an axis in default position (i.e. bottom/left) ? -proto.hasAxisInDfltPos = function(axisName, ax) { - var axSide = ax.side; + font: fontAttrs({ + editType: 'plot', + + }), - if(axisName === 'xaxis') return (axSide === 'bottom'); - else if(axisName === 'yaxis') return (axSide === 'left'); + bgcolor: { + valType: 'color', + dflt: colorAttrs.lightLine, + + editType: 'plot', + + }, + activecolor: { + valType: 'color', + + editType: 'plot', + + }, + bordercolor: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'plot', + + }, + borderwidth: { + valType: 'number', + min: 0, + dflt: 0, + + editType: 'plot', + + }, + editType: 'plot' }; -// has an axis in alternate position (i.e. top/right) ? -proto.hasAxisInAltrPos = function(axisName, ax) { - var axSide = ax.side; +},{"../../plot_api/plot_template":193,"../../plots/font_attributes":230,"../color/attributes":42}],106:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(axisName === 'xaxis') return (axSide === 'top'); - else if(axisName === 'yaxis') return (axSide === 'right'); -}; +'use strict'; -proto.getLabelPad = function(axisName, ax) { - var offsetBase = 1.5, - fontSize = ax.titlefont.size, - showticklabels = ax.showticklabels; - if(axisName === 'xaxis') { - return (ax.side === 'top') ? - -10 + fontSize * (offsetBase + (showticklabels ? 1 : 0)) : - -10 + fontSize * (offsetBase + (showticklabels ? 0.5 : 0)); - } - else if(axisName === 'yaxis') { - return (ax.side === 'right') ? - 10 + fontSize * (offsetBase + (showticklabels ? 1 : 0.5)) : - 10 + fontSize * (offsetBase + (showticklabels ? 0.5 : 0)); - } -}; +module.exports = { -proto.getTickPad = function(ax) { - return (ax.ticks === 'outside') ? 10 + ax.ticklen : 15; -}; + // 'y' position pad above counter axis domain + yPad: 0.02, -proto.getTickMarkLength = function(ax) { - if(!ax.ticks) return 0; + // minimum button width (regardless of text size) + minButtonWidth: 30, - var ticklen = ax.ticklen; + // buttons rect radii + rx: 3, + ry: 3, - return (ax.ticks === 'inside') ? -ticklen : ticklen; + // light fraction used to compute the 'activecolor' default + lightAmount: 25, + darkAmount: 10 }; - -function createAxes2D(scene) { - return new Axes2DOptions(scene); -} - -module.exports = createAxes2D; - -},{"../../lib/html2unicode":694,"../../lib/str2rgbarray":719,"../cartesian/axes":744}],784:[function(_dereq_,module,exports){ +},{}],107:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; - -var Scene2D = _dereq_('./scene2d'); -var layoutGlobalAttrs = _dereq_('../layout_attributes'); -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); -var constants = _dereq_('../cartesian/constants'); -var Cartesian = _dereq_('../cartesian'); -var fxAttrs = _dereq_('../../components/fx/layout_attributes'); -var getSubplotData = _dereq_('../get_data').getSubplotData; - -exports.name = 'gl2d'; - -exports.attr = ['xaxis', 'yaxis']; - -exports.idRoot = ['x', 'y']; +var Lib = _dereq_('../../lib'); +var Color = _dereq_('../color'); +var Template = _dereq_('../../plot_api/plot_template'); +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); -exports.idRegex = constants.idRegex; +var attributes = _dereq_('./attributes'); +var constants = _dereq_('./constants'); -exports.attrRegex = constants.attrRegex; -exports.attributes = _dereq_('../cartesian/attributes'); +module.exports = function handleDefaults(containerIn, containerOut, layout, counterAxes, calendar) { + var selectorIn = containerIn.rangeselector || {}; + var selectorOut = Template.newContainer(containerOut, 'rangeselector'); -exports.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) { - if(!layoutOut._has('cartesian')) { - Cartesian.supplyLayoutDefaults(layoutIn, layoutOut, fullData); + function coerce(attr, dflt) { + return Lib.coerce(selectorIn, selectorOut, attributes, attr, dflt); } -}; -// gl2d uses svg axis attributes verbatim, but overrides editType -// this could potentially be just `layoutAttributes` but it would -// still need special handling somewhere to give it precedence over -// the svg version when both are in use on one plot -exports.layoutAttrOverrides = overrideAll(Cartesian.layoutAttributes, 'plot', 'from-root'); - -// similar overrides for base plot attributes (and those added by components) -exports.baseLayoutAttrOverrides = overrideAll({ - plot_bgcolor: layoutGlobalAttrs.plot_bgcolor, - hoverlabel: fxAttrs.hoverlabel - // dragmode needs calc but only when transitioning TO lasso or select - // so for now it's left inside _relayout - // dragmode: fxAttrs.dragmode -}, 'plot', 'nested'); + var buttons = handleArrayContainerDefaults(selectorIn, selectorOut, { + name: 'buttons', + handleItemDefaults: buttonDefaults, + calendar: calendar + }); -exports.plot = function plotGl2d(gd) { - var fullLayout = gd._fullLayout; - var fullData = gd._fullData; - var subplotIds = fullLayout._subplots.gl2d; + 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']); - for(var i = 0; i < subplotIds.length; i++) { - var subplotId = subplotIds[i], - subplotObj = fullLayout._plots[subplotId], - fullSubplotData = getSubplotData(fullData, 'gl2d', subplotId); - - // ref. to corresp. Scene instance - var scene = subplotObj._scene2d; - - // If Scene is not instantiated, create one! - if(scene === undefined) { - scene = new Scene2D({ - id: subplotId, - graphDiv: gd, - container: gd.querySelector('.gl-container'), - staticPlot: gd._context.staticPlot, - plotGlPixelRatio: gd._context.plotGlPixelRatio - }, - fullLayout - ); + coerce('xanchor'); + coerce('yanchor'); - // set ref to Scene instance - subplotObj._scene2d = scene; - } + Lib.coerceFont(coerce, 'font', layout.font); - scene.plot(fullSubplotData, gd.calcdata, fullLayout, gd.layout); + var bgColor = coerce('bgcolor'); + coerce('activecolor', Color.contrast(bgColor, constants.lightAmount, constants.darkAmount)); + coerce('bordercolor'); + coerce('borderwidth'); } }; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldSceneKeys = oldFullLayout._subplots.gl2d || []; - - for(var i = 0; i < oldSceneKeys.length; i++) { - var id = oldSceneKeys[i], - oldSubplot = oldFullLayout._plots[id]; - - // old subplot wasn't gl2d; nothing to do - if(!oldSubplot._scene2d) continue; - - // if no traces are present, delete gl2d subplot - var subplotData = getSubplotData(newFullData, 'gl2d', id); - if(subplotData.length === 0) { - oldSubplot._scene2d.destroy(); - delete oldFullLayout._plots[id]; - } - } - - // since we use cartesian interactions, do cartesian clean - Cartesian.clean.apply(this, arguments); -}; +function buttonDefaults(buttonIn, buttonOut, selectorOut, opts) { + var calendar = opts.calendar; -exports.drawFramework = function(gd) { - if(!gd._context.staticPlot) { - Cartesian.drawFramework(gd); + function coerce(attr, dflt) { + return Lib.coerce(buttonIn, buttonOut, attributes.buttons, attr, dflt); } -}; - -exports.toSVG = function(gd) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots.gl2d; - for(var i = 0; i < subplotIds.length; i++) { - var subplot = fullLayout._plots[subplotIds[i]], - scene = subplot._scene2d; + var visible = coerce('visible'); - var imageData = scene.toImage('png'); - var image = fullLayout._glimages.append('svg:image'); + if(visible) { + var step = coerce('step'); + if(step !== 'all') { + if(calendar && calendar !== 'gregorian' && (step === 'month' || step === 'year')) { + buttonOut.stepmode = 'backward'; + } + else { + coerce('stepmode'); + } - image.attr({ - xmlns: xmlnsNamespaces.svg, - 'xlink:href': imageData, - x: 0, - y: 0, - width: '100%', - height: '100%', - preserveAspectRatio: 'none' - }); + coerce('count'); + } - scene.destroy(); + coerce('label'); } -}; +} -exports.updateFx = function(gd) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots.gl2d; +function getPosDflt(containerOut, layout, counterAxes) { + var anchoredList = counterAxes.filter(function(ax) { + return layout[ax].anchor === containerOut._id; + }); - for(var i = 0; i < subplotIds.length; i++) { - var subplotObj = fullLayout._plots[subplotIds[i]]._scene2d; - subplotObj.updateFx(fullLayout.dragmode); + 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); } -}; -},{"../../components/fx/layout_attributes":613,"../../constants/xmlns_namespaces":674,"../../plot_api/edit_types":727,"../cartesian":756,"../cartesian/attributes":742,"../cartesian/constants":750,"../get_data":781,"../layout_attributes":799,"./scene2d":785}],785:[function(_dereq_,module,exports){ + return [containerOut.domain[0], posY + constants.yPad]; +} + +},{"../../lib":159,"../../plot_api/plot_template":193,"../../plots/array_container_defaults":199,"../color":43,"./attributes":105,"./constants":106}],108:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; +var d3 = _dereq_('d3'); + var Registry = _dereq_('../../registry'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Fx = _dereq_('../../components/fx'); +var Plots = _dereq_('../../plots/plots'); +var Color = _dereq_('../color'); +var Drawing = _dereq_('../drawing'); +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); -var createPlot2D = _dereq_('gl-plot2d'); -var createSpikes = _dereq_('gl-spikes2d'); -var createSelectBox = _dereq_('gl-select-box'); -var getContext = _dereq_('webgl-context'); - -var createOptions = _dereq_('./convert'); -var createCamera = _dereq_('./camera'); -var convertHTMLToUnicode = _dereq_('../../lib/html2unicode'); -var showNoWebGlMsg = _dereq_('../../lib/show_no_webgl_msg'); -var axisConstraints = _dereq_('../cartesian/constraints'); -var enforceAxisConstraints = axisConstraints.enforce; -var cleanAxisConstraints = axisConstraints.clean; -var doAutoRange = _dereq_('../cartesian/autorange').doAutoRange; +var alignmentConstants = _dereq_('../../constants/alignment'); +var LINE_SPACING = alignmentConstants.LINE_SPACING; +var FROM_TL = alignmentConstants.FROM_TL; +var FROM_BR = alignmentConstants.FROM_BR; -var AXES = ['xaxis', 'yaxis']; -var STATIC_CANVAS, STATIC_CONTEXT; +var constants = _dereq_('./constants'); +var getUpdateObject = _dereq_('./get_update_object'); -var SUBPLOT_PATTERN = _dereq_('../cartesian/constants').SUBPLOT_PATTERN; +module.exports = function draw(gd) { + var fullLayout = gd._fullLayout; -function Scene2D(options, fullLayout) { - this.container = options.container; - this.graphDiv = options.graphDiv; - this.pixelRatio = options.plotGlPixelRatio || window.devicePixelRatio; - this.id = options.id; - this.staticPlot = !!options.staticPlot; - this.scrollZoom = this.graphDiv._context.scrollZoom; + var selectors = fullLayout._infolayer.selectAll('.rangeselector') + .data(makeSelectorData(gd), selectorKeyFunc); - this.fullData = null; - this.updateRefs(fullLayout); + selectors.enter().append('g') + .classed('rangeselector', true); - this.makeFramework(); - if(this.stopped) return; + selectors.exit().remove(); - // update options - this.glplotOptions = createOptions(this); - this.glplotOptions.merge(fullLayout); + selectors.style({ + cursor: 'pointer', + 'pointer-events': 'all' + }); - // create the plot - this.glplot = createPlot2D(this.glplotOptions); + selectors.each(function(d) { + var selector = d3.select(this); + var axisLayout = d; + var selectorLayout = axisLayout.rangeselector; - // create camera - this.camera = createCamera(this); + var buttons = selector.selectAll('g.button') + .data(Lib.filterVisible(selectorLayout.buttons)); - // trace set - this.traces = {}; + buttons.enter().append('g') + .classed('button', true); - // create axes spikes - this.spikes = createSpikes(this.glplot); + buttons.exit().remove(); - this.selectBox = createSelectBox(this.glplot, { - innerFill: false, - outerFill: true - }); + buttons.each(function(d) { + var button = d3.select(this); + var update = getUpdateObject(axisLayout, d); - // last button state - this.lastButtonState = 0; + d._isActive = isActive(axisLayout, d, update); - // last pick result - this.pickResult = null; + button.call(drawButtonRect, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); - // is the mouse over the plot? - // it's OK if this says true when it's not, so long as - // when we get a mouseout we set it to false before handling - this.isMouseOver = true; + button.on('click', function() { + if(gd._dragged) return; - // flag to stop render loop - this.stopped = false; + Registry.call('_guiRelayout', gd, update); + }); - // redraw the plot - this.redraw = this.draw.bind(this); - this.redraw(); -} + button.on('mouseover', function() { + d._isHovered = true; + button.call(drawButtonRect, selectorLayout, d); + }); -module.exports = Scene2D; + button.on('mouseout', function() { + d._isHovered = false; + button.call(drawButtonRect, selectorLayout, d); + }); + }); -var proto = Scene2D.prototype; + reposition(gd, buttons, selectorLayout, axisLayout._name, selector); + }); -proto.makeFramework = function() { +}; - // create canvas and gl context - if(this.staticPlot) { - if(!STATIC_CONTEXT) { - STATIC_CANVAS = document.createElement('canvas'); +function makeSelectorData(gd) { + var axes = axisIds.list(gd, 'x', true); + var data = []; - STATIC_CONTEXT = getContext({ - canvas: STATIC_CANVAS, - preserveDrawingBuffer: false, - premultipliedAlpha: true, - antialias: true - }); + for(var i = 0; i < axes.length; i++) { + var axis = axes[i]; - if(!STATIC_CONTEXT) { - throw new Error('Error creating static canvas/context for image server'); - } + if(axis.rangeselector && axis.rangeselector.visible) { + data.push(axis); } + } + + return data; +} + +function selectorKeyFunc(d) { + return d._id; +} - this.canvas = STATIC_CANVAS; - this.gl = STATIC_CONTEXT; +function isActive(axisLayout, opts, update) { + if(opts.step === 'all') { + return axisLayout.autorange === true; } else { - var liveCanvas = this.container.querySelector('.gl-canvas-focus'); + var keys = Object.keys(update); - var gl = getContext({ - canvas: liveCanvas, - preserveDrawingBuffer: true, - premultipliedAlpha: true - }); + return ( + axisLayout.range[0] === update[keys[0]] && + axisLayout.range[1] === update[keys[1]] + ); + } +} - if(!gl) { - showNoWebGlMsg(this); - this.stopped = true; - return; - } +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; +} - this.canvas = liveCanvas; - this.gl = gl; +function drawButtonText(button, selectorLayout, d, gd) { + function textLayout(s) { + svgTextUtils.convertToTspans(s, gd); } - // position the canvas - var canvas = this.canvas; + var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { + s.classed('user-select-none', true) + .attr('text-anchor', 'middle'); + }); - canvas.style.width = '100%'; - canvas.style.height = '100%'; - canvas.style.position = 'absolute'; - canvas.style.top = '0px'; - canvas.style.left = '0px'; - canvas.style['pointer-events'] = 'none'; + text.call(Drawing.font, selectorLayout.font) + .text(getLabel(d)) + .call(textLayout); +} - this.updateSize(canvas); +function getLabel(opts) { + if(opts.label) return opts.label; - // disabling user select on the canvas - // sanitizes double-clicks interactions - // ref: https://github.com/plotly/plotly.js/issues/744 - canvas.className += ' user-select-none'; + if(opts.step === 'all') return 'all'; - // create SVG container for hover text - var svgContainer = this.svgContainer = document.createElementNS( - 'http://www.w3.org/2000/svg', - 'svg'); - svgContainer.style.position = 'absolute'; - svgContainer.style.top = svgContainer.style.left = '0px'; - svgContainer.style.width = svgContainer.style.height = '100%'; - svgContainer.style['z-index'] = 20; - svgContainer.style['pointer-events'] = 'none'; + return opts.count + opts.step.charAt(0); +} - // create div to catch the mouse event - var mouseContainer = this.mouseContainer = document.createElement('div'); - mouseContainer.style.position = 'absolute'; - mouseContainer.style['pointer-events'] = 'auto'; +function reposition(gd, buttons, opts, axName, selector) { + var width = 0; + var height = 0; - this.pickCanvas = this.container.querySelector('.gl-canvas-pick'); + var borderWidth = opts.borderwidth; + buttons.each(function() { + var button = d3.select(this); + var text = button.select('.selector-text'); - // append canvas, hover svg and mouse div to container - var container = this.container; - container.appendChild(svgContainer); - container.appendChild(mouseContainer); + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; - var self = this; - mouseContainer.addEventListener('mouseout', function() { - self.isMouseOver = false; - self.unhover(); - }); - mouseContainer.addEventListener('mouseover', function() { - self.isMouseOver = true; + height = Math.max(height, hEff); }); -}; -proto.toImage = function(format) { - if(!format) format = 'png'; + 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); - this.stopped = true; + var wEff = Math.max(tWidth + 10, constants.minButtonWidth); - if(this.staticPlot) this.container.appendChild(STATIC_CANVAS); + // TODO add MathJax support - // update canvas size - this.updateSize(this.canvas); + // TODO add buttongap attribute + button.attr('transform', 'translate(' + + (borderWidth + width) + ',' + borderWidth + + ')'); - // grab context and yank out pixels - var gl = this.glplot.gl, - w = gl.drawingBufferWidth, - h = gl.drawingBufferHeight; + rect.attr({ + x: 0, + y: 0, + width: wEff, + height: height + }); - // force redraw - gl.clearColor(1, 1, 1, 0); - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - this.glplot.setDirty(); - this.glplot.draw(); + svgTextUtils.positionText(text, wEff / 2, + height / 2 - ((tLines - 1) * tHeight / 2) + 3); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); + width += wEff + 5; + }); - var pixels = new Uint8Array(w * h * 4); - gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + var graphSize = gd._fullLayout._size; + var lx = graphSize.l + graphSize.w * opts.x; + var ly = graphSize.t + graphSize.h * (1 - opts.y); - // flip pixels - for(var j = 0, k = h - 1; j < k; ++j, --k) { - for(var i = 0; i < w; ++i) { - for(var l = 0; l < 4; ++l) { - var tmp = pixels[4 * (w * j + i) + l]; - pixels[4 * (w * j + i) + l] = pixels[4 * (w * k + i) + l]; - pixels[4 * (w * k + i) + l] = tmp; - } - } + 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'; } - var canvas = document.createElement('canvas'); - canvas.width = w; - canvas.height = h; + width = Math.ceil(width); + height = Math.ceil(height); + lx = Math.round(lx); + ly = Math.round(ly); - var context = canvas.getContext('2d'); - var imageData = context.createImageData(w, h); - imageData.data.set(pixels); - context.putImageData(imageData, 0, 0); + Plots.autoMargin(gd, 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] + }); - var dataURL; + selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); +} - switch(format) { - case 'jpeg': - dataURL = canvas.toDataURL('image/jpeg'); - break; - case 'webp': - dataURL = canvas.toDataURL('image/webp'); - break; - default: - dataURL = canvas.toDataURL('image/png'); - } +},{"../../constants/alignment":138,"../../lib":159,"../../lib/svg_text_utils":180,"../../plots/cartesian/axis_ids":206,"../../plots/plots":236,"../../registry":243,"../color":43,"../drawing":64,"./constants":106,"./get_update_object":109,"d3":8}],109:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(this.staticPlot) this.container.removeChild(STATIC_CANVAS); - return dataURL; -}; +'use strict'; -proto.updateSize = function(canvas) { - if(!canvas) canvas = this.canvas; +var d3 = _dereq_('d3'); - var pixelRatio = this.pixelRatio, - fullLayout = this.fullLayout; +module.exports = function getUpdateObject(axisLayout, buttonLayout) { + var axName = axisLayout._name; + var update = {}; - var width = fullLayout.width, - height = fullLayout.height, - pixelWidth = Math.ceil(pixelRatio * width) |0, - pixelHeight = Math.ceil(pixelRatio * height) |0; + if(buttonLayout.step === 'all') { + update[axName + '.autorange'] = true; + } + else { + var xrange = getXRange(axisLayout, buttonLayout); - // check for resize - if(canvas.width !== pixelWidth || canvas.height !== pixelHeight) { - canvas.width = pixelWidth; - canvas.height = pixelHeight; + update[axName + '.range[0]'] = xrange[0]; + update[axName + '.range[1]'] = xrange[1]; } - return canvas; + return update; }; -proto.computeTickMarks = function() { - this.xaxis.setScale(); - this.yaxis.setScale(); +function getXRange(axisLayout, buttonLayout) { + var currentRange = axisLayout.range; + var base = new Date(axisLayout.r2l(currentRange[1])); + var step = buttonLayout.step; + var count = buttonLayout.count; + var range0; + + switch(buttonLayout.stepmode) { + case 'backward': + range0 = axisLayout.l2r(+d3.time[step].utc.offset(base, -count)); + break; - var nextTicks = [ - Axes.calcTicks(this.xaxis), - Axes.calcTicks(this.yaxis) - ]; + case 'todate': + var base2 = d3.time[step].utc.offset(base, -count); - for(var j = 0; j < 2; ++j) { - for(var i = 0; i < nextTicks[j].length; ++i) { - // coercing tick value (may not be a string) to a string - nextTicks[j][i].text = convertHTMLToUnicode(nextTicks[j][i].text + ''); - } + range0 = axisLayout.l2r(+d3.time[step].utc.ceil(base2)); + break; } - return nextTicks; -}; + var range1 = currentRange[1]; -function compareTicks(a, b) { - for(var i = 0; i < 2; ++i) { - var aticks = a[i], - bticks = b[i]; + return [range0, range1]; +} - if(aticks.length !== bticks.length) return true; +},{"d3":8}],110:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(var j = 0; j < aticks.length; ++j) { - if(aticks[j].x !== bticks[j].x) return true; - } - } +'use strict'; - return false; -} +module.exports = { + moduleType: 'component', + name: 'rangeselector', -proto.updateRefs = function(newFullLayout) { - this.fullLayout = newFullLayout; + schema: { + subplots: { + xaxis: {rangeselector: _dereq_('./attributes')} + } + }, - var spmatch = this.id.match(SUBPLOT_PATTERN); - var xaxisName = 'xaxis' + spmatch[1]; - var yaxisName = 'yaxis' + spmatch[2]; + layoutAttributes: _dereq_('./attributes'), + handleDefaults: _dereq_('./defaults'), - this.xaxis = this.fullLayout[xaxisName]; - this.yaxis = this.fullLayout[yaxisName]; + draw: _dereq_('./draw') }; -proto.relayoutCallback = function() { - var graphDiv = this.graphDiv, - xaxis = this.xaxis, - yaxis = this.yaxis, - layout = graphDiv.layout; - - // update user layout - layout.xaxis.autorange = xaxis.autorange; - layout.xaxis.range = xaxis.range.slice(0); - layout.yaxis.autorange = yaxis.autorange; - layout.yaxis.range = yaxis.range.slice(0); +},{"./attributes":105,"./defaults":107,"./draw":108}],111:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // make a meaningful value to be passed on to the possible 'plotly_relayout' subscriber(s) - // scene.camera has no many useful projection or scale information - // helps determine which one is the latest input (if async) - var update = { - lastInputTime: this.camera.lastInputTime - }; +'use strict'; - update[xaxis._name] = xaxis.range.slice(0); - update[yaxis._name] = yaxis.range.slice(0); +var colorAttributes = _dereq_('../color/attributes'); - graphDiv.emit('plotly_relayout', update); +module.exports = { + bgcolor: { + valType: 'color', + dflt: colorAttributes.background, + + editType: 'plot', + + }, + bordercolor: { + valType: 'color', + dflt: colorAttributes.defaultLine, + + editType: 'plot', + + }, + borderwidth: { + valType: 'integer', + dflt: 0, + min: 0, + + editType: 'plot', + + }, + autorange: { + valType: 'boolean', + dflt: true, + + editType: 'calc', + impliedEdits: {'range[0]': undefined, 'range[1]': undefined}, + + }, + range: { + valType: 'info_array', + + items: [ + {valType: 'any', editType: 'calc', impliedEdits: {'^autorange': false}}, + {valType: 'any', editType: 'calc', impliedEdits: {'^autorange': false}} + ], + editType: 'calc', + impliedEdits: {'autorange': false}, + + }, + thickness: { + valType: 'number', + dflt: 0.15, + min: 0, + max: 1, + + editType: 'plot', + + }, + visible: { + valType: 'boolean', + dflt: true, + + editType: 'calc', + + }, + editType: 'calc' }; -proto.cameraChanged = function() { - var camera = this.camera; +},{"../color/attributes":42}],112:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - this.glplot.setDataBox(this.calcDataBox()); +'use strict'; - var nextTicks = this.computeTickMarks(); - var curTicks = this.glplotOptions.ticks; +var listAxes = _dereq_('../../plots/cartesian/axis_ids').list; +var getAutoRange = _dereq_('../../plots/cartesian/autorange').getAutoRange; +var constants = _dereq_('./constants'); - if(compareTicks(nextTicks, curTicks)) { - this.glplotOptions.ticks = nextTicks; - this.glplotOptions.dataBox = camera.dataBox; - this.glplot.update(this.glplotOptions); - this.handleAnnotations(); - } -}; +module.exports = function calcAutorange(gd) { + var axes = listAxes(gd, 'x', true); -proto.handleAnnotations = function() { - var gd = this.graphDiv, - annotations = this.fullLayout.annotations; + // Compute new slider range using axis autorange if necessary. + // + // Copy back range to input range slider container to skip + // this step in subsequent draw calls. - for(var i = 0; i < annotations.length; i++) { - var ann = annotations[i]; + for(var i = 0; i < axes.length; i++) { + var ax = axes[i]; + var opts = ax[constants.name]; - if(ann.xref === this.xaxis._id && ann.yref === this.yaxis._id) { - Registry.getComponentMethod('annotations', 'drawOne')(gd, i); + if(opts && opts.visible && opts.autorange) { + opts._input.autorange = true; + opts._input.range = opts.range = getAutoRange(gd, ax); } } }; -proto.destroy = function() { - if(!this.glplot) return; - - var traces = this.traces; - - if(traces) { - Object.keys(traces).map(function(key) { - traces[key].dispose(); - delete traces[key]; - }); - } - - this.glplot.dispose(); - - this.container.removeChild(this.svgContainer); - this.container.removeChild(this.mouseContainer); - - this.fullData = null; - this.glplot = null; - this.stopped = true; - this.camera.mouseListener.enabled = false; - this.mouseContainer.removeEventListener('wheel', this.camera.wheelListener); - this.camera = null; -}; - -proto.plot = function(fullData, calcData, fullLayout) { - var glplot = this.glplot; - - this.updateRefs(fullLayout); - this.xaxis.clearCalc(); - this.yaxis.clearCalc(); - this.updateTraces(fullData, calcData); - this.updateFx(fullLayout.dragmode); - - var width = fullLayout.width, - height = fullLayout.height; - - this.updateSize(this.canvas); - - var options = this.glplotOptions; - options.merge(fullLayout); - options.screenBox = [0, 0, width, height]; - - var mockGraphDiv = {_fullLayout: { - _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, - xaxis: this.xaxis, - yaxis: this.yaxis - }}; - - cleanAxisConstraints(mockGraphDiv, this.xaxis); - cleanAxisConstraints(mockGraphDiv, this.yaxis); +},{"../../plots/cartesian/autorange":202,"../../plots/cartesian/axis_ids":206,"./constants":113}],113:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var size = fullLayout._size, - domainX = this.xaxis.domain, - domainY = this.yaxis.domain; +'use strict'; - options.viewBox = [ - size.l + domainX[0] * size.w, - size.b + domainY[0] * size.h, - (width - size.r) - (1 - domainX[1]) * size.w, - (height - size.t) - (1 - domainY[1]) * size.h - ]; +module.exports = { - this.mouseContainer.style.width = size.w * (domainX[1] - domainX[0]) + 'px'; - this.mouseContainer.style.height = size.h * (domainY[1] - domainY[0]) + 'px'; - this.mouseContainer.height = size.h * (domainY[1] - domainY[0]); - this.mouseContainer.style.left = size.l + domainX[0] * size.w + 'px'; - this.mouseContainer.style.top = size.t + (1 - domainY[1]) * size.h + 'px'; + // attribute container name + name: 'rangeslider', - var ax, i; + // class names - for(i = 0; i < 2; ++i) { - ax = this[AXES[i]]; - ax._length = options.viewBox[i + 2] - options.viewBox[i]; + containerClassName: 'rangeslider-container', + bgClassName: 'rangeslider-bg', + rangePlotClassName: 'rangeslider-rangeplot', - doAutoRange(this.graphDiv, ax); - ax.setScale(); - } + maskMinClassName: 'rangeslider-mask-min', + maskMaxClassName: 'rangeslider-mask-max', + slideBoxClassName: 'rangeslider-slidebox', - enforceAxisConstraints(mockGraphDiv); + grabberMinClassName: 'rangeslider-grabber-min', + grabAreaMinClassName: 'rangeslider-grabarea-min', + handleMinClassName: 'rangeslider-handle-min', - options.ticks = this.computeTickMarks(); + grabberMaxClassName: 'rangeslider-grabber-max', + grabAreaMaxClassName: 'rangeslider-grabarea-max', + handleMaxClassName: 'rangeslider-handle-max', - options.dataBox = this.calcDataBox(); + maskMinOppAxisClassName: 'rangeslider-mask-min-opp-axis', + maskMaxOppAxisClassName: 'rangeslider-mask-max-opp-axis', - options.merge(fullLayout); - glplot.update(options); + // style constants - // force redraw so that promise is returned when rendering is completed - this.glplot.draw(); -}; + maskColor: 'rgba(0,0,0,0.4)', + maskOppAxisColor: 'rgba(0,0,0,0.2)', -proto.calcDataBox = function() { - var xaxis = this.xaxis, - yaxis = this.yaxis, - xrange = xaxis.range, - yrange = yaxis.range, - xr2l = xaxis.r2l, - yr2l = yaxis.r2l; + slideBoxFill: 'transparent', + slideBoxCursor: 'ew-resize', - return [xr2l(xrange[0]), yr2l(yrange[0]), xr2l(xrange[1]), yr2l(yrange[1])]; -}; + grabAreaFill: 'transparent', + grabAreaCursor: 'col-resize', + grabAreaWidth: 10, -proto.setRanges = function(dataBox) { - var xaxis = this.xaxis, - yaxis = this.yaxis, - xl2r = xaxis.l2r, - yl2r = yaxis.l2r; + handleWidth: 4, + handleRadius: 1, + handleStrokeWidth: 1, - xaxis.range = [xl2r(dataBox[0]), xl2r(dataBox[2])]; - yaxis.range = [yl2r(dataBox[1]), yl2r(dataBox[3])]; + extraPad: 15 }; -proto.updateTraces = function(fullData, calcData) { - var traceIds = Object.keys(this.traces); - var i, j, fullTrace; - - this.fullData = fullData; +},{}],114:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // remove empty traces - trace_id_loop: - for(i = 0; i < traceIds.length; i++) { - var oldUid = traceIds[i], - oldTrace = this.traces[oldUid]; +'use strict'; - for(j = 0; j < fullData.length; j++) { - fullTrace = fullData[j]; +var Lib = _dereq_('../../lib'); +var Template = _dereq_('../../plot_api/plot_template'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); - if(fullTrace.uid === oldUid && fullTrace.type === oldTrace.type) { - continue trace_id_loop; - } - } +var attributes = _dereq_('./attributes'); +var oppAxisAttrs = _dereq_('./oppaxis_attributes'); - oldTrace.dispose(); - delete this.traces[oldUid]; - } +module.exports = function handleDefaults(layoutIn, layoutOut, axName) { + var axIn = layoutIn[axName]; + var axOut = layoutOut[axName]; - // update / create trace objects - for(i = 0; i < fullData.length; i++) { - fullTrace = fullData[i]; - var calcTrace = calcData[i], - traceObj = this.traces[fullTrace.uid]; + if(!(axIn.rangeslider || layoutOut._requestRangeslider[axOut._id])) return; - if(traceObj) traceObj.update(fullTrace, calcTrace); - else { - traceObj = fullTrace._module.plot(this, fullTrace, calcTrace); - this.traces[fullTrace.uid] = traceObj; - } + // not super proud of this (maybe store _ in axis object instead + if(!Lib.isPlainObject(axIn.rangeslider)) { + axIn.rangeslider = {}; } - // order object per traces - this.glplot.objects.sort(function(a, b) { - return a._trace.index - b._trace.index; - }); -}; - -proto.updateFx = function(dragmode) { - // switch to svg interactions in lasso/select mode - if(dragmode === 'lasso' || dragmode === 'select') { - this.pickCanvas.style['pointer-events'] = 'none'; - this.mouseContainer.style['pointer-events'] = 'none'; - } else { - this.pickCanvas.style['pointer-events'] = 'auto'; - this.mouseContainer.style['pointer-events'] = 'auto'; - } + var containerIn = axIn.rangeslider; + var containerOut = Template.newContainer(axOut, 'rangeslider'); - // set proper cursor - if(dragmode === 'pan') { - this.mouseContainer.style.cursor = 'move'; - } - else if(dragmode === 'zoom') { - this.mouseContainer.style.cursor = 'crosshair'; - } - else { - this.mouseContainer.style.cursor = null; + function coerce(attr, dflt) { + return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); } -}; - -proto.emitPointAction = function(nextSelection, eventType) { - var uid = nextSelection.trace.uid; - var ptNumber = nextSelection.pointIndex; - var trace; - for(var i = 0; i < this.fullData.length; i++) { - if(this.fullData[i].uid === uid) { - trace = this.fullData[i]; - } + var rangeContainerIn, rangeContainerOut; + function coerceRange(attr, dflt) { + return Lib.coerce(rangeContainerIn, rangeContainerOut, oppAxisAttrs, attr, dflt); } - var pointData = { - x: nextSelection.traceCoord[0], - y: nextSelection.traceCoord[1], - curveNumber: trace.index, - pointNumber: ptNumber, - data: trace._input, - fullData: this.fullData, - xaxis: this.xaxis, - yaxis: this.yaxis - }; - - Fx.appendArrayPointValue(pointData, trace, ptNumber); - - this.graphDiv.emit(eventType, {points: [pointData]}); -}; - -proto.draw = function() { - if(this.stopped) return; - - requestAnimationFrame(this.redraw); - - var glplot = this.glplot, - camera = this.camera, - mouseListener = camera.mouseListener, - mouseUp = this.lastButtonState === 1 && mouseListener.buttons === 0, - fullLayout = this.fullLayout; - - this.lastButtonState = mouseListener.buttons; + var visible = coerce('visible'); + if(!visible) return; - this.cameraChanged(); + coerce('bgcolor', layoutOut.plot_bgcolor); + coerce('bordercolor'); + coerce('borderwidth'); + coerce('thickness'); - var x = mouseListener.x * glplot.pixelRatio; - var y = this.canvas.height - glplot.pixelRatio * mouseListener.y; + coerce('autorange', !axOut.isValidRange(containerIn.range)); + coerce('range'); - var result; + 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]; - if(camera.boxEnabled && fullLayout.dragmode === 'zoom') { - this.selectBox.enabled = true; + rangeContainerIn = containerIn[yName] || {}; + rangeContainerOut = Template.newContainer(containerOut, yName, 'yaxis'); - var selectBox = this.selectBox.selectBox = [ - Math.min(camera.boxStart[0], camera.boxEnd[0]), - Math.min(camera.boxStart[1], camera.boxEnd[1]), - Math.max(camera.boxStart[0], camera.boxEnd[0]), - Math.max(camera.boxStart[1], camera.boxEnd[1]) - ]; + var yAxOut = layoutOut[yName]; - // 1D zoom - for(var i = 0; i < 2; i++) { - if(camera.boxStart[i] === camera.boxEnd[i]) { - selectBox[i] = glplot.dataBox[i]; - selectBox[i + 2] = glplot.dataBox[i + 2]; + var rangemodeDflt; + if(rangeContainerIn.range && yAxOut.isValidRange(rangeContainerIn.range)) { + rangemodeDflt = 'fixed'; } - } - - glplot.setDirty(); - } - else if(!camera.panning && this.isMouseOver) { - this.selectBox.enabled = false; - - var size = fullLayout._size, - domainX = this.xaxis.domain, - domainY = this.yaxis.domain; - - result = glplot.pick( - (x / glplot.pixelRatio) + size.l + domainX[0] * size.w, - (y / glplot.pixelRatio) - (size.t + (1 - domainY[1]) * size.h) - ); - - var nextSelection = result && result.object._trace.handlePick(result); - - if(nextSelection && mouseUp) { - this.emitPointAction(nextSelection, 'plotly_click'); - } - - if(result && result.object._trace.hoverinfo !== 'skip' && fullLayout.hovermode) { - - if(nextSelection && ( - !this.lastPickResult || - this.lastPickResult.traceUid !== nextSelection.trace.uid || - this.lastPickResult.dataCoord[0] !== nextSelection.dataCoord[0] || - this.lastPickResult.dataCoord[1] !== nextSelection.dataCoord[1]) - ) { - var selection = nextSelection; - this.lastPickResult = { - traceUid: nextSelection.trace ? nextSelection.trace.uid : null, - dataCoord: nextSelection.dataCoord.slice() - }; - this.spikes.update({ center: result.dataCoord }); - - selection.screenCoord = [ - ((glplot.viewBox[2] - glplot.viewBox[0]) * - (result.dataCoord[0] - glplot.dataBox[0]) / - (glplot.dataBox[2] - glplot.dataBox[0]) + glplot.viewBox[0]) / - glplot.pixelRatio, - (this.canvas.height - (glplot.viewBox[3] - glplot.viewBox[1]) * - (result.dataCoord[1] - glplot.dataBox[1]) / - (glplot.dataBox[3] - glplot.dataBox[1]) - glplot.viewBox[1]) / - glplot.pixelRatio - ]; - - // this needs to happen before the next block that deletes traceCoord data - // also it's important to copy, otherwise data is lost by the time event data is read - this.emitPointAction(nextSelection, 'plotly_hover'); - - var trace = this.fullData[selection.trace.index] || {}; - var ptNumber = selection.pointIndex; - var hoverinfo = Fx.castHoverinfo(trace, fullLayout, ptNumber); - - if(hoverinfo && hoverinfo !== 'all') { - var parts = hoverinfo.split('+'); - if(parts.indexOf('x') === -1) selection.traceCoord[0] = undefined; - if(parts.indexOf('y') === -1) selection.traceCoord[1] = undefined; - if(parts.indexOf('z') === -1) selection.traceCoord[2] = undefined; - if(parts.indexOf('text') === -1) selection.textLabel = undefined; - if(parts.indexOf('name') === -1) selection.name = undefined; - } - - Fx.loneHover({ - x: selection.screenCoord[0], - y: selection.screenCoord[1], - xLabel: this.hoverFormatter('xaxis', selection.traceCoord[0]), - yLabel: this.hoverFormatter('yaxis', selection.traceCoord[1]), - zLabel: selection.traceCoord[2], - text: selection.textLabel, - name: selection.name, - color: Fx.castHoverOption(trace, ptNumber, 'bgcolor') || selection.color, - borderColor: Fx.castHoverOption(trace, ptNumber, 'bordercolor'), - fontFamily: Fx.castHoverOption(trace, ptNumber, 'font.family'), - fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), - fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') - }, { - container: this.svgContainer, - gd: this.graphDiv - }); + var rangeMode = coerceRange('rangemode', rangemodeDflt); + if(rangeMode !== 'match') { + coerceRange('range', yAxOut.range.slice()); } } } - // Remove hover effects if we're not over a point OR - // if we're zooming or panning (in which case result is not set) - if(!result) { - this.unhover(); - } - - glplot.draw(); -}; - -proto.unhover = function() { - if(this.lastPickResult) { - this.spikes.update({}); - this.lastPickResult = null; - this.graphDiv.emit('plotly_unhover'); - Fx.loneUnhover(this.svgContainer); - } -}; - -proto.hoverFormatter = function(axisName, val) { - if(val === undefined) return undefined; - - var axis = this[axisName]; - return Axes.tickText(axis, axis.c2l(val), 'hover').text; + // to map back range slider (auto) range + containerOut._input = containerIn; }; -},{"../../components/fx":612,"../../lib/html2unicode":694,"../../lib/show_no_webgl_msg":717,"../../plots/cartesian/axes":744,"../../registry":827,"../cartesian/autorange":743,"../cartesian/constants":750,"../cartesian/constraints":752,"./camera":782,"./convert":783,"gl-plot2d":275,"gl-select-box":286,"gl-spikes2d":295,"webgl-context":533}],786:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plot_api/plot_template":193,"../../plots/cartesian/axis_ids":206,"./attributes":111,"./oppaxis_attributes":118}],115:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123624,2940 +28824,2194 @@ 'use strict'; -module.exports = createCamera; +var d3 = _dereq_('d3'); -var now = _dereq_('right-now'); -var createView = _dereq_('3d-view'); -var mouseChange = _dereq_('mouse-change'); -var mouseWheel = _dereq_('mouse-wheel'); -var mouseOffset = _dereq_('mouse-event-offset'); -var supportsPassive = _dereq_('has-passive-events'); +var Registry = _dereq_('../../registry'); +var Plots = _dereq_('../../plots/plots'); -function createCamera(element, options) { - element = element || document.body; - options = options || {}; - - var limits = [ 0.01, Infinity ]; - if('distanceLimits' in options) { - limits[0] = options.distanceLimits[0]; - limits[1] = options.distanceLimits[1]; - } - if('zoomMin' in options) { - limits[0] = options.zoomMin; - } - if('zoomMax' in options) { - limits[1] = options.zoomMax; - } - - var view = createView({ - center: options.center || [0, 0, 0], - up: options.up || [0, 1, 0], - eye: options.eye || [0, 0, 10], - mode: options.mode || 'orbit', - distanceLimits: limits - }); - - var pmatrix = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - var distance = 0.0; - var width = element.clientWidth; - var height = element.clientHeight; - - var camera = { - keyBindingMode: 'rotate', - view: view, - element: element, - delay: options.delay || 16, - rotateSpeed: options.rotateSpeed || 1, - zoomSpeed: options.zoomSpeed || 1, - translateSpeed: options.translateSpeed || 1, - flipX: !!options.flipX, - flipY: !!options.flipY, - modes: view.modes, - tick: function() { - var t = now(); - var delay = this.delay; - var ctime = t - 2 * delay; - view.idle(t - delay); - view.recalcMatrix(ctime); - view.flush(t - (100 + delay * 2)); - var allEqual = true; - var matrix = view.computedMatrix; - for(var i = 0; i < 16; ++i) { - allEqual = allEqual && (pmatrix[i] === matrix[i]); - pmatrix[i] = matrix[i]; - } - var sizeChanged = - element.clientWidth === width && - element.clientHeight === height; - width = element.clientWidth; - height = element.clientHeight; - if(allEqual) return !sizeChanged; - distance = Math.exp(view.computedRadius[0]); - return true; - }, - lookAt: function(center, eye, up) { - view.lookAt(view.lastT(), center, eye, up); - }, - rotate: function(pitch, yaw, roll) { - view.rotate(view.lastT(), pitch, yaw, roll); - }, - pan: function(dx, dy, dz) { - view.pan(view.lastT(), dx, dy, dz); - }, - translate: function(dx, dy, dz) { - view.translate(view.lastT(), dx, dy, dz); - } - }; +var Lib = _dereq_('../../lib'); +var Drawing = _dereq_('../drawing'); +var Color = _dereq_('../color'); +var Titles = _dereq_('../titles'); - Object.defineProperties(camera, { - matrix: { - get: function() { - return view.computedMatrix; - }, - set: function(mat) { - view.setMatrix(view.lastT(), mat); - return view.computedMatrix; - }, - enumerable: true - }, - mode: { - get: function() { - return view.getMode(); - }, - set: function(mode) { - var curUp = view.computedUp.slice(); - var curEye = view.computedEye.slice(); - var curCenter = view.computedCenter.slice(); - view.setMode(mode); - if(mode === 'turntable') { - // Hacky time warping stuff to generate smooth animation - var t0 = now(); - view._active.lookAt(t0, curEye, curCenter, curUp); - view._active.lookAt(t0 + 500, curEye, curCenter, [0, 0, 1]); - view._active.flush(t0); - } - return view.getMode(); - }, - enumerable: true - }, - center: { - get: function() { - return view.computedCenter; - }, - set: function(ncenter) { - view.lookAt(view.lastT(), null, ncenter); - return view.computedCenter; - }, - enumerable: true - }, - eye: { - get: function() { - return view.computedEye; - }, - set: function(neye) { - view.lookAt(view.lastT(), neye); - return view.computedEye; - }, - enumerable: true - }, - up: { - get: function() { - return view.computedUp; - }, - set: function(nup) { - view.lookAt(view.lastT(), null, null, nup); - return view.computedUp; - }, - enumerable: true - }, - distance: { - get: function() { - return distance; - }, - set: function(d) { - view.setDistance(view.lastT(), d); - return d; - }, - enumerable: true - }, - distanceLimits: { - get: function() { - return view.getDistanceLimits(limits); - }, - set: function(v) { - view.setDistanceLimits(v); - return v; - }, - enumerable: true - } - }); +var Cartesian = _dereq_('../../plots/cartesian'); +var axisIDs = _dereq_('../../plots/cartesian/axis_ids'); - element.addEventListener('contextmenu', function(ev) { - ev.preventDefault(); - return false; - }); +var dragElement = _dereq_('../dragelement'); +var setCursor = _dereq_('../../lib/setcursor'); + +var constants = _dereq_('./constants'); + +module.exports = function(gd) { + var fullLayout = gd._fullLayout; + var rangeSliderData = fullLayout._rangeSliderData; + for(var i = 0; i < rangeSliderData.length; i++) { + var opts = rangeSliderData[i][constants.name]; + // fullLayout._uid may not exist when we call makeData + opts._clipId = opts._id + '-' + fullLayout._uid; + } + + /* + * + * + * < .... range plot /> + * + * + * + * + * + * + * + * + * + * + * ... + */ - var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}; - camera.mouseListener = mouseChange(element, handleInteraction); + function keyFunction(axisOpts) { + return axisOpts._name; + } - // enable simple touch interactions - element.addEventListener('touchstart', function(ev) { - var xy = mouseOffset(ev.changedTouches[0], element); - handleInteraction(0, xy[0], xy[1], lastMods); - handleInteraction(1, xy[0], xy[1], lastMods); + var rangeSliders = fullLayout._infolayer + .selectAll('g.' + constants.containerClassName) + .data(rangeSliderData, keyFunction); - ev.preventDefault(); - }, supportsPassive ? {passive: false} : false); - element.addEventListener('touchmove', function(ev) { - var xy = mouseOffset(ev.changedTouches[0], element); - handleInteraction(1, xy[0], xy[1], lastMods); + // remove exiting sliders and their corresponding clip paths + rangeSliders.exit().each(function(axisOpts) { + var opts = axisOpts[constants.name]; + fullLayout._topdefs.select('#' + opts._clipId).remove(); + }).remove(); - ev.preventDefault(); - }, supportsPassive ? {passive: false} : false); - element.addEventListener('touchend', function(ev) { - handleInteraction(0, lastX, lastY, lastMods); + // return early if no range slider is visible + if(rangeSliderData.length === 0) return; - ev.preventDefault(); - }, supportsPassive ? {passive: false} : false); + rangeSliders.enter().append('g') + .classed(constants.containerClassName, true) + .attr('pointer-events', 'all'); - function handleInteraction(buttons, x, y, mods) { - var keyBindingMode = camera.keyBindingMode; + // for all present range sliders + rangeSliders.each(function(axisOpts) { + var rangeSlider = d3.select(this); + var opts = axisOpts[constants.name]; + var oppAxisOpts = fullLayout[axisIDs.id2name(axisOpts.anchor)]; + var oppAxisRangeOpts = opts[axisIDs.id2name(axisOpts.anchor)]; - if(keyBindingMode === false) return; + // update range + // Expand slider range to the axis range + if(opts.range) { + var rng = Lib.simpleMap(opts.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]) + ]; + } - var rotate = keyBindingMode === 'rotate'; - var pan = keyBindingMode === 'pan'; - var zoom = keyBindingMode === 'zoom'; + opts.range = opts._input.range = Lib.simpleMap(newRng, axisOpts.l2r); + } - var ctrl = !!mods.control; - var alt = !!mods.alt; - var shift = !!mods.shift; - var left = !!(buttons & 1); - var right = !!(buttons & 2); - var middle = !!(buttons & 4); + axisOpts.cleanRange('rangeslider.range'); - var scale = 1.0 / element.clientHeight; - var dx = scale * (x - lastX); - var dy = scale * (y - lastY); + // update range slider dimensions - var flipX = camera.flipX ? 1 : -1; - var flipY = camera.flipY ? 1 : -1; + var margin = fullLayout.margin; + var graphSize = fullLayout._size; + var domain = axisOpts.domain; + var tickHeight = opts._tickHeight; - var t = now(); + var oppBottom = opts._oppBottom; - var drot = Math.PI * camera.rotateSpeed; + opts._width = graphSize.w * (domain[1] - domain[0]); - if((rotate && left && !ctrl && !alt && !shift) || (left && !ctrl && !alt && shift)) { - // Rotate - view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0); - } + var x = Math.round(margin.l + (graphSize.w * domain[0])); - if((pan && left && !ctrl && !alt && !shift) || right || (left && ctrl && !alt && !shift)) { - // Pan - view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0); - } + var y = Math.round( + graphSize.t + graphSize.h * (1 - oppBottom) + + tickHeight + + opts._offsetShift + constants.extraPad + ); - if((zoom && left && !ctrl && !alt && !shift) || middle || (left && !ctrl && alt && !shift)) { - // Zoom - var kzoom = -camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 100; - view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1)); - } + rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); - lastX = x; - lastY = y; - lastMods = mods; + // update data <--> pixel coordinate conversion methods - return true; - } + var range0 = axisOpts.r2l(opts.range[0]); + var range1 = axisOpts.r2l(opts.range[1]); + var dist = range1 - range0; - camera.wheelListener = mouseWheel(element, function(dx, dy) { - if(camera.keyBindingMode === false) return; + opts.p2d = function(v) { + return (v / opts._width) * dist + range0; + }; - var flipX = camera.flipX ? 1 : -1; - var flipY = camera.flipY ? 1 : -1; - var t = now(); - if(Math.abs(dx) > Math.abs(dy)) { - view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth); - } else { - var kzoom = -camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 20.0; - view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1)); - } - }, true); + opts.d2p = function(v) { + return (v - range0) / dist * opts._width; + }; - return camera; -} + opts._rl = [range0, range1]; -},{"3d-view":45,"has-passive-events":394,"mouse-change":418,"mouse-event-offset":419,"mouse-wheel":421,"right-now":480}],787:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(oppAxisRangeOpts.rangemode !== 'match') { + var range0OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[0]); + var range1OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[1]); + var distOppAxis = range1OppAxis - range0OppAxis; + opts.d2pOppAxis = function(v) { + return (v - range0OppAxis) / distOppAxis * opts._height; + }; + } -'use strict'; + // update inner nodes -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var fxAttrs = _dereq_('../../components/fx/layout_attributes'); + rangeSlider + .call(drawBg, gd, axisOpts, opts) + .call(addClipPath, gd, axisOpts, opts) + .call(drawRangePlot, gd, axisOpts, opts) + .call(drawMasks, gd, axisOpts, opts, oppAxisRangeOpts) + .call(drawSlideBox, gd, axisOpts, opts) + .call(drawGrabbers, gd, axisOpts, opts); -var Scene = _dereq_('./scene'); -var getSubplotData = _dereq_('../get_data').getSubplotData; -var Lib = _dereq_('../../lib'); -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); + // setup drag element + setupDragElement(rangeSlider, gd, axisOpts, opts); -var GL3D = 'gl3d'; -var SCENE = 'scene'; + // update current range + setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRangeOpts); + + // title goes next to range slider instead of tick labels, so + // just take it over and draw it from here + if(axisOpts.side === 'bottom') { + Titles.draw(gd, axisOpts._id + 'title', { + propContainer: axisOpts, + propName: axisOpts._name + '.title', + placeholder: fullLayout._dfltTitle.x, + attributes: { + x: axisOpts._offset + axisOpts._length / 2, + y: y + opts._height + opts._offsetShift + 10 + 1.5 * axisOpts.title.font.size, + 'text-anchor': 'middle' + } + }); + } + }); +}; +function setupDragElement(rangeSlider, gd, axisOpts, opts) { + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); + var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); + var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); -exports.name = GL3D; + rangeSlider.on('mousedown', function() { + var event = d3.event; + var target = event.target; + var startX = event.clientX; + var offsetX = startX - rangeSlider.node().getBoundingClientRect().left; + var minVal = opts.d2p(axisOpts._rl[0]); + var maxVal = opts.d2p(axisOpts._rl[1]); -exports.attr = SCENE; + var dragCover = dragElement.coverSlip(); -exports.idRoot = SCENE; + dragCover.addEventListener('mousemove', mouseMove); + dragCover.addEventListener('mouseup', mouseUp); -exports.idRegex = exports.attrRegex = Lib.counterRegex('scene'); + function mouseMove(e) { + var delta = +e.clientX - startX; + var pixelMin, pixelMax, cursor; -exports.attributes = _dereq_('./layout/attributes'); + switch(target) { + case slideBox: + cursor = 'ew-resize'; + pixelMin = minVal + delta; + pixelMax = maxVal + delta; + break; -exports.layoutAttributes = _dereq_('./layout/layout_attributes'); + case grabAreaMin: + cursor = 'col-resize'; + pixelMin = minVal + delta; + pixelMax = maxVal; + break; -exports.baseLayoutAttrOverrides = overrideAll({ - hoverlabel: fxAttrs.hoverlabel -}, 'plot', 'nested'); + case grabAreaMax: + cursor = 'col-resize'; + pixelMin = minVal; + pixelMax = maxVal + delta; + break; -exports.supplyLayoutDefaults = _dereq_('./layout/defaults'); + default: + cursor = 'ew-resize'; + pixelMin = offsetX; + pixelMax = offsetX + delta; + break; + } -exports.plot = function plotGl3d(gd) { - var fullLayout = gd._fullLayout; - var fullData = gd._fullData; - var sceneIds = fullLayout._subplots[GL3D]; + if(pixelMax < pixelMin) { + var tmp = pixelMax; + pixelMax = pixelMin; + pixelMin = tmp; + } - for(var i = 0; i < sceneIds.length; i++) { - var sceneId = sceneIds[i], - fullSceneData = getSubplotData(fullData, GL3D, sceneId), - sceneLayout = fullLayout[sceneId], - scene = sceneLayout._scene; - - if(!scene) { - scene = new Scene({ - id: sceneId, - graphDiv: gd, - container: gd.querySelector('.gl-container'), - staticPlot: gd._context.staticPlot, - plotGlPixelRatio: gd._context.plotGlPixelRatio - }, - fullLayout - ); + opts._pixelMin = pixelMin; + opts._pixelMax = pixelMax; - // set ref to Scene instance - sceneLayout._scene = scene; + setCursor(d3.select(dragCover), cursor); + setDataRange(rangeSlider, gd, axisOpts, opts); } - // save 'initial' camera settings for modebar button - if(!scene.cameraInitial) { - scene.cameraInitial = Lib.extendDeep({}, sceneLayout.camera); + function mouseUp() { + dragCover.removeEventListener('mousemove', mouseMove); + dragCover.removeEventListener('mouseup', mouseUp); + Lib.removeElement(dragCover); } + }); +} + +function setDataRange(rangeSlider, gd, axisOpts, opts) { - scene.plot(fullSceneData, fullLayout, gd.layout); + function clamp(v) { + return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } -}; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldSceneKeys = oldFullLayout._subplots[GL3D] || []; + var dataMin = clamp(opts.p2d(opts._pixelMin)); + var dataMax = clamp(opts.p2d(opts._pixelMax)); - for(var i = 0; i < oldSceneKeys.length; i++) { - var oldSceneKey = oldSceneKeys[i]; + window.requestAnimationFrame(function() { + Registry.call('_guiRelayout', gd, axisOpts._name + '.range', [dataMin, dataMax]); + }); +} - if(!newFullLayout[oldSceneKey] && !!oldFullLayout[oldSceneKey]._scene) { - oldFullLayout[oldSceneKey]._scene.destroy(); +function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRangeOpts) { + var hw2 = constants.handleWidth / 2; - if(oldFullLayout._infolayer) { - oldFullLayout._infolayer - .selectAll('.annotation-' + oldSceneKey) - .remove(); - } - } + function clamp(v) { + return Lib.constrain(v, 0, opts._width); } -}; -exports.toSVG = function(gd) { - var fullLayout = gd._fullLayout; - var sceneIds = fullLayout._subplots[GL3D]; - var size = fullLayout._size; + function clampOppAxis(v) { + return Lib.constrain(v, 0, opts._height); + } - for(var i = 0; i < sceneIds.length; i++) { - var sceneLayout = fullLayout[sceneIds[i]]; - var domain = sceneLayout.domain; - var scene = sceneLayout._scene; + function clampHandle(v) { + return Lib.constrain(v, -hw2, opts._width + hw2); + } - var imageData = scene.toImage('png'); - var image = fullLayout._glimages.append('svg:image'); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])); + var pixelMax = clamp(opts.d2p(axisOpts._rl[1])); - image.attr({ - xmlns: xmlnsNamespaces.svg, - 'xlink:href': imageData, - x: size.l + size.w * domain.x[0], - y: size.t + size.h * (1 - domain.y[1]), - width: size.w * (domain.x[1] - domain.x[0]), - height: size.h * (domain.y[1] - domain.y[0]), - preserveAspectRatio: 'none' - }); + rangeSlider.select('rect.' + constants.slideBoxClassName) + .attr('x', pixelMin) + .attr('width', pixelMax - pixelMin); - scene.destroy(); - } -}; + rangeSlider.select('rect.' + constants.maskMinClassName) + .attr('width', pixelMin); -// clean scene ids, 'scene1' -> 'scene' -exports.cleanId = function cleanId(id) { - if(!id.match(/^scene[0-9]*$/)) return; + rangeSlider.select('rect.' + constants.maskMaxClassName) + .attr('x', pixelMax) + .attr('width', opts._width - pixelMax); - var sceneNum = id.substr(5); - if(sceneNum === '1') sceneNum = ''; + if(oppAxisRangeOpts.rangemode !== 'match') { + var pixelMinOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[1])); + var pixelMaxOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[0])); - return SCENE + sceneNum; -}; + rangeSlider.select('rect.' + constants.maskMinOppAxisClassName) + .attr('x', pixelMin) + .attr('height', pixelMinOppAxis) + .attr('width', pixelMax - pixelMin); -exports.updateFx = function(gd) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots[GL3D]; + rangeSlider.select('rect.' + constants.maskMaxOppAxisClassName) + .attr('x', pixelMin) + .attr('y', pixelMaxOppAxis) + .attr('height', opts._height - pixelMaxOppAxis) + .attr('width', pixelMax - pixelMin); - for(var i = 0; i < subplotIds.length; i++) { - var subplotObj = fullLayout[subplotIds[i]]._scene; - subplotObj.updateFx(fullLayout.dragmode, fullLayout.hovermode); + rangeSlider.select('rect.' + constants.slideBoxClassName) + .attr('y', pixelMinOppAxis) + .attr('height', pixelMaxOppAxis - pixelMinOppAxis); } -}; -},{"../../components/fx/layout_attributes":613,"../../constants/xmlns_namespaces":674,"../../lib":696,"../../plot_api/edit_types":727,"../get_data":781,"./layout/attributes":788,"./layout/defaults":792,"./layout/layout_attributes":793,"./scene":797}],788:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // add offset for crispier corners + // https://github.com/plotly/plotly.js/pull/1409 + var offset = 0.5; -'use strict'; + var xMin = Math.round(clampHandle(pixelMin - hw2)) - offset; + var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; + rangeSlider.select('g.' + constants.grabberMinClassName) + .attr('transform', 'translate(' + xMin + ',' + offset + ')'); -module.exports = { - scene: { - valType: 'subplotid', - - dflt: 'scene', - editType: 'calc+clearAxisTypes', - - } -}; + rangeSlider.select('g.' + constants.grabberMaxClassName) + .attr('transform', 'translate(' + xMax + ',' + offset + ')'); +} -},{}],789:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function drawBg(rangeSlider, gd, axisOpts, opts) { + var bg = Lib.ensureSingle(rangeSlider, 'rect', constants.bgClassName, function(s) { + s.attr({ + x: 0, + y: 0, + 'shape-rendering': 'crispEdges' + }); + }); -'use strict'; + var borderCorrect = (opts.borderwidth % 2) === 0 ? + opts.borderwidth : + opts.borderwidth - 1; -var Color = _dereq_('../../../components/color'); -var axesAttrs = _dereq_('../../cartesian/layout_attributes'); -var extendFlat = _dereq_('../../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../../plot_api/edit_types').overrideAll; + var offsetShift = -opts._offsetShift; + var lw = Drawing.crispRound(gd, opts.borderwidth); + bg.attr({ + width: opts._width + borderCorrect, + height: opts._height + borderCorrect, + transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + fill: opts.bgcolor, + stroke: opts.bordercolor, + 'stroke-width': lw + }); +} -module.exports = overrideAll({ - visible: axesAttrs.visible, - showspikes: { - valType: 'boolean', - - dflt: true, - - }, - spikesides: { - valType: 'boolean', - - dflt: true, - - }, - spikethickness: { - valType: 'number', - - min: 0, - dflt: 2, - - }, - spikecolor: { - valType: 'color', - - dflt: Color.defaultLine, - - }, - showbackground: { - valType: 'boolean', - - dflt: false, - - }, - backgroundcolor: { - valType: 'color', - - dflt: 'rgba(204, 204, 204, 0.5)', - - }, - showaxeslabels: { - valType: 'boolean', - - dflt: true, - - }, - color: axesAttrs.color, - categoryorder: axesAttrs.categoryorder, - categoryarray: axesAttrs.categoryarray, - title: axesAttrs.title, - titlefont: axesAttrs.titlefont, - type: axesAttrs.type, - autorange: axesAttrs.autorange, - rangemode: axesAttrs.rangemode, - range: axesAttrs.range, - // ticks - tickmode: axesAttrs.tickmode, - nticks: axesAttrs.nticks, - tick0: axesAttrs.tick0, - dtick: axesAttrs.dtick, - tickvals: axesAttrs.tickvals, - ticktext: axesAttrs.ticktext, - ticks: axesAttrs.ticks, - mirror: axesAttrs.mirror, - ticklen: axesAttrs.ticklen, - tickwidth: axesAttrs.tickwidth, - tickcolor: axesAttrs.tickcolor, - showticklabels: axesAttrs.showticklabels, - tickfont: axesAttrs.tickfont, - tickangle: axesAttrs.tickangle, - tickprefix: axesAttrs.tickprefix, - showtickprefix: axesAttrs.showtickprefix, - ticksuffix: axesAttrs.ticksuffix, - showticksuffix: axesAttrs.showticksuffix, - showexponent: axesAttrs.showexponent, - exponentformat: axesAttrs.exponentformat, - separatethousands: axesAttrs.separatethousands, - tickformat: axesAttrs.tickformat, - tickformatstops: axesAttrs.tickformatstops, - hoverformat: axesAttrs.hoverformat, - // lines and grids - showline: axesAttrs.showline, - linecolor: axesAttrs.linecolor, - linewidth: axesAttrs.linewidth, - showgrid: axesAttrs.showgrid, - gridcolor: extendFlat({}, axesAttrs.gridcolor, // shouldn't this be on-par with 2D? - {dflt: 'rgb(204, 204, 204)'}), - gridwidth: axesAttrs.gridwidth, - zeroline: axesAttrs.zeroline, - zerolinecolor: axesAttrs.zerolinecolor, - zerolinewidth: axesAttrs.zerolinewidth -}, 'plot', 'from-root'); +function addClipPath(rangeSlider, gd, axisOpts, opts) { + var fullLayout = gd._fullLayout; -},{"../../../components/color":570,"../../../lib/extend":685,"../../../plot_api/edit_types":727,"../../cartesian/layout_attributes":757}],790:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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 + }); +} -'use strict'; +function drawRangePlot(rangeSlider, gd, axisOpts, opts) { + var calcData = gd.calcdata; -var colorMix = _dereq_('tinycolor2').mix; + var rangePlots = rangeSlider.selectAll('g.' + constants.rangePlotClassName) + .data(axisOpts._subplotsWith, Lib.identity); -var Lib = _dereq_('../../../lib'); -var Template = _dereq_('../../../plot_api/plot_template'); + rangePlots.enter().append('g') + .attr('class', function(id) { return constants.rangePlotClassName + ' ' + id; }) + .call(Drawing.setClipUrl, opts._clipId, gd); -var layoutAttributes = _dereq_('./axis_attributes'); -var handleTypeDefaults = _dereq_('../../cartesian/type_defaults'); -var handleAxisDefaults = _dereq_('../../cartesian/axis_defaults'); + rangePlots.order(); -var axesNames = ['xaxis', 'yaxis', 'zaxis']; + rangePlots.exit().remove(); -// TODO: hard-coded lightness fraction based on gridline default colors -// that differ from other subplot types. -var gridLightness = 100 * (204 - 0x44) / (255 - 0x44); + var mainplotinfo; -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { - var containerIn, containerOut; + rangePlots.each(function(id, i) { + var plotgroup = d3.select(this); + var isMainPlot = (i === 0); - function coerce(attr, dflt) { - return Lib.coerce(containerIn, containerOut, layoutAttributes, attr, dflt); - } + var oppAxisOpts = axisIDs.getFromId(gd, id, 'y'); + var oppAxisName = oppAxisOpts._name; + var oppAxisRangeOpts = opts[oppAxisName]; - for(var j = 0; j < axesNames.length; j++) { - var axName = axesNames[j]; - containerIn = layoutIn[axName] || {}; - - containerOut = Template.newContainer(layoutOut, axName); - containerOut._id = axName[0] + options.scene; - containerOut._name = axName; - - handleTypeDefaults(containerIn, containerOut, coerce, options); - - handleAxisDefaults( - containerIn, - containerOut, - coerce, - { - font: options.font, - letter: axName[0], - data: options.data, - showGrid: true, - bgColor: options.bgColor, - calendar: options.calendar + 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 } }, - options.fullLayout); - - coerce('gridcolor', colorMix(containerOut.color, options.bgColor, gridLightness).toRgbString()); - coerce('title', axName[0]); // shouldn't this be on-par with 2D? + _context: gd._context + }; - containerOut.setScale = Lib.noop; + mockFigure.layout[oppAxisName] = { + type: oppAxisOpts.type, + domain: [0, 1], + range: oppAxisRangeOpts.rangemode !== 'match' ? oppAxisRangeOpts.range.slice() : oppAxisOpts.range.slice(), + calendar: oppAxisOpts.calendar + }; - if(coerce('showspikes')) { - coerce('spikesides'); - coerce('spikethickness'); - coerce('spikecolor', containerOut.color); - } + Plots.supplyDefaults(mockFigure); - coerce('showaxeslabels'); - if(coerce('showbackground')) coerce('backgroundcolor'); - } -}; + var xa = mockFigure._fullLayout.xaxis; + var ya = mockFigure._fullLayout[oppAxisName]; -},{"../../../lib":696,"../../../plot_api/plot_template":734,"../../cartesian/axis_defaults":746,"../../cartesian/type_defaults":768,"./axis_attributes":789,"tinycolor2":514}],791:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + xa.clearCalc(); + xa.setScale(); + ya.clearCalc(); + ya.setScale(); + var plotinfo = { + id: id, + plotgroup: plotgroup, + xaxis: xa, + yaxis: ya, + isRangePlot: true + }; -'use strict'; + if(isMainPlot) mainplotinfo = plotinfo; + else { + plotinfo.mainplot = 'xy'; + plotinfo.mainplotinfo = mainplotinfo; + } -var convertHTMLToUnicode = _dereq_('../../../lib/html2unicode'); -var str2RgbaArray = _dereq_('../../../lib/str2rgbarray'); + Cartesian.rangePlot(gd, plotinfo, filterRangePlotCalcData(calcData, id)); + }); +} -var AXES_NAMES = ['xaxis', 'yaxis', 'zaxis']; +function filterRangePlotCalcData(calcData, subplotId) { + var out = []; -function AxesOptions() { - this.bounds = [ - [-10, -10, -10], - [10, 10, 10] - ]; + for(var i = 0; i < calcData.length; i++) { + var calcTrace = calcData[i]; + var trace = calcTrace[0].trace; - this.ticks = [ [], [], [] ]; - this.tickEnable = [ true, true, true ]; - this.tickFont = [ 'sans-serif', 'sans-serif', 'sans-serif' ]; - this.tickSize = [ 12, 12, 12 ]; - this.tickAngle = [ 0, 0, 0 ]; - this.tickColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ]; - this.tickPad = [ 18, 18, 18 ]; - - this.labels = [ 'x', 'y', 'z' ]; - this.labelEnable = [ true, true, true ]; - this.labelFont = ['Open Sans', 'Open Sans', 'Open Sans']; - this.labelSize = [ 20, 20, 20 ]; - this.labelColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ]; - this.labelPad = [ 30, 30, 30 ]; - - this.lineEnable = [ true, true, true ]; - this.lineMirror = [ false, false, false ]; - this.lineWidth = [ 1, 1, 1 ]; - this.lineColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ]; - - this.lineTickEnable = [ true, true, true ]; - this.lineTickMirror = [ false, false, false ]; - this.lineTickLength = [ 10, 10, 10 ]; - this.lineTickWidth = [ 1, 1, 1 ]; - this.lineTickColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ]; - - this.gridEnable = [ true, true, true ]; - this.gridWidth = [ 1, 1, 1 ]; - this.gridColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ]; - - this.zeroEnable = [ true, true, true ]; - this.zeroLineColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ]; - this.zeroLineWidth = [ 2, 2, 2 ]; - - this.backgroundEnable = [ true, true, true ]; - this.backgroundColor = [ [0.8, 0.8, 0.8, 0.5], - [0.8, 0.8, 0.8, 0.5], - [0.8, 0.8, 0.8, 0.5] ]; - - // some default values are stored for applying model transforms - this._defaultTickPad = this.tickPad.slice(); - this._defaultLabelPad = this.labelPad.slice(); - this._defaultLineTickLength = this.lineTickLength.slice(); -} - -var proto = AxesOptions.prototype; - -proto.merge = function(sceneLayout) { - var opts = this; - for(var i = 0; i < 3; ++i) { - var axes = sceneLayout[AXES_NAMES[i]]; - - if(!axes.visible) { - opts.tickEnable[i] = false; - opts.labelEnable[i] = false; - opts.lineEnable[i] = false; - opts.lineTickEnable[i] = false; - opts.gridEnable[i] = false; - opts.zeroEnable[i] = false; - opts.backgroundEnable[i] = false; - continue; + if(trace.xaxis + trace.yaxis === subplotId) { + out.push(calcTrace); } - - // Axes labels - opts.labels[i] = convertHTMLToUnicode(axes.title); - if('titlefont' in axes) { - if(axes.titlefont.color) opts.labelColor[i] = str2RgbaArray(axes.titlefont.color); - if(axes.titlefont.family) opts.labelFont[i] = axes.titlefont.family; - if(axes.titlefont.size) opts.labelSize[i] = axes.titlefont.size; - } - - // Lines - if('showline' in axes) opts.lineEnable[i] = axes.showline; - if('linecolor' in axes) opts.lineColor[i] = str2RgbaArray(axes.linecolor); - if('linewidth' in axes) opts.lineWidth[i] = axes.linewidth; - - if('showgrid' in axes) opts.gridEnable[i] = axes.showgrid; - if('gridcolor' in axes) opts.gridColor[i] = str2RgbaArray(axes.gridcolor); - if('gridwidth' in axes) opts.gridWidth[i] = axes.gridwidth; - - // Remove zeroline if axis type is log - // otherwise the zeroline is incorrectly drawn at 1 on log axes - if(axes.type === 'log') opts.zeroEnable[i] = false; - else if('zeroline' in axes) opts.zeroEnable[i] = axes.zeroline; - if('zerolinecolor' in axes) opts.zeroLineColor[i] = str2RgbaArray(axes.zerolinecolor); - if('zerolinewidth' in axes) opts.zeroLineWidth[i] = axes.zerolinewidth; - - // tick lines - if('ticks' in axes && !!axes.ticks) opts.lineTickEnable[i] = true; - else opts.lineTickEnable[i] = false; - - if('ticklen' in axes) { - opts.lineTickLength[i] = opts._defaultLineTickLength[i] = axes.ticklen; - } - if('tickcolor' in axes) opts.lineTickColor[i] = str2RgbaArray(axes.tickcolor); - if('tickwidth' in axes) opts.lineTickWidth[i] = axes.tickwidth; - if('tickangle' in axes) { - opts.tickAngle[i] = (axes.tickangle === 'auto') ? - -3600 : // i.e. special number to set auto option - Math.PI * -axes.tickangle / 180; - } - - // tick labels - if('showticklabels' in axes) opts.tickEnable[i] = axes.showticklabels; - if('tickfont' in axes) { - if(axes.tickfont.color) opts.tickColor[i] = str2RgbaArray(axes.tickfont.color); - if(axes.tickfont.family) opts.tickFont[i] = axes.tickfont.family; - if(axes.tickfont.size) opts.tickSize[i] = axes.tickfont.size; - } - - if('mirror' in axes) { - if(['ticks', 'all', 'allticks'].indexOf(axes.mirror) !== -1) { - opts.lineTickMirror[i] = true; - opts.lineMirror[i] = true; - } else if(axes.mirror === true) { - opts.lineTickMirror[i] = false; - opts.lineMirror[i] = true; - } else { - opts.lineTickMirror[i] = false; - opts.lineMirror[i] = false; - } - } else opts.lineMirror[i] = false; - - // grid background - if('showbackground' in axes && axes.showbackground !== false) { - opts.backgroundEnable[i] = true; - opts.backgroundColor[i] = str2RgbaArray(axes.backgroundcolor); - } else opts.backgroundEnable[i] = false; } -}; - -function createAxesOptions(plotlyOptions) { - var result = new AxesOptions(); - result.merge(plotlyOptions); - return result; + return out; } -module.exports = createAxesOptions; - -},{"../../../lib/html2unicode":694,"../../../lib/str2rgbarray":719}],792:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../../lib'); -var Color = _dereq_('../../../components/color'); -var Registry = _dereq_('../../../registry'); - -var handleSubplotDefaults = _dereq_('../../subplot_defaults'); -var supplyGl3dAxisLayoutDefaults = _dereq_('./axis_defaults'); -var layoutAttributes = _dereq_('./layout_attributes'); - - -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - var hasNon3D = layoutOut._basePlotModules.length > 1; - - // some layout-wide attribute are used in all scenes - // if 3D is the only visible plot type - function getDfltFromLayout(attr) { - if(hasNon3D) return; - - var isValid = Lib.validate(layoutIn[attr], layoutAttributes[attr]); - if(isValid) return layoutIn[attr]; - } - - handleSubplotDefaults(layoutIn, layoutOut, fullData, { - type: 'gl3d', - attributes: layoutAttributes, - handleDefaults: handleGl3dDefaults, - fullLayout: layoutOut, - font: layoutOut.font, - fullData: fullData, - getDfltFromLayout: getDfltFromLayout, - paper_bgcolor: layoutOut.paper_bgcolor, - calendar: layoutOut.calendar +function drawMasks(rangeSlider, gd, axisOpts, opts, oppAxisRangeOpts) { + var maskMin = Lib.ensureSingle(rangeSlider, 'rect', constants.maskMinClassName, function(s) { + s.attr({ + x: 0, + y: 0, + 'shape-rendering': 'crispEdges' + }); }); -}; -function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { - /* - * Scene numbering proceeds as follows - * scene - * scene2 - * scene3 - * - * and d.scene will be undefined or some number or number string - * - * Also write back a blank scene object to user layout so that some - * attributes like aspectratio can be written back dynamically. - */ - - var bgcolor = coerce('bgcolor'), - bgColorCombined = Color.combine(bgcolor, opts.paper_bgcolor); - - var cameraKeys = ['up', 'center', 'eye']; + maskMin + .attr('height', opts._height) + .call(Color.fill, constants.maskColor); - for(var j = 0; j < cameraKeys.length; j++) { - coerce('camera.' + cameraKeys[j] + '.x'); - coerce('camera.' + cameraKeys[j] + '.y'); - coerce('camera.' + cameraKeys[j] + '.z'); - } + var maskMax = Lib.ensureSingle(rangeSlider, 'rect', constants.maskMaxClassName, function(s) { + s.attr({ + y: 0, + 'shape-rendering': 'crispEdges' + }); + }); - /* - * coerce to positive number (min 0) but also do not accept 0 (>0 not >=0) - * note that 0's go false with the !! call - */ - var hasAspect = !!coerce('aspectratio.x') && - !!coerce('aspectratio.y') && - !!coerce('aspectratio.z'); + maskMax + .attr('height', opts._height) + .call(Color.fill, constants.maskColor); - var defaultAspectMode = hasAspect ? 'manual' : 'auto'; - var aspectMode = coerce('aspectmode', defaultAspectMode); + // masks used for oppAxis zoom + if(oppAxisRangeOpts.rangemode !== 'match') { + var maskMinOppAxis = Lib.ensureSingle(rangeSlider, 'rect', constants.maskMinOppAxisClassName, function(s) { + s.attr({ + y: 0, + 'shape-rendering': 'crispEdges' + }); + }); - /* - * We need aspectratio object in all the Layouts as it is dynamically set - * in the calculation steps, ie, we cant set the correct data now, it happens later. - * We must also account for the case the user sends bad ratio data with 'manual' set - * for the mode. In this case we must force change it here as the default coerce - * misses it above. - */ - if(!hasAspect) { - sceneLayoutIn.aspectratio = sceneLayoutOut.aspectratio = {x: 1, y: 1, z: 1}; + maskMinOppAxis + .attr('width', opts._width) + .call(Color.fill, constants.maskOppAxisColor); - if(aspectMode === 'manual') sceneLayoutOut.aspectmode = 'auto'; + var maskMaxOppAxis = Lib.ensureSingle(rangeSlider, 'rect', constants.maskMaxOppAxisClassName, function(s) { + s.attr({ + y: 0, + 'shape-rendering': 'crispEdges' + }); + }); - /* - * kind of like autorange - we need the calculated aspectmode back in - * the input layout or relayout can cause problems later - */ - sceneLayoutIn.aspectmode = sceneLayoutOut.aspectmode; + maskMaxOppAxis + .attr('width', opts._width) + .style('border-top', constants.maskOppBorder) + .call(Color.fill, constants.maskOppAxisColor); } - - supplyGl3dAxisLayoutDefaults(sceneLayoutIn, sceneLayoutOut, { - font: opts.font, - scene: opts.id, - data: opts.fullData, - bgColor: bgColorCombined, - calendar: opts.calendar, - fullLayout: opts.fullLayout - }); - - Registry.getComponentMethod('annotations3d', 'handleDefaults')( - sceneLayoutIn, sceneLayoutOut, opts - ); - - coerce('dragmode', opts.getDfltFromLayout('dragmode')); - coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":570,"../../../lib":696,"../../../registry":827,"../../subplot_defaults":822,"./axis_defaults":790,"./layout_attributes":793}],793:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function drawSlideBox(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = Lib.ensureSingle(rangeSlider, 'rect', constants.slideBoxClassName, function(s) { + s.attr({ + y: 0, + cursor: constants.slideBoxCursor, + 'shape-rendering': 'crispEdges' + }); + }); -'use strict'; + slideBox.attr({ + height: opts._height, + fill: constants.slideBoxFill + }); +} -var gl3dAxisAttrs = _dereq_('./axis_attributes'); -var domainAttrs = _dereq_('../../domain').attributes; -var extendFlat = _dereq_('../../../lib/extend').extendFlat; -var counterRegex = _dereq_('../../../lib').counterRegex; +function drawGrabbers(rangeSlider, gd, axisOpts, opts) { + // + var grabberMin = Lib.ensureSingle(rangeSlider, 'g', constants.grabberMinClassName); + var grabberMax = Lib.ensureSingle(rangeSlider, 'g', constants.grabberMaxClassName); -function makeCameraVector(x, y, z) { - return { - x: { - valType: 'number', - - dflt: x, - editType: 'camera' - }, - y: { - valType: 'number', - - dflt: y, - editType: 'camera' - }, - z: { - valType: 'number', - - dflt: z, - editType: 'camera' - }, - editType: 'camera' + // + var handleFixAttrs = { + x: 0, + width: constants.handleWidth, + rx: constants.handleRadius, + fill: Color.background, + stroke: Color.defaultLine, + 'stroke-width': constants.handleStrokeWidth, + 'shape-rendering': 'crispEdges' }; -} - -module.exports = { - _arrayAttrRegexps: [counterRegex('scene', '.annotations', true)], + 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); - bgcolor: { - valType: 'color', - - dflt: 'rgba(0,0,0,0)', - editType: 'plot' - }, - camera: { - up: extendFlat(makeCameraVector(0, 0, 1), { - - }), - center: extendFlat(makeCameraVector(0, 0, 0), { - - }), - eye: extendFlat(makeCameraVector(1.25, 1.25, 1.25), { - - }), - editType: 'camera' - }, - domain: domainAttrs({name: 'scene', editType: 'plot'}), - aspectmode: { - valType: 'enumerated', - - values: ['auto', 'cube', 'data', 'manual'], - dflt: 'auto', - editType: 'plot', - impliedEdits: { - 'aspectratio.x': undefined, - 'aspectratio.y': undefined, - 'aspectratio.z': undefined - }, - - }, - aspectratio: { // must be positive (0's are coerced to 1) - x: { - valType: 'number', - - min: 0, - editType: 'plot', - impliedEdits: {'^aspectmode': 'manual'} - }, - y: { - valType: 'number', - - min: 0, - editType: 'plot', - impliedEdits: {'^aspectmode': 'manual'} - }, - z: { - valType: 'number', - - min: 0, - editType: 'plot', - impliedEdits: {'^aspectmode': 'manual'} - }, - editType: 'plot', - impliedEdits: {aspectmode: 'manual'}, - - }, + var handleMax = Lib.ensureSingle(grabberMax, 'rect', constants.handleMaxClassName, function(s) { + s.attr(handleFixAttrs); + }); + handleMax.attr(handleDynamicAttrs); - xaxis: gl3dAxisAttrs, - yaxis: gl3dAxisAttrs, - zaxis: gl3dAxisAttrs, + // + if(gd._context.staticPlot) return; - dragmode: { - valType: 'enumerated', - - values: ['orbit', 'turntable', 'zoom', 'pan', false], - dflt: 'turntable', - editType: 'plot', - - }, - hovermode: { - valType: 'enumerated', - - values: ['closest', false], - dflt: 'closest', - editType: 'modebar', - - }, - editType: 'plot', + var grabAreaFixAttrs = { + width: constants.grabAreaWidth, + x: 0, + y: 0, + fill: constants.grabAreaFill, + cursor: constants.grabAreaCursor + }; - _deprecated: { - cameraposition: { - valType: 'info_array', - - editType: 'camera', - - } - } -}; + 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); +} -},{"../../../lib":696,"../../../lib/extend":685,"../../domain":770,"./axis_attributes":789}],794:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../lib/setcursor":178,"../../plots/cartesian":215,"../../plots/cartesian/axis_ids":206,"../../plots/plots":236,"../../registry":243,"../color":43,"../dragelement":61,"../drawing":64,"../titles":131,"./constants":113,"d3":8}],116:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var str2RGBArray = _dereq_('../../../lib/str2rgbarray'); - -var AXES_NAMES = ['xaxis', 'yaxis', 'zaxis']; +var axisIDs = _dereq_('../../plots/cartesian/axis_ids'); +var constants = _dereq_('./constants'); +var name = constants.name; -function SpikeOptions() { - this.enabled = [true, true, true]; - this.colors = [[0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1]]; - this.drawSides = [true, true, true]; - this.lineWidth = [1, 1, 1]; +function isVisible(ax) { + var rangeSlider = ax && ax[name]; + return rangeSlider && rangeSlider.visible; } +exports.isVisible = isVisible; -var proto = SpikeOptions.prototype; +exports.makeData = function(fullLayout) { + var axes = axisIDs.list({ _fullLayout: fullLayout }, 'x', true); + var margin = fullLayout.margin; + var rangeSliderData = []; -proto.merge = function(sceneLayout) { - for(var i = 0; i < 3; ++i) { - var axes = sceneLayout[AXES_NAMES[i]]; + if(!fullLayout._has('gl2d')) { + for(var i = 0; i < axes.length; i++) { + var ax = axes[i]; - if(!axes.visible) { - this.enabled[i] = false; - this.drawSides[i] = false; - continue; - } + if(isVisible(ax)) { + rangeSliderData.push(ax); - this.enabled[i] = axes.showspikes; - this.colors[i] = str2RGBArray(axes.spikecolor); - this.drawSides[i] = axes.spikesides; - this.lineWidth[i] = axes.spikethickness; + 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; }; -function createSpikeOptions(layout) { - var result = new SpikeOptions(); - result.merge(layout); - return result; -} +exports.autoMarginOpts = function(gd, ax) { + var opts = ax[name]; -module.exports = createSpikeOptions; + var oppBottom = Infinity; + var counterAxes = ax._counterAxes; + for(var j = 0; j < counterAxes.length; j++) { + var counterId = counterAxes[j]; + var oppAxis = axisIDs.getFromId(gd, counterId); + oppBottom = Math.min(oppBottom, oppAxis.domain[0]); + } + opts._oppBottom = oppBottom; + + var tickHeight = (ax.side === 'bottom' && ax._boundingBox.height) || 0; + opts._tickHeight = tickHeight; + + return { + x: 0, + y: oppBottom, + l: 0, + r: 0, + t: 0, + b: opts._height + gd._fullLayout.margin.b + tickHeight, + pad: constants.extraPad + opts._offsetShift * 2 + }; +}; -},{"../../../lib/str2rgbarray":719}],795:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":206,"./constants":113}],117:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -/* eslint block-scoped-var: 0*/ -/* eslint no-redeclare: 0*/ - 'use strict'; -module.exports = computeTickMarks; - -var Axes = _dereq_('../../cartesian/axes'); -var Lib = _dereq_('../../../lib'); -var convertHTMLToUnicode = _dereq_('../../../lib/html2unicode'); - -var AXES_NAMES = ['xaxis', 'yaxis', 'zaxis']; - -var centerPoint = [0, 0, 0]; - -function contourLevelsFromTicks(ticks) { - var result = new Array(3); - for(var i = 0; i < 3; ++i) { - var tlevel = ticks[i]; - var clevel = new Array(tlevel.length); - for(var j = 0; j < tlevel.length; ++j) { - clevel[j] = tlevel[j].x; - } - result[i] = clevel; - } - return result; -} - -function computeTickMarks(scene) { - var axesOptions = scene.axesOptions; - var glRange = scene.glplot.axesPixels; - var sceneLayout = scene.fullSceneLayout; - - var ticks = [[], [], []]; - - for(var i = 0; i < 3; ++i) { - var axes = sceneLayout[AXES_NAMES[i]]; - - axes._length = (glRange[i].hi - glRange[i].lo) * - glRange[i].pixelsPerDataUnit / scene.dataScale[i]; +var Lib = _dereq_('../../lib'); +var attrs = _dereq_('./attributes'); +var oppAxisAttrs = _dereq_('./oppaxis_attributes'); +var helpers = _dereq_('./helpers'); - if(Math.abs(axes._length) === Infinity) { - ticks[i] = []; - } else { - axes._input_range = axes.range.slice(); - axes.range[0] = (glRange[i].lo) / scene.dataScale[i]; - axes.range[1] = (glRange[i].hi) / scene.dataScale[i]; - axes._m = 1.0 / (scene.dataScale[i] * glRange[i].pixelsPerDataUnit); +module.exports = { + moduleType: 'component', + name: 'rangeslider', - if(axes.range[0] === axes.range[1]) { - axes.range[0] -= 1; - axes.range[1] += 1; - } - // this is necessary to short-circuit the 'y' handling - // in autotick part of calcTicks... Treating all axes as 'y' in this case - // running the autoticks here, then setting - // autoticks to false to get around the 2D handling in calcTicks. - var tickModeCached = axes.tickmode; - if(axes.tickmode === 'auto') { - axes.tickmode = 'linear'; - var nticks = axes.nticks || Lib.constrain((axes._length / 40), 4, 9); - Axes.autoTicks(axes, Math.abs(axes.range[1] - axes.range[0]) / nticks); - } - var dataTicks = Axes.calcTicks(axes); - for(var j = 0; j < dataTicks.length; ++j) { - dataTicks[j].x = dataTicks[j].x * scene.dataScale[i]; - dataTicks[j].text = convertHTMLToUnicode(dataTicks[j].text); + schema: { + subplots: { + xaxis: { + rangeslider: Lib.extendFlat({}, attrs, { + yaxis: oppAxisAttrs + }) } - ticks[i] = dataTicks; - - - axes.tickmode = tickModeCached; - } - } - - axesOptions.ticks = ticks; - - // Calculate tick lengths dynamically - for(var i = 0; i < 3; ++i) { - centerPoint[i] = 0.5 * (scene.glplot.bounds[0][i] + scene.glplot.bounds[1][i]); - for(var j = 0; j < 2; ++j) { - axesOptions.bounds[j][i] = scene.glplot.bounds[j][i]; } - } + }, - scene.contourLevels = contourLevelsFromTicks(ticks); -} + layoutAttributes: _dereq_('./attributes'), + handleDefaults: _dereq_('./defaults'), + calcAutorange: _dereq_('./calc_autorange'), + draw: _dereq_('./draw'), + isVisible: helpers.isVisible, + makeData: helpers.makeData, + autoMarginOpts: helpers.autoMarginOpts +}; -},{"../../../lib":696,"../../../lib/html2unicode":694,"../../cartesian/axes":744}],796:[function(_dereq_,module,exports){ +},{"../../lib":159,"./attributes":111,"./calc_autorange":112,"./defaults":114,"./draw":115,"./helpers":116,"./oppaxis_attributes":118}],118:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - '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; -} +module.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, -module.exports = project; + rangemode: { + valType: 'enumerated', + values: ['auto', 'fixed', 'match'], + dflt: 'match', + + editType: 'calc', + + }, + range: { + valType: 'info_array', + + items: [ + {valType: 'any', editType: 'plot'}, + {valType: 'any', editType: 'plot'} + ], + editType: 'plot', + + }, + editType: 'calc' +}; -},{}],797:[function(_dereq_,module,exports){ +},{}],119:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var createPlot = _dereq_('gl-plot3d'); -var getContext = _dereq_('webgl-context'); -var passiveSupported = _dereq_('has-passive-events'); - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); +var annAttrs = _dereq_('../annotations/attributes'); +var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; +var dash = _dereq_('../drawing/attributes').dash; +var extendFlat = _dereq_('../../lib/extend').extendFlat; +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; -var Axes = _dereq_('../../plots/cartesian/axes'); -var Fx = _dereq_('../../components/fx'); +module.exports = templatedArray('shape', { + visible: { + valType: 'boolean', + + dflt: true, + editType: 'calc+arraydraw', + + }, -var str2RGBAarray = _dereq_('../../lib/str2rgbarray'); -var showNoWebGlMsg = _dereq_('../../lib/show_no_webgl_msg'); + type: { + valType: 'enumerated', + values: ['circle', 'rect', 'path', 'line'], + + editType: 'calc+arraydraw', + + }, -var createCamera = _dereq_('./camera'); -var project = _dereq_('./project'); -var createAxesOptions = _dereq_('./layout/convert'); -var createSpikeOptions = _dereq_('./layout/spikes'); -var computeTickMarks = _dereq_('./layout/tick_marks'); + layer: { + valType: 'enumerated', + values: ['below', 'above'], + dflt: 'above', + + editType: 'arraydraw', + + }, + xref: extendFlat({}, annAttrs.xref, { + + }), + xsizemode: { + valType: 'enumerated', + values: ['scaled', 'pixel'], + dflt: 'scaled', + + editType: 'calc+arraydraw', + + }, + xanchor: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + x0: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + x1: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, -var STATIC_CANVAS, STATIC_CONTEXT; + yref: extendFlat({}, annAttrs.yref, { + + }), + ysizemode: { + valType: 'enumerated', + values: ['scaled', 'pixel'], + dflt: 'scaled', + + editType: 'calc+arraydraw', + + }, + yanchor: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + y0: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, + y1: { + valType: 'any', + + editType: 'calc+arraydraw', + + }, -function render(scene) { - var trace; + path: { + valType: 'string', + + editType: 'calc+arraydraw', + + }, - // update size of svg container - var svgContainer = scene.svgContainer; - var clientRect = scene.container.getBoundingClientRect(); - var width = clientRect.width, height = clientRect.height; - svgContainer.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); - svgContainer.setAttributeNS(null, 'width', width); - svgContainer.setAttributeNS(null, 'height', height); + opacity: { + valType: 'number', + min: 0, + max: 1, + dflt: 1, + + editType: 'arraydraw', + + }, + 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', + + }, + editType: 'arraydraw' +}); - computeTickMarks(scene); - scene.glplot.axes.update(scene.axesOptions); +},{"../../lib/extend":153,"../../plot_api/plot_template":193,"../../traces/scatter/attributes":281,"../annotations/attributes":28,"../drawing/attributes":63}],120:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // check if pick has changed - var keys = Object.keys(scene.traces); - var lastPicked = null; - var selection = scene.glplot.selection; - for(var i = 0; i < keys.length; ++i) { - trace = scene.traces[keys[i]]; - if(trace.data.hoverinfo !== 'skip' && trace.handlePick(selection)) { - lastPicked = trace; - } +'use strict'; - if(trace.setContourLevels) trace.setContourLevels(); - } +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); - function formatter(axisName, val) { - var axis = scene.fullSceneLayout[axisName]; +var constants = _dereq_('./constants'); +var helpers = _dereq_('./helpers'); - return Axes.tickText(axis, axis.d2l(val), 'hover').text; - } - var oldEventData; +module.exports = function calcAutorange(gd) { + var fullLayout = gd._fullLayout; + var shapeList = Lib.filterVisible(fullLayout.shapes); - if(lastPicked !== null) { - var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate); - trace = lastPicked.data; - var ptNumber = selection.index; - var hoverinfo = Fx.castHoverinfo(trace, scene.fullLayout, ptNumber); - var hoverinfoParts = hoverinfo.split('+'); - var isHoverinfoAll = hoverinfo === 'all'; + if(!shapeList.length || !gd._fullData.length) return; - var xVal = formatter('xaxis', selection.traceCoordinate[0]); - var yVal = formatter('yaxis', selection.traceCoordinate[1]); - var zVal = formatter('zaxis', selection.traceCoordinate[2]); + for(var i = 0; i < shapeList.length; i++) { + var shape = shapeList[i]; + shape._extremes = {}; - if(!isHoverinfoAll) { - if(hoverinfoParts.indexOf('x') === -1) xVal = undefined; - if(hoverinfoParts.indexOf('y') === -1) yVal = undefined; - if(hoverinfoParts.indexOf('z') === -1) zVal = undefined; - if(hoverinfoParts.indexOf('text') === -1) selection.textLabel = undefined; - if(hoverinfoParts.indexOf('name') === -1) lastPicked.name = undefined; - } + var ax, bounds; - var tx; + if(shape.xref !== 'paper') { + var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; + var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; + ax = Axes.getFromId(gd, shape.xref); - if(trace.type === 'cone' || trace.type === 'streamtube') { - var vectorTx = []; - if(isHoverinfoAll || hoverinfoParts.indexOf('u') !== -1) { - vectorTx.push('u: ' + formatter('xaxis', selection.traceCoordinate[3])); - } - if(isHoverinfoAll || hoverinfoParts.indexOf('v') !== -1) { - vectorTx.push('v: ' + formatter('yaxis', selection.traceCoordinate[4])); - } - if(isHoverinfoAll || hoverinfoParts.indexOf('w') !== -1) { - vectorTx.push('w: ' + formatter('zaxis', selection.traceCoordinate[5])); - } - if(isHoverinfoAll || hoverinfoParts.indexOf('norm') !== -1) { - vectorTx.push('norm: ' + selection.traceCoordinate[6].toPrecision(3)); - } - if(trace.type === 'streamtube' && (isHoverinfoAll || hoverinfoParts.indexOf('divergence') !== -1)) { - vectorTx.push('divergence: ' + selection.traceCoordinate[7].toPrecision(3)); - } - if(selection.textLabel) { - vectorTx.push(selection.textLabel); + bounds = shapeBounds(ax, vx0, vx1, shape.path, constants.paramIsX); + if(bounds) { + shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcXPaddingOptions(shape)); } - tx = vectorTx.join('
'); - } else { - tx = selection.textLabel; - } - - if(scene.fullSceneLayout.hovermode) { - Fx.loneHover({ - x: (0.5 + 0.5 * pdata[0] / pdata[3]) * width, - y: (0.5 - 0.5 * pdata[1] / pdata[3]) * height, - xLabel: xVal, - yLabel: yVal, - zLabel: zVal, - text: tx, - name: lastPicked.name, - color: Fx.castHoverOption(trace, ptNumber, 'bgcolor') || lastPicked.color, - borderColor: Fx.castHoverOption(trace, ptNumber, 'bordercolor'), - fontFamily: Fx.castHoverOption(trace, ptNumber, 'font.family'), - fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), - fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') - }, { - container: svgContainer, - gd: scene.graphDiv - }); - } - - // TODO not sure if streamtube x/y/z should be emitted as x/y/z - var pointData = { - x: selection.traceCoordinate[0], - y: selection.traceCoordinate[1], - z: selection.traceCoordinate[2], - data: trace._input, - fullData: trace, - curveNumber: trace.index, - pointNumber: ptNumber - }; - - if(trace._module.eventData) { - pointData = trace._module.eventData(pointData, selection, trace, {}, ptNumber); - } - - Fx.appendArrayPointValue(pointData, trace, ptNumber); - - var eventData = {points: [pointData]}; - - if(selection.buttons && selection.distance < 5) { - scene.graphDiv.emit('plotly_click', eventData); - } - else { - scene.graphDiv.emit('plotly_hover', eventData); } - oldEventData = eventData; - } - else { - Fx.loneUnhover(svgContainer); - scene.graphDiv.emit('plotly_unhover', oldEventData); - } - - scene.drawAnnotations(scene); -} + if(shape.yref !== 'paper') { + var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; + var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; + ax = Axes.getFromId(gd, shape.yref); -function initializeGLPlot(scene, fullLayout, canvas, gl) { - var gd = scene.graphDiv; - - var glplotOptions = { - canvas: canvas, - gl: gl, - container: scene.container, - axes: scene.axesOptions, - spikes: scene.spikeOptions, - pickRadius: 10, - snapToData: true, - autoScale: true, - autoBounds: false - }; - - // for static plots, we reuse the WebGL context - // as WebKit doesn't collect them reliably - if(scene.staticMode) { - if(!STATIC_CONTEXT) { - STATIC_CANVAS = document.createElement('canvas'); - STATIC_CONTEXT = getContext({ - canvas: STATIC_CANVAS, - preserveDrawingBuffer: true, - premultipliedAlpha: true, - antialias: true - }); - if(!STATIC_CONTEXT) { - throw new Error('error creating static canvas/context for image server'); + bounds = shapeBounds(ax, vy0, vy1, shape.path, constants.paramIsY); + if(bounds) { + shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcYPaddingOptions(shape)); } } - glplotOptions.pixelRatio = scene.pixelRatio; - glplotOptions.gl = STATIC_CONTEXT; - glplotOptions.canvas = STATIC_CANVAS; - } - - try { - scene.glplot = createPlot(glplotOptions); - } - catch(e) { - /* - * createPlot will throw when webgl is not enabled in the client. - * Lets return an instance of the module with all functions noop'd. - * The destroy method - which will remove the container from the DOM - * is overridden with a function that removes the container only. - */ - return showNoWebGlMsg(scene); - } - - var relayoutCallback = function(scene) { - if(scene.fullSceneLayout.dragmode === false) return; - - var update = {}; - update[scene.id + '.camera'] = getLayoutCamera(scene.camera); - scene.saveCamera(gd.layout); - scene.graphDiv.emit('plotly_relayout', update); - }; - - scene.glplot.canvas.addEventListener('mouseup', relayoutCallback.bind(null, scene)); - scene.glplot.canvas.addEventListener('wheel', relayoutCallback.bind(null, scene), passiveSupported ? {passive: false} : false); - - if(!scene.staticMode) { - scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { - if(gd && gd.emit) { - gd.emit('plotly_webglcontextlost', { - event: event, - layer: scene.id - }); - } - }, false); - } - - if(!scene.camera) { - var cameraData = scene.fullSceneLayout.camera; - scene.camera = createCamera(scene.container, { - center: [cameraData.center.x, cameraData.center.y, cameraData.center.z], - eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z], - up: [cameraData.up.x, cameraData.up.y, cameraData.up.z], - zoomMin: 0.1, - zoomMax: 100, - mode: 'orbit' - }); } +}; - scene.glplot.camera = scene.camera; - - scene.glplot.oncontextloss = function() { - scene.recoverContext(); - }; - - scene.glplot.onrender = render.bind(null, scene); - - // List of scene objects - scene.traces = {}; - - return true; +function calcXPaddingOptions(shape) { + return calcPaddingOptions(shape.line.width, shape.xsizemode, shape.x0, shape.x1, shape.path, false); } -function Scene(options, fullLayout) { - - // create sub container for plot - var sceneContainer = document.createElement('div'); - var plotContainer = options.container; - - // keep a ref to the graph div to fire hover+click events - this.graphDiv = options.graphDiv; - - // create SVG container for hover text - var svgContainer = document.createElementNS( - 'http://www.w3.org/2000/svg', - 'svg'); - svgContainer.style.position = 'absolute'; - svgContainer.style.top = svgContainer.style.left = '0px'; - svgContainer.style.width = svgContainer.style.height = '100%'; - svgContainer.style['z-index'] = 20; - svgContainer.style['pointer-events'] = 'none'; - sceneContainer.appendChild(svgContainer); - this.svgContainer = svgContainer; - - // Tag the container with the sceneID - sceneContainer.id = options.id; - sceneContainer.style.position = 'absolute'; - sceneContainer.style.top = sceneContainer.style.left = '0px'; - sceneContainer.style.width = sceneContainer.style.height = '100%'; - plotContainer.appendChild(sceneContainer); - - this.fullLayout = fullLayout; - this.id = options.id || 'scene'; - this.fullSceneLayout = fullLayout[this.id]; - - // Saved from last call to plot() - this.plotArgs = [ [], {}, {} ]; - - /* - * Move this to calc step? Why does it work here? - */ - this.axesOptions = createAxesOptions(fullLayout[this.id]); - this.spikeOptions = createSpikeOptions(fullLayout[this.id]); - this.container = sceneContainer; - this.staticMode = !!options.staticPlot; - this.pixelRatio = options.plotGlPixelRatio || 2; - - // Coordinate rescaling - this.dataScale = [1, 1, 1]; +function calcYPaddingOptions(shape) { + return calcPaddingOptions(shape.line.width, shape.ysizemode, shape.y0, shape.y1, shape.path, true); +} - this.contourLevels = [ [], [], [] ]; +function calcPaddingOptions(lineWidth, sizeMode, v0, v1, path, isYAxis) { + var ppad = lineWidth / 2; + var axisDirectionReverted = isYAxis; - this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert'); - this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw'); + if(sizeMode === 'pixel') { + var coords = path ? + helpers.extractPathCoords(path, isYAxis ? constants.paramIsY : constants.paramIsX) : + [v0, v1]; + 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; - if(!initializeGLPlot(this, fullLayout)) return; // todo check the necessity for this line + return { + ppad: ppad, + ppadplus: axisDirectionReverted ? beforePad : afterPad, + ppadminus: axisDirectionReverted ? afterPad : beforePad + }; + } else { + return {ppad: ppad}; + } } -var proto = Scene.prototype; - -proto.recoverContext = function() { - var scene = this; - var gl = this.glplot.gl; - var canvas = this.glplot.canvas; - this.glplot.dispose(); +function shapeBounds(ax, v0, v1, path, paramsToUse) { + var convertVal = (ax.type === 'category' || ax.type === 'multicategory') ? ax.r2c : ax.d2c; - function tryRecover() { - if(gl.isContextLost()) { - requestAnimationFrame(tryRecover); - return; - } - if(!initializeGLPlot(scene, scene.fullLayout, canvas, gl)) { - Lib.error('Catastrophic and unrecoverable WebGL error. Context lost.'); - return; - } - scene.plot.apply(scene, scene.plotArgs); - } - requestAnimationFrame(tryRecover); -}; + if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; + if(!path) return; -var axisProperties = [ 'xaxis', 'yaxis', 'zaxis' ]; + var min = Infinity; + var max = -Infinity; + var segments = path.match(constants.segmentRE); + var i; + var segment; + var drawnParam; + var params; + var val; -function computeTraceBounds(scene, trace, bounds) { - var sceneLayout = scene.fullSceneLayout; + if(ax.type === 'date') convertVal = helpers.decodeDate(convertVal); - for(var d = 0; d < 3; d++) { - var axisName = axisProperties[d]; - var axLetter = axisName.charAt(0); - var ax = sceneLayout[axisName]; - var coords = trace[axLetter]; - var calendar = trace[axLetter + 'calendar']; - var len = trace['_' + axLetter + 'length']; + for(i = 0; i < segments.length; i++) { + segment = segments[i]; + drawnParam = paramsToUse[segment.charAt(0)].drawn; + if(drawnParam === undefined) continue; - if(!Lib.isArrayOrTypedArray(coords)) { - bounds[0][d] = Math.min(bounds[0][d], 0); - bounds[1][d] = Math.max(bounds[1][d], len - 1); - } else { - var v; + params = segments[i].substr(1).match(constants.paramRE); + if(!params || params.length < drawnParam) continue; - for(var i = 0; i < (len || coords.length); i++) { - if(Lib.isArrayOrTypedArray(coords[i])) { - for(var j = 0; j < coords[i].length; ++j) { - v = ax.d2l(coords[i][j], 0, calendar); - if(!isNaN(v) && isFinite(v)) { - bounds[0][d] = Math.min(bounds[0][d], v); - bounds[1][d] = Math.max(bounds[1][d], v); - } - } - } else { - v = ax.d2l(coords[i], 0, calendar); - if(!isNaN(v) && isFinite(v)) { - bounds[0][d] = Math.min(bounds[0][d], v); - bounds[1][d] = Math.max(bounds[1][d], v); - } - } - } - } + val = convertVal(params[drawnParam]); + if(val < min) min = val; + if(val > max) max = val; } + if(max >= min) return [min, max]; } -proto.plot = function(sceneData, fullLayout, layout) { +},{"../../lib":159,"../../plots/cartesian/axes":203,"./constants":121,"./helpers":124}],121:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // Save parameters - this.plotArgs = [sceneData, fullLayout, layout]; - if(this.glplot.contextLost) return; +'use strict'; - var data, trace; - var i, j, axis, axisType; - var fullSceneLayout = fullLayout[this.id]; - var sceneLayout = layout[this.id]; - if(fullSceneLayout.bgcolor) this.glplot.clearColor = str2RGBAarray(fullSceneLayout.bgcolor); - else this.glplot.clearColor = [0, 0, 0, 0]; +module.exports = { + segmentRE: /[MLHVQCTSZ][^MLHVQCTSZ]*/g, + paramRE: /[^\s,]+/g, - this.glplot.snapToData = true; + // 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: {} + }, - // Update layout - this.fullLayout = fullLayout; - this.fullSceneLayout = fullSceneLayout; + 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: {} + }, - this.glplotLayout = fullSceneLayout; - this.axesOptions.merge(fullSceneLayout); - this.spikeOptions.merge(fullSceneLayout); + numParams: { + M: 2, + L: 2, + H: 1, + V: 1, + Q: 4, + C: 6, + T: 2, + S: 4, + // A: 7, + Z: 0 + } +}; - // Update camera and camera mode - this.setCamera(fullSceneLayout.camera); - this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode); +},{}],122:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // Update scene - this.glplot.update({}); - // Update axes functions BEFORE updating traces - this.setConvert(axis); +'use strict'; - // Convert scene data - if(!sceneData) sceneData = []; - else if(!Array.isArray(sceneData)) sceneData = [sceneData]; +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - // Compute trace bounding box - var dataBounds = [ - [Infinity, Infinity, Infinity], - [-Infinity, -Infinity, -Infinity] - ]; - for(i = 0; i < sceneData.length; ++i) { - data = sceneData[i]; - if(data.visible !== true) continue; - - computeTraceBounds(this, data, dataBounds); - } - var dataScale = [1, 1, 1]; - for(j = 0; j < 3; ++j) { - if(dataBounds[1][j] === dataBounds[0][j]) { - dataScale[j] = 1.0; - } - else { - dataScale[j] = 1.0 / (dataBounds[1][j] - dataBounds[0][j]); - } - } +var attributes = _dereq_('./attributes'); +var helpers = _dereq_('./helpers'); - // Save scale - this.dataScale = dataScale; - // after computeTraceBounds where ax._categories are filled in - this.convertAnnotations(this); +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + handleArrayContainerDefaults(layoutIn, layoutOut, { + name: 'shapes', + handleItemDefaults: handleShapeDefaults + }); +}; - // Update traces - for(i = 0; i < sceneData.length; ++i) { - data = sceneData[i]; - if(data.visible !== true) { - continue; - } - trace = this.traces[data.uid]; - if(trace) { - if(trace.data.type === data.type) { - trace.update(data); - } else { - trace.dispose(); - trace = data._module.plot(this, data); - this.traces[data.uid] = trace; - } - } else { - trace = data._module.plot(this, data); - this.traces[data.uid] = trace; - } - trace.name = data.name; +function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { + function coerce(attr, dflt) { + return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } - // Remove empty traces - var traceIds = Object.keys(this.traces); + var visible = coerce('visible'); - trace_id_loop: - for(i = 0; i < traceIds.length; ++i) { - for(j = 0; j < sceneData.length; ++j) { - if(sceneData[j].uid === traceIds[i] && sceneData[j].visible === true) { - continue trace_id_loop; - } - } - trace = this.traces[traceIds[i]]; - trace.dispose(); - delete this.traces[traceIds[i]]; - } + if(!visible) return; - // order object per trace index - this.glplot.objects.sort(function(a, b) { - return a._trace.data.index - b._trace.data.index; - }); + coerce('layer'); + coerce('opacity'); + coerce('fillcolor'); + coerce('line.color'); + coerce('line.width'); + coerce('line.dash'); + + var dfltType = shapeIn.path ? 'path' : 'rect'; + var shapeType = coerce('type', dfltType); + var xSizeMode = coerce('xsizemode'); + var ySizeMode = coerce('ysizemode'); - // Update ranges (needs to be called *after* objects are added due to updates) - var sceneBounds = [[0, 0, 0], [0, 0, 0]], - axisDataRange = [], - axisTypeRatios = {}; + // positioning + 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; - for(i = 0; i < 3; ++i) { - axis = fullSceneLayout[axisProperties[i]]; - axisType = axis.type; + // xref, yref + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); - if(axisType in axisTypeRatios) { - axisTypeRatios[axisType].acc *= dataScale[i]; - axisTypeRatios[axisType].count += 1; + if(axRef !== 'paper') { + ax = Axes.getFromId(gdMock, axRef); + ax._shapeIndices.push(shapeOut._index); + r2pos = helpers.rangeToShapePosition(ax); + pos2r = helpers.shapePositionToRange(ax); } else { - axisTypeRatios[axisType] = { - acc: dataScale[i], - count: 1 - }; + pos2r = r2pos = Lib.identity; } - if(axis.autorange) { - sceneBounds[0][i] = Infinity; - sceneBounds[1][i] = -Infinity; - - var objects = this.glplot.objects; - var annotations = this.fullSceneLayout.annotations || []; - var axLetter = axis._name.charAt(0); - - for(j = 0; j < objects.length; j++) { - var obj = objects[j]; - var objBounds = obj.bounds; - var pad = obj._trace.data._pad || 0; - - if(obj.constructor.name === 'ErrorBars' && axis._lowerLogErrorBound) { - sceneBounds[0][i] = Math.min(sceneBounds[0][i], axis._lowerLogErrorBound); - } else { - sceneBounds[0][i] = Math.min(sceneBounds[0][i], objBounds[0][i] / dataScale[i] - pad); - } - sceneBounds[1][i] = Math.max(sceneBounds[1][i], objBounds[1][i] / dataScale[i] + pad); - } - - for(j = 0; j < annotations.length; j++) { - var ann = annotations[j]; + // Coerce x0, x1, y0, y1 + if(shapeType !== 'path') { + var dflt0 = 0.25; + var dflt1 = 0.75; - // N.B. not taking into consideration the arrowhead - if(ann.visible) { - var pos = axis.r2l(ann[axLetter]); - sceneBounds[0][i] = Math.min(sceneBounds[0][i], pos); - sceneBounds[1][i] = Math.max(sceneBounds[1][i], pos); - } - } + // hack until V2.0 when log has regular range behavior - make it look like other + // ranges to send to coerce, then put it back after + // this is all to give reasonable default position behavior on log axes, which is + // a pretty unimportant edge case so we could just ignore this. + 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('rangemode' in axis && axis.rangemode === 'tozero') { - sceneBounds[0][i] = Math.min(sceneBounds[0][i], 0); - sceneBounds[1][i] = Math.max(sceneBounds[1][i], 0); - } - if(sceneBounds[0][i] > sceneBounds[1][i]) { - sceneBounds[0][i] = -1; - sceneBounds[1][i] = 1; + if(sizeMode === 'pixel') { + coerce(attr0, 0); + coerce(attr1, 10); } else { - var d = sceneBounds[1][i] - sceneBounds[0][i]; - sceneBounds[0][i] -= d / 32.0; - sceneBounds[1][i] += d / 32.0; + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); } - if(axis.autorange === 'reversed') { - // swap bounds: - var tmp = sceneBounds[0][i]; - sceneBounds[0][i] = sceneBounds[1][i]; - sceneBounds[1][i] = tmp; - } - } else { - var range = axis.range; - sceneBounds[0][i] = axis.r2l(range[0]); - sceneBounds[1][i] = axis.r2l(range[1]); - } - if(sceneBounds[0][i] === sceneBounds[1][i]) { - sceneBounds[0][i] -= 1; - sceneBounds[1][i] += 1; + // hack part 2 + shapeOut[attr0] = r2pos(shapeOut[attr0]); + shapeOut[attr1] = r2pos(shapeOut[attr1]); + shapeIn[attr0] = in0; + shapeIn[attr1] = in1; } - axisDataRange[i] = sceneBounds[1][i] - sceneBounds[0][i]; - // Update plot bounds - this.glplot.bounds[0][i] = sceneBounds[0][i] * dataScale[i]; - this.glplot.bounds[1][i] = sceneBounds[1][i] * dataScale[i]; - } + // Coerce xanchor and yanchor + if(sizeMode === 'pixel') { + // Hack for log axis described above + var inAnchor = shapeIn[attrAnchor]; + shapeIn[attrAnchor] = pos2r(shapeIn[attrAnchor], true); - var axesScaleRatio = [1, 1, 1]; + Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attrAnchor, 0.25); - // Compute axis scale per category - for(i = 0; i < 3; ++i) { - axis = fullSceneLayout[axisProperties[i]]; - axisType = axis.type; - var axisRatio = axisTypeRatios[axisType]; - axesScaleRatio[i] = Math.pow(axisRatio.acc, 1.0 / axisRatio.count) / dataScale[i]; + // Hack part 2 + shapeOut[attrAnchor] = r2pos(shapeOut[attrAnchor]); + shapeIn[attrAnchor] = inAnchor; + } } - /* - * Dynamically set the aspect ratio depending on the users aspect settings - */ - var axisAutoScaleFactor = 4; - var aspectRatio; - - if(fullSceneLayout.aspectmode === 'auto') { - - if(Math.max.apply(null, axesScaleRatio) / Math.min.apply(null, axesScaleRatio) <= axisAutoScaleFactor) { + if(shapeType === 'path') { + coerce('path'); + } + else { + Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']); + } +} - /* - * USE DATA MODE WHEN AXIS RANGE DIMENSIONS ARE RELATIVELY EQUAL - */ +},{"../../lib":159,"../../plots/array_container_defaults":199,"../../plots/cartesian/axes":203,"./attributes":119,"./helpers":124}],123:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - aspectRatio = axesScaleRatio; - } else { - /* - * USE EQUAL MODE WHEN AXIS RANGE DIMENSIONS ARE HIGHLY UNEQUAL - */ - aspectRatio = [1, 1, 1]; - } +'use strict'; - } else if(fullSceneLayout.aspectmode === 'cube') { - aspectRatio = [1, 1, 1]; +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var Color = _dereq_('../color'); +var Drawing = _dereq_('../drawing'); +var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; - } else if(fullSceneLayout.aspectmode === 'data') { - aspectRatio = axesScaleRatio; +var dragElement = _dereq_('../dragelement'); +var setCursor = _dereq_('../../lib/setcursor'); - } else if(fullSceneLayout.aspectmode === 'manual') { - var userRatio = fullSceneLayout.aspectratio; - aspectRatio = [userRatio.x, userRatio.y, userRatio.z]; +var constants = _dereq_('./constants'); +var helpers = _dereq_('./helpers'); - } else { - throw new Error('scene.js aspectRatio was not one of the enumerated types'); - } - /* - * Write aspect Ratio back to user data and fullLayout so that it is modifies as user - * manipulates the aspectmode settings and the fullLayout is up-to-date. - */ - fullSceneLayout.aspectratio.x = sceneLayout.aspectratio.x = aspectRatio[0]; - fullSceneLayout.aspectratio.y = sceneLayout.aspectratio.y = aspectRatio[1]; - fullSceneLayout.aspectratio.z = sceneLayout.aspectratio.z = aspectRatio[2]; +// Shapes are stored in gd.layout.shapes, an array of objects +// index can point to one item in this array, +// or non-numeric to simply add a new one +// or -1 to modify all existing +// opt can be the full options object, or one key (to be set to value) +// or undefined to simply redraw +// if opt is blank, val can be 'add' or a full options object to add a new +// annotation at that point in the array, or 'remove' to delete this one - /* - * Finally assign the computed aspecratio to the glplot module. This will have an effect - * on the next render cycle. - */ - this.glplot.aspect = aspectRatio; +module.exports = { + draw: draw, + drawOne: drawOne +}; +function draw(gd) { + var fullLayout = gd._fullLayout; - // Update frame position for multi plots - var domain = fullSceneLayout.domain || null, - size = fullLayout._size || null; + // Remove previous shapes before drawing new in shapes in fullLayout.shapes + fullLayout._shapeUpperLayer.selectAll('path').remove(); + fullLayout._shapeLowerLayer.selectAll('path').remove(); - if(domain && size) { - var containerStyle = this.container.style; - containerStyle.position = 'absolute'; - containerStyle.left = (size.l + domain.x[0] * size.w) + 'px'; - containerStyle.top = (size.t + (1 - domain.y[1]) * size.h) + 'px'; - containerStyle.width = (size.w * (domain.x[1] - domain.x[0])) + 'px'; - containerStyle.height = (size.h * (domain.y[1] - domain.y[0])) + 'px'; + for(var k in fullLayout._plots) { + var shapelayer = fullLayout._plots[k].shapelayer; + if(shapelayer) shapelayer.selectAll('path').remove(); } - // force redraw so that promise is returned when rendering is completed - this.glplot.redraw(); -}; - -proto.destroy = function() { - if(!this.glplot) return; - - this.camera.mouseListener.enabled = false; - this.container.removeEventListener('wheel', this.camera.wheelListener); - this.camera = this.glplot.camera = null; - this.glplot.dispose(); - this.container.parentNode.removeChild(this.container); - this.glplot = null; -}; - -// getOrbitCamera :: plotly_coords -> orbit_camera_coords -// inverse of getLayoutCamera -function getOrbitCamera(camera) { - return [ - [camera.eye.x, camera.eye.y, camera.eye.z], - [camera.center.x, camera.center.y, camera.center.z], - [camera.up.x, camera.up.y, camera.up.z] - ]; -} + for(var i = 0; i < fullLayout.shapes.length; i++) { + if(fullLayout.shapes[i].visible) { + drawOne(gd, i); + } + } -// getLayoutCamera :: orbit_camera_coords -> plotly_coords -// inverse of getOrbitCamera -function getLayoutCamera(camera) { - return { - up: {x: camera.up[0], y: camera.up[1], z: camera.up[2]}, - center: {x: camera.center[0], y: camera.center[1], z: camera.center[2]}, - eye: {x: camera.eye[0], y: camera.eye[1], z: camera.eye[2]} - }; + // may need to resurrect this if we put text (LaTeX) in shapes + // return Plots.previousPromises(gd); } -// get camera position in plotly coords from 'orbit-camera' coords -proto.getCamera = function getCamera() { - this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()); - return getLayoutCamera(this.glplot.camera); -}; +function drawOne(gd, index) { + // remove the existing shape if there is one. + // because indices can change, we need to look in all shape layers + gd._fullLayout._paperdiv + .selectAll('.shapelayer [data-index="' + index + '"]') + .remove(); -// set camera position with a set of plotly coords -proto.setCamera = function setCamera(cameraData) { - this.glplot.camera.lookAt.apply(this, getOrbitCamera(cameraData)); -}; + var options = gd._fullLayout.shapes[index] || {}; -// save camera to user layout (i.e. gd.layout) -proto.saveCamera = function saveCamera(layout) { - var cameraData = this.getCamera(), - cameraNestedProp = Lib.nestedProperty(layout, this.id + '.camera'), - cameraDataLastSave = cameraNestedProp.get(), - hasChanged = false; + // this shape is gone - quit now after deleting it + // TODO: use d3 idioms instead of deleting and redrawing every time + if(!options._input || options.visible === false) return; - function same(x, y, i, j) { - var vectors = ['up', 'center', 'eye'], - components = ['x', 'y', 'z']; - return y[vectors[i]] && (x[vectors[i]][components[j]] === y[vectors[i]][components[j]]); + if(options.layer !== 'below') { + drawShape(gd._fullLayout._shapeUpperLayer); + } + else if(options.xref === 'paper' || options.yref === 'paper') { + drawShape(gd._fullLayout._shapeLowerLayer); } - - if(cameraDataLastSave === undefined) hasChanged = true; else { - for(var i = 0; i < 3; i++) { - for(var j = 0; j < 3; j++) { - if(!same(cameraData, cameraDataLastSave, i, j)) { - hasChanged = true; - break; - } - } + var plotinfo = gd._fullLayout._plots[options.xref + options.yref]; + if(plotinfo) { + var mainPlot = plotinfo.mainplotinfo || plotinfo; + drawShape(mainPlot.shapelayer); + } + else { + // Fall back to _shapeLowerLayer in case the requested subplot doesn't exist. + // This can happen if you reference the shape to an x / y axis combination + // that doesn't have any data on it (and layer is below) + drawShape(gd._fullLayout._shapeLowerLayer); } } - if(hasChanged) cameraNestedProp.set(cameraData); - - return hasChanged; -}; - -proto.updateFx = function(dragmode, hovermode) { - var camera = this.camera; - - if(camera) { - // rotate and orbital are synonymous - if(dragmode === 'orbit') { - camera.mode = 'orbit'; - camera.keyBindingMode = 'rotate'; + function drawShape(shapeLayer) { + var attrs = { + 'data-index': index, + 'fill-rule': 'evenodd', + d: getPathString(gd, options) + }; + var lineColor = options.line.width ? options.line.color : 'rgba(0,0,0,0)'; - } else if(dragmode === 'turntable') { - camera.up = [0, 0, 1]; - camera.mode = 'turntable'; - camera.keyBindingMode = 'rotate'; + var path = shapeLayer.append('path') + .attr(attrs) + .style('opacity', options.opacity) + .call(Color.stroke, lineColor) + .call(Color.fill, options.fillcolor) + .call(Drawing.dashLine, options.line.dash, options.line.width); - } else { + setClipPath(path, gd, options); - // none rotation modes [pan or zoom] - camera.keyBindingMode = dragmode; - } + if(gd._context.edits.shapePosition) setupDragElement(gd, path, options, index, shapeLayer); } +} - // to put dragmode and hovermode on the same grounds from relayout - this.fullSceneLayout.hovermode = hovermode; -}; +function setClipPath(shapePath, gd, shapeOptions) { + // note that for layer="below" the clipAxes can be different from the + // subplot we're drawing this in. This could cause problems if the shape + // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); -proto.toImage = function(format) { - if(!format) format = 'png'; + Drawing.setClipUrl( + shapePath, + clipAxes ? 'clip' + gd._fullLayout._uid + clipAxes : null, + gd + ); +} - if(this.staticMode) this.container.appendChild(STATIC_CANVAS); +function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer) { + var MINWIDTH = 10; + var MINHEIGHT = 10; - // Force redraw - this.glplot.redraw(); + var xPixelSized = shapeOptions.xsizemode === 'pixel'; + var yPixelSized = shapeOptions.ysizemode === 'pixel'; + var isLine = shapeOptions.type === 'line'; + var isPath = shapeOptions.type === 'path'; - // Grab context and yank out pixels - var gl = this.glplot.gl; - var w = gl.drawingBufferWidth; - var h = gl.drawingBufferHeight; + var editHelpers = arrayEditor(gd.layout, 'shapes', shapeOptions); + var modifyItem = editHelpers.modifyItem; - gl.bindFramebuffer(gl.FRAMEBUFFER, null); + var x0, y0, x1, y1, xAnchor, yAnchor; + var n0, s0, w0, e0, optN, optS, optW, optE; + var pathIn; - var pixels = new Uint8Array(w * h * 4); - gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + // setup conversion functions + var xa = Axes.getFromId(gd, shapeOptions.xref); + var ya = Axes.getFromId(gd, shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa); + var y2p = helpers.getDataToPixel(gd, ya, true); + var p2x = helpers.getPixelToData(gd, xa); + var p2y = helpers.getPixelToData(gd, ya, true); - // Flip pixels - for(var j = 0, k = h - 1; j < k; ++j, --k) { - for(var i = 0; i < w; ++i) { - for(var l = 0; l < 4; ++l) { - var tmp = pixels[4 * (w * j + i) + l]; - pixels[4 * (w * j + i) + l] = pixels[4 * (w * k + i) + l]; - pixels[4 * (w * k + i) + l] = tmp; - } - } - } + var sensoryElement = obtainSensoryElement(); + var dragOptions = { + element: sensoryElement.node(), + gd: gd, + prepFn: startDrag, + doneFn: endDrag, + clickFn: abortDrag + }; + var dragMode; - var canvas = document.createElement('canvas'); - canvas.width = w; - canvas.height = h; - var context = canvas.getContext('2d'); - var imageData = context.createImageData(w, h); - imageData.data.set(pixels); - context.putImageData(imageData, 0, 0); + dragElement.init(dragOptions); - var dataURL; + sensoryElement.node().onmousemove = updateDragMode; - switch(format) { - case 'jpeg': - dataURL = canvas.toDataURL('image/jpeg'); - break; - case 'webp': - dataURL = canvas.toDataURL('image/webp'); - break; - default: - dataURL = canvas.toDataURL('image/png'); + function obtainSensoryElement() { + return isLine ? createLineDragHandles() : shapePath; } - if(this.staticMode) this.container.removeChild(STATIC_CANVAS); - - return dataURL; -}; + function createLineDragHandles() { + var minSensoryWidth = 10; + var sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth); -proto.setConvert = function() { - for(var i = 0; i < 3; i++) { - var ax = this.fullSceneLayout[axisProperties[i]]; - Axes.setConvert(ax, this.fullLayout); - ax.setScale = Lib.noop; - } -}; + // Helper shapes group + // Note that by setting the `data-index` attr, it is ensured that + // the helper group is purged in this modules `draw` function + var g = shapeLayer.append('g') + .attr('data-index', index); -module.exports = Scene; + // Helper path for moving + g.append('path') + .attr('d', shapePath.attr('d')) + .style({ + 'cursor': 'move', + 'stroke-width': sensoryWidth, + 'stroke-opacity': '0' // ensure not visible + }); -},{"../../components/fx":612,"../../lib":696,"../../lib/show_no_webgl_msg":717,"../../lib/str2rgbarray":719,"../../plots/cartesian/axes":744,"../../registry":827,"./camera":786,"./layout/convert":791,"./layout/spikes":794,"./layout/tick_marks":795,"./project":796,"gl-plot3d":277,"has-passive-events":394,"webgl-context":533}],798:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // Helper circles for resizing + var circleStyle = { + 'fill-opacity': '0' // ensure not visible + }; + var circleRadius = sensoryWidth / 2 > minSensoryWidth ? sensoryWidth / 2 : minSensoryWidth; -'use strict'; + g.append('circle') + .attr({ + 'data-line-point': 'start-point', + 'cx': xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x0 : x2p(shapeOptions.x0), + 'cy': yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y0 : y2p(shapeOptions.y0), + 'r': circleRadius + }) + .style(circleStyle) + .classed('cursor-grab', true); -module.exports = function zip3(x, y, z, len) { - len = len || x.length; + g.append('circle') + .attr({ + 'data-line-point': 'end-point', + 'cx': xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x1 : x2p(shapeOptions.x1), + 'cy': yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y1 : y2p(shapeOptions.y1), + 'r': circleRadius + }) + .style(circleStyle) + .classed('cursor-grab', true); - var result = new Array(len); - for(var i = 0; i < len; i++) { - result[i] = [x[i], y[i], z[i]]; + return g; } - return result; -}; - -},{}],799:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; + function updateDragMode(evt) { + 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 { + // element might not be on screen at time of setup, + // so obtain bounding box here + var dragBBox = dragOptions.element.getBoundingClientRect(); -var fontAttrs = _dereq_('./font_attributes'); -var colorAttrs = _dereq_('../components/color/attributes'); + // choose 'move' or 'resize' + // based on initial position of cursor within the drag element + 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'; -var globalFont = fontAttrs({ - editType: 'calc', - -}); -globalFont.family.dflt = '"Open Sans", verdana, arial, sans-serif'; -globalFont.size.dflt = 12; -globalFont.color.dflt = colorAttrs.defaultLine; + setCursor(shapePath, cursor); -module.exports = { - font: globalFont, - title: { - valType: 'string', - - editType: 'layoutstyle', - - }, - titlefont: fontAttrs({ - editType: 'layoutstyle', - - }), - 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', - - }, - width: { - valType: 'number', - - min: 10, - dflt: 700, - editType: 'plot', - - }, - height: { - valType: 'number', - - min: 10, - dflt: 450, - editType: 'plot', - - }, - margin: { - l: { - valType: 'number', - - min: 0, - dflt: 80, - editType: 'plot', - - }, - r: { - valType: 'number', - - min: 0, - dflt: 80, - editType: 'plot', - - }, - t: { - valType: 'number', - - min: 0, - dflt: 100, - editType: 'plot', - - }, - b: { - valType: 'number', - - min: 0, - dflt: 80, - editType: 'plot', - - }, - pad: { - valType: 'number', - - min: 0, - dflt: 0, - editType: 'plot', - - }, - autoexpand: { - valType: 'boolean', - - dflt: true, - editType: 'plot' - }, - editType: 'plot' - }, - paper_bgcolor: { - valType: 'color', - - dflt: colorAttrs.background, - editType: 'plot', - - }, - 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', - - }, - separators: { - valType: 'string', - - editType: 'plot', - - }, - hidesources: { - valType: 'boolean', - - dflt: false, - editType: 'plot', - - }, - showlegend: { - // handled in legend.supplyLayoutDefaults - // but included here because it's not in the legend object - valType: 'boolean', - - editType: 'legend', - - }, - colorway: { - valType: 'colorlist', - dflt: colorAttrs.defaults, - - editType: 'calc', - - }, - datarevision: { - valType: 'any', - - editType: 'calc', - - }, - template: { - valType: 'any', - - editType: 'calc', - - }, - modebar: { - orientation: { - valType: 'enumerated', - values: ['v', 'h'], - dflt: 'h', - - editType: 'modebar', - - }, - bgcolor: { - valType: 'color', - - editType: 'modebar', - - }, - color: { - valType: 'color', - - editType: 'modebar', - - }, - activecolor: { - valType: 'color', - - editType: 'modebar', - - }, - editType: 'modebar' + // possible values 'move', 'sw', 'w', 'se', 'e', 'ne', 'n', 'nw' and 'w' + dragMode = cursor.split('-')[0]; + } } -}; -},{"../components/color/attributes":569,"./font_attributes":771}],800:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var requiredVersion = '0.45.0'; + function startDrag(evt) { + // setup update strings and initial values + if(xPixelSized) { + xAnchor = x2p(shapeOptions.xanchor); + } + if(yPixelSized) { + yAnchor = y2p(shapeOptions.yanchor); + } -module.exports = { - requiredVersion: requiredVersion, + if(shapeOptions.type === 'path') { + pathIn = shapeOptions.path; + } + else { + x0 = xPixelSized ? shapeOptions.x0 : x2p(shapeOptions.x0); + y0 = yPixelSized ? shapeOptions.y0 : y2p(shapeOptions.y0); + x1 = xPixelSized ? shapeOptions.x1 : x2p(shapeOptions.x1); + y1 = yPixelSized ? shapeOptions.y1 : y2p(shapeOptions.y1); + } - styleUrlPrefix: 'mapbox://styles/mapbox/', - styleUrlSuffix: 'v9', + if(x0 < x1) { + w0 = x0; + optW = 'x0'; + e0 = x1; + optE = 'x1'; + } + else { + w0 = x1; + optW = 'x1'; + e0 = x0; + optE = 'x0'; + } - controlContainerClassName: 'mapboxgl-control-container', + // For fixed size shapes take opposing direction of y-axis into account. + // Hint: For data sized shapes this is done by the y2p function. + if((!yPixelSized && y0 < y1) || (yPixelSized && y0 > y1)) { + n0 = y0; + optN = 'y0'; + s0 = y1; + optS = 'y1'; + } + else { + n0 = y1; + optN = 'y1'; + s0 = y0; + optS = 'y0'; + } - wrongVersionErrorMsg: [ - 'Your custom plotly.js bundle is not using the correct mapbox-gl version', - 'Please install mapbox-gl@' + requiredVersion + '.' - ].join('\n'), + // setup dragMode and the corresponding handler + updateDragMode(evt); + renderVisualCues(shapeLayer, shapeOptions); + deactivateClipPathTemporarily(shapePath, shapeOptions, gd); + dragOptions.moveFn = (dragMode === 'move') ? moveShape : resizeShape; + } - noAccessTokenErrorMsg: [ - 'Missing Mapbox access token.', - 'Mapbox trace type require a Mapbox access token to be registered.', - 'For example:', - ' Plotly.plot(gd, data, layout, { mapboxAccessToken: \'my-access-token\' });', - 'More info here: https://www.mapbox.com/help/define-access-token/' - ].join('\n'), + function endDrag() { + setCursor(shapePath); + removeVisualCues(shapeLayer); - mapOnErrorMsg: 'Mapbox error.', + // Don't rely on clipPath being activated during re-layout + setClipPath(shapePath, gd, shapeOptions); + Registry.call('_guiRelayout', gd, editHelpers.getUpdateObj()); + } - // a subset of node_modules/mapbox-gl/dist/mapbox-gl.css - styleRules: { - map: 'overflow:hidden;position:relative;', - 'missing-css': 'display:none', + function abortDrag() { + removeVisualCues(shapeLayer); } -}; -},{}],801:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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 moveX(x) { return p2x(x2p(x) + dx); }; + if(xa && xa.type === 'date') moveX = helpers.encodeDate(moveX); + } -'use strict'; + if(yPixelSized) { + modifyItem('yanchor', shapeOptions.yanchor = p2y(yAnchor + dy)); + } else { + moveY = function moveY(y) { return p2y(y2p(y) + dy); }; + if(ya && ya.type === 'date') moveY = helpers.encodeDate(moveY); + } -var Lib = _dereq_('../../lib'); + modifyItem('path', shapeOptions.path = movePath(pathIn, moveX, moveY)); + } + else { + if(xPixelSized) { + modifyItem('xanchor', shapeOptions.xanchor = p2x(xAnchor + dx)); + } else { + modifyItem('x0', shapeOptions.x0 = p2x(x0 + dx)); + modifyItem('x1', shapeOptions.x1 = p2x(x1 + dx)); + } -/** - * Convert plotly.js 'textposition' to mapbox-gl 'anchor' and 'offset' - * (with the help of the icon size). - * - * @param {string} textpostion : plotly.js textposition value - * @param {number} iconSize : plotly.js icon size (e.g. marker.size for traces) - * - * @return {object} - * - anchor - * - offset - */ -module.exports = function convertTextOpts(textposition, iconSize) { - var parts = textposition.split(' '), - vPos = parts[0], - hPos = parts[1]; - - // ballpack values - var factor = Lib.isArrayOrTypedArray(iconSize) ? Lib.mean(iconSize) : iconSize, - xInc = 0.5 + (factor / 100), - yInc = 1.5 + (factor / 100); - - var anchorVals = ['', ''], - offset = [0, 0]; - - switch(vPos) { - case 'top': - anchorVals[0] = 'top'; - offset[1] = -yInc; - break; - case 'bottom': - anchorVals[0] = 'bottom'; - offset[1] = yInc; - break; - } + if(yPixelSized) { + modifyItem('yanchor', shapeOptions.yanchor = p2y(yAnchor + dy)); + } else { + modifyItem('y0', shapeOptions.y0 = p2y(y0 + dy)); + modifyItem('y1', shapeOptions.y1 = p2y(y1 + dy)); + } + } - switch(hPos) { - case 'left': - anchorVals[1] = 'right'; - offset[0] = -xInc; - break; - case 'right': - anchorVals[1] = 'left'; - offset[0] = xInc; - break; + shapePath.attr('d', getPathString(gd, shapeOptions)); + renderVisualCues(shapeLayer, shapeOptions); } - // Mapbox text-anchor must be one of: - // center, left, right, top, bottom, - // top-left, top-right, bottom-left, bottom-right - - var anchor; - if(anchorVals[0] && anchorVals[1]) anchor = anchorVals.join('-'); - else if(anchorVals[0]) anchor = anchorVals[0]; - else if(anchorVals[1]) anchor = anchorVals[1]; - else anchor = 'center'; + function resizeShape(dx, dy) { + if(isPath) { + // TODO: implement path resize, don't forget to update dragMode code + var noOp = function(coord) { return coord; }; + var moveX = noOp; + var moveY = noOp; - return { anchor: anchor, offset: offset }; -}; + if(xPixelSized) { + modifyItem('xanchor', shapeOptions.xanchor = p2x(xAnchor + dx)); + } else { + moveX = function moveX(x) { return p2x(x2p(x) + dx); }; + if(xa && xa.type === 'date') moveX = helpers.encodeDate(moveX); + } -},{"../../lib":696}],802:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(yPixelSized) { + modifyItem('yanchor', shapeOptions.yanchor = p2y(yAnchor + dy)); + } else { + moveY = function moveY(y) { return p2y(y2p(y) + dy); }; + if(ya && ya.type === 'date') moveY = helpers.encodeDate(moveY); + } -'use strict'; + modifyItem('path', shapeOptions.path = movePath(pathIn, moveX, moveY)); + } + else if(isLine) { + if(dragMode === 'resize-over-start-point') { + var newX0 = x0 + dx; + var newY0 = yPixelSized ? y0 - dy : y0 + 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 = x1 + dx; + var newY1 = yPixelSized ? y1 - dy : y1 + dy; + modifyItem('x1', shapeOptions.x1 = xPixelSized ? newX1 : p2x(newX1)); + modifyItem('y1', shapeOptions.y1 = yPixelSized ? newY1 : p2y(newY1)); + } + } + else { + var newN = (~dragMode.indexOf('n')) ? n0 + dy : n0; + var newS = (~dragMode.indexOf('s')) ? s0 + dy : s0; + var newW = (~dragMode.indexOf('w')) ? w0 + dx : w0; + var newE = (~dragMode.indexOf('e')) ? e0 + dx : e0; -var mapboxgl = _dereq_('mapbox-gl'); + // Do things in opposing direction for y-axis. + // Hint: for data-sized shapes the reversal of axis direction is done in p2y. + if(~dragMode.indexOf('n') && yPixelSized) newN = n0 - dy; + if(~dragMode.indexOf('s') && yPixelSized) newS = s0 - dy; -var Lib = _dereq_('../../lib'); -var getSubplotCalcData = _dereq_('../../plots/get_data').getSubplotCalcData; -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); + // Update shape eventually. Again, be aware of the + // opposing direction of the y-axis of fixed size shapes. + 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)); + } + } -var createMapbox = _dereq_('./mapbox'); -var constants = _dereq_('./constants'); + shapePath.attr('d', getPathString(gd, shapeOptions)); + renderVisualCues(shapeLayer, shapeOptions); + } -var MAPBOX = 'mapbox'; + function renderVisualCues(shapeLayer, shapeOptions) { + if(xPixelSized || yPixelSized) { + renderAnchor(); + } -for(var k in constants.styleRules) { - Lib.addStyleRule('.mapboxgl-' + k, constants.styleRules[k]); -} + function renderAnchor() { + var isNotPath = shapeOptions.type !== 'path'; -exports.name = MAPBOX; + // d3 join with dummy data to satisfy d3 data-binding + var visualCues = shapeLayer.selectAll('.visual-cue').data([0]); -exports.attr = 'subplot'; + // Enter + var strokeWidth = 1; + visualCues.enter() + .append('path') + .attr({ + 'fill': '#fff', + 'fill-rule': 'evenodd', + 'stroke': '#000', + 'stroke-width': strokeWidth + }) + .classed('visual-cue', true); -exports.idRoot = MAPBOX; + // Update + var posX = x2p( + xPixelSized ? + shapeOptions.xanchor : + Lib.midRange( + isNotPath ? + [shapeOptions.x0, shapeOptions.x1] : + helpers.extractPathCoords(shapeOptions.path, constants.paramIsX)) + ); + var posY = y2p( + yPixelSized ? + shapeOptions.yanchor : + Lib.midRange( + isNotPath ? + [shapeOptions.y0, shapeOptions.y1] : + helpers.extractPathCoords(shapeOptions.path, constants.paramIsY)) + ); -exports.idRegex = exports.attrRegex = Lib.counterRegex(MAPBOX); + posX = helpers.roundPositionForSharpStrokeRendering(posX, strokeWidth); + posY = helpers.roundPositionForSharpStrokeRendering(posY, strokeWidth); -exports.attributes = { - subplot: { - valType: 'subplotid', - - dflt: 'mapbox', - editType: 'calc', - + 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); + } + } } -}; -exports.layoutAttributes = _dereq_('./layout_attributes'); + function removeVisualCues(shapeLayer) { + shapeLayer.selectAll('.visual-cue').remove(); + } -exports.supplyLayoutDefaults = _dereq_('./layout_defaults'); + function deactivateClipPathTemporarily(shapePath, shapeOptions, gd) { + var xref = shapeOptions.xref; + var yref = shapeOptions.yref; + var xa = Axes.getFromId(gd, xref); + var ya = Axes.getFromId(gd, yref); -exports.plot = function plotMapbox(gd) { - var fullLayout = gd._fullLayout; - var calcData = gd.calcdata; - var mapboxIds = fullLayout._subplots[MAPBOX]; + var clipAxes = ''; + if(xref !== 'paper' && !xa.autorange) clipAxes += xref; + if(yref !== 'paper' && !ya.autorange) clipAxes += yref; - if(mapboxgl.version !== constants.requiredVersion) { - throw new Error(constants.wrongVersionErrorMsg); + Drawing.setClipUrl( + shapePath, + clipAxes ? 'clip' + gd._fullLayout._uid + clipAxes : null, + gd + ); } +} - var accessToken = findAccessToken(gd, mapboxIds); - mapboxgl.accessToken = accessToken; +function getPathString(gd, options) { + var type = options.type; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); + var gs = gd._fullLayout._size; + var x2r, x2p, y2r, y2p; + var x0, x1, y0, y1; - for(var i = 0; i < mapboxIds.length; i++) { - var id = mapboxIds[i], - subplotCalcData = getSubplotCalcData(calcData, MAPBOX, id), - opts = fullLayout[id], - mapbox = opts._subplot; + if(xa) { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } + else { + x2p = function(v) { return gs.l + gs.w * v; }; + } - if(!mapbox) { - mapbox = createMapbox({ - gd: gd, - container: fullLayout._glcontainer.node(), - id: id, - fullLayout: fullLayout, - staticPlot: gd._context.staticPlot - }); + if(ya) { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } + else { + y2p = function(v) { return gs.t + gs.h * (1 - v); }; + } - fullLayout[id]._subplot = mapbox; - } + if(type === 'path') { + if(xa && xa.type === 'date') x2p = helpers.decodeDate(x2p); + if(ya && ya.type === 'date') y2p = helpers.decodeDate(y2p); + return convertPath(options, x2p, y2p); + } - if(!mapbox.viewInitial) { - mapbox.viewInitial = { - center: Lib.extendFlat({}, opts.center), - zoom: opts.zoom, - bearing: opts.bearing, - pitch: opts.pitch - }; - } + if(options.xsizemode === 'pixel') { + var xAnchorPos = x2p(options.xanchor); + x0 = xAnchorPos + options.x0; + x1 = xAnchorPos + options.x1; + } + else { + x0 = x2p(options.x0); + x1 = x2p(options.x1); + } - mapbox.plot(subplotCalcData, fullLayout, gd._promises); + if(options.ysizemode === 'pixel') { + var yAnchorPos = y2p(options.yanchor); + y0 = yAnchorPos - options.y0; + y1 = yAnchorPos - options.y1; + } + else { + y0 = y2p(options.y0); + y1 = y2p(options.y1); } -}; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldMapboxKeys = oldFullLayout._subplots[MAPBOX] || []; + if(type === 'line') return 'M' + x0 + ',' + y0 + 'L' + x1 + ',' + y1; + if(type === 'rect') return 'M' + x0 + ',' + y0 + 'H' + x1 + 'V' + y1 + 'H' + x0 + 'Z'; - for(var i = 0; i < oldMapboxKeys.length; i++) { - var oldMapboxKey = oldMapboxKeys[i]; + // circle + var cx = (x0 + x1) / 2; + var cy = (y0 + y1) / 2; + var rx = Math.abs(cx - x0); + var ry = Math.abs(cy - y0); + 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'; +} - if(!newFullLayout[oldMapboxKey] && !!oldFullLayout[oldMapboxKey]._subplot) { - oldFullLayout[oldMapboxKey]._subplot.destroy(); - } - } -}; -exports.toSVG = function(gd) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots[MAPBOX]; - var size = fullLayout._size; +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; - for(var i = 0; i < subplotIds.length; i++) { - var opts = fullLayout[subplotIds[i]], - domain = opts.domain, - mapbox = opts._subplot; + 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 imageData = mapbox.toImage('png'); - var image = fullLayout._glimages.append('svg:image'); + 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++; - image.attr({ - xmlns: xmlnsNamespaces.svg, - 'xlink:href': imageData, - x: size.l + size.w * domain.x[0], - y: size.t + size.h * (1 - domain.y[1]), - width: size.w * (domain.x[1] - domain.x[0]), - height: size.h * (domain.y[1] - domain.y[0]), - preserveAspectRatio: 'none' + if(paramNumber > nParams) param = 'X'; + return param; }); - mapbox.destroy(); - } -}; + if(paramNumber > nParams) { + paramString = paramString.replace(/[\s,]*X.*/, ''); + Lib.log('Ignoring extra params in segment ' + segment); + } -function findAccessToken(gd, mapboxIds) { - var fullLayout = gd._fullLayout, - context = gd._context; + return segmentType + paramString; + }); +} - // special case for Mapbox Atlas users - if(context.mapboxAccessToken === '') return ''; +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]; - // Take the first token we find in a mapbox subplot. - // These default to the context value but may be overridden. - for(var i = 0; i < mapboxIds.length; i++) { - var opts = fullLayout[mapboxIds[i]]; + var paramString = segment.substr(1).replace(constants.paramRE, function(param) { + if(paramNumber >= nParams) return param; - if(opts.accesstoken) { - return opts.accesstoken; - } - } + if(xParams[paramNumber]) param = moveX(param); + else if(yParams[paramNumber]) param = moveY(param); - throw new Error(constants.noAccessTokenErrorMsg); -} + paramNumber++; -exports.updateFx = function(gd) { - var fullLayout = gd._fullLayout; - var subplotIds = fullLayout._subplots[MAPBOX]; + return param; + }); - for(var i = 0; i < subplotIds.length; i++) { - var subplotObj = fullLayout[subplotIds[i]]._subplot; - subplotObj.updateFx(fullLayout); - } -}; + return segmentType + paramString; + }); +} -},{"../../constants/xmlns_namespaces":674,"../../lib":696,"../../plots/get_data":781,"./constants":800,"./layout_attributes":804,"./layout_defaults":805,"./mapbox":806,"mapbox-gl":409}],803:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../lib/setcursor":178,"../../plot_api/plot_template":193,"../../plots/cartesian/axes":203,"../../registry":243,"../color":43,"../dragelement":61,"../drawing":64,"./constants":121,"./helpers":124}],124:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; +var constants = _dereq_('./constants'); + var Lib = _dereq_('../../lib'); -var convertTextOpts = _dereq_('./convert_text_opts'); -function MapboxLayer(mapbox, index) { - this.mapbox = mapbox; - this.map = mapbox.map; - - this.uid = mapbox.uid + '-' + 'layer' + index; - - this.idSource = this.uid + '-source'; - this.idLayer = this.uid + '-layer'; - - // some state variable to check if a remove/add step is needed - this.sourceType = null; - this.source = null; - this.layerType = null; - this.below = null; - - // is layer currently visible - this.visible = false; -} - -var proto = MapboxLayer.prototype; - -proto.update = function update(opts) { - if(!this.visible) { - // IMPORTANT: must create source before layer to not cause errors - this.updateSource(opts); - this.updateLayer(opts); - } else if(this.needsNewSource(opts)) { - // IMPORTANT: must delete layer before source to not cause errors - this.removeLayer(); - this.updateSource(opts); - this.updateLayer(opts); - } else if(this.needsNewLayer(opts)) { - this.updateLayer(opts); - } else { - this.updateStyle(opts); - } +// special position conversion functions... category axis positions can't be +// specified by their data values, because they don't make a continuous mapping. +// so these have to be specified in terms of the category serial numbers, +// but can take fractional values. Other axis types we specify position based on +// the actual data values. +// TODO: in V2.0 (when log axis ranges are in data units) range and shape position +// will be identical, so rangeToShapePosition and shapePositionToRange can be +// removed entirely. - this.visible = isVisible(opts); +exports.rangeToShapePosition = function(ax) { + return (ax.type === 'log') ? ax.r2d : function(v) { return v; }; }; -proto.needsNewSource = function(opts) { - // for some reason changing layer to 'fill' or 'symbol' - // w/o changing the source throws an exception in mapbox-gl 0.18 ; - // stay safe and make new source on type changes - return ( - this.sourceType !== opts.sourcetype || - this.source !== opts.source || - this.layerType !== opts.type - ); +exports.shapePositionToRange = function(ax) { + return (ax.type === 'log') ? ax.d2r : function(v) { return v; }; }; -proto.needsNewLayer = function(opts) { - return ( - this.layerType !== opts.type || - this.below !== opts.below - ); +exports.decodeDate = function(convertToPx) { + return function(v) { + if(v.replace) v = v.replace('_', ' '); + return convertToPx(v); + }; }; -proto.updateSource = function(opts) { - var map = this.map; +exports.encodeDate = function(convertToDate) { + return function(v) { return convertToDate(v).replace(' ', '_'); }; +}; - if(map.getSource(this.idSource)) map.removeSource(this.idSource); +exports.extractPathCoords = function(path, paramsToUse) { + var extractedCoordinates = []; - this.sourceType = opts.sourcetype; - this.source = opts.source; + var segments = path.match(constants.segmentRE); + segments.forEach(function(segment) { + var relevantParamIdx = paramsToUse[segment.charAt(0)].drawn; + if(relevantParamIdx === undefined) return; - if(!isVisible(opts)) return; + var params = segment.substr(1).match(constants.paramRE); + if(!params || params.length < relevantParamIdx) return; - var sourceOpts = convertSourceOpts(opts); + extractedCoordinates.push(Lib.cleanNumber(params[relevantParamIdx])); + }); - map.addSource(this.idSource, sourceOpts); + return extractedCoordinates; }; -proto.updateLayer = function(opts) { - var map = this.map; - var convertedOpts = convertOpts(opts); +exports.getDataToPixel = function(gd, axis, isVertical) { + var gs = gd._fullLayout._size; + var dataToPixel; + + if(axis) { + var d2r = exports.shapePositionToRange(axis); - this.removeLayer(); - this.layerType = opts.type; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(isVisible(opts)) { - map.addLayer({ - id: this.idLayer, - source: this.idSource, - 'source-layer': opts.sourcelayer || '', - type: opts.type, - layout: convertedOpts.layout, - paint: convertedOpts.paint - }, opts.below); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); } -}; - -proto.updateStyle = function(opts) { - if(isVisible(opts)) { - var convertedOpts = convertOpts(opts); - this.mapbox.setOptions(this.idLayer, 'setLayoutProperty', convertedOpts.layout); - this.mapbox.setOptions(this.idLayer, 'setPaintProperty', convertedOpts.paint); + else if(isVertical) { + dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } -}; - -proto.removeLayer = function() { - var map = this.map; - if(map.getLayer(this.idLayer)) { - map.removeLayer(this.idLayer); + else { + dataToPixel = function(v) { return gs.l + gs.w * v; }; } -}; -proto.dispose = function dispose() { - var map = this.map; - map.removeLayer(this.idLayer); - map.removeSource(this.idSource); + return dataToPixel; }; -function isVisible(opts) { - var source = opts.source; - - return opts.visible && ( - Lib.isPlainObject(source) || - (typeof source === 'string' && source.length > 0) - ); -} - -function convertOpts(opts) { - var layout = {}, - paint = {}; - - switch(opts.type) { - - case 'circle': - Lib.extendFlat(paint, { - 'circle-radius': opts.circle.radius, - 'circle-color': opts.color, - 'circle-opacity': opts.opacity - }); - break; - - case 'line': - Lib.extendFlat(paint, { - 'line-width': opts.line.width, - 'line-color': opts.color, - 'line-opacity': opts.opacity - }); - break; - - case 'fill': - Lib.extendFlat(paint, { - 'fill-color': opts.color, - 'fill-outline-color': opts.fill.outlinecolor, - 'fill-opacity': opts.opacity +exports.getPixelToData = function(gd, axis, isVertical) { + var gs = gd._fullLayout._size; + var pixelToData; - // no way to pass specify outline width at the moment - }); - break; + if(axis) { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } + else if(isVertical) { + pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; + } + else { + pixelToData = function(p) { return (p - gs.l) / gs.w; }; + } - case 'symbol': - var symbol = opts.symbol, - textOpts = convertTextOpts(symbol.textposition, symbol.iconsize); - - Lib.extendFlat(layout, { - 'icon-image': symbol.icon + '-15', - 'icon-size': symbol.iconsize / 10, - - 'text-field': symbol.text, - 'text-size': symbol.textfont.size, - 'text-anchor': textOpts.anchor, - 'text-offset': textOpts.offset + return pixelToData; +}; - // TODO font family - // 'text-font': symbol.textfont.family.split(', '), - }); +/** + * Based on the given stroke width, rounds the passed + * position value to represent either a full or half pixel. + * + * In case of an odd stroke width (e.g. 1), this measure ensures + * that a stroke positioned at the returned position isn't rendered + * blurry due to anti-aliasing. + * + * In case of an even stroke width (e.g. 2), this measure ensures + * that the position value is transformed to a full pixel value + * so that anti-aliasing doesn't take effect either. + * + * @param {number} pos The raw position value to be transformed + * @param {number} strokeWidth The stroke width + * @returns {number} either an integer or a .5 decimal number + */ +exports.roundPositionForSharpStrokeRendering = function(pos, strokeWidth) { + var strokeWidthIsOdd = Math.round(strokeWidth % 2) === 1; + var posValAsInt = Math.round(pos); - Lib.extendFlat(paint, { - 'icon-color': opts.color, - 'text-color': symbol.textfont.color, - 'text-opacity': opts.opacity - }); - break; - } + return strokeWidthIsOdd ? posValAsInt + 0.5 : posValAsInt; +}; - return { layout: layout, paint: paint }; -} +},{"../../lib":159,"./constants":121}],125:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -function convertSourceOpts(opts) { - var sourceType = opts.sourcetype; - var source = opts.source; - var sourceOpts = {type: sourceType}; - var field; - if(sourceType === 'geojson') { - field = 'data'; - } else if(sourceType === 'vector') { - field = typeof source === 'string' ? 'url' : 'tiles'; - } +'use strict'; - sourceOpts[field] = source; - return sourceOpts; -} +var drawModule = _dereq_('./draw'); -module.exports = function createMapboxLayer(mapbox, index, opts) { - var mapboxLayer = new MapboxLayer(mapbox, index); +module.exports = { + moduleType: 'component', + name: 'shapes', - mapboxLayer.update(opts); + layoutAttributes: _dereq_('./attributes'), + supplyLayoutDefaults: _dereq_('./defaults'), + includeBasePlot: _dereq_('../../plots/cartesian/include_components')('shapes'), - return mapboxLayer; + calcAutorange: _dereq_('./calc_autorange'), + draw: drawModule.draw, + drawOne: drawModule.drawOne }; -},{"../../lib":696,"./convert_text_opts":801}],804:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":214,"./attributes":119,"./calc_autorange":120,"./defaults":122,"./draw":123}],126:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Lib = _dereq_('../../lib'); -var defaultLine = _dereq_('../../components/color').defaultLine; -var domainAttrs = _dereq_('../domain').attributes; -var fontAttrs = _dereq_('../font_attributes'); -var textposition = _dereq_('../../traces/scatter/attributes').textposition; +var fontAttrs = _dereq_('../../plots/font_attributes'); +var padAttrs = _dereq_('../../plots/pad_attributes'); +var extendDeepAll = _dereq_('../../lib/extend').extendDeepAll; var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; +var animationAttrs = _dereq_('../../plots/animation_attributes'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var constants = _dereq_('./constants'); -var fontAttr = fontAttrs({ - +var stepsAttrs = templatedArray('step', { + visible: { + valType: 'boolean', + + dflt: true, + + }, + method: { + valType: 'enumerated', + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], + dflt: 'restyle', + + + }, + args: { + valType: 'info_array', + + freeLength: true, + items: [ + { valType: 'any' }, + { valType: 'any' }, + { valType: 'any' } + ], + + }, + label: { + valType: 'string', + + + }, + value: { + valType: 'string', + + + }, + execute: { + valType: 'boolean', + + dflt: true, + + } }); -fontAttr.family.dflt = 'Open Sans Regular, Arial Unicode MS Regular'; - -module.exports = overrideAll({ - _arrayAttrRegexps: [Lib.counterRegex('mapbox', '.layers', true)], - domain: domainAttrs({name: 'mapbox'}), - - accesstoken: { - valType: 'string', - noBlank: true, - strict: true, +module.exports = overrideAll(templatedArray('slider', { + visible: { + valType: 'boolean', + dflt: true, }, - style: { - valType: 'any', - values: ['basic', 'streets', 'outdoors', 'light', 'dark', 'satellite', 'satellite-streets'], - dflt: 'basic', + + active: { + valType: 'number', + min: 0, + dflt: 0, }, - center: { - lon: { - valType: 'number', - dflt: 0, - - - }, - lat: { - valType: 'number', - dflt: 0, - - - } + steps: stepsAttrs, + + lenmode: { + valType: 'enumerated', + values: ['fraction', 'pixels'], + + dflt: 'fraction', + }, - zoom: { + len: { valType: 'number', + min: 0, dflt: 1, }, - bearing: { + x: { + valType: 'number', + min: -2, + max: 3, + dflt: 0, + + + }, + pad: extendDeepAll(padAttrs({editType: 'arraydraw'}), { + + }, {t: {dflt: 20}}), + xanchor: { + valType: 'enumerated', + values: ['auto', 'left', 'center', 'right'], + dflt: 'left', + + + }, + y: { valType: 'number', + min: -2, + max: 3, dflt: 0, }, - pitch: { - valType: 'number', - dflt: 0, + yanchor: { + valType: 'enumerated', + values: ['auto', 'top', 'middle', 'bottom'], + dflt: 'top', }, - layers: templatedArray('layer', { - visible: { - valType: 'boolean', + transition: { + duration: { + valType: 'number', - dflt: true, + min: 0, + dflt: 150, }, - sourcetype: { + easing: { valType: 'enumerated', - values: ['geojson', 'vector'], - dflt: 'geojson', + values: animationAttrs.transition.easing.values, + dflt: 'cubic-in-out', - }, + } + }, - source: { - valType: 'any', + currentvalue: { + visible: { + valType: 'boolean', + dflt: true, }, - sourcelayer: { - valType: 'string', - dflt: '', + xanchor: { + valType: 'enumerated', + values: ['left', 'center', 'right'], + dflt: 'left', }, - type: { - valType: 'enumerated', - values: ['circle', 'line', 'fill', 'symbol'], - dflt: 'circle', + offset: { + valType: 'number', + dflt: 10, }, - // attributes shared between all types - below: { + prefix: { valType: 'string', - dflt: '', - - - }, - color: { - valType: 'color', - dflt: defaultLine, }, - opacity: { - valType: 'number', - min: 0, - max: 1, - dflt: 1, + + suffix: { + valType: 'string', }, - // type-specific style attributes - circle: { - radius: { - valType: 'number', - dflt: 15, - - - } - }, - - line: { - width: { - valType: 'number', - dflt: 2, - - - } - }, + font: fontAttrs({ + + }) + }, - fill: { - outlinecolor: { - valType: 'color', - dflt: defaultLine, - - - } - }, + font: fontAttrs({ + + }), - symbol: { - icon: { - valType: 'string', - dflt: 'marker', - - - }, - iconsize: { - valType: 'number', - dflt: 10, - - - }, - text: { - valType: 'string', - dflt: '', - - - }, - textfont: fontAttr, - textposition: Lib.extendFlat({}, textposition, { arrayOk: false }) - } - }) -}, 'plot', 'from-root'); + activebgcolor: { + valType: 'color', + + dflt: constants.gripBgActiveColor, + + }, + bgcolor: { + valType: 'color', + + dflt: constants.railBgColor, + + }, + bordercolor: { + valType: 'color', + dflt: constants.railBorderColor, + + + }, + borderwidth: { + valType: 'number', + min: 0, + dflt: constants.railBorderWidth, + + + }, + ticklen: { + valType: 'number', + min: 0, + dflt: constants.tickLength, + + + }, + tickcolor: { + valType: 'color', + dflt: constants.tickColor, + + + }, + tickwidth: { + valType: 'number', + min: 0, + dflt: 1, + + + }, + minorticklen: { + valType: 'number', + min: 0, + dflt: constants.minorTickLength, + + + } +}), 'arraydraw', 'from-root'); -},{"../../components/color":570,"../../lib":696,"../../plot_api/edit_types":727,"../../plot_api/plot_template":734,"../../traces/scatter/attributes":1043,"../domain":770,"../font_attributes":771}],805:[function(_dereq_,module,exports){ +},{"../../lib/extend":153,"../../plot_api/edit_types":186,"../../plot_api/plot_template":193,"../../plots/animation_attributes":198,"../../plots/font_attributes":230,"../../plots/pad_attributes":235,"./constants":127}],127:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -126567,650 +31021,208 @@ 'use strict'; -var Lib = _dereq_('../../lib'); -var handleSubplotDefaults = _dereq_('../subplot_defaults'); -var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); -var layoutAttributes = _dereq_('./layout_attributes'); +module.exports = { + // layout attribute name + name: 'sliders', -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - handleSubplotDefaults(layoutIn, layoutOut, fullData, { - type: 'mapbox', - attributes: layoutAttributes, - handleDefaults: handleDefaults, - partition: 'y', - accessToken: layoutOut._mapboxAccessToken - }); -}; + // 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', -function handleDefaults(containerIn, containerOut, coerce, opts) { - coerce('accesstoken', opts.accessToken); - coerce('style'); - coerce('center.lon'); - coerce('center.lat'); - coerce('zoom'); - coerce('bearing'); - coerce('pitch'); - - handleArrayContainerDefaults(containerIn, containerOut, { - name: 'layers', - handleItemDefaults: handleLayerDefaults - }); + railHeight: 5, - // copy ref to input container to update 'center' and 'zoom' on map move - containerOut._input = containerIn; -} + // DOM attribute name in button group keeping track + // of active update menu + menuIndexAttrName: 'slider-active-index', -function handleLayerDefaults(layerIn, layerOut) { - function coerce(attr, dflt) { - return Lib.coerce(layerIn, layerOut, layoutAttributes.layers, attr, dflt); - } + // id root pass to Plots.autoMargin + autoMarginIdRoot: 'slider-', - var visible = coerce('visible'); - if(visible) { - var sourceType = coerce('sourcetype'); - coerce('source'); + // min item width / height + minWidth: 30, + minHeight: 30, - if(sourceType === 'vector') coerce('sourcelayer'); + // padding around item text + textPadX: 40, - // maybe add smart default based off GeoJSON geometry? - var type = coerce('type'); + // arrow offset off right edge + arrowOffsetX: 4, - coerce('below'); - coerce('color'); - coerce('opacity'); + railRadius: 2, + railWidth: 5, + railBorder: 4, + railBorderWidth: 1, + railBorderColor: '#bec8d9', + railBgColor: '#f8fafc', - if(type === 'circle') { - coerce('circle.radius'); - } + // 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, - if(type === 'line') { - coerce('line.width'); - } + // 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, - if(type === 'fill') { - coerce('fill.outlinecolor'); - } + gripRadius: 10, + gripWidth: 20, + gripHeight: 20, + gripBorder: 20, + gripBorderWidth: 1, + gripBorderColor: '#bec8d9', + gripBgColor: '#f6f8fa', + gripBgActiveColor: '#dbdde0', - if(type === 'symbol') { - coerce('symbol.icon'); - coerce('symbol.iconsize'); + labelPadding: 8, + labelOffset: 0, - coerce('symbol.text'); - Lib.coerceFont(coerce, 'symbol.textfont'); - coerce('symbol.textposition'); - } - } -} + 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, +}; -},{"../../lib":696,"../array_container_defaults":740,"../subplot_defaults":822,"./layout_attributes":804}],806:[function(_dereq_,module,exports){ +},{}],128:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var mapboxgl = _dereq_('mapbox-gl'); - -var Fx = _dereq_('../../components/fx'); var Lib = _dereq_('../../lib'); -var dragElement = _dereq_('../../components/dragelement'); -var prepSelect = _dereq_('../cartesian/select').prepSelect; -var selectOnClick = _dereq_('../cartesian/select').selectOnClick; -var constants = _dereq_('./constants'); -var layoutAttributes = _dereq_('./layout_attributes'); -var createMapboxLayer = _dereq_('./layers'); - -function Mapbox(opts) { - this.id = opts.id; - this.gd = opts.gd; - this.container = opts.container; - this.isStatic = opts.staticPlot; - - var fullLayout = opts.fullLayout; - - // unique id for this Mapbox instance - this.uid = fullLayout._uid + '-' + this.id; - - // full mapbox options (N.B. needs to be updated on every updates) - this.opts = fullLayout[this.id]; - - // create framework on instantiation for a smoother first plot call - this.div = null; - this.xaxis = null; - this.yaxis = null; - this.createFramework(fullLayout); - - // state variables used to infer how and what to update - this.map = null; - this.accessToken = null; - this.styleObj = null; - this.traceHash = {}; - this.layerList = []; -} - -var proto = Mapbox.prototype; - -module.exports = function createMapbox(opts) { - return new Mapbox(opts); -}; - -proto.plot = function(calcData, fullLayout, promises) { - var self = this; - - // feed in new mapbox options - var opts = self.opts = fullLayout[this.id]; - - // remove map and create a new map if access token has change - if(self.map && (opts.accesstoken !== self.accessToken)) { - self.map.remove(); - self.map = null; - self.styleObj = null; - self.traceHash = []; - self.layerList = {}; - } - - var promise; - - if(!self.map) { - promise = new Promise(function(resolve, reject) { - self.createMap(calcData, fullLayout, resolve, reject); - }); - } else { - promise = new Promise(function(resolve, reject) { - self.updateMap(calcData, fullLayout, resolve, reject); - }); - } - - promises.push(promise); -}; - -proto.createMap = function(calcData, fullLayout, resolve, reject) { - var self = this; - var gd = self.gd; - var opts = self.opts; - - // store style id and URL or object - var styleObj = self.styleObj = getStyleObj(opts.style); - - // store access token associated with this map - self.accessToken = opts.accesstoken; - - // create the map! - var map = self.map = new mapboxgl.Map({ - container: self.div, - - style: styleObj.style, - center: convertCenter(opts.center), - zoom: opts.zoom, - bearing: opts.bearing, - pitch: opts.pitch, - - interactive: !self.isStatic, - preserveDrawingBuffer: self.isStatic, - - doubleClickZoom: false, - boxZoom: false - }); - - // clear navigation container - var className = constants.controlContainerClassName; - var controlContainer = self.div.getElementsByClassName(className)[0]; - self.div.removeChild(controlContainer); - - // make sure canvas does not inherit left and top css - map._canvas.style.left = '0px'; - map._canvas.style.top = '0px'; - - self.rejectOnError(reject); - - map.once('load', function() { - self.updateData(calcData); - self.updateLayout(fullLayout); - self.resolveOnRender(resolve); - }); - - if(self.isStatic) return; - - var wheeling = false; - - // keep track of pan / zoom in user layout and emit relayout event - map.on('moveend', function(eventData) { - if(!self.map) return; - - var view = self.getView(); - - opts._input.center = opts.center = view.center; - opts._input.zoom = opts.zoom = view.zoom; - opts._input.bearing = opts.bearing = view.bearing; - opts._input.pitch = opts.pitch = view.pitch; - - // 'moveend' gets triggered by map.setCenter, map.setZoom, - // map.setBearing and map.setPitch. - // - // Here, we make sure that 'plotly_relayout' is - // triggered here only when the 'moveend' originates from a - // mouse target (filtering out API calls) to not - // duplicate 'plotly_relayout' events. - - if(eventData.originalEvent || wheeling) { - emitRelayoutFromView(view); - } - wheeling = false; - }); - - map.on('wheel', function() { - wheeling = true; - }); - - map.on('mousemove', function(evt) { - var bb = self.div.getBoundingClientRect(); - - // some hackery to get Fx.hover to work - evt.clientX = evt.point.x + bb.left; - evt.clientY = evt.point.y + bb.top; - - evt.target.getBoundingClientRect = function() { return bb; }; - - self.xaxis.p2c = function() { return evt.lngLat.lng; }; - self.yaxis.p2c = function() { return evt.lngLat.lat; }; - - Fx.hover(gd, evt, self.id); - }); - - function unhover() { - Fx.loneUnhover(fullLayout._toppaper); - } - - map.on('dragstart', unhover); - map.on('zoomstart', unhover); - - map.on('dblclick', function() { - gd.emit('plotly_doubleclick', null); - - var viewInitial = self.viewInitial; +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - map.setCenter(convertCenter(viewInitial.center)); - map.setZoom(viewInitial.zoom); - map.setBearing(viewInitial.bearing); - map.setPitch(viewInitial.pitch); +var attributes = _dereq_('./attributes'); +var constants = _dereq_('./constants'); - var viewNow = self.getView(); +var name = constants.name; +var stepAttrs = attributes.steps; - opts._input.center = opts.center = viewNow.center; - opts._input.zoom = opts.zoom = viewNow.zoom; - opts._input.bearing = opts.bearing = viewNow.bearing; - opts._input.pitch = opts.pitch = viewNow.pitch; - emitRelayoutFromView(viewNow); +module.exports = function slidersDefaults(layoutIn, layoutOut) { + handleArrayContainerDefaults(layoutIn, layoutOut, { + name: name, + handleItemDefaults: sliderDefaults }); - - function emitRelayoutFromView(view) { - var id = self.id; - var evtData = {}; - for(var k in view) { - evtData[id + '.' + k] = view[k]; - } - gd.emit('plotly_relayout', evtData); - } - - // define event handlers on map creation, to keep one ref per map, - // so that map.on / map.off in updateFx works as expected - self.clearSelect = function() { - gd._fullLayout._zoomlayer.selectAll('.select-outline').remove(); - }; - - /** - * Returns a click handler function that is supposed - * to handle clicks in pan mode. - */ - self.onClickInPanFn = function(dragOptions) { - return function(evt) { - var clickMode = gd._fullLayout.clickmode; - - if(clickMode.indexOf('select') > -1) { - selectOnClick(evt.originalEvent, gd, [self.xaxis], [self.yaxis], self.id, dragOptions); - } - - if(clickMode.indexOf('event') > -1) { - // TODO: this does not support right-click. If we want to support it, we - // would likely need to change mapbox to use dragElement instead of straight - // mapbox event binding. Or perhaps better, make a simple wrapper with the - // right mousedown, mousemove, and mouseup handlers just for a left/right click - // pie would use this too. - Fx.click(gd, evt.originalEvent); - } - }; - }; -}; - -proto.updateMap = function(calcData, fullLayout, resolve, reject) { - var self = this; - var map = self.map; - - self.rejectOnError(reject); - - var styleObj = getStyleObj(self.opts.style); - - if(self.styleObj.id !== styleObj.id) { - self.styleObj = styleObj; - map.setStyle(styleObj.style); - - map.once('styledata', function() { - // need to rebuild trace layers on reload - // to avoid 'lost event' errors - self.traceHash = {}; - self.updateData(calcData); - self.updateLayout(fullLayout); - self.resolveOnRender(resolve); - }); - } else { - self.updateData(calcData); - self.updateLayout(fullLayout); - self.resolveOnRender(resolve); - } }; -proto.updateData = function(calcData) { - var traceHash = this.traceHash; - var traceObj, trace, i, j; - - // update or create trace objects - for(i = 0; i < calcData.length; i++) { - var calcTrace = calcData[i]; - - trace = calcTrace[0].trace; - traceObj = traceHash[trace.uid]; - - if(traceObj) { - traceObj.update(calcTrace); - } else if(trace._module) { - traceHash[trace.uid] = trace._module.plot(this, calcTrace); - } - } - - // remove empty trace objects - var ids = Object.keys(traceHash); - id_loop: - for(i = 0; i < ids.length; i++) { - var id = ids[i]; - - for(j = 0; j < calcData.length; j++) { - trace = calcData[j][0].trace; - if(id === trace.uid) continue id_loop; - } +function sliderDefaults(sliderIn, sliderOut, layoutOut) { - traceObj = traceHash[id]; - traceObj.dispose(); - delete traceHash[id]; + function coerce(attr, dflt) { + return Lib.coerce(sliderIn, sliderOut, attributes, attr, dflt); } -}; - -proto.updateLayout = function(fullLayout) { - var map = this.map, - opts = this.opts; - - map.setCenter(convertCenter(opts.center)); - map.setZoom(opts.zoom); - map.setBearing(opts.bearing); - map.setPitch(opts.pitch); - this.updateLayers(); - this.updateFramework(fullLayout); - this.updateFx(fullLayout); - this.map.resize(); -}; - -proto.resolveOnRender = function(resolve) { - var map = this.map; - - map.on('render', function onRender() { - if(map.loaded()) { - map.off('render', onRender); - // resolve at end of render loop - setTimeout(resolve, 0); - } + var steps = handleArrayContainerDefaults(sliderIn, sliderOut, { + name: 'steps', + handleItemDefaults: stepDefaults }); -}; -proto.rejectOnError = function(reject) { - var map = this.map; - - function handler() { - reject(new Error(constants.mapOnErrorMsg)); + var stepCount = 0; + for(var i = 0; i < steps.length; i++) { + if(steps[i].visible) stepCount++; } - map.once('error', handler); - map.once('style.error', handler); - map.once('source.error', handler); - map.once('tile.error', handler); - map.once('layer.error', handler); -}; - -proto.createFramework = function(fullLayout) { - var self = this; - - var div = self.div = document.createElement('div'); - div.id = self.uid; - div.style.position = 'absolute'; - self.container.appendChild(div); - - // create mock x/y axes for hover routine - self.xaxis = { - _id: 'x', - c2p: function(v) { return self.project(v).x; } - }; - self.yaxis = { - _id: 'y', - c2p: function(v) { return self.project(v).y; } - }; - - self.updateFramework(fullLayout); -}; + var visible; + // If it has fewer than two options, it's not really a slider + if(stepCount < 2) visible = sliderOut.visible = false; + else visible = coerce('visible'); + if(!visible) return; -proto.updateFx = function(fullLayout) { - var self = this; - var map = self.map; - var gd = self.gd; + sliderOut._stepCount = stepCount; + var visSteps = sliderOut._visibleSteps = Lib.filterVisible(steps); - if(self.isStatic) return; + var active = coerce('active'); + if(!(steps[active] || {}).visible) sliderOut.active = visSteps[0]._index; - function invert(pxpy) { - var obj = self.map.unproject(pxpy); - return [obj.lng, obj.lat]; - } + coerce('x'); + coerce('y'); + Lib.noneOrAll(sliderIn, sliderOut, ['x', 'y']); - var dragMode = fullLayout.dragmode; - var fillRangeItems; + coerce('xanchor'); + coerce('yanchor'); - if(dragMode === 'select') { - fillRangeItems = function(eventData, poly) { - var ranges = eventData.range = {}; - ranges[self.id] = [ - invert([poly.xmin, poly.ymin]), - invert([poly.xmax, poly.ymax]) - ]; - }; - } else { - fillRangeItems = function(eventData, poly, pts) { - var dataPts = eventData.lassoPoints = {}; - dataPts[self.id] = pts.filtered.map(invert); - }; - } + coerce('len'); + coerce('lenmode'); - // Note: dragOptions is needed to be declared for all dragmodes because - // it's the object that holds persistent selection state. - // Merge old dragOptions with new to keep possibly initialized - // persistent selection state. - var oldDragOptions = self.dragOptions; - self.dragOptions = Lib.extendDeep(oldDragOptions || {}, { - element: self.div, - gd: gd, - plotinfo: { - id: self.id, - xaxis: self.xaxis, - yaxis: self.yaxis, - fillRangeItems: fillRangeItems - }, - xaxes: [self.xaxis], - yaxes: [self.yaxis], - subplot: self.id - }); + coerce('pad.t'); + coerce('pad.r'); + coerce('pad.b'); + coerce('pad.l'); - // Unregister the old handler before potentially registering - // a new one. Otherwise multiple click handlers might - // be registered resulting in unwanted behavior. - map.off('click', self.onClickInPanHandler); - if(dragMode === 'select' || dragMode === 'lasso') { - map.dragPan.disable(); - map.on('zoomstart', self.clearSelect); + Lib.coerceFont(coerce, 'font', layoutOut.font); - self.dragOptions.prepFn = function(e, startX, startY) { - prepSelect(e, startX, startY, self.dragOptions, dragMode); - }; + var currentValueIsVisible = coerce('currentvalue.visible'); - dragElement.init(self.dragOptions); - } else { - map.dragPan.enable(); - map.off('zoomstart', self.clearSelect); - self.div.onmousedown = null; + if(currentValueIsVisible) { + coerce('currentvalue.xanchor'); + coerce('currentvalue.prefix'); + coerce('currentvalue.suffix'); + coerce('currentvalue.offset'); - // TODO: this does not support right-click. If we want to support it, we - // would likely need to change mapbox to use dragElement instead of straight - // mapbox event binding. Or perhaps better, make a simple wrapper with the - // right mousedown, mousemove, and mouseup handlers just for a left/right click - // pie would use this too. - self.onClickInPanHandler = self.onClickInPanFn(self.dragOptions); - map.on('click', self.onClickInPanHandler); + Lib.coerceFont(coerce, 'currentvalue.font', sliderOut.font); } -}; - -proto.updateFramework = function(fullLayout) { - var domain = fullLayout[this.id].domain; - var size = fullLayout._size; - - var style = this.div.style; - style.width = size.w * (domain.x[1] - domain.x[0]) + 'px'; - style.height = size.h * (domain.y[1] - domain.y[0]) + 'px'; - style.left = size.l + domain.x[0] * size.w + 'px'; - style.top = size.t + (1 - domain.y[1]) * size.h + 'px'; - - this.xaxis._offset = size.l + domain.x[0] * size.w; - this.xaxis._length = size.w * (domain.x[1] - domain.x[0]); - - this.yaxis._offset = size.t + (1 - domain.y[1]) * size.h; - this.yaxis._length = size.h * (domain.y[1] - domain.y[0]); -}; - -proto.updateLayers = function() { - var opts = this.opts; - var layers = opts.layers; - var layerList = this.layerList; - var i; - // if the layer arrays don't match, - // don't try to be smart, - // delete them all, and start all over. - - if(layers.length !== layerList.length) { - for(i = 0; i < layerList.length; i++) { - layerList[i].dispose(); - } - - layerList = this.layerList = []; + coerce('transition.duration'); + coerce('transition.easing'); - for(i = 0; i < layers.length; i++) { - layerList.push(createMapboxLayer(this, i, layers[i])); - } - } else { - for(i = 0; i < layers.length; i++) { - layerList[i].update(layers[i]); - } - } -}; + coerce('bgcolor'); + coerce('activebgcolor'); + coerce('bordercolor'); + coerce('borderwidth'); + coerce('ticklen'); + coerce('tickwidth'); + coerce('tickcolor'); + coerce('minorticklen'); +} -proto.destroy = function() { - if(this.map) { - this.map.remove(); - this.map = null; - this.container.removeChild(this.div); +function stepDefaults(valueIn, valueOut) { + function coerce(attr, dflt) { + return Lib.coerce(valueIn, valueOut, stepAttrs, attr, dflt); } -}; -proto.toImage = function() { - this.map.stop(); - return this.map.getCanvas().toDataURL(); -}; - -// convenience wrapper to create set multiple layer -// 'layout' or 'paint options at once. -proto.setOptions = function(id, methodName, opts) { - for(var k in opts) { - this.map[methodName](id, k, opts[k]); + var visible; + if(valueIn.method !== 'skip' && !Array.isArray(valueIn.args)) { + visible = valueOut.visible = false; } -}; - -// convenience method to project a [lon, lat] array to pixel coords -proto.project = function(v) { - return this.map.project(new mapboxgl.LngLat(v[0], v[1])); -}; - -// get map's current view values in plotly.js notation -proto.getView = function() { - var map = this.map; - - var mapCenter = map.getCenter(); - var center = { lon: mapCenter.lng, lat: mapCenter.lat }; - - return { - center: center, - zoom: map.getZoom(), - bearing: map.getBearing(), - pitch: map.getPitch() - }; -}; + else visible = coerce('visible'); -function getStyleObj(val) { - var styleValues = layoutAttributes.style.values; - var styleDflt = layoutAttributes.style.dflt; - var styleObj = {}; - - if(Lib.isPlainObject(val)) { - styleObj.id = val.id; - styleObj.style = val; - } else if(typeof val === 'string') { - styleObj.id = val; - styleObj.style = (styleValues.indexOf(val) !== -1) ? - convertStyleVal(val) : - val; - } else { - styleObj.id = styleDflt; - styleObj.style = convertStyleVal(styleDflt); + if(visible) { + coerce('method'); + coerce('args'); + var label = coerce('label', 'step-' + valueOut._index); + coerce('value', label); + coerce('execute'); } - - styleObj.transition = {duration: 0, delay: 0}; - - return styleObj; } -// if style is part of the 'official' mapbox values, add URL prefix and suffix -function convertStyleVal(val) { - return constants.styleUrlPrefix + val + '-' + constants.styleUrlSuffix; -} - -function convertCenter(center) { - return [center.lon, center.lat]; -} - -},{"../../components/dragelement":592,"../../components/fx":612,"../../lib":696,"../cartesian/select":762,"./constants":800,"./layers":803,"./layout_attributes":804,"mapbox-gl":409}],807:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plots/array_container_defaults":199,"./attributes":126,"./constants":127}],129:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127219,2728 +31231,2716 @@ 'use strict'; -// This is used exclusively by components inside component arrays, -// hence the 'arraydraw' editType. If this ever gets used elsewhere -// we could generalize it as a function ala font_attributes -module.exports = { - t: { - valType: 'number', - dflt: 0, - - editType: 'arraydraw', - - }, - r: { - valType: 'number', - dflt: 0, - - editType: 'arraydraw', - - }, - b: { - valType: 'number', - dflt: 0, - - editType: 'arraydraw', - - }, - l: { - valType: 'number', - dflt: 0, - - editType: 'arraydraw', - - }, - editType: 'arraydraw' -}; +var d3 = _dereq_('d3'); -},{}],808:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +var Plots = _dereq_('../../plots/plots'); +var Color = _dereq_('../color'); +var Drawing = _dereq_('../drawing'); +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; +var constants = _dereq_('./constants'); +var alignmentConstants = _dereq_('../../constants/alignment'); +var LINE_SPACING = alignmentConstants.LINE_SPACING; +var FROM_TL = alignmentConstants.FROM_TL; +var FROM_BR = alignmentConstants.FROM_BR; -'use strict'; +module.exports = function draw(gd) { + var fullLayout = gd._fullLayout; + var sliderData = makeSliderData(fullLayout, gd); -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); + // draw a container for *all* sliders: + var sliders = fullLayout._infolayer + .selectAll('g.' + constants.containerClassName) + .data(sliderData.length > 0 ? [0] : []); -var Registry = _dereq_('../registry'); -var PlotSchema = _dereq_('../plot_api/plot_schema'); -var Template = _dereq_('../plot_api/plot_template'); -var Lib = _dereq_('../lib'); -var Color = _dereq_('../components/color'); -var BADNUM = _dereq_('../constants/numerical').BADNUM; + sliders.enter().append('g') + .classed(constants.containerClassName, true) + .style('cursor', 'ew-resize'); -var axisIDs = _dereq_('../plots/cartesian/axis_ids'); + function clearSlider(sliderOpts) { + if(sliderOpts._commandObserver) { + sliderOpts._commandObserver.remove(); + delete sliderOpts._commandObserver; + } -var animationAttrs = _dereq_('./animation_attributes'); -var frameAttrs = _dereq_('./frame_attributes'); + // Most components don't need to explicitly remove autoMargin, because + // marginPushers does this - but slider updates don't go through + // a full replot so we need to explicitly remove it. + Plots.autoMargin(gd, autoMarginId(sliderOpts)); + } -var relinkPrivateKeys = Lib.relinkPrivateKeys; -var _ = Lib._; + sliders.exit().each(function() { + d3.select(this).selectAll('g.' + constants.groupClassName) + .each(clearSlider); + }) + .remove(); -var plots = module.exports = {}; + // Return early if no menus visible: + if(sliderData.length === 0) return; -// Expose registry methods on Plots for backward-compatibility -Lib.extendFlat(plots, Registry); + var sliderGroups = sliders.selectAll('g.' + constants.groupClassName) + .data(sliderData, keyFunction); -plots.attributes = _dereq_('./attributes'); -plots.attributes.type.values = plots.allTypes; -plots.fontAttrs = _dereq_('./font_attributes'); -plots.layoutAttributes = _dereq_('./layout_attributes'); + sliderGroups.enter().append('g') + .classed(constants.groupClassName, true); -// TODO make this a plot attribute? -plots.fontWeight = 'normal'; + sliderGroups.exit() + .each(clearSlider) + .remove(); -var transformsRegistry = plots.transformsRegistry; + // Find the dimensions of the sliders: + for(var i = 0; i < sliderData.length; i++) { + var sliderOpts = sliderData[i]; + findDimensions(gd, sliderOpts); + } -var commandModule = _dereq_('./command'); -plots.executeAPICommand = commandModule.executeAPICommand; -plots.computeAPICommandBindings = commandModule.computeAPICommandBindings; -plots.manageCommandObserver = commandModule.manageCommandObserver; -plots.hasSimpleAPICommandBindings = commandModule.hasSimpleAPICommandBindings; + sliderGroups.each(function(sliderOpts) { + var gSlider = d3.select(this); -// in some cases the browser doesn't seem to know how big -// the text is at first, so it needs to draw it, -// then wait a little, then draw it again -plots.redrawText = function(gd) { - gd = Lib.getGraphDiv(gd); + computeLabelSteps(sliderOpts); - // do not work if polar is present - if((gd.data && gd.data[0] && gd.data[0].r)) return; + Plots.manageCommandObserver(gd, sliderOpts, sliderOpts._visibleSteps, function(data) { + // NB: Same as below. This is *not* always the same as sliderOpts since + // if a new set of steps comes in, the reference in this callback would + // be invalid. We need to refetch it from the slider group, which is + // the join data that creates this slider. So if this slider still exists, + // the group should be valid, *to the best of my knowledge.* If not, + // we'd have to look it up by d3 data join index/key. + var opts = gSlider.data()[0]; - return new Promise(function(resolve) { - setTimeout(function() { - Registry.getComponentMethod('annotations', 'draw')(gd); - Registry.getComponentMethod('legend', 'draw')(gd); + if(opts.active === data.index) return; + if(opts._dragging) return; - (gd.calcdata || []).forEach(function(d) { - if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb(); - }); + setActive(gd, gSlider, opts, data.index, false, true); + }); - resolve(plots.previousPromises(gd)); - }, 300); + drawSlider(gd, d3.select(this), sliderOpts); }); }; -// resize plot about the container size -plots.resize = function(gd) { - gd = Lib.getGraphDiv(gd); +function autoMarginId(sliderOpts) { + return constants.autoMarginIdRoot + sliderOpts._index; +} - return new Promise(function(resolve, reject) { +// This really only just filters by visibility: +function makeSliderData(fullLayout, gd) { + var contOpts = fullLayout[constants.name]; + var sliderData = []; - function isHidden(gd) { - var display = window.getComputedStyle(gd).display; - return !display || display === 'none'; - } + for(var i = 0; i < contOpts.length; i++) { + var item = contOpts[i]; + if(!item.visible) continue; + item._gd = gd; + sliderData.push(item); + } - if(!gd || isHidden(gd)) { - reject(new Error('Resize must be passed a displayed plot div element.')); - } + return sliderData; +} - if(gd._redrawTimer) clearTimeout(gd._redrawTimer); +// This is set in the defaults step: +function keyFunction(opts) { + return opts._index; +} - gd._redrawTimer = setTimeout(function() { - // return if there is nothing to resize or is hidden - if(!gd.layout || (gd.layout.width && gd.layout.height) || isHidden(gd)) { - resolve(gd); - return; - } +// Compute the dimensions (mutates sliderOpts): +function findDimensions(gd, sliderOpts) { + var sliderLabels = Drawing.tester.selectAll('g.' + constants.labelGroupClass) + .data(sliderOpts._visibleSteps); - delete gd.layout.width; - delete gd.layout.height; + sliderLabels.enter().append('g') + .classed(constants.labelGroupClass, true); - // autosizing doesn't count as a change that needs saving - var oldchanged = gd.changed; + // loop over fake buttons to find width / height + var maxLabelWidth = 0; + var labelHeight = 0; + sliderLabels.each(function(stepOpts) { + var labelGroup = d3.select(this); - // nor should it be included in the undo queue - gd.autoplay = true; + var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - Registry.call('relayout', gd, {autosize: true}).then(function() { - gd.changed = oldchanged; - resolve(gd); - }); - }, 100); + 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 = {}; -// for use in Lib.syncOrAsync, check if there are any -// pending promises in this plot and wait for them -plots.previousPromises = function(gd) { - if((gd._promises || []).length) { - return Promise.all(gd._promises) - .then(function() { gd._promises = []; }); + dims.inputAreaWidth = Math.max( + constants.railWidth, + constants.gripHeight + ); + + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions + var graphSize = gd._fullLayout._size; + dims.lx = graphSize.l + graphSize.w * sliderOpts.x; + dims.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); + + if(sliderOpts.lenmode === 'fraction') { + // fraction: + dims.outerLength = Math.round(graphSize.w * sliderOpts.len); + } else { + // pixels: + dims.outerLength = sliderOpts.len; } -}; -/** - * Adds the 'Edit chart' link. - * Note that now Plotly.plot() calls this so it can regenerate whenever it replots - * - * Add source links to your graph inside the 'showSources' config argument. - */ -plots.addLinks = function(gd) { - // Do not do anything if showLink and showSources are not set to true in config - if(!gd._context.showLink && !gd._context.showSources) return; + // The length of the rail, *excluding* padding on either end: + dims.inputAreaStart = 0; + dims.inputAreaLength = Math.round(dims.outerLength - sliderOpts.pad.l - sliderOpts.pad.r); - var fullLayout = gd._fullLayout; + 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; - 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); + // loop over all possible values for currentValue to find the + // area we need for it + dims.currentValueMaxWidth = 0; + dims.currentValueHeight = 0; + dims.currentValueTotalHeight = 0; + dims.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + 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); }); - }); - // The text node inside svg - var text = linkContainer.node(); - var attrs = {y: fullLayout._paper.attr('height') - 9}; + dims.currentValueTotalHeight = dims.currentValueHeight + sliderOpts.currentvalue.offset; - // If text's width is bigger than the layout - // Check that text is a child node or document.body - // because otherwise IE/Edge might throw an exception - // when calling getComputedTextLength(). - // Apparently offsetParent is null for invisibles. - if(document.body.contains(text) && text.getComputedTextLength() >= (fullLayout.width - 20)) { - // Align the text at the left - attrs['text-anchor'] = 'start'; - attrs.x = 5; - } - else { - // Align the text at the right - attrs['text-anchor'] = 'end'; - attrs.x = fullLayout._paper.attr('width') - 7; + dummyGroup.remove(); } - linkContainer.attr(attrs); - - var toolspan = linkContainer.select('.js-link-to-tool'), - spacespan = linkContainer.select('.js-link-spacer'), - sourcespan = linkContainer.select('.js-sourcelinks'); + dims.height = dims.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + dims.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; - if(gd._context.showSources) gd._context.showSources(gd); + var xanchor = 'left'; + if(Lib.isRightAnchor(sliderOpts)) { + dims.lx -= dims.outerLength; + xanchor = 'right'; + } + if(Lib.isCenterAnchor(sliderOpts)) { + dims.lx -= dims.outerLength / 2; + xanchor = 'center'; + } - // 'view in plotly' link for embedded plots - if(gd._context.showLink) positionPlayWithData(gd, toolspan); + var yanchor = 'top'; + if(Lib.isBottomAnchor(sliderOpts)) { + dims.ly -= dims.height; + yanchor = 'bottom'; + } + if(Lib.isMiddleAnchor(sliderOpts)) { + dims.ly -= dims.height / 2; + yanchor = 'middle'; + } - // separator if we have both sources and tool link - spacespan.text((toolspan.text() && sourcespan.text()) ? ' - ' : ''); -}; + dims.outerLength = Math.ceil(dims.outerLength); + dims.height = Math.ceil(dims.height); + dims.lx = Math.round(dims.lx); + dims.ly = Math.round(dims.ly); -// note that now this function is only adding the brand in -// iframes and 3rd-party apps -function positionPlayWithData(gd, container) { - container.text(''); - var link = container.append('a') - .attr({ - 'xlink:xlink:href': '#', - 'class': 'link--impt link--embedview', - 'font-weight': 'bold' - }) - .text(gd._context.linkText + ' ' + String.fromCharCode(187)); + var marginOpts = { + y: sliderOpts.y, + b: dims.height * FROM_BR[yanchor], + t: dims.height * FROM_TL[yanchor] + }; - if(gd._context.sendData) { - link.on('click', function() { - plots.sendDataToCloud(gd); - }); + 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 { - 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 - }); + marginOpts.x = sliderOpts.x; + marginOpts.l = dims.outerLength * FROM_TL[xanchor]; + marginOpts.r = dims.outerLength * FROM_BR[xanchor]; } + + Plots.autoMargin(gd, autoMarginId(sliderOpts), marginOpts); } -plots.sendDataToCloud = function(gd) { - gd.emit('plotly_beforeexport'); +function drawSlider(gd, sliderGroup, sliderOpts) { + // This is related to the other long notes in this file regarding what happens + // when slider steps disappear. This particular fix handles what happens when + // the *current* slider step is removed. The drawing functions will error out + // when they fail to find it, so the fix for now is that it will just draw the + // slider in the first position but will not execute the command. + if(!((sliderOpts.steps[sliderOpts.active] || {}).visible)) { + sliderOpts.active = sliderOpts._visibleSteps[0]._index; + } - var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL; + // These are carefully ordered for proper z-ordering: + sliderGroup + .call(drawCurrentValue, sliderOpts) + .call(drawRail, sliderOpts) + .call(drawLabelGroup, sliderOpts) + .call(drawTicks, sliderOpts) + .call(drawTouchRect, gd, sliderOpts) + .call(drawGrip, gd, sliderOpts); - var hiddenformDiv = d3.select(gd) - .append('div') - .attr('id', 'hiddenform') - .style('display', 'none'); + var dims = sliderOpts._dims; - var hiddenform = hiddenformDiv - .append('form') - .attr({ - action: baseUrl + '/external', - method: 'post', - target: '_blank' - }); + // Position the rectangle: + Drawing.setTranslate(sliderGroup, dims.lx + sliderOpts.pad.l, dims.ly + sliderOpts.pad.t); - var hiddenformInput = hiddenform - .append('input') - .attr({ - type: 'text', - name: 'data' - }); + sliderGroup.call(setGripPosition, sliderOpts, false); + sliderGroup.call(drawCurrentValue, sliderOpts); - hiddenformInput.node().value = plots.graphJson(gd, false, 'keepdata'); - hiddenform.node().submit(); - hiddenformDiv.remove(); +} - gd.emit('plotly_afterexport'); - return false; -}; +function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { + if(!sliderOpts.currentvalue.visible) return; -var d3FormatKeys = [ - 'days', 'shortDays', 'months', 'shortMonths', 'periods', - 'dateTime', 'date', 'time', - 'decimal', 'thousands', 'grouping', 'currency' -]; + var dims = sliderOpts._dims; + var x0, textAnchor; -var extraFormatKeys = [ - 'year', 'month', 'dayMonth', 'dayMonthYear' -]; + switch(sliderOpts.currentvalue.xanchor) { + case 'right': + // This is anchored left and adjusted by the width of the longest label + // so that the prefix doesn't move. The goal of this is to emphasize + // what's actually changing and make the update less distracting. + x0 = dims.inputAreaLength - constants.currentValueInset - dims.currentValueMaxWidth; + textAnchor = 'left'; + break; + case 'center': + x0 = dims.inputAreaLength * 0.5; + textAnchor = 'middle'; + break; + default: + x0 = constants.currentValueInset; + textAnchor = 'left'; + } -/* - * Fill in default values - * @param {DOM element} gd - * @param {object} opts - * @param {boolean} opts.skipUpdateCalc: normally if the existing gd.calcdata looks - * compatible with the new gd._fullData we finish by linking the new _fullData traces - * to the old gd.calcdata, so it's correctly set if we're not going to recalc. But also, - * if there are calcTransforms on the trace, we first remap data arrays from the old full - * trace into the new one. Use skipUpdateCalc to defer this (needed by Plotly.react) - * - * gd.data, gd.layout: - * are precisely what the user specified (except as modified by cleanData/cleanLayout), - * these fields shouldn't be modified (except for filling in some auto values) - * nor used directly after the supply defaults step. - * - * gd._fullData, gd._fullLayout: - * are complete descriptions of how to draw the plot, - * use these fields in all required computations. - * - * gd._fullLayout._modules - * is a list of all the trace modules required to draw the plot. - * - * gd._fullLayout._visibleModules - * subset of _modules, a list of modules corresponding to visible:true traces. - * - * gd._fullLayout._basePlotModules - * is a list of all the plot modules required to draw the plot. - * - * gd._fullLayout._transformModules - * is a list of all the transform modules invoked. - * - */ -plots.supplyDefaults = function(gd, opts) { - var skipUpdateCalc = opts && opts.skipUpdateCalc; - var oldFullLayout = gd._fullLayout || {}; + var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { + s.classed('user-select-none', true) + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); + }); - if(oldFullLayout._skipDefaults) { - delete oldFullLayout._skipDefaults; - return; + var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; + + if(typeof valueOverride === 'string') { + str += valueOverride; + } else { + var curVal = sliderOpts.steps[sliderOpts.active].label; + str += curVal; } - var newFullLayout = gd._fullLayout = {}; - var newLayout = gd.layout || {}; + if(sliderOpts.currentvalue.suffix) { + str += sliderOpts.currentvalue.suffix; + } - var oldFullData = gd._fullData || []; - var newFullData = gd._fullData = []; - var newData = gd.data || []; + text.call(Drawing.font, sliderOpts.currentvalue.font) + .text(str) + .call(svgTextUtils.convertToTspans, sliderOpts._gd); - var oldCalcdata = gd.calcdata || []; + var lines = svgTextUtils.lineCount(text); - var context = gd._context || {}; + var y0 = (dims.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; - var i; + svgTextUtils.positionText(text, x0, y0); - // Create all the storage space for frames, but only if doesn't already exist - if(!gd._transitionData) plots.createTransitionData(gd); + return text; +} - // So we only need to do this once (and since we have gd here) - // get the translated placeholder titles. - // These ones get used as default values so need to be known at supplyDefaults - // others keep their blank defaults but render the placeholder as desired later - // TODO: make these work the same way, only inserting the placeholder text at draw time? - // The challenge is that this has slightly different behavior right now in editable mode: - // using the placeholder as default makes this text permanently (but lightly) visible, - // but explicit '' for these titles gives you a placeholder that's hidden until you mouse - // over it - so you're not distracted by it if you really don't want a title, but if you do - // and you're new to plotly you may not be able to find it. - // When editable=false the two behave the same, no title is drawn. - newFullLayout._dfltTitle = { - plot: _(gd, 'Click to enter Plot title'), - x: _(gd, 'Click to enter X axis title'), - y: _(gd, 'Click to enter Y axis title'), - colorbar: _(gd, 'Click to enter Colorscale title'), - annotation: _(gd, 'new text') - }; - newFullLayout._traceWord = _(gd, 'trace'); +function drawGrip(sliderGroup, gd, sliderOpts) { + var grip = Lib.ensureSingle(sliderGroup, 'rect', constants.gripRectClass, function(s) { + s.call(attachGripEvents, gd, sliderGroup, sliderOpts) + .style('pointer-events', 'all'); + }); - var formatObj = getFormatObj(gd, d3FormatKeys); + 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.classed('user-select-none', true) + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); + }); - // stash the token from context so mapbox subplots can use it as default - newFullLayout._mapboxAccessToken = context.mapboxAccessToken; + text.call(Drawing.font, sliderOpts.font) + .text(data.step.label) + .call(svgTextUtils.convertToTspans, sliderOpts._gd); - // first fill in what we can of layout without looking at data - // because fullData needs a few things from layout - if(oldFullLayout._initialAutoSizeIsDone) { + return text; +} - // coerce the updated layout while preserving width and height - var oldWidth = oldFullLayout.width, - oldHeight = oldFullLayout.height; +function drawLabelGroup(sliderGroup, sliderOpts) { + var labels = Lib.ensureSingle(sliderGroup, 'g', constants.labelsClass); + var dims = sliderOpts._dims; - plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj); + var labelItems = labels.selectAll('g.' + constants.labelGroupClass) + .data(dims.labelSteps); - if(!newLayout.width) newFullLayout.width = oldWidth; - if(!newLayout.height) newFullLayout.height = oldHeight; - plots.sanitizeMargins(newFullLayout); - } - else { + labelItems.enter().append('g') + .classed(constants.labelGroupClass, true); - // coerce the updated layout and autosize if needed - plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj); + labelItems.exit().remove(); - var missingWidthOrHeight = (!newLayout.width || !newLayout.height), - autosize = newFullLayout.autosize, - autosizable = context.autosizable, - initialAutoSize = missingWidthOrHeight && (autosize || autosizable); + labelItems.each(function(d) { + var item = d3.select(this); - if(initialAutoSize) plots.plotAutoSize(gd, newLayout, newFullLayout); - else if(missingWidthOrHeight) plots.sanitizeMargins(newFullLayout); + item.call(drawLabel, d, sliderOpts); - // for backwards-compatibility with Plotly v1.x.x - if(!autosize && missingWidthOrHeight) { - newLayout.width = newFullLayout.width; - newLayout.height = newFullLayout.height; - } - } + 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 + ); + }); - newFullLayout._d3locale = getFormatter(formatObj, newFullLayout.separators); - newFullLayout._extraFormat = getFormatObj(gd, extraFormatKeys); +} - newFullLayout._initialAutoSizeIsDone = true; +function handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, doTransition) { + var quantizedPosition = Math.round(normalizedPosition * (sliderOpts._stepCount - 1)); + var quantizedIndex = sliderOpts._visibleSteps[quantizedPosition]._index; - // keep track of how many traces are inputted - newFullLayout._dataLength = newData.length; + if(quantizedIndex !== sliderOpts.active) { + setActive(gd, sliderGroup, sliderOpts, quantizedIndex, true, doTransition); + } +} - // clear the lists of trace and baseplot modules, and subplots - newFullLayout._modules = []; - newFullLayout._visibleModules = []; - newFullLayout._basePlotModules = []; - var subplots = newFullLayout._subplots = emptySubplotLists(); +function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) { + var previousActive = sliderOpts.active; + sliderOpts.active = index; - // initialize axis and subplot hash objects for splom-generated grids - var splomAxes = newFullLayout._splomAxes = {x: {}, y: {}}; - var splomSubplots = newFullLayout._splomSubplots = {}; - // initialize splom grid defaults - newFullLayout._splomGridDflt = {}; + // due to templating, it's possible this slider doesn't even exist yet + arrayEditor(gd.layout, constants.name, sliderOpts) + .applyUpdate('active', index); - // for stacked area traces to share config across traces - newFullLayout._scatterStackOpts = {}; - // for the first scatter trace on each subplot (so it knows tonext->tozero) - newFullLayout._firstScatter = {}; + var step = sliderOpts.steps[sliderOpts.active]; - // for traces to request a default rangeslider on their x axes - // eg set `_requestRangeslider.x2 = true` for xaxis2 - newFullLayout._requestRangeslider = {}; + sliderGroup.call(setGripPosition, sliderOpts, doTransition); + sliderGroup.call(drawCurrentValue, sliderOpts); - // pull uids from old data to use as new defaults - newFullLayout._traceUids = getTraceUids(oldFullData, newData); + gd.emit('plotly_sliderchange', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active], + interaction: doCallback, + previousActive: previousActive + }); - // then do the data - newFullLayout._globalTransforms = (gd._context || {}).globalTransforms; - plots.supplyDataDefaults(newData, newFullData, newLayout, newFullLayout); + if(step && step.method && doCallback) { + if(sliderGroup._nextMethod) { + // If we've already queued up an update, just overwrite it with the most recent: + sliderGroup._nextMethod.step = step; + sliderGroup._nextMethod.doCallback = doCallback; + sliderGroup._nextMethod.doTransition = doTransition; + } else { + sliderGroup._nextMethod = {step: step, doCallback: doCallback, doTransition: doTransition}; + sliderGroup._nextMethodRaf = window.requestAnimationFrame(function() { + var _step = sliderGroup._nextMethod.step; + if(!_step.method) return; - // redo grid size defaults with info about splom x/y axes, - // and fill in generated cartesian axes and subplots - 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); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } - 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); + sliderGroup._nextMethod = null; + sliderGroup._nextMethodRaf = null; + }); } } +} - // attach helper method to check whether a plot type is present on graph - newFullLayout._has = plots._hasPlotType.bind(newFullLayout); +function attachGripEvents(item, gd, sliderGroup) { + var node = sliderGroup.node(); + var $gd = d3.select(gd); - if(oldFullData.length === newFullData.length) { - for(i = 0; i < newFullData.length; i++) { - relinkPrivateKeys(newFullData[i], oldFullData[i]); - } + // NB: This is *not* the same as sliderOpts itself! These callbacks + // are in a closure so this array won't actually be correct if the + // steps have changed since this was initialized. The sliderGroup, + // however, has not changed since that *is* the slider, so it must + // be present to receive mouse events. + function getSliderOpts() { + return sliderGroup.data()[0]; } - // finally, fill in the pieces of layout that may need to look at data - plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); + item.on('mousedown', function() { + var sliderOpts = getSliderOpts(); + gd.emit('plotly_sliderstart', {slider: sliderOpts}); - // Special cases that introduce interactions between traces. - // This is after relinkPrivateKeys so we can use those in crossTraceDefaults - // and after layout module defaults, so we can use eg barmode - var _modules = newFullLayout._visibleModules; - var crossTraceDefaultsFuncs = []; - for(i = 0; i < _modules.length; i++) { - var funci = _modules[i].crossTraceDefaults; - // some trace types share crossTraceDefaults (ie histogram2d, histogram2dcontour) - if(funci) Lib.pushUnique(crossTraceDefaultsFuncs, funci); - } - for(i = 0; i < crossTraceDefaultsFuncs.length; i++) { - crossTraceDefaultsFuncs[i](newFullData, newFullLayout); - } + var grip = sliderGroup.select('.' + constants.gripRectClass); - // turn on flag to optimize large splom-only graphs - // mostly by omitting SVG layers during Cartesian.drawFramework - 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 - ); + d3.event.stopPropagation(); + d3.event.preventDefault(); + grip.call(Color.fill, sliderOpts.activebgcolor); - // TODO remove in v2.0.0 - // add has-plot-type refs to fullLayout for backward compatibility - newFullLayout._hasCartesian = newFullLayout._has('cartesian'); - newFullLayout._hasGeo = newFullLayout._has('geo'); - newFullLayout._hasGL3D = newFullLayout._has('gl3d'); - newFullLayout._hasGL2D = newFullLayout._has('gl2d'); - newFullLayout._hasTernary = newFullLayout._has('ternary'); - newFullLayout._hasPie = newFullLayout._has('pie'); + var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]); + handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, true); + sliderOpts._dragging = true; - // relink / initialize subplot axis objects - plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout); + $gd.on('mousemove', function() { + var sliderOpts = getSliderOpts(); + var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]); + handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, false); + }); - // clean subplots and other artifacts from previous plot calls - plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout); + $gd.on('mouseup', function() { + var sliderOpts = getSliderOpts(); + sliderOpts._dragging = false; + grip.call(Color.fill, sliderOpts.bgcolor); + $gd.on('mouseup', null); + $gd.on('mousemove', null); - // relink functions and _ attributes to promote consistency between plots - relinkPrivateKeys(newFullLayout, oldFullLayout); + gd.emit('plotly_sliderend', { + slider: sliderOpts, + step: sliderOpts.steps[sliderOpts.active] + }); + }); + }); +} - // TODO may return a promise - plots.doAutoMargin(gd); +function drawTicks(sliderGroup, sliderOpts) { + var tick = sliderGroup.selectAll('rect.' + constants.tickRectClass) + .data(sliderOpts._visibleSteps); + var dims = sliderOpts._dims; - // set scale after auto margin routine - var axList = axisIDs.list(gd); - for(i = 0; i < axList.length; i++) { - var ax = axList[i]; - ax.setScale(); - } + tick.enter().append('rect') + .classed(constants.tickRectClass, true); - // update object references in calcdata - if(!skipUpdateCalc && oldCalcdata.length === newFullData.length) { - plots.supplyDefaultsUpdateCalc(oldCalcdata, newFullData); - } -}; + tick.exit().remove(); -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; + tick.attr({ + width: sliderOpts.tickwidth + 'px', + 'shape-rendering': 'crispEdges' + }); - 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; - } - } -}; + tick.each(function(d, i) { + var isMajor = i % dims.labelStride === 0; + var item = d3.select(this); -/** - * Create a list of uid strings satisfying (in this order of importance): - * 1. all unique, all strings - * 2. matches input uids if provided - * 3. matches previous data uids - */ -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 = {}; + item + .attr({height: isMajor ? sliderOpts.ticklen : sliderOpts.minorticklen}) + .call(Color.fill, isMajor ? sliderOpts.tickcolor : sliderOpts.tickcolor); - function setUid(uid, i) { - out[i] = uid; - seenUids[uid] = 1; + 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 tryUid(uid, i) { - if(uid && typeof uid === 'string' && !seenUids[uid]) { - setUid(uid, i); - return true; +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; } } - for(i = 0; i < len; i++) { - if(tryUid(newData[i].uid, i)) continue; - if(i < oldLen && tryUid(oldFullInput[i].uid, i)) continue; - setUid(Lib.randstr(seenUids), i); + var x = normalizedValueToPosition(sliderOpts, quantizedIndex / (sliderOpts._stepCount - 1)); + + // If this is true, then *this component* is already invoking its own command + // and has triggered its own animation. + if(sliderOpts._invokingCommand) return; + + var el = grip; + if(doTransition && sliderOpts.transition.duration > 0) { + el = el.transition() + .duration(sliderOpts.transition.duration) + .ease(sliderOpts.transition.easing); } - return out; + // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. + // It's also not necessary because there are no other transitions to preserve. + el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); } -/** - * Make a container for collecting subplots we need to display. - * - * Finds all subplot types we need to enumerate once and caches it, - * but makes a new output object each time. - * Single-trace subplots (which have no `id`) such as pie, table, etc - * do not need to be collected because we just draw all visible traces. - */ -var collectableSubplotTypes; -function emptySubplotLists() { - var out = {}; - var i, j; +// Convert a number from [0-1] to a pixel position relative to the slider group container: +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)); +} - if(!collectableSubplotTypes) { - collectableSubplotTypes = []; +// Convert a position relative to the slider group to a nubmer in [0, 1] +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))); +} - var subplotsRegistry = Registry.subplotsRegistry; +function drawTouchRect(sliderGroup, gd, sliderOpts) { + var dims = sliderOpts._dims; + var rect = Lib.ensureSingle(sliderGroup, 'rect', constants.railTouchRectClass, function(s) { + s.call(attachGripEvents, gd, sliderGroup, sliderOpts) + .style('pointer-events', 'all'); + }); - for(var subplotType in subplotsRegistry) { - var subplotModule = subplotsRegistry[subplotType]; - var subplotAttr = subplotModule.attr; + rect.attr({ + width: dims.inputAreaLength, + height: Math.max(dims.inputAreaWidth, constants.tickOffset + sliderOpts.ticklen + dims.labelHeight) + }) + .call(Color.fill, sliderOpts.bgcolor) + .attr('opacity', 0); - if(subplotAttr) { - collectableSubplotTypes.push(subplotType); + Drawing.setTranslate(rect, 0, dims.currentValueTotalHeight); +} - // special case, currently just for cartesian: - // we need to enumerate axes, not just subplots - if(Array.isArray(subplotAttr)) { - for(j = 0; j < subplotAttr.length; j++) { - Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]); - } - } - } - } - } +function drawRail(sliderGroup, sliderOpts) { + var dims = sliderOpts._dims; + var computedLength = dims.inputAreaLength - constants.railInset * 2; + var rect = Lib.ensureSingle(sliderGroup, 'rect', constants.railRectClass); - for(i = 0; i < collectableSubplotTypes.length; i++) { - out[collectableSubplotTypes[i]] = []; - } - return out; + 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 + ); } +},{"../../constants/alignment":138,"../../lib":159,"../../lib/svg_text_utils":180,"../../plot_api/plot_template":193,"../../plots/plots":236,"../color":43,"../drawing":64,"./constants":127,"d3":8}],130:[function(_dereq_,module,exports){ /** - * getFormatObj: use _context to get the format object from locale. - * Used to get d3.locale argument object and extraFormat argument object - * - * Regarding d3.locale argument : - * decimal and thousands can be overridden later by layout.separators - * grouping and currency are not presently used by our automatic number - * formatting system but can be used by custom formats. - * - * @returns {object} d3.locale format object - */ -function getFormatObj(gd, formatKeys) { - var locale = gd._context.locale; - if(!locale) locale === 'en-US'; +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var formatDone = false; - var formatObj = {}; +'use strict'; - function includeFormat(newFormat) { - var formatFinished = true; - for(var i = 0; i < formatKeys.length; i++) { - var formatKey = formatKeys[i]; - if(!formatObj[formatKey]) { - if(newFormat[formatKey]) { - formatObj[formatKey] = newFormat[formatKey]; - } - else formatFinished = false; - } - } - if(formatFinished) formatDone = true; - } +var constants = _dereq_('./constants'); - // same as localize, look for format parts in each format spec in the chain - for(var i = 0; i < 2; i++) { - var locales = gd._context.locales; - for(var j = 0; j < 2; j++) { - var formatj = (locales[locale] || {}).format; - if(formatj) { - includeFormat(formatj); - if(formatDone) break; - } - locales = Registry.localeRegistry; - } +module.exports = { + moduleType: 'component', + name: constants.name, - var baseLocale = locale.split('-')[0]; - if(formatDone || baseLocale === locale) break; - locale = baseLocale; - } + layoutAttributes: _dereq_('./attributes'), + supplyLayoutDefaults: _dereq_('./defaults'), - // lastly pick out defaults from english (non-US, as DMY is so much more common) - if(!formatDone) includeFormat(Registry.localeRegistry.en.format); + draw: _dereq_('./draw') +}; - return formatObj; -} +},{"./attributes":126,"./constants":127,"./defaults":128,"./draw":129}],131:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); + +var Plots = _dereq_('../../plots/plots'); +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var Drawing = _dereq_('../drawing'); +var Color = _dereq_('../color'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var interactConstants = _dereq_('../../constants/interactions'); + +module.exports = { + draw: draw +}; + +var numStripRE = / [XY][0-9]* /; /** - * getFormatter: combine the final separators with the locale formatting object - * we pulled earlier to generate number and time formatters - * TODO: remove separators in v2, only use locale, so we don't need this step? - * - * @param {object} formatObj: d3.locale format object - * @param {string} separators: length-2 string to override decimal and thousands - * separators in number formatting + * Titles - (re)draw titles on the axes and plot: + * @param {DOM element} gd - the graphDiv + * @param {string} titleClass - the css class of this title + * @param {object} options - how and what to draw + * propContainer - the layout object containing `title` and `titlefont` + * attributes that apply to this title + * propName - the full name of the title property (for Plotly.relayout) + * [traceIndex] - include only if this property applies to one trace + * (such as a colorbar title) - then editing pipes to Plotly.restyle + * instead of Plotly.relayout + * placeholder - placeholder text for an empty editable title + * [avoid] {object} - include if this title should move to avoid other elements + * selection - d3 selection of elements to avoid + * side - which direction to move if there is a conflict + * [offsetLeft] - if these elements are subject to a translation + * wrt the title element + * [offsetTop] + * attributes {object} - position and alignment attributes + * x - pixels + * y - pixels + * text-anchor - start|middle|end + * transform {object} - how to transform the title after positioning + * rotate - degrees + * offset - shift up/down in the rotated frame (unused?) + * containerGroup - if an svg element already exists to hold this + * title, include here. Otherwise it will go in fullLayout._infolayer * - * @returns {object} {numberFormat, timeFormat} d3 formatter factory functions - * for numbers and time + * @return {selection} d3 selection of title container group */ -function getFormatter(formatObj, separators) { - formatObj.decimal = separators.charAt(0); - formatObj.thousands = separators.charAt(1); +function draw(gd, titleClass, options) { + 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; - return d3.locale(formatObj); -} + var fullLayout = gd._fullLayout; -// Create storage for all of the data related to frames and transitions: -plots.createTransitionData = function(gd) { - // Set up the default keyframe if it doesn't exist: - if(!gd._transitionData) { - gd._transitionData = {}; - } + var opacity = 1; + var isplaceholder = false; + var title = cont.title; + var txt = (title && title.text ? title.text : '').trim(); - if(!gd._transitionData._frames) { - gd._transitionData._frames = []; - } + var font = title && title.font ? title.font : {}; + var fontFamily = font.family; + var fontSize = font.size; + var fontColor = font.color; - if(!gd._transitionData._frameHash) { - gd._transitionData._frameHash = {}; - } + // only make this title editable if we positively identify its property + // as one that has editing enabled. + 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 = gd._context.edits[editAttr]; - if(!gd._transitionData._counter) { - gd._transitionData._counter = 0; + if(txt === '') opacity = 0; + // look for placeholder text while stripping out numbers from eg X2, Y3 + // this is just for backward compatibility with the old version that had + // "Click to enter X2 title" and may have gotten saved in some old plots, + // we don't want this to show up when these are displayed. + else if(txt.replace(numStripRE, ' % ') === placeholder.replace(numStripRE, ' % ')) { + opacity = 0.2; + isplaceholder = true; + if(!editable) txt = ''; } - if(!gd._transitionData._interruptCallbacks) { - gd._transitionData._interruptCallbacks = []; + if(fullLayout.meta) { + txt = Lib.templateString(txt, {meta: fullLayout.meta}); } -}; -// helper function to be bound to fullLayout to check -// whether a certain plot type is present on plot -// or trace has a category -plots._hasPlotType = function(category) { - var i; + var elShouldExist = txt || editable; - // check base plot modules - var basePlotModules = this._basePlotModules || []; - for(i = 0; i < basePlotModules.length; i++) { - if(basePlotModules[i].name === category) return true; + if(!group) { + group = Lib.ensureSingle(fullLayout._infolayer, 'g', 'g-' + titleClass); } - // check trace modules (including non-visible:true) - var modules = this._modules || []; - for(i = 0; i < modules.length; i++) { - var name = modules[i].name; - if(name === category) return true; - // N.B. this is modules[i] along with 'categories' as a hash object - var _module = Registry.modules[name]; - if(_module && _module.categories[category]) return true; - } + var el = group.selectAll('text') + .data(elShouldExist ? [0] : []); + el.enter().append('text'); + el.text(txt) + // this is hacky, but convertToTspans uses the class + // to determine whether to rotate mathJax... + // so we need to clear out any old class and put the + // correct one (only relevant for colorbars, at least + // for now) - ie don't use .classed + .attr('class', titleClass); + el.exit().remove(); - return false; -}; + if(!elShouldExist) return group; -plots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var i, j; + function titleLayout(titleEl) { + Lib.syncOrAsync([drawTitle, scootTitle], titleEl); + } - var basePlotModules = oldFullLayout._basePlotModules || []; - for(i = 0; i < basePlotModules.length; i++) { - var _module = basePlotModules[i]; + function drawTitle(titleEl) { + var transformVal; - if(_module.clean) { - _module.clean(newFullData, newFullLayout, oldFullData, oldFullLayout); + if(transform) { + transformVal = ''; + if(transform.rotate) { + transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; + } + if(transform.offset) { + transformVal += 'translate(0, ' + transform.offset + ')'; + } + } else { + transformVal = null; } - } - var hadGl = oldFullLayout._has && oldFullLayout._has('gl'); - var hasGl = newFullLayout._has && newFullLayout._has('gl'); + titleEl.attr('transform', transformVal); - if(hadGl && !hasGl) { - if(oldFullLayout._glcontainer !== undefined) { - oldFullLayout._glcontainer.selectAll('.gl-canvas').remove(); - oldFullLayout._glcontainer.selectAll('.no-webgl').remove(); - oldFullLayout._glcanvas = null; - } + titleEl.style({ + 'font-family': fontFamily, + 'font-size': d3.round(fontSize, 2) + 'px', + fill: Color.rgb(fontColor), + opacity: opacity * Color.opacity(fontColor), + 'font-weight': Plots.fontWeight + }) + .attr(attributes) + .call(svgTextUtils.convertToTspans, gd); + + return Plots.previousPromises(gd); } - var hasInfoLayer = !!oldFullLayout._infolayer; + function scootTitle(titleElIn) { + var titleGroup = d3.select(titleElIn.node().parentNode); - oldLoop: - for(i = 0; i < oldFullData.length; i++) { - var oldTrace = oldFullData[i], - oldUid = oldTrace.uid; + if(avoid && avoid.selection && avoid.side && txt) { + titleGroup.attr('transform', null); - for(j = 0; j < newFullData.length; j++) { - var newTrace = newFullData[j]; + // move toward avoid.side (= left, right, top, bottom) if needed + // can include pad (pixels, default 2) + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + // Prevent the title going off the paper + if(maxshift < 0) shift = maxshift; + else { + // so we don't have to offset each avoided element, + // give the title the opposite offset + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; + titlebb.left -= offsetLeft; + titlebb.right -= offsetLeft; + titlebb.top -= offsetTop; + titlebb.bottom -= offsetTop; - if(oldUid === newTrace.uid) continue oldLoop; - } + // iterate over a set of elements (avoid.selection) + // to avoid collisions with + avoid.selection.each(function() { + var avoidbb = Drawing.bBox(this); - // clean old colorbars - if(hasInfoLayer) { - oldFullLayout._infolayer.select('.cb' + oldUid).remove(); + if(Lib.bBoxIntersect(titlebb, avoidbb, pad)) { + shift = Math.max(shift, shiftSign * ( + avoidbb[avoid.side] - titlebb[backside]) + pad); + } + }); + shift = Math.min(maxshift, 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', + 'translate(' + shiftTemplate + ')'); + } } } - if(oldFullLayout._zoomlayer) { - oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); - } -}; - -plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var i, j; - - var oldSubplots = oldFullLayout._plots || {}; - var newSubplots = newFullLayout._plots = {}; - var newSubplotList = newFullLayout._subplots; + el.call(titleLayout); - var mockGd = { - _fullData: newFullData, - _fullLayout: newFullLayout - }; + function setPlaceholder() { + opacity = 0; + isplaceholder = true; + el.text(placeholder) + .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); + }); + } - var ids = newSubplotList.cartesian.concat(newSubplotList.gl2d || []); + if(editable) { + if(!txt) setPlaceholder(); + else el.on('.opacity', null); - for(i = 0; i < ids.length; i++) { - var id = ids[i]; - var oldSubplot = oldSubplots[id]; - var xaxis = axisIDs.getFromId(mockGd, id, 'x'); - var yaxis = axisIDs.getFromId(mockGd, id, 'y'); - var plotinfo; + el.call(svgTextUtils.makeEditable, {gd: gd}) + .on('edit', function(text) { + if(traceIndex !== undefined) { + Registry.call('_guiRestyle', gd, prop, text, traceIndex); + } else { + Registry.call('_guiRelayout', gd, 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); + }); + } + el.classed('js-placeholder', isplaceholder); - // link or create subplot object - if(oldSubplot) { - plotinfo = newSubplots[id] = oldSubplot; - } else { - plotinfo = newSubplots[id] = {}; - plotinfo.id = id; - } + return group; +} - // update x and y axis layout object refs - plotinfo.xaxis = xaxis; - plotinfo.yaxis = yaxis; +},{"../../constants/interactions":139,"../../lib":159,"../../lib/svg_text_utils":180,"../../plots/plots":236,"../../registry":243,"../color":43,"../drawing":64,"d3":8,"fast-isnumeric":10}],132:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // By default, we clip at the subplot level, - // but if one trace on a given subplot has *cliponaxis* set to false, - // we need to clip at the trace module layer level; - // find this out here, once of for all. - plotinfo._hasClipOnAxisFalse = false; +'use strict'; - for(j = 0; j < newFullData.length; j++) { - var trace = newFullData[j]; +var fontAttrs = _dereq_('../../plots/font_attributes'); +var colorAttrs = _dereq_('../color/attributes'); +var extendFlat = _dereq_('../../lib/extend').extendFlat; +var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; +var padAttrs = _dereq_('../../plots/pad_attributes'); +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; - if( - trace.xaxis === plotinfo.xaxis._id && - trace.yaxis === plotinfo.yaxis._id && - trace.cliponaxis === false - ) { - plotinfo._hasClipOnAxisFalse = true; - break; - } - } +var buttonsAttrs = templatedArray('button', { + visible: { + valType: 'boolean', + + + }, + method: { + valType: 'enumerated', + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], + dflt: 'restyle', + + + }, + args: { + valType: 'info_array', + + freeLength: true, + items: [ + {valType: 'any'}, + {valType: 'any'}, + {valType: 'any'} + ], + + }, + label: { + valType: 'string', + + dflt: '', + + }, + execute: { + valType: 'boolean', + + dflt: true, + } +}); - // while we're at it, link overlaying axes to their main axes and - // anchored axes to the axes they're anchored to - var axList = axisIDs.list(mockGd, null, true); - for(i = 0; i < axList.length; i++) { - var ax = axList[i]; - var mainAx = null; - - if(ax.overlaying) { - mainAx = axisIDs.getFromId(mockGd, ax.overlaying); +module.exports = overrideAll(templatedArray('updatemenu', { + _arrayAttrRegexps: [/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/], - // you cannot overlay an axis that's already overlaying another - if(mainAx && mainAx.overlaying) { - ax.overlaying = false; - mainAx = null; - } - } - ax._mainAxis = mainAx || ax; + visible: { + valType: 'boolean', + + + }, - /* - * For now force overlays to overlay completely... so they - * can drag together correctly and share backgrounds. - * Later perhaps we make separate axis domain and - * tick/line domain or something, so they can still share - * the (possibly larger) dragger and background but don't - * have to both be drawn over that whole domain - */ - if(mainAx) ax.domain = mainAx.domain.slice(); + type: { + valType: 'enumerated', + values: ['dropdown', 'buttons'], + dflt: 'dropdown', + + + }, - ax._anchorAxis = ax.anchor === 'free' ? - null : - axisIDs.getFromId(mockGd, ax.anchor); - } -}; + direction: { + valType: 'enumerated', + values: ['left', 'right', 'up', 'down'], + dflt: 'down', + + + }, -// This function clears any trace attributes with valType: color and -// no set dflt filed in the plot schema. This is needed because groupby (which -// is the only transform for which this currently applies) supplies parent -// trace defaults, then expanded trace defaults. The result is that `null` -// colors are default-supplied and inherited as a color instead of a null. -// The result is that expanded trace default colors have no effect, with -// the final result that groups are indistinguishable. This function clears -// those colors so that individual groupby groups get unique colors. -plots.clearExpandedTraceDefaultColors = function(trace) { - var colorAttrs, path, i; + active: { + valType: 'integer', + + min: -1, + dflt: 0, + + }, - // This uses weird closure state in order to satisfy the linter rule - // that we can't create functions in a loop. - function locateColorAttrs(attr, attrName, attrs, level) { - path[level] = attrName; - path.length = level + 1; - if(attr.valType === 'color' && attr.dflt === undefined) { - colorAttrs.push(path.join('.')); - } - } + showactive: { + valType: 'boolean', + + dflt: true, + + }, - path = []; + buttons: buttonsAttrs, - // Get the cached colorAttrs: - colorAttrs = trace._module._colorAttrs; + x: { + valType: 'number', + min: -2, + max: 3, + dflt: -0.05, + + + }, + xanchor: { + valType: 'enumerated', + values: ['auto', 'left', 'center', 'right'], + dflt: 'right', + + + }, + y: { + valType: 'number', + min: -2, + max: 3, + dflt: 1, + + + }, + yanchor: { + valType: 'enumerated', + values: ['auto', 'top', 'middle', 'bottom'], + dflt: 'top', + + + }, - // Or else compute and cache the colorAttrs on the module: - if(!colorAttrs) { - trace._module._colorAttrs = colorAttrs = []; - PlotSchema.crawl( - trace._module.attributes, - locateColorAttrs - ); - } + pad: extendFlat(padAttrs({editType: 'arraydraw'}), { + + }), - for(i = 0; i < colorAttrs.length; i++) { - var origprop = Lib.nestedProperty(trace, '_input.' + colorAttrs[i]); + font: fontAttrs({ + + }), - if(!origprop.get()) { - Lib.nestedProperty(trace, colorAttrs[i]).set(null); - } + bgcolor: { + valType: 'color', + + + }, + bordercolor: { + valType: 'color', + dflt: colorAttrs.borderLine, + + + }, + borderwidth: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'arraydraw', + } -}; - +}), 'arraydraw', 'from-root'); -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; +},{"../../lib/extend":153,"../../plot_api/edit_types":186,"../../plot_api/plot_template":193,"../../plots/font_attributes":230,"../../plots/pad_attributes":235,"../color/attributes":42}],133:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var i, fullTrace, trace; - fullLayout._transformModules = []; +'use strict'; - function pushModule(fullTrace) { - dataOut.push(fullTrace); - var _module = fullTrace._module; - if(!_module) return; +module.exports = { - Lib.pushUnique(modules, _module); - if(fullTrace.visible === true) Lib.pushUnique(visibleModules, _module); - Lib.pushUnique(basePlotModules, fullTrace._module.basePlotModule); - cnt++; + // layout attribute name + name: 'updatemenus', - // TODO: do we really want color not to increment for explicitly invisible traces? - // This logic is weird, but matches previous behavior: traces that you explicitly - // set to visible:false do not increment the color, but traces WE determine to be - // empty or invalid (and thus set to visible:false) DO increment color. - // I kind of think we should just let all traces increment color, visible or not. - // see mock: axes-autotype-empty vs. a test of restyling visible: false that - // I can't find right now... - if(fullTrace._input.visible !== false) colorCnt++; - } + // 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', - var carpetIndex = {}; - var carpetDependents = []; - var dataTemplate = (layout.template || {}).data || {}; - var templater = Template.traceTemplater(dataTemplate); + // DOM attribute name in button group keeping track + // of active update menu + menuIndexAttrName: 'updatemenu-active-index', - for(i = 0; i < dataIn.length; i++) { - trace = dataIn[i]; + // id root pass to Plots.autoMargin + autoMarginIdRoot: 'updatemenu-', - // reuse uid we may have pulled out of oldFullData - // Note: templater supplies trace type - fullTrace = templater.newTrace(trace); - fullTrace.uid = fullLayout._traceUids[i]; - plots.supplyTraceDefaults(trace, fullTrace, colorCnt, fullLayout, i); + // options when 'active: -1' + blankHeaderOpts: { label: ' ' }, - fullTrace.index = i; - fullTrace._input = trace; - fullTrace._expandedIndex = cnt; + // min item width / height + minWidth: 30, + minHeight: 30, - if(fullTrace.transforms && fullTrace.transforms.length) { - var sdInvisible = trace.visible !== false && fullTrace.visible === false; + // padding around item text + textPadX: 24, + arrowPadX: 16, - var expandedTraces = applyTransforms(fullTrace, dataOut, layout, fullLayout); + // item rect radii + rx: 2, + ry: 2, - for(var j = 0; j < expandedTraces.length; j++) { - var expandedTrace = expandedTraces[j]; + // item text x offset off left edge + textOffsetX: 12, - // No further templating during transforms. - 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 - }; + // item text y offset (w.r.t. middle) + textOffsetY: 3, - // If the first supplyDefaults created `visible: false`, - // clear it before running supplyDefaults a second time, - // because sometimes there are items we still want to coerce - // inside trace modules before determining that the trace is - // again `visible: false`, for example partial visibilities - // in `splom` traces. - if(sdInvisible && expandedTrace.visible === false) { - delete expandedTrace.visible; - } + // arrow offset off right edge + arrowOffsetX: 4, - plots.supplyTraceDefaults(expandedTrace, fullExpandedTrace, cnt, fullLayout, i); + // gap between header and buttons + gapButtonHeader: 5, - // relink private (i.e. underscore) keys expanded trace to full expanded trace so - // that transform supply-default methods can set _ keys for future use. - relinkPrivateKeys(fullExpandedTrace, expandedTrace); + // gap between between buttons + gapButton: 2, - // add info about parent data trace - fullExpandedTrace.index = i; - fullExpandedTrace._input = trace; - fullExpandedTrace._fullInput = fullTrace; + // color given to active buttons + activeColor: '#F4FAFF', - // add info about the expanded data - fullExpandedTrace._expandedIndex = cnt; - fullExpandedTrace._expandedInput = expandedTrace; + // color given to hovered buttons + hoverColor: '#F4FAFF', - pushModule(fullExpandedTrace); - } - } - else { - // add identify refs for consistency with transformed traces - fullTrace._fullInput = fullTrace; - fullTrace._expandedInput = fullTrace; + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } +}; - pushModule(fullTrace); - } +},{}],134:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(Registry.traceIs(fullTrace, 'carpetAxis')) { - carpetIndex[fullTrace.carpet] = fullTrace; - } +'use strict'; - if(Registry.traceIs(fullTrace, 'carpetDependent')) { - carpetDependents.push(i); - } - } +var Lib = _dereq_('../../lib'); +var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - for(i = 0; i < carpetDependents.length; i++) { - fullTrace = dataOut[carpetDependents[i]]; +var attributes = _dereq_('./attributes'); +var constants = _dereq_('./constants'); - if(!fullTrace.visible) continue; +var name = constants.name; +var buttonAttrs = attributes.buttons; - var carpetAxis = carpetIndex[fullTrace.carpet]; - fullTrace._carpet = carpetAxis; - if(!carpetAxis || !carpetAxis.visible) { - fullTrace.visible = false; - continue; - } +module.exports = function updateMenusDefaults(layoutIn, layoutOut) { + var opts = { + name: name, + handleItemDefaults: menuDefaults + }; - fullTrace.xaxis = carpetAxis.xaxis; - fullTrace.yaxis = carpetAxis.yaxis; - } + handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -plots.supplyAnimationDefaults = function(opts) { - opts = opts || {}; - var i; - var optsOut = {}; +function menuDefaults(menuIn, menuOut, layoutOut) { function coerce(attr, dflt) { - return Lib.coerce(opts || {}, optsOut, animationAttrs, attr, dflt); + return Lib.coerce(menuIn, menuOut, attributes, 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 || {}); - } + var buttons = handleArrayContainerDefaults(menuIn, menuOut, { + name: 'buttons', + handleItemDefaults: buttonDefaults + }); - 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 || {}); - } + var visible = coerce('visible', buttons.length > 0); + if(!visible) return; - return optsOut; -}; + coerce('active'); + coerce('direction'); + coerce('type'); + coerce('showactive'); -plots.supplyAnimationFrameDefaults = function(opts) { - var optsOut = {}; + coerce('x'); + coerce('y'); + Lib.noneOrAll(menuIn, menuOut, ['x', 'y']); - function coerce(attr, dflt) { - return Lib.coerce(opts || {}, optsOut, animationAttrs.frame, attr, dflt); - } + coerce('xanchor'); + coerce('yanchor'); - coerce('duration'); - coerce('redraw'); + coerce('pad.t'); + coerce('pad.r'); + coerce('pad.b'); + coerce('pad.l'); - return optsOut; -}; + Lib.coerceFont(coerce, 'font', layoutOut.font); -plots.supplyAnimationTransitionDefaults = function(opts) { - var optsOut = {}; + coerce('bgcolor', layoutOut.paper_bgcolor); + coerce('bordercolor'); + coerce('borderwidth'); +} +function buttonDefaults(buttonIn, buttonOut) { function coerce(attr, dflt) { - return Lib.coerce(opts || {}, optsOut, animationAttrs.transition, attr, dflt); + return Lib.coerce(buttonIn, buttonOut, buttonAttrs, attr, dflt); } - coerce('duration'); - coerce('easing'); + var visible = coerce('visible', + (buttonIn.method === 'skip' || Array.isArray(buttonIn.args))); + if(visible) { + coerce('method'); + coerce('args'); + coerce('label'); + coerce('execute'); + } +} - return optsOut; -}; +},{"../../lib":159,"../../plots/array_container_defaults":199,"./attributes":132,"./constants":133}],135:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -plots.supplyFrameDefaults = function(frameIn) { - var frameOut = {}; - function coerce(attr, dflt) { - return Lib.coerce(frameIn, frameOut, frameAttrs, attr, dflt); - } +'use strict'; - coerce('group'); - coerce('name'); - coerce('traces'); - coerce('baseframe'); - coerce('data'); - coerce('layout'); +var d3 = _dereq_('d3'); - return frameOut; -}; +var Plots = _dereq_('../../plots/plots'); +var Color = _dereq_('../color'); +var Drawing = _dereq_('../drawing'); +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; -plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, traceInIndex) { - var colorway = layout.colorway || Color.defaults; - var defaultColor = colorway[colorIndex % colorway.length]; +var LINE_SPACING = _dereq_('../../constants/alignment').LINE_SPACING; - var i; +var constants = _dereq_('./constants'); +var ScrollBox = _dereq_('./scrollbox'); - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt); +module.exports = function draw(gd) { + var fullLayout = gd._fullLayout; + var menuData = Lib.filterVisible(fullLayout[constants.name]); + + /* Update menu data is bound to the header-group. + * The items in the header group are always present. + * + * Upon clicking on a header its corresponding button + * data is bound to the button-group. + * + * We draw all headers in one group before all buttons + * so that the buttons *always* appear above the headers. + * + * Note that only one set of buttons are visible at once. + * + * + * + * + * + * + * + * + * + * ... + * + * + * + * + * ... + */ + + function clearAutoMargin(menuOpts) { + Plots.autoMargin(gd, autoMarginId(menuOpts)); } - var visible = coerce('visible'); + // draw update menu container + var menus = fullLayout._menulayer + .selectAll('g.' + constants.containerClassName) + .data(menuData.length > 0 ? [0] : []); - coerce('type'); - coerce('name', layout._traceWord + ' ' + traceInIndex); + menus.enter().append('g') + .classed(constants.containerClassName, true) + .style('cursor', 'pointer'); - // we want even invisible traces to make their would-be subplots visible - // so coerce the subplot id(s) now no matter what - var _module = plots.getModule(traceOut); + menus.exit().each(function() { + // Most components don't need to explicitly remove autoMargin, because + // marginPushers does this - but updatemenu updates don't go through + // a full replot so we need to explicitly remove it. + // This is for removing *all* updatemenus, removing individuals is + // handled below, in headerGroups.exit + d3.select(this).selectAll('g.' + constants.headerGroupClassName) + .each(clearAutoMargin); + }).remove(); - 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 = ''; + // return early if no update menus are visible + if(menuData.length === 0) return; - // TODO - currently if we draw an empty gl2d subplot, it draws - // nothing then gets stuck and you can't get it back without newPlot - // sort this out in the regl refactor? but for now just drop empty gl2d subplots - if(basePlotModule.name !== 'gl2d' || visible) { - if(Array.isArray(subplotAttr)) { - for(i = 0; i < subplotAttr.length; i++) { - var attri = subplotAttr[i]; - var vali = Lib.coerce(traceIn, traceOut, subplotAttrs, attri); + // join header group + var headerGroups = menus.selectAll('g.' + constants.headerGroupClassName) + .data(menuData, keyFunction); - if(subplots[attri]) Lib.pushUnique(subplots[attri], vali); - subplotId += vali; - } - } - else { - subplotId = Lib.coerce(traceIn, traceOut, subplotAttrs, subplotAttr); - } + headerGroups.enter().append('g') + .classed(constants.headerGroupClassName, true); - if(subplots[basePlotModule.name]) { - Lib.pushUnique(subplots[basePlotModule.name], subplotId); - } - } - } + // draw dropdown button container + var gButton = Lib.ensureSingle(menus, 'g', constants.dropdownButtonGroupClassName, function(s) { + s.style('pointer-events', 'all'); + }); + + // find dimensions before plotting anything (this mutates menuOpts) + for(var i = 0; i < menuData.length; i++) { + var menuOpts = menuData[i]; + findDimensions(gd, menuOpts); } - function coerceUnlessPruned(attr, dflt, cb) { - if(_module && (attr in _module.attributes) && _module.attributes[attr] === undefined) { - // Pruned - } else { - if(cb && typeof cb === 'function') { - cb(); - } else { - coerce(attr, dflt); - } - } + // setup scrollbox + var scrollBoxId = 'updatemenus' + fullLayout._uid; + var scrollBox = new ScrollBox(gd, gButton, scrollBoxId); + + // remove exiting header, remove dropped buttons and reset margins + if(headerGroups.enter().size()) { + // make sure gButton is on top of all headers + gButton.node().parentNode.appendChild(gButton.node()); + gButton.call(removeAllButtons); } - if(visible) { - coerce('customdata'); - coerce('ids'); + headerGroups.exit().each(function(menuOpts) { + gButton.call(removeAllButtons); + clearAutoMargin(menuOpts); + }).remove(); - if(Registry.traceIs(traceOut, 'showLegend')) { - traceOut._dfltShowLegend = true; - coerce('showlegend'); - coerce('legendgroup'); - } - else { - traceOut._dfltShowLegend = false; - } + // draw headers! + headerGroups.each(function(menuOpts) { + var gHeader = d3.select(this); - coerceUnlessPruned('hoverlabel', '', function() { - Registry.getComponentMethod( - 'fx', - 'supplyDefaults' - )(traceIn, traceOut, defaultColor, layout); + var _gButton = menuOpts.type === 'dropdown' ? gButton : null; + Plots.manageCommandObserver(gd, menuOpts, menuOpts.buttons, function(data) { + setActive(gd, menuOpts, menuOpts.buttons[data.index], gHeader, _gButton, scrollBox, data.index, true); }); - // TODO add per-base-plot-module trace defaults step + if(menuOpts.type === 'dropdown') { + drawHeader(gd, gHeader, gButton, scrollBox, menuOpts); - if(_module) { - _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); - Lib.coerceHoverinfo(traceIn, traceOut, layout); + // if this menu is active, update the dropdown container + if(isActive(gButton, menuOpts)) { + drawButtons(gd, gHeader, gButton, scrollBox, menuOpts); + } + } else { + drawButtons(gd, gHeader, null, null, menuOpts); } - if(!Registry.traceIs(traceOut, 'noOpacity')) coerce('opacity'); + }); +}; - if(Registry.traceIs(traceOut, 'notLegendIsolatable')) { - // This clears out the legendonly state for traces like carpet that - // cannot be isolated in the legend - traceOut.visible = !!traceOut.visible; - } +// Note that '_index' is set at the default step, +// it corresponds to the menu index in the user layout update menu container. +// Because a menu can be set invisible, +// this is a more 'consistent' field than the index in the menuData. +function keyFunction(menuOpts) { + return menuOpts._index; +} - if(_module && _module.selectPoints) { - coerce('selectedpoints'); - } +function isFolded(gButton) { + return +gButton.attr(constants.menuIndexAttrName) === -1; +} - plots.supplyTransformDefaults(traceIn, traceOut, layout); +function isActive(gButton, menuOpts) { + return +gButton.attr(constants.menuIndexAttrName) === menuOpts._index; +} + +function setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex, isSilentUpdate) { + // update 'active' attribute in menuOpts + menuOpts.active = buttonIndex; + + // due to templating, it's possible this slider doesn't even exist yet + arrayEditor(gd.layout, constants.name, menuOpts) + .applyUpdate('active', buttonIndex); + + if(menuOpts.type === 'buttons') { + drawButtons(gd, gHeader, null, null, menuOpts); } + else if(menuOpts.type === 'dropdown') { + // fold up buttons and redraw header + gButton.attr(constants.menuIndexAttrName, '-1'); - return traceOut; -}; + drawHeader(gd, gHeader, gButton, scrollBox, menuOpts); -/** - * hasMakesDataTransform: does this trace have a transform that makes its own - * data, either by grabbing it from somewhere else or by creating it from input - * parameters? If so, we should still keep going with supplyDefaults - * even if the trace is invisible, which may just be because it has no data yet. - */ -function hasMakesDataTransform(trace) { - var transforms = trace.transforms; - if(Array.isArray(transforms) && transforms.length) { - for(var i = 0; i < transforms.length; i++) { - var ti = transforms[i]; - var _module = ti._module || transformsRegistry[ti.type]; - if(_module && _module.makesData) return true; + if(!isSilentUpdate) { + drawButtons(gd, gHeader, gButton, scrollBox, menuOpts); } } - return false; } -plots.hasMakesDataTransform = hasMakesDataTransform; +function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { + var header = Lib.ensureSingle(gHeader, 'g', constants.headerClassName, function(s) { + s.style('pointer-events', 'all'); + }); -plots.supplyTransformDefaults = function(traceIn, traceOut, layout) { - // For now we only allow transforms on 1D traces, ie those that specify a _length. - // If we were to implement 2D transforms, we'd need to have each transform - // describe its own applicability and disable itself when it doesn't apply. - // Also allow transforms that make their own data, but not in globalTransforms - if(!(traceOut._length || hasMakesDataTransform(traceIn))) return; + 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 + }; - var globalTransforms = layout._globalTransforms || []; - var transformModules = layout._transformModules || []; + header + .call(drawItem, menuOpts, headerOpts, gd) + .call(setItemPosition, menuOpts, posOpts, positionOverrides); - if(!Array.isArray(traceIn.transforms) && globalTransforms.length === 0) return; + // draw drop arrow at the right edge + var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { + s.classed('user-select-none', true) + .attr('text-anchor', 'end') + .call(Drawing.font, menuOpts.font) + .text(constants.arrowSymbol[menuOpts.direction]); + }); - var containerIn = traceIn.transforms || [], - transformList = globalTransforms.concat(containerIn), - containerOut = traceOut.transforms = []; + arrow.attr({ + x: dims.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, + y: dims.headerHeight / 2 + constants.textOffsetY + menuOpts.pad.t + }); - for(var i = 0; i < transformList.length; i++) { - var transformIn = transformList[i], - type = transformIn.type, - _module = transformsRegistry[type], - transformOut; + header.on('click', function() { + gButton.call(removeAllButtons, + String(isActive(gButton, menuOpts) ? -1 : menuOpts._index) + ); - /* - * Supply defaults may run twice. First pass runs all supply defaults steps - * and adds the _module to any output transforms. - * If transforms exist another pass is run so that any generated traces also - * go through supply defaults. This has the effect of rerunning - * supplyTransformDefaults. If the transform does not have a `transform` - * function it could not have generated any new traces and the second stage - * is unnecessary. We detect this case with the following variables. - */ - var isFirstStage = !(transformIn._module && transformIn._module === _module), - doLaterStages = _module && typeof _module.transform === 'function'; + drawButtons(gd, gHeader, gButton, scrollBox, menuOpts); + }); - if(!_module) Lib.warn('Unrecognized transform type ' + type + '.'); + header.on('mouseover', function() { + header.call(styleOnMouseOver); + }); - if(_module && _module.supplyDefaults && (isFirstStage || doLaterStages)) { - transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); - transformOut.type = type; - transformOut._module = _module; + header.on('mouseout', function() { + header.call(styleOnMouseOut, menuOpts); + }); - Lib.pushUnique(transformModules, _module); - } - else { - transformOut = Lib.extendFlat({}, transformIn); - } + // translate header group + Drawing.setTranslate(gHeader, dims.lx, dims.ly); +} - containerOut.push(transformOut); +function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { + // If this is a set of buttons, set pointer events = all since we play + // some minor games with which container is which in order to simplify + // the drawing of *either* buttons or menus + if(!gButton) { + gButton = gHeader; + gButton.attr('pointer-events', 'all'); } -}; - -function applyTransforms(fullTrace, fullData, layout, fullLayout) { - var container = fullTrace.transforms, - dataOut = [fullTrace]; - for(var i = 0; i < container.length; i++) { - var transform = container[i], - _module = transformsRegistry[transform.type]; + var buttonData = (!isFolded(gButton) || menuOpts.type === 'buttons') ? + menuOpts.buttons : + []; - if(_module && _module.transform) { - dataOut = _module.transform(dataOut, { - transform: transform, - fullTrace: fullTrace, - fullData: fullData, - layout: layout, - fullLayout: fullLayout, - transformIndex: i - }); - } - } + var klass = menuOpts.type === 'dropdown' ? constants.dropdownButtonClassName : constants.buttonClassName; - return dataOut; -} + var buttons = gButton.selectAll('g.' + klass) + .data(Lib.filterVisible(buttonData)); -plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, plots.layoutAttributes, attr, dflt); - } + var enter = buttons.enter().append('g') + .classed(klass, true); - var template = layoutIn.template; - if(Lib.isPlainObject(template)) { - layoutOut.template = template; - layoutOut._template = template.layout; - layoutOut._dataTemplate = template.data; - } + var exit = buttons.exit(); - var globalFont = Lib.coerceFont(coerce, 'font'); + if(menuOpts.type === 'dropdown') { + enter.attr('opacity', '0') + .transition() + .attr('opacity', '1'); - coerce('title', layoutOut._dfltTitle.plot); + exit.transition() + .attr('opacity', '0') + .remove(); + } else { + exit.remove(); + } - Lib.coerceFont(coerce, 'titlefont', { - family: globalFont.family, - size: Math.round(globalFont.size * 1.4), - color: globalFont.color - }); + var x0 = 0; + var y0 = 0; + var dims = menuOpts._dims; - // Make sure that autosize is defaulted to *true* - // on layouts with no set width and height for backward compatibly, - // in particular https://plot.ly/javascript/responsive-fluid-layout/ - // - // Before https://github.com/plotly/plotly.js/pull/635 , - // layouts with no set width and height were set temporary set to 'initial' - // to pass through the autosize routine - // - // This behavior is subject to change in v2. - coerce('autosize', !(layoutIn.width && layoutIn.height)); + var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; - coerce('width'); - coerce('height'); - coerce('margin.l'); - coerce('margin.r'); - coerce('margin.t'); - coerce('margin.b'); - coerce('margin.pad'); - coerce('margin.autoexpand'); + if(menuOpts.type === 'dropdown') { + if(isVertical) { + y0 = dims.headerHeight + constants.gapButtonHeader; + } else { + x0 = dims.headerWidth + constants.gapButtonHeader; + } + } - if(layoutIn.width && layoutIn.height) plots.sanitizeMargins(layoutOut); + if(menuOpts.type === 'dropdown' && menuOpts.direction === 'up') { + y0 = -constants.gapButtonHeader + constants.gapButton - dims.openHeight; + } - Registry.getComponentMethod('grid', 'sizeDefaults')(layoutIn, layoutOut); + if(menuOpts.type === 'dropdown' && menuOpts.direction === 'left') { + x0 = -constants.gapButtonHeader + constants.gapButton - dims.openWidth; + } - coerce('paper_bgcolor'); + var posOpts = { + x: dims.lx + x0 + menuOpts.pad.l, + y: dims.ly + y0 + menuOpts.pad.t, + yPad: constants.gapButton, + xPad: constants.gapButton, + index: 0, + }; - coerce('separators', formatObj.decimal + formatObj.thousands); - coerce('hidesources'); + var scrollBoxPosition = { + l: posOpts.x + menuOpts.borderwidth, + t: posOpts.y + menuOpts.borderwidth + }; - coerce('colorway'); + buttons.each(function(buttonOpts, buttonIndex) { + var button = d3.select(this); - coerce('datarevision'); + button + .call(drawItem, menuOpts, buttonOpts, gd) + .call(setItemPosition, menuOpts, posOpts); - coerce('modebar.orientation'); - coerce('modebar.bgcolor', Color.addOpacity(layoutOut.paper_bgcolor, 0.5)); - var modebarDefaultColor = Color.contrast(Color.rgb(layoutOut.modebar.bgcolor)); - coerce('modebar.color', Color.addOpacity(modebarDefaultColor, 0.3)); - coerce('modebar.activecolor', Color.addOpacity(modebarDefaultColor, 0.7)); + button.on('click', function() { + // skip `dragend` events + if(d3.event.defaultPrevented) return; - Registry.getComponentMethod( - 'calendars', - 'handleDefaults' - )(layoutIn, layoutOut, 'calendar'); + setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Registry.getComponentMethod( - 'fx', - 'supplyLayoutGlobalDefaults' - )(layoutIn, layoutOut, coerce); -}; + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } -plots.plotAutoSize = function plotAutoSize(gd, layout, fullLayout) { - var context = gd._context || {}, - frameMargins = context.frameMargins, - newWidth, - newHeight; + gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); + }); - var isPlotDiv = Lib.isPlotDiv(gd); + button.on('mouseover', function() { + button.call(styleOnMouseOver); + }); - if(isPlotDiv) gd.emit('plotly_autosize'); + button.on('mouseout', function() { + button.call(styleOnMouseOut, menuOpts); + buttons.call(styleButtons, menuOpts); + }); + }); - // embedded in an iframe - just take the full iframe size - // if we get to this point, with no aspect ratio restrictions - if(context.fillFrame) { - newWidth = window.innerWidth; - newHeight = window.innerHeight; + buttons.call(styleButtons, menuOpts); - // somehow we get a few extra px height sometimes... - // just hide it - document.body.style.overflow = 'hidden'; + if(isVertical) { + scrollBoxPosition.w = Math.max(dims.openWidth, dims.headerWidth); + scrollBoxPosition.h = posOpts.y - scrollBoxPosition.t; } else { - // plotly.js - let the developers do what they want, either - // provide height and width for the container div, - // specify size in layout, or take the defaults, - // but don't enforce any ratio restrictions - var computedStyle = isPlotDiv ? window.getComputedStyle(gd) : {}; + scrollBoxPosition.w = posOpts.x - scrollBoxPosition.l; + scrollBoxPosition.h = Math.max(dims.openHeight, dims.headerHeight); + } - newWidth = parseFloat(computedStyle.width) || parseFloat(computedStyle.maxWidth) || fullLayout.width; - newHeight = parseFloat(computedStyle.height) || parseFloat(computedStyle.maxHeight) || fullLayout.height; + scrollBoxPosition.direction = menuOpts.direction; - if(isNumeric(frameMargins) && frameMargins > 0) { - var factor = 1 - 2 * frameMargins; - newWidth = Math.round(factor * newWidth); - newHeight = Math.round(factor * newHeight); + if(scrollBox) { + if(buttons.size()) { + drawScrollBox(gd, gHeader, gButton, scrollBox, menuOpts, scrollBoxPosition); + } + else { + hideScrollBox(scrollBox); } } +} - var minWidth = plots.layoutAttributes.width.min, - 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), - heightHasChanged = !layout.height && - (Math.abs(fullLayout.height - newHeight) > 1); +function drawScrollBox(gd, gHeader, gButton, scrollBox, menuOpts, position) { + // enable the scrollbox + var direction = menuOpts.direction; + var isVertical = (direction === 'up' || direction === 'down'); + var dims = menuOpts._dims; - if(heightHasChanged || widthHasChanged) { - if(widthHasChanged) fullLayout.width = newWidth; - if(heightHasChanged) fullLayout.height = newHeight; + 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; + } } - - // cache initial autosize value, used in relayout when - // width or height values are set to null - if(!gd._initialAutoSize) { - gd._initialAutoSize = { width: newWidth, height: newHeight }; + else { + translateX = 0; + for(i = 0; i < active; i++) { + translateX += dims.widths[i] + constants.gapButton; + } } - plots.sanitizeMargins(fullLayout); -}; + scrollBox.enable(position, translateX, translateY); -plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { - var componentsRegistry = Registry.componentsRegistry; - var basePlotModules = layoutOut._basePlotModules; - var component, i, _module; + if(scrollBox.hbar) { + scrollBox.hbar + .attr('opacity', '0') + .transition() + .attr('opacity', '1'); + } - var Cartesian = Registry.subplotsRegistry.cartesian; + if(scrollBox.vbar) { + scrollBox.vbar + .attr('opacity', '0') + .transition() + .attr('opacity', '1'); + } +} - // check if any components need to add more base plot modules - // that weren't captured by traces - for(component in componentsRegistry) { - _module = componentsRegistry[component]; +function hideScrollBox(scrollBox) { + var hasHBar = !!scrollBox.hbar; + var hasVBar = !!scrollBox.vbar; - if(_module.includeBasePlot) { - _module.includeBasePlot(layoutIn, layoutOut); - } + if(hasHBar) { + scrollBox.hbar + .transition() + .attr('opacity', '0') + .each('end', function() { + hasHBar = false; + if(!hasVBar) scrollBox.disable(); + }); } - // make sure we *at least* have some cartesian axes - if(!basePlotModules.length) { - basePlotModules.push(Cartesian); + if(hasVBar) { + scrollBox.vbar + .transition() + .attr('opacity', '0') + .each('end', function() { + hasVBar = false; + if(!hasHBar) scrollBox.disable(); + }); } +} - // ensure all cartesian axes have at least one subplot - if(layoutOut._has('cartesian')) { - Registry.getComponentMethod('grid', 'contentDefaults')(layoutIn, layoutOut); - Cartesian.finalizeSubplots(layoutIn, layoutOut); - } +function drawItem(item, menuOpts, itemOpts, gd) { + item.call(drawItemRect, menuOpts) + .call(drawItemText, menuOpts, itemOpts, gd); +} - // sort subplot lists - for(var subplotType in layoutOut._subplots) { - layoutOut._subplots[subplotType].sort(Lib.subplotSort); - } +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' + }); + }); - // base plot module layout defaults - for(i = 0; i < basePlotModules.length; i++) { - _module = basePlotModules[i]; + rect.call(Color.stroke, menuOpts.bordercolor) + .call(Color.fill, menuOpts.bgcolor) + .style('stroke-width', menuOpts.borderwidth + 'px'); +} - // e.g. pie does not have a layout-defaults step - if(_module.supplyLayoutDefaults) { - _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); - } - } +function drawItemText(item, menuOpts, itemOpts, gd) { + var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { + s.classed('user-select-none', true) + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); + }); - // trace module layout defaults - // use _modules rather than _visibleModules so that even - // legendonly traces can include settings - eg barmode, which affects - // legend.traceorder default value. - var modules = layoutOut._modules; - for(i = 0; i < modules.length; i++) { - _module = modules[i]; + text.call(Drawing.font, menuOpts.font) + .text(itemOpts.label) + .call(svgTextUtils.convertToTspans, gd); +} - if(_module.supplyLayoutDefaults) { - _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); - } - } +function styleButtons(buttons, menuOpts) { + var active = menuOpts.active; - // transform module layout defaults - var transformModules = layoutOut._transformModules; - for(i = 0; i < transformModules.length; i++) { - _module = transformModules[i]; + buttons.each(function(buttonOpts, i) { + var button = d3.select(this); - if(_module.supplyLayoutDefaults) { - _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); + if(i === active && menuOpts.showactive) { + button.select('rect.' + constants.itemRectClassName) + .call(Color.fill, constants.activeColor); } - } + }); +} - for(component in componentsRegistry) { - _module = componentsRegistry[component]; +function styleOnMouseOver(item) { + item.select('rect.' + constants.itemRectClassName) + .call(Color.fill, constants.hoverColor); +} - if(_module.supplyLayoutDefaults) { - _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); - } - } -}; +function styleOnMouseOut(item, menuOpts) { + item.select('rect.' + constants.itemRectClassName) + .call(Color.fill, menuOpts.bgcolor); +} -// Remove all plotly attributes from a div so it can be replotted fresh -// TODO: these really need to be encapsulated into a much smaller set... -plots.purge = function(gd) { - // note: we DO NOT remove _context because it doesn't change when we insert - // a new plot, and may have been set outside of our scope. +// find item dimensions (this mutates menuOpts) +function findDimensions(gd, menuOpts) { + var dims = menuOpts._dims = { + width1: 0, + height1: 0, + heights: [], + widths: [], + totalWidth: 0, + totalHeight: 0, + openWidth: 0, + openHeight: 0, + lx: 0, + ly: 0 + }; - var fullLayout = gd._fullLayout || {}; - if(fullLayout._glcontainer !== undefined) { - fullLayout._glcontainer.selectAll('.gl-canvas').remove(); - fullLayout._glcontainer.remove(); - fullLayout._glcanvas = null; - } - if(fullLayout._geocontainer !== undefined) fullLayout._geocontainer.remove(); + var fakeButtons = Drawing.tester.selectAll('g.' + constants.dropdownButtonClassName) + .data(Lib.filterVisible(menuOpts.buttons)); - // remove modebar - if(fullLayout._modeBar) fullLayout._modeBar.destroy(); + fakeButtons.enter().append('g') + .classed(constants.dropdownButtonClassName, true); - if(gd._transitionData) { - // Ensure any dangling callbacks are simply dropped if the plot is purged. - // This is more or less only actually important for testing. - if(gd._transitionData._interruptCallbacks) { - gd._transitionData._interruptCallbacks.length = 0; - } + var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; - if(gd._transitionData._animationRaf) { - window.cancelAnimationFrame(gd._transitionData._animationRaf); - } - } + // loop over fake buttons to find width / height + fakeButtons.each(function(buttonOpts, i) { + var button = d3.select(this); - // remove any planned throttles - Lib.clearThrottle(); + button.call(drawItem, menuOpts, buttonOpts, gd); - // remove responsive handler - Lib.clearResponsive(gd); + var text = button.select('.' + constants.itemTextClassName); - // data and layout - delete gd.data; - delete gd.layout; - delete gd._fullData; - delete gd._fullLayout; - delete gd.calcdata; - delete gd.framework; - delete gd.empty; + // width is given by max width of all buttons + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); - delete gd.fid; + // height is determined by item text + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; - delete gd.undoqueue; // action queue - delete gd.undonum; - delete gd.autoplay; // are we doing an action that doesn't go in undo queue? - delete gd.changed; + hEff = Math.ceil(hEff); + wEff = Math.ceil(wEff); - // these get recreated on Plotly.plot anyway, but just to be safe - // (and to have a record of them...) - delete gd._promises; - delete gd._redrawTimer; - delete gd._hmlumcount; - delete gd._hmpixcount; - delete gd._transitionData; - delete gd._transitioning; - delete gd._initialAutoSize; - delete gd._transitioningWithDuration; + // Store per-item sizes since a row of horizontal buttons, for example, + // don't all need to be the same width: + dims.widths[i] = wEff; + dims.heights[i] = hEff; - // created during certain events, that *should* clean them up - // themselves, but may not if there was an error - delete gd._dragging; - delete gd._dragged; - delete gd._hoverdata; - delete gd._snapshotInProgress; - delete gd._editing; - delete gd._replotPending; - delete gd._mouseDownTime; - delete gd._legendMouseDownTime; + // Height and width of individual element: + 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; + } + }); - // remove all event listeners - if(gd.removeAllListeners) gd.removeAllListeners(); -}; + if(isVertical) { + dims.totalHeight -= constants.gapButton; + } else { + dims.totalWidth -= constants.gapButton; + } -plots.style = function(gd) { - var _modules = gd._fullLayout._visibleModules; - var styleModules = []; - var i; - // some trace modules reuse the same style method, - // make sure to not unnecessary call them multiple times. + dims.headerWidth = dims.width1 + constants.arrowPadX; + dims.headerHeight = dims.height1; - for(i = 0; i < _modules.length; i++) { - var _module = _modules[i]; - if(_module.style) { - Lib.pushUnique(styleModules, _module.style); + if(menuOpts.type === 'dropdown') { + if(isVertical) { + dims.width1 += constants.arrowPadX; + dims.totalHeight = dims.height1; + } else { + dims.totalWidth = dims.width1; } + dims.totalWidth += constants.arrowPadX; } - for(i = 0; i < styleModules.length; i++) { - styleModules[i](gd); - } -}; - -plots.sanitizeMargins = function(fullLayout) { - // polar doesn't do margins... - if(!fullLayout || !fullLayout.margin) return; + fakeButtons.remove(); - var width = fullLayout.width, - height = fullLayout.height, - margin = fullLayout.margin, - plotWidth = width - (margin.l + margin.r), - plotHeight = height - (margin.t + margin.b), - correction; + var paddedWidth = dims.totalWidth + menuOpts.pad.l + menuOpts.pad.r; + var paddedHeight = dims.totalHeight + menuOpts.pad.t + menuOpts.pad.b; - // if margin.l + margin.r = 0 then plotWidth > 0 - // as width >= 10 by supplyDefaults - // similarly for margin.t + margin.b + var graphSize = gd._fullLayout._size; + dims.lx = graphSize.l + graphSize.w * menuOpts.x; + dims.ly = graphSize.t + graphSize.h * (1 - menuOpts.y); - if(plotWidth < 0) { - correction = (width - 1) / (margin.l + margin.r); - margin.l = Math.floor(correction * margin.l); - margin.r = Math.floor(correction * margin.r); + var xanchor = 'left'; + if(Lib.isRightAnchor(menuOpts)) { + dims.lx -= paddedWidth; + xanchor = 'right'; } - - if(plotHeight < 0) { - correction = (height - 1) / (margin.t + margin.b); - margin.t = Math.floor(correction * margin.t); - margin.b = Math.floor(correction * margin.b); + if(Lib.isCenterAnchor(menuOpts)) { + dims.lx -= paddedWidth / 2; + xanchor = 'center'; } -}; -plots.clearAutoMarginIds = function(gd) { - gd._fullLayout._pushmarginIds = {}; -}; + var yanchor = 'top'; + if(Lib.isBottomAnchor(menuOpts)) { + dims.ly -= paddedHeight; + yanchor = 'bottom'; + } + if(Lib.isMiddleAnchor(menuOpts)) { + dims.ly -= paddedHeight / 2; + yanchor = 'middle'; + } -plots.allowAutoMargin = function(gd, id) { - gd._fullLayout._pushmarginIds[id] = 1; -}; + dims.totalWidth = Math.ceil(dims.totalWidth); + dims.totalHeight = Math.ceil(dims.totalHeight); + dims.lx = Math.round(dims.lx); + dims.ly = Math.round(dims.ly); -function setupAutoMargin(fullLayout) { - if(!fullLayout._pushmargin) fullLayout._pushmargin = {}; - if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; + Plots.autoMargin(gd, 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) + }); } -/** - * autoMargin: called by components that may need to expand the margins to - * be rendered on-plot. - * - * @param {DOM element} gd - * @param {string} id - an identifier unique (within this plot) to this object, - * so we can remove a previous margin expansion from the same object. - * @param {object} o - the margin requirements of this object, or omit to delete - * this entry (like if it's hidden). Keys are: - * x, y: plot fraction of the anchor point. - * xl, xr, yt, yb: if the object has an extent defined in plot fraction, - * you can specify both edges as plot fractions in each dimension - * l, r, t, b: the pixels to pad past the plot fraction x[l|r] and y[t|b] - * pad: extra pixels to add in all directions, default 12 (why?) - */ -plots.autoMargin = function(gd, id, o) { - var fullLayout = gd._fullLayout; +function autoMarginId(menuOpts) { + return constants.autoMarginIdRoot + menuOpts._index; +} - setupAutoMargin(fullLayout); +// set item positions (mutates posOpts) +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; - var pushMargin = fullLayout._pushmargin; - var pushMarginIds = fullLayout._pushmarginIds; + Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); - if(fullLayout.margin.autoexpand !== false) { - if(!o) { - delete pushMargin[id]; - delete pushMarginIds[id]; - } - else { - var pad = o.pad; - if(pad === undefined) { - var margin = fullLayout.margin; - // if no explicit pad is given, use 12px unless there's a - // specified margin that's smaller than that - pad = Math.min(12, margin.l, margin.r, margin.t, margin.b); - } + var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? dims.heights[index] : dims.height1); - // if the item is too big, just give it enough automargin to - // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) o.l = o.r = 0; - if(o.b + o.t > fullLayout.height * 0.5) o.b = o.t = 0; + rect.attr({ + x: 0, + y: 0, + width: overrideOpts.width || (isVertical ? dims.width1 : dims.widths[index]), + height: finalHeight + }); - var xl = o.xl !== undefined ? o.xl : o.x; - var xr = o.xr !== undefined ? o.xr : o.x; - var yt = o.yt !== undefined ? o.yt : o.y; - var yb = o.yb !== undefined ? o.yb : o.y; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - pushMargin[id] = { - l: {val: xl, size: o.l + pad}, - r: {val: xr, size: o.r + pad}, - b: {val: yb, size: o.b + pad}, - t: {val: yt, size: o.t + pad} - }; - pushMarginIds[id] = 1; - } + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); - if(!fullLayout._replotting) plots.doAutoMargin(gd); + if(isVertical) { + posOpts.y += dims.heights[index] + posOpts.yPad; + } else { + posOpts.x += dims.widths[index] + posOpts.xPad; } -}; - -plots.doAutoMargin = function(gd) { - var fullLayout = gd._fullLayout; - if(!fullLayout._size) fullLayout._size = {}; - setupAutoMargin(fullLayout); - var gs = fullLayout._size, - oldmargins = JSON.stringify(gs); + posOpts.index++; +} - // adjust margins for outside components - // fullLayout.margin is the requested margin, - // fullLayout._size has margins and plotsize after adjustment - var ml = Math.max(fullLayout.margin.l || 0, 0); - var mr = Math.max(fullLayout.margin.r || 0, 0); - var mt = Math.max(fullLayout.margin.t || 0, 0); - var mb = Math.max(fullLayout.margin.b || 0, 0); - var pushMargin = fullLayout._pushmargin; - var pushMarginIds = fullLayout._pushmarginIds; +function removeAllButtons(gButton, newMenuIndexAttr) { + gButton + .attr(constants.menuIndexAttrName, newMenuIndexAttr || '-1') + .selectAll('g.' + constants.dropdownButtonClassName).remove(); +} - if(fullLayout.margin.autoexpand !== false) { +},{"../../constants/alignment":138,"../../lib":159,"../../lib/svg_text_utils":180,"../../plot_api/plot_template":193,"../../plots/plots":236,"../color":43,"../drawing":64,"./constants":133,"./scrollbox":137,"d3":8}],136:[function(_dereq_,module,exports){ +arguments[4][130][0].apply(exports,arguments) +},{"./attributes":132,"./constants":133,"./defaults":134,"./draw":135,"dup":130}],137:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(var k in pushMargin) { - if(!pushMarginIds[k]) delete pushMargin[k]; - } +'use strict'; - // fill in the requested margins - pushMargin.base = { - l: {val: 0, size: ml}, - r: {val: 1, size: mr}, - t: {val: 1, size: mt}, - b: {val: 0, size: mb} - }; +module.exports = ScrollBox; - // now cycle through all the combinations of l and r - // (and t and b) to find the required margins +var d3 = _dereq_('d3'); - for(var k1 in pushMargin) { +var Color = _dereq_('../color'); +var Drawing = _dereq_('../drawing'); - var pushleft = pushMargin[k1].l || {}, - pushbottom = pushMargin[k1].b || {}, - fl = pushleft.val, - pl = pushleft.size, - fb = pushbottom.val, - pb = pushbottom.size; +var Lib = _dereq_('../../lib'); - for(var k2 in pushMargin) { - if(isNumeric(pl) && pushMargin[k2].r) { - var fr = pushMargin[k2].r.val, - pr = pushMargin[k2].r.size; +/** + * Helper class to setup a scroll box + * + * @class + * @param gd Plotly's graph div + * @param container Container to be scroll-boxed (as a D3 selection) + * @param {string} id Id for the clip path to implement the scroll box + */ +function ScrollBox(gd, container, id) { + this.gd = gd; + this.container = container; + this.id = id; - if(fr > fl) { - var newl = (pl * fr + - (pr - fullLayout.width) * fl) / (fr - fl), - newr = (pr * (1 - fl) + - (pl - fullLayout.width) * (1 - fr)) / (fr - fl); - if(newl >= 0 && newr >= 0 && newl + newr > ml + mr) { - ml = newl; - mr = newr; - } - } - } + // See ScrollBox.prototype.enable for further definition + this.position = null; // scrollbox position + this.translateX = null; // scrollbox horizontal translation + this.translateY = null; // scrollbox vertical translation + this.hbar = null; // horizontal scrollbar D3 selection + this.vbar = null; // vertical scrollbar D3 selection - if(isNumeric(pb) && pushMargin[k2].t) { - var ft = pushMargin[k2].t.val, - pt = pushMargin[k2].t.size; + // element to capture pointer events + this.bg = this.container.selectAll('rect.scrollbox-bg').data([0]); - if(ft > fb) { - var newb = (pb * ft + - (pt - fullLayout.height) * fb) / (ft - fb), - newt = (pt * (1 - fb) + - (pb - fullLayout.height) * (1 - ft)) / (ft - fb); - if(newb >= 0 && newt >= 0 && newb + newt > mb + mt) { - mb = newb; - mt = newt; - } - } - } - } - } - } + this.bg.exit() + .on('.drag', null) + .on('wheel', null) + .remove(); - gs.l = Math.round(ml); - gs.r = Math.round(mr); - gs.t = Math.round(mt); - gs.b = Math.round(mb); - gs.p = Math.round(fullLayout.margin.pad); - gs.w = Math.round(fullLayout.width) - gs.l - gs.r; - gs.h = Math.round(fullLayout.height) - gs.t - gs.b; + this.bg.enter().append('rect') + .classed('scrollbox-bg', true) + .style('pointer-events', 'all') + .attr({ + opacity: 0, + x: 0, + y: 0, + width: 0, + height: 0 + }); +} - // if things changed and we're not already redrawing, trigger a redraw - if(!fullLayout._replotting && - oldmargins !== '{}' && - oldmargins !== JSON.stringify(fullLayout._size) - ) { - if('_redrawFromAutoMarginCount' in fullLayout) { - fullLayout._redrawFromAutoMarginCount++; - } else { - fullLayout._redrawFromAutoMarginCount = 1; - } - return Registry.call('plot', gd); - } -}; +// scroll bar dimensions +ScrollBox.barWidth = 2; +ScrollBox.barLength = 20; +ScrollBox.barRadius = 2; +ScrollBox.barPad = 1; +ScrollBox.barColor = '#808BA4'; /** - * JSONify the graph data and layout - * - * This function needs to recurse because some src can be inside - * sub-objects. - * - * It also strips out functions and private (starts with _) elements. - * Therefore, we can add temporary things to data and layout that don't - * get saved. + * If needed, setup a clip path and scrollbars * - * @param gd The graphDiv - * @param {Boolean} dataonly If true, don't return layout. - * @param {'keepref'|'keepdata'|'keepall'} [mode='keepref'] Filter what's kept - * keepref: remove data for which there's a src present - * eg if there's xsrc present (and xsrc is well-formed, - * ie has : and some chars before it), strip out x - * keepdata: remove all src tags, don't remove the data itself - * keepall: keep data and src - * @param {String} output If you specify 'object', the result will not be stringified - * @param {Boolean} useDefaults If truthy, use _fullLayout and _fullData - * @returns {Object|String} + * @method + * @param {Object} position + * @param {number} position.l Left side position (in pixels) + * @param {number} position.t Top side (in pixels) + * @param {number} position.w Width (in pixels) + * @param {number} position.h Height (in pixels) + * @param {string} [position.direction='down'] + * Either 'down', 'left', 'right' or 'up' + * @param {number} [translateX=0] Horizontal offset (in pixels) + * @param {number} [translateY=0] Vertical offset (in pixels) */ -plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { - // if the defaults aren't supplied yet, we need to do that... - if((useDefaults && dataonly && !gd._fullData) || - (useDefaults && !dataonly && !gd._fullLayout)) { - plots.supplyDefaults(gd); - } +ScrollBox.prototype.enable = function enable(position, translateX, translateY) { + var fullLayout = this.gd._fullLayout; + var fullWidth = fullLayout.width; + var fullHeight = fullLayout.height; - var data = (useDefaults) ? gd._fullData : gd.data, - layout = (useDefaults) ? gd._fullLayout : gd.layout, - frames = (gd._transitionData || {})._frames; + // compute position of scrollbox + this.position = position; - function stripObj(d) { - if(typeof d === 'function') { - return null; - } - if(Lib.isPlainObject(d)) { - var o = {}, v, src; - for(v in d) { - // remove private elements and functions - // _ is for private, [ is a mistake ie [object Object] - if(typeof d[v] === 'function' || - ['_', '['].indexOf(v.charAt(0)) !== -1) { - continue; - } + 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; - // look for src/data matches and remove the appropriate one - if(mode === 'keepdata') { - // keepdata: remove all ...src tags - if(v.substr(v.length - 3) === 'src') { - continue; - } - } - else if(mode === 'keepstream') { - // keep sourced data if it's being streamed. - // similar to keepref, but if the 'stream' object exists - // in a trace, we will keep the data array. - src = d[v + 'src']; - if(typeof src === 'string' && src.indexOf(':') > 0) { - if(!Lib.isPlainObject(d.stream)) { - continue; - } - } - } - else if(mode !== 'keepall') { - // keepref: remove sourced data but only - // if the source tag is well-formed - src = d[v + 'src']; - if(typeof src === 'string' && src.indexOf(':') > 0) { - continue; - } - } + if(!isDown && !isLeft && !isRight && !isUp) { + this.position.direction = 'down'; + isDown = true; + } - // OK, we're including this... recurse into it - o[v] = stripObj(d[v]); - } - return o; - } + var isVertical = isDown || isUp; + if(isVertical) { + boxL = l; + boxR = boxL + boxW; - if(Array.isArray(d)) { - return d.map(stripObj); + if(isDown) { + // anchor to top side + boxT = t; + boxB = Math.min(boxT + boxH, fullHeight); + boxH = boxB - boxT; } - - if(Lib.isTypedArray(d)) { - return Lib.simpleMap(d, Lib.identity); + else { + // anchor to bottom side + boxB = t + boxH; + boxT = Math.max(boxB - boxH, 0); + boxH = boxB - boxT; } - - // convert native dates to date strings... - // mostly for external users exporting to plotly - if(Lib.isJSDate(d)) return Lib.ms2DateTimeLocal(+d); - - return d; } + else { + boxT = t; + boxB = boxT + boxH; - var obj = { - data: (data || []).map(function(v) { - var d = stripObj(v); - // fit has some little arrays in it that don't contain data, - // just fit params and meta - if(dataonly) { delete d.fit; } - return d; - }) - }; - if(!dataonly) { obj.layout = stripObj(layout); } - - if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); - - if(frames) obj.frames = stripObj(frames); - - return (output === 'object') ? obj : JSON.stringify(obj); -}; - -/** - * Modify a keyframe using a list of operations: - * - * @param {array of objects} operations - * Sequence of operations to be performed on the keyframes - */ -plots.modifyFrames = function(gd, operations) { - var i, op, frame; - var _frames = gd._transitionData._frames; - var _frameHash = gd._transitionData._frameHash; - - for(i = 0; i < operations.length; i++) { - op = operations[i]; - - switch(op.type) { - // No reason this couldn't exist, but is currently unused/untested: - /* case 'rename': - frame = _frames[op.index]; - delete _frameHash[frame.name]; - _frameHash[op.name] = frame; - frame.name = op.name; - break;*/ - case 'replace': - frame = op.value; - var oldName = (_frames[op.index] || {}).name; - var newName = frame.name; - _frames[op.index] = _frameHash[newName] = frame; - - if(newName !== oldName) { - // If name has changed in addition to replacement, then update - // the lookup table: - delete _frameHash[oldName]; - _frameHash[newName] = frame; - } - - break; - case 'insert': - frame = op.value; - _frameHash[frame.name] = frame; - _frames.splice(op.index, 0, frame); - break; - case 'delete': - frame = _frames[op.index]; - delete _frameHash[frame.name]; - _frames.splice(op.index, 1); - break; + if(isLeft) { + // anchor to right side + boxR = l + boxW; + boxL = Math.max(boxR - boxW, 0); + boxW = boxR - boxL; + } + else { + // anchor to left side + boxL = l; + boxR = Math.min(boxL + boxW, fullWidth); + boxW = boxR - boxL; } } - return Promise.resolve(); -}; + this._box = { + l: boxL, + t: boxT, + w: boxW, + h: boxH + }; -/* - * Compute a keyframe. Merge a keyframe into its base frame(s) and - * expand properties. - * - * @param {object} frameLookup - * An object containing frames keyed by name (i.e. gd._transitionData._frameHash) - * @param {string} frame - * The name of the keyframe to be computed - * - * Returns: a new object with the merged content - */ -plots.computeFrame = function(gd, frameName) { - var frameLookup = gd._transitionData._frameHash; - var i, traceIndices, traceIndex, destIndex; + // compute position of horizontal scroll bar + var needsHorizontalScrollBar = (w > boxW); + var hbarW = ScrollBox.barLength + 2 * ScrollBox.barPad; + var hbarH = ScrollBox.barWidth + 2 * ScrollBox.barPad; + // draw horizontal scrollbar on the bottom side + var hbarL = l; + var hbarT = t + h; - // Null or undefined will fail on .toString(). We'll allow numbers since we - // make it clear frames must be given string names, but we'll allow numbers - // here since they're otherwise fine for looking up frames as long as they're - // properly cast to strings. We really just want to ensure here that this - // 1) doesn't fail, and - // 2) doens't give an incorrect answer (which String(frameName) would) - if(!frameName) { - throw new Error('computeFrame must be given a string frame name'); - } + if(hbarT + hbarH > fullHeight) hbarT = fullHeight - hbarH; - var framePtr = frameLookup[frameName.toString()]; + var hbar = this.container.selectAll('rect.scrollbar-horizontal').data( + (needsHorizontalScrollBar) ? [0] : []); - // Return false if the name is invalid: - if(!framePtr) { - return false; - } + hbar.exit() + .on('.drag', null) + .remove(); - var frameStack = [framePtr]; - var frameNameStack = [framePtr.name]; + hbar.enter().append('rect') + .classed('scrollbar-horizontal', true) + .call(Color.fill, ScrollBox.barColor); - // Follow frame pointers: - while(framePtr.baseframe && (framePtr = frameLookup[framePtr.baseframe.toString()])) { - // Avoid infinite loops: - if(frameNameStack.indexOf(framePtr.name) !== -1) break; + if(needsHorizontalScrollBar) { + this.hbar = hbar.attr({ + 'rx': ScrollBox.barRadius, + 'ry': ScrollBox.barRadius, + 'x': hbarL, + 'y': hbarT, + 'width': hbarW, + 'height': hbarH + }); - frameStack.push(framePtr); - frameNameStack.push(framePtr.name); + // hbar center moves between hbarXMin and hbarXMin + hbarTranslateMax + this._hbarXMin = hbarL + hbarW / 2; + this._hbarTranslateMax = boxW - hbarW; + } + else { + delete this.hbar; + delete this._hbarXMin; + delete this._hbarTranslateMax; } - // A new object for the merged result: - var result = {}; - - // Merge, starting with the last and ending with the desired frame: - while((framePtr = frameStack.pop())) { - if(framePtr.layout) { - result.layout = plots.extendLayout(result.layout, framePtr.layout); - } + // compute position of vertical scroll bar + var needsVerticalScrollBar = (h > boxH); + var vbarW = ScrollBox.barWidth + 2 * ScrollBox.barPad; + var vbarH = ScrollBox.barLength + 2 * ScrollBox.barPad; + // draw vertical scrollbar on the right side + var vbarL = l + w; + var vbarT = t; - if(framePtr.data) { - if(!result.data) { - result.data = []; - } - traceIndices = framePtr.traces; + if(vbarL + vbarW > fullWidth) vbarL = fullWidth - vbarW; - if(!traceIndices) { - // If not defined, assume serial order starting at zero - traceIndices = []; - for(i = 0; i < framePtr.data.length; i++) { - traceIndices[i] = i; - } - } + var vbar = this.container.selectAll('rect.scrollbar-vertical').data( + (needsVerticalScrollBar) ? [0] : []); - if(!result.traces) { - result.traces = []; - } + vbar.exit() + .on('.drag', null) + .remove(); - for(i = 0; i < framePtr.data.length; i++) { - // Loop through this frames data, find out where it should go, - // and merge it! - traceIndex = traceIndices[i]; - if(traceIndex === undefined || traceIndex === null) { - continue; - } + vbar.enter().append('rect') + .classed('scrollbar-vertical', true) + .call(Color.fill, ScrollBox.barColor); - destIndex = result.traces.indexOf(traceIndex); - if(destIndex === -1) { - destIndex = result.data.length; - result.traces[destIndex] = traceIndex; - } + if(needsVerticalScrollBar) { + this.vbar = vbar.attr({ + 'rx': ScrollBox.barRadius, + 'ry': ScrollBox.barRadius, + 'x': vbarL, + 'y': vbarT, + 'width': vbarW, + 'height': vbarH + }); - result.data[destIndex] = plots.extendTrace(result.data[destIndex], framePtr.data[i]); - } - } + // vbar center moves between vbarYMin and vbarYMin + vbarTranslateMax + this._vbarYMin = vbarT + vbarH / 2; + this._vbarTranslateMax = boxH - vbarH; } - - return result; -}; - -/* - * Recompute the lookup table that maps frame name -> frame object. addFrames/ - * deleteFrames already manages this data one at a time, so the only time this - * is necessary is if you poke around manually in `gd._transitionData._frames` - * and create and haven't updated the lookup table. - */ -plots.recomputeFrameHash = function(gd) { - var hash = gd._transitionData._frameHash = {}; - var frames = gd._transitionData._frames; - for(var i = 0; i < frames.length; i++) { - var frame = frames[i]; - if(frame && frame.name) { - hash[frame.name] = frame; - } + else { + delete this.vbar; + delete this._vbarYMin; + delete this._vbarTranslateMax; } -}; -/** - * Extend an object, treating container arrays very differently by extracting - * their contents and merging them separately. - * - * This exists so that we can extendDeepNoArrays and avoid stepping into data - * arrays without knowledge of the plot schema, but so that we may also manually - * recurse into known container arrays, such as transforms. - * - * See extendTrace and extendLayout below for usage. - */ -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 = {}; + // setup a clip path (if scroll bars are needed) + 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; - // Step through and extract any container properties. Otherwise extendDeepNoArrays - // will clobber any existing properties with an empty array and then supplyDefaults - // will reset everything to defaults. - if(containerPaths && containerPaths.length) { - for(i = 0; i < containerPaths.length; i++) { - containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); - containerVal = containerProp.get(); + var clipPath = fullLayout._topdefs.selectAll('#' + clipId) + .data((needsHorizontalScrollBar || needsVerticalScrollBar) ? [0] : []); - if(containerVal === undefined) { - Lib.nestedProperty(containerObj, containerPaths[i]).set(null); - } - else { - containerProp.set(null); - Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); - } - } - } + clipPath.exit().remove(); - dest = Lib.extendDeepNoArrays(dest || {}, expandedObj); + clipPath.enter() + .append('clipPath').attr('id', clipId) + .append('rect'); - if(containerPaths && containerPaths.length) { - for(i = 0; i < containerPaths.length; i++) { - srcProp = Lib.nestedProperty(containerObj, containerPaths[i]); - srcContainer = srcProp.get(); + 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) + }); - if(!srcContainer) continue; + this.container.call(Drawing.setClipUrl, clipId, this.gd); - destProp = Lib.nestedProperty(dest, containerPaths[i]); - destContainer = destProp.get(); + 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(!Array.isArray(destContainer)) { - destContainer = []; - destProp.set(destContainer); - } + // set up drag listeners (if scroll bars are needed) + if(needsHorizontalScrollBar || needsVerticalScrollBar) { + var onBoxDrag = d3.behavior.drag() + .on('dragstart', function() { + d3.event.sourceEvent.preventDefault(); + }) + .on('drag', this._onBoxDrag.bind(this)); - for(j = 0; j < srcContainer.length; j++) { - var srcObj = srcContainer[j]; + this.container + .on('wheel', null) + .on('wheel', this._onBoxWheel.bind(this)) + .on('.drag', null) + .call(onBoxDrag); - if(srcObj === null) destContainer[j] = null; - else { - destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); - } - } + var onBarDrag = d3.behavior.drag() + .on('dragstart', function() { + d3.event.sourceEvent.preventDefault(); + d3.event.sourceEvent.stopPropagation(); + }) + .on('drag', this._onBarDrag.bind(this)); - destProp.set(destContainer); + if(needsHorizontalScrollBar) { + this.hbar + .on('.drag', null) + .call(onBarDrag); + } + + if(needsVerticalScrollBar) { + this.vbar + .on('.drag', null) + .call(onBarDrag); } } - return dest; + // set scrollbox translation + this.setTranslate(translateX, translateY); }; -plots.dataArrayContainers = ['transforms', 'dimensions']; -plots.layoutArrayContainers = Registry.layoutArrayContainers; - -/* - * Extend a trace definition. This method: - * - * 1. directly transfers any array references - * 2. manually recurses into container arrays like transforms +/** + * If present, remove clip-path and scrollbars * - * The result is the original object reference with the new contents merged in. + * @method */ -plots.extendTrace = function(destTrace, srcTrace) { - return plots.extendObjectWithContainers(destTrace, srcTrace, plots.dataArrayContainers); -}; +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; + } -/* - * Extend a layout definition. This method: - * - * 1. directly transfers any array references (not critically important for - * layout since there aren't really data arrays) - * 2. manually recurses into container arrays like annotations - * - * The result is the original object reference with the new contents merged in. - */ -plots.extendLayout = function(destLayout, srcLayout) { - return plots.extendObjectWithContainers(destLayout, srcLayout, plots.layoutArrayContainers); + 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; + } }; /** - * Transition to a set of new data and layout properties + * Handles scroll box drag events * - * @param {DOM element} gd - * the DOM element of the graph container div - * @param {Object[]} data - * an array of data objects following the normal Plotly data definition format - * @param {Object} layout - * a layout object, following normal Plotly layout format - * @param {Number[]} traces - * indices of the corresponding traces specified in `data` - * @param {Object} frameOpts - * options for the frame (i.e. whether to redraw post-transition) - * @param {Object} transitionOpts - * options for the transition + * @method */ -plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) { - var i, traceIdx; +ScrollBox.prototype._onBoxDrag = function onBarDrag() { + var translateX = this.translateX; + var translateY = this.translateY; - var dataLength = Array.isArray(data) ? data.length : 0; - var traceIndices = traces.slice(0, dataLength); + if(this.hbar) { + translateX -= d3.event.dx; + } - var transitionedTraces = []; + if(this.vbar) { + translateY -= d3.event.dy; + } - function prepareTransitions() { - var i; + this.setTranslate(translateX, translateY); +}; - for(i = 0; i < traceIndices.length; i++) { - var traceIdx = traceIndices[i]; - var trace = gd._fullData[traceIdx]; - var module = trace._module; +/** + * Handles scroll box wheel events + * + * @method + */ +ScrollBox.prototype._onBoxWheel = function onBarWheel() { + var translateX = this.translateX; + var translateY = this.translateY; - // There's nothing to do if this module is not defined: - if(!module) continue; + if(this.hbar) { + translateX += d3.event.deltaY; + } - // Don't register the trace as transitioned if it doesn't know what to do. - // If it *is* registered, it will receive a callback that it's responsible - // for calling in order to register the transition as having completed. - if(module.animatable) { - transitionedTraces.push(traceIdx); - } + if(this.vbar) { + translateY += d3.event.deltaY; + } - gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); - } + this.setTranslate(translateX, translateY); +}; - // Follow the same procedure. Clone it so we don't mangle the input, then - // expand any object paths so we can merge deep into gd.layout: - var layoutUpdate = Lib.expandObjectPaths(Lib.extendDeepNoArrays({}, layout)); +/** + * Handles scroll bar drag events + * + * @method + */ +ScrollBox.prototype._onBarDrag = function onBarDrag() { + var translateX = this.translateX; + var translateY = this.translateY; - // Before merging though, we need to modify the incoming layout. We only - // know how to *transition* layout ranges, so it's imperative that a new - // range not be sent to the layout before the transition has started. So - // we must remove the things we can transition: - var axisAttrRe = /^[xy]axis[0-9]*$/; - for(var attr in layoutUpdate) { - if(!axisAttrRe.test(attr)) continue; - delete layoutUpdate[attr].range; - } + if(this.hbar) { + var xMin = translateX + this._hbarXMin; + var xMax = xMin + this._hbarTranslateMax; + var x = Lib.constrain(d3.event.x, xMin, xMax); + var xf = (x - xMin) / (xMax - xMin); - plots.extendLayout(gd.layout, layoutUpdate); + var translateXMax = this.position.w - this._box.w; - // Supply defaults after applying the incoming properties. Note that any attempt - // to simplify this step and reduce the amount of work resulted in the reconstruction - // of essentially the whole supplyDefaults step, so that it seems sensible to just use - // supplyDefaults even though it's heavier than would otherwise be desired for - // transitions: + translateX = xf * translateXMax; + } - // first delete calcdata so supplyDefaults knows a calc step is coming - delete gd.calcdata; + if(this.vbar) { + var yMin = translateY + this._vbarYMin; + var yMax = yMin + this._vbarTranslateMax; + var y = Lib.constrain(d3.event.y, yMin, yMax); + var yf = (y - yMin) / (yMax - yMin); - plots.supplyDefaults(gd); - plots.doCalcdata(gd); + var translateYMax = this.position.h - this._box.h; - return Promise.resolve(); + translateY = yf * translateYMax; } - function executeCallbacks(list) { - var p = Promise.resolve(); - if(!list) return p; - while(list.length) { - p = p.then((list.shift())); - } - return p; - } + this.setTranslate(translateX, translateY); +}; - function flushCallbacks(list) { - if(!list) return; - while(list.length) { - list.shift(); - } - } +/** + * Set clip path and scroll bar translate transform + * + * @method + * @param {number} [translateX=0] Horizontal offset (in pixels) + * @param {number} [translateY=0] Vertical offset (in pixels) + */ +ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) { + // store translateX and translateY (needed by mouse event handlers) + var translateXMax = this.position.w - this._box.w; + var translateYMax = this.position.h - this._box.h; - var aborted = false; + translateX = Lib.constrain(translateX || 0, 0, translateXMax); + translateY = Lib.constrain(translateY || 0, 0, translateYMax); - function executeTransitions() { - gd.emit('plotly_transitioning', []); + this.translateX = translateX; + this.translateY = translateY; - return new Promise(function(resolve) { - // This flag is used to disabled things like autorange: - gd._transitioning = true; + this.container.call(Drawing.setTranslate, + this._box.l - this.position.l - translateX, + this._box.t - this.position.t - translateY); - // When instantaneous updates are coming through quickly, it's too much to simply disable - // all interaction, so store this flag so we can disambiguate whether mouse interactions - // should be fully disabled or not: - if(transitionOpts.duration > 0) { - gd._transitioningWithDuration = true; - } + 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 xf = translateX / translateXMax; - // If another transition is triggered, this callback will be executed simply because it's - // in the interruptCallbacks queue. If this transition completes, it will instead flush - // that queue and forget about this callback. - gd._transitionData._interruptCallbacks.push(function() { - aborted = true; - }); + this.hbar.call(Drawing.setTranslate, + translateX + xf * this._hbarTranslateMax, + translateY); + } - if(frameOpts.redraw) { - gd._transitionData._interruptCallbacks.push(function() { - return Registry.call('redraw', gd); - }); - } + if(this.vbar) { + var yf = translateY / translateYMax; - // Emit this and make sure it happens last: - gd._transitionData._interruptCallbacks.push(function() { - gd.emit('plotly_transitioninterrupted', []); - }); + this.vbar.call(Drawing.setTranslate, + translateX, + translateY + yf * this._vbarTranslateMax); + } +}; - // Construct callbacks that are executed on transition end. This ensures the d3 transitions - // are *complete* before anything else is done. - var numCallbacks = 0; - var numCompleted = 0; - function makeCallback() { - numCallbacks++; - return function() { - numCompleted++; - // When all are complete, perform a redraw: - if(!aborted && numCompleted === numCallbacks) { - completeTransition(resolve); - } - }; - } +},{"../../lib":159,"../color":43,"../drawing":64,"d3":8}],138:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var traceTransitionOpts; - var j; - var basePlotModules = gd._fullLayout._basePlotModules; - var hasAxisTransition = false; - - if(layout) { - for(j = 0; j < basePlotModules.length; j++) { - if(basePlotModules[j].transitionAxes) { - var newLayout = Lib.expandObjectPaths(layout); - hasAxisTransition = basePlotModules[j].transitionAxes(gd, newLayout, transitionOpts, makeCallback) || hasAxisTransition; - } - } - } +'use strict'; - // Here handle the exception that we refuse to animate scales and axes at the same - // time. In other words, if there's an axis transition, then set the data transition - // to instantaneous. - if(hasAxisTransition) { - traceTransitionOpts = Lib.extendFlat({}, transitionOpts); - traceTransitionOpts.duration = 0; - // This means do not transition traces, - // this happens on layout-only (e.g. axis range) animations - transitionedTraces = null; - } else { - traceTransitionOpts = transitionOpts; - } +// fraction of some size to get to a named position +module.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, - for(j = 0; j < basePlotModules.length; j++) { - // Note that we pass a callback to *create* the callback that must be invoked on completion. - // This is since not all traces know about transitions, so it greatly simplifies matters if - // the trace is responsible for creating a callback, if needed, and then executing it when - // the time is right. - basePlotModules[j].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback); - } + // 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.70, - // If nothing else creates a callback, then this will trigger the completion in the next tick: - setTimeout(makeCallback()); + // 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' } +}; - function completeTransition(callback) { - // This a simple workaround for tests which purge the graph before animations - // have completed. That's not a very common case, so this is the simplest - // fix. - if(!gd._transitionData) return; +},{}],139:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - flushCallbacks(gd._transitionData._interruptCallbacks); +'use strict'; - return Promise.resolve().then(function() { - if(frameOpts.redraw) { - return Registry.call('redraw', gd); - } - }).then(function() { - // Set transitioning false again once the redraw has occurred. This is used, for example, - // to prevent the trailing redraw from autoranging: - gd._transitioning = false; - gd._transitioningWithDuration = false; - gd.emit('plotly_transitioned', []); - }).then(callback); - } +module.exports = { + /** + * Timing information for interactive elements + */ + SHOW_PLACEHOLDER: 100, + HIDE_PLACEHOLDER: 1000, - function interruptPreviousTransitions() { - // Fail-safe against purged plot: - if(!gd._transitionData) return; + // ms between first mousedown and 2nd mouseup to constitute dblclick... + // we don't seem to have access to the system setting + DBLCLICKDELAY: 300, - // If a transition is interrupted, set this to false. At the moment, the only thing that would - // interrupt a transition is another transition, so that it will momentarily be set to true - // again, but this determines whether autorange or dragbox work, so it's for the sake of - // cleanliness: - gd._transitioning = false; + // opacity dimming fraction for points that are not in selection + DESELECTDIM: 0.2 +}; - return executeCallbacks(gd._transitionData._interruptCallbacks); - } +},{}],140:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(i = 0; i < traceIndices.length; i++) { - traceIdx = traceIndices[i]; - var contFull = gd._fullData[traceIdx]; - var module = contFull._module; +'use strict'; - if(!module) continue; - } - var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, plots.rehover, executeTransitions]; +module.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: undefined, - var transitionStarting = Lib.syncOrAsync(seq, gd); + /* + * 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 / 10000, - if(!transitionStarting || !transitionStarting.then) { - transitionStarting = Promise.resolve(); - } + /* + * 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 + */ + ONEAVGYEAR: 31557600000, // 365.25 days + ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR + ONEDAY: 86400000, + ONEHOUR: 3600000, + ONEMIN: 60000, + ONESEC: 1000, - return transitionStarting.then(function() { - return gd; - }); -}; + /* + * 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: 2440587.5, -plots.doCalcdata = function(gd, traces) { - var axList = axisIDs.list(gd), - fullData = gd._fullData, - fullLayout = gd._fullLayout; + /* + * Are two values nearly equal? Compare to 1PPM + */ + ALMOST_EQUAL: 1 - 1e-6, - var trace, _module, i, j; + /* + * If we're asked to clip a non-positive log value, how far off-screen + * do we put it? + */ + LOG_CLIP: 10, - // XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without - // *all* needing doCalcdata: - var calcdata = new Array(fullData.length); - var oldCalcdata = (gd.calcdata || []).slice(0); - gd.calcdata = calcdata; + /* + * not a number, but for displaying numbers: the "minus sign" symbol is + * wider than the regular ascii dash "-" + */ + MINUS_SIGN: '\u2212' +}; - // extra helper variables +},{}],141:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // how many box/violins plots do we have (in case they're grouped) - fullLayout._numBoxes = 0; - fullLayout._numViolins = 0; - // initialize violin per-scale-group stats container - fullLayout._violinScaleGroupStats = {}; +'use strict'; - // for calculating avg luminosity of heatmaps - gd._hmpixcount = 0; - gd._hmlumcount = 0; - // for sharing colors across pies (and for legend) - fullLayout._piecolormap = {}; +exports.xmlns = 'http://www.w3.org/2000/xmlns/'; +exports.svg = 'http://www.w3.org/2000/svg'; +exports.xlink = 'http://www.w3.org/1999/xlink'; - // If traces were specified and this trace was not included, - // then transfer it over from the old calcdata: - for(i = 0; i < fullData.length; i++) { - if(Array.isArray(traces) && traces.indexOf(i) === -1) { - calcdata[i] = oldCalcdata[i]; - continue; - } - } +// the 'old' d3 quirk got fix in v3.5.7 +// https://github.com/mbostock/d3/commit/a6f66e9dd37f764403fc7c1f26be09ab4af24fed +exports.svgAttrs = { + xmlns: exports.svg, + 'xmlns:xlink': exports.xlink +}; - for(i = 0; i < fullData.length; i++) { - trace = fullData[i]; +},{}],142:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); +'use strict'; - // keep track of trace extremes (for autorange) in here - trace._extremes = {}; - } +// package version injected by `npm run preprocess` +exports.version = '1.44.4'; - // add polar axes to axis list - var polarIds = fullLayout._subplots.polar || []; - for(i = 0; i < polarIds.length; i++) { - axList.push( - fullLayout[polarIds[i]].radialaxis, - fullLayout[polarIds[i]].angularaxis - ); - } +// inject promise polyfill +_dereq_('es6-promise').polyfill(); - clearAxesCalc(axList); +// inject plot css +_dereq_('../build/plotcss'); - var hasCalcTransform = false; +// inject default MathJax config +_dereq_('./fonts/mathjax_config')(); - // transform loop - for(i = 0; i < fullData.length; i++) { - trace = fullData[i]; +// include registry module and expose register method +var Registry = _dereq_('./registry'); +var register = exports.register = Registry.register; - if(trace.visible === true && trace.transforms) { - _module = trace._module; +// expose plot api methods +var plotApi = _dereq_('./plot_api'); +var methodNames = Object.keys(plotApi); +for(var i = 0; i < methodNames.length; i++) { + var name = methodNames[i]; + // _ -> private API methods, but still registered for internal use + if(name.charAt(0) !== '_') exports[name] = plotApi[name]; + register({ + moduleType: 'apiMethod', + name: name, + fn: plotApi[name] + }); +} - // we need one round of trace module calc before - // the calc transform to 'fill in' the categories list - // used for example in the data-to-coordinate method - if(_module && _module.calc) { - var cdi = _module.calc(gd, trace); +// scatter is the only trace included by default +register(_dereq_('./traces/scatter')); - // must clear scene 'batches', so that 2nd - // _module.calc call starts from scratch - if(cdi[0] && cdi[0].t && cdi[0].t._scene) { - delete cdi[0].t._scene.dirty; - } - } +// register all registrable components modules +register([ + _dereq_('./components/fx'), + _dereq_('./components/legend'), + _dereq_('./components/annotations'), + _dereq_('./components/annotations3d'), + _dereq_('./components/shapes'), + _dereq_('./components/images'), + _dereq_('./components/updatemenus'), + _dereq_('./components/sliders'), + _dereq_('./components/rangeslider'), + _dereq_('./components/rangeselector'), + _dereq_('./components/grid'), + _dereq_('./components/errorbars'), + _dereq_('./components/colorscale') +]); - for(j = 0; j < trace.transforms.length; j++) { - var transform = trace.transforms[j]; +// locales en and en-US are required for default behavior +register([ + _dereq_('./locale-en'), + _dereq_('./locale-en-us') +]); - _module = transformsRegistry[transform.type]; - if(_module && _module.calcTransform) { - trace._hasCalcTransform = true; - hasCalcTransform = true; - _module.calcTransform(gd, trace, transform); - } - } - } - } +// plot icons +exports.Icons = _dereq_('../build/ploticon'); - // clear stuff that should recomputed in 'regular' loop - if(hasCalcTransform) clearAxesCalc(axList); +// unofficial 'beta' plot methods, use at your own risk +exports.Plots = _dereq_('./plots/plots'); +exports.Fx = _dereq_('./components/fx'); +exports.Snapshot = _dereq_('./snapshot'); +exports.PlotSchema = _dereq_('./plot_api/plot_schema'); +exports.Queue = _dereq_('./lib/queue'); - function calci(i, isContainer) { - trace = fullData[i]; - _module = trace._module; +// export d3 used in the bundle +exports.d3 = _dereq_('d3'); - if(!!_module.isContainer !== isContainer) return; +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":36,"./components/annotations3d":41,"./components/colorscale":55,"./components/errorbars":70,"./components/fx":82,"./components/grid":86,"./components/images":91,"./components/legend":99,"./components/rangeselector":110,"./components/rangeslider":117,"./components/shapes":125,"./components/sliders":130,"./components/updatemenus":136,"./fonts/mathjax_config":143,"./lib/queue":173,"./locale-en":184,"./locale-en-us":183,"./plot_api":188,"./plot_api/plot_schema":192,"./plots/plots":236,"./registry":243,"./snapshot":248,"./traces/scatter":293,"d3":8,"es6-promise":9}],143:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var cd = []; +'use strict'; - if(trace.visible === true) { +/* global MathJax:false */ - // clear existing ref in case it got relinked - delete trace._indexToPoints; - // keep ref of index-to-points map object of the *last* enabled transform, - // this index-to-points map object is required to determine the calcdata indices - // that correspond to input indices (e.g. from 'selectedpoints') - var transforms = trace.transforms || []; - for(j = transforms.length - 1; j >= 0; j--) { - if(transforms[j].enabled) { - trace._indexToPoints = transforms[j]._indexToPoints; - break; +module.exports = function() { + if(typeof MathJax !== 'undefined') { + var globalConfig = (window.PlotlyConfig || {}).MathJaxConfig !== 'local'; + + if(globalConfig) { + MathJax.Hub.Config({ + messageStyle: 'none', + skipStartupTypeset: true, + displayAlign: 'left', + tex2jax: { + inlineMath: [['$', '$'], ['\\(', '\\)']] } - } - - if(_module && _module.calc) { - cd = _module.calc(gd, trace); - } - } - - // Make sure there is a first point. - // - // This ensures there is a calcdata item for every trace, - // even if cartesian logic doesn't handle it (for things like legends). - if(!Array.isArray(cd) || !cd[0]) { - cd = [{x: BADNUM, y: BADNUM}]; + }); + MathJax.Hub.Configured(); } - - // add the trace-wide properties to the first point, - // per point properties to every point - // t is the holder for trace-wide properties - if(!cd[0].t) cd[0].t = {}; - cd[0].trace = trace; - - calcdata[i] = cd; } - - // 'regular' loop - make sure container traces (eg carpet) calc before - // contained traces (eg contourcarpet) - for(i = 0; i < fullData.length; i++) calci(i, true); - for(i = 0; i < fullData.length; i++) calci(i, false); - - doCrossTraceCalc(gd); - - Registry.getComponentMethod('fx', 'calc')(gd); - Registry.getComponentMethod('errorbars', 'calc')(gd); }; -function clearAxesCalc(axList) { - for(var i = 0; i < axList.length; i++) { - axList[i].clearCalc(); - } -} - -function doCrossTraceCalc(gd) { - var fullLayout = gd._fullLayout; - var modules = fullLayout._visibleModules; - var hash = {}; - var i, j, k; +},{}],144:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // position and range calculations for traces that - // depend on each other ie bars (stacked or grouped) - // and boxes (grouped) push each other out of the way - 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]; - } - } - } +'use strict'; - 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 sp = subplots[i]; - var spInfo = k === 'cartesian' ? - fullLayout._plots[sp] : - fullLayout[sp]; +/** + * Determine the position anchor property of x/y xanchor/yanchor components. + * + * - values < 1/3 align the low side at that fraction, + * - values [1/3, 2/3] align the center at that fraction, + * - values > 2/3 align the right at that fraction. + */ - for(j = 0; j < methods.length; j++) { - methods[j](gd, spInfo, sp); - } - } - } - else { - for(j = 0; j < methods.length; j++) { - methods[j](gd); - } - } - } -} -plots.rehover = function(gd) { - if(gd._fullLayout._rehover) { - gd._fullLayout._rehover(); - } +exports.isLeftAnchor = function isLeftAnchor(opts) { + return ( + opts.xanchor === 'left' || + (opts.xanchor === 'auto' && opts.x <= 1 / 3) + ); }; -plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) { - var traceHashOld = subplot.traceHash; - var traceHash = {}; - var i; - - // build up moduleName -> calcData hash - for(i = 0; i < subplotCalcData.length; i++) { - var calcTraces = subplotCalcData[i], - trace = calcTraces[0].trace; - - // skip over visible === false traces - // as they don't have `_module` ref - if(trace.visible) { - traceHash[trace.type] = traceHash[trace.type] || []; - traceHash[trace.type].push(calcTraces); - } - } - - // when a trace gets deleted, make sure that its module's - // plot method is called so that it is properly - // removed from the DOM. - for(var moduleNameOld in traceHashOld) { - if(!traceHash[moduleNameOld]) { - var fakeCalcTrace = traceHashOld[moduleNameOld][0], - fakeTrace = fakeCalcTrace[0].trace; +exports.isCenterAnchor = function isCenterAnchor(opts) { + return ( + opts.xanchor === 'center' || + (opts.xanchor === 'auto' && opts.x > 1 / 3 && opts.x < 2 / 3) + ); +}; - fakeTrace.visible = false; - traceHash[moduleNameOld] = [fakeCalcTrace]; - } - } +exports.isRightAnchor = function isRightAnchor(opts) { + return ( + opts.xanchor === 'right' || + (opts.xanchor === 'auto' && opts.x >= 2 / 3) + ); +}; - // call module plot method - for(var moduleName in traceHash) { - var moduleCalcData = traceHash[moduleName]; - var _module = moduleCalcData[0][0].trace._module; +exports.isTopAnchor = function isTopAnchor(opts) { + return ( + opts.yanchor === 'top' || + (opts.yanchor === 'auto' && opts.y >= 2 / 3) + ); +}; - _module.plot(gd, subplot, Lib.filterVisible(moduleCalcData), subplotLayout); - } +exports.isMiddleAnchor = function isMiddleAnchor(opts) { + return ( + opts.yanchor === 'middle' || + (opts.yanchor === 'auto' && opts.y > 1 / 3 && opts.y < 2 / 3) + ); +}; - // update moduleName -> calcData hash - subplot.traceHash = traceHash; +exports.isBottomAnchor = function isBottomAnchor(opts) { + return ( + opts.yanchor === 'bottom' || + (opts.yanchor === 'auto' && opts.y <= 1 / 3) + ); }; -},{"../components/color":570,"../constants/numerical":673,"../lib":696,"../plot_api/plot_schema":733,"../plot_api/plot_template":734,"../plots/cartesian/axis_ids":747,"../registry":827,"./animation_attributes":739,"./attributes":741,"./command":769,"./font_attributes":771,"./frame_attributes":772,"./layout_attributes":799,"d3":148,"fast-isnumeric":214}],809:[function(_dereq_,module,exports){ +},{}],145:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129949,71 +33949,93 @@ 'use strict'; -module.exports = { - attr: 'subplot', - name: 'polar', +var modModule = _dereq_('./mod'); +var mod = modModule.mod; +var modHalf = modModule.modHalf; - axisNames: ['angularaxis', 'radialaxis'], - axisName2dataArray: {angularaxis: 'theta', radialaxis: 'r'}, +var PI = Math.PI; +var twoPI = 2 * PI; - layerNames: [ - 'draglayer', - 'plotbg', - 'backplot', - 'angular-grid', - 'radial-grid', - 'frontplot', - 'angular-line', - 'radial-line', - 'angular-axis', - 'radial-axis' - ], +function deg2rad(deg) { return deg / 180 * PI; } - radialDragBoxSize: 50, - angularDragBoxSize: 30, - cornerLen: 25, - cornerHalfWidth: 2, +function rad2deg(rad) { return rad / PI * 180; } - // pixels to move mouse before you stop clamping to starting point - MINDRAG: 8, - // smallest radial distance [px] allowed for a zoombox - MINZOOM: 20, - // distance [px] off (r=0) or (r=radius) where we transition - // from single-sided to two-sided radial zoom - OFFEDGE: 20 -}; +/** + * is sector a full circle? + * ... this comes up a lot in SVG path-drawing routines + * + * N.B. we consider all sectors that span more that 2pi 'full' circles + * + * @param {2-item array} aBnds : angular bounds in *radians* + * @return {boolean} + */ +function isFullCircle(aBnds) { + return Math.abs(aBnds[1] - aBnds[0]) > twoPI - 1e-15; +} -},{}],810:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * angular delta between angle 'a' and 'b' + * solution taken from: https://stackoverflow.com/a/2007279 + * + * @param {number} a : first angle in *radians* + * @param {number} b : second angle in *radians* + * @return {number} angular delta in *radians* + */ +function angleDelta(a, b) { + return modHalf(b - a, twoPI); +} + +/** + * angular distance between angle 'a' and 'b' + * + * @param {number} a : first angle in *radians* + * @param {number} b : second angle in *radians* + * @return {number} angular distance in *radians* + */ +function angleDist(a, b) { + return Math.abs(angleDelta(a, b)); +} + +/** + * is angle inside sector? + * + * @param {number} a : angle to test in *radians* + * @param {2-item array} aBnds : sector's angular bounds in *radians* + * @param {boolean} + */ +function isAngleInsideSector(a, aBnds) { + if(isFullCircle(aBnds)) return true; + + var s0, s1; + + if(aBnds[0] < aBnds[1]) { + s0 = aBnds[0]; + s1 = aBnds[1]; + } else { + s0 = aBnds[1]; + s1 = aBnds[0]; + } -'use strict'; + s0 = mod(s0, twoPI); + s1 = mod(s1, twoPI); + if(s0 > s1) s1 += twoPI; -var Lib = _dereq_('../../lib'); -var polygonTester = _dereq_('../../lib/polygon').tester; + var a0 = mod(a, twoPI); + var a1 = a0 + twoPI; -var findIndexOfMin = Lib.findIndexOfMin; -var isAngleInsideSector = Lib.isAngleInsideSector; -var angleDelta = Lib.angleDelta; -var angleDist = Lib.angleDist; + return (a0 >= s0 && a0 <= s1) || (a1 >= s0 && a1 <= s1); +} /** - * is pt (r,a) inside polygon made up vertices at angles 'vangles' - * inside a given polar sector + * is pt (r,a) inside sector? * * @param {number} r : pt's radial coordinate * @param {number} a : pt's angular coordinate in *radians* * @param {2-item array} rBnds : sector's radial bounds - * @param {2-item array} aBnds : sector's angular bounds *radians* - * @param {array} vangles : angles of polygon vertices in *radians* + * @param {2-item array} aBnds : sector's angular bounds in *radians* * @return {boolean} */ -function isPtInsidePolygon(r, a, rBnds, aBnds, vangles) { +function isPtInsideSector(r, a, rBnds, aBnds) { if(!isAngleInsideSector(a, aBnds)) return false; var r0, r1; @@ -130026,261 +34048,140 @@ r1 = rBnds[0]; } - var polygonIn = polygonTester(makePolygon(r0, aBnds[0], aBnds[1], vangles)); - var polygonOut = polygonTester(makePolygon(r1, aBnds[0], aBnds[1], vangles)); - var xy = [r * Math.cos(a), r * Math.sin(a)]; - return polygonOut.contains(xy) && !polygonIn.contains(xy); -} - -// find intersection of 'v0' <-> 'v1' edge with a ray at angle 'a' -// (i.e. a line that starts from the origin at angle 'a') -// given an (xp,yp) pair on the 'v0' <-> 'v1' line -// (N.B. 'v0' and 'v1' are angles in radians) -function findIntersectionXY(v0, v1, a, xpyp) { - var xstar, ystar; - - var xp = xpyp[0]; - var yp = xpyp[1]; - var dsin = clampTiny(Math.sin(v1) - Math.sin(v0)); - var dcos = clampTiny(Math.cos(v1) - Math.cos(v0)); - var tanA = Math.tan(a); - var cotanA = clampTiny(1 / tanA); - var m = dsin / dcos; - var b = yp - m * xp; - - if(cotanA) { - if(dsin && dcos) { - // given - // g(x) := v0 -> v1 line = m*x + b - // h(x) := ray at angle 'a' = m*x = tanA*x - // solve g(xstar) = h(xstar) - xstar = b / (tanA - m); - ystar = tanA * xstar; - } else if(dcos) { - // horizontal v0 -> v1 - xstar = yp * cotanA; - ystar = yp; - } else { - // vertical v0 -> v1 - xstar = xp; - ystar = xp * tanA; - } - } else { - // vertical ray - if(dsin && dcos) { - xstar = 0; - ystar = b; - } else if(dcos) { - xstar = 0; - ystar = yp; - } else { - // does this case exists? - xstar = ystar = NaN; - } - } - - return [xstar, ystar]; -} - -// solves l^2 = (f(x)^2 - yp)^2 + (x - xp)^2 -// rearranged into 0 = a*x^2 + b * x + c -// -// where f(x) = m*x + t + yp -// and (x0, x1) = (-b +/- del) / (2*a) -function findXYatLength(l, m, xp, yp) { - var t = -m * xp; - var a = m * m + 1; - var b = 2 * (m * t - xp); - var c = t * t + xp * xp - l * l; - var del = Math.sqrt(b * b - 4 * a * c); - var x0 = (-b + del) / (2 * a); - var x1 = (-b - del) / (2 * a); - return [ - [x0, m * x0 + t + yp], - [x1, m * x1 + t + yp] - ]; + return r >= r0 && r <= r1; } -function makeRegularPolygon(r, vangles) { - var len = vangles.length; - var vertices = new Array(len + 1); - var i; - for(i = 0; i < len; i++) { - var va = vangles[i]; - vertices[i] = [r * Math.cos(va), r * Math.sin(va)]; - } - vertices[i] = vertices[0].slice(); - return vertices; -} +// common to pathArc, pathSector and pathAnnulus +function _path(r0, r1, a0, a1, cx, cy, isClosed) { + cx = cx || 0; + cy = cy || 0; -function makeClippedPolygon(r, a0, a1, vangles) { - var len = vangles.length; - var vertices = []; - var i, j; + var isCircle = isFullCircle([a0, a1]); + var aStart, aMid, aEnd; + var rStart, rEnd; - function a2xy(a) { - return [r * Math.cos(a), r * Math.sin(a)]; + if(isCircle) { + aStart = 0; + aMid = PI; + aEnd = twoPI; + } else { + if(a0 < a1) { + aStart = a0; + aEnd = a1; + } else { + aStart = a1; + aEnd = a0; + } } - function findXY(va0, va1, s) { - return findIntersectionXY(va0, va1, s, a2xy(va0)); + if(r0 < r1) { + rStart = r0; + rEnd = r1; + } else { + rStart = r1; + rEnd = r0; } - function cycleIndex(ind) { - return Lib.mod(ind, len); + // N.B. svg coordinates here, where y increases downward + function pt(r, a) { + return [r * Math.cos(a) + cx, cy - r * Math.sin(a)]; } - function isInside(v) { - return isAngleInsideSector(v, [a0, a1]); + var largeArc = Math.abs(aEnd - aStart) <= PI ? 0 : 1; + function arc(r, a, cw) { + return 'A' + [r, r] + ' ' + [0, largeArc, cw] + ' ' + pt(r, a); } - // find index in sector closest to a0 - // use it to find intersection of v[i0] <-> v[i0-1] edge with sector radius - var i0 = findIndexOfMin(vangles, function(v) { - return isInside(v) ? angleDist(v, a0) : Infinity; - }); - var xy0 = findXY(vangles[i0], vangles[cycleIndex(i0 - 1)], a0); - vertices.push(xy0); + var p; - // fill in in-sector vertices - for(i = i0, j = 0; j < len; i++, j++) { - var va = vangles[cycleIndex(i)]; - if(!isInside(va)) break; - vertices.push(a2xy(va)); + if(isCircle) { + if(rStart === null) { + p = 'M' + pt(rEnd, aStart) + + arc(rEnd, aMid, 0) + + arc(rEnd, aEnd, 0) + 'Z'; + } else { + p = 'M' + pt(rStart, aStart) + + arc(rStart, aMid, 0) + + arc(rStart, aEnd, 0) + 'Z' + + 'M' + pt(rEnd, aStart) + + arc(rEnd, aMid, 1) + + arc(rEnd, aEnd, 1) + 'Z'; + } + } else { + if(rStart === null) { + p = 'M' + pt(rEnd, aStart) + arc(rEnd, aEnd, 0); + if(isClosed) p += 'L0,0Z'; + } else { + p = 'M' + pt(rStart, aStart) + + 'L' + pt(rEnd, aStart) + + arc(rEnd, aEnd, 0) + + 'L' + pt(rStart, aEnd) + + arc(rStart, aStart, 1) + 'Z'; + } } - // find index in sector closest to a1, - // use it to find intersection of v[iN] <-> v[iN+1] edge with sector radius - var iN = findIndexOfMin(vangles, function(v) { - return isInside(v) ? angleDist(v, a1) : Infinity; - }); - var xyN = findXY(vangles[iN], vangles[cycleIndex(iN + 1)], a1); - vertices.push(xyN); - - vertices.push([0, 0]); - vertices.push(vertices[0].slice()); - - return vertices; -} - -function makePolygon(r, a0, a1, vangles) { - return Lib.isFullCircle([a0, a1]) ? - makeRegularPolygon(r, vangles) : - makeClippedPolygon(r, a0, a1, vangles); -} - -function findPolygonOffset(r, a0, a1, vangles) { - var minX = Infinity; - var minY = Infinity; - var vertices = makePolygon(r, a0, a1, vangles); - - for(var i = 0; i < vertices.length; i++) { - var v = vertices[i]; - minX = Math.min(minX, v[0]); - minY = Math.min(minY, -v[1]); - } - return [minX, minY]; + return p; } /** - * find vertex angles (in 'vangles') the enclose angle 'a' + * path an arc * - * @param {number} a : angle in *radians* - * @param {array} vangles : angles of polygon vertices in *radians* - * @return {2-item array} + * @param {number} r : radius + * @param {number} a0 : first angular coordinate in *radians* + * @param {number} a1 : second angular coordinate in *radians* + * @param {number (optional)} cx : x coordinate of center + * @param {number (optional)} cy : y coordinate of center + * @return {string} svg path */ -function findEnclosingVertexAngles(a, vangles) { - var minFn = function(v) { - var adelta = angleDelta(v, a); - return adelta > 0 ? adelta : Infinity; - }; - var i0 = findIndexOfMin(vangles, minFn); - var i1 = Lib.mod(i0 + 1, vangles.length); - return [vangles[i0], vangles[i1]]; -} - -// to more easily catch 'almost zero' numbers in if-else blocks -function clampTiny(v) { - return Math.abs(v) > 1e-10 ? v : 0; -} - -function transformForSVG(pts0, cx, cy) { - cx = cx || 0; - cy = cy || 0; - - var len = pts0.length; - var pts1 = new Array(len); - - for(var i = 0; i < len; i++) { - var pt = pts0[i]; - pts1[i] = [cx + pt[0], cy - pt[1]]; - } - return pts1; +function pathArc(r, a0, a1, cx, cy) { + return _path(null, r, a0, a1, cx, cy, 0); } /** - * path polygon + * path a sector * - * @param {number} r : polygon 'radius' + * @param {number} r : radius * @param {number} a0 : first angular coordinate in *radians* * @param {number} a1 : second angular coordinate in *radians* - * @param {array} vangles : angles of polygon vertices in *radians* * @param {number (optional)} cx : x coordinate of center * @param {number (optional)} cy : y coordinate of center * @return {string} svg path - * */ -function pathPolygon(r, a0, a1, vangles, cx, cy) { - var poly = makePolygon(r, a0, a1, vangles); - return 'M' + transformForSVG(poly, cx, cy).join('L'); +function pathSector(r, a0, a1, cx, cy) { + return _path(null, r, a0, a1, cx, cy, 1); } /** - * path a polygon 'annulus' - * i.e. a polygon with a concentric hole - * - * N.B. this routine uses the evenodd SVG rule + * path an annulus * * @param {number} r0 : first radial coordinate * @param {number} r1 : second radial coordinate * @param {number} a0 : first angular coordinate in *radians* * @param {number} a1 : second angular coordinate in *radians* - * @param {array} vangles : angles of polygon vertices in *radians* * @param {number (optional)} cx : x coordinate of center * @param {number (optional)} cy : y coordinate of center * @return {string} svg path - * */ -function pathPolygonAnnulus(r0, r1, a0, a1, vangles, cx, cy) { - var rStart, rEnd; - - if(r0 < r1) { - rStart = r0; - rEnd = r1; - } else { - rStart = r1; - rEnd = r0; - } - - var inner = transformForSVG(makePolygon(rStart, a0, a1, vangles), cx, cy); - var outer = transformForSVG(makePolygon(rEnd, a0, a1, vangles), cx, cy); - return 'M' + outer.reverse().join('L') + 'M' + inner.join('L'); +function pathAnnulus(r0, r1, a0, a1, cx, cy) { + return _path(r0, r1, a0, a1, cx, cy, 1); } module.exports = { - isPtInsidePolygon: isPtInsidePolygon, - findPolygonOffset: findPolygonOffset, - findEnclosingVertexAngles: findEnclosingVertexAngles, - findIntersectionXY: findIntersectionXY, - findXYatLength: findXYatLength, - clampTiny: clampTiny, - pathPolygon: pathPolygon, - pathPolygonAnnulus: pathPolygonAnnulus + deg2rad: deg2rad, + rad2deg: rad2deg, + angleDelta: angleDelta, + angleDist: angleDist, + isFullCircle: isFullCircle, + isAngleInsideSector: isAngleInsideSector, + isPtInsideSector: isPtInsideSector, + pathArc: pathArc, + pathSector: pathSector, + pathAnnulus: pathAnnulus }; -},{"../../lib":696,"../../lib/polygon":708}],811:[function(_dereq_,module,exports){ +},{"./mod":166}],146:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130289,570 +34190,190 @@ 'use strict'; -var getSubplotCalcData = _dereq_('../get_data').getSubplotCalcData; -var counterRegex = _dereq_('../../lib').counterRegex; - -var createPolar = _dereq_('./polar'); -var constants = _dereq_('./constants'); - -var attr = constants.attr; -var name = constants.name; -var counter = counterRegex(name); - -var attributes = {}; -attributes[attr] = { - valType: 'subplotid', - - dflt: name, - editType: 'calc', - -}; +var isArray = Array.isArray; -function plot(gd) { - var fullLayout = gd._fullLayout; - var calcData = gd.calcdata; - var subplotIds = fullLayout._subplots[name]; +// IE9 fallbacks - for(var i = 0; i < subplotIds.length; i++) { - var id = subplotIds[i]; - var subplotCalcData = getSubplotCalcData(calcData, name, id); - var subplot = fullLayout[id]._subplot; +var ab = (typeof ArrayBuffer === 'undefined' || !ArrayBuffer.isView) ? + {isView: function() { return false; }} : + ArrayBuffer; - if(!subplot) { - subplot = createPolar(gd, id); - fullLayout[id]._subplot = subplot; - } +var dv = (typeof DataView === 'undefined') ? + function() {} : + DataView; - subplot.plot(subplotCalcData, fullLayout, gd._promises); - } +function isTypedArray(a) { + return ab.isView(a) && !(a instanceof dv); } +exports.isTypedArray = isTypedArray; -function clean(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldIds = oldFullLayout._subplots[name] || []; - var hadGl = (oldFullLayout._has && oldFullLayout._has('gl')); - var hasGl = (newFullLayout._has && newFullLayout._has('gl')); - var mustCleanScene = hadGl && !hasGl; - - for(var i = 0; i < oldIds.length; i++) { - var id = oldIds[i]; - var oldSubplot = oldFullLayout[id]._subplot; - - if(!newFullLayout[id] && !!oldSubplot) { - oldSubplot.framework.remove(); - oldSubplot.layers['radial-axis-title'].remove(); - - for(var k in oldSubplot.clipPaths) { - oldSubplot.clipPaths[k].remove(); - } - } - - if(mustCleanScene && oldSubplot._scene) { - oldSubplot._scene.destroy(); - oldSubplot._scene = null; - } - } +function isArrayOrTypedArray(a) { + return isArray(a) || isTypedArray(a); } +exports.isArrayOrTypedArray = isArrayOrTypedArray; -module.exports = { - attr: attr, - name: name, - idRoot: name, - idRegex: counter, - attrRegex: counter, - attributes: attributes, - layoutAttributes: _dereq_('./layout_attributes'), - supplyLayoutDefaults: _dereq_('./layout_defaults'), - plot: plot, - clean: clean, - toSVG: _dereq_('../cartesian').toSVG -}; - -},{"../../lib":696,"../cartesian":756,"../get_data":781,"./constants":809,"./layout_attributes":812,"./layout_defaults":813,"./polar":820}],812:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var colorAttrs = _dereq_('../../components/color/attributes'); -var axesAttrs = _dereq_('../cartesian/layout_attributes'); -var domainAttrs = _dereq_('../domain').attributes; -var extendFlat = _dereq_('../../lib').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; - -var axisLineGridAttr = overrideAll({ - color: axesAttrs.color, - showline: extendFlat({}, axesAttrs.showline, {dflt: true}), - linecolor: axesAttrs.linecolor, - linewidth: axesAttrs.linewidth, - showgrid: extendFlat({}, axesAttrs.showgrid, {dflt: true}), - gridcolor: axesAttrs.gridcolor, - gridwidth: axesAttrs.gridwidth - - // TODO add spike* attributes down the road - - // should we add zeroline* attributes? - -}, 'plot', 'from-root'); - -var axisTickAttrs = overrideAll({ - tickmode: axesAttrs.tickmode, - nticks: axesAttrs.nticks, - tick0: axesAttrs.tick0, - dtick: axesAttrs.dtick, - tickvals: axesAttrs.tickvals, - ticktext: axesAttrs.ticktext, - ticks: axesAttrs.ticks, - ticklen: axesAttrs.ticklen, - tickwidth: axesAttrs.tickwidth, - tickcolor: axesAttrs.tickcolor, - showticklabels: axesAttrs.showticklabels, - showtickprefix: axesAttrs.showtickprefix, - tickprefix: axesAttrs.tickprefix, - showticksuffix: axesAttrs.showticksuffix, - ticksuffix: axesAttrs.ticksuffix, - showexponent: axesAttrs.showexponent, - exponentformat: axesAttrs.exponentformat, - separatethousands: axesAttrs.separatethousands, - tickfont: axesAttrs.tickfont, - tickangle: axesAttrs.tickangle, - tickformat: axesAttrs.tickformat, - tickformatstops: axesAttrs.tickformatstops, - layer: axesAttrs.layer -}, 'plot', 'from-root'); - -var radialAxisAttrs = { - visible: extendFlat({}, axesAttrs.visible, {dflt: true}), - type: axesAttrs.type, - - autorange: extendFlat({}, axesAttrs.autorange, {editType: 'plot'}), - rangemode: { - valType: 'enumerated', - values: ['tozero', 'nonnegative', 'normal'], - dflt: 'tozero', - - editType: 'calc', - - }, - range: extendFlat({}, axesAttrs.range, { - items: [ - {valType: 'any', editType: 'plot', impliedEdits: {'^autorange': false}}, - {valType: 'any', editType: 'plot', impliedEdits: {'^autorange': false}} - ], - editType: 'plot' - }), - - categoryorder: axesAttrs.categoryorder, - categoryarray: axesAttrs.categoryarray, - - angle: { - valType: 'angle', - editType: 'plot', - - - }, - - side: { - valType: 'enumerated', - // TODO add 'center' for `showline: false` radial axes - values: ['clockwise', 'counterclockwise'], - dflt: 'clockwise', - editType: 'plot', - - - }, - +/* + * Test whether an input object is 1D. + * + * Assumes we already know the object is an array. + * + * Looks only at the first element, if the dimensionality is + * not consistent we won't figure that out here. + */ +function isArray1D(a) { + return !isArrayOrTypedArray(a[0]); +} +exports.isArray1D = isArray1D; - title: extendFlat({}, axesAttrs.title, {editType: 'plot', dflt: ''}), - titlefont: overrideAll(axesAttrs.titlefont, 'plot', 'from-root'), - // might need a 'titleside' and even 'titledirection' down the road +/* + * Ensures an array has the right amount of storage space. If it doesn't + * exist, it creates an array. If it does exist, it returns it if too + * short or truncates it in-place. + * + * The goal is to just reuse memory to avoid a bit of excessive garbage + * collection. + */ +exports.ensureArray = function(out, n) { + // TODO: typed array support here? This is only used in + // traces/carpet/compute_control_points + if(!isArray(out)) out = []; - hoverformat: axesAttrs.hoverformat, + // If too long, truncate. (If too short, it will grow + // automatically so we don't care about that case) + out.length = n; - editType: 'calc' + return out; }; -extendFlat( - radialAxisAttrs, - - // N.B. radialaxis grid lines are circular, - // but radialaxis lines are straight from circle center to outer bound - axisLineGridAttr, - axisTickAttrs -); - -var angularAxisAttrs = { - visible: extendFlat({}, axesAttrs.visible, {dflt: true}), - type: { - valType: 'enumerated', - // 'linear' should maybe be called 'angle' or 'angular' here - // to make clear that axis here is periodic and more tightly match - // `thetaunit`? - // - // skip 'date' for first push - // no 'log' for now - values: ['-', 'linear', 'category'], - dflt: '-', - - editType: 'calc', - _noTemplating: true, - - }, +/* + * TypedArray-compatible concatenation of n arrays + * if all arrays are the same type it will preserve that type, + * otherwise it falls back on Array. + * Also tries to avoid copying, in case one array has zero length + * But never mutates an existing array + */ +exports.concat = function() { + var args = []; + var allArray = true; + var totalLen = 0; - categoryorder: axesAttrs.categoryorder, - categoryarray: axesAttrs.categoryarray, + var _constructor, arg0, i, argi, posi, leni, out, j; - thetaunit: { - valType: 'enumerated', - values: ['radians', 'degrees'], - dflt: 'degrees', - - editType: 'calc', - - }, + 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; + } - period: { - valType: 'number', - editType: 'calc', - min: 0, - - - // Examples for date axes: - // - // - period that equals the timeseries length - // http://flowingdata.com/2017/01/24/one-dataset-visualized-25-ways/18-polar-coordinates/ - // - and 1-year periods (focusing on seasonal change0 - // http://otexts.org/fpp2/seasonal-plots.html - // https://blogs.scientificamerican.com/sa-visual/why-are-so-many-babies-born-around-8-00-a-m/ - // http://www.seasonaladjustment.com/2012/09/05/clock-plot-visualising-seasonality-using-r-and-ggplot2-part-3/ - // https://i.pinimg.com/736x/49/b9/72/49b972ccb3206a1a6d6f870dac543280.jpg - // https://www.climate-lab-book.ac.uk/spirals/ - }, + if(isArray(argi)) { + _constructor = false; + } + else { + allArray = false; + if(!totalLen) { + _constructor = argi.constructor; + } + else if(_constructor !== argi.constructor) { + // TODO: in principle we could upgrade here, + // ie keep typed array but convert all to Float64Array? + _constructor = false; + } + } - direction: { - valType: 'enumerated', - values: ['counterclockwise', 'clockwise'], - dflt: 'counterclockwise', - - editType: 'calc', - - }, + totalLen += leni; + } + } - rotation: { - valType: 'angle', - editType: 'calc', - - - }, + if(!totalLen) return []; + if(!args.length) return arg0; - hoverformat: axesAttrs.hoverformat, + if(allArray) return arg0.concat.apply(arg0, args); + if(_constructor) { + // matching typed arrays + 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; + } - editType: 'calc' + // mismatched types or Array + typed + 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; }; -extendFlat( - angularAxisAttrs, - - // N.B. angular grid lines are straight lines from circle center to outer bound - // the angular line is circular bounding the polar plot area. - axisLineGridAttr, - - // N.B. ticksuffix defaults to '°' for angular axes with `thetaunit: 'degrees'` - axisTickAttrs -); - -module.exports = { - // TODO for x/y/zoom system for paper-based zooming: - // x: {}, - // y: {}, - // zoom: {}, - - domain: domainAttrs({name: 'polar', editType: 'plot'}), - - sector: { - valType: 'info_array', - items: [ - {valType: 'number', editType: 'plot'}, - {valType: 'number', editType: 'plot'} - ], - dflt: [0, 360], - - editType: 'plot', - - }, - hole: { - valType: 'number', - min: 0, - max: 1, - dflt: 0, - editType: 'plot', - - - }, - - bgcolor: { - valType: 'color', - - editType: 'plot', - dflt: colorAttrs.background, - - }, - - radialaxis: radialAxisAttrs, - angularaxis: angularAxisAttrs, - - gridshape: { - valType: 'enumerated', - values: ['circular', 'linear'], - dflt: 'circular', - - editType: 'plot', - - }, - - // TODO maybe? - // annotations: +exports.maxRowLength = function(z) { + return _rowLength(z, Math.max, 0); +}; - editType: 'calc' +exports.minRowLength = function(z) { + return _rowLength(z, Math.min, Infinity); }; -},{"../../components/color/attributes":569,"../../lib":696,"../../plot_api/edit_types":727,"../cartesian/layout_attributes":757,"../domain":770}],813:[function(_dereq_,module,exports){ +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; +} + +},{}],147:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); -var Template = _dereq_('../../plot_api/plot_template'); - -var handleSubplotDefaults = _dereq_('../subplot_defaults'); -var getSubplotData = _dereq_('../get_data').getSubplotData; - -var handleTickValueDefaults = _dereq_('../cartesian/tick_value_defaults'); -var handleTickMarkDefaults = _dereq_('../cartesian/tick_mark_defaults'); -var handleTickLabelDefaults = _dereq_('../cartesian/tick_label_defaults'); -var handleCategoryOrderDefaults = _dereq_('../cartesian/category_order_defaults'); -var handleLineGridDefaults = _dereq_('../cartesian/line_grid_defaults'); -var autoType = _dereq_('../cartesian/axis_autotype'); - -var layoutAttributes = _dereq_('./layout_attributes'); -var setConvert = _dereq_('./set_convert'); -var constants = _dereq_('./constants'); -var axisNames = constants.axisNames; - -function handleDefaults(contIn, contOut, coerce, opts) { - var bgColor = coerce('bgcolor'); - opts.bgColor = Color.combine(bgColor, opts.paper_bgcolor); - - var sector = coerce('sector'); - coerce('hole'); - - // could optimize, subplotData is not always needed! - var subplotData = getSubplotData(opts.fullData, constants.name, opts.id); - var layoutOut = opts.layoutOut; - var axName; - - function coerceAxis(attr, dflt) { - return coerce(axName + '.' + attr, dflt); - } - - for(var i = 0; i < axisNames.length; i++) { - axName = axisNames[i]; - - if(!Lib.isPlainObject(contIn[axName])) { - contIn[axName] = {}; - } - - var axIn = contIn[axName]; - var axOut = Template.newContainer(contOut, axName); - axOut._id = axOut._name = axName; - axOut._traceIndices = subplotData.map(function(t) { return t._expandedIndex; }); - - var dataAttr = constants.axisName2dataArray[axName]; - var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr); - - handleCategoryOrderDefaults(axIn, axOut, coerceAxis, { - axData: subplotData, - dataAttr: dataAttr - }); - - var visible = coerceAxis('visible'); - setConvert(axOut, contOut, layoutOut); - - var dfltColor; - var dfltFontColor; - - if(visible) { - dfltColor = coerceAxis('color'); - dfltFontColor = (dfltColor === axIn.color) ? dfltColor : opts.font.color; - } - - // We don't want to make downstream code call ax.setScale, - // as both radial and angular axes don't have a set domain. - // Furthermore, angular axes don't have a set range. - // - // Mocked domains and ranges are set by the polar subplot instances, - // but Axes.findExtremes uses the sign of _m to determine which padding value - // to use. - // - // By setting, _m to 1 here, we make Axes.findExtremes think that - // range[1] > range[0], and vice-versa for `autorange: 'reversed'` below. - axOut._m = 1; - - switch(axName) { - case 'radialaxis': - var autoRange = coerceAxis('autorange', !axOut.isValidRange(axIn.range)); - axIn.autorange = autoRange; - if(autoRange && (axType === 'linear' || axType === '-')) coerceAxis('rangemode'); - if(autoRange === 'reversed') axOut._m = -1; - - coerceAxis('range'); - axOut.cleanRange('range', {dfltRange: [0, 1]}); - - if(visible) { - coerceAxis('side'); - coerceAxis('angle', sector[0]); - - coerceAxis('title'); - Lib.coerceFont(coerceAxis, 'titlefont', { - family: opts.font.family, - size: Math.round(opts.font.size * 1.2), - color: dfltFontColor - }); - } - break; - - case 'angularaxis': - // We do not support 'true' date angular axes yet, - // users can still plot dates on angular axes by setting - // `angularaxis.type: 'category'`. - // - // Here, if a date angular axes is detected, we make - // all its corresponding traces invisible, so that - // when we do add support for data angular axes, the new - // behavior won't conflict with existing behavior - if(axType === 'date') { - Lib.log('Polar plots do not support date angular axes yet.'); - - for(var j = 0; j < subplotData.length; j++) { - subplotData[j].visible = false; - } - - // turn this into a 'dummy' linear axis so that - // the subplot still renders ok - axType = axIn.type = axOut.type = 'linear'; - } - - if(axType === 'linear') { - coerceAxis('thetaunit'); - } else { - coerceAxis('period'); - } - - var direction = coerceAxis('direction'); - coerceAxis('rotation', {counterclockwise: 0, clockwise: 90}[direction]); - break; - } - - if(visible) { - handleTickValueDefaults(axIn, axOut, coerceAxis, axOut.type); - handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, { - tickSuffixDflt: axOut.thetaunit === 'degrees' ? '°' : undefined - }); - handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true}); - - var showTickLabels = coerceAxis('showticklabels'); - if(showTickLabels) { - Lib.coerceFont(coerceAxis, 'tickfont', { - family: opts.font.family, - size: opts.font.size, - color: dfltFontColor - }); - coerceAxis('tickangle'); - coerceAxis('tickformat'); - } - - handleLineGridDefaults(axIn, axOut, coerceAxis, { - dfltColor: dfltColor, - bgColor: opts.bgColor, - // default grid color is darker here (60%, vs cartesian default ~91%) - // because the grid is not square so the eye needs heavier cues to follow - blend: 60, - showLine: true, - showGrid: true, - noZeroLine: true, - attributes: layoutAttributes[axName] - }); - - coerceAxis('layer'); - } - - if(axType !== 'category') coerceAxis('hoverformat'); - - axOut._input = axIn; - } - - if(contOut.angularaxis.type === 'category') { - coerce('gridshape'); - } -} - -function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { - var axType = coerce('type'); - if(axType === '-') { - var trace; +'use strict'; - for(var i = 0; i < subplotData.length; i++) { - if(subplotData[i].visible) { - trace = subplotData[i]; - break; - } - } +var isNumeric = _dereq_('fast-isnumeric'); - if(trace && trace[dataAttr]) { - axOut.type = autoType(trace[dataAttr], 'gregorian'); - } +var BADNUM = _dereq_('../constants/numerical').BADNUM; - if(axOut.type === '-') { - axOut.type = 'linear'; - } else { - // copy autoType back to input axis - // note that if this object didn't exist - // in the input layout, we have to put it in - // this happens in the main supplyDefaults function - axIn.type = axOut.type; - } +// precompile for speed +var JUNK = /^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g; + +/** + * cleanNumber: remove common leading and trailing cruft + * Always returns either a number or BADNUM. + */ +module.exports = function cleanNumber(v) { + if(typeof v === 'string') { + v = v.replace(JUNK, ''); } - return axOut.type; -} + if(isNumeric(v)) return Number(v); -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - handleSubplotDefaults(layoutIn, layoutOut, fullData, { - type: constants.name, - attributes: layoutAttributes, - handleDefaults: handleDefaults, - font: layoutOut.font, - paper_bgcolor: layoutOut.paper_bgcolor, - fullData: fullData, - layoutOut: layoutOut - }); + return BADNUM; }; -},{"../../components/color":570,"../../lib":696,"../../plot_api/plot_template":734,"../cartesian/axis_autotype":745,"../cartesian/category_order_defaults":748,"../cartesian/line_grid_defaults":759,"../cartesian/tick_label_defaults":764,"../cartesian/tick_mark_defaults":765,"../cartesian/tick_value_defaults":766,"../get_data":781,"../subplot_defaults":822,"./constants":809,"./layout_attributes":812,"./set_convert":821}],814:[function(_dereq_,module,exports){ +},{"../constants/numerical":140,"fast-isnumeric":10}],148:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130861,164 +34382,49 @@ 'use strict'; -var scatterAttrs = _dereq_('../../../traces/scatter/attributes'); -var scatterMarkerAttrs = scatterAttrs.marker; -var extendFlat = _dereq_('../../../lib/extend').extendFlat; - -var deprecationWarning = [ - 'Area traces are deprecated!', - 'Please switch to the *barpolar* trace type.' -].join(' '); +/** + * Clear gl frame (if any). This is a common pattern as + * we usually set `preserveDrawingBuffer: true` during + * gl context creation (e.g. via `reglUtils.prepare`). + * + * @param {DOM node or object} gd : graph div object + */ +module.exports = function clearGlCanvases(gd) { + var fullLayout = gd._fullLayout; -module.exports = { - r: extendFlat({}, scatterAttrs.r, { - - }), - t: extendFlat({}, scatterAttrs.t, { - - }), - marker: { - color: extendFlat({}, scatterMarkerAttrs.color, { - - }), - size: extendFlat({}, scatterMarkerAttrs.size, { - - }), - symbol: extendFlat({}, scatterMarkerAttrs.symbol, { - - }), - opacity: extendFlat({}, scatterMarkerAttrs.opacity, { - - }), - editType: 'calc' + if(fullLayout._glcanvas && fullLayout._glcanvas.size()) { + fullLayout._glcanvas.each(function(d) { + if(d.regl) d.regl.clear({color: true, depth: true}); + }); } }; -},{"../../../lib/extend":685,"../../../traces/scatter/attributes":1043}],815:[function(_dereq_,module,exports){ +},{}],149:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var axesAttrs = _dereq_('../../cartesian/layout_attributes'); -var extendFlat = _dereq_('../../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../../plot_api/edit_types').overrideAll; - -var deprecationWarning = [ - 'Legacy polar charts are deprecated!', - 'Please switch to *polar* subplots.' -].join(' '); - -var domainAttr = extendFlat({}, axesAttrs.domain, { - -}); - -function mergeAttrs(axisName, nonCommonAttrs) { - var commonAttrs = { - showline: { - valType: 'boolean', - - - }, - showticklabels: { - valType: 'boolean', - - - }, - tickorientation: { - valType: 'enumerated', - values: ['horizontal', 'vertical'], - - - }, - ticklen: { - valType: 'number', - min: 0, - - - }, - tickcolor: { - valType: 'color', - - - }, - ticksuffix: { - valType: 'string', - - - }, - endpadding: { - valType: 'number', - - description: deprecationWarning, - }, - visible: { - valType: 'boolean', - - - } - }; - - return extendFlat({}, nonCommonAttrs, commonAttrs); -} - -module.exports = overrideAll({ - radialaxis: mergeAttrs('radial', { - range: { - valType: 'info_array', - - items: [ - { valType: 'number' }, - { valType: 'number' } - ], - - }, - domain: domainAttr, - orientation: { - valType: 'number', - - - } - }), - - angularaxis: mergeAttrs('angular', { - range: { - valType: 'info_array', - - items: [ - { valType: 'number', dflt: 0 }, - { valType: 'number', dflt: 360 } - ], - - }, - domain: domainAttr - }), - - // attributes that appear at layout root - layout: { - direction: { - valType: 'enumerated', - values: ['clockwise', 'counterclockwise'], - - - }, - orientation: { - valType: 'angle', - - - } +/** + * Clear responsive handlers (if any). + * + * @param {DOM node or object} gd : graph div object + */ +module.exports = function clearResponsive(gd) { + if(gd._responsiveChartHandler) { + window.removeEventListener('resize', gd._responsiveChartHandler); + delete gd._responsiveChartHandler; } -}, 'plot', 'nested'); +}; -},{"../../../lib/extend":685,"../../../plot_api/edit_types":727,"../../cartesian/layout_attributes":757}],816:[function(_dereq_,module,exports){ +},{}],150:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131027,1585 +34433,1410 @@ 'use strict'; -var Polar = module.exports = _dereq_('./micropolar'); +var isNumeric = _dereq_('fast-isnumeric'); +var tinycolor = _dereq_('tinycolor2'); -Polar.manager = _dereq_('./micropolar_manager'); +var baseTraceAttrs = _dereq_('../plots/attributes'); +var scales = _dereq_('../components/colorscale/scales'); +var DESELECTDIM = _dereq_('../constants/interactions').DESELECTDIM; -},{"./micropolar":817,"./micropolar_manager":818}],817:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +var nestedProperty = _dereq_('./nested_property'); +var counterRegex = _dereq_('./regex').counter; +var modHalf = _dereq_('./mod').modHalf; +var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; -var d3 = _dereq_('d3'); -var Lib = _dereq_('../../../lib'); -var extendDeepAll = Lib.extendDeepAll; -var MID_SHIFT = _dereq_('../../../constants/alignment').MID_SHIFT; +exports.valObjectMeta = { + data_array: { + // You can use *dflt=[] to force said array to exist though. + + + + coerceFunction: function(v, propOut, dflt) { + // TODO maybe `v: {type: 'float32', vals: [/* ... */]}` also + if(isArrayOrTypedArray(v)) propOut.set(v); + else if(dflt !== undefined) propOut.set(dflt); + } + }, + enumerated: { + + + + 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 µ = module.exports = { version: '0.2.2' }; + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); -µ.Axis = function module() { - var config = { - data: [], - layout: {} - }, inputConfig = {}, liveConfig = {}; - var svg, container, dispatch = d3.dispatch('hover'), radialScale, angularScale; - var exports = {}; - function render(_container) { - container = _container || container; - var data = config.data; - var axisConfig = config.layout; - if (typeof container == 'string' || container.nodeName) container = d3.select(container); - container.datum(data).each(function(_data, _index) { - var dataOriginal = _data.slice(); - liveConfig = { - data: µ.util.cloneJson(dataOriginal), - layout: µ.util.cloneJson(axisConfig) - }; - var colorIndex = 0; - dataOriginal.forEach(function(d, i) { - if (!d.color) { - d.color = axisConfig.defaultColorRange[colorIndex]; - colorIndex = (colorIndex + 1) % axisConfig.defaultColorRange.length; - } - if (!d.strokeColor) { - d.strokeColor = d.geometry === 'LinePlot' ? d.color : d3.rgb(d.color).darker().toString(); - } - liveConfig.data[i].color = d.color; - liveConfig.data[i].strokeColor = d.strokeColor; - liveConfig.data[i].strokeDash = d.strokeDash; - liveConfig.data[i].strokeSize = d.strokeSize; - }); - var data = dataOriginal.filter(function(d, i) { - var visible = d.visible; - return typeof visible === 'undefined' || visible === true; - }); - var isStacked = false; - var dataWithGroupId = data.map(function(d, i) { - isStacked = isStacked || typeof d.groupId !== 'undefined'; - return d; - }); - if (isStacked) { - var grouped = d3.nest().key(function(d, i) { - return typeof d.groupId != 'undefined' ? d.groupId : 'unstacked'; - }).entries(dataWithGroupId); - var dataYStack = []; - var stacked = grouped.map(function(d, i) { - if (d.key === 'unstacked') return d.values; else { - var prevArray = d.values[0].r.map(function(d, i) { - return 0; - }); - d.values.forEach(function(d, i, a) { - d.yStack = [ prevArray ]; - dataYStack.push(prevArray); - prevArray = µ.util.sumArrays(d.r, prevArray); - }); - return d.values; - } - }); - data = d3.merge(stacked); - } - data.forEach(function(d, i) { - d.t = Array.isArray(d.t[0]) ? d.t : [ d.t ]; - d.r = Array.isArray(d.r[0]) ? d.r : [ d.r ]; - }); - var radius = Math.min(axisConfig.width - axisConfig.margin.left - axisConfig.margin.right, axisConfig.height - axisConfig.margin.top - axisConfig.margin.bottom) / 2; - radius = Math.max(10, radius); - var chartCenter = [ axisConfig.margin.left + radius, axisConfig.margin.top + radius ]; - var extent; - if (isStacked) { - var highestStackedValue = d3.max(µ.util.sumArrays(µ.util.arrayLast(data).r[0], µ.util.arrayLast(dataYStack))); - extent = [ 0, highestStackedValue ]; - } else extent = d3.extent(µ.util.flattenArray(data.map(function(d, i) { - return d.r; - }))); - if (axisConfig.radialAxis.domain != µ.DATAEXTENT) extent[0] = 0; - radialScale = d3.scale.linear().domain(axisConfig.radialAxis.domain != µ.DATAEXTENT && axisConfig.radialAxis.domain ? axisConfig.radialAxis.domain : extent).range([ 0, radius ]); - liveConfig.layout.radialAxis.domain = radialScale.domain(); - var angularDataMerged = µ.util.flattenArray(data.map(function(d, i) { - return d.t; - })); - var isOrdinal = typeof angularDataMerged[0] === 'string'; - var ticks; - if (isOrdinal) { - angularDataMerged = µ.util.deduplicate(angularDataMerged); - ticks = angularDataMerged.slice(); - angularDataMerged = d3.range(angularDataMerged.length); - data = data.map(function(d, i) { - var result = d; - d.t = [ angularDataMerged ]; - if (isStacked) result.yStack = d.yStack; - return result; - }); + 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; } - var hasOnlyLineOrDotPlot = data.filter(function(d, i) { - return d.geometry === 'LinePlot' || d.geometry === 'DotPlot'; - }).length === data.length; - var needsEndSpacing = axisConfig.needsEndSpacing === null ? isOrdinal || !hasOnlyLineOrDotPlot : axisConfig.needsEndSpacing; - var useProvidedDomain = axisConfig.angularAxis.domain && axisConfig.angularAxis.domain != µ.DATAEXTENT && !isOrdinal && axisConfig.angularAxis.domain[0] >= 0; - var angularDomain = useProvidedDomain ? axisConfig.angularAxis.domain : d3.extent(angularDataMerged); - var angularDomainStep = Math.abs(angularDataMerged[1] - angularDataMerged[0]); - if (hasOnlyLineOrDotPlot && !isOrdinal) angularDomainStep = 0; - var angularDomainWithPadding = angularDomain.slice(); - if (needsEndSpacing && isOrdinal) angularDomainWithPadding[1] += angularDomainStep; - var tickCount = axisConfig.angularAxis.ticksCount || 4; - if (tickCount > 8) tickCount = tickCount / (tickCount / 8) + tickCount % 8; - if (axisConfig.angularAxis.ticksStep) { - tickCount = (angularDomainWithPadding[1] - angularDomainWithPadding[0]) / tickCount; + return false; + } + }, + 'boolean': { + + + + coerceFunction: function(v, propOut, dflt) { + if(v === true || v === false) propOut.set(v); + else propOut.set(dflt); + } + }, + number: { + + + + coerceFunction: function(v, propOut, dflt, opts) { + if(!isNumeric(v) || + (opts.min !== undefined && v < opts.min) || + (opts.max !== undefined && v > opts.max)) { + propOut.set(dflt); } - var angularTicksStep = axisConfig.angularAxis.ticksStep || (angularDomainWithPadding[1] - angularDomainWithPadding[0]) / (tickCount * (axisConfig.minorTicks + 1)); - if (ticks) angularTicksStep = Math.max(Math.round(angularTicksStep), 1); - if (!angularDomainWithPadding[2]) angularDomainWithPadding[2] = angularTicksStep; - var angularAxisRange = d3.range.apply(this, angularDomainWithPadding); - angularAxisRange = angularAxisRange.map(function(d, i) { - return parseFloat(d.toPrecision(12)); - }); - angularScale = d3.scale.linear().domain(angularDomainWithPadding.slice(0, 2)).range(axisConfig.direction === 'clockwise' ? [ 0, 360 ] : [ 360, 0 ]); - liveConfig.layout.angularAxis.domain = angularScale.domain(); - liveConfig.layout.angularAxis.endPadding = needsEndSpacing ? angularDomainStep : 0; - svg = d3.select(this).select('svg.chart-root'); - if (typeof svg === 'undefined' || svg.empty()) { - var skeleton = "' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '"; - var doc = new DOMParser().parseFromString(skeleton, 'application/xml'); - var newSvg = this.appendChild(this.ownerDocument.importNode(doc.documentElement, true)); - svg = d3.select(newSvg); + else propOut.set(+v); + } + }, + integer: { + + + + coerceFunction: function(v, propOut, dflt, opts) { + if(v % 1 || !isNumeric(v) || + (opts.min !== undefined && v < opts.min) || + (opts.max !== undefined && v > opts.max)) { + propOut.set(dflt); } - svg.select('.guides-group').style({ - 'pointer-events': 'none' - }); - svg.select('.angular.axis-group').style({ - 'pointer-events': 'none' - }); - svg.select('.radial.axis-group').style({ - 'pointer-events': 'none' - }); - var chartGroup = svg.select('.chart-group'); - var lineStyle = { - fill: 'none', - stroke: axisConfig.tickColor - }; - var fontStyle = { - 'font-size': axisConfig.font.size, - 'font-family': axisConfig.font.family, - fill: axisConfig.font.color, - 'text-shadow': [ '-1px 0px', '1px -1px', '-1px 1px', '1px 1px' ].map(function(d, i) { - return ' ' + d + ' 0 ' + axisConfig.font.outlineColor; - }).join(',') - }; - var legendContainer; - if (axisConfig.showLegend) { - legendContainer = svg.select('.legend-group').attr({ - transform: 'translate(' + [ radius, axisConfig.margin.top ] + ')' - }).style({ - display: 'block' - }); - var elements = data.map(function(d, i) { - var datumClone = µ.util.cloneJson(d); - datumClone.symbol = d.geometry === 'DotPlot' ? d.dotType || 'circle' : d.geometry != 'LinePlot' ? 'square' : 'line'; - datumClone.visibleInLegend = typeof d.visibleInLegend === 'undefined' || d.visibleInLegend; - datumClone.color = d.geometry === 'LinePlot' ? d.strokeColor : d.color; - return datumClone; - }); - - µ.Legend().config({ - data: data.map(function(d, i) { - return d.name || 'Element' + i; - }), - legendConfig: extendDeepAll({}, - µ.Legend.defaultConfig().legendConfig, - { - container: legendContainer, - elements: elements, - reverseOrder: axisConfig.legend.reverseOrder - } - ) - })(); + else propOut.set(+v); + } + }, + string: { + + + // TODO 'values shouldn't be in there (edge case: 'dash' in Scatter) + + coerceFunction: function(v, propOut, dflt, opts) { + if(typeof v !== 'string') { + var okToCoerce = (typeof v === 'number'); - var legendBBox = legendContainer.node().getBBox(); - radius = Math.min(axisConfig.width - legendBBox.width - axisConfig.margin.left - axisConfig.margin.right, axisConfig.height - axisConfig.margin.top - axisConfig.margin.bottom) / 2; - radius = Math.max(10, radius); - chartCenter = [ axisConfig.margin.left + radius, axisConfig.margin.top + radius ]; - radialScale.range([ 0, radius ]); - liveConfig.layout.radialAxis.domain = radialScale.domain(); - legendContainer.attr('transform', 'translate(' + [ chartCenter[0] + radius, chartCenter[1] - radius ] + ')'); - } else { - legendContainer = svg.select('.legend-group').style({ - display: 'none' - }); + 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: { + + + + coerceFunction: function(v, propOut, dflt) { + if(tinycolor(v).isValid()) propOut.set(v); + else propOut.set(dflt); + } + }, + colorlist: { + + + + 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: { + + + + coerceFunction: function(v, propOut, dflt) { + propOut.set(scales.get(v, dflt)); + } + }, + angle: { + + + + coerceFunction: function(v, propOut, dflt) { + if(v === 'auto') propOut.set('auto'); + else if(!isNumeric(v)) propOut.set(dflt); + else propOut.set(modHalf(+v, 360)); + } + }, + subplotid: { + + + + coerceFunction: function(v, propOut, dflt, opts) { + var regex = opts.regex || counterRegex(dflt); + if(typeof v === 'string' && regex.test(v)) { + propOut.set(v); + return; } - svg.attr({ - width: axisConfig.width, - height: axisConfig.height - }).style({ - opacity: axisConfig.opacity - }); - chartGroup.attr('transform', 'translate(' + chartCenter + ')').style({ - cursor: 'crosshair' - }); - var centeringOffset = [ (axisConfig.width - (axisConfig.margin.left + axisConfig.margin.right + radius * 2 + (legendBBox ? legendBBox.width : 0))) / 2, (axisConfig.height - (axisConfig.margin.top + axisConfig.margin.bottom + radius * 2)) / 2 ]; - centeringOffset[0] = Math.max(0, centeringOffset[0]); - centeringOffset[1] = Math.max(0, centeringOffset[1]); - svg.select('.outer-group').attr('transform', 'translate(' + centeringOffset + ')'); - if (axisConfig.title) { - var title = svg.select('g.title-group text').style(fontStyle).text(axisConfig.title); - var titleBBox = title.node().getBBox(); - title.attr({ - x: chartCenter[0] - titleBBox.width / 2, - y: chartCenter[1] - radius - 20 - }); + 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: { + + + + coerceFunction: function(v, propOut, dflt, opts) { + if(typeof v !== 'string') { + propOut.set(dflt); + return; } - var radialAxis = svg.select('.radial.axis-group'); - if (axisConfig.radialAxis.gridLinesVisible) { - var gridCircles = radialAxis.selectAll('circle.grid-circle').data(radialScale.ticks(5)); - gridCircles.enter().append('circle').attr({ - 'class': 'grid-circle' - }).style(lineStyle); - gridCircles.attr('r', radialScale); - gridCircles.exit().remove(); + if((opts.extras || []).indexOf(v) !== -1) { + propOut.set(v); + return; } - radialAxis.select('circle.outside-circle').attr({ - r: radius - }).style(lineStyle); - var backgroundCircle = svg.select('circle.background-circle').attr({ - r: radius - }).style({ - fill: axisConfig.backgroundColor, - stroke: axisConfig.stroke - }); - function currentAngle(d, i) { - return angularScale(d) % 360 + axisConfig.orientation; + var vParts = v.split('+'); + var i = 0; + while(i < vParts.length) { + var vi = vParts[i]; + if(opts.flags.indexOf(vi) === -1 || vParts.indexOf(vi) < i) { + vParts.splice(i, 1); + } + else i++; } - if (axisConfig.radialAxis.visible) { - var axis = d3.svg.axis().scale(radialScale).ticks(5).tickSize(5); - radialAxis.call(axis).attr({ - transform: 'rotate(' + axisConfig.radialAxis.orientation + ')' - }); - radialAxis.selectAll('.domain').style(lineStyle); - radialAxis.selectAll('g>text').text(function(d, i) { - return this.textContent + axisConfig.radialAxis.ticksSuffix; - }).style(fontStyle).style({ - 'text-anchor': 'start' - }).attr({ - x: 0, - y: 0, - dx: 0, - dy: 0, - transform: function(d, i) { - if (axisConfig.radialAxis.tickOrientation === 'horizontal') { - return 'rotate(' + -axisConfig.radialAxis.orientation + ') translate(' + [ 0, fontStyle['font-size'] ] + ')'; - } else return 'translate(' + [ 0, fontStyle['font-size'] ] + ')'; - } - }); - radialAxis.selectAll('g>line').style({ - stroke: 'black' - }); + if(!vParts.length) propOut.set(dflt); + else propOut.set(vParts.join('+')); + } + }, + any: { + + + + coerceFunction: function(v, propOut, dflt) { + if(v === undefined) propOut.set(dflt); + else propOut.set(v); + } + }, + info_array: { + + + // 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 + + coerceFunction: function(v, propOut, dflt, opts) { + + // simplified coerce function just for array items + function coercePart(v, opts, dflt) { + var out; + var propPart = {set: function(v) { out = v; }}; + + if(dflt === undefined) dflt = opts.dflt; + + exports.valObjectMeta[opts.valType].coerceFunction(v, propPart, dflt, opts); + + return out; } - var angularAxis = svg.select('.angular.axis-group').selectAll('g.angular-tick').data(angularAxisRange); - var angularAxisEnter = angularAxis.enter().append('g').classed('angular-tick', true); - angularAxis.attr({ - transform: function(d, i) { - return 'rotate(' + currentAngle(d, i) + ')'; - } - }).style({ - display: axisConfig.angularAxis.visible ? 'block' : 'none' - }); - angularAxis.exit().remove(); - angularAxisEnter.append('line').classed('grid-line', true).classed('major', function(d, i) { - return i % (axisConfig.minorTicks + 1) == 0; - }).classed('minor', function(d, i) { - return !(i % (axisConfig.minorTicks + 1) == 0); - }).style(lineStyle); - angularAxisEnter.selectAll('.minor').style({ - stroke: axisConfig.minorTickColor - }); - angularAxis.select('line.grid-line').attr({ - x1: axisConfig.tickLength ? radius - axisConfig.tickLength : 0, - x2: radius - }).style({ - display: axisConfig.angularAxis.gridLinesVisible ? 'block' : 'none' - }); - angularAxisEnter.append('text').classed('axis-text', true).style(fontStyle); - var ticksText = angularAxis.select('text.axis-text').attr({ - x: radius + axisConfig.labelOffset, - dy: MID_SHIFT + 'em', - transform: function(d, i) { - var angle = currentAngle(d, i); - var rad = radius + axisConfig.labelOffset; - var orient = axisConfig.angularAxis.tickOrientation; - if (orient == 'horizontal') return 'rotate(' + -angle + ' ' + rad + ' 0)'; else if (orient == 'radial') return angle < 270 && angle > 90 ? 'rotate(180 ' + rad + ' 0)' : null; else return 'rotate(' + (angle <= 180 && angle > 0 ? -90 : 90) + ' ' + rad + ' 0)'; - } - }).style({ - 'text-anchor': 'middle', - display: axisConfig.angularAxis.labelsVisible ? 'block' : 'none' - }).text(function(d, i) { - if (i % (axisConfig.minorTicks + 1) != 0) return ''; - if (ticks) { - return ticks[d] + axisConfig.angularAxis.ticksSuffix; - } else return d + axisConfig.angularAxis.ticksSuffix; - }).style(fontStyle); - if (axisConfig.angularAxis.rewriteTicks) ticksText.text(function(d, i) { - if (i % (axisConfig.minorTicks + 1) != 0) return ''; - return axisConfig.angularAxis.rewriteTicks(this.textContent, i); - }); - var rightmostTickEndX = d3.max(chartGroup.selectAll('.angular-tick text')[0].map(function(d, i) { - return d.getCTM().e + d.getBBox().width; - })); - legendContainer.attr({ - transform: 'translate(' + [ radius + rightmostTickEndX, axisConfig.margin.top ] + ')' - }); - var hasGeometry = svg.select('g.geometry-group').selectAll('g').size() > 0; - var geometryContainer = svg.select('g.geometry-group').selectAll('g.geometry').data(data); - geometryContainer.enter().append('g').attr({ - 'class': function(d, i) { - return 'geometry geometry' + i; + + var twoD = opts.dimensions === 2 || (opts.dimensions === '1-2' && Array.isArray(v) && Array.isArray(v[0])); + + if(!Array.isArray(v)) { + propOut.set(dflt); + return; + } + + var items = opts.items; + var vOut = []; + var arrayItems = Array.isArray(items); + var arrayItems2D = arrayItems && twoD && Array.isArray(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 = Array.isArray(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 !== undefined) vOut[i][j] = vNew; + } } - }); - geometryContainer.exit().remove(); - if (data[0] || hasGeometry) { - var geometryConfigs = []; - data.forEach(function(d, i) { - var geometryConfig = {}; - geometryConfig.radialScale = radialScale; - geometryConfig.angularScale = angularScale; - geometryConfig.container = geometryContainer.filter(function(dB, iB) { - return iB == i; - }); - geometryConfig.geometry = d.geometry; - geometryConfig.orientation = axisConfig.orientation; - geometryConfig.direction = axisConfig.direction; - geometryConfig.index = i; - geometryConfigs.push({ - data: d, - geometryConfig: geometryConfig - }); - }); - var geometryConfigsGrouped = d3.nest().key(function(d, i) { - return typeof d.data.groupId != 'undefined' || 'unstacked'; - }).entries(geometryConfigs); - var geometryConfigsGrouped2 = []; - geometryConfigsGrouped.forEach(function(d, i) { - if (d.key === 'unstacked') geometryConfigsGrouped2 = geometryConfigsGrouped2.concat(d.values.map(function(d, i) { - return [ d ]; - })); else geometryConfigsGrouped2.push(d.values); - }); - geometryConfigsGrouped2.forEach(function(d, i) { - var geometry; - if (Array.isArray(d)) geometry = d[0].geometryConfig.geometry; else geometry = d.geometryConfig.geometry; - var finalGeometryConfig = d.map(function(dB, iB) { - return extendDeepAll(µ[geometry].defaultConfig(), dB); - }); - µ[geometry]().config(finalGeometryConfig)(); - }); } - var guides = svg.select('.guides-group'); - var tooltipContainer = svg.select('.tooltips-group'); - var angularTooltip = µ.tooltipPanel().config({ - container: tooltipContainer, - fontSize: 8 - })(); - var radialTooltip = µ.tooltipPanel().config({ - container: tooltipContainer, - fontSize: 8 - })(); - var geometryTooltip = µ.tooltipPanel().config({ - container: tooltipContainer, - hasTick: true - })(); - var angularValue, radialValue; - if (!isOrdinal) { - var angularGuideLine = guides.select('line').attr({ - x1: 0, - y1: 0, - y2: 0 - }).style({ - stroke: 'grey', - 'pointer-events': 'none' - }); - chartGroup.on('mousemove.angular-guide', function(d, i) { - var mouseAngle = µ.util.getMousePos(backgroundCircle).angle; - angularGuideLine.attr({ - x2: -radius, - transform: 'rotate(' + mouseAngle + ')' - }).style({ - opacity: .5 - }); - var angleWithOriginOffset = (mouseAngle + 180 + 360 - axisConfig.orientation) % 360; - angularValue = angularScale.invert(angleWithOriginOffset); - var pos = µ.util.convertToCartesian(radius + 12, mouseAngle + 180); - angularTooltip.text(µ.util.round(angularValue)).move([ pos[0] + chartCenter[0], pos[1] + chartCenter[1] ]); - }).on('mouseout.angular-guide', function(d, i) { - guides.select('line').style({ - opacity: 0 - }); - }); + else { + for(i = 0; i < len; i++) { + vNew = coercePart(v[i], arrayItems ? items[i] : items, dflt[i]); + if(vNew !== undefined) vOut[i] = vNew; + } } - var angularGuideCircle = guides.select('circle').style({ - stroke: 'grey', - fill: 'none' - }); - chartGroup.on('mousemove.radial-guide', function(d, i) { - var r = µ.util.getMousePos(backgroundCircle).radius; - angularGuideCircle.attr({ - r: r - }).style({ - opacity: .5 - }); - radialValue = radialScale.invert(µ.util.getMousePos(backgroundCircle).radius); - var pos = µ.util.convertToCartesian(r, axisConfig.radialAxis.orientation); - radialTooltip.text(µ.util.round(radialValue)).move([ pos[0] + chartCenter[0], pos[1] + chartCenter[1] ]); - }).on('mouseout.radial-guide', function(d, i) { - angularGuideCircle.style({ - opacity: 0 - }); - geometryTooltip.hide(); - angularTooltip.hide(); - radialTooltip.hide(); - }); - svg.selectAll('.geometry-group .mark').on('mouseover.tooltip', function(d, i) { - var el = d3.select(this); - var color = this.style.fill; - var newColor = 'black'; - var opacity = this.style.opacity || 1; - el.attr({ - 'data-opacity': opacity - }); - if (color && color !== 'none') { - el.attr({ - 'data-fill': color - }); - newColor = d3.hsl(color).darker().toString(); - el.style({ - fill: newColor, - opacity: 1 - }); - var textData = { - t: µ.util.round(d[0]), - r: µ.util.round(d[1]) - }; - if (isOrdinal) textData.t = ticks[d[0]]; - var text = 't: ' + textData.t + ', r: ' + textData.r; - var bbox = this.getBoundingClientRect(); - var svgBBox = svg.node().getBoundingClientRect(); - var pos = [ bbox.left + bbox.width / 2 - centeringOffset[0] - svgBBox.left, bbox.top + bbox.height / 2 - centeringOffset[1] - svgBBox.top ]; - geometryTooltip.config({ - color: newColor - }).text(text); - geometryTooltip.move(pos); - } else { - color = this.style.stroke || 'black'; - el.attr({ - 'data-stroke': color - }); - newColor = d3.hsl(color).darker().toString(); - el.style({ - stroke: newColor, - opacity: 1 - }); + + propOut.set(vOut); + }, + validateFunction: function(v, opts) { + if(!Array.isArray(v)) return false; + + var items = opts.items; + var arrayItems = Array.isArray(items); + var twoD = opts.dimensions === 2; + + // when free length is off, input and declared lengths must match + if(!opts.freeLength && v.length !== items.length) return false; + + // valid when all input items are valid + for(var i = 0; i < v.length; i++) { + if(twoD) { + if(!Array.isArray(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; + } + } } - }).on('mousemove.tooltip', function(d, i) { - if (d3.event.which != 0) return false; - if (d3.select(this).attr('data-fill')) geometryTooltip.show(); - }).on('mouseout.tooltip', function(d, i) { - geometryTooltip.hide(); - var el = d3.select(this); - var fillColor = el.attr('data-fill'); - if (fillColor) el.style({ - fill: fillColor, - opacity: el.attr('data-opacity') - }); else el.style({ - stroke: el.attr('data-stroke'), - opacity: el.attr('data-opacity') - }); - }); - }); - return exports; - } - exports.render = function(_container) { - render(_container); - return this; - }; - exports.config = function(_x) { - if (!arguments.length) return config; - var xClone = µ.util.cloneJson(_x); - xClone.data.forEach(function(d, i) { - if (!config.data[i]) config.data[i] = {}; - extendDeepAll(config.data[i], µ.Axis.defaultConfig().data[0]); - extendDeepAll(config.data[i], d); - }); - extendDeepAll(config.layout, µ.Axis.defaultConfig().layout); - extendDeepAll(config.layout, xClone.layout); - return this; - }; - exports.getLiveConfig = function() { - return liveConfig; - }; - exports.getinputConfig = function() { - return inputConfig; - }; - exports.radialScale = function(_x) { - return radialScale; - }; - exports.angularScale = function(_x) { - return angularScale; - }; - exports.svg = function() { - return svg; - }; - d3.rebind(exports, dispatch, 'on'); - return exports; -}; + else if(!validate(v[i], arrayItems ? items[i] : items)) return false; + } -µ.Axis.defaultConfig = function(d, i) { - var config = { - data: [ { - t: [ 1, 2, 3, 4 ], - r: [ 10, 11, 12, 13 ], - name: 'Line1', - geometry: 'LinePlot', - color: null, - strokeDash: 'solid', - strokeColor: null, - strokeSize: '1', - visibleInLegend: true, - opacity: 1 - } ], - layout: { - defaultColorRange: d3.scale.category10().range(), - title: null, - height: 450, - width: 500, - margin: { - top: 40, - right: 40, - bottom: 40, - left: 40 - }, - font: { - size: 12, - color: 'gray', - outlineColor: 'white', - family: 'Tahoma, sans-serif' - }, - direction: 'clockwise', - orientation: 0, - labelOffset: 10, - radialAxis: { - domain: null, - orientation: -45, - ticksSuffix: '', - visible: true, - gridLinesVisible: true, - tickOrientation: 'horizontal', - rewriteTicks: null - }, - angularAxis: { - domain: [ 0, 360 ], - ticksSuffix: '', - visible: true, - gridLinesVisible: true, - labelsVisible: true, - tickOrientation: 'horizontal', - rewriteTicks: null, - ticksCount: null, - ticksStep: null - }, - minorTicks: 0, - tickLength: null, - tickColor: 'silver', - minorTickColor: '#eee', - backgroundColor: 'none', - needsEndSpacing: null, - showLegend: true, - legend: { - reverseOrder: false - }, - opacity: 1 + return true; } - }; - return config; + } }; -µ.util = {}; +/** + * Ensures that container[attribute] has a valid value. + * + * attributes[attribute] is an object with possible keys: + * - valType: data_array, enumerated, boolean, ... as in valObjectMeta + * - values: (enumerated only) array of allowed vals + * - min, max: (number, integer only) inclusive bounds on allowed vals + * either or both may be omitted + * - dflt: if attribute is invalid or missing, use this default + * if dflt is provided as an argument to lib.coerce it takes precedence + * as a convenience, returns the value it finally set + */ +exports.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 === undefined && template) { + v = nestedProperty(template, attribute).get(); + // already used the template value, so short-circuit the second check + template = 0; + } -µ.DATAEXTENT = 'dataExtent'; + if(dflt === undefined) dflt = opts.dflt; -µ.AREA = 'AreaChart'; + /** + * arrayOk: value MAY be an array, then we do no value checking + * at this point, because it can be more complicated than the + * individual form (eg. some array vals can be numbers, even if the + * single values must be color strings) + */ + if(opts.arrayOk && isArrayOrTypedArray(v)) { + propOut.set(v); + return v; + } -µ.LINE = 'LinePlot'; + var coerceFunction = exports.valObjectMeta[opts.valType].coerceFunction; + coerceFunction(v, propOut, dflt, opts); -µ.DOT = 'DotPlot'; + var out = propOut.get(); + // in case v was provided but invalid, try the template again so it still + // overrides the regular default + if(template && out === dflt && !validate(v, opts)) { + v = nestedProperty(template, attribute).get(); + coerceFunction(v, propOut, dflt, opts); + out = propOut.get(); + } + return out; +}; -µ.BAR = 'BarChart'; +/** + * Variation on coerce + * + * Uses coerce to get attribute value if user input is valid, + * returns attribute default if user input it not valid or + * returns false if there is no user input. + */ +exports.coerce2 = function(containerIn, containerOut, attributes, attribute, dflt) { + var propIn = nestedProperty(containerIn, attribute); + var propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt); + var valIn = propIn.get(); -µ.util._override = function(_objA, _objB) { - for (var x in _objA) if (x in _objB) _objB[x] = _objA[x]; + return (valIn !== undefined && valIn !== null) ? propOut : false; }; -µ.util._extend = function(_objA, _objB) { - for (var x in _objA) _objB[x] = _objA[x]; -}; +/* + * Shortcut to coerce the three font attributes + * + * 'coerce' is a lib.coerce wrapper with implied first three arguments + */ +exports.coerceFont = function(coerce, attr, dfltObj) { + var out = {}; -µ.util._rndSnd = function() { - return Math.random() * 2 - 1 + (Math.random() * 2 - 1) + (Math.random() * 2 - 1); -}; + dfltObj = dfltObj || {}; -µ.util.dataFromEquation2 = function(_equation, _step) { - var step = _step || 6; - var data = d3.range(0, 360 + step, step).map(function(deg, index) { - var theta = deg * Math.PI / 180; - var radius = _equation(theta); - return [ deg, radius ]; - }); - return data; -}; + out.family = coerce(attr + '.family', dfltObj.family); + out.size = coerce(attr + '.size', dfltObj.size); + out.color = coerce(attr + '.color', dfltObj.color); -µ.util.dataFromEquation = function(_equation, _step, _name) { - var step = _step || 6; - var t = [], r = []; - d3.range(0, 360 + step, step).forEach(function(deg, index) { - var theta = deg * Math.PI / 180; - var radius = _equation(theta); - t.push(deg); - r.push(radius); - }); - var result = { - t: t, - r: r - }; - if (_name) result.name = _name; - return result; + return out; }; -µ.util.ensureArray = function(_val, _count) { - if (typeof _val === 'undefined') return null; - var arr = [].concat(_val); - return d3.range(_count).map(function(d, i) { - return arr[i] || arr[0]; - }); -}; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? moduleAttrs : baseTraceAttrs; -µ.util.fillArrays = function(_obj, _valueNames, _count) { - _valueNames.forEach(function(d, i) { - _obj[d] = µ.util.ensureArray(_obj[d], _count); - }); - return _obj; -}; + var valObj = attrs.hoverinfo; + var dflt; -µ.util.cloneJson = function(json) { - return JSON.parse(JSON.stringify(json)); -}; + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); -µ.util.validateKeys = function(obj, keys) { - if (typeof keys === 'string') keys = keys.split('.'); - var next = keys.shift(); - return obj[next] && (!keys.length || objHasKeys(obj[next], keys)); -}; + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } -µ.util.sumArrays = function(a, b) { - return d3.zip(a, b).map(function(d, i) { - return d3.sum(d); - }); + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); }; -µ.util.arrayLast = function(a) { - return a[a.length - 1]; -}; +/** Coerce shortcut for [un]selected.marker.opacity, + * which has special default logic, to ensure that it corresponds to the + * default selection behavior while allowing to be overtaken by any other + * [un]selected attribute. + * + * N.B. This must be called *after* coercing all the other [un]selected attrs, + * to give the intended result. + * + * @param {object} traceOut : fullData item + * @param {function} coerce : lib.coerce wrapper with implied first three arguments + */ +exports.coerceSelectionMarkerOpacity = function(traceOut, coerce) { + if(!traceOut.marker) return; -µ.util.arrayEqual = function(a, b) { - var i = Math.max(a.length, b.length, 1); - while (i-- >= 0 && a[i] === b[i]) ; - return i === -2; + var mo = traceOut.marker.opacity; + // you can still have a `marker` container with no markers if there's text + if(mo === undefined) return; + + var smoDflt; + var usmoDflt; + + // Don't give [un]selected.marker.opacity a default value if + // marker.opacity is an array: handle this during style step. + // + // Only give [un]selected.marker.opacity a default value if you don't + // set any other [un]selected attributes. + if(!isArrayOrTypedArray(mo) && !traceOut.selected && !traceOut.unselected) { + smoDflt = mo; + usmoDflt = DESELECTDIM * mo; + } + + coerce('selected.marker.opacity', smoDflt); + coerce('unselected.marker.opacity', usmoDflt); }; -µ.util.flattenArray = function(arr) { - var r = []; - while (!µ.util.arrayEqual(r, arr)) { - r = arr; - arr = [].concat.apply([], arr); +function validate(value, opts) { + var valObjectDef = exports.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; } }; + + // 'failed' just something mutable that won't be === anything else + + valObjectDef.coerceFunction(value, propMock, failed, opts); + return out !== failed; +} +exports.validate = validate; + +},{"../components/colorscale/scales":58,"../constants/interactions":139,"../plots/attributes":200,"./array":146,"./mod":166,"./nested_property":167,"./regex":174,"fast-isnumeric":10,"tinycolor2":26}],151:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); + +var Loggers = _dereq_('./loggers'); +var mod = _dereq_('./mod').mod; + +var constants = _dereq_('../constants/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 = _dereq_('../registry'); + +var utcFormat = d3.time.format.utc; + +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; +// special regex for chinese calendars to support yyyy-mmi-dd etc for intercalary months +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; + +// for 2-digit years, the first year we map them onto +var YFIRST = new Date().getFullYear() - 70; + +function isWorldCalendar(calendar) { + return ( + calendar && + Registry.componentsRegistry.calendars && + typeof calendar === 'string' && calendar !== 'gregorian' + ); +} + +/* + * dateTick0: get the canonical tick for this calendar + * + * bool sunday is for week ticks, shift it to a Sunday. + */ +exports.dateTick0 = function(calendar, sunday) { + if(isWorldCalendar(calendar)) { + return sunday ? + Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : + Registry.getComponentMethod('calendars', 'CANONICAL_TICK')[calendar]; + } + else { + return sunday ? '2000-01-02' : '2000-01-01'; } - return arr; }; -µ.util.deduplicate = function(arr) { - return arr.filter(function(v, i, a) { - return a.indexOf(v) == i; - }); +/* + * dfltRange: for each calendar, give a valid default range + */ +exports.dfltRange = function(calendar) { + if(isWorldCalendar(calendar)) { + return Registry.getComponentMethod('calendars', 'DFLTRANGE')[calendar]; + } + else { + return ['2000-01-01', '2001-01-01']; + } }; -µ.util.convertToCartesian = function(radius, theta) { - var thetaRadians = theta * Math.PI / 180; - var x = radius * Math.cos(thetaRadians); - var y = radius * Math.sin(thetaRadians); - return [ x, y ]; +// is an object a javascript date? +exports.isJSDate = function(v) { + return typeof v === 'object' && v !== null && typeof v.getTime === 'function'; }; -µ.util.round = function(_value, _digits) { - var digits = _digits || 2; - var mult = Math.pow(10, digits); - return Math.round(_value * mult) / mult; +// The absolute limits of our date-time system +// This is a little weird: we use MIN_MS and MAX_MS in dateTime2ms +// but we use dateTime2ms to calculate them (after defining it!) +var MIN_MS, MAX_MS; + +/** + * dateTime2ms - turn a date object or string s into milliseconds + * (relative to 1970-01-01, per javascript standard) + * optional calendar (string) to use a non-gregorian calendar + * + * Returns BADNUM if it doesn't find a date + * + * strings should have the form: + * + * -?YYYY-mm-ddHH:MM:SS.sss? + * + * : space (our normal standard) or T or t (ISO-8601) + * : Z, z, or [+\-]HH:?MM and we THROW IT AWAY + * this format comes from https://tools.ietf.org/html/rfc3339#section-5.6 + * but we allow it even with a space as the separator + * + * May truncate after any full field, and sss can be any length + * even >3 digits, though javascript dates truncate to milliseconds, + * we keep as much as javascript numeric precision can hold, but we only + * report back up to 100 microsecond precision, because most dates support + * this precision (close to 1970 support more, very far away support less) + * + * Expanded to support negative years to -9999 but you must always + * give 4 digits, except for 2-digit positive years which we assume are + * near the present time. + * Note that we follow ISO 8601:2004: there *is* a year 0, which + * is 1BC/BCE, and -1===2BC etc. + * + * World calendars: not all of these *have* agreed extensions to this full range, + * if you have another calendar system but want a date range outside its validity, + * you can use a gregorian date string prefixed with 'G' or 'g'. + * + * Where to cut off 2-digit years between 1900s and 2000s? + * from http://support.microsoft.com/kb/244664: + * 1930-2029 (the most retro of all...) + * but in my mac chrome from eg. d=new Date(Date.parse('8/19/50')): + * 1950-2049 + * by Java, from http://stackoverflow.com/questions/2024273/: + * now-80 - now+19 + * or FileMaker Pro, from + * http://www.filemaker.com/12help/html/add_view_data.4.21.html: + * now-70 - now+29 + * but python strptime etc, via + * http://docs.python.org/py3k/library/time.html: + * 1969-2068 (super forward-looking, but static, not sliding!) + * + * lets go with now-70 to now+29, and if anyone runs into this problem + * they can learn the hard way not to use 2-digit years, as no choice we + * make now will cover all possibilities. mostly this will all be taken + * care of in initial parsing, should only be an issue for hand-entered data + * currently (2016) this range is: + * 1946-2045 + */ +exports.dateTime2ms = function(s, calendar) { + // first check if s is a date object + if(exports.isJSDate(s)) { + // Convert to the UTC milliseconds that give the same + // hours as this date has in the local timezone + 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; + } + // otherwise only accept strings and numbers + if(typeof s !== 'string' && typeof s !== 'number') return BADNUM; + + s = String(s); + + var isWorld = isWorldCalendar(calendar); + + // to handle out-of-range dates in international calendars, accept + // 'G' as a prefix to force the built-in gregorian calendar. + var s0 = s.charAt(0); + if(isWorld && (s0 === 'G' || s0 === '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) { + // disallow 2-digit years for world calendars + 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; } // Invalid ... date + + if(!cDate) return BADNUM; + + return ((cDate.toJD() - EPOCHJD) * ONEDAY) + + (H * ONEHOUR) + (M * ONEMIN) + (S * ONESEC); + } + + if(y.length === 2) { + y = (Number(y) + 2000 - YFIRST) % 100 + YFIRST; + } + else y = Number(y); + + // new Date uses months from 0; subtract 1 here just so we + // don't have to do it again during the validity test below + m -= 1; + + // javascript takes new Date(0..99,m,d) to mean 1900-1999, so + // to support years 0-99 we need to use setFullYear explicitly + // Note that 2000 is a leap year. + var date = new Date(Date.UTC(2000, m, d, H, M)); + date.setUTCFullYear(y); + + if(date.getUTCMonth() !== m) return BADNUM; + if(date.getUTCDate() !== d) return BADNUM; + + return date.getTime() + S * ONESEC; }; -µ.util.getMousePos = function(_referenceElement) { - var mousePos = d3.mouse(_referenceElement.node()); - var mouseX = mousePos[0]; - var mouseY = mousePos[1]; - var mouse = {}; - mouse.x = mouseX; - mouse.y = mouseY; - mouse.pos = mousePos; - mouse.angle = (Math.atan2(mouseY, mouseX) + Math.PI) * 180 / Math.PI; - mouse.radius = Math.sqrt(mouseX * mouseX + mouseY * mouseY); - return mouse; +MIN_MS = exports.MIN_MS = exports.dateTime2ms('-9999'); +MAX_MS = exports.MAX_MS = exports.dateTime2ms('9999-12-31 23:59:59.9999'); + +// is string s a date? (see above) +exports.isDateTime = function(s, calendar) { + return (exports.dateTime2ms(s, calendar) !== BADNUM); }; -µ.util.duplicatesCount = function(arr) { - var uniques = {}, val; - var dups = {}; - for (var i = 0, len = arr.length; i < len; i++) { - val = arr[i]; - if (val in uniques) { - uniques[val]++; - dups[val] = uniques[val]; +// pad a number with zeroes, to given # of digits before the decimal point +function lpad(val, digits) { + return String(val + Math.pow(10, digits)).substr(1); +} + +/** + * Turn ms into string of the form YYYY-mm-dd HH:MM:SS.ssss + * Crop any trailing zeros in time, except never stop right after hours + * (we could choose to crop '-01' from date too but for now we always + * show the whole date) + * Optional range r is the data range that applies, also in ms. + * If rng is big, the later parts of time will be omitted + */ +var NINETYDAYS = 90 * ONEDAY; +var THREEHOURS = 3 * ONEHOUR; +var FIVEMIN = 5 * ONEMIN; +exports.ms2DateTime = function(ms, r, calendar) { + if(typeof ms !== 'number' || !(ms >= MIN_MS && ms <= MAX_MS)) return BADNUM; + + if(!r) r = 0; + + var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10); + var msRounded = Math.round(ms - msecTenths / 10); + var dateStr, h, m, s, msec10, d; + + if(isWorldCalendar(calendar)) { + var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD; + var timeMs = Math.floor(mod(ms, ONEDAY)); + try { + dateStr = Registry.getComponentMethod('calendars', 'getCal')(calendar) + .fromJD(dateJD).formatDate('yyyy-mm-dd'); + } catch(e) { + // invalid date in this calendar - fall back to Gyyyy-mm-dd + dateStr = utcFormat('G%Y-%m-%d')(new Date(msRounded)); + } + + // yyyy does NOT guarantee 4-digit years. YYYY mostly does, but does + // other things for a few calendars, so we can't trust it. Just pad + // it manually (after the '-' if there is one) + if(dateStr.charAt(0) === '-') { + while(dateStr.length < 11) dateStr = '-0' + dateStr.substr(1); } else { - uniques[val] = 1; + while(dateStr.length < 10) dateStr = '0' + dateStr; } + + // TODO: if this is faster, we could use this block for extracting + // the time components of regular gregorian too + 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 = utcFormat('%Y-%m-%d')(d); + + // <90 days: add hours and minutes - never *only* add hours + h = (r < NINETYDAYS) ? d.getUTCHours() : 0; + m = (r < NINETYDAYS) ? d.getUTCMinutes() : 0; + // <3 hours: add seconds + s = (r < THREEHOURS) ? d.getUTCSeconds() : 0; + // <5 minutes: add ms (plus one extra digit, this is msec*10) + msec10 = (r < FIVEMIN) ? d.getUTCMilliseconds() * 10 + msecTenths : 0; } - return dups; -}; -µ.util.duplicates = function(arr) { - return Object.keys(µ.util.duplicatesCount(arr)); + return includeTime(dateStr, h, m, s, msec10); }; -µ.util.translator = function(obj, sourceBranch, targetBranch, reverse) { - if (reverse) { - var targetBranchCopy = targetBranch.slice(); - targetBranch = sourceBranch; - sourceBranch = targetBranchCopy; - } - var value = sourceBranch.reduce(function(previousValue, currentValue) { - if (typeof previousValue != 'undefined') return previousValue[currentValue]; - }, obj); - if (typeof value === 'undefined') return; - sourceBranch.reduce(function(previousValue, currentValue, index) { - if (typeof previousValue == 'undefined') return; - if (index === sourceBranch.length - 1) delete previousValue[currentValue]; - return previousValue[currentValue]; - }, obj); - targetBranch.reduce(function(previousValue, currentValue, index) { - if (typeof previousValue[currentValue] === 'undefined') previousValue[currentValue] = {}; - if (index === targetBranch.length - 1) previousValue[currentValue] = value; - return previousValue[currentValue]; - }, obj); +// For converting old-style milliseconds to date strings, +// we use the local timezone rather than UTC like we use +// everywhere else, both for backward compatibility and +// because that's how people mostly use javasript date objects. +// Clip one extra day off our date range though so we can't get +// thrown beyond the range by the timezone shift. +exports.ms2DateTimeLocal = function(ms) { + if(!(ms >= MIN_MS + ONEDAY && ms <= MAX_MS - ONEDAY)) return BADNUM; + + var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10); + var d = new Date(Math.round(ms - msecTenths / 10)); + var dateStr = d3.time.format('%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); }; -µ.PolyChart = function module() { - var config = [ µ.PolyChart.defaultConfig() ]; - var dispatch = d3.dispatch('hover'); - var dashArray = { - solid: 'none', - dash: [ 5, 2 ], - dot: [ 2, 5 ] - }; - var colorScale; - function exports() { - var geometryConfig = config[0].geometryConfig; - var container = geometryConfig.container; - if (typeof container == 'string') container = d3.select(container); - container.datum(config).each(function(_config, _index) { - var isStack = !!_config[0].data.yStack; - var data = _config.map(function(d, i) { - if (isStack) return d3.zip(d.data.t[0], d.data.r[0], d.data.yStack[0]); else return d3.zip(d.data.t[0], d.data.r[0]); - }); - var angularScale = geometryConfig.angularScale; - var domainMin = geometryConfig.radialScale.domain()[0]; - var generator = {}; - generator.bar = function(d, i, pI) { - var dataConfig = _config[pI].data; - var h = geometryConfig.radialScale(d[1]) - geometryConfig.radialScale(0); - var stackTop = geometryConfig.radialScale(d[2] || 0); - var w = dataConfig.barWidth; - d3.select(this).attr({ - 'class': 'mark bar', - d: 'M' + [ [ h + stackTop, -w / 2 ], [ h + stackTop, w / 2 ], [ stackTop, w / 2 ], [ stackTop, -w / 2 ] ].join('L') + 'Z', - transform: function(d, i) { - return 'rotate(' + (geometryConfig.orientation + angularScale(d[0])) + ')'; - } - }); - }; - generator.dot = function(d, i, pI) { - var stackedData = d[2] ? [ d[0], d[1] + d[2] ] : d; - var symbol = d3.svg.symbol().size(_config[pI].data.dotSize).type(_config[pI].data.dotType)(d, i); - d3.select(this).attr({ - 'class': 'mark dot', - d: symbol, - transform: function(d, i) { - var coord = convertToCartesian(getPolarCoordinates(stackedData)); - return 'translate(' + [ coord.x, coord.y ] + ')'; - } - }); - }; - var line = d3.svg.line.radial().interpolate(_config[0].data.lineInterpolation).radius(function(d) { - return geometryConfig.radialScale(d[1]); - }).angle(function(d) { - return geometryConfig.angularScale(d[0]) * Math.PI / 180; - }); - generator.line = function(d, i, pI) { - var lineData = d[2] ? data[pI].map(function(d, i) { - return [ d[0], d[1] + d[2] ]; - }) : data[pI]; - d3.select(this).each(generator['dot']).style({ - opacity: function(dB, iB) { - return +_config[pI].data.dotVisible; - }, - fill: markStyle.stroke(d, i, pI) - }).attr({ - 'class': 'mark dot' - }); - if (i > 0) return; - var lineSelection = d3.select(this.parentNode).selectAll('path.line').data([ 0 ]); - lineSelection.enter().insert('path'); - lineSelection.attr({ - 'class': 'line', - d: line(lineData), - transform: function(dB, iB) { - return 'rotate(' + (geometryConfig.orientation + 90) + ')'; - }, - 'pointer-events': 'none' - }).style({ - fill: function(dB, iB) { - return markStyle.fill(d, i, pI); - }, - 'fill-opacity': 0, - stroke: function(dB, iB) { - return markStyle.stroke(d, i, pI); - }, - 'stroke-width': function(dB, iB) { - return markStyle['stroke-width'](d, i, pI); - }, - 'stroke-dasharray': function(dB, iB) { - return markStyle['stroke-dasharray'](d, i, pI); - }, - opacity: function(dB, iB) { - return markStyle.opacity(d, i, pI); - }, - display: function(dB, iB) { - return markStyle.display(d, i, pI); - } - }); - }; - var angularRange = geometryConfig.angularScale.range(); - var triangleAngle = Math.abs(angularRange[1] - angularRange[0]) / data[0].length * Math.PI / 180; - var arc = d3.svg.arc().startAngle(function(d) { - return -triangleAngle / 2; - }).endAngle(function(d) { - return triangleAngle / 2; - }).innerRadius(function(d) { - return geometryConfig.radialScale(domainMin + (d[2] || 0)); - }).outerRadius(function(d) { - return geometryConfig.radialScale(domainMin + (d[2] || 0)) + geometryConfig.radialScale(d[1]); - }); - generator.arc = function(d, i, pI) { - d3.select(this).attr({ - 'class': 'mark arc', - d: arc, - transform: function(d, i) { - return 'rotate(' + (geometryConfig.orientation + angularScale(d[0]) + 90) + ')'; - } - }); - }; - var markStyle = { - fill: function(d, i, pI) { - return _config[pI].data.color; - }, - stroke: function(d, i, pI) { - return _config[pI].data.strokeColor; - }, - 'stroke-width': function(d, i, pI) { - return _config[pI].data.strokeSize + 'px'; - }, - 'stroke-dasharray': function(d, i, pI) { - return dashArray[_config[pI].data.strokeDash]; - }, - opacity: function(d, i, pI) { - return _config[pI].data.opacity; - }, - display: function(d, i, pI) { - return typeof _config[pI].data.visible === 'undefined' || _config[pI].data.visible ? 'block' : 'none'; +function includeTime(dateStr, h, m, s, msec10) { + // include each part that has nonzero data in or after it + 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; } - }; - var geometryLayer = d3.select(this).selectAll('g.layer').data(data); - geometryLayer.enter().append('g').attr({ - 'class': 'layer' - }); - var geometry = geometryLayer.selectAll('path.mark').data(function(d, i) { - return d; - }); - geometry.enter().append('path').attr({ - 'class': 'mark' - }); - geometry.style(markStyle).each(generator[geometryConfig.geometryType]); - geometry.exit().remove(); - geometryLayer.exit().remove(); - function getPolarCoordinates(d, i) { - var r = geometryConfig.radialScale(d[1]); - var t = (geometryConfig.angularScale(d[0]) + geometryConfig.orientation) * Math.PI / 180; - return { - r: r, - t: t - }; - } - function convertToCartesian(polarCoordinates) { - var x = polarCoordinates.r * Math.cos(polarCoordinates.t); - var y = polarCoordinates.r * Math.sin(polarCoordinates.t); - return { - x: x, - y: y - }; + dateStr += '.' + lpad(msec10, digits); } - }); + } } - exports.config = function(_x) { - if (!arguments.length) return config; - _x.forEach(function(d, i) { - if (!config[i]) config[i] = {}; - extendDeepAll(config[i], µ.PolyChart.defaultConfig()); - extendDeepAll(config[i], d); - }); - return this; - }; - exports.getColorScale = function() { - return colorScale; - }; - d3.rebind(exports, dispatch, 'on'); - return exports; -}; + return dateStr; +} -µ.PolyChart.defaultConfig = function() { - var config = { - data: { - name: 'geom1', - t: [ [ 1, 2, 3, 4 ] ], - r: [ [ 1, 2, 3, 4 ] ], - dotType: 'circle', - dotSize: 64, - dotVisible: false, - barWidth: 20, - color: '#ffa500', - strokeSize: 1, - strokeColor: 'silver', - strokeDash: 'solid', - opacity: 1, - index: 0, - visible: true, - visibleInLegend: true - }, - geometryConfig: { - geometry: 'LinePlot', - geometryType: 'arc', - direction: 'clockwise', - orientation: 0, - container: 'body', - radialScale: null, - angularScale: null, - colorScale: d3.scale.category20() +// normalize date format to date string, in case it starts as +// a Date object or milliseconds +// optional dflt is the return value if cleaning fails +exports.cleanDate = function(v, dflt, calendar) { + // let us use cleanDate to provide a missing default without an error + if(v === BADNUM) return dflt; + if(exports.isJSDate(v) || (typeof v === 'number' && isFinite(v))) { + // do not allow milliseconds (old) or jsdate objects (inherently + // described as gregorian dates) with world calendars + if(isWorldCalendar(calendar)) { + Loggers.error('JS Dates and milliseconds are incompatible with world calendars', v); + return dflt; } - }; - return config; -}; -µ.BarChart = function module() { - return µ.PolyChart(); + // NOTE: if someone puts in a year as a number rather than a string, + // this will mistakenly convert it thinking it's milliseconds from 1970 + // that is: '2012' -> Jan. 1, 2012, but 2012 -> 2012 epoch milliseconds + v = exports.ms2DateTimeLocal(+v); + if(!v && dflt !== undefined) return dflt; + } + else if(!exports.isDateTime(v, calendar)) { + Loggers.error('unrecognized date', v); + return dflt; + } + return v; }; -µ.BarChart.defaultConfig = function() { - var config = { - geometryConfig: { - geometryType: 'bar' - } - }; - return config; -}; +/* + * Date formatting for ticks and hovertext + */ -µ.AreaChart = function module() { - return µ.PolyChart(); -}; +/* + * modDateFormat: Support world calendars, and add one item to + * d3's vocabulary: + * %{n}f where n is the max number of digits of fractional seconds + */ +var fracMatch = /%\d?f/g; +function modDateFormat(fmt, x, formatter, calendar) { -µ.AreaChart.defaultConfig = function() { - var config = { - geometryConfig: { - geometryType: 'arc' - } - }; - return config; -}; + fmt = fmt.replace(fracMatch, function(match) { + var digits = Math.min(+(match.charAt(1)) || 6, 6); + var fracSecs = ((x / 1000 % 1) + 2) + .toFixed(digits) + .substr(2).replace(/0+$/, '') || '0'; + return fracSecs; + }); -µ.DotPlot = function module() { - return µ.PolyChart(); -}; + var d = new Date(Math.floor(x + 0.05)); -µ.DotPlot.defaultConfig = function() { - var config = { - geometryConfig: { - geometryType: 'dot', - dotType: 'circle' + if(isWorldCalendar(calendar)) { + try { + fmt = Registry.getComponentMethod('calendars', 'worldCalFmt')(fmt, x, calendar); } - }; - return config; -}; + catch(e) { + return 'Invalid'; + } + } + return formatter(fmt)(d); +} -µ.LinePlot = function module() { - return µ.PolyChart(); -}; +/* + * formatTime: create a time string from: + * x: milliseconds + * tr: tickround ('M', 'S', or # digits) + * only supports UTC times (where every day is 24 hours and 0 is at midnight) + */ +var MAXSECONDS = [59, 59.9, 59.99, 59.999, 59.9999]; +function formatTime(x, tr) { + var timePart = mod(x + 0.05, ONEDAY); -µ.LinePlot.defaultConfig = function() { - var config = { - geometryConfig: { - geometryType: 'line' - } - }; - return config; -}; + var timeStr = lpad(Math.floor(timePart / ONEHOUR), 2) + ':' + + lpad(mod(Math.floor(timePart / ONEMIN), 60), 2); -µ.Legend = function module() { - var config = µ.Legend.defaultConfig(); - var dispatch = d3.dispatch('hover'); - function exports() { - var legendConfig = config.legendConfig; - var flattenData = config.data.map(function(d, i) { - return [].concat(d).map(function(dB, iB) { - var element = extendDeepAll({}, legendConfig.elements[i]); - element.name = dB; - element.color = [].concat(legendConfig.elements[i].color)[iB]; - return element; - }); - }); - var data = d3.merge(flattenData); - data = data.filter(function(d, i) { - return legendConfig.elements[i] && (legendConfig.elements[i].visibleInLegend || typeof legendConfig.elements[i].visibleInLegend === 'undefined'); - }); - if (legendConfig.reverseOrder) data = data.reverse(); - var container = legendConfig.container; - if (typeof container == 'string' || container.nodeName) container = d3.select(container); - var colors = data.map(function(d, i) { - return d.color; - }); - var lineHeight = legendConfig.fontSize; - var isContinuous = legendConfig.isContinuous == null ? typeof data[0] === 'number' : legendConfig.isContinuous; - var height = isContinuous ? legendConfig.height : lineHeight * data.length; - var legendContainerGroup = container.classed('legend-group', true); - var svg = legendContainerGroup.selectAll('svg').data([ 0 ]); - var svgEnter = svg.enter().append('svg').attr({ - width: 300, - height: height + lineHeight, - xmlns: 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink', - version: '1.1' - }); - svgEnter.append('g').classed('legend-axis', true); - svgEnter.append('g').classed('legend-marks', true); - var dataNumbered = d3.range(data.length); - var colorScale = d3.scale[isContinuous ? 'linear' : 'ordinal']().domain(dataNumbered).range(colors); - var dataScale = d3.scale[isContinuous ? 'linear' : 'ordinal']().domain(dataNumbered)[isContinuous ? 'range' : 'rangePoints']([ 0, height ]); - var shapeGenerator = function(_type, _size) { - var squareSize = _size * 3; - if (_type === 'line') { - return 'M' + [ [ -_size / 2, -_size / 12 ], [ _size / 2, -_size / 12 ], [ _size / 2, _size / 12 ], [ -_size / 2, _size / 12 ] ] + 'Z'; - } else if (d3.svg.symbolTypes.indexOf(_type) != -1) return d3.svg.symbol().type(_type).size(squareSize)(); else return d3.svg.symbol().type('square').size(squareSize)(); - }; - if (isContinuous) { - var gradient = svg.select('.legend-marks').append('defs').append('linearGradient').attr({ - id: 'grad1', - x1: '0%', - y1: '0%', - x2: '0%', - y2: '100%' - }).selectAll('stop').data(colors); - gradient.enter().append('stop'); - gradient.attr({ - offset: function(d, i) { - return i / (colors.length - 1) * 100 + '%'; - } - }).style({ - 'stop-color': function(d, i) { - return d; - } - }); - svg.append('rect').classed('legend-mark', true).attr({ - height: legendConfig.height, - width: legendConfig.colorBandWidth, - fill: 'url(#grad1)' - }); - } else { - var legendElement = svg.select('.legend-marks').selectAll('path.legend-mark').data(data); - legendElement.enter().append('path').classed('legend-mark', true); - legendElement.attr({ - transform: function(d, i) { - return 'translate(' + [ lineHeight / 2, dataScale(i) + lineHeight / 2 ] + ')'; - }, - d: function(d, i) { - var symbolType = d.symbol; - return shapeGenerator(symbolType, lineHeight); - }, - fill: function(d, i) { - return colorScale(i); - } - }); - legendElement.exit().remove(); + if(tr !== 'M') { + if(!isNumeric(tr)) tr = 0; // should only be 'S' + + /* + * this is a weird one - and shouldn't come up unless people + * monkey with tick0 in weird ways, but we need to do something! + * IN PARTICULAR we had better not display garbage (see below) + * for numbers we always round to the nearest increment of the + * precision we're showing, and this seems like the right way to + * handle seconds and milliseconds, as they have a decimal point + * and people will interpret that to mean rounding like numbers. + * but for larger increments we floor the value: it's always + * 2013 until the ball drops on the new year. We could argue about + * which field it is where we start rounding (should 12:08:59 + * round to 12:09 if we're stopping at minutes?) but for now I'll + * say we round seconds but floor everything else. BUT that means + * we need to never round up to 60 seconds, ie 23:59:60 + */ + var sec = Math.min(mod(x / ONESEC, 60), MAXSECONDS[tr]); + + var secStr = (100 + sec).toFixed(tr).substr(1); + if(tr > 0) { + secStr = secStr.replace(/0+$/, '').replace(/[\.]$/, ''); + } + + timeStr += ':' + secStr; + } + return timeStr; +} + +/* + * formatDate: turn a date into tick or hover label text. + * + * x: milliseconds, the value to convert + * fmt: optional, an explicit format string (d3 format, even for world calendars) + * tr: tickround ('y', 'm', 'd', 'M', 'S', or # digits) + * used if no explicit fmt is provided + * formatter: locale-aware d3 date formatter for standard gregorian calendars + * should be the result of exports.getD3DateFormat(gd) + * calendar: optional string, the world calendar system to use + * + * returns the date/time as a string, potentially with the leading portion + * on a separate line (after '\n') + * Note that this means if you provide an explicit format which includes '\n' + * the axis may choose to strip things after it when they don't change from + * one tick to the next (as it does with automatic formatting) + */ +exports.formatDate = function(x, fmt, tr, formatter, calendar, extraFormat) { + calendar = isWorldCalendar(calendar) && calendar; + + if(!fmt) { + if(tr === 'y') fmt = extraFormat.year; + else if(tr === 'm') fmt = extraFormat.month; + else if(tr === 'd') { + fmt = extraFormat.dayMonth + '\n' + extraFormat.year; + } + else { + return formatTime(x, tr) + '\n' + modDateFormat(extraFormat.dayMonthYear, x, formatter, calendar); } - var legendAxis = d3.svg.axis().scale(dataScale).orient('right'); - var axis = svg.select('g.legend-axis').attr({ - transform: 'translate(' + [ isContinuous ? legendConfig.colorBandWidth : lineHeight, lineHeight / 2 ] + ')' - }).call(legendAxis); - axis.selectAll('.domain').style({ - fill: 'none', - stroke: 'none' - }); - axis.selectAll('line').style({ - fill: 'none', - stroke: isContinuous ? legendConfig.textColor : 'none' - }); - axis.selectAll('text').style({ - fill: legendConfig.textColor, - 'font-size': legendConfig.fontSize - }).text(function(d, i) { - return data[i].name; - }); - return exports; } - exports.config = function(_x) { - if (!arguments.length) return config; - extendDeepAll(config, _x); - return this; - }; - d3.rebind(exports, dispatch, 'on'); - return exports; + + return modDateFormat(fmt, x, formatter, calendar); }; -µ.Legend.defaultConfig = function(d, i) { - var config = { - data: [ 'a', 'b', 'c' ], - legendConfig: { - elements: [ { - symbol: 'line', - color: 'red' - }, { - symbol: 'square', - color: 'yellow' - }, { - symbol: 'diamond', - color: 'limegreen' - } ], - height: 150, - colorBandWidth: 30, - fontSize: 12, - container: 'body', - isContinuous: null, - textColor: 'grey', - reverseOrder: false +/* + * incrementMonth: make a new milliseconds value from the given one, + * having changed the month + * + * special case for world calendars: multiples of 12 are treated as years, + * even for calendar systems that don't have (always or ever) 12 months/year + * TODO: perhaps we need a different code for year increments to support this? + * + * ms (number): the initial millisecond value + * dMonth (int): the (signed) number of months to shift + * calendar (string): the calendar system to use + * + * changing month does not (and CANNOT) always preserve day, since + * months have different lengths. The worst example of this is: + * d = new Date(1970,0,31); d.setMonth(1) -> Feb 31 turns into Mar 3 + * + * But we want to be able to iterate over the last day of each month, + * regardless of what its number is. + * So shift 3 days forward, THEN set the new month, then unshift: + * 1/31 -> 2/28 (or 29) -> 3/31 -> 4/30 -> ... + * + * Note that odd behavior still exists if you start from the 26th-28th: + * 1/28 -> 2/28 -> 3/31 + * but at least you can't shift any dates into the wrong month, + * and ticks on these days incrementing by month would be very unusual + */ +var THREEDAYS = 3 * ONEDAY; +exports.incrementMonth = function(ms, dMonth, calendar) { + calendar = isWorldCalendar(calendar) && calendar; + + // pull time out and operate on pure dates, then add time back at the end + // this gives maximum precision - not that we *normally* care if we're + // incrementing by month, but better to be safe! + var timeMs = mod(ms, ONEDAY); + ms = Math.round(ms - timeMs); + + if(calendar) { + try { + var dateJD = Math.round(ms / 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 ' + ms + ' in calendar ' + calendar); + // then keep going in gregorian even though the result will be 'Invalid' } - }; - return config; -}; + } -µ.tooltipPanel = function() { - var tooltipEl, tooltipTextEl, backgroundEl; - var config = { - container: null, - hasTick: false, - fontSize: 12, - color: 'white', - padding: 5 - }; - var id = 'tooltip-' + µ.tooltipPanel.uid++; - var tickSize = 10; - var exports = function() { - tooltipEl = config.container.selectAll('g.' + id).data([ 0 ]); - var tooltipEnter = tooltipEl.enter().append('g').classed(id, true).style({ - 'pointer-events': 'none', - display: 'none' - }); - backgroundEl = tooltipEnter.append('path').style({ - fill: 'white', - 'fill-opacity': .9 - }).attr({ - d: 'M0 0' - }); - tooltipTextEl = tooltipEnter.append('text').attr({ - dx: config.padding + tickSize, - dy: +config.fontSize * .3 - }); - return exports; - }; - exports.text = function(_text) { - var l = d3.hsl(config.color).l; - var strokeColor = l >= .5 ? '#aaa' : 'white'; - var fillColor = l >= .5 ? 'black' : 'white'; - var text = _text || ''; - tooltipTextEl.style({ - fill: fillColor, - 'font-size': config.fontSize + 'px' - }).text(text); - var padding = config.padding; - var bbox = tooltipTextEl.node().getBBox(); - var boxStyle = { - fill: config.color, - stroke: strokeColor, - 'stroke-width': '2px' - }; - var backGroundW = bbox.width + padding * 2 + tickSize; - var backGroundH = bbox.height + padding * 2; - backgroundEl.attr({ - d: 'M' + [ [ tickSize, -backGroundH / 2 ], [ tickSize, -backGroundH / 4 ], [ config.hasTick ? 0 : tickSize, 0 ], [ tickSize, backGroundH / 4 ], [ tickSize, backGroundH / 2 ], [ backGroundW, backGroundH / 2 ], [ backGroundW, -backGroundH / 2 ] ].join('L') + 'Z' - }).style(boxStyle); - tooltipEl.attr({ - transform: 'translate(' + [ tickSize, -backGroundH / 2 + padding * 2 ] + ')' - }); - tooltipEl.style({ - display: 'block' - }); - return exports; - }; - exports.move = function(_pos) { - if (!tooltipEl) return; - tooltipEl.attr({ - transform: 'translate(' + [ _pos[0], _pos[1] ] + ')' - }).style({ - display: 'block' - }); - return exports; - }; - exports.hide = function() { - if (!tooltipEl) return; - tooltipEl.style({ - display: 'none' - }); - return exports; - }; - exports.show = function() { - if (!tooltipEl) return; - tooltipEl.style({ - display: 'block' - }); - return exports; - }; - exports.config = function(_x) { - extendDeepAll(config, _x); - return exports; - }; - return exports; + var y = new Date(ms + THREEDAYS); + return y.setUTCMonth(y.getUTCMonth() + dMonth) + timeMs - THREEDAYS; }; -µ.tooltipPanel.uid = 1; +/* + * findExactDates: what fraction of data is exact days, months, or years? + * + * data: array of millisecond values + * calendar (string) the calendar to test against + */ +exports.findExactDates = function(data, calendar) { + var exactYears = 0; + var exactMonths = 0; + var exactDays = 0; + var blankCount = 0; + var d; + var di; -µ.adapter = {}; + var calInstance = ( + isWorldCalendar(calendar) && + Registry.getComponentMethod('calendars', 'getCal')(calendar) + ); -µ.adapter.plotly = function module() { - var exports = {}; - exports.convert = function(_inputConfig, reverse) { - var outputConfig = {}; - if (_inputConfig.data) { - outputConfig.data = _inputConfig.data.map(function(d, i) { - var r = extendDeepAll({}, d); - var toTranslate = [ - [ r, [ 'marker', 'color' ], [ 'color' ] ], - [ r, [ 'marker', 'opacity' ], [ 'opacity' ] ], - [ r, [ 'marker', 'line', 'color' ], [ 'strokeColor' ] ], - [ r, [ 'marker', 'line', 'dash' ], [ 'strokeDash' ] ], - [ r, [ 'marker', 'line', 'width' ], [ 'strokeSize' ] ], - [ r, [ 'marker', 'symbol' ], [ 'dotType' ] ], - [ r, [ 'marker', 'size' ], [ 'dotSize' ] ], - [ r, [ 'marker', 'barWidth' ], [ 'barWidth' ] ], - [ r, [ 'line', 'interpolation' ], [ 'lineInterpolation' ] ], - [ r, [ 'showlegend' ], [ 'visibleInLegend' ] ] - ]; - toTranslate.forEach(function(d, i) { - µ.util.translator.apply(null, d.concat(reverse)); - }); + for(var i = 0; i < data.length; i++) { + di = data[i]; - if (!reverse) delete r.marker; - if (reverse) delete r.groupId; - if (!reverse) { - if (r.type === 'scatter') { - if (r.mode === 'lines') r.geometry = 'LinePlot'; else if (r.mode === 'markers') r.geometry = 'DotPlot'; else if (r.mode === 'lines+markers') { - r.geometry = 'LinePlot'; - r.dotVisible = true; - } - } else if (r.type === 'area') r.geometry = 'AreaChart'; else if (r.type === 'bar') r.geometry = 'BarChart'; - delete r.mode; - delete r.type; - } else { - if (r.geometry === 'LinePlot') { - r.type = 'scatter'; - if (r.dotVisible === true) { - delete r.dotVisible; - r.mode = 'lines+markers'; - } else r.mode = 'lines'; - } else if (r.geometry === 'DotPlot') { - r.type = 'scatter'; - r.mode = 'markers'; - } else if (r.geometry === 'AreaChart') r.type = 'area'; else if (r.geometry === 'BarChart') r.type = 'bar'; - delete r.geometry; - } - return r; - }); - if (!reverse && _inputConfig.layout && _inputConfig.layout.barmode === 'stack') { - var duplicates = µ.util.duplicates(outputConfig.data.map(function(d, i) { - return d.geometry; - })); - outputConfig.data.forEach(function(d, i) { - var idx = duplicates.indexOf(d.geometry); - if (idx != -1) outputConfig.data[i].groupId = idx; - }); - } + // not date data at all + if(!isNumeric(di)) { + blankCount ++; + continue; } - if (_inputConfig.layout) { - var r = extendDeepAll({}, _inputConfig.layout); - var toTranslate = [ - [ r, [ 'plot_bgcolor' ], [ 'backgroundColor' ] ], - [ r, [ 'showlegend' ], [ 'showLegend' ] ], - [ r, [ 'radialaxis' ], [ 'radialAxis' ] ], - [ r, [ 'angularaxis' ], [ 'angularAxis' ] ], - [ r.angularaxis, [ 'showline' ], [ 'gridLinesVisible' ] ], - [ r.angularaxis, [ 'showticklabels' ], [ 'labelsVisible' ] ], - [ r.angularaxis, [ 'nticks' ], [ 'ticksCount' ] ], - [ r.angularaxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], - [ r.angularaxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], - [ r.angularaxis, [ 'range' ], [ 'domain' ] ], - [ r.angularaxis, [ 'endpadding' ], [ 'endPadding' ] ], - [ r.radialaxis, [ 'showline' ], [ 'gridLinesVisible' ] ], - [ r.radialaxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], - [ r.radialaxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], - [ r.radialaxis, [ 'range' ], [ 'domain' ] ], - [ r.angularAxis, [ 'showline' ], [ 'gridLinesVisible' ] ], - [ r.angularAxis, [ 'showticklabels' ], [ 'labelsVisible' ] ], - [ r.angularAxis, [ 'nticks' ], [ 'ticksCount' ] ], - [ r.angularAxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], - [ r.angularAxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], - [ r.angularAxis, [ 'range' ], [ 'domain' ] ], - [ r.angularAxis, [ 'endpadding' ], [ 'endPadding' ] ], - [ r.radialAxis, [ 'showline' ], [ 'gridLinesVisible' ] ], - [ r.radialAxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], - [ r.radialAxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], - [ r.radialAxis, [ 'range' ], [ 'domain' ] ], - [ r.font, [ 'outlinecolor' ], [ 'outlineColor' ] ], - [ r.legend, [ 'traceorder' ], [ 'reverseOrder' ] ], - [ r, [ 'labeloffset' ], [ 'labelOffset' ] ], - [ r, [ 'defaultcolorrange' ], [ 'defaultColorRange' ] ] - ]; - toTranslate.forEach(function(d, i) { - µ.util.translator.apply(null, d.concat(reverse)); - }); - if (!reverse) { - if (r.angularAxis && typeof r.angularAxis.ticklen !== 'undefined') r.tickLength = r.angularAxis.ticklen; - if (r.angularAxis && typeof r.angularAxis.tickcolor !== 'undefined') r.tickColor = r.angularAxis.tickcolor; - } else { - if (typeof r.tickLength !== 'undefined') { - r.angularaxis.ticklen = r.tickLength; - delete r.tickLength; - } - if (r.tickColor) { - r.angularaxis.tickcolor = r.tickColor; - delete r.tickColor; + // not an exact date + if(di % ONEDAY) continue; + + if(calInstance) { + try { + d = calInstance.fromJD(di / ONEDAY + EPOCHJD); + if(d.day() === 1) { + if(d.month() === 1) exactYears++; + else exactMonths++; } + else exactDays++; } - if (r.legend && typeof r.legend.reverseOrder != 'boolean') { - r.legend.reverseOrder = r.legend.reverseOrder != 'normal'; + catch(e) { + // invalid date in this calendar - ignore it here. } - if (r.legend && typeof r.legend.traceorder == 'boolean') { - r.legend.traceorder = r.legend.traceorder ? 'reversed' : 'normal'; - delete r.legend.reverseOrder; + } + else { + d = new Date(di); + if(d.getUTCDate() === 1) { + if(d.getUTCMonth() === 0) exactYears++; + else exactMonths++; } - if (r.margin && typeof r.margin.t != 'undefined') { - var source = [ 't', 'r', 'b', 'l', 'pad' ]; - var target = [ 'top', 'right', 'bottom', 'left', 'pad' ]; - var margin = {}; - d3.entries(r.margin).forEach(function(dB, iB) { - margin[target[source.indexOf(dB.key)]] = dB.value; - }); - r.margin = margin; + else exactDays++; + } + } + exactMonths += exactYears; + exactDays += exactMonths; + + var dataCount = data.length - blankCount; + + return { + exactYears: exactYears / dataCount, + exactMonths: exactMonths / dataCount, + exactDays: exactDays / dataCount + }; +}; + +},{"../constants/numerical":140,"../registry":243,"./loggers":163,"./mod":166,"d3":8,"fast-isnumeric":10}],152:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +/* global jQuery:false */ + +var EventEmitter = _dereq_('events').EventEmitter; + +var Events = { + + init: function(plotObj) { + + /* + * If we have already instantiated an emitter for this plot + * return early. + */ + if(plotObj._ev instanceof EventEmitter) return plotObj; + + var ev = new EventEmitter(); + var internalEv = new EventEmitter(); + + /* + * Assign to plot._ev while we still live in a land + * where plot is a DOM element with stuff attached to it. + * In the future we can make plot the event emitter itself. + */ + plotObj._ev = ev; + + /* + * Create a second event handler that will manage events *internally*. + * This allows parts of plotly to respond to thing like relayout without + * having to use the user-facing event handler. They cannot peacefully + * coexist on the same handler because a user invoking + * plotObj.removeAllListeners() would detach internal events, breaking + * plotly. + */ + plotObj._internalEv = internalEv; + + /* + * Assign bound methods from the ev to the plot object. These methods + * will reference the 'this' of plot._ev even though they are methods + * of plot. This will keep the event machinery away from the plot object + * which currently is often a DOM element but presents an API that will + * continue to function when plot becomes an emitter. Not all EventEmitter + * methods have been bound to `plot` as some do not currently add value to + * the Plotly event API. + */ + plotObj.on = ev.on.bind(ev); + plotObj.once = ev.once.bind(ev); + plotObj.removeListener = ev.removeListener.bind(ev); + plotObj.removeAllListeners = ev.removeAllListeners.bind(ev); + + /* + * Create functions for managing internal events. These are *only* triggered + * by the mirroring of external events via the emit function. + */ + plotObj._internalOn = internalEv.on.bind(internalEv); + plotObj._internalOnce = internalEv.once.bind(internalEv); + plotObj._removeInternalListener = internalEv.removeListener.bind(internalEv); + plotObj._removeAllInternalListeners = internalEv.removeAllListeners.bind(internalEv); + + /* + * We must wrap emit to continue to support JQuery events. The idea + * is to check to see if the user is using JQuery events, if they are + * we emit JQuery events to trigger user handlers as well as the EventEmitter + * events. + */ + plotObj.emit = function(event, data) { + if(typeof jQuery !== 'undefined') { + jQuery(plotObj).trigger(event, data); } - if (reverse) { - delete r.needsEndSpacing; - delete r.minorTickColor; - delete r.minorTicks; - delete r.angularaxis.ticksCount; - delete r.angularaxis.ticksCount; - delete r.angularaxis.ticksStep; - delete r.angularaxis.rewriteTicks; - delete r.angularaxis.nticks; - delete r.radialaxis.ticksCount; - delete r.radialaxis.ticksCount; - delete r.radialaxis.ticksStep; - delete r.radialaxis.rewriteTicks; - delete r.radialaxis.nticks; + + ev.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 jQuery exists run all its handlers for this event and + * collect the return value of the LAST handler function + */ + if(typeof jQuery !== 'undefined') { + jQueryHandlerValue = jQuery(plotObj).triggerHandler(event, data); + } + + /* + * Now run all the node style event handlers + */ + var ev = plotObj._ev; + if(!ev) return jQueryHandlerValue; + + var handlers = ev._events[event]; + if(!handlers) return jQueryHandlerValue; + + // making sure 'this' is the EventEmitter instance + function apply(handler) { + // The 'once' case, we can't just call handler() as we need + // the return value here. So, + // - remove handler + // - call listener and grab return value! + // - stash 'fired' key to not call handler twice + if(handler.listener) { + ev.removeListener(event, handler.listener); + if(!handler.fired) { + handler.fired = true; + return handler.listener.apply(ev, [data]); + } + } else { + return handler.apply(ev, [data]); } - outputConfig.layout = r; } - return outputConfig; - }; - return exports; + + // handlers can be function or an array of functions + handlers = Array.isArray(handlers) ? handlers : [handlers]; + + var i; + for(i = 0; i < handlers.length - 1; i++) { + apply(handlers[i]); + } + // now call the final handler and collect its value + nodeEventHandlerValue = apply(handlers[i]); + + /* + * Return either the jQuery handler value if it exists or the + * nodeEventHandler value. jQuery event value supersedes nodejs + * events for backwards compatibility reasons. + */ + return jQueryHandlerValue !== undefined ? + 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; + } + }; -},{"../../../constants/alignment":668,"../../../lib":696,"d3":148}],818:[function(_dereq_,module,exports){ +module.exports = Events; + +},{"events":7}],153:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -/* eslint-disable new-cap */ 'use strict'; -var d3 = _dereq_('d3'); -var Lib = _dereq_('../../../lib'); -var Color = _dereq_('../../../components/color'); +var isPlainObject = _dereq_('./is_plain_object.js'); +var isArray = Array.isArray; -var micropolar = _dereq_('./micropolar'); -var UndoManager = _dereq_('./undo_manager'); -var extendDeepAll = Lib.extendDeepAll; +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; +} -var manager = module.exports = {}; +exports.extendFlat = function() { + return _extend(arguments, false, false, false); +}; -manager.framework = function(_gd) { - var config, previousConfigClone, plot, convertedInput, container; - var undoManager = new UndoManager(); +exports.extendDeep = function() { + return _extend(arguments, true, false, false); +}; - function exports(_inputConfig, _container) { - if(_container) container = _container; - d3.select(d3.select(container).node().parentNode).selectAll('.svg-container>*:not(.chart-root)').remove(); +exports.extendDeepAll = function() { + return _extend(arguments, true, true, false); +}; - config = (!config) ? - _inputConfig : - extendDeepAll(config, _inputConfig); +exports.extendDeepNoArrays = function() { + return _extend(arguments, true, false, true); +}; - if(!plot) plot = micropolar.Axis(); - convertedInput = micropolar.adapter.plotly().convert(config); - plot.config(convertedInput).render(container); - _gd.data = config.data; - _gd.layout = config.layout; - manager.fillLayout(_gd); - return config; +/* + * Inspired by https://github.com/justmoon/node-extend/blob/master/index.js + * All credit to the jQuery authors for perfecting this amazing utility. + * + * API difference with jQuery version: + * - No optional boolean (true -> deep extend) first argument, + * use `extendFlat` for first-level only extend and + * use `extendDeep` for a deep extend. + * + * Other differences with jQuery version: + * - Uses a modern (and faster) isPlainObject routine. + * - Expected to work with object {} and array [] arguments only. + * - Does not check for circular structure. + * FYI: jQuery only does a check across one level. + * Warning: this might result in infinite loops. + * + */ +function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { + var target = inputs[0]; + var length = inputs.length; + + var input, key, src, copy, copyIsArray, clone, allPrimitives; + + // TODO does this do the right thing for typed arrays? + + 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); // reset target and continue to next block + } } - exports.isPolar = true; - exports.svg = function() { return plot.svg(); }; - exports.getConfig = function() { return config; }; - exports.getLiveConfig = function() { - return micropolar.adapter.plotly().convert(plot.getLiveConfig(), true); - }; - exports.getLiveScales = function() { return {t: plot.angularScale(), r: plot.radialScale()}; }; - exports.setUndoPoint = function() { - var that = this; - var configClone = micropolar.util.cloneJson(config); - (function(_configClone, _previousConfigClone) { - undoManager.add({ - undo: function() { - if(_previousConfigClone) that(_previousConfigClone); - }, - redo: function() { - that(_configClone); + + for(var i = 1; i < length; i++) { + input = inputs[i]; + + for(key in input) { + src = target[key]; + copy = input[key]; + + // Stop early and just transfer the array if array copies are disallowed: + if(noArrayCopies && isArray(copy)) { + target[key] = copy; + } + + // recurse if we're merging plain objects or arrays + else if(isDeep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if(copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; } - }); - })(configClone, previousConfigClone); - previousConfigClone = micropolar.util.cloneJson(configClone); - }; - exports.undo = function() { undoManager.undo(); }; - exports.redo = function() { undoManager.redo(); }; - return exports; -}; -manager.fillLayout = function(_gd) { - var container = d3.select(_gd).selectAll('.plot-container'), - paperDiv = container.selectAll('.svg-container'), - paper = _gd.framework && _gd.framework.svg && _gd.framework.svg(), - dflts = { - width: 800, - height: 600, - paper_bgcolor: Color.background, - _container: container, - _paperdiv: paperDiv, - _paper: paper - }; + // never move original objects, clone them + target[key] = _extend([clone, copy], isDeep, keepAllKeys, noArrayCopies); + } - _gd._fullLayout = extendDeepAll(dflts, _gd.layout); -}; + // don't bring in undefined values, except for extendDeepAll + else if(typeof copy !== 'undefined' || keepAllKeys) { + target[key] = copy; + } + } + } + + return target; +} -},{"../../../components/color":570,"../../../lib":696,"./micropolar":817,"./undo_manager":819,"d3":148}],819:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":160}],154:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -// Modified from https://github.com/ArthurClemens/Javascript-Undo-Manager -// Copyright (c) 2010-2013 Arthur Clemens, arthur@visiblearea.com -module.exports = function UndoManager() { - var undoCommands = [], - index = -1, - isExecuting = false, - callback; - function execute(command, action) { - if(!command) return this; +/** + * Return news array containing only the unique items + * found in input array. + * + * IMPORTANT: Note that items are considered unique + * if `String({})` is unique. For example; + * + * Lib.filterUnique([ { a: 1 }, { b: 2 } ]) + * + * returns [{ a: 1 }] + * + * and + * + * Lib.filterUnique([ '1', 1 ]) + * + * returns ['1'] + * + * + * @param {array} array base array + * @return {array} new filtered array + */ +module.exports = function filterUnique(array) { + var seen = {}; + var out = []; + var j = 0; - isExecuting = true; - command[action](); - isExecuting = false; + for(var i = 0; i < array.length; i++) { + var item = array[i]; - return this; + if(seen[item] !== 1) { + seen[item] = 1; + out[j++] = item; + } } - return { - add: function(command) { - if(isExecuting) return this; - undoCommands.splice(index + 1, undoCommands.length - index); - undoCommands.push(command); - index = undoCommands.length - 1; - return this; - }, - setCallback: function(callbackFunc) { callback = callbackFunc; }, - undo: function() { - var command = undoCommands[index]; - if(!command) return this; - execute(command, 'undo'); - index -= 1; - if(callback) callback(command.undo); - return this; - }, - redo: function() { - var command = undoCommands[index + 1]; - if(!command) return this; - execute(command, 'redo'); - index += 1; - if(callback) callback(command.redo); - return this; - }, - clear: function() { - undoCommands = []; - index = -1; - }, - hasUndo: function() { return index !== -1; }, - hasRedo: function() { return index < (undoCommands.length - 1); }, - getCommands: function() { return undoCommands; }, - getPreviousCommand: function() { return undoCommands[index - 1]; }, - getIndex: function() { return index; } - }; + return out; }; -},{}],820:[function(_dereq_,module,exports){ +},{}],155:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132614,3162 +35845,2364 @@ 'use strict'; -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); +/** Filter out object items with visible !== true + * insider array container. + * + * @param {array of objects} container + * @return {array of objects} of length <= container + * + */ +module.exports = function filterVisible(container) { + var filterFn = isCalcData(container) ? calcDataFilter : baseFilter; + var out = []; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Plots = _dereq_('../plots'); -var setConvertCartesian = _dereq_('../cartesian/set_convert'); -var setConvertPolar = _dereq_('./set_convert'); -var doAutoRange = _dereq_('../cartesian/autorange').doAutoRange; -var doTicksSingle = _dereq_('../cartesian/axes').doTicksSingle; -var dragBox = _dereq_('../cartesian/dragbox'); -var dragElement = _dereq_('../../components/dragelement'); -var Fx = _dereq_('../../components/fx'); -var Titles = _dereq_('../../components/titles'); -var prepSelect = _dereq_('../cartesian/select').prepSelect; -var selectOnClick = _dereq_('../cartesian/select').selectOnClick; -var clearSelect = _dereq_('../cartesian/select').clearSelect; -var setCursor = _dereq_('../../lib/setcursor'); -var clearGlCanvases = _dereq_('../../lib/clear_gl_canvases'); -var redrawReglTraces = _dereq_('../../plot_api/subroutines').redrawReglTraces; + for(var i = 0; i < container.length; i++) { + var item = container[i]; + if(filterFn(item)) out.push(item); + } -var MID_SHIFT = _dereq_('../../constants/alignment').MID_SHIFT; -var constants = _dereq_('./constants'); -var helpers = _dereq_('./helpers'); + return out; +}; -var _ = Lib._; -var mod = Lib.mod; -var deg2rad = Lib.deg2rad; -var rad2deg = Lib.rad2deg; +function baseFilter(item) { + return item.visible === true; +} -function Polar(gd, id) { - this.id = id; - this.gd = gd; +function calcDataFilter(item) { + return item[0].trace.visible === true; +} - this._hasClipOnAxisFalse = null; - this.vangles = null; - this.radialAxisAngle = null; - this.traceHash = {}; - this.layers = {}; - this.clipPaths = {}; - this.clipIds = {}; - this.viewInitial = {}; +function isCalcData(cont) { + return ( + Array.isArray(cont) && + Array.isArray(cont[0]) && + cont[0][0] && + cont[0][0].trace + ); +} - var fullLayout = gd._fullLayout; - var clipIdBase = 'clip' + fullLayout._uid + id; +},{}],156:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; - this.clipIds.forTraces = clipIdBase + '-for-traces'; - this.clipPaths.forTraces = fullLayout._clips.append('clipPath') - .attr('id', this.clipIds.forTraces); - this.clipPaths.forTraces.append('path'); +var mod = _dereq_('./mod').mod; - this.framework = fullLayout._polarlayer.append('g') - .attr('class', id); +/* + * look for intersection of two line segments + * (1->2 and 3->4) - returns array [x,y] if they do, null if not + */ +exports.segmentsIntersect = segmentsIntersect; +function segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { + var a = x2 - x1; + var b = x3 - x1; + var c = x4 - x3; + var d = y2 - y1; + var e = y3 - y1; + var f = y4 - y3; + var det = a * f - c * d; + // parallel lines? intersection is undefined + // ignore the case where they are colinear + if(det === 0) return null; + var t = (b * f - c * e) / det; + var u = (b * d - a * e) / det; + // segments do not intersect? + if(u < 0 || u > 1 || t < 0 || t > 1) return null; - // unfortunately, we have to keep track of some axis tick settings - // so that we don't have to call doTicksSingle with its special redraw flag - this.radialTickLayout = null; - this.angularTickLayout = null; + return {x: x1 + a * t, y: y1 + d * t}; } -var proto = Polar.prototype; +/* + * find the minimum distance between two line segments (1->2 and 3->4) + */ +exports.segmentDistance = function segmentDistance(x1, y1, x2, y2, x3, y3, x4, y4) { + if(segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4)) return 0; + + // the two segments and their lengths squared + var x12 = x2 - x1; + var y12 = y2 - y1; + var x34 = x4 - x3; + var y34 = y4 - y3; + var ll12 = x12 * x12 + y12 * y12; + var ll34 = x34 * x34 + y34 * y34; + + // calculate distance squared, then take the sqrt at the very end + var dist2 = Math.min( + perpDistance2(x12, y12, ll12, x3 - x1, y3 - y1), + perpDistance2(x12, y12, ll12, x4 - x1, y4 - y1), + perpDistance2(x34, y34, ll34, x1 - x3, y1 - y3), + perpDistance2(x34, y34, ll34, x2 - x3, y2 - y3) + ); -module.exports = function createPolar(gd, id) { - return new Polar(gd, id); + return Math.sqrt(dist2); }; -proto.plot = function(polarCalcData, fullLayout) { - var _this = this; - var polarLayout = fullLayout[_this.id]; +/* + * distance squared from segment ab to point c + * [xab, yab] is the vector b-a + * [xac, yac] is the vector c-a + * llab is the length squared of (b-a), just to simplify calculation + */ +function perpDistance2(xab, yab, llab, xac, yac) { + var fcAB = (xac * xab + yac * yab); + if(fcAB < 0) { + // point c is closer to point a + return xac * xac + yac * yac; + } + else if(fcAB > llab) { + // point c is closer to point b + var xbc = xac - xab; + var ybc = yac - yab; + return xbc * xbc + ybc * ybc; + } + else { + // perpendicular distance is the shortest + var crossProduct = xac * yab - yac * xab; + return crossProduct * crossProduct / llab; + } +} - _this._hasClipOnAxisFalse = false; - for(var i = 0; i < polarCalcData.length; i++) { - var trace = polarCalcData[i][0].trace; - if(trace.cliponaxis === false) { - _this._hasClipOnAxisFalse = true; - break; - } +// a very short-term cache for getTextLocation, just because +// we're often looping over the same locations multiple times +// invalidated as soon as we look at a different path +var locationCache, workingPath, workingTextWidth; + +// turn a path and position along it into x, y, and angle for the given text +exports.getTextLocation = function getTextLocation(path, totalPathLen, positionOnPath, textWidth) { + if(path !== workingPath || textWidth !== workingTextWidth) { + locationCache = {}; + workingPath = path; + workingTextWidth = textWidth; + } + if(locationCache[positionOnPath]) { + return locationCache[positionOnPath]; + } + + // for the angle, use points on the path separated by the text width + // even though due to curvature, the text will cover a bit more than that + var p0 = path.getPointAtLength(mod(positionOnPath - textWidth / 2, totalPathLen)); + var p1 = path.getPointAtLength(mod(positionOnPath + textWidth / 2, totalPathLen)); + // note: atan handles 1/0 nicely + var theta = Math.atan((p1.y - p0.y) / (p1.x - p0.x)); + // center the text at 2/3 of the center position plus 1/3 the p0/p1 midpoint + // that's the average position of this segment, assuming it's roughly quadratic + var pCenter = path.getPointAtLength(mod(positionOnPath, totalPathLen)); + var x = (pCenter.x * 4 + p0.x + p1.x) / 6; + var y = (pCenter.y * 4 + p0.y + p1.y) / 6; + + var out = {x: x, y: y, theta: theta}; + locationCache[positionOnPath] = out; + return out; +}; + +exports.clearLocationCache = function() { + workingPath = null; +}; + +/* + * Find the segment of `path` that's within the visible area + * given by `bounds` {left, right, top, bottom}, to within a + * precision of `buffer` px + * + * returns: undefined if nothing is visible, else object: + * { + * min: position where the path first enters bounds, or 0 if it + * starts within bounds + * max: position where the path last exits bounds, or the path length + * if it finishes within bounds + * len: max - min, ie the length of visible path + * total: the total path length - just included so the caller doesn't + * need to call path.getTotalLength() again + * isClosed: true iff the start and end points of the path are both visible + * and are at the same point + * } + * + * Works by starting from either end and repeatedly finding the distance from + * that point to the plot area, and if it's outside the plot, moving along the + * path by that distance (because the plot must be at least that far away on + * the path). Note that if a path enters, exits, and re-enters the plot, we + * will not capture this behavior. + */ +exports.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 pt = path.getPointAtLength(len); + + // hold on to the start and end points for `closed` + if(len === 0) pt0 = pt; + else if(len === pTotal) ptTotal = pt; + + var dx = (pt.x < left) ? left - pt.x : (pt.x > right ? pt.x - right : 0); + var dy = (pt.y < top) ? top - pt.y : (pt.y > bottom ? pt.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); } - _this.updateLayers(fullLayout, polarLayout); - _this.updateLayout(fullLayout, polarLayout); - Plots.generalUpdatePerTraceModule(_this.gd, _this, polarCalcData, polarLayout); - _this.updateFx(fullLayout, polarLayout); + 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 + }; }; -proto.updateLayers = function(fullLayout, polarLayout) { - var _this = this; - var layers = _this.layers; - var radialLayout = polarLayout.radialaxis; - var angularLayout = polarLayout.angularaxis; - var layerNames = constants.layerNames; - - var frontPlotIndex = layerNames.indexOf('frontplot'); - var layerData = layerNames.slice(0, frontPlotIndex); - var isAngularAxisBelowTraces = angularLayout.layer === 'below traces'; - var isRadialAxisBelowTraces = radialLayout.layer === 'below traces'; - - if(isAngularAxisBelowTraces) layerData.push('angular-line'); - if(isRadialAxisBelowTraces) layerData.push('radial-line'); - if(isAngularAxisBelowTraces) layerData.push('angular-axis'); - if(isRadialAxisBelowTraces) layerData.push('radial-axis'); - - layerData.push('frontplot'); - - if(!isAngularAxisBelowTraces) layerData.push('angular-line'); - if(!isRadialAxisBelowTraces) layerData.push('radial-line'); - if(!isAngularAxisBelowTraces) layerData.push('angular-axis'); - if(!isRadialAxisBelowTraces) layerData.push('radial-axis'); +/** + * Find point on SVG path corresponding to a given constraint coordinate + * + * @param {SVGPathElement} path + * @param {Number} val : constraint coordinate value + * @param {String} coord : 'x' or 'y' the constraint coordinate + * @param {Object} opts : + * - {Number} pathLength : supply total path length before hand + * - {Number} tolerance + * - {Number} iterationLimit + * @return {SVGPoint} + */ +exports.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 join = _this.framework.selectAll('.polarsublayer') - .data(layerData, String); + // if path starts at a val greater than the path tail (like on vertical violins), + // we must flip the sign of the computed diff. + var mul = path.getPointAtLength(0)[coord] > path.getPointAtLength(pathLength)[coord] ? -1 : 1; - join.enter().append('g') - .attr('class', function(d) { return 'polarsublayer ' + d;}) - .each(function(d) { - var sel = layers[d] = d3.select(this); + var i = 0; + var b0 = 0; + var b1 = pathLength; + var mid; + var pt; + var diff; - switch(d) { - case 'frontplot': - // TODO add option to place in 'backplot' layer?? - sel.append('g').classed('barlayer', true); - sel.append('g').classed('scatterlayer', true); - break; - case 'backplot': - sel.append('g').classed('maplayer', true); - break; - case 'plotbg': - layers.bg = sel.append('path'); - break; - case 'radial-grid': - sel.style('fill', 'none'); - sel.append('g').classed('x', 1); - break; - case 'angular-grid': - sel.style('fill', 'none'); - sel.append('g').classed('angularaxis', 1); - break; - case 'radial-line': - sel.append('line').style('fill', 'none'); - break; - case 'angular-line': - sel.append('path').style('fill', 'none'); - break; + while(i < iterationLimit) { + mid = (b0 + b1) / 2; + pt = path.getPointAtLength(mid); + diff = pt[coord] - val; + + if(Math.abs(diff) < tolerance) { + return pt; + } else { + if(mul * diff > 0) { + b1 = mid; + } else { + b0 = mid; } - }); - - join.order(); + i++; + } + } + return pt; }; -/* Polar subplots juggle with 6 'axis objects' (!), these are: +},{"./mod":166}],157:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +/** + * Allow referencing a graph DOM element either directly + * or by its id string * - * - polarLayout.radialaxis (aka radialLayout in this file): - * - polarLayout.angularaxis (aka angularLayout in this file): - * used for data -> calcdata conversions (aka d2c) during the calc step - * - * - this.radialAxis - * extends polarLayout.radialaxis, adds mocked 'domain' and - * few other keys in order to reuse Cartesian doAutoRange and doTicksSingle, - * used for calcdata -> geometric conversions (aka c2g) during the plot step - * + setGeometry setups ax.c2g for given ax.range - * + setScale setups ax._m,ax._b for given ax.range - * - * - this.angularAxis - * extends polarLayout.angularaxis, adds mocked 'range' and 'domain' and - * a few other keys in order to reuse Cartesian doTicksSingle, - * used for calcdata -> geometric conversions (aka c2g) during the plot step - * + setGeometry setups ax.c2g given ax.rotation, ax.direction & ax._categories, - * and mocks ax.range - * + setScale setups ax._m,ax._b with that mocked ax.range - * - * - this.xaxis - * - this.yaxis - * setup so that polar traces can reuse plot methods of Cartesian traces - * which mostly rely on 2pixel methods (e.g ax.c2p) + * @param {HTMLDivElement|string} gd: a graph element or its id + * + * @returns {HTMLDivElement} the DOM element of the graph */ -proto.updateLayout = function(fullLayout, polarLayout) { - var _this = this; - var layers = _this.layers; - var gs = fullLayout._size; +module.exports = function(gd) { + var gdElement; - // axis attributes - var radialLayout = polarLayout.radialaxis; - var angularLayout = polarLayout.angularaxis; - // layout domains - var xDomain = polarLayout.domain.x; - var yDomain = polarLayout.domain.y; - // offsets from paper edge to layout domain box - _this.xOffset = gs.l + gs.w * xDomain[0]; - _this.yOffset = gs.t + gs.h * (1 - yDomain[1]); - // lengths of the layout domain box - var xLength = _this.xLength = gs.w * (xDomain[1] - xDomain[0]); - var yLength = _this.yLength = gs.h * (yDomain[1] - yDomain[0]); - // sector to plot - var sector = polarLayout.sector; - _this.sectorInRad = sector.map(deg2rad); - var sectorBBox = _this.sectorBBox = computeSectorBBox(sector); - var dxSectorBBox = sectorBBox[2] - sectorBBox[0]; - var dySectorBBox = sectorBBox[3] - sectorBBox[1]; - // aspect ratios - var arDomain = yLength / xLength; - var arSector = Math.abs(dySectorBBox / dxSectorBBox); - // actual lengths and domains of subplot box - var xLength2, yLength2; - var xDomain2, yDomain2; - var gap; - if(arDomain > arSector) { - xLength2 = xLength; - yLength2 = xLength * arSector; - gap = (yLength - yLength2) / gs.h / 2; - xDomain2 = [xDomain[0], xDomain[1]]; - yDomain2 = [yDomain[0] + gap, yDomain[1] - gap]; - } else { - xLength2 = yLength / arSector; - yLength2 = yLength; - gap = (xLength - xLength2) / gs.w / 2; - xDomain2 = [xDomain[0] + gap, xDomain[1] - gap]; - yDomain2 = [yDomain[0], yDomain[1]]; - } - _this.xLength2 = xLength2; - _this.yLength2 = yLength2; - _this.xDomain2 = xDomain2; - _this.yDomain2 = yDomain2; - // actual offsets from paper edge to the subplot box top-left corner - var xOffset2 = _this.xOffset2 = gs.l + gs.w * xDomain2[0]; - var yOffset2 = _this.yOffset2 = gs.t + gs.h * (1 - yDomain2[1]); - // circle radius in px - var radius = _this.radius = xLength2 / dxSectorBBox; - // 'inner' radius in px (when polar.hole is set) - var innerRadius = _this.innerRadius = polarLayout.hole * radius; - // circle center position in px - var cx = _this.cx = xOffset2 - radius * sectorBBox[0]; - var cy = _this.cy = yOffset2 + radius * sectorBBox[3]; - // circle center in the coordinate system of plot area - var cxx = _this.cxx = cx - xOffset2; - var cyy = _this.cyy = cy - yOffset2; - - _this.radialAxis = _this.mockAxis(fullLayout, polarLayout, radialLayout, { - _axislayer: layers['radial-axis'], - _gridlayer: layers['radial-grid'], - // make this an 'x' axis to make positioning (especially rotation) easier - _id: 'x', - // convert to 'x' axis equivalent - side: { - counterclockwise: 'top', - clockwise: 'bottom' - }[radialLayout.side], - // spans length 1 radius - domain: [innerRadius / gs.w, radius / gs.w] - }); - - _this.angularAxis = _this.mockAxis(fullLayout, polarLayout, angularLayout, { - _axislayer: layers['angular-axis'], - _gridlayer: layers['angular-grid'], - side: 'right', - // to get auto nticks right - domain: [0, Math.PI], - // don't pass through autorange logic - autorange: false - }); - - _this.doAutoRange(fullLayout, polarLayout); - // N.B. this sets _this.vangles - _this.updateAngularAxis(fullLayout, polarLayout); - // N.B. this sets _this.radialAxisAngle - _this.updateRadialAxis(fullLayout, polarLayout); - _this.updateRadialAxisTitle(fullLayout, polarLayout); - - _this.xaxis = _this.mockCartesianAxis(fullLayout, polarLayout, { - _id: 'x', - domain: xDomain2 - }); - - _this.yaxis = _this.mockCartesianAxis(fullLayout, polarLayout, { - _id: 'y', - domain: yDomain2 - }); - - var dPath = _this.pathSubplot(); - - _this.clipPaths.forTraces.select('path') - .attr('d', dPath) - .attr('transform', strTranslate(cxx, cyy)); - - layers.frontplot - .attr('transform', strTranslate(xOffset2, yOffset2)) - .call(Drawing.setClipUrl, _this._hasClipOnAxisFalse ? null : _this.clipIds.forTraces); - - layers.bg - .attr('d', dPath) - .attr('transform', strTranslate(cx, cy)) - .call(Color.fill, polarLayout.bgcolor); - - // remove crispEdges - all the off-square angles in polar plots - // make these counterproductive. - _this.framework.selectAll('.crisp').classed('crisp', 0); -}; - -proto.mockAxis = function(fullLayout, polarLayout, axLayout, opts) { - var commonOpts = { - // to get _boundingBox computation right when showticklabels is false - anchor: 'free', - position: 0, - _pos: 0, - // dummy truthy value to make doTicksSingle draw the grid - _counteraxis: true, - // don't use automargins routine for labels - automargin: false - }; + if(typeof gd === 'string') { + gdElement = document.getElementById(gd); - var ax = Lib.extendFlat(commonOpts, axLayout, opts); - setConvertPolar(ax, polarLayout, fullLayout); - return ax; -}; + if(gdElement === null) { + throw new Error('No DOM element with id \'' + gd + '\' exists on the page.'); + } -proto.mockCartesianAxis = function(fullLayout, polarLayout, opts) { - var _this = this; - var axId = opts._id; + return gdElement; + } + else if(gd === null || gd === undefined) { + throw new Error('DOM element provided is null or undefined'); + } - var ax = Lib.extendFlat({type: 'linear'}, opts); - setConvertCartesian(ax, fullLayout); + return gd; // otherwise assume that gd is a DOM element +}; - var bboxIndices = { - x: [0, 2], - y: [1, 3] - }; +},{}],158:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - ax.setRange = function() { - var sectorBBox = _this.sectorBBox; - var ind = bboxIndices[axId]; - var rl = _this.radialAxis._rl; - var drl = (rl[1] - rl[0]) / (1 - polarLayout.hole); - ax.range = [sectorBBox[ind[0]] * drl, sectorBBox[ind[1]] * drl]; - }; +'use strict'; - ax.isPtWithinRange = axId === 'x' ? - function(d) { return _this.isPtInside(d); } : - function() { return true; }; +// Simple helper functions +// none of these need any external deps - ax.setRange(); - ax.setScale(); - return ax; -}; +module.exports = function identity(d) { return d; }; -proto.doAutoRange = function(fullLayout, polarLayout) { - var gd = this.gd; - var radialAxis = this.radialAxis; - var radialLayout = polarLayout.radialaxis; - - radialAxis.setScale(); - doAutoRange(gd, radialAxis); - - var rng = radialAxis.range; - radialLayout.range = rng.slice(); - radialLayout._input.range = rng.slice(); - - radialAxis._rl = [ - radialAxis.r2l(rng[0], null, 'gregorian'), - radialAxis.r2l(rng[1], null, 'gregorian') - ]; -}; +},{}],159:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -proto.updateRadialAxis = function(fullLayout, polarLayout) { - var _this = this; - var gd = _this.gd; - var layers = _this.layers; - var radius = _this.radius; - var innerRadius = _this.innerRadius; - var cx = _this.cx; - var cy = _this.cy; - var radialLayout = polarLayout.radialaxis; - var a0 = mod(polarLayout.sector[0], 360); - var ax = _this.radialAxis; - var hasRoomForIt = innerRadius < radius; - _this.fillViewInitialKey('radialaxis.angle', radialLayout.angle); - _this.fillViewInitialKey('radialaxis.range', ax.range.slice()); +'use strict'; - ax.setGeometry(); +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); - // rotate auto tick labels by 180 if in quadrant II and III to make them - // readable from left-to-right - // - // TODO try moving deeper in doTicksSingle for better results? - if(ax.tickangle === 'auto' && (a0 > 90 && a0 <= 270)) { - ax.tickangle = 180; - } +var numConstants = _dereq_('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; - // easier to set rotate angle with custom translate function - ax._transfn = function(d) { - return 'translate(' + (ax.l2p(d.x) + innerRadius) + ',0)'; - }; +var lib = module.exports = {}; - // set special grid path function - ax._gridpath = function(d) { - return _this.pathArc(ax.r2p(d.x) + innerRadius); - }; +lib.nestedProperty = _dereq_('./nested_property'); +lib.keyedContainer = _dereq_('./keyed_container'); +lib.relativeAttr = _dereq_('./relative_attr'); +lib.isPlainObject = _dereq_('./is_plain_object'); +lib.toLogRange = _dereq_('./to_log_range'); +lib.relinkPrivateKeys = _dereq_('./relink_private'); - var newTickLayout = strTickLayout(radialLayout); - if(_this.radialTickLayout !== newTickLayout) { - layers['radial-axis'].selectAll('.xtick').remove(); - _this.radialTickLayout = newTickLayout; - } +var arrayModule = _dereq_('./array'); +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; - if(hasRoomForIt) { - ax.setScale(); - doTicksSingle(gd, ax, true); - } +var modModule = _dereq_('./mod'); +lib.mod = modModule.mod; +lib.modHalf = modModule.modHalf; - // stash 'actual' radial axis angle for drag handlers (in degrees) - var angle = _this.radialAxisAngle = _this.vangles ? - rad2deg(snapToVertexAngle(deg2rad(radialLayout.angle), _this.vangles)) : - radialLayout.angle; +var coerceModule = _dereq_('./coerce'); +lib.valObjectMeta = coerceModule.valObjectMeta; +lib.coerce = coerceModule.coerce; +lib.coerce2 = coerceModule.coerce2; +lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; +lib.coerceSelectionMarkerOpacity = coerceModule.coerceSelectionMarkerOpacity; +lib.validate = coerceModule.validate; - var trans = strTranslate(cx, cy) + strRotate(-angle); +var datesModule = _dereq_('./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; - updateElement( - layers['radial-axis'], - hasRoomForIt && (radialLayout.showticklabels || radialLayout.ticks), - {transform: trans} - ); +var searchModule = _dereq_('./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; - // move all grid paths to about circle center, - // undo individual grid lines translations - updateElement( - layers['radial-grid'], - hasRoomForIt && radialLayout.showgrid, - {transform: strTranslate(cx, cy)} - ).selectAll('path').attr('transform', null); - - updateElement( - layers['radial-line'].select('line'), - hasRoomForIt && radialLayout.showline, - { - x1: innerRadius, - y1: 0, - x2: radius, - y2: 0, - transform: trans - } - ) - .attr('stroke-width', radialLayout.linewidth) - .call(Color.stroke, radialLayout.linecolor); -}; +var statsModule = _dereq_('./stats'); +lib.aggNums = statsModule.aggNums; +lib.len = statsModule.len; +lib.mean = statsModule.mean; +lib.midRange = statsModule.midRange; +lib.variance = statsModule.variance; +lib.stdev = statsModule.stdev; +lib.interp = statsModule.interp; -proto.updateRadialAxisTitle = function(fullLayout, polarLayout, _angle) { - var _this = this; - var gd = _this.gd; - var radius = _this.radius; - var cx = _this.cx; - var cy = _this.cy; - var radialLayout = polarLayout.radialaxis; - var titleClass = _this.id + 'title'; - - var angle = _angle !== undefined ? _angle : _this.radialAxisAngle; - var angleRad = deg2rad(angle); - var cosa = Math.cos(angleRad); - var sina = Math.sin(angleRad); - - var pad = 0; - if(radialLayout.title) { - var h = Drawing.bBox(_this.layers['radial-axis'].node()).height; - var ts = radialLayout.titlefont.size; - pad = radialLayout.side === 'counterclockwise' ? - -h - ts * 0.4 : - h + ts * 0.8; - } - - _this.layers['radial-axis-title'] = Titles.draw(gd, titleClass, { - propContainer: radialLayout, - propName: _this.id + '.radialaxis.title', - placeholder: _(gd, 'Click to enter radial axis title'), - attributes: { - x: cx + (radius / 2) * cosa + pad * sina, - y: cy - (radius / 2) * sina + pad * cosa, - 'text-anchor': 'middle' - }, - transform: {rotate: -angle} - }); -}; +var matrixModule = _dereq_('./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.apply2DTransform = matrixModule.apply2DTransform; +lib.apply2DTransform2 = matrixModule.apply2DTransform2; -proto.updateAngularAxis = function(fullLayout, polarLayout) { - var _this = this; - var gd = _this.gd; - var layers = _this.layers; - var radius = _this.radius; - var innerRadius = _this.innerRadius; - var cx = _this.cx; - var cy = _this.cy; - var angularLayout = polarLayout.angularaxis; - var ax = _this.angularAxis; - - _this.fillViewInitialKey('angularaxis.rotation', angularLayout.rotation); - - ax.setGeometry(); - - // 't'ick to 'g'eometric radians is used all over the place here - var t2g = function(d) { return ax.t2g(d.x); }; - - // run rad2deg on tick0 and ditck for thetaunit: 'radians' axes - if(ax.type === 'linear' && ax.thetaunit === 'radians') { - ax.tick0 = rad2deg(ax.tick0); - ax.dtick = rad2deg(ax.dtick); - } - - // Use tickval filter for category axes instead of tweaking - // the range w.r.t sector, so that sectors that cross 360 can - // show all their ticks. - if(ax.type === 'category') { - ax._tickFilter = function(d) { - return Lib.isAngleInsideSector(t2g(d), _this.sectorInRad); - }; - } +var anglesModule = _dereq_('./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; - ax._transfn = function(d) { - var sel = d3.select(this); - var hasElement = sel && sel.node(); +var anchorUtils = _dereq_('./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; - // don't translate grid lines - if(hasElement && sel.classed('angularaxisgrid')) return ''; +var geom2dModule = _dereq_('./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 rad = t2g(d); - var out = strTranslate(cx + radius * Math.cos(rad), cy - radius * Math.sin(rad)); +var extendModule = _dereq_('./extend'); +lib.extendFlat = extendModule.extendFlat; +lib.extendDeep = extendModule.extendDeep; +lib.extendDeepAll = extendModule.extendDeepAll; +lib.extendDeepNoArrays = extendModule.extendDeepNoArrays; - // must also rotate ticks, but don't rotate labels - if(hasElement && sel.classed('ticks')) { - out += strRotate(-rad2deg(rad)); - } +var loggersModule = _dereq_('./loggers'); +lib.log = loggersModule.log; +lib.warn = loggersModule.warn; +lib.error = loggersModule.error; - return out; - }; +var regexModule = _dereq_('./regex'); +lib.counterRegex = regexModule.counter; - ax._gridpath = function(d) { - var rad = t2g(d); - var cosRad = Math.cos(rad); - var sinRad = Math.sin(rad); - return 'M' + [cx + innerRadius * cosRad, cy - innerRadius * sinRad] + - 'L' + [cx + radius * cosRad, cy - radius * sinRad]; - }; +var throttleModule = _dereq_('./throttle'); +lib.throttle = throttleModule.throttle; +lib.throttleDone = throttleModule.done; +lib.clearThrottle = throttleModule.clear; - var offset4fontsize = (angularLayout.ticks !== 'outside' ? 0.7 : 0.5); +lib.getGraphDiv = _dereq_('./get_graph_div'); - ax._labelx = function(d) { - var rad = t2g(d); - var labelStandoff = ax._labelStandoff; - var pad = ax._pad; +lib.clearResponsive = _dereq_('./clear_responsive'); - var offset4tx = signSin(rad) === 0 ? - 0 : - Math.cos(rad) * (labelStandoff + pad + offset4fontsize * d.fontSize); - var offset4tick = signCos(rad) * (d.dx + labelStandoff + pad); +lib.makeTraceGroups = _dereq_('./make_trace_groups'); - return offset4tx + offset4tick; - }; +lib._ = _dereq_('./localize'); - ax._labely = function(d) { - var rad = t2g(d); - var labelStandoff = ax._labelStandoff; - var labelShift = ax._labelShift; - var pad = ax._pad; +lib.notifier = _dereq_('./notifier'); - var offset4tx = d.dy + d.fontSize * MID_SHIFT - labelShift; - var offset4tick = -Math.sin(rad) * (labelStandoff + pad + offset4fontsize * d.fontSize); +lib.filterUnique = _dereq_('./filter_unique'); +lib.filterVisible = _dereq_('./filter_visible'); +lib.pushUnique = _dereq_('./push_unique'); - return offset4tx + offset4tick; - }; +lib.cleanNumber = _dereq_('./clean_number'); - ax._labelanchor = function(angle, d) { - var rad = t2g(d); - return signSin(rad) === 0 ? - (signCos(rad) > 0 ? 'start' : 'end') : - 'middle'; - }; +lib.ensureNumber = function num(v) { + if(!isNumeric(v)) return BADNUM; + v = Number(v); + if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; + return isNumeric(v) ? Number(v) : BADNUM; +}; - var newTickLayout = strTickLayout(angularLayout); - if(_this.angularTickLayout !== newTickLayout) { - layers['angular-axis'].selectAll('.' + ax._id + 'tick').remove(); - _this.angularTickLayout = newTickLayout; - } +/** + * Is v a valid array index? Accepts numeric strings as well as numbers. + * + * @param {any} v: the value to test + * @param {Optional[integer]} len: the array length we are indexing + * + * @return {bool}: v is a valid array index + */ +lib.isIndex = function(v, len) { + if(len !== undefined && v >= len) return false; + return isNumeric(v) && (v >= 0) && (v % 1 === 0); +}; - ax.setScale(); - doTicksSingle(gd, ax, true); +lib.noop = _dereq_('./noop'); +lib.identity = _dereq_('./identity'); - // angle of polygon vertices in geometric radians (null means circles) - // TODO what to do when ax.period > ax._categories ?? - var vangles; - if(polarLayout.gridshape === 'linear') { - vangles = ax._vals.map(t2g); - - // ax._vals should be always ordered, make them - // always turn counterclockwise for convenience here - if(Lib.angleDelta(vangles[0], vangles[1]) < 0) { - vangles = vangles.slice().reverse(); - } - } else { - vangles = null; +/** + * create an array of length 'cnt' filled with 'v' at all indices + * + * @param {any} v + * @param {number} cnt + * @return {array} + */ +lib.repeat = function(v, cnt) { + var out = new Array(cnt); + for(var i = 0; i < cnt; i++) { + out[i] = v; } - _this.vangles = vangles; - - // TODO maybe two arcs is better here? - // maybe split style attributes between inner and outer angular axes? - - updateElement(layers['angular-line'].select('path'), angularLayout.showline, { - d: _this.pathSubplot(), - transform: strTranslate(cx, cy) - }) - .attr('stroke-width', angularLayout.linewidth) - .call(Color.stroke, angularLayout.linecolor); + return out; }; -proto.updateFx = function(fullLayout, polarLayout) { - if(!this.gd._context.staticPlot) { - this.updateAngularDrag(fullLayout); - this.updateRadialDrag(fullLayout, polarLayout, 0); - this.updateRadialDrag(fullLayout, polarLayout, 1); - this.updateMainDrag(fullLayout); +/** + * swap x and y of the same attribute in container cont + * specify attr with a ? in place of x/y + * you can also swap other things than x/y by providing part1 and part2 + */ +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 xp = lib.nestedProperty(cont, attr.replace('?', part1)); + var yp = lib.nestedProperty(cont, attr.replace('?', part2)); + var temp = xp.get(); + xp.set(yp.get()); + yp.set(temp); } }; -proto.updateMainDrag = function(fullLayout) { - var _this = this; - var gd = _this.gd; - var layers = _this.layers; - var zoomlayer = fullLayout._zoomlayer; - var MINZOOM = constants.MINZOOM; - var OFFEDGE = constants.OFFEDGE; - var radius = _this.radius; - var innerRadius = _this.innerRadius; - var cx = _this.cx; - var cy = _this.cy; - var cxx = _this.cxx; - var cyy = _this.cyy; - var sectorInRad = _this.sectorInRad; - var vangles = _this.vangles; - var radialAxis = _this.radialAxis; - var clampTiny = helpers.clampTiny; - var findXYatLength = helpers.findXYatLength; - var findEnclosingVertexAngles = helpers.findEnclosingVertexAngles; - var chw = constants.cornerHalfWidth; - var chl = constants.cornerLen / 2; - - var mainDrag = dragBox.makeDragger(layers, 'path', 'maindrag', 'crosshair'); - - d3.select(mainDrag) - .attr('d', _this.pathSubplot()) - .attr('transform', strTranslate(cx, cy)); - - var dragOpts = { - element: mainDrag, - gd: gd, - subplot: _this.id, - plotinfo: { - id: _this.id, - xaxis: _this.xaxis, - yaxis: _this.yaxis - }, - xaxes: [_this.xaxis], - yaxes: [_this.yaxis] - }; - - // mouse px position at drag start (0), move (1) - var x0, y0; - // radial distance from circle center at drag start (0), move (1) - var r0, r1; - // zoombox persistent quantities - var path0, dimmed, lum; - // zoombox, corners elements - var zb, corners; +/** + * SVG painter's algo worked around with reinsertion + */ +lib.raiseToTop = function raiseToTop(elem) { + elem.parentNode.appendChild(elem); +}; - function norm(x, y) { - return Math.sqrt(x * x + y * y); - } +/** + * cancel a possibly pending transition; returned selection may be used by caller + */ +lib.cancelTransition = function(selection) { + return selection.transition().duration(0); +}; - function xy2r(x, y) { - return norm(x - cxx, y - cyy); - } +// constrain - restrict a number v to be between v0 and v1 +lib.constrain = function(v, v0, v1) { + if(v0 > v1) return Math.max(v1, Math.min(v0, v)); + return Math.max(v0, Math.min(v1, v)); +}; - function xy2a(x, y) { - return Math.atan2(cyy - y, x - cxx); - } +/** + * do two bounding boxes from getBoundingClientRect, + * ie {left,right,top,bottom,width,height}, overlap? + * takes optional padding pixels + */ +lib.bBoxIntersect = function(a, b, pad) { + pad = pad || 0; + return (a.left <= b.right + pad && + b.left <= a.right + pad && + a.top <= b.bottom + pad && + b.top <= a.bottom + pad); +}; - function ra2xy(r, a) { - return [r * Math.cos(a), r * Math.sin(-a)]; - } +/* + * simpleMap: alternative to Array.map that only + * passes on the element and up to 2 extra args you + * provide (but not the array index or the whole array) + * + * array: the array to map it to + * func: the function to apply + * x1, x2: optional extra args + */ +lib.simpleMap = function(array, func, x1, x2) { + var len = array.length; + var out = new Array(len); + for(var i = 0; i < len; i++) out[i] = func(array[i], x1, x2); + return out; +}; - function pathCorner(r, a) { - if(r === 0) return _this.pathSector(2 * chw); +/** + * Random string generator + * + * @param {object} existing + * pass in strings to avoid as keys with truthy values + * @param {int} bits + * bits of information in the output string, default 24 + * @param {int} base + * base of string representation, default 16. Should be a power of 2. + */ +lib.randstr = function randstr(existing, bits, base, _recursion) { + if(!base) base = 16; + if(bits === undefined) bits = 24; + if(bits <= 0) return '0'; - var da = chl / r; - var am = a - da; - var ap = a + da; - var rb = Math.max(0, Math.min(r, radius)); - var rm = rb - chw; - var rp = rb + chw; + var digits = Math.log(Math.pow(2, bits)) / Math.log(base); + var res = ''; + var i, b, x; - return 'M' + ra2xy(rm, am) + - 'A' + [rm, rm] + ' 0,0,0 ' + ra2xy(rm, ap) + - 'L' + ra2xy(rp, ap) + - 'A' + [rp, rp] + ' 0,0,1 ' + ra2xy(rp, am) + - 'Z'; + for(i = 2; digits === Infinity; i *= 2) { + digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i; } - // (x,y) is the pt at middle of the va0 <-> va1 edge - // - // ... we could eventually add another mode for cursor - // angles 'close to' enough to a particular vertex. - function pathCornerForPolygons(r, va0, va1) { - if(r === 0) return _this.pathSector(2 * chw); - - var xy0 = ra2xy(r, va0); - var xy1 = ra2xy(r, va1); - var x = clampTiny((xy0[0] + xy1[0]) / 2); - var y = clampTiny((xy0[1] + xy1[1]) / 2); - var innerPts, outerPts; - - if(x && y) { - var m = y / x; - var mperp = -1 / m; - var midPts = findXYatLength(chw, m, x, y); - innerPts = findXYatLength(chl, mperp, midPts[0][0], midPts[0][1]); - outerPts = findXYatLength(chl, mperp, midPts[1][0], midPts[1][1]); - } else { - var dx, dy; - if(y) { - // horizontal handles - dx = chl; - dy = chw; - } else { - // vertical handles - dx = chw; - dy = chl; - } - innerPts = [[x - dx, y - dy], [x + dx, y - dy]]; - outerPts = [[x - dx, y + dy], [x + dx, y + dy]]; - } + var rem = digits - Math.floor(digits); - return 'M' + innerPts.join('L') + - 'L' + outerPts.reverse().join('L') + 'Z'; + for(i = 0; i < Math.floor(digits); i++) { + x = Math.floor(Math.random() * base).toString(base); + res = x + res; } - function zoomPrep() { - r0 = null; - r1 = null; - path0 = _this.pathSubplot(); - dimmed = false; - - var polarLayoutNow = gd._fullLayout[_this.id]; - lum = tinycolor(polarLayoutNow.bgcolor).getLuminance(); - - zb = dragBox.makeZoombox(zoomlayer, lum, cx, cy, path0); - zb.attr('fill-rule', 'evenodd'); - corners = dragBox.makeCorners(zoomlayer, cx, cy); - clearSelect(zoomlayer); + if(rem) { + b = Math.pow(base, rem); + x = Math.floor(Math.random() * b).toString(base); + res = x + res; } - // N.B. this sets scoped 'r0' and 'r1' - // return true if 'valid' zoom distance, false otherwise - function clampAndSetR0R1(rr0, rr1) { - rr1 = Math.max(Math.min(rr1, radius), innerRadius); - - // starting or ending drag near center (outer edge), - // clamps radial distance at origin (at r=radius) - if(rr0 < OFFEDGE) rr0 = 0; - else if((radius - rr0) < OFFEDGE) rr0 = radius; - else if(rr1 < OFFEDGE) rr1 = 0; - else if((radius - rr1) < OFFEDGE) rr1 = radius; - - // make sure r0 < r1, - // to get correct fill pattern in path1 below - if(Math.abs(rr1 - rr0) > MINZOOM) { - if(rr0 < rr1) { - r0 = rr0; - r1 = rr1; - } else { - r0 = rr1; - r1 = rr0; - } - return true; - } else { - r0 = null; - r1 = null; - return false; + 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; +}; - function applyZoomMove(path1, cpath) { - path1 = path1 || path0; - cpath = cpath || 'M0,0Z'; - - zb.attr('d', path1); - corners.attr('d', cpath); - dragBox.transitionZoombox(zb, corners, dimmed, lum); - dimmed = true; - } - - function zoomMove(dx, dy) { - var x1 = x0 + dx; - var y1 = y0 + dy; - var rr0 = xy2r(x0, y0); - var rr1 = Math.min(xy2r(x1, y1), radius); - var a0 = xy2a(x0, y0); - var path1; - var cpath; - - if(clampAndSetR0R1(rr0, rr1)) { - path1 = path0 + _this.pathSector(r1); - if(r0) path1 += _this.pathSector(r0); - // keep 'starting' angle - cpath = pathCorner(r0, a0) + pathCorner(r1, a0); - } - applyZoomMove(path1, cpath); - } - - function findPolygonRadius(x, y, va0, va1) { - var xy = helpers.findIntersectionXY(va0, va1, va0, [x - cxx, cyy - y]); - return norm(xy[0], xy[1]); - } - - function zoomMoveForPolygons(dx, dy) { - var x1 = x0 + dx; - var y1 = y0 + dy; - var a0 = xy2a(x0, y0); - var a1 = xy2a(x1, y1); - var vangles0 = findEnclosingVertexAngles(a0, vangles); - var vangles1 = findEnclosingVertexAngles(a1, vangles); - var rr0 = findPolygonRadius(x0, y0, vangles0[0], vangles0[1]); - var rr1 = Math.min(findPolygonRadius(x1, y1, vangles1[0], vangles1[1]), radius); - var path1; - var cpath; - - if(clampAndSetR0R1(rr0, rr1)) { - path1 = path0 + _this.pathSector(r1); - if(r0) path1 += _this.pathSector(r0); - // keep 'starting' angle here too - cpath = [ - pathCornerForPolygons(r0, vangles0[0], vangles0[1]), - pathCornerForPolygons(r1, vangles0[0], vangles0[1]) - ].join(' '); - } - applyZoomMove(path1, cpath); - } +lib.OptionControl = function(opt, optname) { + /* + * An environment to contain all option setters and + * getters that collectively modify opts. + * + * You can call up opts from any function in new object + * as this.optname || this.opt + * + * See FitOpts for example of usage + */ + if(!opt) opt = {}; + if(!optname) optname = 'opt'; - function zoomDone() { - dragBox.removeZoombox(gd); + var self = {}; + self.optionList = []; - if(r0 === null || r1 === null) return; + self._newoption = function(optObj) { + optObj[optname] = opt; + self[optObj.name] = optObj; + self.optionList.push(optObj); + }; - dragBox.showDoubleClickNotifier(gd); + self['_' + optname] = opt; + return self; +}; - var rl = radialAxis._rl; - var m = (rl[1] - rl[0]) / (1 - innerRadius / radius) / radius; - var newRng = [ - rl[0] + (r0 - innerRadius) * m, - rl[0] + (r1 - innerRadius) * m - ]; - Registry.call('relayout', gd, _this.id + '.radialaxis.range', newRng); - } +/** + * lib.smooth: smooth arrayIn by convolving with + * a hann window with given full width at half max + * bounce the ends in, so the output has the same length as the input + */ +lib.smooth = function(arrayIn, FWHM) { + FWHM = Math.round(FWHM) || 0; // only makes sense for integers + if(FWHM < 2) return arrayIn; - function zoomClick(numClicks, evt) { - var clickMode = gd._fullLayout.clickmode; + 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; - dragBox.removeZoombox(gd); + // first make the window array + for(i = 0; i < wlen; i++) { + w[i] = (1 - Math.cos(Math.PI * (i + 1) / FWHM)) / (2 * FWHM); + } - // TODO double once vs twice logic (autorange vs fixed range) - if(numClicks === 2) { - var updateObj = {}; - for(var k in _this.viewInitial) { - updateObj[_this.id + '.' + k] = _this.viewInitial[k]; - } + // now do the convolution + for(i = 0; i < alen; i++) { + v = 0; + for(j = 0; j < wlen; j++) { + k = i + j + 1 - FWHM; - gd.emit('plotly_doubleclick', null); - Registry.call('relayout', gd, updateObj); - } + // multibounce + if(k < -alen) k -= alen2 * Math.round(k / alen2); + else if(k >= alen2) k -= alen2 * Math.floor(k / alen2); - if(clickMode.indexOf('select') > -1 && numClicks === 1) { - selectOnClick(evt, gd, [_this.xaxis], [_this.yaxis], _this.id, dragOpts); - } + // single bounce + if(k < 0) k = - 1 - k; + else if(k >= alen) k = alen2 - 1 - k; - if(clickMode.indexOf('event') > -1) { - Fx.click(gd, evt, _this.id); + v += arrayIn[k] * w[j]; } + arrayOut[i] = v; } - dragOpts.prepFn = function(evt, startX, startY) { - var dragModeNow = gd._fullLayout.dragmode; - - var bbox = mainDrag.getBoundingClientRect(); - x0 = startX - bbox.left; - y0 = startY - bbox.top; - - // need to offset x/y as bbox center does not - // match origin for asymmetric polygons - if(vangles) { - var offset = helpers.findPolygonOffset(radius, sectorInRad[0], sectorInRad[1], vangles); - x0 += cxx + offset[0]; - y0 += cyy + offset[1]; - } - - switch(dragModeNow) { - case 'zoom': - if(vangles) { - dragOpts.moveFn = zoomMoveForPolygons; - } else { - dragOpts.moveFn = zoomMove; - } - dragOpts.clickFn = zoomClick; - dragOpts.doneFn = zoomDone; - zoomPrep(evt, startX, startY); - break; - case 'select': - case 'lasso': - prepSelect(evt, startX, startY, dragOpts, dragModeNow); - break; - } - }; - - mainDrag.onmousemove = function(evt) { - Fx.hover(gd, evt, _this.id); - gd._fullLayout._lasthover = mainDrag; - gd._fullLayout._hoversubplot = _this.id; - }; - - mainDrag.onmouseout = function(evt) { - if(gd._dragging) return; - dragElement.unhover(gd, evt); - }; - - dragElement.init(dragOpts); + return arrayOut; }; -proto.updateRadialDrag = function(fullLayout, polarLayout, rngIndex) { - var _this = this; - var gd = _this.gd; - var layers = _this.layers; - var radius = _this.radius; - var innerRadius = _this.innerRadius; - var cx = _this.cx; - var cy = _this.cy; - var radialAxis = _this.radialAxis; - var bl = constants.radialDragBoxSize; - var bl2 = bl / 2; - - if(!radialAxis.visible) return; - - var angle0 = deg2rad(_this.radialAxisAngle); - var rl = radialAxis._rl; - var rl0 = rl[0]; - var rl1 = rl[1]; - var rbase = rl[rngIndex]; - var m = 0.75 * (rl[1] - rl[0]) / (1 - polarLayout.hole) / radius; - - var tx, ty, className; - if(rngIndex) { - tx = cx + (radius + bl2) * Math.cos(angle0); - ty = cy - (radius + bl2) * Math.sin(angle0); - className = 'radialdrag'; - } else { - // the 'inner' box can get called: - // - when polar.hole>0 - // - when polar.sector isn't a full circle - // otherwise it is hidden behind the main drag. - tx = cx + (innerRadius - bl2) * Math.cos(angle0); - ty = cy - (innerRadius - bl2) * Math.sin(angle0); - className = 'radialdrag-inner'; - } - - var radialDrag = dragBox.makeRectDragger(layers, className, 'crosshair', -bl2, -bl2, bl, bl); - var dragOpts = {element: radialDrag, gd: gd}; - - updateElement(d3.select(radialDrag), radialAxis.visible && innerRadius < radius, { - transform: strTranslate(tx, ty) - }); - - // move function (either rotate or re-range flavor) - var moveFn2; - // rotate angle on done - var angle1; - // re-range range[1] (or range[0]) on done - var rprime; - - function moveFn(dx, dy) { - if(moveFn2) { - moveFn2(dx, dy); - } else { - var dvec = [dx, -dy]; - var rvec = [Math.cos(angle0), Math.sin(angle0)]; - var comp = Math.abs(Lib.dot(dvec, rvec) / Math.sqrt(Lib.dot(dvec, dvec))); +/** + * syncOrAsync: run a sequence of functions synchronously + * as long as its returns are not promises (ie have no .then) + * includes one argument arg to send to all functions... + * this is mainly just to prevent us having to make wrapper functions + * when the only purpose of the wrapper is to reference gd + * and a final step to be executed at the end + * TODO: if there's an error and everything is sync, + * this doesn't happen yet because we want to make sure + * that it gets reported + */ +lib.syncOrAsync = function(sequence, arg, finalStep) { + var ret, fni; - // mostly perpendicular motions rotate, - // mostly parallel motions re-range - if(!isNaN(comp)) { - moveFn2 = comp < 0.5 ? rotateMove : rerangeMove; - } - } + function continueAsync() { + return lib.syncOrAsync(sequence, arg, finalStep); } - function doneFn() { - if(angle1 !== null) { - Registry.call('relayout', gd, _this.id + '.radialaxis.angle', angle1); - } else if(rprime !== null) { - Registry.call('relayout', gd, _this.id + '.radialaxis.range[' + rngIndex + ']', rprime); + while(sequence.length) { + fni = sequence.splice(0, 1)[0]; + ret = fni(arg); + + if(ret && ret.then) { + return ret.then(continueAsync) + .then(undefined, lib.promiseError); } } - function rotateMove(dx, dy) { - // disable for inner drag boxes - if(rngIndex === 0) return; - - var x1 = tx + dx; - var y1 = ty + dy; + return finalStep && finalStep(arg); +}; - angle1 = Math.atan2(cy - y1, x1 - cx); - if(_this.vangles) angle1 = snapToVertexAngle(angle1, _this.vangles); - angle1 = rad2deg(angle1); - var transform = strTranslate(cx, cy) + strRotate(-angle1); - layers['radial-axis'].attr('transform', transform); - layers['radial-line'].select('line').attr('transform', transform); +/** + * Helper to strip trailing slash, from + * http://stackoverflow.com/questions/6680825/return-string-without-trailing-slash + */ +lib.stripTrailingSlash = function(str) { + if(str.substr(-1) === '/') return str.substr(0, str.length - 1); + return str; +}; - var fullLayoutNow = _this.gd._fullLayout; - var polarLayoutNow = fullLayoutNow[_this.id]; - _this.updateRadialAxisTitle(fullLayoutNow, polarLayoutNow, angle1); - } +lib.noneOrAll = function(containerIn, containerOut, attrList) { + /** + * some attributes come together, so if you have one of them + * in the input, you should copy the default values of the others + * to the input as well. + */ + if(!containerIn) return; - function rerangeMove(dx, dy) { - // project (dx, dy) unto unit radial axis vector - var dr = Lib.dot([dx, -dy], [Math.cos(angle0), Math.sin(angle0)]); - rprime = rbase - m * dr; + var hasAny = false; + var hasAll = true; + var i; + var val; - // make sure rprime does not change the range[0] -> range[1] sign - if((m > 0) !== (rngIndex ? rprime > rl0 : rprime < rl1)) { - rprime = null; - return; - } + for(i = 0; i < attrList.length; i++) { + val = containerIn[attrList[i]]; + if(val !== undefined && val !== null) hasAny = true; + else hasAll = false; + } - // update radial range -> update c2g -> update _m,_b - radialAxis.range[rngIndex] = rprime; - radialAxis._rl[rngIndex] = rprime; - radialAxis.setGeometry(); - radialAxis.setScale(); - - _this.xaxis.setRange(); - _this.xaxis.setScale(); - _this.yaxis.setRange(); - _this.yaxis.setScale(); - - doTicksSingle(gd, radialAxis, true); - layers['radial-grid'] - .attr('transform', strTranslate(cx, cy)) - .selectAll('path').attr('transform', null); - - var hasRegl = false; - - for(var traceType in _this.traceHash) { - var moduleCalcData = _this.traceHash[traceType]; - var moduleCalcDataVisible = Lib.filterVisible(moduleCalcData); - var _module = moduleCalcData[0][0].trace._module; - var polarLayoutNow = gd._fullLayout[_this.id]; - _module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow); - if(Registry.traceIs(traceType, 'gl') && moduleCalcDataVisible.length) hasRegl = true; + if(hasAny && !hasAll) { + for(i = 0; i < attrList.length; i++) { + containerIn[attrList[i]] = containerOut[attrList[i]]; } + } +}; - if(hasRegl) { - clearGlCanvases(gd); - redrawReglTraces(gd); - } +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ +lib.mergeArray = function(traceAttr, cd, cdAttr) { + if(lib.isArrayOrTypedArray(traceAttr)) { + var imax = Math.min(traceAttr.length, cd.length); + for(var i = 0; i < imax; i++) cd[i][cdAttr] = traceAttr[i]; } +}; - dragOpts.prepFn = function() { - moveFn2 = null; - angle1 = null; - rprime = null; - - dragOpts.moveFn = moveFn; - dragOpts.doneFn = doneFn; - - clearSelect(fullLayout._zoomlayer); - }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; - dragOpts.clampFn = function(dx, dy) { - if(Math.sqrt(dx * dx + dy * dy) < constants.MINDRAG) { - dx = 0; - dy = 0; + if(lib.isArrayOrTypedArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); } - return [dx, dy]; - }; - - dragElement.init(dragOpts); + } }; -proto.updateAngularDrag = function(fullLayout) { - var _this = this; - var gd = _this.gd; - var layers = _this.layers; - var radius = _this.radius; - var angularAxis = _this.angularAxis; - var cx = _this.cx; - var cy = _this.cy; - var cxx = _this.cxx; - var cyy = _this.cyy; - var dbs = constants.angularDragBoxSize; - - var angularDrag = dragBox.makeDragger(layers, 'path', 'angulardrag', 'move'); - var dragOpts = {element: angularDrag, gd: gd}; - - d3.select(angularDrag) - .attr('d', _this.pathAnnulus(radius, radius + dbs)) - .attr('transform', strTranslate(cx, cy)) - .call(setCursor, 'move'); - - function xy2a(x, y) { - return Math.atan2(cyy + dbs - y, x - cxx - dbs); - } - - // scatter trace, points and textpoints selections - var scatterTraces = layers.frontplot.select('.scatterlayer').selectAll('.trace'); - var scatterPoints = scatterTraces.selectAll('.point'); - var scatterTextPoints = scatterTraces.selectAll('.textpoint'); +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; - // mouse px position at drag start (0), move (1) - var x0, y0; - // angular axis angle rotation at drag start (0), move (1) - var rot0, rot1; - // induced radial axis rotation (only used on polygon grids) - var rrot1; - // angle about circle center at drag start - var a0; - - function moveFn(dx, dy) { - var fullLayoutNow = _this.gd._fullLayout; - var polarLayoutNow = fullLayoutNow[_this.id]; - var x1 = x0 + dx; - var y1 = y0 + dy; - var a1 = xy2a(x1, y1); - var da = rad2deg(a1 - a0); - rot1 = rot0 + da; + var val = lib.nestedProperty(trace, astr).get(); - layers.frontplot.attr('transform', - strTranslate(_this.xOffset2, _this.yOffset2) + strRotate([-da, cxx, cyy]) - ); + 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; + } +}; - if(_this.vangles) { - rrot1 = _this.radialAxisAngle + da; +/** Extract option from calcdata item, correctly falling back to + * trace value if not found. + * + * @param {object} calcPt : calcdata[i][j] item + * @param {object} trace : (full) trace object + * @param {string} calcKey : calcdata key + * @param {string} traceKey : aka trace attribute string + * @return {any} + */ +lib.extractOption = function(calcPt, trace, calcKey, traceKey) { + if(calcKey in calcPt) return calcPt[calcKey]; - var trans = strTranslate(cx, cy) + strRotate(-da); - var trans2 = strTranslate(cx, cy) + strRotate(-rrot1); + // fallback to trace value, + // must check if value isn't itself an array + // which means the trace attribute has a corresponding + // calcdata key, but its value is falsy + var traceVal = lib.nestedProperty(trace, traceKey).get(); + if(!Array.isArray(traceVal)) return traceVal; +}; - layers.bg.attr('transform', trans); - layers['radial-grid'].attr('transform', trans); - layers['angular-line'].select('path').attr('transform', trans); - layers['radial-axis'].attr('transform', trans2); - layers['radial-line'].select('line').attr('transform', trans2); - _this.updateRadialAxisTitle(fullLayoutNow, polarLayoutNow, rrot1); - } else { - _this.clipPaths.forTraces.select('path').attr('transform', - strTranslate(cxx, cyy) + strRotate(da) - ); +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; +} - // 'un-rotate' marker and text points - scatterPoints.each(function() { - var sel = d3.select(this); - var xy = Drawing.getTranslate(sel); - sel.attr('transform', strTranslate(xy.x, xy.y) + strRotate([da])); - }); - scatterTextPoints.each(function() { - var sel = d3.select(this); - var tx = sel.select('text'); - var xy = Drawing.getTranslate(sel); - // N.B rotate -> translate ordering matters - sel.attr('transform', strRotate([da, tx.attr('x'), tx.attr('y')]) + strTranslate(xy.x, xy.y)); - }); +/** Tag selected calcdata items + * + * N.B. note that point 'index' corresponds to input data array index + * whereas 'number' is its post-transform version. + * + * @param {array} calcTrace + * @param {object} trace + * - selectedpoints {array} + * - _indexToPoints {object} + * @param {ptNumber2cdIndex} ptNumber2cdIndex (optional) + * optional map object for trace types that do not have 1-to-1 point number to + * calcdata item index correspondence (e.g. histogram) + */ +lib.tagSelected = function(calcTrace, trace, ptNumber2cdIndex) { + var selectedpoints = trace.selectedpoints; + var indexToPoints = trace._indexToPoints; + var ptIndex2ptNumber; - // update rotation -> range -> _m,_b - angularAxis.rotation = Lib.modHalf(rot1, 360); - angularAxis.setGeometry(); - angularAxis.setScale(); + // make pt index-to-number map object, which takes care of transformed traces + if(indexToPoints) { + ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints); + } - doTicksSingle(gd, angularAxis, true); + function isCdIndexValid(v) { + return v !== undefined && v < calcTrace.length; + } - if(_this._hasClipOnAxisFalse && !Lib.isFullCircle(_this.sectorInRad)) { - scatterTraces.call(Drawing.hideOutsideRangePoints, _this); - } + for(var i = 0; i < selectedpoints.length; i++) { + var ptIndex = selectedpoints[i]; - var hasRegl = false; + if(lib.isIndex(ptIndex)) { + var ptNumber = ptIndex2ptNumber ? ptIndex2ptNumber[ptIndex] : ptIndex; + var cdIndex = ptNumber2cdIndex ? ptNumber2cdIndex[ptNumber] : ptNumber; - for(var traceType in _this.traceHash) { - if(Registry.traceIs(traceType, 'gl')) { - var moduleCalcData = _this.traceHash[traceType]; - var moduleCalcDataVisible = Lib.filterVisible(moduleCalcData); - var _module = moduleCalcData[0][0].trace._module; - _module.plot(gd, _this, moduleCalcDataVisible, polarLayoutNow); - if(moduleCalcDataVisible.length) hasRegl = true; + if(isCdIndexValid(cdIndex)) { + calcTrace[cdIndex].selected = 1; } } - - if(hasRegl) { - clearGlCanvases(gd); - redrawReglTraces(gd); - } } +}; - function doneFn() { - scatterTextPoints.select('text').attr('transform', null); +lib.selIndices2selPoints = function(trace) { + var selectedpoints = trace.selectedpoints; + var indexToPoints = trace._indexToPoints; - var updateObj = {}; - updateObj[_this.id + '.angularaxis.rotation'] = rot1; + if(indexToPoints) { + var ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints); + var out = []; - if(_this.vangles) { - updateObj[_this.id + '.radialaxis.angle'] = rrot1; + 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); + } + } } - Registry.call('relayout', gd, updateObj); + return out; + } else { + return selectedpoints; } +}; - dragOpts.prepFn = function(evt, startX, startY) { - var polarLayoutNow = fullLayout[_this.id]; - rot0 = polarLayoutNow.angularaxis.rotation; +/** Returns target as set by 'target' transform attribute + * + * @param {object} trace : full trace object + * @param {object} transformOpts : transform option object + * - target (string} : + * either an attribute string referencing an array in the trace object, or + * a set array. + * + * @return {array or false} : the target array (NOT a copy!!) or false if invalid + */ +lib.getTargetArray = function(trace, transformOpts) { + var target = transformOpts.target; - var bbox = angularDrag.getBoundingClientRect(); - x0 = startX - bbox.left; - y0 = startY - bbox.top; - a0 = xy2a(x0, y0); + if(typeof target === 'string' && target) { + var array = lib.nestedProperty(trace, target).get(); + return Array.isArray(array) ? array : false; + } else if(Array.isArray(target)) { + return target; + } - dragOpts.moveFn = moveFn; - dragOpts.doneFn = doneFn; + return false; +}; - clearSelect(fullLayout._zoomlayer); - }; +/** + * modified version of jQuery's extend to strip out private objs and functions, + * and cut arrays down to first or 1 elements + * because extend-like algorithms are hella slow + * obj2 is assumed to already be clean of these things (including no arrays) + */ +lib.minExtend = function(obj1, obj2) { + var objOut = {}; + if(typeof obj2 !== 'object') obj2 = {}; + var arrayLen = 3; + var keys = Object.keys(obj1); + var i, k, v; - // I don't what we should do in this case, skip we now - if(_this.vangles && !Lib.isFullCircle(_this.sectorInRad)) { - dragOpts.prepFn = Lib.noop; - setCursor(d3.select(angularDrag), null); + 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') { + objOut[k] = v.slice(); + } else { + objOut[k] = v.slice(0, arrayLen); + } + } + else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); + else objOut[k] = v; } - dragElement.init(dragOpts); -}; - -proto.isPtInside = function(d) { - var sectorInRad = this.sectorInRad; - var vangles = this.vangles; - var thetag = this.angularAxis.c2g(d.theta); - var radialAxis = this.radialAxis; - var r = radialAxis.c2l(d.r); - var rl = radialAxis._rl; + 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; + } + } - var fn = vangles ? helpers.isPtInsidePolygon : Lib.isPtInsideSector; - return fn(r, thetag, rl, sectorInRad, vangles); + return objOut; }; -proto.pathArc = function(r) { - var sectorInRad = this.sectorInRad; - var vangles = this.vangles; - var fn = vangles ? helpers.pathPolygon : Lib.pathArc; - return fn(r, sectorInRad[0], sectorInRad[1], vangles); +lib.titleCase = function(s) { + return s.charAt(0).toUpperCase() + s.substr(1); }; -proto.pathSector = function(r) { - var sectorInRad = this.sectorInRad; - var vangles = this.vangles; - var fn = vangles ? helpers.pathPolygon : Lib.pathSector; - return fn(r, sectorInRad[0], sectorInRad[1], vangles); +lib.containsAny = function(s, fragments) { + for(var i = 0; i < fragments.length; i++) { + if(s.indexOf(fragments[i]) !== -1) return true; + } + return false; }; -proto.pathAnnulus = function(r0, r1) { - var sectorInRad = this.sectorInRad; - var vangles = this.vangles; - var fn = vangles ? helpers.pathPolygonAnnulus : Lib.pathAnnulus; - return fn(r0, r1, sectorInRad[0], sectorInRad[1], vangles); +lib.isPlotDiv = function(el) { + var el3 = d3.select(el); + return el3.node() instanceof HTMLElement && + el3.size() && + el3.classed('js-plotly-plot'); }; -proto.pathSubplot = function() { - var r0 = this.innerRadius; - var r1 = this.radius; - return r0 ? this.pathAnnulus(r0, r1) : this.pathSector(r1); +lib.removeElement = function(el) { + var elParent = el && el.parentNode; + if(elParent) elParent.removeChild(el); }; -proto.fillViewInitialKey = function(key, val) { - if(!(key in this.viewInitial)) { - this.viewInitial[key] = val; - } +/** + * for dynamically adding style rules + * makes one stylesheet that contains all rules added + * by all calls to this function + */ +lib.addStyleRule = function(selector, styleString) { + lib.addRelatedStyleRule('global', selector, styleString); }; -function strTickLayout(axLayout) { - var out = axLayout.ticks + String(axLayout.ticklen) + String(axLayout.showticklabels); - if('side' in axLayout) out += axLayout.side; - return out; -} - -// Finds the bounding box of a given circle sector, -// inspired by https://math.stackexchange.com/q/1852703 -// -// assumes: -// - sector[0] < sector[1] -// - counterclockwise rotation -function computeSectorBBox(sector) { - var s0 = sector[0]; - var s1 = sector[1]; - var arc = s1 - s0; - var a0 = mod(s0, 360); - var a1 = a0 + arc; - - var ax0 = Math.cos(deg2rad(a0)); - var ay0 = Math.sin(deg2rad(a0)); - var ax1 = Math.cos(deg2rad(a1)); - var ay1 = Math.sin(deg2rad(a1)); - - var x0, y0, x1, y1; - - if((a0 <= 90 && a1 >= 90) || (a0 > 90 && a1 >= 450)) { - y1 = 1; - } else if(ay0 <= 0 && ay1 <= 0) { - y1 = 0; - } else { - y1 = Math.max(ay0, ay1); - } - - if((a0 <= 180 && a1 >= 180) || (a0 > 180 && a1 >= 540)) { - x0 = -1; - } else if(ax0 >= 0 && ax1 >= 0) { - x0 = 0; - } else { - x0 = Math.min(ax0, ax1); - } - - if((a0 <= 270 && a1 >= 270) || (a0 > 270 && a1 >= 630)) { - y0 = -1; - } else if(ay0 >= 0 && ay1 >= 0) { - y0 = 0; - } else { - y0 = Math.min(ay0, ay1); +/** + * for dynamically adding style rules + * to a stylesheet uniquely identified by a uid + */ +lib.addRelatedStyleRule = function(uid, selector, styleString) { + var id = 'plotly.js-style-' + uid; + var style = document.getElementById(id); + if(!style) { + style = document.createElement('style'); + style.setAttribute('id', id); + // WebKit hack :( + style.appendChild(document.createTextNode('')); + document.head.appendChild(style); } + var styleSheet = style.sheet; - if(a1 >= 360) { - x1 = 1; - } else if(ax0 <= 0 && ax1 <= 0) { - x1 = 0; - } else { - x1 = Math.max(ax0, ax1); + if(styleSheet.insertRule) { + styleSheet.insertRule(selector + '{' + styleString + '}', 0); } - - return [x0, y0, x1, y1]; -} - -function snapToVertexAngle(a, vangles) { - var fn = function(v) { return Lib.angleDist(a, v); }; - var ind = Lib.findIndexOfMin(vangles, fn); - return vangles[ind]; -} - -function updateElement(sel, showAttr, attrs) { - if(showAttr) { - sel.attr('display', null); - sel.attr(attrs); - } else if(sel) { - sel.attr('display', 'none'); + else if(styleSheet.addRule) { + styleSheet.addRule(selector, styleString, 0); } - return sel; -} - -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - -function strRotate(angle) { - return 'rotate(' + angle + ')'; -} - -// because Math.sign(Math.cos(Math.PI / 2)) === 1 -// oh javascript ;) -function sign(v) { - return Math.abs(v) < 1e-10 ? 0 : - v > 0 ? 1 : -1; -} - -function signCos(v) { - return sign(Math.cos(v)); -} - -function signSin(v) { - return sign(Math.sin(v)); -} + else lib.warn('addStyleRule failed'); +}; -},{"../../components/color":570,"../../components/dragelement":592,"../../components/drawing":595,"../../components/fx":612,"../../components/titles":661,"../../constants/alignment":668,"../../lib":696,"../../lib/clear_gl_canvases":680,"../../lib/setcursor":716,"../../plot_api/subroutines":735,"../../registry":827,"../cartesian/autorange":743,"../cartesian/axes":744,"../cartesian/dragbox":753,"../cartesian/select":762,"../cartesian/set_convert":763,"../plots":808,"./constants":809,"./helpers":810,"./set_convert":821,"d3":148,"tinycolor2":514}],821:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var setConvertCartesian = _dereq_('../cartesian/set_convert'); + * to remove from the page a stylesheet identified by a given uid + */ +lib.deleteRelatedStyleRule = function(uid) { + var id = 'plotly.js-style-' + uid; + var style = document.getElementById(id); + if(style) lib.removeElement(style); +}; -var deg2rad = Lib.deg2rad; -var rad2deg = Lib.rad2deg; +lib.isIE = function() { + return typeof window.navigator.msSaveBlob !== 'undefined'; +}; /** - * setConvert for polar axes! - * - * @param {object} ax - * axis in question (works for both radial and angular axes) - * @param {object} polarLayout - * full polar layout of the subplot associated with 'ax' - * @param {object} fullLayout - * full layout - * - * Here, reuse some of the Cartesian setConvert logic, - * but we must extend some of it, as both radial and angular axes - * don't have domains and angular axes don't have _true_ ranges. - * - * Moreover, we introduce two new coordinate systems: - * - 'g' for geometric coordinates and - * - 't' for angular ticks - * - * Radial axis coordinate systems: - * - d, c and l: same as for cartesian axes - * - g: like calcdata but translated about `radialaxis.range[0]` & `polar.hole` - * - * Angular axis coordinate systems: - * - d: data, in whatever form it's provided - * - c: calcdata, turned into radians (for linear axes) - * or category indices (category axes) - * - t: tick calcdata, just like 'c' but in degrees for linear axes - * - g: geometric calcdata, radians coordinates that take into account - * axis rotation and direction - * - * Then, 'g'eometric data is ready to be converted to (x,y). - */ -module.exports = function setConvert(ax, polarLayout, fullLayout) { - setConvertCartesian(ax, fullLayout); - - switch(ax._id) { - case 'x': - case 'radialaxis': - setConvertRadial(ax, polarLayout); - break; - case 'angularaxis': - setConvertAngular(ax, polarLayout); - break; - } + * Duck typing to recognize a d3 selection, mostly for IE9's benefit + * because it doesn't handle instanceof like modern browsers + */ +lib.isD3Selection = function(obj) { + return obj && (typeof obj.classed === 'function'); }; -function setConvertRadial(ax, polarLayout) { - var subplot = polarLayout._subplot; +/** + * Append element to DOM only if not present. + * + * @param {d3 selection} parent : parent selection of the element in question + * @param {string} nodeType : node type of element to append + * @param {string} className (optional) : class name of element in question + * @param {fn} enterFn (optional) : optional fn applied to entering elements only + * @return {d3 selection} selection of new layer + * + * Previously, we were using the following pattern: + * + * ``` + * var sel = parent.selectAll('.' + className) + * .data([0]); + * + * sel.enter().append(nodeType) + * .classed(className, true); + * + * return sel; + * ``` + * + * in numerous places in our codebase to achieve the same behavior. + * + * The logic below performs much better, mostly as we are using + * `.select` instead `.selectAll` that is `querySelector` instead of + * `querySelectorAll`. + * + */ +lib.ensureSingle = function(parent, nodeType, className, enterFn) { + var sel = parent.select(nodeType + (className ? '.' + className : '')); + if(sel.size()) return sel; - ax.setGeometry = function() { - var rl0 = ax._rl[0]; - var rl1 = ax._rl[1]; - - var b = subplot.innerRadius; - var m = (subplot.radius - b) / (rl1 - rl0); - var b2 = b / m; - - var rFilter = rl0 > rl1 ? - function(v) { return v <= 0; } : - function(v) { return v >= 0; }; - - ax.c2g = function(v) { - var r = ax.c2l(v) - rl0; - return (rFilter(r) ? r : 0) + b2; - }; + var layer = parent.append(nodeType); + if(className) layer.classed(className, true); + if(enterFn) layer.call(enterFn); - ax.g2c = function(v) { - return ax.l2c(v + rl0 - b2); - }; + return layer; +}; - ax.g2p = function(v) { return v * m; }; - ax.c2p = function(v) { return ax.g2p(ax.c2g(v)); }; - }; -} +/** + * Same as Lib.ensureSingle, but using id as selector. + * This version is mostly used for clipPath nodes. + * + * @param {d3 selection} parent : parent selection of the element in question + * @param {string} nodeType : node type of element to append + * @param {string} id : id of element in question + * @param {fn} enterFn (optional) : optional fn applied to entering elements only + * @return {d3 selection} selection of new layer + */ +lib.ensureSingleById = function(parent, nodeType, id, enterFn) { + var sel = parent.select(nodeType + '#' + id); + if(sel.size()) return sel; -function toRadians(v, unit) { - return unit === 'degrees' ? deg2rad(v) : v; -} + var layer = parent.append(nodeType).attr('id', id); + if(enterFn) layer.call(enterFn); -function fromRadians(v, unit) { - return unit === 'degrees' ? rad2deg(v) : v; -} + return layer; +}; -function setConvertAngular(ax, polarLayout) { - var axType = ax.type; +/** + * Converts a string path to an object. + * + * When given a string containing an array element, it will create a `null` + * filled array of the given size. + * + * @example + * lib.objectFromPath('nested.test[2].path', 'value'); + * // returns { nested: { test: [null, null, { path: 'value' }]} + * + * @param {string} path to nested value + * @param {*} any value to be set + * + * @return {Object} the constructed object with a full nested path + */ +lib.objectFromPath = function(path, value) { + var keys = path.split('.'); + var tmpObj; + var obj = tmpObj = {}; - if(axType === 'linear') { - var _d2c = ax.d2c; - var _c2d = ax.c2d; + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var el = null; - ax.d2c = function(v, unit) { return toRadians(_d2c(v), unit); }; - ax.c2d = function(v, unit) { return _c2d(fromRadians(v, unit)); }; - } + var parts = keys[i].match(/(.*)\[([0-9]+)\]/); - // override makeCalcdata to handle thetaunit and special theta0/dtheta logic - ax.makeCalcdata = function(trace, coord) { - var arrayIn = trace[coord]; - var len = trace._length; - var arrayOut, i; + if(parts) { + key = parts[1]; + el = parts[2]; - var _d2c = function(v) { return ax.d2c(v, trace.thetaunit); }; + tmpObj = tmpObj[key] = []; - if(arrayIn) { - if(Lib.isTypedArray(arrayIn) && axType === 'linear') { - if(len === arrayIn.length) { - return arrayIn; - } else if(arrayIn.subarray) { - return arrayIn.subarray(0, len); - } + if(i === keys.length - 1) { + tmpObj[el] = value; + } else { + tmpObj[el] = {}; } - arrayOut = new Array(len); - for(i = 0; i < len; i++) { - arrayOut[i] = _d2c(arrayIn[i]); - } + tmpObj = tmpObj[el]; } else { - var coord0 = coord + '0'; - var dcoord = 'd' + coord; - var v0 = (coord0 in trace) ? _d2c(trace[coord0]) : 0; - var dv = (trace[dcoord]) ? _d2c(trace[dcoord]) : (ax.period || 2 * Math.PI) / len; - arrayOut = new Array(len); - for(i = 0; i < len; i++) { - arrayOut[i] = v0 + i * dv; + if(i === keys.length - 1) { + tmpObj[key] = value; + } else { + tmpObj[key] = {}; } - } - - return arrayOut; - }; - - // N.B. we mock the axis 'range' here - ax.setGeometry = function() { - var sector = polarLayout.sector; - var sectorInRad = sector.map(deg2rad); - var dir = {clockwise: -1, counterclockwise: 1}[ax.direction]; - var rot = deg2rad(ax.rotation); - - var rad2g = function(v) { return dir * v + rot; }; - var g2rad = function(v) { return (v - rot) / dir; }; - - var rad2c, c2rad; - var rad2t, t2rad; - - switch(axType) { - case 'linear': - c2rad = rad2c = Lib.identity; - t2rad = deg2rad; - rad2t = rad2deg; - - // Set the angular range in degrees to make auto-tick computation cleaner, - // changing rotation/direction should not affect the angular tick value. - ax.range = Lib.isFullCircle(sectorInRad) ? - [sector[0], sector[0] + 360] : - sectorInRad.map(g2rad).map(rad2deg); - break; - - case 'category': - var catLen = ax._categories.length; - var _period = ax.period ? Math.max(ax.period, catLen) : catLen; - c2rad = t2rad = function(v) { return v * 2 * Math.PI / _period; }; - rad2c = rad2t = function(v) { return v * _period / Math.PI / 2; }; - - ax.range = [0, _period]; - break; + tmpObj = tmpObj[key]; } + } - ax.c2g = function(v) { return rad2g(c2rad(v)); }; - ax.g2c = function(v) { return rad2c(g2rad(v)); }; - - ax.t2g = function(v) { return rad2g(t2rad(v)); }; - ax.g2t = function(v) { return rad2t(g2rad(v)); }; - }; -} - -},{"../../lib":696,"../cartesian/set_convert":763}],822:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../lib'); -var Template = _dereq_('../plot_api/plot_template'); -var handleDomainDefaults = _dereq_('./domain').defaults; - + return obj; +}; /** - * Find and supply defaults to all subplots of a given type - * This handles subplots that are contained within one container - so - * gl3d, geo, ternary... but not 2d axes which have separate x and y axes - * finds subplots, coerces their `domain` attributes, then calls the - * given handleDefaults function to fill in everything else. - * - * layoutIn: the complete user-supplied input layout - * layoutOut: the complete finished layout - * fullData: the finished data array, used only to find subplots - * opts: { - * type: subplot type string - * attributes: subplot attributes object - * partition: 'x' or 'y', which direction to divide domain space by default - * (default 'x', ie side-by-side subplots) - * TODO: this option is only here because 3D and geo made opposite - * choices in this regard previously and I didn't want to change it. - * Instead we should do: - * - something consistent - * - something more square (4 cuts 2x2, 5/6 cuts 2x3, etc.) - * - something that includes all subplot types in one arrangement, - * now that we can have them together! - * handleDefaults: function of (subplotLayoutIn, subplotLayoutOut, coerce, opts) - * this opts object is passed through to handleDefaults, so attach any - * additional items needed by this function here as well - * } + * Iterate through an object in-place, converting dotted properties to objects. + * + * Examples: + * + * lib.expandObjectPaths({'nested.test.path': 'value'}); + * => { nested: { test: {path: 'value'}}} + * + * It also handles array notation, e.g.: + * + * lib.expandObjectPaths({'foo[1].bar': 'value'}); + * => { foo: [null, {bar: value}] } + * + * It handles merges the results when two properties are specified in parallel: + * + * lib.expandObjectPaths({'foo[1].bar': 10, 'foo[0].bar': 20}); + * => { foo: [{bar: 10}, {bar: 20}] } + * + * It does NOT, however, merge mulitple mutliply-nested arrays:: + * + * lib.expandObjectPaths({'marker[1].range[1]': 5, 'marker[1].range[0]': 4}) + * => { marker: [null, {range: 4}] } */ -module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, opts) { - var subplotType = opts.type; - var subplotAttributes = opts.attributes; - var handleDefaults = opts.handleDefaults; - var partition = opts.partition || 'x'; - var ids = layoutOut._subplots[subplotType]; - var idsLength = ids.length; +// Store this to avoid recompiling regex on *every* prop since this may happen many +// many times for animations. Could maybe be inside the function. Not sure about +// scoping vs. recompilation tradeoff, but at least it's not just inlining it into +// the inner loop. +var dottedPropertyRegex = /^([^\[\.]+)\.(.+)?/; +var indexedPropertyRegex = /^([^\.]+)\[([0-9]+)\](\.)?(.+)?/; - var baseId = idsLength && ids[0].replace(/\d+$/, ''); +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]; - var subplotLayoutIn, subplotLayoutOut; + delete data[key]; - function coerce(attr, dflt) { - return Lib.coerce(subplotLayoutIn, subplotLayoutOut, subplotAttributes, attr, dflt); - } + data[prop] = lib.extendDeepNoArrays(data[prop] || {}, lib.objectFromPath(key, lib.expandObjectPaths(datum))[prop]); + } else if((match = key.match(indexedPropertyRegex))) { + datum = data[key]; - for(var i = 0; i < idsLength; i++) { - var id = ids[i]; + prop = match[1]; + idx = parseInt(match[2]); - // ternary traces get a layout ternary for free! - if(layoutIn[id]) subplotLayoutIn = layoutIn[id]; - else subplotLayoutIn = layoutIn[id] = {}; + delete data[key]; - subplotLayoutOut = Template.newContainer(layoutOut, id, baseId); + data[prop] = data[prop] || []; - var dfltDomains = {}; - dfltDomains[partition] = [i / idsLength, (i + 1) / idsLength]; - handleDomainDefaults(subplotLayoutOut, layoutOut, coerce, dfltDomains); + if(match[3] === '.') { + // This is the case where theere are subsequent properties into which + // we must recurse, e.g. transforms[0].value + trailingPath = match[4]; + dest = data[prop][idx] = data[prop][idx] || {}; - opts.id = id; - handleDefaults(subplotLayoutIn, subplotLayoutOut, coerce, opts); + // NB: Extend deep no arrays prevents this from working on multiple + // nested properties in the same object, e.g. + // + // { + // foo[0].bar[1].range + // foo[0].bar[0].range + // } + // + // In this case, the extendDeepNoArrays will overwrite one array with + // the other, so that both properties *will not* be present in the + // result. Fixing this would require a more intelligent tracking + // of changes and merging than extendDeepNoArrays currently accomplishes. + lib.extendDeepNoArrays(dest, lib.objectFromPath(trailingPath, lib.expandObjectPaths(datum))); + } else { + // This is the case where this property is the end of the line, + // e.g. xaxis.range[0] + data[prop][idx] = lib.expandObjectPaths(datum); + } + } else { + data[key] = lib.expandObjectPaths(data[key]); + } + } + } } + + return data; }; -},{"../lib":696,"../plot_api/plot_template":734,"./domain":770}],823:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - + * Converts value to string separated by the provided separators. + * + * @example + * lib.numSeparate(2016, '.,'); + * // returns '2016' + * + * @example + * lib.numSeparate(3000, '.,', true); + * // returns '3,000' + * + * @example + * lib.numSeparate(1234.56, '|,') + * // returns '1,234|56' + * + * @param {string|number} value the value to be converted + * @param {string} separators string of decimal, then thousands separators + * @param {boolean} separatethousands boolean, 4-digit integers are separated if true + * + * @return {string} the value that has been separated + */ +lib.numSeparate = function(value, separators, separatethousands) { + if(!separatethousands) separatethousands = false; -'use strict'; + if(typeof separators !== 'string' || separators.length === 0) { + throw new Error('Separator string required for formatting!'); + } -var Ternary = _dereq_('./ternary'); + if(typeof value === 'number') { + value = String(value); + } -var getSubplotCalcData = _dereq_('../../plots/get_data').getSubplotCalcData; -var counterRegex = _dereq_('../../lib').counterRegex; -var TERNARY = 'ternary'; + var thousandsRe = /(\d+)(\d{3})/; + var decimalSep = separators.charAt(0); + var thouSep = separators.charAt(1); + + var x = value.split('.'); + var x1 = x[0]; + var x2 = x.length > 1 ? decimalSep + x[1] : ''; -exports.name = TERNARY; + // Years are ignored for thousands separators + if(thouSep && (x.length > 1 || x1.length > 4 || separatethousands)) { + while(thousandsRe.test(x1)) { + x1 = x1.replace(thousandsRe, '$1' + thouSep + '$2'); + } + } -var attr = exports.attr = 'subplot'; + return x1 + x2; +}; -exports.idRoot = TERNARY; +var TEMPLATE_STRING_REGEX = /%{([^\s%{}:]*)(:[^}]*)?}/g; +var SIMPLE_PROPERTY_REGEX = /^\w*$/; -exports.idRegex = exports.attrRegex = counterRegex(TERNARY); +/** + * Substitute values from an object into a string + * + * Examples: + * Lib.templateString('name: %{trace}', {trace: 'asdf'}) --> 'name: asdf' + * Lib.templateString('name: %{trace[0].name}', {trace: [{name: 'asdf'}]}) --> 'name: asdf' + * + * @param {string} input string containing %{...} template strings + * @param {obj} data object containing substitution values + * + * @return {string} templated string + */ +lib.templateString = function(string, obj) { + // Not all that useful, but cache nestedProperty instantiation + // just in case it speeds things up *slightly*: + var getterCache = {}; -var attributes = exports.attributes = {}; -attributes[attr] = { - valType: 'subplotid', - - dflt: 'ternary', - editType: 'calc', - + return string.replace(TEMPLATE_STRING_REGEX, function(dummy, key) { + if(SIMPLE_PROPERTY_REGEX.test(key)) { + return obj[key] || ''; + } + getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get; + return getterCache[key]() || ''; + }); }; -exports.layoutAttributes = _dereq_('./layout_attributes'); +var TEMPLATE_STRING_FORMAT_SEPARATOR = /^:/; +var numberOfHoverTemplateWarnings = 0; +var maximumNumberOfHoverTemplateWarnings = 10; +/** + * Substitute values from an object into a string and optionally formats them using d3-format, + * or fallback to associated labels. + * + * Examples: + * Lib.templateString('name: %{trace}', {trace: 'asdf'}) --> 'name: asdf' + * Lib.templateString('name: %{trace[0].name}', {trace: [{name: 'asdf'}]}) --> 'name: asdf' + * Lib.templateString('price: %{y:$.2f}', {y: 1}) --> 'price: $1.00' + * + * @param {string} input string containing %{...:...} template strings + * @param {obj} data object containing fallback text when no formatting is specified, ex.: {yLabel: 'formattedYValue'} + * @param {obj} data objects containing substitution values + * + * @return {string} templated string + */ +lib.hovertemplateString = function(string, labels) { + var args = arguments; + // Not all that useful, but cache nestedProperty instantiation + // just in case it speeds things up *slightly*: + var getterCache = {}; -exports.supplyLayoutDefaults = _dereq_('./layout_defaults'); + return string.replace(TEMPLATE_STRING_REGEX, function(match, key, format) { + var obj, value, i; + for(i = 2; i < args.length; i++) { + obj = args[i]; + if(obj.hasOwnProperty(key)) { + value = obj[key]; + break; + } -exports.plot = function plotTernary(gd) { - var fullLayout = gd._fullLayout; - var calcData = gd.calcdata; - var ternaryIds = fullLayout._subplots[TERNARY]; + if(!SIMPLE_PROPERTY_REGEX.test(key)) { + value = getterCache[key] || lib.nestedProperty(obj, key).get(); + if(value) getterCache[key] = value; + } + if(value !== undefined) break; + } - for(var i = 0; i < ternaryIds.length; i++) { - var ternaryId = ternaryIds[i], - ternaryCalcData = getSubplotCalcData(calcData, TERNARY, ternaryId), - ternary = fullLayout[ternaryId]._subplot; - - // If ternary is not instantiated, create one! - if(!ternary) { - ternary = new Ternary({ - id: ternaryId, - graphDiv: gd, - container: fullLayout._ternarylayer.node() - }, - fullLayout - ); + if(value === undefined) { + if(numberOfHoverTemplateWarnings < maximumNumberOfHoverTemplateWarnings) { + lib.warn('Variable \'' + key + '\' in hovertemplate could not be found!'); + value = match; + } - fullLayout[ternaryId]._subplot = ternary; + if(numberOfHoverTemplateWarnings === maximumNumberOfHoverTemplateWarnings) { + lib.warn('Too many hovertemplate warnings - additional warnings will be suppressed'); + } + numberOfHoverTemplateWarnings++; } - ternary.plot(ternaryCalcData, fullLayout, gd._promises); - } + if(format) { + value = d3.format(format.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ''))(value); + } else { + if(labels.hasOwnProperty(key + 'Label')) value = labels[key + 'Label']; + } + return value; + }); }; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var oldTernaryKeys = oldFullLayout._subplots[TERNARY] || []; +/* + * alphanumeric string sort, tailored for subplot IDs like scene2, scene10, x10y13 etc + */ +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; - for(var i = 0; i < oldTernaryKeys.length; i++) { - var oldTernaryKey = oldTernaryKeys[i]; - var oldTernary = oldFullLayout[oldTernaryKey]._subplot; + if(isNumA) numA = 10 * numA + charA - char0; + if(isNumB) numB = 10 * numB + charB - char0; - if(!newFullLayout[oldTernaryKey] && !!oldTernary) { - oldTernary.plotContainer.remove(); - oldTernary.clipDef.remove(); - oldTernary.clipDefRelative.remove(); - oldTernary.layers['a-title'].remove(); - oldTernary.layers['b-title'].remove(); - oldTernary.layers['c-title'].remove(); + if(!isNumA || !isNumB) { + if(numA !== numB) return numA - numB; + if(charA !== charB) return charA - charB; } } + return numB - numA; }; -},{"../../lib":696,"../../plots/get_data":781,"./layout_attributes":824,"./layout_defaults":825,"./ternary":826}],824:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var colorAttrs = _dereq_('../../components/color/attributes'); -var domainAttrs = _dereq_('../domain').attributes; -var axesAttrs = _dereq_('../cartesian/layout_attributes'); - -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var extendFlat = _dereq_('../../lib/extend').extendFlat; +// repeatable pseudorandom generator +var randSeed = 2000000000; -var ternaryAxesAttrs = { - title: axesAttrs.title, - titlefont: axesAttrs.titlefont, - color: axesAttrs.color, - // ticks - tickmode: axesAttrs.tickmode, - nticks: extendFlat({}, axesAttrs.nticks, {dflt: 6, min: 1}), - tick0: axesAttrs.tick0, - dtick: axesAttrs.dtick, - tickvals: axesAttrs.tickvals, - ticktext: axesAttrs.ticktext, - ticks: axesAttrs.ticks, - ticklen: axesAttrs.ticklen, - tickwidth: axesAttrs.tickwidth, - tickcolor: axesAttrs.tickcolor, - showticklabels: axesAttrs.showticklabels, - showtickprefix: axesAttrs.showtickprefix, - tickprefix: axesAttrs.tickprefix, - showticksuffix: axesAttrs.showticksuffix, - ticksuffix: axesAttrs.ticksuffix, - showexponent: axesAttrs.showexponent, - exponentformat: axesAttrs.exponentformat, - separatethousands: axesAttrs.separatethousands, - tickfont: axesAttrs.tickfont, - tickangle: axesAttrs.tickangle, - tickformat: axesAttrs.tickformat, - tickformatstops: axesAttrs.tickformatstops, - hoverformat: axesAttrs.hoverformat, - // lines and grids - showline: extendFlat({}, axesAttrs.showline, {dflt: true}), - linecolor: axesAttrs.linecolor, - linewidth: axesAttrs.linewidth, - showgrid: extendFlat({}, axesAttrs.showgrid, {dflt: true}), - gridcolor: axesAttrs.gridcolor, - gridwidth: axesAttrs.gridwidth, - layer: axesAttrs.layer, - // range - min: { - valType: 'number', - dflt: 0, - - min: 0, - - } +lib.seedPseudoRandom = function() { + randSeed = 2000000000; }; -module.exports = overrideAll({ - domain: domainAttrs({name: 'ternary'}), - - bgcolor: { - valType: 'color', - - dflt: colorAttrs.background, - - }, - sum: { - valType: 'number', - - dflt: 1, - min: 0, - - }, - aaxis: ternaryAxesAttrs, - baxis: ternaryAxesAttrs, - caxis: ternaryAxesAttrs -}, 'plot', 'from-root'); +lib.pseudoRandom = function() { + var lastVal = randSeed; + randSeed = (69069 * randSeed + 1) % 4294967296; + // don't let consecutive vals be too close together + // gets away from really trying to be random, in favor of better local uniformity + if(Math.abs(randSeed - lastVal) < 429496729) return lib.pseudoRandom(); + return randSeed / 4294967296; +}; -},{"../../components/color/attributes":569,"../../lib/extend":685,"../../plot_api/edit_types":727,"../cartesian/layout_attributes":757,"../domain":770}],825:[function(_dereq_,module,exports){ +},{"../constants/numerical":140,"./anchor_utils":144,"./angles":145,"./array":146,"./clean_number":147,"./clear_responsive":149,"./coerce":150,"./dates":151,"./extend":153,"./filter_unique":154,"./filter_visible":155,"./geometry2d":156,"./get_graph_div":157,"./identity":158,"./is_plain_object":160,"./keyed_container":161,"./localize":162,"./loggers":163,"./make_trace_groups":164,"./matrix":165,"./mod":166,"./nested_property":167,"./noop":168,"./notifier":169,"./push_unique":172,"./regex":174,"./relative_attr":175,"./relink_private":176,"./search":177,"./stats":179,"./throttle":181,"./to_log_range":182,"d3":8,"fast-isnumeric":10}],160:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Color = _dereq_('../../components/color'); -var Template = _dereq_('../../plot_api/plot_template'); -var Lib = _dereq_('../../lib'); - -var handleSubplotDefaults = _dereq_('../subplot_defaults'); -var handleTickLabelDefaults = _dereq_('../cartesian/tick_label_defaults'); -var handleTickMarkDefaults = _dereq_('../cartesian/tick_mark_defaults'); -var handleTickValueDefaults = _dereq_('../cartesian/tick_value_defaults'); -var handleLineGridDefaults = _dereq_('../cartesian/line_grid_defaults'); -var layoutAttributes = _dereq_('./layout_attributes'); - -var axesNames = ['aaxis', 'baxis', 'caxis']; - -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - handleSubplotDefaults(layoutIn, layoutOut, fullData, { - type: 'ternary', - attributes: layoutAttributes, - handleDefaults: handleTernaryDefaults, - font: layoutOut.font, - paper_bgcolor: layoutOut.paper_bgcolor - }); -}; - -function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, options) { - var bgColor = coerce('bgcolor'); - var sum = coerce('sum'); - options.bgColor = Color.combine(bgColor, options.paper_bgcolor); - var axName, containerIn, containerOut; - - // TODO: allow most (if not all) axis attributes to be set - // in the outer container and used as defaults in the individual axes? - - for(var j = 0; j < axesNames.length; j++) { - axName = axesNames[j]; - containerIn = ternaryLayoutIn[axName] || {}; - containerOut = Template.newContainer(ternaryLayoutOut, axName); - containerOut._name = axName; - - handleAxisDefaults(containerIn, containerOut, options); - } - - // if the min values contradict each other, set them all to default (0) - // and delete *all* the inputs so the user doesn't get confused later by - // changing one and having them all change. - var aaxis = ternaryLayoutOut.aaxis, - baxis = ternaryLayoutOut.baxis, - caxis = ternaryLayoutOut.caxis; - if(aaxis.min + baxis.min + caxis.min >= sum) { - aaxis.min = 0; - baxis.min = 0; - caxis.min = 0; - if(ternaryLayoutIn.aaxis) delete ternaryLayoutIn.aaxis.min; - if(ternaryLayoutIn.baxis) delete ternaryLayoutIn.baxis.min; - if(ternaryLayoutIn.caxis) delete ternaryLayoutIn.caxis.min; - } -} - -function handleAxisDefaults(containerIn, containerOut, options) { - var axAttrs = layoutAttributes[containerOut._name]; - - function coerce(attr, dflt) { - return Lib.coerce(containerIn, containerOut, axAttrs, attr, dflt); - } - - containerOut.type = 'linear'; // no other types allowed for ternary - - var dfltColor = coerce('color'); - // if axis.color was provided, use it for fonts too; otherwise, - // inherit from global font color in case that was provided. - var dfltFontColor = (dfltColor !== axAttrs.color.dflt) ? dfltColor : options.font.color; - - var axName = containerOut._name, - letterUpper = axName.charAt(0).toUpperCase(), - dfltTitle = 'Component ' + letterUpper; - - var title = coerce('title', dfltTitle); - containerOut._hovertitle = title === dfltTitle ? title : letterUpper; - - Lib.coerceFont(coerce, 'titlefont', { - family: options.font.family, - size: Math.round(options.font.size * 1.2), - color: dfltFontColor - }); - // range is just set by 'min' - max is determined by the other axes mins - coerce('min'); +'use strict'; - handleTickValueDefaults(containerIn, containerOut, coerce, 'linear'); - handleTickLabelDefaults(containerIn, containerOut, coerce, 'linear', {}); - handleTickMarkDefaults(containerIn, containerOut, coerce, - { outerTicks: true }); +// more info: http://stackoverflow.com/questions/18531624/isplainobject-thing +module.exports = function isPlainObject(obj) { - var showTickLabels = coerce('showticklabels'); - if(showTickLabels) { - Lib.coerceFont(coerce, 'tickfont', { - family: options.font.family, - size: options.font.size, - color: dfltFontColor - }); - coerce('tickangle'); - coerce('tickformat'); + // We need to be a little less strict in the `imagetest` container because + // of how async image requests are handled. + // + // N.B. isPlainObject(new Constructor()) will return true in `imagetest` + if(window && window.process && window.process.versions) { + return Object.prototype.toString.call(obj) === '[object Object]'; } - handleLineGridDefaults(containerIn, containerOut, coerce, { - dfltColor: dfltColor, - bgColor: options.bgColor, - // default grid color is darker here (60%, vs cartesian default ~91%) - // because the grid is not square so the eye needs heavier cues to follow - blend: 60, - showLine: true, - showGrid: true, - noZeroLine: true, - attributes: axAttrs - }); - - coerce('hoverformat'); - coerce('layer'); -} + return ( + Object.prototype.toString.call(obj) === '[object Object]' && + Object.getPrototypeOf(obj) === Object.prototype + ); +}; -},{"../../components/color":570,"../../lib":696,"../../plot_api/plot_template":734,"../cartesian/line_grid_defaults":759,"../cartesian/tick_label_defaults":764,"../cartesian/tick_mark_defaults":765,"../cartesian/tick_value_defaults":766,"../subplot_defaults":822,"./layout_attributes":824}],826:[function(_dereq_,module,exports){ +},{}],161:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var _ = Lib._; -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var setConvert = _dereq_('../cartesian/set_convert'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var Plots = _dereq_('../plots'); -var Axes = _dereq_('../cartesian/axes'); -var dragElement = _dereq_('../../components/dragelement'); -var Fx = _dereq_('../../components/fx'); -var Titles = _dereq_('../../components/titles'); -var prepSelect = _dereq_('../cartesian/select').prepSelect; -var selectOnClick = _dereq_('../cartesian/select').selectOnClick; -var clearSelect = _dereq_('../cartesian/select').clearSelect; -var constants = _dereq_('../cartesian/constants'); - -function Ternary(options, fullLayout) { - this.id = options.id; - this.graphDiv = options.graphDiv; - this.init(fullLayout); - this.makeFramework(fullLayout); - - // unfortunately, we have to keep track of some axis tick settings - // as ternary subplots do not implement the 'ticks' editType - this.aTickLayout = null; - this.bTickLayout = null; - this.cTickLayout = null; -} - -module.exports = Ternary; - -var proto = Ternary.prototype; - -proto.init = function(fullLayout) { - this.container = fullLayout._ternarylayer; - this.defs = fullLayout._defs; - this.layoutId = fullLayout._uid; - this.traceHash = {}; - this.layers = {}; -}; - -proto.plot = function(ternaryCalcData, fullLayout) { - var _this = this; - var ternaryLayout = fullLayout[_this.id]; - var graphSize = fullLayout._size; - - _this._hasClipOnAxisFalse = false; - for(var i = 0; i < ternaryCalcData.length; i++) { - var trace = ternaryCalcData[i][0].trace; - - if(trace.cliponaxis === false) { - _this._hasClipOnAxisFalse = true; - break; - } - } - - _this.updateLayers(ternaryLayout); - _this.adjustLayout(ternaryLayout, graphSize); - Plots.generalUpdatePerTraceModule(_this.graphDiv, _this, ternaryCalcData, ternaryLayout); - _this.layers.plotbg.select('path').call(Color.fill, ternaryLayout.bgcolor); -}; - -proto.makeFramework = function(fullLayout) { - var _this = this; - var ternaryLayout = fullLayout[_this.id]; - - var clipId = _this.clipId = 'clip' + _this.layoutId + _this.id; - var clipIdRelative = _this.clipIdRelative = 'clip-relative' + _this.layoutId + _this.id; - - // clippath for this ternary subplot - _this.clipDef = Lib.ensureSingleById(fullLayout._clips, 'clipPath', clipId, function(s) { - s.append('path').attr('d', 'M0,0Z'); - }); - - // 'relative' clippath (i.e. no translation) for this ternary subplot - _this.clipDefRelative = Lib.ensureSingleById(fullLayout._clips, 'clipPath', clipIdRelative, function(s) { - s.append('path').attr('d', 'M0,0Z'); - }); - - // container for everything in this ternary subplot - _this.plotContainer = Lib.ensureSingle(_this.container, 'g', _this.id); - _this.updateLayers(ternaryLayout); - - Drawing.setClipUrl(_this.layers.backplot, clipId); - Drawing.setClipUrl(_this.layers.grids, clipId); -}; +var nestedProperty = _dereq_('./nested_property'); -proto.updateLayers = function(ternaryLayout) { - var _this = this; - var layers = _this.layers; +var SIMPLE_PROPERTY_REGEX = /^\w*$/; - // inside that container, we have one container for the data, and - // one each for the three axes around it. +// bitmask for deciding what's updated. Sometimes the name needs to be updated, +// sometimes the value needs to be updated, and sometimes both do. This is just +// a simple way to track what's updated such that it's a simple OR operation to +// assimilate new updates. +// +// The only exception is the UNSET bit that tracks when we need to explicitly +// unset and remove the property. This concrn arises because of the special +// way in which nestedProperty handles null/undefined. When you specify `null`, +// it prunes any unused items in the tree. I ran into some issues with it getting +// null vs undefined confused, so UNSET is just a bit that forces the property +// update to send `null`, removing the property explicitly rather than setting +// it to undefined. +var NONE = 0; +var NAME = 1; +var VALUE = 2; +var BOTH = 3; +var UNSET = 4; - var plotLayers = ['draglayer', 'plotbg', 'backplot', 'grids']; +module.exports = function keyedContainer(baseObj, path, keyName, valueName) { + keyName = keyName || 'name'; + valueName = valueName || 'value'; + var i, arr, baseProp; + var changeTypes = {}; - if(ternaryLayout.aaxis.layer === 'below traces') { - plotLayers.push('aaxis', 'aline'); - } - if(ternaryLayout.baxis.layer === 'below traces') { - plotLayers.push('baxis', 'bline'); - } - if(ternaryLayout.caxis.layer === 'below traces') { - plotLayers.push('caxis', 'cline'); + if(path && path.length) { + baseProp = nestedProperty(baseObj, path); + arr = baseProp.get(); + } else { + arr = baseObj; } - plotLayers.push('frontplot'); + path = path || ''; - if(ternaryLayout.aaxis.layer === 'above traces') { - plotLayers.push('aaxis', 'aline'); - } - if(ternaryLayout.baxis.layer === 'above traces') { - plotLayers.push('baxis', 'bline'); - } - if(ternaryLayout.caxis.layer === 'above traces') { - plotLayers.push('caxis', 'cline'); + // Construct an index: + var indexLookup = {}; + if(arr) { + for(i = 0; i < arr.length; i++) { + indexLookup[arr[i][keyName]] = i; + } } - var toplevel = _this.plotContainer.selectAll('g.toplevel') - .data(plotLayers, String); - - var grids = ['agrid', 'bgrid', 'cgrid']; + var isSimpleValueProp = SIMPLE_PROPERTY_REGEX.test(valueName); - toplevel.enter().append('g') - .attr('class', function(d) { return 'toplevel ' + d; }) - .each(function(d) { - var s = d3.select(this); - layers[d] = s; + var obj = { + set: function(name, value) { + var changeType = value === null ? UNSET : NONE; - // containers for different trace types. - // NOTE - this is different from cartesian, where all traces - // are in front of grids. Here I'm putting maps behind the grids - // so the grids will always be visible if they're requested. - // Perhaps we want that for cartesian too? - if(d === 'frontplot') { - s.append('g').classed('scatterlayer', true); - } else if(d === 'backplot') { - s.append('g').classed('maplayer', true); - } else if(d === 'plotbg') { - s.append('path').attr('d', 'M0,0Z'); - } else if(d === 'aline' || d === 'bline' || d === 'cline') { - s.append('path'); - } else if(d === 'grids') { - grids.forEach(function(d) { - layers[d] = s.append('g').classed('grid ' + d, true); + // create the base array if necessary + if(!arr) { + if(!baseProp || changeType === UNSET) return; - var fictID = (d === 'bgrid') ? 'x' : 'y'; - layers[d].append('g').classed(fictID, true); - }); + arr = []; + baseProp.set(arr); } - }); - toplevel.order(); -}; - -var w_over_h = Math.sqrt(4 / 3); + var idx = indexLookup[name]; + if(idx === undefined) { + if(changeType === UNSET) return; -proto.adjustLayout = function(ternaryLayout, graphSize) { - var _this = this, - domain = ternaryLayout.domain, - xDomainCenter = (domain.x[0] + domain.x[1]) / 2, - yDomainCenter = (domain.y[0] + domain.y[1]) / 2, - xDomain = domain.x[1] - domain.x[0], - yDomain = domain.y[1] - domain.y[0], - wmax = xDomain * graphSize.w, - hmax = yDomain * graphSize.h, - sum = ternaryLayout.sum, - amin = ternaryLayout.aaxis.min, - bmin = ternaryLayout.baxis.min, - cmin = ternaryLayout.caxis.min; - - var x0, y0, w, h, xDomainFinal, yDomainFinal; - - if(wmax > w_over_h * hmax) { - h = hmax; - w = h * w_over_h; - } - else { - w = wmax; - h = w / w_over_h; - } + changeType = changeType | BOTH; + idx = arr.length; + indexLookup[name] = idx; + } else if(value !== (isSimpleValueProp ? arr[idx][valueName] : nestedProperty(arr[idx], valueName).get())) { + changeType = changeType | VALUE; + } - xDomainFinal = xDomain * w / wmax; - yDomainFinal = yDomain * h / hmax; + var newValue = arr[idx] = arr[idx] || {}; + newValue[keyName] = name; - x0 = graphSize.l + graphSize.w * xDomainCenter - w / 2; - y0 = graphSize.t + graphSize.h * (1 - yDomainCenter) - h / 2; + if(isSimpleValueProp) { + newValue[valueName] = value; + } else { + nestedProperty(newValue, valueName).set(value); + } - _this.x0 = x0; - _this.y0 = y0; - _this.w = w; - _this.h = h; - _this.sum = sum; + // If it's not an unset, force that bit to be unset. This is all related to the fact + // that undefined and null are a bit specially implemented in nestedProperties. + if(value !== null) { + changeType = changeType & ~UNSET; + } - // set up the x and y axis objects we'll use to lay out the points - _this.xaxis = { - type: 'linear', - range: [amin + 2 * cmin - sum, sum - amin - 2 * bmin], - domain: [ - xDomainCenter - xDomainFinal / 2, - xDomainCenter + xDomainFinal / 2 - ], - _id: 'x' - }; - setConvert(_this.xaxis, _this.graphDiv._fullLayout); - _this.xaxis.setScale(); - _this.xaxis.isPtWithinRange = function(d) { - return ( - d.a >= _this.aaxis.range[0] && - d.a <= _this.aaxis.range[1] && - d.b >= _this.baxis.range[1] && - d.b <= _this.baxis.range[0] && - d.c >= _this.caxis.range[1] && - d.c <= _this.caxis.range[0] - ); - }; + changeTypes[idx] = changeTypes[idx] | changeType; - _this.yaxis = { - type: 'linear', - range: [amin, sum - bmin - cmin], - domain: [ - yDomainCenter - yDomainFinal / 2, - yDomainCenter + yDomainFinal / 2 - ], - _id: 'y' - }; - setConvert(_this.yaxis, _this.graphDiv._fullLayout); - _this.yaxis.setScale(); - _this.yaxis.isPtWithinRange = function() { return true; }; - - // set up the modified axes for tick drawing - var yDomain0 = _this.yaxis.domain[0]; - - // aaxis goes up the left side. Set it up as a y axis, but with - // fictitious angles and domain, but then rotate and translate - // it into place at the end - var aaxis = _this.aaxis = extendFlat({}, ternaryLayout.aaxis, { - visible: true, - range: [amin, sum - bmin - cmin], - side: 'left', - _counterangle: 30, - // tickangle = 'auto' means 0 anyway for a y axis, need to coerce to 0 here - // so we can shift by 30. - tickangle: (+ternaryLayout.aaxis.tickangle || 0) - 30, - domain: [yDomain0, yDomain0 + yDomainFinal * w_over_h], - _axislayer: _this.layers.aaxis, - _gridlayer: _this.layers.agrid, - anchor: 'free', - position: 0, - _pos: 0, // _this.xaxis.domain[0] * graphSize.w, - _id: 'y', - _length: w, - _gridpath: 'M0,0l' + h + ',-' + (w / 2), - automargin: false // don't use automargins routine for labels - }); - setConvert(aaxis, _this.graphDiv._fullLayout); - aaxis.setScale(); - - // baxis goes across the bottom (backward). We can set it up as an x axis - // without any enclosing transformation. - var baxis = _this.baxis = extendFlat({}, ternaryLayout.baxis, { - visible: true, - range: [sum - amin - cmin, bmin], - side: 'bottom', - _counterangle: 30, - domain: _this.xaxis.domain, - _axislayer: _this.layers.baxis, - _gridlayer: _this.layers.bgrid, - _counteraxis: _this.aaxis, - anchor: 'free', - position: 0, - _pos: 0, // (1 - yDomain0) * graphSize.h, - _id: 'x', - _length: w, - _gridpath: 'M0,0l-' + (w / 2) + ',-' + h, - automargin: false // don't use automargins routine for labels - }); - setConvert(baxis, _this.graphDiv._fullLayout); - baxis.setScale(); - aaxis._counteraxis = baxis; - - // caxis goes down the right side. Set it up as a y axis, with - // post-transformation similar to aaxis - var caxis = _this.caxis = extendFlat({}, ternaryLayout.caxis, { - visible: true, - range: [sum - amin - bmin, cmin], - side: 'right', - _counterangle: 30, - tickangle: (+ternaryLayout.caxis.tickangle || 0) + 30, - domain: [yDomain0, yDomain0 + yDomainFinal * w_over_h], - _axislayer: _this.layers.caxis, - _gridlayer: _this.layers.cgrid, - _counteraxis: _this.baxis, - anchor: 'free', - position: 0, - _pos: 0, // _this.xaxis.domain[1] * graphSize.w, - _id: 'y', - _length: w, - _gridpath: 'M0,0l-' + h + ',' + (w / 2), - automargin: false // don't use automargins routine for labels - }); - setConvert(caxis, _this.graphDiv._fullLayout); - caxis.setScale(); - - var triangleClip = 'M' + x0 + ',' + (y0 + h) + 'h' + w + 'l-' + (w / 2) + ',-' + h + 'Z'; - _this.clipDef.select('path').attr('d', triangleClip); - _this.layers.plotbg.select('path').attr('d', triangleClip); - - var triangleClipRelative = 'M0,' + h + 'h' + w + 'l-' + (w / 2) + ',-' + h + 'Z'; - _this.clipDefRelative.select('path').attr('d', triangleClipRelative); - - var plotTransform = 'translate(' + x0 + ',' + y0 + ')'; - _this.plotContainer.selectAll('.scatterlayer,.maplayer') - .attr('transform', plotTransform); - - _this.clipDefRelative.select('path').attr('transform', null); - - // TODO: shift axes to accommodate linewidth*sin(30) tick mark angle - - // TODO: there's probably an easier way to handle these translations/offsets now... - var bTransform = 'translate(' + (x0 - baxis._offset) + ',' + (y0 + h) + ')'; - - _this.layers.baxis.attr('transform', bTransform); - _this.layers.bgrid.attr('transform', bTransform); - - var aTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(30)translate(0,' + -aaxis._offset + ')'; - _this.layers.aaxis.attr('transform', aTransform); - _this.layers.agrid.attr('transform', aTransform); - - var cTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(-30)translate(0,' + -caxis._offset + ')'; - _this.layers.caxis.attr('transform', cTransform); - _this.layers.cgrid.attr('transform', cTransform); - - _this.drawAxes(true); - - // remove crispEdges - all the off-square angles in ternary plots - // make these counterproductive. - _this.plotContainer.selectAll('.crisp').classed('crisp', false); - - _this.layers.aline.select('path') - .attr('d', aaxis.showline ? - 'M' + x0 + ',' + (y0 + h) + 'l' + (w / 2) + ',-' + h : 'M0,0') - .call(Color.stroke, aaxis.linecolor || '#000') - .style('stroke-width', (aaxis.linewidth || 0) + 'px'); - _this.layers.bline.select('path') - .attr('d', baxis.showline ? - 'M' + x0 + ',' + (y0 + h) + 'h' + w : 'M0,0') - .call(Color.stroke, baxis.linecolor || '#000') - .style('stroke-width', (baxis.linewidth || 0) + 'px'); - _this.layers.cline.select('path') - .attr('d', caxis.showline ? - 'M' + (x0 + w / 2) + ',' + y0 + 'l' + (w / 2) + ',' + h : 'M0,0') - .call(Color.stroke, caxis.linecolor || '#000') - .style('stroke-width', (caxis.linewidth || 0) + 'px'); + return obj; + }, + get: function(name) { + if(!arr) return; - if(!_this.graphDiv._context.staticPlot) { - _this.initInteractions(); - } + var idx = indexLookup[name]; - Drawing.setClipUrl( - _this.layers.frontplot, - _this._hasClipOnAxisFalse ? null : _this.clipId - ); -}; + if(idx === undefined) { + return undefined; + } else if(isSimpleValueProp) { + return arr[idx][valueName]; + } else { + return nestedProperty(arr[idx], valueName).get(); + } + }, + rename: function(name, newName) { + var idx = indexLookup[name]; -proto.drawAxes = function(doTitles) { - var _this = this; - var gd = _this.graphDiv; - var titlesuffix = _this.id.substr(7) + 'title'; - var layers = _this.layers; - var aaxis = _this.aaxis; - var baxis = _this.baxis; - var caxis = _this.caxis; - var newTickLayout; + if(idx === undefined) return obj; + changeTypes[idx] = changeTypes[idx] | NAME; - newTickLayout = strTickLayout(aaxis); - if(_this.aTickLayout !== newTickLayout) { - layers.aaxis.selectAll('.ytick').remove(); - _this.aTickLayout = newTickLayout; - } + indexLookup[newName] = idx; + delete indexLookup[name]; - newTickLayout = strTickLayout(baxis); - if(_this.bTickLayout !== newTickLayout) { - layers.baxis.selectAll('.xtick').remove(); - _this.bTickLayout = newTickLayout; - } + arr[idx][keyName] = newName; - newTickLayout = strTickLayout(caxis); - if(_this.cTickLayout !== newTickLayout) { - layers.caxis.selectAll('.ytick').remove(); - _this.cTickLayout = newTickLayout; - } + return obj; + }, + remove: function(name) { + var idx = indexLookup[name]; - // 3rd arg true below skips titles, so we can configure them - // correctly later on. - Axes.doTicksSingle(gd, aaxis, true); - Axes.doTicksSingle(gd, baxis, true); - Axes.doTicksSingle(gd, caxis, true); + if(idx === undefined) return obj; - if(doTitles) { - var apad = Math.max(aaxis.showticklabels ? aaxis.tickfont.size / 2 : 0, - (caxis.showticklabels ? caxis.tickfont.size * 0.75 : 0) + - (caxis.ticks === 'outside' ? caxis.ticklen * 0.87 : 0)); - _this.layers['a-title'] = Titles.draw(gd, 'a' + titlesuffix, { - propContainer: aaxis, - propName: _this.id + '.aaxis.title', - placeholder: _(gd, 'Click to enter Component A title'), - attributes: { - x: _this.x0 + _this.w / 2, - y: _this.y0 - aaxis.titlefont.size / 3 - apad, - 'text-anchor': 'middle' + var object = arr[idx]; + if(Object.keys(object).length > 2) { + // This object contains more than just the key/value, so unset + // the value without modifying the entry otherwise: + 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 { + // Perform this update *strictly* so we can check whether the result's + // been pruned. If so, it's a removal. If not, it's a value unset only. + nestedProperty(object, valueName).set(null); - var bpad = (baxis.showticklabels ? baxis.tickfont.size : 0) + - (baxis.ticks === 'outside' ? baxis.ticklen : 0) + 3; + // Now check if the top level nested property has any keys left. If so, + // the object still has values so we only want to unset the key. If not, + // the entire object can be removed since there's no other data. + // var topLevelKeys = Object.keys(object[valueName.split('.')[0]] || []); - _this.layers['b-title'] = Titles.draw(gd, 'b' + titlesuffix, { - propContainer: baxis, - propName: _this.id + '.baxis.title', - placeholder: _(gd, 'Click to enter Component B title'), - attributes: { - x: _this.x0 - bpad, - y: _this.y0 + _this.h + baxis.titlefont.size * 0.83 + bpad, - 'text-anchor': 'middle' + changeTypes[idx] = changeTypes[idx] | VALUE | UNSET; } - }); - _this.layers['c-title'] = Titles.draw(gd, 'c' + titlesuffix, { - propContainer: caxis, - propName: _this.id + '.caxis.title', - placeholder: _(gd, 'Click to enter Component C title'), - attributes: { - x: _this.x0 + _this.w + bpad, - y: _this.y0 + _this.h + caxis.titlefont.size * 0.83 + bpad, - 'text-anchor': 'middle' + return obj; + }, + constructUpdate: function() { + var astr, idx; + var update = {}; + var changed = Object.keys(changeTypes); + for(var i = 0; i < changed.length; i++) { + idx = changed[i]; + 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; + } } - }); - } -}; -function strTickLayout(axLayout) { - return axLayout.ticks + String(axLayout.ticklen) + String(axLayout.showticklabels); -} + return update; + } + }; + return obj; +}; -// hard coded paths for zoom corners -// uses the same sizing as cartesian, length is MINZOOM/2, width is 3px -var CLEN = constants.MINZOOM / 2 + 0.87; -var BLPATH = 'm-0.87,.5h' + CLEN + 'v3h-' + (CLEN + 5.2) + - 'l' + (CLEN / 2 + 2.6) + ',-' + (CLEN * 0.87 + 4.5) + - 'l2.6,1.5l-' + (CLEN / 2) + ',' + (CLEN * 0.87) + 'Z'; -var BRPATH = 'm0.87,.5h-' + CLEN + 'v3h' + (CLEN + 5.2) + - 'l-' + (CLEN / 2 + 2.6) + ',-' + (CLEN * 0.87 + 4.5) + - 'l-2.6,1.5l' + (CLEN / 2) + ',' + (CLEN * 0.87) + 'Z'; -var TOPPATH = 'm0,1l' + (CLEN / 2) + ',' + (CLEN * 0.87) + - 'l2.6,-1.5l-' + (CLEN / 2 + 2.6) + ',-' + (CLEN * 0.87 + 4.5) + - 'l-' + (CLEN / 2 + 2.6) + ',' + (CLEN * 0.87 + 4.5) + - 'l2.6,1.5l' + (CLEN / 2) + ',-' + (CLEN * 0.87) + 'Z'; -var STARTMARKER = 'm0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z'; +},{"./nested_property":167}],162:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -// I guess this could be shared with cartesian... but for now it's separate. -var SHOWZOOMOUTTIP = true; -proto.initInteractions = function() { - var _this = this, - dragger = _this.layers.plotbg.select('path').node(), - gd = _this.graphDiv, - zoomContainer = gd._fullLayout._zoomlayer; +'use strict'; - // use plotbg for the main interactions - var dragOptions = { - element: dragger, - gd: gd, - plotinfo: { - id: _this.id, - xaxis: _this.xaxis, - yaxis: _this.yaxis - }, - subplot: _this.id, - prepFn: function(e, startX, startY) { - // these aren't available yet when initInteractions - // is called - dragOptions.xaxes = [_this.xaxis]; - dragOptions.yaxes = [_this.yaxis]; - var dragModeNow = gd._fullLayout.dragmode; +var Registry = _dereq_('../registry'); - if(dragModeNow === 'lasso') dragOptions.minDrag = 1; - else dragOptions.minDrag = undefined; +/** + * localize: translate a string for the current locale + * + * @param {object} gd: the graphDiv for context + * gd._context.locale determines the language (& optional region/country) + * the dictionary for each locale may either be supplied in + * gd._context.locales or globally via Plotly.register + * @param {string} s: the string to translate + */ +module.exports = function localize(gd, s) { + var locale = gd._context.locale; - if(dragModeNow === 'zoom') { - dragOptions.moveFn = zoomMove; - dragOptions.clickFn = clickZoomPan; - dragOptions.doneFn = zoomDone; - zoomPrep(e, startX, startY); - } - else if(dragModeNow === 'pan') { - dragOptions.moveFn = plotDrag; - dragOptions.clickFn = clickZoomPan; - dragOptions.doneFn = dragDone; - panPrep(); - clearSelect(zoomContainer); - } - else if(dragModeNow === 'select' || dragModeNow === 'lasso') { - prepSelect(e, startX, startY, dragOptions, dragModeNow); + /* + * Priority of lookup: + * contextDicts[locale], + * registeredDicts[locale], + * contextDicts[baseLocale], (if baseLocale is distinct) + * registeredDicts[baseLocale] + * Return the first translation we find. + * This way if you have a regionalization you are allowed to specify + * only what's different from the base locale, everything else will + * fall back on the base. + */ + for(var i = 0; i < 2; i++) { + var locales = gd._context.locales; + for(var j = 0; j < 2; j++) { + var dict = (locales[locale] || {}).dictionary; + if(dict) { + var out = dict[s]; + if(out) return out; } - } - }; - - var x0, y0, mins0, span0, mins, lum, path0, dimmed, zb, corners; - - function clickZoomPan(numClicks, evt) { - var clickMode = gd._fullLayout.clickmode; - - removeZoombox(gd); - - if(numClicks === 2) { - var attrs = {}; - attrs[_this.id + '.aaxis.min'] = 0; - attrs[_this.id + '.baxis.min'] = 0; - attrs[_this.id + '.caxis.min'] = 0; - gd.emit('plotly_doubleclick', null); - Registry.call('relayout', gd, attrs); - } - - if(clickMode.indexOf('select') > -1 && numClicks === 1) { - selectOnClick(evt, gd, [_this.xaxis], [_this.yaxis], _this.id, dragOptions); + locales = Registry.localeRegistry; } - if(clickMode.indexOf('event') > -1) { - Fx.click(gd, evt, _this.id); - } + var baseLocale = locale.split('-')[0]; + if(baseLocale === locale) break; + locale = baseLocale; } - function zoomPrep(e, startX, startY) { - var dragBBox = dragger.getBoundingClientRect(); - x0 = startX - dragBBox.left; - y0 = startY - dragBBox.top; - mins0 = { - a: _this.aaxis.range[0], - b: _this.baxis.range[1], - c: _this.caxis.range[1] - }; - mins = mins0; - span0 = _this.aaxis.range[1] - mins0.a; - lum = tinycolor(_this.graphDiv._fullLayout[_this.id].bgcolor).getLuminance(); - path0 = 'M0,' + _this.h + 'L' + (_this.w / 2) + ', 0L' + _this.w + ',' + _this.h + 'Z'; - dimmed = false; - - zb = zoomContainer.append('path') - .attr('class', 'zoombox') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') - .style({ - 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', - 'stroke-width': 0 - }) - .attr('d', path0); - - corners = zoomContainer.append('path') - .attr('class', 'zoombox-corners') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') - .style({ - fill: Color.background, - stroke: Color.defaultLine, - 'stroke-width': 1, - opacity: 0 - }) - .attr('d', 'M0,0Z'); + return s; +}; - clearSelect(zoomContainer); - } +},{"../registry":243}],163:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - function getAFrac(x, y) { return 1 - (y / _this.h); } - function getBFrac(x, y) { return 1 - ((x + (_this.h - y) / Math.sqrt(3)) / _this.w); } - function getCFrac(x, y) { return ((x - (_this.h - y) / Math.sqrt(3)) / _this.w); } +'use strict'; - function zoomMove(dx0, dy0) { - var x1 = x0 + dx0, - y1 = y0 + dy0, - afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))), - bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))), - cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))), - xLeft = ((afrac / 2) + cfrac) * _this.w, - xRight = (1 - (afrac / 2) - bfrac) * _this.w, - xCenter = (xLeft + xRight) / 2, - xSpan = xRight - xLeft, - yBottom = (1 - afrac) * _this.h, - yTop = yBottom - xSpan / w_over_h; - - if(xSpan < constants.MINZOOM) { - mins = mins0; - zb.attr('d', path0); - corners.attr('d', 'M0,0Z'); - } - else { - mins = { - a: mins0.a + afrac * span0, - b: mins0.b + bfrac * span0, - c: mins0.c + cfrac * span0 - }; - zb.attr('d', path0 + 'M' + xLeft + ',' + yBottom + - 'H' + xRight + 'L' + xCenter + ',' + yTop + - 'L' + xLeft + ',' + yBottom + 'Z'); - corners.attr('d', 'M' + x0 + ',' + y0 + STARTMARKER + - 'M' + xLeft + ',' + yBottom + BLPATH + - 'M' + xRight + ',' + yBottom + BRPATH + - 'M' + xCenter + ',' + yTop + TOPPATH); - } - - 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); - dimmed = true; - } - } +/* eslint-disable no-console */ - function zoomDone() { - removeZoombox(gd); +var dfltConfig = _dereq_('../plot_api/plot_config').dfltConfig; - if(mins === mins0) return; +var loggers = module.exports = {}; - var attrs = {}; - attrs[_this.id + '.aaxis.min'] = mins.a; - attrs[_this.id + '.baxis.min'] = mins.b; - attrs[_this.id + '.caxis.min'] = mins.c; +/** + * ------------------------------------------ + * debugging tools + * ------------------------------------------ + */ - Registry.call('relayout', gd, attrs); +loggers.log = function() { + if(dfltConfig.logging > 1) { + var messages = ['LOG:']; - if(SHOWZOOMOUTTIP && gd.data && gd._context.showTips) { - Lib.notifier(_(gd, 'Double-click to zoom back out'), 'long'); - SHOWZOOMOUTTIP = false; + for(var i = 0; i < arguments.length; i++) { + messages.push(arguments[i]); } - } - function panPrep() { - mins0 = { - a: _this.aaxis.range[0], - b: _this.baxis.range[1], - c: _this.caxis.range[1] - }; - mins = mins0; + apply(console.trace || console.log, messages); } +}; - function plotDrag(dx, dy) { - var dxScaled = dx / _this.xaxis._m, - dyScaled = dy / _this.yaxis._m; - mins = { - a: mins0.a - dyScaled, - b: mins0.b + (dxScaled + dyScaled) / 2, - c: mins0.c - (dxScaled - dyScaled) / 2 - }; - var minsorted = [mins.a, mins.b, mins.c].sort(), - minindices = { - a: minsorted.indexOf(mins.a), - b: minsorted.indexOf(mins.b), - c: minsorted.indexOf(mins.c) - }; - if(minsorted[0] < 0) { - if(minsorted[1] + minsorted[0] / 2 < 0) { - minsorted[2] += minsorted[0] + minsorted[1]; - minsorted[0] = minsorted[1] = 0; - } - else { - minsorted[2] += minsorted[0] / 2; - minsorted[1] += minsorted[0] / 2; - minsorted[0] = 0; - } - mins = { - a: minsorted[minindices.a], - b: minsorted[minindices.b], - c: minsorted[minindices.c] - }; - dy = (mins0.a - mins.a) * _this.yaxis._m; - dx = (mins0.c - mins.c - mins0.b + mins.b) * _this.xaxis._m; +loggers.warn = function() { + if(dfltConfig.logging > 0) { + var messages = ['WARN:']; + + for(var i = 0; i < arguments.length; i++) { + messages.push(arguments[i]); } - // move the data (translate, don't redraw) - var plotTransform = 'translate(' + (_this.x0 + dx) + ',' + (_this.y0 + dy) + ')'; - _this.plotContainer.selectAll('.scatterlayer,.maplayer') - .attr('transform', plotTransform); + apply(console.trace || console.log, messages); + } +}; + +loggers.error = function() { + if(dfltConfig.logging > 0) { + var messages = ['ERROR:']; - var plotTransform2 = 'translate(' + -dx + ',' + -dy + ')'; - _this.clipDefRelative.select('path').attr('transform', plotTransform2); + for(var i = 0; i < arguments.length; i++) { + messages.push(arguments[i]); + } - // move the ticks - _this.aaxis.range = [mins.a, _this.sum - mins.b - mins.c]; - _this.baxis.range = [_this.sum - mins.a - mins.c, mins.b]; - _this.caxis.range = [_this.sum - mins.a - mins.b, mins.c]; + apply(console.error, messages); + } +}; - _this.drawAxes(false); - _this.plotContainer.selectAll('.crisp').classed('crisp', false); +/* + * Robust apply, for IE9 where console.log doesn't support + * apply like other functions do + */ +function apply(f, args) { + if(f && f.apply) { + try { + // `this` should always be console, since here we're always + // applying a method of the console object. + f.apply(console, args); + return; + } + catch(e) { /* in case apply failed, fall back on the code below */ } + } - if(_this._hasClipOnAxisFalse) { - _this.plotContainer - .select('.scatterlayer').selectAll('.trace') - .call(Drawing.hideOutsideRangePoints, _this); + // no apply - just try calling the function on each arg independently + for(var i = 0; i < args.length; i++) { + try { + f(args[i]); + } + catch(e) { + // still fails - last resort simple console.log + console.log(args[i]); } } +} - function dragDone() { - var attrs = {}; - attrs[_this.id + '.aaxis.min'] = mins.a; - attrs[_this.id + '.baxis.min'] = mins.b; - attrs[_this.id + '.caxis.min'] = mins.c; +},{"../plot_api/plot_config":191}],164:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - Registry.call('relayout', gd, attrs); - } - // finally, set up hover and click - // these event handlers must already be set before dragElement.init - // so it can stash them and override them. - dragger.onmousemove = function(evt) { - Fx.hover(gd, evt, _this.id); - gd._fullLayout._lasthover = dragger; - gd._fullLayout._hoversubplot = _this.id; - }; +'use strict'; + +/** + * General helper to manage trace groups based on calcdata + * + * @param {d3.selection} traceLayer: a selection containing a single group + * to draw these traces into + * @param {array} cdModule: array of calcdata items for this + * module and subplot combination. Assumes the calcdata item for each + * trace is an array with the fullData trace attached to the first item. + * @param {string} cls: the class attribute to give each trace group + * so you can give multiple classes separated by spaces + */ +module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { + var traces = traceLayer.selectAll('g.' + cls.replace(/\s/g, '.')) + .data(cdModule, function(cd) { return cd[0].trace.uid; }); - dragger.onmouseout = function(evt) { - if(gd._dragging) return; + traces.exit().remove(); - dragElement.unhover(gd, evt); - }; + traces.enter().append('g') + .attr('class', cls); - dragElement.init(dragOptions); -}; + traces.order(); -function removeZoombox(gd) { - d3.select(gd) - .selectAll('.zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners') - .remove(); -} + return traces; +}; -},{"../../components/color":570,"../../components/dragelement":592,"../../components/drawing":595,"../../components/fx":612,"../../components/titles":661,"../../lib":696,"../../lib/extend":685,"../../registry":827,"../cartesian/axes":744,"../cartesian/constants":750,"../cartesian/select":762,"../cartesian/set_convert":763,"../plots":808,"d3":148,"tinycolor2":514}],827:[function(_dereq_,module,exports){ +},{}],165:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Loggers = _dereq_('./lib/loggers'); -var noop = _dereq_('./lib/noop'); -var pushUnique = _dereq_('./lib/push_unique'); -var isPlainObject = _dereq_('./lib/is_plain_object'); -var ExtendModule = _dereq_('./lib/extend'); -var basePlotAttributes = _dereq_('./plots/attributes'); -var baseLayoutAttributes = _dereq_('./plots/layout_attributes'); +'use strict'; -var extendFlat = ExtendModule.extendFlat; -var extendDeepAll = ExtendModule.extendDeepAll; -exports.modules = {}; -exports.allCategories = {}; -exports.allTypes = []; -exports.subplotsRegistry = {}; -exports.transformsRegistry = {}; -exports.componentsRegistry = {}; -exports.layoutArrayContainers = []; -exports.layoutArrayRegexes = []; -exports.traceLayoutAttributes = {}; -exports.localeRegistry = {}; -exports.apiMethodRegistry = {}; +exports.init2dArray = function(rowLength, colLength) { + var array = new Array(rowLength); + for(var i = 0; i < rowLength; i++) array[i] = new Array(colLength); + return array; +}; /** - * Top-level register routine, exported as Plotly.register - * - * @param {object array or array of objects} _modules : - * module object or list of module object to register. - * - * A valid `moduleType: 'trace'` module has fields: - * - name {string} : the trace type - * - categories {array} : categories associated with this trace type, - * tested with Register.traceIs() - * - meta {object} : meta info (mostly for plot-schema) - * - * A valid `moduleType: 'locale'` module has fields: - * - name {string} : the locale name. Should be a 2-digit language string ('en', 'de') - * optionally with a country/region code ('en-GB', 'de-CH'). If a country - * code is used but the base language locale has not yet been supplied, - * we will use this locale for the base as well. - * - dictionary {object} : the dictionary mapping input strings to localized strings - * generally the keys should be the literal input strings, but - * if default translations are provided you can use any string as a key. - * - format {object} : a `d3.locale` format specifier for this locale - * any omitted keys we'll fall back on en-US. - * - * A valid `moduleType: 'transform'` module has fields: - * - name {string} : transform name - * - transform {function} : default-level transform function - * - calcTransform {function} : calc-level transform function - * - attributes {object} : transform attributes declarations - * - supplyDefaults {function} : attributes default-supply function - * - * A valid `moduleType: 'component'` module has fields: - * - name {string} : the component name, used it with Register.getComponentMethod() - * to employ component method. - * - * A valid `moduleType: 'apiMethod'` module has fields: - * - name {string} : the api method name. - * - fn {function} : the api method called with Register.call(); - * + * transpose a (possibly ragged) 2d array z. inspired by + * http://stackoverflow.com/questions/17428587/ + * transposing-a-2d-array-in-javascript */ -exports.register = function register(_modules) { - if(!_modules) { - throw new Error('No argument passed to Plotly.register.'); - } else if(_modules && !Array.isArray(_modules)) { - _modules = [_modules]; +exports.transposeRagged = function(z) { + var maxlen = 0; + var zlen = z.length; + var i, j; + // Maximum row length: + 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]; } - for(var i = 0; i < _modules.length; i++) { - var newModule = _modules[i]; + return t; +}; - if(!newModule) { - throw new Error('Invalid module was attempted to be registered!'); - } +// our own dot function so that we don't need to include numeric +exports.dot = function(x, y) { + if(!(x.length && y.length) || x.length !== y.length) return null; - 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; - exports.apiMethodRegistry[name] = newModule.fn; - break; - default: - throw new Error('Invalid module was attempted to be registered!'); - } + var len = x.length; + var out; + var i; + + if(x[0].length) { + // mat-vec or mat-mat + out = new Array(len); + for(i = 0; i < len; i++) out[i] = exports.dot(x[i], y); + } + else if(y[0].length) { + // vec-mat + var yTranspose = exports.transposeRagged(y); + out = new Array(yTranspose.length); + for(i = 0; i < yTranspose.length; i++) out[i] = exports.dot(x, yTranspose[i]); + } + else { + // vec-vec + out = 0; + for(i = 0; i < len; i++) out += x[i] * y[i]; } + + return out; }; -/** - * Get registered module using trace object or trace type - * - * @param {object||string} trace - * trace object with prop 'type' or trace type as a string - * @return {object} - * module object corresponding to trace type - */ -exports.getModule = function(trace) { - var _module = exports.modules[getTraceType(trace)]; - if(!_module) return false; - return _module._module; +// translate by (x,y) +exports.translationMatrix = function(x, y) { + return [[1, 0, x], [0, 1, y], [0, 0, 1]]; }; -/** - * Determine if this trace type is in a given category - * - * @param {object||string} traceType - * a trace (object) or trace type (string) - * @param {string} category - * category in question - * @return {boolean} - */ -exports.traceIs = function(traceType, category) { - traceType = getTraceType(traceType); +// rotate by alpha around (0,0) +exports.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]]; +}; - // old plot.ly workspace hack, nothing to see here - if(traceType === 'various') return false; +// rotate by alpha around (x,y) +exports.rotationXYMatrix = function(a, x, y) { + return exports.dot( + exports.dot(exports.translationMatrix(x, y), + exports.rotationMatrix(a)), + exports.translationMatrix(-x, -y)); +}; - var _module = exports.modules[traceType]; +// applies a 2D transformation matrix to either x and y params or an [x,y] array +exports.apply2DTransform = function(transform) { + return function() { + var args = arguments; + if(args.length === 3) { + args = args[0]; + }// from map + var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; + return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); + }; +}; - if(!_module) { - if(traceType && traceType !== 'area') { - Loggers.log('Unrecognized trace type ' + traceType + '.'); - } +// applies a 2D transformation matrix to an [x1,y1,x2,y2] array (to transform a segment) +exports.apply2DTransform2 = function(transform) { + var at = exports.apply2DTransform(transform); + return function(xys) { + return at(xys.slice(0, 2)).concat(at(xys.slice(2, 4))); + }; +}; - _module = exports.modules[basePlotAttributes.type.dflt]; - } +},{}],166:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return !!_module.categories[category]; -}; +'use strict'; /** - * Determine if this trace has a transform of the given type and return - * array of matching indices. - * - * @param {object} data - * a trace object (member of data or fullData) - * @param {string} type - * type of trace to test - * @return {array} - * array of matching indices. If none found, returns [] + * sanitized modulus function that always returns in the range [0, d) + * rather than (-d, 0] if v is negative */ -exports.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; -}; +function mod(v, d) { + var out = v % d; + return out < 0 ? out + d : out; +} /** - * Determine if this trace has a transform of the given type - * - * @param {object} data - * a trace object (member of data or fullData) - * @param {string} type - * type of trace to test - * @return {boolean} + * sanitized modulus function that always returns in the range [-d/2, d/2] + * rather than (-d, 0] if v is negative */ -exports.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; +function modHalf(v, d) { + return Math.abs(v) > (d / 2) ? + v - Math.round(v / d) * d : + v; +} + +module.exports = { + mod: mod, + modHalf: modHalf }; +},{}],167:[function(_dereq_,module,exports){ /** - * Retrieve component module method. Falls back on noop if either the - * module or the method is missing, so the result can always be safely called - * - * @param {string} name - * name of component (as declared in component module) - * @param {string} method - * name of component module method - * @return {function} - */ -exports.getComponentMethod = function(name, method) { - var _module = exports.componentsRegistry[name]; +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(!_module) return noop; - return _module[method] || noop; -}; + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; /** - * Call registered api method. - * - * @param {string} name : api method name - * @param {...array} args : arguments passed to api method - * @return {any} : returns api method output + * convert a string s (such as 'xaxis.range[0]') + * representing a property of nested object into set and get methods + * also return the string and object so we don't have to keep track of them + * allows [-1] for an array index, to set a property inside all elements + * of an array + * eg if obj = {arr: [{a: 1}, {a: 2}]} + * you can do p = nestedProperty(obj, 'arr[-1].a') + * but you cannot set the array itself this way, to do that + * just set the whole array. + * eg if obj = {arr: [1, 2, 3]} + * you can't do nestedProperty(obj, 'arr[-1]').set(5) + * but you can do nestedProperty(obj, 'arr').set([5, 5, 5]) */ -exports.call = function() { - var name = arguments[0]; - var args = [].slice.call(arguments, 1); - return exports.apiMethodRegistry[name].apply(null, args); -}; +module.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'; + } -function registerTraceModule(_module) { - var thisType = _module.name; - var categoriesIn = _module.categories; - var meta = _module.meta; + var j = 0; + var propParts = propStr.split('.'); + var indexed; + var indices; + var i; - if(exports.modules[thisType]) { - Loggers.log('Type ' + thisType + ' already registered'); - return; - } + // check for parts of the nesting hierarchy that are numbers (ie array elements) + while(j < propParts.length) { + // look for non-bracket chars, then any number of [##] blocks + indexed = String(propParts[j]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/); + if(indexed) { + if(indexed[1]) propParts[j] = indexed[1]; + // allow propStr to start with bracketed array indices + else if(j === 0) propParts.splice(0, 1); + else throw 'bad property string'; - if(!exports.subplotsRegistry[_module.basePlotModule.name]) { - registerSubplot(_module.basePlotModule); + 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++; } - var categoryObj = {}; - for(var i = 0; i < categoriesIn.length; i++) { - categoryObj[categoriesIn[i]] = true; - exports.allCategories[categoriesIn[i]] = true; + if(typeof container !== 'object') { + return badContainer(container, propStr, propParts); } - exports.modules[thisType] = { - _module: _module, - categories: categoryObj + 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 undefined; + } + curCont = curCont[curPart]; + if(typeof curCont !== 'object' || curCont === null) { + return undefined; + } + } + + // only hit this if parts.length === 1 + if(typeof curCont !== 'object' || curCont === null) return undefined; + + out = curCont[parts[i]]; + if(out === null) return undefined; + return out; }; +} - if(meta && Object.keys(meta).length) { - exports.modules[thisType].meta = meta; - } +/* + * Can this value be deleted? We can delete `undefined`, and `null` except INSIDE an + * *args* array. + * + * Previously we also deleted some `{}` and `[]`, in order to try and make set/unset + * a net noop; but this causes far more complication than it's worth, and still had + * lots of exceptions. See https://github.com/plotly/plotly.js/issues/1410 + * + * *args* arrays get passed directly to API methods and we should respect null if + * the user put it there, but otherwise null is deleted as we use it as code + * in restyle/relayout/update for "delete this value" whereas undefined means + * "ignore this edit" + */ +var ARGS_PATTERN = /(^|\.)args\[/; +function isDeletable(val, propStr) { + return (val === undefined) || (val === null && !propStr.match(ARGS_PATTERN)); +} - exports.allTypes.push(thisType); +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(var componentName in exports.componentsRegistry) { - mergeComponentAttrsToTrace(componentName, thisType); - } + for(i = 0; i < parts.length - 1; i++) { + curPart = parts[i]; - /* - * Collect all trace layout attributes in one place for easier lookup later - * but don't merge them into the base schema as it would confuse the docs - * (at least after https://github.com/plotly/documentation/issues/202 gets done!) - */ - if(_module.layoutAttributes) { - extendFlat(exports.traceLayoutAttributes, _module.layoutAttributes); - } -} + if(typeof curPart === 'number' && !isArrayOrTypedArray(curCont)) { + throw 'array index but container is not an array'; + } -function registerSubplot(_module) { - var plotType = _module.name; + // handle special -1 array index + if(curPart === -1) { + toDelete = !setArrayAll(curCont, parts.slice(i + 1), val, propStr); + if(toDelete) break; + else return; + } - if(exports.subplotsRegistry[plotType]) { - Loggers.log('Plot type ' + plotType + ' already registered.'); - return; - } + if(!checkNewContainer(curCont, curPart, parts[i + 1], toDelete)) { + break; + } - // relayout array handling will look for component module methods with this - // name and won't find them because this is a subplot module... but that - // should be fine, it will just fall back on redrawing the plot. - findArrayRegexps(_module); + curCont = curCont[curPart]; - // not sure what's best for the 'cartesian' type at this point - exports.subplotsRegistry[plotType] = _module; + if(typeof curCont !== 'object' || curCont === null) { + throw 'container is not an object'; + } - for(var componentName in exports.componentsRegistry) { - mergeComponentAttrsToSubplot(componentName, _module.name); - } -} + propPart = joinPropStr(propPart, curPart); -function registerComponentModule(_module) { - if(typeof _module.name !== 'string') { - throw new Error('Component module *name* must be a string.'); - } + containerLevels.push([curCont, propPart]); + } - var name = _module.name; - exports.componentsRegistry[name] = _module; + if(toDelete) { + if(i === parts.length - 1) { + delete curCont[parts[i]]; - if(_module.layoutAttributes) { - if(_module.layoutAttributes._isLinkedToArray) { - pushUnique(exports.layoutArrayContainers, name); + // The one bit of pruning we still do: drop `undefined` from the end of arrays. + // In case someone has already unset previous items, continue until we hit a + // non-undefined value. + if(Array.isArray(curCont) && +parts[i] === curCont.length - 1) { + while(curCont.length && curCont[curCont.length - 1] === undefined) { + curCont.pop(); + } + } + } } - findArrayRegexps(_module); - } + else curCont[parts[i]] = val; + }; +} - for(var traceType in exports.modules) { - mergeComponentAttrsToTrace(name, traceType); - } +function joinPropStr(propStr, newPart) { + var toAdd = newPart; + if(isNumeric(newPart)) toAdd = '[' + newPart + ']'; + else if(propStr) toAdd = '.' + newPart; - for(var subplotName in exports.subplotsRegistry) { - mergeComponentAttrsToSubplot(name, subplotName); - } + return propStr + toAdd; +} - for(var transformType in exports.transformsRegistry) { - mergeComponentAttrsToTransform(name, transformType); - } +// handle special -1 array index +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; - if(_module.schema && _module.schema.layout) { - extendDeepAll(baseLayoutAttributes, _module.schema.layout); + 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 registerTransformModule(_module) { - if(typeof _module.name !== 'string') { - throw new Error('Transform module *name* must be a string.'); +/** + * make new sub-container as needed. + * returns false if there's no container and none is needed + * because we're only deleting an attribute + */ +function checkNewContainer(container, part, nextPart, toDelete) { + if(container[part] === undefined) { + if(toDelete) return false; + + if(typeof nextPart === 'number') container[part] = []; + else container[part] = {}; } + return true; +} - var prefix = 'Transform module ' + _module.name; - var hasTransform = typeof _module.transform === 'function'; - var hasCalcTransform = typeof _module.calcTransform === 'function'; +function badContainer(container, propStr, propParts) { + return { + set: function() { throw 'bad container'; }, + get: function() {}, + astr: propStr, + parts: propParts, + obj: container + }; +} - 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.'); - } +},{"./array":146,"fast-isnumeric":10}],168:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - exports.transformsRegistry[_module.name] = _module; +'use strict'; - for(var componentName in exports.componentsRegistry) { - mergeComponentAttrsToTransform(componentName, _module.name); - } -} +// Simple helper functions +// none of these need any external deps -function registerLocale(_module) { - var locale = _module.name; - var baseLocale = locale.split('-')[0]; +module.exports = function noop() {}; - var newDict = _module.dictionary; - var newFormat = _module.format; - var hasDict = newDict && Object.keys(newDict).length; - var hasFormat = newFormat && Object.keys(newFormat).length; +},{}],169:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var locales = exports.localeRegistry; - var localeObj = locales[locale]; - if(!localeObj) locales[locale] = localeObj = {}; +'use strict'; - // Should we use this dict for the base locale? - // In case we're overwriting a previous dict for this locale, check - // whether the base matches the full locale dict now. If we're not - // overwriting, locales[locale] is undefined so this just checks if - // baseLocale already had a dict or not. - // Same logic for dateFormats - if(baseLocale !== locale) { - var baseLocaleObj = locales[baseLocale]; - if(!baseLocaleObj) locales[baseLocale] = baseLocaleObj = {}; +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); - if(hasDict && baseLocaleObj.dictionary === localeObj.dictionary) { - baseLocaleObj.dictionary = newDict; - } - if(hasFormat && baseLocaleObj.format === localeObj.format) { - baseLocaleObj.format = newFormat; - } - } +var NOTEDATA = []; - if(hasDict) localeObj.dictionary = newDict; - if(hasFormat) localeObj.format = newFormat; -} +/** + * notifier + * @param {String} text The person's user name + * @param {Number} [delay=1000] The delay time in milliseconds + * or 'long' which provides 2000 ms delay time. + * @return {undefined} this function does not return a value + */ +module.exports = function(text, displayLength) { + if(NOTEDATA.indexOf(text) !== -1) return; -function findArrayRegexps(_module) { - if(_module.layoutAttributes) { - var arrayAttrRegexps = _module.layoutAttributes._arrayAttrRegexps; - if(arrayAttrRegexps) { - for(var i = 0; i < arrayAttrRegexps.length; i++) { - pushUnique(exports.layoutArrayRegexes, arrayAttrRegexps[i]); - } - } - } -} + NOTEDATA.push(text); -function mergeComponentAttrsToTrace(componentName, traceType) { - var componentSchema = exports.componentsRegistry[componentName].schema; - if(!componentSchema || !componentSchema.traces) return; + var ts = 1000; + if(isNumeric(displayLength)) ts = displayLength; + else if(displayLength === 'long') ts = 3000; - var traceAttrs = componentSchema.traces[traceType]; - if(traceAttrs) { - extendDeepAll(exports.modules[traceType]._module.attributes, traceAttrs); - } -} + var notifierContainer = d3.select('body') + .selectAll('.plotly-notifier') + .data([0]); + notifierContainer.enter() + .append('div') + .classed('plotly-notifier', true); -function mergeComponentAttrsToTransform(componentName, transformType) { - var componentSchema = exports.componentsRegistry[componentName].schema; - if(!componentSchema || !componentSchema.transforms) return; + var notes = notifierContainer.selectAll('.notifier-note').data(NOTEDATA); - var transformAttrs = componentSchema.transforms[transformType]; - if(transformAttrs) { - extendDeepAll(exports.transformsRegistry[transformType].attributes, transformAttrs); + 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(); + }); } -} -function mergeComponentAttrsToSubplot(componentName, subplotName) { - var componentSchema = exports.componentsRegistry[componentName].schema; - if(!componentSchema || !componentSchema.subplots) return; + notes.enter().append('div') + .classed('notifier-note', true) + .style('opacity', 0) + .each(function(thisText) { + var note = d3.select(this); - var subplotModule = exports.subplotsRegistry[subplotName]; - var subplotAttrs = subplotModule.layoutAttributes; - var subplotAttr = subplotModule.attr === 'subplot' ? subplotModule.name : subplotModule.attr; - if(Array.isArray(subplotAttr)) subplotAttr = subplotAttr[0]; + note.append('button') + .classed('notifier-close', true) + .html('×') + .on('click', function() { + note.transition().call(killNote); + }); - var componentLayoutAttrs = componentSchema.subplots[subplotAttr]; - if(subplotAttrs && componentLayoutAttrs) { - extendDeepAll(subplotAttrs, componentLayoutAttrs); - } -} + 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]); + } -function getTraceType(traceType) { - if(typeof traceType === 'object') traceType = traceType.type; - return traceType; -} + note.transition() + .duration(700) + .style('opacity', 1) + .transition() + .delay(ts) + .call(killNote); + }); +}; -},{"./lib/extend":685,"./lib/is_plain_object":697,"./lib/loggers":700,"./lib/noop":705,"./lib/push_unique":710,"./plots/attributes":741,"./plots/layout_attributes":799}],828:[function(_dereq_,module,exports){ +},{"d3":8,"fast-isnumeric":10}],170:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -135779,490 +38212,547 @@ 'use strict'; -var Lib = _dereq_('../lib'); - -var extendFlat = Lib.extendFlat; -var extendDeep = Lib.extendDeep; - -// Put default plotTile layouts here -function cloneLayoutOverride(tileClass) { - var override; - - switch(tileClass) { - case 'themes__thumb': - override = { - autosize: true, - width: 150, - height: 150, - title: '', - showlegend: false, - margin: {l: 5, r: 5, t: 5, b: 5, pad: 0}, - annotations: [] - }; - break; +var setCursor = _dereq_('./setcursor'); - case 'thumbnail': - override = { - title: '', - hidesources: true, - showlegend: false, - borderwidth: 0, - bordercolor: '', - margin: {l: 1, r: 1, t: 1, b: 1, pad: 0}, - annotations: [] - }; - break; +var STASHATTR = 'data-savedcursor'; +var NO_CURSOR = '!!'; - default: - override = {}; +/* + * works with our CSS cursor classes (see css/_cursor.scss) + * to override a previous cursor set on d3 single-element selections, + * by moving the name of the original cursor to the data-savedcursor attr. + * omit cursor to revert to the previously set value. + */ +module.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); + } +}; - return override; -} +},{"./setcursor":178}],171:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -function keyIsAxis(keyName) { - var types = ['xaxis', 'yaxis', 'zaxis']; - return (types.indexOf(keyName.slice(0, 5)) > -1); -} +'use strict'; -module.exports = function clonePlot(graphObj, options) { +var dot = _dereq_('./matrix').dot; +var BADNUM = _dereq_('../constants/numerical').BADNUM; - // Polar plot compatibility - if(graphObj.framework && graphObj.framework.isPolar) { - graphObj = graphObj.framework.getConfig(); - } +var polygon = module.exports = {}; +/** + * Turn an array of [x, y] pairs into a polygon object + * that can test if points are inside it + * + * @param ptsIn Array of [x, y] pairs + * + * @returns polygon Object {xmin, xmax, ymin, ymax, pts, contains} + * (x|y)(min|max) are the bounding rect of the polygon + * pts is the original array, with the first pair repeated at the end + * contains is a function: (pt, omitFirstEdge) + * pt is the [x, y] pair to test + * omitFirstEdge truthy means points exactly on the first edge don't + * count. This is for use adding one polygon to another so we + * don't double-count the edge where they meet. + * returns boolean: is pt inside the polygon (including on its edges) + */ +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; - 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; + 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]); + } - if(options.tileClass === 'thumbnail' || options.tileClass === 'themes__thumb') { - // kill annotations - newLayout.annotations = []; - var keys = Object.keys(newLayout); + // do we have a rectangle? Handle this here, so we can use the same + // tester for the rectangular case without sacrificing speed - for(i = 0; i < keys.length; i++) { - if(keyIsAxis(keys[i])) { - newLayout[keys[i]].title = ''; + var isRect = false; + var rectFirstEdgeTest; + + if(pts.length === 5) { + if(pts[0][0] === pts[1][0]) { // vert, horz, vert, horz + if(pts[2][0] === pts[3][0] && + pts[0][1] === pts[3][1] && + pts[1][1] === pts[2][1]) { + isRect = true; + rectFirstEdgeTest = function(pt) { return pt[0] === pts[0][0]; }; } } - - // kill colorbar and pie labels - for(i = 0; i < newData.length; i++) { - var trace = newData[i]; - trace.showscale = false; - if(trace.marker) trace.marker.showscale = false; - if(trace.type === 'pie') trace.textposition = 'none'; + else if(pts[0][1] === pts[1][1]) { // horz, vert, horz, vert + if(pts[2][1] === pts[3][1] && + pts[0][0] === pts[3][0] && + pts[1][0] === pts[2][0]) { + isRect = true; + rectFirstEdgeTest = function(pt) { return pt[1] === pts[0][1]; }; + } } } - if(Array.isArray(options.annotations)) { - for(i = 0; i < options.annotations.length; i++) { - newLayout.annotations.push(options.annotations[i]); + function rectContains(pt, omitFirstEdge) { + var x = pt[0]; + var y = pt[1]; + + if(x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { + // pt is outside the bounding box of polygon + return false; } + if(omitFirstEdge && rectFirstEdgeTest(pt)) return false; + + return true; } - // TODO: does this scene modification really belong here? - // If we still need it, can it move into the gl3d module? - var sceneIds = Object.keys(newLayout).filter(function(key) { - return key.match(/^scene\d*$/); - }); - if(sceneIds.length) { - var axesImageOverride = {}; - if(options.tileClass === 'thumbnail') { - axesImageOverride = { - title: '', - showaxeslabels: false, - showticklabels: false, - linetickenable: false - }; + function contains(pt, omitFirstEdge) { + var x = pt[0]; + var y = pt[1]; + + if(x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { + // pt is outside the bounding box of polygon + return false; } - for(i = 0; i < sceneIds.length; i++) { - var scene = newLayout[sceneIds[i]]; - if(!scene.xaxis) { - scene.xaxis = {}; - } + var imax = pts.length; + var x1 = pts[0][0]; + var y1 = pts[0][1]; + var crossings = 0; + var i; + var x0; + var y0; + var xmini; + var ycross; + + for(i = 1; i < imax; i++) { + // find all crossings of a vertical line upward from pt with + // polygon segments + // crossings exactly at xmax don't count, unless the point is + // exactly on the segment, then it counts as inside. + x0 = x1; + y0 = y1; + x1 = pts[i][0]; + y1 = pts[i][1]; + xmini = Math.min(x0, x1); - if(!scene.yaxis) { - scene.yaxis = {}; + // outside the bounding box of this segment, it's only a crossing + // if it's below the box. + if(x < xmini || x > Math.max(x0, x1) || y > Math.max(y0, y1)) { + continue; } - - if(!scene.zaxis) { - scene.zaxis = {}; + else if(y < Math.min(y0, y1)) { + // don't count the left-most point of the segment as a crossing + // because we don't want to double-count adjacent crossings + // UNLESS the polygon turns past vertical at exactly this x + // Note that this is repeated below, but we can't factor it out + // because + if(x !== xmini) crossings++; } + // inside the bounding box, check the actual line intercept + else { + // vertical segment - we know already that the point is exactly + // on the segment, so mark the crossing as exactly at the point. + if(x1 === x0) ycross = y; + // any other angle + else ycross = y0 + (x - x0) * (y1 - y0) / (x1 - x0); - extendFlat(scene.xaxis, axesImageOverride); - extendFlat(scene.yaxis, axesImageOverride); - extendFlat(scene.zaxis, axesImageOverride); + // exactly on the edge: counts as inside the polygon, unless it's the + // first edge and we're omitting it. + if(y === ycross) { + if(i === 1 && omitFirstEdge) return false; + return true; + } - // TODO what does this do? - scene._scene = null; + if(y <= ycross && x !== xmini) crossings++; + } } - } - var gd = document.createElement('div'); - if(options.tileClass) gd.className = options.tileClass; + // if we've gotten this far, odd crossings means inside, even is outside + return crossings % 2 === 1; + } - var plotTile = { - gd: gd, - td: gd, // for external (image server) compatibility - layout: newLayout, - data: newData, - config: { - staticPlot: (options.staticPlot === undefined) ? - true : - options.staticPlot, - plotGlPixelRatio: (options.plotGlPixelRatio === undefined) ? - 2 : - options.plotGlPixelRatio, - displaylogo: options.displaylogo || false, - showLink: options.showLink || false, - showTips: options.showTips || false, - mapboxAccessToken: context.mapboxAccessToken + // detect if poly is degenerate + 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; } - }; - - if(options.setBackground !== 'transparent') { - plotTile.config.setBackground = options.setBackground || 'opaque'; } - // attaching the default Layout the gd, so you can grab it later - plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); - - return plotTile; + return { + xmin: xmin, + xmax: xmax, + ymin: ymin, + ymax: ymax, + pts: pts, + contains: isRect ? rectContains : contains, + isRect: isRect, + degenerate: degenerate + }; }; -},{"../lib":696}],829:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - + * Test if a segment of a points array is bent or straight + * + * @param pts Array of [x, y] pairs + * @param start the index of the proposed start of the straight section + * @param end the index of the proposed end point + * @param tolerance the max distance off the line connecting start and end + * before the line counts as bent + * @returns boolean: true means this segment is bent, false means straight + */ +var isBent = polygon.isSegmentBent = function isBent(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; -'use strict'; + for(i = start + 1; i < end; i++) { + part = [pts[i][0] - startPt[0], pts[i][1] - startPt[1]]; + partParallel = dot(part, segment); -var toImage = _dereq_('../plot_api/to_image'); -var Lib = _dereq_('../lib'); // for isIE -var fileSaver = _dereq_('./filesaver'); + if(partParallel < 0 || partParallel > segmentSquared || + Math.abs(dot(part, unitPerp)) > tolerance) return true; + } + return false; +}; -/** Plotly.downloadImage +/** + * Make a filtering polygon, to minimize the number of segments * - * @param {object | string | HTML div} gd - * can either be a data/layout/config object - * or an existing graph
- * or an id to an existing graph
- * @param {object} opts (see ../plot_api/to_image) - * @return {promise} + * @param pts Array of [x, y] pairs (must start with at least 1 pair) + * @param tolerance the maximum deviation from straight allowed for + * removing points to simplify the polygon + * + * @returns Object {addPt, raw, filtered} + * addPt is a function(pt: [x, y] pair) to add a raw point and + * continue filtering + * raw is all the input points + * filtered is the resulting filtered Array of [x, y] pairs */ -function downloadImage(gd, opts) { - var _gd; - if(!Lib.isPlainObject(gd)) _gd = Lib.getGraphDiv(gd); - - // check for undefined opts - opts = opts || {}; - // default to png - opts.format = opts.format || 'png'; +polygon.filter = function filter(pts, tolerance) { + var ptsFiltered = [pts[0]]; + var doneRawIndex = 0; + var doneFilteredIndex = 0; - return new Promise(function(resolve, reject) { - if(_gd && _gd._snapshotInProgress) { - reject(new Error('Snapshotting already in progress.')); - } + function addPt(pt) { + pts.push(pt); + var prevFilterLen = ptsFiltered.length; + var iLast = doneRawIndex; + ptsFiltered.splice(doneFilteredIndex + 1); - // see comments within svgtoimg for additional - // discussion of problems with IE - // can now draw to canvas, but CORS tainted canvas - // does not allow toDataURL - // svg format will work though - if(Lib.isIE() && opts.format !== 'svg') { - reject(new Error('Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.')); + for(var i = iLast + 1; i < pts.length; i++) { + if(i === pts.length - 1 || isBent(pts, iLast, i + 1, tolerance)) { + ptsFiltered.push(pts[i]); + if(ptsFiltered.length < prevFilterLen - 2) { + doneRawIndex = i; + doneFilteredIndex = ptsFiltered.length - 1; + } + iLast = i; + } } + } - if(_gd) _gd._snapshotInProgress = true; - var promise = toImage(gd, opts); - - var filename = opts.filename || gd.fn || 'newplot'; - filename += '.' + opts.format; - - promise.then(function(result) { - if(_gd) _gd._snapshotInProgress = false; - return fileSaver(result, filename); - }).then(function(name) { - resolve(name); - }).catch(function(err) { - if(_gd) _gd._snapshotInProgress = false; - reject(err); - }); - }); -} + if(pts.length > 1) { + var lastPt = pts.pop(); + addPt(lastPt); + } -module.exports = downloadImage; + return { + addPt: addPt, + raw: pts, + filtered: ptsFiltered + }; +}; -},{"../lib":696,"../plot_api/to_image":737,"./filesaver":830}],830:[function(_dereq_,module,exports){ +},{"../constants/numerical":140,"./matrix":165}],172:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -/* -* substantial portions of this code from FileSaver.js -* https://github.com/eligrey/FileSaver.js -* License: https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md -* FileSaver.js -* A saveAs() FileSaver implementation. -* 1.1.20160328 -* -* By Eli Grey, http://eligrey.com -* License: MIT -* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md -*/ - 'use strict'; -var fileSaver = function(url, name) { - var saveLink = document.createElement('a'); - var canUseSaveLink = 'download' in saveLink; - var isSafari = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent); - var promise = new Promise(function(resolve, reject) { - // IE <10 is explicitly unsupported - if(typeof navigator !== 'undefined' && /MSIE [1-9]\./.test(navigator.userAgent)) { - reject(new Error('IE < 10 unsupported')); - } - - // First try a.download, then web filesystem, then object URLs - if(isSafari) { - // Safari doesn't allow downloading of blob urls - document.location.href = 'data:application/octet-stream' + url.slice(url.search(/[,;]/)); - resolve(name); - } - - if(!name) { - name = 'download'; - } - - if(canUseSaveLink) { - saveLink.href = url; - saveLink.download = name; - document.body.appendChild(saveLink); - saveLink.click(); - document.body.removeChild(saveLink); - resolve(name); - } - - // IE 10+ (native saveAs) - if(typeof navigator !== 'undefined' && navigator.msSaveBlob) { - // At this point we are only dealing with a SVG encoded as - // a data URL (since IE only supports SVG) - var encoded = url.split(/^data:image\/svg\+xml,/)[1]; - var svg = decodeURIComponent(encoded); - navigator.msSaveBlob(new Blob([svg]), name); - resolve(name); +/** + * Push array with unique items + * + * Ignores falsy items, except 0 so we can use it to construct arrays of indices. + * + * @param {array} array + * array to be filled + * @param {any} item + * item to be or not to be inserted + * @return {array} + * ref to array (now possibly containing one more item) + * + */ +module.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); - reject(new Error('download error')); - }); - - return promise; + return array; }; -module.exports = fileSaver; - -},{}],831:[function(_dereq_,module,exports){ +},{}],173:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -exports.getDelay = function(fullLayout) { - if(!fullLayout._has) return 0; - - return ( - fullLayout._has('gl3d') || - fullLayout._has('gl2d') || - fullLayout._has('mapbox') - ) ? 500 : 0; -}; +var Lib = _dereq_('../lib'); +var dfltConfig = _dereq_('../plot_api/plot_config').dfltConfig; -exports.getRedrawFunc = function(gd) { - var fullLayout = gd._fullLayout || {}; - var hasPolar = fullLayout._has && fullLayout._has('polar'); - var hasLegacyPolar = !hasPolar && gd.data && gd.data[0] && gd.data[0].r; +/** + * Copy arg array *without* removing `undefined` values from objects. + * + * @param gd + * @param args + * @returns {Array} + */ +function copyArgArray(gd, args) { + var copy = []; + var arg; - // do not work for legacy polar - if(hasLegacyPolar) return; + for(var i = 0; i < args.length; i++) { + arg = args[i]; - return function() { - (gd.calcdata || []).forEach(function(d) { - if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb(); - }); - }; -}; + if(arg === gd) copy[i] = arg; + else if(typeof arg === 'object') { + copy[i] = Array.isArray(arg) ? + Lib.extendDeep([], arg) : + Lib.extendDeepAll({}, arg); + } + else copy[i] = arg; + } -},{}],832:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return copy; +} -'use strict'; +// ----------------------------------------------------- +// Undo/Redo queue for plots +// ----------------------------------------------------- -var helpers = _dereq_('./helpers'); -var Snapshot = { - getDelay: helpers.getDelay, - getRedrawFunc: helpers.getRedrawFunc, - clone: _dereq_('./cloneplot'), - toSVG: _dereq_('./tosvg'), - svgToImg: _dereq_('./svgtoimg'), - toImage: _dereq_('./toimage'), - downloadImage: _dereq_('./download') -}; +var queue = {}; -module.exports = Snapshot; +// TODO: disable/enable undo and redo buttons appropriately -},{"./cloneplot":828,"./download":829,"./helpers":831,"./svgtoimg":833,"./toimage":834,"./tosvg":835}],833:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Add an item to the undoQueue for a graphDiv + * + * @param gd + * @param undoFunc Function undo this operation + * @param undoArgs Args to supply undoFunc with + * @param redoFunc Function to redo this operation + * @param redoArgs Args to supply redoFunc with + */ +queue.add = function(gd, undoFunc, undoArgs, redoFunc, redoArgs) { + var queueObj, + queueIndex; -'use strict'; + // make sure we have the queue and our position in it + gd.undoQueue = gd.undoQueue || {index: 0, queue: [], sequence: false}; + queueIndex = gd.undoQueue.index; -var Lib = _dereq_('../lib'); -var EventEmitter = _dereq_('events').EventEmitter; + // if we're already playing an undo or redo, or if this is an auto operation + // (like pane resize... any others?) then we don't save this to the undo queue + if(gd.autoplay) { + if(!gd.undoQueue.inSequence) gd.autoplay = false; + return; + } -function svgToImg(opts) { - var ev = opts.emitter || new EventEmitter(); + // if we're not in a sequence or are just starting, we need a new queue item + if(!gd.undoQueue.sequence || gd.undoQueue.beginSequence) { + queueObj = {undo: {calls: [], args: []}, redo: {calls: [], args: []}}; + gd.undoQueue.queue.splice(queueIndex, gd.undoQueue.queue.length - queueIndex, queueObj); + gd.undoQueue.index += 1; + } else { + queueObj = gd.undoQueue.queue[queueIndex - 1]; + } + gd.undoQueue.beginSequence = false; - var promise = new Promise(function(resolve, reject) { - var Image = window.Image; - var svg = opts.svg; - var format = opts.format || 'png'; + // we unshift to handle calls for undo in a forward for loop later + if(queueObj) { + queueObj.undo.calls.unshift(undoFunc); + queueObj.undo.args.unshift(undoArgs); + queueObj.redo.calls.push(redoFunc); + queueObj.redo.args.push(redoArgs); + } - // IE only support svg - if(Lib.isIE() && format !== 'svg') { - var ieSvgError = new Error('Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'); - reject(ieSvgError); - // eventually remove the ev - // in favor of promises - if(!opts.promise) { - return ev.emit('error', ieSvgError); - } else { - return promise; - } - } + if(gd.undoQueue.queue.length > dfltConfig.queueLength) { + gd.undoQueue.queue.shift(); + gd.undoQueue.index--; + } +}; - var canvas = opts.canvas; - var scale = opts.scale || 1; - var w0 = opts.width || 300; - var h0 = opts.height || 150; - var w1 = scale * w0; - var h1 = scale * h0; +/** + * Begin a sequence of undoQueue changes + * + * @param gd + */ +queue.startSequence = function(gd) { + gd.undoQueue = gd.undoQueue || {index: 0, queue: [], sequence: false}; + gd.undoQueue.sequence = true; + gd.undoQueue.beginSequence = true; +}; - var ctx = canvas.getContext('2d'); - var img = new Image(); +/** + * Stop a sequence of undoQueue changes + * + * Call this *after* you're sure your undo chain has ended + * + * @param gd + */ +queue.stopSequence = function(gd) { + gd.undoQueue = gd.undoQueue || {index: 0, queue: [], sequence: false}; + gd.undoQueue.sequence = false; + gd.undoQueue.beginSequence = false; +}; - // for Safari support, eliminate createObjectURL - // this decision could cause problems if content - // is not restricted to svg - var url = 'data:image/svg+xml,' + encodeURIComponent(svg); +/** + * Move one step back in the undo queue, and undo the object there. + * + * @param gd + */ +queue.undo = function undo(gd) { + var queueObj, i; - canvas.width = w1; - canvas.height = h1; + if(gd.framework && gd.framework.isPolar) { + gd.framework.undo(); + return; + } + if(gd.undoQueue === undefined || + isNaN(gd.undoQueue.index) || + gd.undoQueue.index <= 0) { + return; + } - img.onload = function() { - var imgData; + // index is pointing to next *forward* queueObj, point to the one we're undoing + gd.undoQueue.index--; - // don't need to draw to canvas if svg - // save some time and also avoid failure on IE - if(format !== 'svg') { - ctx.drawImage(img, 0, 0, w1, h1); - } + // get the queueObj for instructions on how to undo + queueObj = gd.undoQueue.queue[gd.undoQueue.index]; - switch(format) { - 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)); - // eventually remove the ev - // in favor of promises - if(!opts.promise) { - return ev.emit('error', errorMsg); - } - } - resolve(imgData); - // eventually remove the ev - // in favor of promises - if(!opts.promise) { - ev.emit('success', imgData); - } - }; + // this sequence keeps things from adding to the queue during undo/redo + gd.undoQueue.inSequence = true; + for(i = 0; i < queueObj.undo.calls.length; i++) { + queue.plotDo(gd, queueObj.undo.calls[i], queueObj.undo.args[i]); + } + gd.undoQueue.inSequence = false; + gd.autoplay = false; +}; - img.onerror = function(err) { - reject(err); - // eventually remove the ev - // in favor of promises - if(!opts.promise) { - return ev.emit('error', err); - } - }; +/** + * Redo the current object in the undo, then move forward in the queue. + * + * @param gd + */ +queue.redo = function redo(gd) { + var queueObj, i; - img.src = url; - }); + if(gd.framework && gd.framework.isPolar) { + gd.framework.redo(); + return; + } + if(gd.undoQueue === undefined || + isNaN(gd.undoQueue.index) || + gd.undoQueue.index >= gd.undoQueue.queue.length) { + return; + } - // temporary for backward compatibility - // move to only Promise in 2.0.0 - // and eliminate the EventEmitter - if(opts.promise) { - return promise; + // get the queueObj for instructions on how to undo + queueObj = gd.undoQueue.queue[gd.undoQueue.index]; + + // this sequence keeps things from adding to the queue during undo/redo + gd.undoQueue.inSequence = true; + for(i = 0; i < queueObj.redo.calls.length; i++) { + queue.plotDo(gd, queueObj.redo.calls[i], queueObj.redo.args[i]); } + gd.undoQueue.inSequence = false; + gd.autoplay = false; - return ev; -} + // index is pointing to the thing we just redid, move it + gd.undoQueue.index++; +}; -module.exports = svgToImg; +/** + * Called by undo/redo to make the actual changes. + * + * Not meant to be called publically, but included for mocking out in tests. + * + * @param gd + * @param func + * @param args + */ +queue.plotDo = function(gd, func, args) { + gd.autoplay = true; + + // this *won't* copy gd and it preserves `undefined` properties! + args = copyArgArray(gd, args); + + // call the supplied function + func.apply(null, args); +}; -},{"../lib":696,"events":92}],834:[function(_dereq_,module,exports){ +module.exports = queue; + +},{"../lib":159,"../plot_api/plot_config":191}],174:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -136271,77 +38761,81 @@ 'use strict'; -var EventEmitter = _dereq_('events').EventEmitter; - -var Registry = _dereq_('../registry'); -var Lib = _dereq_('../lib'); - -var helpers = _dereq_('./helpers'); -var clonePlot = _dereq_('./cloneplot'); -var toSVG = _dereq_('./tosvg'); -var svgToImg = _dereq_('./svgtoimg'); - -/** - * @param {object} gd figure Object - * @param {object} opts option object - * @param opts.format 'jpeg' | 'png' | 'webp' | 'svg' +/* + * make a regex for matching counter ids/names ie xaxis, xaxis2, xaxis10... + * + * @param {string} head: the head of the pattern, eg 'x' matches 'x', 'x2', 'x10' etc. + * 'xy' is a special case for cartesian subplots: it matches 'x2y3' etc + * @param {Optional(string)} tail: a fixed piece after the id + * eg counterRegex('scene', '.annotations') for scene2.annotations etc. + * @param {boolean} openEnded: if true, the string may continue past the match. + * @param {boolean} matchBeginning: if false, the string may start before the match. */ -function toImage(gd, opts) { - - // first clone the GD so we can operate in a clean environment - var ev = new EventEmitter(); +exports.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); +}; - var clone = clonePlot(gd, {format: 'png'}); - var clonedGd = clone.gd; +},{}],175:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // put the cloned div somewhere off screen before attaching to DOM - clonedGd.style.position = 'absolute'; - clonedGd.style.left = '-5000px'; - document.body.appendChild(clonedGd); - function wait() { - var delay = helpers.getDelay(clonedGd._fullLayout); +'use strict'; - setTimeout(function() { - var svg = toSVG(clonedGd); +// ASCEND: chop off the last nesting level - either [] or . - to ascend +// the attribute tree. the remaining attrString is in match[1] +var ASCEND = /^(.*)(\.[^\.\[\]]+|\[\d\])$/; - var canvas = document.createElement('canvas'); - canvas.id = Lib.randstr(); +// SIMPLEATTR: is this an un-nested attribute? (no dots or brackets) +var SIMPLEATTR = /^[^\.\[\]]+$/; - ev = svgToImg({ - format: opts.format, - width: clonedGd._fullLayout.width, - height: clonedGd._fullLayout.height, - canvas: canvas, - emitter: ev, - svg: svg - }); +/* + * calculate a relative attribute string, similar to a relative path + * + * @param {string} baseAttr: + * an attribute string, such as 'annotations[3].x'. The "current location" + * is the attribute string minus the last component ('annotations[3]') + * @param {string} relativeAttr: + * a route to the desired attribute string, using '^' to ascend + * + * @return {string} attrString: + * for example: + * relativeAttr('annotations[3].x', 'y') = 'annotations[3].y' + * relativeAttr('annotations[3].x', '^[2].z') = 'annotations[2].z' + * relativeAttr('annotations[3].x', '^^margin') = 'margin' + * relativeAttr('annotations[3].x', '^^margin.r') = 'margin.r' + */ +module.exports = function(baseAttr, relativeAttr) { + while(relativeAttr) { + var match = baseAttr.match(ASCEND); - ev.clean = function() { - if(clonedGd) document.body.removeChild(clonedGd); - }; + if(match) baseAttr = match[1]; + else if(baseAttr.match(SIMPLEATTR)) baseAttr = ''; + else throw new Error('bad relativeAttr call:' + [baseAttr, relativeAttr]); - }, delay); + if(relativeAttr.charAt(0) === '^') relativeAttr = relativeAttr.slice(1); + else break; } - var redrawFunc = helpers.getRedrawFunc(clonedGd); - - Registry.call('plot', clonedGd, clone.data, clone.layout, clone.config) - .then(redrawFunc) - .then(wait) - .catch(function(err) { - ev.emit('error', err); - }); - - - return ev; -} - -module.exports = toImage; + if(baseAttr && relativeAttr.charAt(0) !== '[') { + return baseAttr + '.' + relativeAttr; + } + return baseAttr + relativeAttr; +}; -},{"../lib":696,"../registry":827,"./cloneplot":828,"./helpers":831,"./svgtoimg":833,"./tosvg":835,"events":92}],835:[function(_dereq_,module,exports){ +},{}],176:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -136351,179 +38845,248 @@ 'use strict'; -var d3 = _dereq_('d3'); +var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; +var isPlainObject = _dereq_('./is_plain_object'); -var Lib = _dereq_('../lib'); -var Drawing = _dereq_('../components/drawing'); -var Color = _dereq_('../components/color'); +/** + * Relink private _keys and keys with a function value from one container + * to the new container. + * Relink means copying if object is pass-by-value and adding a reference + * if object is pass-by-ref. + * This prevents deepCopying massive structures like a webgl context. + */ +module.exports = function relinkPrivateKeys(toContainer, fromContainer) { + for(var k in fromContainer) { + var fromVal = fromContainer[k]; + var toVal = toContainer[k]; -var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); -var DOUBLEQUOTE_REGEX = /"/g; -var DUMMY_SUB = 'TOBESTRIPPED'; -var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + if(toVal === fromVal) { + continue; + } + if(k.charAt(0) === '_' || typeof fromVal === 'function') { -function htmlEntityDecode(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -} + // if it already exists at this point, it's something + // that we recreate each time around, so ignore it + if(k in toContainer) continue; -function xmlEntityEncode(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -} + toContainer[k] = fromVal; + } + else if(isArrayOrTypedArray(fromVal) && isArrayOrTypedArray(toVal) && isPlainObject(fromVal[0])) { -module.exports = function toSVG(gd, format, scale) { - var fullLayout = gd._fullLayout; - var svg = fullLayout._paper; - var toppaper = fullLayout._toppaper; - var width = fullLayout.width; - var height = fullLayout.height; - var i; + // filter out data_array items that can contain user objects + // most of the time the toVal === fromVal check will catch these early + // but if the user makes new ones we also don't want to recurse in. + if(k === 'customdata' || k === 'ids') continue; - // make background color a rect in the svg, then revert after scraping - // all other alterations have been dealt with by properly preparing the svg - // in the first place... like setting cursors with css classes so we don't - // have to remove them, and providing the right namespaces in the svg to - // begin with - svg.insert('rect', ':first-child') - .call(Drawing.setRect, 0, 0, width, height) - .call(Color.fill, fullLayout.paper_bgcolor); + // recurse into arrays containers + 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)) { - // subplot-specific to-SVG methods - // which notably add the contents of the gl-container - // into the main svg node - var basePlotModules = fullLayout._basePlotModules || []; - for(i = 0; i < basePlotModules.length; i++) { - var _module = basePlotModules[i]; + // recurse into objects, but only if they still exist + relinkPrivateKeys(toVal, fromVal); - if(_module.toSVG) _module.toSVG(gd); + if(!Object.keys(toVal).length) delete toContainer[k]; + } } +}; - // add top items above them assumes everything in toppaper is either - // a group or a defs, and if it's empty (like hoverlayer) we can ignore it. - if(toppaper) { - var nodes = toppaper.node().childNodes; +},{"./array":146,"./is_plain_object":160}],177:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // make copy of nodes as childNodes prop gets mutated in loop below - var topGroups = Array.prototype.slice.call(nodes); - for(i = 0; i < topGroups.length; i++) { - var topGroup = topGroups[i]; +'use strict'; - if(topGroup.childNodes.length) svg.node().appendChild(topGroup); - } - } +var isNumeric = _dereq_('fast-isnumeric'); +var loggers = _dereq_('./loggers'); +var identity = _dereq_('./identity'); - // remove draglayer for Adobe Illustrator compatibility - if(fullLayout._draggers) { - fullLayout._draggers.remove(); - } +// don't trust floating point equality - fraction of bin size to call +// "on the line" and ensure that they go the right way specified by +// linelow +var roundingError = 1e-9; - // in case the svg element had an explicit background color, remove this - // we want the rect to get the color so it's the right size; svg bg will - // fill whatever container it's displayed in regardless of plot size. - svg.node().style.background = ''; - svg.selectAll('text') - .attr({'data-unformatted': null, 'data-math': null}) - .each(function() { - var txt = d3.select(this); +/** + * findBin - find the bin for val - note that it can return outside the + * bin range any pos. or neg. integer for linear bins, or -1 or + * bins.length-1 for explicit. + * bins is either an object {start,size,end} or an array length #bins+1 + * bins can be either increasing or decreasing but must be monotonic + * for linear bins, we can just calculate. For listed bins, run a binary + * search linelow (truthy) says the bin boundary should be attributed to + * the lower bin rather than the default upper bin + */ +exports.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 n1 = 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); + // c is just to avoid infinite loops if there's an error + while(n1 < n2 && c++ < 100) { + n = Math.floor((n1 + n2) / 2); + if(test(bins[n], val)) n1 = n + 1; + else n2 = n; + } + if(c > 90) loggers.log('Long binary search...'); + return n1 - 1; + } +}; - // hidden text is pre-formatting mathjax, the browser ignores it - // but in a static plot it's useless and it can confuse batik - // we've tried to standardize on display:none but make sure we still - // catch visibility:hidden if it ever arises - if(this.style.visibility === 'hidden' || this.style.display === 'none') { - txt.remove(); - return; - } - else { - // clear other visibility/display values to default - // to not potentially confuse non-browser SVG implementations - txt.style({visibility: null, display: null}); - } +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; } - // Font family styles break things because of quotation marks, - // so we must remove them *after* the SVG DOM has been serialized - // to a string (browsers convert singles back) - var ff = this.style.fontFamily; - if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); - } - }); +exports.sorterAsc = function(a, b) { return a - b; }; +exports.sorterDes = function(a, b) { return b - a; }; - svg.selectAll('.point, .scatterpts, .legendfill>path, .legendlines>path, .cbfill').each(function() { - var pt = d3.select(this); +/** + * find distinct values in an array, lumping together ones that appear to + * just be off by a rounding error + * return the distinct values and the minimum difference between any two + */ +exports.distinctVals = function(valsIn) { + var vals = valsIn.slice(); // otherwise we sort the original array... + vals.sort(exports.sorterAsc); - // similar to font family styles above, - // we must remove " after the SVG DOM has been serialized - var fill = this.style.fill; - if(fill && fill.indexOf('url(') !== -1) { - pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); - } + var l = vals.length - 1; + var minDiff = (vals[l] - vals[0]) || 1; + var errDiff = minDiff / (l || 1) / 10000; + var v2 = [vals[0]]; - var stroke = this.style.stroke; - if(stroke && stroke.indexOf('url(') !== -1) { - pt.style('stroke', stroke.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + for(var i = 0; i < l; i++) { + // make sure values aren't just off by a rounding error + if(vals[i + 1] > vals[i] + errDiff) { + minDiff = Math.min(minDiff, vals[i + 1] - vals[i]); + v2.push(vals[i + 1]); } - }); - - if(format === 'pdf' || format === 'eps') { - // these formats make the extra line MathJax adds around symbols look super thick in some cases - // it looks better if this is removed entirely. - svg.selectAll('#MathJax_SVG_glyphs path') - .attr('stroke-width', 0); } - // fix for IE namespacing quirk? - // http://stackoverflow.com/questions/19610089/unwanted-namespaces-on-svg-markup-when-using-xmlserializer-in-javascript-with-ie - svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns', xmlnsNamespaces.svg); - svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); + return {vals: v2, minDiff: minDiff}; +}; - if(format === 'svg' && scale) { - svg.attr('width', scale * width); - svg.attr('height', scale * height); - svg.attr('viewBox', '0 0 ' + width + ' ' + height); +/** + * return the smallest element from (sorted) array arrayIn that's bigger than val, + * or (reverse) the largest element smaller than val + * used to find the best tick given the minimum (non-rounded) tick + * particularly useful for date/time where things are not powers of 10 + * binary search is probably overkill here... + */ +exports.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; + // c is just to avoid infinite loops if there's an error + while(low < high && c++ < 100) { + mid = rounded((low + high) / 2); + if(arrayIn[mid] <= val) low = mid + dlow; + else high = mid - dhigh; } + return arrayIn[low]; +}; - var s = new window.XMLSerializer().serializeToString(svg.node()); - s = htmlEntityDecode(s); - s = xmlEntityEncode(s); +/** + * Tweak to Array.sort(sortFn) that improves performance for pre-sorted arrays + * + * Note that newer browsers (such as Chrome v70+) are starting to pick up + * on pre-sorted arrays which may render the following optimization unnecessary + * in the future. + * + * Motivation: sometimes we need to sort arrays but the input is likely to + * already be sorted. Browsers don't seem to pick up on pre-sorted arrays, + * and in fact Chrome is actually *slower* sorting pre-sorted arrays than purely + * random arrays. FF is at least faster if the array is pre-sorted, but still + * not as fast as it could be. + * Here's how this plays out sorting a length-1e6 array: + * + * Calls to Sort FN | Chrome bare | FF bare | Chrome tweak | FF tweak + * | v68.0 Mac | v61.0 Mac| | + * ------------------+---------------+-----------+----------------+------------ + * ordered | 30.4e6 | 10.1e6 | 1e6 | 1e6 + * reversed | 29.4e6 | 9.9e6 | 1e6 + reverse | 1e6 + reverse + * random | ~21e6 | ~18.7e6 | ~21e6 | ~18.7e6 + * + * So this is a substantial win for pre-sorted (ordered or exactly reversed) + * arrays. Including this wrapper on an unsorted array adds a penalty that will + * in general be only a few calls to the sort function. The only case this + * penalty will be significant is if the array is mostly sorted but there are + * a few unsorted items near the end, but the penalty is still at most N calls + * out of (for N=1e6) ~20N total calls + * + * @param {Array} array: the array, to be sorted in place + * @param {function} sortFn: As in Array.sort, function(a, b) that puts + * item a before item b if the return is negative, a after b if positive, + * and no change if zero. + * @return {Array}: the original array, sorted in place. + */ +exports.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(); +}; - // Fix quotations around font strings and gradient URLs - s = s.replace(DUMMY_REGEX, '\''); +/** + * find index in array 'arr' that minimizes 'fn' + * + * @param {array} arr : array where to search + * @param {fn (optional)} fn : function to minimize, + * if not given, fn is the identity function + * @return {integer} + */ +exports.findIndexOfMin = function(arr, fn) { + fn = fn || identity; - // IE is very strict, so we will need to clean - // svg with the following regex - // yes this is messy, but do not know a better way - // Even with this IE will not work due to tainted canvas - // see https://github.com/kangax/fabric.js/issues/1957 - // http://stackoverflow.com/questions/18112047/canvas-todataurl-working-in-all-browsers-except-ie10 - // Leave here just in case the CORS/tainted IE issue gets resolved - if(Lib.isIE()) { - // replace double quote with single quote - s = s.replace(/"/gi, '\''); - // url in svg are single quoted - // since we changed double to single - // we'll need to change these to double-quoted - s = s.replace(/(\('#)([^']*)('\))/gi, '(\"#$2\")'); - // font names with spaces will be escaped single-quoted - // we'll need to change these to double-quoted - s = s.replace(/(\\')/gi, '\"'); + 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 s; + return ind; }; -},{"../components/color":570,"../components/drawing":595,"../constants/xmlns_namespaces":674,"../lib":696,"d3":148}],836:[function(_dereq_,module,exports){ +},{"./identity":158,"./loggers":163,"fast-isnumeric":10}],178:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -136533,259 +39096,121 @@ 'use strict'; -var mergeArray = _dereq_('../../lib').mergeArray; - - -// arrayOk attributes, merge them into calcdata array -module.exports = function arraysToCalcdata(cd, trace) { - for(var i = 0; i < cd.length; i++) cd[i].i = i; - - mergeArray(trace.text, cd, 'tx'); - mergeArray(trace.hovertext, cd, 'htx'); - - var marker = trace.marker; - if(marker) { - mergeArray(marker.opacity, cd, 'mo'); - mergeArray(marker.color, cd, 'mc'); +// works with our CSS cursor classes (see css/_cursor.scss) +// to apply cursors to d3 single-element selections. +// omit cursor to revert to the default. +module.exports = function setCursor(el3, csr) { + (el3.attr('class') || '').split(' ').forEach(function(cls) { + if(cls.indexOf('cursor-') === 0) el3.classed(cls, false); + }); - var markerLine = marker.line; - if(markerLine) { - mergeArray(markerLine.color, cd, 'mlc'); - mergeArray(markerLine.width, cd, 'mlw'); - } - } + if(csr) el3.classed('cursor-' + csr, true); }; -},{"../../lib":696}],837:[function(_dereq_,module,exports){ +},{}],179:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var fontAttrs = _dereq_('../../plots/font_attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var textFontAttrs = fontAttrs({ - editType: 'calc', - arrayOk: true, - colorEditType: 'style', - -}); - -var scatterMarkerAttrs = scatterAttrs.marker; -var scatterMarkerLineAttrs = scatterMarkerAttrs.line; -var markerLineWidth = extendFlat({}, - scatterMarkerLineAttrs.width, { dflt: 0 }); +'use strict'; -var markerLine = extendFlat({ - width: markerLineWidth, - editType: 'calc' -}, colorAttributes('marker.line')); +var isNumeric = _dereq_('fast-isnumeric'); +var isArrayOrTypedArray = _dereq_('./array').isArrayOrTypedArray; -var marker = extendFlat({ - line: markerLine, - editType: 'calc' -}, colorAttributes('marker'), { - colorbar: colorbarAttrs, - opacity: { - valType: 'number', - arrayOk: true, - dflt: 1, - min: 0, - max: 1, - - editType: 'style', - +/** + * aggNums() returns the result of an aggregate function applied to an array of + * values, where non-numerical values have been tossed out. + * + * @param {function} f - aggregation function (e.g., Math.min) + * @param {Number} v - initial value (continuing from previous calls) + * if there's no continuing value, use null for selector-type + * functions (max,min), or 0 for summations + * @param {Array} a - array to aggregate (may be nested, we will recurse, + * but all elements must have the same dimension) + * @param {Number} len - maximum length of a to aggregate + * @return {Number} - result of f applied to a starting from v + */ +exports.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] = exports.aggNums(f, v, a[i]); + a = b; } -}); - -module.exports = { - x: scatterAttrs.x, - x0: scatterAttrs.x0, - dx: scatterAttrs.dx, - y: scatterAttrs.y, - y0: scatterAttrs.y0, - dy: scatterAttrs.dy, - - text: scatterAttrs.text, - hovertext: scatterAttrs.hovertext, - - textposition: { - valType: 'enumerated', - - values: ['inside', 'outside', 'auto', 'none'], - dflt: 'none', - arrayOk: true, - editType: 'calc', - - }, - - textfont: extendFlat({}, textFontAttrs, { - - }), - - insidetextfont: extendFlat({}, textFontAttrs, { - - }), - - outsidetextfont: extendFlat({}, textFontAttrs, { - - }), - - constraintext: { - valType: 'enumerated', - values: ['inside', 'outside', 'both', 'none'], - - dflt: 'both', - editType: 'calc', - - }, - - cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, { - - }), - - orientation: { - valType: 'enumerated', - - values: ['v', 'h'], - editType: 'calc+clearAxisTypes', - - }, - - base: { - valType: 'any', - dflt: null, - arrayOk: true, - - editType: 'calc', - - }, - - offset: { - valType: 'number', - dflt: null, - arrayOk: true, - - editType: 'calc', - - }, - - width: { - valType: 'number', - dflt: null, - min: 0, - arrayOk: true, - - editType: 'calc', - - }, - - marker: marker, - - 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' - }, - r: scatterAttrs.r, - t: scatterAttrs.t, - - _deprecated: { - bardir: { - valType: 'enumerated', - - editType: 'calc', - values: ['v', 'h'], - - } + for(i = 0; i < len; i++) { + if(!isNumeric(v)) v = a[i]; + else if(isNumeric(a[i])) v = f(+v, +a[i]); } + return v; }; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/font_attributes":771,"../scatter/attributes":1043}],838:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Axes = _dereq_('../../plots/cartesian/axes'); -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); -var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); -var calcSelection = _dereq_('../scatter/calc_selection'); - -module.exports = function calc(gd, trace) { - var xa = Axes.getFromId(gd, trace.xaxis || 'x'); - var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; - - if(trace.orientation === 'h') { - size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); - } else { - size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); - } + * mean & std dev functions using aggNums, so it handles non-numerics nicely + * even need to use aggNums instead of .length, to toss out non-numerics + */ +exports.len = function(data) { + return exports.aggNums(function(a) { return a + 1; }, 0, data); +}; - // create the "calculated data" to plot - var serieslen = Math.min(pos.length, size.length); - var cd = new Array(serieslen); +exports.mean = function(data, len) { + if(!len) len = exports.len(data); + return exports.aggNums(function(a, b) { return a + b; }, 0, data) / len; +}; - // set position and size - for(var i = 0; i < serieslen; i++) { - cd[i] = { p: pos[i], s: size[i] }; +exports.midRange = function(numArr) { + if(numArr === undefined || numArr.length === 0) return undefined; + return (exports.aggNums(Math.max, null, numArr) + exports.aggNums(Math.min, null, numArr)) / 2; +}; - if(trace.ids) { - cd[i].id = String(trace.ids[i]); - } - } +exports.variance = function(data, len, mean) { + if(!len) len = exports.len(data); + if(!isNumeric(mean)) mean = exports.mean(data, len); - // auto-z and autocolorscale if applicable - if(hasColorscale(trace, 'marker')) { - colorscaleCalc(trace, trace.marker.color, 'marker', 'c'); - } - if(hasColorscale(trace, 'marker.line')) { - colorscaleCalc(trace, trace.marker.line.color, 'marker.line', 'c'); - } + return exports.aggNums(function(a, b) { + return a + Math.pow(b - mean, 2); + }, 0, data) / len; +}; - arraysToCalcdata(cd, trace); - calcSelection(cd, trace); +exports.stdev = function(data, len, mean) { + return Math.sqrt(exports.variance(data, len, mean)); +}; - return cd; +/** + * interp() computes a percentile (quantile) for a given distribution. + * We interpolate the distribution (to compute quantiles, we follow method #10 here: + * http://www.amstat.org/publications/jse/v14n3/langford.html). + * Typically the index or rank (n * arr.length) may be non-integer. + * For reference: ends are clipped to the extreme values in the array; + * For box plots: index you get is half a point too high (see + * http://en.wikipedia.org/wiki/Percentile#Nearest_rank) but note that this definition + * indexes from 1 rather than 0, so we subtract 1/2 (instead of add). + * + * @param {Array} arr - This array contains the values that make up the distribution. + * @param {Number} n - Between 0 and 1, n = p/100 is such that we compute the p^th percentile. + * For example, the 50th percentile (or median) corresponds to n = 0.5 + * @return {Number} - percentile + */ +exports.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)]; }; -},{"../../components/colorscale/calc":578,"../../components/colorscale/has_colorscale":584,"../../plots/cartesian/axes":744,"../scatter/calc_selection":1045,"./arrays_to_calcdata":836}],839:[function(_dereq_,module,exports){ +},{"./array":146,"fast-isnumeric":10}],180:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -136795,798 +39220,958 @@ 'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; -var BADNUM = _dereq_('../../constants/numerical').BADNUM; - -var Registry = _dereq_('../../registry'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Sieve = _dereq_('./sieve.js'); +/* global MathJax:false */ -/* - * Bar chart stacking/grouping positioning and autoscaling calculations - * for each direction separately calculate the ranges and positions - * note that this handles histograms too - * now doing this one subplot at a time - */ +var d3 = _dereq_('d3'); -function crossTraceCalc(gd, plotinfo) { - var xa = plotinfo.xaxis, - ya = plotinfo.yaxis; +var Lib = _dereq_('../lib'); +var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); +var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; - var fullTraces = gd._fullData, - calcTraces = gd.calcdata, - calcTracesHorizontal = [], - calcTracesVertical = [], - i; - for(i = 0; i < fullTraces.length; i++) { - var fullTrace = fullTraces[i]; - if( - fullTrace.visible === true && - Registry.traceIs(fullTrace, 'bar') && - fullTrace.xaxis === xa._id && - fullTrace.yaxis === ya._id - ) { - if(fullTrace.orientation === 'h') { - calcTracesHorizontal.push(calcTraces[i]); - } - else { - calcTracesVertical.push(calcTraces[i]); - } - } - } +// text converter - setGroupPositions(gd, xa, ya, calcTracesVertical); - setGroupPositions(gd, ya, xa, calcTracesHorizontal); +function getSize(_selection, _dimension) { + return _selection.node().getBoundingClientRect()[_dimension]; } -function setGroupPositions(gd, pa, sa, calcTraces) { - if(!calcTraces.length) return; - - var barmode = gd._fullLayout.barmode, - overlay = (barmode === 'overlay'), - group = (barmode === 'group'), - excluded, - included, - i, calcTrace, fullTrace; +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; - initBase(gd, pa, sa, calcTraces); +exports.convertToTspans = function(_context, gd, _callback) { + var str = _context.text(); - if(overlay) { - setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces); - } - else if(group) { - // exclude from the group those traces for which the user set an offset - excluded = []; - included = []; - for(i = 0; i < calcTraces.length; i++) { - calcTrace = calcTraces[i]; - fullTrace = calcTrace[0].trace; + // Until we get tex integrated more fully (so it can be used along with non-tex) + // allow some elements to prohibit it by attaching 'data-notex' to the original + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); - if(fullTrace.offset === undefined) included.push(calcTrace); - else excluded.push(calcTrace); - } + 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' + }); - if(included.length) { - setGroupPositionsInGroupMode(gd, pa, sa, included); - } - if(excluded.length) { - setGroupPositionsInOverlayMode(gd, pa, sa, excluded); + function showText() { + if(!parent.empty()) { + svgClass = _context.attr('class') + '-math'; + parent.select('svg.' + svgClass).remove(); } - } - else { - // exclude from the stack those traces for which the user set a base - excluded = []; - included = []; - for(i = 0; i < calcTraces.length; i++) { - calcTrace = calcTraces[i]; - fullTrace = calcTrace[0].trace; + _context.text('') + .style('white-space', 'pre'); - if(fullTrace.base === undefined) included.push(calcTrace); - else excluded.push(calcTrace); - } + var hasLink = buildSVGText(_context.node(), str); - if(included.length) { - setGroupPositionsInStackOrRelativeMode(gd, pa, sa, included); - } - if(excluded.length) { - setGroupPositionsInOverlayMode(gd, pa, sa, excluded); + if(hasLink) { + // at least in Chrome, pointer-events does not seem + // to be honored in children of elements + // so if we have an anchor, we have to make the + // whole element respond + _context.style('pointer-events', 'all'); } - } - - collectExtents(calcTraces, pa); -} - -function initBase(gd, pa, sa, calcTraces) { - var i, j; - for(i = 0; i < calcTraces.length; i++) { - var cd = calcTraces[i]; - var trace = cd[0].trace; - var base = trace.base; - var b; - - // not sure if it really makes sense to have dates for bar size data... - // ideally if we want to make gantt charts or something we'd treat - // the actual size (trace.x or y) as time delta but base as absolute - // time. But included here for completeness. - var scalendar = trace.orientation === 'h' ? trace.xcalendar : trace.ycalendar; + exports.positionText(_context); - if(isArrayOrTypedArray(base)) { - for(j = 0; j < Math.min(base.length, cd.length); j++) { - b = sa.d2c(base[j], 0, scalendar); - if(isNumeric(b)) { - cd[j].b = +b; - cd[j].hasB = 1; - } - else cd[j].b = 0; - } - for(; j < cd.length; j++) { - cd[j].b = 0; - } - } else { - b = sa.d2c(base, 0, scalendar); - var hasBase = isNumeric(b); - b = hasBase ? b : 0; - for(j = 0; j < cd.length; j++) { - cd[j].b = b; - if(hasBase) cd[j].hasB = 1; - } - } + if(_callback) _callback.call(_context); } -} - - -function setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces) { - var barnorm = gd._fullLayout.barnorm, - separateNegativeValues = false, - dontMergeOverlappingData = !barnorm; - - // update position axis and set bar offsets and widths - for(var i = 0; i < calcTraces.length; i++) { - var calcTrace = calcTraces[i]; - var sieve = new Sieve( - [calcTrace], separateNegativeValues, dontMergeOverlappingData - ); + if(tex) { + ((gd && gd._promises) || []).push(new Promise(function(resolve) { + _context.style('display', 'none'); + var fontSize = parseInt(_context.node().style.fontSize, 10); + var config = {fontSize: fontSize}; - // set bar offsets and widths, and update position axis - setOffsetAndWidth(gd, pa, sieve); + texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { + parent.selectAll('svg.' + svgClass).remove(); + parent.selectAll('g.' + svgClass + '-group').remove(); - // set bar bases and sizes, and update size axis - // - // (note that `setGroupPositionsInOverlayMode` handles the case barnorm - // is defined, because this function is also invoked for traces that - // can't be grouped or stacked) - if(barnorm) { - sieveBars(gd, sa, sieve); - normalizeBars(gd, sa, sieve); - } - else { - setBaseAndTop(gd, sa, sieve); - } - } -} + 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' + }); -function setGroupPositionsInGroupMode(gd, pa, sa, calcTraces) { - var fullLayout = gd._fullLayout, - barnorm = fullLayout.barnorm, - separateNegativeValues = false, - dontMergeOverlappingData = !barnorm, - sieve = new Sieve( - calcTraces, separateNegativeValues, dontMergeOverlappingData - ); + mathjaxGroup.node().appendChild(newSvg.node()); - // set bar offsets and widths, and update position axis - setOffsetAndWidthInGroupMode(gd, pa, sieve); + // stitch the glyph defs + if(_glyphDefs && _glyphDefs.node()) { + newSvg.node().insertBefore(_glyphDefs.node().cloneNode(true), + newSvg.node().firstChild); + } - // set bar bases and sizes, and update size axis - if(barnorm) { - sieveBars(gd, sa, sieve); - normalizeBars(gd, sa, sieve); - } - else { - setBaseAndTop(gd, sa, sieve); - } -} + newSvg.attr({ + 'class': svgClass, + height: _svgBBox.height, + preserveAspectRatio: 'xMinYMin meet' + }) + .style({overflow: 'visible', 'pointer-events': 'none'}); + var fill = _context.node().style.fill || 'black'; + newSvg.select('g').attr({fill: fill, stroke: fill}); -function setGroupPositionsInStackOrRelativeMode(gd, pa, sa, calcTraces) { - var fullLayout = gd._fullLayout, - barmode = fullLayout.barmode, - stack = (barmode === 'stack'), - relative = (barmode === 'relative'), - barnorm = gd._fullLayout.barnorm, - separateNegativeValues = relative, - dontMergeOverlappingData = !(barnorm || stack || relative), - sieve = new Sieve( - calcTraces, separateNegativeValues, dontMergeOverlappingData - ); + var newSvgW = getSize(newSvg, 'width'); + var newSvgH = getSize(newSvg, 'height'); + var newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start']; + // font baseline is about 1/4 fontSize below centerline + var textHeight = fontSize || getSize(_context, 'height'); + var dy = -textHeight / 4; - // set bar offsets and widths, and update position axis - setOffsetAndWidth(gd, pa, sieve); + if(svgClass[0] === 'y') { + mathjaxGroup.attr({ + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + }); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); + } + else if(svgClass[0] === 'l') { + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); + } + else if(svgClass[0] === 'a' && svgClass.indexOf('atitle') !== 0) { + newSvg.attr({x: 0, y: dy}); + } + else { + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); + } - // set bar bases and sizes, and update size axis - stackBars(gd, sa, sieve); + if(_callback) _callback.call(_context, mathjaxGroup); + resolve(mathjaxGroup); + }); + })); + } + else showText(); - // flag the outmost bar (for text display purposes) - for(var i = 0; i < calcTraces.length; i++) { - var calcTrace = calcTraces[i]; + return _context; +}; - for(var j = 0; j < calcTrace.length; j++) { - var bar = calcTrace[j]; - if(bar.s === BADNUM) continue; +// MathJax - var isOutmostBar = ((bar.b + bar.s) === sieve.get(bar.p, bar.s)); - if(isOutmostBar) bar._outmost = true; - } - } +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; - // Note that marking the outmost bars has to be done - // before `normalizeBars` changes `bar.b` and `bar.s`. - if(barnorm) normalizeBars(gd, sa, sieve); +function cleanEscapesForTex(s) { + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } +function texToSVG(_texString, _config, _callback) { -function setOffsetAndWidth(gd, pa, sieve) { - var fullLayout = gd._fullLayout, - bargap = fullLayout.bargap, - bargroupgap = fullLayout.bargroupgap || 0, - minDiff = sieve.minDiff, - calcTraces = sieve.traces, - i, calcTrace, calcTrace0, - t; - - // set bar offsets and widths - var barGroupWidth = minDiff * (1 - bargap), - barWidthPlusGap = barGroupWidth, - barWidth = barWidthPlusGap * (1 - bargroupgap); + var originalRenderer, + originalConfig, + originalProcessSectionDelay, + tmpDiv; - // computer bar group center and bar offset - var offsetFromCenter = -barWidth / 2; + MathJax.Hub.Queue( + function() { + originalConfig = Lib.extendDeepAll({}, MathJax.Hub.config); - for(i = 0; i < calcTraces.length; i++) { - calcTrace = calcTraces[i]; - calcTrace0 = calcTrace[0]; + originalProcessSectionDelay = MathJax.Hub.processSectionDelay; + if(MathJax.Hub.processSectionDelay !== undefined) { + // MathJax 2.5+ + MathJax.Hub.processSectionDelay = 0; + } - // store bar width and offset for this trace - t = calcTrace0.t; - t.barwidth = barWidth; - t.poffset = offsetFromCenter; - t.bargroupwidth = barGroupWidth; - t.bardelta = minDiff; - } + return MathJax.Hub.Config({ + messageStyle: 'none', + tex2jax: { + inlineMath: [['$', '$'], ['\\(', '\\)']] + }, + displayAlign: 'left', + }); + }, + function() { + // Get original renderer + originalRenderer = MathJax.Hub.config.menuSettings.renderer; + if(originalRenderer !== 'SVG') { + return MathJax.Hub.setRenderer('SVG'); + } + }, + function() { + var randomID = 'math-output-' + Lib.randstr({}, 64); + tmpDiv = d3.select('body').append('div') + .attr({id: randomID}) + .style({visibility: 'hidden', position: 'absolute'}) + .style({'font-size': _config.fontSize + 'px'}) + .text(cleanEscapesForTex(_texString)); - // stack bars that only differ by rounding - sieve.binWidth = calcTraces[0][0].t.barwidth / 100; + return MathJax.Hub.Typeset(tmpDiv.node()); + }, + function() { + var glyphDefs = d3.select('body').select('#MathJax_SVG_glyphs'); - // if defined, apply trace offset and width - applyAttributes(sieve); + if(tmpDiv.select('.MathJax_SVG').empty() || !tmpDiv.select('svg').node()) { + Lib.log('There was an error in the tex syntax.', _texString); + _callback(); + } + else { + var svgBBox = tmpDiv.select('svg').node().getBoundingClientRect(); + _callback(tmpDiv.select('.MathJax_SVG'), glyphDefs, svgBBox); + } - // store the bar center in each calcdata item - setBarCenterAndWidth(gd, pa, sieve); + tmpDiv.remove(); - // update position axes - updatePositionAxis(gd, pa, sieve); + if(originalRenderer !== 'SVG') { + return MathJax.Hub.setRenderer(originalRenderer); + } + }, + function() { + if(originalProcessSectionDelay !== undefined) { + MathJax.Hub.processSectionDelay = originalProcessSectionDelay; + } + return MathJax.Hub.Config(originalConfig); + }); } +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%', + b: 'font-weight:bold', + i: 'font-style:italic', + a: 'cursor:pointer', + span: '', + em: 'font-style:italic;font-weight:bold' +}; -function setOffsetAndWidthInGroupMode(gd, pa, sieve) { - var fullLayout = gd._fullLayout, - bargap = fullLayout.bargap, - bargroupgap = fullLayout.bargroupgap || 0, - positions = sieve.positions, - distinctPositions = sieve.distinctPositions, - minDiff = sieve.minDiff, - calcTraces = sieve.traces, - i, calcTrace, calcTrace0, - t; - - // if there aren't any overlapping positions, - // let them have full width even if mode is group - var overlap = (positions.length !== distinctPositions.length); +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' +}; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; - var nTraces = calcTraces.length, - barGroupWidth = minDiff * (1 - bargap), - barWidthPlusGap = (overlap) ? barGroupWidth / nTraces : barGroupWidth, - barWidth = barWidthPlusGap * (1 - bargroupgap); - - for(i = 0; i < nTraces; i++) { - calcTrace = calcTraces[i]; - calcTrace0 = calcTrace[0]; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; - // computer bar group center and bar offset - var offsetFromCenter = (overlap) ? - ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 : - -barWidth / 2; +var NEWLINES = /(\r\n?|\n)/g; - // store bar width and offset for this trace - t = calcTrace0.t; - t.barwidth = barWidth; - t.poffset = offsetFromCenter; - t.bargroupwidth = barGroupWidth; - t.bardelta = minDiff; - } +var SPLIT_TAGS = /(<[^<>]*>)/; - // stack bars that only differ by rounding - sieve.binWidth = calcTraces[0][0].t.barwidth / 100; +var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; - // if defined, apply trace width - applyAttributes(sieve); +var BR_TAG = //i; - // store the bar center in each calcdata item - setBarCenterAndWidth(gd, pa, sieve); +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + * + * These are for tag attributes; Chrome anyway will convert entities in + * attribute values, but not in attribute names + * you can test this by for example: + * > p = document.createElement('p') + * > p.innerHTML = 'Hi' + * > p.innerHTML + * <- 'Hi' + */ +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; - // update position axes - updatePositionAxis(gd, pa, sieve, overlap); +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + var result = match && (match[3] || match[4]); + return result && convertEntities(result); } +var COLORMATCH = /(^|;)\s*color:/; -function applyAttributes(sieve) { - var calcTraces = sieve.traces, - i, calcTrace, calcTrace0, fullTrace, - j, - t; +/** + * Strip string of tags + * + * @param {string} _str : input string + * @param {object} opts : + * - maxLen {number} max length of output string + * - allowedTags {array} list of pseudo-html tags to NOT strip + * @return {string} + */ +exports.plainText = function(_str, opts) { + opts = opts || {}; - for(i = 0; i < calcTraces.length; i++) { - calcTrace = calcTraces[i]; - calcTrace0 = calcTrace[0]; - fullTrace = calcTrace0.trace; - t = calcTrace0.t; - - var offset = fullTrace._offset || fullTrace.offset, - initialPoffset = t.poffset, - newPoffset; + var len = (opts.len !== undefined && opts.len !== -1) ? opts.len : Infinity; + var allowedTags = opts.allowedTags !== undefined ? opts.allowedTags : ['br']; - if(isArrayOrTypedArray(offset)) { - // if offset is an array, then clone it into t.poffset. - newPoffset = Array.prototype.slice.call(offset, 0, calcTrace.length); + var ellipsis = '...'; + var eLen = ellipsis.length; - // guard against non-numeric items - for(j = 0; j < newPoffset.length; j++) { - if(!isNumeric(newPoffset[j])) { - newPoffset[j] = initialPoffset; - } - } + 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 the length of the array is too short, - // then extend it with the initial value of t.poffset - for(j = newPoffset.length; j < calcTrace.length; j++) { - newPoffset.push(initialPoffset); + if(tagType) { + // N.B. tags do not count towards string length + if(allowedTags.indexOf(tagType) !== -1) { + newParts.push(p); + prevTag = tagType; } + } else { + var pLen = p.length; - t.poffset = newPoffset; - } - else if(offset !== undefined) { - t.poffset = offset; - } - - var width = fullTrace._width || fullTrace.width; - var initialBarwidth = t.barwidth; + if((l + pLen) < len) { + newParts.push(p); + l += pLen; + } else if(l < len) { + var pLen2 = len - l; - if(isArrayOrTypedArray(width)) { - // if width is an array, then clone it into t.barwidth. - var newBarwidth = Array.prototype.slice.call(width, 0, calcTrace.length); + if(prevTag && (prevTag !== 'br' || pLen2 <= eLen || pLen <= eLen)) { + newParts.pop(); + } - // guard against non-numeric items - for(j = 0; j < newBarwidth.length; j++) { - if(!isNumeric(newBarwidth[j])) newBarwidth[j] = initialBarwidth; + if(len > eLen) { + newParts.push(p.substr(0, pLen2 - eLen) + ellipsis); + } else { + newParts.push(p.substr(0, pLen2)); + } + break; } - // if the length of the array is too short, - // then extend it with the initial value of t.barwidth - for(j = newBarwidth.length; j < calcTrace.length; j++) { - newBarwidth.push(initialBarwidth); - } + prevTag = ''; + } + } - t.barwidth = newBarwidth; + return newParts.join(''); +}; - // if user didn't set offset, - // then correct t.poffset to ensure bars remain centered - if(offset === undefined) { - newPoffset = []; - for(j = 0; j < calcTrace.length; j++) { - newPoffset.push( - initialPoffset + (initialBarwidth - newBarwidth[j]) / 2 - ); - } - t.poffset = newPoffset; - } - } - else if(width !== undefined) { - t.barwidth = width; +/* + * N.B. HTML entities are listed without the leading '&' and trailing ';' + * https://www.freeformatter.com/html-entities.html + * + * FWIW if we wanted to support the full set, it has 2261 entries: + * https://www.w3.org/TR/html5/entities.json + * though I notice that some of these are duplicates and/or are missing ";" + * eg: "&", "&", "&", and "&" all map to "&" + * We no longer need to include numeric entities here, these are now handled + * by String.fromCodePoint/fromCharCode + * + * Anyway the only ones that are really important to allow are the HTML special + * chars <, >, and &, because these ones can trigger special processing if not + * replaced by the corresponding entity. + */ +var entityToUnicode = { + mu: 'μ', + amp: '&', + lt: '<', + gt: '>', + nbsp: ' ', + times: '×', + plusmn: '±', + deg: '°' +}; - // if user didn't set offset, - // then correct t.poffset to ensure bars remain centered - if(offset === undefined) { - t.poffset = initialPoffset + (initialBarwidth - width) / 2; - } +// NOTE: in general entities can contain uppercase too (so [a-zA-Z]) but all the +// ones we support use only lowercase. If we ever change that, update the regex. +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) === '#') { + // cannot use String.fromCodePoint in IE + outChar = fromCodePoint( + innerMatch.charAt(1) === 'x' ? + parseInt(innerMatch.substr(2), 16) : + parseInt(innerMatch.substr(1), 10) + ); } - } + else outChar = entityToUnicode[innerMatch]; + + // as in regular HTML, if we didn't decode the entity just + // leave the raw text in place. + return outChar || fullMatch; + }); } +exports.convertEntities = convertEntities; +function fromCodePoint(code) { + // Don't allow overflow. In Chrome this turns into � but I feel like it's + // more useful to just not convert it at all. + if(code > 0x10FFFF) return; + var stringFromCodePoint = String.fromCodePoint; + if(stringFromCodePoint) return stringFromCodePoint(code); -function setBarCenterAndWidth(gd, pa, sieve) { - var calcTraces = sieve.traces, - pLetter = getAxisLetter(pa); + // IE doesn't have String.fromCodePoint + // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint + var stringFromCharCode = String.fromCharCode; + if(code <= 0xFFFF) return stringFromCharCode(code); + return stringFromCharCode( + (code >> 10) + 0xD7C0, + (code % 0x400) + 0xDC00 + ); +} - for(var i = 0; i < calcTraces.length; i++) { - var calcTrace = calcTraces[i], - t = calcTrace[0].t, - poffset = t.poffset, - poffsetIsArray = Array.isArray(poffset), - barwidth = t.barwidth, - barwidthIsArray = Array.isArray(barwidth); +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + /* + * Normalize behavior between IE and others wrt newlines and whitespace:pre + * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 + * Chrome and FF display \n, \r, or \r\n as a space in this mode. + * I feel like at some point we turned these into
but currently we don't so + * I'm just going to cement what we do now in Chrome and FF + */ + str = str.replace(NEWLINES, ' '); - for(var j = 0; j < calcTrace.length; j++) { - var calcBar = calcTrace[j]; + var hasLink = false; - // store the actual bar width and position, for use by hover - var width = calcBar.w = (barwidthIsArray) ? barwidth[j] : barwidth; - calcBar[pLetter] = calcBar.p + - ((poffsetIsArray) ? poffset[j] : poffset) + - width / 2; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + 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; -function updatePositionAxis(gd, pa, sieve, allowMinDtick) { - var calcTraces = sieve.traces, - distinctPositions = sieve.distinctPositions, - distinctPositions0 = distinctPositions[0], - minDiff = sieve.minDiff, - vpad = minDiff / 2; - - Axes.minDtick(pa, minDiff, distinctPositions0, allowMinDtick); - - // If the user set the bar width or the offset, - // then bars can be shifted away from their positions - // and widths can be larger than minDiff. - // - // Here, we compute pMin and pMax to expand the position axis, - // so that all bars are fully within the axis range. - var pMin = Math.min.apply(Math, distinctPositions) - vpad, - pMax = Math.max.apply(Math, distinctPositions) + vpad; + var oldNodeStack = nodeStack; + nodeStack = [{node: lineNode}]; - for(var i = 0; i < calcTraces.length; i++) { - var calcTrace = calcTraces[i], - calcTrace0 = calcTrace[0], - fullTrace = calcTrace0.trace; + if(oldNodeStack.length > 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } - if(fullTrace.width === undefined && fullTrace.offset === undefined) { - continue; + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + // security: href and target are not inserted as code but + // as attributes. popup is, but limited to /[A-Za-z0-9_=,]/ + nodeAttrs.onclick = 'window.open(this.href.baseVal,this.target.baseVal,"' + + popup + '");return false;'; + } + } } + else nodeType = 'tspan'; - var t = calcTrace0.t, - poffset = t.poffset, - barwidth = t.barwidth, - poffsetIsArray = Array.isArray(poffset), - barwidthIsArray = Array.isArray(barwidth); + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; - for(var j = 0; j < calcTrace.length; j++) { - var calcBar = calcTrace[j], - calcBarOffset = (poffsetIsArray) ? poffset[j] : poffset, - calcBarWidth = (barwidthIsArray) ? barwidth[j] : barwidth, - p = calcBar.p, - l = p + calcBarOffset, - r = l + calcBarWidth; + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); - pMin = Math.min(pMin, l); - pMax = Math.max(pMax, r); - } - } + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); - var extremes = Axes.findExtremes(pa, [pMin, pMax], {padded: false}); - putExtremes(calcTraces, pa, extremes); -} + 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]; -function expandRange(range, newValue) { - if(isNumeric(range[0])) range[0] = Math.min(range[0], newValue); - else range[0] = newValue; + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } - if(isNumeric(range[1])) range[1] = Math.max(range[1], newValue); - else range[1] = newValue; -} + d3.select(newNode).attr(nodeAttrs); -function setBaseAndTop(gd, sa, sieve) { - // store these bar bases and tops in calcdata - // and make sure the size axis includes zero, - // along with the bases and tops of each bar. - var traces = sieve.traces, - sLetter = getAxisLetter(sa), - sRange = [null, null]; + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } - for(var i = 0; i < traces.length; i++) { - var trace = traces[i]; + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } - for(var j = 0; j < trace.length; j++) { - var bar = trace[j], - barBase = bar.b, - barTop = barBase + bar.s; + function exitNode(type) { + // A bare closing tag can't close the root node. If we encounter this it + // means there's an extra closing tag that can just be ignored: + if(nodeStack.length === 1) { + Lib.log('Ignoring unexpected end tag .', str); + return; + } - bar[sLetter] = barTop; + var innerNode = nodeStack.pop(); - if(isNumeric(sa.c2l(barTop))) expandRange(sRange, barTop); - if(bar.hasB && isNumeric(sa.c2l(barBase))) expandRange(sRange, barBase); + 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 extremes = Axes.findExtremes(sa, sRange, {tozero: true, padded: true}); - putExtremes(traces, sa, extremes); -} + var hasLines = BR_TAG.test(str); + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } -function stackBars(gd, sa, sieve) { - var fullLayout = gd._fullLayout, - barnorm = fullLayout.barnorm, - sLetter = getAxisLetter(sa), - traces = sieve.traces, - i, trace, - j, bar; + 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 === undefined) { + addTextNode(currentNode, convertEntities(parti)); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; - var sRange = [null, null]; + var nodeSpec = {type: tagType}; - for(i = 0; i < traces.length; i++) { - trace = traces[i]; + // now add style, from both the tag name and any extra css + // Most of the svg css that users will care about is just like html, + // but font color is different (uses fill). Let our users ignore this. + var css = getQuotedMatch(extra, STYLEMATCH); + if(css) { + css = css.replace(COLORMATCH, '$1 fill:'); + if(tagStyle) css += ';' + tagStyle; + } + else if(tagStyle) css = tagStyle; - for(j = 0; j < trace.length; j++) { - bar = trace[j]; + if(css) nodeSpec.style = css; - if(bar.s === BADNUM) continue; + if(tagType === 'a') { + hasLink = true; - // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.b + bar.s), - barTop = barBase + bar.b + bar.s; + var href = getQuotedMatch(extra, HREFMATCH); - // store the bar base and top in each calcdata item - bar.b = barBase; - bar[sLetter] = barTop; + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + // Decode href to allow both already encoded and not encoded + // URIs. Without decoding prior encoding, an already encoded + // URI would be encoded twice producing a semantically different URI. + nodeSpec.href = encodeURI(decodeURI(href)); + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } - if(!barnorm) { - if(isNumeric(sa.c2l(barTop))) expandRange(sRange, barTop); - if(bar.hasB && isNumeric(sa.c2l(barBase))) expandRange(sRange, barBase); + enterNode(nodeSpec); } } } - // if barnorm is set, let normalizeBars update the axis range - if(!barnorm) { - var extremes = Axes.findExtremes(sa, sRange, {tozero: true, padded: true}); - putExtremes(traces, sa, extremes); - } + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; -function sieveBars(gd, sa, sieve) { - var traces = sieve.traces; - - for(var i = 0; i < traces.length; i++) { - var trace = traces[i]; - - for(var j = 0; j < trace.length; j++) { - var bar = trace[j]; +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); - if(bar.s !== BADNUM) sieve.put(bar.p, bar.b + bar.s); + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; } - } -} - -function normalizeBars(gd, sa, sieve) { - // Note: - // - // normalizeBars requires that either sieveBars or stackBars has been - // previously invoked. + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); - var traces = sieve.traces, - sLetter = getAxisLetter(sa), - sTop = (gd._fullLayout.barnorm === 'fraction') ? 1 : 100, - sTiny = sTop / 1e9, // in case of rounding error in sum - sMin = sa.l2c(sa.c2l(0)), - sMax = (gd._fullLayout.barmode === 'stack') ? sTop : sMin, - sRange = [sMin, sMax], - padded = false; - - function maybeExpand(newValue) { - if(isNumeric(sa.c2l(newValue)) && - ((newValue < sMin - sTiny) || (newValue > sMax + sTiny) || !isNumeric(sMin)) - ) { - padded = true; - expandRange(sRange, newValue); + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); } - } - - for(var i = 0; i < traces.length; i++) { - var trace = traces[i]; - - for(var j = 0; j < trace.length; j++) { - var bar = trace[j]; - - if(bar.s === BADNUM) continue; + }); +}; - var scale = Math.abs(sTop / sieve.get(bar.p, bar.s)); - bar.b *= scale; - bar.s *= scale; +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; - var barBase = bar.b, - barTop = barBase + bar.s; - bar[sLetter] = barTop; + 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 { // default: top + getTop = function() { return bRect.top; }; + } - maybeExpand(barTop); - if(bar.hasB) maybeExpand(barBase); - } + 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 { // default: left + getLeft = function() { return bRect.left; }; } - // update range of size axis - var extremes = Axes.findExtremes(sa, sRange, {tozero: true, padded: padded}); - putExtremes(traces, sa, extremes); + return function() { + thisRect = this.node().getBoundingClientRect(); + this.style({ + top: (getTop() - cRect.top) + 'px', + left: (getLeft() - cRect.left) + 'px', + 'z-index': 1000 + }); + return this; + }; } +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -function getAxisLetter(ax) { - return ax._id.charAt(0); -} +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; + var dispatch = d3.dispatch('edit', 'input', 'cancel'); + var handlerElement = _delegate || context; -function putExtremes(cd, ax, extremes) { - for(var i = 0; i < cd.length; i++) { - cd[i][0].trace._extremes[ax._id] = extremes; - } -} + context.style({'pointer-events': _delegate ? 'none' : 'all'}); -// find the full position span of bars at each position -// for use by hover, to ensure labels move in if bars are -// narrower than the space they're in. -// run once per trace group (subplot & direction) and -// the same mapping is attached to all calcdata traces -function collectExtents(calcTraces, pa) { - var posLetter = pa._id.charAt(0); - var extents = {}; - var pMin = Infinity; - var pMax = -Infinity; + if(context.size() !== 1) throw new Error('boo'); - var i, j, cd; - for(i = 0; i < calcTraces.length; i++) { - cd = calcTraces[i]; - for(j = 0; j < cd.length; j++) { - var p = cd[j].p; - if(isNumeric(p)) { - pMin = Math.min(pMin, p); - pMax = Math.max(pMax, p); - } + function handleClick() { + appendEditable(); + context.style({opacity: 0}); + // also hide any mathjax svg + 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}); } } - // this is just for positioning of hover labels, and nobody will care if - // the label is 1px too far out; so round positions to 1/10K in case - // position values don't exactly match from trace to trace - var roundFactor = 10000 / (pMax - pMin); - var round = extents.round = function(p) { - return String(Math.round(roundFactor * (p - pMin))); - }; - - var poffset, poffsetIsArray; + 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(); + } - for(i = 0; i < calcTraces.length; i++) { - cd = calcTraces[i]; - cd[0].t.extents = extents; - poffset = cd[0].t.poffset; - poffsetIsArray = Array.isArray(poffset); + function appendEditable() { + var plotDiv = d3.select(gd); + var container = plotDiv.select('.svg-container'); + var div = container.append('div'); + var cStyle = context.node().style; + var fontSize = parseFloat(cStyle.fontSize || 12); - for(j = 0; j < cd.length; j++) { - var di = cd[j]; - var p0 = di[posLetter] - di.w / 2; + var initialText = options.text; + if(initialText === undefined) initialText = context.attr('data-unformatted'); - if(isNumeric(p0)) { - var p1 = di[posLetter] + di.w / 2; - var pVal = round(di.p); - if(extents[pVal]) { - extents[pVal] = [Math.min(p0, extents[pVal][0]), Math.max(p1, extents[pVal][1])]; - } else { - extents[pVal] = [p0, p1]; + 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() { + gd._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}); } - } - - di.p0 = di.p + ((poffsetIsArray) ? poffset[j] : poffset); - di.p1 = di.p0 + di.w; - di.s0 = di.b; - di.s1 = di.s0 + di.s; - } + 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; + gd._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) { + gd._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); } -} -module.exports = { - crossTraceCalc: crossTraceCalc, - setGroupPositions: setGroupPositions + if(options.immediate) handleClick(); + else handlerElement.on('click', handleClick); + + return d3.rebind(context, dispatch, 'on'); }; -},{"../../constants/numerical":673,"../../lib":696,"../../plots/cartesian/axes":744,"../../registry":827,"./sieve.js":848,"fast-isnumeric":214}],840:[function(_dereq_,module,exports){ +},{"../constants/alignment":138,"../constants/xmlns_namespaces":141,"../lib":159,"d3":8}],181:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); -var Registry = _dereq_('../../registry'); +var timerCache = {}; -var handleXYDefaults = _dereq_('../scatter/xy_defaults'); -var handleStyleDefaults = _dereq_('../bar/style_defaults'); -var attributes = _dereq_('./attributes'); +/** + * Throttle a callback. `callback` executes synchronously only if + * more than `minInterval` milliseconds have already elapsed since the latest + * call (if any). Otherwise we wait until `minInterval` is over and execute the + * last callback received while waiting. + * So the first and last events in a train are always executed (eventually) + * but some of the events in the middle can be dropped. + * + * @param {string} id: an identifier to mark events to throttle together + * @param {number} minInterval: minimum time, in milliseconds, between + * invocations of `callback` + * @param {function} callback: the function to throttle. `callback` itself + * should be a purely synchronous function. + */ +exports.throttle = function throttle(id, minInterval, callback) { + var cache = timerCache[id]; + var now = Date.now(); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + if(!cache) { + /* + * Throw out old items before making a new one, to prevent the cache + * getting overgrown, for example from old plots that have been replaced. + * 1 minute age is arbitrary. + */ + for(var idi in timerCache) { + if(timerCache[idi].ts < now - 60000) { + delete timerCache[idi]; + } + } + cache = timerCache[id] = {ts: 0, timer: null}; } - var coerceFont = Lib.coerceFont; + _clearTimeout(cache); - var len = handleXYDefaults(traceIn, traceOut, layout, coerce); - if(!len) { - traceOut.visible = false; - return; + function exec() { + callback(); + cache.ts = Date.now(); + if(cache.onDone) { + cache.onDone(); + cache.onDone = null; + } } - coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); - coerce('base'); - coerce('offset'); - coerce('width'); + if(now > cache.ts + minInterval) { + exec(); + return; + } - coerce('text'); - coerce('hovertext'); + cache.timer = setTimeout(function() { + exec(); + cache.timer = null; + }, minInterval); +}; - var textPosition = coerce('textposition'); +exports.done = function(id) { + var cache = timerCache[id]; + if(!cache || !cache.timer) return Promise.resolve(); - var hasBoth = Array.isArray(textPosition) || textPosition === 'auto', - hasInside = hasBoth || textPosition === 'inside', - hasOutside = hasBoth || textPosition === 'outside'; + return new Promise(function(resolve) { + var previousOnDone = cache.onDone; + cache.onDone = function onDone() { + if(previousOnDone) previousOnDone(); + resolve(); + cache.onDone = null; + }; + }); +}; - if(hasInside || hasOutside) { - var textFont = coerceFont(coerce, 'textfont', layout.font); +/** + * Clear the throttle cache for one or all timers + * @param {optional string} id: + * if provided, clear just this timer + * if omitted, clear all timers (mainly useful for testing) + */ +exports.clear = function(id) { + if(id) { + _clearTimeout(timerCache[id]); + delete timerCache[id]; + } + else { + for(var idi in timerCache) exports.clear(idi); + } +}; - // Note that coercing `insidetextfont` is always needed – - // even if `textposition` is `outside` for each trace – since - // an outside label can become an inside one, for example because - // of a bar being stacked on top of it. - var insideTextFontDefault = Lib.extendFlat({}, textFont); - var isTraceTextfontColorSet = traceIn.textfont && traceIn.textfont.color; - var isColorInheritedFromLayoutFont = !isTraceTextfontColorSet; - if(isColorInheritedFromLayoutFont) { - delete insideTextFontDefault.color; - } - coerceFont(coerce, 'insidetextfont', insideTextFontDefault); +function _clearTimeout(cache) { + if(cache && cache.timer !== null) { + clearTimeout(cache.timer); + cache.timer = null; + } +} - if(hasOutside) coerceFont(coerce, 'outsidetextfont', textFont); +},{}],182:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - coerce('constraintext'); - coerce('selected.textfont.color'); - coerce('unselected.textfont.color'); - coerce('cliponaxis'); - } +'use strict'; - handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); +var isNumeric = _dereq_('fast-isnumeric'); - // override defaultColor for error bars with defaultLine - var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); +/** + * convert a linear value into a logged value, folding negative numbers into + * the given range + */ +module.exports = function toLogRange(val, range) { + if(val > 0) return Math.log(val) / Math.LN10; - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); + // move a negative value reference to a log axis - just put the + // result at the lowest range value on the plot (or if the range also went negative, + // one millionth of the top of the range) + 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; }; -},{"../../components/color":570,"../../lib":696,"../../registry":827,"../bar/style_defaults":850,"../scatter/xy_defaults":1069,"./attributes":837}],841:[function(_dereq_,module,exports){ +},{"fast-isnumeric":10}],183:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -137595,808 +40180,954 @@ 'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); -var tinycolor = _dereq_('tinycolor2'); - -exports.coerceString = function(attributeDefinition, value, defaultValue) { - if(typeof value === 'string') { - if(value || !attributeDefinition.noBlank) return value; - } - else if(typeof value === 'number') { - if(!attributeDefinition.strict) return String(value); +module.exports = { + moduleType: 'locale', + name: 'en-US', + dictionary: { + 'Click to enter Colorscale title': 'Click to enter Colorscale title' + }, + format: { + date: '%m/%d/%Y' } - - return (defaultValue !== undefined) ? - defaultValue : - attributeDefinition.dflt; }; -exports.coerceNumber = function(attributeDefinition, value, defaultValue) { - if(isNumeric(value)) { - value = +value; +},{}],184:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var min = attributeDefinition.min, - max = attributeDefinition.max, - isOutOfBounds = (min !== undefined && value < min) || - (max !== undefined && value > max); +'use strict'; - if(!isOutOfBounds) return value; +module.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' } - - return (defaultValue !== undefined) ? - defaultValue : - attributeDefinition.dflt; }; -exports.coerceColor = function(attributeDefinition, value, defaultValue) { - if(tinycolor(value).isValid()) return value; +},{}],185:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return (defaultValue !== undefined) ? - defaultValue : - attributeDefinition.dflt; -}; -exports.coerceEnumerated = function(attributeDefinition, value, defaultValue) { - if(attributeDefinition.coerceNumber) value = +value; +'use strict'; + +var Registry = _dereq_('../registry'); + +/* + * containerArrayMatch: does this attribute string point into a + * layout container array? + * + * @param {String} astr: an attribute string, like *annotations[2].text* + * + * @returns {Object | false} Returns false if `astr` doesn't match a container + * array. If it does, returns: + * {array: {String}, index: {Number}, property: {String}} + * ie the attribute string for the array, the index within the array (or '' + * if the whole array) and the property within that (or '' if the whole array + * or the whole object) + */ +module.exports = function containerArrayMatch(astr) { + var rootContainers = Registry.layoutArrayContainers; + var regexpContainers = Registry.layoutArrayRegexes; + var rootPart = astr.split('[')[0]; + var arrayStr; + var match; + + // look for regexp matches first, because they may be nested inside root matches + // eg updatemenus[i].buttons is nested inside updatemenus + for(var i = 0; i < regexpContainers.length; i++) { + match = astr.match(regexpContainers[i]); + if(match && match.index === 0) { + arrayStr = match[0]; + break; + } + } + + // now look for root matches + if(!arrayStr) arrayStr = rootContainers[rootContainers.indexOf(rootPart)]; - if(attributeDefinition.values.indexOf(value) !== -1) return value; + if(!arrayStr) return false; - return (defaultValue !== undefined) ? - defaultValue : - attributeDefinition.dflt; -}; + var tail = astr.substr(arrayStr.length); + if(!tail) return {array: arrayStr, index: '', property: ''}; -exports.getValue = function(arrayOrScalar, index) { - var value; - if(!Array.isArray(arrayOrScalar)) value = arrayOrScalar; - else if(index < arrayOrScalar.length) value = arrayOrScalar[index]; - return value; + match = tail.match(/^\[(0|[1-9][0-9]*)\](\.(.+))?$/); + if(!match) return false; + + return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"fast-isnumeric":214,"tinycolor2":514}],842:[function(_dereq_,module,exports){ +},{"../registry":243}],186:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Fx = _dereq_('../../components/fx'); -var Registry = _dereq_('../../registry'); -var Color = _dereq_('../../components/color'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); +var Lib = _dereq_('../lib'); +var extendFlat = Lib.extendFlat; +var isPlainObject = Lib.isPlainObject; -function hoverPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var trace = cd[0].trace; - var t = cd[0].t; - var isClosest = (hovermode === 'closest'); - var maxHoverDistance = pointData.maxHoverDistance; - var maxSpikeDistance = pointData.maxSpikeDistance; +var traceOpts = { + valType: 'flaglist', + extras: ['none'], + flags: ['calc', 'clearAxisTypes', 'plot', 'style', 'markerSize', 'colorbars'], + +}; - var posVal, sizeVal, posLetter, sizeLetter, dx, dy, pRangeCalc; +var layoutOpts = { + valType: 'flaglist', + extras: ['none'], + flags: [ + 'calc', 'plot', 'legend', 'ticks', 'axrange', + 'layoutstyle', 'modebar', 'camera', 'arraydraw' + ], + +}; - function thisBarMinPos(di) { return di[posLetter] - di.w / 2; } - function thisBarMaxPos(di) { return di[posLetter] + di.w / 2; } +// flags for inside restyle/relayout include a few extras +// that shouldn't be used in attributes, to deal with certain +// combinations and conditionals efficiently +var traceEditTypeFlags = traceOpts.flags.slice() + .concat(['fullReplot']); - var minPos = isClosest ? - thisBarMinPos : - function(di) { - /* - * In compare mode, accept a bar if you're on it *or* its group. - * Nearly always it's the group that matters, but in case the bar - * was explicitly set wider than its group we'd better accept the - * whole bar. - * - * use `bardelta` instead of `bargroupwidth` so we accept hover - * in the gap. That way hover doesn't flash on and off as you - * mouse over the plot in compare modes. - * In 'closest' mode though the flashing seems inevitable, - * without far more complex logic - */ - return Math.min(thisBarMinPos(di), di.p - t.bardelta / 2); - }; +var layoutEditTypeFlags = layoutOpts.flags.slice() + .concat('layoutReplot'); - var maxPos = isClosest ? - thisBarMaxPos : - function(di) { - return Math.max(thisBarMaxPos(di), di.p + t.bardelta / 2); - }; +module.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); }, - function _positionFn(_minPos, _maxPos) { - // add a little to the pseudo-distance for wider bars, so that like scatter, - // if you are over two overlapping bars, the narrower one wins. - return Fx.inbox(_minPos - posVal, _maxPos - posVal, - maxHoverDistance + Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc) - 1); - } + /* + * default (all false) edit flags for relayout + * creates a new object each call, so the caller can mutate freely + */ + layoutFlags: function() { return falseObj(layoutEditTypeFlags); }, - function positionFn(di) { - return _positionFn(minPos(di), maxPos(di)); - } + /* + * 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; + } + } + }, - function thisBarPositionFn(di) { - return _positionFn(thisBarMinPos(di), thisBarMaxPos(di)); - } + overrideAll: overrideAll +}; - function sizeFn(di) { - // add a gradient so hovering near the end of a - // bar makes it a little closer match - return Fx.inbox(di.b - sizeVal, di[sizeLetter] - sizeVal, - maxHoverDistance + (di[sizeLetter] - sizeVal) / (di[sizeLetter] - di.b) - 1); +function falseObj(keys) { + var out = {}; + for(var i = 0; i < keys.length; i++) out[keys[i]] = false; + return out; +} + +/** + * For attributes that are largely copied from elsewhere into a plot type that doesn't + * support partial redraws - overrides the editType field of all attributes in the object + * + * @param {object} attrs: the attributes to override. Will not be mutated. + * @param {string} editTypeOverride: the new editType to use + * @param {'nested'|'from-root'} overrideContainers: + * - 'nested' will override editType for nested containers but not the root. + * - 'from-root' will also override editType of the root container. + * Containers below the absolute top level (trace or layout root) DO need an + * editType even if they are not `valObject`s themselves (eg `scatter.marker`) + * to handle the case where you edit the whole container. + * + * @return {object} a new attributes object with `editType` modified as directed + */ +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; - if(trace.orientation === 'h') { - posVal = yval; - sizeVal = xval; - posLetter = 'y'; - sizeLetter = 'x'; - dx = sizeFn; - dy = positionFn; + 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 { - posVal = xval; - sizeVal = yval; - posLetter = 'x'; - sizeLetter = 'y'; - dy = sizeFn; - dx = positionFn; + // don't provide an editType for the _deprecated container + return overrideAll(attr, editTypeOverride, + (key.charAt(0) === '_') ? 'nested' : 'from-root'); } +} - var pa = pointData[posLetter + 'a']; - var sa = pointData[sizeLetter + 'a']; +},{"../lib":159}],187:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - pRangeCalc = Math.abs(pa.r2c(pa.range[1]) - pa.r2c(pa.range[0])); - function dxy(di) { return (dx(di) + dy(di)) / 2; } - var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); - Fx.getClosest(cd, distfn, pointData); +'use strict'; - // skip the rest (for this trace) if we didn't find a close point - if(pointData.index === false) return; +var isNumeric = _dereq_('fast-isnumeric'); +var m4FromQuat = _dereq_('gl-mat4/fromQuat'); - // if we get here and we're not in 'closest' mode, push min/max pos back - // onto the group - even though that means occasionally the mouse will be - // over the hover label. - if(!isClosest) { - minPos = function(di) { - return Math.min(thisBarMinPos(di), di.p - t.bargroupwidth / 2); - }; - maxPos = function(di) { - return Math.max(thisBarMaxPos(di), di.p + t.bargroupwidth / 2); - }; - } +var Registry = _dereq_('../registry'); +var Lib = _dereq_('../lib'); +var Plots = _dereq_('../plots/plots'); +var AxisIds = _dereq_('../plots/cartesian/axis_ids'); +var cleanId = AxisIds.cleanId; +var getFromTrace = AxisIds.getFromTrace; +var Color = _dereq_('../components/color'); - // the closest data point - var index = pointData.index; - var di = cd[index]; - var size = (trace.base) ? di.b + di.s : di.s; - pointData[sizeLetter + '0'] = pointData[sizeLetter + '1'] = sa.c2p(di[sizeLetter], true); - pointData[sizeLetter + 'LabelVal'] = size; +// clear the promise queue if one of them got rejected +exports.clearPromiseQueue = function(gd) { + if(Array.isArray(gd._promises) && gd._promises.length > 0) { + Lib.log('Clearing previous rejected promises from queue.'); + } - var extent = t.extents[t.extents.round(di.p)]; - pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); - pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + gd._promises = []; +}; - // spikelines always want "closest" distance regardless of hovermode - pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 + maxSpikeDistance - maxHoverDistance; - // they also want to point to the data value, regardless of where the label goes - // in case of bars shifted within groups - pointData[posLetter + 'Spike'] = pa.c2p(di.p, true); +// make a few changes to the layout right away +// before it gets used for anything +// backward compatibility and cleanup of nonstandard options +exports.cleanLayout = function(layout) { + var i, j; - pointData.color = getTraceColor(trace, di); - fillHoverText(di, trace, pointData); - Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, pointData); + if(!layout) layout = {}; - return [pointData]; -} + // cannot have (x|y)axis1, numbering goes axis, axis2, axis3... + 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; + } -function getTraceColor(trace, di) { - var mc = di.mcc || trace.marker.color; - var mlc = di.mlcc || trace.marker.line.color; - var mlw = di.mlw || trace.marker.line.width; + var axisAttrRegex = (Plots.subplotsRegistry.cartesian || {}).attrRegex; + var polarAttrRegex = (Plots.subplotsRegistry.polar || {}).attrRegex; + var ternaryAttrRegex = (Plots.subplotsRegistry.ternary || {}).attrRegex; + var sceneAttrRegex = (Plots.subplotsRegistry.gl3d || {}).attrRegex; - if(Color.opacity(mc)) return mc; - else if(Color.opacity(mlc) && mlw) return mlc; -} + var keys = Object.keys(layout); + for(i = 0; i < keys.length; i++) { + var key = keys[i]; -module.exports = { - hoverPoints: hoverPoints, - getTraceColor: getTraceColor -}; + // modifications to cartesian axes + 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); -},{"../../components/color":570,"../../components/fx":612,"../../registry":827,"../scatter/fill_hover_text":1051}],843:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // old method of axis type - isdate and islog (before category existed) + 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'; + } + delete ax.islog; + delete ax.isdate; + delete ax.categories; // replaced by _categories + // prune empty domain arrays made before the new nestedProperty + if(emptyContainer(ax, 'domain')) delete ax.domain; -'use strict'; + // autotick -> tickmode + if(ax.autotick !== undefined) { + if(ax.tickmode === undefined) { + ax.tickmode = ax.autotick ? 'auto' : 'linear'; + } + delete ax.autotick; + } -var Bar = {}; + cleanTitle(ax); + } -Bar.attributes = _dereq_('./attributes'); -Bar.layoutAttributes = _dereq_('./layout_attributes'); -Bar.supplyDefaults = _dereq_('./defaults'); -Bar.supplyLayoutDefaults = _dereq_('./layout_defaults'); -Bar.calc = _dereq_('./calc'); -Bar.crossTraceCalc = _dereq_('./cross_trace_calc').crossTraceCalc; -Bar.colorbar = _dereq_('../scatter/marker_colorbar'); -Bar.arraysToCalcdata = _dereq_('./arrays_to_calcdata'); -Bar.plot = _dereq_('./plot'); -Bar.style = _dereq_('./style').style; -Bar.styleOnSelect = _dereq_('./style').styleOnSelect; -Bar.hoverPoints = _dereq_('./hover').hoverPoints; -Bar.selectPoints = _dereq_('./select'); + // modifications for polar + else if(polarAttrRegex && polarAttrRegex.test(key)) { + var polar = layout[key]; -Bar.moduleType = 'trace'; -Bar.name = 'bar'; -Bar.basePlotModule = _dereq_('../../plots/cartesian'); -Bar.categories = ['cartesian', 'svg', 'bar', 'oriented', 'errorBarsOK', 'showLegend', 'zoomScale']; -Bar.meta = { - -}; + cleanTitle(polar.radialaxis); + } -module.exports = Bar; + // modifications for ternary + else if(ternaryAttrRegex && ternaryAttrRegex.test(key)) { + var ternary = layout[key]; -},{"../../plots/cartesian":756,"../scatter/marker_colorbar":1061,"./arrays_to_calcdata":836,"./attributes":837,"./calc":838,"./cross_trace_calc":839,"./defaults":840,"./hover":842,"./layout_attributes":844,"./layout_defaults":845,"./plot":846,"./select":847,"./style":849}],844:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + cleanTitle(ternary.aaxis); + cleanTitle(ternary.baxis); + cleanTitle(ternary.caxis); + } -'use strict'; + // modifications for 3D scenes + else if(sceneAttrRegex && sceneAttrRegex.test(key)) { + var scene = layout[key]; + // clean old Camera coords + var cameraposition = scene.cameraposition; -module.exports = { - barmode: { - valType: 'enumerated', - values: ['stack', 'group', 'overlay', 'relative'], - dflt: 'group', - - editType: 'calc', - - }, - barnorm: { - valType: 'enumerated', - values: ['', 'fraction', 'percent'], - dflt: '', - - editType: 'calc', - - }, - bargap: { - valType: 'number', - min: 0, - max: 1, - - editType: 'calc', - - }, - bargroupgap: { - valType: 'number', - min: 0, - max: 1, - dflt: 0, - - editType: 'calc', - - } -}; + 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 = []; -},{}],845:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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 + }; -'use strict'; + delete scene.cameraposition; + } -var Registry = _dereq_('../../registry'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Lib = _dereq_('../../lib'); + // clean axis titles + cleanTitle(scene.xaxis); + cleanTitle(scene.yaxis); + cleanTitle(scene.zaxis); + } + } -var layoutAttributes = _dereq_('./layout_attributes'); + 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; -module.exports = function(layoutIn, layoutOut, fullData) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); + 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 hasBars = false, - shouldBeGapless = false, - gappedAnyway = false, - usedSubplots = {}; + var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; + for(i = 0; i < shapesLen; i++) { + var shape = layout.shapes[i]; - for(var i = 0; i < fullData.length; i++) { - var trace = fullData[i]; - if(Registry.traceIs(trace, 'bar') && trace.visible) hasBars = true; - else continue; + if(!Lib.isPlainObject(shape)) continue; - // if we have at least 2 grouped bar traces on the same subplot, - // we should default to a gap anyway, even if the data is histograms - if(layoutIn.barmode !== 'overlay' && layoutIn.barmode !== 'stack') { - var subploti = trace.xaxis + trace.yaxis; - if(usedSubplots[subploti]) gappedAnyway = true; - usedSubplots[subploti] = true; + cleanAxRef(shape, 'xref'); + cleanAxRef(shape, 'yref'); + } + + var legend = layout.legend; + if(legend) { + // check for old-style legend positioning (x or y is +/- 100) + if(legend.x > 3) { + legend.x = 1.02; + legend.xanchor = 'left'; + } + else if(legend.x < -2) { + legend.x = -0.02; + legend.xanchor = 'right'; } - if(trace.visible && trace.type === 'histogram') { - var pa = Axes.getFromId({_fullLayout: layoutOut}, - trace[trace.orientation === 'v' ? 'xaxis' : 'yaxis']); - if(pa.type !== 'category') shouldBeGapless = true; + if(legend.y > 3) { + legend.y = 1.02; + legend.yanchor = 'bottom'; + } + else if(legend.y < -2) { + legend.y = -0.02; + legend.yanchor = 'top'; } } - if(!hasBars) return; + // clean plot title + cleanTitle(layout); - var mode = coerce('barmode'); - if(mode !== 'overlay') coerce('barnorm'); + /* + * Moved from rotate -> orbit for dragmode + */ + if(layout.dragmode === 'rotate') layout.dragmode = 'orbit'; - coerce('bargap', (shouldBeGapless && !gappedAnyway) ? 0 : 0.2); - coerce('bargroupgap'); -}; + // sanitize rgb(fractions) and rgba(fractions) that old tinycolor + // supported, but new tinycolor does not because they're not valid css + Color.clean(layout); -},{"../../lib":696,"../../plots/cartesian/axes":744,"../../registry":827,"./layout_attributes":844}],846:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // clean the layout container in layout.template + if(layout.template && layout.template.layout) { + exports.cleanLayout(layout.template.layout); + } + return layout; +}; -'use strict'; +function cleanAxRef(container, attr) { + var valIn = container[attr]; + var axLetter = attr.charAt(0); + if(valIn && valIn !== 'paper') { + container[attr] = cleanId(valIn, axLetter); + } +} -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); +/** + * Cleans up old title attribute structure (flat) in favor of the new one (nested). + * + * @param {Object} titleContainer - an object potentially including deprecated title attributes + */ +function cleanTitle(titleContainer) { + if(titleContainer) { + + // title -> title.text + // (although title used to be a string attribute, + // numbers are accepted as well) + if(typeof titleContainer.title === 'string' || typeof titleContainer.title === 'number') { + titleContainer.title = { + text: titleContainer.title + }; + } -var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); + rewireAttr('titlefont', 'font'); + rewireAttr('titleposition', 'position'); + rewireAttr('titleside', 'side'); + rewireAttr('titleoffset', 'offset'); + } -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Registry = _dereq_('../../registry'); + function rewireAttr(oldAttrName, newAttrName) { + var oldAttrSet = titleContainer[oldAttrName]; + var newAttrSet = titleContainer.title && titleContainer.title[newAttrName]; -var attributes = _dereq_('./attributes'), - attributeText = attributes.text, - attributeTextPosition = attributes.textposition; -var helpers = _dereq_('./helpers'); -var style = _dereq_('./style'); + if(oldAttrSet && !newAttrSet) { -// padding in pixels around text -var TEXTPAD = 3; + // Ensure title object exists + if(!titleContainer.title) { + titleContainer.title = {}; + } -module.exports = function plot(gd, plotinfo, cdbar, barLayer) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - var fullLayout = gd._fullLayout; + titleContainer.title[newAttrName] = titleContainer[oldAttrName]; + delete titleContainer[oldAttrName]; + } + } +} - var bartraces = Lib.makeTraceGroups(barLayer, cdbar, 'trace bars').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var trace = cd0.trace; +/* + * cleanData: Make a few changes to the data for backward compatibility + * before it gets used for anything. Modifies the data traces users provide. + * + * Important: if you're going to add something here that modifies a data array, + * update it in place so the new array === the old one. + */ +exports.cleanData = function(data) { + for(var tracei = 0; tracei < data.length; tracei++) { + var trace = data[tracei]; + var i; - if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; + // use xbins to bin data in x, and ybins to bin data in y + if(trace.type === 'histogramy' && 'xbins' in trace && !('ybins' in trace)) { + trace.ybins = trace.xbins; + delete trace.xbins; + } - var pointGroup = Lib.ensureSingle(plotGroup, 'g', 'points'); + // error_y.opacity is obsolete - merge into color + if(trace.error_y && 'opacity' in trace.error_y) { + var dc = Color.defaults; + var yeColor = trace.error_y.color || (Registry.traceIs(trace, 'bar') ? + Color.defaultLine : + dc[tracei % dc.length]); + trace.error_y.color = Color.addOpacity( + Color.rgb(yeColor), + Color.opacity(yeColor) * trace.error_y.opacity); + delete trace.error_y.opacity; + } - var bars = pointGroup.selectAll('g.point').data(Lib.identity); + // convert bardir to orientation, and put the data into + // the axes it's eventually going to be used with + if('bardir' in trace) { + if(trace.bardir === 'h' && (Registry.traceIs(trace, 'bar') || + trace.type.substr(0, 9) === 'histogram')) { + trace.orientation = 'h'; + exports.swapXYData(trace); + } + delete trace.bardir; + } - bars.enter().append('g') - .classed('point', true); + // now we have only one 1D histogram type, and whether + // it uses x or y data depends on trace.orientation + if(trace.type === 'histogramy') exports.swapXYData(trace); + if(trace.type === 'histogramx' || trace.type === 'histogramy') { + trace.type = 'histogram'; + } - bars.exit().remove(); + // scl->scale, reversescl->reversescale + 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; + } - bars.each(function(di, i) { - var bar = d3.select(this); + // axis ids x1 -> x, y1-> y + if(trace.xaxis) trace.xaxis = cleanId(trace.xaxis, 'x'); + if(trace.yaxis) trace.yaxis = cleanId(trace.yaxis, 'y'); - // now display the bar - // clipped xf/yf (2nd arg true): non-positive - // log values go off-screen by plotwidth - // so you see them continue if you drag the plot - var x0, x1, y0, y1; - if(trace.orientation === 'h') { - y0 = ya.c2p(di.p0, true); - y1 = ya.c2p(di.p1, true); - x0 = xa.c2p(di.s0, true); - x1 = xa.c2p(di.s1, true); + // scene ids scene1 -> scene + if(Registry.traceIs(trace, 'gl3d') && trace.scene) { + trace.scene = Plots.subplotsRegistry.gl3d.cleanId(trace.scene); + } - // for selections - di.ct = [x1, (y0 + y1) / 2]; + if(!Registry.traceIs(trace, 'pie') && !Registry.traceIs(trace, 'bar')) { + if(Array.isArray(trace.textposition)) { + for(i = 0; i < trace.textposition.length; i++) { + trace.textposition[i] = cleanTextPosition(trace.textposition[i]); + } } - else { - x0 = xa.c2p(di.p0, true); - x1 = xa.c2p(di.p1, true); - y0 = ya.c2p(di.s0, true); - y1 = ya.c2p(di.s1, true); - - // for selections - di.ct = [(x0 + x1) / 2, y1]; + else if(trace.textposition) { + trace.textposition = cleanTextPosition(trace.textposition); } + } - if(!isNumeric(x0) || !isNumeric(x1) || - !isNumeric(y0) || !isNumeric(y1) || - x0 === x1 || y0 === y1) { - bar.remove(); - return; + // fix typo in colorscale definition + 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'; } + } - var lw = (di.mlw + 1 || trace.marker.line.width + 1 || - (di.trace ? di.trace.marker.line.width : 0) + 1) - 1, - offset = d3.round((lw / 2) % 1, 2); + // fix typo in surface 'highlight*' definitions + if(trace.type === 'surface' && Lib.isPlainObject(trace.contours)) { + var dims = ['x', 'y', 'z']; - function roundWithLine(v) { - // if there are explicit gaps, don't round, - // it can make the gaps look crappy - return (fullLayout.bargap === 0 && fullLayout.bargroupgap === 0) ? - d3.round(Math.round(v) - offset, 2) : v; - } + for(i = 0; i < dims.length; i++) { + var opts = trace.contours[dims[i]]; - function expandToVisible(v, vc) { - // if it's not in danger of disappearing entirely, - // round more precisely - return Math.abs(v - vc) >= 2 ? roundWithLine(v) : - // but if it's very thin, expand it so it's - // necessarily visible, even if it might overlap - // its neighbor - (v > vc ? Math.ceil(v) : Math.floor(v)); - } + if(!Lib.isPlainObject(opts)) continue; - if(!gd._context.staticPlot) { - // if bars are not fully opaque or they have a line - // around them, round to integer pixels, mainly for - // safari so we prevent overlaps from its expansive - // pixelation. if the bars ARE fully opaque and have - // no line, expand to a full pixel to make sure we - // can see them - var op = Color.opacity(di.mc || trace.marker.color), - fixpx = (op < 1 || lw > 0.01) ? - roundWithLine : expandToVisible; - x0 = fixpx(x0, x1); - x1 = fixpx(x1, x0); - y0 = fixpx(y0, y1); - y1 = fixpx(y1, y0); + if(opts.highlightColor) { + opts.highlightcolor = opts.highlightColor; + delete opts.highlightColor; + } + + if(opts.highlightWidth) { + opts.highlightwidth = opts.highlightWidth; + delete opts.highlightWidth; + } } + } - Lib.ensureSingle(bar, 'path') - .style('vector-effect', 'non-scaling-stroke') - .attr('d', - 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') - .call(Drawing.setClipUrl, plotinfo.layerClipId); + // fixes from converting finance from transforms to real trace types + 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); - appendBarText(gd, bar, cd, i, x0, x1, y0, y1); + // now figure out something smart to do with the separate direction + // names we removed + if((increasingName !== false) && (decreasingName !== false)) { + // both sub-names existed: base name previously had no effect + // so ignore it and try to find a shared part of the sub-names - if(plotinfo.layerClipId) { - Drawing.hideOutsideRangePoint(di, bar.select('text'), xa, ya, trace.xcalendar, trace.ycalendar); + var newName = commonPrefix( + increasingName, decreasingName, + increasingShowlegend, decreasingShowlegend + ); + // if no common part, leave whatever name was (or wasn't) there + if(newName) trace.name = newName; } - }); + else if((increasingName || decreasingName) && !trace.name) { + // one sub-name existed but not the base name - just use the sub-name + trace.name = increasingName || decreasingName; + } + } - // lastly, clip points groups of `cliponaxis !== false` traces - // on `plotinfo._hasClipOnAxisFalse === true` subplots - var hasClipOnAxisFalse = cd0.trace.cliponaxis === false; - Drawing.setClipUrl(plotGroup, hasClipOnAxisFalse ? null : plotinfo.layerClipId); - }); + // transforms backward compatibility fixes + if(Array.isArray(trace.transforms)) { + var transforms = trace.transforms; - // error bars are on the top - Registry.getComponentMethod('errorbars', 'plot')(bartraces, plotinfo); -}; + for(i = 0; i < transforms.length; i++) { + var transform = transforms[i]; -function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { - var textPosition; + if(!Lib.isPlainObject(transform)) continue; - function appendTextNode(bar, text, textFont) { - var textSelection = Lib.ensureSingle(bar, 'text') - .text(text) - .attr({ - 'class': 'bartext bartext-' + textPosition, - transform: '', - 'text-anchor': 'middle', - // prohibit tex interpretation until we can handle - // tex and regular text together - 'data-notex': 1 - }) - .call(Drawing.font, textFont) - .call(svgTextUtils.convertToTspans, gd); + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - return textSelection; - } + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; + } + break; - // get trace attributes - var trace = calcTrace[0].trace, - orientation = trace.orientation; + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; - var text = getText(trace, i); - textPosition = getTextPosition(trace, i); + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); - if(!text || textPosition === 'none') { - bar.select('text').remove(); - return; - } + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; + } + } + } - var layoutFont = gd._fullLayout.font; - var barColor = style.getBarColor(calcTrace[i], trace); - var insideTextFont = style.getInsideTextFont(trace, i, layoutFont, barColor); - var outsideTextFont = style.getOutsideTextFont(trace, i, layoutFont); + // prune empty containers made before the new nestedProperty + 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; + } - // compute text position - var barmode = gd._fullLayout.barmode, - inStackMode = (barmode === 'stack'), - inRelativeMode = (barmode === 'relative'), - inStackOrRelativeMode = inStackMode || inRelativeMode, - - calcBar = calcTrace[i], - isOutmostBar = !inStackOrRelativeMode || calcBar._outmost, - - barWidth = Math.abs(x1 - x0) - 2 * TEXTPAD, // padding excluded - barHeight = Math.abs(y1 - y0) - 2 * TEXTPAD, // padding excluded - - textSelection, - textBB, - textWidth, - textHeight; + // sanitize rgb(fractions) and rgba(fractions) that old tinycolor + // supported, but new tinycolor does not because they're not valid css + Color.clean(trace); - if(textPosition === 'outside') { - if(!isOutmostBar && !calcBar.hasB) textPosition = 'inside'; + // remove obsolete autobin(x|y) attributes, but only if true + // if false, this needs to happen in Histogram.calc because it + // can be a one-time autobin so we need to know the results before + // we can push them back into the 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); } +}; - if(textPosition === 'auto') { - if(isOutmostBar) { - // draw text using insideTextFont and check if it fits inside bar - textPosition = 'inside'; - textSelection = appendTextNode(bar, text, insideTextFont); +function cleanFinanceDir(dirContainer) { + if(!Lib.isPlainObject(dirContainer)) return false; - textBB = Drawing.bBox(textSelection.node()), - textWidth = textBB.width, - textHeight = textBB.height; + var dirName = dirContainer.name; - var textHasSize = (textWidth > 0 && textHeight > 0), - fitsInside = - (textWidth <= barWidth && textHeight <= barHeight), - fitsInsideIfRotated = - (textWidth <= barHeight && textHeight <= barWidth), - fitsInsideIfShrunk = (orientation === 'h') ? - (barWidth >= textWidth * (barHeight / textHeight)) : - (barHeight >= textHeight * (barWidth / textWidth)); - if(textHasSize && - (fitsInside || fitsInsideIfRotated || fitsInsideIfShrunk)) { - textPosition = 'inside'; - } - else { - textPosition = 'outside'; - textSelection.remove(); - textSelection = null; - } - } - else textPosition = 'inside'; - } + delete dirContainer.name; + delete dirContainer.showlegend; - if(!textSelection) { - textSelection = appendTextNode(bar, text, - (textPosition === 'outside') ? - outsideTextFont : insideTextFont); + return (typeof dirName === 'string' || typeof dirName === 'number') && String(dirName); +} - textBB = Drawing.bBox(textSelection.node()), - textWidth = textBB.width, - textHeight = textBB.height; +function commonPrefix(name1, name2, show1, show2) { + // if only one is shown in the legend, use that + if(show1 && !show2) return name1; + if(show2 && !show1) return name2; - if(textWidth <= 0 || textHeight <= 0) { - textSelection.remove(); - return; - } - } + // if both or neither are in the legend, check if one is blank (or whitespace) + // and use the other one + // note that hover labels can still use the name even if the legend doesn't + if(!name1.trim()) return name2; + if(!name2.trim()) return name1; - // compute text transform - var transform, constrained; - if(textPosition === 'outside') { - constrained = trace.constraintext === 'both' || trace.constraintext === 'outside'; - transform = getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, - orientation, constrained); - } - else { - constrained = trace.constraintext === 'both' || trace.constraintext === 'inside'; - transform = getTransformToMoveInsideBar(x0, x1, y0, y1, textBB, - orientation, constrained); + var minLen = Math.min(name1.length, name2.length); + var i; + for(i = 0; i < minLen; i++) { + if(name1.charAt(i) !== name2.charAt(i)) break; } - textSelection.attr('transform', transform); + var out = name1.substr(0, i); + return out.trim(); } -function getTransformToMoveInsideBar(x0, x1, y0, y1, textBB, orientation, constrained) { - // compute text and target positions - var textWidth = textBB.width, - textHeight = textBB.height, - textX = (textBB.left + textBB.right) / 2, - textY = (textBB.top + textBB.bottom) / 2, - barWidth = Math.abs(x1 - x0), - barHeight = Math.abs(y1 - y0), - targetWidth, - targetHeight, - targetX, - targetY; +// textposition - support partial attributes (ie just 'top') +// and incorrect use of middle / center etc. +function cleanTextPosition(textposition) { + var posY = 'middle'; + var posX = 'center'; - // apply text padding - var textpad; - if(barWidth > (2 * TEXTPAD) && barHeight > (2 * TEXTPAD)) { - textpad = TEXTPAD; - barWidth -= 2 * textpad; - barHeight -= 2 * textpad; + 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'; } - else textpad = 0; - // compute rotation and scale - var rotate, - scale; + return posY + ' ' + posX; +} - if(textWidth <= barWidth && textHeight <= barHeight) { - // no scale or rotation is required - rotate = false; - scale = 1; - } - else if(textWidth <= barHeight && textHeight <= barWidth) { - // only rotation is required - rotate = true; - scale = 1; - } - else if((textWidth < textHeight) === (barWidth < barHeight)) { - // only scale is required - rotate = false; - scale = constrained ? Math.min(barWidth / textWidth, barHeight / textHeight) : 1; - } - else { - // both scale and rotation are required - rotate = true; - scale = constrained ? Math.min(barHeight / textWidth, barWidth / textHeight) : 1; - } +function emptyContainer(outer, innerStr) { + return (innerStr in outer) && + (typeof outer[innerStr] === 'object') && + (Object.keys(outer[innerStr]).length === 0); +} - if(rotate) rotate = 90; // rotate clockwise - // compute text and target positions - if(rotate) { - targetWidth = scale * textHeight; - targetHeight = scale * textWidth; - } - else { - targetWidth = scale * textWidth; - targetHeight = scale * textHeight; +// swap all the data and data attributes associated with x and y +exports.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(orientation === 'h') { - if(x1 < x0) { - // bar end is on the left hand side - targetX = x1 + textpad + targetWidth / 2; - targetY = (y0 + y1) / 2; - } - else { - targetX = x1 - textpad - targetWidth / 2; - targetY = (y0 + y1) / 2; + 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']); } } - else { - if(y1 > y0) { - // bar end is on the bottom - targetX = (x0 + x1) / 2; - targetY = y1 - textpad - targetHeight / 2; + 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'; } - else { - targetX = (x0 + x1) / 2; - targetY = y1 + textpad + targetHeight / 2; + trace.hoverinfo = hoverInfoParts.join('+'); + } +}; + +// coerce traceIndices input to array of trace indices +exports.coerceTraceIndices = function(gd, traceIndices) { + if(isNumeric(traceIndices)) { + return [traceIndices]; + } + else if(!Array.isArray(traceIndices) || !traceIndices.length) { + return gd.data.map(function(_, i) { return i; }); + } + else if(Array.isArray(traceIndices)) { + var traceIndicesOut = []; + for(var i = 0; i < traceIndices.length; i++) { + if(Lib.isIndex(traceIndices[i], gd.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 getTransform(textX, textY, targetX, targetY, scale, rotate); -} + return traceIndices; +}; -function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation, constrained) { - var barWidth = (orientation === 'h') ? - Math.abs(y1 - y0) : - Math.abs(x1 - x0), - textpad; +/** + * Manages logic around array container item creation / deletion / update + * that nested property alone can't handle. + * + * @param {Object} np + * nested property of update attribute string about trace or layout object + * @param {*} newVal + * update value passed to restyle / relayout / update + * @param {Object} undoit + * undo hash (N.B. undoit may be mutated here). + * + */ +exports.manageArrayContainers = function(np, newVal, undoit) { + var obj = np.obj; + var parts = np.parts; + var pLength = parts.length; + var pLast = parts[pLength - 1]; - // Keep the padding so the text doesn't sit right against - // the bars, but don't factor it into barWidth - if(barWidth > 2 * TEXTPAD) { - textpad = TEXTPAD; - } + var pLastIsNumber = isNumeric(pLast); - // compute rotation and scale - var scale = 1; - if(constrained) { - scale = (orientation === 'h') ? - Math.min(1, barWidth / textBB.height) : - Math.min(1, barWidth / textBB.width); - } + // delete item + if(pLastIsNumber && newVal === null) { - // compute text and target positions - var textX = (textBB.left + textBB.right) / 2, - textY = (textBB.top + textBB.bottom) / 2, - targetWidth, - targetHeight, - targetX, - targetY; + // Clear item in array container when new value is null + var contPath = parts.slice(0, pLength - 1).join('.'); + var cont = Lib.nestedProperty(obj, contPath).get(); + cont.splice(pLast, 1); + + // Note that nested property clears null / undefined at end of + // array container, but not within them. + } + // create item + else if(pLastIsNumber && np.get() === undefined) { - targetWidth = scale * textBB.width; - targetHeight = scale * textBB.height; + // When adding a new item, make sure undo command will remove it + if(np.get() === undefined) undoit[np.astr] = null; - if(orientation === 'h') { - if(x1 < x0) { - // bar end is on the left hand side - targetX = x1 - textpad - targetWidth / 2; - targetY = (y0 + y1) / 2; - } - else { - targetX = x1 + textpad + targetWidth / 2; - targetY = (y0 + y1) / 2; - } + np.set(newVal); } + // update item else { - if(y1 > y0) { - // bar end is on the bottom - targetX = (x0 + x1) / 2; - targetY = y1 + textpad + targetHeight / 2; - } - else { - targetX = (x0 + x1) / 2; - targetY = y1 - textpad - targetHeight / 2; - } + + // If the last part of attribute string isn't a number, + // np.set is all we need. + np.set(newVal); } +}; - return getTransform(textX, textY, targetX, targetY, scale, false); -} +/* + * Match the part to strip off to turn an attribute into its parent + * really it should be either '.some_characters' or '[number]' + * but we're a little more permissive here and match either + * '.not_brackets_or_dot' or '[not_brackets_or_dot]' + */ +var ATTR_TAIL_RE = /(\.[^\[\]\.]+|\[[^\[\]\.]+\])$/; -function getTransform(textX, textY, targetX, targetY, scale, rotate) { - var transformScale, - transformRotate, - transformTranslate; +function getParent(attr) { + var tail = attr.search(ATTR_TAIL_RE); + if(tail > 0) return attr.substr(0, tail); +} - if(scale < 1) transformScale = 'scale(' + scale + ') '; - else { - scale = 1; - transformScale = ''; +/* + * hasParent: does an attribute object contain a parent of the given attribute? + * for example, given 'images[2].x' do we also have 'images' or 'images[2]'? + * + * @param {Object} aobj + * update object, whose keys are attribute strings and values are their new settings + * @param {string} attr + * the attribute string to test against + * @returns {Boolean} + * is a parent of attr present in aobj? + */ +exports.hasParent = function(aobj, attr) { + var attrParent = getParent(attr); + while(attrParent) { + if(attrParent in aobj) return true; + attrParent = getParent(attrParent); } + return false; +}; - transformRotate = (rotate) ? - 'rotate(' + rotate + ' ' + textX + ' ' + textY + ') ' : ''; - - // Note that scaling also affects the center of the text box - var translateX = (targetX - scale * textX), - translateY = (targetY - scale * textY); - transformTranslate = 'translate(' + translateX + ' ' + translateY + ')'; - - return transformTranslate + transformScale + transformRotate; -} +/** + * Empty out types for all axes containing these traces so we auto-set them again + * + * @param {object} gd + * @param {[integer]} traces: trace indices to search for axes to clear the types of + * @param {object} layoutUpdate: any update being done concurrently to the layout, + * which may supercede clearing the axis types + */ +var axLetters = ['x', 'y', 'z']; +exports.clearAxisTypes = function(gd, traces, layoutUpdate) { + for(var i = 0; i < traces.length; i++) { + var trace = gd._fullData[i]; + for(var j = 0; j < 3; j++) { + var ax = getFromTrace(gd, trace, axLetters[j]); -function getText(trace, index) { - var value = helpers.getValue(trace.text, index); - return helpers.coerceString(attributeText, value); -} + // do not clear log type - that's never an auto result so must have been intentional + if(ax && ax.type !== 'log') { + var axAttr = ax._name; + var sceneName = ax._id.substr(1); + if(sceneName.substr(0, 5) === 'scene') { + if(layoutUpdate[sceneName] !== undefined) continue; + axAttr = sceneName + '.' + axAttr; + } + var typeAttr = axAttr + '.type'; -function getTextPosition(trace, index) { - var value = helpers.getValue(trace.textposition, index); - return helpers.coerceEnumerated(attributeTextPosition, value); -} + if(layoutUpdate[axAttr] === undefined && layoutUpdate[typeAttr] === undefined) { + Lib.nestedProperty(gd.layout, typeAttr).set(null); + } + } + } + } +}; -},{"../../components/color":570,"../../components/drawing":595,"../../lib":696,"../../lib/svg_text_utils":720,"../../registry":827,"./attributes":837,"./helpers":841,"./style":849,"d3":148,"fast-isnumeric":214}],847:[function(_dereq_,module,exports){ +},{"../components/color":43,"../lib":159,"../plots/cartesian/axis_ids":206,"../plots/plots":236,"../registry":243,"fast-isnumeric":10,"gl-mat4/fromQuat":11}],188:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -138405,150 +41136,259 @@ 'use strict'; -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; - var i; +var main = _dereq_('./plot_api'); - if(selectionTester === false) { - // clear selection - for(i = 0; i < cd.length; i++) { - cd[i].selected = 0; - } - } else { - for(i = 0; i < cd.length; i++) { - var di = cd[i]; +exports.plot = main.plot; +exports.newPlot = main.newPlot; +exports.restyle = main.restyle; +exports.relayout = main.relayout; +exports.redraw = main.redraw; +exports.update = main.update; +exports._guiRestyle = main._guiRestyle; +exports._guiRelayout = main._guiRelayout; +exports._guiUpdate = main._guiUpdate; +exports._storeDirectGUIEdit = main._storeDirectGUIEdit; +exports.react = main.react; +exports.extendTraces = main.extendTraces; +exports.prependTraces = main.prependTraces; +exports.addTraces = main.addTraces; +exports.deleteTraces = main.deleteTraces; +exports.moveTraces = main.moveTraces; +exports.purge = main.purge; +exports.addFrames = main.addFrames; +exports.deleteFrames = main.deleteFrames; +exports.animate = main.animate; +exports.setPlotConfig = main.setPlotConfig; - if(selectionTester.contains(di.ct, false, i, searchInfo)) { - selection.push({ - pointNumber: i, - x: xa.c2d(di.x), - y: ya.c2d(di.y) - }); - di.selected = 1; - } else { - di.selected = 0; - } - } - } +exports.toImage = _dereq_('./to_image'); +exports.validate = _dereq_('./validate'); +exports.downloadImage = _dereq_('../snapshot/download'); - return selection; -}; +var templateApi = _dereq_('./template_api'); +exports.makeTemplate = templateApi.makeTemplate; +exports.validateTemplate = templateApi.validateTemplate; -},{}],848:[function(_dereq_,module,exports){ +},{"../snapshot/download":245,"./plot_api":190,"./template_api":195,"./to_image":196,"./validate":197}],189:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -module.exports = Sieve; +var isPlainObject = _dereq_('../lib/is_plain_object'); +var noop = _dereq_('../lib/noop'); +var Loggers = _dereq_('../lib/loggers'); +var sorterAsc = _dereq_('../lib/search').sorterAsc; +var Registry = _dereq_('../registry'); -var Lib = _dereq_('../../lib'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; -/** - * Helper class to sieve data from traces into bins +exports.containerArrayMatch = _dereq_('./container_array_match'); + +var isAddVal = exports.isAddVal = function isAddVal(val) { + return val === 'add' || isPlainObject(val); +}; + +var isRemoveVal = exports.isRemoveVal = function isRemoveVal(val) { + return val === null || val === 'remove'; +}; + +/* + * applyContainerArrayChanges: for managing arrays of layout components in relayout + * handles them all with a consistent interface. * - * @class - * @param {Array} traces - * Array of calculated traces - * @param {boolean} [separateNegativeValues] - * If true, then split data at the same position into a bar - * for positive values and another for negative values - * @param {boolean} [dontMergeOverlappingData] - * If true, then don't merge overlapping bars into a single bar + * Here are the supported actions -> relayout calls -> edits we get here + * (as prepared in _relayout): + * + * add an empty obj -> {'annotations[2]': 'add'} -> {2: {'': 'add'}} + * add a specific obj -> {'annotations[2]': {attrs}} -> {2: {'': {attrs}}} + * delete an obj -> {'annotations[2]': 'remove'} -> {2: {'': 'remove'}} + * -> {'annotations[2]': null} -> {2: {'': null}} + * delete the whole array -> {'annotations': 'remove'} -> {'': {'': 'remove'}} + * -> {'annotations': null} -> {'': {'': null}} + * edit an object -> {'annotations[2].text': 'boo'} -> {2: {'text': 'boo'}} + * + * You can combine many edits to different objects. Objects are added and edited + * in ascending order, then removed in descending order. + * For example, starting with [a, b, c], if you want to: + * - replace b with d: + * {'annotations[1]': d, 'annotations[2]': null} (b is item 2 after adding d) + * - add a new item d between a and b, and edit b: + * {'annotations[1]': d, 'annotations[2].x': newX} (b is item 2 after adding d) + * - delete b and edit c: + * {'annotations[1]': null, 'annotations[2].x': newX} (c is edited before b is removed) + * + * You CANNOT combine adding/deleting an item at index `i` with edits to the same index `i` + * You CANNOT combine replacing/deleting the whole array with anything else (for the same array). + * + * @param {HTMLDivElement} gd + * the DOM element of the graph container div + * @param {Lib.nestedProperty} componentType: the array we are editing + * @param {Object} edits + * the changes to make; keys are indices to edit, values are themselves objects: + * {attr: newValue} of changes to make to that index (with add/remove behavior + * in special values of the empty attr) + * @param {Object} flags + * the flags for which actions we're going to perform to display these (and + * any other) changes. If we're already `recalc`ing, we don't need to redraw + * individual items + * @param {function} _nestedProperty + * a (possibly modified for gui edits) nestedProperty constructor + * The modified version takes a 3rd argument, for a prefix to the attribute + * string necessary for storing GUI edits + * + * @returns {bool} `true` if it managed to complete drawing of the changes + * `false` would mean the parent should replot. */ -function Sieve(traces, separateNegativeValues, dontMergeOverlappingData) { - this.traces = traces; - this.separateNegativeValues = separateNegativeValues; - this.dontMergeOverlappingData = dontMergeOverlappingData; - - // for single-bin histograms - see histogram/calc - var width1 = Infinity; +exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, edits, flags, _nestedProperty) { + var componentType = np.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 = gd.layout; + var fullLayout = gd._fullLayout; - 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]; - if(bar.p !== BADNUM) positions.push(bar.p); + if(edits['']) { + if(Object.keys(edits).length > 1) { + Loggers.warn('Full array edits are incompatible with other edits', + componentType); } - if(trace[0] && trace[0].width1) { - width1 = Math.min(trace[0].width1, width1); + + var fullVal = edits['']['']; + + if(isRemoveVal(fullVal)) np.set(null); + else if(Array.isArray(fullVal)) np.set(fullVal); + else { + Loggers.warn('Unrecognized full array edit value', componentType, fullVal); + return true; } + + if(replotLater) return false; + + supplyComponentDefaults(layout, fullLayout); + draw(gd); + return true; } - this.positions = positions; - var dv = Lib.distinctVals(positions); - this.distinctPositions = dv.vals; - if(dv.vals.length === 1 && width1 !== Infinity) this.minDiff = width1; - else this.minDiff = Math.min(dv.minDiff, width1); + var componentNums = Object.keys(edits).map(Number).sort(sorterAsc); + var componentArrayIn = np.get(); + var componentArray = componentArrayIn || []; + // componentArrayFull is used just to keep splices in line between + // full and input arrays, so private keys can be copied over after + // redoing supplyDefaults + // TODO: this assumes componentArray is in gd.layout - which will not be + // true after we extend this to restyle + 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; - this.binWidth = this.minDiff; + // first make the add and edit changes + for(i = 0; i < componentNums.length; i++) { + componentNum = componentNums[i]; + objEdits = edits[componentNum]; + objKeys = Object.keys(objEdits); + objVal = objEdits[''], + adding = isAddVal(objVal); - this.bins = {}; -} + if(componentNum < 0 || componentNum > componentArray.length - (adding ? 0 : 1)) { + Loggers.warn('index out of range', componentType, componentNum); + continue; + } -/** - * Sieve datum - * - * @method - * @param {number} position - * @param {number} value - * @returns {number} Previous bin value - */ -Sieve.prototype.put = function put(position, value) { - var label = this.getLabel(position, value), - oldValue = this.bins[label] || 0; + if(objVal !== undefined) { + if(objKeys.length > 1) { + Loggers.warn( + 'Insertion & removal are incompatible with edits to the same index.', + componentType, componentNum); + } - this.bins[label] = oldValue + value; + 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); + } - return oldValue; -}; + 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]]); + } + } + } -/** - * Get current bin value for a given datum - * - * @method - * @param {number} position Position of datum - * @param {number} [value] Value of datum - * (required if this.separateNegativeValues is true) - * @returns {number} Current bin value - */ -Sieve.prototype.get = function put(position, value) { - var label = this.getLabel(position, value); - return this.bins[label] || 0; -}; + // now do deletes + for(i = deletes.length - 1; i >= 0; i--) { + componentArray.splice(deletes[i], 1); + // TODO: this drops private keys that had been stored in componentArrayFull + // does this have any ill effects? + if(componentArrayFull) componentArrayFull.splice(deletes[i], 1); + } -/** - * Get bin label for a given datum - * - * @method - * @param {number} position Position of datum - * @param {number} [value] Value of datum - * (required if this.separateNegativeValues is true) - * @returns {string} Bin label - * (prefixed with a 'v' if value is negative and this.separateNegativeValues is - * true; otherwise prefixed with '^') - */ -Sieve.prototype.getLabel = function getLabel(position, value) { - var prefix = (value < 0 && this.separateNegativeValues) ? 'v' : '^', - label = (this.dontMergeOverlappingData) ? - position : - Math.round(position / this.binWidth); - return prefix + label; + if(!componentArray.length) np.set(null); + else if(!componentArrayIn) np.set(componentArray); + + if(replotLater) return false; + + supplyComponentDefaults(layout, fullLayout); + + // finally draw all the components we need to + // if we added or removed any, redraw all after it + if(drawOne !== noop) { + var indicesToDraw; + if(firstIndexChange === -1) { + // there's no re-indexing to do, so only redraw components that changed + indicesToDraw = componentNums; + } + else { + // in case the component array was shortened, we still need do call + // drawOne on the latter items so they get properly removed + 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(gd, indicesToDraw[i]); + } + } + else draw(gd); + + return true; }; -},{"../../constants/numerical":673,"../../lib":696}],849:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":160,"../lib/loggers":163,"../lib/noop":168,"../lib/search":177,"../registry":243,"./container_array_match":185}],190:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -138558,4925 +41398,3848 @@ 'use strict'; + var d3 = _dereq_('d3'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); +var isNumeric = _dereq_('fast-isnumeric'); +var hasHover = _dereq_('has-hover'); -var attributes = _dereq_('./attributes'), - attributeTextFont = attributes.textfont, - attributeInsideTextFont = attributes.insidetextfont, - attributeOutsideTextFont = attributes.outsidetextfont; -var helpers = _dereq_('./helpers'); +var Lib = _dereq_('../lib'); +var nestedProperty = Lib.nestedProperty; -function style(gd, cd) { - var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.bars'); - var barcount = s.size(); - var fullLayout = gd._fullLayout; +var Events = _dereq_('../lib/events'); +var Queue = _dereq_('../lib/queue'); - // trace styling - s.style('opacity', function(d) { return d[0].trace.opacity; }) +var Registry = _dereq_('../registry'); +var PlotSchema = _dereq_('./plot_schema'); +var Plots = _dereq_('../plots/plots'); +var Polar = _dereq_('../plots/polar/legacy'); - // for gapless (either stacked or neighboring grouped) bars use - // crispEdges to turn off antialiasing so an artificial gap - // isn't introduced. - .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'); - } - }); +var Axes = _dereq_('../plots/cartesian/axes'); +var Drawing = _dereq_('../components/drawing'); +var Color = _dereq_('../components/color'); +var connectColorbar = _dereq_('../components/colorbar/connect'); +var initInteractions = _dereq_('../plots/cartesian/graph_interact').initInteractions; +var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); +var svgTextUtils = _dereq_('../lib/svg_text_utils'); - s.selectAll('g.points').each(function(d) { - var sel = d3.select(this); - var trace = d[0].trace; - stylePoints(sel, trace, gd); - }); +var dfltConfig = _dereq_('./plot_config').dfltConfig; +var manageArrays = _dereq_('./manage_arrays'); +var helpers = _dereq_('./helpers'); +var subroutines = _dereq_('./subroutines'); +var editTypes = _dereq_('./edit_types'); - Registry.getComponentMethod('errorbars', 'style')(s); -} +var AX_NAME_PATTERN = _dereq_('../plots/cartesian/constants').AX_NAME_PATTERN; -function stylePoints(sel, trace, gd) { - var pts = sel.selectAll('path'); - var txs = sel.selectAll('text'); +var numericNameWarningCount = 0; +var numericNameWarningCountLimit = 5; - Drawing.pointStyle(pts, trace, gd); +/** + * Main plot-creation function + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + * @param {array of objects} data + * array of traces, containing the data and display information for each trace + * @param {object} layout + * object describing the overall display of the plot, + * all the stuff that doesn't pertain to any individual trace + * @param {object} config + * configuration options (see ./plot_config.js for more info) + * + * OR + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + * @param {object} figure + * object containing `data`, `layout`, `config`, and `frames` members + * + */ +exports.plot = function(gd, data, layout, config) { + var frames; - txs.each(function(d) { - var tx = d3.select(this); - var font = determineFont(tx, d, trace, gd); - Drawing.font(tx, font); - }); -} + gd = Lib.getGraphDiv(gd); -function styleOnSelect(gd, cd) { - var s = cd[0].node3; - var trace = cd[0].trace; + // Events.init is idempotent and bails early if gd has already been init'd + Events.init(gd); - if(trace.selectedpoints) { - stylePointsInSelectionMode(s, trace, gd); - } else { - stylePoints(s, trace, gd); + if(Lib.isPlainObject(data)) { + var obj = data; + data = obj.data; + layout = obj.layout; + config = obj.config; + frames = obj.frames; } -} -function stylePointsInSelectionMode(s, trace, gd) { - Drawing.selectedPointStyle(s.selectAll('path'), trace); - styleTextInSelectionMode(s.selectAll('text'), trace, gd); -} + var okToPlot = Events.triggerHandler(gd, 'plotly_beforeplot', [data, layout, config]); + if(okToPlot === false) return Promise.reject(); + + // if there's no data or layout, and this isn't yet a plotly plot + // container, log a warning to help plotly.js users debug + if(!data && !layout && !Lib.isPlotDiv(gd)) { + Lib.warn('Calling Plotly.plot as if redrawing ' + + 'but this container doesn\'t yet have a plot.', gd); + } -function styleTextInSelectionMode(txs, trace, gd) { - txs.each(function(d) { - var tx = d3.select(this); - var font; + function addFrames() { + if(frames) { + return exports.addFrames(gd, frames); + } + } - if(d.selected) { - font = Lib.extendFlat({}, determineFont(tx, d, trace, gd)); + // transfer configuration options to gd until we move over to + // a more OO like model + setPlotContext(gd, config); - var selectedFontColor = trace.selected.textfont && trace.selected.textfont.color; - if(selectedFontColor) { - font.color = selectedFontColor; - } + if(!layout) layout = {}; - Drawing.font(tx, font); - } else { - Drawing.selectedTextStyle(tx, trace); - } - }); -} + // hook class for plots main container (in case of plotly.js + // this won't be #embedded-graph or .js-tab-contents) + d3.select(gd).classed('js-plotly-plot', true); -function determineFont(tx, d, trace, gd) { - var layoutFont = gd._fullLayout.font; - var textFont = trace.textfont; + // off-screen getBoundingClientRect testing space, + // in #js-plotly-tester (and stored as Drawing.tester) + // so we can share cached text across tabs + Drawing.makeTester(); - 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); - } + // collect promises for any async actions during plotting + // any part of the plotting code can push to gd._promises, then + // before we move to the next step, we check that they're all + // complete, and empty out the promise list again. + if(!Array.isArray(gd._promises)) gd._promises = []; - return textFont; -} + var graphWasEmpty = ((gd.data || []).length === 0 && Array.isArray(data)); -function getTextFont(trace, index, defaultValue) { - return getFontValue( - attributeTextFont, trace.textfont, index, defaultValue); -} + // if there is already data on the graph, append the new data + // if you only want to redraw, pass a non-array for data + if(Array.isArray(data)) { + helpers.cleanData(data); -function getInsideTextFont(trace, index, layoutFont, barColor) { - var defaultFont = getTextFont(trace, index, layoutFont); + if(graphWasEmpty) gd.data = data; + else gd.data.push.apply(gd.data, data); - var wouldFallBackToLayoutFont = - (trace._input.textfont === undefined || trace._input.textfont.color === undefined) || - (Array.isArray(trace.textfont.color) && trace.textfont.color[index] === undefined); - if(wouldFallBackToLayoutFont) { - defaultFont = { - color: Color.contrast(barColor), - family: defaultFont.family, - size: defaultFont.size - }; + // for routines outside graph_obj that want a clean tab + // (rather than appending to an existing one) gd.empty + // is used to determine whether to make a new tab + gd.empty = false; } - return getFontValue( - attributeInsideTextFont, trace.insidetextfont, index, defaultFont); -} + if(!gd.layout || graphWasEmpty) gd.layout = helpers.cleanLayout(layout); -function getOutsideTextFont(trace, index, layoutFont) { - var defaultFont = getTextFont(trace, index, layoutFont); - return getFontValue( - attributeOutsideTextFont, trace.outsidetextfont, index, defaultFont); -} + // if the user is trying to drag the axes, allow new data and layout + // to come in but don't allow a replot. + if(gd._dragging && !gd._transitioning) { + // signal to drag handler that after everything else is done + // we need to replot, because something has changed + gd._replotPending = true; + return Promise.reject(); + } else { + // we're going ahead with a replot now + gd._replotPending = false; + } -function getFontValue(attributeDefinition, attributeValue, index, defaultValue) { - attributeValue = attributeValue || {}; + Plots.supplyDefaults(gd); - var familyValue = helpers.getValue(attributeValue.family, index), - sizeValue = helpers.getValue(attributeValue.size, index), - colorValue = helpers.getValue(attributeValue.color, index); + var fullLayout = gd._fullLayout; + var hasCartesian = fullLayout._has('cartesian'); - 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) - }; -} + // Legacy polar plots + if(!fullLayout._has('polar') && data && data[0] && data[0].r) { + Lib.log('Legacy polar charts are deprecated!'); + return plotLegacyPolar(gd, data, layout); + } -function getBarColor(cd, trace) { - return cd.mc || trace.marker.color; -} + // so we don't try to re-call Plotly.plot from inside + // legend and colorbar, if margins changed + fullLayout._replotting = true; -module.exports = { - style: style, - styleOnSelect: styleOnSelect, - getInsideTextFont: getInsideTextFont, - getOutsideTextFont: getOutsideTextFont, - getBarColor: getBarColor -}; + // make or remake the framework if we need to + if(graphWasEmpty) makePlotFramework(gd); -},{"../../components/color":570,"../../components/drawing":595,"../../lib":696,"../../registry":827,"./attributes":837,"./helpers":841,"d3":148}],850:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // polar need a different framework + if(gd.framework !== makePlotFramework) { + gd.framework = makePlotFramework; + makePlotFramework(gd); + } + // clear gradient defs on each .plot call, because we know we'll loop through all traces + Drawing.initGradients(gd); -'use strict'; + // save initial show spikes once per graph + if(graphWasEmpty) Axes.saveShowSpikeInitial(gd); -var Color = _dereq_('../../components/color'); -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); + // prepare the data and find the autorange -module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout) { - coerce('marker.color', defaultColor); + // generate calcdata, if we need to + // to force redoing calcdata, just delete it before calling Plotly.plot + var recalc = !gd.calcdata || gd.calcdata.length !== (gd._fullData || []).length; + if(recalc) Plots.doCalcdata(gd); - if(hasColorscale(traceIn, 'marker')) { - colorscaleDefaults( - traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'} - ); + // in case it has changed, attach fullData traces to calcdata + for(var i = 0; i < gd.calcdata.length; i++) { + gd.calcdata[i][0].trace = gd._fullData[i]; } - coerce('marker.line.color', Color.defaultLine); + // make the figure responsive + if(gd._context.responsive) { + if(!gd._responsiveChartHandler) { + // Keep a reference to the resize handler to purge it down the road + gd._responsiveChartHandler = function() {Plots.resize(gd);}; - if(hasColorscale(traceIn, 'marker.line')) { - colorscaleDefaults( - traceIn, traceOut, layout, coerce, {prefix: 'marker.line.', cLetter: 'c'} - ); + // Listen to window resize + window.addEventListener('resize', gd._responsiveChartHandler); + } + } else { + Lib.clearResponsive(gd); } - coerce('marker.line.width'); - coerce('marker.opacity'); - coerce('selected.marker.color'); - coerce('unselected.marker.color'); -}; - -},{"../../components/color":570,"../../components/colorscale/defaults":580,"../../components/colorscale/has_colorscale":584}],851:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + /* + * start async-friendly code - now we're actually drawing things + */ -'use strict'; + var oldmargins = JSON.stringify(fullLayout._size); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var scatterPolarAttrs = _dereq_('../scatterpolar/attributes'); -var barAttrs = _dereq_('../bar/attributes'); + // draw framework first so that margin-pushing + // components can position themselves correctly + var drawFrameworkCalls = 0; + function drawFramework() { + var basePlotModules = fullLayout._basePlotModules; -module.exports = { - r: scatterPolarAttrs.r, - theta: scatterPolarAttrs.theta, - r0: scatterPolarAttrs.r0, - dr: scatterPolarAttrs.dr, - theta0: scatterPolarAttrs.theta0, - dtheta: scatterPolarAttrs.dtheta, - thetaunit: scatterPolarAttrs.thetaunit, - - // orientation: { - // valType: 'enumerated', - // - // values: ['radial', 'angular'], - // editType: 'calc+clearAxisTypes', - // - // }, + for(var i = 0; i < basePlotModules.length; i++) { + if(basePlotModules[i].drawFramework) { + basePlotModules[i].drawFramework(gd); + } + } - base: extendFlat({}, barAttrs.base, { - - }), - offset: extendFlat({}, barAttrs.offset, { - - }), - width: extendFlat({}, barAttrs.width, { - - }), + 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; }); - text: extendFlat({}, barAttrs.text, { - - }), - // hovertext: barAttrs.hovertext, + 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, + 'width': '100%', + 'height': '100%', + 'overflow': 'visible', + 'pointer-events': 'none' + }); + } - // textposition: {}, - // textfont: {}, - // insidetextfont: {}, - // outsidetextfont: {}, - // constraintext: {}, - // cliponaxis: extendFlat({}, barAttrs.cliponaxis, {dflt: false}), + if(fullLayout._glcanvas) { + fullLayout._glcanvas + .attr('width', fullLayout.width) + .attr('height', fullLayout.height); - marker: barAttrs.marker, + var regl = fullLayout._glcanvas.data()[0].regl; + if(regl) { + // Unfortunately, this can happen when relayouting to large + // width/height on some browsers. + if(Math.floor(fullLayout.width) !== regl._gl.drawingBufferWidth || + Math.floor(fullLayout.height) !== 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([], {}, gd._fullData, fullLayout); + Plots.supplyDefaults(gd); + fullLayout = gd._fullLayout; + Plots.doCalcdata(gd); + drawFrameworkCalls++; + return drawFramework(); + } + } + } + } - hoverinfo: scatterPolarAttrs.hoverinfo, + return Plots.previousPromises(gd); + } - selected: barAttrs.selected, - unselected: barAttrs.unselected + // draw anything that can affect margins. + function marginPushers() { + var calcdata = gd.calcdata; + var i, cd, trace; - // error_x (error_r, error_theta) - // error_y -}; + // First reset the list of things that are allowed to change the margins + // So any deleted traces or components will be wiped out of the + // automargin calculation. + // This means *every* margin pusher must be listed here, even if it + // doesn't actually try to push the margins until later. + Plots.clearAutoMarginIds(gd); -},{"../../lib/extend":685,"../bar/attributes":837,"../scatterpolar/attributes":1105}],852:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + subroutines.drawMarginPushers(gd); + Axes.allowAutoMargin(gd); -'use strict'; + for(i = 0; i < calcdata.length; i++) { + cd = calcdata[i]; + trace = cd[0].trace; + var colorbarOpts = trace._module.colorbar; + if(trace.visible !== true || !colorbarOpts) { + Plots.autoMargin(gd, 'cb' + trace.uid); + } + else connectColorbar(gd, cd, colorbarOpts); + } -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); -var arraysToCalcdata = _dereq_('../bar/arrays_to_calcdata'); -var setGroupPositions = _dereq_('../bar/cross_trace_calc').setGroupPositions; -var calcSelection = _dereq_('../scatter/calc_selection'); -var traceIs = _dereq_('../../registry').traceIs; -var extendFlat = _dereq_('../../lib').extendFlat; + Plots.doAutoMargin(gd); + return Plots.previousPromises(gd); + } -function calc(gd, trace) { - var fullLayout = gd._fullLayout; - var subplotId = trace.subplot; - var radialAxis = fullLayout[subplotId].radialaxis; - var angularAxis = fullLayout[subplotId].angularaxis; - var rArray = radialAxis.makeCalcdata(trace, 'r'); - var thetaArray = angularAxis.makeCalcdata(trace, 'theta'); - var len = trace._length; - var cd = new Array(len); - - // 'size' axis variables - var sArray = rArray; - // 'pos' axis variables - var pArray = thetaArray; + // in case the margins changed, draw margin pushers again + function marginPushersAgain() { + if(JSON.stringify(fullLayout._size) === oldmargins) return; - for(var i = 0; i < len; i++) { - cd[i] = {p: pArray[i], s: sArray[i]}; + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } - // convert width and offset in 'c' coordinate, - // set 'c' value(s) in trace._width and trace._offset, - // to make Bar.crossTraceCalc "just work" - function d2c(attr) { - var val = trace[attr]; - if(val !== undefined) { - trace['_' + attr] = Array.isArray(val) ? - angularAxis.makeCalcdata(trace, attr) : - angularAxis.d2c(val, trace.thetaunit); + function positionAndAutorange() { + if(!recalc) { + doAutoRangeAndConstraints(); + return; } - } - if(angularAxis.type === 'linear') { - d2c('width'); - d2c('offset'); + // TODO: autosize extra for text markers and images + // see https://github.com/plotly/plotly.js/issues/1111 + return Lib.syncOrAsync([ + Registry.getComponentMethod('shapes', 'calcAutorange'), + Registry.getComponentMethod('annotations', 'calcAutorange'), + doAutoRangeAndConstraints + ], gd); } - if(hasColorscale(trace, 'marker')) { - colorscaleCalc(trace, trace.marker.color, 'marker', 'c'); + function doAutoRangeAndConstraints() { + if(gd._transitioning) return; + + subroutines.doAutoRangeAndConstraints(gd); + + // store initial ranges *after* enforcing constraints, otherwise + // we will never look like we're at the initial ranges + if(graphWasEmpty) Axes.saveRangeInitial(gd); + + // this one is different from shapes/annotations calcAutorange + // the others incorporate those components into ax._extremes, + // this one actually sets the ranges in rangesliders. + Registry.getComponentMethod('rangeslider', 'calcAutorange')(gd); } - if(hasColorscale(trace, 'marker.line')) { - colorscaleCalc(trace, trace.marker.line.color, 'marker.line', 'c'); + + // draw ticks, titles, and calculate axis scaling (._b, ._m) + function drawAxes() { + return Axes.draw(gd, graphWasEmpty ? '' : 'redraw'); } - arraysToCalcdata(cd, trace); - calcSelection(cd, trace); + var seq = [ + Plots.previousPromises, + addFrames, + drawFramework, + marginPushers, + marginPushersAgain + ]; - return cd; -} + if(hasCartesian) seq.push(positionAndAutorange); -function crossTraceCalc(gd, polarLayout, subplotId) { - var calcdata = gd.calcdata; - var barPolarCd = []; + seq.push(subroutines.layoutStyles); + if(hasCartesian) seq.push(drawAxes); - for(var i = 0; i < calcdata.length; i++) { - var cdi = calcdata[i]; - var trace = cdi[0].trace; + seq.push( + subroutines.drawData, + subroutines.finalDraw, + initInteractions, + Plots.addLinks, + Plots.rehover, + // 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 + ); - if(trace.visible === true && traceIs(trace, 'bar') && - trace.subplot === subplotId - ) { - barPolarCd.push(cdi); - } - } + // even if everything we did was synchronous, return a promise + // so that the caller doesn't care which route we took + var plotDone = Lib.syncOrAsync(seq, gd); + if(!plotDone || !plotDone.then) plotDone = Promise.resolve(); - // to make _extremes is filled in correctly so that - // polar._subplot.radialAxis can get auotrange'd - // TODO clean up! - // I think we want to call getAutorange on polar.radialaxis - // NOT on polar._subplot.radialAxis - var rAxis = extendFlat({}, polarLayout.radialaxis, {_id: 'x'}); - var aAxis = polarLayout.angularaxis; + return plotDone.then(function() { + emitAfterPlot(gd); + return gd; + }); +}; - // 'bargap', 'barmode' are in _fullLayout.polar - // TODO clean up setGroupPositions API instead - var mockGd = {_fullLayout: polarLayout}; +function emitAfterPlot(gd) { + var fullLayout = gd._fullLayout; - setGroupPositions(mockGd, aAxis, rAxis, barPolarCd); + if(fullLayout._redrawFromAutoMarginCount) { + fullLayout._redrawFromAutoMarginCount--; + } else { + gd.emit('plotly_afterplot'); + } } -module.exports = { - calc: calc, - crossTraceCalc: crossTraceCalc +exports.setPlotConfig = function setPlotConfig(obj) { + return Lib.extendFlat(dfltConfig, obj); }; -},{"../../components/colorscale/calc":578,"../../components/colorscale/has_colorscale":584,"../../lib":696,"../../registry":827,"../bar/arrays_to_calcdata":836,"../bar/cross_trace_calc":839,"../scatter/calc_selection":1045}],853:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; +function setBackground(gd, bgColor) { + try { + gd._fullLayout._paper.style('background', bgColor); + } catch(e) { + Lib.error(e); + } +} -var Lib = _dereq_('../../lib'); +function opaqueSetBackground(gd, bgColor) { + var blend = Color.combine(bgColor, 'white'); + setBackground(gd, blend); +} -var handleRThetaDefaults = _dereq_('../scatterpolar/defaults').handleRThetaDefaults; -var handleStyleDefaults = _dereq_('../bar/style_defaults'); -var attributes = _dereq_('./attributes'); +function setPlotContext(gd, config) { + if(!gd._context) { + gd._context = Lib.extendDeep({}, dfltConfig); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + // stash href, used to make robust clipPath URLs + var base = d3.select('base'); + gd._context._baseUrl = base.size() && base.attr('href') ? + window.location.href.split('#')[0] : + ''; } - var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce); - if(!len) { - traceOut.visible = false; - return; - } + var context = gd._context; - // coerce('orientation', (traceOut.theta && !traceOut.r) ? 'angular' : 'radial'); + var i, keys, key; - coerce('thetaunit'); - coerce('base'); - coerce('offset'); - coerce('width'); + 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]; + } + } + } - coerce('text'); - // coerce('hovertext'); + // map plot3dPixelRatio to plotGlPixelRatio for backward compatibility + if(config.plot3dPixelRatio && !context.plotGlPixelRatio) { + context.plotGlPixelRatio = context.plot3dPixelRatio; + } + + // now deal with editable and edits - first editable overrides + // everything, then edits refines + var editable = config.editable; + if(editable !== undefined) { + // we're not going to *use* context.editable, we're only going to + // use context.edits... but keep it for the record + context.editable = editable; - // var textPosition = coerce('textposition'); - // var hasBoth = Array.isArray(textPosition) || textPosition === 'auto'; - // var hasInside = hasBoth || textPosition === 'inside'; - // var hasOutside = hasBoth || textPosition === 'outside'; - - // if(hasInside || hasOutside) { - // var textFont = coerceFont(coerce, 'textfont', layout.font); - // if(hasInside) coerceFont(coerce, 'insidetextfont', textFont); - // if(hasOutside) coerceFont(coerce, 'outsidetextfont', textFont); - // coerce('constraintext'); - // coerce('selected.textfont.color'); - // coerce('unselected.textfont.color'); - // coerce('cliponaxis'); - // } + 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]; + } + } + } - handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); + // not part of the user-facing config options + context._exportedPlot = config._exportedPlot; + } - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -}; + // staticPlot forces a bunch of others: + 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; + } -},{"../../lib":696,"../bar/style_defaults":850,"../scatterpolar/defaults":1107,"./attributes":851}],854:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // make sure hover-only devices have mode bar visible + if(context.displayModeBar === 'hover' && !hasHover) { + context.displayModeBar = true; + } -'use strict'; + // default and fallback for setBackground + if(context.setBackground === 'transparent' || typeof context.setBackground !== 'function') { + context.setBackground = setBackground; + } -var Fx = _dereq_('../../components/fx'); -var Lib = _dereq_('../../lib'); -var getTraceColor = _dereq_('../bar/hover').getTraceColor; -var fillHoverText = _dereq_('../scatter/fill_hover_text'); -var makeHoverPointText = _dereq_('../scatterpolar/hover').makeHoverPointText; -var isPtInsidePolygon = _dereq_('../../plots/polar/helpers').isPtInsidePolygon; + // Check if gd has a specified widht/height to begin with + context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0; + context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0; + + // fill context._scrollZoom helper to help manage scrollZoom flaglist + var szIn = context.scrollZoom; + var szOut = context._scrollZoom = {}; + if(szIn === true) { + szOut.cartesian = 1; + szOut.gl3d = 1; + szOut.geo = 1; + szOut.mapbox = 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; + } +} + +function plotLegacyPolar(gd, data, layout) { + // build or reuse the container skeleton + var plotContainer = d3.select(gd).selectAll('.plot-container') + .data([0]); + plotContainer.enter() + .insert('div', ':first-child') + .classed('plot-container plotly', true); + var paperDiv = plotContainer.selectAll('.svg-container') + .data([0]); + paperDiv.enter().append('div') + .classed('svg-container', true) + .style('position', 'relative'); -module.exports = function hoverPoints(pointData, xval, yval) { - var cd = pointData.cd; - var trace = cd[0].trace; + // empty it everytime for now + paperDiv.html(''); - var subplot = pointData.subplot; - var radialAxis = subplot.radialAxis; - var angularAxis = subplot.angularAxis; - var vangles = subplot.vangles; - var inboxFn = vangles ? isPtInsidePolygon : Lib.isPtInsideSector; - var maxHoverDistance = pointData.maxHoverDistance; - var period = angularAxis._period || 2 * Math.PI; + // fulfill gd requirements + if(data) gd.data = data; + if(layout) gd.layout = layout; + Polar.manager.fillLayout(gd); - var rVal = Math.abs(radialAxis.g2p(Math.sqrt(xval * xval + yval * yval))); - var thetaVal = Math.atan2(yval, xval); + // resize canvas + paperDiv.style({ + width: gd._fullLayout.width + 'px', + height: gd._fullLayout.height + 'px' + }); - // polar.(x|y)axis.p2c doesn't get the reversed radial axis range case right - if(radialAxis.range[0] > radialAxis.range[1]) { - thetaVal += Math.PI; - } - - var distFn = function(di) { - if(inboxFn(rVal, thetaVal, [di.rp0, di.rp1], [di.thetag0, di.thetag1], vangles)) { - return maxHoverDistance + - // add a little to the pseudo-distance for wider bars, so that like scatter, - // if you are over two overlapping bars, the narrower one wins. - Math.min(1, Math.abs(di.thetag1 - di.thetag0) / period) - 1 + - // add a gradient so hovering near the end of a - // bar makes it a little closer match - (di.rp1 - rVal) / (di.rp1 - di.rp0) - 1; - } else { - return Infinity; - } - }; + // instantiate framework + gd.framework = Polar.manager.framework(gd); - Fx.getClosest(cd, distFn, pointData); - if(pointData.index === false) return; + // plot + gd.framework({data: gd.data, layout: gd.layout}, paperDiv.node()); - var index = pointData.index; - var cdi = cd[index]; + // set undo point + gd.framework.setUndoPoint(); - pointData.x0 = pointData.x1 = cdi.ct[0]; - pointData.y0 = pointData.y1 = cdi.ct[1]; + // get the resulting svg for extending it + var polarPlotSVG = gd.framework.svg(); - var _cdi = Lib.extendFlat({}, cdi, {r: cdi.s, theta: cdi.p}); - fillHoverText(cdi, trace, pointData); - makeHoverPointText(_cdi, trace, subplot, pointData); - pointData.color = getTraceColor(trace, cdi); - pointData.xLabelVal = pointData.yLabelVal = undefined; + // editable title + var opacity = 1; + var txt = gd._fullLayout.title ? gd._fullLayout.title.text : ''; + if(txt === '' || !txt) opacity = 0; - if(cdi.s < 0) { - pointData.idealAlign = 'left'; - } + var titleLayout = function() { + this.call(svgTextUtils.convertToTspans, gd); + // TODO: html/mathjax + // TODO: center title + }; - return [pointData]; -}; + var title = polarPlotSVG.select('.title-group text') + .call(titleLayout); -},{"../../components/fx":612,"../../lib":696,"../../plots/polar/helpers":810,"../bar/hover":842,"../scatter/fill_hover_text":1051,"../scatterpolar/hover":1108}],855:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(gd._context.edits.titleText) { + var placeholderText = Lib._(gd, 'Click to enter Plot title'); + if(!txt || txt === placeholderText) { + opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted + title.attr({'data-unformatted': placeholderText}) + .text(placeholderText) + .style({opacity: opacity}) + .on('mouseover.opacity', function() { + d3.select(this).transition().duration(100) + .style('opacity', 1); + }) + .on('mouseout.opacity', function() { + d3.select(this).transition().duration(1000) + .style('opacity', 0); + }); + } -'use strict'; + var setContenteditable = function() { + this.call(svgTextUtils.makeEditable, {gd: gd}) + .on('edit', function(text) { + gd.framework({layout: {title: {text: text}}}); + this.text(text) + .call(titleLayout); + this.call(setContenteditable); + }) + .on('cancel', function() { + var txt = this.attr('data-unformatted'); + this.text(txt).call(titleLayout); + }); + }; + title.call(setContenteditable); + } -module.exports = { - moduleType: 'trace', - name: 'barpolar', - basePlotModule: _dereq_('../../plots/polar'), - categories: ['polar', 'bar', 'showLegend'], + gd._context.setBackground(gd, gd._fullLayout.paper_bgcolor); + Plots.addLinks(gd); - attributes: _dereq_('./attributes'), - layoutAttributes: _dereq_('./layout_attributes'), - supplyDefaults: _dereq_('./defaults'), - supplyLayoutDefaults: _dereq_('./layout_defaults'), + return Promise.resolve(); +} - calc: _dereq_('./calc').calc, - crossTraceCalc: _dereq_('./calc').crossTraceCalc, +// convenience function to force a full redraw, mostly for use by plotly.js +exports.redraw = function(gd) { + gd = Lib.getGraphDiv(gd); - plot: _dereq_('./plot'), - colorbar: _dereq_('../scatter/marker_colorbar'), - style: _dereq_('../bar/style').style, + if(!Lib.isPlotDiv(gd)) { + throw new Error('This element is not a Plotly plot: ' + gd); + } - hoverPoints: _dereq_('./hover'), - selectPoints: _dereq_('../bar/select'), + helpers.cleanData(gd.data); + helpers.cleanLayout(gd.layout); - meta: { - - - } + gd.calcdata = undefined; + return exports.plot(gd).then(function() { + gd.emit('plotly_redraw'); + return gd; + }); }; -},{"../../plots/polar":811,"../bar/select":847,"../bar/style":849,"../scatter/marker_colorbar":1061,"./attributes":851,"./calc":852,"./defaults":853,"./hover":854,"./layout_attributes":856,"./layout_defaults":857,"./plot":858}],856:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Convenience function to make idempotent plot option obvious to users. + * + * @param gd + * @param {Object[]} data + * @param {Object} layout + * @param {Object} config + */ +exports.newPlot = function(gd, data, layout, config) { + gd = Lib.getGraphDiv(gd); -'use strict'; + // remove gl contexts + Plots.cleanPlot([], {}, gd._fullData || [], gd._fullLayout || {}); -module.exports = { - barmode: { - valType: 'enumerated', - values: ['stack', 'overlay'], - dflt: 'stack', - - editType: 'calc', - - }, - bargap: { - valType: 'number', - dflt: 0.1, - min: 0, - max: 1, - - editType: 'calc', - - } + Plots.purge(gd); + return exports.plot(gd, data, layout, config); }; -},{}],857:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var attrs = _dereq_('./layout_attributes'); - -module.exports = function(layoutIn, layoutOut, fullData) { - var subplotsDone = {}; - var sp; - - function coerce(attr, dflt) { - return Lib.coerce(layoutIn[sp] || {}, layoutOut[sp], attrs, attr, dflt); - } + * Wrap negative indicies to their positive counterparts. + * + * @param {Number[]} indices An array of indices + * @param {Number} maxIndex The maximum index allowable (arr.length - 1) + */ +function positivifyIndices(indices, maxIndex) { + var parentLength = maxIndex + 1; + var positiveIndices = []; + var i; + var index; - for(var i = 0; i < fullData.length; i++) { - var trace = fullData[i]; - if(trace.type === 'barpolar' && trace.visible === true) { - sp = trace.subplot; - if(!subplotsDone[sp]) { - coerce('barmode'); - coerce('bargap'); - subplotsDone[sp] = 1; - } + for(i = 0; i < indices.length; i++) { + index = indices[i]; + if(index < 0) { + positiveIndices.push(parentLength + index); + } else { + positiveIndices.push(index); } } -}; + return positiveIndices; +} -},{"../../lib":696,"./layout_attributes":856}],858:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var isNumeric = _dereq_('fast-isnumeric'); - -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../../components/drawing'); -var helpers = _dereq_('../../plots/polar/helpers'); - -module.exports = function plot(gd, subplot, cdbar) { - var xa = subplot.xaxis; - var ya = subplot.yaxis; - var radialAxis = subplot.radialAxis; - var angularAxis = subplot.angularAxis; - var pathFn = makePathFn(subplot); - var barLayer = subplot.layers.frontplot.select('g.barlayer'); - - Lib.makeTraceGroups(barLayer, cdbar, 'trace bars').each(function(cd) { - var plotGroup = cd[0].node3 = d3.select(this); - var pointGroup = Lib.ensureSingle(plotGroup, 'g', 'points'); - var bars = pointGroup.selectAll('g.point').data(Lib.identity); - - bars.enter().append('g') - .style('vector-effect', 'non-scaling-stroke') - .style('stroke-miterlimit', 2) - .classed('point', true); - - bars.exit().remove(); + * Ensures that an index array for manipulating gd.data is valid. + * + * Intended for use with addTraces, deleteTraces, and moveTraces. + * + * @param gd + * @param indices + * @param arrayName + */ +function assertIndexArray(gd, indices, arrayName) { + var i, + index; - bars.each(function(di) { - var bar = d3.select(this); + for(i = 0; i < indices.length; i++) { + index = indices[i]; - var rp0 = di.rp0 = radialAxis.c2p(di.s0); - var rp1 = di.rp1 = radialAxis.c2p(di.s1); - var thetag0 = di.thetag0 = angularAxis.c2g(di.p0); - var thetag1 = di.thetag1 = angularAxis.c2g(di.p1); - - var dPath; - - if(!isNumeric(rp0) || !isNumeric(rp1) || - !isNumeric(thetag0) || !isNumeric(thetag1) || - rp0 === rp1 || thetag0 === thetag1 - ) { - // do not remove blank bars, to keep data-to-node - // mapping intact during radial drag, that we - // can skip calling _module.style during interactions - dPath = 'M0,0Z'; - } else { - // this 'center' pt is used for selections and hover labels - var rg1 = radialAxis.c2g(di.s1); - var thetagMid = (thetag0 + thetag1) / 2; - di.ct = [ - xa.c2p(rg1 * Math.cos(thetagMid)), - ya.c2p(rg1 * Math.sin(thetagMid)) - ]; + // validate that indices are indeed integers + if(index !== parseInt(index, 10)) { + throw new Error('all values in ' + arrayName + ' must be integers'); + } - dPath = pathFn(rp0, rp1, thetag0, thetag1); - } + // check that all indices are in bounds for given gd.data array length + if(index >= gd.data.length || index < -gd.data.length) { + throw new Error(arrayName + ' must be valid indices for gd.data.'); + } - Lib.ensureSingle(bar, 'path').attr('d', dPath); - }); + // check that indices aren't repeated + if(indices.indexOf(index, i + 1) > -1 || + index >= 0 && indices.indexOf(-gd.data.length + index) > -1 || + index < 0 && indices.indexOf(gd.data.length + index) > -1) { + throw new Error('each index in ' + arrayName + ' must be unique.'); + } + } +} - // clip plotGroup, when trace layer isn't clipped - Drawing.setClipUrl(plotGroup, subplot._hasClipOnAxisFalse ? subplot.clipIds.forTraces : null); - }); -}; +/** + * Private function used by Plotly.moveTraces to check input args + * + * @param gd + * @param currentIndices + * @param newIndices + */ +function checkMoveTracesArgs(gd, currentIndices, newIndices) { -function makePathFn(subplot) { - var cxx = subplot.cxx; - var cyy = subplot.cyy; + // check that gd has attribute 'data' and 'data' is array + if(!Array.isArray(gd.data)) { + throw new Error('gd.data must be an array.'); + } - if(subplot.vangles) { - return function(r0, r1, _a0, _a1) { - var a0, a1; + // validate currentIndices array + if(typeof currentIndices === 'undefined') { + throw new Error('currentIndices is a required argument.'); + } else if(!Array.isArray(currentIndices)) { + currentIndices = [currentIndices]; + } + assertIndexArray(gd, currentIndices, 'currentIndices'); - if(Lib.angleDelta(_a0, _a1) > 0) { - a0 = _a0; - a1 = _a1; - } else { - a0 = _a1; - a1 = _a0; - } + // validate newIndices array if it exists + if(typeof newIndices !== 'undefined' && !Array.isArray(newIndices)) { + newIndices = [newIndices]; + } + if(typeof newIndices !== 'undefined') { + assertIndexArray(gd, newIndices, 'newIndices'); + } - var va0 = helpers.findEnclosingVertexAngles(a0, subplot.vangles)[0]; - var va1 = helpers.findEnclosingVertexAngles(a1, subplot.vangles)[1]; - var vaBar = [va0, (a0 + a1) / 2, va1]; - return helpers.pathPolygonAnnulus(r0, r1, a0, a1, vaBar, cxx, cyy); - }; + // check currentIndices and newIndices are the same length if newIdices exists + if(typeof newIndices !== 'undefined' && currentIndices.length !== newIndices.length) { + throw new Error('current and new indices must be of equal length.'); } - return function(r0, r1, a0, a1) { - return Lib.pathAnnulus(r0, r1, a0, a1, cxx, cyy); - }; } - -},{"../../components/drawing":595,"../../lib":696,"../../plots/polar/helpers":810,"d3":148,"fast-isnumeric":214}],859:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + * A private function to reduce the type checking clutter in addTraces. + * + * @param gd + * @param traces + * @param newIndices + */ +function checkAddTracesArgs(gd, traces, newIndices) { + var i, value; -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorAttrs = _dereq_('../../components/color/attributes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; + // check that gd has attribute 'data' and 'data' is array + if(!Array.isArray(gd.data)) { + throw new Error('gd.data must be an array.'); + } -var scatterMarkerAttrs = scatterAttrs.marker; -var scatterMarkerLineAttrs = scatterMarkerAttrs.line; + // make sure traces exists + if(typeof traces === 'undefined') { + throw new Error('traces must be defined.'); + } -module.exports = { - y: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - x: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - x0: { - valType: 'any', - - editType: 'calc+clearAxisTypes', - - }, - y0: { - valType: 'any', - - editType: 'calc+clearAxisTypes', - - }, - name: { - valType: 'string', - - editType: 'calc+clearAxisTypes', - - }, - text: extendFlat({}, scatterAttrs.text, { - - }), - whiskerwidth: { - valType: 'number', - min: 0, - max: 1, - dflt: 0.5, - - editType: 'calc', - - }, - notched: { - valType: 'boolean', - - editType: 'calc', - - }, - notchwidth: { - valType: 'number', - min: 0, - max: 0.5, - dflt: 0.25, - - editType: 'calc', - - }, - boxpoints: { - valType: 'enumerated', - values: ['all', 'outliers', 'suspectedoutliers', false], - dflt: 'outliers', - - editType: 'calc', - - }, - boxmean: { - valType: 'enumerated', - values: [true, 'sd', false], - dflt: false, - - editType: 'calc', - - }, - jitter: { - valType: 'number', - min: 0, - max: 1, - - editType: 'calc', - - }, - pointpos: { - valType: 'number', - min: -2, - max: 2, - - editType: 'calc', - - }, - orientation: { - valType: 'enumerated', - values: ['v', 'h'], - - editType: 'calc+clearAxisTypes', - - }, - marker: { - outliercolor: { - valType: 'color', - dflt: 'rgba(0, 0, 0, 0)', - - editType: 'style', - - }, - symbol: extendFlat({}, scatterMarkerAttrs.symbol, - {arrayOk: false, editType: 'plot'}), - opacity: extendFlat({}, scatterMarkerAttrs.opacity, - {arrayOk: false, dflt: 1, editType: 'style'}), - size: extendFlat({}, scatterMarkerAttrs.size, - {arrayOk: false, editType: 'calc'}), - color: extendFlat({}, scatterMarkerAttrs.color, - {arrayOk: false, editType: 'style'}), - line: { - color: extendFlat({}, scatterMarkerLineAttrs.color, - {arrayOk: false, dflt: colorAttrs.defaultLine, editType: 'style'} - ), - width: extendFlat({}, scatterMarkerLineAttrs.width, - {arrayOk: false, dflt: 0, editType: 'style'} - ), - outliercolor: { - valType: 'color', - - editType: 'style', - - }, - outlierwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'style', - - }, - editType: 'style' - }, - editType: 'plot' - }, - line: { - color: { - valType: 'color', - - editType: 'style', - - }, - width: { - valType: 'number', - - min: 0, - dflt: 2, - editType: 'style', - - }, - editType: 'plot' - }, - fillcolor: scatterAttrs.fillcolor, + // make sure traces is an array + if(!Array.isArray(traces)) { + traces = [traces]; + } - selected: { - marker: scatterAttrs.selected.marker, - editType: 'style' - }, - unselected: { - marker: scatterAttrs.unselected.marker, - editType: 'style' - }, + // make sure each value in traces is an object + 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'); + } + } - hoveron: { - valType: 'flaglist', - flags: ['boxes', 'points'], - dflt: 'boxes+points', - - editType: 'style', - + // make sure we have an index for each trace + 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' + ); + } +} -},{"../../components/color/attributes":569,"../../lib/extend":685,"../scatter/attributes":1043}],860:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); + * A private function to reduce the type checking clutter in spliceTraces. + * Get all update Properties from gd.data. Validate inputs and outputs. + * Used by prependTrace and extendTraces + * + * @param gd + * @param update + * @param indices + * @param maxPoints + */ +function assertExtendTracesArgs(gd, update, indices, maxPoints) { -var Lib = _dereq_('../../lib'); -var _ = Lib._; -var Axes = _dereq_('../../plots/cartesian/axes'); + var maxPointsIsObject = Lib.isPlainObject(maxPoints); -// outlier definition based on http://www.physics.csbsju.edu/stats/box2.html -module.exports = function calc(gd, trace) { - var fullLayout = gd._fullLayout; - var xa = Axes.getFromId(gd, trace.xaxis || 'x'); - var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var cd = []; + if(!Array.isArray(gd.data)) { + throw new Error('gd.data must be an array'); + } + if(!Lib.isPlainObject(update)) { + throw new Error('update must be a key:value object'); + } - // N.B. violin reuses same Box.calc - var numKey = trace.type === 'violin' ? '_numViolins' : '_numBoxes'; + if(typeof indices === 'undefined') { + throw new Error('indices must be an integer or array of integers'); + } - var i; - var valAxis, valLetter; - var posAxis, posLetter; + assertIndexArray(gd, indices, 'indices'); - if(trace.orientation === 'h') { - valAxis = xa; - valLetter = 'x'; - posAxis = ya; - posLetter = 'y'; - } else { - valAxis = ya; - valLetter = 'y'; - posAxis = xa; - posLetter = 'x'; - } + for(var key in update) { - var val = valAxis.makeCalcdata(trace, valLetter); - var pos = getPos(trace, posLetter, posAxis, val, fullLayout[numKey]); + /* + * Verify that the attribute to be updated contains as many trace updates + * as indices. Failure must result in throw and no-op + */ + if(!Array.isArray(update[key]) || update[key].length !== indices.length) { + throw new Error('attribute ' + key + ' must be an array of length equal to indices array length'); + } - var dv = Lib.distinctVals(pos); - var posDistinct = dv.vals; - var dPos = dv.minDiff / 2; - var posBins = makeBins(posDistinct, dPos); - - var pLen = posDistinct.length; - var ptsPerBin = initNestedArray(pLen); - - // bin pts info per position bins - for(i = 0; i < trace._length; i++) { - var v = val[i]; - if(!isNumeric(v)) continue; - - var n = Lib.findBin(pos[i], posBins); - if(n >= 0 && n < pLen) { - var pt = {v: v, i: i}; - arraysToCalcdata(pt, trace, i); - ptsPerBin[n].push(pt); + /* + * if maxPoints is an object it must match keys and array lengths of 'update' 1:1 + */ + if(maxPointsIsObject && + (!(key in maxPoints) || !Array.isArray(maxPoints[key]) || + maxPoints[key].length !== update[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'); } } +} - // build calcdata trace items, one item per distinct position - for(i = 0; i < pLen; i++) { - if(ptsPerBin[i].length > 0) { - var pts = ptsPerBin[i].sort(sortByVal); - var boxVals = pts.map(extractVal); - var bvLen = boxVals.length; - - var cdi = { - pos: posDistinct[i], - pts: pts - }; - - cdi.min = boxVals[0]; - cdi.max = boxVals[bvLen - 1]; - cdi.mean = Lib.mean(boxVals, bvLen); - cdi.sd = Lib.stdev(boxVals, bvLen, cdi.mean); - - // first quartile - cdi.q1 = Lib.interp(boxVals, 0.25); - // median - cdi.med = Lib.interp(boxVals, 0.5); - // third quartile - cdi.q3 = Lib.interp(boxVals, 0.75); - - // lower and upper fences - last point inside - // 1.5 interquartile ranges from quartiles - cdi.lf = Math.min( - cdi.q1, - boxVals[Math.min( - Lib.findBin(2.5 * cdi.q1 - 1.5 * cdi.q3, boxVals, true) + 1, - bvLen - 1 - )] - ); - cdi.uf = Math.max( - cdi.q3, - boxVals[Math.max( - Lib.findBin(2.5 * cdi.q3 - 1.5 * cdi.q1, boxVals), - 0 - )] - ); +/** + * A private function to reduce the type checking clutter in spliceTraces. + * + * @param {Object|HTMLDivElement} gd + * @param {Object} update + * @param {Number[]} indices + * @param {Number||Object} maxPoints + * @return {Object[]} + */ +function getExtendProperties(gd, update, indices, maxPoints) { - // lower and upper outliers - 3 IQR out (don't clip to max/min, - // this is only for discriminating suspected & far outliers) - cdi.lo = 4 * cdi.q1 - 3 * cdi.q3; - cdi.uo = 4 * cdi.q3 - 3 * cdi.q1; + var maxPointsIsObject = Lib.isPlainObject(maxPoints); + var updateProps = []; + var trace, target, prop, insert, maxp; + // allow scalar index to represent a single trace position + if(!Array.isArray(indices)) indices = [indices]; - // lower and upper notches ~95% Confidence Intervals for median - var iqr = cdi.q3 - cdi.q1; - var mci = 1.57 * iqr / Math.sqrt(bvLen); - cdi.ln = cdi.med - mci; - cdi.un = cdi.med + mci; + // negative indices are wrapped around to their positive value. Equivalent to python indexing. + indices = positivifyIndices(indices, gd.data.length - 1); - cd.push(cdi); - } - } + // loop through all update keys and traces and harvest validated data. + for(var key in update) { - calcSelection(cd, trace); - var extremes = Axes.findExtremes(valAxis, val, {padded: true}); - trace._extremes[valAxis._id] = extremes; + for(var j = 0; j < indices.length; j++) { - if(cd.length > 0) { - cd[0].t = { - num: fullLayout[numKey], - dPos: dPos, - posLetter: posLetter, - valLetter: valLetter, - labels: { - med: _(gd, 'median:'), - min: _(gd, 'min:'), - q1: _(gd, 'q1:'), - q3: _(gd, 'q3:'), - max: _(gd, 'max:'), - mean: trace.boxmean === 'sd' ? _(gd, 'mean ± σ:') : _(gd, 'mean:'), - lf: _(gd, 'lower fence:'), - uf: _(gd, 'upper fence:') - } - }; + /* + * Choose the trace indexed by the indices map argument and get the prop setter-getter + * instance that references the key and value for this particular trace. + */ + trace = gd.data[indices[j]]; + prop = nestedProperty(trace, key); - fullLayout[numKey]++; - return cd; - } else { - return [{t: {empty: true}}]; - } -}; + /* + * Target is the existing gd.data.trace.dataArray value like "x" or "marker.size" + * Target must exist as an Array to allow the extend operation to be performed. + */ + target = prop.get(); + insert = update[key][j]; -// In vertical (horizontal) box plots: -// if no x (y) data, use x0 (y0), or name -// so if you want one box -// per trace, set x0 (y0) to the x (y) value or category for this trace -// (or set x (y) to a constant array matching y (x)) -function getPos(trace, posLetter, posAxis, val, num) { - if(posLetter in trace) { - return posAxis.makeCalcdata(trace, posLetter); - } - - var pos0; - - if(posLetter + '0' in trace) { - pos0 = trace[posLetter + '0']; - } else if('name' in trace && ( - posAxis.type === 'category' || ( - isNumeric(trace.name) && - ['linear', 'log'].indexOf(posAxis.type) !== -1 - ) || ( - Lib.isDateTime(trace.name) && - posAxis.type === 'date' - ) - )) { - pos0 = trace.name; - } else { - pos0 = num; - } + 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); + } - var pos0c = posAxis.d2c(pos0, 0, trace[posLetter + 'calendar']); - return val.map(function() { return pos0c; }); -} + /* + * maxPoints may be an object map or a scalar. If object select the key:value, else + * Use the scalar maxPoints for all key and trace combinations. + */ + maxp = maxPointsIsObject ? maxPoints[key][j] : maxPoints; -function makeBins(x, dx) { - var len = x.length; - var bins = new Array(len + 1); + // could have chosen null here, -1 just tells us to not take a window + if(!isNumeric(maxp)) maxp = -1; - for(var i = 0; i < len; i++) { - bins[i] = x[i] - dx; + /* + * Wrap the nestedProperty in an object containing required data + * for lengthening and windowing this particular trace - key combination. + * Flooring maxp mirrors the behaviour of floats in the Array.slice JSnative function. + */ + updateProps.push({ + prop: prop, + target: target, + insert: insert, + maxp: Math.floor(maxp) + }); + } } - bins[len] = x[len - 1] + dx; - return bins; + // all target and insertion data now validated + return updateProps; } -function initNestedArray(len) { - var arr = new Array(len); - for(var i = 0; i < len; i++) { - arr[i] = []; - } - return arr; -} +/** + * A private function to key Extend and Prepend traces DRY + * + * @param {Object|HTMLDivElement} gd + * @param {Object} update + * @param {Number[]} indices + * @param {Number||Object} maxPoints + * @param {Function} updateArray + * @return {Object} + */ +function spliceTraces(gd, update, indices, maxPoints, updateArray) { + assertExtendTracesArgs(gd, update, indices, maxPoints); -function arraysToCalcdata(pt, trace, i) { - var trace2calc = { - text: 'tx' - }; + var updateProps = getExtendProperties(gd, update, indices, maxPoints); + var undoUpdate = {}; + var undoPoints = {}; - for(var k in trace2calc) { - if(Array.isArray(trace[k])) { - pt[trace2calc[k]] = trace[k][i]; - } - } -} + for(var i = 0; i < updateProps.length; i++) { + var prop = updateProps[i].prop; + var maxp = updateProps[i].maxp; -function calcSelection(cd, trace) { - if(Lib.isArrayOrTypedArray(trace.selectedpoints)) { - for(var i = 0; i < cd.length; i++) { - var pts = cd[i].pts || []; - var ptNumber2cdIndex = {}; + // return new array and remainder + var out = updateArray(updateProps[i].target, updateProps[i].insert, maxp); + prop.set(out[0]); - for(var j = 0; j < pts.length; j++) { - ptNumber2cdIndex[pts[j].i] = j; - } + // build the inverse update object for the undo operation + if(!Array.isArray(undoUpdate[prop.astr])) undoUpdate[prop.astr] = []; + undoUpdate[prop.astr].push(out[1]); - Lib.tagSelected(pts, trace, ptNumber2cdIndex); - } + // build the matching maxPoints undo object containing original trace lengths + if(!Array.isArray(undoPoints[prop.astr])) undoPoints[prop.astr] = []; + undoPoints[prop.astr].push(updateProps[i].target.length); } -} -function sortByVal(a, b) { return a.v - b.v; } + return {update: undoUpdate, maxPoints: undoPoints}; +} -function extractVal(o) { return o.v; } +function concatTypedArray(arr0, arr1) { + var arr2 = new arr0.constructor(arr0.length + arr1.length); + arr2.set(arr0); + arr2.set(arr1, arr0.length); + return arr2; +} -},{"../../lib":696,"../../plots/cartesian/axes":744,"fast-isnumeric":214}],861:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Axes = _dereq_('../../plots/cartesian/axes'); -var Lib = _dereq_('../../lib'); + * extend && prepend traces at indices with update arrays, window trace lengths to maxPoints + * + * Extend and Prepend have identical APIs. Prepend inserts an array at the head while Extend + * inserts an array off the tail. Prepend truncates the tail of the array - counting maxPoints + * from the head, whereas Extend truncates the head of the array, counting backward maxPoints + * from the tail. + * + * If maxPoints is undefined, nonNumeric, negative or greater than extended trace length no + * truncation / windowing will be performed. If its zero, well the whole trace is truncated. + * + * @param {Object|HTMLDivElement} gd The graph div + * @param {Object} update The key:array map of target attributes to extend + * @param {Number|Number[]} indices The locations of traces to be extended + * @param {Number|Object} [maxPoints] Number of points for trace window after lengthening. + * + */ +exports.extendTraces = function extendTraces(gd, update, indices, maxPoints) { + gd = Lib.getGraphDiv(gd); -var orientations = ['v', 'h']; + function updateArray(target, insert, maxp) { + var newArray, remainder; -function crossTraceCalc(gd, plotinfo) { - var calcdata = gd.calcdata; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(Lib.isTypedArray(target)) { + if(maxp < 0) { + var none = new target.constructor(0); + var both = concatTypedArray(target, insert); - for(var i = 0; i < orientations.length; i++) { - var orientation = orientations[i]; - var posAxis = orientation === 'h' ? ya : xa; - var boxList = []; - var minPad = 0; - var maxPad = 0; + 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); - // make list of boxes / candlesticks - // For backward compatibility, candlesticks are treated as if they *are* box traces here - for(var j = 0; j < calcdata.length; j++) { - var cd = calcdata[j]; - var t = cd[0].t; - var trace = cd[0].trace; + if(maxp === insert.length) { + newArray.set(insert); + remainder.set(target); + } else if(maxp < insert.length) { + var numberOfItemsFromInsert = insert.length - maxp; - if(trace.visible === true && - (trace.type === 'box' || trace.type === 'candlestick') && - !t.empty && - (trace.orientation || 'v') === orientation && - trace.xaxis === xa._id && - trace.yaxis === ya._id - ) { - boxList.push(j); + 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; - if(trace.boxpoints) { - minPad = Math.max(minPad, trace.jitter - trace.pointpos - 1); - maxPad = Math.max(maxPad, trace.jitter + trace.pointpos - 1); + 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) : + []; } - setPositionOffset('box', gd, boxList, posAxis, [minPad, maxPad]); + return [newArray, remainder]; } -} - -function setPositionOffset(traceType, gd, boxList, posAxis, pad) { - var calcdata = gd.calcdata; - var fullLayout = gd._fullLayout; - var pointList = []; - // N.B. reused in violin - var numKey = traceType === 'violin' ? '_numViolins' : '_numBoxes'; + var undo = spliceTraces(gd, update, indices, maxPoints, updateArray); + var promise = exports.redraw(gd); + var undoArgs = [gd, undo.update, indices, undo.maxPoints]; + Queue.add(gd, exports.prependTraces, undoArgs, extendTraces, arguments); - var i, j, calcTrace; + return promise; +}; - // make list of box points - for(i = 0; i < boxList.length; i++) { - calcTrace = calcdata[boxList[i]]; - for(j = 0; j < calcTrace.length; j++) { - pointList.push(calcTrace[j].pos); - } - } +exports.prependTraces = function prependTraces(gd, update, indices, maxPoints) { + gd = Lib.getGraphDiv(gd); - if(!pointList.length) return; + function updateArray(target, insert, maxp) { + var newArray, remainder; - // box plots - update dPos based on multiple traces - // and then use for posAxis autorange - var boxdv = Lib.distinctVals(pointList); - var dPos = boxdv.minDiff / 2; + if(Lib.isTypedArray(target)) { + if(maxp <= 0) { + var none = new target.constructor(0); + var both = concatTypedArray(insert, target); - // if there's no duplication of x points, - // disable 'group' mode by setting counter to 1 - if(pointList.length === boxdv.vals.length) { - fullLayout[numKey] = 1; - } + 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); - // check for forced minimum dtick - Axes.minDtick(posAxis, boxdv.minDiff, boxdv.vals[0], true); + if(maxp === insert.length) { + newArray.set(insert); + remainder.set(target); + } else if(maxp < insert.length) { + var numberOfItemsFromInsert = insert.length - maxp; - var gap = fullLayout[traceType + 'gap']; - var groupgap = fullLayout[traceType + 'groupgap']; - var padfactor = (1 - gap) * (1 - groupgap) * dPos / fullLayout[numKey]; + newArray.set(insert.subarray(0, numberOfItemsFromInsert)); + remainder.set(insert.subarray(numberOfItemsFromInsert)); + remainder.set(target, numberOfItemsFromInsert); + } else { + var numberOfItemsFromTarget = maxp - insert.length; - // autoscale the x axis - including space for points if they're off the side - // TODO: this will overdo it if the outermost boxes don't have - // their points as far out as the other boxes - var extremes = Axes.findExtremes(posAxis, boxdv.vals, { - vpadminus: dPos + pad[0] * padfactor, - vpadplus: dPos + pad[1] * padfactor - }); + 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) : + []; + } - for(i = 0; i < boxList.length; i++) { - calcTrace = calcdata[boxList[i]]; - // set the width of all boxes - calcTrace[0].t.dPos = dPos; - // link extremes to all boxes - calcTrace[0].trace._extremes[posAxis._id] = extremes; + return [newArray, remainder]; } -} + var undo = spliceTraces(gd, update, indices, maxPoints, updateArray); + var promise = exports.redraw(gd); + var undoArgs = [gd, undo.update, indices, undo.maxPoints]; + Queue.add(gd, exports.extendTraces, undoArgs, prependTraces, arguments); -module.exports = { - crossTraceCalc: crossTraceCalc, - setPositionOffset: setPositionOffset + return promise; }; -},{"../../lib":696,"../../plots/cartesian/axes":744}],862:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + * Add data traces to an existing graph div. + * + * @param {Object|HTMLDivElement} gd The graph div + * @param {Object[]} gd.data The array of traces we're adding to + * @param {Object[]|Object} traces The object or array of objects to add + * @param {Number[]|Number} [newIndices=[gd.data.length]] Locations to add traces + * + */ +exports.addTraces = function addTraces(gd, traces, newIndices) { + gd = Lib.getGraphDiv(gd); -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); -var Color = _dereq_('../../components/color'); + var currentIndices = []; + var undoFunc = exports.deleteTraces; + var redoFunc = addTraces; + var undoArgs = [gd, currentIndices]; + var redoArgs = [gd, traces]; // no newIndices here + var i; + var promise; -var attributes = _dereq_('./attributes'); + // all validation is done elsewhere to remove clutter here + checkAddTracesArgs(gd, traces, newIndices); -function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + // make sure traces is an array + if(!Array.isArray(traces)) { + traces = [traces]; } - handleSampleDefaults(traceIn, traceOut, coerce, layout); - if(traceOut.visible === false) return; - - coerce('line.color', (traceIn.marker || {}).color || defaultColor); - coerce('line.width'); - coerce('fillcolor', Color.addOpacity(traceOut.line.color, 0.5)); - - coerce('whiskerwidth'); - coerce('boxmean'); - - var notched = coerce('notched', traceIn.notchwidth !== undefined); - if(notched) coerce('notchwidth'); - - handlePointsDefaults(traceIn, traceOut, coerce, {prefix: 'box'}); -} - -function handleSampleDefaults(traceIn, traceOut, coerce, layout) { - var y = coerce('y'); - var x = coerce('x'); - var hasX = x && x.length; + // make sure traces do not repeat existing ones + traces = traces.map(function(trace) { + return Lib.extendFlat({}, trace); + }); - var defaultOrientation, len; + helpers.cleanData(traces); - if(y && y.length) { - defaultOrientation = 'v'; - if(hasX) { - len = Math.min(x.length, y.length); - } - else { - coerce('x0'); - len = y.length; - } - } else if(hasX) { - defaultOrientation = 'h'; - coerce('y0'); - len = x.length; - } else { - traceOut.visible = false; - return; + // add the traces to gd.data (no redrawing yet!) + for(i = 0; i < traces.length; i++) { + gd.data.push(traces[i]); } - traceOut._length = len; - - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); - coerce('orientation', defaultOrientation); -} - -function handlePointsDefaults(traceIn, traceOut, coerce, opts) { - var prefix = opts.prefix; - - var outlierColorDflt = Lib.coerce2(traceIn, traceOut, attributes, 'marker.outliercolor'); - var lineoutliercolor = coerce('marker.line.outliercolor'); + // to continue, we need to call moveTraces which requires currentIndices + for(i = 0; i < traces.length; i++) { + currentIndices.push(-traces.length + i); + } - var points = coerce( - prefix + 'points', - (outlierColorDflt || lineoutliercolor) ? 'suspectedoutliers' : undefined - ); + // if the user didn't define newIndices, they just want the traces appended + // i.e., we can simply redraw and be done + if(typeof newIndices === 'undefined') { + promise = exports.redraw(gd); + Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); + return promise; + } - if(points) { - coerce('jitter', points === 'all' ? 0.3 : 0); - coerce('pointpos', points === 'all' ? -1.5 : 0); - - coerce('marker.symbol'); - coerce('marker.opacity'); - coerce('marker.size'); - coerce('marker.color', traceOut.line.color); - coerce('marker.line.color'); - coerce('marker.line.width'); - - if(points === 'suspectedoutliers') { - coerce('marker.line.outliercolor', traceOut.marker.color); - coerce('marker.line.outlierwidth'); - } + // make sure indices is property defined + if(!Array.isArray(newIndices)) { + newIndices = [newIndices]; + } - coerce('selected.marker.color'); - coerce('unselected.marker.color'); - coerce('selected.marker.size'); - coerce('unselected.marker.size'); + try { - coerce('text'); - } else { - delete traceOut.marker; + // this is redundant, but necessary to not catch later possible errors! + checkMoveTracesArgs(gd, currentIndices, newIndices); } + catch(error) { - coerce('hoveron'); - - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -} + // something went wrong, reset gd to be safe and rethrow error + gd.data.splice(gd.data.length - traces.length, traces.length); + throw error; + } -module.exports = { - supplyDefaults: supplyDefaults, - handleSampleDefaults: handleSampleDefaults, - handlePointsDefaults: handlePointsDefaults + // if we're here, the user has defined specific places to place the new traces + // this requires some extra work that moveTraces will do + Queue.startSequence(gd); + Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); + promise = exports.moveTraces(gd, currentIndices, newIndices); + Queue.stopSequence(gd); + return promise; }; -},{"../../components/color":570,"../../lib":696,"../../registry":827,"./attributes":859}],863:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Delete traces at `indices` from gd.data array. + * + * @param {Object|HTMLDivElement} gd The graph div + * @param {Object[]} gd.data The array of traces we're removing from + * @param {Number|Number[]} indices The indices + */ +exports.deleteTraces = function deleteTraces(gd, indices) { + gd = Lib.getGraphDiv(gd); -'use strict'; + var traces = []; + var undoFunc = exports.addTraces; + var redoFunc = deleteTraces; + var undoArgs = [gd, traces, indices]; + var redoArgs = [gd, indices]; + var i; + var deletedTrace; + + // make sure indices are defined + if(typeof indices === 'undefined') { + throw new Error('indices must be an integer or array of integers.'); + } else if(!Array.isArray(indices)) { + indices = [indices]; + } + assertIndexArray(gd, indices, 'indices'); -module.exports = function eventData(out, pt) { + // convert negative indices to positive indices + indices = positivifyIndices(indices, gd.data.length - 1); - // Note: hoverOnBox property is needed for click-to-select - // to ignore when a box was clicked. This is the reason box - // implements this custom eventData function. - if(pt.hoverOnBox) out.hoverOnBox = pt.hoverOnBox; + // we want descending here so that splicing later doesn't affect indexing + indices.sort(Lib.sorterDes); + for(i = 0; i < indices.length; i += 1) { + deletedTrace = gd.data.splice(indices[i], 1)[0]; + traces.push(deletedTrace); + } - if('xVal' in pt) out.x = pt.xVal; - if('yVal' in pt) out.y = pt.yVal; - if(pt.xa) out.xaxis = pt.xa; - if(pt.ya) out.yaxis = pt.ya; + var promise = exports.redraw(gd); + Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - return out; + return promise; }; -},{}],864:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + * Move traces at currentIndices array to locations in newIndices array. + * + * If newIndices is omitted, currentIndices will be moved to the end. E.g., + * these are equivalent: + * + * Plotly.moveTraces(gd, [1, 2, 3], [-3, -2, -1]) + * Plotly.moveTraces(gd, [1, 2, 3]) + * + * @param {Object|HTMLDivElement} gd The graph div + * @param {Object[]} gd.data The array of traces we're removing from + * @param {Number|Number[]} currentIndices The locations of traces to be moved + * @param {Number|Number[]} [newIndices] The locations to move traces to + * + * Example calls: + * + * // move trace i to location x + * Plotly.moveTraces(gd, i, x) + * + * // move trace i to end of array + * Plotly.moveTraces(gd, i) + * + * // move traces i, j, k to end of array (i != j != k) + * Plotly.moveTraces(gd, [i, j, k]) + * + * // move traces [i, j, k] to [x, y, z] (i != j != k) (x != y != z) + * Plotly.moveTraces(gd, [i, j, k], [x, y, z]) + * + * // reorder all traces (assume there are 5--a, b, c, d, e) + * Plotly.moveTraces(gd, [b, d, e, a, c]) // same as 'move to end' + */ +exports.moveTraces = function moveTraces(gd, currentIndices, newIndices) { + gd = Lib.getGraphDiv(gd); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Lib = _dereq_('../../lib'); -var Fx = _dereq_('../../components/fx'); -var Color = _dereq_('../../components/color'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); + var newData = []; + var movingTraceMap = []; + var undoFunc = moveTraces; + var redoFunc = moveTraces; + var undoArgs = [gd, newIndices, currentIndices]; + var redoArgs = [gd, currentIndices, newIndices]; + var i; -function hoverPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var trace = cd[0].trace; - var hoveron = trace.hoveron; - var closeBoxData = []; - var closePtData; + // to reduce complexity here, check args elsewhere + // this throws errors where appropriate + checkMoveTracesArgs(gd, currentIndices, newIndices); - if(hoveron.indexOf('boxes') !== -1) { - closeBoxData = closeBoxData.concat(hoverOnBoxes(pointData, xval, yval, hovermode)); - } + // make sure currentIndices is an array + currentIndices = Array.isArray(currentIndices) ? currentIndices : [currentIndices]; - if(hoveron.indexOf('points') !== -1) { - closePtData = hoverOnPoints(pointData, xval, yval); + // if undefined, define newIndices to point to the end of gd.data array + if(typeof newIndices === 'undefined') { + newIndices = []; + for(i = 0; i < currentIndices.length; i++) { + newIndices.push(-currentIndices.length + i); + } } - // If there's a point in range and hoveron has points, show the best single point only. - // If hoveron has boxes and there's no point in range (or hoveron doesn't have points), show the box stats. - if(hovermode === 'closest') { - if(closePtData) return [closePtData]; - return closeBoxData; - } + // make sure newIndices is an array if it's user-defined + newIndices = Array.isArray(newIndices) ? newIndices : [newIndices]; - // Otherwise in compare mode, allow a point AND the box stats to be labeled - // If there are multiple boxes in range (ie boxmode = 'overlay') we'll see stats for all of them. - if(closePtData) { - closeBoxData.push(closePtData); - return closeBoxData; - } - return closeBoxData; -} + // convert negative indices to positive indices (they're the same length) + currentIndices = positivifyIndices(currentIndices, gd.data.length - 1); + newIndices = positivifyIndices(newIndices, gd.data.length - 1); -function hoverOnBoxes(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var xa = pointData.xa; - var ya = pointData.ya; - var trace = cd[0].trace; - var t = cd[0].t; - var isViolin = trace.type === 'violin'; - var closeBoxData = []; + // at this point, we've coerced the index arrays into predictable forms - var pLetter, vLetter, pAxis, vAxis, vVal, pVal, dx, dy, dPos, - hoverPseudoDistance, spikePseudoDistance; + // get the traces that aren't being moved around + for(i = 0; i < gd.data.length; i++) { - var boxDelta = t.bdPos; - var posAcceptance = t.wHover; - var shiftPos = function(di) { return di.pos + t.bPos - pVal; }; - - if(isViolin && trace.side !== 'both') { - if(trace.side === 'positive') { - dPos = function(di) { - var pos = shiftPos(di); - return Fx.inbox(pos, pos + posAcceptance, hoverPseudoDistance); - }; - } - if(trace.side === 'negative') { - dPos = function(di) { - var pos = shiftPos(di); - return Fx.inbox(pos - posAcceptance, pos, hoverPseudoDistance); - }; + // if index isn't in currentIndices, include it in ignored! + if(currentIndices.indexOf(i) === -1) { + newData.push(gd.data[i]); } - } else { - dPos = function(di) { - var pos = shiftPos(di); - return Fx.inbox(pos - posAcceptance, pos + posAcceptance, hoverPseudoDistance); - }; - } - - var dVal; - - if(isViolin) { - dVal = function(di) { - return Fx.inbox(di.span[0] - vVal, di.span[1] - vVal, hoverPseudoDistance); - }; - } else { - dVal = function(di) { - return Fx.inbox(di.min - vVal, di.max - vVal, hoverPseudoDistance); - }; } - if(trace.orientation === 'h') { - vVal = xval; - pVal = yval; - dx = dVal; - dy = dPos; - pLetter = 'y'; - pAxis = ya; - vLetter = 'x'; - vAxis = xa; - } else { - vVal = yval; - pVal = xval; - dx = dPos; - dy = dVal; - pLetter = 'x'; - pAxis = xa; - vLetter = 'y'; - vAxis = ya; + // get a mapping of indices to moving traces + for(i = 0; i < currentIndices.length; i++) { + movingTraceMap.push({newIndex: newIndices[i], trace: gd.data[currentIndices[i]]}); } - // if two boxes are overlaying, let the narrowest one win - var pseudoDistance = Math.min(1, boxDelta / Math.abs(pAxis.r2c(pAxis.range[1]) - pAxis.r2c(pAxis.range[0]))); - hoverPseudoDistance = pointData.maxHoverDistance - pseudoDistance; - spikePseudoDistance = pointData.maxSpikeDistance - pseudoDistance; - - function dxy(di) { return (dx(di) + dy(di)) / 2; } - var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); - Fx.getClosest(cd, distfn, pointData); - - // skip the rest (for this trace) if we didn't find a close point - // and create the item(s) in closedata for this point - if(pointData.index === false) return []; - - var di = cd[pointData.index]; - var lc = trace.line.color; - var mc = (trace.marker || {}).color; + // reorder this mapping by newIndex, ascending + movingTraceMap.sort(function(a, b) { + return a.newIndex - b.newIndex; + }); - if(Color.opacity(lc) && trace.line.width) pointData.color = lc; - else if(Color.opacity(mc) && trace.boxpoints) pointData.color = mc; - else pointData.color = trace.fillcolor; + // now, add the moving traces back in, in order! + for(i = 0; i < movingTraceMap.length; i += 1) { + newData.splice(movingTraceMap[i].newIndex, 0, movingTraceMap[i].trace); + } - pointData[pLetter + '0'] = pAxis.c2p(di.pos + t.bPos - boxDelta, true); - pointData[pLetter + '1'] = pAxis.c2p(di.pos + t.bPos + boxDelta, true); + gd.data = newData; - pointData[pLetter + 'LabelVal'] = di.pos; + var promise = exports.redraw(gd); + Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - var spikePosAttr = pLetter + 'Spike'; - pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; - pointData[spikePosAttr] = pAxis.c2p(di.pos, true); + return promise; +}; - // box plots: each "point" gets many labels - var usedVals = {}; - var attrs = ['med', 'min', 'q1', 'q3', 'max']; +/** + * restyle: update trace attributes of an existing plot + * + * Can be called two ways. + * + * Signature 1: + * @param {String | HTMLDivElement} gd + * the id or DOM element of the graph container div + * @param {String} astr + * attribute string (like `'marker.symbol'`) to update + * @param {*} val + * value to give this attribute + * @param {Number[] | Number} [traces] + * integer or array of integers for the traces to alter (all if omitted) + * + * Signature 2: + * @param {String | HTMLDivElement} gd + * (as in signature 1) + * @param {Object} aobj + * attribute object `{astr1: val1, astr2: val2 ...}` + * allows setting multiple attributes simultaneously + * @param {Number[] | Number} [traces] + * (as in signature 1) + * + * `val` (or `val1`, `val2` ... in the object form) can be an array, + * to apply different values to each trace. + * + * If the array is too short, it will wrap around (useful for + * style files that want to specify cyclical default values). + */ +function restyle(gd, astr, val, _traces) { + gd = Lib.getGraphDiv(gd); + helpers.clearPromiseQueue(gd); - if(trace.boxmean || (trace.meanline || {}).visible) { - attrs.push('mean'); + var aobj = {}; + if(typeof astr === 'string') aobj[astr] = val; + else if(Lib.isPlainObject(astr)) { + // the 3-arg form + aobj = Lib.extendFlat({}, astr); + if(_traces === undefined) _traces = val; } - if(trace.boxpoints || trace.points) { - attrs.push('lf', 'uf'); + else { + Lib.warn('Restyle fail.', astr, val, _traces); + return Promise.reject(); } - for(var i = 0; i < attrs.length; i++) { - var attr = attrs[i]; - - if(!(attr in di) || (di[attr] in usedVals)) continue; - usedVals[di[attr]] = true; - - // copy out to a new object for each value to label - var val = di[attr]; - var valPx = vAxis.c2p(val, true); - var pointData2 = Lib.extendFlat({}, pointData); - - pointData2[vLetter + '0'] = pointData2[vLetter + '1'] = valPx; - pointData2[vLetter + 'LabelVal'] = val; - pointData2[vLetter + 'Label'] = (t.labels ? t.labels[attr] + ' ' : '') + Axes.hoverLabelText(vAxis, val); + if(Object.keys(aobj).length) gd.changed = true; - // Note: introduced to be able to distinguish a - // clicked point from a box during click-to-select - pointData2.hoverOnBox = true; + var traces = helpers.coerceTraceIndices(gd, _traces); - if(attr === 'mean' && ('sd' in di) && trace.boxmean === 'sd') { - pointData2[vLetter + 'err'] = di.sd; - } - // only keep name and spikes on the first item (median) - pointData.name = ''; - pointData.spikeDistance = undefined; - pointData[spikePosAttr] = undefined; + var specs = _restyle(gd, aobj, traces); + var flags = specs.flags; - closeBoxData.push(pointData2); - } + // clear calcdata and/or axis types if required so they get regenerated + if(flags.calc) gd.calcdata = undefined; + if(flags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, {}); - return closeBoxData; -} + // fill in redraw sequence + var seq = []; -function hoverOnPoints(pointData, xval, yval) { - var cd = pointData.cd; - var xa = pointData.xa; - var ya = pointData.ya; - var trace = cd[0].trace; - var xPx = xa.c2p(xval); - var yPx = ya.c2p(yval); - var closePtData; + if(flags.fullReplot) { + seq.push(exports.plot); + } else { + seq.push(Plots.previousPromises); - var dx = function(di) { - var rad = Math.max(3, di.mrc || 0); - return Math.max(Math.abs(xa.c2p(di.x) - xPx) - rad, 1 - 3 / rad); - }; - var dy = function(di) { - var rad = Math.max(3, di.mrc || 0); - return Math.max(Math.abs(ya.c2p(di.y) - yPx) - rad, 1 - 3 / rad); - }; - var distfn = Fx.quadrature(dx, dy); + // maybe only call Plots.supplyDataDefaults in the splom case, + // to skip over long and slow axes defaults + Plots.supplyDefaults(gd); - // show one point per trace - var ijClosest = false; - var di, pt; + if(flags.markerSize) { + Plots.doCalcdata(gd); + addAxRangeSequence(seq); - for(var i = 0; i < cd.length; i++) { - di = cd[i]; + // TODO + // if all axes have autorange:false, then + // proceed to subroutines.doTraceStyle(), + // otherwise we must go through addAxRangeSequence, + // which in general must redraws 'all' axes + } - for(var j = 0; j < (di.pts || []).length; j++) { - pt = di.pts[j]; + if(flags.style) seq.push(subroutines.doTraceStyle); + if(flags.colorbars) seq.push(subroutines.doColorBars); - var newDistance = distfn(pt); - if(newDistance <= pointData.distance) { - pointData.distance = newDistance; - ijClosest = [i, j]; - } - } + seq.push(emitAfterPlot); } - if(!ijClosest) return false; + seq.push(Plots.rehover); - di = cd[ijClosest[0]]; - pt = di.pts[ijClosest[1]]; + Queue.add(gd, + restyle, [gd, specs.undoit, specs.traces], + restyle, [gd, specs.redoit, specs.traces] + ); - var xc = xa.c2p(pt.x, true); - var yc = ya.c2p(pt.y, true); - var rad = pt.mrc || 1; + var plotDone = Lib.syncOrAsync(seq, gd); + if(!plotDone || !plotDone.then) plotDone = Promise.resolve(); - closePtData = Lib.extendFlat({}, pointData, { - // corresponds to index in x/y input data array - index: pt.i, - color: (trace.marker || {}).color, - name: trace.name, - x0: xc - rad, - x1: xc + rad, - xLabelVal: pt.x, - y0: yc - rad, - y1: yc + rad, - yLabelVal: pt.y, - spikeDistance: pointData.distance + return plotDone.then(function() { + gd.emit('plotly_restyle', specs.eventData); + return gd; }); - var pLetter = trace.orientation === 'h' ? 'y' : 'x'; - var pa = trace.orientation === 'h' ? ya : xa; - closePtData[pLetter + 'Spike'] = pa.c2p(di.pos, true); - fillHoverText(pt, trace, closePtData); - - return closePtData; } +exports.restyle = restyle; -module.exports = { - hoverPoints: hoverPoints, - hoverOnBoxes: hoverOnBoxes, - hoverOnPoints: hoverOnPoints -}; - -},{"../../components/color":570,"../../components/fx":612,"../../lib":696,"../../plots/cartesian/axes":744,"../scatter/fill_hover_text":1051}],865:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Box = {}; - -Box.attributes = _dereq_('./attributes'); -Box.layoutAttributes = _dereq_('./layout_attributes'); -Box.supplyDefaults = _dereq_('./defaults').supplyDefaults; -Box.supplyLayoutDefaults = _dereq_('./layout_defaults').supplyLayoutDefaults; -Box.calc = _dereq_('./calc'); -Box.crossTraceCalc = _dereq_('./cross_trace_calc').crossTraceCalc; -Box.plot = _dereq_('./plot').plot; -Box.style = _dereq_('./style').style; -Box.styleOnSelect = _dereq_('./style').styleOnSelect; -Box.hoverPoints = _dereq_('./hover').hoverPoints; -Box.eventData = _dereq_('./event_data'); -Box.selectPoints = _dereq_('./select'); - -Box.moduleType = 'trace'; -Box.name = 'box'; -Box.basePlotModule = _dereq_('../../plots/cartesian'); -Box.categories = ['cartesian', 'svg', 'symbols', 'oriented', 'box-violin', 'showLegend', 'boxLayout', 'zoomScale']; -Box.meta = { - -}; - -module.exports = Box; +// for undo: undefined initial vals must be turned into nulls +// so that we unset rather than ignore them +function undefinedToNull(val) { + if(val === undefined) return null; + return val; +} -},{"../../plots/cartesian":756,"./attributes":859,"./calc":860,"./cross_trace_calc":861,"./defaults":862,"./event_data":863,"./hover":864,"./layout_attributes":866,"./layout_defaults":867,"./plot":868,"./select":869,"./style":870}],866:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + * Factory function to wrap nestedProperty with GUI edits if necessary + * with GUI edits we add an optional prefix to the nestedProperty constructor + * to prepend to the attribute string in the preGUI store. + */ +function makeNP(preGUI, guiEditFlag) { + if(!guiEditFlag) return nestedProperty; + return function(container, attr, prefix) { + var np = nestedProperty(container, attr); + var npSet = np.set; + np.set = function(val) { + var fullAttr = (prefix || '') + attr; + storeCurrent(fullAttr, np.get(), val, preGUI); + npSet(val); + }; + return np; + }; +} -module.exports = { - boxmode: { - valType: 'enumerated', - values: ['group', 'overlay'], - dflt: 'overlay', - - editType: 'calc', - - }, - boxgap: { - valType: 'number', - min: 0, - max: 1, - dflt: 0.3, - - editType: 'calc', - - }, - boxgroupgap: { - valType: 'number', - min: 0, - max: 1, - dflt: 0.3, - - editType: 'calc', - +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); + } } -}; - -},{}],867:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var layoutAttributes = _dereq_('./layout_attributes'); - -function _supply(layoutIn, layoutOut, fullData, coerce, traceType) { - var hasTraceType; - var category = traceType + 'Layout'; - for(var i = 0; i < fullData.length; i++) { - if(Registry.traceIs(fullData[i], category)) { - hasTraceType = true; - break; + 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); } } - if(!hasTraceType) return; - - coerce(traceType + 'mode'); - coerce(traceType + 'gap'); - coerce(traceType + 'groupgap'); -} - -function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); + else if(preGUI[attr] === undefined) { + preGUI[attr] = undefinedToNull(val); } - _supply(layoutIn, layoutOut, fullData, coerce, 'box'); } -module.exports = { - supplyLayoutDefaults: supplyLayoutDefaults, - _supply: _supply +/** + * storeDirectGUIEdit: for routines that skip restyle/relayout and mock it + * by emitting a plotly_restyle or plotly_relayout event, this routine + * keeps track of the initial state in _preGUI for use by uirevision + * Does *not* apply these changes to data/layout - that's the responsibility + * of the calling routine. + * + * @param {object} container: the input attributes container (eg `layout` or a `trace`) + * @param {object} preGUI: where original values should be stored, either + * `layout._preGUI` or `layout._tracePreGUI[uid]` + * @param {object} edits: the {attr: val} object as normally passed to `relayout` etc + */ +exports._storeDirectGUIEdit = function(container, preGUI, edits) { + for(var attr in edits) { + var np = nestedProperty(container, attr); + storeCurrent(attr, np.get(), edits[attr], preGUI); + } }; -},{"../../lib":696,"../../registry":827,"./layout_attributes":866}],868:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function _restyle(gd, aobj, traces) { + var fullLayout = gd._fullLayout; + var fullData = gd._fullData; + var data = gd.data; + var guiEditFlag = fullLayout._guiEditing; + var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag); + var eventData = Lib.extendDeepAll({}, aobj); + var i; -'use strict'; + cleanDeprecatedAttributeKeys(aobj); -var d3 = _dereq_('d3'); + // initialize flags + var flags = editTypes.traceFlags(); -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../../components/drawing'); + // copies of the change (and previous values of anything affected) + // for the undo / redo queue + var redoit = {}; + var undoit = {}; + var axlist; -// constants for dynamic jitter (ie less jitter for sparser points) -var JITTERCOUNT = 5; // points either side of this to include -var JITTERSPREAD = 0.01; // fraction of IQR to count as "dense" + // make a new empty vals array for undoit + function a0() { return traces.map(function() { return undefined; }); } -function plot(gd, plotinfo, cdbox, boxLayer) { - var fullLayout = gd._fullLayout; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - var numBoxes = fullLayout._numBoxes; - var groupFraction = (1 - fullLayout.boxgap); - var group = (fullLayout.boxmode === 'group' && numBoxes > 1); + // for autoranging multiple axes + function addToAxlist(axid) { + var axName = Axes.id2name(axid); + if(axlist.indexOf(axName) === -1) axlist.push(axName); + } - Lib.makeTraceGroups(boxLayer, cdbox, 'trace boxes').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var t = cd0.t; - var trace = cd0.trace; - if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; - // box half width - var bdPos = t.dPos * groupFraction * (1 - fullLayout.boxgroupgap) / (group ? numBoxes : 1); - // box center offset - var bPos = group ? 2 * t.dPos * (-0.5 + (t.num + 0.5) / numBoxes) * groupFraction : 0; - // whisker width - var wdPos = bdPos * trace.whiskerwidth; + function autorangeAttr(axName) { return 'LAYOUT' + axName + '.autorange'; } - if(trace.visible !== true || t.empty) { - plotGroup.remove(); - return; + function rangeAttr(axName) { return 'LAYOUT' + axName + '.range'; } + + function getFullTrace(traceIndex) { + // usually fullData maps 1:1 onto data, but with groupby transforms + // the fullData index can be greater. Take the *first* matching trace. + for(var j = traceIndex; j < fullData.length; j++) { + if(fullData[j]._input === data[traceIndex]) return fullData[j]; } + // should never get here - and if we *do* it should cause an error + // later on undefined fullTrace is passed to nestedProperty. + } - var posAxis, valAxis; + // for attrs that interact (like scales & autoscales), save the + // old vals before making the change + // val=undefined will not set a value, just record what the value was. + // val=null will delete the attribute + // attr can be an array to set several at once (all to the same val) + function doextra(attr, val, i) { + if(Array.isArray(attr)) { + attr.forEach(function(a) { doextra(a, val, i); }); + return; + } + // quit if explicitly setting this elsewhere + if(attr in aobj || helpers.hasParent(aobj, attr)) return; - if(trace.orientation === 'h') { - posAxis = ya; - valAxis = xa; + var extraparam; + if(attr.substr(0, 6) === 'LAYOUT') { + extraparam = layoutNP(gd.layout, attr.replace('LAYOUT', '')); } else { - posAxis = xa; - valAxis = ya; + var tracei = traces[i]; + var preGUI = fullLayout._tracePreGUI[getFullTrace(tracei)._fullInput.uid]; + extraparam = makeNP(preGUI, guiEditFlag)(data[tracei], attr); } - // save the box size and box position for use by hover - t.bPos = bPos; - t.bdPos = bdPos; - t.wdPos = wdPos; - // half-width within which to accept hover for this box - // always split the distance to the closest box - t.wHover = t.dPos * (group ? groupFraction / numBoxes : 1); - - plotBoxAndWhiskers(plotGroup, {pos: posAxis, val: valAxis}, trace, t); - plotPoints(plotGroup, {x: xa, y: ya}, trace, t); - plotBoxMean(plotGroup, {pos: posAxis, val: valAxis}, trace, t); - }); -} - -function plotBoxAndWhiskers(sel, axes, trace, t) { - var posAxis = axes.pos; - var valAxis = axes.val; - var bPos = t.bPos; - var wdPos = t.wdPos || 0; - var bPosPxOffset = t.bPosPxOffset || 0; - var whiskerWidth = trace.whiskerwidth || 0; - var notched = trace.notched || false; - var nw = notched ? 1 - 2 * trace.notchwidth : 1; - - // to support for one-sided box - var bdPos0; - var bdPos1; - if(Array.isArray(t.bdPos)) { - bdPos0 = t.bdPos[0]; - bdPos1 = t.bdPos[1]; - } else { - bdPos0 = t.bdPos; - bdPos1 = t.bdPos; + if(!(attr in undoit)) { + undoit[attr] = a0(); + } + if(undoit[attr][i] === undefined) { + undoit[attr][i] = undefinedToNull(extraparam.get()); + } + if(val !== undefined) { + extraparam.set(val); + } } - var paths = sel.selectAll('path.box').data(( - trace.type !== 'violin' || - trace.box.visible - ) ? Lib.identity : []); + function allBins(binAttr) { + return function(j) { + return fullData[j][binAttr]; + }; + } - paths.enter().append('path') - .style('vector-effect', 'non-scaling-stroke') - .attr('class', 'box'); + function arrayBins(binAttr) { + return function(vij, j) { + return vij === false ? fullData[traces[j]][binAttr] : null; + }; + } - paths.exit().remove(); + // now make the changes to gd.data (and occasionally gd.layout) + // and figure out what kind of graphics update we need to do + for(var ai in aobj) { + if(helpers.hasParent(aobj, ai)) { + throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously'); + } - paths.each(function(d) { - var pos = d.pos; - var posc = posAxis.c2p(pos + bPos, true) + bPosPxOffset; - var pos0 = posAxis.c2p(pos + bPos - bdPos0, true) + bPosPxOffset; - var pos1 = posAxis.c2p(pos + bPos + bdPos1, true) + bPosPxOffset; - var posw0 = posAxis.c2p(pos + bPos - wdPos, true) + bPosPxOffset; - var posw1 = posAxis.c2p(pos + bPos + wdPos, true) + bPosPxOffset; - var posm0 = posAxis.c2p(pos + bPos - bdPos0 * nw, true) + bPosPxOffset; - var posm1 = posAxis.c2p(pos + bPos + bdPos1 * nw, true) + bPosPxOffset; - var q1 = valAxis.c2p(d.q1, true); - var q3 = valAxis.c2p(d.q3, true); - // make sure median isn't identical to either of the - // quartiles, so we can see it - var m = Lib.constrain( - valAxis.c2p(d.med, true), - Math.min(q1, q3) + 1, Math.max(q1, q3) - 1 - ); + var vi = aobj[ai]; + var cont; + var contFull; + var param; + var oldVal; + var newVal; + var valObject; - // for compatibility with box, violin, and candlestick - // perhaps we should put this into cd0.t instead so it's more explicit, - // but what we have now is: - // - box always has d.lf, but boxpoints can be anything - // - violin has d.lf and should always use it (boxpoints is undefined) - // - candlestick has only min/max - var useExtremes = (d.lf === undefined) || (trace.boxpoints === false); - var lf = valAxis.c2p(useExtremes ? d.min : d.lf, true); - var uf = valAxis.c2p(useExtremes ? d.max : d.uf, true); - var ln = valAxis.c2p(d.ln, true); - var un = valAxis.c2p(d.un, true); - - if(trace.orientation === 'h') { - d3.select(this).attr('d', - 'M' + m + ',' + posm0 + 'V' + posm1 + // median line - 'M' + q1 + ',' + pos0 + 'V' + pos1 + // left edge - (notched ? 'H' + ln + 'L' + m + ',' + posm1 + 'L' + un + ',' + pos1 : '') + // top notched edge - 'H' + q3 + // end of the top edge - 'V' + pos0 + // right edge - (notched ? 'H' + un + 'L' + m + ',' + posm0 + 'L' + ln + ',' + pos0 : '') + // bottom notched edge - 'Z' + // end of the box - 'M' + q1 + ',' + posc + 'H' + lf + 'M' + q3 + ',' + posc + 'H' + uf + // whiskers - ((whiskerWidth === 0) ? '' : // whisker caps - 'M' + lf + ',' + posw0 + 'V' + posw1 + 'M' + uf + ',' + posw0 + 'V' + posw1)); - } else { - d3.select(this).attr('d', - 'M' + posm0 + ',' + m + 'H' + posm1 + // median line - 'M' + pos0 + ',' + q1 + 'H' + pos1 + // top of the box - (notched ? 'V' + ln + 'L' + posm1 + ',' + m + 'L' + pos1 + ',' + un : '') + // notched right edge - 'V' + q3 + // end of the right edge - 'H' + pos0 + // bottom of the box - (notched ? 'V' + un + 'L' + posm0 + ',' + m + 'L' + pos0 + ',' + ln : '') + // notched left edge - 'Z' + // end of the box - 'M' + posc + ',' + q1 + 'V' + lf + 'M' + posc + ',' + q3 + 'V' + uf + // whiskers - ((whiskerWidth === 0) ? '' : // whisker caps - 'M' + posw0 + ',' + lf + 'H' + posw1 + 'M' + posw0 + ',' + uf + 'H' + posw1)); + // Backward compatibility shim for turning histogram autobin on, + // or freezing previous autobinned values. + // Replace obsolete `autobin(x|y): true` with `(x|y)bins: null` + // and `autobin(x|y): false` with the `(x|y)bins` in `fullData` + if(ai === 'autobinx' || ai === 'autobiny') { + ai = ai.charAt(ai.length - 1) + 'bins'; + if(Array.isArray(vi)) vi = vi.map(arrayBins(ai)); + else if(vi === false) vi = traces.map(allBins(ai)); + else vi = null; } - }); -} - -function plotPoints(sel, axes, trace, t) { - var xa = axes.x; - var ya = axes.y; - var bdPos = t.bdPos; - var bPos = t.bPos; - - // to support violin points - var mode = trace.boxpoints || trace.points; - - // repeatable pseudo-random number generator - Lib.seedPseudoRandom(); - - // since box plot points get an extra level of nesting, each - // box needs the trace styling info - var fn = function(d) { - d.forEach(function(v) { - v.t = t; - v.trace = trace; - }); - return d; - }; - var gPoints = sel.selectAll('g.points') - .data(mode ? fn : []); + redoit[ai] = vi; - gPoints.enter().append('g') - .attr('class', 'points'); + if(ai.substr(0, 6) === 'LAYOUT') { + param = layoutNP(gd.layout, ai.replace('LAYOUT', '')); + undoit[ai] = [undefinedToNull(param.get())]; + // since we're allowing val to be an array, allow it here too, + // even though that's meaningless + param.set(Array.isArray(vi) ? vi[0] : vi); + // ironically, the layout attrs in restyle only require replot, + // not relayout + flags.calc = true; + continue; + } - gPoints.exit().remove(); + // set attribute in gd.data + undoit[ai] = a0(); + 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, ai); + oldVal = param.get(); + newVal = Array.isArray(vi) ? vi[i % vi.length] : vi; - var paths = gPoints.selectAll('path') - .data(function(d) { - var i; + if(newVal === undefined) continue; - var pts = mode === 'all' ? - d.pts : - d.pts.filter(function(pt) { return (pt.v < d.lf || pt.v > d.uf); }); - - // normally use IQR, but if this is 0 or too small, use max-min - var typicalSpread = Math.max((d.max - d.min) / 10, d.q3 - d.q1); - var minSpread = typicalSpread * 1e-9; - var spreadLimit = typicalSpread * JITTERSPREAD; - var jitterFactors = []; - var maxJitterFactor = 0; - var newJitter; - - // dynamic jitter - if(trace.jitter) { - if(typicalSpread === 0) { - // edge case of no spread at all: fall back to max jitter - maxJitterFactor = 1; - jitterFactors = new Array(pts.length); - for(i = 0; i < pts.length; i++) { - jitterFactors[i] = 1; - } - } else { - for(i = 0; i < pts.length; i++) { - var i0 = Math.max(0, i - JITTERCOUNT); - var pmin = pts[i0].v; - var i1 = Math.min(pts.length - 1, i + JITTERCOUNT); - var pmax = pts[i1].v; - - if(mode !== 'all') { - if(pts[i].v < d.lf) pmax = Math.min(pmax, d.lf); - else pmin = Math.max(pmin, d.uf); - } + var finalPart = param.parts[param.parts.length - 1]; + var prefix = ai.substr(0, ai.length - finalPart.length - 1); + var prefixDot = prefix ? prefix + '.' : ''; + var innerContFull = prefix ? + nestedProperty(contFull, prefix).get() : contFull; - var jitterFactor = Math.sqrt(spreadLimit * (i1 - i0) / (pmax - pmin + minSpread)) || 0; - jitterFactor = Lib.constrain(Math.abs(jitterFactor), 0, 1); + valObject = PlotSchema.getTraceValObject(contFull, param.parts); - jitterFactors.push(jitterFactor); - maxJitterFactor = Math.max(jitterFactor, maxJitterFactor); - } + if(valObject && valObject.impliedEdits && newVal !== null) { + for(var impliedKey in valObject.impliedEdits) { + doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey], i); } - newJitter = trace.jitter * 2 / (maxJitterFactor || 1); } - // fills in 'x' and 'y' in calcdata 'pts' item - for(i = 0; i < pts.length; i++) { - var pt = pts[i]; - var v = pt.v; - - var jitterOffset = trace.jitter ? - (newJitter * jitterFactors[i] * (Lib.pseudoRandom() - 0.5)) : - 0; - - var posPx = d.pos + bPos + bdPos * (trace.pointpos + jitterOffset); - - if(trace.orientation === 'h') { - pt.y = posPx; - pt.x = v; - } else { - pt.x = posPx; - pt.y = v; + // changing colorbar size modes, + // make the resulting size not change + // note that colorbar fractional sizing is based on the + // original plot size, before anything (like a colorbar) + // increases the margins + else if((finalPart === 'thicknessmode' || finalPart === 'lenmode') && + oldVal !== newVal && + (newVal === 'fraction' || newVal === 'pixels') && + innerContFull + ) { + var gs = fullLayout._size; + var orient = innerContFull.orient; + var topOrBottom = (orient === 'top') || (orient === 'bottom'); + if(finalPart === 'thicknessmode') { + var thicknorm = topOrBottom ? gs.h : gs.w; + doextra(prefixDot + 'thickness', innerContFull.thickness * + (newVal === 'fraction' ? 1 / thicknorm : thicknorm), i); } - - // tag suspected outliers - if(mode === 'suspectedoutliers' && v < d.uo && v > d.lo) { - pt.so = true; + else { + var lennorm = topOrBottom ? gs.w : gs.h; + doextra(prefixDot + 'len', innerContFull.len * + (newVal === 'fraction' ? 1 / lennorm : lennorm), i); } } - return pts; - }); - - paths.enter().append('path') - .classed('point', true); - - paths.exit().remove(); - - paths.call(Drawing.translatePoints, xa, ya); -} - -function plotBoxMean(sel, axes, trace, t) { - var posAxis = axes.pos; - var valAxis = axes.val; - var bPos = t.bPos; - var bPosPxOffset = t.bPosPxOffset || 0; - - // to support violin mean lines - var mode = trace.boxmean || (trace.meanline || {}).visible; - - // to support for one-sided box - var bdPos0; - var bdPos1; - if(Array.isArray(t.bdPos)) { - bdPos0 = t.bdPos[0]; - bdPos1 = t.bdPos[1]; - } else { - bdPos0 = t.bdPos; - bdPos1 = t.bdPos; - } + else if(ai === 'type' && (newVal === 'pie') !== (oldVal === 'pie')) { + 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); - var paths = sel.selectAll('path.mean').data(( - (trace.type === 'box' && trace.boxmean) || - (trace.type === 'violin' && trace.box.visible && trace.meanline.visible) - ) ? Lib.identity : []); + if(oldVal === 'pie') { + nestedProperty(cont, 'marker.color') + .set(nestedProperty(cont, 'marker.colors').get()); - paths.enter().append('path') - .attr('class', 'mean') - .style({ - fill: 'none', - 'vector-effect': 'non-scaling-stroke' - }); + // super kludgy - but if all pies are gone we won't remove them otherwise + fullLayout._pielayer.selectAll('g.trace').remove(); + } else if(Registry.traceIs(cont, 'cartesian')) { + nestedProperty(cont, 'marker.colors') + .set(nestedProperty(cont, 'marker.color').get()); + } + } - paths.exit().remove(); + undoit[ai][i] = undefinedToNull(oldVal); + // set the new value - if val is an array, it's one el per trace + // first check for attributes that get more complex alterations + var swapAttrs = [ + 'swapxy', 'swapxyaxes', 'orientation', 'orientationaxes' + ]; + if(swapAttrs.indexOf(ai) !== -1) { + // setting an orientation: make sure it's changing + // before we swap everything else + if(ai === 'orientation') { + param.set(newVal); + // obnoxious that we need this level of coupling... but in order to + // properly handle setting orientation to `null` we need to mimic + // the logic inside Bars.supplyDefaults for default orientation + var defaultOrientation = (cont.x && !cont.y) ? 'h' : 'v'; + if((param.get() || defaultOrientation) === contFull.orientation) { + continue; + } + } + // orientationaxes has no value, + // it flips everything and the axes + else if(ai === '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) { + // TODO: use manageArrays.applyContainerArrayChanges here too + helpers.manageArrayContainers(param, newVal, undoit); + flags.calc = true; + } + else { + if(valObject) { + // must redo calcdata when restyling array values of arrayOk attributes + // ... but no need to this for regl-based traces + if(valObject.arrayOk && + !Registry.traceIs(contFull, 'regl') && + (Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal)) + ) { + flags.calc = true; + } + else editTypes.update(flags, valObject); + } + else { + /* + * if we couldn't find valObject, assume a full recalc. + * This can happen if you're changing type and making + * some other edits too, so the modules we're + * looking at don't have these attributes in them. + */ + flags.calc = true; + } - paths.each(function(d) { - var posc = posAxis.c2p(d.pos + bPos, true) + bPosPxOffset; - var pos0 = posAxis.c2p(d.pos + bPos - bdPos0, true) + bPosPxOffset; - var pos1 = posAxis.c2p(d.pos + bPos + bdPos1, true) + bPosPxOffset; - var m = valAxis.c2p(d.mean, true); - var sl = valAxis.c2p(d.mean - d.sd, true); - var sh = valAxis.c2p(d.mean + d.sd, true); - - if(trace.orientation === 'h') { - d3.select(this).attr('d', - 'M' + m + ',' + pos0 + 'V' + pos1 + - (mode === 'sd' ? - 'm0,0L' + sl + ',' + posc + 'L' + m + ',' + pos0 + 'L' + sh + ',' + posc + 'Z' : - '') - ); - } else { - d3.select(this).attr('d', - 'M' + pos0 + ',' + m + 'H' + pos1 + - (mode === 'sd' ? - 'm0,0L' + posc + ',' + sl + 'L' + pos0 + ',' + m + 'L' + posc + ',' + sh + 'Z' : - '') - ); + // all the other ones, just modify that one attribute + param.set(newVal); + } } - }); -} - -module.exports = { - plot: plot, - plotBoxAndWhiskers: plotBoxAndWhiskers, - plotPoints: plotPoints, - plotBoxMean: plotBoxMean -}; -},{"../../components/drawing":595,"../../lib":696,"d3":148}],869:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; - var i, j; + // swap the data attributes of the relevant x and y axes? + if(['swapxyaxes', 'orientationaxes'].indexOf(ai) !== -1) { + Axes.swap(gd, traces); + } - if(selectionTester === false) { - for(i = 0; i < cd.length; i++) { - for(j = 0; j < (cd[i].pts || []).length; j++) { - // clear selection - cd[i].pts[j].selected = 0; + // swap hovermode if set to "compare x/y data" + if(ai === 'orientationaxes') { + var hovermode = nestedProperty(gd.layout, 'hovermode'); + if(hovermode.get() === 'x') { + hovermode.set('y'); + } else if(hovermode.get() === 'y') { + hovermode.set('x'); } } - } else { - for(i = 0; i < cd.length; i++) { - for(j = 0; j < (cd[i].pts || []).length; j++) { - var pt = cd[i].pts[j]; - var x = xa.c2p(pt.x); - var y = ya.c2p(pt.y); - - if(selectionTester.contains([x, y], null, pt.i, searchInfo)) { - selection.push({ - pointNumber: pt.i, - x: xa.c2d(pt.x), - y: ya.c2d(pt.y) - }); - pt.selected = 1; - } else { - pt.selected = 0; + + // Major enough changes deserve autoscale and + // non-reversed axes so people don't get confused + // + // Note: autobin (or its new analog bin clearing) is not included here + // since we're not pushing bins back to gd.data, so if we have bin + // info it was explicitly provided by the user. + if(['orientation', 'type'].indexOf(ai) !== -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); } } - return selection; -}; - -},{}],870:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); + if(flags.calc || flags.plot) { + flags.fullReplot = true; + } -function style(gd, cd) { - var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.boxes'); + return { + flags: flags, + undoit: undoit, + redoit: redoit, + traces: traces, + eventData: Lib.extendDeepNoArrays([], [eventData, traces]) + }; +} - s.style('opacity', function(d) { return d[0].trace.opacity; }); +/** + * Converts deprecated attribute keys to + * the current API to ensure backwards compatibility. + * + * This is needed for the update mechanism to determine which + * subroutines to run based on the actual attribute + * definitions (that don't include the deprecated ones). + * + * E.g. Maps {'xaxis.title': 'A chart'} to {'xaxis.title.text': 'A chart'} + * and {titlefont: {...}} to {'title.font': {...}}. + * + * @param aobj + */ +function cleanDeprecatedAttributeKeys(aobj) { + var oldAxisTitleRegex = Lib.counterRegex('axis', '\.title', false, false); + var colorbarRegex = /colorbar\.title$/; + var keys = Object.keys(aobj); + var i, key, value; - s.each(function(d) { - var el = d3.select(this); - var trace = d[0].trace; - var lineWidth = trace.line.width; + for(i = 0; i < keys.length; i++) { + key = keys[i]; + value = aobj[key]; - function styleBox(boxSel, lineWidth, lineColor, fillColor) { - boxSel.style('stroke-width', lineWidth + 'px') - .call(Color.stroke, lineColor) - .call(Color.fill, fillColor); - } - - var allBoxes = el.selectAll('path.box'); - - if(trace.type === 'candlestick') { - allBoxes.each(function(boxData) { - var thisBox = d3.select(this); - var container = trace[boxData.dir]; // dir = 'increasing' or 'decreasing' - styleBox(thisBox, container.line.width, container.line.color, container.fillcolor); - // TODO: custom selection style for candlesticks - thisBox.style('opacity', trace.selectedpoints && !boxData.selected ? 0.3 : 1); - }); + 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) { + 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')); } - else { - styleBox(allBoxes, lineWidth, trace.line.color, trace.fillcolor); - el.selectAll('path.mean') - .style({ - 'stroke-width': lineWidth, - 'stroke-dasharray': (2 * lineWidth) + 'px,' + lineWidth + 'px' - }) - .call(Color.stroke, trace.line.color); + } - var pts = el.selectAll('path.point'); - Drawing.pointStyle(pts, trace, gd); - } - }); + function replace(oldAttrStr, newAttrStr) { + aobj[newAttrStr] = aobj[oldAttrStr]; + delete aobj[oldAttrStr]; + } } -function styleOnSelect(gd, cd) { - var s = cd[0].node3; - var trace = cd[0].trace; - var pts = s.selectAll('path.point'); +/** + * relayout: update layout attributes of an existing plot + * + * Can be called two ways: + * + * Signature 1: + * @param {String | HTMLDivElement} gd + * the id or dom element of the graph container div + * @param {String} astr + * attribute string (like `'xaxis.range[0]'`) to update + * @param {*} val + * value to give this attribute + * + * Signature 2: + * @param {String | HTMLDivElement} gd + * (as in signature 1) + * @param {Object} aobj + * attribute object `{astr1: val1, astr2: val2 ...}` + * allows setting multiple attributes simultaneously + */ +function relayout(gd, astr, val) { + gd = Lib.getGraphDiv(gd); + helpers.clearPromiseQueue(gd); - if(trace.selectedpoints) { - Drawing.selectedPointStyle(pts, trace); + if(gd.framework && gd.framework.isPolar) { + return Promise.resolve(gd); + } + + var aobj = {}; + if(typeof astr === 'string') { + aobj[astr] = val; + } else if(Lib.isPlainObject(astr)) { + aobj = Lib.extendFlat({}, astr); } else { - Drawing.pointStyle(pts, trace, gd); + Lib.warn('Relayout fail.', astr, val); + return Promise.reject(); } -} -module.exports = { - style: style, - styleOnSelect: styleOnSelect -}; + if(Object.keys(aobj).length) gd.changed = true; -},{"../../components/color":570,"../../components/drawing":595,"d3":148}],871:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var specs = _relayout(gd, aobj); + var flags = specs.flags; + // clear calcdata if required + if(flags.calc) gd.calcdata = undefined; -'use strict'; + // fill in redraw sequence -var extendFlat = _dereq_('../../lib').extendFlat; -var OHLCattrs = _dereq_('../ohlc/attributes'); -var boxAttrs = _dereq_('../box/attributes'); + // even if we don't have anything left in aobj, + // something may have happened within relayout that we + // need to wait for + var seq = [Plots.previousPromises]; -function directionAttrs(lineColorDefault) { - return { - line: { - color: extendFlat({}, boxAttrs.line.color, {dflt: lineColorDefault}), - width: boxAttrs.line.width, - editType: 'style' - }, + if(flags.layoutReplot) { + seq.push(subroutines.layoutReplot); + } + else if(Object.keys(aobj).length) { + axRangeSupplyDefaultsByPass(gd, flags, specs) || Plots.supplyDefaults(gd); - fillcolor: boxAttrs.fillcolor, - editType: 'style' - }; -} + 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); -module.exports = { - x: OHLCattrs.x, - open: OHLCattrs.open, - high: OHLCattrs.high, - low: OHLCattrs.low, - close: OHLCattrs.close, + seq.push(emitAfterPlot); + } - line: { - width: extendFlat({}, boxAttrs.line.width, { - - }), - editType: 'style' - }, + seq.push(Plots.rehover); - increasing: directionAttrs(OHLCattrs.increasing.line.color.dflt), + Queue.add(gd, + relayout, [gd, specs.undoit], + relayout, [gd, specs.redoit] + ); - decreasing: directionAttrs(OHLCattrs.decreasing.line.color.dflt), + var plotDone = Lib.syncOrAsync(seq, gd); + if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd); - text: OHLCattrs.text, - whiskerwidth: extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }), + return plotDone.then(function() { + gd.emit('plotly_relayout', specs.eventData); + return gd; + }); +} +exports.relayout = relayout; - hoverlabel: OHLCattrs.hoverlabel, -}; +// Optimization mostly for large splom traces where +// Plots.supplyDefaults can take > 100ms +function axRangeSupplyDefaultsByPass(gd, flags, specs) { + var k; -},{"../../lib":696,"../box/attributes":859,"../ohlc/attributes":991}],872:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(!flags.axrange) return false; -'use strict'; + for(k in flags) { + if(k !== 'axrange' && flags[k]) return false; + } -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); + for(k in specs.rangesAltered) { + var axName = Axes.id2name(k); + var axIn = gd.layout[axName]; + var axOut = gd._fullLayout[axName]; + axOut.autorange = axIn.autorange; + axOut.range = axIn.range.slice(); + axOut.cleanRange(); + } + return true; +} + +function addAxRangeSequence(seq, rangesAltered) { + // N.B. leave as sequence of subroutines (for now) instead of + // subroutine of its own so that finalDraw always gets + // executed after drawData + var drawAxes = rangesAltered ? + function(gd) { + var opts = {skipTitle: true}; + for(var id in rangesAltered) { + if(Axes.getFromId(gd, id).automargin) { + opts = {}; + break; + } + } + return Axes.draw(gd, Object.keys(rangesAltered), opts); + } : + function(gd) { + return Axes.draw(gd, 'redraw'); + }; + + seq.push( + subroutines.doAutoRangeAndConstraints, + drawAxes, + subroutines.drawData, + subroutines.finalDraw + ); +} -var calcCommon = _dereq_('../ohlc/calc').calcCommon; +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]\])?$/; -module.exports = function(gd, trace) { +function _relayout(gd, aobj) { + var layout = gd.layout; var fullLayout = gd._fullLayout; - var xa = Axes.getFromId(gd, trace.xaxis); - var ya = Axes.getFromId(gd, trace.yaxis); + var guiEditFlag = fullLayout._guiEditing; + var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag); + var keys = Object.keys(aobj); + var axes = Axes.list(gd); + var eventData = Lib.extendDeepAll({}, aobj); + var arrayEdits = {}; - var x = xa.makeCalcdata(trace, 'x'); + var arrayStr, i, j; - var cd = calcCommon(gd, trace, x, ya, ptFunc); + cleanDeprecatedAttributeKeys(aobj); + keys = Object.keys(aobj); - if(cd.length) { - Lib.extendFlat(cd[0].t, { - num: fullLayout._numBoxes, - dPos: Lib.distinctVals(x).minDiff / 2, - posLetter: 'x', - valLetter: 'y', - }); + // look for 'allaxes', split out into all axes + // in case of 3D the axis are nested within a scene which is held in _id + 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); - fullLayout._numBoxes++; - return cd; - } else { - return [{t: {empty: true}}]; - } -}; + if(!aobj[newkey]) aobj[newkey] = aobj[keys[i]]; + } -function ptFunc(o, h, l, c) { - return { - min: l, - q1: Math.min(o, c), - med: c, - q3: Math.max(o, c), - max: h, - }; -} + delete aobj[keys[i]]; + } + } -},{"../../lib":696,"../../plots/cartesian/axes":744,"../ohlc/calc":992}],873:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // initialize flags + var flags = editTypes.layoutFlags(); + // copies of the change (and previous values of anything affected) + // for the undo / redo queue + var redoit = {}; + var undoit = {}; -'use strict'; + // for attrs that interact (like scales & autoscales), save the + // old vals before making the change + // val=undefined will not set a value, just record what the value was. + // attr can be an array to set several at once (all to the same val) + function doextra(attr, val) { + if(Array.isArray(attr)) { + attr.forEach(function(a) { doextra(a, val); }); + return; + } -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); -var handleOHLC = _dereq_('../ohlc/ohlc_defaults'); -var attributes = _dereq_('./attributes'); + // if we have another value for this attribute (explicitly or + // via a parent) do not override with this auto-generated extra + if(attr in aobj || helpers.hasParent(aobj, attr)) return; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + var p = layoutNP(layout, attr); + if(!(attr in undoit)) { + undoit[attr] = undefinedToNull(p.get()); + } + if(val !== undefined) p.set(val); } - var len = handleOHLC(traceIn, traceOut, coerce, layout); - if(!len) { - traceOut.visible = false; - return; + // for constraint enforcement: keep track of all axes (as {id: name}) + // we're editing the (auto)range of, so we can tell the others constrained + // to scale with them that it's OK for them to shrink + var rangesAltered = {}; + var axId; + + function recordAlteredAxis(pleafPlus) { + var axId = Axes.name2id(pleafPlus.split('.')[0]); + rangesAltered[axId] = 1; + return axId; } - coerce('line.width'); + // alter gd.layout + for(var ai in aobj) { + if(helpers.hasParent(aobj, ai)) { + throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously'); + } - handleDirection(traceIn, traceOut, coerce, 'increasing'); - handleDirection(traceIn, traceOut, coerce, 'decreasing'); + var p = layoutNP(layout, ai); + var vi = aobj[ai]; + var plen = p.parts.length; + // p.parts may end with an index integer if the property is an array + var pend = plen - 1; + while(pend > 0 && typeof p.parts[pend] !== 'string') pend--; + // last property in chain (leaf node) + var pleaf = p.parts[pend]; + // leaf plus immediate parent + var pleafPlus = p.parts[pend - 1] + '.' + pleaf; + // trunk nodes (everything except the leaf) + var ptrunk = p.parts.slice(0, pend).join('.'); + var parentIn = nestedProperty(gd.layout, ptrunk).get(); + var parentFull = nestedProperty(fullLayout, ptrunk).get(); + var vOld = p.get(); - coerce('text'); - coerce('whiskerwidth'); + if(vi === undefined) continue; - layout._requestRangeslider[traceOut.xaxis] = true; -}; + redoit[ai] = vi; -function handleDirection(traceIn, traceOut, coerce, direction) { - var lineColor = coerce(direction + '.line.color'); - coerce(direction + '.line.width', traceOut.line.width); - coerce(direction + '.fillcolor', Color.addOpacity(lineColor, 0.5)); -} + // axis reverse is special - it is its own inverse + // op and has no flag. + undoit[ai] = (pleaf === 'reverse') ? vi : undefinedToNull(vOld); -},{"../../components/color":570,"../../lib":696,"../ohlc/ohlc_defaults":996,"./attributes":871}],874:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var valObject = PlotSchema.getLayoutValObject(fullLayout, p.parts); -'use strict'; + if(valObject && valObject.impliedEdits && vi !== null) { + for(var impliedKey in valObject.impliedEdits) { + doextra(Lib.relativeAttr(ai, impliedKey), valObject.impliedEdits[impliedKey]); + } + } -module.exports = { - moduleType: 'trace', - name: 'candlestick', - basePlotModule: _dereq_('../../plots/cartesian'), - categories: ['cartesian', 'svg', 'showLegend', 'candlestick', 'boxLayout'], - meta: { - - }, + // Setting width or height to null must reset the graph's width / height + // back to its initial value as computed during the first pass in Plots.plotAutoSize. + // + // To do so, we must manually set them back here using the _initialAutoSize cache. + // can't use impliedEdits for this because behavior depends on vi + if(['width', 'height'].indexOf(ai) !== -1) { + if(vi) { + doextra('autosize', null); + // currently we don't support autosize one dim only - so + // explicitly set the other one. Note that doextra will + // ignore this if the same relayout call also provides oppositeAttr + var oppositeAttr = ai === 'height' ? 'width' : 'height'; + doextra(oppositeAttr, fullLayout[oppositeAttr]); + } + else { + fullLayout[ai] = gd._initialAutoSize[ai]; + } + } + else if(ai === 'autosize') { + // depends on vi here too, so again can't use impliedEdits + doextra('width', vi ? null : fullLayout.width); + doextra('height', vi ? null : fullLayout.height); + } + // check autorange vs range + 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) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(AX_DOMAIN_RE)) { + nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } - attributes: _dereq_('./attributes'), - layoutAttributes: _dereq_('../box/layout_attributes'), - supplyLayoutDefaults: _dereq_('../box/layout_defaults').supplyLayoutDefaults, - crossTraceCalc: _dereq_('../box/cross_trace_calc').crossTraceCalc, - supplyDefaults: _dereq_('./defaults'), - calc: _dereq_('./calc'), - plot: _dereq_('../box/plot').plot, - layerName: 'boxlayer', - style: _dereq_('../box/style').style, - hoverPoints: _dereq_('../ohlc/hover').hoverPoints, - selectPoints: _dereq_('../ohlc/select') -}; + // toggling axis type between log and linear: we need to convert + // positions for components that are still using linearized values, + // not data values like newer components. + // previously we did this for log <-> not-log, but now only do it + // for log <-> linear + if(pleaf === 'type') { + var ax = parentIn; + var toLog = parentFull.type === 'linear' && vi === 'log'; + var fromLog = parentFull.type === 'log' && vi === 'linear'; -},{"../../plots/cartesian":756,"../box/cross_trace_calc":861,"../box/layout_attributes":866,"../box/layout_defaults":867,"../box/plot":868,"../box/style":870,"../ohlc/hover":994,"../ohlc/select":998,"./attributes":871,"./calc":872,"./defaults":873}],875:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(toLog || fromLog) { + if(!ax || !ax.range) { + // 2D never gets here, but 3D does + // I don't think this is needed, but left here in case there + // are edge cases I'm not thinking of. + doextra(ptrunk + '.autorange', true); + } + else if(!parentFull.autorange) { + // toggling log without autorange: need to also recalculate ranges + // because log axes use linearized values for range endpoints + var r0 = ax.range[0]; + var r1 = ax.range[1]; + if(toLog) { + // if both limits are negative, autorange + if(r0 <= 0 && r1 <= 0) { + doextra(ptrunk + '.autorange', true); + } + // if one is negative, set it 6 orders below the other. + if(r0 <= 0) r0 = r1 / 1e6; + else if(r1 <= 0) r1 = r0 / 1e6; + // now set the range values as appropriate + doextra(ptrunk + '.range[0]', Math.log(r0) / Math.LN10); + doextra(ptrunk + '.range[1]', Math.log(r1) / Math.LN10); + } + else { + doextra(ptrunk + '.range[0]', Math.pow(10, r0)); + doextra(ptrunk + '.range[1]', Math.pow(10, r1)); + } + } + else if(toLog) { + // just make sure the range is positive and in the right + // order, it'll get recalculated later + ax.range = (ax.range[1] > ax.range[0]) ? [1, 2] : [2, 1]; + } -'use strict'; + // clear polar view initial stash for radial range so that + // value get recomputed in correct units + 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']; + } -var handleAxisDefaults = _dereq_('./axis_defaults'); -var Template = _dereq_('../../plot_api/plot_template'); + // Annotations and images also need to convert to/from linearized coords + // Shapes do not need this :) + Registry.getComponentMethod('annotations', 'convertCoords')(gd, parentFull, vi, doextra); + Registry.getComponentMethod('images', 'convertCoords')(gd, parentFull, vi, doextra); + } + else { + // any other type changes: the range from the previous type + // will not make sense, so autorange it. + 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, ai).get(); + var newType = (vi || {}).type; -module.exports = function handleABDefaults(traceIn, traceOut, fullLayout, coerce, dfltColor) { - var a = coerce('a'); + // This can potentially cause strange behavior if the autotype is not + // numeric (linear, because we don't auto-log) but the previous type + // was log. That's a very strange edge case though + if(!newType || newType === '-') newType = 'linear'; + Registry.getComponentMethod('annotations', 'convertCoords')(gd, fullProp, newType, doextra); + Registry.getComponentMethod('images', 'convertCoords')(gd, fullProp, newType, doextra); + } - if(!a) { - coerce('da'); - coerce('a0'); - } + // alter gd.layout - var b = coerce('b'); + // collect array component edits for execution all together + // so we can ensure consistent behavior adding/removing items + // and order-independence for add/remove/edit all together in + // one relayout call + var containerArrayMatch = manageArrays.containerArrayMatch(ai); + if(containerArrayMatch) { + arrayStr = containerArrayMatch.array; + i = containerArrayMatch.index; + var propStr = containerArrayMatch.property; + var updateValObject = valObject || {editType: 'calc'}; - if(!b) { - coerce('db'); - coerce('b0'); - } + if(i !== '' && propStr === '') { + // special handling of undoit if we're adding or removing an element + // ie 'annotations[2]' which can be {...} (add) or null, + // does not work when replacing the entire array + if(manageArrays.isAddVal(vi)) { + undoit[ai] = null; + } else if(manageArrays.isRemoveVal(vi)) { + undoit[ai] = (nestedProperty(layout, arrayStr).get() || [])[i]; + } else { + Lib.warn('unrecognized full object value', aobj); + } + } + editTypes.update(flags, updateValObject); - mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor); -}; + // prepare the edits object we'll send to applyContainerArrayChanges + if(!arrayEdits[arrayStr]) arrayEdits[arrayStr] = {}; + var objEdits = arrayEdits[arrayStr][i]; + if(!objEdits) objEdits = arrayEdits[arrayStr][i] = {}; + objEdits[propStr] = vi; -function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { - var axesList = ['aaxis', 'baxis']; + delete aobj[ai]; + } + // handle axis reversal explicitly, as there's no 'reverse' attribute + else if(pleaf === 'reverse') { + if(parentIn.range) parentIn.range.reverse(); + else { + doextra(ptrunk + '.autorange', true); + parentIn.range = [1, 0]; + } - axesList.forEach(function(axName) { - var axLetter = axName.charAt(0); - var axIn = traceIn[axName] || {}; - var axOut = Template.newContainer(traceOut, axName); + if(parentFull.autorange) flags.calc = true; + else flags.plot = true; + } + else { + if((fullLayout._has('scatter-like') && fullLayout._has('regl')) && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.plot = true; + } + else if(valObject) editTypes.update(flags, valObject); + else flags.calc = true; - var defaultOptions = { - tickfont: 'x', - id: axLetter + 'axis', - letter: axLetter, - font: traceOut.font, - name: axName, - data: traceIn[axLetter], - calendar: traceOut.calendar, - dfltColor: dfltColor, - bgColor: fullLayout.paper_bgcolor, - fullLayout: fullLayout - }; + p.set(vi); + } + } - handleAxisDefaults(axIn, axOut, defaultOptions); - axOut._categories = axOut._categories || []; + // now we've collected component edits - execute them all together + for(arrayStr in arrayEdits) { + var finished = manageArrays.applyContainerArrayChanges(gd, + layoutNP(layout, arrayStr), arrayEdits[arrayStr], flags, layoutNP); + if(!finished) flags.plot = true; + } - // so we don't have to repeat autotype unnecessarily, - // copy an autotype back to traceIn - if(!traceIn[axName] && axIn.type !== '-') { - traceIn[axName] = {type: axIn.type}; + // figure out if we need to recalculate axis constraints + var constraints = fullLayout._axisConstraintGroups || []; + for(axId in rangesAltered) { + for(i = 0; i < constraints.length; i++) { + var group = constraints[i]; + if(group[axId]) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; + } + } + } } - }); -} - -},{"../../plot_api/plot_template":734,"./axis_defaults":880}],876:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + } -'use strict'; + // If the autosize changed or height or width was explicitly specified, + // this triggers a redraw + // TODO: do we really need special aobj.height/width handling here? + // couldn't editType do this? + if(updateAutosize(gd) || aobj.height || aobj.width) flags.plot = true; -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; + if(flags.plot || flags.calc) { + flags.layoutReplot = true; + } -module.exports = function(a) { - return minMax(a, 0); -}; + // now all attribute mods are done, as are + // redo and undo so we can save them -function minMax(a, depth) { - // Limit to ten dimensional datasets. This seems *exceedingly* unlikely to - // ever cause problems or even be a concern. It's include strictly so that - // circular arrays could never cause this to loop. - if(!isArrayOrTypedArray(a) || depth >= 10) { - return null; - } + return { + flags: flags, + rangesAltered: rangesAltered, + undoit: undoit, + redoit: redoit, + eventData: eventData + }; +} - var min = Infinity; - var max = -Infinity; - var n = a.length; - for(var i = 0; i < n; i++) { - var datum = a[i]; - - if(isArrayOrTypedArray(datum)) { - var result = minMax(datum, depth + 1); - - if(result) { - min = Math.min(result[0], min); - max = Math.max(result[1], max); - } - } else { - min = Math.min(datum, min); - max = Math.max(datum, max); - } - } +/* + * updateAutosize: we made a change, does it change the autosize result? + * puts the new size into fullLayout + * returns true if either height or width changed + */ +function updateAutosize(gd) { + var fullLayout = gd._fullLayout; + var oldWidth = fullLayout.width; + var oldHeight = fullLayout.height; - return [min, max]; + // calculate autosizing + if(gd.layout.autosize) Plots.plotAutoSize(gd, gd.layout, fullLayout); + + return (fullLayout.width !== oldWidth) || (fullLayout.height !== oldHeight); } -},{"../../lib":696}],877:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * update: update trace and layout attributes of an existing plot + * + * @param {String | HTMLDivElement} gd + * the id or DOM element of the graph container div + * @param {Object} traceUpdate + * attribute object `{astr1: val1, astr2: val2 ...}` + * corresponding to updates in the plot's traces + * @param {Object} layoutUpdate + * attribute object `{astr1: val1, astr2: val2 ...}` + * corresponding to updates in the plot's layout + * @param {Number[] | Number} [traces] + * integer or array of integers for the traces to alter (all if omitted) + * + */ +function update(gd, traceUpdate, layoutUpdate, _traces) { + gd = Lib.getGraphDiv(gd); + helpers.clearPromiseQueue(gd); -'use strict'; + if(gd.framework && gd.framework.isPolar) { + return Promise.resolve(gd); + } -var fontAttrs = _dereq_('../../plots/font_attributes'); -var axisAttrs = _dereq_('./axis_attributes'); -var colorAttrs = _dereq_('../../components/color/attributes'); + if(!Lib.isPlainObject(traceUpdate)) traceUpdate = {}; + if(!Lib.isPlainObject(layoutUpdate)) layoutUpdate = {}; -var carpetFont = fontAttrs({ - editType: 'calc', - -}); -// TODO: inherit from global font -carpetFont.family.dflt = '"Open Sans", verdana, arial, sans-serif'; -carpetFont.size.dflt = 12; -carpetFont.color.dflt = colorAttrs.defaultLine; + if(Object.keys(traceUpdate).length) gd.changed = true; + if(Object.keys(layoutUpdate).length) gd.changed = true; -module.exports = { - carpet: { - valType: 'string', - - editType: 'calc', - - }, - x: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - y: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - a: { - valType: 'data_array', - editType: 'calc', - - }, - a0: { - valType: 'number', - dflt: 0, - - editType: 'calc', - - }, - da: { - valType: 'number', - dflt: 1, - - editType: 'calc', - - }, - b: { - valType: 'data_array', - editType: 'calc', - - }, - b0: { - valType: 'number', - dflt: 0, - - editType: 'calc', - - }, - db: { - valType: 'number', - dflt: 1, - - editType: 'calc', - - }, - cheaterslope: { - valType: 'number', - - dflt: 1, - editType: 'calc', - - }, - aaxis: axisAttrs, - baxis: axisAttrs, - font: carpetFont, - color: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'plot', - - }, - transforms: undefined -}; + var traces = helpers.coerceTraceIndices(gd, _traces); -},{"../../components/color/attributes":569,"../../plots/font_attributes":771,"./axis_attributes":879}],878:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var restyleSpecs = _restyle(gd, Lib.extendFlat({}, traceUpdate), traces); + var restyleFlags = restyleSpecs.flags; -'use strict'; + var relayoutSpecs = _relayout(gd, Lib.extendFlat({}, layoutUpdate)); + var relayoutFlags = relayoutSpecs.flags; -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; + // clear calcdata and/or axis types if required + if(restyleFlags.calc || relayoutFlags.calc) gd.calcdata = undefined; + if(restyleFlags.clearAxisTypes) helpers.clearAxisTypes(gd, traces, layoutUpdate); -/* This function retrns a set of control points that define a curve aligned along - * either the a or b axis. Exactly one of a or b must be an array defining the range - * spanned. - * - * Honestly this is the most complicated function I've implemente here so far because - * of the way it handles knot insertion and direction/axis-agnostic slices. - */ -module.exports = function(carpet, carpetcd, a, b) { - var idx, tangent, tanIsoIdx, tanIsoPar, segment, refidx; - var p0, p1, v0, v1, start, end, range; - - var axis = isArrayOrTypedArray(a) ? 'a' : 'b'; - var ax = axis === 'a' ? carpet.aaxis : carpet.baxis; - var smoothing = ax.smoothing; - var toIdx = axis === 'a' ? carpet.a2i : carpet.b2j; - var pt = axis === 'a' ? a : b; - var iso = axis === 'a' ? b : a; - var n = axis === 'a' ? carpetcd.a.length : carpetcd.b.length; - var m = axis === 'a' ? carpetcd.b.length : carpetcd.a.length; - var isoIdx = Math.floor(axis === 'a' ? carpet.b2j(iso) : carpet.a2i(iso)); - - var xy = axis === 'a' ? function(value) { - return carpet.evalxy([], value, isoIdx); - } : function(value) { - return carpet.evalxy([], isoIdx, value); - }; - - if(smoothing) { - tanIsoIdx = Math.max(0, Math.min(m - 2, isoIdx)); - tanIsoPar = isoIdx - tanIsoIdx; - tangent = axis === 'a' ? function(i, ti) { - return carpet.dxydi([], i, tanIsoIdx, ti, tanIsoPar); - } : function(j, tj) { - return carpet.dxydj([], tanIsoIdx, j, tanIsoPar, tj); - }; - } + // fill in redraw sequence + var seq = []; - var vstart = toIdx(pt[0]); - var vend = toIdx(pt[1]); + if(restyleFlags.fullReplot && relayoutFlags.layoutReplot) { + var data = gd.data; + var layout = gd.layout; - // So that we can make this work in two directions, flip all of the - // math functions if the direction is from higher to lower indices: - // - // Note that the tolerance is directional! - var dir = vstart < vend ? 1 : -1; - var tol = (vend - vstart) * 1e-8; - var dirfloor = dir > 0 ? Math.floor : Math.ceil; - var dirceil = dir > 0 ? Math.ceil : Math.floor; - var dirmin = dir > 0 ? Math.min : Math.max; - var dirmax = dir > 0 ? Math.max : Math.min; - - var idx0 = dirfloor(vstart + tol); - var idx1 = dirceil(vend - tol); - - p0 = xy(vstart); - var segments = [[p0]]; - - for(idx = idx0; idx * dir < idx1 * dir; idx += dir) { - segment = []; - start = dirmax(vstart, idx); - end = dirmin(vend, idx + dir); - range = end - start; - - // In order to figure out which cell we're in for the derivative (remember, - // the derivatives are *not* constant across grid lines), let's just average - // the start and end points. This cuts out just a tiny bit of logic and - // there's really no computational difference: - refidx = Math.max(0, Math.min(n - 2, Math.floor(0.5 * (start + end)))); - - p1 = xy(end); - if(smoothing) { - v0 = tangent(refidx, start - refidx); - v1 = tangent(refidx, end - refidx); - - segment.push([ - p0[0] + v0[0] / 3 * range, - p0[1] + v0[1] / 3 * range - ]); + // clear existing data/layout on gd + // so that Plotly.plot doesn't try to extend them + gd.data = undefined; + gd.layout = undefined; - segment.push([ - p1[0] - v1[0] / 3 * range, - p1[1] - v1[1] / 3 * range - ]); - } + seq.push(function() { return exports.plot(gd, data, layout); }); + } + else if(restyleFlags.fullReplot) { + seq.push(exports.plot); + } + else if(relayoutFlags.layoutReplot) { + seq.push(subroutines.layoutReplot); + } + else { + seq.push(Plots.previousPromises); + axRangeSupplyDefaultsByPass(gd, relayoutFlags, relayoutSpecs) || Plots.supplyDefaults(gd); - segment.push(p1); + if(restyleFlags.style) seq.push(subroutines.doTraceStyle); + if(restyleFlags.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); - segments.push(segment); - p0 = p1; + seq.push(emitAfterPlot); } - return segments; -}; + seq.push(Plots.rehover); -},{"../../lib":696}],879:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + Queue.add(gd, + update, [gd, restyleSpecs.undoit, relayoutSpecs.undoit, restyleSpecs.traces], + update, [gd, restyleSpecs.redoit, relayoutSpecs.redoit, restyleSpecs.traces] + ); -'use strict'; + var plotDone = Lib.syncOrAsync(seq, gd); + if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var colorAttrs = _dereq_('../../components/color/attributes'); -var axesAttrs = _dereq_('../../plots/cartesian/layout_attributes'); -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; + return plotDone.then(function() { + gd.emit('plotly_update', { + data: restyleSpecs.eventData, + layout: relayoutSpecs.eventData + }); -module.exports = { - color: { - valType: 'color', - - editType: 'calc', - - }, - smoothing: { - valType: 'number', - dflt: 1, - min: 0, - max: 1.3, - - editType: 'calc' - }, - title: { - valType: 'string', - - editType: 'calc', - - }, - titlefont: fontAttrs({ - editType: 'calc', - - }), - titleoffset: { - valType: 'number', - - dflt: 10, - editType: 'calc', - - }, - 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', 'date', 'category'], - dflt: '-', - - editType: 'calc', - - }, - autorange: { - valType: 'enumerated', - values: [true, false, 'reversed'], - dflt: true, - - editType: 'calc', - - }, - rangemode: { - valType: 'enumerated', - values: ['normal', 'tozero', 'nonnegative'], - dflt: 'normal', - - editType: 'calc', - - }, - range: { - valType: 'info_array', - - editType: 'calc', - items: [ - {valType: 'any', editType: 'calc'}, - {valType: 'any', editType: 'calc'} - ], - - }, + return gd; + }); +} +exports.update = update; - fixedrange: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - cheatertype: { - valType: 'enumerated', - values: ['index', 'value'], - dflt: 'value', - - editType: 'calc' - }, - tickmode: { - valType: 'enumerated', - values: ['linear', 'array'], - dflt: 'array', - - editType: 'calc' - }, - nticks: { - valType: 'integer', - min: 0, - dflt: 0, - - editType: 'calc', - - }, - tickvals: { - valType: 'data_array', - editType: 'calc', - - }, - ticktext: { - valType: 'data_array', - editType: 'calc', - - }, - showticklabels: { - valType: 'enumerated', - values: ['start', 'end', 'both', 'none'], - dflt: 'start', - - editType: 'calc', - - }, - tickfont: fontAttrs({ - editType: 'calc', - - }), - tickangle: { - valType: 'angle', - dflt: 'auto', - - editType: 'calc', - - }, - tickprefix: { - valType: 'string', - dflt: '', - - editType: 'calc', - - }, - showtickprefix: { - valType: 'enumerated', - values: ['all', 'first', 'last', 'none'], - dflt: 'all', - - editType: 'calc', - - }, - ticksuffix: { - valType: 'string', - dflt: '', - - editType: 'calc', - - }, - showticksuffix: { - valType: 'enumerated', - values: ['all', 'first', 'last', 'none'], - dflt: 'all', - - editType: 'calc', - - }, - showexponent: { - valType: 'enumerated', - values: ['all', 'first', 'last', 'none'], - dflt: 'all', - - editType: 'calc', - - }, - exponentformat: { - valType: 'enumerated', - values: ['none', 'e', 'E', 'power', 'SI', 'B'], - dflt: 'B', - - editType: 'calc', - - }, - separatethousands: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - tickformat: { - valType: 'string', - dflt: '', - - editType: 'calc', - - }, - tickformatstops: overrideAll(axesAttrs.tickformatstops, 'calc', 'from-root'), - categoryorder: { - valType: 'enumerated', - values: [ - 'trace', 'category ascending', 'category descending', 'array' - /* , 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later - ], - dflt: 'trace', - - editType: 'calc', - - }, - categoryarray: { - valType: 'data_array', - - editType: 'calc', - - }, - labelpadding: { - valType: 'integer', - - dflt: 10, - editType: 'calc', - - }, - labelprefix: { - valType: 'string', - - editType: 'calc', - - }, - labelsuffix: { - valType: 'string', - dflt: '', - - editType: 'calc', - - }, - // lines and grids - showline: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - linecolor: { - valType: 'color', - dflt: colorAttrs.defaultLine, - - editType: 'calc', - - }, - linewidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'calc', - - }, - gridcolor: { - valType: 'color', - - editType: 'calc', - - }, - gridwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'calc', - - }, - showgrid: { - valType: 'boolean', - - dflt: true, - editType: 'calc', - - }, - minorgridcount: { - valType: 'integer', - min: 0, - dflt: 0, - - editType: 'calc', - - }, - minorgridwidth: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'calc', - - }, - minorgridcolor: { - valType: 'color', - dflt: colorAttrs.lightLine, - - editType: 'calc', - - }, - startline: { - valType: 'boolean', - - editType: 'calc', - - }, - startlinecolor: { - valType: 'color', - - editType: 'calc', - - }, - startlinewidth: { - valType: 'number', - dflt: 1, - - editType: 'calc', - - }, - endline: { - valType: 'boolean', - - editType: 'calc', - - }, - endlinewidth: { - valType: 'number', - dflt: 1, - - editType: 'calc', - - }, - endlinecolor: { - valType: 'color', - - editType: 'calc', - - }, - tick0: { - valType: 'number', - min: 0, - dflt: 0, - - editType: 'calc', - - }, - dtick: { - valType: 'number', - min: 0, - dflt: 1, - - editType: 'calc', - - }, - arraytick0: { - valType: 'integer', - min: 0, - dflt: 0, - - editType: 'calc', - - }, - arraydtick: { - valType: 'integer', - min: 1, - dflt: 1, - - editType: 'calc', - - }, - editType: 'calc' -}; +/* + * internal-use-only restyle/relayout/update variants that record the initial + * values in (fullLayout|fullTrace)._preGUI so changes can be persisted across + * Plotly.react data updates, dependent on uirevision attributes + */ +function guiEdit(func) { + return function wrappedEdit(gd) { + gd._fullLayout._guiEditing = true; + var p = func.apply(null, arguments); + gd._fullLayout._guiEditing = false; + return p; + }; +} +exports._guiRestyle = guiEdit(restyle); +exports._guiRelayout = guiEdit(relayout); +exports._guiUpdate = guiEdit(update); + +// For connecting edited layout attributes to uirevision attrs +// If no `attr` we use `match[1] + '.uirevision'` +// Ordered by most common edits first, to minimize our search time +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)/}, + {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: /^legend\.(x|y)$/, attr: 'editrevision'}, + {pattern: /^(shapes|annotations)/, attr: 'editrevision'}, + {pattern: /^title\.text$/, attr: 'editrevision'} +]; -},{"../../components/color/attributes":569,"../../plot_api/edit_types":727,"../../plots/cartesian/layout_attributes":757,"../../plots/font_attributes":771}],880:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +// same for trace attributes: if `attr` is given it's in layout, +// or with no `attr` we use `trace.uirevision` +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/}, + + // 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'} +]; -'use strict'; +function findUIPattern(key, patternSpecs) { + for(var i = 0; i < patternSpecs.length; i++) { + var spec = patternSpecs[i]; + var match = key.match(spec.pattern); + if(match) { + return {head: match[1], attr: spec.attr}; + } + } +} -var carpetAttrs = _dereq_('./attributes'); +// We're finding the new uirevision before supplyDefaults, so do the +// inheritance manually. Note that only `undefined` inherits - other +// falsy values are returned. +function getNewRev(revAttr, container) { + var newRev = nestedProperty(container, revAttr).get(); + if(newRev !== undefined) return newRev; -var addOpacity = _dereq_('../../components/color').addOpacity; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var handleTickValueDefaults = _dereq_('../../plots/cartesian/tick_value_defaults'); -var handleTickLabelDefaults = _dereq_('../../plots/cartesian/tick_label_defaults'); -var handleCategoryOrderDefaults = _dereq_('../../plots/cartesian/category_order_defaults'); -var setConvert = _dereq_('../../plots/cartesian/set_convert'); -var autoType = _dereq_('../../plots/cartesian/axis_autotype'); + var parts = revAttr.split('.'); + parts.pop(); + while(parts.length > 1) { + parts.pop(); + newRev = nestedProperty(container, parts.join('.') + '.uirevision').get(); + if(newRev !== undefined) 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; + } + // fall back on trace order, but only if user didn't provide a uid for that trace + return (!data[tracei] || data[tracei].uid) ? -1 : tracei; +} + +function valsMatch(v1, v2) { + var v1IsObj = Lib.isPlainObject(v1); + var v1IsArray = Array.isArray(v1); + if(v1IsObj || v1IsArray) { + return ( + (v1IsObj && Lib.isPlainObject(v2)) || + (v1IsArray && Array.isArray(v2)) + ) && JSON.stringify(v1) === JSON.stringify(v2); + } + return v1 === v2; +} + +function applyUIRevisions(data, layout, oldFullData, oldFullLayout) { + var layoutPreGUI = oldFullLayout._preGUI; + var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal; + var bothInheritAutorange = []; + var newRangeAccepted = {}; + for(key in layoutPreGUI) { + match = findUIPattern(key, layoutUIControlPatterns); + if(match) { + revAttr = match.attr || (match.head + '.uirevision'); + oldRev = nestedProperty(oldFullLayout, revAttr).get(); + newRev = oldRev && getNewRev(revAttr, layout); + if(newRev && (newRev === oldRev)) { + preGUIVal = layoutPreGUI[key]; + if(preGUIVal === null) preGUIVal = undefined; + newNP = nestedProperty(layout, key); + newVal = newNP.get(); + if(valsMatch(newVal, preGUIVal)) { + if(newVal === undefined && key.substr(key.length - 9) === 'autorange') { + bothInheritAutorange.push(key.substr(0, key.length - 10)); + } + newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get())); + continue; + } + } + } + else { + Lib.warn('unrecognized GUI edit: ' + key); + } + // if we got this far, the new value was accepted as the new starting + // point (either because it changed or revision changed) + // so remove it from _preGUI for next time. + delete layoutPreGUI[key]; + + if(key.substr(key.length - 8, 6) === 'range[') { + newRangeAccepted[key.substr(0, key.length - 9)] = 1; + } + } + + // Special logic for `autorange`, since it interacts with `range`: + // If the new figure's matching `range` was kept, and `autorange` + // wasn't supplied explicitly in either the original or the new figure, + // we shouldn't alter that - but we may just have done that, so fix it. + 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; + } + } + + // Now traces - try to match them up by uid (in case we added/deleted in + // the middle), then fall back on index. + var allTracePreGUI = oldFullLayout._tracePreGUI; + for(var uid in allTracePreGUI) { + var tracePreGUI = allTracePreGUI[uid]; + var newTrace = null; + var fullInput; + for(key in tracePreGUI) { + // wait until we know we have preGUI values to look for traces + // but if we don't find both, stop looking at this uid + if(!newTrace) { + var fulli = getFullTraceIndexFromUid(uid, oldFullData); + if(fulli < 0) { + // Somehow we didn't even have this trace in oldFullData... + // I guess this could happen with `deleteTraces` or something + delete allTracePreGUI[uid]; + break; + } + var fullTrace = oldFullData[fulli]; + fullInput = fullTrace._fullInput; + + var newTracei = getTraceIndexFromUid(uid, data, fullInput.index); + if(newTracei < 0) { + // No match in new data + 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; + // inheritance for trace.uirevision is simple, just layout.uirevision + newRev = newTrace.uirevision; + if(newRev === undefined) newRev = layout.uirevision; + } + + if(newRev && newRev === oldRev) { + preGUIVal = tracePreGUI[key]; + if(preGUIVal === null) preGUIVal = undefined; + 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]; + } + } +} /** - * options: object containing: + * Plotly.react: + * A plot/update method that takes the full plot state (same API as plot/newPlot) + * and diffs to determine the minimal update pathway + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + * @param {array of objects} data + * array of traces, containing the data and display information for each trace + * @param {object} layout + * object describing the overall display of the plot, + * all the stuff that doesn't pertain to any individual trace + * @param {object} config + * configuration options (see ./plot_config.js for more info) + * + * OR + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + * @param {object} figure + * object containing `data`, `layout`, `config`, and `frames` members * - * letter: 'a' or 'b' - * title: name of the axis (ie 'Colorbar') to go in default title - * name: axis object name (ie 'xaxis') if one should be stored - * font: the default font to inherit - * outerTicks: boolean, should ticks default to outside? - * showGrid: boolean, should gridlines be shown by default? - * data: the plot data to use in choosing auto type - * bgColor: the plot background color, to calculate default gridline colors */ -module.exports = function handleAxisDefaults(containerIn, containerOut, options) { - var letter = options.letter, - font = options.font || {}, - attributes = carpetAttrs[letter + 'axis']; +exports.react = function(gd, data, layout, config) { + var frames, plotDone; - function coerce(attr, dflt) { - return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); - } + function addFrames() { return exports.addFrames(gd, frames); } - function coerce2(attr, dflt) { - return Lib.coerce2(containerIn, containerOut, attributes, attr, dflt); - } + gd = Lib.getGraphDiv(gd); + + var oldFullData = gd._fullData; + var oldFullLayout = gd._fullLayout; - // set up some private properties - if(options.name) { - containerOut._name = options.name; - containerOut._id = options.name; + // you can use this as the initial draw as well as to update + if(!Lib.isPlotDiv(gd) || !oldFullData || !oldFullLayout) { + plotDone = exports.newPlot(gd, data, layout, config); } + else { - // now figure out type and do some more initialization - var axType = coerce('type'); - if(axType === '-') { - if(options.data) setAutoType(containerOut, options.data); + if(Lib.isPlainObject(data)) { + var obj = data; + data = obj.data; + layout = obj.layout; + config = obj.config; + frames = obj.frames; + } - if(containerOut.type === '-') { - containerOut.type = 'linear'; + var configChanged = false; + // assume that if there's a config at all, we're reacting to it too, + // and completely replace the previous config + if(config) { + var oldConfig = Lib.extendDeep({}, gd._context); + gd._context = undefined; + setPlotContext(gd, config); + configChanged = diffConfig(oldConfig, gd._context); + } + + gd.data = data || []; + helpers.cleanData(gd.data); + gd.layout = layout || {}; + helpers.cleanLayout(gd.layout); + + applyUIRevisions(gd.data, gd.layout, oldFullData, oldFullLayout); + + // "true" skips updating calcdata and remapping arrays from calcTransforms, + // which supplyDefaults usually does at the end, but we may need to NOT do + // if the diff (which we haven't determined yet) says we'll recalc + Plots.supplyDefaults(gd, {skipUpdateCalc: true}); + + var newFullData = gd._fullData; + var newFullLayout = gd._fullLayout; + var immutable = newFullLayout.datarevision === undefined; + var transition = newFullLayout.transition; + + var relayoutFlags = diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition); + var newDataRevision = relayoutFlags.newDataRevision; + var restyleFlags = diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision); + + // TODO: how to translate this part of relayout to Plotly.react? + // // Setting width or height to null must reset the graph's width / height + // // back to its initial value as computed during the first pass in Plots.plotAutoSize. + // // + // // To do so, we must manually set them back here using the _initialAutoSize cache. + // if(['width', 'height'].indexOf(ai) !== -1 && vi === null) { + // fullLayout[ai] = gd._initialAutoSize[ai]; + // } + + if(updateAutosize(gd)) relayoutFlags.layoutReplot = true; + + // clear calcdata if required + if(restyleFlags.calc || relayoutFlags.calc) gd.calcdata = undefined; + // otherwise do the calcdata updates and calcTransform array remaps that we skipped earlier + else Plots.supplyDefaultsUpdateCalc(gd.calcdata, newFullData); + + // Note: what restyle/relayout use impliedEdits and clearAxisTypes for + // must be handled by the user when using Plotly.react. + + // fill in redraw sequence + var seq = []; + + if(frames) { + gd._transitionData = {}; + Plots.createTransitionData(gd); + seq.push(addFrames); + } + + // Transition pathway, + // only used when 'transition' is set by user and + // when at least one animatable attribute has changed, + // N.B. config changed aren't animatable + if(newFullLayout.transition && !configChanged && (restyleFlags.anim || relayoutFlags.anim)) { + Plots.doCalcdata(gd); + subroutines.doAutoRangeAndConstraints(gd); + + seq.push(function() { + return Plots.transitionFromReact(gd, restyleFlags, relayoutFlags, oldFullLayout); + }); + } + else if(restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) { + gd._fullLayout._skipDefaults = true; + seq.push(exports.plot); } else { - // copy autoType back to input axis - // note that if this object didn't exist - // in the input layout, we have to put it in - // this happens in the main supplyDefaults function - axType = containerIn.type = containerOut.type; + 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(gd, indices[i]); + } + } + else { + var draw = Registry.getComponentMethod(componentType, 'draw'); + if(draw === Lib.noop) { + throw new Error('cannot draw components: ' + componentType); + } + draw(gd); + } + } + } + + seq.push(Plots.previousPromises); + if(restyleFlags.style) seq.push(subroutines.doTraceStyle); + if(restyleFlags.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); + + plotDone = Lib.syncOrAsync(seq, gd); + if(!plotDone || !plotDone.then) plotDone = Promise.resolve(gd); } - coerce('smoothing'); - coerce('cheatertype'); + return plotDone.then(function() { + gd.emit('plotly_react', { + data: data, + layout: layout + }); + + return gd; + }); + +}; + +function diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision) { + var sameTraceLength = oldFullData.length === newFullData.length; - coerce('showticklabels'); - coerce('labelprefix', letter + ' = '); - coerce('labelsuffix'); - coerce('showtickprefix'); - coerce('showticksuffix'); + if(!transition && !sameTraceLength) { + return { + fullReplot: true, + calc: true + }; + } - coerce('separatethousands'); - coerce('tickformat'); - coerce('exponentformat'); - coerce('showexponent'); - coerce('categoryorder'); + var flags = editTypes.traceFlags(); + flags.arrays = {}; + flags.nChanges = 0; + flags.nChangesAnim = 0; - coerce('tickmode'); - coerce('tickvals'); - coerce('ticktext'); - coerce('tick0'); - coerce('dtick'); + var i, trace; - if(containerOut.tickmode === 'array') { - coerce('arraytick0'); - coerce('arraydtick'); + function getTraceValObject(parts) { + return PlotSchema.getTraceValObject(trace, parts); } - coerce('labelpadding'); + var diffOpts = { + getValObject: getTraceValObject, + flags: flags, + immutable: immutable, + transition: transition, + newDataRevision: newDataRevision, + gd: gd + }; + + var seenUIDs = {}; - containerOut._hovertitle = letter; + 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(axType === 'date') { - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); - handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + if(flags.calc || flags.plot) { + flags.fullReplot = true; } - // we need some of the other functions setConvert attaches, but for - // path finding, override pixel scaling to simple passthrough (identity) - setConvert(containerOut, options.fullLayout); - containerOut.c2p = Lib.identity; + if(transition && flags.nChanges && flags.nChangesAnim) { + flags.anim = (flags.nChanges === flags.nChangesAnim) && sameTraceLength ? 'all' : 'some'; + } - var dfltColor = coerce('color', options.dfltColor); - // if axis.color was provided, use it for fonts too; otherwise, - // inherit from global font color in case that was provided. - var dfltFontColor = (dfltColor === containerIn.color) ? dfltColor : font.color; + return flags; +} - coerce('title'); - Lib.coerceFont(coerce, 'titlefont', { - family: font.family, - size: Math.round(font.size * 1.2), - color: dfltFontColor - }); +function diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition) { + var flags = editTypes.layoutFlags(); + flags.arrays = {}; + flags.rangesAltered = {}; + flags.nChanges = 0; + flags.nChangesAnim = 0; - coerce('titleoffset'); + function getLayoutValObject(parts) { + return PlotSchema.getLayoutValObject(newFullLayout, parts); + } - coerce('tickangle'); + var diffOpts = { + getValObject: getLayoutValObject, + flags: flags, + immutable: immutable, + transition: transition, + gd: gd + }; - var autoRange = coerce('autorange', !containerOut.isValidRange(containerIn.range)); + getDiffFlags(oldFullLayout, newFullLayout, [], diffOpts); - if(autoRange) coerce('rangemode'); + if(flags.plot || flags.calc) { + flags.layoutReplot = true; + } - coerce('range'); - containerOut.cleanRange(); + if(transition && flags.nChanges && flags.nChangesAnim) { + flags.anim = flags.nChanges === flags.nChangesAnim ? 'all' : 'some'; + } - coerce('fixedrange'); + return flags; +} - handleTickValueDefaults(containerIn, containerOut, coerce, axType); - handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options); - handleCategoryOrderDefaults(containerIn, containerOut, coerce, { - data: options.data, - dataAttr: letter - }); +function getDiffFlags(oldContainer, newContainer, outerparts, opts) { + var valObject, key, astr; - var gridColor = coerce2('gridcolor', addOpacity(dfltColor, 0.3)); - var gridWidth = coerce2('gridwidth'); - var showGrid = coerce('showgrid'); + var getValObject = opts.getValObject; + var flags = opts.flags; + var immutable = opts.immutable; + var inArray = opts.inArray; + var arrayIndex = opts.arrayIndex; - if(!showGrid) { - delete containerOut.gridcolor; - delete containerOut.gridwidth; + 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++; + } + + // track animatable changes + if(opts.transition && valObject.anim) { + flags.nChangesAnim++; + } + + // track cartesian axes with altered ranges + if(AX_RANGE_RE.test(astr) || AX_AUTORANGE_RE.test(astr)) { + flags.rangesAltered[outerparts[0]] = 1; + } + + // clear _inputDomain on cartesian axes with altered domains + if(AX_DOMAIN_RE.test(astr)) { + nestedProperty(newContainer, '_inputDomain').set(null); + } + + // track datarevision changes + if(key === 'datarevision') { + flags.newDataRevision = 1; + } + } + + function valObjectCanBeDataArray(valObject) { + return valObject.valType === 'data_array' || valObject.arrayOk; } - var startLineColor = coerce2('startlinecolor', dfltColor); - var startLineWidth = coerce2('startlinewidth', gridWidth); - var showStartLine = coerce('startline', containerOut.showgrid || !!startLineColor || !!startLineWidth); + for(key in oldContainer) { + // short-circuit based on previous calls or previous keys that already maximized the pathway + 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; + + // FIXME: ax.tick0 and dtick get filled in during plotting (except for geo subplots), + // and unlike other auto values they don't make it back into the input, + // so newContainer won't have them. + if((key === 'tick0' || key === 'dtick') && outerparts[0] !== 'geo') { + var tickMode = newContainer.tickmode; + if(tickMode === 'auto' || tickMode === 'array' || !tickMode) continue; + } + // FIXME: Similarly for axis ranges for 3D + // contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them. + if(key === 'range' && newContainer.autorange) continue; + if((key === 'zmin' || key === 'zmax') && newContainer.type === 'contourcarpet') continue; + + valObject = getValObject(parts); + + // in case type changed, we may not even *have* a valObject. + 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); + + // hack for traces that modify the data in supplyDefaults, like + // converting 1D to 2D arrays, which will always create new objects + if(wasArray && nowArray) { + var inputKey = '_input_' + key; + var oldValIn = oldContainer[inputKey]; + var newValIn = newContainer[inputKey]; + if(Array.isArray(oldValIn) && oldValIn === newValIn) continue; + } + + if(newVal === undefined) { + 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)); + } + + // put this at the end so that we know our collected array indices are sorted + // but the check for length changes happens up front so we can short-circuit + // diffing if appropriate + 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) { + + // don't try to diff two data arrays. If immutable we know the data changed, + // if not, assume it didn't and let `layout.datarevision` tell us if it did + if(immutable) { + flags.calc = true; + } - if(!showStartLine) { - delete containerOut.startlinecolor; - delete containerOut.startlinewidth; + // look for animatable attributes when the data changed + if(immutable || opts.newDataRevision) { + changed(); + } + } + else if(wasArray !== nowArray) { + flags.calc = true; + } + else changed(); + } + else if(wasArray && nowArray) { + // info array, colorscale, 'any' - these are short, just stringify. + // I don't *think* that covers up any real differences post-validation, does it? + // otherwise we need to dive in 1 (info_array) or 2 (colorscale) levels and compare + // all elements. + if(oldVal.length !== newVal.length || String(oldVal) !== String(newVal)) { + changed(); + } + } + else { + changed(); + } } - var endLineColor = coerce2('endlinecolor', dfltColor); - var endLineWidth = coerce2('endlinewidth', gridWidth); - var showEndLine = coerce('endline', containerOut.showgrid || !!endLineColor || !!endLineWidth); + for(key in newContainer) { + if(!(key in oldContainer || key.charAt(0) === '_' || typeof newContainer[key] === 'function')) { + valObject = getValObject(outerparts.concat(key)); - if(!showEndLine) { - delete containerOut.endlinecolor; - delete containerOut.endlinewidth; + if(valObjectCanBeDataArray(valObject) && Array.isArray(newContainer[key])) { + flags.calc = true; + return; + } + else changed(); + } } +} - if(!showGrid) { - delete containerOut.gridcolor; - delete containerOut.gridWidth; - } else { - coerce('minorgridcount'); - coerce('minorgridwidth', gridWidth); - coerce('minorgridcolor', addOpacity(gridColor, 0.06)); +/* + * simple diff for config - for now, just treat all changes as equivalent + */ +function diffConfig(oldConfig, newConfig) { + var key; - if(!containerOut.minorgridcount) { - delete containerOut.minorgridwidth; - delete containerOut.minorgridcolor; + 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; + } } } +} + +/** + * Animate to a frame, sequence of frame, frame group, or frame definition + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + * + * @param {string or object or array of strings or array of objects} frameOrGroupNameOrFrameList + * a single frame, array of frames, or group to which to animate. The intent is + * inferred by the type of the input. Valid inputs are: + * + * - string, e.g. 'groupname': animate all frames of a given `group` in the order + * in which they are defined via `Plotly.addFrames`. + * + * - array of strings, e.g. ['frame1', frame2']: a list of frames by name to which + * to animate in sequence + * + * - object: {data: ...}: a frame definition to which to animate. The frame is not + * and does not need to be added via `Plotly.addFrames`. It may contain any of + * the properties of a frame, including `data`, `layout`, and `traces`. The + * frame is used as provided and does not use the `baseframe` property. + * + * - array of objects, e.g. [{data: ...}, {data: ...}]: a list of frame objects, + * each following the same rules as a single `object`. + * + * @param {object} animationOpts + * configuration for the animation + */ +exports.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { + gd = Lib.getGraphDiv(gd); - if(containerOut.showticklabels === 'none') { - delete containerOut.tickfont; - delete containerOut.tickangle; - delete containerOut.showexponent; - delete containerOut.exponentformat; - delete containerOut.tickformat; - delete containerOut.showticksuffix; - delete containerOut.showtickprefix; + if(!Lib.isPlotDiv(gd)) { + throw new Error( + 'This element is not a Plotly plot: ' + gd + '. It\'s likely that you\'ve failed ' + + 'to create a plot before animating it. For more details, see ' + + 'https://plot.ly/javascript/animations/' + ); } - if(!containerOut.showticksuffix) { - delete containerOut.ticksuffix; - } + var trans = gd._transitionData; - if(!containerOut.showtickprefix) { - delete containerOut.tickprefix; + // This is the queue of frames that will be animated as soon as possible. They + // are popped immediately upon the *start* of a transition: + if(!trans._frameQueue) { + trans._frameQueue = []; } - // It needs to be coerced, then something above overrides this deep in the axis code, - // but no, we *actually* want to coerce this. - coerce('tickmode'); + animationOpts = Plots.supplyAnimationDefaults(animationOpts); + var transitionOpts = animationOpts.transition; + var frameOpts = animationOpts.frame; - if(!containerOut.title || (containerOut.title && containerOut.title.length === 0)) { - delete containerOut.titlefont; - delete containerOut.titleoffset; + // Since frames are popped immediately, an empty queue only means all frames have + // *started* to transition, not that the animation is complete. To solve that, + // track a separate counter that increments at the same time as frames are added + // to the queue, but decrements only when the transition is complete. + if(trans._frameWaitingCnt === undefined) { + trans._frameWaitingCnt = 0; } - return containerOut; -}; - -function setAutoType(ax, data) { - // new logic: let people specify any type they want, - // only autotype if type is '-' - if(ax.type !== '-') return; - - var id = ax._id, - axLetter = id.charAt(0); - - var calAttr = axLetter + 'calendar', - calendar = ax[calAttr]; - - ax.type = autoType(data, calendar); -} - -},{"../../components/color":570,"../../lib":696,"../../plots/cartesian/axis_autotype":745,"../../plots/cartesian/category_order_defaults":748,"../../plots/cartesian/set_convert":763,"../../plots/cartesian/tick_label_defaults":764,"../../plots/cartesian/tick_value_defaults":766,"../../registry":827,"./attributes":877}],881:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Axes = _dereq_('../../plots/cartesian/axes'); -var isArray1D = _dereq_('../../lib').isArray1D; -var cheaterBasis = _dereq_('./cheater_basis'); -var arrayMinmax = _dereq_('./array_minmax'); -var calcGridlines = _dereq_('./calc_gridlines'); -var calcLabels = _dereq_('./calc_labels'); -var calcClipPath = _dereq_('./calc_clippath'); -var clean2dArray = _dereq_('../heatmap/clean_2d_array'); -var smoothFill2dArray = _dereq_('./smooth_fill_2d_array'); -var convertColumnData = _dereq_('../heatmap/convert_column_xyz'); -var setConvert = _dereq_('./set_convert'); - -module.exports = function calc(gd, trace) { - var xa = Axes.getFromId(gd, trace.xaxis); - var ya = Axes.getFromId(gd, trace.yaxis); - var aax = trace.aaxis; - var bax = trace.baxis; - - var x = trace.x; - var y = trace.y; - var cols = []; - if(x && isArray1D(x)) cols.push('x'); - if(y && isArray1D(y)) cols.push('y'); - - if(cols.length) { - convertColumnData(trace, aax, bax, 'a', 'b', cols); + function getTransitionOpts(i) { + if(Array.isArray(transitionOpts)) { + if(i >= transitionOpts.length) { + return transitionOpts[0]; + } else { + return transitionOpts[i]; + } + } else { + return transitionOpts; + } } - var a = trace._a = trace._a || trace.a; - var b = trace._b = trace._b || trace.b; - x = trace._x || trace.x; - y = trace._y || trace.y; - - var t = {}; - - if(trace._cheater) { - var avals = aax.cheatertype === 'index' ? a.length : a; - var bvals = bax.cheatertype === 'index' ? b.length : b; - x = cheaterBasis(avals, bvals, trace.cheaterslope); + function getFrameOpts(i) { + if(Array.isArray(frameOpts)) { + if(i >= frameOpts.length) { + return frameOpts[0]; + } else { + return frameOpts[i]; + } + } else { + return frameOpts; + } } - trace._x = x = clean2dArray(x); - trace._y = y = clean2dArray(y); - - // Fill in any undefined values with elliptic smoothing. This doesn't take - // into account the spacing of the values. That is, the derivatives should - // be modified to use a and b values. It's not that hard, but this is already - // moderate overkill for just filling in missing values. - smoothFill2dArray(x, a, b); - smoothFill2dArray(y, a, b); - - setConvert(trace); + // Execute a callback after the wrapper function has been called n times. + // This is used to defer the resolution until a transition has resovled *and* + // the frame has completed. If it's not done this way, then we get a race + // condition in which the animation might resolve before a transition is complete + // or vice versa. + function callbackOnNthTime(cb, n) { + var cnt = 0; + return function() { + if(cb && ++cnt === n) { + return cb(); + } + }; + } - // create conversion functions that depend on the data - trace.setScale(); + return new Promise(function(resolve, reject) { + function discardExistingFrames() { + if(trans._frameQueue.length === 0) { + return; + } - // This is a rather expensive scan. Nothing guarantees monotonicity, - // so we need to scan through all data to get proper ranges: - var xrange = arrayMinmax(x); - var yrange = arrayMinmax(y); + while(trans._frameQueue.length) { + var next = trans._frameQueue.pop(); + if(next.onInterrupt) { + next.onInterrupt(); + } + } - var dx = 0.5 * (xrange[1] - xrange[0]); - var xc = 0.5 * (xrange[1] + xrange[0]); + gd.emit('plotly_animationinterrupted', []); + } - var dy = 0.5 * (yrange[1] - yrange[0]); - var yc = 0.5 * (yrange[1] + yrange[0]); + function queueFrames(frameList) { + if(frameList.length === 0) return; - // Expand the axes to fit the plot, except just grow it by a factor of 1.3 - // because the labels should be taken into account except that's difficult - // hence 1.3. - var grow = 1.3; - xrange = [xc - dx * grow, xc + dx * grow]; - yrange = [yc - dy * grow, yc + dy * grow]; + for(var i = 0; i < frameList.length; i++) { + var computedFrame; - trace._extremes[xa._id] = Axes.findExtremes(xa, xrange, {padded: true}); - trace._extremes[ya._id] = Axes.findExtremes(ya, yrange, {padded: true}); + if(frameList[i].type === 'byname') { + // If it's a named frame, compute it: + computedFrame = Plots.computeFrame(gd, frameList[i].name); + } else { + // Otherwise we must have been given a simple object, so treat + // the input itself as the computed frame. + computedFrame = frameList[i].data; + } - // Enumerate the gridlines, both major and minor, and store them on the trace - // object: - calcGridlines(trace, 'a', 'b'); - calcGridlines(trace, 'b', 'a'); + var frameOpts = getFrameOpts(i); + var transitionOpts = getTransitionOpts(i); - // Calculate the text labels for each major gridline and store them on the - // trace object: - calcLabels(trace, aax); - calcLabels(trace, bax); + // It doesn't make much sense for the transition duration to be greater than + // the frame duration, so limit it: + transitionOpts.duration = Math.min(transitionOpts.duration, frameOpts.duration); - // Tabulate points for the four segments that bound the axes so that we can - // map to pixel coordinates in the plot function and create a clip rect: - t.clipsegments = calcClipPath(trace._xctrl, trace._yctrl, aax, bax); + var nextFrame = { + frame: computedFrame, + name: frameList[i].name, + frameOpts: frameOpts, + transitionOpts: transitionOpts, + }; + if(i === frameList.length - 1) { + // The last frame in this .animate call stores the promise resolve + // and reject callbacks. This is how we ensure that the animation + // loop (which may exist as a result of a *different* .animate call) + // still resolves or rejecdts this .animate call's promise. once it's + // complete. + nextFrame.onComplete = callbackOnNthTime(resolve, 2); + nextFrame.onInterrupt = reject; + } - t.x = x; - t.y = y; - t.a = a; - t.b = b; + trans._frameQueue.push(nextFrame); + } - return [t]; -}; + // Set it as never having transitioned to a frame. This will cause the animation + // loop to immediately transition to the next frame (which, for immediate mode, + // is the first frame in the list since all others would have been discarded + // below) + if(animationOpts.mode === 'immediate') { + trans._lastFrameAt = -Infinity; + } -},{"../../lib":696,"../../plots/cartesian/axes":744,"../heatmap/clean_2d_array":947,"../heatmap/convert_column_xyz":949,"./array_minmax":876,"./calc_clippath":882,"./calc_gridlines":883,"./calc_labels":884,"./cheater_basis":886,"./set_convert":899,"./smooth_fill_2d_array":900}],882:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // Only it's not already running, start a RAF loop. This could be avoided in the + // case that there's only one frame, but it significantly complicated the logic + // and only sped things up by about 5% or so for a lorenz attractor simulation. + // It would be a fine thing to implement, but the benefit of that optimization + // doesn't seem worth the extra complexity. + if(!trans._animationRaf) { + beginAnimationLoop(); + } + } + function stopAnimationLoop() { + gd.emit('plotly_animated'); -'use strict'; + // Be sure to unset also since it's how we know whether a loop is already running: + window.cancelAnimationFrame(trans._animationRaf); + trans._animationRaf = null; + } -module.exports = function makeClipPath(xctrl, yctrl, aax, bax) { - var i, x, y; - var segments = []; + function nextFrame() { + if(trans._currentFrame && trans._currentFrame.onComplete) { + // Execute the callback and unset it to ensure it doesn't + // accidentally get called twice + trans._currentFrame.onComplete(); + } - var asmoothing = !!aax.smoothing; - var bsmoothing = !!bax.smoothing; - var nea1 = xctrl[0].length - 1; - var neb1 = xctrl.length - 1; - - // Along the lower a axis: - for(i = 0, x = [], y = []; i <= nea1; i++) { - x[i] = xctrl[0][i]; - y[i] = yctrl[0][i]; - } - segments.push({x: x, y: y, bicubic: asmoothing}); - - // Along the upper b axis: - for(i = 0, x = [], y = []; i <= neb1; i++) { - x[i] = xctrl[i][nea1]; - y[i] = yctrl[i][nea1]; - } - segments.push({x: x, y: y, bicubic: bsmoothing}); - - // Backwards along the upper a axis: - for(i = nea1, x = [], y = []; i >= 0; i--) { - x[nea1 - i] = xctrl[neb1][i]; - y[nea1 - i] = yctrl[neb1][i]; - } - segments.push({x: x, y: y, bicubic: asmoothing}); - - // Backwards along the lower b axis: - for(i = neb1, x = [], y = []; i >= 0; i--) { - x[neb1 - i] = xctrl[i][0]; - y[neb1 - i] = yctrl[i][0]; - } - segments.push({x: x, y: y, bicubic: bsmoothing}); + var newFrame = trans._currentFrame = trans._frameQueue.shift(); - return segments; -}; + if(newFrame) { + // Since it's sometimes necessary to do deep digging into frame data, + // we'll consider it not 100% impossible for nulls or numbers to sneak through, + // so check when casting the name, just to be absolutely certain: + var stringName = newFrame.name ? newFrame.name.toString() : null; + gd._fullLayout._currentFrame = stringName; -},{}],883:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + trans._lastFrameAt = Date.now(); + trans._timeToNext = newFrame.frameOpts.duration; -'use strict'; + // This is simply called and it's left to .transition to decide how to manage + // interrupting current transitions. That means we don't need to worry about + // how it resolves or what happens after this: + Plots.transition(gd, + newFrame.frame.data, + newFrame.frame.layout, + helpers.coerceTraceIndices(gd, newFrame.frame.traces), + newFrame.frameOpts, + newFrame.transitionOpts + ).then(function() { + if(newFrame.onComplete) { + newFrame.onComplete(); + } -var Axes = _dereq_('../../plots/cartesian/axes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; + }); -module.exports = function calcGridlines(trace, axisLetter, crossAxisLetter) { - var i, j, j0; - var eps, bounds, n1, n2, n, value, v; - var j1, v0, v1, d; - - var data = trace['_' + axisLetter]; - var axis = trace[axisLetter + 'axis']; - - var gridlines = axis._gridlines = []; - var minorgridlines = axis._minorgridlines = []; - var boundarylines = axis._boundarylines = []; - - var crossData = trace['_' + crossAxisLetter]; - var crossAxis = trace[crossAxisLetter + 'axis']; - - if(axis.tickmode === 'array') { - axis.tickvals = data.slice(); - } - - var xcp = trace._xctrl; - var ycp = trace._yctrl; - var nea = xcp[0].length; - var neb = xcp.length; - var na = trace._a.length; - var nb = trace._b.length; - - Axes.prepTicks(axis); - - // don't leave tickvals in axis looking like an attribute - if(axis.tickmode === 'array') delete axis.tickvals; - - // The default is an empty array that will cause the join to remove the gridline if - // it's just disappeared: - // axis._startline = axis._endline = []; - - // If the cross axis uses bicubic interpolation, then the grid - // lines fall once every three expanded grid row/cols: - var stride = axis.smoothing ? 3 : 1; - - function constructValueGridline(value) { - var i, j, j0, tj, pxy, i0, ti, xy, dxydi0, dxydi1, dxydj0, dxydj1; - var xpoints = []; - var ypoints = []; - var ret = {}; - // Search for the fractional grid index giving this line: - if(axisLetter === 'b') { - // For the position we use just the i-j coordinates: - j = trace.b2j(value); - - // The derivatives for catmull-rom splines are discontinuous across cell - // boundaries though, so we need to provide both the cell and the position - // within the cell separately: - j0 = Math.floor(Math.max(0, Math.min(nb - 2, j))); - tj = j - j0; + gd.emit('plotly_animatingframe', { + name: stringName, + frame: newFrame.frame, + animation: { + frame: newFrame.frameOpts, + transition: newFrame.transitionOpts, + } + }); + } else { + // If there are no more frames, then stop the RAF loop: + stopAnimationLoop(); + } + } - ret.length = nb; - ret.crossLength = na; + function beginAnimationLoop() { + gd.emit('plotly_animating'); - ret.xy = function(i) { - return trace.evalxy([], i, j); - }; + // If no timer is running, then set last frame = long ago so that the next + // frame is immediately transitioned: + trans._lastFrameAt = -Infinity; + trans._timeToNext = 0; + trans._runningTransitions = 0; + trans._currentFrame = null; - ret.dxy = function(i0, ti) { - return trace.dxydi([], i0, j0, ti, tj); - }; + var doFrame = function() { + // This *must* be requested before nextFrame since nextFrame may decide + // to cancel it if there's nothing more to animated: + trans._animationRaf = window.requestAnimationFrame(doFrame); - for(i = 0; i < na; i++) { - i0 = Math.min(na - 2, i); - ti = i - i0; - xy = trace.evalxy([], i, j); - - if(crossAxis.smoothing && i > 0) { - // First control point: - dxydi0 = trace.dxydi([], i - 1, j0, 0, tj); - xpoints.push(pxy[0] + dxydi0[0] / 3); - ypoints.push(pxy[1] + dxydi0[1] / 3); - - // Second control point: - dxydi1 = trace.dxydi([], i - 1, j0, 1, tj); - xpoints.push(xy[0] - dxydi1[0] / 3); - ypoints.push(xy[1] - dxydi1[1] / 3); + // Check if we're ready for a new frame: + if(Date.now() - trans._lastFrameAt > trans._timeToNext) { + nextFrame(); } - - xpoints.push(xy[0]); - ypoints.push(xy[1]); - - pxy = xy; - } - } else { - i = trace.a2i(value); - i0 = Math.floor(Math.max(0, Math.min(na - 2, i))); - ti = i - i0; - - ret.length = na; - ret.crossLength = nb; - - ret.xy = function(j) { - return trace.evalxy([], i, j); - }; - - ret.dxy = function(j0, tj) { - return trace.dxydj([], i0, j0, ti, tj); }; - for(j = 0; j < nb; j++) { - j0 = Math.min(nb - 2, j); - tj = j - j0; - xy = trace.evalxy([], i, j); - - if(crossAxis.smoothing && j > 0) { - // First control point: - dxydj0 = trace.dxydj([], i0, j - 1, ti, 0); - xpoints.push(pxy[0] + dxydj0[0] / 3); - ypoints.push(pxy[1] + dxydj0[1] / 3); + doFrame(); + } - // Second control point: - dxydj1 = trace.dxydj([], i0, j - 1, ti, 1); - xpoints.push(xy[0] - dxydj1[0] / 3); - ypoints.push(xy[1] - dxydj1[1] / 3); + // This is an animate-local counter that helps match up option input list + // items with the particular frame. + var configCounter = 0; + function setTransitionConfig(frame) { + if(Array.isArray(transitionOpts)) { + if(configCounter >= transitionOpts.length) { + frame.transitionOpts = transitionOpts[configCounter]; + } else { + frame.transitionOpts = transitionOpts[0]; } - - xpoints.push(xy[0]); - ypoints.push(xy[1]); - - pxy = xy; + } else { + frame.transitionOpts = transitionOpts; } + configCounter++; + return frame; } - ret.axisLetter = axisLetter; - ret.axis = axis; - ret.crossAxis = crossAxis; - ret.value = value; - ret.constvar = crossAxisLetter; - ret.index = n; - ret.x = xpoints; - ret.y = ypoints; - ret.smoothing = crossAxis.smoothing; - - return ret; - } - - function constructArrayGridline(idx) { - var j, i0, j0, ti, tj; - var xpoints = []; - var ypoints = []; - var ret = {}; - ret.length = data.length; - ret.crossLength = crossData.length; - - if(axisLetter === 'b') { - j0 = Math.max(0, Math.min(nb - 2, idx)); - tj = Math.min(1, Math.max(0, idx - j0)); + // Disambiguate what's sort of frames have been received + var i, frame; + var frameList = []; + var allFrames = frameOrGroupNameOrFrameList === undefined || frameOrGroupNameOrFrameList === null; + var isFrameArray = Array.isArray(frameOrGroupNameOrFrameList); + var isSingleFrame = !allFrames && !isFrameArray && Lib.isPlainObject(frameOrGroupNameOrFrameList); - ret.xy = function(i) { - return trace.evalxy([], i, idx); - }; + if(isSingleFrame) { + // In this case, a simple object has been passed to animate. + frameList.push({ + type: 'object', + data: setTransitionConfig(Lib.extendFlat({}, frameOrGroupNameOrFrameList)) + }); + } else if(allFrames || ['string', 'number'].indexOf(typeof frameOrGroupNameOrFrameList) !== -1) { + // In this case, null or undefined has been passed so that we want to + // animate *all* currently defined frames + for(i = 0; i < trans._frames.length; i++) { + frame = trans._frames[i]; - ret.dxy = function(i0, ti) { - return trace.dxydi([], i0, j0, ti, tj); - }; + if(!frame) continue; - // In the tickmode: array case, this operation is a simple - // transfer of data: - for(j = 0; j < nea; j++) { - xpoints[j] = xcp[idx * stride][j]; - ypoints[j] = ycp[idx * stride][j]; + if(allFrames || String(frame.group) === String(frameOrGroupNameOrFrameList)) { + frameList.push({ + type: 'byname', + name: String(frame.name), + data: setTransitionConfig({name: frame.name}) + }); + } } - } else { - i0 = Math.max(0, Math.min(na - 2, idx)); - ti = Math.min(1, Math.max(0, idx - i0)); - - ret.xy = function(j) { - return trace.evalxy([], idx, j); - }; - - ret.dxy = function(j0, tj) { - return trace.dxydj([], i0, j0, ti, tj); - }; - - // In the tickmode: array case, this operation is a simple - // transfer of data: - for(j = 0; j < neb; j++) { - xpoints[j] = xcp[j][idx * stride]; - ypoints[j] = ycp[j][idx * stride]; + } else if(isFrameArray) { + for(i = 0; i < frameOrGroupNameOrFrameList.length; i++) { + var frameOrName = frameOrGroupNameOrFrameList[i]; + if(['number', 'string'].indexOf(typeof frameOrName) !== -1) { + frameOrName = String(frameOrName); + // In this case, there's an array and this frame is a string name: + frameList.push({ + type: 'byname', + name: frameOrName, + data: setTransitionConfig({name: frameOrName}) + }); + } else if(Lib.isPlainObject(frameOrName)) { + frameList.push({ + type: 'object', + data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) + }); + } } } - ret.axisLetter = axisLetter; - ret.axis = axis; - ret.crossAxis = crossAxis; - ret.value = data[idx]; - ret.constvar = crossAxisLetter; - ret.index = idx; - ret.x = xpoints; - ret.y = ypoints; - ret.smoothing = crossAxis.smoothing; - - return ret; - } - - if(axis.tickmode === 'array') { - // var j0 = axis.startline ? 1 : 0; - // var j1 = data.length - (axis.endline ? 1 : 0); - - eps = 5e-15; - bounds = [ - Math.floor(((data.length - 1) - axis.arraytick0) / axis.arraydtick * (1 + eps)), - Math.ceil((- axis.arraytick0) / axis.arraydtick / (1 + eps)) - ].sort(function(a, b) {return a - b;}); - - // Unpack sorted values so we can be sure to avoid infinite loops if something - // is backwards: - n1 = bounds[0] - 1; - n2 = bounds[1] + 1; - - // If the axes fall along array lines, then this is a much simpler process since - // we already have all the control points we need - for(n = n1; n < n2; n++) { - j = axis.arraytick0 + axis.arraydtick * n; - if(j < 0 || j > data.length - 1) continue; - gridlines.push(extendFlat(constructArrayGridline(j), { - color: axis.gridcolor, - width: axis.gridwidth - })); - } - - for(n = n1; n < n2; n++) { - j0 = axis.arraytick0 + axis.arraydtick * n; - j1 = Math.min(j0 + axis.arraydtick, data.length - 1); - - // TODO: fix the bounds computation so we don't have to do a large range and then throw - // out unneeded numbers - if(j0 < 0 || j0 > data.length - 1) continue; - if(j1 < 0 || j1 > data.length - 1) continue; - - v0 = data[j0]; - v1 = data[j1]; - - for(i = 0; i < axis.minorgridcount; i++) { - d = j1 - j0; - - // TODO: fix the bounds computation so we don't have to do a large range and then throw - // out unneeded numbers - if(d <= 0) continue; - - // XXX: This calculation isn't quite right. Off by one somewhere? - v = v0 + (v1 - v0) * (i + 1) / (axis.minorgridcount + 1) * (axis.arraydtick / d); - - // TODO: fix the bounds computation so we don't have to do a large range and then throw - // out unneeded numbers - if(v < data[0] || v > data[data.length - 1]) continue; - minorgridlines.push(extendFlat(constructValueGridline(v), { - color: axis.minorgridcolor, - width: axis.minorgridwidth - })); + // Verify that all of these frames actually exist; return and reject if not: + 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(axis.startline) { - boundarylines.push(extendFlat(constructArrayGridline(0), { - color: axis.startlinecolor, - width: axis.startlinewidth - })); + // If the mode is either next or immediate, then all currently queued frames must + // be dumped and the corresponding .animate promises rejected. + if(['next', 'immediate'].indexOf(animationOpts.mode) !== -1) { + discardExistingFrames(); } - if(axis.endline) { - boundarylines.push(extendFlat(constructArrayGridline(data.length - 1), { - color: axis.endlinecolor, - width: axis.endlinewidth - })); - } - } else { - // If the lines do not fall along the axes, then we have to interpolate - // the contro points and so some math to figure out where the lines are - // in the first place. - - // Compute the integer boudns of tick0 + n * dtick that fall within the range - // (roughly speaking): - // Give this a nice generous epsilon. We use at as * (1 + eps) in order to make - // inequalities a little tolerant in a more or less correct manner: - eps = 5e-15; - bounds = [ - Math.floor((data[data.length - 1] - axis.tick0) / axis.dtick * (1 + eps)), - Math.ceil((data[0] - axis.tick0) / axis.dtick / (1 + eps)) - ].sort(function(a, b) {return a - b;}); - - // Unpack sorted values so we can be sure to avoid infinite loops if something - // is backwards: - n1 = bounds[0]; - n2 = bounds[1]; - - for(n = n1; n <= n2; n++) { - value = axis.tick0 + axis.dtick * n; - - gridlines.push(extendFlat(constructValueGridline(value), { - color: axis.gridcolor, - width: axis.gridwidth - })); + if(animationOpts.direction === 'reverse') { + frameList.reverse(); } - for(n = n1 - 1; n < n2 + 1; n++) { - value = axis.tick0 + axis.dtick * n; - - for(i = 0; i < axis.minorgridcount; i++) { - v = value + axis.dtick * (i + 1) / (axis.minorgridcount + 1); - if(v < data[0] || v > data[data.length - 1]) continue; - minorgridlines.push(extendFlat(constructValueGridline(v), { - color: axis.minorgridcolor, - width: axis.minorgridwidth - })); + var currentFrame = gd._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(axis.startline) { - boundarylines.push(extendFlat(constructValueGridline(data[0]), { - color: axis.startlinecolor, - width: axis.startlinewidth - })); - } - - if(axis.endline) { - boundarylines.push(extendFlat(constructValueGridline(data[data.length - 1]), { - color: axis.endlinecolor, - width: axis.endlinewidth - })); - } - } -}; - -},{"../../lib/extend":685,"../../plots/cartesian/axes":744}],884:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Axes = _dereq_('../../plots/cartesian/axes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -module.exports = function calcLabels(trace, axis) { - var i, tobj, prefix, suffix, gridline; - - var labels = axis._labels = []; - var gridlines = axis._gridlines; - - for(i = 0; i < gridlines.length; i++) { - gridline = gridlines[i]; - - if(['start', 'both'].indexOf(axis.showticklabels) !== -1) { - tobj = Axes.tickText(axis, gridline.value); - - extendFlat(tobj, { - prefix: prefix, - suffix: suffix, - endAnchor: true, - xy: gridline.xy(0), - dxy: gridline.dxy(0, 0), - axis: gridline.axis, - length: gridline.crossAxis.length, - font: gridline.axis.tickfont, - isFirst: i === 0, - isLast: i === gridlines.length - 1 - }); - - labels.push(tobj); - } - - if(['end', 'both'].indexOf(axis.showticklabels) !== -1) { - tobj = Axes.tickText(axis, gridline.value); - - extendFlat(tobj, { - endAnchor: false, - xy: gridline.xy(gridline.crossLength - 1), - dxy: gridline.dxy(gridline.crossLength - 2, 1), - axis: gridline.axis, - length: gridline.crossAxis.length, - font: gridline.axis.tickfont, - isFirst: i === 0, - isLast: i === gridlines.length - 1 - }); - - labels.push(tobj); - } - } -}; - -},{"../../lib/extend":685,"../../plots/cartesian/axes":744}],885:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/* - * Compute the tangent vector according to catmull-rom cubic splines (centripetal, - * I think). That differs from the control point in two ways: - * 1. It is a vector, not a position relative to the point - * 2. the vector is longer than the position relative to p1 by a factor of 3 - * - * Close to the boundaries, we'll use these as *quadratic control points, so that - * to make a nice grid, we'll need to divide the tangent by 2 instead of 3. (The - * math works out this way if you work through the bezier derivatives) - */ -var CatmullRomExp = 0.5; -module.exports = function makeControlPoints(p0, p1, p2, smoothness) { - var d1x = p0[0] - p1[0], - d1y = p0[1] - p1[1], - d2x = p2[0] - p1[0], - d2y = p2[1] - p1[1], - d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2), - d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2), - numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness, - numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness, - denom1 = d2a * (d1a + d2a) * 3, - denom2 = d1a * (d1a + d2a) * 3; - return [[ - p1[0] + (denom1 && numx / denom1), - p1[1] + (denom1 && numy / denom1) - ], [ - p1[0] - (denom2 && numx / denom2), - p1[1] - (denom2 && numy / denom2) - ]]; -}; - -},{}],886:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; - -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; - -/* - * Construct a 2D array of cheater values given a, b, and a slope. - * If - */ -module.exports = function(a, b, cheaterslope) { - var i, j, ascal, bscal, aval, bval; - var data = []; - - var na = isArrayOrTypedArray(a) ? a.length : a; - var nb = isArrayOrTypedArray(b) ? b.length : b; - var adata = isArrayOrTypedArray(a) ? a : null; - var bdata = isArrayOrTypedArray(b) ? b : null; - - // If we're using data, scale it so that for data that's just barely - // not evenly spaced, the switch to value-based indexing is continuous. - // This means evenly spaced data should look the same whether value - // or index cheatertype. - if(adata) { - ascal = (adata.length - 1) / (adata[adata.length - 1] - adata[0]) / (na - 1); - } - - if(bdata) { - bscal = (bdata.length - 1) / (bdata[bdata.length - 1] - bdata[0]) / (nb - 1); - } - - var xval; - var xmin = Infinity; - var xmax = -Infinity; - for(j = 0; j < nb; j++) { - data[j] = []; - bval = bdata ? (bdata[j] - bdata[0]) * bscal : j / (nb - 1); - for(i = 0; i < na; i++) { - aval = adata ? (adata[i] - adata[0]) * ascal : i / (na - 1); - xval = aval - bval * cheaterslope; - xmin = Math.min(xval, xmin); - xmax = Math.max(xval, xmax); - data[j][i] = xval; + 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; + } } - } - // Normalize cheater values to the 0-1 range. This comes into play when you have - // multiple cheater plots. After careful consideration, it seems better if cheater - // values are normalized to a consistent range. Otherwise one cheater affects the - // layout of other cheaters on the same axis. - var slope = 1.0 / (xmax - xmin); - var offset = -xmin * slope; - for(j = 0; j < nb; j++) { - for(i = 0; i < na; i++) { - data[j][i] = slope * data[j][i] + offset; + if(frameList.length > 0) { + queueFrames(frameList); + } else { + // This is the case where there were simply no frames. It's a little strange + // since there's not much to do: + gd.emit('plotly_animated'); + resolve(); } - } - - return data; + }); }; -},{"../../lib":696}],887:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var makeControlPoints = _dereq_('./catmull_rom'); -var ensureArray = _dereq_('../../lib').ensureArray; - -/* - * Turns a coarse grid into a fine grid with control points. + * Register new frames * - * Here's an ASCII representation: + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div * - * o ----- o ----- o ----- o - * | | | | - * | | | | - * | | | | - * o ----- o ----- o ----- o - * | | | | - * | | | | - * ^ | | | | - * | o ----- o ----- o ----- o - * b | | | | | - * | | | | | - * | | | | | - * o ----- o ----- o ----- o - * ------> - * a - * - * First of all, note that we want to do this in *cartesian* space. This means - * we might run into problems when there are extreme differences in x/y scaling, - * but the alternative is that the topology of the contours might actually be - * view-dependent, which seems worse. As a fallback, the only parameter that - * actually affects the result is the *aspect ratio*, so that we can at least - * improve the situation a bit without going all the way to screen coordinates. - * - * This function flattens the points + tangents into a slightly denser grid of - * *control points*. The resulting grid looks like this: - * - * 9 +--o-o--+ -o-o--+--o-o--+ - * 8 o o o o o o o o o o - * | | | | - * 7 o o o o o o o o o o - * 6 +--o-o--+ -o-o--+--o-o--+ - * 5 o o o o o o o o o o - * | | | | - * ^ 4 o o o o o o o o o o - * | 3 +--o-o--+ -o-o--+--o-o--+ - * b | 2 o o o o o o o o o o - * | | | | | - * | 1 o o o o o o o o o o - * 0 +--o-o--+ -o-o--+--o-o--+ - * 0 1 2 3 4 5 6 7 8 9 - * ------> - * a - * - * where `o`s represent newly-computed control points. the resulting dimension is - * - * (m - 1) * 3 + 1 - * = 3 * m - 2 - * - * We could simply store the tangents separately, but that's a nightmare to organize - * in two dimensions since we'll be slicing grid lines in both directions and since - * that basically requires very nearly just as much storage as just storing the dense - * grid. + * @param {array of objects} frameList + * list of frame definitions, in which each object includes any of: + * - name: {string} name of frame to add + * - data: {array of objects} trace data + * - layout {object} layout definition + * - traces {array} trace indices + * - baseframe {string} name of frame from which this frame gets defaults * - * Wow! + * @param {array of integers} indices + * an array of integer indices matching the respective frames in `frameList`. If not + * provided, an index will be provided in serial order. If already used, the frame + * will be overwritten. */ +exports.addFrames = function(gd, frameList, indices) { + gd = Lib.getGraphDiv(gd); - -/* - * Catmull-rom is biased at the boundaries toward the interior and we actually - * can't use catmull-rom to compute the control point closest to (but inside) - * the boundary. - * - * A note on plotly's spline interpolation. It uses the catmull rom control point - * closest to the boundary *as* a quadratic control point. This seems incorrect, - * so I've elected not to follow that. Given control points 0 and 1, regular plotly - * splines give *equivalent* cubic control points: - * - * Input: - * - * boundary - * | | - * p0 p2 p3 --> interior - * 0.0 0.667 1.0 - * | | - * - * Cubic-equivalent of what plotly splines draw:: - * - * boundary - * | | - * p0 p1 p2 p3 --> interior - * 0.0 0.4444 0.8888 1.0 - * | | - * - * What this function fills in: - * - * boundary - * | | - * p0 p1 p2 p3 --> interior - * 0.0 0.333 0.667 1.0 - * | | - * - * Parameters: - * p0: boundary point - * p2: catmull rom point based on computation at p3 - * p3: first grid point - * - * Of course it works whichever way it's oriented; you just need to interpret the - * input/output accordingly. - */ -function inferCubicControlPoint(p0, p2, p3) { - // Extend p1 away from p0 by 50%. This is the equivalent quadratic point that - // would give the same slope as catmull rom at p0. - var p2e0 = -0.5 * p3[0] + 1.5 * p2[0]; - var p2e1 = -0.5 * p3[1] + 1.5 * p2[1]; - - return [ - (2 * p2e0 + p0[0]) / 3, - (2 * p2e1 + p0[1]) / 3, - ]; -} - -module.exports = function computeControlPoints(xe, ye, x, y, asmoothing, bsmoothing) { - var i, j, ie, je, xej, yej, xj, yj, cp, p1; - // At this point, we know these dimensions are correct and representative of - // the whole 2D arrays: - var na = x[0].length; - var nb = x.length; - - // (n)umber of (e)xpanded points: - var nea = asmoothing ? 3 * na - 2 : na; - var neb = bsmoothing ? 3 * nb - 2 : nb; - - xe = ensureArray(xe, neb); - ye = ensureArray(ye, neb); - - for(ie = 0; ie < neb; ie++) { - xe[ie] = ensureArray(xe[ie], nea); - ye[ie] = ensureArray(ye[ie], nea); + if(frameList === null || frameList === undefined) { + return Promise.resolve(); } - // This loop fills in the X'd points: - // - // . . . . - // . . . . - // | | | | - // | | | | - // X ----- X ----- X ----- X - // | | | | - // | | | | - // | | | | - // X ----- X ----- X ----- X - // - // - // ie = (i) (e)xpanded: - for(j = 0, je = 0; j < nb; j++, je += bsmoothing ? 3 : 1) { - xej = xe[je]; - yej = ye[je]; - xj = x[j]; - yj = y[j]; - - // je = (j) (e)xpanded: - for(i = 0, ie = 0; i < na; i++, ie += asmoothing ? 3 : 1) { - xej[ie] = xj[i]; - yej[ie] = yj[i]; - } + if(!Lib.isPlotDiv(gd)) { + throw new Error( + 'This element is not a Plotly plot: ' + gd + '. It\'s likely that you\'ve failed ' + + 'to create a plot before adding frames. For more details, see ' + + 'https://plot.ly/javascript/animations/' + ); } - if(asmoothing) { - // If there's a-smoothing, this loop fills in the X'd points with catmull-rom - // control points computed along the a-axis: - // . . . . - // . . . . - // | | | | - // | | | | - // o -Y-X- o -X-X- o -X-Y- o - // | | | | - // | | | | - // | | | | - // o -Y-X- o -X-X- o -X-Y- o - // - // i: 0 1 2 3 - // ie: 0 1 3 3 4 5 6 7 8 9 - // - // ------> - // a - // - for(j = 0, je = 0; j < nb; j++, je += bsmoothing ? 3 : 1) { - // Fill in the points marked X for this a-row: - for(i = 1, ie = 3; i < na - 1; i++, ie += 3) { - cp = makeControlPoints( - [x[j][i - 1], y[j][i - 1]], - [x[j][i ], y[j][i]], - [x[j][i + 1], y[j][i + 1]], - asmoothing - ); + var i, frame, j, idx; + var _frames = gd._transitionData._frames; + var _frameHash = gd._transitionData._frameHash; - xe[je][ie - 1] = cp[0][0]; - ye[je][ie - 1] = cp[0][1]; - xe[je][ie + 1] = cp[1][0]; - ye[je][ie + 1] = cp[1][1]; - } - - // The very first cubic interpolation point (to the left for i = 1 above) is - // used as a *quadratic* interpolation point by the spline drawing function - // which isn't really correct. But for the sake of consistency, we'll use it - // as such. Since we're using cubic splines, that means we need to shorten the - // tangent by 1/3 and also construct a new cubic spline control point 1/3 from - // the original to the i = 0 point. - p1 = inferCubicControlPoint( - [xe[je][0], ye[je][0]], - [xe[je][2], ye[je][2]], - [xe[je][3], ye[je][3]] - ); - xe[je][1] = p1[0]; - ye[je][1] = p1[1]; - // Ditto last points, sans explanation: - p1 = inferCubicControlPoint( - [xe[je][nea - 1], ye[je][nea - 1]], - [xe[je][nea - 3], ye[je][nea - 3]], - [xe[je][nea - 4], ye[je][nea - 4]] - ); - xe[je][nea - 2] = p1[0]; - ye[je][nea - 2] = p1[1]; - } + if(!Array.isArray(frameList)) { + throw new Error('addFrames failure: frameList must be an Array of frame definitions' + frameList); } - if(bsmoothing) { - // If there's a-smoothing, this loop fills in the X'd points with catmull-rom - // control points computed along the b-axis: - // . . . . - // X X X X X X X X X X - // | | | | - // X X X X X X X X X X - // o -o-o- o -o-o- o -o-o- o - // X X X X X X X X X X - // | | | | - // Y Y Y Y Y Y Y Y Y Y - // o -o-o- o -o-o- o -o-o- o - // - // i: 0 1 2 3 - // ie: 0 1 3 3 4 5 6 7 8 9 - // - // ------> - // a - // - for(ie = 0; ie < nea; ie++) { - for(je = 3; je < neb - 3; je += 3) { - cp = makeControlPoints( - [xe[je - 3][ie], ye[je - 3][ie]], - [xe[je][ie], ye[je][ie]], - [xe[je + 3][ie], ye[je + 3][ie]], - bsmoothing - ); - - xe[je - 1][ie] = cp[0][0]; - ye[je - 1][ie] = cp[0][1]; - xe[je + 1][ie] = cp[1][0]; - ye[je + 1][ie] = cp[1][1]; - } - // Do the same boundary condition magic for these control points marked Y above: - p1 = inferCubicControlPoint( - [xe[0][ie], ye[0][ie]], - [xe[2][ie], ye[2][ie]], - [xe[3][ie], ye[3][ie]] - ); - xe[1][ie] = p1[0]; - ye[1][ie] = p1[1]; + // Create a sorted list of insertions since we run into lots of problems if these + // aren't in ascending order of index: + // + // Strictly for sorting. Make sure this is guaranteed to never collide with any + // already-exisisting indices: + var bigIndex = _frames.length + frameList.length * 2; - p1 = inferCubicControlPoint( - [xe[neb - 1][ie], ye[neb - 1][ie]], - [xe[neb - 3][ie], ye[neb - 3][ie]], - [xe[neb - 4][ie], ye[neb - 4][ie]] - ); - xe[neb - 2][ie] = p1[0]; - ye[neb - 2][ie] = p1[1]; - } - } + var insertions = []; + var _frameHashLocal = {}; + for(i = frameList.length - 1; i >= 0; i--) { + if(!Lib.isPlainObject(frameList[i])) continue; - if(asmoothing && bsmoothing) { - // Do one more pass, this time recomputing exactly what we just computed. - // It's overdetermined since we're peforming catmull-rom in two directions, - // so we'll just average the overdetermined. These points don't lie along the - // grid lines, so note that only grid lines will follow normal plotly spline - // interpolation. - // - // Unless of course there was no b smoothing. Then these intermediate points - // don't actually exist and this section is bypassed. - // . . . . - // o X X o X X o X X o - // | | | | - // o X X o X X o X X o - // o -o-o- o -o-o- o -o-o- o - // o X X o X X o X X o - // | | | | - // o Y Y o Y Y o Y Y o - // o -o-o- o -o-o- o -o-o- o - // - // i: 0 1 2 3 - // ie: 0 1 3 3 4 5 6 7 8 9 - // - // ------> - // a - // - for(je = 1; je < neb; je += (je + 1) % 3 === 0 ? 2 : 1) { - // Fill in the points marked X for this a-row: - for(ie = 3; ie < nea - 3; ie += 3) { - cp = makeControlPoints( - [xe[je][ie - 3], ye[je][ie - 3]], - [xe[je][ie], ye[je][ie]], - [xe[je][ie + 3], ye[je][ie + 3]], - asmoothing - ); + // The entire logic for checking for this type of name collision can be removed once we migrate to ES6 and + // use a Map instead of an Object instance, as Map keys aren't converted to strings. + var lookupName = frameList[i].name; + var name = (_frameHash[lookupName] || _frameHashLocal[lookupName] || {}).name; + var newName = frameList[i].name; + var collisionPresent = _frameHash[name] || _frameHashLocal[name]; - xe[je][ie - 1] = 0.5 * (xe[je][ie - 1] + cp[0][0]); - ye[je][ie - 1] = 0.5 * (ye[je][ie - 1] + cp[0][1]); - xe[je][ie + 1] = 0.5 * (xe[je][ie + 1] + cp[1][0]); - ye[je][ie + 1] = 0.5 * (ye[je][ie + 1] + cp[1][1]); - } + if(name && newName && typeof newName === 'number' && collisionPresent && numericNameWarningCount < numericNameWarningCountLimit) { + numericNameWarningCount++; - // This case is just slightly different. The computation is the same, - // but having computed this, we'll average with the existing result. - p1 = inferCubicControlPoint( - [xe[je][0], ye[je][0]], - [xe[je][2], ye[je][2]], - [xe[je][3], ye[je][3]] - ); - xe[je][1] = 0.5 * (xe[je][1] + p1[0]); - ye[je][1] = 0.5 * (ye[je][1] + p1[1]); + 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.'); - p1 = inferCubicControlPoint( - [xe[je][nea - 1], ye[je][nea - 1]], - [xe[je][nea - 3], ye[je][nea - 3]], - [xe[je][nea - 4], ye[je][nea - 4]] - ); - xe[je][nea - 2] = 0.5 * (xe[je][nea - 2] + p1[0]); - ye[je][nea - 2] = 0.5 * (ye[je][nea - 2] + p1[1]); + 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.'); + } } - } - return [xe, ye]; -}; + _frameHashLocal[lookupName] = {name: lookupName}; -},{"../../lib":696,"./catmull_rom":885}],888:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + insertions.push({ + frame: Plots.supplyFrameDefaults(frameList[i]), + index: (indices && indices[i] !== undefined && indices[i] !== null) ? indices[i] : bigIndex + i + }); + } + // Sort this, taking note that undefined insertions end up at the end: + insertions.sort(function(a, b) { + if(a.index > b.index) return -1; + if(a.index < b.index) return 1; + return 0; + }); -'use strict'; + var ops = []; + var revops = []; + var frameCount = _frames.length; -module.exports = { - RELATIVE_CULL_TOLERANCE: 1e-6 -}; + for(i = insertions.length - 1; i >= 0; i--) { + frame = insertions[i].frame; -},{}],889:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(typeof frame.name === 'number') { + Lib.warn('Warning: addFrames accepts frames with numeric names, but the numbers are' + + 'implicitly cast to strings'); -'use strict'; + } -/* - * Evaluates the derivative of a list of control point arrays. That is, it expects an array or arrays - * that are expanded relative to the raw data to include the bicubic control points, if applicable. If - * only linear interpolation is desired, then the data points correspond 1-1 along that axis to the - * data itself. Since it's catmull-rom splines in either direction note in particular that the - * derivatives are discontinuous across cell boundaries. That's the reason you need both the *cell* - * and the *point within the cell*. - * - * Also note that the discontinuity of the derivative is in magnitude only. The direction *is* - * continuous across cell boundaries. - * - * For example, to compute the derivative of the xcoordinate halfway betwen the 7 and 8th i-gridpoints - * and the 10th and 11th j-gridpoints given bicubic smoothing in both dimensions, you'd write: - * - * var deriv = createIDerivativeEvaluator([x], 1, 1); - * - * var dxdi = deriv([], 7, 10, 0.5, 0.5); - * // => [0.12345] - * - * Since there'd be a bunch of duplicate computation to compute multiple derivatives, you can double - * this up by providing more arrays: - * - * var deriv = createIDerivativeEvaluator([x, y], 1, 1); - * - * var dxdi = deriv([], 7, 10, 0.5, 0.5); - * // => [0.12345, 0.78910] - * - * NB: It's presumed that at this point all data has been sanitized and is valid numerical data arrays - * of the correct dimension. - */ -module.exports = function(arrays, asmoothing, bsmoothing) { - if(asmoothing && bsmoothing) { - return function(out, i0, j0, u, v) { - if(!out) out = []; - var f0, f1, f2, f3, ak, k; - - // Since it's a grid of control points, the actual indices are * 3: - i0 *= 3; - j0 *= 3; - - // Precompute some numbers: - var u2 = u * u; - var ou = 1 - u; - var ou2 = ou * ou; - var ouu2 = ou * u * 2; - var a = -3 * ou2; - var b = 3 * (ou2 - ouu2); - var c = 3 * (ouu2 - u2); - var d = 3 * u2; - - var v2 = v * v; - var v3 = v2 * v; - var ov = 1 - v; - var ov2 = ov * ov; - var ov3 = ov2 * ov; - - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - // Compute the derivatives in the u-direction: - f0 = a * ak[j0 ][i0] + b * ak[j0 ][i0 + 1] + c * ak[j0 ][i0 + 2] + d * ak[j0 ][i0 + 3]; - f1 = a * ak[j0 + 1][i0] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 1][i0 + 2] + d * ak[j0 + 1][i0 + 3]; - f2 = a * ak[j0 + 2][i0] + b * ak[j0 + 2][i0 + 1] + c * ak[j0 + 2][i0 + 2] + d * ak[j0 + 2][i0 + 3]; - f3 = a * ak[j0 + 3][i0] + b * ak[j0 + 3][i0 + 1] + c * ak[j0 + 3][i0 + 2] + d * ak[j0 + 3][i0 + 3]; + if(!frame.name) { + // Repeatedly assign a default name, incrementing the counter each time until + // we get a name that's not in the hashed lookup table: + while(_frameHash[(frame.name = 'frame ' + gd._transitionData._counter++)]); + } - // Now just interpolate in the v-direction since it's all separable: - out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3; + if(_frameHash[frame.name]) { + // If frame is present, overwrite its definition: + 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 { + // Otherwise insert it at the end of the list: + idx = Math.max(0, Math.min(insertions[i].index, frameCount)); - return out; - }; - } else if(asmoothing) { - // Handle smooth in the a-direction but linear in the b-direction by performing four - // linear interpolations followed by one cubic interpolation of the result - return function(out, i0, j0, u, v) { - if(!out) out = []; - var f0, f1, k, ak; - i0 *= 3; - var u2 = u * u; - var ou = 1 - u; - var ou2 = ou * ou; - var ouu2 = ou * u * 2; - var a = -3 * ou2; - var b = 3 * (ou2 - ouu2); - var c = 3 * (ouu2 - u2); - var d = 3 * u2; - var ov = 1 - v; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = a * ak[j0 ][i0] + b * ak[j0 ][i0 + 1] + c * ak[j0 ][i0 + 2] + d * ak[j0 ][i0 + 3]; - f1 = a * ak[j0 + 1][i0] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 1][i0 + 2] + d * ak[j0 + 1][i0 + 3]; + ops.push({type: 'insert', index: idx, value: frame}); + revops.unshift({type: 'delete', index: idx}); + frameCount++; + } + } - out[k] = ov * f0 + v * f1; - } - return out; - }; - } else if(bsmoothing) { - // Same as the above case, except reversed. I've disabled the no-unused vars rule - // so that this function is fully interpolation-agnostic. Otherwise it would need - // to be called differently in different cases. Which wouldn't be the worst, but - /* eslint-disable no-unused-vars */ - return function(out, i0, j0, u, v) { - /* eslint-enable no-unused-vars */ - if(!out) out = []; - var f0, f1, f2, f3, k, ak; - j0 *= 3; - var v2 = v * v; - var v3 = v2 * v; - var ov = 1 - v; - var ov2 = ov * ov; - var ov3 = ov2 * ov; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ak[j0][i0 + 1] - ak[j0][i0]; - f1 = ak[j0 + 1][i0 + 1] - ak[j0 + 1][i0]; - f2 = ak[j0 + 2][i0 + 1] - ak[j0 + 2][i0]; - f3 = ak[j0 + 3][i0 + 1] - ak[j0 + 3][i0]; + var undoFunc = Plots.modifyFrames; + var redoFunc = Plots.modifyFrames; + var undoArgs = [gd, revops]; + var redoArgs = [gd, ops]; - out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3; - } - return out; - }; - } else { - // Finally, both directions are linear: - /* eslint-disable no-unused-vars */ - return function(out, i0, j0, u, v) { - /* eslint-enable no-unused-vars */ - if(!out) out = []; - var f0, f1, k, ak; - var ov = 1 - v; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ak[j0][i0 + 1] - ak[j0][i0]; - f1 = ak[j0 + 1][i0 + 1] - ak[j0 + 1][i0]; + if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - out[k] = ov * f0 + v * f1; - } - return out; - }; - } + return Plots.modifyFrames(gd, ops); }; -},{}],890:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Delete frame + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + * + * @param {array of integers} frameList + * list of integer indices of frames to be deleted + */ +exports.deleteFrames = function(gd, frameList) { + gd = Lib.getGraphDiv(gd); -'use strict'; + if(!Lib.isPlotDiv(gd)) { + throw new Error('This element is not a Plotly plot: ' + gd); + } -module.exports = function(arrays, asmoothing, bsmoothing) { - if(asmoothing && bsmoothing) { - return function(out, i0, j0, u, v) { - if(!out) out = []; - var f0, f1, f2, f3, ak, k; + var i, idx; + var _frames = gd._transitionData._frames; + var ops = []; + var revops = []; - // Since it's a grid of control points, the actual indices are * 3: - i0 *= 3; - j0 *= 3; + if(!frameList) { + frameList = []; + for(i = 0; i < _frames.length; i++) { + frameList.push(i); + } + } - // Precompute some numbers: - var u2 = u * u; - var u3 = u2 * u; - var ou = 1 - u; - var ou2 = ou * ou; - var ou3 = ou2 * ou; + frameList = frameList.slice(0); + frameList.sort(); - var v2 = v * v; - var ov = 1 - v; - var ov2 = ov * ov; - var ovv2 = ov * v * 2; - var a = -3 * ov2; - var b = 3 * (ov2 - ovv2); - var c = 3 * (ovv2 - v2); - var d = 3 * v2; + 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]}); + } - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; + var undoFunc = Plots.modifyFrames; + var redoFunc = Plots.modifyFrames; + var undoArgs = [gd, revops]; + var redoArgs = [gd, ops]; - // Compute the derivatives in the v-direction: - f0 = a * ak[j0][i0] + b * ak[j0 + 1][i0] + c * ak[j0 + 2][i0] + d * ak[j0 + 3][i0]; - f1 = a * ak[j0][i0 + 1] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 2][i0 + 1] + d * ak[j0 + 3][i0 + 1]; - f2 = a * ak[j0][i0 + 2] + b * ak[j0 + 1][i0 + 2] + c * ak[j0 + 2][i0 + 2] + d * ak[j0 + 3][i0 + 2]; - f3 = a * ak[j0][i0 + 3] + b * ak[j0 + 1][i0 + 3] + c * ak[j0 + 2][i0 + 3] + d * ak[j0 + 3][i0 + 3]; + if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); - // Now just interpolate in the v-direction since it's all separable: - out[k] = ou3 * f0 + 3 * (ou2 * u * f1 + ou * u2 * f2) + u3 * f3; - } + return Plots.modifyFrames(gd, ops); +}; - return out; - }; - } else if(asmoothing) { - // Handle smooth in the a-direction but linear in the b-direction by performing four - // linear interpolations followed by one cubic interpolation of the result - return function(out, i0, j0, v, u) { - if(!out) out = []; - var f0, f1, f2, f3, k, ak; - i0 *= 3; - var u2 = u * u; - var u3 = u2 * u; - var ou = 1 - u; - var ou2 = ou * ou; - var ou3 = ou2 * ou; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - - f0 = ak[j0 + 1][i0] - ak[j0][i0]; - f1 = ak[j0 + 1][i0 + 1] - ak[j0][i0 + 1]; - f2 = ak[j0 + 1][i0 + 2] - ak[j0][i0 + 2]; - f3 = ak[j0 + 1][i0 + 3] - ak[j0][i0 + 3]; - - out[k] = ou3 * f0 + 3 * (ou2 * u * f1 + ou * u2 * f2) + u3 * f3; - - // mathematically equivalent: - // f0 = ou3 * ak[j0 ][i0] + 3 * (ou2 * u * ak[j0 ][i0 + 1] + ou * u2 * ak[j0 ][i0 + 2]) + u3 * ak[j0 ][i0 + 3]; - // f1 = ou3 * ak[j0 + 1][i0] + 3 * (ou2 * u * ak[j0 + 1][i0 + 1] + ou * u2 * ak[j0 + 1][i0 + 2]) + u3 * ak[j0 + 1][i0 + 3]; - // out[k] = f1 - f0; - } - return out; - }; - } else if(bsmoothing) { - // Same as the above case, except reversed: - /* eslint-disable no-unused-vars */ - return function(out, i0, j0, u, v) { - /* eslint-enable no-unused-vars */ - if(!out) out = []; - var f0, f1, k, ak; - j0 *= 3; - var ou = 1 - u; - var v2 = v * v; - var ov = 1 - v; - var ov2 = ov * ov; - var ovv2 = ov * v * 2; - var a = -3 * ov2; - var b = 3 * (ov2 - ovv2); - var c = 3 * (ovv2 - v2); - var d = 3 * v2; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = a * ak[j0][i0] + b * ak[j0 + 1][i0] + c * ak[j0 + 2][i0] + d * ak[j0 + 3][i0]; - f1 = a * ak[j0][i0 + 1] + b * ak[j0 + 1][i0 + 1] + c * ak[j0 + 2][i0 + 1] + d * ak[j0 + 3][i0 + 1]; +/** + * Purge a graph container div back to its initial pre-Plotly.plot state + * + * @param {string id or DOM element} gd + * the id or DOM element of the graph container div + */ +exports.purge = function purge(gd) { + gd = Lib.getGraphDiv(gd); - out[k] = ou * f0 + u * f1; - } - return out; - }; - } else { - // Finally, both directions are linear: - /* eslint-disable no-unused-vars */ - return function(out, i0, j0, v, u) { - /* eslint-enable no-unused-vars */ - if(!out) out = []; - var f0, f1, k, ak; - var ov = 1 - v; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ak[j0 + 1][i0] - ak[j0][i0]; - f1 = ak[j0 + 1][i0 + 1] - ak[j0][i0 + 1]; + var fullLayout = gd._fullLayout || {}; + var fullData = gd._fullData || []; - out[k] = ov * f0 + v * f1; - } - return out; - }; - } + // remove gl contexts + Plots.cleanPlot([], {}, fullData, fullLayout); -}; + // purge properties + Plots.purge(gd); -},{}],891:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // purge event emitter methods + Events.purge(gd); -'use strict'; + // remove plot container + if(fullLayout._container) fullLayout._container.remove(); -/* - * Return a function that evaluates a set of linear or bicubic control points. - * This will get evaluated a lot, so we'll at least do a bit of extra work to - * flatten some of the choices. In particular, we'll unroll the linear/bicubic - * combinations and we'll allow computing results in parallel to cut down - * on repeated arithmetic. - * - * Take note that we don't search for the correct range in this function. The - * reason is for consistency due to the corrresponding derivative function. In - * particular, the derivatives aren't continuous across cells, so it's important - * to be able control whether the derivative at a cell boundary is approached - * from one side or the other. - */ -module.exports = function(arrays, na, nb, asmoothing, bsmoothing) { - var imax = na - 2; - var jmax = nb - 2; - - if(asmoothing && bsmoothing) { - return function(out, i, j) { - if(!out) out = []; - var f0, f1, f2, f3, ak, k; - - var i0 = Math.max(0, Math.min(Math.floor(i), imax)); - var j0 = Math.max(0, Math.min(Math.floor(j), jmax)); - var u = Math.max(0, Math.min(1, i - i0)); - var v = Math.max(0, Math.min(1, j - j0)); - - // Since it's a grid of control points, the actual indices are * 3: - i0 *= 3; - j0 *= 3; - - // Precompute some numbers: - var u2 = u * u; - var u3 = u2 * u; - var ou = 1 - u; - var ou2 = ou * ou; - var ou3 = ou2 * ou; - - var v2 = v * v; - var v3 = v2 * v; - var ov = 1 - v; - var ov2 = ov * ov; - var ov3 = ov2 * ov; - - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ou3 * ak[j0][i0] + 3 * (ou2 * u * ak[j0][i0 + 1] + ou * u2 * ak[j0][i0 + 2]) + u3 * ak[j0][i0 + 3]; - f1 = ou3 * ak[j0 + 1][i0] + 3 * (ou2 * u * ak[j0 + 1][i0 + 1] + ou * u2 * ak[j0 + 1][i0 + 2]) + u3 * ak[j0 + 1][i0 + 3]; - f2 = ou3 * ak[j0 + 2][i0] + 3 * (ou2 * u * ak[j0 + 2][i0 + 1] + ou * u2 * ak[j0 + 2][i0 + 2]) + u3 * ak[j0 + 2][i0 + 3]; - f3 = ou3 * ak[j0 + 3][i0] + 3 * (ou2 * u * ak[j0 + 3][i0 + 1] + ou * u2 * ak[j0 + 3][i0 + 2]) + u3 * ak[j0 + 3][i0 + 3]; - out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3; - } + // in contrast to Plotly.Plots.purge which does NOT clear _context! + delete gd._context; - return out; - }; - } else if(asmoothing) { - // Handle smooth in the a-direction but linear in the b-direction by performing four - // linear interpolations followed by one cubic interpolation of the result - return function(out, i, j) { - if(!out) out = []; - - var i0 = Math.max(0, Math.min(Math.floor(i), imax)); - var j0 = Math.max(0, Math.min(Math.floor(j), jmax)); - var u = Math.max(0, Math.min(1, i - i0)); - var v = Math.max(0, Math.min(1, j - j0)); - - var f0, f1, f2, f3, k, ak; - i0 *= 3; - var u2 = u * u; - var u3 = u2 * u; - var ou = 1 - u; - var ou2 = ou * ou; - var ou3 = ou2 * ou; - var ov = 1 - v; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ov * ak[j0][i0] + v * ak[j0 + 1][i0]; - f1 = ov * ak[j0][i0 + 1] + v * ak[j0 + 1][i0 + 1]; - f2 = ov * ak[j0][i0 + 2] + v * ak[j0 + 1][i0 + 1]; - f3 = ov * ak[j0][i0 + 3] + v * ak[j0 + 1][i0 + 1]; + return gd; +}; - out[k] = ou3 * f0 + 3 * (ou2 * u * f1 + ou * u2 * f2) + u3 * f3; - } - return out; - }; - } else if(bsmoothing) { - // Same as the above case, except reversed: - return function(out, i, j) { - if(!out) out = []; - - var i0 = Math.max(0, Math.min(Math.floor(i), imax)); - var j0 = Math.max(0, Math.min(Math.floor(j), jmax)); - var u = Math.max(0, Math.min(1, i - i0)); - var v = Math.max(0, Math.min(1, j - j0)); - - var f0, f1, f2, f3, k, ak; - j0 *= 3; - var v2 = v * v; - var v3 = v2 * v; - var ov = 1 - v; - var ov2 = ov * ov; - var ov3 = ov2 * ov; - var ou = 1 - u; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ou * ak[j0][i0] + u * ak[j0][i0 + 1]; - f1 = ou * ak[j0 + 1][i0] + u * ak[j0 + 1][i0 + 1]; - f2 = ou * ak[j0 + 2][i0] + u * ak[j0 + 2][i0 + 1]; - f3 = ou * ak[j0 + 3][i0] + u * ak[j0 + 3][i0 + 1]; +// ------------------------------------------------------- +// makePlotFramework: Create the plot container and axes +// ------------------------------------------------------- +function makePlotFramework(gd) { + var gd3 = d3.select(gd); + var fullLayout = gd._fullLayout; - out[k] = ov3 * f0 + 3 * (ov2 * v * f1 + ov * v2 * f2) + v3 * f3; - } - return out; - }; - } else { - // Finally, both directions are linear: - return function(out, i, j) { - if(!out) out = []; - - var i0 = Math.max(0, Math.min(Math.floor(i), imax)); - var j0 = Math.max(0, Math.min(Math.floor(j), jmax)); - var u = Math.max(0, Math.min(1, i - i0)); - var v = Math.max(0, Math.min(1, j - j0)); - - var f0, f1, k, ak; - var ov = 1 - v; - var ou = 1 - u; - for(k = 0; k < arrays.length; k++) { - ak = arrays[k]; - f0 = ou * ak[j0][i0] + u * ak[j0][i0 + 1]; - f1 = ou * ak[j0 + 1][i0] + u * ak[j0 + 1][i0 + 1]; + // Plot container + fullLayout._container = gd3.selectAll('.plot-container').data([0]); + fullLayout._container.enter().insert('div', ':first-child') + .classed('plot-container', true) + .classed('plotly', true); - out[k] = ov * f0 + v * f1; - } - return out; - }; - } + // Make the svg container + fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); + fullLayout._paperdiv.enter().append('div') + .classed('svg-container', true) + .style('position', 'relative'); -}; + // Make the graph containers + // start fresh each time we get here, so we know the order comes out + // right, rather than enter/exit which can muck up the order + // TODO: sort out all the ordering so we don't have to + // explicitly delete anything + // FIXME: parcoords reuses this object, not the best pattern + fullLayout._glcontainer = fullLayout._paperdiv.selectAll('.gl-container') + .data([{}]); -},{}],892:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + fullLayout._glcontainer.enter().append('div') + .classed('gl-container', true); + fullLayout._paperdiv.selectAll('.main-svg').remove(); -'use strict'; + fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child') + .classed('main-svg', true); -var Lib = _dereq_('../../lib'); -var handleXYDefaults = _dereq_('./xy_defaults'); -var handleABDefaults = _dereq_('./ab_defaults'); -var attributes = _dereq_('./attributes'); -var colorAttrs = _dereq_('../../components/color/attributes'); + fullLayout._toppaper = fullLayout._paperdiv.append('svg') + .classed('main-svg', true); -module.exports = function supplyDefaults(traceIn, traceOut, dfltColor, fullLayout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + if(!fullLayout._uid) { + var otherUids = {}; + d3.selectAll('defs').each(function() { + if(this.id) otherUids[this.id.split('-')[1]] = 1; + }); + fullLayout._uid = Lib.randstr(otherUids); } - traceOut._clipPathId = 'clip' + traceOut.uid + 'carpet'; + fullLayout._paperdiv.selectAll('.main-svg') + .attr(xmlnsNamespaces.svgAttrs); - var defaultColor = coerce('color', colorAttrs.defaultLine); - Lib.coerceFont(coerce, 'font'); + fullLayout._defs = fullLayout._paper.append('defs') + .attr('id', 'defs-' + fullLayout._uid); - coerce('carpet'); + fullLayout._clips = fullLayout._defs.append('g') + .classed('clips', true); - handleABDefaults(traceIn, traceOut, fullLayout, coerce, defaultColor); + fullLayout._topdefs = fullLayout._toppaper.append('defs') + .attr('id', 'topdefs-' + fullLayout._uid); - if(!traceOut.a || !traceOut.b) { - traceOut.visible = false; - return; - } + fullLayout._topclips = fullLayout._topdefs.append('g') + .classed('clips', true); - if(traceOut.a.length < 3) { - traceOut.aaxis.smoothing = 0; - } + fullLayout._bgLayer = fullLayout._paper.append('g') + .classed('bglayer', true); - if(traceOut.b.length < 3) { - traceOut.baxis.smoothing = 0; - } + fullLayout._draggers = fullLayout._paper.append('g') + .classed('draglayer', true); - // NB: the input is x/y arrays. You should know that the *first* dimension of x and y - // corresponds to b and the second to a. This sounds backwards but ends up making sense - // the important part to know is that when you write y[j][i], j goes from 0 to b.length - 1 - // and i goes from 0 to a.length - 1. - var validData = handleXYDefaults(traceIn, traceOut, coerce); - if(!validData) { - traceOut.visible = false; - } + // lower shape/image layer - note that this is behind + // all subplots data/grids but above the backgrounds + // except inset subplots, whose backgrounds are drawn + // inside their own group so that they appear above + // the data for the main subplot + // lower shapes and images which are fully referenced to + // a subplot still get drawn within the subplot's group + // so they will work correctly on insets + 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); - if(traceOut._cheater) { - coerce('cheaterslope'); - } -}; + // single cartesian layer for the whole plot + fullLayout._cartesianlayer = fullLayout._paper.append('g').classed('cartesianlayer', true); -},{"../../components/color/attributes":569,"../../lib":696,"./ab_defaults":875,"./attributes":877,"./xy_defaults":901}],893:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // single polar layer for the whole plot + fullLayout._polarlayer = fullLayout._paper.append('g').classed('polarlayer', true); + // single ternary layer for the whole plot + fullLayout._ternarylayer = fullLayout._paper.append('g').classed('ternarylayer', true); -'use strict'; + // single geo layer for the whole plot + fullLayout._geolayer = fullLayout._paper.append('g').classed('geolayer', true); -var Carpet = {}; + // single pie layer for the whole plot + fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true); -Carpet.attributes = _dereq_('./attributes'); -Carpet.supplyDefaults = _dereq_('./defaults'); -Carpet.plot = _dereq_('./plot'); -Carpet.calc = _dereq_('./calc'); -Carpet.animatable = true; -Carpet.isContainer = true; // so carpet traces get `calc` before other traces + // fill in image server scrape-svg + fullLayout._glimages = fullLayout._paper.append('g').classed('glimages', true); -Carpet.moduleType = 'trace'; -Carpet.name = 'carpet'; -Carpet.basePlotModule = _dereq_('../../plots/cartesian'); -Carpet.categories = ['cartesian', 'svg', 'carpet', 'carpetAxis', 'notLegendIsolatable']; -Carpet.meta = { - -}; + // lastly upper shapes, info (legend, annotations) and hover layers go on top + // these are in a different svg element normally, but get collapsed into a single + // svg when exporting (after inserting 3D) + // upper shapes/images are only those drawn above the whole plot, including subplots + 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._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._toppaper.append('g').classed('hoverlayer', true); -module.exports = Carpet; + gd.emit('plotly_framework'); +} -},{"../../plots/cartesian":756,"./attributes":877,"./calc":881,"./defaults":892,"./plot":898}],894:[function(_dereq_,module,exports){ +},{"../components/color":43,"../components/colorbar/connect":45,"../components/drawing":64,"../constants/xmlns_namespaces":141,"../lib":159,"../lib/events":152,"../lib/queue":173,"../lib/svg_text_utils":180,"../plots/cartesian/axes":203,"../plots/cartesian/constants":209,"../plots/cartesian/graph_interact":213,"../plots/plots":236,"../plots/polar/legacy":239,"../registry":243,"./edit_types":186,"./helpers":187,"./manage_arrays":189,"./plot_config":191,"./plot_schema":192,"./subroutines":194,"d3":8,"fast-isnumeric":10,"has-hover":12}],191:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -143485,144 +45248,292 @@ 'use strict'; -/* - * Given a trace, look up the carpet axis by carpet. +/** + * This will be transferred over to gd and overridden by + * config args to Plotly.plot. + * + * The defaults are the appropriate settings for plotly.js, + * so we get the right experience without any config argument. + * + * N.B. the config options are not coerced using Lib.coerce so keys + * like `valType` and `values` are only set for documentation purposes + * at the moment. */ -module.exports = function(gd, trace) { - var n = gd._fullData.length; - var firstAxis; - for(var i = 0; i < n; i++) { - var maybeCarpet = gd._fullData[i]; - if(maybeCarpet.index === trace.index) continue; +var configAttributes = { + staticPlot: { + valType: 'boolean', + dflt: false, + + }, - if(maybeCarpet.type === 'carpet') { - if(!firstAxis) { - firstAxis = maybeCarpet; - } + plotlyServerURL: { + valType: 'string', + dflt: 'https://plot.ly', + + }, - if(maybeCarpet.carpet === trace.carpet) { - return maybeCarpet; - } + editable: { + valType: 'boolean', + dflt: false, + + }, + edits: { + annotationPosition: { + valType: 'boolean', + dflt: false, + + }, + annotationTail: { + valType: 'boolean', + dflt: false, + + }, + annotationText: { + valType: 'boolean', + dflt: false, + + }, + axisTitleText: { + valType: 'boolean', + dflt: false, + + }, + colorbarPosition: { + valType: 'boolean', + dflt: false, + + }, + colorbarTitleText: { + valType: 'boolean', + dflt: false, + + }, + legendPosition: { + valType: 'boolean', + dflt: false, + + }, + legendText: { + valType: 'boolean', + dflt: false, + + }, + shapePosition: { + valType: 'boolean', + dflt: false, + + }, + titleText: { + valType: 'boolean', + dflt: false, + } - } + }, - return firstAxis; -}; + autosizable: { + valType: 'boolean', + dflt: false, + + }, + responsive: { + valType: 'boolean', + dflt: false, + + }, + fillFrame: { + valType: 'boolean', + dflt: false, + + }, + frameMargins: { + valType: 'number', + dflt: 0, + min: 0, + max: 0.5, + + }, -},{}],895:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + scrollZoom: { + valType: 'flaglist', + flags: ['cartesian', 'gl3d', 'geo', 'mapbox'], + extras: [true, false], + dflt: 'gl3d+geo+mapbox', + + }, + doubleClick: { + valType: 'enumerated', + values: [false, 'reset', 'autosize', 'reset+autosize'], + dflt: 'reset+autosize', + + }, -'use strict'; + showAxisDragHandles: { + valType: 'boolean', + dflt: true, + + }, + showAxisRangeEntryBoxes: { + valType: 'boolean', + dflt: true, + + }, -module.exports = function makePath(xp, yp, isBicubic) { - // Prevent d3 errors that would result otherwise: - if(xp.length === 0) return ''; + showTips: { + valType: 'boolean', + dflt: true, + + }, - var i, path = []; - var stride = isBicubic ? 3 : 1; - for(i = 0; i < xp.length; i += stride) { - path.push(xp[i] + ',' + yp[i]); + showLink: { + valType: 'boolean', + dflt: false, + + }, + linkText: { + valType: 'string', + dflt: 'Edit chart', + noBlank: true, + + }, + sendData: { + valType: 'boolean', + dflt: true, + + }, + showSources: { + valType: 'any', + dflt: false, + + }, - if(isBicubic && i < xp.length - stride) { - path.push('C'); - path.push([ - xp[i + 1] + ',' + yp[i + 1], - xp[i + 2] + ',' + yp[i + 2] + ' ', - ].join(' ')); - } - } - return path.join(isBicubic ? '' : 'L'); -}; + displayModeBar: { + valType: 'enumerated', + values: ['hover', true, false], + dflt: 'hover', + + }, + showSendToCloud: { + valType: 'boolean', + dflt: false, + + }, + modeBarButtonsToRemove: { + valType: 'any', + dflt: [], + + }, + modeBarButtonsToAdd: { + valType: 'any', + dflt: [], + + }, + modeBarButtons: { + valType: 'any', + dflt: false, + + }, + toImageButtonOptions: { + valType: 'any', + dflt: {}, + + }, + displaylogo: { + valType: 'boolean', + dflt: true, + + }, + watermark: { + valType: 'boolean', + dflt: false, + + }, -},{}],896:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + plotGlPixelRatio: { + valType: 'number', + dflt: 2, + min: 1, + max: 4, + + }, -'use strict'; + setBackground: { + valType: 'any', + dflt: 'transparent', + + }, -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; + topojsonURL: { + valType: 'string', + noBlank: true, + dflt: 'https://cdn.plot.ly/', + + }, -/* - * Map an array of x or y coordinates (c) to screen-space pixel coordinates (p). - * The output array is optional, but if provided, it will be reused without - * reallocation to the extent possible. - */ -module.exports = function mapArray(out, data, func) { - var i; + mapboxAccessToken: { + valType: 'string', + dflt: null, + + }, + + logging: { + valType: 'boolean', + dflt: 1, + + }, + + queueLength: { + valType: 'integer', + min: 0, + dflt: 0, + + }, - if(!isArrayOrTypedArray(out)) { - // If not an array, make it an array: - out = []; - } else if(out.length > data.length) { - // If too long, truncate. (If too short, it will grow - // automatically so we don't care about that case) - out = out.slice(0, data.length); - } + globalTransforms: { + valType: 'any', + dflt: [], + + }, - for(i = 0; i < data.length; i++) { - out[i] = func(data[i]); - } + locale: { + valType: 'string', + dflt: 'en-US', + + }, - return out; + locales: { + valType: 'any', + dflt: {}, + + } }; -},{"../../lib":696}],897:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -module.exports = function orientText(trace, xaxis, yaxis, xy, dxy, refDxy) { - var dx = dxy[0] * trace.dpdx(xaxis); - var dy = dxy[1] * trace.dpdy(yaxis); - var flip = 1; +var dfltConfig = {}; - var offsetMultiplier = 1.0; - if(refDxy) { - var l1 = Math.sqrt(dxy[0] * dxy[0] + dxy[1] * dxy[1]); - var l2 = Math.sqrt(refDxy[0] * refDxy[0] + refDxy[1] * refDxy[1]); - var dot = (dxy[0] * refDxy[0] + dxy[1] * refDxy[1]) / l1 / l2; - offsetMultiplier = Math.max(0.0, dot); +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]); + } } +} - var angle = Math.atan2(dy, dx) * 180 / Math.PI; - if(angle < -90) { - angle += 180; - flip = -flip; - } else if(angle > 90) { - angle -= 180; - flip = -flip; - } +crawl(configAttributes, dfltConfig); - return { - angle: angle, - flip: flip, - p: trace.c2p(xy, xaxis, yaxis), - offsetMultplier: offsetMultiplier - }; +module.exports = { + configAttributes: configAttributes, + dfltConfig: dfltConfig }; -},{}],898:[function(_dereq_,module,exports){ +},{}],192:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -143632,1058 +45543,686 @@ 'use strict'; -var d3 = _dereq_('d3'); -var Drawing = _dereq_('../../components/drawing'); -var map1dArray = _dereq_('./map_1d_array'); -var makepath = _dereq_('./makepath'); -var orientText = _dereq_('./orient_text'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var Lib = _dereq_('../../lib'); -var alignmentConstants = _dereq_('../../constants/alignment'); - -module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - var fullLayout = gd._fullLayout; - var clipLayer = fullLayout._clips; - - Lib.makeTraceGroups(carpetLayer, cdcarpet, 'trace').each(function(cd) { - var axisLayer = d3.select(this); - var cd0 = cd[0]; - var trace = cd0.trace; - var aax = trace.aaxis; - var bax = trace.baxis; - - var minorLayer = Lib.ensureSingle(axisLayer, 'g', 'minorlayer'); - var majorLayer = Lib.ensureSingle(axisLayer, 'g', 'majorlayer'); - var boundaryLayer = Lib.ensureSingle(axisLayer, 'g', 'boundarylayer'); - var labelLayer = Lib.ensureSingle(axisLayer, 'g', 'labellayer'); - - axisLayer.style('opacity', trace.opacity); - - drawGridLines(xa, ya, majorLayer, aax, 'a', aax._gridlines, true); - drawGridLines(xa, ya, majorLayer, bax, 'b', bax._gridlines, true); - drawGridLines(xa, ya, minorLayer, aax, 'a', aax._minorgridlines, true); - drawGridLines(xa, ya, minorLayer, bax, 'b', bax._minorgridlines, true); - - // NB: These are not ommitted if the lines are not active. The joins must be executed - // in order for them to get cleaned up without a full redraw - drawGridLines(xa, ya, boundaryLayer, aax, 'a-boundary', aax._boundarylines); - drawGridLines(xa, ya, boundaryLayer, bax, 'b-boundary', bax._boundarylines); - - var labelOrientationA = drawAxisLabels(gd, xa, ya, trace, cd0, labelLayer, aax._labels, 'a-label'); - var labelOrientationB = drawAxisLabels(gd, xa, ya, trace, cd0, labelLayer, bax._labels, 'b-label'); - - drawAxisTitles(gd, labelLayer, trace, cd0, xa, ya, labelOrientationA, labelOrientationB); - - drawClipPath(trace, cd0, clipLayer, xa, ya); - }); -}; - -function drawClipPath(trace, t, layer, xaxis, yaxis) { - var seg, xp, yp, i; - - var clip = layer.select('#' + trace._clipPathId); - - if(!clip.size()) { - clip = layer.append('clipPath') - .classed('carpetclip', true); - } - - var path = Lib.ensureSingle(clip, 'path', 'carpetboundary'); - var segments = t.clipsegments; - var segs = []; - - for(i = 0; i < segments.length; i++) { - seg = segments[i]; - xp = map1dArray([], seg.x, xaxis.c2p); - yp = map1dArray([], seg.y, yaxis.c2p); - segs.push(makepath(xp, yp, seg.bicubic)); - } +var Registry = _dereq_('../registry'); +var Lib = _dereq_('../lib'); - // This could be optimized ever so slightly to avoid no-op L segments - // at the corners, but it's so negligible that I don't think it's worth - // the extra complexity - var clipPathData = 'M' + segs.join('L') + 'Z'; - clip.attr('id', trace._clipPathId); - path.attr('d', clipPathData); -} +var baseAttributes = _dereq_('../plots/attributes'); +var baseLayoutAttributes = _dereq_('../plots/layout_attributes'); +var frameAttributes = _dereq_('../plots/frame_attributes'); +var animationAttributes = _dereq_('../plots/animation_attributes'); +var configAttributes = _dereq_('./plot_config').configAttributes; -function drawGridLines(xaxis, yaxis, layer, axis, axisLetter, gridlines) { - var lineClass = 'const-' + axisLetter + '-lines'; - var gridJoin = layer.selectAll('.' + lineClass).data(gridlines); +// polar attributes are not part of the Registry yet +var polarAreaAttrs = _dereq_('../plots/polar/legacy/area_attributes'); +var polarAxisAttrs = _dereq_('../plots/polar/legacy/axis_attributes'); - gridJoin.enter().append('path') - .classed(lineClass, true) - .style('vector-effect', 'non-scaling-stroke'); +var editTypes = _dereq_('./edit_types'); - gridJoin.each(function(d) { - var gridline = d; - var x = gridline.x; - var y = gridline.y; +var extendFlat = Lib.extendFlat; +var extendDeepAll = Lib.extendDeepAll; +var isPlainObject = Lib.isPlainObject; - var xp = map1dArray([], x, xaxis.c2p); - var yp = map1dArray([], y, yaxis.c2p); +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]; - var path = 'M' + makepath(xp, yp, gridline.smoothing); +exports.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; +exports.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; +exports.DEPRECATED = DEPRECATED; +exports.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; - var el = d3.select(this); +/** Outputs the full plotly.js plot schema + * + * @return {object} + * - defs + * - traces + * - layout + * - transforms + * - frames + * - animations + * - config + */ +exports.get = function() { + var traces = {}; - el.attr('d', path) - .style('stroke-width', gridline.width) - .style('stroke', gridline.color) - .style('fill', 'none'); + Registry.allTypes.concat('area').forEach(function(type) { + traces[type] = getTraceAttributes(type); }); - gridJoin.exit().remove(); -} - -function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) { - var labelJoin = layer.selectAll('text.' + labelClass).data(labels); - - labelJoin.enter().append('text') - .classed(labelClass, true); - - var maxExtent = 0; - var labelOrientation = {}; - - labelJoin.each(function(label, i) { - // Most of the positioning is done in calc_labels. Only the parts that depend upon - // the screen space representation of the x and y axes are here: - var orientation; - if(label.axis.tickangle === 'auto') { - orientation = orientText(trace, xaxis, yaxis, label.xy, label.dxy); - } else { - var angle = (label.axis.tickangle + 180.0) * Math.PI / 180.0; - orientation = orientText(trace, xaxis, yaxis, label.xy, [Math.cos(angle), Math.sin(angle)]); - } - - if(!i) { - // TODO: offsetMultiplier? Not currently used anywhere... - labelOrientation = {angle: orientation.angle, flip: orientation.flip}; - } - var direction = (label.endAnchor ? -1 : 1) * orientation.flip; - - var labelEl = d3.select(this) - .attr({ - 'text-anchor': direction > 0 ? 'start' : 'end', - 'data-notex': 1 - }) - .call(Drawing.font, label.font) - .text(label.text) - .call(svgTextUtils.convertToTspans, gd); - - var bbox = Drawing.bBox(this); - - labelEl.attr('transform', - // Translate to the correct point: - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + - // Rotate to line up with grid line tangent: - 'rotate(' + orientation.angle + ')' + - // Adjust the baseline and indentation: - 'translate(' + label.axis.labelpadding * direction + ',' + bbox.height * 0.3 + ')' - ); + var transforms = {}; - maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding); + Object.keys(Registry.transformsRegistry).forEach(function(type) { + transforms[type] = getTransformAttributes(type); }); - labelJoin.exit().remove(); - - labelOrientation.maxExtent = maxExtent; - return labelOrientation; -} - -function drawAxisTitles(gd, layer, trace, t, xa, ya, labelOrientationA, labelOrientationB) { - var a, b, xy, dxy; - - a = 0.5 * (trace.a[0] + trace.a[trace.a.length - 1]); - b = trace.b[0]; - xy = trace.ab2xy(a, b, true); - dxy = trace.dxyda_rough(a, b); - if(labelOrientationA.angle === undefined) { - Lib.extendFlat(labelOrientationA, orientText(trace, xa, ya, xy, trace.dxydb_rough(a, b))); - } - drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.aaxis, xa, ya, labelOrientationA, 'a-title'); - - a = trace.a[0]; - b = 0.5 * (trace.b[0] + trace.b[trace.b.length - 1]); - xy = trace.ab2xy(a, b, true); - dxy = trace.dxydb_rough(a, b); - if(labelOrientationB.angle === undefined) { - Lib.extendFlat(labelOrientationB, orientText(trace, xa, ya, xy, trace.dxyda_rough(a, b))); - } - drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.baxis, xa, ya, labelOrientationB, 'b-title'); -} + return { + defs: { + valObjects: Lib.valObjectMeta, + metaKeys: UNDERSCORE_ATTRS.concat(['description', 'role', 'editType', 'impliedEdits']), + editType: { + traces: editTypes.traces, + layout: editTypes.layout + }, + impliedEdits: { + + } + }, -var lineSpacing = alignmentConstants.LINE_SPACING; -var midShift = ((1 - alignmentConstants.MID_SHIFT) / lineSpacing) + 1; + traces: traces, + layout: getLayoutAttributes(), -function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientation, labelClass) { - var data = []; - if(axis.title) data.push(axis.title); - var titleJoin = layer.selectAll('text.' + labelClass).data(data); - var offset = labelOrientation.maxExtent; + transforms: transforms, - titleJoin.enter().append('text') - .classed(labelClass, true); + frames: getFramesAttributes(), + animation: formatAttributes(animationAttributes), - // There's only one, but we'll do it as a join so it's updated nicely: - titleJoin.each(function() { - var orientation = orientText(trace, xa, ya, xy, dxy); + config: formatAttributes(configAttributes) + }; +}; - if(['start', 'both'].indexOf(axis.showticklabels) === -1) { - offset = 0; - } +/** + * Crawl the attribute tree, recursively calling a callback function + * + * @param {object} attrs + * The node of the attribute tree (e.g. the root) from which recursion originates + * @param {Function} callback + * A callback function with the signature: + * @callback callback + * @param {object} attr an attribute + * @param {String} attrName name string + * @param {object[]} attrs all the attributes + * @param {Number} level the recursion level, 0 at the root + * @param {String} fullAttrString full attribute name (ie 'marker.line') + * @param {Number} [specifiedLevel] + * The level in the tree, in order to let the callback function detect descend or backtrack, + * typically unsupplied (implied 0), just used by the self-recursive call. + * The necessity arises because the tree traversal is not controlled by callback return values. + * The decision to not use callback return values for controlling tree pruning arose from + * the goal of keeping the crawler backwards compatible. Observe that one of the pruning conditions + * precedes the callback call. + * @param {string} [attrString] + * the path to the current attribute, as an attribute string (ie 'marker.line') + * typically unsupplied, but you may supply it if you want to disambiguate which attrs tree you + * are starting from + * + * @return {object} transformOut + * copy of transformIn that contains attribute defaults + */ +exports.crawl = function(attrs, callback, specifiedLevel, attrString) { + var level = specifiedLevel || 0; + attrString = attrString || ''; - // In addition to the size of the labels, add on some extra padding: - var titleSize = axis.titlefont.size; - offset += titleSize + axis.titleoffset; + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; - var labelNorm = labelOrientation.angle + (labelOrientation.flip < 0 ? 180 : 0); - var angleDiff = (labelNorm - orientation.angle + 450) % 360; - var reverseTitle = angleDiff > 90 && angleDiff < 270; + if(UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; - var el = d3.select(this); + var fullAttrString = (attrString ? attrString + '.' : '') + attrName; + callback(attr, attrName, attrs, level, fullAttrString); - el.text(axis.title || '') - .call(svgTextUtils.convertToTspans, gd); + if(exports.isValObject(attr)) return; - if(reverseTitle) { - offset = (-svgTextUtils.lineCount(el) + midShift) * lineSpacing * titleSize - offset; + if(isPlainObject(attr) && attrName !== 'impliedEdits') { + exports.crawl(attr, callback, level + 1, fullAttrString); } - - el.attr('transform', - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + - 'rotate(' + orientation.angle + ') ' + - 'translate(0,' + offset + ')' - ) - .classed('user-select-none', true) - .attr('text-anchor', 'middle') - .call(Drawing.font, axis.titlefont); }); +}; - titleJoin.exit().remove(); -} +/** Is object a value object (or a container object)? + * + * @param {object} obj + * @return {boolean} + * returns true for a valid value object and + * false for tree nodes in the attribute hierarchy + */ +exports.isValObject = function(obj) { + return obj && obj.valType !== undefined; +}; -},{"../../components/drawing":595,"../../constants/alignment":668,"../../lib":696,"../../lib/svg_text_utils":720,"./makepath":895,"./map_1d_array":896,"./orient_text":897,"d3":148}],899:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var constants = _dereq_('./constants'); -var search = _dereq_('../../lib/search').findBin; -var computeControlPoints = _dereq_('./compute_control_points'); -var createSplineEvaluator = _dereq_('./create_spline_evaluator'); -var createIDerivativeEvaluator = _dereq_('./create_i_derivative_evaluator'); -var createJDerivativeEvaluator = _dereq_('./create_j_derivative_evaluator'); - -/* - * Create conversion functions to go from one basis to another. In particular the letter - * abbreviations are: + * Find all data array attributes in a given trace object - including + * `arrayOk` attributes. * - * i: i/j coordinates along the grid. Integer values correspond to data points - * a: real-valued coordinates along the a/b axes - * c: cartesian x-y coordinates - * p: screen-space pixel coordinates - */ -module.exports = function setConvert(trace) { - var a = trace._a; - var b = trace._b; - var na = a.length; - var nb = b.length; - var aax = trace.aaxis; - var bax = trace.baxis; - - // Grab the limits once rather than recomputing the bounds for every point - // independently: - var amin = a[0]; - var amax = a[na - 1]; - var bmin = b[0]; - var bmax = b[nb - 1]; - var arange = a[a.length - 1] - a[0]; - var brange = b[b.length - 1] - b[0]; - - // Compute the tolerance so that points are visible slightly outside the - // defined carpet axis: - var atol = arange * constants.RELATIVE_CULL_TOLERANCE; - var btol = brange * constants.RELATIVE_CULL_TOLERANCE; - - // Expand the limits to include the relative tolerance: - amin -= atol; - amax += atol; - bmin -= btol; - bmax += btol; - - trace.isVisible = function(a, b) { - return a > amin && a < amax && b > bmin && b < bmax; - }; - - trace.isOccluded = function(a, b) { - return a < amin || a > amax || b < bmin || b > bmax; - }; - - trace.setScale = function() { - var x = trace._x; - var y = trace._y; - - // This is potentially a very expensive step! It does the bulk of the work of constructing - // an expanded basis of control points. Note in particular that it overwrites the existing - // basis without creating a new array since that would potentially thrash the garbage - // collector. - var result = computeControlPoints(trace._xctrl, trace._yctrl, x, y, aax.smoothing, bax.smoothing); - trace._xctrl = result[0]; - trace._yctrl = result[1]; - - // This step is the second step in the process, but it's somewhat simpler. It just unrolls - // some logic since it would be unnecessarily expensive to compute both interpolations - // nearly identically but separately and to include a bunch of linear vs. bicubic logic in - // every single call. - trace.evalxy = createSplineEvaluator([trace._xctrl, trace._yctrl], na, nb, aax.smoothing, bax.smoothing); - - trace.dxydi = createIDerivativeEvaluator([trace._xctrl, trace._yctrl], aax.smoothing, bax.smoothing); - trace.dxydj = createJDerivativeEvaluator([trace._xctrl, trace._yctrl], aax.smoothing, bax.smoothing); - }; - - /* - * Convert from i/j data grid coordinates to a/b values. Note in particular that this - * is *linear* interpolation, even if the data is interpolated bicubically. - */ - trace.i2a = function(i) { - var i0 = Math.max(0, Math.floor(i[0]), na - 2); - var ti = i[0] - i0; - return (1 - ti) * a[i0] + ti * a[i0 + 1]; - }; - - trace.j2b = function(j) { - var j0 = Math.max(0, Math.floor(j[1]), na - 2); - var tj = j[1] - j0; - return (1 - tj) * b[j0] + tj * b[j0 + 1]; - }; - - trace.ij2ab = function(ij) { - return [trace.i2a(ij[0]), trace.j2b(ij[1])]; - }; + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * + * @return {array} arrayAttributes + * list of array attributes for the given trace + */ +exports.findArrayAttributes = function(trace) { + var arrayAttributes = []; + var stack = []; + var isArrayStack = []; + var baseContainer, baseAttrName; - /* - * Convert from a/b coordinates to i/j grid-numbered coordinates. This requires searching - * through the a/b data arrays and assumes they are monotonic, which is presumed to have - * been enforced already. - */ - trace.a2i = function(aval) { - var i0 = Math.max(0, Math.min(search(aval, a), na - 2)); - var a0 = a[i0]; - var a1 = a[i0 + 1]; - return Math.max(0, Math.min(na - 1, i0 + (aval - a0) / (a1 - a0))); - }; - - trace.b2j = function(bval) { - var j0 = Math.max(0, Math.min(search(bval, b), nb - 2)); - var b0 = b[j0]; - var b1 = b[j0 + 1]; - return Math.max(0, Math.min(nb - 1, j0 + (bval - b0) / (b1 - b0))); - }; + function callback(attr, attrName, attrs, level) { + stack = stack.slice(0, level).concat([attrName]); + isArrayStack = isArrayStack.slice(0, level).concat([attr && attr._isLinkedToArray]); - trace.ab2ij = function(ab) { - return [trace.a2i(ab[0]), trace.b2j(ab[1])]; - }; + var splittableAttr = ( + attr && + (attr.valType === 'data_array' || attr.arrayOk === true) && + !(stack[level - 1] === 'colorbar' && (attrName === 'ticktext' || attrName === 'tickvals')) + ); - /* - * Convert from i/j coordinates to x/y caretesian coordinates. This means either bilinear - * or bicubic spline evaluation, but the hard part is already done at this point. - */ - trace.i2c = function(i, j) { - return trace.evalxy([], i, j); - }; + // Manually exclude 'colorbar.tickvals' and 'colorbar.ticktext' for now + // which are declared as `valType: 'data_array'` but scale independently of + // the coordinate arrays. + // + // Down the road, we might want to add a schema field (e.g `uncorrelatedArray: true`) + // to distinguish attributes of the likes. - trace.ab2xy = function(aval, bval, extrapolate) { - if(!extrapolate && (aval < a[0] || aval > a[na - 1] | bval < b[0] || bval > b[nb - 1])) { - return [false, false]; - } - var i = trace.a2i(aval); - var j = trace.b2j(bval); - - var pt = trace.evalxy([], i, j); - - if(extrapolate) { - // This section uses the boundary derivatives to extrapolate linearly outside - // the defined range. Consider a scatter line with one point inside the carpet - // axis and one point outside. If we don't extrapolate, we can't draw the line - // at all. - var iex = 0; - var jex = 0; - var der = []; + if(!splittableAttr) return; - var i0, ti, j0, tj; - if(aval < a[0]) { - i0 = 0; - ti = 0; - iex = (aval - a[0]) / (a[1] - a[0]); - } else if(aval > a[na - 1]) { - i0 = na - 2; - ti = 1; - iex = (aval - a[na - 1]) / (a[na - 1] - a[na - 2]); - } else { - i0 = Math.max(0, Math.min(na - 2, Math.floor(i))); - ti = i - i0; - } + crawlIntoTrace(baseContainer, 0, ''); + } - if(bval < b[0]) { - j0 = 0; - tj = 0; - jex = (bval - b[0]) / (b[1] - b[0]); - } else if(bval > b[nb - 1]) { - j0 = nb - 2; - tj = 1; - jex = (bval - b[nb - 1]) / (b[nb - 1] - b[nb - 2]); - } else { - j0 = Math.max(0, Math.min(nb - 2, Math.floor(j))); - tj = j - j0; + function crawlIntoTrace(container, i, astrPartial) { + var item = container[stack[i]]; + var newAstrPartial = astrPartial + stack[i]; + if(i === stack.length - 1) { + if(Lib.isArrayOrTypedArray(item)) { + arrayAttributes.push(baseAttrName + newAstrPartial); } - - if(iex) { - trace.dxydi(der, i0, j0, ti, tj); - pt[0] += der[0] * iex; - pt[1] += der[1] * iex; + } + else { + if(isArrayStack[i]) { + if(Array.isArray(item)) { + for(var j = 0; j < item.length; j++) { + if(Lib.isPlainObject(item[j])) { + crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].'); + } + } + } } - - if(jex) { - trace.dxydj(der, i0, j0, ti, tj); - pt[0] += der[0] * jex; - pt[1] += der[1] * jex; + else if(Lib.isPlainObject(item)) { + crawlIntoTrace(item, i + 1, newAstrPartial + '.'); } } + } - return pt; - }; - - - trace.c2p = function(xy, xa, ya) { - return [xa.c2p(xy[0]), ya.c2p(xy[1])]; - }; - - trace.p2x = function(p, xa, ya) { - return [xa.p2c(p[0]), ya.p2c(p[1])]; - }; - - trace.dadi = function(i /* , u*/) { - // Right now only a piecewise linear a or b basis is permitted since smoother interpolation - // would cause monotonicity problems. As a retult, u is entirely disregarded in this - // computation, though we'll specify it as a parameter for the sake of completeness and - // future-proofing. It would be possible to use monotonic cubic interpolation, for example. - // - // See: https://en.wikipedia.org/wiki/Monotone_cubic_interpolation - - // u = u || 0; - - var i0 = Math.max(0, Math.min(a.length - 2, i)); - - // The step (demoninator) is implicitly 1 since that's the grid spacing. - return a[i0 + 1] - a[i0]; - }; + baseContainer = trace; + baseAttrName = ''; + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } - trace.dbdj = function(j /* , v*/) { - // See above caveats for dadi which also apply here - var j0 = Math.max(0, Math.min(b.length - 2, j)); + var transforms = trace.transforms; + if(transforms) { + for(var i = 0; i < transforms.length; i++) { + var transform = transforms[i]; + var module = transform._module; - // The step (demoninator) is implicitly 1 since that's the grid spacing. - return b[j0 + 1] - b[j0]; - }; + if(module) { + baseAttrName = 'transforms[' + i + '].'; + baseContainer = transform; - // Takes: grid cell coordinate (i, j) and fractional grid cell coordinates (u, v) - // Returns: (dx/da, dy/db) - // - // NB: separate grid cell + fractional grid cell coordinate format is due to the discontinuous - // derivative, as described better in create_i_derivative_evaluator.js - trace.dxyda = function(i0, j0, u, v) { - var dxydi = trace.dxydi(null, i0, j0, u, v); - var dadi = trace.dadi(i0, u); + exports.crawl(module.attributes, callback); + } + } + } - return [dxydi[0] / dadi, dxydi[1] / dadi]; - }; + return arrayAttributes; +}; - trace.dxydb = function(i0, j0, u, v) { - var dxydj = trace.dxydj(null, i0, j0, u, v); - var dbdj = trace.dbdj(j0, v); +/* + * Find the valObject for one attribute in an existing trace + * + * @param {object} trace + * full trace object that contains a reference to `_module.attributes` + * @param {object} parts + * an array of parts, like ['transforms', 1, 'value'] + * typically from nestedProperty(...).parts + * + * @return {object|false} + * the valObject for this attribute, or the last found parent + * in some cases the innermost valObject will not exist, for example + * `valType: 'any'` attributes where we might set a part of the attribute. + * In that case, stop at the deepest valObject we *do* find. + */ +exports.getTraceValObject = function(trace, parts) { + var head = parts[0]; + var i = 1; // index to start recursing from + var moduleAttrs, valObject; - return [dxydj[0] / dbdj, dxydj[1] / dbdj]; - }; + 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; // start recursing only inside the transform + } + else if(trace.type === 'area') { + valObject = polarAreaAttrs[head]; + } + else { + // first look in the module for this trace + // components have already merged their trace attributes in here + var _module = trace._module; + if(!_module) _module = (Registry.modules[trace.type || baseAttributes.type.dflt] || {})._module; + if(!_module) return false; - // Sometimes we don't care about precision and all we really want is decent rough - // directions (as is the case with labels). In that case, we can do a very rough finite - // difference and spare having to worry about precise grid coordinates: - trace.dxyda_rough = function(a, b, reldiff) { - var h = arange * (reldiff || 0.1); - var plus = trace.ab2xy(a + h, b, true); - var minus = trace.ab2xy(a - h, b, true); + moduleAttrs = _module.attributes; + valObject = moduleAttrs && moduleAttrs[head]; - return [ - (plus[0] - minus[0]) * 0.5 / h, - (plus[1] - minus[1]) * 0.5 / h - ]; - }; + // then look in the subplot attributes + if(!valObject) { + var subplotModule = _module.basePlotModule; + if(subplotModule && subplotModule.attributes) { + valObject = subplotModule.attributes[head]; + } + } - trace.dxydb_rough = function(a, b, reldiff) { - var h = brange * (reldiff || 0.1); - var plus = trace.ab2xy(a, b + h, true); - var minus = trace.ab2xy(a, b - h, true); + // finally look in the global attributes + if(!valObject) valObject = baseAttributes[head]; + } - return [ - (plus[0] - minus[0]) * 0.5 / h, - (plus[1] - minus[1]) * 0.5 / h - ]; - }; + return recurseIntoValObject(valObject, parts, i); +}; - trace.dpdx = function(xa) { - return xa._m; - }; +/* + * Find the valObject for one layout attribute + * + * @param {array} parts + * an array of parts, like ['annotations', 1, 'x'] + * typically from nestedProperty(...).parts + * + * @return {object|false} + * the valObject for this attribute, or the last found parent + * in some cases the innermost valObject will not exist, for example + * `valType: 'any'` attributes where we might set a part of the attribute. + * In that case, stop at the deepest valObject we *do* find. + */ +exports.getLayoutValObject = function(fullLayout, parts) { + var valObject = layoutHeadAttr(fullLayout, parts[0]); - trace.dpdy = function(ya) { - return ya._m; - }; + return recurseIntoValObject(valObject, parts, 1); }; -},{"../../lib/search":715,"./compute_control_points":887,"./constants":888,"./create_i_derivative_evaluator":889,"./create_j_derivative_evaluator":890,"./create_spline_evaluator":891}],900:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function layoutHeadAttr(fullLayout, head) { + var i, key, _module, attributes; -'use strict'; + // look for attributes of the subplot types used on the plot + 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 a module defines overrides, these take precedence + // initially this is to allow gl2d different editTypes from svg cartesian + if(_module.layoutAttrOverrides) return _module.layoutAttrOverrides; -var Lib = _dereq_('../../lib'); + // otherwise take the first attributes we find + if(!out && _module.layoutAttributes) out = _module.layoutAttributes; + } -/* - * Given a 2D array as well as a basis in either direction, this function fills in the - * 2D array using a combination of smoothing and extrapolation. This is rather important - * for carpet plots since it's used for layout so that we can't simply omit or blank out - * points. We need a reasonable guess so that the interpolation puts points somewhere - * even if we were to somehow represent that the data was missing later on. - * - * input: - * - data: 2D array of arrays - * - a: array such that a.length === data[0].length - * - b: array such that b.length === data.length - */ -module.exports = function smoothFill2dArray(data, a, b) { - var i, j, k; - var ip = []; - var jp = []; - // var neighborCnts = []; - - var ni = data[0].length; - var nj = data.length; - - function avgSurrounding(i, j) { - // As a low-quality start, we can simply average surrounding points (in a not - // non-uniform grid aware manner): - var sum = 0.0; - var val; - var cnt = 0; - if(i > 0 && (val = data[j][i - 1]) !== undefined) { - cnt++; - sum += val; - } - if(i < ni - 1 && (val = data[j][i + 1]) !== undefined) { - cnt++; - sum += val; - } - if(j > 0 && (val = data[j - 1][i]) !== undefined) { - cnt++; - sum += val; + // a module can also override the behavior of base (and component) module layout attrs + // again see gl2d for initial use case + var baseOverrides = _module.baseLayoutAttrOverrides; + if(baseOverrides && head in baseOverrides) return baseOverrides[head]; } - if(j < nj - 1 && (val = data[j + 1][i]) !== undefined) { - cnt++; - sum += val; + if(out) return out; + } + + // look for layout attributes contributed by traces on the plot + 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]; + } } - return sum / Math.max(1, cnt); + } + /* + * Next look in components. + * Components that define a schema have already merged this into + * base and subplot attribute defs, so ignore these. + * Others (older style) all put all their attributes + * inside a container matching the module `name` + * eg `attributes` (array) or `legend` (object) + */ + for(key in Registry.componentsRegistry) { + _module = Registry.componentsRegistry[key]; + if(!_module.schema && (head === _module.name)) { + return _module.layoutAttributes; + } } - // This loop iterates over all cells. Any cells that are null will be noted and those - // are the only points we will loop over and update via laplace's equation. Points with - // any neighbors will receive the average. If there are no neighboring points, then they - // will be set to zero. Also as we go, track the maximum magnitude so that we can scale - // our tolerance accordingly. - var dmax = 0.0; - for(i = 0; i < ni; i++) { - for(j = 0; j < nj; j++) { - if(data[j][i] === undefined) { - ip.push(i); - jp.push(j); - - data[j][i] = avgSurrounding(i, j); - // neighborCnts.push(result.neighbors); - } - dmax = Math.max(dmax, Math.abs(data[j][i])); - } - } - - if(!ip.length) return data; - - // The tolerance doesn't need to be excessive. It's just for display positioning - var dxp, dxm, dap, dam, dbp, dbm, c, d, diff, reldiff, overrelaxation; - var tol = 1e-5; - var resid = 0; - var itermax = 100; - var iter = 0; - var n = ip.length; - do { - resid = 0; - // Normally we'd loop in two dimensions, but not all points are blank and need - // an update, so we instead loop only over the points that were tabulated above - for(k = 0; k < n; k++) { - i = ip[k]; - j = jp[k]; - // neighborCnt = neighborCnts[k]; - - // Track a counter for how many contributions there are. We'll use this counter - // to average at the end, which reduces to laplace's equation with neumann boundary - // conditions on the first derivative (second derivative is zero so that we get - // a nice linear extrapolation at the boundaries). - var boundaryCnt = 0; - var newVal = 0; - - var d0, d1, x0, x1, i0, j0; - if(i === 0) { - // If this lies along the i = 0 boundary, extrapolate from the two points - // to the right of this point. Note that the finite differences take into - // account non-uniform grid spacing: - i0 = Math.min(ni - 1, 2); - x0 = a[i0]; - x1 = a[1]; - d0 = data[j][i0]; - d1 = data[j][1]; - newVal += d1 + (d1 - d0) * (a[0] - x1) / (x1 - x0); - boundaryCnt++; - } else if(i === ni - 1) { - // If along the high i boundary, extrapolate from the two points to the - // left of this point - i0 = Math.max(0, ni - 3); - x0 = a[i0]; - x1 = a[ni - 2]; - d0 = data[j][i0]; - d1 = data[j][ni - 2]; - newVal += d1 + (d1 - d0) * (a[ni - 1] - x1) / (x1 - x0); - boundaryCnt++; - } - - if((i === 0 || i === ni - 1) && (j > 0 && j < nj - 1)) { - // If along the min(i) or max(i) boundaries, also smooth vertically as long - // as we're not in a corner. Note that the finite differences used here - // are also aware of nonuniform grid spacing: - dxp = b[j + 1] - b[j]; - dxm = b[j] - b[j - 1]; - newVal += (dxm * data[j + 1][i] + dxp * data[j - 1][i]) / (dxm + dxp); - boundaryCnt++; - } - - if(j === 0) { - // If along the j = 0 boundary, extrpolate this point from the two points - // above it - j0 = Math.min(nj - 1, 2); - x0 = b[j0]; - x1 = b[1]; - d0 = data[j0][i]; - d1 = data[1][i]; - newVal += d1 + (d1 - d0) * (b[0] - x1) / (x1 - x0); - boundaryCnt++; - } else if(j === nj - 1) { - // Same for the max j boundary from the cells below it: - j0 = Math.max(0, nj - 3); - x0 = b[j0]; - x1 = b[nj - 2]; - d0 = data[j0][i]; - d1 = data[nj - 2][i]; - newVal += d1 + (d1 - d0) * (b[nj - 1] - x1) / (x1 - x0); - boundaryCnt++; - } - - if((j === 0 || j === nj - 1) && (i > 0 && i < ni - 1)) { - // Now average points to the left/right as long as not in a corner: - dxp = a[i + 1] - a[i]; - dxm = a[i] - a[i - 1]; - newVal += (dxm * data[j][i + 1] + dxp * data[j][i - 1]) / (dxm + dxp); - boundaryCnt++; - } - - if(!boundaryCnt) { - // If none of the above conditions were triggered, then this is an interior - // point and we can just do a laplace equation update. As above, these differences - // are aware of nonuniform grid spacing: - dap = a[i + 1] - a[i]; - dam = a[i] - a[i - 1]; - dbp = b[j + 1] - b[j]; - dbm = b[j] - b[j - 1]; - - // These are just some useful constants for the iteration, which is perfectly - // straightforward but a little long to derive from f_xx + f_yy = 0. - c = dap * dam * (dap + dam); - d = dbp * dbm * (dbp + dbm); - - newVal = (c * (dbm * data[j + 1][i] + dbp * data[j - 1][i]) + - d * (dam * data[j][i + 1] + dap * data[j][i - 1])) / - (d * (dam + dap) + c * (dbm + dbp)); - } else { - // If we did have contributions from the boundary conditions, then average - // the result from the various contributions: - newVal /= boundaryCnt; - } - - // Jacobi updates are ridiculously slow to converge, so this approach uses a - // Gauss-seidel iteration which is dramatically faster. - diff = newVal - data[j][i]; - reldiff = diff / dmax; - resid += reldiff * reldiff; - - // Gauss-Seidel-ish iteration, omega chosen based on heuristics and some - // quick tests. - // - // NB: Don't overrelax the boundarie. Otherwise set an overrelaxation factor - // which is a little low but safely optimal-ish: - overrelaxation = boundaryCnt ? 0 : 0.85; - - // If there are four non-null neighbors, then we want a simple average without - // overrelaxation. If all the surrouding points are null, then we want the full - // overrelaxation - // - // Based on experiments, this actually seems to slow down convergence just a bit. - // I'll leave it here for reference in case this needs to be revisited, but - // it seems to work just fine without this. - // if (overrelaxation) overrelaxation *= (4 - neighborCnt) / 4; + if(head in baseLayoutAttributes) return baseLayoutAttributes[head]; - data[j][i] += diff * (1 + overrelaxation); - } + // Polar doesn't populate _modules or _basePlotModules + // just fall back on these when the others fail + if(head === 'radialaxis' || head === 'angularaxis') { + return polarAxisAttrs[head]; + } + return polarAxisAttrs.layout[head] || false; +} - resid = Math.sqrt(resid); - } while(iter++ < itermax && resid > tol); +function recurseIntoValObject(valObject, parts, i) { + if(!valObject) return false; - Lib.log('Smoother converged to', resid, 'after', iter, 'iterations'); + if(valObject._isLinkedToArray) { + // skip array index, abort if we try to dive into an array without an index + if(isIndex(parts[i])) i++; + else if(i < parts.length) return false; + } - return data; -}; + // now recurse as far as we can. Occasionally we have an attribute + // setting an internal part below what's in the schema; just return + // the innermost schema item we find. + for(; i < parts.length; i++) { + var newValObject = valObject[parts[i]]; + if(isPlainObject(newValObject)) valObject = newValObject; + else break; -},{"../../lib":696}],901:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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; -'use strict'; + 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; + } + } + } -var isArray1D = _dereq_('../../lib').isArray1D; + return valObject; +} -module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { - var x = coerce('x'); - var hasX = x && x.length; - var y = coerce('y'); - var hasY = y && y.length; - if(!hasX && !hasY) return false; +// note: this is different from Lib.isIndex, this one doesn't accept numeric +// strings, only actual numbers. +function isIndex(val) { + return val === Math.round(val) && val >= 0; +} - traceOut._cheater = !x; +function getTraceAttributes(type) { + var _module, basePlotModule; - if((!hasX || isArray1D(x)) && (!hasY || isArray1D(y))) { - var len = hasX ? x.length : Infinity; - if(hasY) len = Math.min(len, y.length); - if(traceOut.a && traceOut.a.length) len = Math.min(len, traceOut.a.length); - if(traceOut.b && traceOut.b.length) len = Math.min(len, traceOut.b.length); - traceOut._length = len; + if(type === 'area') { + _module = { attributes: polarAreaAttrs }; + basePlotModule = {}; + } + else { + _module = Registry.modules[type]._module, + basePlotModule = _module.basePlotModule; } - else traceOut._length = null; - return true; -}; + var attributes = {}; -},{"../../lib":696}],902:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // make 'type' the first attribute in the object + attributes.type = null; -'use strict'; -var scatterGeoAttrs = _dereq_('../scattergeo/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); + var copyBaseAttributes = extendDeepAll({}, baseAttributes); + var copyModuleAttributes = extendDeepAll({}, _module.attributes); -var extendFlat = _dereq_('../../lib/extend').extendFlat; + // prune global-level trace attributes that are already defined in a trace + exports.crawl(copyModuleAttributes, function(attr, attrName, attrs, level, fullAttrString) { + Lib.nestedProperty(copyBaseAttributes, fullAttrString).set(undefined); + // Prune undefined attributes + if(attr === undefined) Lib.nestedProperty(copyModuleAttributes, fullAttrString).set(undefined); + }); -var scatterGeoMarkerLineAttrs = scatterGeoAttrs.marker.line; + // base attributes (same for all trace types) + extendDeepAll(attributes, copyBaseAttributes); -module.exports = extendFlat({ - locations: { - valType: 'data_array', - editType: 'calc', - - }, - locationmode: scatterGeoAttrs.locationmode, - z: { - valType: 'data_array', - editType: 'calc', - - }, - text: extendFlat({}, scatterGeoAttrs.text, { - - }), - marker: { - line: { - color: scatterGeoMarkerLineAttrs.color, - width: extendFlat({}, scatterGeoMarkerLineAttrs.width, {dflt: 1}), - editType: 'calc' - }, - opacity: { - valType: 'number', - arrayOk: true, - min: 0, - max: 1, - dflt: 1, - - editType: 'style', - - }, - editType: 'calc' - }, + // module attributes + extendDeepAll(attributes, copyModuleAttributes); - selected: { - marker: { - opacity: scatterGeoAttrs.selected.marker.opacity, - editType: 'plot' - }, - editType: 'plot' - }, - unselected: { - marker: { - opacity: scatterGeoAttrs.unselected.marker.opacity, - editType: 'plot' - }, - editType: 'plot' - }, + // subplot attributes + if(basePlotModule.attributes) { + extendDeepAll(attributes, basePlotModule.attributes); + } - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - editType: 'calc', - flags: ['location', 'z', 'text', 'name'] - }) -}, + // 'type' gets overwritten by baseAttributes; reset it here + attributes.type = type; - colorscaleAttrs('', { - cLetter: 'z', - editTypeOverride: 'calc' - }), - {colorbar: colorbarAttrs} -); + var out = { + meta: _module.meta || {}, + attributes: formatAttributes(attributes), + }; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/attributes":741,"../scattergeo/attributes":1083}],903:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // trace-specific layout attributes + if(_module.layoutAttributes) { + var layoutAttributes = {}; + extendDeepAll(layoutAttributes, _module.layoutAttributes); + out.layoutAttributes = formatAttributes(layoutAttributes); + } -'use strict'; + return out; +} -var isNumeric = _dereq_('fast-isnumeric'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; +function getLayoutAttributes() { + var layoutAttributes = {}; + var key, _module; -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); -var arraysToCalcdata = _dereq_('../scatter/arrays_to_calcdata'); -var calcSelection = _dereq_('../scatter/calc_selection'); + // global layout attributes + extendDeepAll(layoutAttributes, baseLayoutAttributes); -module.exports = function calc(gd, trace) { - var len = trace._length; - var calcTrace = new Array(len); + // add base plot module layout attributes + for(key in Registry.subplotsRegistry) { + _module = Registry.subplotsRegistry[key]; - for(var i = 0; i < len; i++) { - var calcPt = calcTrace[i] = {}; - var loc = trace.locations[i]; - var z = trace.z[i]; + if(!_module.layoutAttributes) continue; - calcPt.loc = typeof loc === 'string' ? loc : null; - calcPt.z = isNumeric(z) ? z : BADNUM; + 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); + } } - arraysToCalcdata(calcTrace, trace); - colorscaleCalc(trace, trace.z, '', 'z'); - calcSelection(calcTrace, trace); - - return calcTrace; -}; - -},{"../../components/colorscale/calc":578,"../../constants/numerical":673,"../scatter/arrays_to_calcdata":1042,"../scatter/calc_selection":1045,"fast-isnumeric":214}],904:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // polar layout attributes + layoutAttributes = assignPolarLayoutAttrs(layoutAttributes); + // add registered components layout attributes + for(key in Registry.componentsRegistry) { + _module = Registry.componentsRegistry[key]; + var schema = _module.schema; -'use strict'; + /* + * Components with defined schema have already been merged in at register time + * but a few components define attributes that apply only to xaxis + * not yaxis (rangeselector, rangeslider) - delete from y schema. + * Note that the input attributes for xaxis/yaxis are the same object + * so it's not possible to only add them to xaxis from the start. + * If we ever have such asymmetry the other way, or anywhere else, + * we will need to extend both this code and mergeComponentAttrsToSubplot + * (which will not find yaxis only for example) + */ + 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]; + } + } + // older style without schema need to be explicitly merged in now + else if(_module.layoutAttributes) { + insertAttrs(layoutAttributes, _module.layoutAttributes, _module.name); + } + } -var Lib = _dereq_('../../lib'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); + return { + layoutAttributes: formatAttributes(layoutAttributes) + }; +} -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } +function getTransformAttributes(type) { + var _module = Registry.transformsRegistry[type]; + var attributes = extendDeepAll({}, _module.attributes); - var locations = coerce('locations'); - var z = coerce('z'); + // add registered components transform attributes + Object.keys(Registry.componentsRegistry).forEach(function(k) { + var _module = Registry.componentsRegistry[k]; - if(!(locations && locations.length && Lib.isArrayOrTypedArray(z) && z.length)) { - traceOut.visible = false; - return; - } - traceOut._length = Math.min(locations.length, z.length); + if(_module.schema && _module.schema.transforms && _module.schema.transforms[type]) { + Object.keys(_module.schema.transforms[type]).forEach(function(v) { + insertAttrs(attributes, _module.schema.transforms[type][v], v); + }); + } + }); - coerce('locationmode'); + return { + attributes: formatAttributes(attributes) + }; +} - coerce('text'); +function getFramesAttributes() { + var attrs = { + frames: Lib.extendDeepAll({}, frameAttributes) + }; - coerce('marker.line.color'); - coerce('marker.line.width'); - coerce('marker.opacity'); + formatAttributes(attrs); - colorscaleDefaults( - traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} - ); + return attrs.frames; +} - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -}; +function formatAttributes(attrs) { + mergeValTypeAndRole(attrs); + formatArrayContainers(attrs); + stringify(attrs); -},{"../../components/colorscale/defaults":580,"../../lib":696,"./attributes":902}],905:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return attrs; +} +function mergeValTypeAndRole(attrs) { -'use strict'; + function makeSrcAttr(attrName) { + return { + valType: 'string', + + + editType: 'none' + }; + } -module.exports = function eventData(out, pt) { - out.location = pt.location; - out.z = pt.z; + function callback(attr, attrName, attrs) { + if(exports.isValObject(attr)) { + if(attr.valType === 'data_array') { + // all 'data_array' attrs have role 'data' + attr.role = 'data'; + // all 'data_array' attrs have a corresponding 'src' attr + attrs[attrName + 'src'] = makeSrcAttr(attrName); + } + else if(attr.arrayOk === true) { + // all 'arrayOk' attrs have a corresponding 'src' attr + attrs[attrName + 'src'] = makeSrcAttr(attrName); + } + } + else if(isPlainObject(attr)) { + // all attrs container objects get role 'object' + attr.role = 'object'; + } + } - return out; -}; + exports.crawl(attrs, callback); +} -},{}],906:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function formatArrayContainers(attrs) { + function callback(attr, attrName, attrs) { + if(!attr) return; -'use strict'; + var itemName = attr[IS_LINKED_TO_ARRAY]; -var Axes = _dereq_('../../plots/cartesian/axes'); -var attributes = _dereq_('./attributes'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); + if(!itemName) return; -module.exports = function hoverPoints(pointData, xval, yval) { - var cd = pointData.cd; - var trace = cd[0].trace; - var geo = pointData.subplot; + delete attr[IS_LINKED_TO_ARRAY]; - var pt, i, j, isInside; + attrs[attrName] = { items: {} }; + attrs[attrName].items[itemName] = attr; + attrs[attrName].role = 'object'; + } - for(i = 0; i < cd.length; i++) { - pt = cd[i]; - isInside = false; + exports.crawl(attrs, callback); +} - if(pt._polygons) { - for(j = 0; j < pt._polygons.length; j++) { - if(pt._polygons[j].contains([xval, yval])) { - isInside = !isInside; +// this can take around 10ms and should only be run from PlotSchema.get(), +// to ensure JSON.stringify(PlotSchema.get()) gives the intended result. +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]); } - // for polygons that cross antimeridian as xval is in [-180, 180] - if(pt._polygons[j].contains([xval + 360, yval])) { - isInside = !isInside; + } else { + // as JSON.stringify(/test/) // => {} + if(attr[k] instanceof RegExp) { + attr[k] = attr[k].toString(); } } - - if(isInside) break; } } - if(!isInside || !pt) return; - - pointData.x0 = pointData.x1 = pointData.xa.c2p(pt.ct); - pointData.y0 = pointData.y1 = pointData.ya.c2p(pt.ct); - - pointData.index = pt.index; - pointData.location = pt.loc; - pointData.z = pt.z; - - makeHoverInfo(pointData, trace, pt, geo.mockAxis); - - return [pointData]; -}; - -function makeHoverInfo(pointData, trace, pt, axis) { - var hoverinfo = pt.hi || trace.hoverinfo; + walk(attrs); +} - var parts = (hoverinfo === 'all') ? - attributes.hoverinfo.flags : - hoverinfo.split('+'); +function assignPolarLayoutAttrs(layoutAttributes) { + extendFlat(layoutAttributes, { + radialaxis: polarAxisAttrs.radialaxis, + angularaxis: polarAxisAttrs.angularaxis + }); - var hasName = (parts.indexOf('name') !== -1); - var hasLocation = (parts.indexOf('location') !== -1); - var hasZ = (parts.indexOf('z') !== -1); - var hasText = (parts.indexOf('text') !== -1); - var hasIdAsNameLabel = !hasName && hasLocation; + extendFlat(layoutAttributes, polarAxisAttrs.layout); - var text = []; + return layoutAttributes; +} - function formatter(val) { - return Axes.tickText(axis, axis.c2l(val), 'hover').text; - } +function handleBasePlotModule(layoutAttributes, _module, astr) { + var np = Lib.nestedProperty(layoutAttributes, astr); + var attrs = extendDeepAll({}, _module.layoutAttributes); - if(hasIdAsNameLabel) { - pointData.nameOverride = pt.loc; - } else { - if(hasName) pointData.nameOverride = trace.name; - if(hasLocation) text.push(pt.loc); - } + attrs[IS_SUBPLOT_OBJ] = true; + np.set(attrs); +} - if(hasZ) text.push(formatter(pt.z)); - if(hasText) { - fillHoverText(pt, trace, text); - } +function insertAttrs(baseAttrs, newAttrs, astr) { + var np = Lib.nestedProperty(baseAttrs, astr); - pointData.extraText = text.join('
'); + np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../../plots/cartesian/axes":744,"../scatter/fill_hover_text":1051,"./attributes":902}],907:[function(_dereq_,module,exports){ +},{"../lib":159,"../plots/animation_attributes":198,"../plots/attributes":200,"../plots/frame_attributes":231,"../plots/layout_attributes":234,"../plots/polar/legacy/area_attributes":237,"../plots/polar/legacy/axis_attributes":238,"../registry":243,"./edit_types":186,"./plot_config":191}],193:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -144693,249 +46232,311 @@ 'use strict'; -var Choropleth = {}; +var Lib = _dereq_('../lib'); +var plotAttributes = _dereq_('../plots/attributes'); -Choropleth.attributes = _dereq_('./attributes'); -Choropleth.supplyDefaults = _dereq_('./defaults'); -Choropleth.colorbar = _dereq_('../heatmap/colorbar'); -Choropleth.calc = _dereq_('./calc'); -Choropleth.plot = _dereq_('./plot'); -Choropleth.style = _dereq_('./style').style; -Choropleth.styleOnSelect = _dereq_('./style').styleOnSelect; -Choropleth.hoverPoints = _dereq_('./hover'); -Choropleth.eventData = _dereq_('./event_data'); -Choropleth.selectPoints = _dereq_('./select'); +var TEMPLATEITEMNAME = 'templateitemname'; -Choropleth.moduleType = 'trace'; -Choropleth.name = 'choropleth'; -Choropleth.basePlotModule = _dereq_('../../plots/geo'); -Choropleth.categories = ['geo', 'noOpacity']; -Choropleth.meta = { +var templateAttrs = { + name: { + valType: 'string', + + editType: 'none', + + } +}; +templateAttrs[TEMPLATEITEMNAME] = { + valType: 'string', + + editType: 'calc', }; -module.exports = Choropleth; - -},{"../../plots/geo":775,"../heatmap/colorbar":948,"./attributes":902,"./calc":903,"./defaults":904,"./event_data":905,"./hover":906,"./plot":908,"./select":909,"./style":910}],908:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); - -var Lib = _dereq_('../../lib'); -var polygon = _dereq_('../../lib/polygon'); + * templatedArray: decorate an attributes object with templating (and array) + * properties. + * + * @param {string} name: the singular form of the array name. Sets + * `_isLinkedToArray` to this, so the schema knows to treat this as an array. + * @param {object} attrs: the item attributes. Since all callers are expected + * to be constructing this object on the spot, we mutate it here for + * performance, rather than extending a new object with it. + * + * @returns {object}: the decorated `attrs` object + */ +exports.templatedArray = function(name, attrs) { + attrs._isLinkedToArray = name; + attrs.name = templateAttrs.name; + attrs[TEMPLATEITEMNAME] = templateAttrs[TEMPLATEITEMNAME]; + return attrs; +}; -var getTopojsonFeatures = _dereq_('../../lib/topojson_utils').getTopojsonFeatures; -var locationToFeature = _dereq_('../../lib/geo_location_utils').locationToFeature; -var style = _dereq_('./style').style; +/** + * traceTemplater: logic for matching traces to trace templates + * + * @param {object} dataTemplate: collection of {traceType: [{template}, ...]} + * ie each type the template applies to contains a list of template objects, + * to be provided cyclically to data traces of that type. + * + * @returns {object}: {newTrace}, a function: + * newTrace(traceIn): that takes the input traceIn, coerces its type, then + * uses that type to find the next template to apply. returns the output + * traceOut with template attached, ready to continue supplyDefaults. + */ +exports.traceTemplater = function(dataTemplate) { + var traceCounts = {}; + var traceType, typeTemplates; -module.exports = function plot(gd, geo, calcData) { - for(var i = 0; i < calcData.length; i++) { - calcGeoJSON(calcData[i], geo.topojson); + for(traceType in dataTemplate) { + typeTemplates = dataTemplate[traceType]; + if(Array.isArray(typeTemplates) && typeTemplates.length) { + traceCounts[traceType] = 0; + } } - var choroplethLayer = geo.layers.backplot.select('.choroplethlayer'); - Lib.makeTraceGroups(choroplethLayer, calcData, 'trace choropleth').each(function(calcTrace) { - var sel = calcTrace[0].node3 = d3.select(this); - - var paths = sel.selectAll('path.choroplethlocation') - .data(Lib.identity); + function newTrace(traceIn) { + traceType = Lib.coerce(traceIn, {}, plotAttributes, 'type'); + var traceOut = {type: traceType, _template: null}; + if(traceType in traceCounts) { + typeTemplates = dataTemplate[traceType]; + // cycle through traces in the template set for this type + var typei = traceCounts[traceType] % typeTemplates.length; + traceCounts[traceType]++; + traceOut._template = typeTemplates[typei]; + } + else { + // TODO: anything we should do for types missing from the template? + // try to apply some other type? Or just bail as we do here? + // Actually I think yes, we should apply other types; would be nice + // if all scatter* could inherit from each other, and if histogram + // could inherit from bar, etc... but how to specify this? And do we + // compose them, or if a type is present require it to be complete? + // Actually this could apply to layout too - 3D annotations + // inheriting from 2D, axes of different types inheriting from each + // other... + } + return traceOut; + } - paths.enter().append('path') - .classed('choroplethlocation', true); + return { + newTrace: newTrace + // TODO: function to figure out what's left & what didn't work + }; +}; - paths.exit().remove(); +/** + * newContainer: Create a new sub-container inside `container` and propagate any + * applicable template to it. If there's no template, still propagates + * `undefined` so relinkPrivate will not retain an old template! + * + * @param {object} container: the outer container, should already have _template + * if there *is* a template for this plot + * @param {string} name: the key of the new container to make + * @param {string} baseName: if applicable, a base attribute to take the + * template from, ie for xaxis3 the base would be xaxis + * + * @returns {object}: an object for inclusion _full*, empty except for the + * appropriate template piece + */ +exports.newContainer = function(container, name, baseName) { + var template = container._template; + var part = template && (template[name] || (baseName && template[baseName])); + if(!Lib.isPlainObject(part)) part = null; - // call style here within topojson request callback - style(gd, calcTrace); - }); + var out = container[name] = {_template: part}; + return out; }; -function calcGeoJSON(calcTrace, topojson) { - var trace = calcTrace[0].trace; - var len = calcTrace.length; - var features = getTopojsonFeatures(trace, topojson); +/** + * arrayTemplater: special logic for templating both defaults and specific items + * in a container array (annotations etc) + * + * @param {object} container: the outer container, should already have _template + * if there *is* a template for this plot + * @param {string} name: the name of the array to template (ie 'annotations') + * will be used to find default ('annotationdefaults' object) and specific + * ('annotations' array) template specs. + * @param {string} inclusionAttr: the attribute determining this item's + * inclusion in the output, usually 'visible' or 'enabled' + * + * @returns {object}: {newItem, defaultItems}, both functions: + * newItem(itemIn): create an output item, bare except for the correct + * template and name(s), as the base for supplyDefaults + * defaultItems(): to be called after all newItem calls, return any + * specific template items that have not already beeen included, + * also as bare output items ready for supplyDefaults. + */ +exports.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 = []; + } - for(var i = 0; i < len; i++) { - var calcPt = calcTrace[i]; - var feature = locationToFeature(trace.locationmode, calcPt.loc, features); + var usedNames = {}; - if(!feature) { - calcPt.geojson = null; - continue; + function newItem(itemIn) { + // include name and templateitemname in the output object for ALL + // container array items. Note: you could potentially use different + // name and templateitemname, if you're using one template to make + // another template. templateitemname would be the name in the original + // template, and name is the new "subclassed" item name. + var out = {name: itemIn.name, _input: itemIn}; + var templateItemName = out[TEMPLATEITEMNAME] = itemIn[TEMPLATEITEMNAME]; + + // no itemname: use the default template + if(!validItemName(templateItemName)) { + out._template = defaultsTemplate; + return out; } + // look for an item matching this itemname + // note these do not inherit from the default template, only the item. + for(var i = 0; i < templateItems.length; i++) { + var templateItem = templateItems[i]; + if(templateItem.name === templateItemName) { + // Note: it's OK to use a template item more than once + // but using it at least once will stop it from generating + // a default item at the end. + usedNames[templateItemName] = 1; + out._template = templateItem; + return out; + } + } - calcPt.geojson = feature; - calcPt.ct = feature.properties.ct; - calcPt.index = i; - calcPt._polygons = feature2polygons(feature); + // Didn't find a matching template item, so since this item is intended + // to only be modifications it's most likely broken. Hide it unless + // it's explicitly marked visible - in which case it gets NO template, + // not even the default. + out[inclusionAttr] = itemIn[inclusionAttr] || false; + // special falsy value we can look for in validateTemplate + out._template = false; + return out; } -} - -function feature2polygons(feature) { - var geometry = feature.geometry; - var coords = geometry.coordinates; - var loc = feature.id; - var polygons = []; - var appendPolygon, j, k, m; - - function doesCrossAntiMerdian(pts) { - for(var l = 0; l < pts.length - 1; l++) { - if(pts[l][0] > 0 && pts[l + 1][0] < 0) return l; + function defaultItems() { + var out = []; + for(var i = 0; i < templateItems.length; i++) { + var templateItem = templateItems[i]; + var name = templateItem.name; + // only allow named items to be added as defaults, + // and only allow each name once + if(validItemName(name) && !usedNames[name]) { + var outi = { + _template: templateItem, + name: name, + _input: {_templateitemname: name} + }; + outi[TEMPLATEITEMNAME] = templateItem[TEMPLATEITEMNAME]; + out.push(outi); + usedNames[name] = 1; + } } - return null; + return out; } - if(loc === 'RUS' || loc === 'FJI') { - // Russia and Fiji have landmasses that cross the antimeridian, - // we need to add +360 to their longitude coordinates, so that - // polygon 'contains' doesn't get confused when crossing the antimeridian. - // - // Note that other countries have polygons on either side of the antimeridian - // (e.g. some Aleutian island for the USA), but those don't confuse - // the 'contains' method; these are skipped here. - appendPolygon = function(_pts) { - var pts; - - if(doesCrossAntiMerdian(_pts) === null) { - pts = _pts; - } else { - pts = new Array(_pts.length); - for(m = 0; m < _pts.length; m++) { - // do nut mutate calcdata[i][j].geojson !! - pts[m] = [ - _pts[m][0] < 0 ? _pts[m][0] + 360 : _pts[m][0], - _pts[m][1] - ]; - } - } - - polygons.push(polygon.tester(pts)); - }; - } else if(loc === 'ATA') { - // Antarctica has a landmass that wraps around every longitudes which - // confuses the 'contains' methods. - appendPolygon = function(pts) { - var crossAntiMeridianIndex = doesCrossAntiMerdian(pts); - - // polygon that do not cross anti-meridian need no special handling - if(crossAntiMeridianIndex === null) { - return polygons.push(polygon.tester(pts)); - } - - // stitch polygon by adding pt over South Pole, - // so that it covers the projected region covers all latitudes - // - // Note that the algorithm below only works for polygons that - // start and end on longitude -180 (like the ones built by - // https://github.com/etpinard/sane-topojson). - var stitch = new Array(pts.length + 1); - var si = 0; - - for(m = 0; m < pts.length; m++) { - if(m > crossAntiMeridianIndex) { - stitch[si++] = [pts[m][0] + 360, pts[m][1]]; - } else if(m === crossAntiMeridianIndex) { - stitch[si++] = pts[m]; - stitch[si++] = [pts[m][0], -90]; - } else { - stitch[si++] = pts[m]; - } - } + return { + newItem: newItem, + defaultItems: defaultItems + }; +}; - // polygon.tester by default appends pt[0] to the points list, - // we must remove it here, to avoid a jump in longitude from 180 to -180, - // that would confuse the 'contains' method - var tester = polygon.tester(stitch); - tester.pts.pop(); - polygons.push(tester); - }; - } else { - // otherwise using same array ref is fine - appendPolygon = function(pts) { - polygons.push(polygon.tester(pts)); - }; - } +function validItemName(name) { + return name && typeof name === 'string'; +} - switch(geometry.type) { - case 'MultiPolygon': - for(j = 0; j < coords.length; j++) { - for(k = 0; k < coords[j].length; k++) { - appendPolygon(coords[j][k]); - } - } - break; - case 'Polygon': - for(j = 0; j < coords.length; j++) { - appendPolygon(coords[j]); - } - break; +function arrayDefaultKey(name) { + var lastChar = name.length - 1; + if(name.charAt(lastChar) !== 's') { + Lib.warn('bad argument to arrayDefaultKey: ' + name); } - - return polygons; + return name.substr(0, name.length - 1) + 'defaults'; } +exports.arrayDefaultKey = arrayDefaultKey; -},{"../../lib":696,"../../lib/geo_location_utils":688,"../../lib/polygon":708,"../../lib/topojson_utils":723,"./style":910,"d3":148}],909:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + * arrayEditor: helper for editing array items that may have come from + * template defaults (in which case they will not exist in the input yet) + * + * @param {object} parentIn: the input container (eg gd.layout) + * @param {string} containerStr: the attribute string for the container inside + * `parentIn`. + * @param {object} itemOut: the _full* item (eg gd._fullLayout.annotations[0]) + * that we'll be editing. Assumed to have been created by `arrayTemplater`. + * + * @returns {object}: {modifyBase, modifyItem, getUpdateObj, applyUpdate}, all functions: + * modifyBase(attr, value): Add an update that's *not* related to the item. + * `attr` is the full attribute string. + * modifyItem(attr, value): Add an update to the item. `attr` is just the + * portion of the attribute string inside the item. + * getUpdateObj(): Get the final constructed update object, to use in + * `restyle` or `relayout`. Also resets the update object in case this + * update was canceled. + * applyUpdate(attr, value): optionally add an update `attr: value`, + * then apply it to `parent` which should be the parent of `containerIn`, + * ie the object to which `containerStr` is the attribute string. + */ +exports.arrayEditor = function(parentIn, containerStr, itemOut) { + var lengthIn = (Lib.nestedProperty(parentIn, containerStr).get() || []).length; + var index = itemOut._index; + // Check that we are indeed off the end of this container. + // Otherwise a devious user could put a key `_templateitemname` in their + // own input and break lots of things. + var templateItemName = (index >= lengthIn) && (itemOut._input || {})._templateitemname; + if(templateItemName) index = lengthIn; + var itemStr = containerStr + '[' + index + ']'; -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; + var update; + function resetUpdate() { + update = {}; + if(templateItemName) { + update[itemStr] = {}; + update[itemStr][TEMPLATEITEMNAME] = templateItemName; + } + } + resetUpdate(); - var i, di, ct, x, y; + function modifyBase(attr, value) { + update[attr] = value; + } - if(selectionTester === false) { - for(i = 0; i < cd.length; i++) { - cd[i].selected = 0; + function modifyItem(attr, value) { + if(templateItemName) { + // we're making a new object: edit that object + Lib.nestedProperty(update[itemStr], attr).set(value); } - } else { - for(i = 0; i < cd.length; i++) { - di = cd[i]; - ct = di.ct; - - if(!ct) continue; + else { + // we're editing an existing object: include *just* the edit + update[itemStr + '.' + attr] = value; + } + } - x = xa.c2p(ct); - y = ya.c2p(ct); + function getUpdateObj() { + var updateOut = update; + resetUpdate(); + return updateOut; + } - if(selectionTester.contains([x, y], null, i, searchInfo)) { - selection.push({ - pointNumber: i, - lon: ct[0], - lat: ct[1] - }); - di.selected = 1; - } else { - di.selected = 0; - } + 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 selection; + return { + modifyBase: modifyBase, + modifyItem: modifyItem, + getUpdateObj: getUpdateObj, + applyUpdate: applyUpdate + }; }; -},{}],910:[function(_dereq_,module,exports){ +},{"../lib":159,"../plots/attributes":200}],194:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -144945,1794 +46546,1401 @@ 'use strict'; var d3 = _dereq_('d3'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Colorscale = _dereq_('../../components/colorscale'); +var Registry = _dereq_('../registry'); +var Plots = _dereq_('../plots/plots'); -function style(gd, calcTrace) { - if(calcTrace) styleTrace(gd, calcTrace); -} +var Lib = _dereq_('../lib'); +var clearGlCanvases = _dereq_('../lib/clear_gl_canvases'); -function styleTrace(gd, calcTrace) { - var trace = calcTrace[0].trace; - var s = calcTrace[0].node3; - var locs = s.selectAll('.choroplethlocation'); - var marker = trace.marker || {}; - var markerLine = marker.line || {}; +var Color = _dereq_('../components/color'); +var Drawing = _dereq_('../components/drawing'); +var Titles = _dereq_('../components/titles'); +var ModeBar = _dereq_('../components/modebar'); - var sclFunc = Colorscale.makeColorScaleFunc( - Colorscale.extractScale( - trace.colorscale, - trace.zmin, - trace.zmax - ) - ); +var Axes = _dereq_('../plots/cartesian/axes'); +var alignmentConstants = _dereq_('../constants/alignment'); +var axisConstraints = _dereq_('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; +var doAutoRange = _dereq_('../plots/cartesian/autorange').doAutoRange; - locs.each(function(d) { - d3.select(this) - .attr('fill', sclFunc(d.z)) - .call(Color.stroke, d.mlc || markerLine.color) - .call(Drawing.dashLine, '', d.mlw || markerLine.width || 0) - .style('opacity', marker.opacity); - }); +var SVG_TEXT_ANCHOR_START = 'start'; +var SVG_TEXT_ANCHOR_MIDDLE = 'middle'; +var SVG_TEXT_ANCHOR_END = 'end'; - Drawing.selectedPointStyle(locs, trace, gd); -} +exports.layoutStyles = function(gd) { + return Lib.syncOrAsync([Plots.doAutoMargin, lsInner], gd); +}; -function styleOnSelect(gd, calcTrace) { - var s = calcTrace[0].node3; - var trace = calcTrace[0].trace; +function overlappingDomain(xDomain, yDomain, domains) { + for(var i = 0; i < domains.length; i++) { + var existingX = domains[i][0]; + var existingY = domains[i][1]; - if(trace.selectedpoints) { - Drawing.selectedPointStyle(s.selectAll('.choroplethlocation'), trace, gd); - } else { - styleTrace(gd, calcTrace); + if(existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) { + continue; + } + if(existingY[0] < yDomain[1] && existingY[1] > yDomain[0]) { + return true; + } } + return false; } -module.exports = { - style: style, - styleOnSelect: styleOnSelect -}; - -},{"../../components/color":570,"../../components/colorscale":585,"../../components/drawing":595,"d3":148}],911:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var mesh3dAttrs = _dereq_('../mesh3d/attributes'); -var baseAttrs = _dereq_('../../plots/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var attrs = { - x: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, - y: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, - z: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, - - u: { - valType: 'data_array', - editType: 'calc', - - }, - v: { - valType: 'data_array', - editType: 'calc', - - }, - w: { - valType: 'data_array', - editType: 'calc', - - }, - - // TODO add way to specify cone positions independently of the vector field - // provided, similar to MATLAB's coneplot Cx/Cy/Cz meshgrids, - // see https://www.mathworks.com/help/matlab/ref/coneplot.html - // - // Alternatively, if our goal is only to 'fill in gaps' in the vector data, - // we could try to extend the heatmap 'connectgaps' algorithm to 3D. - // From AJ: this particular algorithm which amounts to a Poisson equation, - // both for interpolation and extrapolation - is the right one to use for - // cones too. It makes a field with zero divergence, which is a good - // baseline assumption for vector fields. - // - // cones: { - // // potential attributes to add: - // // - // // - meshmode: 'cartesian-product', 'pts', 'grid' - // // - // // under `meshmode: 'grid'` - // // - (x|y|z)grid.start - // // - (x|y|z)grid.end - // // - (x|y|z)grid.size - // - // x: { - // valType: 'data_array', - // editType: 'calc', - // - // }, - // y: { - // valType: 'data_array', - // editType: 'calc', - // - // }, - // z: { - // valType: 'data_array', - // editType: 'calc', - // - // }, - // - // editType: 'calc', - // - // }, +function lsInner(gd) { + var fullLayout = gd._fullLayout; + var gs = fullLayout._size; + var pad = gs.p; + var axList = Axes.list(gd, '', true); + var i, subplot, plotinfo, ax, xa, ya; - sizemode: { - valType: 'enumerated', - values: ['scaled', 'absolute'], - - editType: 'calc', - dflt: 'scaled', - - }, - sizeref: { - valType: 'number', - - editType: 'calc', - min: 0, - - }, + fullLayout._paperdiv.style({ + width: (gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroWidth && !gd.layout.width) ? '100%' : fullLayout.width + 'px', + height: (gd._context.responsive && fullLayout.autosize && !gd._context._hasZeroHeight && !gd.layout.height) ? '100%' : fullLayout.height + 'px' + }) + .selectAll('.main-svg') + .call(Drawing.setSize, fullLayout.width, fullLayout.height); + gd._context.setBackground(gd, fullLayout.paper_bgcolor); - anchor: { - valType: 'enumerated', - - editType: 'calc', - values: ['tip', 'tail', 'cm', 'center'], - dflt: 'cm', - - }, + exports.drawMainTitle(gd); + ModeBar.manage(gd); - text: { - valType: 'string', - - dflt: '', - arrayOk: true, - editType: 'calc', - + // _has('cartesian') means SVG specifically, not GL2D - but GL2D + // can still get here because it makes some of the SVG structure + // for shared features like selections. + if(!fullLayout._has('cartesian')) { + return gd._promises.length && Promise.all(gd._promises); } -}; - -extendFlat(attrs, colorscaleAttrs('', { - colorAttr: 'u/v/w norm', - showScaleDflt: true, - editTypeOverride: 'calc' -}), { - colorbar: colorbarAttrs -}); - -var fromMesh3d = ['opacity', 'lightposition', 'lighting']; - -fromMesh3d.forEach(function(k) { - attrs[k] = mesh3dAttrs[k]; -}); - -attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, { - editType: 'calc', - flags: ['x', 'y', 'z', 'u', 'v', 'w', 'norm', 'text', 'name'], - dflt: 'x+y+z+norm+text+name' -}); - -attrs.transforms = undefined; - -module.exports = attrs; - -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/attributes":741,"../mesh3d/attributes":986}],912:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); - -module.exports = function calc(gd, trace) { - var u = trace.u; - var v = trace.v; - var w = trace.w; - var len = Math.min( - trace.x.length, trace.y.length, trace.z.length, - u.length, v.length, w.length - ); - var normMax = -Infinity; - var normMin = Infinity; + function getLinePosition(ax, counterAx, side) { + var lwHalf = ax._lw / 2; - for(var i = 0; i < len; i++) { - var uu = u[i]; - var vv = v[i]; - var ww = w[i]; - var norm = Math.sqrt(uu * uu + vv * vv + ww * ww); + if(ax._id.charAt(0) === 'x') { + if(!counterAx) return gs.t + gs.h * (1 - (ax.position || 0)) + (lwHalf % 1); + else if(side === 'top') return counterAx._offset - pad - lwHalf; + return counterAx._offset + counterAx._length + pad + lwHalf; + } - normMax = Math.max(normMax, norm); - normMin = Math.min(normMin, norm); + if(!counterAx) return gs.l + gs.w * (ax.position || 0) + (lwHalf % 1); + else if(side === 'right') return counterAx._offset + counterAx._length + pad + lwHalf; + return counterAx._offset - pad - lwHalf; } - trace._len = len; - trace._normMax = normMax; - - colorscaleCalc(trace, [normMin, normMax], '', 'c'); -}; - -},{"../../components/colorscale/calc":578}],913:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // some preparation of axis position info + for(i = 0; i < axList.length; i++) { + ax = axList[i]; -'use strict'; + var counterAx = ax._anchorAxis; -var conePlot = _dereq_('gl-cone3d'); -var createConeMesh = _dereq_('gl-cone3d').createConeMesh; + // clear axis line positions, to be set in the subplot loop below + ax._linepositions = {}; -var simpleMap = _dereq_('../../lib').simpleMap; -var parseColorScale = _dereq_('../../lib/gl_format_color').parseColorScale; -var zip3 = _dereq_('../../plots/gl3d/zip3'); + // stash crispRounded linewidth so we don't need to pass gd all over the place + ax._lw = Drawing.crispRound(gd, ax.linewidth, 1); -function Cone(scene, uid) { - this.scene = scene; - this.uid = uid; - this.mesh = null; - this.data = null; -} + // figure out the main axis line and main mirror line position. + // it's easier to follow the logic if we handle these separately from + // ax._linepositions, which are only used by mirror=allticks + // for non-main-subplot ticks, and mirror=all(ticks)? for zero line + // hiding logic + ax._mainLinePosition = getLinePosition(ax, counterAx, ax.side); + ax._mainMirrorPosition = (ax.mirror && counterAx) ? + getLinePosition(ax, counterAx, + alignmentConstants.OPPOSITE_SIDE[ax.side]) : null; + } -var proto = Cone.prototype; + // figure out which backgrounds we need to draw, + // and in which layers to put them + var lowerBackgroundIDs = []; + var backgroundIds = []; + var lowerDomains = []; + // no need to draw background when paper and plot color are the same color, + // activate mode just for large splom (which benefit the most from this + // optimization), but this could apply to all cartesian subplots. + var noNeedForBg = ( + Color.opacity(fullLayout.paper_bgcolor) === 1 && + Color.opacity(fullLayout.plot_bgcolor) === 1 && + fullLayout.paper_bgcolor === fullLayout.plot_bgcolor + ); -proto.handlePick = function(selection) { - if(selection.object === this.mesh) { - var selectIndex = selection.index = selection.data.index; - var xx = this.data.x[selectIndex]; - var yy = this.data.y[selectIndex]; - var zz = this.data.z[selectIndex]; - var uu = this.data.u[selectIndex]; - var vv = this.data.v[selectIndex]; - var ww = this.data.w[selectIndex]; + for(subplot in fullLayout._plots) { + plotinfo = fullLayout._plots[subplot]; - selection.traceCoordinate = [ - xx, yy, zz, - uu, vv, ww, - Math.sqrt(uu * uu + vv * vv + ww * ww) - ]; + if(plotinfo.mainplot) { + // mainplot is a reference to the main plot this one is overlaid on + // so if it exists, this is an overlaid plot and we don't need to + // give it its own background + if(plotinfo.bg) { + plotinfo.bg.remove(); + } + plotinfo.bg = undefined; + } else { + var xDomain = plotinfo.xaxis.domain; + var yDomain = plotinfo.yaxis.domain; + var plotgroup = plotinfo.plotgroup; - var text = this.data.text; - if(Array.isArray(text) && text[selectIndex] !== undefined) { - selection.textLabel = text[selectIndex]; - } else if(text) { - selection.textLabel = text; + if(overlappingDomain(xDomain, yDomain, lowerDomains)) { + 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); + } + } } - - return true; } -}; -var axisName2scaleIndex = {xaxis: 0, yaxis: 1, zaxis: 2}; -var anchor2coneOffset = {tip: 1, tail: 0, cm: 0.25, center: 0.5}; -var anchor2coneSpan = {tip: 1, tail: 1, cm: 0.75, center: 0.5}; + // now create all the lower-layer backgrounds at once now that + // we have the list of subplots that need them + var lowerBackgrounds = fullLayout._bgLayer.selectAll('.bg') + .data(lowerBackgroundIDs); -function convert(scene, trace) { - var sceneLayout = scene.fullSceneLayout; - var dataScale = scene.dataScale; - var coneOpts = {}; + lowerBackgrounds.enter().append('rect') + .classed('bg', true); - function toDataCoords(arr, axisName) { - var ax = sceneLayout[axisName]; - var scale = dataScale[axisName2scaleIndex[axisName]]; - return simpleMap(arr, function(v) { return ax.d2l(v) * scale; }); - } + lowerBackgrounds.exit().remove(); - coneOpts.vectors = zip3( - toDataCoords(trace.u, 'xaxis'), - toDataCoords(trace.v, 'yaxis'), - toDataCoords(trace.w, 'zaxis'), - trace._len - ); + lowerBackgrounds.each(function(subplot) { + fullLayout._plots[subplot].bg = d3.select(this); + }); - coneOpts.positions = zip3( - toDataCoords(trace.x, 'xaxis'), - toDataCoords(trace.y, 'yaxis'), - toDataCoords(trace.z, 'zaxis'), - trace._len - ); + // style all backgrounds + for(i = 0; i < backgroundIds.length; i++) { + plotinfo = fullLayout._plots[backgroundIds[i]]; + xa = plotinfo.xaxis; + ya = plotinfo.yaxis; - coneOpts.colormap = parseColorScale(trace.colorscale); - coneOpts.vertexIntensityBounds = [trace.cmin / trace._normMax, trace.cmax / trace._normMax]; - coneOpts.coneOffset = anchor2coneOffset[trace.anchor]; - - if(trace.sizemode === 'scaled') { - // unitless sizeref - coneOpts.coneSize = trace.sizeref || 0.5; - } else { - // sizeref here has unit of velocity - coneOpts.coneSize = trace.sizeref && trace._normMax ? - trace.sizeref / trace._normMax : - 0.5; + if(plotinfo.bg) { + plotinfo.bg + .call(Drawing.setRect, + xa._offset - pad, ya._offset - pad, + xa._length + 2 * pad, ya._length + 2 * pad) + .call(Color.fill, fullLayout.plot_bgcolor) + .style('stroke-width', 0); + } } - var meshData = conePlot(coneOpts); - - // pass gl-mesh3d lighting attributes - var lp = trace.lightposition; - meshData.lightPosition = [lp.x, lp.y, lp.z]; - meshData.ambient = trace.lighting.ambient; - meshData.diffuse = trace.lighting.diffuse; - meshData.specular = trace.lighting.specular; - meshData.roughness = trace.lighting.roughness; - meshData.fresnel = trace.lighting.fresnel; - meshData.opacity = trace.opacity; - - // stash autorange pad value - trace._pad = anchor2coneSpan[trace.anchor] * meshData.vectorScale * meshData.coneScale * trace._normMax; - - return meshData; -} - -proto.update = function(data) { - this.data = data; - - var meshData = convert(this.scene, data); - this.mesh.update(meshData); -}; - -proto.dispose = function() { - this.scene.glplot.remove(this.mesh); - this.mesh.dispose(); -}; - -function createConeTrace(scene, data) { - var gl = scene.glplot.gl; + if(!fullLayout._hasOnlyLargeSploms) { + for(subplot in fullLayout._plots) { + plotinfo = fullLayout._plots[subplot]; + xa = plotinfo.xaxis; + ya = plotinfo.yaxis; - var meshData = convert(scene, data); - var mesh = createConeMesh(gl, meshData); + // Clip so that data only shows up on the plot area. + var clipId = plotinfo.clipId = 'clip' + fullLayout._uid + subplot + 'plot'; - var cone = new Cone(scene, data.uid); - cone.mesh = mesh; - cone.data = data; - mesh._trace = cone; + var plotClip = Lib.ensureSingleById(fullLayout._clips, 'clipPath', clipId, function(s) { + s.classed('plotclip', true) + .append('rect'); + }); - scene.glplot.add(mesh); + plotinfo.clipRect = plotClip.select('rect').attr({ + width: xa._length, + height: ya._length + }); - return cone; -} + Drawing.setTranslate(plotinfo.plot, xa._offset, ya._offset); -module.exports = createConeTrace; + var plotClipId; + var layerClipId; -},{"../../lib":696,"../../lib/gl_format_color":692,"../../plots/gl3d/zip3":798,"gl-cone3d":231}],914:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(plotinfo._hasClipOnAxisFalse) { + plotClipId = null; + layerClipId = clipId; + } else { + plotClipId = clipId; + layerClipId = null; + } + Drawing.setClipUrl(plotinfo.plot, plotClipId, gd); -'use strict'; + // stash layer clipId value (null or same as clipId) + // to DRY up Drawing.setClipUrl calls on trace-module and trace layers + // downstream + plotinfo.layerClipId = layerClipId; + } + } -var Lib = _dereq_('../../lib'); + var xLinesXLeft, xLinesXRight, xLinesYBottom, xLinesYTop, + leftYLineWidth, rightYLineWidth; + var yLinesYBottom, yLinesYTop, yLinesXLeft, yLinesXRight, + connectYBottom, connectYTop; + var extraSubplot; -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); + function xLinePath(y) { + return 'M' + xLinesXLeft + ',' + y + 'H' + xLinesXRight; + } -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + function xLinePathFree(y) { + return 'M' + xa._offset + ',' + y + 'h' + xa._length; } - var u = coerce('u'); - var v = coerce('v'); - var w = coerce('w'); + function yLinePath(x) { + return 'M' + x + ',' + yLinesYTop + 'V' + yLinesYBottom; + } - var x = coerce('x'); - var y = coerce('y'); - var z = coerce('z'); + function yLinePathFree(x) { + return 'M' + x + ',' + ya._offset + 'v' + ya._length; + } - if( - !u || !u.length || !v || !v.length || !w || !w.length || - !x || !x.length || !y || !y.length || !z || !z.length - ) { - traceOut.visible = false; - return; + function mainPath(ax, pathFn, pathFnFree) { + if(!ax.showline || subplot !== ax._mainSubplot) return ''; + if(!ax._anchorAxis) return pathFnFree(ax._mainLinePosition); + var out = pathFn(ax._mainLinePosition); + if(ax.mirror) out += pathFn(ax._mainMirrorPosition); + return out; } - coerce('sizeref'); - coerce('sizemode'); - - coerce('anchor'); - - coerce('lighting.ambient'); - coerce('lighting.diffuse'); - coerce('lighting.specular'); - coerce('lighting.roughness'); - coerce('lighting.fresnel'); - coerce('lightposition.x'); - coerce('lightposition.y'); - coerce('lightposition.z'); + for(subplot in fullLayout._plots) { + plotinfo = fullLayout._plots[subplot]; + xa = plotinfo.xaxis; + ya = plotinfo.yaxis; - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); + /* + * x lines get longer where they meet y lines, to make a crisp corner. + * The x lines get the padding (margin.pad) plus the y line width to + * fill up the corner nicely. Free x lines are excluded - they always + * span exactly the data area of the plot + * + * | XXXXX + * | XXXXX + * | + * +------ + * x1 + * ----- + * x2 + */ + var xPath = 'M0,0'; + if(shouldShowLinesOrTicks(xa, subplot)) { + leftYLineWidth = findCounterAxisLineWidth(xa, 'left', ya, axList); + xLinesXLeft = xa._offset - (leftYLineWidth ? (pad + leftYLineWidth) : 0); + rightYLineWidth = findCounterAxisLineWidth(xa, 'right', ya, axList); + xLinesXRight = xa._offset + xa._length + (rightYLineWidth ? (pad + rightYLineWidth) : 0); + xLinesYBottom = getLinePosition(xa, ya, 'bottom'); + xLinesYTop = getLinePosition(xa, ya, 'top'); - coerce('text'); + // save axis line positions for extra ticks to reference + // each subplot that gets ticks from "allticks" gets an entry: + // [left or bottom, right or top] + extraSubplot = (!xa._anchorAxis || subplot !== xa._mainSubplot); + if(extraSubplot && (xa.mirror === 'allticks' || xa.mirror === 'all')) { + xa._linepositions[subplot] = [xLinesYBottom, xLinesYTop]; + } - // disable 1D transforms (for now) - traceOut._length = null; -}; + xPath = mainPath(xa, xLinePath, xLinePathFree); + if(extraSubplot && xa.showline && (xa.mirror === 'all' || xa.mirror === 'allticks')) { + xPath += xLinePath(xLinesYBottom) + xLinePath(xLinesYTop); + } -},{"../../components/colorscale/defaults":580,"../../lib":696,"./attributes":911}],915:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + plotinfo.xlines + .style('stroke-width', xa._lw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + } + plotinfo.xlines.attr('d', xPath); -'use strict'; + /* + * y lines that meet x axes get longer only by margin.pad, because + * the x axes fill in the corner space. Free y axes, like free x axes, + * always span exactly the data area of the plot + * + * | | XXXX + * y2| y1| XXXX + * | | XXXX + * | + * +----- + */ + var yPath = 'M0,0'; + if(shouldShowLinesOrTicks(ya, subplot)) { + connectYBottom = findCounterAxisLineWidth(ya, 'bottom', xa, axList); + yLinesYBottom = ya._offset + ya._length + (connectYBottom ? pad : 0); + connectYTop = findCounterAxisLineWidth(ya, 'top', xa, axList); + yLinesYTop = ya._offset - (connectYTop ? pad : 0); + yLinesXLeft = getLinePosition(ya, xa, 'left'); + yLinesXRight = getLinePosition(ya, xa, 'right'); -module.exports = { - moduleType: 'trace', - name: 'cone', - basePlotModule: _dereq_('../../plots/gl3d'), - categories: ['gl3d'], + extraSubplot = (!ya._anchorAxis || subplot !== ya._mainSubplot); + if(extraSubplot && (ya.mirror === 'allticks' || ya.mirror === 'all')) { + ya._linepositions[subplot] = [yLinesXLeft, yLinesXRight]; + } - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults'), - colorbar: { - min: 'cmin', - max: 'cmax' - }, - calc: _dereq_('./calc'), - plot: _dereq_('./convert'), + yPath = mainPath(ya, yLinePath, yLinePathFree); + if(extraSubplot && ya.showline && (ya.mirror === 'all' || ya.mirror === 'allticks')) { + yPath += yLinePath(yLinesXLeft) + yLinePath(yLinesXRight); + } - meta: { - + plotinfo.ylines + .style('stroke-width', ya._lw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } + plotinfo.ylines.attr('d', yPath); } -}; - -},{"../../plots/gl3d":787,"./attributes":911,"./calc":912,"./convert":913,"./defaults":914}],916:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; + Axes.makeClipPaths(gd); -var heatmapAttrs = _dereq_('../heatmap/attributes'); -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var dash = _dereq_('../../components/drawing/attributes').dash; -var fontAttrs = _dereq_('../../plots/font_attributes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; + return gd._promises.length && Promise.all(gd._promises); +} -var filterOps = _dereq_('../../constants/filter_ops'); -var COMPARISON_OPS2 = filterOps.COMPARISON_OPS2; -var INTERVAL_OPS = filterOps.INTERVAL_OPS; - -var scatterLineAttrs = scatterAttrs.line; - -module.exports = extendFlat({ - z: heatmapAttrs.z, - x: heatmapAttrs.x, - x0: heatmapAttrs.x0, - dx: heatmapAttrs.dx, - y: heatmapAttrs.y, - y0: heatmapAttrs.y0, - dy: heatmapAttrs.dy, - text: heatmapAttrs.text, - transpose: heatmapAttrs.transpose, - xtype: heatmapAttrs.xtype, - ytype: heatmapAttrs.ytype, - zhoverformat: heatmapAttrs.zhoverformat, +function shouldShowLinesOrTicks(ax, subplot) { + return (ax.ticks || ax.showline) && + (subplot === ax._mainSubplot || ax.mirror === 'all' || ax.mirror === 'allticks'); +} - connectgaps: heatmapAttrs.connectgaps, +/* + * should we draw a line on counterAx at this side of ax? + * It's assumed that counterAx is known to overlay the subplot we're working on + * but it may not be its main axis. + */ +function shouldShowLineThisSide(ax, side, counterAx) { + // does counterAx get a line at all? + if(!counterAx.showline || !counterAx._lw) return false; - fillcolor: { - valType: 'color', - - editType: 'calc', - - }, + // are we drawing *all* lines for counterAx? + if(counterAx.mirror === 'all' || counterAx.mirror === 'allticks') return true; - autocontour: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - impliedEdits: { - 'contours.start': undefined, - 'contours.end': undefined, - 'contours.size': undefined - }, - - }, - ncontours: { - valType: 'integer', - dflt: 15, - min: 1, - - editType: 'calc', - - }, + var anchorAx = counterAx._anchorAxis; - contours: { - type: { - valType: 'enumerated', - values: ['levels', 'constraint'], - dflt: 'levels', - - editType: 'calc', - - }, - start: { - valType: 'number', - dflt: null, - - editType: 'plot', - impliedEdits: {'^autocontour': false}, - - }, - end: { - valType: 'number', - dflt: null, - - editType: 'plot', - impliedEdits: {'^autocontour': false}, - - }, - size: { - valType: 'number', - dflt: null, - min: 0, - - editType: 'plot', - impliedEdits: {'^autocontour': false}, - - }, - coloring: { - valType: 'enumerated', - values: ['fill', 'heatmap', 'lines', 'none'], - dflt: 'fill', - - editType: 'calc', - - }, - showlines: { - valType: 'boolean', - dflt: true, - - editType: 'plot', - - }, - showlabels: { - valType: 'boolean', - dflt: false, - - editType: 'plot', - - }, - labelfont: fontAttrs({ - editType: 'plot', - colorEditType: 'style', - - }), - labelformat: { - valType: 'string', - dflt: '', - - editType: 'plot', - - }, - operation: { - valType: 'enumerated', - values: [].concat(COMPARISON_OPS2).concat(INTERVAL_OPS), - - dflt: '=', - editType: 'calc', - - }, - value: { - valType: 'any', - dflt: 0, - - editType: 'calc', - - }, - editType: 'calc', - impliedEdits: {'autocontour': false} - }, + // is this a free axis? free axes can only have a subplot side-line with all(ticks)? mirroring + if(!anchorAx) return false; - line: { - color: extendFlat({}, scatterLineAttrs.color, { - editType: 'style+colorbars', - - }), - width: extendFlat({}, scatterLineAttrs.width, { - editType: 'style+colorbars' - }), - dash: dash, - smoothing: extendFlat({}, scatterLineAttrs.smoothing, { - - }), - editType: 'plot' + // in order to handle cases where the user forgot to anchor this axis correctly + // (because its default anchor has the same domain on the relevant end) + // check whether the relevant position is the same. + var sideIndex = alignmentConstants.FROM_BL[side]; + if(counterAx.side === side) { + return anchorAx.domain[sideIndex] === ax.domain[sideIndex]; } -}, - colorscaleAttrs('', { - cLetter: 'z', - autoColorDflt: false, - editTypeOverride: 'calc' - }), - { colorbar: colorbarAttrs } -); - -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../components/drawing/attributes":594,"../../constants/filter_ops":669,"../../lib/extend":685,"../../plots/font_attributes":771,"../heatmap/attributes":945,"../scatter/attributes":1043}],917:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return counterAx.mirror && anchorAx.domain[1 - sideIndex] === ax.domain[1 - sideIndex]; +} +/* + * Is there another axis intersecting `side` end of `ax`? + * First look at `counterAx` (the axis for this subplot), + * then at all other potential counteraxes on or overlaying this subplot. + * Take the line width from the first one that has a line. + */ +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; +} -'use strict'; +exports.drawMainTitle = function(gd) { + var fullLayout = gd._fullLayout; -var heatmapCalc = _dereq_('../heatmap/calc'); -var setContours = _dereq_('./set_contours'); + var textAnchor = getMainTitleTextAnchor(fullLayout); + var dy = getMainTitleDy(fullLayout); -// most is the same as heatmap calc, then adjust it -// though a few things inside heatmap calc still look for -// contour maps, because the makeBoundArray calls are too entangled -module.exports = function calc(gd, trace) { - var cd = heatmapCalc(gd, trace); - setContours(trace); - return cd; + Titles.draw(gd, 'gtitle', { + propContainer: fullLayout, + propName: 'title.text', + placeholder: fullLayout._dfltTitle.plot, + attributes: { + x: getMainTitleX(fullLayout, textAnchor), + y: getMainTitleY(fullLayout, dy), + 'text-anchor': textAnchor, + dy: dy + } + }); }; -},{"../heatmap/calc":946,"./set_contours":935}],918:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function getMainTitleX(fullLayout, textAnchor) { + var title = fullLayout.title; + var gs = fullLayout._size; + var hPadShift = 0; -'use strict'; + if(textAnchor === SVG_TEXT_ANCHOR_START) { + hPadShift = title.pad.l; + } else if(textAnchor === SVG_TEXT_ANCHOR_END) { + hPadShift = -title.pad.r; + } -module.exports = function(pathinfo, operation, perimeter, trace) { - // Abandon all hope, ye who enter here. - var i, v1, v2; - var pi0 = pathinfo[0]; - var na = pi0.x.length; - var nb = pi0.y.length; - var z = pi0.z; - var contours = trace.contours; + switch(title.xref) { + case 'paper': + return gs.l + gs.w * title.x + hPadShift; + case 'container': + default: + return fullLayout.width * title.x + hPadShift; + } +} - var boundaryMax = -Infinity; - var boundaryMin = Infinity; +function getMainTitleY(fullLayout, dy) { + var title = fullLayout.title; + var gs = fullLayout._size; + var vPadShift = 0; - for(i = 0; i < nb; i++) { - boundaryMin = Math.min(boundaryMin, z[i][0]); - boundaryMin = Math.min(boundaryMin, z[i][na - 1]); - boundaryMax = Math.max(boundaryMax, z[i][0]); - boundaryMax = Math.max(boundaryMax, z[i][na - 1]); + if(dy === '0em' || !dy) { + vPadShift = -title.pad.b; + } else if(dy === alignmentConstants.CAP_SHIFT + 'em') { + vPadShift = title.pad.t; } - for(i = 1; i < na - 1; i++) { - boundaryMin = Math.min(boundaryMin, z[0][i]); - boundaryMin = Math.min(boundaryMin, z[nb - 1][i]); - boundaryMax = Math.max(boundaryMax, z[0][i]); - boundaryMax = Math.max(boundaryMax, z[nb - 1][i]); + if(title.y === 'auto') { + return gs.t / 2; + } else { + switch(title.yref) { + case 'paper': + return gs.t + gs.h - gs.h * title.y + vPadShift; + case 'container': + default: + return fullLayout.height - fullLayout.height * title.y + vPadShift; + } } +} - pi0.prefixBoundary = false; +function getMainTitleTextAnchor(fullLayout) { + var title = fullLayout.title; - switch(operation) { - case '>': - if(contours.value > boundaryMax) { - pi0.prefixBoundary = true; - } - break; - case '<': - if(contours.value < boundaryMin) { - pi0.prefixBoundary = true; - } - break; - case '[]': - v1 = Math.min.apply(null, contours.value); - v2 = Math.max.apply(null, contours.value); - if(v2 < boundaryMin || v1 > boundaryMax) { - pi0.prefixBoundary = true; - } - break; - case '][': - v1 = Math.min.apply(null, contours.value); - v2 = Math.max.apply(null, contours.value); - if(v1 < boundaryMin && v2 > boundaryMax) { - pi0.prefixBoundary = true; - } - break; + 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; } -}; - -},{}],919:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + return textAnchor; +} -var drawColorbar = _dereq_('../../components/colorbar/draw'); +function getMainTitleDy(fullLayout) { + var title = fullLayout.title; -var makeColorMap = _dereq_('./make_color_map'); -var endPlus = _dereq_('./end_plus'); + var dy = '0em'; + if(Lib.isTopAnchor(title)) { + dy = alignmentConstants.CAP_SHIFT + 'em'; + } else if(Lib.isMiddleAnchor(title)) { + dy = alignmentConstants.MID_SHIFT + 'em'; + } + return dy; +} -module.exports = function colorbar(gd, cd) { - var trace = cd[0].trace; - var cbId = 'cb' + trace.uid; +exports.doTraceStyle = function(gd) { + var calcdata = gd.calcdata; + var editStyleCalls = []; + var i; - gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); + for(i = 0; i < calcdata.length; i++) { + var cd = calcdata[i]; + var cd0 = cd[0] || {}; + var trace = cd0.trace || {}; + var _module = trace._module || {}; - if(!trace.showscale) return; + // See if we need to do arraysToCalcdata + // call it regardless of what change we made, in case + // supplyDefaults brought in an array that was already + // in gd.data but not in gd._fullData previously + var arraysToCalcdata = _module.arraysToCalcdata; + if(arraysToCalcdata) arraysToCalcdata(cd, trace); - var cb = cd[0].t.cb = drawColorbar(gd, cbId); + var editStyle = _module.editStyle; + if(editStyle) editStyleCalls.push({fn: editStyle, cd0: cd0}); + } - var contours = trace.contours; - var line = trace.line; - var cs = contours.size || 1; - var coloring = contours.coloring; + if(editStyleCalls.length) { + for(i = 0; i < editStyleCalls.length; i++) { + var edit = editStyleCalls[i]; + edit.fn(gd, edit.cd0); + } + clearGlCanvases(gd); + exports.redrawReglTraces(gd); + } - var colorMap = makeColorMap(trace, {isColorbar: true}); + Plots.style(gd); + Registry.getComponentMethod('legend', 'draw')(gd); - cb.fillgradient(coloring === 'heatmap' ? trace.colorscale : '') - .zrange(coloring === 'heatmap' ? [trace.zmin, trace.zmax] : '') - .fillcolor((coloring === 'fill') ? colorMap : '') - .line({ - color: coloring === 'lines' ? colorMap : line.color, - width: contours.showlines !== false ? line.width : 0, - dash: line.dash - }) - .levels({ - start: contours.start, - end: endPlus(contours), - size: cs - }) - .options(trace.colorbar)(); + return Plots.previousPromises(gd); }; -},{"../../components/colorbar/draw":575,"./end_plus":927,"./make_color_map":932}],920:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +exports.doColorBars = function(gd) { + for(var i = 0; i < gd.calcdata.length; i++) { + var cdi0 = gd.calcdata[i][0]; -'use strict'; -module.exports = { - // some constants to help with marching squares algorithm - // where does the path start for each index? - BOTTOMSTART: [1, 9, 13, 104, 713], - TOPSTART: [4, 6, 7, 104, 713], - LEFTSTART: [8, 12, 14, 208, 1114], - RIGHTSTART: [2, 3, 11, 208, 1114], - - // which way [dx,dy] do we leave a given index? - // saddles are already disambiguated - NEWDELTA: [ - null, [-1, 0], [0, -1], [-1, 0], - [1, 0], null, [0, -1], [-1, 0], - [0, 1], [0, 1], null, [0, 1], - [1, 0], [1, 0], [0, -1] - ], + if((cdi0.t || {}).cb) { + var trace = cdi0.trace; + var cb = cdi0.t.cb; - // for each saddle, the first index here is used - // for dx||dy<0, the second for dx||dy>0 - CHOOSESADDLE: { - 104: [4, 1], - 208: [2, 8], - 713: [7, 13], - 1114: [11, 14] - }, - - // after one index has been used for a saddle, which do we - // substitute to be used up later? - SADDLEREMAINDER: {1: 4, 2: 8, 4: 1, 7: 13, 8: 2, 11: 14, 13: 7, 14: 11}, - - // length of a contour, as a multiple of the plot area diagonal, per label - LABELDISTANCE: 2, - - // number of contour levels after which we start increasing the number of - // labels we draw. Many contours means they will generally be close - // together, so it will be harder to follow a long way to find a label - LABELINCREASE: 10, - - // minimum length of a contour line, as a multiple of the label length, - // at which we draw *any* labels - LABELMIN: 3, - - // max number of labels to draw on a single contour path, no matter how long - LABELMAX: 10, - - // constants for the label position cost function - LABELOPTIMIZER: { - // weight given to edge proximity - EDGECOST: 1, - // weight given to the angle off horizontal - ANGLECOST: 1, - // weight given to distance from already-placed labels - NEIGHBORCOST: 5, - // cost multiplier for labels on the same level - SAMELEVELFACTOR: 10, - // minimum distance (as a multiple of the label length) - // for labels on the same level - SAMELEVELDISTANCE: 5, - // maximum cost before we won't even place the label - MAXCOST: 100, - // number of evenly spaced points to look at in the first - // iteration of the search - INITIALSEARCHPOINTS: 10, - // number of binary search iterations after the initial wide search - ITERATIONS: 5 + if(Registry.traceIs(trace, 'contour')) { + cb.line({ + width: trace.contours.showlines !== false ? + trace.line.width : 0, + dash: trace.line.dash, + color: trace.contours.coloring === 'line' ? + cb._opts.line.color : trace.line.color + }); + } + var moduleOpts = trace._module.colorbar; + var containerName = moduleOpts.container; + var opts = (containerName ? trace[containerName] : trace).colorbar; + cb.options(opts)(); + } } -}; - -},{}],921:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); + return Plots.previousPromises(gd); +}; -var handleLabelDefaults = _dereq_('./label_defaults'); +// force plot() to redo the layout and replot with the modified layout +exports.layoutReplot = function(gd) { + var layout = gd.layout; + gd.layout = undefined; + return Registry.call('plot', gd, '', layout); +}; -var Color = _dereq_('../../components/color'); -var addOpacity = Color.addOpacity; -var opacity = Color.opacity; +exports.doLegend = function(gd) { + Registry.getComponentMethod('legend', 'draw')(gd); + return Plots.previousPromises(gd); +}; -var filterOps = _dereq_('../../constants/filter_ops'); -var CONSTRAINT_REDUCTION = filterOps.CONSTRAINT_REDUCTION; -var COMPARISON_OPS2 = filterOps.COMPARISON_OPS2; +exports.doTicksRelayout = function(gd) { + Axes.draw(gd, 'redraw'); -module.exports = function handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor, opts) { - var contours = traceOut.contours; - var showLines, lineColor, fillColor; + if(gd._fullLayout._hasOnlyLargeSploms) { + Registry.subplotsRegistry.splom.updateGrid(gd); + clearGlCanvases(gd); + exports.redrawReglTraces(gd); + } - var operation = coerce('contours.operation'); - contours._operation = CONSTRAINT_REDUCTION[operation]; + exports.drawMainTitle(gd); + return Plots.previousPromises(gd); +}; - handleConstraintValueDefaults(coerce, contours); +exports.doModeBar = function(gd) { + var fullLayout = gd._fullLayout; - if(operation === '=') { - showLines = contours.showlines = true; - } - else { - showLines = coerce('contours.showlines'); - fillColor = coerce('fillcolor', addOpacity( - (traceIn.line || {}).color || defaultColor, 0.5 - )); - } + ModeBar.manage(gd); - if(showLines) { - var lineDfltColor = fillColor && opacity(fillColor) ? - addOpacity(traceOut.fillcolor, 1) : - defaultColor; - lineColor = coerce('line.color', lineDfltColor); - coerce('line.width', 2); - coerce('line.dash'); + for(var i = 0; i < fullLayout._basePlotModules.length; i++) { + var updateFx = fullLayout._basePlotModules[i].updateFx; + if(updateFx) updateFx(gd); } - coerce('line.smoothing'); - - handleLabelDefaults(coerce, layout, lineColor, opts); + return Plots.previousPromises(gd); }; -function handleConstraintValueDefaults(coerce, contours) { - var zvalue; - - if(COMPARISON_OPS2.indexOf(contours.operation) === -1) { - // Requires an array of two numbers: - coerce('contours.value', [0, 1]); +exports.doCamera = function(gd) { + var fullLayout = gd._fullLayout; + var sceneIds = fullLayout._subplots.gl3d; - if(!Array.isArray(contours.value)) { - if(isNumeric(contours.value)) { - zvalue = parseFloat(contours.value); - contours.value = [zvalue, zvalue + 1]; - } - } else if(contours.value.length > 2) { - contours.value = contours.value.slice(2); - } else if(contours.length === 0) { - contours.value = [0, 1]; - } else if(contours.length < 2) { - zvalue = parseFloat(contours.value[0]); - contours.value = [zvalue, zvalue + 1]; - } else { - contours.value = [ - parseFloat(contours.value[0]), - parseFloat(contours.value[1]) - ]; - } - } else { - // Requires a single scalar: - coerce('contours.value', 0); + for(var i = 0; i < sceneIds.length; i++) { + var sceneLayout = fullLayout[sceneIds[i]]; + var scene = sceneLayout._scene; - if(!isNumeric(contours.value)) { - if(Array.isArray(contours.value)) { - contours.value = parseFloat(contours.value[0]); - } else { - contours.value = 0; - } - } + scene.setCamera(sceneLayout.camera); } -} +}; -},{"../../components/color":570,"../../constants/filter_ops":669,"./label_defaults":931,"fast-isnumeric":214}],922:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +exports.drawData = function(gd) { + var fullLayout = gd._fullLayout; + var calcdata = gd.calcdata; + var i; -'use strict'; + // remove old colorbars explicitly + for(i = 0; i < calcdata.length; i++) { + var trace = calcdata[i][0].trace; + if(trace.visible !== true || !trace._module.colorbar) { + fullLayout._infolayer.select('.cb' + trace.uid).remove(); + } + } -var filterOps = _dereq_('../../constants/filter_ops'); -var isNumeric = _dereq_('fast-isnumeric'); + clearGlCanvases(gd); -// This syntax conforms to the existing filter transform syntax, but we don't care -// about open vs. closed intervals for simply drawing contours constraints: -module.exports = { - '[]': makeRangeSettings('[]'), - '][': makeRangeSettings(']['), - '>': makeInequalitySettings('>'), - '<': makeInequalitySettings('<'), - '=': makeInequalitySettings('=') -}; + // loop over the base plot modules present on graph + var basePlotModules = fullLayout._basePlotModules; + for(i = 0; i < basePlotModules.length; i++) { + basePlotModules[i].plot(gd); + } -// This does not in any way shape or form support calendars. It's adapted from -// transforms/filter.js. -function coerceValue(operation, value) { - var hasArrayValue = Array.isArray(value); + exports.redrawReglTraces(gd); - var coercedValue; + // styling separate from drawing + Plots.style(gd); - function coerce(value) { - return isNumeric(value) ? (+value) : null; - } + // show annotations and shapes + Registry.getComponentMethod('shapes', 'draw')(gd); + Registry.getComponentMethod('annotations', 'draw')(gd); - if(filterOps.COMPARISON_OPS2.indexOf(operation) !== -1) { - coercedValue = hasArrayValue ? coerce(value[0]) : coerce(value); - } else if(filterOps.INTERVAL_OPS.indexOf(operation) !== -1) { - coercedValue = hasArrayValue ? - [coerce(value[0]), coerce(value[1])] : - [coerce(value), coerce(value)]; - } else if(filterOps.SET_OPS.indexOf(operation) !== -1) { - coercedValue = hasArrayValue ? value.map(coerce) : [coerce(value)]; - } + // Mark the first render as complete + fullLayout._replotting = false; - return coercedValue; -} + return Plots.previousPromises(gd); +}; -// Returns a parabola scaled so that the min/max is either +/- 1 and zero at the two values -// provided. The data is mapped by this function when constructing intervals so that it's -// very easy to construct contours as normal. -function makeRangeSettings(operation) { - return function(value) { - value = coerceValue(operation, value); +// Draw (or redraw) all regl-based traces in one go, +// useful during drag and selection where buffers of targeted traces are updated, +// but all traces need to be redrawn following clearGlCanvases. +// +// Note that _module.plot for regl trace does NOT draw things +// on the canvas, they only update the buffers. +// Drawing is perform here. +// +// TODO try adding per-subplot option using gl.SCISSOR_TEST for +// non-overlaying, disjoint subplots. +// +// TODO try to include parcoords in here. +// https://github.com/plotly/plotly.js/issues/3069 +exports.redrawReglTraces = function(gd) { + var fullLayout = gd._fullLayout; - // Ensure proper ordering: - var min = Math.min(value[0], value[1]); - var max = Math.max(value[0], value[1]); + if(fullLayout._has('regl')) { + var fullData = gd._fullData; + var cartesianIds = []; + var polarIds = []; + var i, sp; - return { - start: min, - end: max, - size: max - min - }; - }; -} + if(fullLayout._hasOnlyLargeSploms) { + fullLayout._splomGrid.draw(); + } -function makeInequalitySettings(operation) { - return function(value) { - value = coerceValue(operation, value); + // N.B. + // - Loop over fullData (not _splomScenes) to preserve splom trace-to-trace ordering + // - Fill list if subplot ids (instead of fullLayout._subplots) to handle cases where all traces + // of a given module are `visible !== true` + for(i = 0; i < fullData.length; i++) { + var trace = fullData[i]; - return { - start: value, - end: Infinity, - size: Infinity - }; - }; -} + if(trace.visible === true) { + 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); + } + } + } -},{"../../constants/filter_ops":669,"fast-isnumeric":214}],923:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + for(i = 0; i < cartesianIds.length; i++) { + sp = fullLayout._plots[cartesianIds[i]]; + if(sp._scene) sp._scene.draw(); + } -'use strict'; + for(i = 0; i < polarIds.length; i++) { + sp = fullLayout[polarIds[i]]._subplot; + if(sp._scene) sp._scene.draw(); + } + } +}; + +exports.doAutoRangeAndConstraints = function(gd) { + var axList = Axes.list(gd, '', true); -module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerce2) { - var contourStart = coerce2('contours.start'); - var contourEnd = coerce2('contours.end'); - var missingEnd = (contourStart === false) || (contourEnd === false); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + // in case margins changed, update scale + ax.setScale(); + doAutoRange(gd, ax); + } - // normally we only need size if autocontour is off. But contour.calc - // pushes its calculated contour size back to the input trace, so for - // things like restyle that can call supplyDefaults without calc - // after the initial draw, we can just reuse the previous calculation - var contourSize = coerce('contours.size'); - var autoContour; + enforceAxisConstraints(gd); +}; - if(missingEnd) autoContour = traceOut.autocontour = true; - else autoContour = coerce('autocontour', false); +// An initial paint must be completed before these components can be +// correctly sized and the whole plot re-margined. fullLayout._replotting must +// be set to false before these will work properly. +exports.finalDraw = function(gd) { + Registry.getComponentMethod('shapes', 'draw')(gd); + Registry.getComponentMethod('images', 'draw')(gd); + Registry.getComponentMethod('annotations', 'draw')(gd); + // TODO: rangesliders really belong in marginPushers but they need to be + // drawn after data - can we at least get the margin pushing part separated + // out and done earlier? + Registry.getComponentMethod('rangeslider', 'draw')(gd); + // TODO: rangeselector only needs to be here (in addition to drawMarginPushers) + // because the margins need to be fully determined before we can call + // autorange and update axis ranges (which rangeselector needs to know which + // button is active). Can we break out its automargin step from its draw step? + Registry.getComponentMethod('rangeselector', 'draw')(gd); +}; - if(autoContour || !contourSize) coerce('ncontours'); +exports.drawMarginPushers = function(gd) { + Registry.getComponentMethod('legend', 'draw')(gd); + Registry.getComponentMethod('rangeselector', 'draw')(gd); + Registry.getComponentMethod('sliders', 'draw')(gd); + Registry.getComponentMethod('updatemenus', 'draw')(gd); }; -},{}],924:[function(_dereq_,module,exports){ +},{"../components/color":43,"../components/drawing":64,"../components/modebar":102,"../components/titles":131,"../constants/alignment":138,"../lib":159,"../lib/clear_gl_canvases":148,"../plots/cartesian/autorange":202,"../plots/cartesian/axes":203,"../plots/cartesian/constraints":211,"../plots/plots":236,"../registry":243,"d3":8}],195:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var Lib = _dereq_('../../lib'); +var Lib = _dereq_('../lib'); +var isPlainObject = Lib.isPlainObject; +var PlotSchema = _dereq_('./plot_schema'); +var Plots = _dereq_('../plots/plots'); +var plotAttributes = _dereq_('../plots/attributes'); +var Template = _dereq_('./plot_template'); +var dfltConfig = _dereq_('./plot_config').dfltConfig; -// The contour extraction is great, except it totally fails for constraints because we -// need weird range loops and flipped contours instead of the usual format. This function -// does some weird manipulation of the extracted pathinfo data such that it magically -// draws contours correctly *as* constraints. -module.exports = function(pathinfo, operation) { - var i, pi0, pi1; +/** + * Plotly.makeTemplate: create a template off an existing figure to reuse + * style attributes on other figures. + * + * Note: separated from the rest of templates because otherwise we get circular + * references due to PlotSchema. + * + * @param {object|DOM element|string} figure: The figure to base the template on + * should contain a trace array `figure.data` + * and a layout object `figure.layout` + * @returns {object} template: the extracted template - can then be used as + * `layout.template` in another figure. + */ +exports.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 || {}; + // copy over a few items to help follow the schema + layout._basePlotModules = figure._fullLayout._basePlotModules; + layout._modules = figure._fullLayout._modules; - var op0 = function(arr) { return arr.reverse(); }; - var op1 = function(arr) { return arr; }; + var template = { + data: {}, + layout: {} + }; - switch(operation) { - case '=': - case '<': - return pathinfo; - case '>': - if(pathinfo.length !== 1) { - Lib.warn('Contour data invalid for the specified inequality operation.'); - } + /* + * Note: we do NOT validate template values, we just take what's in the + * user inputs data and layout, not the validated values in fullData and + * fullLayout. Even if we were to validate here, there's no guarantee that + * these values would still be valid when applied to a new figure, which + * may contain different trace modes, different axes, etc. So it's + * important that when applying a template we still validate the template + * values, rather than just using them as defaults. + */ - // In this case there should be exactly two contour levels in pathinfo. We - // simply concatenate the info into one pathinfo and flip all of the data - // in one. This will draw the contour as closed. - pi0 = pathinfo[0]; + data.forEach(function(trace) { + // TODO: What if no style info is extracted for this trace. We may + // not want an empty object as the null value. + // TODO: allow transforms to contribute to templates? + // as it stands they are ignored, which may be for the best... - for(i = 0; i < pi0.edgepaths.length; i++) { - pi0.edgepaths[i] = op0(pi0.edgepaths[i]); - } + var traceTemplate = {}; + walkStyleKeys(trace, traceTemplate, getTraceInfo.bind(null, trace)); - for(i = 0; i < pi0.paths.length; i++) { - pi0.paths[i] = op0(pi0.paths[i]); - } - return pathinfo; - case '][': - var tmp = op0; - op0 = op1; - op1 = tmp; - // It's a nice rule, except this definitely *is* what's intended here. - /* eslint-disable: no-fallthrough */ - case '[]': - /* eslint-enable: no-fallthrough */ - if(pathinfo.length !== 2) { - Lib.warn('Contour data invalid for the specified inequality range operation.'); - } + var traceType = Lib.coerce(trace, {}, plotAttributes, 'type'); + var typeTemplates = template.data[traceType]; + if(!typeTemplates) typeTemplates = template.data[traceType] = []; + typeTemplates.push(traceTemplate); + }); - // In this case there should be exactly two contour levels in pathinfo. We - // simply concatenate the info into one pathinfo and flip all of the data - // in one. This will draw the contour as closed. - pi0 = copyPathinfo(pathinfo[0]); - pi1 = copyPathinfo(pathinfo[1]); + walkStyleKeys(layout, template.layout, getLayoutInfo.bind(null, layout)); - for(i = 0; i < pi0.edgepaths.length; i++) { - pi0.edgepaths[i] = op0(pi0.edgepaths[i]); - } + /* + * Compose the new template with an existing one to the same effect + * + * NOTE: there's a possibility of slightly different behavior: if the plot + * has an invalid value and the old template has a valid value for the same + * attribute, the plot will use the old template value but this routine + * will pull the invalid value (resulting in the original default). + * In the general case it's not possible to solve this with a single value, + * since valid options can be context-dependent. It could be solved with + * a *list* of values, but that would be huge complexity for little gain. + */ + delete template.layout.template; + var oldTemplate = layout.template; + if(isPlainObject(oldTemplate)) { + var oldLayoutTemplate = oldTemplate.layout; - for(i = 0; i < pi0.paths.length; i++) { - pi0.paths[i] = op0(pi0.paths[i]); - } + var i, traceType, oldTypeTemplates, oldTypeLen, typeTemplates, typeLen; - while(pi1.edgepaths.length) { - pi0.edgepaths.push(op1(pi1.edgepaths.shift())); + 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])); + } + } } - while(pi1.paths.length) { - pi0.paths.push(op1(pi1.paths.shift())); + for(traceType in oldDataTemplate) { + if(!(traceType in template.data)) { + template.data[traceType] = Lib.extendDeep([], oldDataTemplate[traceType]); + } } - return [pi0]; + } } -}; - -function copyPathinfo(pi) { - return Lib.extendFlat({}, pi, { - edgepaths: Lib.extendDeep([], pi.edgepaths), - paths: Lib.extendDeep([], pi.paths) - }); -} - -},{"../../lib":696}],925:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return template; +}; -'use strict'; - -var Lib = _dereq_('../../lib'); +function mergeTemplates(oldTemplate, newTemplate) { + // we don't care about speed here, just make sure we have a totally + // distinct object from the previous template + oldTemplate = Lib.extendDeep({}, oldTemplate); -var handleXYZDefaults = _dereq_('../heatmap/xyz_defaults'); -var handleConstraintDefaults = _dereq_('./constraint_defaults'); -var handleContoursDefaults = _dereq_('./contours_defaults'); -var handleStyleDefaults = _dereq_('./style_defaults'); -var attributes = _dereq_('./attributes'); + // sort keys so we always get annotationdefaults before annotations etc + // so arrayTemplater will work right + var oldKeys = Object.keys(oldTemplate).sort(); + var i, j; + function mergeOne(oldVal, newVal, key) { + if(isPlainObject(newVal) && isPlainObject(oldVal)) { + mergeTemplates(oldVal, newVal); + } + else if(Array.isArray(newVal) && Array.isArray(oldVal)) { + // Note: omitted `inclusionAttr` from arrayTemplater here, + // it's irrelevant as we only want the resulting `_template`. + var templater = Template.arrayTemplater({_template: oldTemplate}, key); + 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); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + // templateitemname only applies to receiving plots + for(j = 0; j < newVal.length; j++) delete newVal[j].templateitemname; + } } - function coerce2(attr) { - return Lib.coerce2(traceIn, traceOut, attributes, attr); - } + 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; - var len = handleXYZDefaults(traceIn, traceOut, coerce, layout); - if(!len) { - traceOut.visible = false; - return; + // if this is a base key from the old template (eg xaxis), look for + // extended keys (eg xaxis2) in the new template to merge into + 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); + } + } + } } +} - coerce('text'); - var isConstraint = (coerce('contours.type') === 'constraint'); - coerce('connectgaps', Lib.isArray1D(traceOut.z)); +function getBaseKey(key) { + return key.replace(/[0-9]+$/, ''); +} - if(isConstraint) { - handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor); - } - else { - handleContoursDefaults(traceIn, traceOut, coerce, coerce2); - handleStyleDefaults(traceIn, traceOut, coerce, layout); - } -}; +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); + } + } -},{"../../lib":696,"../heatmap/xyz_defaults":960,"./attributes":916,"./constraint_defaults":921,"./contours_defaults":923,"./style_defaults":937}],926:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // we'll get an attr if path starts with a valid part, then has an + // invalid ending. Make sure we got all the way to the end. + if(pathAttr && (pathAttr === attr)) continue; -'use strict'; + if(!attr || attr._noTemplating || + attr.valType === 'data_array' || + (attr.arrayOk && Array.isArray(child)) + ) { + continue; + } -var Lib = _dereq_('../../lib'); -var constraintMapping = _dereq_('./constraint_mapping'); -var endPlus = _dereq_('./end_plus'); + 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]) { + // named array items: allow all attributes except data arrays + 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); -module.exports = function emptyPathinfo(contours, plotinfo, cd0) { - var contoursFinal = (contours.type === 'constraint') ? - constraintMapping[contours._operation](contours.value) : - contours; - - var cs = contoursFinal.size; - var pathinfo = []; - var end = endPlus(contoursFinal); - - var carpet = cd0.trace._carpetTrace; - - var basePathinfo = carpet ? { - // store axes so we can convert to px - xaxis: carpet.aaxis, - yaxis: carpet.baxis, - // full data arrays to use for interpolation - x: cd0.a, - y: cd0.b - } : { - xaxis: plotinfo.xaxis, - yaxis: plotinfo.yaxis, - x: cd0.x, - y: cd0.y - }; - - for(var ci = contoursFinal.start; ci < end; ci += cs) { - pathinfo.push(Lib.extendFlat({ - level: ci, - // all the cells with nontrivial marching index - crossings: {}, - // starting points on the edges of the lattice for each contour - starts: [], - // all unclosed paths (may have less items than starts, - // if a path is closed by rounding) - edgepaths: [], - // all closed paths - paths: [], - z: cd0.z, - smoothing: cd0.trace.line.smoothing - }, basePathinfo)); + // getAttributeInfo will fail if we try to use dfltKey directly. + // Instead put this item into the next array element, then + // pull it out and move it to dfltKey. + 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); - if(pathinfo.length > 1000) { - Lib.warn('Too many contours, clipping at 1000', contours); - break; + dfltDone = true; + } + } + } + } + else { + var templateProp = Lib.nestedProperty(templateOut, nextPath); + templateProp.set(child); } } - return pathinfo; -}; +} -},{"../../lib":696,"./constraint_mapping":922,"./end_plus":927}],927:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function getLayoutInfo(layout, path) { + return PlotSchema.getLayoutValObject( + layout, Lib.nestedProperty({}, path).parts + ); +} +function getTraceInfo(trace, path) { + return PlotSchema.getTraceValObject( + trace, Lib.nestedProperty({}, path).parts + ); +} -'use strict'; +function getNextPath(parent, key, path) { + var nextPath; + if(!path) nextPath = key; + else if(Array.isArray(parent)) nextPath = path + '[' + key + ']'; + else nextPath = path + '.' + key; -/* - * tiny helper to move the end of the contours a little to prevent - * losing the last contour to rounding errors - */ -module.exports = function endPlus(contours) { - return contours.end + contours.size / 1e6; -}; + return nextPath; +} -},{}],928:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * validateTemplate: Test for consistency between the given figure and + * a template, either already included in the figure or given separately. + * Note that not every issue we identify here is necessarily a problem, + * it depends on what you're using the template for. + * + * @param {object|DOM element} figure: the plot, with {data, layout} members, + * to test the template against + * @param {Optional(object)} template: the template, with its own {data, layout}, + * to test. If omitted, we will look for a template already attached as the + * plot's `layout.template` attribute. + * + * @returns {array} array of error objects each containing: + * - {string} code + * error code ('missing', 'unused', 'reused', 'noLayout', 'noData') + * - {string} msg + * a full readable description of the issue. + */ +exports.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 = []; -'use strict'; + figure.layout = layout; + figure.layout.template = template; + Plots.supplyDefaults(figure); -var Lib = _dereq_('../../lib'); -var constants = _dereq_('./constants'); + var fullLayout = figure._fullLayout; + var fullData = figure._fullData; -module.exports = function findAllPaths(pathinfo, xtol, ytol) { - var cnt, - startLoc, - i, - pi, - j; - - // Default just passes these values through as they were before: - xtol = xtol || 0.01; - ytol = ytol || 0.01; - - for(i = 0; i < pathinfo.length; i++) { - pi = pathinfo[i]; - - for(j = 0; j < pi.starts.length; j++) { - startLoc = pi.starts[j]; - makePath(pi, startLoc, 'edge', xtol, ytol); + 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 i; + for(i = 0; i < paths.length; i++) { + nextPaths.push(getNextPath(obj, key, paths[i])); + if(baseKey !== key) nextPaths.push(getNextPath(obj, baseKey, paths[i])); + } + for(i = 0; i < nextPaths.length; i++) { + layoutPaths[nextPaths[i]] = 1; + } + crawlLayoutForContainers(obj[key], nextPaths); + } } + } - cnt = 0; - while(Object.keys(pi.crossings).length && cnt < 10000) { - cnt++; - startLoc = Object.keys(pi.crossings)[0].split(',').map(Number); - makePath(pi, startLoc, undefined, xtol, ytol); + 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(cnt === 10000) Lib.log('Infinite loop in contour?'); } -}; -function equalPts(pt1, pt2, xtol, ytol) { - return Math.abs(pt1[0] - pt2[0]) < xtol && - Math.abs(pt1[1] - pt2[1]) < ytol; -} - -// distance in index units - uses the 3rd and 4th items in points -function ptDist(pt1, pt2) { - var dx = pt1[2] - pt2[2], - dy = pt1[3] - pt2[3]; - return Math.sqrt(dx * dx + dy * dy); -} - -function makePath(pi, loc, edgeflag, xtol, ytol) { - var startLocStr = loc.join(','); - var locStr = startLocStr; - var mi = pi.crossings[locStr]; - var marchStep = startStep(mi, edgeflag, loc); - // start by going backward a half step and finding the crossing point - var pts = [getInterpPx(pi, loc, [-marchStep[0], -marchStep[1]])]; - var startStepStr = marchStep.join(','); - var m = pi.z.length; - var n = pi.z[0].length; - var cnt; - - // now follow the path - for(cnt = 0; cnt < 10000; cnt++) { // just to avoid infinite loops - if(mi > 20) { - mi = constants.CHOOSESADDLE[mi][(marchStep[0] || marchStep[1]) < 0 ? 0 : 1]; - pi.crossings[locStr] = constants.SADDLEREMAINDER[mi]; - } - else { - delete pi.crossings[locStr]; - } + if(!isPlainObject(layoutTemplate)) { + errorList.push({code: 'layout'}); + } + else { + crawlLayoutForContainers(fullLayout, ['layout']); + crawlLayoutTemplateForContainers(layoutTemplate, 'layout'); + } - marchStep = constants.NEWDELTA[mi]; - if(!marchStep) { - Lib.log('Found bad marching index:', mi, loc, pi.level); - break; + 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) { + // this takes care of the case of traceType in the data but not + // the template + errorList.push({ + code: 'missing', + index: fullTrace._fullInput.index, + traceType: traceType + }); + } } - - // find the crossing a half step forward, and then take the full step - pts.push(getInterpPx(pi, loc, marchStep)); - loc[0] += marchStep[0]; - loc[1] += marchStep[1]; - - // don't include the same point multiple times - if(equalPts(pts[pts.length - 1], pts[pts.length - 2], xtol, ytol)) pts.pop(); - locStr = loc.join(','); - - var atEdge = (marchStep[0] && (loc[0] < 0 || loc[0] > n - 2)) || - (marchStep[1] && (loc[1] < 0 || loc[1] > m - 2)), - closedLoop = (locStr === startLocStr) && (marchStep.join(',') === startStepStr); - - // have we completed a loop, or reached an edge? - if((closedLoop) || (edgeflag && atEdge)) break; - - mi = pi.crossings[locStr]; - } - - if(cnt === 10000) { - Lib.log('Infinite loop in contour?'); - } - var closedpath = equalPts(pts[0], pts[pts.length - 1], xtol, ytol); - var totaldist = 0; - var distThresholdFactor = 0.2 * pi.smoothing; - var alldists = []; - var cropstart = 0; - var distgroup, cnt2, cnt3, newpt, ptcnt, ptavg, thisdist, - i, j, edgepathi, edgepathj; - - /* - * Check for points that are too close together (<1/5 the average dist - * *in grid index units* (important for log axes and nonuniform grids), - * less if less smoothed) and just take the center (or avg of center 2). - * This cuts down on funny behavior when a point is very close to a - * contour level. - */ - for(cnt = 1; cnt < pts.length; cnt++) { - thisdist = ptDist(pts[cnt], pts[cnt - 1]); - totaldist += thisdist; - alldists.push(thisdist); - } - - var distThreshold = totaldist / alldists.length * distThresholdFactor; - - function getpt(i) { return pts[i % pts.length]; } - - for(cnt = pts.length - 2; cnt >= cropstart; cnt--) { - distgroup = alldists[cnt]; - if(distgroup < distThreshold) { - cnt3 = 0; - for(cnt2 = cnt - 1; cnt2 >= cropstart; cnt2--) { - if(distgroup + alldists[cnt2] < distThreshold) { - distgroup += alldists[cnt2]; - } - else break; + for(traceType in dataTemplate) { + var templateCount = dataTemplate[traceType].length; + var dataCount = typeCount[traceType] || 0; + if(templateCount > dataCount) { + errorList.push({ + code: 'unused', + traceType: traceType, + templateCount: templateCount, + dataCount: dataCount + }); } - - // closed path with close points wrapping around the boundary? - if(closedpath && cnt === pts.length - 2) { - for(cnt3 = 0; cnt3 < cnt2; cnt3++) { - if(distgroup + alldists[cnt3] < distThreshold) { - distgroup += alldists[cnt3]; - } - else break; - } + else if(dataCount > templateCount) { + errorList.push({ + code: 'reused', + traceType: traceType, + templateCount: templateCount, + dataCount: dataCount + }); } - ptcnt = cnt - cnt2 + cnt3 + 1; - ptavg = Math.floor((cnt + cnt2 + cnt3 + 2) / 2); - - // either endpoint included: keep the endpoint - if(!closedpath && cnt === pts.length - 2) newpt = pts[pts.length - 1]; - else if(!closedpath && cnt2 === -1) newpt = pts[0]; - - // odd # of points - just take the central one - else if(ptcnt % 2) newpt = getpt(ptavg); + } + } - // even # of pts - average central two - else { - newpt = [(getpt(ptavg)[0] + getpt(ptavg + 1)[0]) / 2, - (getpt(ptavg)[1] + getpt(ptavg + 1)[1]) / 2]; + // _template: false is when someone tried to modify an array item + // but there was no template with matching name + 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); } - - pts.splice(cnt2 + 1, cnt - cnt2 + 1, newpt); - cnt = cnt2 + 1; - if(cnt3) cropstart = cnt3; - if(closedpath) { - if(cnt === pts.length - 2) pts[cnt3] = pts[pts.length - 1]; - else if(cnt === 0) pts[pts.length - 1] = pts[0]; + else if(Array.isArray(val) && hasPlainObject(val)) { + crawlForMissingTemplates(val, nextPath); } } } - pts.splice(0, cropstart); + crawlForMissingTemplates({data: fullData, layout: fullLayout}, ''); - // done with the index parts - remove them so path generation works right - // because it depends on only having [xpx, ypx] - for(cnt = 0; cnt < pts.length; cnt++) pts[cnt].length = 2; + if(errorList.length) return errorList.map(format); +}; - // don't return single-point paths (ie all points were the same - // so they got deleted?) - if(pts.length < 2) return; - else if(closedpath) { - pts.pop(); - pi.paths.push(pts); +function hasPlainObject(arr) { + for(var i = 0; i < arr.length; i++) { + if(isPlainObject(arr[i])) return true; } - else { - if(!edgeflag) { - Lib.log('Unclosed interior contour?', - pi.level, startLocStr, pts.join('L')); - } - - // edge path - does it start where an existing edge path ends, or vice versa? - var merged = false; - for(i = 0; i < pi.edgepaths.length; i++) { - edgepathi = pi.edgepaths[i]; - if(!merged && equalPts(edgepathi[0], pts[pts.length - 1], xtol, ytol)) { - pts.pop(); - merged = true; - - // now does it ALSO meet the end of another (or the same) path? - var doublemerged = false; - for(j = 0; j < pi.edgepaths.length; j++) { - edgepathj = pi.edgepaths[j]; - if(equalPts(edgepathj[edgepathj.length - 1], pts[0], xtol, ytol)) { - doublemerged = true; - pts.shift(); - pi.edgepaths.splice(i, 1); - if(j === i) { - // the path is now closed - pi.paths.push(pts.concat(edgepathj)); - } - else { - if(j > i) j--; - pi.edgepaths[j] = edgepathj.concat(pts, edgepathi); - } - break; - } - } - if(!doublemerged) { - pi.edgepaths[i] = pts.concat(edgepathi); - } +} + +function format(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 + '.'; } - } - for(i = 0; i < pi.edgepaths.length; i++) { - if(merged) break; - edgepathi = pi.edgepaths[i]; - if(equalPts(edgepathi[edgepathi.length - 1], pts[0], xtol, ytol)) { - pts.shift(); - pi.edgepaths[i] = edgepathi.concat(pts); - merged = true; + break; + case 'unused': + if(opts.path) { + msg = 'The template item at ' + opts.path + + ' was not used in constructing the plot.'; } - } - - if(!merged) pi.edgepaths.push(pts); - } -} - -// special function to get the marching step of the -// first point in the path (leading to loc) -function startStep(mi, edgeflag, loc) { - var dx = 0, - dy = 0; - if(mi > 20 && edgeflag) { - // these saddles start at +/- x - if(mi === 208 || mi === 1114) { - // if we're starting at the left side, we must be going right - dx = loc[0] === 0 ? 1 : -1; - } - else { - // if we're starting at the bottom, we must be going up - dy = loc[1] === 0 ? 1 : -1; - } + 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; } - else if(constants.BOTTOMSTART.indexOf(mi) !== -1) dy = 1; - else if(constants.LEFTSTART.indexOf(mi) !== -1) dx = 1; - else if(constants.TOPSTART.indexOf(mi) !== -1) dy = -1; - else dx = -1; - return [dx, dy]; -} + opts.msg = msg; -/* - * Find the pixel coordinates of a particular crossing - * - * @param {object} pi: the pathinfo object at this level - * @param {array} loc: the grid index [x, y] of the crossing - * @param {array} step: the direction [dx, dy] we're moving on the grid - * - * @return {array} [xpx, ypx, xi, yi]: the first two are the pixel location, - * the next two are the interpolated grid indices, which we use for - * distance calculations to delete points that are too close together. - * This is important when the grid is nonuniform (and most dramatically when - * we're on log axes and include invalid (0 or negative) values. - * It's crucial to delete these extra two before turning an array of these - * points into a path, because those routines require length-2 points. - */ -function getInterpPx(pi, loc, step) { - var locx = loc[0] + Math.max(step[0], 0), - locy = loc[1] + Math.max(step[1], 0), - zxy = pi.z[locy][locx], - xa = pi.xaxis, - ya = pi.yaxis; - - if(step[1]) { - var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy); - - return [xa.c2p((1 - dx) * pi.x[locx] + dx * pi.x[locx + 1], true), - ya.c2p(pi.y[locy], true), - locx + dx, locy]; - } - else { - var dy = (pi.level - zxy) / (pi.z[locy + 1][locx] - zxy); - return [xa.c2p(pi.x[locx], true), - ya.c2p((1 - dy) * pi.y[locy] + dy * pi.y[locy + 1], true), - locx, locy + dy]; - } + return opts; } -},{"../../lib":696,"./constants":920}],929:[function(_dereq_,module,exports){ +},{"../lib":159,"../plots/attributes":200,"../plots/plots":236,"./plot_config":191,"./plot_schema":192,"./plot_template":193}],196:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Color = _dereq_('../../components/color'); - -var heatmapHoverPoints = _dereq_('../heatmap/hover'); +var plotApi = _dereq_('./plot_api'); +var Lib = _dereq_('../lib'); -module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer) { - var hoverData = heatmapHoverPoints(pointData, xval, yval, hovermode, hoverLayer, true); +var helpers = _dereq_('../snapshot/helpers'); +var toSVG = _dereq_('../snapshot/tosvg'); +var svgToImg = _dereq_('../snapshot/svgtoimg'); - if(hoverData) { - hoverData.forEach(function(hoverPt) { - var trace = hoverPt.trace; - if(trace.contours.type === 'constraint') { - if(trace.fillcolor && Color.opacity(trace.fillcolor)) { - hoverPt.color = Color.addOpacity(trace.fillcolor, 1); - } - else if(trace.contours.showlines && Color.opacity(trace.line.color)) { - hoverPt.color = Color.addOpacity(trace.line.color, 1); - } - } - }); +var attrs = { + format: { + valType: 'enumerated', + values: ['png', 'jpeg', 'webp', 'svg'], + dflt: 'png', + + }, + width: { + valType: 'number', + min: 1, + + }, + height: { + valType: 'number', + min: 1, + + }, + scale: { + valType: 'number', + min: 0, + dflt: 1, + + }, + setBackground: { + valType: 'any', + dflt: false, + + }, + imageDataOnly: { + valType: 'boolean', + dflt: false, + } - - return hoverData; }; -},{"../../components/color":570,"../heatmap/hover":952}],930:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Contour = {}; +var IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; -Contour.attributes = _dereq_('./attributes'); -Contour.supplyDefaults = _dereq_('./defaults'); -Contour.calc = _dereq_('./calc'); -Contour.plot = _dereq_('./plot').plot; -Contour.style = _dereq_('./style'); -Contour.colorbar = _dereq_('./colorbar'); -Contour.hoverPoints = _dereq_('./hover'); +/** Plotly.toImage + * + * @param {object | string | HTML div} gd + * can either be a data/layout/config object + * or an existing graph
+ * or an id to an existing graph
+ * @param {object} opts (see above) + * @return {promise} + */ +function toImage(gd, opts) { + opts = opts || {}; -Contour.moduleType = 'trace'; -Contour.name = 'contour'; -Contour.basePlotModule = _dereq_('../../plots/cartesian'); -Contour.categories = ['cartesian', 'svg', '2dMap', 'contour', 'showLegend']; -Contour.meta = { - -}; + var data; + var layout; + var config; -module.exports = Contour; + if(Lib.isPlainObject(gd)) { + data = gd.data || []; + layout = gd.layout || {}; + config = gd.config || {}; + } else { + gd = Lib.getGraphDiv(gd); + data = Lib.extendDeep([], gd.data); + layout = Lib.extendDeep({}, gd.layout); + config = gd._context; + } -},{"../../plots/cartesian":756,"./attributes":916,"./calc":917,"./colorbar":919,"./defaults":925,"./hover":929,"./plot":934,"./style":936}],931:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + function isImpliedOrValid(attr) { + return !(attr in opts) || Lib.validate(opts[attr], attrs[attr]); + } + if(!isImpliedOrValid('width') || !isImpliedOrValid('height')) { + throw new Error('Height and width should be pixel values.'); + } -'use strict'; + if(!isImpliedOrValid('format')) { + throw new Error('Image format is not jpeg, png, svg or webp.'); + } -var Lib = _dereq_('../../lib'); + var fullOpts = {}; -module.exports = function handleLabelDefaults(coerce, layout, lineColor, opts) { - if(!opts) opts = {}; - var showLabels = coerce('contours.showlabels'); - if(showLabels) { - var globalFont = layout.font; - Lib.coerceFont(coerce, 'contours.labelfont', { - family: globalFont.family, - size: globalFont.size, - color: lineColor - }); - coerce('contours.labelformat'); + function coerce(attr, dflt) { + return Lib.coerce(opts, fullOpts, attrs, attr, dflt); } - if(opts.hasHover !== false) coerce('zhoverformat'); -}; + var format = coerce('format'); + var width = coerce('width'); + var height = coerce('height'); + var scale = coerce('scale'); + var setBackground = coerce('setBackground'); + var imageDataOnly = coerce('imageDataOnly'); -},{"../../lib":696}],932:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // put the cloned div somewhere off screen before attaching to DOM + var clonedGd = document.createElement('div'); + clonedGd.style.position = 'absolute'; + clonedGd.style.left = '-5000px'; + document.body.appendChild(clonedGd); + // extend layout with image options + var layoutImage = Lib.extendFlat({}, layout); + if(width) layoutImage.width = width; + if(height) layoutImage.height = height; -'use strict'; + // extend config for static plot + var configImage = Lib.extendFlat({}, config, { + _exportedPlot: true, + staticPlot: true, + setBackground: setBackground + }); -var d3 = _dereq_('d3'); -var Colorscale = _dereq_('../../components/colorscale'); -var endPlus = _dereq_('./end_plus'); + var redrawFunc = helpers.getRedrawFunc(clonedGd); -module.exports = function makeColorMap(trace) { - var contours = trace.contours, - start = contours.start, - end = endPlus(contours), - cs = contours.size || 1, - nc = Math.floor((end - start) / cs) + 1, - extra = contours.coloring === 'lines' ? 0 : 1; - - if(!isFinite(cs)) { - cs = 1; - nc = 1; - } - - var scl = trace.colorscale, - len = scl.length; - - var domain = new Array(len), - range = new Array(len); - - var si, i; - - if(contours.coloring === 'heatmap') { - if(trace.zauto && trace.autocontour === false) { - trace.zmin = start - cs / 2; - trace.zmax = trace.zmin + nc * cs; - } + function wait() { + return new Promise(function(resolve) { + setTimeout(resolve, helpers.getDelay(clonedGd._fullLayout)); + }); + } - for(i = 0; i < len; i++) { - si = scl[i]; + function convert() { + return new Promise(function(resolve, reject) { + var svg = toSVG(clonedGd, format, scale); + var width = clonedGd._fullLayout.width; + var height = clonedGd._fullLayout.height; - domain[i] = si[0] * (trace.zmax - trace.zmin) + trace.zmin; - range[i] = si[1]; - } + plotApi.purge(clonedGd); + document.body.removeChild(clonedGd); - // do the contours extend beyond the colorscale? - // if so, extend the colorscale with constants - var zRange = d3.extent([trace.zmin, trace.zmax, contours.start, - contours.start + cs * (nc - 1)]), - zmin = zRange[trace.zmin < trace.zmax ? 0 : 1], - zmax = zRange[trace.zmin < trace.zmax ? 1 : 0]; + if(format === 'svg') { + if(imageDataOnly) { + return resolve(svg); + } else { + return resolve('data:image/svg+xml,' + encodeURIComponent(svg)); + } + } - if(zmin !== trace.zmin) { - domain.splice(0, 0, zmin); - range.splice(0, 0, Range[0]); - } + var canvas = document.createElement('canvas'); + canvas.id = Lib.randstr(); - if(zmax !== trace.zmax) { - domain.push(zmax); - range.push(range[range.length - 1]); - } + svgToImg({ + format: format, + width: width, + height: height, + scale: scale, + canvas: canvas, + svg: svg, + // ask svgToImg to return a Promise + // rather than EventEmitter + // leave EventEmitter for backward + // compatibility + promise: true + }) + .then(resolve) + .catch(reject); + }); } - else { - for(i = 0; i < len; i++) { - si = scl[i]; - domain[i] = (si[0] * (nc + extra - 1) - (extra / 2)) * cs + start; - range[i] = si[1]; + function urlToImageData(url) { + if(imageDataOnly) { + return url.replace(IMAGE_URL_PREFIX, ''); + } else { + return url; } } - return Colorscale.makeColorScaleFunc({ - domain: domain, - range: range, - }, { - noNumericCheck: true + return new Promise(function(resolve, reject) { + plotApi.plot(clonedGd, data, layoutImage, configImage) + .then(redrawFunc) + .then(wait) + .then(convert) + .then(function(url) { resolve(urlToImageData(url)); }) + .catch(function(err) { reject(err); }); }); -}; +} -},{"../../components/colorscale":585,"./end_plus":927,"d3":148}],933:[function(_dereq_,module,exports){ +module.exports = toImage; + +},{"../lib":159,"../snapshot/helpers":247,"../snapshot/svgtoimg":249,"../snapshot/tosvg":251,"./plot_api":190}],197:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -146741,981 +47949,652 @@ 'use strict'; -var constants = _dereq_('./constants'); - -// Calculate all the marching indices, for ALL levels at once. -// since we want to be exhaustive we'll check for contour crossings -// at every intersection, rather than just following a path -// TODO: shorten the inner loop to only the relevant levels -module.exports = function makeCrossings(pathinfo) { - var z = pathinfo[0].z, - m = z.length, - n = z[0].length, // we already made sure z isn't ragged in interp2d - twoWide = m === 2 || n === 2, - xi, - yi, - startIndices, - ystartIndices, - label, - corners, - mi, - pi, - i; - - for(yi = 0; yi < m - 1; yi++) { - ystartIndices = []; - if(yi === 0) ystartIndices = ystartIndices.concat(constants.BOTTOMSTART); - if(yi === m - 2) ystartIndices = ystartIndices.concat(constants.TOPSTART); - - for(xi = 0; xi < n - 1; xi++) { - startIndices = ystartIndices.slice(); - if(xi === 0) startIndices = startIndices.concat(constants.LEFTSTART); - if(xi === n - 2) startIndices = startIndices.concat(constants.RIGHTSTART); - - label = xi + ',' + yi; - corners = [[z[yi][xi], z[yi][xi + 1]], - [z[yi + 1][xi], z[yi + 1][xi + 1]]]; - for(i = 0; i < pathinfo.length; i++) { - pi = pathinfo[i]; - mi = getMarchingIndex(pi.level, corners); - if(!mi) continue; - - pi.crossings[label] = mi; - if(startIndices.indexOf(mi) !== -1) { - pi.starts.push([xi, yi]); - if(twoWide && startIndices.indexOf(mi, - startIndices.indexOf(mi) + 1) !== -1) { - // the same square has starts from opposite sides - // it's not possible to have starts on opposite edges - // of a corner, only a start and an end... - // but if the array is only two points wide (either way) - // you can have starts on opposite sides. - pi.starts.push([xi, yi]); - } - } - } - } - } -}; +var Lib = _dereq_('../lib'); +var Plots = _dereq_('../plots/plots'); +var PlotSchema = _dereq_('./plot_schema'); +var dfltConfig = _dereq_('./plot_config').dfltConfig; -// modified marching squares algorithm, -// so we disambiguate the saddle points from the start -// and we ignore the cases with no crossings -// the index I'm using is based on: -// http://en.wikipedia.org/wiki/Marching_squares -// except that the saddles bifurcate and I represent them -// as the decimal combination of the two appropriate -// non-saddle indices -function getMarchingIndex(val, corners) { - var mi = (corners[0][0] > val ? 0 : 1) + - (corners[0][1] > val ? 0 : 2) + - (corners[1][1] > val ? 0 : 4) + - (corners[1][0] > val ? 0 : 8); - if(mi === 5 || mi === 10) { - var avg = (corners[0][0] + corners[0][1] + - corners[1][0] + corners[1][1]) / 4; - // two peaks with a big valley - if(val > avg) return (mi === 5) ? 713 : 1114; - // two valleys with a big ridge - return (mi === 5) ? 104 : 208; - } - return (mi === 15) ? 0 : mi; -} +var isPlainObject = Lib.isPlainObject; +var isArray = Array.isArray; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; -},{"./constants":920}],934:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - + * Validate a data array and layout object. + * + * @param {array} data + * @param {object} layout + * + * @return {array} array of error objects each containing: + * - {string} code + * error code ('object', 'array', 'schema', 'unused', 'invisible' or 'value') + * - {string} container + * container where the error occurs ('data' or 'layout') + * - {number} trace + * trace index of the 'data' container where the error occurs + * - {array} path + * nested path to the key that causes the error + * - {string} astr + * attribute string variant of 'path' compatible with Plotly.restyle and + * Plotly.relayout. + * - {string} msg + * error message (shown in console in logger config argument is enable) + */ +module.exports = function validate(data, layout) { + var schema = PlotSchema.get(); + var errorList = []; + var gd = {_context: Lib.extendFlat({}, dfltConfig)}; -'use strict'; + var dataIn, layoutIn; -var d3 = _dereq_('d3'); + if(isArray(data)) { + gd.data = Lib.extendDeep([], data); + dataIn = data; + } + else { + gd.data = []; + dataIn = []; + errorList.push(format('array', 'data')); + } -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../../components/drawing'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var setConvert = _dereq_('../../plots/cartesian/set_convert'); + if(isPlainObject(layout)) { + gd.layout = Lib.extendDeep({}, layout); + layoutIn = layout; + } + else { + gd.layout = {}; + layoutIn = {}; + if(arguments.length > 1) { + errorList.push(format('object', 'layout')); + } + } -var heatmapPlot = _dereq_('../heatmap/plot'); -var makeCrossings = _dereq_('./make_crossings'); -var findAllPaths = _dereq_('./find_all_paths'); -var emptyPathinfo = _dereq_('./empty_pathinfo'); -var convertToConstraints = _dereq_('./convert_to_constraints'); -var closeBoundaries = _dereq_('./close_boundaries'); -var constants = _dereq_('./constants'); -var costConstants = constants.LABELOPTIMIZER; + // N.B. dataIn and layoutIn are in general not the same as + // gd.data and gd.layout after supplyDefaults as some attributes + // in gd.data and gd.layout (still) get mutated during this step. -exports.plot = function plot(gd, plotinfo, cdcontours, contourLayer) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - var fullLayout = gd._fullLayout; + Plots.supplyDefaults(gd); - Lib.makeTraceGroups(contourLayer, cdcontours, 'contour').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var trace = cd0.trace; - var x = cd0.x; - var y = cd0.y; - var contours = trace.contours; - var pathinfo = emptyPathinfo(contours, plotinfo, cd0); + var dataOut = gd._fullData; + var len = dataIn.length; - // use a heatmap to fill - draw it behind the lines - var heatmapColoringLayer = Lib.ensureSingle(plotGroup, 'g', 'heatmapcoloring'); - var cdheatmaps = []; - if(contours.coloring === 'heatmap') { - if(trace.zauto && (trace.autocontour === false)) { - trace._input.zmin = trace.zmin = - contours.start - contours.size / 2; - trace._input.zmax = trace.zmax = - trace.zmin + pathinfo.length * contours.size; - } - cdheatmaps = [cd]; - } - heatmapPlot(gd, plotinfo, cdheatmaps, heatmapColoringLayer); - - makeCrossings(pathinfo); - findAllPaths(pathinfo); - - var leftedge = xa.c2p(x[0], true), - rightedge = xa.c2p(x[x.length - 1], true), - bottomedge = ya.c2p(y[0], true), - topedge = ya.c2p(y[y.length - 1], true), - perimeter = [ - [leftedge, topedge], - [rightedge, topedge], - [rightedge, bottomedge], - [leftedge, bottomedge] - ]; + for(var i = 0; i < len; i++) { + var traceIn = dataIn[i]; + var base = ['data', i]; - var fillPathinfo = pathinfo; - if(contours.type === 'constraint') { - fillPathinfo = convertToConstraints(pathinfo, contours._operation); - closeBoundaries(fillPathinfo, contours._operation, perimeter, trace); + if(!isPlainObject(traceIn)) { + errorList.push(format('object', base)); + continue; } - // draw everything - makeBackground(plotGroup, perimeter, contours); - makeFills(plotGroup, fillPathinfo, perimeter, contours); - makeLinesAndLabels(plotGroup, pathinfo, gd, cd0, contours, perimeter); - clipGaps(plotGroup, plotinfo, fullLayout._clips, cd0, perimeter); - }); -}; - -function makeBackground(plotgroup, perimeter, contours) { - var bggroup = Lib.ensureSingle(plotgroup, 'g', 'contourbg'); - - var bgfill = bggroup.selectAll('path') - .data(contours.coloring === 'fill' ? [0] : []); - bgfill.enter().append('path'); - bgfill.exit().remove(); - bgfill - .attr('d', 'M' + perimeter.join('L') + 'Z') - .style('stroke', 'none'); -} - -function makeFills(plotgroup, pathinfo, perimeter, contours) { - var fillgroup = Lib.ensureSingle(plotgroup, 'g', 'contourfill'); + var traceOut = dataOut[i]; + var traceType = traceOut.type; + var traceSchema = schema.traces[traceType].attributes; - var fillitems = fillgroup.selectAll('path') - .data(contours.coloring === 'fill' || (contours.type === 'constraint' && contours._operation !== '=') ? pathinfo : []); - fillitems.enter().append('path'); - fillitems.exit().remove(); - fillitems.each(function(pi) { - // join all paths for this level together into a single path - // first follow clockwise around the perimeter to close any open paths - // if the whole perimeter is above this level, start with a path - // enclosing the whole thing. With all that, the parity should mean - // that we always fill everything above the contour, nothing below - var fullpath = joinAllPaths(pi, perimeter); + // PlotSchema does something fancy with trace 'type', reset it here + // to make the trace schema compatible with Lib.validate. + traceSchema.type = { + valType: 'enumerated', + values: [traceType] + }; - if(!fullpath) d3.select(this).remove(); - else d3.select(this).attr('d', fullpath).style('stroke', 'none'); - }); -} + if(traceOut.visible === false && traceIn.visible !== false) { + errorList.push(format('invisible', base)); + } -function initFullPath(pi, perimeter) { - var prefixBoundary = pi.prefixBoundary; - if(prefixBoundary === undefined) { - var edgeVal2 = Math.min(pi.z[0][0], pi.z[0][1]); - prefixBoundary = (!pi.edgepaths.length && edgeVal2 > pi.level); - } + crawl(traceIn, traceOut, traceSchema, errorList, base); - if(prefixBoundary) { - // TODO: why does ^^ not work for constraints? - // pi.prefixBoundary gets set by closeBoundaries - return 'M' + perimeter.join('L') + 'Z'; - } - return ''; -} + var transformsIn = traceIn.transforms; + var transformsOut = traceOut.transforms; -function joinAllPaths(pi, perimeter) { - var fullpath = initFullPath(pi, perimeter), - i = 0, - startsleft = pi.edgepaths.map(function(v, i) { return i; }), - newloop = true, - endpt, - newendpt, - cnt, - nexti, - possiblei, - addpath; - - function istop(pt) { return Math.abs(pt[1] - perimeter[0][1]) < 0.01; } - function isbottom(pt) { return Math.abs(pt[1] - perimeter[2][1]) < 0.01; } - function isleft(pt) { return Math.abs(pt[0] - perimeter[0][0]) < 0.01; } - function isright(pt) { return Math.abs(pt[0] - perimeter[2][0]) < 0.01; } - - while(startsleft.length) { - addpath = Drawing.smoothopen(pi.edgepaths[i], pi.smoothing); - fullpath += newloop ? addpath : addpath.replace(/^M/, 'L'); - startsleft.splice(startsleft.indexOf(i), 1); - endpt = pi.edgepaths[i][pi.edgepaths[i].length - 1]; - nexti = -1; - - // now loop through sides, moving our endpoint until we find a new start - for(cnt = 0; cnt < 4; cnt++) { // just to prevent infinite loops - if(!endpt) { - Lib.log('Missing end?', i, pi); - break; + if(transformsIn) { + if(!isArray(transformsIn)) { + errorList.push(format('array', base, ['transforms'])); } - if(istop(endpt) && !isright(endpt)) newendpt = perimeter[1]; // right top - else if(isleft(endpt)) newendpt = perimeter[0]; // left top - else if(isbottom(endpt)) newendpt = perimeter[3]; // right bottom - else if(isright(endpt)) newendpt = perimeter[2]; // left bottom - - for(possiblei = 0; possiblei < pi.edgepaths.length; possiblei++) { - var ptNew = pi.edgepaths[possiblei][0]; - // is ptNew on the (horz. or vert.) segment from endpt to newendpt? - if(Math.abs(endpt[0] - newendpt[0]) < 0.01) { - if(Math.abs(endpt[0] - ptNew[0]) < 0.01 && - (ptNew[1] - endpt[1]) * (newendpt[1] - ptNew[1]) >= 0) { - newendpt = ptNew; - nexti = possiblei; - } - } - else if(Math.abs(endpt[1] - newendpt[1]) < 0.01) { - if(Math.abs(endpt[1] - ptNew[1]) < 0.01 && - (ptNew[0] - endpt[0]) * (newendpt[0] - ptNew[0]) >= 0) { - newendpt = ptNew; - nexti = possiblei; - } - } - else { - Lib.log('endpt to newendpt is not vert. or horz.', - endpt, newendpt, ptNew); - } - } + base.push('transforms'); - endpt = newendpt; + for(var j = 0; j < transformsIn.length; j++) { + var path = ['transforms', j]; + var transformType = transformsIn[j].type; - if(nexti >= 0) break; - fullpath += 'L' + newendpt; - } + if(!isPlainObject(transformsIn[j])) { + errorList.push(format('object', base, path)); + continue; + } - if(nexti === pi.edgepaths.length) { - Lib.log('unclosed perimeter path'); - break; - } + var transformSchema = schema.transforms[transformType] ? + schema.transforms[transformType].attributes : + {}; - i = nexti; + // add 'type' to transform schema to validate the transform type + transformSchema.type = { + valType: 'enumerated', + values: Object.keys(schema.transforms) + }; - // if we closed back on a loop we already included, - // close it and start a new loop - newloop = (startsleft.indexOf(i) === -1); - if(newloop) { - i = startsleft[0]; - fullpath += 'Z'; + crawl(transformsIn[j], transformsOut[j], transformSchema, errorList, base, path); + } } } - // finally add the interior paths - for(i = 0; i < pi.paths.length; i++) { - fullpath += Drawing.smoothclosed(pi.paths[i], pi.smoothing); - } - - return fullpath; -} - -function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, perimeter) { - var lineContainer = Lib.ensureSingle(plotgroup, 'g', 'contourlines'); - var showLines = contours.showlines !== false; - var showLabels = contours.showlabels; - var clipLinesForLabels = showLines && showLabels; - - // Even if we're not going to show lines, we need to create them - // if we're showing labels, because the fill paths include the perimeter - // so can't be used to position the labels correctly. - // In this case we'll remove the lines after making the labels. - var linegroup = exports.createLines(lineContainer, showLines || showLabels, pathinfo); - - var lineClip = exports.createLineClip(lineContainer, clipLinesForLabels, - gd._fullLayout._clips, cd0.trace.uid); - - var labelGroup = plotgroup.selectAll('g.contourlabels') - .data(showLabels ? [0] : []); + var layoutOut = gd._fullLayout; + var layoutSchema = fillLayoutSchema(schema, dataOut); - labelGroup.exit().remove(); - - labelGroup.enter().append('g') - .classed('contourlabels', true); - - if(showLabels) { - var labelClipPathData = [perimeter]; + crawl(layoutIn, layoutOut, layoutSchema, errorList, 'layout'); - var labelData = []; + // return undefined if no validation errors were found + return (errorList.length === 0) ? void(0) : errorList; +}; - // invalidate the getTextLocation cache in case paths changed - Lib.clearLocationCache(); +function crawl(objIn, objOut, schema, list, base, path) { + path = path || []; - var contourFormat = exports.labelFormatter(contours, cd0.t.cb, gd._fullLayout); + var keys = Object.keys(objIn); - var dummyText = Drawing.tester.append('text') - .attr('data-notex', 1) - .call(Drawing.font, contours.labelfont); + for(var i = 0; i < keys.length; i++) { + var k = keys[i]; - var xLen = pathinfo[0].xaxis._length; - var yLen = pathinfo[0].yaxis._length; + // transforms are handled separately + if(k === 'transforms') continue; - // visible bounds of the contour trace (and the midpoints, to - // help with cost calculations) - var bounds = { - left: Math.max(perimeter[0][0], 0), - right: Math.min(perimeter[2][0], xLen), - top: Math.max(perimeter[0][1], 0), - bottom: Math.min(perimeter[2][1], yLen) - }; - bounds.middle = (bounds.top + bounds.bottom) / 2; - bounds.center = (bounds.left + bounds.right) / 2; + var p = path.slice(); + p.push(k); - var plotDiagonal = Math.sqrt(xLen * xLen + yLen * yLen); + var valIn = objIn[k]; + var valOut = objOut[k]; - // the path length to use to scale the number of labels to draw: - var normLength = constants.LABELDISTANCE * plotDiagonal / - Math.max(1, pathinfo.length / constants.LABELINCREASE); + var nestedSchema = getNestedSchema(schema, k); + var isInfoArray = (nestedSchema || {}).valType === 'info_array'; + var isColorscale = (nestedSchema || {}).valType === 'colorscale'; + var items = (nestedSchema || {}).items; - linegroup.each(function(d) { - var textOpts = exports.calcTextOpts(d.level, contourFormat, dummyText, gd); + if(!isInSchema(schema, k)) { + list.push(format('schema', base, p)); + } + else if(isPlainObject(valIn) && isPlainObject(valOut)) { + crawl(valIn, valOut, nestedSchema, list, base, p); + } + else if(isInfoArray && isArray(valIn)) { + if(valIn.length > valOut.length) { + list.push(format('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(format('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(format('value', base, p.concat(n, m), valInPart)); + } + else if(valOutPart !== valInPart && valOutPart !== +valInPart) { + list.push(format('dynamic', base, p.concat(n, m), valInPart, valOutPart)); + } + } + } + else { + list.push(format('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(format('value', base, p.concat(n), valInPart)); + } + else if(valOutPart !== valInPart && valOutPart !== +valInPart) { + list.push(format('dynamic', base, p.concat(n), valInPart, valOutPart)); + } + } + } + } + else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { + var _nestedSchema = items[Object.keys(items)[0]]; + var indexList = []; - d3.select(this).selectAll('path').each(function() { - var path = this; - var pathBounds = Lib.getVisibleSegment(path, bounds, textOpts.height / 2); - if(!pathBounds) return; + var j, _p; - if(pathBounds.len < (textOpts.width + textOpts.height) * constants.LABELMIN) return; + // loop over valOut items while keeping track of their + // corresponding input container index (given by _index) + for(j = 0; j < valOut.length; j++) { + var _index = valOut[j]._index || j; - var maxLabels = Math.min(Math.ceil(pathBounds.len / normLength), - constants.LABELMAX); + _p = p.slice(); + _p.push(_index); - for(var i = 0; i < maxLabels; i++) { - var loc = exports.findBestTextLocation(path, pathBounds, textOpts, - labelData, bounds); + 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(format('invisible', base, _p)); + } + else crawl(valInj, valOutj, _nestedSchema, list, base, _p); + } + } - if(!loc) break; + // loop over valIn to determine where it went wrong for some items + for(j = 0; j < valIn.length; j++) { + _p = p.slice(); + _p.push(j); - exports.addLabelData(loc, textOpts, labelData, labelClipPathData); + if(!isPlainObject(valIn[j])) { + list.push(format('object', base, _p, valIn[j])); } - }); - }); + else if(indexList.indexOf(j) === -1) { + list.push(format('unused', base, _p)); + } + } + } + else if(!isPlainObject(valIn) && isPlainObject(valOut)) { + list.push(format('object', base, p, valIn)); + } + else if(!isArrayOrTypedArray(valIn) && isArrayOrTypedArray(valOut) && !isInfoArray && !isColorscale) { + list.push(format('array', base, p, valIn)); + } + else if(!(k in objOut)) { + list.push(format('unused', base, p, valIn)); + } + else if(!Lib.validate(valIn, nestedSchema)) { + list.push(format('value', base, p, valIn)); + } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } + } + + return list; +} + +// the 'full' layout schema depends on the traces types presents +function fillLayoutSchema(schema, dataOut) { + var layoutSchema = schema.layout.layoutAttributes; - dummyText.remove(); + for(var i = 0; i < dataOut.length; i++) { + var traceOut = dataOut[i]; + var traceSchema = schema.traces[traceOut.type]; + var traceLayoutAttr = traceSchema.layoutAttributes; - exports.drawLabels(labelGroup, labelData, gd, lineClip, - clipLinesForLabels ? labelClipPathData : null); + if(traceLayoutAttr) { + if(traceOut.subplot) { + Lib.extendFlat(layoutSchema[traceSchema.attributes.subplot.dflt], traceLayoutAttr); + } else { + Lib.extendFlat(layoutSchema, traceLayoutAttr); + } + } } - if(showLabels && !showLines) linegroup.remove(); + return layoutSchema; } -exports.createLines = function(lineContainer, makeLines, pathinfo) { - var smoothing = pathinfo[0].smoothing; - - var linegroup = lineContainer.selectAll('g.contourlevel') - .data(makeLines ? pathinfo : []); - - linegroup.exit().remove(); - linegroup.enter().append('g') - .classed('contourlevel', true); +// validation error codes +var code2msgFunc = { + object: function(base, astr) { + var prefix; - if(makeLines) { - // pedgepaths / ppaths are used by contourcarpet, for the paths transformed from a/b to x/y - // edgepaths / paths are used by contour since it's in x/y from the start - var opencontourlines = linegroup.selectAll('path.openline') - .data(function(d) { return d.pedgepaths || d.edgepaths; }); + 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; - opencontourlines.exit().remove(); - opencontourlines.enter().append('path') - .classed('openline', true); + return prefix + ' must be linked to an object container'; + }, + array: function(base, astr) { + var prefix; - opencontourlines - .attr('d', function(d) { - return Drawing.smoothopen(d, smoothing); - }) - .style('stroke-miterlimit', 1) - .style('vector-effect', 'non-scaling-stroke'); + if(base === 'data') prefix = 'The data argument'; + else prefix = inBase(base) + 'key ' + astr; - var closedcontourlines = linegroup.selectAll('path.closedline') - .data(function(d) { return d.ppaths || d.paths; }); + 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'; - closedcontourlines.exit().remove(); - closedcontourlines.enter().append('path') - .classed('closedline', true); - - closedcontourlines - .attr('d', function(d) { - return Drawing.smoothclosed(d, smoothing); - }) - .style('stroke-miterlimit', 1) - .style('vector-effect', 'non-scaling-stroke'); + 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(' '); } - - return linegroup; }; -exports.createLineClip = function(lineContainer, clipLinesForLabels, clips, uid) { - var clipId = clipLinesForLabels ? ('clipline' + uid) : null; +function inBase(base) { + if(isArray(base)) return 'In data trace ' + base[1] + ', '; - var lineClip = clips.selectAll('#' + clipId) - .data(clipLinesForLabels ? [0] : []); - lineClip.exit().remove(); + return 'In ' + base + ', '; +} - lineClip.enter().append('clipPath') - .classed('contourlineclip', true) - .attr('id', clipId); +function format(code, base, path, valIn, valOut) { + path = path || ''; - Drawing.setClipUrl(lineContainer, clipId); + var container, trace; - return lineClip; -}; + // container is either 'data' or 'layout + // trace is the trace index if 'data', null otherwise -exports.labelFormatter = function(contours, colorbar, fullLayout) { - if(contours.labelformat) { - return fullLayout._d3locale.numberFormat(contours.labelformat); + if(isArray(base)) { + container = base[0]; + trace = base[1]; } else { - var formatAxis; - if(colorbar) { - formatAxis = colorbar.axis; - } - else { - formatAxis = { - type: 'linear', - _id: 'ycontour', - showexponent: 'all', - exponentformat: 'B' - }; - - if(contours.type === 'constraint') { - var value = contours.value; - if(Array.isArray(value)) { - formatAxis.range = [value[0], value[value.length - 1]]; - } - else formatAxis.range = [value, value]; - } - else { - formatAxis.range = [contours.start, contours.end]; - formatAxis.nticks = (contours.end - contours.start) / contours.size; - } - - if(formatAxis.range[0] === formatAxis.range[1]) { - formatAxis.range[1] += formatAxis.range[0] || 1; - } - if(!formatAxis.nticks) formatAxis.nticks = 1000; - - setConvert(formatAxis, fullLayout); - Axes.prepTicks(formatAxis); - formatAxis._tmin = null; - formatAxis._tmax = null; - } - return function(v) { - return Axes.tickText(formatAxis, v).text; - }; + container = base; + trace = null; } -}; -exports.calcTextOpts = function(level, contourFormat, dummyText, gd) { - var text = contourFormat(level); - dummyText.text(text) - .call(svgTextUtils.convertToTspans, gd); - var bBox = Drawing.bBox(dummyText.node(), true); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); + + // log to console if logger config option is enabled + Lib.log(msg); return { - text: text, - width: bBox.width, - height: bBox.height, - level: level, - dy: (bBox.top + bBox.bottom) / 2 + code: code, + container: container, + trace: trace, + path: path, + astr: astr, + msg: msg }; -}; +} -exports.findBestTextLocation = function(path, pathBounds, textOpts, labelData, plotBounds) { - var textWidth = textOpts.width; - - var p0, dp, pMax, pMin, loc; - if(pathBounds.isClosed) { - dp = pathBounds.len / costConstants.INITIALSEARCHPOINTS; - p0 = pathBounds.min + dp / 2; - pMax = pathBounds.max; - } - else { - dp = (pathBounds.len - textWidth) / (costConstants.INITIALSEARCHPOINTS + 1); - p0 = pathBounds.min + dp + textWidth / 2; - pMax = pathBounds.max - (dp + textWidth) / 2; - } - - var cost = Infinity; - for(var j = 0; j < costConstants.ITERATIONS; j++) { - for(var p = p0; p < pMax; p += dp) { - var newLocation = Lib.getTextLocation(path, pathBounds.total, p, textWidth); - var newCost = locationCost(newLocation, textOpts, labelData, plotBounds); - if(newCost < cost) { - cost = newCost; - loc = newLocation; - pMin = p; - } - } - if(cost > costConstants.MAXCOST * 2) break; - - // subsequent iterations just look half steps away from the - // best we found in the previous iteration - if(j) dp /= 2; - p0 = pMin - dp / 2; - pMax = p0 + dp * 1.5; - } - if(cost <= costConstants.MAXCOST) return loc; -}; +function isInSchema(schema, key) { + var parts = splitKey(key); + var keyMinusId = parts.keyMinusId; + var id = parts.id; -/* - * locationCost: a cost function for label locations - * composed of three kinds of penalty: - * - for open paths, being close to the end of the path - * - the angle away from horizontal - * - being too close to already placed neighbors - */ -function locationCost(loc, textOpts, labelData, bounds) { - var halfWidth = textOpts.width / 2; - var halfHeight = textOpts.height / 2; - var x = loc.x; - var y = loc.y; - var theta = loc.theta; - var dx = Math.cos(theta) * halfWidth; - var dy = Math.sin(theta) * halfWidth; - - // cost for being near an edge - var normX = ((x > bounds.center) ? (bounds.right - x) : (x - bounds.left)) / - (dx + Math.abs(Math.sin(theta) * halfHeight)); - var normY = ((y > bounds.middle) ? (bounds.bottom - y) : (y - bounds.top)) / - (Math.abs(dy) + Math.cos(theta) * halfHeight); - if(normX < 1 || normY < 1) return Infinity; - var cost = costConstants.EDGECOST * (1 / (normX - 1) + 1 / (normY - 1)); - - // cost for not being horizontal - cost += costConstants.ANGLECOST * theta * theta; - - // cost for being close to other labels - var x1 = x - dx; - var y1 = y - dy; - var x2 = x + dx; - var y2 = y + dy; - for(var i = 0; i < labelData.length; i++) { - var labeli = labelData[i]; - var dxd = Math.cos(labeli.theta) * labeli.width / 2; - var dyd = Math.sin(labeli.theta) * labeli.width / 2; - var dist = Lib.segmentDistance( - x1, y1, - x2, y2, - labeli.x - dxd, labeli.y - dyd, - labeli.x + dxd, labeli.y + dyd - ) * 2 / (textOpts.height + labeli.height); - - var sameLevel = labeli.level === textOpts.level; - var distOffset = sameLevel ? costConstants.SAMELEVELDISTANCE : 1; - - if(dist <= distOffset) return Infinity; - - var distFactor = costConstants.NEIGHBORCOST * - (sameLevel ? costConstants.SAMELEVELFACTOR : 1); - - cost += distFactor / (dist - distOffset); - } - - return cost; -} - -exports.addLabelData = function(loc, textOpts, labelData, labelClipPathData) { - var halfWidth = textOpts.width / 2; - var halfHeight = textOpts.height / 2; - - var x = loc.x; - var y = loc.y; - var theta = loc.theta; - - var sin = Math.sin(theta); - var cos = Math.cos(theta); - var dxw = halfWidth * cos; - var dxh = halfHeight * sin; - var dyw = halfWidth * sin; - var dyh = -halfHeight * cos; - var bBoxPts = [ - [x - dxw - dxh, y - dyw - dyh], - [x + dxw - dxh, y + dyw - dyh], - [x + dxw + dxh, y + dyw + dyh], - [x - dxw + dxh, y - dyw + dyh], - ]; + if((keyMinusId in schema) && schema[keyMinusId]._isSubplotObj && id) { + return true; + } - labelData.push({ - text: textOpts.text, - x: x, - y: y, - dy: textOpts.dy, - theta: theta, - level: textOpts.level, - width: textOpts.width, - height: textOpts.height - }); + return (key in schema); +} - labelClipPathData.push(bBoxPts); -}; +function getNestedSchema(schema, key) { + if(key in schema) return schema[key]; -exports.drawLabels = function(labelGroup, labelData, gd, lineClip, labelClipPathData) { - var labels = labelGroup.selectAll('text') - .data(labelData, function(d) { - return d.text + ',' + d.x + ',' + d.y + ',' + d.theta; - }); + var parts = splitKey(key); - labels.exit().remove(); + return schema[parts.keyMinusId]; +} - labels.enter().append('text') - .attr({ - 'data-notex': 1, - 'text-anchor': 'middle' - }) - .each(function(d) { - var x = d.x + Math.sin(d.theta) * d.dy; - var y = d.y - Math.cos(d.theta) * d.dy; - d3.select(this) - .text(d.text) - .attr({ - x: x, - y: y, - transform: 'rotate(' + (180 * d.theta / Math.PI) + ' ' + x + ' ' + y + ')' - }) - .call(svgTextUtils.convertToTspans, gd); - }); +var idRegex = Lib.counterRegex('([a-z]+)'); - if(labelClipPathData) { - var clipPath = ''; - for(var i = 0; i < labelClipPathData.length; i++) { - clipPath += 'M' + labelClipPathData[i].join('L') + 'Z'; - } +function splitKey(key) { + var idMatch = key.match(idRegex); - var lineClipPath = Lib.ensureSingle(lineClip, 'path', ''); - lineClipPath.attr('d', clipPath); - } -}; + return { + keyMinusId: idMatch && idMatch[1], + id: idMatch && idMatch[2] + }; +} -function clipGaps(plotGroup, plotinfo, clips, cd0, perimeter) { - var clipId = 'clip' + cd0.trace.uid; +function convertPathToAttributeString(path) { + if(!isArray(path)) return String(path); - var clipPath = clips.selectAll('#' + clipId) - .data(cd0.trace.connectgaps ? [] : [0]); - clipPath.enter().append('clipPath') - .classed('contourclip', true) - .attr('id', clipId); - clipPath.exit().remove(); + var astr = ''; - if(cd0.trace.connectgaps === false) { - var clipPathInfo = { - // fraction of the way from missing to present point - // to draw the boundary. - // if you make this 1 (or 1-epsilon) then a point in - // a sea of missing data will disappear entirely. - level: 0.9, - crossings: {}, - starts: [], - edgepaths: [], - paths: [], - xaxis: plotinfo.xaxis, - yaxis: plotinfo.yaxis, - x: cd0.x, - y: cd0.y, - // 0 = no data, 1 = data - z: makeClipMask(cd0), - smoothing: 0 - }; + for(var i = 0; i < path.length; i++) { + var p = path[i]; - makeCrossings([clipPathInfo]); - findAllPaths([clipPathInfo]); - var fullpath = joinAllPaths(clipPathInfo, perimeter); + if(typeof p === 'number') { + astr = astr.substr(0, astr.length - 1) + '[' + p + ']'; + } + else { + astr += p; + } - var path = Lib.ensureSingle(clipPath, 'path', ''); - path.attr('d', fullpath); + if(i < path.length - 1) astr += '.'; } - else clipId = null; - - plotGroup.call(Drawing.setClipUrl, clipId); -} - -function makeClipMask(cd0) { - var empties = cd0.trace._emptypoints, - z = [], - m = cd0.z.length, - n = cd0.z[0].length, - i, - row = [], - emptyPoint; - for(i = 0; i < n; i++) row.push(1); - for(i = 0; i < m; i++) z.push(row.slice()); - for(i = 0; i < empties.length; i++) { - emptyPoint = empties[i]; - z[emptyPoint[0]][emptyPoint[1]] = 0; - } - // save this mask to determine whether to show this data in hover - cd0.zmask = z; - return z; + return astr; } -},{"../../components/drawing":595,"../../lib":696,"../../lib/svg_text_utils":720,"../../plots/cartesian/axes":744,"../../plots/cartesian/set_convert":763,"../heatmap/plot":957,"./close_boundaries":918,"./constants":920,"./convert_to_constraints":924,"./empty_pathinfo":926,"./find_all_paths":928,"./make_crossings":933,"d3":148}],935:[function(_dereq_,module,exports){ +},{"../lib":159,"../plots/plots":236,"./plot_config":191,"./plot_schema":192}],198:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Axes = _dereq_('../../plots/cartesian/axes'); -var Lib = _dereq_('../../lib'); - - -module.exports = function setContours(trace) { - var contours = trace.contours; - - // check if we need to auto-choose contour levels - if(trace.autocontour) { - var zmin = trace.zmin; - var zmax = trace.zmax; - if(zmin === undefined || zmax === undefined) { - zmin = Lib.aggNums(Math.min, null, trace._z); - zmax = Lib.aggNums(Math.max, null, trace._z); - } - var dummyAx = autoContours(zmin, zmax, trace.ncontours); - - contours.size = dummyAx.dtick; - - contours.start = Axes.tickFirst(dummyAx); - dummyAx.range.reverse(); - contours.end = Axes.tickFirst(dummyAx); - - if(contours.start === zmin) contours.start += contours.size; - if(contours.end === zmax) contours.end -= contours.size; - - // if you set a small ncontours, *and* the ends are exactly on zmin/zmax - // there's an edge case where start > end now. Make sure there's at least - // one meaningful contour, put it midway between the crossed values - if(contours.start > contours.end) { - contours.start = contours.end = (contours.start + contours.end) / 2; - } - - // copy auto-contour info back to the source data. - // previously we copied the whole contours object back, but that had - // other info (coloring, showlines) that should be left to supplyDefaults - if(!trace._input.contours) trace._input.contours = {}; - Lib.extendFlat(trace._input.contours, { - start: contours.start, - end: contours.end, - size: contours.size - }); - trace._input.autocontour = true; - } - else if(contours.type !== 'constraint') { - // sanity checks on manually-supplied start/end/size - var start = contours.start, - end = contours.end, - inputContours = trace._input.contours; - - if(start > end) { - contours.start = inputContours.start = end; - end = contours.end = inputContours.end = start; - start = contours.start; - } - - if(!(contours.size > 0)) { - var sizeOut; - if(start === end) sizeOut = 1; - else sizeOut = autoContours(start, end, trace.ncontours).dtick; - - inputContours.size = contours.size = sizeOut; +module.exports = { + mode: { + valType: 'enumerated', + dflt: 'afterall', + + values: ['immediate', 'next', 'afterall'], + + }, + direction: { + valType: 'enumerated', + + values: ['forward', 'reverse'], + dflt: 'forward', + + }, + fromcurrent: { + valType: 'boolean', + dflt: false, + + + }, + frame: { + duration: { + valType: 'number', + + min: 0, + dflt: 500, + + }, + redraw: { + valType: 'boolean', + + dflt: true, + + }, + }, + transition: { + duration: { + valType: 'number', + + min: 0, + dflt: 500, + editType: 'none', + + }, + 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', + + }, + ordering: { + valType: 'enumerated', + values: ['layout first', 'traces first'], + dflt: 'layout first', + + editType: 'none', + } } }; - -/* - * autoContours: make a dummy axis object with dtick we can use - * as contours.size, and if needed we can use Axes.tickFirst - * with this axis object to calculate the start and end too - * - * start: the value to start the contours at - * end: the value to end at (must be > start) - * ncontours: max number of contours to make, like roughDTick - * - * returns: an axis object - */ -function autoContours(start, end, ncontours) { - var dummyAx = { - type: 'linear', - range: [start, end] - }; - - Axes.autoTicks( - dummyAx, - (end - start) / (ncontours || 15) - ); - - return dummyAx; -} - -},{"../../lib":696,"../../plots/cartesian/axes":744}],936:[function(_dereq_,module,exports){ +},{}],199:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var d3 = _dereq_('d3'); - -var Drawing = _dereq_('../../components/drawing'); -var heatmapStyle = _dereq_('../heatmap/style'); - -var makeColorMap = _dereq_('./make_color_map'); - - -module.exports = function style(gd) { - var contours = d3.select(gd).selectAll('g.contour'); +var Lib = _dereq_('../lib'); +var Template = _dereq_('../plot_api/plot_template'); - contours.style('opacity', function(d) { - return d[0].trace.opacity; - }); +/** Convenience wrapper for making array container logic DRY and consistent + * + * @param {object} parentObjIn + * user input object where the container in question is linked + * (i.e. either a user trace object or the user layout object) + * + * @param {object} parentObjOut + * full object where the coerced container will be linked + * (i.e. either a full trace object or the full layout object) + * + * @param {object} opts + * options object: + * - name {string} + * name of the key linking the container in question + * - inclusionAttr {string} + * name of the item attribute for inclusion/exclusion. Default is 'visible'. + * Since inclusion is true, use eg 'enabled' instead of 'disabled'. + * - handleItemDefaults {function} + * defaults method to be called on each item in the array container in question + * + * Its arguments are: + * - itemIn {object} item in user layout + * - itemOut {object} item in full layout + * - parentObj {object} (as in closure) + * - opts {object} (as in closure) + * N.B. + * + * - opts is passed to handleItemDefaults so it can also store + * links to supplementary data (e.g. fullData for layout components) + * + */ +module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { + var name = opts.name; + var inclusionAttr = opts.inclusionAttr || 'visible'; - contours.each(function(d) { - var c = d3.select(this); - var trace = d[0].trace; - var contours = trace.contours; - var line = trace.line; - var cs = contours.size || 1; - var start = contours.start; - - // for contourcarpet only - is this a constraint-type contour trace? - var isConstraintType = contours.type === 'constraint'; - var colorLines = !isConstraintType && contours.coloring === 'lines'; - var colorFills = !isConstraintType && contours.coloring === 'fill'; - - var colorMap = (colorLines || colorFills) ? makeColorMap(trace) : null; - - c.selectAll('g.contourlevel').each(function(d) { - d3.select(this).selectAll('path') - .call(Drawing.lineGroupStyle, - line.width, - colorLines ? colorMap(d.level) : line.color, - line.dash); - }); - - var labelFont = contours.labelfont; - c.selectAll('g.contourlabels text').each(function(d) { - Drawing.font(d3.select(this), { - family: labelFont.family, - size: labelFont.size, - color: labelFont.color || (colorLines ? colorMap(d.level) : line.color) - }); - }); + var previousContOut = parentObjOut[name]; - if(isConstraintType) { - c.selectAll('g.contourfill path') - .style('fill', trace.fillcolor); - } - else if(colorFills) { - var firstFill; - - c.selectAll('g.contourfill path') - .style('fill', function(d) { - if(firstFill === undefined) firstFill = d.level; - return colorMap(d.level + 0.5 * cs); - }); + var contIn = Lib.isArrayOrTypedArray(parentObjIn[name]) ? parentObjIn[name] : []; + var contOut = parentObjOut[name] = []; + var templater = Template.arrayTemplater(parentObjOut, name, inclusionAttr); + var i, itemOut; - if(firstFill === undefined) firstFill = start; + for(i = 0; i < contIn.length; i++) { + var itemIn = contIn[i]; - c.selectAll('g.contourbg path') - .style('fill', colorMap(firstFill - 0.5 * cs)); + if(!Lib.isPlainObject(itemIn)) { + itemOut = templater.newItem({}); + itemOut[inclusionAttr] = false; + } + else { + itemOut = templater.newItem(itemIn); } - }); - - heatmapStyle(gd); -}; - -},{"../../components/drawing":595,"../heatmap/style":958,"./make_color_map":932,"d3":148}],937:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var handleLabelDefaults = _dereq_('./label_defaults'); - -module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, opts) { - var coloring = coerce('contours.coloring'); + itemOut._index = i; - var showLines; - var lineColor = ''; - if(coloring === 'fill') showLines = coerce('contours.showlines'); + if(itemOut[inclusionAttr] !== false) { + opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts); + } - if(showLines !== false) { - if(coloring !== 'lines') lineColor = coerce('line.color', '#000'); - coerce('line.width', 0.5); - coerce('line.dash'); + contOut.push(itemOut); } - if(coloring !== 'none') { - // plots/plots always coerces showlegend to true, but in this case - // we default to false and (by default) show a colorbar instead - if(traceIn.showlegend !== true) traceOut.showlegend = false; - traceOut._dfltShowLegend = false; - - colorscaleDefaults( - traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} - ); + 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); } - coerce('line.smoothing'); + // in case this array gets its defaults rebuilt independent of the whole layout, + // relink the private keys just for this array. + if(Lib.isArrayOrTypedArray(previousContOut)) { + var len = Math.min(previousContOut.length, contOut.length); + for(i = 0; i < len; i++) { + Lib.relinkPrivateKeys(contOut[i], previousContOut[i]); + } + } - handleLabelDefaults(coerce, layout, lineColor, opts); + return contOut; }; -},{"../../components/colorscale/defaults":580,"./label_defaults":931}],938:[function(_dereq_,module,exports){ +},{"../lib":159,"../plot_api/plot_template":193}],200:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -147724,269 +48603,161 @@ 'use strict'; -var heatmapAttrs = _dereq_('../heatmap/attributes'); -var contourAttrs = _dereq_('../contour/attributes'); -var contourContourAttrs = contourAttrs.contours; -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var scatterLineAttrs = scatterAttrs.line; +var fxAttrs = _dereq_('../components/fx/attributes'); -module.exports = extendFlat({ - carpet: { +module.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', + + }, + showlegend: { + valType: 'boolean', + + dflt: true, + editType: 'style', + + }, + legendgroup: { valType: 'string', + dflt: '', + editType: 'style', + + }, + opacity: { + valType: 'number', + + min: 0, + max: 1, + dflt: 1, + editType: 'style', + + }, + name: { + valType: 'string', + + editType: 'style', + + }, + uid: { + valType: 'string', + + editType: 'plot', + anim: true, + + }, + ids: { + valType: 'data_array', editType: 'calc', + anim: true, }, - z: heatmapAttrs.z, - a: heatmapAttrs.x, - a0: heatmapAttrs.x0, - da: heatmapAttrs.dx, - b: heatmapAttrs.y, - b0: heatmapAttrs.y0, - db: heatmapAttrs.dy, - text: heatmapAttrs.text, - transpose: heatmapAttrs.transpose, - atype: heatmapAttrs.xtype, - btype: heatmapAttrs.ytype, - - fillcolor: contourAttrs.fillcolor, - - autocontour: contourAttrs.autocontour, - ncontours: contourAttrs.ncontours, - - contours: { - type: contourContourAttrs.type, - start: contourContourAttrs.start, - end: contourContourAttrs.end, - size: contourContourAttrs.size, - coloring: { - // from contourAttrs.contours.coloring but no 'heatmap' option - valType: 'enumerated', - values: ['fill', 'lines', 'none'], - dflt: 'fill', + customdata: { + valType: 'data_array', + editType: 'calc', + + }, + + // 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', + + }, + + hoverinfo: { + valType: 'flaglist', + + flags: ['x', 'y', 'z', 'text', 'name'], + extras: ['all', 'none', 'skip'], + arrayOk: true, + dflt: 'all', + editType: 'none', + + }, + hoverlabel: fxAttrs.hoverlabel, + stream: { + token: { + valType: 'string', + noBlank: true, + strict: true, editType: 'calc', }, - showlines: contourContourAttrs.showlines, - showlabels: contourContourAttrs.showlabels, - labelfont: contourContourAttrs.labelfont, - labelformat: contourContourAttrs.labelformat, - operation: contourContourAttrs.operation, - value: contourContourAttrs.value, - editType: 'calc', - impliedEdits: {'autocontour': false} - }, - - line: { - color: extendFlat({}, scatterLineAttrs.color, { + maxpoints: { + valType: 'number', + min: 0, + max: 10000, + dflt: 500, - }), - width: scatterLineAttrs.width, - dash: scatterLineAttrs.dash, - smoothing: extendFlat({}, scatterLineAttrs.smoothing, { + editType: 'calc', - }), - editType: 'plot' - }, - transforms: undefined -}, - - colorscaleAttrs('', { - cLetter: 'z', - autoColorDflt: false - }), - { colorbar: colorbarAttrs } -); - -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../contour/attributes":916,"../heatmap/attributes":945,"../scatter/attributes":1043}],939:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); -var isArray1D = _dereq_('../../lib').isArray1D; - -var convertColumnData = _dereq_('../heatmap/convert_column_xyz'); -var clean2dArray = _dereq_('../heatmap/clean_2d_array'); -var maxRowLength = _dereq_('../heatmap/max_row_length'); -var interp2d = _dereq_('../heatmap/interp2d'); -var findEmpties = _dereq_('../heatmap/find_empties'); -var makeBoundArray = _dereq_('../heatmap/make_bound_array'); -var supplyDefaults = _dereq_('./defaults'); -var lookupCarpet = _dereq_('../carpet/lookup_carpetid'); -var setContours = _dereq_('../contour/set_contours'); - -// most is the same as heatmap calc, then adjust it -// though a few things inside heatmap calc still look for -// contour maps, because the makeBoundArray calls are too entangled -module.exports = function calc(gd, trace) { - var carpet = trace._carpetTrace = lookupCarpet(gd, trace); - if(!carpet || !carpet.visible || carpet.visible === 'legendonly') return; - - if(!trace.a || !trace.b) { - // Look up the original incoming carpet data: - var carpetdata = gd.data[carpet.index]; - - // Look up the incoming trace data, *except* perform a shallow - // copy so that we're not actually modifying it when we use it - // to supply defaults: - var tracedata = gd.data[trace.index]; - // var tracedata = extendFlat({}, gd.data[trace.index]); - - // If the data is not specified - if(!tracedata.a) tracedata.a = carpetdata.a; - if(!tracedata.b) tracedata.b = carpetdata.b; - - supplyDefaults(tracedata, trace, trace._defaultColor, gd._fullLayout); + }, + editType: 'calc' + }, + transforms: { + _isLinkedToArray: 'transform', + editType: 'calc', + + }, + uirevision: { + valType: 'any', + + editType: 'none', + } - - var cd = heatmappishCalc(gd, trace); - - setContours(trace); - - return cd; }; -function heatmappishCalc(gd, trace) { - // prepare the raw data - // run makeCalcdata on x and y even for heatmaps, in case of category mappings - var carpet = trace._carpetTrace; - var aax = carpet.aaxis; - var bax = carpet.baxis; - var a, - a0, - da, - b, - b0, - db, - z; - - // cancel minimum tick spacings (only applies to bars and boxes) - aax._minDtick = 0; - bax._minDtick = 0; - - if(isArray1D(trace.z)) convertColumnData(trace, aax, bax, 'a', 'b', ['z']); - a = trace._a = trace._a || trace.a; - b = trace._b = trace._b || trace.b; - - a = a ? aax.makeCalcdata(trace, '_a') : []; - b = b ? bax.makeCalcdata(trace, '_b') : []; - a0 = trace.a0 || 0; - da = trace.da || 1; - b0 = trace.b0 || 0; - db = trace.db || 1; - - z = trace._z = clean2dArray(trace._z || trace.z, trace.transpose); - - trace._emptypoints = findEmpties(z); - interp2d(z, trace._emptypoints); - - // create arrays of brick boundaries, to be used by autorange and heatmap.plot - var xlen = maxRowLength(z), - xIn = trace.xtype === 'scaled' ? '' : a, - xArray = makeBoundArray(trace, xIn, a0, da, xlen, aax), - yIn = trace.ytype === 'scaled' ? '' : b, - yArray = makeBoundArray(trace, yIn, b0, db, z.length, bax); - - var cd0 = { - a: xArray, - b: yArray, - z: z, - }; - - if(trace.contours.type === 'levels' && trace.contours.coloring !== 'none') { - // auto-z and autocolorscale if applicable - colorscaleCalc(trace, z, '', 'z'); - } - - return [cd0]; -} - -},{"../../components/colorscale/calc":578,"../../lib":696,"../carpet/lookup_carpetid":894,"../contour/set_contours":935,"../heatmap/clean_2d_array":947,"../heatmap/convert_column_xyz":949,"../heatmap/find_empties":951,"../heatmap/interp2d":954,"../heatmap/make_bound_array":955,"../heatmap/max_row_length":956,"./defaults":940}],940:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":73}],201:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Lib = _dereq_('../../lib'); - -var handleXYZDefaults = _dereq_('../heatmap/xyz_defaults'); -var attributes = _dereq_('./attributes'); -var handleConstraintDefaults = _dereq_('../contour/constraint_defaults'); -var handleContoursDefaults = _dereq_('../contour/contours_defaults'); -var handleStyleDefaults = _dereq_('../contour/style_defaults'); - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - function coerce2(attr) { - return Lib.coerce2(traceIn, traceOut, attributes, attr); - } - - coerce('carpet'); - - // If either a or b is not present, then it's not a valid trace *unless* the carpet - // axis has the a or b values we're looking for. So if these are not found, just defer - // that decision until the calc step. - // - // NB: the calc step will modify the original data input by assigning whichever of - // a or b are missing. This is necessary because panning goes right from supplyDefaults - // to plot (skipping calc). That means on subsequent updates, this *will* need to be - // able to find a and b. - // - // The long-term proper fix is that this should perhaps use underscored attributes to - // at least modify the user input to a slightly lesser extent. Fully removing the - // input mutation is challenging. The underscore approach is not currently taken since - // it requires modification to all of the functions below that expect the coerced - // attribute name to match the property name -- except '_a' !== 'a' so that is not - // straightforward. - if(traceIn.a && traceIn.b) { - - var len = handleXYZDefaults(traceIn, traceOut, coerce, layout, 'a', 'b'); - - if(!len) { - traceOut.visible = false; - return; - } - coerce('text'); - var isConstraint = (coerce('contours.type') === 'constraint'); - - if(isConstraint) { - handleConstraintDefaults(traceIn, traceOut, coerce, layout, defaultColor, {hasHover: false}); - } else { - handleContoursDefaults(traceIn, traceOut, coerce, coerce2); - handleStyleDefaults(traceIn, traceOut, coerce, layout, {hasHover: false}); - } - } else { - traceOut._defaultColor = defaultColor; - traceOut._length = null; +module.exports = { + xaxis: { + valType: 'subplotid', + + dflt: 'x', + editType: 'calc+clearAxisTypes', + + }, + yaxis: { + valType: 'subplotid', + + dflt: 'y', + editType: 'calc+clearAxisTypes', + } }; -},{"../../lib":696,"../contour/constraint_defaults":921,"../contour/contours_defaults":923,"../contour/style_defaults":937,"../heatmap/xyz_defaults":960,"./attributes":938}],941:[function(_dereq_,module,exports){ +},{}],202:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -147995,864 +48766,491 @@ 'use strict'; -var ContourCarpet = {}; +var isNumeric = _dereq_('fast-isnumeric'); -ContourCarpet.attributes = _dereq_('./attributes'); -ContourCarpet.supplyDefaults = _dereq_('./defaults'); -ContourCarpet.colorbar = _dereq_('../contour/colorbar'); -ContourCarpet.calc = _dereq_('./calc'); -ContourCarpet.plot = _dereq_('./plot'); -ContourCarpet.style = _dereq_('../contour/style'); +var Lib = _dereq_('../../lib'); +var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; +var Registry = _dereq_('../../registry'); -ContourCarpet.moduleType = 'trace'; -ContourCarpet.name = 'contourcarpet'; -ContourCarpet.basePlotModule = _dereq_('../../plots/cartesian'); -ContourCarpet.categories = ['cartesian', 'svg', 'carpet', 'contour', 'symbols', 'showLegend', 'hasLines', 'carpetDependent']; -ContourCarpet.meta = { - - +module.exports = { + getAutoRange: getAutoRange, + makePadFn: makePadFn, + doAutoRange: doAutoRange, + findExtremes: findExtremes, + concatExtremes: concatExtremes }; -module.exports = ContourCarpet; - -},{"../../plots/cartesian":756,"../contour/colorbar":919,"../contour/style":936,"./attributes":938,"./calc":939,"./defaults":940,"./plot":944}],942:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * getAutoRange + * + * Collects all _extremes values corresponding to a given axis + * and computes its auto range. + * + * Note that getAutoRange uses return values from findExtremes. + * + * @param {object} gd: + * graph div object with filled-in fullData and fullLayout, in particular + * with filled-in '_extremes' containers: + * { + * val: calcdata value, + * pad: extra pixels beyond this value, + * extrapad: bool, does this point want 5% extra padding + * } + * @param {object} ax: + * full axis object, in particular with filled-in '_traceIndices' + * and '_annIndices' / '_shapeIndices' if applicable + * @return {array} + * an array of [min, max]. These are calcdata for log and category axes + * and data for linear and date axes. + * + * TODO: we want to change log to data as well, but it's hard to do this + * maintaining backward compatibility. category will always have to use calcdata + * though, because otherwise values between categories (or outside all categories) + * would be impossible. + */ +function getAutoRange(gd, ax) { + var i, j; + var newRange = []; -'use strict'; + var getPad = makePadFn(ax); + var extremes = concatExtremes(gd, ax); + var minArray = extremes.min; + var maxArray = extremes.max; -var Drawing = _dereq_('../../components/drawing'); -var axisAlignedLine = _dereq_('../carpet/axis_aligned_line'); -var Lib = _dereq_('../../lib'); + if(minArray.length === 0 || maxArray.length === 0) { + return Lib.simpleMap(ax.range, ax.r2l); + } -module.exports = function joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpetcd, xa, ya) { - var i; - var fullpath = ''; + var minmin = minArray[0].val; + var maxmax = maxArray[0].val; - var startsleft = pi.edgepaths.map(function(v, i) { return i; }); - var newloop = true; - var endpt, newendpt, cnt, nexti, possiblei, addpath; - - var atol = Math.abs(perimeter[0][0] - perimeter[2][0]) * 1e-4; - var btol = Math.abs(perimeter[0][1] - perimeter[2][1]) * 1e-4; - - function istop(pt) { return Math.abs(pt[1] - perimeter[0][1]) < btol; } - function isbottom(pt) { return Math.abs(pt[1] - perimeter[2][1]) < btol; } - function isleft(pt) { return Math.abs(pt[0] - perimeter[0][0]) < atol; } - function isright(pt) { return Math.abs(pt[0] - perimeter[2][0]) < atol; } - - function pathto(pt0, pt1) { - var i, j, segments, axis; - var path = ''; - - if((istop(pt0) && !isright(pt0)) || (isbottom(pt0) && !isleft(pt0))) { - axis = carpet.aaxis; - segments = axisAlignedLine(carpet, carpetcd, [pt0[0], pt1[0]], 0.5 * (pt0[1] + pt1[1])); - } else { - axis = carpet.baxis; - segments = axisAlignedLine(carpet, carpetcd, 0.5 * (pt0[0] + pt1[0]), [pt0[1], pt1[1]]); - } + 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); + } - for(i = 1; i < segments.length; i++) { - path += axis.smoothing ? 'C' : 'L'; - for(j = 0; j < segments[i].length; j++) { - var pt = segments[i][j]; - path += [xa.c2p(pt[0]), ya.c2p(pt[1])] + ' '; - } - } + var axReverse = false; - return path; + if(ax.range) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + // one-time setting to easily reverse the axis + // when plotting from code + if(ax.autorange === 'reversed') { + axReverse = true; + ax.autorange = true; } - i = 0; - endpt = null; - while(startsleft.length) { - var startpt = pi.edgepaths[i][0]; - - if(endpt) { - fullpath += pathto(endpt, startpt); - } - - addpath = Drawing.smoothopen(pi.edgepaths[i].map(ab2p), pi.smoothing); - fullpath += newloop ? addpath : addpath.replace(/^M/, 'L'); - startsleft.splice(startsleft.indexOf(i), 1); - endpt = pi.edgepaths[i][pi.edgepaths[i].length - 1]; - nexti = -1; - - // now loop through sides, moving our endpoint until we find a new start - for(cnt = 0; cnt < 4; cnt++) { // just to prevent infinite loops - if(!endpt) { - Lib.log('Missing end?', i, pi); - break; - } + var rangeMode = ax.rangemode; + var toZero = rangeMode === 'tozero'; + var nonNegative = rangeMode === 'nonnegative'; + var axLen = ax._length; + // don't allow padding to reduce the data to < 10% of the length + var minSpan = axLen / 10; - if(istop(endpt) && !isright(endpt)) { - newendpt = perimeter[1]; // left top ---> right top - } else if(isleft(endpt)) { - newendpt = perimeter[0]; // left bottom ---> left top - } else if(isbottom(endpt)) { - newendpt = perimeter[3]; // right bottom - } else if(isright(endpt)) { - newendpt = perimeter[2]; // left bottom - } - - for(possiblei = 0; possiblei < pi.edgepaths.length; possiblei++) { - var ptNew = pi.edgepaths[possiblei][0]; - // is ptNew on the (horz. or vert.) segment from endpt to newendpt? - if(Math.abs(endpt[0] - newendpt[0]) < atol) { - if(Math.abs(endpt[0] - ptNew[0]) < atol && (ptNew[1] - endpt[1]) * (newendpt[1] - ptNew[1]) >= 0) { - newendpt = ptNew; - nexti = possiblei; - } - } else if(Math.abs(endpt[1] - newendpt[1]) < btol) { - if(Math.abs(endpt[1] - ptNew[1]) < btol && (ptNew[0] - endpt[0]) * (newendpt[0] - ptNew[0]) >= 0) { - newendpt = ptNew; - nexti = possiblei; + var mbest = 0; + var minpt, maxpt, minbest, maxbest, dp, dv; + + for(i = 0; i < minArray.length; i++) { + minpt = minArray[i]; + for(j = 0; j < maxArray.length; j++) { + maxpt = maxArray[j]; + dv = maxpt.val - minpt.val; + if(dv > 0) { + dp = axLen - getPad(minpt) - getPad(maxpt); + if(dp > minSpan) { + if(dv / dp > mbest) { + minbest = minpt; + maxbest = maxpt; + mbest = dv / dp; } - } else { - Lib.log('endpt to newendpt is not vert. or horz.', endpt, newendpt, ptNew); + } + else if(dv / axLen > mbest) { + // in case of padding longer than the axis + // at least include the unpadded data values. + minbest = {val: minpt.val, pad: 0}; + maxbest = {val: maxpt.val, pad: 0}; + mbest = dv / axLen; } } - - if(nexti >= 0) break; - fullpath += pathto(endpt, newendpt); - endpt = newendpt; - } - - if(nexti === pi.edgepaths.length) { - Lib.log('unclosed perimeter path'); - break; - } - - i = nexti; - - // if we closed back on a loop we already included, - // close it and start a new loop - newloop = (startsleft.indexOf(i) === -1); - if(newloop) { - i = startsleft[0]; - fullpath += pathto(endpt, newendpt) + 'Z'; - endpt = null; } } - // finally add the interior paths - for(i = 0; i < pi.paths.length; i++) { - fullpath += Drawing.smoothclosed(pi.paths[i].map(ab2p), pi.smoothing); + function getMaxPad(prev, pt) { + return Math.max(prev, getPad(pt)); } - return fullpath; -}; - -},{"../../components/drawing":595,"../../lib":696,"../carpet/axis_aligned_line":878}],943:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -module.exports = function mapPathinfo(pathinfo, map) { - var i, j, k, pi, pedgepaths, ppaths, pedgepath, ppath, path; - - for(i = 0; i < pathinfo.length; i++) { - pi = pathinfo[i]; - pedgepaths = pi.pedgepaths = []; - ppaths = pi.ppaths = []; - for(j = 0; j < pi.edgepaths.length; j++) { - path = pi.edgepaths[j]; - pedgepath = []; - for(k = 0; k < path.length; k++) { - pedgepath[k] = map(path[k]); + if(minmin === maxmax) { + var lower = minmin - 1; + var upper = minmin + 1; + if(toZero) { + if(minmin === 0) { + // The only value we have on this axis is 0, and we want to + // autorange so zero is one end. + // In principle this could be [0, 1] or [-1, 0] but usually + // 'tozero' pins 0 to the low end, so follow that. + newRange = [0, 1]; } - pedgepaths.push(pedgepath); - } - for(j = 0; j < pi.paths.length; j++) { - path = pi.paths[j]; - ppath = []; - for(k = 0; k < path.length; k++) { - ppath[k] = map(path[k]); + else { + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + // we're pushing a single value away from the edge due to its + // padding, with the other end clamped at zero + // 0.5 means don't push it farther than the center. + var rangeEnd = minmin / (1 - Math.min(0.5, maxPad / axLen)); + newRange = minmin > 0 ? [0, rangeEnd] : [rangeEnd, 0]; } - ppaths.push(ppath); + } else if(nonNegative) { + newRange = [Math.max(0, lower), Math.max(1, upper)]; + } else { + newRange = [lower, upper]; } } -}; - -},{}],944:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var map1dArray = _dereq_('../carpet/map_1d_array'); -var makepath = _dereq_('../carpet/makepath'); -var Drawing = _dereq_('../../components/drawing'); -var Lib = _dereq_('../../lib'); - -var makeCrossings = _dereq_('../contour/make_crossings'); -var findAllPaths = _dereq_('../contour/find_all_paths'); -var contourPlot = _dereq_('../contour/plot'); -var constants = _dereq_('../contour/constants'); -var convertToConstraints = _dereq_('../contour/convert_to_constraints'); -var joinAllPaths = _dereq_('./join_all_paths'); -var emptyPathinfo = _dereq_('../contour/empty_pathinfo'); -var mapPathinfo = _dereq_('./map_pathinfo'); -var lookupCarpet = _dereq_('../carpet/lookup_carpetid'); -var closeBoundaries = _dereq_('../contour/close_boundaries'); - -module.exports = function plot(gd, plotinfo, cdcontours, contourcarpetLayer) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - - Lib.makeTraceGroups(contourcarpetLayer, cdcontours, 'contour').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var trace = cd0.trace; - - var carpet = trace._carpetTrace = lookupCarpet(gd, trace); - var carpetcd = gd.calcdata[carpet.index][0]; - - if(!carpet.visible || carpet.visible === 'legendonly') return; - - var a = cd0.a; - var b = cd0.b; - var contours = trace.contours; - var pathinfo = emptyPathinfo(contours, plotinfo, cd0); - var isConstraint = contours.type === 'constraint'; - var operation = contours._operation; - var coloring = isConstraint ? (operation === '=' ? 'lines' : 'fill') : contours.coloring; - - // Map [a, b] (data) --> [i, j] (pixels) - function ab2p(ab) { - var pt = carpet.ab2xy(ab[0], ab[1], true); - return [xa.c2p(pt[0]), ya.c2p(pt[1])]; - } - - // Define the perimeter in a/b coordinates: - var perimeter = [ - [a[0], b[b.length - 1]], - [a[a.length - 1], b[b.length - 1]], - [a[a.length - 1], b[0]], - [a[0], b[0]] - ]; - - // Extract the contour levels: - makeCrossings(pathinfo); - var atol = (a[a.length - 1] - a[0]) * 1e-8; - var btol = (b[b.length - 1] - b[0]) * 1e-8; - findAllPaths(pathinfo, atol, btol); - - // Constraints might need to be draw inverted, which is not something contours - // handle by default since they're assumed fully opaque so that they can be - // drawn overlapping. This function flips the paths as necessary so that they're - // drawn correctly. - // - // TODO: Perhaps this should be generalized and *all* paths should be drawn as - // closed regions so that translucent contour levels would be valid. - // See: https://github.com/plotly/plotly.js/issues/1356 - var fillPathinfo = pathinfo; - if(contours.type === 'constraint') { - fillPathinfo = convertToConstraints(pathinfo, operation); - closeBoundaries(fillPathinfo, operation, perimeter, trace); + else { + if(toZero) { + if(minbest.val >= 0) { + minbest = {val: 0, pad: 0}; + } + if(maxbest.val <= 0) { + maxbest = {val: 0, pad: 0}; + } } - - // Map the paths in a/b coordinates to pixel coordinates: - mapPathinfo(pathinfo, ab2p); - - // draw everything - - // Compute the boundary path - var seg, xp, yp, i; - var segs = []; - for(i = carpetcd.clipsegments.length - 1; i >= 0; i--) { - seg = carpetcd.clipsegments[i]; - xp = map1dArray([], seg.x, xa.c2p); - yp = map1dArray([], seg.y, ya.c2p); - xp.reverse(); - yp.reverse(); - segs.push(makepath(xp, yp, seg.bicubic)); + else if(nonNegative) { + if(minbest.val - mbest * getPad(minbest) < 0) { + minbest = {val: 0, pad: 0}; + } + if(maxbest.val <= 0) { + maxbest = {val: 1, pad: 0}; + } } - var boundaryPath = 'M' + segs.join('L') + 'Z'; - - // Draw the baseline background fill that fills in the space behind any other - // contour levels: - makeBackground(plotGroup, carpetcd.clipsegments, xa, ya, isConstraint, coloring); - - // Draw the specific contour fills. As a simplification, they're assumed to be - // fully opaque so that it's easy to draw them simply overlapping. The alternative - // would be to flip adjacent paths and draw closed paths for each level instead. - makeFills(trace, plotGroup, xa, ya, fillPathinfo, perimeter, ab2p, carpet, carpetcd, coloring, boundaryPath); - - // Draw contour lines: - makeLinesAndLabels(plotGroup, pathinfo, gd, cd0, contours, plotinfo, carpet); - - // Clip the boundary of the plot - Drawing.setClipUrl(plotGroup, carpet._clipPathId); - }); -}; - -function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, plotinfo, carpet) { - var lineContainer = Lib.ensureSingle(plotgroup, 'g', 'contourlines'); - var showLines = contours.showlines !== false; - var showLabels = contours.showlabels; - var clipLinesForLabels = showLines && showLabels; - - // Even if we're not going to show lines, we need to create them - // if we're showing labels, because the fill paths include the perimeter - // so can't be used to position the labels correctly. - // In this case we'll remove the lines after making the labels. - var linegroup = contourPlot.createLines(lineContainer, showLines || showLabels, pathinfo); - - var lineClip = contourPlot.createLineClip(lineContainer, clipLinesForLabels, - gd._fullLayout._defs, cd0.trace.uid); - - var labelGroup = plotgroup.selectAll('g.contourlabels') - .data(showLabels ? [0] : []); - - labelGroup.exit().remove(); - - labelGroup.enter().append('g') - .classed('contourlabels', true); - - if(showLabels) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - var xLen = xa._length; - var yLen = ya._length; - // for simplicity use the xy box for label clipping outline. - var labelClipPathData = [[ - [0, 0], - [xLen, 0], - [xLen, yLen], - [0, yLen] - ]]; - - - var labelData = []; - - // invalidate the getTextLocation cache in case paths changed - Lib.clearLocationCache(); - - var contourFormat = contourPlot.labelFormatter(contours, cd0.t.cb, gd._fullLayout); - - var dummyText = Drawing.tester.append('text') - .attr('data-notex', 1) - .call(Drawing.font, contours.labelfont); - - // use `bounds` only to keep labels away from the x/y boundaries - // `constrainToCarpet` below ensures labels don't go off the - // carpet edges - var bounds = { - left: 0, - right: xLen, - center: xLen / 2, - top: 0, - bottom: yLen, - middle: yLen / 2 - }; - - var plotDiagonal = Math.sqrt(xLen * xLen + yLen * yLen); - - // the path length to use to scale the number of labels to draw: - var normLength = constants.LABELDISTANCE * plotDiagonal / - Math.max(1, pathinfo.length / constants.LABELINCREASE); - - linegroup.each(function(d) { - var textOpts = contourPlot.calcTextOpts(d.level, contourFormat, dummyText, gd); - - d3.select(this).selectAll('path').each(function(pathData) { - var path = this; - var pathBounds = Lib.getVisibleSegment(path, bounds, textOpts.height / 2); - if(!pathBounds) return; - - constrainToCarpet(path, pathData, d, pathBounds, carpet, textOpts.height); - - if(pathBounds.len < (textOpts.width + textOpts.height) * constants.LABELMIN) return; - - var maxLabels = Math.min(Math.ceil(pathBounds.len / normLength), - constants.LABELMAX); + // in case it changed again... + mbest = (maxbest.val - minbest.val) / + (axLen - getPad(minbest) - getPad(maxbest)); - for(var i = 0; i < maxLabels; i++) { - var loc = contourPlot.findBestTextLocation(path, pathBounds, textOpts, - labelData, bounds); + newRange = [ + minbest.val - mbest * getPad(minbest), + maxbest.val + mbest * getPad(maxbest) + ]; + } - if(!loc) break; + // maintain reversal + if(axReverse) newRange.reverse(); - contourPlot.addLabelData(loc, textOpts, labelData, labelClipPathData); - } - }); - }); + return Lib.simpleMap(newRange, ax.l2r || Number); +} - dummyText.remove(); +/* + * calculate the pixel padding for ax._min and ax._max entries with + * optional extrapad as 5% of the total axis length + */ +function makePadFn(ax) { + // 5% padding for points that specify extrapad: true + var extrappad = ax._length / 20; - contourPlot.drawLabels(labelGroup, labelData, gd, lineClip, - clipLinesForLabels ? labelClipPathData : null); + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if((ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); } - if(showLabels && !showLines) linegroup.remove(); + return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -// figure out if this path goes off the edge of the carpet -// and shorten the part we call visible to keep labels away from the edge -function constrainToCarpet(path, pathData, levelData, pathBounds, carpet, textHeight) { - var pathABData; - for(var i = 0; i < levelData.pedgepaths.length; i++) { - if(pathData === levelData.pedgepaths[i]) { - pathABData = levelData.edgepaths[i]; - } - } - if(!pathABData) return; - - var aMin = carpet.a[0]; - var aMax = carpet.a[carpet.a.length - 1]; - var bMin = carpet.b[0]; - var bMax = carpet.b[carpet.b.length - 1]; - - function getOffset(abPt, pathVector) { - var offset = 0; - var edgeVector; - var dAB = 0.1; - if(Math.abs(abPt[0] - aMin) < dAB || Math.abs(abPt[0] - aMax) < dAB) { - edgeVector = normalizeVector(carpet.dxydb_rough(abPt[0], abPt[1], dAB)); - offset = Math.max(offset, textHeight * vectorTan(pathVector, edgeVector) / 2); - } +function concatExtremes(gd, ax) { + var axId = ax._id; + var fullData = gd._fullData; + var fullLayout = gd._fullLayout; + var minArray = []; + var maxArray = []; + var i, j, d; - if(Math.abs(abPt[1] - bMin) < dAB || Math.abs(abPt[1] - bMax) < dAB) { - edgeVector = normalizeVector(carpet.dxyda_rough(abPt[0], abPt[1], dAB)); - offset = Math.max(offset, textHeight * vectorTan(pathVector, edgeVector) / 2); + 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}); + } + } } - return offset; } - var startVector = getUnitVector(path, 0, 1); - var endVector = getUnitVector(path, pathBounds.total, pathBounds.total - 1); - var minStart = getOffset(pathABData[0], startVector); - var maxEnd = pathBounds.total - getOffset(pathABData[pathABData.length - 1], endVector); - - if(pathBounds.min < minStart) pathBounds.min = minStart; - if(pathBounds.max > maxEnd) pathBounds.max = maxEnd; + _concat(fullData, ax._traceIndices); + _concat(fullLayout.annotations || [], ax._annIndices || []); + _concat(fullLayout.shapes || [], ax._shapeIndices || []); - pathBounds.len = pathBounds.max - pathBounds.min; + return {min: minArray, max: maxArray}; } -function getUnitVector(path, p0, p1) { - var pt0 = path.getPointAtLength(p0); - var pt1 = path.getPointAtLength(p1); - var dx = pt1.x - pt0.x; - var dy = pt1.y - pt0.y; - var len = Math.sqrt(dx * dx + dy * dy); - return [dx / len, dy / len]; -} +function doAutoRange(gd, ax) { + if(ax.autorange) { + ax.range = getAutoRange(gd, ax); -function normalizeVector(v) { - var len = Math.sqrt(v[0] * v[0] + v[1] * v[1]); - return [v[0] / len, v[1] / len]; -} + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); -function vectorTan(v0, v1) { - var cos = Math.abs(v0[0] * v1[0] + v0[1] * v1[1]); - var sin = Math.sqrt(1 - cos * cos); - return sin / cos; -} + // doAutoRange will get called on fullLayout, + // but we want to report its results back to layout -function makeBackground(plotgroup, clipsegments, xaxis, yaxis, isConstraint, coloring) { - var seg, xp, yp, i; - var bggroup = Lib.ensureSingle(plotgroup, 'g', 'contourbg'); + var axIn = ax._input; - var bgfill = bggroup.selectAll('path') - .data((coloring === 'fill' && !isConstraint) ? [0] : []); - bgfill.enter().append('path'); - bgfill.exit().remove(); + // before we edit _input, store preGUI values + var edits = {}; + edits[ax._attr + '.range'] = ax.range; + edits[ax._attr + '.autorange'] = ax.autorange; + Registry.call('_storeDirectGUIEdit', gd.layout, gd._fullLayout._preGUI, edits); - var segs = []; - for(i = 0; i < clipsegments.length; i++) { - seg = clipsegments[i]; - xp = map1dArray([], seg.x, xaxis.c2p); - yp = map1dArray([], seg.y, yaxis.c2p); - segs.push(makepath(xp, yp, seg.bicubic)); + axIn.range = ax.range.slice(); + axIn.autorange = ax.autorange; } - bgfill - .attr('d', 'M' + segs.join('L') + 'Z') - .style('stroke', 'none'); -} - -function makeFills(trace, plotgroup, xa, ya, pathinfo, perimeter, ab2p, carpet, carpetcd, coloring, boundaryPath) { - var fillgroup = Lib.ensureSingle(plotgroup, 'g', 'contourfill'); - - var fillitems = fillgroup.selectAll('path') - .data(coloring === 'fill' ? pathinfo : []); - fillitems.enter().append('path'); - fillitems.exit().remove(); - fillitems.each(function(pi) { - // join all paths for this level together into a single path - // first follow clockwise around the perimeter to close any open paths - // if the whole perimeter is above this level, start with a path - // enclosing the whole thing. With all that, the parity should mean - // that we always fill everything above the contour, nothing below - var fullpath = joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpetcd, xa, ya); - - if(pi.prefixBoundary) { - fullpath = boundaryPath + fullpath; - } + var anchorAx = ax._anchorAxis; - if(!fullpath) { - d3.select(this).remove(); - } else { - d3.select(this) - .attr('d', fullpath) - .style('stroke', 'none'); + if(anchorAx && anchorAx.rangeslider) { + var axeRangeOpts = anchorAx.rangeslider[ax._name]; + if(axeRangeOpts) { + if(axeRangeOpts.rangemode === 'auto') { + axeRangeOpts.range = getAutoRange(gd, ax); + } } - }); + anchorAx._input.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts); + } } -},{"../../components/drawing":595,"../../lib":696,"../carpet/lookup_carpetid":894,"../carpet/makepath":895,"../carpet/map_1d_array":896,"../contour/close_boundaries":918,"../contour/constants":920,"../contour/convert_to_constraints":924,"../contour/empty_pathinfo":926,"../contour/find_all_paths":928,"../contour/make_crossings":933,"../contour/plot":934,"./join_all_paths":942,"./map_pathinfo":943,"d3":148}],945:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -module.exports = extendFlat({ - z: { - valType: 'data_array', - editType: 'calc', - - }, - 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'}}), - - text: { - valType: 'data_array', - editType: 'calc', - - }, - transpose: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - xtype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - editType: 'calc+clearAxisTypes', - - }, - ytype: { - valType: 'enumerated', - values: ['array', 'scaled'], - - editType: 'calc+clearAxisTypes', - - }, - zsmooth: { - valType: 'enumerated', - values: ['fast', 'best', false], - dflt: false, - - editType: 'calc', - - }, - connectgaps: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - xgap: { - valType: 'number', - dflt: 0, - min: 0, - - editType: 'plot', - - }, - ygap: { - valType: 'number', - dflt: 0, - min: 0, - - editType: 'plot', - - }, - zhoverformat: { - valType: 'string', - dflt: '', - - editType: 'none', - - }, - transforms: undefined -}, - colorscaleAttrs('', { - cLetter: 'z', - autoColorDflt: false - }), - { colorbar: colorbarAttrs } -); - -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../scatter/attributes":1043}],946:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; + * findExtremes + * + * Find min/max extremes of an array of coordinates on a given axis. + * + * Note that findExtremes is called during `calc`, when we don't yet know the axis + * length; all the inputs should be based solely on the trace data, nothing + * about the axis layout. + * + * Note that `ppad` and `vpad` as well as their asymmetric variants refer to + * the before and after padding of the passed `data` array, not to the whole axis. + * + * @param {object} ax: full axis object + * relies on + * - ax.type + * - ax._m (just its sign) + * - ax.d2l + * @param {array} data: + * array of numbers (i.e. already run though ax.d2c) + * @param {object} opts: + * available keys are: + * vpad: (number or number array) pad values (data value +-vpad) + * ppad: (number or number array) pad pixels (pixel location +-ppad) + * ppadplus, ppadminus, vpadplus, vpadminus: + * separate padding for each side, overrides symmetric + * padded: (boolean) add 5% padding to both ends + * (unless one end is overridden by tozero) + * tozero: (boolean) make sure to include zero if axis is linear, + * and make it a tight bound if possible + * + * @return {object} + * - min {array of objects} + * - max {array of objects} + * each object item has fields: + * - val {number} + * - pad {number} + * - extrappad {number} + * - opts {object}: a ref to the passed "options" object + */ +function findExtremes(ax, data, opts) { + if(!opts) opts = {}; + if(!ax._m) ax.setScale(); -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); + var minArray = []; + var maxArray = []; -var histogram2dCalc = _dereq_('../histogram2d/calc'); -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); -var convertColumnData = _dereq_('./convert_column_xyz'); -var maxRowLength = _dereq_('./max_row_length'); -var clean2dArray = _dereq_('./clean_2d_array'); -var interp2d = _dereq_('./interp2d'); -var findEmpties = _dereq_('./find_empties'); -var makeBoundArray = _dereq_('./make_bound_array'); + 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 i, v, di, dmin, dmax, ppadiplus, ppadiminus, vmin, vmax; + function makePadAccessor(item) { + if(Array.isArray(item)) { + hasArrayOption = true; + return function(i) { return Math.max(Number(item[i]||0), 0); }; + } + else { + var v = Math.max(Number(item||0), 0); + return function() { return v; }; + } + } -module.exports = function calc(gd, trace) { - // prepare the raw data - // run makeCalcdata on x and y even for heatmaps, in case of category mappings - var xa = Axes.getFromId(gd, trace.xaxis || 'x'), - ya = Axes.getFromId(gd, trace.yaxis || 'y'), - isContour = Registry.traceIs(trace, 'contour'), - isHist = Registry.traceIs(trace, 'histogram'), - isGL2D = Registry.traceIs(trace, 'gl2d'), - zsmooth = isContour ? 'best' : trace.zsmooth, - x, - x0, - dx, - y, - y0, - dy, - z, - i, - binned; + 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); - // cancel minimum tick spacings (only applies to bars and boxes) - xa._minDtick = 0; - ya._minDtick = 0; + if(!hasArrayOption) { + // with no arrays other than `data` we don't need to consider + // every point, only the extreme data points + vmin = Infinity; + vmax = -Infinity; - if(isHist) { - binned = histogram2dCalc(gd, trace); - x = binned.x; - x0 = binned.x0; - dx = binned.dx; - y = binned.y; - y0 = binned.y0; - dy = binned.dy; - z = binned.z; - } - else { - var zIn = trace.z; - if(Lib.isArray1D(zIn)) { - convertColumnData(trace, xa, ya, 'x', 'y', ['z']); - x = trace._x; - y = trace._y; - zIn = trace._z; + if(isLog) { + for(i = 0; i < len; i++) { + v = data[i]; + // data is not linearized yet so we still have to filter out negative logs + if(v < vmin && v > 0) vmin = v; + if(v > vmax && v < FP_SAFE) vmax = v; + } } else { - x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + 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; + } } - x0 = trace.x0 || 0; - dx = trace.dx || 1; - y0 = trace.y0 || 0; - dy = trace.dy || 1; + data = [vmin, vmax]; + len = 2; + } - z = clean2dArray(zIn, trace.transpose); + var collapseOpts = {tozero: tozero, extrapad: extrapad}; - if(isContour || trace.connectgaps) { - trace._emptypoints = findEmpties(z); - interp2d(z, trace._emptypoints); - } - } + function addItem(i) { + di = data[i]; + if(!isNumeric(di)) return; + ppadiplus = ppadplus(i); + ppadiminus = ppadminus(i); + vmin = di - vpadminus(i); + vmax = di + vpadplus(i); + // special case for log axes: if vpad makes this object span + // more than an order of mag, clip it to one order. This is so + // we don't have non-positive errors or absurdly large lower + // range due to rounding errors + if(isLog && vmin < vmax / 10) vmin = vmax / 10; - function noZsmooth(msg) { - zsmooth = trace._input.zsmooth = trace.zsmooth = false; - Lib.warn('cannot use zsmooth: "fast": ' + msg); - } + dmin = ax.c2l(vmin); + dmax = ax.c2l(vmax); - // check whether we really can smooth (ie all boxes are about the same size) - if(zsmooth === 'fast') { - if(xa.type === 'log' || ya.type === 'log') { - noZsmooth('log axis found'); + if(tozero) { + dmin = Math.min(0, dmin); + dmax = Math.max(0, dmax); } - else if(!isHist) { - if(x.length) { - var avgdx = (x[x.length - 1] - x[0]) / (x.length - 1), - maxErrX = Math.abs(avgdx / 100); - for(i = 0; i < x.length - 1; i++) { - if(Math.abs(x[i + 1] - x[i] - avgdx) > maxErrX) { - noZsmooth('x scale is not linear'); - break; - } - } - } - if(y.length && zsmooth === 'fast') { - var avgdy = (y[y.length - 1] - y[0]) / (y.length - 1), - maxErrY = Math.abs(avgdy / 100); - for(i = 0; i < y.length - 1; i++) { - if(Math.abs(y[i + 1] - y[i] - avgdy) > maxErrY) { - noZsmooth('y scale is not linear'); - break; - } - } - } + if(goodNumber(dmin)) { + collapseMinArray(minArray, dmin, ppadiminus, collapseOpts); + } + if(goodNumber(dmax)) { + collapseMaxArray(maxArray, dmax, ppadiplus, collapseOpts); } } - // create arrays of brick boundaries, to be used by autorange and heatmap.plot - var xlen = maxRowLength(z); - var xIn = trace.xtype === 'scaled' ? '' : x; - var xArray = makeBoundArray(trace, xIn, x0, dx, xlen, xa); - var yIn = trace.ytype === 'scaled' ? '' : y; - var yArray = makeBoundArray(trace, yIn, y0, dy, z.length, ya); - - // handled in gl2d convert step - if(!isGL2D) { - trace._extremes[xa._id] = Axes.findExtremes(xa, xArray); - trace._extremes[ya._id] = Axes.findExtremes(ya, yArray); - } - - var cd0 = { - x: xArray, - y: yArray, - z: z, - text: trace._text || trace.text - }; - - 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; - } + // For efficiency covering monotonic or near-monotonic data, + // check a few points at both ends first and then sweep + // through the middle + var iMax = Math.min(6, len); + for(i = 0; i < iMax; i++) addItem(i); + for(i = len - 1; i >= iMax; i--) addItem(i); - // auto-z and autocolorscale if applicable - if(!isContour || trace.contours.type !== 'constraint') { - colorscaleCalc(trace, z, '', 'z'); - } + return { + min: minArray, + max: maxArray, + opts: opts + }; +} - 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, x0, dx, xlen, xa); - cd0.yfill = makeBoundArray(dummyTrace, yIn, y0, dy, z.length, ya); - } +function collapseMinArray(array, newVal, newPad, opts) { + collapseArray(array, newVal, newPad, opts, lessOrEqual); +} - return [cd0]; -}; +function collapseMaxArray(array, newVal, newPad, opts) { + collapseArray(array, newVal, newPad, opts, greaterOrEqual); +} -},{"../../components/colorscale/calc":578,"../../lib":696,"../../plots/cartesian/axes":744,"../../registry":827,"../histogram2d/calc":977,"./clean_2d_array":947,"./convert_column_xyz":949,"./find_empties":951,"./interp2d":954,"./make_bound_array":955,"./max_row_length":956}],947:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -module.exports = function clean2dArray(zOld, transpose) { - var rowlen, collen, getCollen, old2new, i, j; - - function cleanZvalue(v) { - if(!isNumeric(v)) return undefined; - return +v; - } + * collapseArray + * + * Takes items from 'array' and compares them to 'newVal', 'newPad'. + * + * @param {array} array: + * current set of min or max extremes + * @param {number} newVal: + * new value to compare against + * @param {number} newPad: + * pad value associated with 'newVal' + * @param {object} opts: + * - tozero {boolean} + * - extrapad {number} + * @param {function} atLeastAsExtreme: + * comparison function, use + * - lessOrEqual for min 'array' and + * - greaterOrEqual for max 'array' + * + * In practice, 'array' is either + * - 'extremes[ax._id].min' or + * - 'extremes[ax._id].max + * found in traces and layout items that affect autorange. + * + * Since we don't yet know the relationship between pixels and values + * (that's what we're trying to figure out!) AND we don't yet know how + * many pixels `extrapad` represents (it's going to be 5% of the length, + * but we don't want to have to redo calc just because length changed) + * two point must satisfy three criteria simultaneously for one to supersede the other: + * - at least as extreme a `val` + * - at least as big a `pad` + * - an unpadded point cannot supersede a padded point, but any other combination can + * + * Then: + * - If the item supersedes the new point, set includeThis false + * - If the new pt supersedes the item, delete it from 'array' + */ +function collapseArray(array, newVal, newPad, opts, atLeastAsExtreme) { + var tozero = opts.tozero; + var extrapad = opts.extrapad; + var includeThis = true; - if(transpose) { - rowlen = 0; - for(i = 0; i < zOld.length; i++) rowlen = Math.max(rowlen, zOld[i].length); - if(rowlen === 0) return false; - getCollen = function(zOld) { return zOld.length; }; - old2new = function(zOld, i, j) { return zOld[j][i]; }; - } - else { - rowlen = zOld.length; - getCollen = function(zOld, i) { return zOld[i].length; }; - old2new = function(zOld, i, j) { return zOld[i][j]; }; + 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--; + } } - - var zNew = new Array(rowlen); - - for(i = 0; i < rowlen; i++) { - collen = getCollen(zOld, i); - zNew[i] = new Array(collen); - for(j = 0; j < collen; j++) zNew[i][j] = cleanZvalue(old2new(zOld, i, j)); + if(includeThis) { + var clipAtZero = (tozero && newVal === 0); + array.push({ + val: newVal, + pad: clipAtZero ? 0 : newPad, + extrapad: clipAtZero ? false : extrapad + }); } +} - return zNew; -}; - -},{"fast-isnumeric":214}],948:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; +// In order to stop overflow errors, don't consider points +// too close to the limits of js floating point +function goodNumber(v) { + return isNumeric(v) && Math.abs(v) < FP_SAFE; +} -module.exports = { - min: 'zmin', - max: 'zmax' -}; +function lessOrEqual(v0, v1) { return v0 <= v1; } +function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{}],949:[function(_dereq_,module,exports){ +},{"../../constants/numerical":140,"../../lib":159,"../../registry":243,"fast-isnumeric":10}],203:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -148862,3826 +49260,3011 @@ 'use strict'; -var Lib = _dereq_('../../lib'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; - -module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { - var colLen = trace._length; - var col1 = trace[var1Name].slice(0, colLen); - var col2 = trace[var2Name].slice(0, colLen); - var textCol = trace.text; - var hasColumnText = (textCol !== undefined && Lib.isArray1D(textCol)); - var col1Calendar = trace[var1Name + 'calendar']; - var col2Calendar = trace[var2Name + 'calendar']; - - var i, j, arrayVar, newArray, arrayVarName; - - for(i = 0; i < colLen; i++) { - col1[i] = ax1.d2c(col1[i], 0, col1Calendar); - col2[i] = ax2.d2c(col2[i], 0, col2Calendar); - } - - var col1dv = Lib.distinctVals(col1), - col1vals = col1dv.vals, - col2dv = Lib.distinctVals(col2), - col2vals = col2dv.vals, - newArrays = []; +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); +var Plots = _dereq_('../../plots/plots'); - for(i = 0; i < arrayVarNames.length; i++) { - newArrays[i] = Lib.init2dArray(col2vals.length, col1vals.length); - } +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var Titles = _dereq_('../../components/titles'); +var Color = _dereq_('../../components/color'); +var Drawing = _dereq_('../../components/drawing'); - var i1, i2, text; +var axAttrs = _dereq_('./layout_attributes'); +var cleanTicks = _dereq_('./clean_ticks'); - if(hasColumnText) text = Lib.init2dArray(col2vals.length, col1vals.length); +var constants = _dereq_('../../constants/numerical'); +var ONEAVGYEAR = constants.ONEAVGYEAR; +var ONEAVGMONTH = constants.ONEAVGMONTH; +var ONEDAY = constants.ONEDAY; +var ONEHOUR = constants.ONEHOUR; +var ONEMIN = constants.ONEMIN; +var ONESEC = constants.ONESEC; +var MINUS_SIGN = constants.MINUS_SIGN; +var BADNUM = constants.BADNUM; - for(i = 0; i < colLen; i++) { - if(col1[i] !== BADNUM && col2[i] !== BADNUM) { - i1 = Lib.findBin(col1[i] + col1dv.minDiff / 2, col1vals); - i2 = Lib.findBin(col2[i] + col2dv.minDiff / 2, col2vals); +var MID_SHIFT = _dereq_('../../constants/alignment').MID_SHIFT; +var LINE_SPACING = _dereq_('../../constants/alignment').LINE_SPACING; - for(j = 0; j < arrayVarNames.length; j++) { - arrayVarName = arrayVarNames[j]; - arrayVar = trace[arrayVarName]; - newArray = newArrays[j]; - newArray[i2][i1] = arrayVar[i]; - } +var axes = module.exports = {}; - if(hasColumnText) text[i2][i1] = textCol[i]; - } - } +axes.setConvert = _dereq_('./set_convert'); +var autoType = _dereq_('./axis_autotype'); - trace['_' + var1Name] = col1vals; - trace['_' + var2Name] = col2vals; - for(j = 0; j < arrayVarNames.length; j++) { - trace['_' + arrayVarNames[j]] = newArrays[j]; - } - if(hasColumnText) trace._text = text; -}; +var axisIds = _dereq_('./axis_ids'); +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; -},{"../../constants/numerical":673,"../../lib":696}],950:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +var autorange = _dereq_('./autorange'); +axes.getAutoRange = autorange.getAutoRange; +axes.findExtremes = autorange.findExtremes; +/* + * find the list of possible axes to reference with an xref or yref attribute + * and coerce it to that list + * + * attr: the attribute we're generating a reference for. Should end in 'x' or 'y' + * but can be prefixed, like 'ax' for annotation's arrow x + * dflt: the default to coerce to, or blank to use the first axis (falling back on + * extraOption if there is no axis) + * extraOption: aside from existing axes with this letter, what non-axis value is allowed? + * Only required if it's different from `dflt` + */ +axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption) { + var axLetter = attr.charAt(attr.length - 1); + var axlist = gd._fullLayout._subplots[axLetter + 'axis']; + var refAttr = attr + 'ref'; + var attrDef = {}; -'use strict'; + if(!dflt) dflt = axlist[0] || extraOption; + if(!extraOption) extraOption = dflt; -var Lib = _dereq_('../../lib'); + // data-ref annotations are not supported in gl2d yet -var handleXYZDefaults = _dereq_('./xyz_defaults'); -var handleStyleDefaults = _dereq_('./style_defaults'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); + attrDef[refAttr] = { + valType: 'enumerated', + values: axlist.concat(extraOption ? [extraOption] : []), + dflt: dflt + }; + // xref, yref + return Lib.coerce(containerIn, containerOut, attrDef, refAttr); +}; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } +/* + * coerce position attributes (range-type) that can be either on axes or absolute + * (paper or pixel) referenced. The biggest complication here is that we don't know + * before looking at the axis whether the value must be a number or not (it may be + * a date string), so we can't use the regular valType='number' machinery + * + * axRef (string): the axis this position is referenced to, or: + * paper: fraction of the plot area + * pixel: pixels relative to some starting position + * attr (string): the attribute in containerOut we are coercing + * dflt (number): the default position, as a fraction or pixels. If the attribute + * is to be axis-referenced, this will be converted to an axis data value + * + * Also cleans the values, since the attribute definition itself has to say + * valType: 'any' to handle date axes. This allows us to accept: + * - for category axes: category names, and convert them here into serial numbers. + * Note that this will NOT work for axis range endpoints, because we don't know + * the category list yet (it's set by ax.makeCalcdata during calc) + * but it works for component (note, shape, images) positions. + * - for date axes: JS Dates or milliseconds, and convert to date strings + * - for other types: coerce them to numbers + */ +axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { + var cleanPos, pos; - var validData = handleXYZDefaults(traceIn, traceOut, coerce, layout); - if(!validData) { - traceOut.visible = false; - return; + if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; + pos = coerce(attr, dflt); + } else { + var ax = axes.getFromId(gd, axRef); + dflt = ax.fraction2r(dflt); + pos = coerce(attr, dflt); + cleanPos = ax.cleanPos; } - coerce('text'); - - handleStyleDefaults(traceIn, traceOut, coerce, layout); - - coerce('connectgaps', Lib.isArray1D(traceOut.z) && (traceOut.zsmooth !== false)); - - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); + containerOut[attr] = cleanPos(pos); }; -},{"../../components/colorscale/defaults":580,"../../lib":696,"./attributes":945,"./style_defaults":959,"./xyz_defaults":960}],951:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var maxRowLength = _dereq_('./max_row_length'); - -/* Return a list of empty points in 2D array z - * each empty point z[i][j] gives an array [i, j, neighborCount] - * neighborCount is the count of 4 nearest neighbors that DO exist - * this is to give us an order of points to evaluate for interpolation. - * if no neighbors exist, we iteratively look for neighbors that HAVE - * neighbors, and add a fractional neighborCount - */ -module.exports = function findEmpties(z) { - var empties = [], - neighborHash = {}, - noNeighborList = [], - nextRow = z[0], - row = [], - blank = [0, 0, 0], - rowLength = maxRowLength(z), - prevRow, - i, - j, - thisPt, - p, - neighborCount, - newNeighborHash, - foundNewNeighbors; +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; - for(i = 0; i < z.length; i++) { - prevRow = row; - row = nextRow; - nextRow = z[i + 1] || []; - for(j = 0; j < rowLength; j++) { - if(row[j] === undefined) { - neighborCount = (row[j - 1] !== undefined ? 1 : 0) + - (row[j + 1] !== undefined ? 1 : 0) + - (prevRow[j] !== undefined ? 1 : 0) + - (nextRow[j] !== undefined ? 1 : 0); + return cleanPos(pos); +}; - if(neighborCount) { - // for this purpose, don't count off-the-edge points - // as undefined neighbors - if(i === 0) neighborCount++; - if(j === 0) neighborCount++; - if(i === z.length - 1) neighborCount++; - if(j === row.length - 1) neighborCount++; +axes.redrawComponents = function(gd, axIds) { + axIds = axIds ? axIds : axes.listIds(gd); - // if all neighbors that could exist do, we don't - // need this for finding farther neighbors - if(neighborCount < 4) { - neighborHash[[i, j]] = [i, j, neighborCount]; - } + var fullLayout = gd._fullLayout; - empties.push([i, j, neighborCount]); + 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(gd, ind); + stash[ind] = 1; + // once is enough for images (which doesn't use the `i` arg anyway) + if(shortCircuit) return; } - else noNeighborList.push([i, j]); } } } - while(noNeighborList.length) { - newNeighborHash = {}; - foundNewNeighbors = false; - - // look for cells that now have neighbors but didn't before - for(p = noNeighborList.length - 1; p >= 0; p--) { - thisPt = noNeighborList[p]; - i = thisPt[0]; - j = thisPt[1]; + // annotations and shapes 'draw' method is slow, + // use the finer-grained 'drawOne' method instead + _redrawOneComp('annotations', 'drawOne', '_annIndices'); + _redrawOneComp('shapes', 'drawOne', '_shapeIndices'); + _redrawOneComp('images', 'draw', '_imgIndices', true); +}; - 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; +var getDataConversions = axes.getDataConversions = function(gd, trace, target, targetArray) { + var ax; - if(neighborCount) { - newNeighborHash[thisPt] = [i, j, neighborCount]; - noNeighborList.splice(p, 1); - foundNewNeighbors = true; - } - } + // If target points to an axis, use the type we already have for that + // axis to find the data type. Otherwise use the values to autotype. + var d2cTarget = (target === 'x' || target === 'y' || target === 'z') ? + target : + targetArray; - if(!foundNewNeighbors) { - throw 'findEmpties iterated with no new neighbors'; - } + // In the case of an array target, make a mock data array + // and call supplyDefaults to the data type and + // setup the data-to-calc method. + if(Array.isArray(d2cTarget)) { + ax = { + type: autoType(targetArray), + _categories: [] + }; + axes.setConvert(ax); - // put these new cells into the main neighbor list - for(thisPt in newNeighborHash) { - neighborHash[thisPt] = newNeighborHash[thisPt]; - empties.push(newNeighborHash[thisPt]); + // build up ax._categories (usually done during ax.makeCalcdata() + if(ax.type === 'category') { + for(var i = 0; i < targetArray.length; i++) { + ax.d2c(targetArray[i]); + } } + // TODO what to do for transforms? + } else { + ax = axes.getFromTrace(gd, trace, d2cTarget); } - // sort the full list in descending order of neighbor count - return empties.sort(function(a, b) { return b[2] - a[2]; }); -}; + // if 'target' has corresponding axis + // -> use setConvert method + if(ax) return {d2c: ax.d2c, c2d: ax.c2d}; -},{"./max_row_length":956}],952:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // special case for 'ids' + // -> cast to String + if(d2cTarget === 'ids') return {d2c: toString, c2d: toString}; + // otherwise (e.g. numeric-array of 'marker.color' or 'marker.size') + // -> cast to Number -'use strict'; + return {d2c: toNum, c2d: toNum}; +}; -var Fx = _dereq_('../../components/fx'); -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); +function toNum(v) { return +v; } +function toString(v) { return String(v); } -module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer, contour) { - var cd0 = pointData.cd[0]; - var trace = cd0.trace; - var xa = pointData.xa; - var ya = pointData.ya; - var x = cd0.x; - var y = cd0.y; - var z = cd0.z; - var xc = cd0.xCenter; - var yc = cd0.yCenter; - var zmask = cd0.zmask; - var range = [trace.zmin, trace.zmax]; - var zhoverformat = trace.zhoverformat; - var x2 = x; - var y2 = y; +axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { + return getDataConversions(gd, trace, target, targetArray).d2c; +}; - var xl, yl, nx, ny; +// get counteraxis letter for this axis (name or id) +// this can also be used as the id for default counter axis +axes.counterLetter = function(id) { + var axLetter = id.charAt(0); + if(axLetter === 'x') return 'y'; + if(axLetter === 'y') return 'x'; +}; - 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; - } +// incorporate a new minimum difference and first tick into +// forced +// note that _forceTick0 is linearized, so needs to be turned into +// a range value for setting tick0 +axes.minDtick = function(ax, newDiff, newFirst, allow) { + // doesn't make sense to do forced min dTick on log or category axes, + // and the plot itself may decide to cancel (ie non-grouped bars) + if(['log', 'category', 'multicategory'].indexOf(ax.type) !== -1 || !allow) { + ax._minDtick = 0; } - 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; + // undefined means there's nothing there yet + else if(ax._minDtick === undefined) { + ax._minDtick = newDiff; + ax._forceTick0 = newFirst; } - else { - if(contour) { - 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]]); + else if(ax._minDtick) { + // existing minDtick is an integer multiple of newDiff + // (within rounding err) + // and forceTick0 can be shifted to newFirst + if((ax._minDtick / newDiff + 1e-6) % 1 < 2e-6 && + (((newFirst - ax._forceTick0) / newDiff % 1) + + 1.000001) % 1 < 2e-6) { + ax._minDtick = newDiff; + ax._forceTick0 = newFirst; } - 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 x0 = xa.c2p(x[nx]), - x1 = xa.c2p(x[nx + 1]), - y0 = ya.c2p(y[ny]), - y1 = ya.c2p(y[ny + 1]); - - if(contour) { - x1 = x0; - xl = x[nx]; - y1 = y0; - yl = y[ny]; - } - else { - xl = xc ? xc[nx] : ((x[nx] + x[nx + 1]) / 2); - yl = yc ? yc[ny] : ((y[ny] + y[ny + 1]) / 2); - if(trace.zsmooth) { - x0 = x1 = xa.c2p(xl); - y0 = y1 = ya.c2p(yl); + // 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 + else if((newDiff / ax._minDtick + 1e-6) % 1 > 2e-6 || + (((newFirst - ax._forceTick0) / ax._minDtick % 1) + + 1.000001) % 1 > 2e-6) { + ax._minDtick = 0; } } - - var zVal = z[ny][nx]; - if(zmask && !zmask[ny][nx]) zVal = undefined; - - var text; - if(Array.isArray(cd0.text) && Array.isArray(cd0.text[ny])) { - text = cd0.text[ny][nx]; - } - - var zLabel; - // dummy axis for formatting the z value - var dummyAx = { - type: 'linear', - range: range, - hoverformat: zhoverformat, - _separators: xa._separators, - _numFormat: xa._numFormat - }; - var zLabelObj = Axes.tickText(dummyAx, zVal, 'hover'); - zLabel = zLabelObj.text; - - return [Lib.extendFlat(pointData, { - index: [ny, nx], - // never let a 2D override 1D type as closest point - distance: pointData.maxHoverDistance, - spikeDistance: pointData.maxSpikeDistance, - x0: x0, - x1: x1, - y0: y0, - y1: y1, - xLabelVal: xl, - yLabelVal: yl, - zLabelVal: zVal, - zLabel: zLabel, - text: text - })]; -}; - -},{"../../components/fx":612,"../../lib":696,"../../plots/cartesian/axes":744}],953:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Heatmap = {}; - -Heatmap.attributes = _dereq_('./attributes'); -Heatmap.supplyDefaults = _dereq_('./defaults'); -Heatmap.calc = _dereq_('./calc'); -Heatmap.plot = _dereq_('./plot'); -Heatmap.colorbar = _dereq_('./colorbar'); -Heatmap.style = _dereq_('./style'); -Heatmap.hoverPoints = _dereq_('./hover'); - -Heatmap.moduleType = 'trace'; -Heatmap.name = 'heatmap'; -Heatmap.basePlotModule = _dereq_('../../plots/cartesian'); -Heatmap.categories = ['cartesian', 'svg', '2dMap']; -Heatmap.meta = { - }; -module.exports = Heatmap; - -},{"../../plots/cartesian":756,"./attributes":945,"./calc":946,"./colorbar":948,"./defaults":950,"./hover":952,"./plot":957,"./style":958}],954:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); - -var INTERPTHRESHOLD = 1e-2; -var NEIGHBORSHIFTS = [[-1, 0], [1, 0], [0, -1], [0, 1]]; - -function correctionOvershoot(maxFractionalChange) { - // start with less overshoot, until we know it's converging, - // then ramp up the overshoot for faster convergence - return 0.5 - 0.25 * Math.min(1, maxFractionalChange * 0.5); -} - -/* - * interp2d: Fill in missing data from a 2D array using an iterative - * poisson equation solver with zero-derivative BC at edges. - * Amazingly, this just amounts to repeatedly averaging all the existing - * nearest neighbors, at least if we don't take x/y scaling into account, - * which is the right approach here where x and y may not even have the - * same units. - * - * @param {array of arrays} z - * The 2D array to fill in. Will be mutated here. Assumed to already be - * cleaned, so all entries are numbers except gaps, which are `undefined`. - * @param {array of arrays} emptyPoints - * Each entry [i, j, neighborCount] for empty points z[i][j] and the number - * of neighbors that are *not* missing. Assumed to be sorted from most to - * least neighbors, as produced by heatmap/find_empties. - */ -module.exports = function interp2d(z, emptyPoints) { - var maxFractionalChange = 1; - var i; - - // one pass to fill in a starting value for all the empties - iterateInterp2d(z, emptyPoints); +// save a copy of the initial axis ranges in fullLayout +// use them in mode bar and dblclick events +axes.saveRangeInitial = function(gd, overwrite) { + var axList = axes.list(gd, '', true); + var hasOneAxisChanged = false; - // we're don't need to iterate lone empties - remove them - for(i = 0; i < emptyPoints.length; i++) { - if(emptyPoints[i][2] < 4) break; - } - // but don't remove these points from the original array, - // we'll use them for masking, so make a copy. - 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, - thisPt, - i, - j, - p, - q, - neighborShift, - neighborRow, - neighborVal, - neighborCount, - neighborSum, - initialVal, - minNeighbor, - 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 !== undefined) { - if(neighborSum === 0) { - minNeighbor = maxNeighbor = neighborVal; - } - else { - minNeighbor = Math.min(minNeighbor, neighborVal); - maxNeighbor = Math.max(maxNeighbor, neighborVal); - } - neighborCount++; - neighborSum += neighborVal; - } - } + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + var isNew = (ax._rangeInitial === undefined); + var hasChanged = isNew || !( + ax.range[0] === ax._rangeInitial[0] && + ax.range[1] === ax._rangeInitial[1] + ); - if(neighborCount === 0) { - throw 'iterateInterp2d order is wrong: no defined neighbors'; + if((isNew && ax.autorange === false) || (overwrite && hasChanged)) { + ax._rangeInitial = ax.range.slice(); + hasOneAxisChanged = true; } + } + + return hasOneAxisChanged; +}; - // this is the laplace equation interpolation: - // each point is just the average of its neighbors - // note that this ignores differential x/y scaling - // which I think is the right approach, since we - // don't know what that scaling means - z[i][j] = neighborSum / neighborCount; +// save a copy of the initial spike visibility +axes.saveShowSpikeInitial = function(gd, overwrite) { + var axList = axes.list(gd, '', true); + var hasOneAxisChanged = false; + var allSpikesEnabled = 'on'; + + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + var isNew = (ax._showSpikeInitial === undefined); + var hasChanged = isNew || !(ax.showspikes === ax._showspikes); - if(initialVal === undefined) { - if(neighborCount < 4) maxFractionalChange = 1; + if(isNew || (overwrite && hasChanged)) { + ax._showSpikeInitial = ax.showspikes; + hasOneAxisChanged = true; } - else { - // we can make large empty regions converge faster - // if we overshoot the change vs the previous value - 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)); - } + if(allSpikesEnabled === 'on' && !ax.showspikes) { + allSpikesEnabled = 'off'; } } + gd._fullLayout._cartesianSpikesEnabled = allSpikesEnabled; + return hasOneAxisChanged; +}; - return maxFractionalChange; -} - -},{"../../lib":696}],955:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Registry = _dereq_('../../registry'); -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; +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); -module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { - var arrayOut = [], - isContour = Registry.traceIs(trace, 'contour'), - isHist = Registry.traceIs(trace, 'histogram'), - isGL2D = Registry.traceIs(trace, 'gl2d'), - v0, - dv, - i; - - var isArrayOfTwoItemsOrMore = isArrayOrTypedArray(arrayIn) && arrayIn.length > 1; - - if(isArrayOfTwoItemsOrMore && !isHist && (ax.type !== 'category')) { - var len = arrayIn.length; - - // given vals are brick centers - // hopefully length === numbricks, but use this method even if too few are supplied - // and extend it linearly based on the last two points - if(len <= numbricks) { - // contour plots only want the centers - if(isContour || isGL2D) arrayOut = arrayIn.slice(0, numbricks); - else if(numbricks === 1) { - arrayOut = [arrayIn[0] - 0.5, arrayIn[0] + 0.5]; - } - else { - arrayOut = [1.5 * arrayIn[0] - 0.5 * arrayIn[1]]; + 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, + }; + } - for(i = 1; i < len; i++) { - arrayOut.push((arrayIn[i - 1] + arrayIn[i]) * 0.5); - } + if(!calendar) calendar = ax.calendar; - arrayOut.push(1.5 * arrayIn[len - 1] - 0.5 * arrayIn[len - 2]); - } + // piggyback off tick code to make "nice" bin sizes and edges + 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: calendar + }; + } + axes.setConvert(dummyAx); - if(len < numbricks) { - var lastPt = arrayOut[arrayOut.length - 1], - delta = lastPt - arrayOut[arrayOut.length - 2]; + size = size && cleanTicks.dtick(size, dummyAx.type); - for(i = len; i < numbricks; i++) { - lastPt += delta; - arrayOut.push(lastPt); - } - } - } - else { - // hopefully length === numbricks+1, but do something regardless: - // given vals are brick boundaries - return isContour ? - arrayIn.slice(0, numbricks) : // we must be strict for contours - arrayIn.slice(0, numbricks + 1); - } + if(size) { + dummyAx.dtick = size; + dummyAx.tick0 = cleanTicks.tick0(undefined, dummyAx.type, calendar); } else { - dv = dvIn || 1; - - var calendar = trace[ax._id.charAt(0) + 'calendar']; - - if(isHist || ax.type === 'category') v0 = ax.r2c(v0In, 0, calendar) || 0; - else if(isArrayOrTypedArray(arrayIn) && arrayIn.length === 1) v0 = arrayIn[0]; - else if(v0In === undefined) v0 = 0; - else v0 = ax.d2c(v0In, 0, calendar); + var size0; + if(nbins) size0 = ((dataMax - dataMin) / nbins); + else { + // totally auto: scale off std deviation so the highest bin is + // somewhat taller than the total number of bins, but don't let + // the size get smaller than the 'nice' rounded down minimum + // difference between values + 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)); - for(i = (isContour || isGL2D) ? 0 : -0.5; i < numbricks; i++) { - arrayOut.push(v0 + dv * i); + // fallback if ax.d2c output BADNUMs + // e.g. when user try to plot categorical bins + // on a layout.xaxis.type: 'linear' + if(!isNumeric(size0)) size0 = 1; } - } - return arrayOut; -}; + axes.autoTicks(dummyAx, size0); + } -},{"../../lib":696,"../../registry":827}],956:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var finalSize = dummyAx.dtick; + var binStart = axes.tickIncrement( + axes.tickFirst(dummyAx), finalSize, 'reverse', calendar); + var binEnd, bincount; -'use strict'; + // check for too many data points right at the edges of bins + // (>50% within 1% of bin edges) or all data points integral + // and offset the bins accordingly + if(typeof finalSize === 'number') { + binStart = autoShiftNumericBins(binStart, data, dummyAx, dataMin, dataMax); -module.exports = function maxRowLength(z) { - var len = 0; + bincount = 1 + Math.floor((dataMax - binStart) / finalSize); + binEnd = binStart + bincount * finalSize; + } + else { + // month ticks - should be the only nonlinear kind we have at this point. + // dtick (as supplied by axes.autoTick) only has nonlinear values on + // date and log axes, but even if you display a histogram on a log axis + // we bin it on a linear axis (which one could argue against, but that's + // a separate issue) + if(dummyAx.dtick.charAt(0) === 'M') { + binStart = autoShiftMonthBins(binStart, data, finalSize, dataMin, calendar); + } - for(var i = 0; i < z.length; i++) { - len = Math.max(len, z[i].length); + // calculate the endpoint for nonlinear ticks - you have to + // just increment until you're done + binEnd = binStart; + bincount = 0; + while(binEnd <= dataMax) { + binEnd = axes.tickIncrement(binEnd, finalSize, false, calendar); + bincount++; + } } - return len; + return { + start: ax.c2r(binStart, 0, calendar), + end: ax.c2r(binEnd, 0, calendar), + size: finalSize, + _dataSpan: dataMax - dataMin + }; }; -},{}],957:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Colorscale = _dereq_('../../components/colorscale'); -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); +function autoShiftNumericBins(binStart, data, ax, dataMin, dataMax) { + var edgecount = 0; + var midcount = 0; + var intcount = 0; + var blankCount = 0; -var maxRowLength = _dereq_('./max_row_length'); + function nearEdge(v) { + // is a value within 1% of a bin edge? + return (1 + (v - binStart) * 100 / ax.dtick) % 100 < 2; + } -module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + for(var i = 0; i < data.length; i++) { + if(data[i] % 1 === 0) intcount++; + else if(!isNumeric(data[i])) blankCount++; - Lib.makeTraceGroups(heatmapLayer, cdheatmaps, 'hm').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var trace = cd0.trace; + if(nearEdge(data[i])) edgecount++; + if(nearEdge(data[i] + ax.dtick / 2)) midcount++; + } + var dataCount = data.length - blankCount; - var z = cd0.z; - var x = cd0.x; - var y = cd0.y; - var xc = cd0.xCenter; - var yc = cd0.yCenter; - var isContour = Registry.traceIs(trace, 'contour'); - var zsmooth = isContour ? 'best' : trace.zsmooth; - - // get z dims - var m = z.length; - var n = maxRowLength(z); - var xrev = false; - var yrev = false; - - var left, right, temp, top, bottom, i; - - // TODO: if there are multiple overlapping categorical heatmaps, - // or if we allow category sorting, then the categories may not be - // sequential... may need to reorder and/or expand z - - // Get edges of png in pixels (xa.c2p() maps axes coordinates to pixel coordinates) - // figure out if either axis is reversed (y is usually reversed, in pixel coords) - // also clip the image to maximum 50% outside the visible plot area - // bigger image lets you pan more naturally, but slows performance. - // TODO: use low-resolution images outside the visible plot for panning - // these while loops find the first and last brick bounds that are defined - // (in case of log of a negative) - i = 0; - while(left === undefined && i < x.length - 1) { - left = xa.c2p(x[i]); - i++; + if(intcount === dataCount && ax.type !== 'date') { + // all integers: if bin size is <1, it's because + // that was specifically requested (large nbins) + // so respect that... but center the bins containing + // integers on those integers + if(ax.dtick < 1) { + binStart = dataMin - 0.5 * ax.dtick; } - i = x.length - 1; - while(right === undefined && i > 0) { - right = xa.c2p(x[i]); - i--; + // otherwise start half an integer down regardless of + // the bin size, just enough to clear up endpoint + // ambiguity about which integers are in which bins. + else { + binStart -= 0.5; + if(binStart + ax.dtick < dataMin) binStart += ax.dtick; } - - if(right < left) { - temp = right; - right = left; - left = temp; - xrev = true; + } + else if(midcount < dataCount * 0.1) { + if(edgecount > dataCount * 0.3 || + nearEdge(dataMin) || nearEdge(dataMax)) { + // lots of points at the edge, not many in the middle + // shift half a bin + var binshift = ax.dtick / 2; + binStart += (binStart + binshift < dataMin) ? binshift : -binshift; } + } + return binStart; +} - i = 0; - while(top === undefined && i < y.length - 1) { - top = ya.c2p(y[i]); - i++; - } - i = y.length - 1; - while(bottom === undefined && i > 0) { - bottom = ya.c2p(y[i]); - i--; - } - if(bottom < top) { - temp = top; - top = bottom; - bottom = temp; - yrev = true; - } - - // for contours with heatmap fill, we generate the boundaries based on - // brick centers but then use the brick edges for drawing the bricks - if(isContour) { - xc = x; - yc = y; - x = cd0.xfill; - y = cd0.yfill; - } - - // make an image that goes at most half a screen off either side, to keep - // time reasonable when you zoom in. if zsmooth is true/fast, don't worry - // about this, because zooming doesn't increase number of pixels - // if zsmooth is best, don't include anything off screen because it takes too long - if(zsmooth !== 'fast') { - var extra = zsmooth === 'best' ? 0 : 0.5; - left = Math.max(-extra * xa._length, left); - right = Math.min((1 + extra) * xa._length, right); - top = Math.max(-extra * ya._length, top); - bottom = Math.min((1 + extra) * ya._length, bottom); - } - - var imageWidth = Math.round(right - left), - imageHeight = Math.round(bottom - top); - - // setup image nodes - - // if image is entirely off-screen, don't even draw it - var isOffScreen = (imageWidth <= 0 || imageHeight <= 0); - - if(isOffScreen) { - var noImage = plotGroup.selectAll('image').data([]); - noImage.exit().remove(); - return; - } +function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { + var stats = Lib.findExactDates(data, calendar); + // number of data points that needs to be an exact value + // to shift that increment to (near) the bin center + var threshold = 0.8; - // generate image data + if(stats.exactDays > threshold) { + var numMonths = Number(dtick.substr(1)); - var canvasW, canvasH; - if(zsmooth === 'fast') { - canvasW = n; - canvasH = m; - } else { - canvasW = imageWidth; - canvasH = imageHeight; + if((stats.exactYears > threshold) && (numMonths % 12 === 0)) { + // The exact middle of a non-leap-year is 1.5 days into July + // so if we start the bins here, all but leap years will + // get hover-labeled as exact years. + binStart = axes.tickIncrement(binStart, 'M6', 'reverse') + ONEDAY * 1.5; } - - var canvas = document.createElement('canvas'); - canvas.width = canvasW; - canvas.height = canvasH; - var context = canvas.getContext('2d'); - - var sclFunc = Colorscale.makeColorScaleFunc( - Colorscale.extractScale( - trace.colorscale, - trace.zmin, - trace.zmax - ), - { noNumericCheck: true, returnArray: true } - ); - - // map brick boundaries to image pixels - var xpx, - ypx; - if(zsmooth === 'fast') { - xpx = xrev ? - function(index) { return n - 1 - index; } : - Lib.identity; - ypx = yrev ? - function(index) { return m - 1 - index; } : - Lib.identity; + else if(stats.exactMonths > threshold) { + // Months are not as clean, but if we shift half the *longest* + // month (31/2 days) then 31-day months will get labeled exactly + // and shorter months will get labeled with the correct month + // but shifted 12-36 hours into it. + binStart = axes.tickIncrement(binStart, 'M1', 'reverse') + ONEDAY * 15.5; } else { - xpx = function(index) { - return Lib.constrain(Math.round(xa.c2p(x[index]) - left), - 0, imageWidth); - }; - ypx = function(index) { - return Lib.constrain(Math.round(ya.c2p(y[index]) - top), - 0, imageHeight); - }; + // Shifting half a day is exact, but since these are month bins it + // will always give a somewhat odd-looking label, until we do something + // smarter like showing the bin boundaries (or the bounds of the actual + // data in each bin) + binStart -= ONEDAY / 2; } + var nextBinStart = axes.tickIncrement(binStart, dtick); - // build the pixel map brick-by-brick - // cruise through z-matrix row-by-row - // build a brick at each z-matrix value - var yi = ypx(0); - var yb = [yi, yi]; - var xbi = xrev ? 0 : 1; - var ybi = yrev ? 0 : 1; - // for collecting an average luminosity of the heatmap - var pixcount = 0; - var rcount = 0; - var gcount = 0; - var bcount = 0; - - var xb, j, xi, v, row, c; - - function setColor(v, pixsize) { - if(v !== undefined) { - var c = sclFunc(v); - c[0] = Math.round(c[0]); - c[1] = Math.round(c[1]); - c[2] = Math.round(c[2]); - - pixcount += pixsize; - rcount += c[0] * pixsize; - gcount += c[1] * pixsize; - bcount += c[2] * pixsize; - return c; - } - return [0, 0, 0, 0]; - } - - function interpColor(r0, r1, xinterp, yinterp) { - var z00 = r0[xinterp.bin0]; - if(z00 === undefined) return setColor(undefined, 1); - - var z01 = r0[xinterp.bin1], - z10 = r1[xinterp.bin0], - z11 = r1[xinterp.bin1], - dx = (z01 - z00) || 0, - dy = (z10 - z00) || 0, - dxy; - - // the bilinear interpolation term needs different calculations - // for all the different permutations of missing data - // among the neighbors of the main point, to ensure - // continuity across brick boundaries. - if(z01 === undefined) { - if(z11 === undefined) dxy = 0; - else if(z10 === undefined) dxy = 2 * (z11 - z00); - else dxy = (2 * z11 - z10 - z00) * 2 / 3; - } - else if(z11 === undefined) { - if(z10 === undefined) dxy = 0; - else dxy = (2 * z00 - z01 - z10) * 2 / 3; - } - else if(z10 === undefined) dxy = (2 * z11 - z01 - z00) * 2 / 3; - else dxy = (z11 + z00 - z01 - z10); - - return setColor(z00 + xinterp.frac * dx + yinterp.frac * (dy + xinterp.frac * dxy)); - } - - if(zsmooth) { // best or fast, works fastest with imageData - var pxIndex = 0, - pixels; - - try { - pixels = new Uint8Array(imageWidth * imageHeight * 4); - } - catch(e) { - pixels = new Array(imageWidth * imageHeight * 4); - } + if(nextBinStart <= dataMin) return nextBinStart; + } + return binStart; +} - if(zsmooth === 'best') { - var xForPx = xc || x; - var yForPx = yc || y; - var xPixArray = new Array(xForPx.length); - var yPixArray = new Array(yForPx.length); - var xinterpArray = new Array(imageWidth); - var findInterpX = xc ? findInterpFromCenters : findInterp; - var findInterpY = yc ? findInterpFromCenters : findInterp; - var yinterp, r0, r1; - - // first make arrays of x and y pixel locations of brick boundaries - for(i = 0; i < xForPx.length; i++) xPixArray[i] = Math.round(xa.c2p(xForPx[i]) - left); - for(i = 0; i < yForPx.length; i++) yPixArray[i] = Math.round(ya.c2p(yForPx[i]) - top); - - // then make arrays of interpolations - // (bin0=closest, bin1=next, frac=fractional dist.) - for(i = 0; i < imageWidth; i++) xinterpArray[i] = findInterpX(i, xPixArray); - - // now do the interpolations and fill the png - for(j = 0; j < imageHeight; j++) { - yinterp = findInterpY(j, yPixArray); - r0 = z[yinterp.bin0]; - r1 = z[yinterp.bin1]; - for(i = 0; i < imageWidth; i++, pxIndex += 4) { - c = interpColor(r0, r1, xinterpArray[i], yinterp); - putColor(pixels, pxIndex, c); - } - } - } - else { // zsmooth = fast - for(j = 0; j < m; j++) { - row = z[j]; - yb = ypx(j); - for(i = 0; i < imageWidth; i++) { - c = setColor(row[i], 1); - pxIndex = (yb * imageWidth + xpx(i)) * 4; - putColor(pixels, pxIndex, c); - } - } - } +// ---------------------------------------------------- +// Ticks and grids +// ---------------------------------------------------- - var imageData = context.createImageData(imageWidth, imageHeight); - try { - imageData.data.set(pixels); - } - catch(e) { - var pxArray = imageData.data, - dlen = pxArray.length; - for(j = 0; j < dlen; j ++) { - pxArray[j] = pixels[j]; - } - } +// ensure we have tick0, dtick, and tick rounding calculated +axes.prepTicks = function(ax) { + var rng = Lib.simpleMap(ax.range, ax.r2l); - context.putImageData(imageData, 0, 0); - } else { // zsmooth = false -> filling potentially large bricks works fastest with fillRect - - // gaps do not need to be exact integers, but if they *are* we will get - // cleaner edges by rounding at least one edge - var xGap = trace.xgap; - var yGap = trace.ygap; - 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] === undefined || yb[1] === undefined) { - continue; - } - xi = xpx(0); - xb = [xi, xi]; - for(i = 0; i < n; i++) { - // build one color brick! - xb.reverse(); - xb[xbi] = xpx(i + 1); - if(xb[0] === xb[1] || xb[0] === undefined || xb[1] === undefined) { - continue; - } - v = row[i]; - c = setColor(v, (xb[1] - xb[0]) * (yb[1] - yb[0])); - context.fillStyle = 'rgba(' + c.join(',') + ')'; + // calculate max number of (auto) ticks to display based on plot size + if(ax.tickmode === 'auto' || !ax.dtick) { + var nt = ax.nticks; + var minPx; - context.fillRect(xb[0] + xGapLeft, yb[0] + yGapTop, - xb[1] - xb[0] - xGap, yb[1] - yb[0] - yGap); - } + if(!nt) { + if(ax.type === 'category' || ax.type === 'multicategory') { + minPx = ax.tickfont ? (ax.tickfont.size || 12) * 1.2 : 15; + nt = ax._length / minPx; + } else { + minPx = ax._id.charAt(0) === 'y' ? 40 : 80; + nt = Lib.constrain(ax._length / minPx, 4, 9) + 1; } + + // radial axes span half their domain, + // multiply nticks value by two to get correct number of auto ticks. + if(ax._name === 'radialaxis') nt *= 2; } - rcount = Math.round(rcount / pixcount); - gcount = Math.round(gcount / pixcount); - bcount = Math.round(bcount / pixcount); - var avgColor = tinycolor('rgb(' + rcount + ',' + gcount + ',' + bcount + ')'); + // add a couple of extra digits for filling in ticks when we + // have explicit tickvals without tick text + if(ax.tickmode === 'array') nt *= 100; - gd._hmpixcount = (gd._hmpixcount||0) + pixcount; - gd._hmlumcount = (gd._hmlumcount||0) + pixcount * avgColor.getLuminance(); + axes.autoTicks(ax, Math.abs(rng[1] - rng[0]) / nt); + // check for a forced minimum dtick + if(ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { + ax.dtick = ax._minDtick; + ax.tick0 = ax.l2r(ax._forceTick0); + } + } - var image3 = plotGroup.selectAll('image') - .data(cd); + // check for missing tick0 + if(!ax.tick0) { + ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; + } - image3.enter().append('svg:image').attr({ - xmlns: xmlnsNamespaces.svg, - preserveAspectRatio: 'none' - }); + // ensure we don't try to make ticks below our minimum precision + // see https://github.com/plotly/plotly.js/issues/2892 + if(ax.type === 'date' && ax.dtick < 0.1) ax.dtick = 0.1; - image3.attr({ - height: imageHeight, - width: imageWidth, - x: left, - y: top, - 'xlink:href': canvas.toDataURL('image/png') - }); - }); + // now figure out rounding of tick values + autoTickRound(ax); }; -// get interpolated bin value. Returns {bin0:closest bin, frac:fractional dist to next, bin1:next bin} -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); +// calculate the ticks: text, values, positioning +// if ticks are set to automatic, determine the right values (tick0,dtick) +// in any case, set tickround to # of digits to round tick labels to, +// or codes to this effect for log and date scales +axes.calcTicks = function calcTicks(ax) { + axes.prepTicks(ax); + var rng = Lib.simpleMap(ax.range, ax.r2l); - if(!interp || interp === maxBin || !frac) { - return { - bin0: bin0, - bin1: bin0, - frac: 0 - }; - } - return { - bin0: bin0, - frac: frac, - bin1: Math.round(bin0 + frac / (interp - bin0)) - }; -} + // now that we've figured out the auto values for formatting + // in case we're missing some ticktext, we can break out for array ticks + if(ax.tickmode === 'array') return arrayTicks(ax); -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 - }; + // find the first tick + ax._tmin = axes.tickFirst(ax); + + // add a tiny bit so we get ticks which may have rounded out + var startTick = rng[0] * 1.0001 - rng[1] * 0.0001; + var endTick = rng[1] * 1.0001 - rng[0] * 0.0001; + // check for reversed axis + var axrev = (rng[1] < rng[0]); + + // No visible ticks? Quit. + // I've only seen this on category axes with all categories off the edge. + if((ax._tmin < startTick) !== axrev) return []; + + // return the full set of tick vals + var vals = []; + if(ax.type === 'category' || ax.type === 'multicategory') { + endTick = (axrev) ? Math.max(-0.5, endTick) : + Math.min(ax._categories.length - 0.5, endTick); } - if(frac < 0.5) { - return { - bin0: bin, - bin1: bin + 1, - frac: frac - }; + + var xPrevious = null; + var maxTicks = Math.max(1000, ax._length || 0); + for(var x = ax._tmin; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(vals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + vals.push(x); } - 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); -} + // If same angle over a full circle, the last tick vals is a duplicate. + // TODO must do something similar for angular date axes. + if(isAngular(ax) && Math.abs(rng[1] - rng[0]) === 360) { + vals.pop(); + } -},{"../../components/colorscale":585,"../../constants/xmlns_namespaces":674,"../../lib":696,"../../registry":827,"./max_row_length":956,"d3":148,"tinycolor2":514}],958:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // save the last tick as well as first, so we can + // show the exponent only on the last one + ax._tmax = vals[vals.length - 1]; + // for showing the rest of a date when the main tick label is only the + // latter part: ax._prevDateHead holds what we showed most recently. + // Start with it cleared and mark that we're in calcTicks (ie calculating a + // whole string of these so we should care what the previous date head was!) + ax._prevDateHead = ''; + ax._inCalcTicks = true; -'use strict'; + var ticksOut = new Array(vals.length); + for(var i = 0; i < vals.length; i++) ticksOut[i] = axes.tickText(ax, vals[i]); -var d3 = _dereq_('d3'); + ax._inCalcTicks = false; -module.exports = function style(gd) { - d3.select(gd).selectAll('.hm image') - .style('opacity', function(d) { - return d.trace.opacity; - }); + return ticksOut; }; -},{"d3":148}],959:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function arrayTicks(ax) { + var vals = ax.tickvals; + var text = ax.ticktext; + var ticksOut = new Array(vals.length); + var rng = Lib.simpleMap(ax.range, ax.r2l); + var r0expanded = rng[0] * 1.0001 - rng[1] * 0.0001; + var r1expanded = rng[1] * 1.0001 - rng[0] * 0.0001; + var tickMin = Math.min(r0expanded, r1expanded); + var tickMax = Math.max(r0expanded, r1expanded); + var j = 0; + // without a text array, just format the given values as any other ticks + // except with more precision to the numbers + if(!Array.isArray(text)) text = []; -'use strict'; + // make sure showing ticks doesn't accidentally add new categories + // TODO multicategory, if we allow ticktext / tickvals + var tickVal2l = ax.type === 'category' ? ax.d2l_noadd : ax.d2l; -module.exports = function handleStyleDefaults(traceIn, traceOut, coerce) { - var zsmooth = coerce('zsmooth'); - if(zsmooth === false) { - // ensure that xgap and ygap are coerced only when zsmooth allows them to have an effect. - coerce('xgap'); - coerce('ygap'); + // array ticks on log axes always show the full number + // (if no explicit ticktext overrides it) + 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); } - coerce('zhoverformat'); -}; + for(var i = 0; i < vals.length; i++) { + var vali = tickVal2l(vals[i]); + if(vali > tickMin && vali < tickMax) { + if(text[i] === undefined) ticksOut[j] = axes.tickText(ax, vali); + else ticksOut[j] = tickTextObj(ax, vali, String(text[i])); + j++; + } + } -},{}],960:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(j < vals.length) ticksOut.splice(j, vals.length - j); + return ticksOut; +} -'use strict'; +var roundBase10 = [2, 5, 10]; +var roundBase24 = [1, 2, 3, 6, 12]; +var roundBase60 = [1, 2, 5, 10, 15, 30]; +// 2&3 day ticks are weird, but need something btwn 1&7 +var roundDays = [1, 2, 3, 7, 14]; +// approx. tick positions for log axes, showing all (1) and just 1, 2, 5 (2) +// these don't have to be exact, just close enough to round to the right value +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]; +// N.B. `thetaunit; 'radians' angular axes must be converted to degrees +var roundAngles = [15, 30, 45, 90, 180]; -var isNumeric = _dereq_('fast-isnumeric'); -var Lib = _dereq_('../../lib'); +function roundDTick(roughDTick, base, roundingSet) { + return base * Lib.roundUp(roughDTick / base, roundingSet); +} -var Registry = _dereq_('../../registry'); +// autoTicks: calculate best guess at pleasant ticks for this axis +// inputs: +// ax - an axis object +// roughDTick - rough tick spacing (to be turned into a nice round number) +// outputs (into ax): +// tick0: starting point for ticks (not necessarily on the graph) +// usually 0 for numeric (=10^0=1 for log) or jan 1, 2000 for dates +// dtick: the actual, nice round tick spacing, usually a little larger than roughDTick +// if the ticks are spaced linearly (linear scale, categories, +// log with only full powers, date ticks < month), +// this will just be a number +// months: M# +// years: M# where # is 12*number of years +// log with linear ticks: L# where # is the linear tick spacing +// log showing powers plus some intermediates: +// D1 shows all digits, D2 shows 2 and 5 +axes.autoTicks = function(ax, roughDTick) { + 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); + // the criteria below are all based on the rough spacing we calculate + // being > half of the final unit - so precalculate twice the rough val + var roughX2 = 2 * roughDTick; -module.exports = function handleXYZDefaults(traceIn, traceOut, coerce, layout, xName, yName) { - var z = coerce('z'); - xName = xName || 'x'; - yName = yName || 'y'; - var x, y; - - if(z === undefined || !z.length) return 0; - - if(Lib.isArray1D(traceIn.z)) { - x = coerce(xName); - y = coerce(yName); + 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, roundDays); + // get week ticks on sunday + // this will also move the base tick off 2000-01-01 if dtick is + // 2 or 3 days... but that's a weird enough case that we'll ignore it. + ax.tick0 = Lib.dateTick0(ax.calendar, true); + } + 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 { + // milliseconds + 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); - // column z must be accompanied by xName and yName arrays - if(!(x && x.length && y && y.length)) return 0; + if(roughDTick > 0.7) { + // only show powers of 10 + ax.dtick = Math.ceil(roughDTick); + } + else if(Math.abs(rng[1] - rng[0]) < 1) { + // span is less than one power of 10 + var nt = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); - traceOut._length = Math.min(x.length, y.length, z.length); + // ticks on a linear scale, labeled fully + roughDTick = Math.abs(Math.pow(10, rng[1]) - + Math.pow(10, rng[0])) / nt; + base = getBase(10); + ax.dtick = 'L' + roundDTick(roughDTick, base, roundBase10); + } + else { + // include intermediates between powers of 10, + // labeled with small digits + // ax.dtick = "D2" (show 2 and 5) or "D1" (show all digits) + 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 { - x = coordDefaults(xName, coerce); - y = coordDefaults(yName, coerce); - - // TODO put z validation elsewhere - if(!isValidZ(z)) return 0; - - coerce('transpose'); - - traceOut._length = null; + // auto ticks always start at 0 + ax.tick0 = 0; + base = getBase(10); + ax.dtick = roundDTick(roughDTick, base, roundBase10); } - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, [xName, yName], layout); + // prevent infinite loops + if(ax.dtick === 0) ax.dtick = 1; - return true; + // TODO: this is from log axis histograms with autorange off + if(!isNumeric(ax.dtick) && typeof ax.dtick !== 'string') { + var olddtick = ax.dtick; + ax.dtick = 1; + throw 'ax.dtick error: ' + String(olddtick); + } }; -function coordDefaults(coordStr, coerce) { - var coord = coerce(coordStr), - coordType = coord ? - coerce(coordStr + 'type', 'array') : - 'scaled'; +// after dtick is already known, find tickround = precision +// to display in tick labels +// for numeric ticks, integer # digits after . to round to +// for date ticks, the last date part to show (y,m,d,H,M,S) +// or an integer # digits past seconds +function autoTickRound(ax) { + var dtick = ax.dtick; - if(coordType === 'scaled') { - coerce(coordStr + '0'); - coerce('d' + coordStr); + ax._tickexponent = 0; + if(!isNumeric(dtick) && typeof dtick !== 'string') { + dtick = 1; } - return coord; -} - -function isValidZ(z) { - var allRowsAreArrays = true, - oneRowIsFilled = false, - hasOneNumber = false, - zi; - - /* - * Without this step: - * - * hasOneNumber = false breaks contour but not heatmap - * allRowsAreArrays = false breaks contour but not heatmap - * oneRowIsFilled = false breaks both - */ + if(ax.type === 'category' || ax.type === 'multicategory') { + ax._tickround = null; + } + if(ax.type === 'date') { + // If tick0 is unusual, give tickround a bit more information + // not necessarily *all* the information in tick0 though, if it's really odd + // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 + // take off a leading minus (year < 0) and i (intercalary month) so length is consistent + var tick0ms = ax.r2l(ax.tick0); + var tick0str = ax.l2r(tick0ms).replace(/(^-|i)/g, ''); + var tick0len = tick0str.length; - for(var i = 0; i < z.length; i++) { - zi = z[i]; - if(!Lib.isArrayOrTypedArray(zi)) { - allRowsAreArrays = false; - break; + if(String(dtick).charAt(0) === 'M') { + // any tick0 more specific than a year: alway show the full date + if(tick0len > 10 || tick0str.substr(5) !== '01-01') ax._tickround = 'd'; + // show the month unless ticks are full multiples of a year + else ax._tickround = (+(dtick.substr(1)) % 12 === 0) ? 'y' : 'm'; } - if(zi.length > 0) oneRowIsFilled = true; - for(var j = 0; j < zi.length; j++) { - if(isNumeric(zi[j])) { - hasOneNumber = true; - break; - } + 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 { + // tickround is a number of digits of fractional seconds + // of any two adjacent ticks, at least one will have the maximum fractional digits + // of all possible ticks - so take the max. length of tick0 and the next one + var tick1len = ax.l2r(tick0ms + dtick).replace(/^-/, '').length; + ax._tickround = Math.max(tick0len, tick1len) - 20; + + // We shouldn't get here... but in case there's a situation I'm + // not thinking of where tick0str and tick1str are identical or + // something, fall back on maximum precision + if(ax._tickround < 0) ax._tickround = 4; } } + else if(isNumeric(dtick) || dtick.charAt(0) === 'L') { + // linear or log (except D1, D2) + var rng = ax.range.map(ax.r2d || Number); + if(!isNumeric(dtick)) dtick = Number(dtick.substr(1)); + // 2 digits past largest digit of dtick + ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); - return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); -} - -},{"../../lib":696,"../../registry":827,"fast-isnumeric":214}],961:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - - -var heatmapAttrs = _dereq_('../heatmap/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; - - -var commonList = [ - 'z', - 'x', 'x0', 'dx', - 'y', 'y0', 'dy', - 'text', 'transpose', - 'xtype', 'ytype' -]; - -var attrs = {}; + var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); -for(var i = 0; i < commonList.length; i++) { - var k = commonList[i]; - attrs[k] = heatmapAttrs[k]; + var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); + if(Math.abs(rangeexp) > 3) { + if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { + ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); + } + else ax._tickexponent = rangeexp; + } + } + // D1 or D2 (log) + else ax._tickround = null; } -extendFlat( - attrs, - colorscaleAttrs('', {cLetter: 'z', autoColorDflt: false}), - {colorbar: colorbarAttrs} -); - -module.exports = overrideAll(attrs, 'calc', 'nested'); - -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plot_api/edit_types":727,"../heatmap/attributes":945}],962:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var createHeatmap2D = _dereq_('gl-heatmap2d'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var str2RGBArray = _dereq_('../../lib/str2rgbarray'); - - -function Heatmap(scene, uid) { - this.scene = scene; - this.uid = uid; - this.type = 'heatmapgl'; - - this.name = ''; - this.hoverinfo = 'all'; - - this.xData = []; - this.yData = []; - this.zData = []; - this.textLabels = []; +// months and years don't have constant millisecond values +// (but a year is always 12 months so we only need months) +// log-scale ticks are also not consistently spaced, except +// for pure powers of 10 +// numeric ticks always have constant differences, other datetime ticks +// can all be calculated as constant number of milliseconds +axes.tickIncrement = function(x, dtick, axrev, calendar) { + var axSign = axrev ? -1 : 1; - this.idToIndex = []; - this.bounds = [0, 0, 0, 0]; + // includes linear, all dates smaller than month, and pure 10^n in log + if(isNumeric(dtick)) return x + axSign * dtick; - this.options = { - z: [], - x: [], - y: [], - shape: [0, 0], - colorLevels: [0], - colorValues: [0, 0, 0, 1] - }; + // everything else is a string, one character plus a number + var tType = dtick.charAt(0); + var dtSigned = axSign * Number(dtick.substr(1)); - this.heatmap = createHeatmap2D(scene.glplot, this.options); - this.heatmap._trace = this; -} + // Dates: months (or years - see Lib.incrementMonth) + if(tType === 'M') return Lib.incrementMonth(x, dtSigned, calendar); -var proto = Heatmap.prototype; + // Log scales: Linear, Digits + else if(tType === 'L') return Math.log(Math.pow(10, x) + dtSigned) / Math.LN10; -proto.handlePick = function(pickResult) { - var options = this.options, - shape = options.shape, - index = pickResult.pointId, - xIndex = index % shape[0], - yIndex = Math.floor(index / shape[0]), - zIndex = index; + // log10 of 2,5,10, or all digits (logs just have to be + // close enough to round) + else 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 { - trace: this, - dataCoord: pickResult.dataCoord, - traceCoord: [ - options.x[xIndex], - options.y[yIndex], - options.z[zIndex] - ], - textLabel: this.textLabels[index], - name: this.name, - pointIndex: [yIndex, xIndex], - hoverinfo: this.hoverinfo - }; + return Math.floor(x2) + + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; + } + else throw 'unrecognized dtick ' + String(dtick); }; -proto.update = function(fullTrace, calcTrace) { - var calcPt = calcTrace[0]; - - this.index = fullTrace.index; - this.name = fullTrace.name; - this.hoverinfo = fullTrace.hoverinfo; - - // convert z from 2D -> 1D - var z = calcPt.z; - this.options.z = [].concat.apply([], z); +// calculate the first tick on an axis +axes.tickFirst = function(ax) { + var r2l = ax.r2l || Number; + var rng = Lib.simpleMap(ax.range, r2l); + var axrev = rng[1] < rng[0]; + var sRound = axrev ? Math.floor : Math.ceil; + // add a tiny extra bit to make sure we get ticks + // that may have been rounded out + var r0 = rng[0] * 1.0001 - rng[1] * 0.0001; + var dtick = ax.dtick; + var tick0 = r2l(ax.tick0); - var rowLen = z[0].length, - colLen = z.length; - this.options.shape = [rowLen, colLen]; + if(isNumeric(dtick)) { + var tmin = sRound((r0 - tick0) / dtick) * dtick + tick0; - this.options.x = calcPt.x; - this.options.y = calcPt.y; + // make sure no ticks outside the category list + if(ax.type === 'category' || ax.type === 'multicategory') { + tmin = Lib.constrain(tmin, 0, ax._categories.length - 1); + } + return tmin; + } - var colorOptions = convertColorscale(fullTrace); - this.options.colorLevels = colorOptions.colorLevels; - this.options.colorValues = colorOptions.colorValues; + var tType = dtick.charAt(0); + var dtNum = Number(dtick.substr(1)); - // convert text from 2D -> 1D - this.textLabels = [].concat.apply([], fullTrace.text); + // Dates: months (or years) + if(tType === 'M') { + var cnt = 0; + var t0 = tick0; + var t1, mult, newDTick; - this.heatmap.update(this.options); + // This algorithm should work for *any* nonlinear (but close to linear!) + // tick spacing. Limit to 10 iterations, for gregorian months it's normally <=3. + while(cnt < 10) { + t1 = axes.tickIncrement(t0, dtick, axrev, ax.calendar); + if((t1 - r0) * (t0 - r0) <= 0) { + // t1 and t0 are on opposite sides of r0! we've succeeded! + if(axrev) return Math.min(t0, t1); + return Math.max(t0, t1); + } + mult = (r0 - ((t0 + t1) / 2)) / (t1 - t0); + newDTick = tType + ((Math.abs(Math.round(mult)) || 1) * dtNum); + t0 = axes.tickIncrement(t0, newDTick, mult < 0 ? !axrev : axrev, ax.calendar); + cnt++; + } + Lib.error('tickFirst did not converge', ax); + return t0; + } - var xa = this.scene.xaxis; - var ya = this.scene.yaxis; - fullTrace._extremes[xa._id] = Axes.findExtremes(xa, calcPt.x); - fullTrace._extremes[ya._id] = Axes.findExtremes(ya, calcPt.y); -}; + // Log scales: Linear, Digits + else if(tType === 'L') { + return Math.log(sRound( + (Math.pow(10, r0) - tick0) / dtNum) * dtNum + tick0) / Math.LN10; + } + else if(tType === 'D') { + var tickset = (dtick === 'D2') ? roundLog2 : roundLog1; + var frac = Lib.roundUp(Lib.mod(r0, 1), tickset, axrev); -proto.dispose = function() { - this.heatmap.dispose(); + return Math.floor(r0) + + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; + } + else throw 'unrecognized dtick ' + String(dtick); }; -function convertColorscale(fullTrace) { - var scl = fullTrace.colorscale, - zmin = fullTrace.zmin, - zmax = fullTrace.zmax; - - var N = scl.length, - domain = new Array(N), - range = new Array(4 * N); - - for(var i = 0; i < N; i++) { - var si = scl[i]; - var color = str2RGBArray(si[1]); +// draw the text for one tick. +// px,py are the location on gd.paper +// prefix is there so the x axis ticks can be dropped a line +// ax is the axis layout, x is the tick value +// hover is a (truthy) flag for whether to show numbers with a bit +// more precision for hovertext +axes.tickText = function(ax, x, hover) { + var out = tickTextObj(ax, x); + var arrayMode = ax.tickmode === 'array'; + var extraPrecision = hover || arrayMode; + var axType = ax.type; + // TODO multicategory, if we allow ticktext / tickvals + var tickVal2l = axType === 'category' ? ax.d2l_noadd : ax.d2l; + var i; - domain[i] = zmin + si[0] * (zmax - zmin); + if(arrayMode && Array.isArray(ax.ticktext)) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + var minDiff = Math.abs(rng[1] - rng[0]) / 10000; - for(var j = 0; j < 4; j++) { - range[(4 * i) + j] = color[j]; + 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]); + return out; } } - return { - colorLevels: domain, - colorValues: range - }; -} - -function createHeatmap(scene, fullTrace, calcTrace) { - var plot = new Heatmap(scene, fullTrace.uid); - plot.update(fullTrace, calcTrace); - return plot; -} + function isHidden(showAttr) { + if(showAttr === undefined) return true; + if(hover) return showAttr === 'none'; -module.exports = createHeatmap; + var firstOrLast = { + first: ax._tmin, + last: ax._tmax + }[showAttr]; -},{"../../lib/str2rgbarray":719,"../../plots/cartesian/axes":744,"gl-heatmap2d":241}],963:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return showAttr !== 'all' && x !== firstOrLast; + } + var hideexp = hover ? + 'never' : + ax.exponentformat !== 'none' && isHidden(ax.showexponent) ? 'hide' : ''; -'use strict'; + 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); -var HeatmapGl = {}; + // add prefix and suffix + if(ax.tickprefix && !isHidden(ax.showtickprefix)) out.text = ax.tickprefix + out.text; + if(ax.ticksuffix && !isHidden(ax.showticksuffix)) out.text += ax.ticksuffix; -HeatmapGl.attributes = _dereq_('./attributes'); -HeatmapGl.supplyDefaults = _dereq_('../heatmap/defaults'); -HeatmapGl.colorbar = _dereq_('../heatmap/colorbar'); + // Setup ticks and grid lines boundaries + // at 1/2 a 'category' to the left/bottom + if(ax.tickson === 'boundaries' || ax.showdividers) { + var inbounds = function(v) { + var p = ax.l2p(v); + return p >= 0 && p <= ax._length ? v : null; + }; -HeatmapGl.calc = _dereq_('../heatmap/calc'); -HeatmapGl.plot = _dereq_('./convert'); + out.xbnd = [ + inbounds(out.x - 0.5), + inbounds(out.x + ax.dtick - 0.5) + ]; + } -HeatmapGl.moduleType = 'trace'; -HeatmapGl.name = 'heatmapgl'; -HeatmapGl.basePlotModule = _dereq_('../../plots/gl2d'); -HeatmapGl.categories = ['gl', 'gl2d', '2dMap']; -HeatmapGl.meta = { - + return out; }; -module.exports = HeatmapGl; - -},{"../../plots/gl2d":784,"../heatmap/calc":946,"../heatmap/colorbar":948,"../heatmap/defaults":950,"./attributes":961,"./convert":962}],964:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var barAttrs = _dereq_('../bar/attributes'); -var makeBinAttrs = _dereq_('./bin_attributes'); - -module.exports = { - x: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - y: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - - text: barAttrs.text, - orientation: barAttrs.orientation, - - histfunc: { - valType: 'enumerated', - values: ['count', 'sum', 'avg', 'min', 'max'], - - dflt: 'count', - editType: 'calc', - - }, - histnorm: { - valType: 'enumerated', - values: ['', 'percent', 'probability', 'density', 'probability density'], - dflt: '', - - editType: 'calc', - - }, - - cumulative: { - enabled: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - - direction: { - valType: 'enumerated', - values: ['increasing', 'decreasing'], - dflt: 'increasing', - - editType: 'calc', - - }, - - currentbin: { - valType: 'enumerated', - values: ['include', 'exclude', 'half'], - dflt: 'include', - - editType: 'calc', - - }, - editType: 'calc' - }, - nbinsx: { - valType: 'integer', - min: 0, - dflt: 0, - - editType: 'calc', - - }, - xbins: makeBinAttrs('x', true), - - nbinsy: { - valType: 'integer', - min: 0, - dflt: 0, - - editType: 'calc', - - }, - ybins: makeBinAttrs('y', true), - autobinx: { - valType: 'boolean', - dflt: null, - - editType: 'calc', - - }, - autobiny: { - valType: 'boolean', - dflt: null, - - editType: 'calc', - impliedEdits: { - 'ybins.start': undefined, - 'ybins.end': undefined, - 'ybins.size': undefined - }, - - }, - - marker: barAttrs.marker, - - selected: barAttrs.selected, - unselected: barAttrs.unselected, - - _deprecated: { - bardir: barAttrs._deprecated.bardir + * create text for a hover label on this axis, with special handling of + * log axes (where negative values can't be displayed but can appear in hover text) + * + * @param {object} ax: the axis to format text for + * @param {number} val: calcdata value to format + * @param {Optional(number)} val2: a second value to display + * + * @returns {string} `val` formatted as a string appropriate to this axis, or + * `val` and `val2` as a range (ie ' - ') if `val2` is provided and + * it's different from `val`. + */ +axes.hoverLabelText = function(ax, val, val2) { + if(val2 !== BADNUM && val2 !== val) { + return axes.hoverLabelText(ax, val) + ' - ' + axes.hoverLabelText(ax, val2); } -}; - -},{"../bar/attributes":837,"./bin_attributes":966}],965:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; + var logOffScale = (ax.type === 'log' && val <= 0); + var tx = axes.tickText(ax, ax.c2l(logOffScale ? -val : val), 'hover').text; -module.exports = function doAvg(size, counts) { - var nMax = size.length, - total = 0; - for(var i = 0; i < nMax; i++) { - if(counts[i]) { - size[i] /= counts[i]; - total += size[i]; - } - else size[i] = null; + if(logOffScale) { + return val === 0 ? '0' : MINUS_SIGN + tx; } - return total; -}; -},{}],966:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // TODO: should we do something special if the axis calendar and + // the data calendar are different? Somehow display both dates with + // their system names? Right now it will just display in the axis calendar + // but users could add the other one as text. + return tx; +}; -'use strict'; +function tickTextObj(ax, x, text) { + var tf = ax.tickfont || {}; -module.exports = function makeBinAttrs(axLetter, match) { return { - start: { - valType: 'any', // for date axes - - editType: 'calc', - - }, - end: { - valType: 'any', // for date axes - - editType: 'calc', - - }, - size: { - valType: 'any', // for date axes - - editType: 'calc', - - }, - editType: 'calc' + x: x, + dx: 0, + dy: 0, + text: text || '', + fontSize: tf.size, + font: tf.family, + fontColor: tf.color }; -}; - -},{}],967:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +} +function formatDate(ax, out, hover, extraPrecision) { + var tr = ax._tickround; + var fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax); -'use strict'; + if(extraPrecision) { + // second or sub-second precision: extra always shows max digits. + // for other fields, extra precision just adds one field. + if(isNumeric(tr)) tr = 4; + else tr = {y: 'm', m: 'd', d: 'M', M: 'S', S: 4}[tr]; + } -var isNumeric = _dereq_('fast-isnumeric'); + var dateStr = Lib.formatDate(out.x, fmt, tr, 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); + } -module.exports = { - count: function(n, i, size) { - size[n]++; - return 1; - }, + if(extraPrecision) { + // if extraPrecision led to trailing zeros, strip them off + // actually, this can lead to removing even more zeros than + // in the original rounding, but that's fine because in these + // contexts uniformity is not so important (if there's even + // anything to be uniform with!) - sum: function(n, i, size, counterData) { - var v = counterData[i]; - if(isNumeric(v)) { - v = Number(v); - size[n] += v; - return v; + // can we remove the whole time part? + if(dateStr === '00:00:00' || dateStr === '00:00') { + dateStr = headStr; + headStr = ''; } - return 0; - }, - - avg: function(n, i, size, counterData, counts) { - var v = counterData[i]; - if(isNumeric(v)) { - v = Number(v); - size[n] += v; - counts[n]++; + else if(dateStr.length === 8) { + // strip off seconds if they're zero (zero fractional seconds + // are already omitted) + // but we never remove minutes and leave just hours + dateStr = dateStr.replace(/:00$/, ''); } - 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; - } + if(headStr) { + if(hover) { + // hover puts it all on one line, so headPart works best up front + // except for year headPart: turn this into "Jan 1, 2000" etc. + if(tr === 'd') dateStr += ', ' + headStr; + else dateStr = headStr + (dateStr ? ', ' + dateStr : ''); } - 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; - } + else if(!ax._inCalcTicks || (headStr !== ax._prevDateHead)) { + dateStr += '
' + headStr; + ax._prevDateHead = headStr; } - return 0; } -}; - -},{"fast-isnumeric":214}],968:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + out.text = dateStr; +} -'use strict'; +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); -var numConstants = _dereq_('../../constants/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 = _dereq_('../../plots/cartesian/axes').tickIncrement; + if(hideexp === 'never') { + // If this is a hover label, then we must *never* hide the exponent + // for the sake of display, which could give the wrong value by + // potentially many orders of magnitude. If hideexp was 'never', then + // it's now succeeded by preventing the other condition from automating + // this choice. Thus we can unset it so that the axis formatting takes + // precedence. + hideexp = ''; + } + if(extraPrecision && (dtChar0 !== 'L')) { + dtick = 'L3'; + dtChar0 = 'L'; + } -/* - * make a function that will find rounded bin edges - * @param {number} leftGap: how far from the left edge of any bin is the closest data value? - * @param {number} rightGap: how far from the right edge of any bin is the closest data value? - * @param {Array[number]} binEdges: the actual edge values used in binning - * @param {object} pa: the position axis - * @param {string} calendar: the data calendar - * - * @return {function(v, isRightEdge)}: - * find the start (isRightEdge is falsy) or end (truthy) label value for a bin edge `v` - */ -module.exports = function getBinSpanLabelRound(leftGap, rightGap, binEdges, pa, calendar) { - // the rounding digit is the largest digit that changes in *all* of 4 regions: - // - inside the rightGap before binEdges[0] (shifted 10% to the left) - // - inside the leftGap after binEdges[0] (expanded by 10% of rightGap on each end) - // - same for binEdges[1] - 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, pa, calendar), - biggestDigitChanged(edge1 + dv1, edge1 + dv2, pa, calendar) - ); - var rightDigit = Math.min( - biggestDigitChanged(edge0 + dv0, edge0 + dv1, pa, calendar), - biggestDigitChanged(edge1 + dv0, edge1 + dv1, pa, calendar) - ); + 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 + ''; - // normally we try to make the label for the right edge different from - // the left edge label, so it's unambiguous which bin gets data on the edge. - // but if this results in more than 3 extra digits (or for dates, more than - // 2 fields ie hr&min or min&sec, which is 3600x), it'll be more clutter than - // useful so keep the label cleaner instead - var digit, disambiguateEdges; - if(leftDigit > rightDigit && rightDigit < Math.abs(edge1 - edge0) / 4000) { - digit = leftDigit; - disambiguateEdges = false; + 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 { - digit = Math.min(leftDigit, rightDigit); - disambiguateEdges = true; + 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(pa.type === 'date' && digit > oneDay) { - var dashExclude = (digit === oneYear) ? 1 : 6; - var increment = (digit === oneYear) ? 'M12' : 'M1'; - - return function(v, isRightEdge) { - var dateStr = pa.c2d(v, oneYear, calendar); - var dashPos = dateStr.indexOf('-', dashExclude); - if(dashPos > 0) dateStr = dateStr.substr(0, dashPos); - var roundedV = pa.d2c(dateStr, 0, calendar); - - if(roundedV < v) { - var nextV = tickIncrement(roundedV, increment, false, calendar); - if((roundedV + nextV) / 2 < v + leftGap) roundedV = nextV; + // if 9's are printed on log scale, move the 10's away a bit + 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; } - - if(isRightEdge && disambiguateEdges) { - return tickIncrement(roundedV, increment, true, calendar); + else { + out.dy += out.fontSize / 2; + out.dx += (ax.range[1] > ax.range[0] ? 1 : -1) * + out.fontSize * (x < 0 ? 0.5 : 0.25); } - - return roundedV; - }; - } - - return function(v, isRightEdge) { - var roundedV = digit * Math.round(v / digit); - // if we rounded down and we could round up and still be < leftGap - // (or what leftGap values round to), do that - if(roundedV + (digit / 10) < v && roundedV + (digit * 0.9) < v + leftGap) { - roundedV += digit; - } - // finally for the right edge back off one digit - but only if we can do that - // and not clip off any data that's potentially in the bin - if(isRightEdge && disambiguateEdges) { - roundedV -= digit; } - return roundedV; - }; -}; - -/* - * Find the largest digit that changes within a (calcdata) region [v1, v2] - * if dates, "digit" means date/time part when it's bigger than a second - * returns the unit value to round to this digit, eg 0.01 to round to hundredths, or - * 100 to round to hundreds. returns oneMonth or oneYear for month or year rounding, - * so that Math.min will work, rather than 'M1' and 'M12' - */ -function biggestDigitChanged(v1, v2, pa, calendar) { - // are we crossing zero? can't say anything. - // in principle this doesn't apply to dates but turns out this doesn't matter. - if(v1 * v2 <= 0) return Infinity; - - var dv = Math.abs(v2 - v1); - var isDate = pa.type === 'date'; - var digit = biggestGuaranteedDigitChanged(dv, isDate); - // see if a larger digit also changed - for(var i = 0; i < 10; i++) { - // numbers: next digit needs to be >10x but <100x then gets rounded down. - // dates: next digit can be as much as 60x (then rounded down) - var nextDigit = biggestGuaranteedDigitChanged(digit * 80, isDate); - // if we get to years, the chain stops - if(digit === nextDigit) break; - if(didDigitChange(nextDigit, v1, v2, isDate, pa, calendar)) digit = nextDigit; - else break; } - return digit; } -/* - * Find the largest digit that *definitely* changes in a region [v, v + dv] for any v - * for nonuniform date regions (months/years) pick the largest - */ -function biggestGuaranteedDigitChanged(dv, isDate) { - if(isDate && dv > oneSec) { - // this is supposed to be the biggest *guaranteed* change - // so compare to the longest month and year across any calendar, - // and we'll iterate back up later - // note: does not support rounding larger than one year. We could add - // that if anyone wants it, but seems unusual and not strictly necessary. - if(dv > oneDay) { - if(dv > oneYear * 1.1) return oneYear; - if(dv > oneMonth * 1.1) return oneMonth; - return oneDay; - } - - if(dv > oneHour) return oneHour; - if(dv > oneMin) return oneMin; - return oneSec; - } - return Math.pow(10, Math.floor(Math.log(dv) / Math.LN10)); +function formatCategory(ax, out) { + var tt = ax._categories[Math.round(out.x)]; + if(tt === undefined) tt = ''; + out.text = String(tt); } -function didDigitChange(digit, v1, v2, isDate, pa, calendar) { - if(isDate && digit > oneDay) { - var dateParts1 = dateParts(v1, pa, calendar); - var dateParts2 = dateParts(v2, pa, calendar); - var parti = (digit === oneYear) ? 0 : 1; - return dateParts1[parti] !== dateParts2[parti]; +function formatMultiCategory(ax, out, hover) { + var v = Math.round(out.x); + var cats = ax._categories[v] || []; + var tt = cats[1] === undefined ? '' : String(cats[1]); + var tt2 = cats[0] === undefined ? '' : String(cats[0]); + if(hover) { + // TODO is this what we want? + out.text = tt2 + ' - ' + tt; + } else { + // setup for secondary labels + out.text = tt; + out.text2 = tt2; } - return Math.floor(v2 / digit) - Math.floor(v1 / digit) > 0.1; } -function dateParts(v, pa, calendar) { - var parts = pa.c2d(v, oneYear, calendar).split('-'); - if(parts[0] === '') { - parts.unshift(); - parts[0] = '-' + parts[0]; +function formatLinear(ax, out, hover, extraPrecision, hideexp) { + if(hideexp === 'never') { + // If this is a hover label, then we must *never* hide the exponent + // for the sake of display, which could give the wrong value by + // potentially many orders of magnitude. If hideexp was 'never', then + // it's now succeeded by preventing the other condition from automating + // this choice. Thus we can unset it so that the axis formatting takes + // precedence. + hideexp = ''; + } else if(ax.showexponent === 'all' && Math.abs(out.x / ax.dtick) < 1e-6) { + // don't add an exponent to zero if we're showing all exponents + // so the only reason you'd show an exponent on zero is if it's the + // ONLY tick to get an exponent (first or last) + hideexp = 'hide'; } - return parts; + out.text = numFormat(out.x, ax, hideexp, extraPrecision); } -},{"../../constants/numerical":673,"../../plots/cartesian/axes":744}],969:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var isNumeric = _dereq_('fast-isnumeric'); - -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); - -var arraysToCalcdata = _dereq_('../bar/arrays_to_calcdata'); -var binFunctions = _dereq_('./bin_functions'); -var normFunctions = _dereq_('./norm_functions'); -var doAvg = _dereq_('./average'); -var getBinSpanLabelRound = _dereq_('./bin_label_vals'); +function formatAngle(ax, out, hover, extraPrecision, hideexp) { + if(ax.thetaunit === 'radians' && !hover) { + var num = out.x / 180; -module.exports = function calc(gd, trace) { - // ignore as much processing as possible (and including in autorange) if not visible - if(trace.visible !== true) return; + if(num === 0) { + out.text = '0'; + } else { + var frac = num2frac(num); - // depending on orientation, set position and size axes and data ranges - // note: this logic for choosing orientation is duplicated in graph_obj->setstyles - var pos = []; - var size = []; - var pa = Axes.getFromId(gd, trace.orientation === 'h' ? - (trace.yaxis || 'y') : (trace.xaxis || 'x')); - var mainData = trace.orientation === 'h' ? 'y' : 'x'; - var counterData = {x: 'y', y: 'x'}[mainData]; - var calendar = trace[mainData + 'calendar']; - var cumulativeSpec = trace.cumulative; - var i; + if(frac[1] >= 100) { + out.text = numFormat(Lib.deg2rad(out.x), ax, hideexp, extraPrecision); + } else { + var isNeg = out.x < 0; - var binsAndPos = calcAllAutoBins(gd, trace, pa, mainData); - var binSpec = binsAndPos[0]; - var pos0 = binsAndPos[1]; - - var nonuniformBins = typeof binSpec.size === 'string'; - var binEdges = []; - var bins = nonuniformBins ? binEdges : binSpec; - // make the empty bin array - 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) { - // we treat "cumulative" like it means "integral" if you use a density norm, - // which in the end means it's the same as without "density" - 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 pa.r2c(v, 0, calendar); }; - var rawCounterData; - - if(Lib.isArrayOrTypedArray(trace[counterData]) && func !== 'count') { - rawCounterData = trace[counterData]; - isAvg = func === 'avg'; - binFunc = binFunctions[func]; - } - - // create the bins (and any extra arrays needed) - // assume more than 1e6 bins is an error, so we don't crash the browser - i = pr2c(binSpec.start); - - // decrease end a little in case of rounding errors - 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([]); - // nonuniform bins (like months) we need to search, - // rather than straight calculate the bin we're in - binEdges.push(i); - // nonuniform bins also need nonuniform normalization factors - if(densityNorm) inc.push(1 / (i2 - i)); - if(isAvg) counts.push(0); - // break to avoid infinite loops - if(i2 <= i) break; - i = i2; - } - binEdges.push(i); - - // for date axes we need bin bounds to be calcdata. For nonuniform bins - // we already have this, but uniform with start/end/size they're still strings. - if(!nonuniformBins && pa.type === 'date') { - bins = { - start: pr2c(bins.start), - end: pr2c(bins.end), - size: bins.size - }; - } + if(frac[1] === 1) { + if(frac[0] === 1) out.text = 'π'; + else out.text = frac[0] + 'π'; + } else { + out.text = [ + '', frac[0], '', + '⁄', + '', frac[1], '', + 'π' + ].join(''); + } - // bin the data - // and make histogram-specific pt-number-to-cd-index map object - var nMax = size.length; - var uniqueValsPerBin = true; - var leftGap = Infinity; - var rightGap = Infinity; - 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; + if(isNeg) out.text = MINUS_SIGN + out.text; } - inputPoints[n].push(i); - ptNumber2cdIndex[i] = n; - - leftGap = Math.min(leftGap, posi - binEdges[n]); - rightGap = Math.min(rightGap, binEdges[n + 1] - posi); } + } else { + out.text = numFormat(out.x, ax, hideexp, extraPrecision); } +} - var roundFn; - if(!uniqueValsPerBin) { - roundFn = getBinSpanLabelRound(leftGap, rightGap, binEdges, pa, calendar); +// inspired by +// https://github.com/yisibl/num2fraction/blob/master/index.js +function num2frac(num) { + function almostEq(a, b) { + return Math.abs(a - b) <= 1e-6; } - // average and/or normalize the data, if needed - if(isAvg) total = doAvg(size, counts); - if(normFunc) normFunc(size, total, inc); - - // after all normalization etc, now we can accumulate if desired - if(cumulativeSpec.enabled) cdf(size, cumulativeSpec.direction, cumulativeSpec.currentbin); - - - var seriesLen = Math.min(pos.length, size.length); - var cd = []; - var firstNonzero = 0; - var lastNonzero = seriesLen - 1; - - // look for empty bins at the ends to remove, so autoscale omits them - 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; - } + function findGCD(a, b) { + return almostEq(b, 0) ? a : findGCD(b, a % b); } - // create the "calculated data" to plot - for(i = firstNonzero; i <= lastNonzero; i++) { - if((isNumeric(pos[i]) && isNumeric(size[i]))) { - var cdi = { - p: pos[i], - s: size[i], - b: 0 - }; - - // setup hover and event data fields, - // N.B. pts and "hover" positions ph0/ph1 don't seem to make much sense - // for cumulative distributions - if(!cumulativeSpec.enabled) { - cdi.pts = inputPoints[i]; - if(uniqueValsPerBin) { - cdi.ph0 = cdi.ph1 = (inputPoints[i].length) ? pos0[inputPoints[i][0]] : pos[i]; - } - else { - cdi.ph0 = roundFn(binEdges[i]); - cdi.ph1 = roundFn(binEdges[i + 1], true); - } - } - cd.push(cdi); + function findPrecision(n) { + var e = 1; + while(!almostEq(Math.round(n * e) / e, n)) { + e *= 10; } + return e; } - if(cd.length === 1) { - // when we collapse to a single bin, calcdata no longer describes bin size - // so we need to explicitly specify it - cd[0].width1 = Axes.tickIncrement(cd[0].p, binSpec.size, false, calendar) - cd[0].p; - } + var precision = findPrecision(num); + var number = num * precision; + var gcd = Math.abs(findGCD(number, precision)); - arraysToCalcdata(cd, trace); + return [ + // numerator + Math.round(number / gcd), + // denominator + Math.round(precision / gcd) + ]; +} - if(Lib.isArrayOrTypedArray(trace.selectedpoints)) { - Lib.tagSelected(cd, trace, ptNumber2cdIndex); - } +// format a number (tick value) according to the axis settings +// new, more reliable procedure than d3.round or similar: +// add half the rounding increment, then stringify and truncate +// also automatically switch to sci. notation +var SIPREFIXES = ['f', 'p', 'n', 'μ', 'm', '', 'k', 'M', 'G', 'T']; - return cd; -}; +function isSIFormat(exponentFormat) { + return exponentFormat === 'SI' || exponentFormat === 'B'; +} -/* - * calcAllAutoBins: we want all histograms on the same axes to share bin specs - * if they're grouped or stacked. If the user has explicitly specified differing - * bin specs, there's nothing we can do, but if possible we will try to use the - * smallest bins of any of the auto values for all histograms grouped/stacked - * together. - */ -function calcAllAutoBins(gd, trace, pa, mainData, _overlayEdgeCase) { - var binAttr = mainData + 'bins'; - var fullLayout = gd._fullLayout; - var isOverlay = fullLayout.barmode === 'overlay'; - var i, traces, tracei, calendar, pos0, autoVals, cumulativeSpec; +// are we beyond the range of common SI prefixes? +// 10^-16 -> 1x10^-16 +// 10^-15 -> 1f +// ... +// 10^14 -> 100T +// 10^15 -> 1x10^15 +// 10^16 -> 1x10^16 +function beyondSI(exponent) { + return exponent > 14 || exponent < -15; +} - var cleanBound = (pa.type === 'date') ? - function(v) { return (v || v === 0) ? Lib.cleanDate(v, null, pa.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]); - } +function numFormat(v, ax, fmtoverride, hover) { + var isNeg = v < 0; + // max number of digits past decimal point to show + var tickRound = ax._tickround; + var exponentFormat = fmtoverride || ax.exponentformat || 'B'; + var exponent = ax._tickexponent; + var tickformat = axes.getTickFormat(ax); + var separatethousands = ax.separatethousands; + + // special case for hover: set exponent just for this value, and + // add a couple more digits of precision over tick labels + if(hover) { + // make a dummy axis obj to get the auto rounding and exponent + var ah = { + exponentformat: exponentFormat, + 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(ah); + tickRound = (Number(ah._tickround) || 0) + 4; + exponent = ah._tickexponent; + if(ax.hoverformat) tickformat = ax.hoverformat; } - var binOpts = fullLayout._histogramBinOpts[trace._groupName]; + if(tickformat) return ax._numFormat(tickformat)(v).replace(/-/g, MINUS_SIGN); + + // 'epsilon' - rounding increment + var e = Math.pow(10, -tickRound) / 2; + + // exponentFormat codes: + // 'e' (1.2e+6, default) + // 'E' (1.2E+6) + // 'SI' (1.2M) + // 'B' (same as SI except 10^9=B not G) + // 'none' (1200000) + // 'power' (1.2x10^6) + // 'hide' (1.2, use 3rd argument=='hide' to eg + // only show exponent on last tick) + if(exponentFormat === 'none') exponent = 0; - // all but the first trace in this group has already been marked finished - // clear this flag, so next time we run calc we will run autobin again - if(trace._autoBinFinished) { - delete trace._autoBinFinished; + // take the sign out, put it back manually at the end + // - makes cases easier + v = Math.abs(v); + if(v < e) { + // 0 is just 0, but may get exponent if it's the last tick + v = '0'; + isNeg = false; } else { - traces = binOpts.traces; - var sizeFound = binOpts.sizeFound; - var allPos = []; - autoVals = traces[0]._autoBin = {}; - // Note: we're including `legendonly` traces here for autobin purposes, - // so that showing & hiding from the legend won't affect bins. - // But this complicates things a bit since those traces don't `calc`, - // hence `isFirstVisible`. - var isFirstVisible = true; - for(i = 0; i < traces.length; i++) { - tracei = traces[i]; - pos0 = tracei._pos0 = pa.makeCalcdata(tracei, mainData); - allPos = Lib.concat(allPos, pos0); - delete tracei._autoBinFinished; - if(trace.visible === true) { - if(isFirstVisible) { - isFirstVisible = false; - } - else { - delete tracei._autoBin; - tracei._autoBinFinished = 1; - } - } - } - calendar = traces[0][mainData + 'calendar']; - var newBinSpec = Axes.autoBin( - allPos, pa, binOpts.nbins, false, calendar, sizeFound && binOpts.size); - - // Edge case: single-valued histogram overlaying others - // Use them all together to calculate the bin size for the single-valued one - if(isOverlay && newBinSpec._dataSpan === 0 && pa.type !== 'category') { - // Several single-valued histograms! Stop infinite recursion, - // just return an extra flag that tells handleSingleValueOverlays - // to sort out this trace too - if(_overlayEdgeCase) return [newBinSpec, pos0, true]; - - newBinSpec = handleSingleValueOverlays(gd, trace, pa, mainData, binAttr); - } - - // adjust for CDF edge cases - cumulativeSpec = tracei.cumulative; - if(cumulativeSpec.enabled && (cumulativeSpec.currentbin !== 'include')) { - if(cumulativeSpec.direction === 'decreasing') { - newBinSpec.start = pa.c2r(Axes.tickIncrement( - pa.r2c(newBinSpec.start, 0, calendar), - newBinSpec.size, true, calendar - )); - } - else { - newBinSpec.end = pa.c2r(Axes.tickIncrement( - pa.r2c(newBinSpec.end, 0, calendar), - newBinSpec.size, false, calendar - )); - } + v += e; + // take out a common exponent, if any + if(exponent) { + v *= Math.pow(10, -exponent); + tickRound += exponent; } - - binOpts.size = newBinSpec.size; - if(!sizeFound) { - autoVals.size = newBinSpec.size; - Lib.nestedProperty(traces[0], binAttr + '.size').set(newBinSpec.size); - } - - setBound('start', binOpts, newBinSpec); - setBound('end', binOpts, newBinSpec); - } - - pos0 = trace._pos0; - delete trace._pos0; - - // Each trace can specify its own start/end, or if omitted - // we ensure they're beyond the bounds of this trace's data, - // and we need to make sure start is aligned with the main start - var traceInputBins = trace._input[binAttr] || {}; - var traceBinOptsCalc = Lib.extendFlat({}, binOpts); - var mainStart = binOpts.start; - var startIn = pa.r2l(traceInputBins.start); - var hasStart = startIn !== undefined; - if((binOpts.startFound || hasStart) && startIn !== pa.r2l(mainStart)) { - // We have an explicit start to reconcile across traces - // if this trace has an explicit start, shift it down to a bin edge - // if another trace had an explicit start, shift it down to a - // bin edge past our data - var traceStart = hasStart ? - startIn : - Lib.aggNums(Math.min, null, pos0); - - var dummyAx = { - type: pa.type === 'category' ? 'linear' : pa.type, - r2l: pa.r2l, - dtick: binOpts.size, - tick0: mainStart, - calendar: calendar, - range: ([traceStart, Axes.tickIncrement(traceStart, binOpts.size, false, calendar)]).map(pa.l2r) - }; - var newStart = Axes.tickFirst(dummyAx); - if(newStart > pa.r2l(traceStart)) { - newStart = Axes.tickIncrement(newStart, binOpts.size, true, calendar); - } - traceBinOptsCalc.start = pa.l2r(newStart); - if(!hasStart) Lib.nestedProperty(trace, binAttr + '.start').set(traceBinOptsCalc.start); - } - - var mainEnd = binOpts.end; - var endIn = pa.r2l(traceInputBins.end); - var hasEnd = endIn !== undefined; - if((binOpts.endFound || hasEnd) && endIn !== pa.r2l(mainEnd)) { - // Reconciling an explicit end is easier, as it doesn't need to - // match bin edges - var traceEnd = hasEnd ? - endIn : - Lib.aggNums(Math.max, null, pos0); - - traceBinOptsCalc.end = pa.l2r(traceEnd); - if(!hasEnd) Lib.nestedProperty(trace, binAttr + '.start').set(traceBinOptsCalc.end); - } - - // Backward compatibility for one-time autobinning. - // autobin: true is handled in cleanData, but autobin: false - // needs to be here where we have determined the values. - 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]; -} - -/* - * Adjust single-value histograms in overlay mode to make as good a - * guess as we can at autobin values the user would like. - * - * Returns the binSpec for the trace that sparked all this - */ -function handleSingleValueOverlays(gd, trace, pa, mainData, binAttr) { - var overlaidTraceGroup = getConnectedHistograms(gd, trace); - var pastThisTrace = false; - var minSize = Infinity; - var singleValuedTraces = [trace]; - var i, tracei; - - // first collect all the: - // - min bin size from all multi-valued traces - // - single-valued traces - for(i = 0; i < overlaidTraceGroup.length; i++) { - tracei = overlaidTraceGroup[i]; - if(tracei === trace) pastThisTrace = true; - else if(!pastThisTrace) { - // This trace has already had its autobins calculated - // (so must not have been single-valued). - minSize = Math.min(minSize, tracei[binAttr].size); + // round the mantissa + 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 { - var resulti = calcAllAutoBins(gd, tracei, pa, mainData, true); - var binSpeci = resulti[0]; - var isSingleValued = resulti[2]; - - // so we can use this result when we get to tracei in the normal - // course of events, mark it as done and put _pos0 back - tracei._autoBinFinished = 1; - tracei._pos0 = resulti[1]; - - if(isSingleValued) { - singleValuedTraces.push(tracei); - } - else { - minSize = Math.min(minSize, binSpeci.size); - } - } - } - - // find the real data values for each single-valued trace - // hunt through pos0 for the first valid value - var dataVals = new Array(singleValuedTraces.length); - for(i = 0; i < singleValuedTraces.length; i++) { - var pos0 = singleValuedTraces[i]._pos0; - for(var j = 0; j < pos0.length; j++) { - if(pos0[j] !== undefined) { - dataVals[i] = pos0[j]; - break; - } + v = String(v); + var dp = v.indexOf('.') + 1; + if(dp) v = v.substr(0, dp + tickRound).replace(/\.?0+$/, ''); } + // insert appropriate decimal point and thousands separator + v = Lib.numSeparate(v, ax._separators, separatethousands); } - // are ALL traces are single-valued? use the min difference between - // all of their values (which defaults to 1 if there's still only one) - if(!isFinite(minSize)) { - minSize = Lib.distinctVals(dataVals).minDiff; - } - - // now apply the min size we found to all single-valued traces - for(i = 0; i < singleValuedTraces.length; i++) { - tracei = singleValuedTraces[i]; - var calendar = tracei[mainData + 'calendar']; - - tracei._input[binAttr] = tracei[binAttr] = { - start: pa.c2r(dataVals[i] - minSize / 2, 0, calendar), - end: pa.c2r(dataVals[i] + minSize / 2, 0, calendar), - size: minSize - }; - } - - return trace[binAttr]; -} + // add exponent + if(exponent && exponentFormat !== 'hide') { + if(isSIFormat(exponentFormat) && beyondSI(exponent)) exponentFormat = 'power'; -/* - * Return an array of histograms that share axes and orientation. - * - * Only considers histograms. In principle we could include bars in a - * similar way to how we do manually binned histograms, though this - * would have tons of edge cases and value judgments to make. - */ -function getConnectedHistograms(gd, trace) { - var xid = trace.xaxis; - var yid = trace.yaxis; - var orientation = trace.orientation; + var signedExponent; + if(exponent < 0) signedExponent = MINUS_SIGN + -exponent; + else if(exponentFormat !== 'power') signedExponent = '+' + exponent; + else signedExponent = String(exponent); - var out = []; - var fullData = gd._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); + 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]; } } - return out; + // put sign back in and return + // replace standard minus character (which is technically a hyphen) + // with a true minus sign + if(isNeg) return MINUS_SIGN + v; + return v; } +axes.getTickFormat = function(ax) { + var i; -function cdf(size, direction, currentBin) { - var i, vi, prevSum; - - function firstHalfPoint(i) { - prevSum = size[i]; - size[i] /= 2; - } - - function nextHalfPoint(i) { - vi = size[i]; - size[i] = prevSum + vi / 2; - prevSum += vi; + function convertToMs(dtick) { + return typeof dtick !== 'string' ? dtick : Number(dtick.replace('M', '')) * ONEAVGMONTH; } - 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); + 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; } } - else if(direction === 'increasing') { - for(i = 1; i < size.length; i++) { - size[i] += size[i - 1]; - } - // 'exclude' is identical to 'include' just shifted one bin over - if(currentBin === 'exclude') { - size.unshift(0); - size.pop(); - } + 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)); } - else { - for(i = size.length - 2; i >= 0; i--) { - size[i] += size[i + 1]; - } - if(currentBin === 'exclude') { - size.push(0); - size.shift(); - } + 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); } -} -},{"../../lib":696,"../../plots/cartesian/axes":744,"../bar/arrays_to_calcdata":836,"./average":965,"./bin_functions":967,"./bin_label_vals":968,"./norm_functions":975,"fast-isnumeric":214}],970:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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; +}; +// getSubplots - extract all subplot IDs we need +// as an array of items like 'xy', 'x2y', 'x2y2'... +// sorted by x (x,x2,x3...) then y +// optionally restrict to only subplots containing axis object ax +// +// NOTE: this is currently only used OUTSIDE plotly.js (toolpanel, webapp) +// ideally we get rid of it there (or just copy this there) and remove it here +axes.getSubplots = function(gd, ax) { + var subplotObj = gd._fullLayout._subplots; + var allSubplots = subplotObj.cartesian.concat(subplotObj.gl2d || []); -'use strict'; + var out = ax ? axes.findSubplotsWithAxis(allSubplots, ax) : allSubplots; -var Lib = _dereq_('../../lib'); -var nestedProperty = Lib.nestedProperty; + out.sort(function(a, b) { + var aParts = a.substr(1).split('y'); + var bParts = b.substr(1).split('y'); -var attributes = _dereq_('./attributes'); + if(aParts[0] === bParts[0]) return +aParts[1] - +bParts[1]; + return +aParts[0] - +bParts[0]; + }); -var BINATTRS = { - x: [ - {aStr: 'xbins.start', name: 'start'}, - {aStr: 'xbins.end', name: 'end'}, - {aStr: 'xbins.size', name: 'size'}, - {aStr: 'nbinsx', name: 'nbins'} - ], - y: [ - {aStr: 'ybins.start', name: 'start'}, - {aStr: 'ybins.end', name: 'end'}, - {aStr: 'ybins.size', name: 'size'}, - {aStr: 'nbinsy', name: 'nbins'} - ] + return out; }; -// handle bin attrs and relink auto-determined values so fullData is complete -module.exports = function crossTraceDefaults(fullData, fullLayout) { - var allBinOpts = fullLayout._histogramBinOpts = {}; - var isOverlay = fullLayout.barmode === 'overlay'; - var i, j, traceOut, traceIn, binDirection, group, binOpts; +// find all subplots with axis 'ax' +// NOTE: this is only used in axes.getSubplots (only used outside plotly.js) and +// gl2d/convert (where it restricts axis subplots to only those with gl2d) +axes.findSubplotsWithAxis = function(subplots, ax) { + var axMatch = new RegExp( + (ax._id.charAt(0) === 'x') ? ('^' + ax._id + 'y') : (ax._id + '$') + ); + var subplotsWithAx = []; - function coerce(attr) { - return Lib.coerce(traceOut._input, traceOut, attributes, attr); + for(var i = 0; i < subplots.length; i++) { + var sp = subplots[i]; + if(axMatch.test(sp)) subplotsWithAx.push(sp); } - for(i = 0; i < fullData.length; i++) { - traceOut = fullData[i]; - if(traceOut.type !== 'histogram') continue; - - // TODO: this shouldn't be relinked as it's only used within calc - // https://github.com/plotly/plotly.js/issues/749 - delete traceOut._autoBinFinished; - - binDirection = traceOut.orientation === 'v' ? 'x' : 'y'; - // in overlay mode make a separate group for each trace - // otherwise collect all traces of the same subplot & orientation - group = isOverlay ? traceOut.uid : (traceOut.xaxis + traceOut.yaxis + binDirection); - traceOut._groupName = group; + return subplotsWithAx; +}; - binOpts = allBinOpts[group]; +// makeClipPaths: prepare clipPaths for all single axes and all possible xy pairings +axes.makeClipPaths = function(gd) { + var fullLayout = gd._fullLayout; - if(binOpts) { - binOpts.traces.push(traceOut); - } - else { - binOpts = allBinOpts[group] = { - traces: [traceOut], - direction: binDirection - }; - } - } + // for more info: https://github.com/plotly/plotly.js/issues/2595 + if(fullLayout._hasOnlyLargeSploms) return; - for(group in allBinOpts) { - binOpts = allBinOpts[group]; - binDirection = binOpts.direction; - var attrs = BINATTRS[binDirection]; - for(j = 0; j < attrs.length; j++) { - var attrSpec = attrs[j]; - var attr = attrSpec.name; - - // nbins(x|y) is moot if we have a size. This depends on - // nbins coming after size in binAttrs. - if(attr === 'nbins' && binOpts.sizeFound) continue; - - var aStr = attrSpec.aStr; - for(i = 0; i < binOpts.traces.length; i++) { - traceOut = binOpts.traces[i]; - traceIn = traceOut._input; - if(nestedProperty(traceIn, aStr).get() !== undefined) { - binOpts[attr] = coerce(aStr); - binOpts[attr + 'Found'] = true; - break; - } - var autoVals = traceOut._autoBin; - if(autoVals && autoVals[attr]) { - // if this is the *first* autoval - nestedProperty(traceOut, aStr).set(autoVals[attr]); - } - } - // start and end we need to coerce anyway, after having collected the - // first of each into binOpts, in case a trace wants to restrict its - // data to a certain range - if(attr === 'start' || attr === 'end') { - for(; i < binOpts.traces.length; i++) { - traceOut = binOpts.traces[i]; - coerce(aStr, (traceOut._autoBin || {})[attr]); - } - } + var fullWidth = {_offset: 0, _length: fullLayout.width, _id: ''}; + var fullHeight = {_offset: 0, _length: fullLayout.height, _id: ''}; + var xaList = axes.list(gd, 'x', true); + var yaList = axes.list(gd, 'y', true); + var clipList = []; + var i, j; - if(attr === 'nbins' && !binOpts.sizeFound && !binOpts.nbinsFound) { - traceOut = binOpts.traces[0]; - binOpts[attr] = coerce(aStr); - } + 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]}); } } -}; - -},{"../../lib":696,"./attributes":964}],971:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); - -var handleStyleDefaults = _dereq_('../bar/style_defaults'); -var attributes = _dereq_('./attributes'); + // selectors don't work right with camelCase tags, + // have to use class instead + // https://groups.google.com/forum/#!topic/d3-js/6EpAzQ2gU9I + var axClips = fullLayout._clips.selectAll('.axesclip') + .data(clipList, function(d) { return d.x._id + d.y._id; }); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } + axClips.enter().append('clipPath') + .classed('axesclip', true) + .attr('id', function(d) { return 'clip' + fullLayout._uid + d.x._id + d.y._id; }) + .append('rect'); - var x = coerce('x'); - var y = coerce('y'); + axClips.exit().remove(); - var cumulative = coerce('cumulative.enabled'); - if(cumulative) { - coerce('cumulative.direction'); - coerce('cumulative.currentbin'); - } + 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 + }); + }); +}; - coerce('text'); +/** + * Main multi-axis drawing routine! + * + * @param {DOM element} gd : graph div + * @param {string or array of strings} arg : polymorphic argument + * @param {object} opts: + * - @param {boolean} skipTitle : optional flag to skip axis title draw/update + * + * Signature 1: Axes.draw(gd, 'redraw') + * use this to clear and redraw all axes on graph + * + * Signature 2: Axes.draw(gd, '') + * use this to draw all axes on graph w/o the selectAll().remove() + * of the 'redraw' signature + * + * Signature 3: Axes.draw(gd, [axId, axId2, ...]) + * where the items are axis id string, + * use this to update multiple axes in one call + * + * N.B draw updates: + * - ax._r (stored range for use by zoom/pan) + * - ax._rl (stored linearized range for use by zoom/pan) + */ +axes.draw = function(gd, arg, opts) { + var fullLayout = gd._fullLayout; - var orientation = coerce('orientation', (y && !x) ? 'h' : 'v'); - var sampleLetter = orientation === 'v' ? 'x' : 'y'; - var aggLetter = orientation === 'v' ? 'y' : 'x'; + if(arg === 'redraw') { + fullLayout._paper.selectAll('g.subplot').each(function(d) { + var id = d[0]; + var plotinfo = fullLayout._plots[id]; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - var len = (x && y) ? Math.min(x.length && y.length) : (traceOut[sampleLetter] || []).length; + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(!len) { - traceOut.visible = false; - return; - } + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - traceOut._length = len; + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + }); + } - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); + var axList = (!arg || arg === 'redraw') ? axes.listIds(gd) : arg; - var hasAggregationData = traceOut[aggLetter]; - if(hasAggregationData) coerce('histfunc'); - coerce('histnorm'); - - // Note: bin defaults are now handled in Histogram.crossTraceDefaults - // autobin(x|y) are only included here to appease Plotly.validate - coerce('autobin' + sampleLetter); + return Lib.syncOrAsync(axList.map(function(axId) { + return function() { + if(!axId) return; - handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); + var ax = axes.getFromId(gd, axId); + var axDone = axes.drawOne(gd, ax, opts); - // override defaultColor for error bars with defaultLine - var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); + return axDone; + }; + })); }; -},{"../../components/color":570,"../../lib":696,"../../registry":827,"../bar/style_defaults":850,"./attributes":964}],972:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Draw one cartesian axis + * + * @param {DOM element} gd + * @param {object} ax (full) axis object + * @param {object} opts + * - @param {boolean} skipTitle (set to true to skip axis title draw call) + */ +axes.drawOne = function(gd, ax, opts) { + opts = opts || {}; -'use strict'; + var i, sp, plotinfo; -module.exports = function eventData(out, pt, trace, cd, pointNumber) { - // standard cartesian event data - out.x = 'xVal' in pt ? pt.xVal : pt.x; - out.y = 'yVal' in pt ? pt.yVal : pt.y; + ax.setScale(); - if(pt.xa) out.xaxis = pt.xa; - if(pt.ya) out.yaxis = pt.ya; + var fullLayout = gd._fullLayout; + var axId = ax._id; + var axLetter = axId.charAt(0); + var counterLetter = axes.counterLetter(axId); + var mainSubplot = ax._mainSubplot; + var mainLinePosition = ax._mainLinePosition; + var mainMirrorPosition = ax._mainMirrorPosition; + var mainPlotinfo = fullLayout._plots[mainSubplot]; + var mainAxLayer = mainPlotinfo[axLetter + 'axislayer']; + var subplotsWithAx = ax._subplotsWith; - // specific to histogram - CDFs do not have pts (yet?) - if(!(trace.cumulative || {}).enabled) { - var pts = Array.isArray(pointNumber) ? - cd[0].pts[pointNumber[0]][pointNumber[1]] : - cd[pointNumber].pts; + var vals = ax._vals = axes.calcTicks(ax); - out.pointNumbers = pts; - out.binNumber = out.pointNumber; - delete out.pointNumber; - delete out.pointIndex; + // Add a couple of axis properties that should cause us to recreate + // elements. Used in d3 data function. + var axInfo = [ax.mirror, mainLinePosition, mainMirrorPosition].join('_'); + for(i = 0; i < vals.length; i++) { + vals[i].axInfo = axInfo; + } - var pointIndices; - if(trace._indexToPoints) { - pointIndices = []; - for(var i = 0; i < pts.length; i++) { - pointIndices = pointIndices.concat(trace._indexToPoints[pts[i]]); - } - } else { - pointIndices = pts; - } + if(!ax.visible) return; - out.pointIndices = pointIndices; + // stash selections to avoid DOM queries e.g. + // - stash tickLabels selection, so that drawTitle can use it to scoot title + ax._selections = {}; + // stash tick angle (including the computed 'auto' values) per tick-label class + ax._tickAngles = {}; + + var transFn = axes.makeTransFn(ax); + var tickVals; + // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end + // The key case here is removing zero lines when the axis bound is zero + var valsClipped; + + if(ax.tickson === 'boundaries') { + var boundaryVals = getBoundaryVals(ax, vals); + valsClipped = axes.clipEnds(ax, boundaryVals); + tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + } else { + valsClipped = axes.clipEnds(ax, vals); + tickVals = ax.ticks === 'inside' ? valsClipped : vals; } - return out; -}; - -},{}],973:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var gridVals = ax._gridVals = valsClipped; + var dividerVals = getDividerVals(ax, vals); + if(!fullLayout._hasOnlyLargeSploms) { + // keep track of which subplots (by main conteraxis) we've already + // drawn grids for, so we don't overdraw overlaying subplots + var finishedGrids = {}; -'use strict'; + for(i = 0; i < subplotsWithAx.length; i++) { + sp = subplotsWithAx[i]; + plotinfo = fullLayout._plots[sp]; -var barHover = _dereq_('../bar/hover').hoverPoints; -var hoverLabelText = _dereq_('../../plots/cartesian/axes').hoverLabelText; + var counterAxis = plotinfo[counterLetter + 'axis']; + var mainCounterID = counterAxis._mainAxis._id; + if(finishedGrids[mainCounterID]) continue; + finishedGrids[mainCounterID] = 1; -module.exports = function hoverPoints(pointData, xval, yval, hovermode) { - var pts = barHover(pointData, xval, yval, hovermode); + var gridPath = axLetter === 'x' ? + 'M0,' + counterAxis._offset + 'v' + counterAxis._length : + 'M' + counterAxis._offset + ',0h' + counterAxis._length; + + axes.drawGrid(gd, ax, { + vals: gridVals, + counterAxis: counterAxis, + layer: plotinfo.gridlayer.select('.' + axId), + path: gridPath, + transFn: transFn + }); + axes.drawZeroLine(gd, ax, { + counterAxis: counterAxis, + layer: plotinfo.zerolinelayer, + path: gridPath, + transFn: transFn + }); + } + } - if(!pts) return; + var tickSigns = axes.getTickSigns(ax); + var tickSubplots = []; - pointData = pts[0]; - var di = pointData.cd[pointData.index]; - var trace = pointData.cd[0].trace; + if(ax.ticks) { + var mainTickPath = axes.makeTickPath(ax, mainLinePosition, tickSigns[2]); + var mirrorTickPath; + var fullTickPath; + if(ax._anchorAxis && ax.mirror && ax.mirror !== true) { + mirrorTickPath = axes.makeTickPath(ax, mainMirrorPosition, tickSigns[3]); + fullTickPath = mainTickPath + mirrorTickPath; + } else { + mirrorTickPath = ''; + fullTickPath = mainTickPath; + } + + var tickPath; + if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + var dividerLookup = {}; + for(i = 0; i < dividerVals.length; i++) { + dividerLookup[dividerVals[i].x] = 1; + } + tickPath = function(d) { + return dividerLookup[d.x] ? mirrorTickPath : fullTickPath; + }; + } else { + tickPath = fullTickPath; + } - if(!trace.cumulative.enabled) { - var posLetter = trace.orientation === 'h' ? 'y' : 'x'; + axes.drawTicks(gd, ax, { + vals: tickVals, + layer: mainAxLayer, + path: tickPath, + transFn: transFn + }); - pointData[posLetter + 'Label'] = hoverLabelText(pointData[posLetter + 'a'], di.ph0, di.ph1); + tickSubplots = Object.keys(ax._linepositions || {}); } - return pts; -}; - -},{"../../plots/cartesian/axes":744,"../bar/hover":842}],974:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; + for(i = 0; i < tickSubplots.length; i++) { + sp = tickSubplots[i]; + plotinfo = fullLayout._plots[sp]; + // [bottom or left, top or right], free and main are handled above + var linepositions = ax._linepositions[sp] || []; + var spTickPath = axes.makeTickPath(ax, linepositions[0], tickSigns[0]) + + axes.makeTickPath(ax, linepositions[1], tickSigns[1]); -/** - * Histogram has its own attribute, defaults and calc steps, - * but uses bar's plot to display - * and bar's crossTraceCalc (formerly known as setPositions) for stacking and grouping - */ + axes.drawTicks(gd, ax, { + vals: tickVals, + layer: plotinfo[axLetter + 'axislayer'], + path: spTickPath, + transFn: transFn + }); + } -/** - * histogram errorBarsOK is debatable, but it's put in for backward compat. - * there are use cases for it - sqrt for a simple histogram works right now, - * constant and % work but they're not so meaningful. I guess it could be cool - * to allow quadrature combination of errors in summed histograms... - */ + var seq = []; + // tick labels - for now just the main labels. + // TODO: mirror labels, esp for subplots -var Histogram = {}; + seq.push(function() { + var labelFns = axes.makeLabelFns(ax, mainLinePosition); + return axes.drawLabels(gd, ax, { + vals: vals, + layer: mainAxLayer, + transFn: transFn, + labelXFn: labelFns.labelXFn, + labelYFn: labelFns.labelYFn, + labelAnchorFn: labelFns.labelAnchorFn, + }); + }); -Histogram.attributes = _dereq_('./attributes'); -Histogram.layoutAttributes = _dereq_('../bar/layout_attributes'); -Histogram.supplyDefaults = _dereq_('./defaults'); -Histogram.crossTraceDefaults = _dereq_('./cross_trace_defaults'); -Histogram.supplyLayoutDefaults = _dereq_('../bar/layout_defaults'); -Histogram.calc = _dereq_('./calc'); -Histogram.crossTraceCalc = _dereq_('../bar/cross_trace_calc').crossTraceCalc; -Histogram.plot = _dereq_('../bar/plot'); -Histogram.layerName = 'barlayer'; -Histogram.style = _dereq_('../bar/style').style; -Histogram.styleOnSelect = _dereq_('../bar/style').styleOnSelect; -Histogram.colorbar = _dereq_('../scatter/marker_colorbar'); -Histogram.hoverPoints = _dereq_('./hover'); -Histogram.selectPoints = _dereq_('../bar/select'); -Histogram.eventData = _dereq_('./event_data'); + if(ax.type === 'multicategory') { + var labelLength = 0; + var pad = {x: 2, y: 10}[axLetter]; + var sgn = tickSigns[2] * (ax.ticks === 'inside' ? -1 : 1); + + seq.push(function() { + labelLength += getLabelLevelSpan(ax, axId + 'tick') + pad; + labelLength += ax._tickAngles[axId + 'tick'] ? ax.tickfont.size * LINE_SPACING : 0; + var secondaryPosition = mainLinePosition + labelLength * sgn; + var secondaryLabelFns = axes.makeLabelFns(ax, secondaryPosition); + + return axes.drawLabels(gd, ax, { + vals: getSecondaryLabelVals(ax, vals), + layer: mainAxLayer, + cls: axId + 'tick2', + repositionOnUpdate: true, + secondary: true, + transFn: transFn, + labelXFn: secondaryLabelFns.labelXFn, + labelYFn: secondaryLabelFns.labelYFn, + labelAnchorFn: secondaryLabelFns.labelAnchorFn, + }); + }); -Histogram.moduleType = 'trace'; -Histogram.name = 'histogram'; -Histogram.basePlotModule = _dereq_('../../plots/cartesian'); -Histogram.categories = ['cartesian', 'svg', 'bar', 'histogram', 'oriented', 'errorBarsOK', 'showLegend']; -Histogram.meta = { - -}; + seq.push(function() { + labelLength += getLabelLevelSpan(ax, axId + 'tick2'); + ax._labelLength = labelLength; + + return drawDividers(gd, ax, { + vals: dividerVals, + layer: mainAxLayer, + path: axes.makeTickPath(ax, mainLinePosition, sgn, labelLength), + transFn: transFn + }); + }); + } -module.exports = Histogram; + function extendRange(range, newRange) { + range[0] = Math.min(range[0], newRange[0]); + range[1] = Math.max(range[1], newRange[1]); + } -},{"../../plots/cartesian":756,"../bar/cross_trace_calc":839,"../bar/layout_attributes":844,"../bar/layout_defaults":845,"../bar/plot":846,"../bar/select":847,"../bar/style":849,"../scatter/marker_colorbar":1061,"./attributes":964,"./calc":969,"./cross_trace_defaults":970,"./defaults":971,"./event_data":972,"./hover":973}],975:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + function calcBoundingBox() { + if(ax.showticklabels) { + var gdBB = gd.getBoundingClientRect(); + var bBox = mainAxLayer.node().getBoundingClientRect(); + /* + * the way we're going to use this, the positioning that matters + * is relative to the origin of gd. This is important particularly + * if gd is scrollable, and may have been scrolled between the time + * we calculate this and the time we use it + */ -'use strict'; + ax._boundingBox = { + width: bBox.width, + height: bBox.height, + left: bBox.left - gdBB.left, + right: bBox.right - gdBB.left, + top: bBox.top - gdBB.top, + bottom: bBox.bottom - gdBB.top + }; + } else { + var gs = fullLayout._size; + var pos; + // set dummy bbox for ticklabel-less axes -module.exports = { - percent: function(size, total) { - var nMax = size.length, - 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; - } -}; + if(axLetter === 'x') { + pos = ax.anchor === 'free' ? + gs.t + gs.h * (1 - ax.position) : + gs.t + gs.h * (1 - ax._anchorAxis.domain[{bottom: 0, top: 1}[ax.side]]); -},{}],976:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + ax._boundingBox = { + top: pos, + bottom: pos, + left: ax._offset, + right: ax._offset + ax._length, + width: ax._length, + height: 0 + }; + } else { + pos = ax.anchor === 'free' ? + gs.l + gs.w * ax.position : + gs.l + gs.w * ax._anchorAxis.domain[{left: 0, right: 1}[ax.side]]; -'use strict'; + ax._boundingBox = { + left: pos, + right: pos, + bottom: ax._offset + ax._length, + top: ax._offset, + height: ax._length, + width: 0 + }; + } + } -var histogramAttrs = _dereq_('../histogram/attributes'); -var makeBinAttrs = _dereq_('../histogram/bin_attributes'); -var heatmapAttrs = _dereq_('../heatmap/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); + /* + * for spikelines: what's the full domain of positions in the + * opposite direction that are associated with this axis? + * This means any axes that we make a subplot with, plus the + * position of the axis itself if it's free. + */ + if(subplotsWithAx) { + var fullRange = ax._counterSpan = [Infinity, -Infinity]; -var extendFlat = _dereq_('../../lib/extend').extendFlat; + for(var i = 0; i < subplotsWithAx.length; i++) { + var plotinfo = fullLayout._plots[subplotsWithAx[i]]; + var counterAxis = plotinfo[(axLetter === 'x') ? 'yaxis' : 'xaxis']; -module.exports = extendFlat( - { - x: histogramAttrs.x, - y: histogramAttrs.y, + extendRange(fullRange, [ + counterAxis._offset, + counterAxis._offset + counterAxis._length + ]); + } - z: { - valType: 'data_array', - editType: 'calc', - - }, - marker: { - color: { - valType: 'data_array', - editType: 'calc', - - }, - editType: 'calc' - }, + if(ax.anchor === 'free') { + extendRange(fullRange, (axLetter === 'x') ? + [ax._boundingBox.bottom, ax._boundingBox.top] : + [ax._boundingBox.right, ax._boundingBox.left]); + } + } + } - histnorm: histogramAttrs.histnorm, - histfunc: histogramAttrs.histfunc, - nbinsx: histogramAttrs.nbinsx, - xbins: makeBinAttrs('x'), - nbinsy: histogramAttrs.nbinsy, - ybins: makeBinAttrs('y'), - autobinx: histogramAttrs.autobinx, - autobiny: histogramAttrs.autobiny, - - xgap: heatmapAttrs.xgap, - ygap: heatmapAttrs.ygap, - zsmooth: heatmapAttrs.zsmooth, - zhoverformat: heatmapAttrs.zhoverformat - }, - colorscaleAttrs('', { - cLetter: 'z', - autoColorDflt: false - }), - { colorbar: colorbarAttrs } -); + var hasRangeSlider = Registry.getComponentMethod('rangeslider', 'isVisible')(ax); -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../heatmap/attributes":945,"../histogram/attributes":964,"../histogram/bin_attributes":966}],977:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + function doAutoMargins() { + var s = ax.side.charAt(0); + var push; + var rangeSliderPush; + if(hasRangeSlider) { + rangeSliderPush = Registry.getComponentMethod('rangeslider', 'autoMarginOpts')(gd, ax); + } + Plots.autoMargin(gd, rangeSliderAutoMarginID(ax), rangeSliderPush); -'use strict'; + if(ax.automargin && (!hasRangeSlider || s !== 'b')) { + push = {x: 0, y: 0, r: 0, l: 0, t: 0, b: 0}; -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); + var bbox = ax._boundingBox; + var counterAx = mainPlotinfo[counterLetter + 'axis']; + var anchorAxDomainIndex; + var offset; -var binFunctions = _dereq_('../histogram/bin_functions'); -var normFunctions = _dereq_('../histogram/norm_functions'); -var doAvg = _dereq_('../histogram/average'); -var getBinSpanLabelRound = _dereq_('../histogram/bin_label_vals'); + switch(axLetter + s) { + case 'xb': + anchorAxDomainIndex = 0; + offset = bbox.top - counterAx._length - counterAx._offset; + push[s] = bbox.height; + break; + case 'xt': + anchorAxDomainIndex = 1; + offset = counterAx._offset - bbox.bottom; + push[s] = bbox.height; + break; + case 'yl': + anchorAxDomainIndex = 0; + offset = counterAx._offset - bbox.right; + push[s] = bbox.width; + break; + case 'yr': + anchorAxDomainIndex = 1; + offset = bbox.left - counterAx._length - counterAx._offset; + push[s] = bbox.width; + break; + } + push[counterLetter] = ax.anchor === 'free' ? + ax.position : + ax._anchorAxis.domain[anchorAxDomainIndex]; -module.exports = function calc(gd, trace) { - var xa = Axes.getFromId(gd, trace.xaxis || 'x'); - var x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var y = trace.y ? ya.makeCalcdata(trace, 'y') : []; - var xcalendar = trace.xcalendar; - var ycalendar = trace.ycalendar; - var xr2c = function(v) { return xa.r2c(v, 0, xcalendar); }; - var yr2c = function(v) { return ya.r2c(v, 0, ycalendar); }; - var xc2r = function(v) { return xa.c2r(v, 0, xcalendar); }; - var yc2r = function(v) { return ya.c2r(v, 0, ycalendar); }; + if(push[s] > 0) { + push[s] += offset; + } + if(ax.title.text !== fullLayout._dfltTitle[axLetter]) { + push[s] += ax.title.font.size; + } + } - var i, j, n, m; + Plots.autoMargin(gd, axAutoMarginID(ax), push); + } - var serieslen = trace._length; - if(x.length > serieslen) x.splice(serieslen, x.length - serieslen); - if(y.length > serieslen) y.splice(serieslen, y.length - serieslen); + seq.push(calcBoundingBox, doAutoMargins); - // calculate the bins - doAutoBin(trace, 'x', x, xa, xr2c, xc2r, xcalendar); - doAutoBin(trace, 'y', y, ya, yr2c, yc2r, ycalendar); - - // make the empty bin array & scale the map - var z = []; - var onecol = []; - var zerocol = []; - var nonuniformBinsX = (typeof(trace.xbins.size) === 'string'); - var nonuniformBinsY = (typeof(trace.ybins.size) === 'string'); - var xEdges = []; - var yEdges = []; - var xbins = nonuniformBinsX ? xEdges : trace.xbins; - var ybins = nonuniformBinsY ? yEdges : trace.ybins; - 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 = []; - - // set a binning function other than count? - // for binning functions: check first for 'z', - // then 'mc' in case we had a colored scatter plot - // and want to transfer these colors to the 2D histo - // TODO: axe this, make it the responsibility of the app changing type? or an impliedEdit? - 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]; - } - - // decrease end a little in case of rounding errors - var binSpec = trace.xbins, - binStart = xr2c(binSpec.start), - binEnd = xr2c(binSpec.end) + - (binStart - Axes.tickIncrement(binStart, binSpec.size, false, xcalendar)) / 1e6; - - for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binSpec.size, false, xcalendar)) { - onecol.push(sizeinit); - xEdges.push(i); - if(doavg) zerocol.push(0); - } - xEdges.push(i); - - var nx = onecol.length; - var x0c = xr2c(trace.xbins.start); - var dx = (i - x0c) / nx; - var x0 = xc2r(x0c + dx / 2); - - binSpec = trace.ybins; - binStart = yr2c(binSpec.start); - binEnd = yr2c(binSpec.end) + - (binStart - Axes.tickIncrement(binStart, binSpec.size, false, ycalendar)) / 1e6; - - for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binSpec.size, 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 y0c = yr2c(trace.ybins.start); - var dy = (i - y0c) / ny; - var y0 = yc2r(y0c + dy / 2); - - if(densitynorm) { - xinc = makeIncrements(onecol.length, xbins, dx, nonuniformBinsX); - yinc = makeIncrements(z.length, ybins, dy, nonuniformBinsY); - } - - // for date axes we need bin bounds to be calcdata. For nonuniform bins - // we already have this, but uniform with start/end/size they're still strings. - if(!nonuniformBinsX && xa.type === 'date') xbins = binsToCalc(xr2c, xbins); - if(!nonuniformBinsY && ya.type === 'date') ybins = binsToCalc(yr2c, ybins); - - // put data into bins - 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 xi = x[i]; - var yi = y[i]; - n = Lib.findBin(xi, xbins); - m = Lib.findBin(yi, 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] === undefined) xVals[n] = xi; - else if(xVals[n] !== xi) uniqueValsPerX = false; - } - if(uniqueValsPerY) { - if(yVals[n] === undefined) yVals[n] = yi; - else if(yVals[n] !== yi) uniqueValsPerY = false; - } - - xGapLow = Math.min(xGapLow, xi - xEdges[n]); - xGapHigh = Math.min(xGapHigh, xEdges[n + 1] - xi); - yGapLow = Math.min(yGapLow, yi - yEdges[m]); - yGapHigh = Math.min(yGapHigh, yEdges[m + 1] - yi); - } - } - // normalize, if needed - 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]); + if(!opts.skipTitle && + !(hasRangeSlider && ax._boundingBox && ax.side === 'bottom') + ) { + seq.push(function() { return drawTitle(gd, ax); }); } - return { - x: x, - xRanges: getRanges(xEdges, uniqueValsPerX && xVals, xGapLow, xGapHigh, xa, xcalendar), - x0: x0, - dx: dx, - y: y, - yRanges: getRanges(yEdges, uniqueValsPerY && yVals, yGapLow, yGapHigh, ya, ycalendar), - y0: y0, - dy: dy, - z: z, - pts: inputPoints - }; + return Lib.syncOrAsync(seq); }; -function doAutoBin(trace, axLetter, data, ax, r2c, c2r, calendar) { - var binAttr = axLetter + 'bins'; - var binSpec = trace[binAttr]; - if(!binSpec) binSpec = trace[binAttr] = {}; - var inputBinSpec = trace._input[binAttr] || {}; - var autoBin = trace._autoBin = {}; - - // clear out any previously added autobin info - if(!inputBinSpec.size) delete binSpec.size; - if(inputBinSpec.start === undefined) delete binSpec.start; - if(inputBinSpec.end === undefined) delete binSpec.end; - - var autoSize = !binSpec.size; - var autoStart = binSpec.start === undefined; - var autoEnd = binSpec.end === undefined; - - if(autoSize || autoStart || autoEnd) { - var newBinSpec = Axes.autoBin(data, ax, trace['nbins' + axLetter], '2d', calendar, binSpec.size); - if(trace.type === 'histogram2dcontour') { - // the "true" 2nd argument reverses the tick direction (which we can't - // just do with a minus sign because of month bins) - if(autoStart) { - newBinSpec.start = c2r(Axes.tickIncrement( - r2c(newBinSpec.start), newBinSpec.size, true, calendar)); - } - if(autoEnd) { - newBinSpec.end = c2r(Axes.tickIncrement( - r2c(newBinSpec.end), newBinSpec.size, false, calendar)); - } - } - if(autoSize) binSpec.size = autoBin.size = newBinSpec.size; - if(autoStart) binSpec.start = autoBin.start = newBinSpec.start; - if(autoEnd) binSpec.end = autoBin.end = newBinSpec.end; - } - - // Backward compatibility for one-time autobinning. - // autobin: true is handled in cleanData, but autobin: false - // needs to be here where we have determined the values. - var autoBinAttr = 'autobin' + axLetter; - if(trace._input[autoBinAttr] === false) { - trace._input[binAttr] = Lib.extendFlat({}, binSpec); - delete trace._input[autoBinAttr]; - delete trace[autoBinAttr]; - } -} - -function makeIncrements(len, bins, dv, nonuniform) { - var out = new Array(len); +function getBoundaryVals(ax, vals) { + var out = []; var i; - if(nonuniform) { - for(i = 0; i < len; i++) out[i] = 1 / (bins[i + 1] - bins[i]); - } - else { - var inc = 1 / dv; - 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 + // boundaryVals are never used for labels; + // no need to worry about the other tickTextObj keys + var _push = function(d, bndIndex) { + var xb = d.xbnd[bndIndex]; + if(xb !== null) { + out.push(Lib.extendFlat({}, d, {x: xb})); + } }; -} -function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) { - var i; - var len = edges.length - 1; - var out = new Array(len); - if(uniqueVals) { - for(i = 0; i < len; i++) out[i] = [uniqueVals[i], uniqueVals[i]]; - } - else { - var roundFn = getBinSpanLabelRound(gapLow, gapHigh, edges, ax, calendar); - for(i = 0; i < len; i++) out[i] = [roundFn(edges[i]), roundFn(edges[i + 1], true)]; + if(vals.length) { + for(i = 0; i < vals.length; i++) { + _push(vals[i], 0); + } + _push(vals[i - 1], 1); } + return out; } -},{"../../lib":696,"../../plots/cartesian/axes":744,"../histogram/average":965,"../histogram/bin_functions":967,"../histogram/bin_label_vals":968,"../histogram/norm_functions":975}],978:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - - -var isNumeric = _dereq_('fast-isnumeric'); - -var BADNUM = _dereq_('../../constants/numerical').BADNUM; -var axisIds = _dereq_('../../plots/cartesian/axis_ids'); -var Lib = _dereq_('../../lib'); - -var attributes = _dereq_('./attributes'); - -var BINDIRECTIONS = ['x', 'y']; - -// Handle bin attrs and relink auto-determined values so fullData is complete -// does not have cross-trace coupling, but moved out here so we have axis types -// and relinked trace._autoBin -module.exports = function crossTraceDefaults(fullData, fullLayout) { - var i, j, traceOut, binDirection; +function getSecondaryLabelVals(ax, vals) { + var out = []; + var lookup = {}; - function coerce(attr) { - return Lib.coerce(traceOut._input, traceOut, attributes, attr); + for(var i = 0; i < vals.length; i++) { + var d = vals[i]; + if(lookup[d.text2]) { + lookup[d.text2].push(d.x); + } else { + lookup[d.text2] = [d.x]; + } } - for(i = 0; i < fullData.length; i++) { - traceOut = fullData[i]; - var type = traceOut.type; - if(type !== 'histogram2d' && type !== 'histogram2dcontour') continue; + for(var k in lookup) { + out.push(tickTextObj(ax, Lib.interp(lookup[k], 0.5), k)); + } - for(j = 0; j < BINDIRECTIONS.length; j++) { - binDirection = BINDIRECTIONS[j]; - var binAttr = binDirection + 'bins'; - var autoBins = (traceOut._autoBin || {})[binDirection] || {}; - coerce(binAttr + '.start', autoBins.start); - coerce(binAttr + '.end', autoBins.end); - coerce(binAttr + '.size', autoBins.size); + return out; +} - cleanBins(traceOut, binDirection, fullLayout, autoBins); +function getDividerVals(ax, vals) { + var out = []; + var i, current; - if(!(traceOut[binAttr] || {}).size) coerce('nbins' + binDirection); + // never used for labels; + // no need to worry about the other tickTextObj keys + var _push = function(d, bndIndex) { + var xb = d.xbnd[bndIndex]; + if(xb !== null) { + out.push(Lib.extendFlat({}, d, {x: xb})); } - } -}; - -function cleanBins(trace, binDirection, fullLayout, autoBins) { - var ax = fullLayout[axisIds.id2name(trace[binDirection + 'axis'])]; - var axType = ax.type; - var binAttr = binDirection + 'bins'; - var bins = trace[binAttr]; - var calendar = trace[binDirection + 'calendar']; - - if(!bins) bins = trace[binAttr] = {}; - - var cleanBound = (axType === 'date') ? - function(v, dflt) { return (v || v === 0) ? Lib.cleanDate(v, BADNUM, calendar) : dflt; } : - function(v, dflt) { return isNumeric(v) ? Number(v) : dflt; }; - - bins.start = cleanBound(bins.start, autoBins.start); - bins.end = cleanBound(bins.end, autoBins.end); - - // logic for bin size is very similar to dtick (cartesian/tick_value_defaults) - // but without the extra string options for log axes - // ie the only strings we accept are M for months - var sizeDflt = autoBins.size; - var binSize = bins.size; + }; - if(isNumeric(binSize)) { - bins.size = (binSize > 0) ? Number(binSize) : sizeDflt; - } - else if(typeof binSize !== 'string') { - bins.size = sizeDflt; - } - else { - // date special case: "M" gives bins every (integer) n months - var prefix = binSize.charAt(0); - var sizeNum = binSize.substr(1); - - sizeNum = isNumeric(sizeNum) ? Number(sizeNum) : 0; - if((sizeNum <= 0) || !( - axType === 'date' && prefix === 'M' && sizeNum === Math.round(sizeNum) - )) { - bins.size = sizeDflt; + if(ax.showdividers && vals.length) { + for(i = 0; i < vals.length; i++) { + var d = vals[i]; + if(d.text2 !== current) { + _push(d, 0); + } + current = d.text2; } + _push(vals[i - 1], 1); } -} - -},{"../../constants/numerical":673,"../../lib":696,"../../plots/cartesian/axis_ids":747,"./attributes":976,"fast-isnumeric":214}],979:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return out; +} -'use strict'; +function getLabelLevelSpan(ax, cls) { + var axLetter = ax._id.charAt(0); + var angle = ax._tickAngles[cls] || 0; + var rad = Lib.deg2rad(angle); + var sinA = Math.sin(rad); + var cosA = Math.cos(rad); + var maxX = 0; + var maxY = 0; -var Lib = _dereq_('../../lib'); + // N.B. Drawing.bBox does not take into account rotate transforms -var handleSampleDefaults = _dereq_('./sample_defaults'); -var handleStyleDefaults = _dereq_('../heatmap/style_defaults'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); + ax._selections[cls].each(function() { + var thisLabel = selectTickLabel(this); + var bb = Drawing.bBox(thisLabel.node()); + var w = bb.width; + var h = bb.height; + maxX = Math.max(maxX, cosA * w, sinA * h); + maxY = Math.max(maxY, sinA * w, cosA * h); + }); + return {x: maxY, y: maxX}[axLetter]; +} -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); +/** + * Which direction do the 'ax.side' values, and free ticks go? + * + * @param {object} ax (full) axis object + * - {string} _id (starting with 'x' or 'y') + * - {string} side + * - {string} ticks + * @return {array} all entries are either -1 or 1 + * - [0]: sign for top/right ticks (i.e. negative SVG direction) + * - [1]: sign for bottom/left ticks (i.e. positive SVG direction) + * - [2]: sign for ticks corresponding to 'ax.side' + * - [3]: sign for ticks mirroring 'ax.side' + */ +axes.getTickSigns = function(ax) { + 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]; + // then we flip if outside XOR y axis + if((ax.ticks !== 'inside') === (axLetter === 'x')) { + out = out.map(function(v) { return -v; }); } - - handleSampleDefaults(traceIn, traceOut, coerce, layout); - if(traceOut.visible === false) return; - - handleStyleDefaults(traceIn, traceOut, coerce, layout); - colorscaleDefaults( - traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} - ); + return out; }; -},{"../../components/colorscale/defaults":580,"../../lib":696,"../heatmap/style_defaults":959,"./attributes":976,"./sample_defaults":982}],980:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var heatmapHover = _dereq_('../heatmap/hover'); -var hoverLabelText = _dereq_('../../plots/cartesian/axes').hoverLabelText; - -module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer, contour) { - var pts = heatmapHover(pointData, xval, yval, hovermode, hoverLayer, contour); - - if(!pts) return; - - pointData = pts[0]; - var indices = pointData.index; - var ny = indices[0]; - var nx = indices[1]; - var cd0 = pointData.cd[0]; - var xRange = cd0.xRanges[nx]; - var yRange = cd0.yRanges[ny]; - - pointData.xLabel = hoverLabelText(pointData.xa, xRange[0], xRange[1]); - pointData.yLabel = hoverLabelText(pointData.ya, yRange[0], yRange[1]); - - return pts; + * Make axis translate transform function + * + * @param {object} ax (full) axis object + * - {string} _id + * - {number} _offset + * - {fn} l2p + * @return {fn} function of calcTicks items + */ +axes.makeTransFn = function(ax) { + var axLetter = ax._id.charAt(0); + var offset = ax._offset; + return axLetter === 'x' ? + function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : + function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; }; -},{"../../plots/cartesian/axes":744,"../heatmap/hover":952}],981:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Histogram2D = {}; + * Make axis tick path string + * + * @param {object} ax (full) axis object + * - {string} _id + * - {number} ticklen + * - {number} linewidth + * @param {number} shift along direction of ticklen + * @param {1 or -1} sng tick sign + * @param {number (optional)} len tick length + * @return {string} + */ +axes.makeTickPath = function(ax, shift, sgn, len) { + len = len !== undefined ? len : ax.ticklen; -Histogram2D.attributes = _dereq_('./attributes'); -Histogram2D.supplyDefaults = _dereq_('./defaults'); -Histogram2D.crossTraceDefaults = _dereq_('./cross_trace_defaults'); -Histogram2D.calc = _dereq_('../heatmap/calc'); -Histogram2D.plot = _dereq_('../heatmap/plot'); -Histogram2D.layerName = 'heatmaplayer'; -Histogram2D.colorbar = _dereq_('../heatmap/colorbar'); -Histogram2D.style = _dereq_('../heatmap/style'); -Histogram2D.hoverPoints = _dereq_('./hover'); -Histogram2D.eventData = _dereq_('../histogram/event_data'); + var axLetter = ax._id.charAt(0); + var pad = (ax.linewidth || 1) / 2; -Histogram2D.moduleType = 'trace'; -Histogram2D.name = 'histogram2d'; -Histogram2D.basePlotModule = _dereq_('../../plots/cartesian'); -Histogram2D.categories = ['cartesian', 'svg', '2dMap', 'histogram']; -Histogram2D.meta = { - - + return axLetter === 'x' ? + 'M0,' + (shift + pad * sgn) + 'v' + (len * sgn) : + 'M' + (shift + pad * sgn) + ',0h' + (len * sgn); }; -module.exports = Histogram2D; - -},{"../../plots/cartesian":756,"../heatmap/calc":946,"../heatmap/colorbar":948,"../heatmap/plot":957,"../heatmap/style":958,"../histogram/event_data":972,"./attributes":976,"./cross_trace_defaults":978,"./defaults":979,"./hover":980}],982:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Registry = _dereq_('../../registry'); + * Make axis tick label x, y and anchor functions + * + * @param {object} ax (full) axis object + * - {string} _id + * - {string} ticks + * - {number} ticklen + * - {string} side + * - {number} linewidth + * - {number} tickfont.size + * - {boolean} showline + * @param {number} shift + * @param {number} angle [in degrees] ... + * @return {object} + * - {fn} labelXFn + * - {fn} labelYFn + * - {fn} labelAnchorFn + * - {number} labelStandoff + * - {number} labelShift + */ +axes.makeLabelFns = function(ax, shift, angle) { + var axLetter = ax._id.charAt(0); + var pad = (ax.linewidth || 1) / 2; + var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; -module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout) { - var x = coerce('x'); - var y = coerce('y'); + var labelStandoff = ticksOnOutsideLabels ? ax.ticklen : 0; + var labelShift = 0; - // we could try to accept x0 and dx, etc... - // but that's a pretty weird use case. - // for now require both x and y explicitly specified. - if(!(x && x.length && y && y.length)) { - traceOut.visible = false; - return; + if(angle && ax.ticks === 'outside') { + var rad = Lib.deg2rad(angle); + labelStandoff = ax.ticklen * Math.cos(rad) + 1; + labelShift = ax.ticklen * Math.sin(rad); } - traceOut._length = Math.min(x.length, y.length); - - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); + if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + labelStandoff += 0.2 * ax.tickfont.size; + } - // if marker.color is an array, we can use it in aggregation instead of z - var hasAggregationData = coerce('z') || coerce('marker.color'); + // Used in polar angular label x/y functions + // TODO generalize makeLabelFns so that it just work for angular axes + var out = { + labelStandoff: labelStandoff, + labelShift: labelShift + }; - if(hasAggregationData) coerce('histfunc'); - coerce('histnorm'); + var x0, y0, ff, flipIt; + if(axLetter === 'x') { + flipIt = ax.side === 'bottom' ? 1 : -1; + x0 = labelShift * flipIt; + y0 = shift + (labelStandoff + pad) * flipIt; + ff = ax.side === 'bottom' ? 1 : -0.2; + + out.labelXFn = function(d) { return d.dx + x0; }; + out.labelYFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; + out.labelAnchorFn = function(a) { + if(!isNumeric(a) || a === 0 || a === 180) { + return 'middle'; + } + return (a * flipIt < 0) ? 'end' : 'start'; + }; + } else if(axLetter === 'y') { + flipIt = ax.side === 'right' ? 1 : -1; + x0 = labelStandoff + pad; + y0 = -labelShift * flipIt; + ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + + out.labelXFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.labelYFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; + out.labelAnchorFn = function(a) { + if(isNumeric(a) && Math.abs(a) === 90) { + return 'middle'; + } + return ax.side === 'right' ? 'start' : 'end'; + }; + } - // Note: bin defaults are now handled in Histogram2D.crossTraceDefaults - // autobin(x|y) are only included here to appease Plotly.validate - coerce('autobinx'); - coerce('autobiny'); + return out; }; -},{"../../registry":827}],983:[function(_dereq_,module,exports){ +function tickDataFn(d) { + return [d.text, d.x, d.axInfo, d.font, d.fontSize, d.fontColor].join('_'); +} + /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Draw axis ticks + * + * @param {DOM element} gd + * @param {object} ax (full) axis object + * - {string} _id + * - {string} ticks + * - {number} linewidth + * - {string} tickcolor + * @param {object} opts + * - {array of object} vals (calcTicks output-like) + * - {d3 selection} layer + * - {string or fn} path + * - {fn} transFn + * - {boolean} crisp (set to false to unset crisp-edge SVG rendering) + */ +axes.drawTicks = function(gd, ax, opts) { + opts = opts || {}; -'use strict'; + var cls = ax._id + 'tick'; -var histogram2dAttrs = _dereq_('../histogram2d/attributes'); -var contourAttrs = _dereq_('../contour/attributes'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); + var ticks = opts.layer.selectAll('path.' + cls) + .data(ax.ticks ? opts.vals : [], tickDataFn); -var extendFlat = _dereq_('../../lib/extend').extendFlat; + ticks.exit().remove(); -module.exports = extendFlat({ - x: histogram2dAttrs.x, - y: histogram2dAttrs.y, - z: histogram2dAttrs.z, - marker: histogram2dAttrs.marker, - - histnorm: histogram2dAttrs.histnorm, - histfunc: histogram2dAttrs.histfunc, - nbinsx: histogram2dAttrs.nbinsx, - xbins: histogram2dAttrs.xbins, - nbinsy: histogram2dAttrs.nbinsy, - ybins: histogram2dAttrs.ybins, - autobinx: histogram2dAttrs.autobinx, - autobiny: histogram2dAttrs.autobiny, - - autocontour: contourAttrs.autocontour, - ncontours: contourAttrs.ncontours, - contours: contourAttrs.contours, - line: contourAttrs.line, - zhoverformat: histogram2dAttrs.zhoverformat -}, - colorscaleAttrs('', { - cLetter: 'z', - editTypeOverride: 'calc' - }), - { colorbar: colorbarAttrs } -); + ticks.enter().append('path') + .classed(cls, 1) + .classed('ticks', 1) + .classed('crisp', opts.crisp !== false) + .call(Color.stroke, ax.tickcolor) + .style('stroke-width', Drawing.crispRound(gd, ax.tickwidth, 1) + 'px') + .attr('d', opts.path); + + ticks.attr('transform', opts.transFn); +}; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../contour/attributes":916,"../histogram2d/attributes":976}],984:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Draw axis grid + * + * @param {DOM element} gd + * @param {object} ax (full) axis object + * - {string} _id + * - {boolean} showgrid + * - {string} gridcolor + * - {string} gridwidth + * - {boolean} zeroline + * - {string} type + * - {string} dtick + * @param {object} opts + * - {array of object} vals (calcTicks output-like) + * - {d3 selection} layer + * - {object} counterAxis (full axis object corresponding to counter axis) + * optional - only required if this axis supports zero lines + * - {string or fn} path + * - {fn} transFn + * - {boolean} crisp (set to false to unset crisp-edge SVG rendering) + */ +axes.drawGrid = function(gd, ax, opts) { + opts = opts || {}; + var cls = ax._id + 'grid'; + var vals = opts.vals; + var counterAx = opts.counterAxis; + if(ax.showgrid === false) { + vals = []; + } + else if(counterAx && axes.shouldShowZeroLine(gd, ax, counterAx)) { + var isArrayMode = ax.tickmode === 'array'; + for(var i = 0; i < vals.length; i++) { + var xi = vals[i].x; + if(isArrayMode ? !xi : (Math.abs(xi) < ax.dtick / 100)) { + vals = vals.slice(0, i).concat(vals.slice(i + 1)); + // In array mode you can in principle have multiple + // ticks at 0, so test them all. Otherwise once we found + // one we can stop. + if(isArrayMode) i--; + else break; + } + } + } -'use strict'; + var grid = opts.layer.selectAll('path.' + cls) + .data(vals, tickDataFn); -var Lib = _dereq_('../../lib'); + grid.exit().remove(); -var handleSampleDefaults = _dereq_('../histogram2d/sample_defaults'); -var handleContoursDefaults = _dereq_('../contour/contours_defaults'); -var handleStyleDefaults = _dereq_('../contour/style_defaults'); -var attributes = _dereq_('./attributes'); + grid.enter().append('path') + .classed(cls, 1) + .classed('crisp', opts.crisp !== false); + ax._gw = Drawing.crispRound(gd, ax.gridwidth, 1); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } + grid.attr('transform', opts.transFn) + .attr('d', opts.path) + .call(Color.stroke, ax.gridcolor || '#ddd') + .style('stroke-width', ax._gw + 'px'); - function coerce2(attr) { - return Lib.coerce2(traceIn, traceOut, attributes, attr); - } + if(typeof opts.path === 'function') grid.attr('d', opts.path); +}; - handleSampleDefaults(traceIn, traceOut, coerce, layout); - if(traceOut.visible === false) return; +/** + * Draw axis zero-line + * + * @param {DOM element} gd + * @param {object} ax (full) axis object + * - {string} _id + * - {boolean} zeroline + * - {number} zerolinewidth + * - {string} zerolinecolor + * - {number (optional)} _gridWidthCrispRound + * @param {object} opts + * - {d3 selection} layer + * - {object} counterAxis (full axis object corresponding to counter axis) + * - {string or fn} path + * - {fn} transFn + * - {boolean} crisp (set to false to unset crisp-edge SVG rendering) + */ +axes.drawZeroLine = function(gd, ax, opts) { + opts = opts || opts; + + var cls = ax._id + 'zl'; + var show = axes.shouldShowZeroLine(gd, ax, opts.counterAxis); + + var zl = opts.layer.selectAll('path.' + cls) + .data(show ? [{x: 0, id: ax._id}] : []); + + zl.exit().remove(); + + zl.enter().append('path') + .classed(cls, 1) + .classed('zl', 1) + .classed('crisp', opts.crisp !== false) + .each(function() { + // use the fact that only one element can enter to trigger a sort. + // If several zerolines enter at the same time we will sort once per, + // but generally this should be a minimal overhead. + opts.layer.selectAll('path').sort(function(da, db) { + return axisIds.idSort(da.id, db.id); + }); + }); - handleContoursDefaults(traceIn, traceOut, coerce, coerce2); - handleStyleDefaults(traceIn, traceOut, coerce, layout); + zl.attr('transform', opts.transFn) + .attr('d', opts.path) + .call(Color.stroke, ax.zerolinecolor || Color.defaultLine) + .style('stroke-width', Drawing.crispRound(gd, ax.zerolinewidth, ax._gw || 1) + 'px'); }; -},{"../../lib":696,"../contour/contours_defaults":923,"../contour/style_defaults":937,"../histogram2d/sample_defaults":982,"./attributes":983}],985:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Draw axis tick labels + * + * @param {DOM element} gd + * @param {object} ax (full) axis object + * - {string} _id + * - {boolean} showticklabels + * - {number} tickangle + * - {object (optional)} _selections + * - {object} (optional)} _tickAngles + * @param {object} opts + * - {array of object} vals (calcTicks output-like) + * - {d3 selection} layer + * - {string (optional)} cls (node className) + * - {boolean} repositionOnUpdate (set to true to reposition update selection) + * - {boolean} secondary + * - {fn} transFn + * - {fn} labelXFn + * - {fn} labelYFn + * - {fn} labelAnchorFn + */ +axes.drawLabels = function(gd, ax, opts) { + opts = opts || {}; + var axId = ax._id; + var axLetter = axId.charAt(0); + var cls = opts.cls || axId + 'tick'; + var vals = opts.vals; + var labelXFn = opts.labelXFn; + var labelYFn = opts.labelYFn; + var labelAnchorFn = opts.labelAnchorFn; + var tickAngle = opts.secondary ? 0 : ax.tickangle; + var lastAngle = (ax._tickAngles || {})[cls]; -'use strict'; + var tickLabels = opts.layer.selectAll('g.' + cls) + .data(ax.showticklabels ? vals : [], tickDataFn); -var Histogram2dContour = {}; + var labelsReady = []; -Histogram2dContour.attributes = _dereq_('./attributes'); -Histogram2dContour.supplyDefaults = _dereq_('./defaults'); -Histogram2dContour.crossTraceDefaults = _dereq_('../histogram2d/cross_trace_defaults'); -Histogram2dContour.calc = _dereq_('../contour/calc'); -Histogram2dContour.plot = _dereq_('../contour/plot').plot; -Histogram2dContour.layerName = 'contourlayer'; -Histogram2dContour.style = _dereq_('../contour/style'); -Histogram2dContour.colorbar = _dereq_('../contour/colorbar'); -Histogram2dContour.hoverPoints = _dereq_('../contour/hover'); + tickLabels.enter().append('g') + .classed(cls, 1) + .append('text') + // only so tex has predictable alignment that we can + // alter later + .attr('text-anchor', 'middle') + .each(function(d) { + var thisLabel = d3.select(this); + var newPromise = gd._promises.length; -Histogram2dContour.moduleType = 'trace'; -Histogram2dContour.name = 'histogram2dcontour'; -Histogram2dContour.basePlotModule = _dereq_('../../plots/cartesian'); -Histogram2dContour.categories = ['cartesian', 'svg', '2dMap', 'contour', 'histogram', 'showLegend']; -Histogram2dContour.meta = { - - -}; + thisLabel + .call(svgTextUtils.positionText, labelXFn(d), labelYFn(d)) + .call(Drawing.font, d.font, d.fontSize, d.fontColor) + .text(d.text) + .call(svgTextUtils.convertToTspans, gd); + + if(gd._promises[newPromise]) { + // if we have an async label, we'll deal with that + // all here so take it out of gd._promises and + // instead position the label and promise this in + // labelsReady + labelsReady.push(gd._promises.pop().then(function() { + positionLabels(thisLabel, tickAngle); + })); + } else { + // sync label: just position it now. + positionLabels(thisLabel, tickAngle); + } + }); -module.exports = Histogram2dContour; + tickLabels.exit().remove(); -},{"../../plots/cartesian":756,"../contour/calc":917,"../contour/colorbar":919,"../contour/hover":929,"../contour/plot":934,"../contour/style":936,"../histogram2d/cross_trace_defaults":978,"./attributes":983,"./defaults":984}],986:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(opts.repositionOnUpdate) { + tickLabels.each(function(d) { + d3.select(this).select('text') + .call(svgTextUtils.positionText, labelXFn(d), labelYFn(d)); + }); + } -'use strict'; + // How much to shift a multi-line label to center it vertically. + function getAnchorHeight(lineCount, lineHeight, angle) { + var h = (lineCount - 1) * lineHeight; + if(axLetter === 'x') { + if(angle < -60 || 60 < angle) { + return -0.5 * h; + } else if(ax.side === 'top') { + return -h; + } + } else { + angle *= ax.side === 'left' ? 1 : -1; + if(angle < -30) { + return -h; + } else if(angle < 30) { + return -0.5 * h; + } + } + return 0; + } -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var surfaceAtts = _dereq_('../surface/attributes'); -var baseAttrs = _dereq_('../../plots/attributes'); + function positionLabels(s, angle) { + s.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + var anchor = labelAnchorFn(angle, d); + + var transform = opts.transFn.call(thisLabel.node(), d) + + ((isNumeric(angle) && +angle !== 0) ? + (' rotate(' + angle + ',' + labelXFn(d) + ',' + + (labelYFn(d) - d.fontSize / 2) + ')') : + ''); + + var anchorHeight = getAnchorHeight( + svgTextUtils.lineCount(thisLabel), + LINE_SPACING * d.fontSize, + isNumeric(angle) ? +angle : 0 + ); -var extendFlat = _dereq_('../../lib/extend').extendFlat; + if(anchorHeight) { + transform += ' translate(0, ' + anchorHeight + ')'; + } -module.exports = extendFlat({ - x: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - y: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, - z: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, + if(mathjaxGroup.empty()) { + thisLabel.select('text').attr({ + transform: transform, + 'text-anchor': anchor + }); + } else { + var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; + var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; + mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + } + }); + } - i: { - valType: 'data_array', - editType: 'calc', - - }, - j: { - valType: 'data_array', - editType: 'calc', - + // make sure all labels are correctly positioned at their base angle + // the positionLabels call above is only for newly drawn labels. + // do this without waiting, using the last calculated angle to + // minimize flicker, then do it again when we know all labels are + // there, putting back the prescribed angle to check for overlaps. + positionLabels(tickLabels, lastAngle || tickAngle); - }, - k: { - valType: 'data_array', - editType: 'calc', - + function allLabelsReady() { + return labelsReady.length && Promise.all(labelsReady); + } - }, + function fixLabelOverlaps() { + positionLabels(tickLabels, tickAngle); - text: { - valType: 'string', - - dflt: '', - arrayOk: true, - editType: 'calc', - - }, + var autoangle = null; - delaunayaxis: { - valType: 'enumerated', - - values: [ 'x', 'y', 'z' ], - dflt: 'z', - editType: 'calc', - - }, + // check for auto-angling if x labels overlap + // don't auto-angle at all for log axes with + // base and digit format + if(vals.length && axLetter === 'x' && !isNumeric(tickAngle) && + (ax.type !== 'log' || String(ax.dtick).charAt(0) !== 'D') + ) { + autoangle = 0; - alphahull: { - valType: 'number', - - dflt: -1, - editType: 'calc', - - }, + var maxFontSize = 0; + var lbbArray = []; + var i; - intensity: { - valType: 'data_array', - editType: 'calc', - - }, + tickLabels.each(function(d) { + maxFontSize = Math.max(maxFontSize, d.fontSize); - // Color field - color: { - valType: 'color', - - editType: 'calc', - - }, - vertexcolor: { - valType: 'data_array', - - editType: 'calc', - - }, - facecolor: { - valType: 'data_array', - - editType: 'calc', - - }, - transforms: undefined -}, + var x = ax.l2p(d.x); + var thisLabel = selectTickLabel(this); + var bb = Drawing.bBox(thisLabel.node()); + + 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 + }); + }); + + if((ax.tickson === 'boundaries' || ax.showdividers) && !opts.secondary) { + var gap = 2; + if(ax.ticks) gap += ax.tickwidth / 2; + + // TODO should secondary labels also fall into this fix-overlap regime? + + 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 = 90; + break; + } + } + } else { + var vLen = vals.length; + var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; -colorscaleAttrs('', { - colorAttr: '`intensity`', - showScaleDflt: true, - editTypeOverride: 'calc' -}), { + // any overlap at all - set 30 degrees or 90 degrees + for(i = 0; i < lbbArray.length - 1; i++) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + autoangle = rotate90 ? 90 : 30; + break; + } + } + } - colorbar: colorbarAttrs, + if(autoangle) { + positionLabels(tickLabels, autoangle); + } + } - opacity: surfaceAtts.opacity, + if(ax._tickAngles) { + ax._tickAngles[cls] = autoangle === null ? + (isNumeric(tickAngle) ? tickAngle : 0) : + autoangle; + } + } - // Flat shaded mode - flatshading: { - valType: 'boolean', - - dflt: false, - editType: 'calc', - - }, + if(ax._selections) { + ax._selections[cls] = tickLabels; + } - contour: { - show: extendFlat({}, surfaceAtts.contours.x.show, { - - }), - color: surfaceAtts.contours.x.color, - width: surfaceAtts.contours.x.width, - editType: 'calc' - }, + var done = Lib.syncOrAsync([allLabelsReady, fixLabelOverlaps]); + if(done && done.then) gd._promises.push(done); + return done; +}; - lightposition: { - x: extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), - y: extendFlat({}, surfaceAtts.lightposition.y, {dflt: 1e5}), - z: extendFlat({}, surfaceAtts.lightposition.z, {dflt: 0}), - editType: 'calc' - }, - lighting: extendFlat({ - vertexnormalsepsilon: { - valType: 'number', - - min: 0.00, - max: 1, - dflt: 1e-12, // otherwise finely tessellated things eg. the brain will have no specular light reflection - editType: 'calc', - - }, - facenormalsepsilon: { - valType: 'number', - - min: 0.00, - max: 1, - dflt: 1e-6, // even the brain model doesn't appear to need finer than this - editType: 'calc', - - }, - editType: 'calc' - }, surfaceAtts.lighting), +/** + * Draw axis dividers + * + * @param {DOM element} gd + * @param {object} ax (full) axis object + * - {string} _id + * - {string} showdividers + * - {number} dividerwidth + * - {string} dividercolor + * @param {object} opts + * - {array of object} vals (calcTicks output-like) + * - {d3 selection} layer + * - {fn} path + * - {fn} transFn + */ +function drawDividers(gd, ax, opts) { + var cls = ax._id + 'divider'; + var vals = opts.vals; - hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {editType: 'calc'}) -}); + var dividers = opts.layer.selectAll('path.' + cls) + .data(vals, tickDataFn); -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/attributes":741,"../surface/attributes":1130}],987:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + dividers.exit().remove(); -'use strict'; + dividers.enter().insert('path', ':first-child') + .classed(cls, 1) + .classed('crisp', 1) + .call(Color.stroke, ax.dividercolor) + .style('stroke-width', Drawing.crispRound(gd, ax.dividerwidth, 1) + 'px'); -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); + dividers + .attr('transform', opts.transFn) + .attr('d', opts.path); +} -module.exports = function calc(gd, trace) { - if(trace.intensity) { - colorscaleCalc(trace, trace.intensity, '', 'c'); +function drawTitle(gd, ax) { + var fullLayout = gd._fullLayout; + var axId = ax._id; + var axLetter = axId.charAt(0); + var gs = fullLayout._size; + var fontSize = ax.title.font.size; + + var titleStandoff; + if(ax.type === 'multicategory') { + titleStandoff = ax._labelLength; + } else { + var offsetBase = 1.5; + titleStandoff = 10 + fontSize * offsetBase + (ax.linewidth ? ax.linewidth - 1 : 0); } -}; -},{"../../components/colorscale/calc":578}],988:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var transform, counterAxis, x, y; + if(axLetter === 'x') { + counterAxis = (ax.anchor === 'free') ? + {_offset: gs.t + (1 - (ax.position || 0)) * gs.h, _length: 0} : + axisIds.getFromId(gd, ax.anchor); -'use strict'; + x = ax._offset + ax._length / 2; -var createMesh = _dereq_('gl-mesh3d'); -var triangulate = _dereq_('delaunay-triangulate'); -var alphaShape = _dereq_('alpha-shape'); -var convexHull = _dereq_('convex-hull'); + if(ax.side === 'top') { + y = -titleStandoff - fontSize * (ax.showticklabels ? 1 : 0); + } else { + y = counterAxis._length + titleStandoff + + fontSize * (ax.showticklabels ? 1.5 : 0.5); + } + y += counterAxis._offset; + } else { + counterAxis = (ax.anchor === 'free') ? + {_offset: gs.l + (ax.position || 0) * gs.w, _length: 0} : + axisIds.getFromId(gd, ax.anchor); -var parseColorScale = _dereq_('../../lib/gl_format_color').parseColorScale; -var str2RgbaArray = _dereq_('../../lib/str2rgbarray'); -var zip3 = _dereq_('../../plots/gl3d/zip3'); + y = ax._offset + ax._length / 2; -function Mesh3DTrace(scene, mesh, uid) { - this.scene = scene; - this.uid = uid; - this.mesh = mesh; - this.name = ''; - this.color = '#fff'; - this.data = null; - this.showContour = false; -} + if(ax.side === 'right') { + x = counterAxis._length + titleStandoff + + fontSize * (ax.showticklabels ? 1 : 0.5); + } else { + x = -titleStandoff - fontSize * (ax.showticklabels ? 0.5 : 0); + } + x += counterAxis._offset; -var proto = Mesh3DTrace.prototype; + transform = {rotate: '-90', offset: 0}; + } -proto.handlePick = function(selection) { - if(selection.object === this.mesh) { - var selectIndex = selection.index = selection.data.index; + var avoid; - selection.traceCoordinate = [ - this.data.x[selectIndex], - this.data.y[selectIndex], - this.data.z[selectIndex] - ]; + if(ax.type !== 'multicategory') { + var tickLabels = ax._selections[ax._id + 'tick']; - var text = this.data.text; - if(Array.isArray(text) && text[selectIndex] !== undefined) { - selection.textLabel = text[selectIndex]; - } else if(text) { - selection.textLabel = text; - } + avoid = { + selection: tickLabels, + side: ax.side + }; - return true; + if(tickLabels && tickLabels.node() && tickLabels.node().parentNode) { + var translation = Drawing.getTranslate(tickLabels.node().parentNode); + avoid.offsetLeft = translation.x; + avoid.offsetTop = translation.y; + } } + + return Titles.draw(gd, axId + 'title', { + propContainer: ax, + propName: ax._name + '.title.text', + placeholder: fullLayout._dfltTitle[axLetter], + avoid: avoid, + transform: transform, + attributes: {x: x, y: y, 'text-anchor': 'middle'} + }); +} + +axes.shouldShowZeroLine = function(gd, ax, counterAxis) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + return ( + (rng[0] * rng[1] <= 0) && + ax.zeroline && + (ax.type === 'linear' || ax.type === '-') && + ax._gridVals.length && + ( + clipEnds(ax, 0) || + !anyCounterAxLineAtZero(gd, ax, counterAxis, rng) || + hasBarsOrFill(gd, ax) + ) + ); }; -function parseColorArray(colors) { - return colors.map(str2RgbaArray); +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); } -proto.update = function(data) { - var scene = this.scene, - layout = scene.fullSceneLayout; +function anyCounterAxLineAtZero(gd, ax, counterAxis, rng) { + var mainCounterAxis = counterAxis._mainAxis; + if(!mainCounterAxis) return; - this.data = data; + var fullLayout = gd._fullLayout; + var axLetter = ax._id.charAt(0); + var counterLetter = axes.counterLetter(ax._id); - // Unpack position data - function toDataCoords(axis, coord, scale, calendar) { - return coord.map(function(x) { - return axis.d2l(x, 0, calendar) * scale; - }); - } + var zeroPosition = ax._offset + ( + ((Math.abs(rng[0]) < Math.abs(rng[1])) === (axLetter === 'x')) ? + 0 : ax._length + ); - var positions = zip3( - toDataCoords(layout.xaxis, data.x, scene.dataScale[0], data.xcalendar), - toDataCoords(layout.yaxis, data.y, scene.dataScale[1], data.ycalendar), - toDataCoords(layout.zaxis, data.z, scene.dataScale[2], data.zcalendar)); + function lineNearZero(ax2) { + if(!ax2.showline || !ax2.linewidth) return false; + var tolerance = Math.max((ax2.linewidth + ax.zerolinewidth) / 2, 1); - var cells; - if(data.i && data.j && data.k) { - cells = zip3(data.i, data.j, data.k); - } - else if(data.alphahull === 0) { - cells = convexHull(positions); - } - else if(data.alphahull > 0) { - cells = alphaShape(data.alphahull, positions); - } - else { - var d = ['x', 'y', 'z'].indexOf(data.delaunayaxis); - cells = triangulate(positions.map(function(c) { - return [c[(d + 1) % 3], c[(d + 2) % 3]]; - })); + 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 config = { - positions: positions, - cells: cells, - lightPosition: [data.lightposition.x, data.lightposition.y, data.lightposition.z], - ambient: data.lighting.ambient, - diffuse: data.lighting.diffuse, - specular: data.lighting.specular, - roughness: data.lighting.roughness, - fresnel: data.lighting.fresnel, - vertexNormalsEpsilon: data.lighting.vertexnormalsepsilon, - faceNormalsEpsilon: data.lighting.facenormalsepsilon, - opacity: data.opacity, - contourEnable: data.contour.show, - contourColor: str2RgbaArray(data.contour.color).slice(0, 3), - contourWidth: data.contour.width, - useFacetNormals: data.flatshading - }; - - if(data.intensity) { - this.color = '#fff'; - config.vertexIntensity = data.intensity; - config.vertexIntensityBounds = [data.cmin, data.cmax]; - config.colormap = parseColorScale(data.colorscale); - } - else if(data.vertexcolor) { - this.color = data.vertexcolor[0]; - config.vertexColors = parseColorArray(data.vertexcolor); - } - else if(data.facecolor) { - this.color = data.facecolor[0]; - config.cellColors = parseColorArray(data.facecolor); + var plotinfo = fullLayout._plots[counterAxis._mainSubplot]; + if(!(plotinfo.mainplotinfo || plotinfo).overlays.length) { + return lineNearZero(counterAxis, zeroPosition); } - else { - this.color = data.color; - config.meshColor = str2RgbaArray(data.color); + + var counterLetterAxes = axes.list(gd, counterLetter); + for(var i = 0; i < counterLetterAxes.length; i++) { + var counterAxis2 = counterLetterAxes[i]; + if( + counterAxis2._mainAxis === mainCounterAxis && + lineNearZero(counterAxis2, zeroPosition) + ) { + return true; + } } +} - // Update mesh - this.mesh.update(config); -}; +function hasBarsOrFill(gd, ax) { + var fullData = gd._fullData; + var subplot = ax._mainSubplot; + var axLetter = ax._id.charAt(0); -proto.dispose = function() { - this.scene.glplot.remove(this.mesh); - this.mesh.dispose(); -}; + for(var i = 0; i < fullData.length; i++) { + var trace = fullData[i]; -function createMesh3DTrace(scene, data) { - var gl = scene.glplot.gl; - var mesh = createMesh({gl: gl}); - var result = new Mesh3DTrace(scene, mesh, data.uid); - mesh._trace = result; - result.update(data); - scene.glplot.add(mesh); - return result; + if(trace.visible === true && + (trace.xaxis + trace.yaxis) === subplot && + ( + Registry.traceIs(trace, 'bar') && trace.orientation === {x: 'h', y: 'v'}[axLetter] || + trace.fill && trace.fill.charAt(trace.fill.length - 1) === axLetter + ) + ) { + return true; + } + } + return false; } -module.exports = createMesh3DTrace; +function selectTickLabel(gTick) { + var s = d3.select(gTick); + var mj = s.select('.text-math-group'); + return mj.empty() ? s.select('text') : mj; +} -},{"../../lib/gl_format_color":692,"../../lib/str2rgbarray":719,"../../plots/gl3d/zip3":798,"alpha-shape":52,"convex-hull":118,"delaunay-triangulate":150,"gl-mesh3d":268}],989:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - + * Find all margin pushers for 2D axes and reserve them for later use + * Both label and rangeslider automargin calculations happen later so + * we need to explicitly allow their ids in order to not delete them. + * + * TODO: can we pull the actual automargin calls forward to avoid this hack? + * We're probably also doing multiple redraws in this case, would be faster + * if we can just do the whole calculation ahead of time and draw once. + */ +axes.allowAutoMargin = function(gd) { + var axList = axes.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + if(ax.automargin) { + Plots.allowAutoMargin(gd, axAutoMarginID(ax)); + } + if(Registry.getComponentMethod('rangeslider', 'isVisible')(ax)) { + Plots.allowAutoMargin(gd, rangeSliderAutoMarginID(ax)); + } + } +}; -'use strict'; +function axAutoMarginID(ax) { return ax._id + '.automargin'; } +function rangeSliderAutoMarginID(ax) { return ax._id + '.rangeslider'; } -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); +// swap all the presentation attributes of the axes showing these traces +axes.swap = function(gd, traces) { + var axGroups = makeAxisGroups(gd, traces); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + for(var i = 0; i < axGroups.length; i++) { + swapAxisGroup(gd, axGroups[i].x, axGroups[i].y); } +}; - // read in face/vertex properties - function readComponents(array) { - var ret = array.map(function(attr) { - var result = coerce(attr); +function makeAxisGroups(gd, traces) { + var groups = []; + var i, j; - if(result && Lib.isArrayOrTypedArray(result)) return result; - return null; - }); + for(i = 0; i < traces.length; i++) { + var groupsi = []; + var xi = gd._fullData[traces[i]].xaxis; + var yi = gd._fullData[traces[i]].yaxis; + if(!xi || !yi) continue; // not a 2D cartesian trace? + + for(j = 0; j < groups.length; j++) { + if(groups[j].x.indexOf(xi) !== -1 || groups[j].y.indexOf(yi) !== -1) { + groupsi.push(j); + } + } + + if(!groupsi.length) { + groups.push({x: [xi], y: [yi]}); + continue; + } - return ret.every(function(x) { - return x && x.length === ret[0].length; - }) && ret; + 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, [xi]); + mergeAxisGroups(group0.y, [yi]); } - var coords = readComponents(['x', 'y', 'z']); - var indices = readComponents(['i', 'j', 'k']); + return groups; +} - if(!coords) { - traceOut.visible = false; - return; +function mergeAxisGroups(intoSet, fromSet) { + for(var i = 0; i < fromSet.length; i++) { + if(intoSet.indexOf(fromSet[i]) === -1) intoSet.push(fromSet[i]); } +} - if(indices) { - // otherwise, convert all face indices to ints - indices.forEach(function(index) { - for(var i = 0; i < index.length; ++i) index[i] |= 0; - }); +function swapAxisGroup(gd, xIds, yIds) { + var xFullAxes = []; + var yFullAxes = []; + var layout = gd.layout; + var i, j; + + for(i = 0; i < xIds.length; i++) xFullAxes.push(axes.getFromId(gd, xIds[i])); + for(i = 0; i < yIds.length; i++) yFullAxes.push(axes.getFromId(gd, 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) { + // type is special - if we find a mixture of linear and log, + // coerce them all to linear on flipping + 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) { + // type is special - if we find a mixture of linear and log, + // coerce them all to linear on flipping + 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, gd._fullLayout._dfltTitle); + } } - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout); + // now swap x&y for any annotations anchored to these x & y + for(i = 0; i < gd._fullLayout.annotations.length; i++) { + var ann = gd._fullLayout.annotations[i]; + if(xIds.indexOf(ann.xref) !== -1 && + yIds.indexOf(ann.yref) !== -1) { + Lib.swapAttrs(layout.annotations[i], ['?']); + } + } +} - // Coerce remaining properties - [ - 'lighting.ambient', - 'lighting.diffuse', - 'lighting.specular', - 'lighting.roughness', - 'lighting.fresnel', - 'lighting.vertexnormalsepsilon', - 'lighting.facenormalsepsilon', - 'lightposition.x', - 'lightposition.y', - 'lightposition.z', - 'contour.show', - 'contour.color', - 'contour.width', - 'colorscale', - 'reversescale', - 'flatshading', - 'alphahull', - 'delaunayaxis', - 'opacity' - ].forEach(function(x) { coerce(x); }); - - if('intensity' in traceIn) { - coerce('intensity'); - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); - } else { - traceOut.showscale = false; +function swapAxisAttrs(layout, key, xFullAxes, yFullAxes, dfltTitle) { + // in case the value is the default for either axis, + // look at the first axis in each list and see if + // this key's value is undefined + var np = Lib.nestedProperty; + var xVal = np(layout[xFullAxes[0]._name], key).get(); + var yVal = np(layout[yFullAxes[0]._name], key).get(); + var i; - if('facecolor' in traceIn) coerce('facecolor'); - else if('vertexcolor' in traceIn) coerce('vertexcolor'); - else coerce('color', defaultColor); + if(key === 'title') { + // special handling of placeholder titles + if(xVal && xVal.text === dfltTitle.x) { + xVal.text = dfltTitle.y; + } + if(yVal && yVal.text === dfltTitle.y) { + yVal.text = dfltTitle.x; + } } - coerce('text'); + for(i = 0; i < xFullAxes.length; i++) { + np(layout, xFullAxes[i]._name + '.' + key).set(yVal); + } + for(i = 0; i < yFullAxes.length; i++) { + np(layout, yFullAxes[i]._name + '.' + key).set(xVal); + } +} - // disable 1D transforms - // x/y/z should match lengths, and i/j/k should match as well, but - // the two sets have different lengths so transforms wouldn't work. - traceOut._length = null; -}; +function isAngular(ax) { + return ax._id === 'angularaxis'; +} -},{"../../components/colorscale/defaults":580,"../../lib":696,"../../registry":827,"./attributes":986}],990:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/drawing":64,"../../components/titles":131,"../../constants/alignment":138,"../../constants/numerical":140,"../../lib":159,"../../lib/svg_text_utils":180,"../../plots/plots":236,"../../registry":243,"./autorange":202,"./axis_autotype":204,"./axis_ids":206,"./clean_ticks":208,"./layout_attributes":216,"./set_convert":222,"d3":8,"fast-isnumeric":10}],204:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152691,140 +52274,207 @@ 'use strict'; -var Mesh3D = {}; +var isNumeric = _dereq_('fast-isnumeric'); -Mesh3D.attributes = _dereq_('./attributes'); -Mesh3D.supplyDefaults = _dereq_('./defaults'); -Mesh3D.calc = _dereq_('./calc'); -Mesh3D.colorbar = { - min: 'cmin', - max: 'cmax' -}; -Mesh3D.plot = _dereq_('./convert'); +var Lib = _dereq_('../../lib'); +var BADNUM = _dereq_('../../constants/numerical').BADNUM; -Mesh3D.moduleType = 'trace'; -Mesh3D.name = 'mesh3d', -Mesh3D.basePlotModule = _dereq_('../../plots/gl3d'); -Mesh3D.categories = ['gl3d']; -Mesh3D.meta = { - +module.exports = function autoType(array, calendar, opts) { + opts = opts || {}; + + if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; + if(moreDates(array, calendar)) return 'date'; + if(category(array)) return 'category'; + if(linearOK(array)) return 'linear'; + else return '-'; }; -module.exports = Mesh3D; +// is there at least one number in array? If not, we should leave +// ax.type empty so it can be autoset later +function linearOK(array) { + if(!array) return false; + + for(var i = 0; i < array.length; i++) { + if(isNumeric(array[i])) return true; + } + + return false; +} + +// does the array a have mostly dates rather than numbers? +// note: some values can be neither (such as blanks, text) +// 2- or 4-digit integers can be both, so require twice as many +// dates as non-dates, to exclude cases with mostly 2 & 4 digit +// numbers and a few dates +// as with categories, consider DISTINCT values only. +function moreDates(a, calendar) { + // test at most 1000 points, evenly spaced + var inc = Math.max(1, (a.length - 1) / 1000); + var dcnt = 0; + var ncnt = 0; + var seen = {}; + + for(var i = 0; i < a.length; i += inc) { + var ai = a[Math.round(i)]; + var stri = String(ai); + if(seen[stri]) continue; + seen[stri] = 1; + + if(Lib.isDateTime(ai, calendar)) dcnt += 1; + if(isNumeric(ai)) ncnt += 1; + } + + return (dcnt > ncnt * 2); +} + +// are the (x,y)-values in gd.data mostly text? +// require twice as many DISTINCT categories as distinct numbers +function category(a) { + // test at most 1000 points + var inc = Math.max(1, (a.length - 1) / 1000); + var curvenums = 0; + var curvecats = 0; + var seen = {}; + + for(var i = 0; i < a.length; i += inc) { + var ai = a[Math.round(i)]; + var stri = String(ai); + if(seen[stri]) continue; + seen[stri] = 1; + + if(typeof ai === 'boolean') curvecats++; + else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; + else if(typeof ai === 'string') curvecats++; + } + + return curvecats > curvenums * 2; +} + +// very-loose requirements for multicategory, +// trace modules that should never auto-type to multicategory +// should be declared with 'noMultiCategory' +function multiCategory(a) { + return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); +} -},{"../../plots/gl3d":787,"./attributes":986,"./calc":987,"./convert":988,"./defaults":989}],991:[function(_dereq_,module,exports){ +},{"../../constants/numerical":140,"../../lib":159,"fast-isnumeric":10}],205:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var extendFlat = _dereq_('../../lib').extendFlat; -var scatterAttrs = _dereq_('../scatter/attributes'); -var dash = _dereq_('../../components/drawing/attributes').dash; -var fxAttrs = _dereq_('../../components/fx/attributes'); +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); -var INCREASING_COLOR = '#3D9970'; -var DECREASING_COLOR = '#FF4136'; +var layoutAttributes = _dereq_('./layout_attributes'); +var handleTickValueDefaults = _dereq_('./tick_value_defaults'); +var handleTickMarkDefaults = _dereq_('./tick_mark_defaults'); +var handleTickLabelDefaults = _dereq_('./tick_label_defaults'); +var handleCategoryOrderDefaults = _dereq_('./category_order_defaults'); +var handleLineGridDefaults = _dereq_('./line_grid_defaults'); +var setConvert = _dereq_('./set_convert'); -var lineAttrs = scatterAttrs.line; +/** + * options: object containing: + * + * letter: 'x' or 'y' + * title: name of the axis (ie 'Colorbar') to go in default title + * font: the default font to inherit + * outerTicks: boolean, should ticks default to outside? + * showGrid: boolean, should gridlines be shown by default? + * noHover: boolean, this axis doesn't support hover effects? + * noTickson: boolean, this axis doesn't support 'tickson' + * data: the plot data, used to manage categories + * bgColor: the plot background color, to calculate default gridline colors + */ +module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, options, layoutOut) { + var letter = options.letter; + var font = options.font || {}; + var splomStash = options.splomStash || {}; -function directionAttrs(lineColorDefault) { - return { - line: { - color: extendFlat({}, lineAttrs.color, {dflt: lineColorDefault}), - width: lineAttrs.width, - dash: dash, - editType: 'style' - }, - editType: 'style' - }; -} + var visible = coerce('visible', !options.cheateronly); -module.exports = { + var axType = containerOut.type; - x: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, + if(axType === 'date') { + var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); + handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + } - open: { - valType: 'data_array', - editType: 'calc', - - }, + setConvert(containerOut, layoutOut); - high: { - valType: 'data_array', - editType: 'calc', - - }, + var autoRange = coerce('autorange', !containerOut.isValidRange(containerIn.range)); + if(autoRange && (axType === 'linear' || axType === '-')) coerce('rangemode'); - low: { - valType: 'data_array', - editType: 'calc', - - }, + coerce('range'); + containerOut.cleanRange(); - close: { - valType: 'data_array', - editType: 'calc', - - }, + handleCategoryOrderDefaults(containerIn, containerOut, coerce, options); - line: { - width: extendFlat({}, lineAttrs.width, { - - }), - dash: extendFlat({}, dash, { - - }), - editType: 'style' - }, + if(axType !== 'category' && !options.noHover) coerce('hoverformat'); - increasing: directionAttrs(INCREASING_COLOR), + if(!visible) return containerOut; - decreasing: directionAttrs(DECREASING_COLOR), + var dfltColor = coerce('color'); + // if axis.color was provided, use it for fonts too; otherwise, + // inherit from global font color in case that was provided. + // Compare to dflt rather than to containerIn, so we can provide color via + // template too. + var dfltFontColor = (dfltColor !== layoutAttributes.color.dflt) ? dfltColor : font.color; + // try to get default title from splom trace, fallback to graph-wide value + var dfltTitle = splomStash.label || layoutOut._dfltTitle[letter]; - text: { - valType: 'string', - - dflt: '', - arrayOk: true, - editType: 'calc', - - }, + coerce('title.text', dfltTitle); + Lib.coerceFont(coerce, 'title.font', { + family: font.family, + size: Math.round(font.size * 1.2), + color: dfltFontColor + }); + + handleTickValueDefaults(containerIn, containerOut, coerce, axType); + handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options); + handleTickMarkDefaults(containerIn, containerOut, coerce, options); + handleLineGridDefaults(containerIn, containerOut, coerce, { + dfltColor: dfltColor, + bgColor: options.bgColor, + showGrid: options.showGrid, + attributes: layoutAttributes + }); - tickwidth: { - valType: 'number', - min: 0, - max: 0.5, - dflt: 0.3, - - editType: 'calc', - - }, + if(containerOut.showline || containerOut.ticks) coerce('mirror'); - hoverlabel: extendFlat({}, fxAttrs.hoverlabel, { - split: { - valType: 'boolean', - - dflt: false, - editType: 'style', - + if(options.automargin) coerce('automargin'); + + var isMultiCategory = containerOut.type === 'multicategory'; + + if(!options.noTickson && + (containerOut.type === 'category' || isMultiCategory) && + (containerOut.ticks || containerOut.showgrid) + ) { + var ticksonDflt; + if(isMultiCategory) ticksonDflt = 'boundaries'; + coerce('tickson', ticksonDflt); + } + + if(isMultiCategory) { + var showDividers = coerce('showdividers'); + if(showDividers) { + coerce('dividercolor'); + coerce('dividerwidth'); } - }), + } + + return containerOut; }; -},{"../../components/drawing/attributes":594,"../../components/fx/attributes":604,"../../lib":696,"../scatter/attributes":1043}],992:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../registry":243,"./category_order_defaults":207,"./layout_attributes":216,"./line_grid_defaults":218,"./set_convert":222,"./tick_label_defaults":223,"./tick_mark_defaults":224,"./tick_value_defaults":225}],206:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152833,163 +52483,210 @@ 'use strict'; -var Lib = _dereq_('../../lib'); -var _ = Lib._; -var Axes = _dereq_('../../plots/cartesian/axes'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; - -function calc(gd, trace) { - var xa = Axes.getFromId(gd, trace.xaxis); - var ya = Axes.getFromId(gd, trace.yaxis); - - var tickLen = convertTickWidth(gd, xa, trace); - var minDiff = trace._minDiff; - trace._minDiff = null; - var x = trace._xcalc; - trace._xcalc = null; - - var cd = calcCommon(gd, trace, x, ya, ptFunc); - - trace._extremes[xa._id] = Axes.findExtremes(xa, x, {vpad: minDiff / 2}); - if(cd.length) { - Lib.extendFlat(cd[0].t, { - wHover: minDiff / 2, - tickLen: tickLen - }); - return cd; - } else { - return [{t: {empty: true}}]; - } -} +var Registry = _dereq_('../../registry'); -function ptFunc(o, h, l, c) { - return { - o: o, - h: h, - l: l, - c: c - }; -} +var constants = _dereq_('./constants'); -// shared between OHLC and candlestick -// ptFunc makes a calcdata point specific to each trace type, from oi, hi, li, ci -function calcCommon(gd, trace, x, ya, ptFunc) { - var o = ya.makeCalcdata(trace, 'open'); - var h = ya.makeCalcdata(trace, 'high'); - var l = ya.makeCalcdata(trace, 'low'); - var c = ya.makeCalcdata(trace, 'close'); +// convert between axis names (xaxis, xaxis2, etc, elements of gd.layout) +// and axis id's (x, x2, etc). Would probably have ditched 'xaxis' +// completely in favor of just 'x' if it weren't ingrained in the API etc. +exports.id2name = function id2name(id) { + if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; + var axNum = id.substr(1); + if(axNum === '1') axNum = ''; + return id.charAt(0) + 'axis' + axNum; +}; - var hasTextArray = Array.isArray(trace.text); +exports.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; +}; - // we're optimists - before we have any changing data, assume increasing - var increasing = true; - var cPrev = null; +exports.cleanId = function cleanId(id, axLetter) { + if(!id.match(constants.AX_ID_PATTERN)) return; + if(axLetter && id.charAt(0) !== axLetter) return; - var cd = []; - for(var i = 0; i < x.length; i++) { - var xi = x[i]; - var oi = o[i]; - var hi = h[i]; - var li = l[i]; - var ci = c[i]; + var axNum = id.substr(1).replace(/^0+/, ''); + if(axNum === '1') axNum = ''; + return id.charAt(0) + axNum; +}; - if(xi !== BADNUM && oi !== BADNUM && hi !== BADNUM && li !== BADNUM && ci !== BADNUM) { - if(ci === oi) { - // if open == close, look for a change from the previous close - if(cPrev !== null && ci !== cPrev) increasing = ci > cPrev; - // else (c === cPrev or cPrev is null) no change - } - else increasing = ci > oi; +// get all axis objects, as restricted in listNames +exports.list = function(gd, axLetter, only2d) { + var fullLayout = gd._fullLayout; + if(!fullLayout) return []; - cPrev = ci; + var idList = exports.listIds(gd, axLetter); + var out = new Array(idList.length); + var i; - var pt = ptFunc(oi, hi, li, ci); + for(i = 0; i < idList.length; i++) { + var idi = idList[i]; + out[i] = fullLayout[idi.charAt(0) + 'axis' + idi.substr(1)]; + } - pt.pos = xi; - pt.yc = (oi + ci) / 2; - pt.i = i; - pt.dir = increasing ? 'increasing' : 'decreasing'; + if(!only2d) { + var sceneIds3D = fullLayout._subplots.gl3d || []; - if(hasTextArray) pt.tx = trace.text[i]; + for(i = 0; i < sceneIds3D.length; i++) { + var scene = fullLayout[sceneIds3D[i]]; - cd.push(pt); + if(axLetter) out.push(scene[axLetter + 'axis']); + else out.push(scene.xaxis, scene.yaxis, scene.zaxis); } } - trace._extremes[ya._id] = Axes.findExtremes(ya, l.concat(h), {padded: true}); + return out; +}; - if(cd.length) { - cd[0].t = { - labels: { - open: _(gd, 'open:') + ' ', - high: _(gd, 'high:') + ' ', - low: _(gd, 'low:') + ' ', - close: _(gd, 'close:') + ' ' - } - }; - } +// get all axis ids, optionally restricted by letter +// this only makes sense for 2d axes +exports.listIds = function(gd, axLetter) { + var fullLayout = gd._fullLayout; + if(!fullLayout) return []; - return cd; -} + var subplotLists = fullLayout._subplots; + if(axLetter) return subplotLists[axLetter + 'axis']; + return subplotLists.xaxis.concat(subplotLists.yaxis); +}; -/* - * find min x-coordinates difference of all traces - * attached to this x-axis and stash the result in _minDiff - * in all traces; when a trace uses this in its - * calc step it deletes _minDiff, so that next calc this is - * done again in case the data changed. - * also since we need it here, stash _xcalc on the trace - */ -function convertTickWidth(gd, xa, trace) { - var minDiff = trace._minDiff; - - if(!minDiff) { - var fullData = gd._fullData, - ohlcTracesOnThisXaxis = []; +// get an axis object from its id 'x','x2' etc +// optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it +exports.getFromId = function(gd, id, type) { + var fullLayout = gd._fullLayout; - minDiff = Infinity; + if(type === 'x') id = id.replace(/y[0-9]*/, ''); + else if(type === 'y') id = id.replace(/x[0-9]*/, ''); - var i; + return fullLayout[exports.id2name(id)]; +}; - for(i = 0; i < fullData.length; i++) { - var tracei = fullData[i]; +// get an axis object of specified type from the containing trace +exports.getFromTrace = function(gd, fullTrace, type) { + var fullLayout = gd._fullLayout; + var ax = null; - if(tracei.type === 'ohlc' && - tracei.visible === true && - tracei.xaxis === xa._id - ) { - ohlcTracesOnThisXaxis.push(tracei); + if(Registry.traceIs(fullTrace, 'gl3d')) { + var scene = fullTrace.scene; + if(scene.substr(0, 5) === 'scene') { + ax = fullLayout[scene][type + 'axis']; + } + } + else { + ax = exports.getFromId(gd, fullTrace[type + 'axis'] || type); + } - var xcalc = xa.makeCalcdata(tracei, 'x'); - tracei._xcalc = xcalc; + return ax; +}; - var _minDiff = Lib.distinctVals(xcalc).minDiff; - if(_minDiff && isFinite(_minDiff)) { - minDiff = Math.min(minDiff, _minDiff); - } +// sort x, x2, x10, y, y2, y10... +exports.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); +}; + +},{"../../registry":243,"./constants":209}],207:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +function findCategories(ax, opts) { + var dataAttr = opts.dataAttr || ax._id.charAt(0); + var lookup = {}; + var axData; + var i, j; + + if(opts.axData) { + // non-x/y case + axData = opts.axData; + } else { + // x/y case + axData = []; + for(i = 0; i < opts.data.length; i++) { + var trace = opts.data[i]; + if(trace[dataAttr + 'axis'] === ax._id) { + axData.push(trace); } } + } - // if minDiff is still Infinity here, set it to 1 - if(minDiff === Infinity) minDiff = 1; - - for(i = 0; i < ohlcTracesOnThisXaxis.length; i++) { - ohlcTracesOnThisXaxis[i]._minDiff = minDiff; + 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 !== undefined) { + lookup[v] = 1; + } } } - return minDiff * trace.tickwidth; + return Object.keys(lookup); } -module.exports = { - calc: calc, - calcCommon: calcCommon +/** + * Fills in category* default and initial categories. + * + * @param {object} containerIn : input axis object + * @param {object} containerOut : full axis object + * @param {function} coerce : Lib.coerce fn wrapper + * @param {object} opts : + * - data {array} : (full) data trace + * OR + * - axData {array} : (full) data associated with axis being coerced here + * - dataAttr {string} : attribute name corresponding to coordinate array + */ +module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, coerce, opts) { + if(containerOut.type !== 'category') return; + + var arrayIn = containerIn.categoryarray; + var isValidArray = (Array.isArray(arrayIn) && arrayIn.length > 0); + + // override default 'categoryorder' value when non-empty array is supplied + var orderDefault; + if(isValidArray) orderDefault = 'array'; + + var order = coerce('categoryorder', orderDefault); + var array; + + // coerce 'categoryarray' only in array order case + if(order === 'array') { + array = coerce('categoryarray'); + } + + // cannot set 'categoryorder' to 'array' with an invalid 'categoryarray' + if(!isValidArray && order === 'array') { + order = containerOut.categoryorder = 'trace'; + } + + // set up things for makeCalcdata + 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(); + } + } }; -},{"../../constants/numerical":673,"../../lib":696,"../../plots/cartesian/axes":744}],993:[function(_dereq_,module,exports){ +},{}],208:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152999,42 +52696,86 @@ 'use strict'; +var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var handleOHLC = _dereq_('./ohlc_defaults'); -var attributes = _dereq_('./attributes'); +var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } +/** + * Return a validated dtick value for this axis + * + * @param {any} dtick: the candidate dtick. valid values are numbers and strings, + * and further constrained depending on the axis type. + * @param {string} axType: the axis type + */ +exports.dtick = function(dtick, axType) { + var isLog = axType === 'log'; + var isDate = axType === 'date'; + var isCat = axType === 'category'; + var dtickDflt = isDate ? ONEDAY : 1; - var len = handleOHLC(traceIn, traceOut, coerce, layout); - if(!len) { - traceOut.visible = false; - return; + if(!dtick) return dtickDflt; + + if(isNumeric(dtick)) { + dtick = Number(dtick); + if(dtick <= 0) return dtickDflt; + if(isCat) { + // category dtick must be positive integers + return Math.max(1, Math.round(dtick)); + } + if(isDate) { + // date dtick must be at least 0.1ms (our current precision) + return Math.max(0.1, dtick); + } + return dtick; } - coerce('line.width'); - coerce('line.dash'); + if(typeof dtick !== 'string' || !(isDate || isLog)) { + return dtickDflt; + } - handleDirection(traceIn, traceOut, coerce, 'increasing'); - handleDirection(traceIn, traceOut, coerce, 'decreasing'); + var prefix = dtick.charAt(0); + var dtickNum = dtick.substr(1); + dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; - coerce('text'); - coerce('tickwidth'); + 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; + } - layout._requestRangeslider[traceOut.xaxis] = true; + return dtick; }; -function handleDirection(traceIn, traceOut, coerce, direction) { - coerce(direction + '.line.color'); - coerce(direction + '.line.width', traceOut.line.width); - coerce(direction + '.line.dash', traceOut.line.dash); -} +/** + * Return a validated tick0 for this axis + * + * @param {any} tick0: the candidate tick0. Valid values are numbers and strings, + * further constrained depending on the axis type + * @param {string} axType: the axis type + * @param {string} calendar: for date axes, the calendar to validate/convert with + * @param {any} dtick: an already valid dtick. Only used for D1 and D2 log dticks, + * which do not support tick0 at all. + */ +exports.tick0 = function(tick0, axType, calendar, dtick) { + if(axType === 'date') { + return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + } + if(dtick === 'D1' || dtick === 'D2') { + // D1 and D2 modes ignore tick0 entirely + return undefined; + } + // Aside from date axes, tick0 must be numeric + return isNumeric(tick0) ? Number(tick0) : 0; +}; -},{"../../lib":696,"./attributes":991,"./ohlc_defaults":996}],994:[function(_dereq_,module,exports){ +},{"../../constants/numerical":140,"../../lib":159,"fast-isnumeric":10}],209:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153042,230 +52783,235 @@ */ 'use strict'; +var counterRegex = _dereq_('../../lib/regex').counter; -var Axes = _dereq_('../../plots/cartesian/axes'); -var Lib = _dereq_('../../lib'); -var Fx = _dereq_('../../components/fx'); -var Color = _dereq_('../../components/color'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); -var DIRSYMBOL = { - increasing: '▲', - decreasing: '▼' -}; +module.exports = { -function hoverPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var trace = cd[0].trace; + idRegex: { + x: counterRegex('x'), + y: counterRegex('y') + }, - if(trace.hoverlabel.split) { - return hoverSplit(pointData, xval, yval, hovermode); - } + attrRegex: counterRegex('[xy]axis'), - return hoverOnPoints(pointData, xval, yval, hovermode); -} + // axis match regular expression + xAxisMatch: counterRegex('xaxis'), + yAxisMatch: counterRegex('yaxis'), -function getClosestPoint(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var xa = pointData.xa; - var trace = cd[0].trace; - var t = cd[0].t; + // 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]*$/, + AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, - var type = trace.type; - var minAttr = type === 'ohlc' ? 'l' : 'min'; - var maxAttr = type === 'ohlc' ? 'h' : 'max'; + // and for 2D subplots + SUBPLOT_PATTERN: /^x([0-9]*)y([0-9]*)$/, - var hoverPseudoDistance, spikePseudoDistance; + // pixels to move mouse before you stop clamping to starting point + MINDRAG: 8, - // potentially shift xval for grouped candlesticks - var centerShift = t.bPos || 0; - var shiftPos = function(di) { return di.pos + centerShift - xval; }; + // smallest dimension allowed for a select box + MINSELECT: 12, - // ohlc and candlestick call displayHalfWidth different things... - var displayHalfWidth = t.bdPos || t.tickLen; - var hoverHalfWidth = t.wHover; + // smallest dimension allowed for a zoombox + MINZOOM: 20, - // if two figures are overlaying, let the narrowest one win - var pseudoDistance = Math.min(1, displayHalfWidth / Math.abs(xa.r2c(xa.range[1]) - xa.r2c(xa.range[0]))); - hoverPseudoDistance = pointData.maxHoverDistance - pseudoDistance; - spikePseudoDistance = pointData.maxSpikeDistance - pseudoDistance; + // width of axis drag regions + DRAGGERSIZE: 20, - function dx(di) { - var pos = shiftPos(di); - return Fx.inbox(pos - hoverHalfWidth, pos + hoverHalfWidth, hoverPseudoDistance); - } + // max pixels off straight before a lasso select line counts as bent + BENDPX: 1.5, - function dy(di) { - return Fx.inbox(di[minAttr] - yval, di[maxAttr] - yval, hoverPseudoDistance); - } + // delay before a redraw (relayout) after smooth panning and zooming + REDRAWDELAY: 50, - function dxy(di) { return (dx(di) + dy(di)) / 2; } + // throttling limit (ms) for selectPoints calls + SELECTDELAY: 100, - var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); - Fx.getClosest(cd, distfn, pointData); + // cache ID suffix for throttle + SELECTID: '-select', - if(pointData.index === false) return null; + // last resort axis ranges for x and y axes if we have no data + DFLTRANGEX: [-1, 6], + DFLTRANGEY: [-1, 4], - var di = cd[pointData.index]; - var dir = di.dir; - var container = trace[dir]; - var lc = container.line.color; + // Layers to keep trace types in the right order + // N.B. each 'unique' plot method must have its own layer + traceLayerClasses: [ + 'heatmaplayer', + 'contourcarpetlayer', 'contourlayer', + 'barlayer', + 'carpetlayer', + 'violinlayer', + 'boxlayer', + 'ohlclayer', + 'scattercarpetlayer', 'scatterlayer' + ], - if(Color.opacity(lc) && container.line.width) pointData.color = lc; - else pointData.color = container.fillcolor; + layerValue2layerClass: { + 'above traces': 'above', + 'below traces': 'below' + } +}; - pointData.x0 = xa.c2p(di.pos + centerShift - displayHalfWidth, true); - pointData.x1 = xa.c2p(di.pos + centerShift + displayHalfWidth, true); +},{"../../lib/regex":174}],210:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - pointData.xLabelVal = di.pos; - pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; - pointData.xSpike = xa.c2p(di.pos, true); +'use strict'; - return pointData; -} +var Lib = _dereq_('../../lib'); +var id2name = _dereq_('./axis_ids').id2name; -function hoverSplit(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var ya = pointData.ya; - var trace = cd[0].trace; - var t = cd[0].t; - var closeBoxData = []; - var closestPoint = getClosestPoint(pointData, xval, yval, hovermode); - // skip the rest (for this trace) if we didn't find a close point - if(!closestPoint) return []; +module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { + var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); + + if(containerOut.fixedrange) return; - var cdIndex = closestPoint.index; - var di = cd[cdIndex]; - var hoverinfo = di.hi || trace.hoverinfo; - var hoverParts = hoverinfo.split('+'); - var isAll = hoverinfo === 'all'; - var hasY = isAll || hoverParts.indexOf('y') !== -1; - - // similar to hoverOnPoints, we return nothing - // if all or y is not present. - if(!hasY) return []; - - var attrs = ['high', 'open', 'close', 'low']; - - // several attributes can have the same y-coordinate. We will - // bunch them together in a single text block. For this, we keep - // a dictionary mapping y-coord -> point data. - var usedVals = {}; - - for(var i = 0; i < attrs.length; i++) { - var attr = attrs[i]; - - var val = trace[attr][closestPoint.index]; - var valPx = ya.c2p(val, true); - var pointData2; - if(val in usedVals) { - pointData2 = usedVals[val]; - pointData2.yLabel += '
' + t.labels[attr] + Axes.hoverLabelText(ya, val); + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' } - else { - // copy out to a new object for each new y-value to label - pointData2 = Lib.extendFlat({}, closestPoint); + }, 'constraintoward'); - pointData2.y0 = pointData2.y1 = valPx; - pointData2.yLabelVal = val; - pointData2.yLabel = t.labels[attr] + Axes.hoverLabelText(ya, val); + if(!containerIn.scaleanchor) return; - pointData2.name = ''; + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); - closeBoxData.push(pointData2); - usedVals[val] = pointData2; + var scaleanchor = Lib.coerce(containerIn, containerOut, { + scaleanchor: { + valType: 'enumerated', + values: constraintOpts.linkableAxes } + }, 'scaleanchor'); + + if(scaleanchor) { + var scaleratio = coerce('scaleratio'); + // TODO: I suppose I could do attribute.min: Number.MIN_VALUE to avoid zero, + // but that seems hacky. Better way to say "must be a positive number"? + // Of course if you use several super-tiny values you could eventually + // force a product of these to zero and all hell would break loose... + // Likewise with super-huge values. + if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + + updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, + thisID, scaleanchor, scaleratio); + } + else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + + containerIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because the target' + + 'axis has fixed range.'); } +}; - return closeBoxData; -} +function getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut) { + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter allAxisIds to enforce this, also matching axis types. -function hoverOnPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var ya = pointData.ya; - var trace = cd[0].trace; - var t = cd[0].t; + var thisType = layoutOut[id2name(thisID)].type; - var closestPoint = getClosestPoint(pointData, xval, yval, hovermode); - // skip the rest (for this trace) if we didn't find a close point - if(!closestPoint) return []; + var i, j, idj, axj; + + var linkableAxes = []; + for(j = 0; j < allAxisIds.length; j++) { + idj = allAxisIds[j]; + if(idj === thisID) continue; + + axj = layoutOut[id2name(idj)]; + if(axj.type === thisType && !axj.fixedrange) linkableAxes.push(idj); + } + + for(i = 0; i < constraintGroups.length; i++) { + if(constraintGroups[i][thisID]) { + var thisGroup = constraintGroups[i]; - // we don't make a calcdata point if we're missing any piece (x/o/h/l/c) - // so we need to fix the index here to point to the data arrays - var cdIndex = closestPoint.index; - var di = cd[cdIndex]; - var i = closestPoint.index = di.i; - var dir = di.dir; - - function getLabelLine(attr) { - return t.labels[attr] + Axes.hoverLabelText(ya, trace[attr][i]); - } - - var hoverinfo = di.hi || trace.hoverinfo; - var hoverParts = hoverinfo.split('+'); - var isAll = hoverinfo === 'all'; - var hasY = isAll || hoverParts.indexOf('y') !== -1; - var hasText = isAll || hoverParts.indexOf('text') !== -1; - - var textParts = hasY ? [ - getLabelLine('open'), - getLabelLine('high'), - getLabelLine('low'), - getLabelLine('close') + ' ' + DIRSYMBOL[dir] - ] : []; - if(hasText) fillHoverText(di, trace, textParts); - - // don't make .yLabelVal or .text, since we're managing hoverinfo - // put it all in .extraText - closestPoint.extraText = textParts.join('
'); - - // this puts the label *and the spike* at the midpoint of the box, ie - // halfway between open and close, not between high and low. - closestPoint.y0 = closestPoint.y1 = ya.c2p(di.yc, true); + var linkableAxesNoLoops = []; + for(j = 0; j < linkableAxes.length; j++) { + idj = linkableAxes[j]; + if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); + } + return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + } + } - return [closestPoint]; + return {linkableAxes: linkableAxes, thisGroup: null}; } -module.exports = { - hoverPoints: hoverPoints, - hoverSplit: hoverSplit, - hoverOnPoints: hoverOnPoints -}; -},{"../../components/color":570,"../../components/fx":612,"../../lib":696,"../../plots/cartesian/axes":744,"../scatter/fill_hover_text":1051}],995:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +/* + * Add this axis to the axis constraint groups, which is the collection + * of axes that are all constrained together on scale. + * + * constraintGroups: a list of objects. each object is + * {axis_id: scale_within_group}, where scale_within_group is + * only important relative to the rest of the group, and defines + * the relative scales between all axes in the group + * + * thisGroup: the group the current axis is already in + * thisID: the id if the current axis + * scaleanchor: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the scaleanchor axis + */ +function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { + var i, j, groupi, keyj, thisGroupIndex; -'use strict'; + if(thisGroup === null) { + thisGroup = {}; + thisGroup[thisID] = 1; + thisGroupIndex = constraintGroups.length; + constraintGroups.push(thisGroup); + } + else { + thisGroupIndex = constraintGroups.indexOf(thisGroup); + } -module.exports = { - moduleType: 'trace', - name: 'ohlc', - basePlotModule: _dereq_('../../plots/cartesian'), - categories: ['cartesian', 'svg', 'showLegend'], - meta: { - - }, + var thisGroupKeys = Object.keys(thisGroup); + + // we know that this axis isn't in any other groups, but we don't know + // about the scaleanchor axis. If it is, we need to merge the groups. + for(i = 0; i < constraintGroups.length; i++) { + groupi = constraintGroups[i]; + if(i !== thisGroupIndex && groupi[scaleanchor]) { + var baseScale = groupi[scaleanchor]; + for(j = 0; j < thisGroupKeys.length; j++) { + keyj = thisGroupKeys[j]; + groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + } + constraintGroups.splice(thisGroupIndex, 1); + return; + } + } - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults'), - calc: _dereq_('./calc').calc, - plot: _dereq_('./plot'), - style: _dereq_('./style'), - hoverPoints: _dereq_('./hover').hoverPoints, - selectPoints: _dereq_('./select') -}; + // otherwise, we insert the new scaleanchor axis as the base scale (1) + // in its group, and scale the rest of the group to it + if(scaleratio !== 1) { + for(j = 0; j < thisGroupKeys.length; j++) { + thisGroup[thisGroupKeys[j]] *= scaleratio; + } + } + thisGroup[scaleanchor] = 1; +} -},{"../../plots/cartesian":756,"./attributes":991,"./calc":992,"./defaults":993,"./hover":994,"./plot":997,"./select":998,"./style":999}],996:[function(_dereq_,module,exports){ +},{"../../lib":159,"./axis_ids":206}],211:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153275,3837 +53021,2209 @@ 'use strict'; -var Registry = _dereq_('../../registry'); +var id2name = _dereq_('./axis_ids').id2name; +var scaleZoom = _dereq_('./scale_zoom'); +var makePadFn = _dereq_('./autorange').makePadFn; +var concatExtremes = _dereq_('./autorange').concatExtremes; +var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; -module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { - var x = coerce('x'); - var open = coerce('open'); - var high = coerce('high'); - var low = coerce('low'); - var close = coerce('close'); +var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; - coerce('hoverlabel.split'); - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x'], layout); +exports.enforce = function enforceAxisConstraints(gd) { + var fullLayout = gd._fullLayout; + var constraintGroups = fullLayout._axisConstraintGroups || []; - if(!(open && high && low && close)) return; + var i, j, axisID, ax, normScale, mode, factor; - var len = Math.min(open.length, high.length, low.length, close.length); + for(i = 0; i < constraintGroups.length; i++) { + var group = constraintGroups[i]; + var axisIDs = Object.keys(group); - if(x) len = Math.min(len, x.length); + var minScale = Infinity; + var maxScale = 0; + // mostly matchScale will be the same as minScale + // ie we expand axis ranges to encompass *everything* + // that's currently in any of their ranges, but during + // autorange of a subset of axes we will ignore other + // axes for this purpose. + var matchScale = Infinity; + var normScales = {}; + var axes = {}; + var hasAnyDomainConstraint = false; - traceOut._length = len; + // find the (normalized) scale of each axis in the group + for(j = 0; j < axisIDs.length; j++) { + axisID = axisIDs[j]; + axes[axisID] = ax = fullLayout[id2name(axisID)]; - return len; -}; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); -},{"../../registry":827}],997:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(!ax._inputRange) ax._inputRange = ax.range.slice(); -'use strict'; + // set axis scale here so we can use _m rather than + // having to calculate it from length and range + ax.setScale(); -var d3 = _dereq_('d3'); + // abs: inverted scales still satisfy the constraint + 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); + } -var Lib = _dereq_('../../lib'); + // this has served its purpose, so remove it + delete ax._constraintShrinkable; + maxScale = Math.max(maxScale, normScale); -module.exports = function plot(gd, plotinfo, cdOHLC, ohlcLayer) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; + } - Lib.makeTraceGroups(ohlcLayer, cdOHLC, 'trace ohlc').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var t = cd0.t; - var trace = cd0.trace; - if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; + // Do we have a constraint mismatch? Give a small buffer for rounding errors + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; - if(trace.visible !== true || t.empty) { - plotGroup.remove(); - return; - } + // now increase any ranges we need to until all normalized scales are equal + for(j = 0; j < axisIDs.length; j++) { + axisID = axisIDs[j]; + normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; - var tickLen = t.tickLen; + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; - var paths = plotGroup.selectAll('path').data(Lib.identity); + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' - paths.enter().append('path'); + 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])); - paths.exit().remove(); + factor /= domainShrunk; - paths.attr('d', function(d) { - var x = xa.c2p(d.pos, true); - var xo = xa.c2p(d.pos - tickLen, true); - var xc = xa.c2p(d.pos + tickLen, true); + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } - var yo = ya.c2p(d.o, true); - var yh = ya.c2p(d.h, true); - var yl = ya.c2p(d.l, true); - var yc = ya.c2p(d.c, true); + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } - return 'M' + xo + ',' + yo + 'H' + x + - 'M' + x + ',' + yh + 'V' + yl + - 'M' + xc + ',' + yc + 'H' + x; - }); - }); -}; + if(ax.autorange) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + 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); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + var getPad = makePadFn(ax); -},{"../../lib":696,"d3":148}],998:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + updateDomain(ax, factor); + var m = Math.abs(ax._m); + var extremes = concatExtremes(gd, ax); + var minArray = extremes.min; + var maxArray = extremes.max; + var newVal; + var k; -'use strict'; + for(k = 0; k < minArray.length; k++) { + newVal = minArray[k].val - getPad(minArray[k]) / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; - var i; - // for (potentially grouped) candlesticks - var posOffset = cd[0].t.bPos || 0; + for(k = 0; k < maxArray.length; k++) { + newVal = maxArray[k].val + getPad(maxArray[k]) / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } - if(selectionTester === false) { - // clear selection - for(i = 0; i < cd.length; i++) { - cd[i].selected = 0; - } - } else { - for(i = 0; i < cd.length; i++) { - var di = cd[i]; + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; - if(selectionTester.contains([xa.c2p(di.pos + posOffset), ya.c2p(di.yc)], null, di.i, searchInfo)) { - selection.push({ - pointNumber: di.i, - x: xa.c2d(di.pos), - y: ya.c2d(di.yc) - }); - di.selected = 1; - } else { - di.selected = 0; + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } } } } - - return selection; -}; - -},{}],999:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var d3 = _dereq_('d3'); -var Drawing = _dereq_('../../components/drawing'); -var Color = _dereq_('../../components/color'); - -module.exports = function style(gd, cd) { - var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.ohlclayer').selectAll('g.trace'); - - s.style('opacity', function(d) { - return d[0].trace.opacity; - }); - - s.each(function(d) { - var trace = d[0].trace; - - d3.select(this).selectAll('path').each(function(di) { - var dirLine = trace[di.dir].line; - d3.select(this) - .style('fill', 'none') - .call(Color.stroke, dirLine.color) - .call(Drawing.dashLine, dirLine.dash, dirLine.width) - // TODO: custom selection style for OHLC - .style('opacity', trace.selectedpoints && !di.selected ? 0.3 : 1); - }); - }); }; -},{"../../components/color":570,"../../components/drawing":595,"d3":148}],1000:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var plotAttrs = _dereq_('../../plots/attributes'); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var domainAttrs = _dereq_('../../plots/domain').attributes; -var scatterAttrs = _dereq_('../scatter/attributes'); -var scatterLineAttrs = scatterAttrs.line; -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); - -var line = extendFlat({ - editType: 'calc' -}, colorAttributes('line', {editType: 'calc'}), - { - showscale: scatterLineAttrs.showscale, - colorbar: colorbarAttrs, - shape: { - valType: 'enumerated', - values: ['linear', 'hspline'], - dflt: 'linear', - - editType: 'plot', - +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; + } } - }); - -module.exports = { - domain: domainAttrs({name: 'parcats', trace: true, editType: 'calc'}), - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['count', 'probability'], - editType: 'plot', - arrayOk: false - // plotAttrs.hoverinfo description is appropriate - }), - hoveron: { - valType: 'enumerated', - values: ['category', 'color', 'dimension'], - dflt: 'category', - - editType: 'plot', - - }, - arrangement: { - valType: 'enumerated', - values: ['perpendicular', 'freeform', 'fixed'], - dflt: 'perpendicular', - - editType: 'plot', - - }, - bundlecolors: { - valType: 'boolean', - dflt: true, - - editType: 'plot', - - }, - sortpaths: { - valType: 'enumerated', - values: ['forward', 'backward'], - dflt: 'forward', - - editType: 'plot', - - }, - labelfont: fontAttrs({ - editType: 'calc', - - }), - - tickfont: fontAttrs({ - editType: 'calc', - - }), - - dimensions: { - _isLinkedToArray: 'dimension', - label: { - valType: 'string', - - editType: 'calc', - - }, - categoryorder: { - valType: 'enumerated', - values: [ - 'trace', 'category ascending', 'category descending', 'array' - ], - dflt: 'trace', - - editType: 'calc', - - }, - categoryarray: { - valType: 'data_array', - - editType: 'calc', - - }, - ticktext: { - valType: 'data_array', - - editType: 'calc', - - }, - values: { - valType: 'data_array', - - dflt: [], - editType: 'calc', - - }, - displayindex: { - valType: 'integer', - - editType: 'calc', - - }, - editType: 'calc', - - visible: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; } - }, + } +}; - line: line, - counts: { - valType: 'number', - min: 0, - dflt: 1, - arrayOk: true, - - editType: 'calc', - - }, +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; - // Hide unsupported top-level properties from plot-schema - customdata: undefined, - hoverlabel: undefined, - ids: undefined, - legendgroup: undefined, - opacity: undefined, - selectedpoints: undefined, - showlegend: undefined -}; + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; + ax.setScale(); +} -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/attributes":741,"../../plots/domain":770,"../../plots/font_attributes":771,"../scatter/attributes":1043}],1001:[function(_dereq_,module,exports){ +},{"../../constants/alignment":138,"../../constants/numerical":140,"./autorange":202,"./axis_ids":206,"./scale_zoom":220}],212:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; -var getModuleCalcData = _dereq_('../../plots/get_data').getModuleCalcData; -var parcatsPlot = _dereq_('./plot'); +'use strict'; -var PARCATS = 'parcats'; -exports.name = PARCATS; +var d3 = _dereq_('d3'); +var tinycolor = _dereq_('tinycolor2'); +var supportsPassive = _dereq_('has-passive-events'); -exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); +var Color = _dereq_('../../components/color'); +var Drawing = _dereq_('../../components/drawing'); +var Fx = _dereq_('../../components/fx'); +var Axes = _dereq_('./axes'); +var setCursor = _dereq_('../../lib/setcursor'); +var dragElement = _dereq_('../../components/dragelement'); +var FROM_TL = _dereq_('../../constants/alignment').FROM_TL; +var clearGlCanvases = _dereq_('../../lib/clear_gl_canvases'); +var redrawReglTraces = _dereq_('../../plot_api/subroutines').redrawReglTraces; - var cdModuleAndOthers = getModuleCalcData(gd.calcdata, PARCATS); +var Plots = _dereq_('../plots'); - if(cdModuleAndOthers.length) { - var calcData = cdModuleAndOthers[0]; - parcatsPlot(gd, calcData, transitionOpts, makeOnCompleteCallback); - } -}; +var getFromId = _dereq_('./axis_ids').getFromId; +var prepSelect = _dereq_('./select').prepSelect; +var clearSelect = _dereq_('./select').clearSelect; +var selectOnClick = _dereq_('./select').selectOnClick; +var scaleZoom = _dereq_('./scale_zoom'); -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var hadTable = (oldFullLayout._has && oldFullLayout._has('parcats')); - var hasTable = (newFullLayout._has && newFullLayout._has('parcats')); +var constants = _dereq_('./constants'); +var MINDRAG = constants.MINDRAG; +var MINZOOM = constants.MINZOOM; - if(hadTable && !hasTable) { - oldFullLayout._paperdiv.selectAll('.parcats').remove(); - } -}; -},{"../../plots/get_data":781,"./plot":1006}],1002:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +// flag for showing "doubleclick to zoom out" only at the beginning +var SHOWZOOMOUTTIP = true; -'use strict'; +// dragBox: create an element to drag one or more axis ends +// inputs: +// plotinfo - which subplot are we making dragboxes on? +// x,y,w,h - left, top, width, height of the box +// ns - how does this drag the vertical axis? +// 'n' - top only +// 's' - bottom only +// 'ns' - top and bottom together, difference unchanged +// ew - same for horizontal axis +function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { + // mouseDown stores ms of first mousedown event in the last + // DBLCLICKDELAY ms on the drag bars + // numClicks stores how many mousedowns have been seen + // within DBLCLICKDELAY so we can check for click or doubleclick events + // dragged stores whether a drag has occurred, so we don't have to + // redraw unnecessarily, ie if no move bigger than MINDRAG or MINZOOM px + var zoomlayer = gd._fullLayout._zoomlayer; + var isMainDrag = (ns + ew === 'nsew'); + var singleEnd = (ns + ew).length === 1; -// Requirements -// ============ -var wrap = _dereq_('../../lib/gup').wrap; -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); -var filterUnique = _dereq_('../../lib/filter_unique.js'); -var Drawing = _dereq_('../../components/drawing'); -var Lib = _dereq_('../../lib'); + // main subplot x and y (i.e. found in plotinfo - the main ones) + var xa0, ya0; + // {ax._id: ax} hash objects + var xaHash, yaHash; + // xaHash/yaHash values (arrays) + var xaxes, yaxes; + // main axis offsets + var xs, ys; + // main axis lengths + var pw, ph; + // contains keys 'xaHash', 'yaHash', 'xaxes', and 'yaxes' + // which are the x/y {ax._id: ax} hash objects and their values + // for linked axis relative to this subplot + var links; + // set to ew/ns val when active, set to '' when inactive + var xActive, yActive; + // are all axes in this subplot are fixed? + var allFixedRanges; + // is subplot constrained? + var isSubplotConstrained; + // do we need to edit x/y ranges? + var editX, editY; + // graph-wide optimization flags + var hasScatterGl, hasSplom, hasSVG; + // collected changes to be made to the plot by relayout at the end + var updates; -/** - * Create a wrapped ParcatsModel object from trace - * - * Note: trace defaults have already been applied - * @param {Object} gd - * @param {Object} trace - * @return {Array.} - */ -module.exports = function calc(gd, trace) { - var visibleDims = Lib.filterVisible(trace.dimensions); + function recomputeAxisLists() { + xa0 = plotinfo.xaxis; + ya0 = plotinfo.yaxis; + pw = xa0._length; + ph = ya0._length; + xs = xa0._offset; + ys = ya0._offset; - if(visibleDims.length === 0) return []; + xaHash = {}; + xaHash[xa0._id] = xa0; + yaHash = {}; + yaHash[ya0._id] = ya0; - var uniqueInfoDims = visibleDims.map(function(dim) { - var categoryValues; - if(dim.categoryorder === 'trace') { - // Use order of first occurrence in trace - categoryValues = null; - } else if(dim.categoryorder === 'array') { - // Use categories specified in `categoryarray` first, - // then add extra to the end in trace order - categoryValues = dim.categoryarray; - } else { - // Get all categories up front so we can order them - // Should we check for numbers as sort numerically? - categoryValues = filterUnique(dim.values).sort(); - if(dim.categoryorder === 'category descending') { - categoryValues = categoryValues.reverse(); + // if we're dragging two axes at once, also drag overlays + if(ns && ew) { + var overlays = plotinfo.overlays; + for(var i = 0; i < overlays.length; i++) { + var xa = overlays[i].xaxis; + xaHash[xa._id] = xa; + var ya = overlays[i].yaxis; + yaHash[ya._id] = ya; } } - return getUniqueInfo(dim.values, categoryValues); - }); - - var counts, - count, - totalCount; - if(Lib.isArrayOrTypedArray(trace.counts)) { - counts = trace.counts; - } else { - counts = [trace.counts]; - } - - validateDimensionDisplayInds(visibleDims); - - visibleDims.forEach(function(dim, dimInd) { - validateCategoryProperties(dim, uniqueInfoDims[dimInd]); - }); - // Handle path colors - // ------------------ - var line = trace.line; - var markerColorscale; - - // Process colorscale - if(line) { - if(hasColorscale(trace, 'line')) { - colorscaleCalc(trace, trace.line.color, 'line', 'c'); - } - markerColorscale = Drawing.tryColorscale(line); - } else { - markerColorscale = Lib.identity; - } + xaxes = hashValues(xaHash); + yaxes = hashValues(yaHash); + xActive = isDirectionActive(xaxes, ew); + yActive = isDirectionActive(yaxes, ns); + allFixedRanges = !yActive && !xActive; - // Build color generation function - function getMarkerColorInfo(index) { - var value; - if(Lib.isArrayOrTypedArray(line.color)) { - value = line.color[index % line.color.length]; - } else { - value = line.color; - } + links = calcLinks(gd, xaHash, yaHash); + isSubplotConstrained = links.isSubplotConstrained; + editX = ew || isSubplotConstrained; + editY = ns || isSubplotConstrained; - return {color: markerColorscale(value), rawColor: value}; + var fullLayout = gd._fullLayout; + hasScatterGl = fullLayout._has('scattergl'); + hasSplom = fullLayout._has('splom'); + hasSVG = fullLayout._has('svg'); } - // Number of values and counts - // --------------------------- - var numValues = visibleDims[0].values.length; - - // Build path info - // --------------- - // Mapping from category inds to PathModel objects - var pathModels = {}; + recomputeAxisLists(); - // Category inds array for each dimension - var categoryIndsDims = uniqueInfoDims.map(function(di) {return di.inds;}); + var cursor = getDragCursor(yActive + xActive, gd._fullLayout.dragmode, isMainDrag); + var dragger = makeRectDragger(plotinfo, ns + ew + 'drag', cursor, x, y, w, h); - // Initialize total count - totalCount = 0; - var valueInd; - var d; + // still need to make the element if the axes are disabled + // but nuke its events (except for maindrag which needs them for hover) + // and stop there + if(allFixedRanges && !isMainDrag) { + dragger.onmousedown = null; + dragger.style.pointerEvents = 'none'; + return dragger; + } - for(valueInd = 0; valueInd < numValues; valueInd++) { + var dragOptions = { + element: dragger, + gd: gd, + plotinfo: plotinfo + }; - // Category inds for this input value across dimensions - var categoryIndsPath = []; - for(d = 0; d < categoryIndsDims.length; d++) { - categoryIndsPath.push(categoryIndsDims[d][valueInd]); + dragOptions.prepFn = function(e, startX, startY) { + var dragModePrev = dragOptions.dragmode; + var dragModeNow = gd._fullLayout.dragmode; + if(dragModeNow !== dragModePrev) { + dragOptions.dragmode = dragModeNow; } - // Count - count = counts[valueInd % counts.length]; - - // Update total count - totalCount += count; - - // Path color - var pathColorInfo = getMarkerColorInfo(valueInd); - - // path key - var pathKey = categoryIndsPath + '-' + pathColorInfo.rawColor; + recomputeAxisLists(); - // Create / Update PathModel - if(pathModels[pathKey] === undefined) { - pathModels[pathKey] = createPathModel(categoryIndsPath, - pathColorInfo.color, - pathColorInfo.rawColor); + if(!allFixedRanges) { + if(isMainDrag) { + // main dragger handles all drag modes, and changes + // to pan (or to zoom if it already is pan) on shift + if(e.shiftKey) { + if(dragModeNow === 'pan') dragModeNow = 'zoom'; + else if(!isSelectOrLasso(dragModeNow)) dragModeNow = 'pan'; + } + else if(e.ctrlKey) { + dragModeNow = 'pan'; + } + } + // all other draggers just pan + else dragModeNow = 'pan'; } - updatePathModel(pathModels[pathKey], valueInd, count); - } - - var dimensionModels = visibleDims.map(function(di, i) { - return createDimensionModel(i, di._index, di._displayindex, di.label, totalCount); - }); + if(dragModeNow === 'lasso') dragOptions.minDrag = 1; + else dragOptions.minDrag = undefined; - for(valueInd = 0; valueInd < numValues; valueInd++) { + if(isSelectOrLasso(dragModeNow)) { + dragOptions.xaxes = xaxes; + dragOptions.yaxes = yaxes; + // this attaches moveFn, clickFn, doneFn on dragOptions + prepSelect(e, startX, startY, dragOptions, dragModeNow); + } else { + dragOptions.clickFn = clickFn; + if(isSelectOrLasso(dragModePrev)) { + // TODO Fix potential bug + // Note: clearing / resetting selection state only happens, when user + // triggers at least one interaction in pan/zoom mode. Otherwise, the + // select/lasso outlines are deleted (in plots.js.cleanPlot) but the selection + // cache isn't cleared. So when the user switches back to select/lasso and + // 'adds to a selection' with Shift, the "old", seemingly removed outlines + // are redrawn again because the selection cache still holds their coordinates. + // However, this isn't easily solved, since plots.js would need + // to have a reference to the dragOptions object (which holds the + // selection cache). + clearAndResetSelect(); + } - count = counts[valueInd % counts.length]; + if(!allFixedRanges) { + if(dragModeNow === 'zoom') { + dragOptions.moveFn = zoomMove; + dragOptions.doneFn = zoomDone; - for(d = 0; d < dimensionModels.length; d++) { - var containerInd = dimensionModels[d].containerInd; - var catInd = uniqueInfoDims[d].inds[valueInd]; - var cats = dimensionModels[d].categories; + // zoomMove takes care of the threshold, but we need to + // minimize this so that constrained zoom boxes will flip + // orientation at the right place + dragOptions.minDrag = 1; - if(cats[catInd] === undefined) { - var catValue = trace.dimensions[containerInd]._categoryarray[catInd]; - var catLabel = trace.dimensions[containerInd]._ticktext[catInd]; - cats[catInd] = createCategoryModel(d, catInd, catValue, catLabel); + zoomPrep(e, startX, startY); + } else if(dragModeNow === 'pan') { + dragOptions.moveFn = plotDrag; + dragOptions.doneFn = dragTail; + } } - - updateCategoryModel(cats[catInd], valueInd, count); } - } - - // Compute unique - return wrap(createParcatsModel(dimensionModels, pathModels, totalCount)); -}; + }; -// Models -// ====== + function clearAndResetSelect() { + // clear selection polygon cache (if any) + dragOptions.plotinfo.selection = false; + // clear selection outlines + clearSelect(zoomlayer); + } -// Parcats Model -// ------------- -/** - * @typedef {Object} ParcatsModel - * Object containing calculated information about a parcats trace - * - * @property {Array.} dimensions - * Array of dimension models - * @property {Object.} paths - * Dictionary from category inds string (e.g. "1,2,1,1") to path model - * @property {Number} maxCats - * The maximum number of categories of any dimension in the diagram - * @property {Number} count - * Total number of input values - * @property {Object} trace - */ + function clickFn(numClicks, evt) { + var clickmode = gd._fullLayout.clickmode; -/** - * Create and new ParcatsModel object - * @param {Array.} dimensions - * @param {Object.} paths - * @param {Number} count - * @return {ParcatsModel} - */ -function createParcatsModel(dimensions, paths, count) { - var maxCats = dimensions - .map(function(d) {return d.categories.length;}) - .reduce(function(v1, v2) {return Math.max(v1, v2);}); - return {dimensions: dimensions, paths: paths, trace: undefined, maxCats: maxCats, count: count}; -} + removeZoombox(gd); -// Dimension Model -// --------------- -/** - * @typedef {Object} DimensionModel - * Object containing calculated information about a single dimension - * - * @property {Number} dimensionInd - * The index of this dimension among the *visible* dimensions - * @property {Number} containerInd - * The index of this dimension in the original dimensions container, - * irrespective of dimension visibility - * @property {Number} displayInd - * The display index of this dimension (where 0 is the left most dimension) - * @property {String} dimensionLabel - * The label of this dimension - * @property {Number} count - * Total number of input values - * @property {Array.} categories - * @property {Number|null} dragX - * The x position of dimension that is currently being dragged. null if not being dragged - */ + if(numClicks === 2 && !singleEnd) doubleClick(); -/** - * Create and new DimensionModel object with an empty categories array - * @param {Number} dimensionInd - * @param {Number} containerInd - * @param {Number} displayInd - * @param {String} dimensionLabel - * @param {Number} count - * Total number of input values - * @return {DimensionModel} - */ -function createDimensionModel(dimensionInd, containerInd, displayInd, dimensionLabel, count) { - return { - dimensionInd: dimensionInd, - containerInd: containerInd, - displayInd: displayInd, - dimensionLabel: dimensionLabel, - count: count, - categories: [], - dragX: null - }; -} + if(isMainDrag) { + if(clickmode.indexOf('select') > -1) { + selectOnClick(evt, gd, xaxes, yaxes, plotinfo.id, dragOptions); + } -// Category Model -// -------------- -/** - * @typedef {Object} CategoryModel - * Object containing calculated information about a single category. - * - * @property {Number} dimensionInd - * The index of this categories dimension - * @property {Number} categoryInd - * The index of this category - * @property {Number} displayInd - * The display index of this category (where 0 is the topmost category) - * @property {String} categoryLabel - * The name of this category - * @property categoryValue: Raw value of the category - * @property {Array} valueInds - * Array of indices (into the original value array) of all samples in this category - * @property {Number} count - * The number of elements from the original array in this path - * @property {Number|null} dragY - * The y position of category that is currently being dragged. null if not being dragged - */ + if(clickmode.indexOf('event') > -1) { + Fx.click(gd, evt, plotinfo.id); + } + } + else if(numClicks === 1 && singleEnd) { + var ax = ns ? ya0 : xa0; + var end = (ns === 's' || ew === 'w') ? 0 : 1; + var attrStr = ax._name + '.range[' + end + ']'; + var initialText = getEndText(ax, end); + var hAlign = 'left'; + var vAlign = 'middle'; -/** - * Create and return a new CategoryModel object - * @param {Number} dimensionInd - * @param {Number} categoryInd - * The display index of this category (where 0 is the topmost category) - * @param {String} categoryValue - * @param {String} categoryLabel - * @return {CategoryModel} - */ -function createCategoryModel(dimensionInd, categoryInd, categoryValue, categoryLabel) { - return { - dimensionInd: dimensionInd, - categoryInd: categoryInd, - categoryValue: categoryValue, - displayInd: categoryInd, - categoryLabel: categoryLabel, - valueInds: [], - count: 0, - dragY: null - }; -} + if(ax.fixedrange) return; -/** - * Update a CategoryModel object with a new value index - * Note: The calling parameter is modified in place. - * - * @param {CategoryModel} categoryModel - * @param {Number} valueInd - * @param {Number} count - */ -function updateCategoryModel(categoryModel, valueInd, count) { - categoryModel.valueInds.push(valueInd); - categoryModel.count += count; -} + if(ns) { + vAlign = (ns === 'n') ? 'top' : 'bottom'; + if(ax.side === 'right') hAlign = 'right'; + } + else if(ew === 'e') hAlign = 'right'; + if(gd._context.showAxisRangeEntryBoxes) { + d3.select(dragger) + .call(svgTextUtils.makeEditable, { + gd: gd, + immediate: true, + background: gd._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 !== undefined) { + Registry.call('_guiRelayout', gd, attrStr, v); + } + }); + } + } + } -// Path Model -// ---------- -/** - * @typedef {Object} PathModel - * Object containing calculated information about the samples in a path. - * - * @property {Array} categoryInds - * Array of category indices for each dimension (length `numDimensions`) - * @param {String} pathColor - * Color of this path. (Note: Any colorscaling has already taken place) - * @property {Array} valueInds - * Array of indices (into the original value array) of all samples in this path - * @property {Number} count - * The number of elements from the original array in this path - * @property {String} color - * The path's color (ass CSS color string) - * @property rawColor - * The raw color value specified by the user. May be a CSS color string or a Number - */ + dragElement.init(dragOptions); -/** - * Create and return a new PathModel object - * @param {Array} categoryInds - * @param color - * @param rawColor - * @return {PathModel} - */ -function createPathModel(categoryInds, color, rawColor) { - return { - categoryInds: categoryInds, - color: color, - rawColor: rawColor, - valueInds: [], - count: 0 - }; -} + var x0, + y0, + box, + lum, + path0, + dimmed, + zoomMode, + zb, + corners; -/** - * Update a PathModel object with a new value index - * Note: The calling parameter is modified in place. - * - * @param {PathModel} pathModel - * @param {Number} valueInd - * @param {Number} count - */ -function updatePathModel(pathModel, valueInd, count) { - pathModel.valueInds.push(valueInd); - pathModel.count += count; -} + // zoom takes over minDrag, so it also has to take over gd._dragged + var zoomDragged; -// Unique calculations -// =================== -/** - * @typedef {Object} UniqueInfo - * Object containing information about the unique values of an input array - * - * @property {Array} uniqueValues - * The unique values in the input array - * @property {Array} uniqueCounts - * The number of times each entry in uniqueValues occurs in input array. - * This has the same length as `uniqueValues` - * @property {Array} inds - * Indices into uniqueValues that would reproduce original input array - */ + function zoomPrep(e, startX, startY) { + var dragBBox = dragger.getBoundingClientRect(); + x0 = startX - dragBBox.left; + y0 = startY - dragBBox.top; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; + lum = gd._hmpixcount ? + (gd._hmlumcount / gd._hmpixcount) : + tinycolor(gd._fullLayout.plot_bgcolor).getLuminance(); + path0 = 'M0,0H' + pw + 'V' + ph + 'H0V0'; + dimmed = false; + zoomMode = 'xy'; + zoomDragged = false; -/** - * Compute unique value information for an array - * - * IMPORTANT: Note that values are considered unique - * if their string representations are unique. - * - * @param {Array} values - * @param {Array|undefined} uniqueValues - * Array of expected unique values. The uniqueValues property of the resulting UniqueInfo object will begin with - * these entries. Entries are included even if there are zero occurrences in the values array. Entries found in - * the values array that are not present in uniqueValues will be included at the end of the array in the - * UniqueInfo object. - * @return {UniqueInfo} - */ -function getUniqueInfo(values, uniqueValues) { + zb = makeZoombox(zoomlayer, lum, xs, ys, path0); - // Initialize uniqueValues if not specified - if(uniqueValues === undefined || uniqueValues === null) { - uniqueValues = []; - } else { - // Shallow copy so append below doesn't alter input array - uniqueValues = uniqueValues.map(function(e) {return e;}); + corners = makeCorners(zoomlayer, xs, ys); } - // Initialize Variables - var uniqueValueCounts = {}, - uniqueValueInds = {}, - inds = []; - - // Initialize uniqueValueCounts and - uniqueValues.forEach(function(uniqueVal, valInd) { - uniqueValueCounts[uniqueVal] = 0; - uniqueValueInds[uniqueVal] = valInd; - }); - - // Compute the necessary unique info in a single pass - for(var i = 0; i < values.length; i++) { - var item = values[i]; - var itemInd; - - if(uniqueValueCounts[item] === undefined) { - // This item has a previously unseen value - uniqueValueCounts[item] = 1; - itemInd = uniqueValues.push(item) - 1; - uniqueValueInds[item] = itemInd; - } else { - // Increment count for this item - uniqueValueCounts[item]++; - itemInd = uniqueValueInds[item]; + function zoomMove(dx0, dy0) { + if(gd._transitioningWithDuration) { + return false; } - inds.push(itemInd); - } - - // Build UniqueInfo - var uniqueCounts = uniqueValues.map(function(v) { return uniqueValueCounts[v]; }); - return { - uniqueValues: uniqueValues, - uniqueCounts: uniqueCounts, - inds: inds - }; -} + var x1 = Math.max(0, Math.min(pw, dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var dx = Math.abs(x1 - x0); + var dy = Math.abs(y1 - y0); + box.l = Math.min(x0, x1); + box.r = Math.max(x0, x1); + box.t = Math.min(y0, y1); + box.b = Math.max(y0, y1); -/** - * Validate the requested display order for the dimensions. - * If the display order is a permutation of 0 through dimensions.length - 1, link to _displayindex - * Otherwise, replace the display order with the dimension order - * @param {Object} trace - */ -function validateDimensionDisplayInds(visibleDims) { - var displayInds = visibleDims.map(function(d) { return d.displayindex; }); - var i; + function noZoom() { + zoomMode = ''; + box.r = box.l; + box.t = box.b; + corners.attr('d', 'M0,0Z'); + } - if(isRangePermutation(displayInds)) { - for(i = 0; i < visibleDims.length; i++) { - visibleDims[i]._displayindex = visibleDims[i].displayindex; + if(isSubplotConstrained) { + if(dx > MINZOOM || dy > MINZOOM) { + zoomMode = 'xy'; + if(dx / pw > dy / ph) { + dy = dx * ph / pw; + if(y0 > y1) box.t = y0 - dy; + else box.b = y0 + dy; + } + else { + dx = dy * pw / ph; + if(x0 > x1) box.l = x0 - dx; + else box.r = x0 + dx; + } + corners.attr('d', xyCorners(box)); + } + else { + noZoom(); + } } - } else { - for(i = 0; i < visibleDims.length; i++) { - visibleDims[i]._displayindex = i; + // look for small drags in one direction or the other, + // and only drag the other axis + else if(!yActive || dy < Math.min(Math.max(dx * 0.6, MINDRAG), MINZOOM)) { + if(dx < MINDRAG || !xActive) { + noZoom(); + } else { + box.t = 0; + box.b = ph; + zoomMode = 'x'; + corners.attr('d', xCorners(box, y0)); + } } - } -} - - -/** - * Update category properties based on the unique values found for this dimension - * @param {Object} dim - * @param {UniqueInfo} uniqueInfoDim - */ -function validateCategoryProperties(dim, uniqueInfoDim) { - - // Update categoryarray - dim._categoryarray = uniqueInfoDim.uniqueValues; + else if(!xActive || dx < Math.min(dy * 0.6, MINZOOM)) { + box.l = 0; + box.r = pw; + zoomMode = 'y'; + corners.attr('d', yCorners(box, x0)); + } + else { + zoomMode = 'xy'; + corners.attr('d', xyCorners(box)); + } + box.w = box.r - box.l; + box.h = box.b - box.t; - // Handle ticktext - if(dim.ticktext === null || dim.ticktext === undefined) { - dim._ticktext = []; - } else { - // Shallow copy to avoid modifying input array - dim._ticktext = dim.ticktext.slice(); - } + if(zoomMode) zoomDragged = true; + gd._dragged = zoomDragged; - // Extend ticktext with elements from uniqueInfoDim.uniqueValues - for(var i = dim._ticktext.length; i < uniqueInfoDim.uniqueValues.length; i++) { - dim._ticktext.push(uniqueInfoDim.uniqueValues[i]); + updateZoombox(zb, corners, box, path0, dimmed, lum); + dimmed = true; } -} -/** - * Determine whether an array contains a permutation of the integers from 0 to the array's length - 1 - * @param {Array} inds - * @return {boolean} - */ -function isRangePermutation(inds) { - var indsSpecified = new Array(inds.length); + function zoomDone() { + updates = {}; - for(var i = 0; i < inds.length; i++) { - // Check for out of bounds - if(inds[i] < 0 || inds[i] >= inds.length) { - return false; + // more strict than dragged, which allows you to come back to where you started + // and still count as dragged + if(Math.min(box.h, box.w) < MINDRAG * 2) { + return removeZoombox(gd); } - // Check for collisions with already specified index - if(indsSpecified[inds[i]] !== undefined) { - return false; + // TODO: edit linked axes in zoomAxRanges and in dragTail + if(zoomMode === 'xy' || zoomMode === 'x') { + zoomAxRanges(xaxes, box.l / pw, box.r / pw, updates, links.xaxes); + } + if(zoomMode === 'xy' || zoomMode === 'y') { + zoomAxRanges(yaxes, (ph - box.b) / ph, (ph - box.t) / ph, updates, links.yaxes); } - indsSpecified[inds[i]] = true; + removeZoombox(gd); + dragTail(); + showDoubleClickNotifier(gd); } - // Nothing out of bounds and no collisions. We have a permutation - return true; -} - -},{"../../components/colorscale/calc":578,"../../components/colorscale/has_colorscale":584,"../../components/drawing":595,"../../lib":696,"../../lib/filter_unique.js":686,"../../lib/gup":693}],1003:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var handleDomainDefaults = _dereq_('../../plots/domain').defaults; -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var mergeLength = _dereq_('../parcoords/merge_length'); - -function handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce) { + // scroll zoom, on all draggers except corners + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? gd._fullLayout._plots[plotinfo.mainplot] : plotinfo; - coerce('line.shape'); - var lineColor = coerce('line.color', layout.colorway[0]); - if(hasColorscale(traceIn, 'line') && Lib.isArrayOrTypedArray(lineColor)) { - if(lineColor.length) { - coerce('line.colorscale'); - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c'}); - return lineColor.length; - } - else { - traceOut.line.color = defaultColor; + function zoomWheel(e) { + // deactivate mousewheel scrolling on embedded graphs + // devs can override this with layout._enablescrollzoom, + // but _ ensures this setting won't leave their page + if(!gd._context._scrollZoom.cartesian && !gd._fullLayout._enablescrollzoom) { + return; } - } - return Infinity; -} -function dimensionDefaults(dimensionIn, dimensionOut) { - function coerce(attr, dflt) { - return Lib.coerce(dimensionIn, dimensionOut, attributes.dimensions, attr, dflt); - } + clearAndResetSelect(); - var values = coerce('values'); - var visible = coerce('visible'); - if(!(values && values.length)) { - visible = dimensionOut.visible = false; - } + // If a transition is in progress, then disable any behavior: + if(gd._transitioningWithDuration) { + e.preventDefault(); + e.stopPropagation(); + return; + } - if(visible) { - // Dimension level - coerce('label'); - coerce('displayindex', dimensionOut._index); + recomputeAxisLists(); - // Category level - var arrayIn = dimensionIn.categoryarray; - var isValidArray = (Array.isArray(arrayIn) && arrayIn.length > 0); - - var orderDefault; - if(isValidArray) orderDefault = 'array'; - var order = coerce('categoryorder', orderDefault); - - // coerce 'categoryarray' only in array order case - if(order === 'array') { - coerce('categoryarray'); - coerce('ticktext'); - } else { - delete dimensionIn.categoryarray; - delete dimensionIn.ticktext; - } + clearTimeout(redrawTimer); - // cannot set 'categoryorder' to 'array' with an invalid 'categoryarray' - if(!isValidArray && order === 'array') { - dimensionOut.categoryorder = 'trace'; + var wheelDelta = -e.deltaY; + if(!isFinite(wheelDelta)) wheelDelta = e.wheelDelta / 10; + if(!isFinite(wheelDelta)) { + Lib.log('Did not find wheel motion attributes: ', e); + return; } - } -} -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { + 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 coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } + function zoomWheelOneAxis(ax, centerFraction, zoom) { + if(ax.fixedrange) return; - var dimensions = handleArrayContainerDefaults(traceIn, traceOut, { - name: 'dimensions', - handleItemDefaults: dimensionDefaults - }); + var axRange = Lib.simpleMap(ax.range, ax.r2l); + var v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; + function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } + ax.range = axRange.map(doZoom); + } - var len = handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); + if(editX) { + // if we're only zooming this axis because of constraints, + // zoom it about the center + if(!ew) xfrac = 0.5; - handleDomainDefaults(traceOut, layout, coerce); + for(i = 0; i < xaxes.length; i++) { + zoomWheelOneAxis(xaxes[i], xfrac, zoom); + } - if(!Array.isArray(dimensions) || !dimensions.length) { - traceOut.visible = false; - } + scrollViewBox[2] *= zoom; + scrollViewBox[0] += scrollViewBox[2] * xfrac * (1 / zoom - 1); + } + if(editY) { + if(!ns) yfrac = 0.5; - mergeLength(traceOut, dimensions, 'values', len); + for(i = 0; i < yaxes.length; i++) { + zoomWheelOneAxis(yaxes[i], yfrac, zoom); + } - coerce('hoveron'); - coerce('arrangement'); - coerce('bundlecolors'); - coerce('sortpaths'); - coerce('counts'); + scrollViewBox[3] *= zoom; + scrollViewBox[1] += scrollViewBox[3] * (1 - yfrac) * (1 / zoom - 1); + } - var labelfontDflt = { - family: layout.font.family, - size: Math.round(layout.font.size), - color: layout.font.color - }; + // viewbox redraw at first + updateSubplots(scrollViewBox); + ticksAndAnnotations(); - Lib.coerceFont(coerce, 'labelfont', labelfontDflt); + // then replot after a delay to make sure + // no more scrolling is coming + redrawTimer = setTimeout(function() { + scrollViewBox = [0, 0, pw, ph]; + dragTail(); + }, REDRAWDELAY); - var categoryfontDefault = { - family: layout.font.family, - size: Math.round(layout.font.size / 1.2), - color: layout.font.color - }; + e.preventDefault(); + return; + } - Lib.coerceFont(coerce, 'tickfont', categoryfontDefault); -}; + // everything but the corners gets wheel zoom + if(ns.length * ew.length !== 1) { + attachWheelEventHandler(dragger, zoomWheel); + } -},{"../../components/colorscale/defaults":580,"../../components/colorscale/has_colorscale":584,"../../lib":696,"../../plots/array_container_defaults":740,"../../plots/domain":770,"../parcoords/merge_length":1015,"./attributes":1000}],1004:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // plotDrag: move the plot in response to a drag + function plotDrag(dx, dy) { + // If a transition is in progress, then disable any behavior: + if(gd._transitioningWithDuration) { + return; + } -'use strict'; + // prevent axis drawing from monkeying with margins until we're done + gd._fullLayout._replotting = true; -var Parcats = {}; + if(xActive === 'ew' || yActive === 'ns') { + if(xActive) dragAxList(xaxes, dx); + if(yActive) dragAxList(yaxes, dy); + updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + ticksAndAnnotations(); + return; + } -Parcats.attributes = _dereq_('./attributes'); -Parcats.supplyDefaults = _dereq_('./defaults'); -Parcats.calc = _dereq_('./calc'); -Parcats.plot = _dereq_('./plot'); -Parcats.colorbar = { - container: 'line', - min: 'cmin', - max: 'cmax' -}; + // dz: set a new value for one end (0 or 1) of an axis array axArray, + // and return a pixel shift for that end for the viewbox + // based on pixel drag distance d + // TODO: this makes (generally non-fatal) errors when you get + // near floating point limits + function dz(axArray, end, d) { + var otherEnd = 1 - end; + var movedAx; + var newLinearizedEnd; + for(var i = 0; i < axArray.length; i++) { + var axi = axArray[i]; + 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); -Parcats.moduleType = 'trace'; -Parcats.name = 'parcats'; -Parcats.basePlotModule = _dereq_('./base_plot'); -Parcats.categories = ['noOpacity']; -Parcats.meta = { - -}; + // if l2r comes back false or undefined, it means we've dragged off + // the end of valid ranges - so stop. + if(newEnd !== false && newEnd !== undefined) axi.range[end] = newEnd; + } + return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / + (movedAx._rl[end] - movedAx._rl[otherEnd]); + } -module.exports = Parcats; + if(isSubplotConstrained && xActive && yActive) { + // dragging a corner of a constrained subplot: + // respect the fixed corner, but harmonize dx and dy + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; + dx = dxyFraction * pw; + dy = dxySign * dxyFraction * ph; + } -},{"./attributes":1000,"./base_plot":1001,"./calc":1002,"./defaults":1003,"./plot":1006}],1005:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(xActive === 'w') dx = dz(xaxes, 0, dx); + else if(xActive === 'e') dx = dz(xaxes, 1, -dx); + else if(!xActive) dx = 0; -'use strict'; + if(yActive === 'n') dy = dz(yaxes, 1, dy); + else if(yActive === 's') dy = dz(yaxes, 0, -dy); + else if(!yActive) dy = 0; -var d3 = _dereq_('d3'); -var Plotly = _dereq_('../../plot_api/plot_api'); -var Fx = _dereq_('../../components/fx'); -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../../components/drawing'); -var tinycolor = _dereq_('tinycolor2'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); + var x0 = (xActive === 'w') ? dx : 0; + var y0 = (yActive === 'n') ? dy : 0; -function performPlot(parcatsModels, graphDiv, layout, svg) { + if(isSubplotConstrained) { + var i; + if(!xActive && yActive.length === 1) { + // dragging one end of the y axis of a constrained subplot + // scale the other axis the same about its middle + for(i = 0; i < xaxes.length; i++) { + xaxes[i].range = xaxes[i]._r.slice(); + scaleZoom(xaxes[i], 1 - dy / ph); + } + dx = dy * pw / ph; + x0 = dx / 2; + } + if(!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 * ph / pw; + y0 = dy / 2; + } + } - var viewModels = parcatsModels.map(createParcatsViewModel.bind(0, graphDiv, layout)); + updateSubplots([x0, y0, pw - dx, ph - dy]); + ticksAndAnnotations(); + } - // Get (potentially empty) parcatslayer selection with bound data to single element array - var layerSelection = svg.selectAll('g.parcatslayer').data([null]); + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. + function ticksAndAnnotations() { + var activeAxIds = []; + var i; - // Initialize single parcatslayer group if it doesn't exist - layerSelection.enter() - .append('g') - .attr('class', 'parcatslayer') - .style('pointer-events', 'all'); - - // Bind data to children of layerSelection and get reference to traceSelection - var traceSelection = layerSelection - .selectAll('g.trace.parcats') - .data(viewModels, key); - - // Initialize group for each trace/dimensions - var traceEnter = traceSelection.enter() - .append('g') - .attr('class', 'trace parcats'); - - // Update properties for each trace - traceSelection - .attr('transform', function(d) { - return 'translate(' + d.x + ', ' + d.y + ')'; - }); - - // Initialize paths group - traceEnter - .append('g') - .attr('class', 'paths'); - - // Update paths transform - var pathsSelection = traceSelection - .select('g.paths'); - - // Get paths selection - var pathSelection = pathsSelection - .selectAll('path.path') - .data(function(d) { - return d.paths; - }, key); - - // Update existing path colors - pathSelection - .attr('fill', function(d) { - return d.model.color; - }); - - // Create paths - var pathSelectionEnter = pathSelection - .enter() - .append('path') - .attr('class', 'path') - .attr('stroke-opacity', 0) - .attr('fill', function(d) { - return d.model.color; - }) - .attr('fill-opacity', 0); + function pushActiveAxIds(axList) { + for(i = 0; i < axList.length; i++) { + if(!axList[i].fixedrange) activeAxIds.push(axList[i]._id); + } + } - stylePathsNoHover(pathSelectionEnter); + if(editX) { + pushActiveAxIds(xaxes); + pushActiveAxIds(links.xaxes); + } + if(editY) { + pushActiveAxIds(yaxes); + pushActiveAxIds(links.yaxes); + } - // Set path geometry - pathSelection - .attr('d', function(d) { - return d.svgD; - }); + updates = {}; + for(i = 0; i < activeAxIds.length; i++) { + var axId = activeAxIds[i]; + var ax = getFromId(gd, axId); + Axes.drawOne(gd, ax, {skipTitle: true}); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; + } - // sort paths - if(!pathSelectionEnter.empty()) { - // Only sort paths if there has been a change. - // Otherwise paths are already sorted or a hover operation may be in progress - pathSelection.sort(compareRawColor); + Axes.redrawComponents(gd, activeAxIds); } - // Remove any old paths - pathSelection.exit().remove(); - - // Path hover - pathSelection - .on('mouseover', mouseoverPath) - .on('mouseout', mouseoutPath) - .on('click', clickPath); + function doubleClick() { + if(gd._transitioningWithDuration) return; - // Initialize dimensions group - traceEnter.append('g').attr('class', 'dimensions'); + var doubleClickConfig = gd._context.doubleClick; + var axList = (xActive ? xaxes : []).concat(yActive ? yaxes : []); + var attrs = {}; - // Update dimensions transform - var dimensionsSelection = traceSelection - .select('g.dimensions'); + var ax, i, rangeInitial; - // Get dimension selection - var dimensionSelection = dimensionsSelection - .selectAll('g.dimension') - .data(function(d) { - return d.dimensions; - }, key); + // For reset+autosize mode: + // If *any* of the main axes is not at its initial range + // (or autoranged, if we have no initial range, to match the logic in + // doubleClickConfig === 'reset' below), we reset. + // If they are *all* at their initial ranges, then we autosize. + if(doubleClickConfig === 'reset+autosize') { - // Create dimension groups - dimensionSelection.enter() - .append('g') - .attr('class', 'dimension'); + doubleClickConfig = 'autosize'; - // Update dimension group transforms - dimensionSelection.attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; - }); + for(i = 0; i < axList.length; i++) { + ax = axList[i]; + if((ax._rangeInitial && ( + ax.range[0] !== ax._rangeInitial[0] || + ax.range[1] !== ax._rangeInitial[1] + )) || + (!ax._rangeInitial && !ax.autorange) + ) { + doubleClickConfig = 'reset'; + break; + } + } + } - // Remove any old dimensions - dimensionSelection.exit().remove(); + if(doubleClickConfig === 'autosize') { + // don't set the linked axes here, so relayout marks them as shrinkable + // and we autosize just to the requested axis/axes + for(i = 0; i < axList.length; i++) { + ax = axList[i]; + if(!ax.fixedrange) attrs[ax._name + '.autorange'] = true; + } + } + else if(doubleClickConfig === 'reset') { + // when we're resetting, reset all linked axes too, so we get back + // to the fully-auto-with-constraints situation + if(xActive || isSubplotConstrained) axList = axList.concat(links.xaxes); + if(yActive && !isSubplotConstrained) axList = axList.concat(links.yaxes); - // Get category selection - var categorySelection = dimensionSelection - .selectAll('g.category') - .data(function(d) { - return d.categories; - }, key); + if(isSubplotConstrained) { + if(!xActive) axList = axList.concat(xaxes); + else if(!yActive) axList = axList.concat(yaxes); + } - // Initialize category groups - var categoryGroupEnterSelection = categorySelection - .enter() - .append('g') - .attr('class', 'category'); + for(i = 0; i < axList.length; i++) { + ax = axList[i]; - // Update category transforms - categorySelection - .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; - }); + if(!ax.fixedrange) { + if(!ax._rangeInitial) { + attrs[ax._name + '.autorange'] = true; + } else { + rangeInitial = ax._rangeInitial; + attrs[ax._name + '.range[0]'] = rangeInitial[0]; + attrs[ax._name + '.range[1]'] = rangeInitial[1]; + } + } + } + } + gd.emit('plotly_doubleclick', null); + Registry.call('_guiRelayout', gd, attrs); + } - // Initialize rectangle - categoryGroupEnterSelection - .append('rect') - .attr('class', 'catrect') - .attr('pointer-events', 'none'); + // dragTail - finish a drag event with a redraw + function dragTail() { + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` + updateSubplots([0, 0, pw, ph]); + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { + gd._fullLayout._replotting = false; + Registry.call('_guiRelayout', gd, updates); + } + ], gd); + } - // Update rectangle - categorySelection.select('rect.catrect') - .attr('fill', 'none') - .attr('width', function(d) { - return d.width; - }) - .attr('height', function(d) { - return d.height; - }); + // x/y scaleFactor stash, + // minimizes number of per-point DOM updates in updateSubplots below + var xScaleFactorOld, yScaleFactorOld; - styleCategoriesNoHover(categoryGroupEnterSelection); + // updateSubplots - find all plot viewboxes that should be + // affected by this drag, and update them. look for all plots + // sharing an affected axis (including the one being dragged), + // includes also scattergl and splom logic. + function updateSubplots(viewBox) { + var fullLayout = gd._fullLayout; + var plotinfos = fullLayout._plots; + var subplots = fullLayout._subplots.cartesian; + var i, sp, xa, ya; - // Initialize color band rects - var bandSelection = categorySelection - .selectAll('rect.bandrect') - .data( - /** @param {CategoryViewModel} catViewModel*/ - function(catViewModel) { - return catViewModel.bands; - }, key); - - // Raise all update bands to the top so that fading enter/exit bands will be behind - bandSelection.each(function() {Lib.raiseToTop(this);}); - - // Update band color - bandSelection - .attr('fill', function(d) { - return d.color; - }); + if(hasSplom) { + Registry.subplotsRegistry.splom.drag(gd); + } - var bandsSelectionEnter = bandSelection.enter() - .append('rect') - .attr('class', 'bandrect') - .attr('stroke-opacity', 0) - .attr('fill', function(d) { - return d.color; - }) - .attr('fill-opacity', 0); + if(hasScatterGl) { + for(i = 0; i < subplots.length; i++) { + sp = plotinfos[subplots[i]]; + xa = sp.xaxis; + ya = sp.yaxis; - bandSelection - .attr('fill', function(d) { - return d.color; - }) - .attr('width', function(d) { - return d.width; - }) - .attr('height', function(d) { - return d.height; - }) - .attr('y', function(d) { - return d.y; - }) - .attr('cursor', - /** @param {CategoryBandViewModel} bandModel*/ - function(bandModel) { - if(bandModel.parcatsViewModel.arrangement === 'fixed') { - return 'default'; - } else if(bandModel.parcatsViewModel.arrangement === 'perpendicular') { - return 'ns-resize'; - } else { - return 'move'; + if(sp._scene) { + var xrng = Lib.simpleMap(xa.range, xa.r2l); + var yrng = Lib.simpleMap(ya.range, ya.r2l); + sp._scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]}); } - }); + } + } + + if(hasSplom || hasScatterGl) { + clearGlCanvases(gd); + redrawReglTraces(gd); + } - styleBandsNoHover(bandsSelectionEnter); + if(hasSVG) { + var xScaleFactor = viewBox[2] / xa0._length; + var yScaleFactor = viewBox[3] / ya0._length; - bandSelection.exit().remove(); + for(i = 0; i < subplots.length; i++) { + sp = plotinfos[subplots[i]]; + xa = sp.xaxis; + ya = sp.yaxis; - // Initialize category label - categoryGroupEnterSelection - .append('text') - .attr('class', 'catlabel') - .attr('pointer-events', 'none'); + var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; + var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; - var paperColor = graphDiv._fullLayout.paper_bgcolor; + var xScaleFactor2, yScaleFactor2; + var clipDx, clipDy; - // Update category label - categorySelection.select('text.catlabel') - .attr('text-anchor', - function(d) { - if(catInRightDim(d)) { - // Place label to the right of category - return 'start'; + if(editX2) { + xScaleFactor2 = xScaleFactor; + clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); } else { - // Place label to the left of category - return 'end'; + xScaleFactor2 = getLinkedScaleFactor(xa, xScaleFactor, yScaleFactor); + clipDx = scaleAndGetShift(xa, xScaleFactor2); } - }) - .attr('alignment-baseline', 'middle') - .style('text-shadow', - paperColor + ' -1px 1px 2px, ' + - paperColor + ' 1px 1px 2px, ' + - paperColor + ' 1px -1px 2px, ' + - paperColor + ' -1px -1px 2px') - .style('fill', 'rgb(0, 0, 0)') - .attr('x', - function(d) { - if(catInRightDim(d)) { - // Place label to the right of category - return d.width + 5; + if(editY2) { + yScaleFactor2 = yScaleFactor; + clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); } else { - // Place label to the left of category - return -5; + yScaleFactor2 = getLinkedScaleFactor(ya, xScaleFactor, yScaleFactor); + clipDy = scaleAndGetShift(ya, yScaleFactor2); } - }) - .attr('y', function(d) { - return d.height / 2; - }) - .text(function(d) { - return d.model.categoryLabel; - }) - .each( - /** @param {CategoryViewModel} catModel*/ - function(catModel) { - Drawing.font(d3.select(this), catModel.parcatsViewModel.categorylabelfont); - svgTextUtils.convertToTspans(d3.select(this), graphDiv); - }); - - // Initialize dimension label - categoryGroupEnterSelection - .append('text') - .attr('class', 'dimlabel'); - // Update dimension label - categorySelection.select('text.dimlabel') - .attr('text-anchor', 'middle') - .attr('alignment-baseline', 'baseline') - .attr('cursor', - /** @param {CategoryViewModel} catModel*/ - function(catModel) { - if(catModel.parcatsViewModel.arrangement === 'fixed') { - return 'default'; - } else { - return 'ew-resize'; + // don't scale at all if neither axis is scalable here + if(!xScaleFactor2 && !yScaleFactor2) { + continue; } - }) - .attr('x', function(d) { - return d.width / 2; - }) - .attr('y', -5) - .text(function(d, i) { - if(i === 0) { - // Add dimension label above topmost category - return d.parcatsViewModel.model.dimensions[d.model.dimensionInd].dimensionLabel; - } else { - return null; - } - }) - .each( - /** @param {CategoryViewModel} catModel*/ - function(catModel) { - Drawing.font(d3.select(this), catModel.parcatsViewModel.labelfont); - }); - - // Category hover - // categorySelection.select('rect.catrect') - categorySelection.selectAll('rect.bandrect') - .on('mouseover', mouseoverCategoryBand) - .on('mouseout', mouseoutCategory); - - // Remove unused categories - categorySelection.exit().remove(); - - // Setup drag - dimensionSelection.call(d3.behavior.drag() - .origin(function(d) { - return {x: d.x, y: 0}; - }) - .on('dragstart', dragDimensionStart) - .on('drag', dragDimension) - .on('dragend', dragDimensionEnd)); - - - // Save off selections to view models - traceSelection.each(function(d) { - d.traceSelection = d3.select(this); - d.pathSelection = d3.select(this).selectAll('g.paths').selectAll('path.path'); - d.dimensionSelection = d3.select(this).selectAll('g.dimensions').selectAll('g.dimension'); - }); - - // Remove any orphan traces - traceSelection.exit().remove(); -} - -/** - * Create / update parcat traces - * - * @param {Object} graphDiv - * @param {Object} svg - * @param {Array.} parcatsModels - * @param {Layout} layout - */ -module.exports = function(graphDiv, svg, parcatsModels, layout) { - performPlot(parcatsModels, graphDiv, layout, svg); -}; - -/** - * Function the returns the key property of an object for use with as D3 join function - * @param d - */ -function key(d) { - return d.key; -} - /** True if a category view model is in the right-most display dimension - * @param {CategoryViewModel} d */ -function catInRightDim(d) { - var numDims = d.parcatsViewModel.dimensions.length, - leftDimInd = d.parcatsViewModel.dimensions[numDims - 1].model.dimensionInd; - return d.model.dimensionInd === leftDimInd; -} + // but if only one is, reset the other axis scaling + if(!xScaleFactor2) xScaleFactor2 = 1; + if(!yScaleFactor2) yScaleFactor2 = 1; -/** - * @param {PathViewModel} a - * @param {PathViewModel} b - */ -function compareRawColor(a, b) { - if(a.model.rawColor > b.model.rawColor) { - return 1; - } else if(a.model.rawColor < b.model.rawColor) { - return -1; - } else { - return 0; - } -} + var plotDx = xa._offset - clipDx / xScaleFactor2; + var plotDy = ya._offset - clipDy / yScaleFactor2; -/** - * Handle path mouseover - * @param {PathViewModel} d - */ -function mouseoverPath(d) { + // TODO could be more efficient here: + // setTranslate and setScale do a lot of extra work + // when working independently, should perhaps combine + // them into a single routine. + sp.clipRect + .call(Drawing.setTranslate, clipDx, clipDy) + .call(Drawing.setScale, xScaleFactor2, yScaleFactor2); - if(!d.parcatsViewModel.dragDimension) { - // We're not currently dragging + sp.plot + .call(Drawing.setTranslate, plotDx, plotDy) + .call(Drawing.setScale, 1 / xScaleFactor2, 1 / yScaleFactor2); - if(d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) { - // hoverinfo is not skip, so we at least style the paths and emit interaction events - - // Raise path to top - Lib.raiseToTop(this); - - stylePathsHover(d3.select(this)); - - // Emit hover event - var points = buildPointsArrayForPath(d); - d.parcatsViewModel.graphDiv.emit('plotly_hover', {points: points, event: d3.event}); - - // Handle hover label - if(d.parcatsViewModel.hoverinfoItems.indexOf('none') === -1) { - // hoverinfo is a combination of 'count' and 'probability' - - // Mouse - var hoverX = d3.mouse(this)[0]; - - // Label - var gd = d.parcatsViewModel.graphDiv; - var fullLayout = gd._fullLayout; - var rootBBox = fullLayout._paperdiv.node().getBoundingClientRect(); - var graphDivBBox = d.parcatsViewModel.graphDiv.getBoundingClientRect(); - - // Find path center in path coordinates - var pathCenterX, - pathCenterY, - dimInd; - - for(dimInd = 0; dimInd < (d.leftXs.length - 1); dimInd++) { - if(d.leftXs[dimInd] + d.dimWidths[dimInd] - 2 <= hoverX && hoverX <= d.leftXs[dimInd + 1] + 2) { - var leftDim = d.parcatsViewModel.dimensions[dimInd]; - var rightDim = d.parcatsViewModel.dimensions[dimInd + 1]; - pathCenterX = (leftDim.x + leftDim.width + rightDim.x) / 2; - pathCenterY = (d.topYs[dimInd] + d.topYs[dimInd + 1] + d.height) / 2; - break; - } + // apply an inverse scale to individual points to counteract + // the scale of the trace group. + // apply only when scale changes, as adjusting the scale of + // all the points can be expansive. + if(xScaleFactor2 !== xScaleFactorOld || yScaleFactor2 !== yScaleFactorOld) { + Drawing.setPointGroupScale(sp.zoomScalePts, xScaleFactor2, yScaleFactor2); + Drawing.setTextPointsScale(sp.zoomScaleTxt, xScaleFactor2, yScaleFactor2); } - // Find path center in root coordinates - var hoverCenterX = d.parcatsViewModel.x + pathCenterX; - var hoverCenterY = d.parcatsViewModel.y + pathCenterY; - - var textColor = tinycolor.mostReadable(d.model.color, ['black', 'white']); - - // Build hover text - var hovertextParts = []; - if(d.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) { - hovertextParts.push(['Count:', d.model.count].join(' ')); - } - if(d.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) { - hovertextParts.push(['P:', (d.model.count / d.parcatsViewModel.model.count).toFixed(3)].join(' ')); - } - - var hovertext = hovertextParts.join('
'); - var mouseX = d3.mouse(gd)[0]; - - Fx.loneHover({ - x: hoverCenterX - rootBBox.left + graphDivBBox.left, - y: hoverCenterY - rootBBox.top + graphDivBBox.top, - text: hovertext, - color: d.model.color, - borderColor: 'black', - fontFamily: 'Monaco, "Courier New", monospace', - fontSize: 10, - fontColor: textColor, - idealAlign: mouseX < hoverCenterX ? 'right' : 'left' - }, { - container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node(), - gd: gd - }); + Drawing.hideOutsideRangePoints(sp.clipOnAxisFalseTraces, sp); + + // update x/y scaleFactor stash + xScaleFactorOld = xScaleFactor2; + yScaleFactorOld = yScaleFactor2; } } } -} - -/** - * Handle path mouseout - * @param {PathViewModel} d - */ -function mouseoutPath(d) { - if(!d.parcatsViewModel.dragDimension) { - // We're not currently dragging - stylePathsNoHover(d3.select(this)); - // Remove and hover label - Fx.loneUnhover(d.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()); - - // Restore path order - d.parcatsViewModel.pathSelection.sort(compareRawColor); + // Find the appropriate scaling for this axis, if it's linked to the + // dragged axes by constraints. 0 is special, it means this axis shouldn't + // ever be scaled (will be converted to 1 if the other axis is scaled) + function getLinkedScaleFactor(ax, xScaleFactor, yScaleFactor) { + if(ax.fixedrange) return 0; - // Emit unhover event - if(d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) { - var points = buildPointsArrayForPath(d); - d.parcatsViewModel.graphDiv.emit('plotly_unhover', {points: points, event: d3.event}); + if(editX && links.xaHash[ax._id]) { + return xScaleFactor; + } + if(editY && (isSubplotConstrained ? links.xaHash : links.yaHash)[ax._id]) { + return yScaleFactor; } + return 0; } -} - -/** - * Build array of point objects for a path - * - * For use in click/hover events - * @param {PathViewModel} d - */ -function buildPointsArrayForPath(d) { - var points = []; - var curveNumber = getTraceIndex(d.parcatsViewModel); - for(var i = 0; i < d.model.valueInds.length; i++) { - var pointNumber = d.model.valueInds[i]; - points.push({ - curveNumber: curveNumber, - pointNumber: pointNumber - }); + function scaleAndGetShift(ax, scaleFactor) { + if(scaleFactor) { + ax.range = ax._r.slice(); + scaleZoom(ax, scaleFactor); + return getShift(ax, scaleFactor); + } + return 0; } - return points; -} -/** - * Handle path click - * @param {PathViewModel} d - */ -function clickPath(d) { - if(d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) { - // hoverinfo it's skip, so interaction events aren't disabled - var points = buildPointsArrayForPath(d); - d.parcatsViewModel.graphDiv.emit('plotly_click', {points: points, event: d3.event}); + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; } -} -function stylePathsNoHover(pathSelection) { - pathSelection - .attr('fill', function(d) { - return d.model.color; - }) - .attr('fill-opacity', 0.6) - .attr('stroke', 'lightgray') - .attr('stroke-width', 0.2) - .attr('stroke-opacity', 1.0); + return dragger; } -function stylePathsHover(pathSelection) { - pathSelection - .attr('fill-opacity', 0.8) - .attr('stroke', function(d) { - return tinycolor.mostReadable(d.model.color, ['black', 'white']); - }) - .attr('stroke-width', 0.3); -} +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); + }); -function styleCategoryHover(categorySelection) { - categorySelection - .select('rect.catrect') - .attr('stroke', 'black') - .attr('stroke-width', 2.5); -} + dragger3.call(setCursor, cursor); -function styleCategoriesNoHover(categorySelection) { - categorySelection - .select('rect.catrect') - .attr('stroke', 'black') - .attr('stroke-width', 1) - .attr('stroke-opacity', 1); + return dragger3.node(); } -function styleBandsHover(bandsSelection) { - bandsSelection - .attr('stroke', 'black') - .attr('stroke-width', 1.5); +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 styleBandsNoHover(bandsSelection) { - bandsSelection - .attr('stroke', 'black') - .attr('stroke-width', 0.2) - .attr('stroke-opacity', 1.0) - .attr('fill-opacity', 1.0); +function isDirectionActive(axList, activeVal) { + for(var i = 0; i < axList.length; i++) { + if(!axList[i].fixedrange) return activeVal; + } + return ''; } -/** - * Return selection of all paths that pass through the specified category - * @param {CategoryBandViewModel} catBandViewModel - */ -function selectPathsThroughCategoryBandColor(catBandViewModel) { - - var allPaths = catBandViewModel.parcatsViewModel.pathSelection; - var dimInd = catBandViewModel.categoryViewModel.model.dimensionInd; - var catInd = catBandViewModel.categoryViewModel.model.categoryInd; +function getEndText(ax, end) { + var initialVal = ax.range[end]; + var diff = Math.abs(initialVal - ax.range[1 - end]); + var dig; - return allPaths - .filter( - /** @param {PathViewModel} pathViewModel */ - function(pathViewModel) { - return pathViewModel.model.categoryInds[dimInd] === catInd && - pathViewModel.model.color === catBandViewModel.color; - }); + // TODO: this should basically be ax.r2d but we're doing extra + // rounding here... can we clean up at all? + if(ax.type === 'date') { + return initialVal; + } + else if(ax.type === 'log') { + dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; + return d3.format('.' + dig + 'g')(Math.pow(10, initialVal)); + } + else { // linear numeric (or category... but just show numbers here) + dig = Math.floor(Math.log(Math.abs(initialVal)) / Math.LN10) - + Math.floor(Math.log(diff) / Math.LN10) + 4; + return d3.format('.' + String(dig) + 'g')(initialVal); + } } +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { + var i, + axi, + axRangeLinear0, + axRangeLinearSpan; -/** - * Perform hover styling for all paths that pass though the specified band element's category - * - * @param {HTMLElement} bandElement - * HTML element for band - * - */ -function styleForCategoryHovermode(bandElement) { - - // Get all bands in the current category - var bandSel = d3.select(bandElement.parentNode).selectAll('rect.bandrect'); + for(i = 0; i < axList.length; i++) { + axi = axList[i]; + if(axi.fixedrange) continue; - // Raise and style paths - bandSel.each(function(bvm) { - var paths = selectPathsThroughCategoryBandColor(bvm); - stylePathsHover(paths); - paths.each(function() { - // Raise path to top - Lib.raiseToTop(this); - }); - }); + axRangeLinear0 = axi._rl[0]; + axRangeLinearSpan = axi._rl[1] - axRangeLinear0; + axi.range = [ + axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), + axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) + ]; - // Style category - styleCategoryHover(d3.select(bandElement.parentNode)); -} + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; + } -/** - * Perform hover styling for all paths that pass though the category of the specified band element and share the - * same color - * - * @param {HTMLElement} bandElement - * HTML element for band - * - */ -function styleForColorHovermode(bandElement) { - var bandViewModel = d3.select(bandElement).datum(); - var catPaths = selectPathsThroughCategoryBandColor(bandViewModel); - stylePathsHover(catPaths); - catPaths.each(function() { - // Raise path to top - Lib.raiseToTop(this); - }); + // zoom linked axes about their centers + if(linkedAxes && linkedAxes.length) { + var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - // Style category for drag - d3.select(bandElement.parentNode) - .selectAll('rect.bandrect') - .filter(function(b) {return b.color === bandViewModel.color;}) - .each(function() { - Lib.raiseToTop(this); - styleBandsHover(d3.select(this)); - }); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); + } } - -/** - * @param {HTMLElement} bandElement - * HTML element for band - * @param eventName - * Event name (plotly_hover or plotly_click) - * @param event - * Mouse Event - */ -function emitPointsEventCategoryHovermode(bandElement, eventName, event) { - // Get all bands in the current category - var bandViewModel = d3.select(bandElement).datum(); - var gd = bandViewModel.parcatsViewModel.graphDiv; - var bandSel = d3.select(bandElement.parentNode).selectAll('rect.bandrect'); - - var points = []; - bandSel.each(function(bvm) { - var paths = selectPathsThroughCategoryBandColor(bvm); - paths.each(function(pathViewModel) { - // Extend points array - Array.prototype.push.apply(points, buildPointsArrayForPath(pathViewModel)); - }); - }); - - gd.emit(eventName, {points: points, event: event}); +function dragAxList(axList, pix) { + for(var i = 0; i < axList.length; i++) { + var axi = axList[i]; + if(!axi.fixedrange) { + axi.range = [ + axi.l2r(axi._rl[0] - pix / axi._m), + axi.l2r(axi._rl[1] - pix / axi._m) + ]; + } + } } -/** - * @param {HTMLElement} bandElement - * HTML element for band - * @param eventName - * Event name (plotly_hover or plotly_click) - * @param event - * Mouse Event - */ -function emitPointsEventColorHovermode(bandElement, eventName, event) { - var bandViewModel = d3.select(bandElement).datum(); - var gd = bandViewModel.parcatsViewModel.graphDiv; - var paths = selectPathsThroughCategoryBandColor(bandViewModel); - - var points = []; - paths.each(function(pathViewModel) { - // Extend points array - Array.prototype.push.apply(points, buildPointsArrayForPath(pathViewModel)); - }); - - gd.emit(eventName, {points: points, event: event}); +// common transform for dragging one end of an axis +// d>0 is compressing scale (cursor is over the plot, +// the axis end should move with the cursor) +// d<0 is expanding (cursor is off the plot, axis end moves +// nonlinearly so you can expand far) +function dZoom(d) { + return 1 - ((d >= 0) ? Math.min(d, 0.9) : + 1 / (1 / Math.max(d, -0.3) + 3.222)); } -/** - * Create hover label for a band element's category (for use when hoveron === 'category') - * - * @param {ClientRect} rootBBox - * Client bounding box for root of figure - * @param {HTMLElement} bandElement - * HTML element for band - * - */ -function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { - // Selections - var rectSelection = d3.select(bandElement.parentNode).select('rect.catrect'); - var rectBoundingBox = rectSelection.node().getBoundingClientRect(); - - // Models - /** @type {CategoryViewModel} */ - var catViewModel = rectSelection.datum(); - var parcatsViewModel = catViewModel.parcatsViewModel; - var dimensionModel = parcatsViewModel.model.dimensions[catViewModel.model.dimensionInd]; - - // Positions - var hoverCenterY = rectBoundingBox.top + rectBoundingBox.height / 2; - var hoverCenterX, - hoverLabelIdealAlign; - - if(parcatsViewModel.dimensions.length > 1 && - dimensionModel.displayInd === parcatsViewModel.dimensions.length - 1) { - - // right most dimension - hoverCenterX = rectBoundingBox.left; - hoverLabelIdealAlign = 'left'; - } else { - hoverCenterX = rectBoundingBox.left + rectBoundingBox.width; - hoverLabelIdealAlign = 'right'; - } - - // Hover label text - var hoverinfoParts = []; - if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) { - hoverinfoParts.push(['Count:', catViewModel.model.count].join(' ')); - } - if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) { - hoverinfoParts.push([ - 'P(' + catViewModel.model.categoryLabel + '):', - (catViewModel.model.count / catViewModel.parcatsViewModel.model.count).toFixed(3)].join(' ')); +function getDragCursor(nsew, dragmode, isMainDrag) { + if(!nsew) return 'pointer'; + if(nsew === 'nsew') { + // in this case here, clear cursor and + // use the cursor style set on + if(isMainDrag) return ''; + if(dragmode === 'pan') return 'move'; + return 'crosshair'; } + return nsew.toLowerCase() + '-resize'; +} - var hovertext = hoverinfoParts.join('
'); - return { - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, - text: hovertext, - color: 'lightgray', - borderColor: 'black', - fontFamily: 'Monaco, "Courier New", monospace', - fontSize: 12, - fontColor: 'black', - idealAlign: hoverLabelIdealAlign - }; +function makeZoombox(zoomlayer, lum, xs, ys, 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', 'translate(' + xs + ', ' + ys + ')') + .attr('d', path0 + 'Z'); } -/** - * Create hover label for a band element's category (for use when hoveron === 'category') - * - * @param {ClientRect} rootBBox - * Client bounding box for root of figure - * @param {HTMLElement} bandElement - * HTML element for band - * - */ -function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { +function makeCorners(zoomlayer, xs, ys) { + return zoomlayer.append('path') + .attr('class', 'zoombox-corners') + .style({ + fill: Color.background, + stroke: Color.defaultLine, + 'stroke-width': 1, + opacity: 0 + }) + .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('d', 'M0,0Z'); +} - var allHoverlabels = []; +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); +} - d3.select(bandElement.parentNode.parentNode) - .selectAll('g.category') - .select('rect.catrect') - .each(function() { - var bandNode = this; - allHoverlabels.push(createHoverLabelForCategoryHovermode(rootBBox, bandNode)); - }); +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); + } +} - return allHoverlabels; +function removeZoombox(gd) { + d3.select(gd) + .selectAll('.zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners') + .remove(); } -/** - * Create hover labels for a band element's category (for use when hoveron === 'dimension') - * - * @param {ClientRect} rootBBox - * Client bounding box for root of figure - * @param {HTMLElement} bandElement - * HTML element for band - * - */ -function createHoverLabelForColorHovermode(rootBBox, bandElement) { +function showDoubleClickNotifier(gd) { + if(SHOWZOOMOUTTIP && gd.data && gd._context.showTips) { + Lib.notifier(Lib._(gd, 'Double-click to zoom back out'), 'long'); + SHOWZOOMOUTTIP = false; + } +} - var bandBoundingBox = bandElement.getBoundingClientRect(); +function isSelectOrLasso(dragmode) { + return dragmode === 'lasso' || dragmode === 'select'; +} - // Models - /** @type {CategoryBandViewModel} */ - var bandViewModel = d3.select(bandElement).datum(); - var catViewModel = bandViewModel.categoryViewModel; - var parcatsViewModel = catViewModel.parcatsViewModel; - var dimensionModel = parcatsViewModel.model.dimensions[catViewModel.model.dimensionInd]; +function xCorners(box, y0) { + return 'M' + + (box.l - 0.5) + ',' + (y0 - MINZOOM - 0.5) + + 'h-3v' + (2 * MINZOOM + 1) + 'h3ZM' + + (box.r + 0.5) + ',' + (y0 - MINZOOM - 0.5) + + 'h3v' + (2 * MINZOOM + 1) + 'h-3Z'; +} - // positions - var hoverCenterY = bandBoundingBox.y + bandBoundingBox.height / 2; +function yCorners(box, x0) { + return 'M' + + (x0 - MINZOOM - 0.5) + ',' + (box.t - 0.5) + + 'v-3h' + (2 * MINZOOM + 1) + 'v3ZM' + + (x0 - MINZOOM - 0.5) + ',' + (box.b + 0.5) + + 'v3h' + (2 * MINZOOM + 1) + 'v-3Z'; +} - var hoverCenterX, - hoverLabelIdealAlign; - if(parcatsViewModel.dimensions.length > 1 && - dimensionModel.displayInd === parcatsViewModel.dimensions.length - 1) { - // right most dimension - hoverCenterX = bandBoundingBox.left; - hoverLabelIdealAlign = 'left'; - } else { - hoverCenterX = bandBoundingBox.left + bandBoundingBox.width; - hoverLabelIdealAlign = 'right'; - } +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'; +} - // Labels - var catLabel = catViewModel.model.categoryLabel; +function calcLinks(gd, xaHash, yaHash) { + var constraintGroups = gd._fullLayout._axisConstraintGroups; + var isSubplotConstrained = false; + var xLinks = {}; + var yLinks = {}; + var xID, yID, xLinkID, yLinkID; - // Counts - var totalCount = bandViewModel.parcatsViewModel.model.count; + for(var i = 0; i < constraintGroups.length; i++) { + var group = constraintGroups[i]; + // check if any of the x axes we're dragging is in this constraint group + for(xID in xaHash) { + if(group[xID]) { + // put the rest of these axes into xLinks, if we're not already + // dragging them, so we know to scale these axes automatically too + // to match the changes in the dragged x axes + for(xLinkID in group) { + if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + xLinks[xLinkID] = 1; + } + } - var bandColorCount = 0; - bandViewModel.categoryViewModel.bands.forEach(function(b) { - if(b.color === bandViewModel.color) { - bandColorCount += b.count; + // check if the x and y axes of THIS drag are linked + for(yID in yaHash) { + if(group[yID]) isSubplotConstrained = true; + } + } } - }); - - var catCount = catViewModel.model.count; - var colorCount = 0; - parcatsViewModel.pathSelection.each( - /** @param {PathViewModel} pathViewModel */ - function(pathViewModel) { - if(pathViewModel.model.color === bandViewModel.color) { - colorCount += pathViewModel.model.count; + // now check if any of the y axes we're dragging is in this constraint group + // only look for outside links, as we've already checked for links within the dragger + for(yID in yaHash) { + if(group[yID]) { + for(yLinkID in group) { + if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + yLinks[yLinkID] = 1; + } + } } - }); - - // Hover label text - var hoverinfoParts = []; - if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('count') !== -1) { - hoverinfoParts.push(['Count:', bandColorCount].join(' ')); + } } - if(catViewModel.parcatsViewModel.hoverinfoItems.indexOf('probability') !== -1) { - var pColorAndCatLable = 'P(color ∩ ' + catLabel + '): '; - var pColorAndCatValue = (bandColorCount / totalCount).toFixed(3); - var pColorAndCatRow = pColorAndCatLable + pColorAndCatValue; - hoverinfoParts.push(pColorAndCatRow); - var pCatGivenColorLabel = 'P(' + catLabel + ' | color): '; - var pCatGivenColorValue = (bandColorCount / colorCount).toFixed(3); - var pCatGivenColorRow = pCatGivenColorLabel + pCatGivenColorValue; - hoverinfoParts.push(pCatGivenColorRow); - - var pColorGivenCatLabel = 'P(color | ' + catLabel + '): '; - var pColorGivenCatValue = (bandColorCount / catCount).toFixed(3); - var pColorGivenCatRow = pColorGivenCatLabel + pColorGivenCatValue; - hoverinfoParts.push(pColorGivenCatRow); + if(isSubplotConstrained) { + // merge xLinks and yLinks if the subplot is constrained, + // since we'll always apply both anyway and the two will contain + // duplicates + Lib.extendFlat(xLinks, yLinks); + yLinks = {}; } - var hovertext = hoverinfoParts.join('
'); + var xaHashLinked = {}; + var xaxesLinked = []; + for(xLinkID in xLinks) { + var xa = getFromId(gd, xLinkID); + xaxesLinked.push(xa); + xaHashLinked[xa._id] = xa; + } - // Compute text color - var textColor = tinycolor.mostReadable(bandViewModel.color, ['black', 'white']); + var yaHashLinked = {}; + var yaxesLinked = []; + for(yLinkID in yLinks) { + var ya = getFromId(gd, yLinkID); + yaxesLinked.push(ya); + yaHashLinked[ya._id] = ya; + } return { - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, - // name: 'NAME', - text: hovertext, - color: bandViewModel.color, - borderColor: 'black', - fontFamily: 'Monaco, "Courier New", monospace', - fontColor: textColor, - fontSize: 10, - idealAlign: hoverLabelIdealAlign + xaHash: xaHashLinked, + yaHash: yaHashLinked, + xaxes: xaxesLinked, + yaxes: yaxesLinked, + isSubplotConstrained: isSubplotConstrained }; } -/** - * Handle dimension mouseover - * @param {CategoryBandViewModel} bandViewModel - */ -function mouseoverCategoryBand(bandViewModel) { - if(!bandViewModel.parcatsViewModel.dragDimension) { - // We're not currently dragging - - if(bandViewModel.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) { - // hoverinfo is not skip, so we at least style the bands and emit interaction events - - // Mouse - var mouseY = d3.mouse(this)[1]; - if(mouseY < -1) { - // Hover is above above the category rectangle (probably the dimension title text) - return; - } - - var gd = bandViewModel.parcatsViewModel.graphDiv; - var fullLayout = gd._fullLayout; - var rootBBox = fullLayout._paperdiv.node().getBoundingClientRect(); - var hoveron = bandViewModel.parcatsViewModel.hoveron; - - /** @type {HTMLElement} */ - var bandElement = this; - - // Handle style and events - if(hoveron === 'color') { - styleForColorHovermode(bandElement); - emitPointsEventColorHovermode(bandElement, 'plotly_hover', d3.event); - } else { - styleForCategoryHovermode(bandElement); - emitPointsEventCategoryHovermode(bandElement, 'plotly_hover', d3.event); - } +// still seems to be some confusion about onwheel vs onmousewheel... +function attachWheelEventHandler(element, handler) { + if(!supportsPassive) { + if(element.onwheel !== undefined) element.onwheel = handler; + else if(element.onmousewheel !== undefined) element.onmousewheel = handler; + } + else { + var wheelEventName = element.onwheel !== undefined ? 'wheel' : 'mousewheel'; - // Handle hover label - if(bandViewModel.parcatsViewModel.hoverinfoItems.indexOf('none') === -1) { - var hoverItems; - if(hoveron === 'category') { - hoverItems = createHoverLabelForCategoryHovermode(rootBBox, bandElement); - } else if(hoveron === 'color') { - hoverItems = createHoverLabelForColorHovermode(rootBBox, bandElement); - } else if(hoveron === 'dimension') { - hoverItems = createHoverLabelForDimensionHovermode(rootBBox, bandElement); - } - - if(hoverItems) { - Fx.multiHovers(hoverItems, { - container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node(), - gd: gd - }); - } - } + 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; +} -/** - * Handle dimension mouseover - * @param {CategoryBandViewModel} bandViewModel - */ -function mouseoutCategory(bandViewModel) { - - var parcatsViewModel = bandViewModel.parcatsViewModel; - - if(!parcatsViewModel.dragDimension) { - // We're not dragging anything - - // Reset unhovered styles - stylePathsNoHover(parcatsViewModel.pathSelection); - styleCategoriesNoHover(parcatsViewModel.dimensionSelection.selectAll('g.category')); - styleBandsNoHover(parcatsViewModel.dimensionSelection.selectAll('g.category').selectAll('rect.bandrect')); - - // Remove hover label - Fx.loneUnhover(parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()); - - // Restore path order - parcatsViewModel.pathSelection.sort(compareRawColor); - - // Emit unhover event - if(parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) { +module.exports = { + makeDragBox: makeDragBox, - var hoveron = bandViewModel.parcatsViewModel.hoveron; - var bandElement = this; + makeDragger: makeDragger, + makeRectDragger: makeRectDragger, + makeZoombox: makeZoombox, + makeCorners: makeCorners, - // Handle style and events - if(hoveron === 'color') { - emitPointsEventColorHovermode(bandElement, 'plotly_unhover', d3.event); - } else { - emitPointsEventCategoryHovermode(bandElement, 'plotly_unhover', d3.event); - } - } - } -} + updateZoombox: updateZoombox, + xyCorners: xyCorners, + transitionZoombox: transitionZoombox, + removeZoombox: removeZoombox, + showDoubleClickNotifier: showDoubleClickNotifier, + attachWheelEventHandler: attachWheelEventHandler +}; +},{"../../components/color":43,"../../components/dragelement":61,"../../components/drawing":64,"../../components/fx":82,"../../constants/alignment":138,"../../lib":159,"../../lib/clear_gl_canvases":148,"../../lib/setcursor":178,"../../lib/svg_text_utils":180,"../../plot_api/subroutines":194,"../../registry":243,"../plots":236,"./axes":203,"./axis_ids":206,"./constants":209,"./scale_zoom":220,"./select":221,"d3":8,"has-passive-events":13,"tinycolor2":26}],213:[function(_dereq_,module,exports){ /** - * Handle dimension drag start - * @param {DimensionViewModel} d - */ -function dragDimensionStart(d) { - - // Check if dragging is supported - if(d.parcatsViewModel.arrangement === 'fixed') { - return; - } - - // Save off initial drag indexes for dimension - d.dragDimensionDisplayInd = d.model.displayInd; - d.initialDragDimensionDisplayInds = d.parcatsViewModel.model.dimensions.map(function(d) {return d.displayInd;}); - d.dragHasMoved = false; - - // Check for category hit - d.dragCategoryDisplayInd = null; - d3.select(this) - .selectAll('g.category') - .select('rect.catrect') - .each( - /** @param {CategoryViewModel} catViewModel */ - function(catViewModel) { - var catMouseX = d3.mouse(this)[0]; - var catMouseY = d3.mouse(this)[1]; - - - if(-2 <= catMouseX && catMouseX <= catViewModel.width + 2 && - -2 <= catMouseY && catMouseY <= catViewModel.height + 2) { - - // Save off initial drag indexes for categories - d.dragCategoryDisplayInd = catViewModel.model.displayInd; - d.initialDragCategoryDisplayInds = d.model.categories.map(function(c) { - return c.displayInd; - }); +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // Initialize categories dragY to be the current y position - catViewModel.model.dragY = catViewModel.y; - // Raise category - Lib.raiseToTop(this.parentNode); +'use strict'; - // Get band element - d3.select(this.parentNode) - .selectAll('rect.bandrect') - /** @param {CategoryBandViewModel} bandViewModel */ - .each(function(bandViewModel) { - if(bandViewModel.y < catMouseY && catMouseY <= bandViewModel.y + bandViewModel.height) { - d.potentialClickBand = this; - } - }); - } - }); +var d3 = _dereq_('d3'); - // Update toplevel drag dimension - d.parcatsViewModel.dragDimension = d; +var Fx = _dereq_('../../components/fx'); +var dragElement = _dereq_('../../components/dragelement'); +var setCursor = _dereq_('../../lib/setcursor'); - // Remove hover label if any - Fx.loneUnhover(d.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()); -} +var makeDragBox = _dereq_('./dragbox').makeDragBox; +var DRAGGERSIZE = _dereq_('./constants').DRAGGERSIZE; -/** - * Handle dimension drag - * @param {DimensionViewModel} d - */ -function dragDimension(d) { +exports.initInteractions = function initInteractions(gd) { + var fullLayout = gd._fullLayout; - // Check if dragging is supported - if(d.parcatsViewModel.arrangement === 'fixed') { + if(gd._context.staticPlot) { + // this sweeps up more than just cartesian drag elements... + d3.select(gd).selectAll('.drag').remove(); return; } - d.dragHasMoved = true; - - if(d.dragDimensionDisplayInd === null) { - return; - } + if(!fullLayout._has('cartesian') && !fullLayout._has('splom')) return; - var dragDimInd = d.dragDimensionDisplayInd, - prevDimInd = dragDimInd - 1, - nextDimInd = dragDimInd + 1; + var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { + // sort overlays last, then by x axis number, then y axis number + 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; + }); - var dragDimension = d.parcatsViewModel - .dimensions[dragDimInd]; + subplots.forEach(function(subplot) { + var plotinfo = fullLayout._plots[subplot]; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - // Update category - if(d.dragCategoryDisplayInd !== null) { + // main and corner draggers need not be repeated for + // overlaid subplots - these draggers drag them all + if(!plotinfo.mainplot) { + // main dragger goes over the grids and data, so we use its + // mousemove events for all data hover effects + var maindrag = makeDragBox(gd, plotinfo, xa._offset, ya._offset, + xa._length, ya._length, 'ns', 'ew'); - var dragCategory = dragDimension.categories[d.dragCategoryDisplayInd]; + maindrag.onmousemove = function(evt) { + // This is on `gd._fullLayout`, *not* fullLayout because the reference + // changes by the time this is called again. + gd._fullLayout._rehover = function() { + if(gd._fullLayout._hoversubplot === subplot) { + Fx.hover(gd, evt, subplot); + } + }; - // Update dragY by dy - dragCategory.model.dragY += d3.event.dy; - var categoryY = dragCategory.model.dragY; + Fx.hover(gd, evt, subplot); - // Check for category drag swaps - var catDisplayInd = dragCategory.model.displayInd; - var dimCategoryViews = dragDimension.categories; + // Note that we have *not* used the cached fullLayout variable here + // since that may be outdated when this is called as a callback later on + gd._fullLayout._lasthover = maindrag; + gd._fullLayout._hoversubplot = subplot; + }; - var catAbove = dimCategoryViews[catDisplayInd - 1]; - var catBelow = dimCategoryViews[catDisplayInd + 1]; + /* + * IMPORTANT: + * We must check for the presence of the drag cover here. + * If we don't, a 'mouseout' event is triggered on the + * maindrag before each 'click' event, which has the effect + * of clearing the hoverdata; thus, cancelling the click event. + */ + maindrag.onmouseout = function(evt) { + if(gd._dragging) return; - // Check for overlap above - if(catAbove !== undefined) { + // When the mouse leaves this maindrag, unset the hovered subplot. + // This may cause problems if it leaves the subplot directly *onto* + // another subplot, but that's a tiny corner case at the moment. + gd._fullLayout._hoversubplot = null; - if(categoryY < (catAbove.y + catAbove.height / 2.0)) { + dragElement.unhover(gd, evt); + }; - // Swap display inds - dragCategory.model.displayInd = catAbove.model.displayInd; - catAbove.model.displayInd = catDisplayInd; + // corner draggers + if(gd._context.showAxisDragHandles) { + makeDragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset - DRAGGERSIZE, + DRAGGERSIZE, DRAGGERSIZE, 'n', 'w'); + makeDragBox(gd, plotinfo, xa._offset + xa._length, ya._offset - DRAGGERSIZE, + DRAGGERSIZE, DRAGGERSIZE, 'n', 'e'); + makeDragBox(gd, plotinfo, xa._offset - DRAGGERSIZE, ya._offset + ya._length, + DRAGGERSIZE, DRAGGERSIZE, 's', 'w'); + makeDragBox(gd, plotinfo, xa._offset + xa._length, ya._offset + ya._length, + DRAGGERSIZE, DRAGGERSIZE, 's', 'e'); } } - - if(catBelow !== undefined) { - - if((categoryY + dragCategory.height) > (catBelow.y + catBelow.height / 2.0)) { - - // Swap display inds - dragCategory.model.displayInd = catBelow.model.displayInd; - catBelow.model.displayInd = catDisplayInd; + if(gd._context.showAxisDragHandles) { + // x axis draggers - if you have overlaid plots, + // these drag each axis separately + if(subplot === xa._mainSubplot) { + // the y position of the main x axis line + var y0 = xa._mainLinePosition; + if(xa.side === 'top') y0 -= DRAGGERSIZE; + makeDragBox(gd, plotinfo, xa._offset + xa._length * 0.1, y0, + xa._length * 0.8, DRAGGERSIZE, '', 'ew'); + makeDragBox(gd, plotinfo, xa._offset, y0, + xa._length * 0.1, DRAGGERSIZE, '', 'w'); + makeDragBox(gd, plotinfo, xa._offset + xa._length * 0.9, y0, + xa._length * 0.1, DRAGGERSIZE, '', 'e'); + } + // y axis draggers + if(subplot === ya._mainSubplot) { + // the x position of the main y axis line + var x0 = ya._mainLinePosition; + if(ya.side !== 'right') x0 -= DRAGGERSIZE; + makeDragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.1, + DRAGGERSIZE, ya._length * 0.8, 'ns', ''); + makeDragBox(gd, plotinfo, x0, ya._offset + ya._length * 0.9, + DRAGGERSIZE, ya._length * 0.1, 's', ''); + makeDragBox(gd, plotinfo, x0, ya._offset, + DRAGGERSIZE, ya._length * 0.1, 'n', ''); } } + }); - // Update category drag display index - d.dragCategoryDisplayInd = dragCategory.model.displayInd; - } - - // Update dimension position - if(d.dragCategoryDisplayInd === null || d.parcatsViewModel.arrangement === 'freeform') { - dragDimension.model.dragX = d3.event.x; + // In case you mousemove over some hovertext, send it to Fx.hover too + // we do this so that we can put the hover text in front of everything, + // but still be able to interact with everything as if it isn't there + var hoverLayer = fullLayout._hoverlayer.node(); - // Check for dimension swaps - var prevDimension = d.parcatsViewModel.dimensions[prevDimInd]; - var nextDimension = d.parcatsViewModel.dimensions[nextDimInd]; + hoverLayer.onmousemove = function(evt) { + evt.target = gd._fullLayout._lasthover; + Fx.hover(gd, evt, fullLayout._hoversubplot); + }; - if(prevDimension !== undefined) { - if(dragDimension.model.dragX < (prevDimension.x + prevDimension.width)) { + hoverLayer.onclick = function(evt) { + evt.target = gd._fullLayout._lasthover; + Fx.click(gd, evt); + }; - // Swap display inds - dragDimension.model.displayInd = prevDimension.model.displayInd; - prevDimension.model.displayInd = dragDimInd; - } - } + // also delegate mousedowns... TODO: does this actually work? + hoverLayer.onmousedown = function(evt) { + gd._fullLayout._lasthover.onmousedown(evt); + }; - if(nextDimension !== undefined) { - if((dragDimension.model.dragX + dragDimension.width) > nextDimension.x) { + exports.updateFx(gd); +}; - // Swap display inds - dragDimension.model.displayInd = nextDimension.model.displayInd; - nextDimension.model.displayInd = d.dragDimensionDisplayInd; - } - } +// Minimal set of update needed on 'modebar' edits. +// We only need to update the cursor style. +// +// Note that changing the axis configuration and/or the fixedrange attribute +// should trigger a full initInteractions. +exports.updateFx = function(gd) { + var fullLayout = gd._fullLayout; + var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair'; + setCursor(fullLayout._draggers, cursor); +}; - // Update drag display index - d.dragDimensionDisplayInd = dragDimension.model.displayInd; - } +},{"../../components/dragelement":61,"../../components/fx":82,"../../lib/setcursor":178,"./constants":209,"./dragbox":212,"d3":8}],214:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // Update view models - updateDimensionViewModels(d.parcatsViewModel); - updatePathViewModels(d.parcatsViewModel); - // Update svg geometry - updateSvgCategories(d.parcatsViewModel); - updateSvgPaths(d.parcatsViewModel); -} +'use strict'; +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); /** - * Handle dimension drag end - * @param {DimensionViewModel} d + * Factory function for checking component arrays for subplot references. + * + * @param {string} containerArrayName: the top-level array in gd.layout to check + * If an item in this container is found that references a cartesian x and/or y axis, + * ensure cartesian is marked as a base plot module and record the axes (and subplot + * if both refs are axes) in gd._fullLayout + * + * @return {function}: with args layoutIn (gd.layout) and layoutOut (gd._fullLayout) + * as expected of a component includeBasePlot method */ -function dragDimensionEnd(d) { +module.exports = function makeIncludeComponents(containerArrayName) { + return function includeComponents(layoutIn, layoutOut) { + var array = layoutIn[containerArrayName]; + if(!Array.isArray(array)) return; - // Check if dragging is supported - if(d.parcatsViewModel.arrangement === 'fixed') { - 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'); - if(d.dragDimensionDisplayInd === null) { - return; - } + for(var i = 0; i < array.length; i++) { + var itemi = array[i]; + if(!Lib.isPlainObject(itemi)) continue; - d3.select(this).selectAll('text').attr('font-weight', 'normal'); + var xref = itemi.xref; + var yref = itemi.yref; - // Compute restyle command - // ----------------------- - var restyleData = {}; - var traceInd = getTraceIndex(d.parcatsViewModel); + var hasXref = idRegex.x.test(xref); + var hasYref = idRegex.y.test(yref); + if(hasXref || hasYref) { + if(!hasCartesianOrGL2D) Lib.pushUnique(layoutOut._basePlotModules, Cartesian); - // ### Handle dimension reordering ### - var finalDragDimensionDisplayInds = d.parcatsViewModel.model.dimensions.map(function(d) {return d.displayInd;}); - var anyDimsReordered = d.initialDragDimensionDisplayInds.some(function(initDimDisplay, dimInd) { - return initDimDisplay !== finalDragDimensionDisplayInds[dimInd]; - }); + 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(anyDimsReordered) { - finalDragDimensionDisplayInds.forEach(function(finalDimDisplay, dimInd) { - var containerInd = d.parcatsViewModel.model.dimensions[dimInd].containerInd; - restyleData['dimensions[' + containerInd + '].displayindex'] = finalDimDisplay; - }); - } + /* + * Notice the logic here: only add a subplot for a component if + * it's referencing both x and y axes AND it's creating a new axis + * so for example if your plot already has xy and x2y2, an annotation + * on x2y or xy2 will not create a new subplot. + */ + if(newAxis && hasXref && hasYref) { + cartesianList.push(xref + yref); + } + } + } + }; +}; - // ### Handle category reordering ### - var anyCatsReordered = false; - if(d.dragCategoryDisplayInd !== null) { - var finalDragCategoryDisplayInds = d.model.categories.map(function(c) { - return c.displayInd; - }); +},{"../../lib":159,"../../registry":243}],215:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - anyCatsReordered = d.initialDragCategoryDisplayInds.some(function(initCatDisplay, catInd) { - return initCatDisplay !== finalDragCategoryDisplayInds[catInd]; - }); - if(anyCatsReordered) { +'use strict'; - // Sort a shallow copy of the category models by display index - var sortedCategoryModels = d.model.categories.slice().sort( - function(a, b) { return a.displayInd - b.displayInd; }); +var d3 = _dereq_('d3'); - // Get new categoryarray and ticktext values - var newCategoryArray = sortedCategoryModels.map(function(v) { return v.categoryValue; }); - var newCategoryLabels = sortedCategoryModels.map(function(v) { return v.categoryLabel; }); +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var Plots = _dereq_('../plots'); +var Drawing = _dereq_('../../components/drawing'); - restyleData['dimensions[' + d.model.containerInd + '].categoryarray'] = [newCategoryArray]; - restyleData['dimensions[' + d.model.containerInd + '].ticktext'] = [newCategoryLabels]; - restyleData['dimensions[' + d.model.containerInd + '].categoryorder'] = 'array'; - } - } +var getModuleCalcData = _dereq_('../get_data').getModuleCalcData; +var axisIds = _dereq_('./axis_ids'); +var constants = _dereq_('./constants'); +var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); - // Handle potential click event - // ---------------------------- - if(d.parcatsViewModel.hoverinfoItems.indexOf('skip') === -1) { - if(!d.dragHasMoved && d.potentialClickBand) { - if(d.parcatsViewModel.hoveron === 'color') { - emitPointsEventColorHovermode(d.potentialClickBand, 'plotly_click', d3.event.sourceEvent); - } else { - emitPointsEventCategoryHovermode(d.potentialClickBand, 'plotly_click', d3.event.sourceEvent); - } - } - } +var ensureSingle = Lib.ensureSingle; - // Nullify drag states - // ------------------- - d.model.dragX = null; - if(d.dragCategoryDisplayInd !== null) { - var dragCategory = d.parcatsViewModel - .dimensions[d.dragDimensionDisplayInd] - .categories[d.dragCategoryDisplayInd]; +function ensureSingleAndAddDatum(parent, nodeType, className) { + return Lib.ensureSingle(parent, nodeType, className, function(s) { + s.datum(className); + }); +} - dragCategory.model.dragY = null; - d.dragCategoryDisplayInd = null; - } +exports.name = 'cartesian'; - d.dragDimensionDisplayInd = null; - d.parcatsViewModel.dragDimension = null; - d.dragHasMoved = null; - d.potentialClickBand = null; +exports.attr = ['xaxis', 'yaxis']; - // Update view models - // ------------------ - updateDimensionViewModels(d.parcatsViewModel); - updatePathViewModels(d.parcatsViewModel); +exports.idRoot = ['x', 'y']; - // Perform transition - // ------------------ - var transition = d3.transition() - .duration(300) - .ease('cubic-in-out'); +exports.idRegex = constants.idRegex; - transition - .each(function() { - updateSvgCategories(d.parcatsViewModel, true); - updateSvgPaths(d.parcatsViewModel, true); - }) - .each('end', function() { - if(anyDimsReordered || anyCatsReordered) { - // Perform restyle if the order of categories or dimensions changed - Plotly.restyle(d.parcatsViewModel.graphDiv, restyleData, [traceInd]); - } - }); -} +exports.attrRegex = constants.attrRegex; -/** - * - * @param {ParcatsViewModel} parcatsViewModel - */ -function getTraceIndex(parcatsViewModel) { - var traceInd; - var allTraces = parcatsViewModel.graphDiv._fullData; - for(var i = 0; i < allTraces.length; i++) { - if(parcatsViewModel.key === allTraces[i].uid) { - traceInd = i; - break; - } - } - return traceInd; -} +exports.attributes = _dereq_('./attributes'); -/** Update the svg paths for view model - * @param {ParcatsViewModel} parcatsViewModel - * @param {boolean} hasTransition Whether to update element with transition - */ -function updateSvgPaths(parcatsViewModel, hasTransition) { +exports.layoutAttributes = _dereq_('./layout_attributes'); - if(hasTransition === undefined) { - hasTransition = false; - } +exports.supplyLayoutDefaults = _dereq_('./layout_defaults'); - function transition(selection) { - return hasTransition ? selection.transition() : selection; - } +exports.transitionAxes = _dereq_('./transition_axes'); - // Update binding - parcatsViewModel.pathSelection.data(function(d) { - return d.paths; - }, key); +exports.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, xi, yi; - // Update paths - transition(parcatsViewModel.pathSelection).attr('d', function(d) { - return d.svgD; - }); -} + for(i = 0; i < spAll.length; i++) { + var parts = spAll[i].split('y'); + allX[parts[0]] = 1; + allY['y' + parts[1]] = 1; + } -/** Update the svg paths for view model - * @param {ParcatsViewModel} parcatsViewModel - * @param {boolean} hasTransition Whether to update element with transition - */ -function updateSvgCategories(parcatsViewModel, hasTransition) { + // check for x axes with no subplot, and make one from the anchor of that x axis + for(i = 0; i < xList.length; i++) { + xi = xList[i]; + if(!allX[xi]) { + yi = (layoutIn[axisIds.id2name(xi)] || {}).anchor; + if(!constants.idRegex.y.test(yi)) yi = 'y'; + spSVG.push(xi + yi); + spAll.push(xi + yi); - if(hasTransition === undefined) { - hasTransition = false; + if(!allY[yi]) { + allY[yi] = 1; + Lib.pushUnique(yList, yi); + } + } } - function transition(selection) { - return hasTransition ? selection.transition() : selection; - } + // same for y axes with no subplot + for(i = 0; i < yList.length; i++) { + yi = yList[i]; + if(!allY[yi]) { + xi = (layoutIn[axisIds.id2name(yi)] || {}).anchor; + if(!constants.idRegex.x.test(xi)) xi = 'x'; + spSVG.push(xi + yi); + spAll.push(xi + yi); - // Update binding - parcatsViewModel.dimensionSelection - .data(function(d) { - return d.dimensions;}, key); - - var categorySelection = parcatsViewModel.dimensionSelection - .selectAll('g.category') - .data(function(d) {return d.categories;}, key); - - // Update dimension position - transition(parcatsViewModel.dimensionSelection) - .attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; - }); - - // Update category position - transition(categorySelection) - .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; - }); - - var dimLabelSelection = categorySelection.select('.dimlabel'); - - // ### Update dimension label - // Only the top-most display category should have the dimension label - dimLabelSelection - .text(function(d, i) { - if(i === 0) { - // Add dimension label above topmost category - return d.parcatsViewModel.model.dimensions[d.model.dimensionInd].dimensionLabel; - } else { - return null; + if(!allX[xi]) { + allX[xi] = 1; + Lib.pushUnique(xList, xi); } - }); + } + } - // Update category label - // Categories in the right-most display dimension have their labels on - // the right, all others on the left - var catLabelSelection = categorySelection.select('.catlabel'); - catLabelSelection - .attr('text-anchor', - function(d) { - if(catInRightDim(d)) { - // Place label to the right of category - return 'start'; - } else { - // Place label to the left of category - return 'end'; + // finally, if we've gotten here we're supposed to show cartesian... + // so if there are NO subplots at all, make one from the first + // x & y axes in the input layout + if(!spAll.length) { + xi = ''; + yi = ''; + for(var ki in layoutIn) { + if(constants.attrRegex.test(ki)) { + var axLetter = ki.charAt(0); + if(axLetter === 'x') { + if(!xi || (+ki.substr(5) < +xi.substr(5))) { + xi = ki; + } } - }) - .attr('x', - function(d) { - if(catInRightDim(d)) { - // Place label to the right of category - return d.width + 5; - } else { - // Place label to the left of category - return -5; + else if(!yi || (+ki.substr(5) < +yi.substr(5))) { + yi = ki; } - }) - .each(function(d) { - // Update attriubutes of elements - var newX; - var newAnchor; - if(catInRightDim(d)) { - // Place label to the right of category - newX = d.width + 5; - newAnchor = 'start'; - } else { - // Place label to the left of category - newX = -5; - newAnchor = 'end'; - } - d3.select(this) - .selectAll('tspan') - .attr('x', newX) - .attr('text-anchor', newAnchor); - }); - - // Update bands - // Initialize color band rects - var bandSelection = categorySelection - .selectAll('rect.bandrect') - .data( - /** @param {CategoryViewModel} catViewModel*/ - function(catViewModel) { - return catViewModel.bands; - }, key); - - var bandsSelectionEnter = bandSelection.enter() - .append('rect') - .attr('class', 'bandrect') - .attr('cursor', 'move') - .attr('stroke-opacity', 0) - .attr('fill', function(d) { - return d.color; - }) - .attr('fill-opacity', 0); - - bandSelection - .attr('fill', function(d) { - return d.color; - }) - .attr('width', function(d) { - return d.width; - }) - .attr('height', function(d) { - return d.height; - }) - .attr('y', function(d) { - return d.y; - }); - - styleBandsNoHover(bandsSelectionEnter); - - // Raise bands to the top - bandSelection.each(function() {Lib.raiseToTop(this);}); - - // Remove unused bands - bandSelection.exit().remove(); -} - -/** - * Create a ParcatsViewModel traces - * @param {Object} graphDiv - * Top-level graph div element - * @param {Layout} layout - * SVG layout object - * @param {Array.} wrappedParcatsModel - * Wrapped ParcatsModel for this trace - * @return {ParcatsViewModel} - */ -function createParcatsViewModel(graphDiv, layout, wrappedParcatsModel) { - // Unwrap model - var parcatsModel = wrappedParcatsModel[0]; - - // Compute margin - var margin = layout.margin || {l: 80, r: 80, t: 100, b: 80}; - - // Compute pixel position/extents - var trace = parcatsModel.trace, - domain = trace.domain, - figureWidth = layout.width, - figureHeight = layout.height, - traceWidth = Math.floor(figureWidth * (domain.x[1] - domain.x[0])), - traceHeight = Math.floor(figureHeight * (domain.y[1] - domain.y[0])), - traceX = domain.x[0] * figureWidth + margin.l, - traceY = layout.height - domain.y[1] * layout.height + margin.t; - - // Handle path shape - // ----------------- - var pathShape = trace.line.shape; - - // Handle hover info - // ----------------- - var hoverinfoItems; - if(trace.hoverinfo === 'all') { - hoverinfoItems = ['count', 'probability']; - } else { - hoverinfoItems = trace.hoverinfo.split('+'); + } + } + xi = xi ? axisIds.name2id(xi) : 'x'; + yi = yi ? axisIds.name2id(yi) : 'y'; + xList.push(xi); + yList.push(yi); + spSVG.push(xi + yi); } - - // Construct parcatsViewModel - // -------------------------- - var parcatsViewModel = { - key: trace.uid, - model: parcatsModel, - x: traceX, - y: traceY, - width: traceWidth, - height: traceHeight, - hoveron: trace.hoveron, - hoverinfoItems: hoverinfoItems, - arrangement: trace.arrangement, - bundlecolors: trace.bundlecolors, - sortpaths: trace.sortpaths, - labelfont: trace.labelfont, - categorylabelfont: trace.tickfont, - pathShape: pathShape, - dragDimension: null, - margin: margin, - paths: [], - dimensions: [], - graphDiv: graphDiv, - traceSelection: null, - pathSelection: null, - dimensionSelection: null - }; - - // Update dimension view models if we have at least 1 dimension - if(parcatsModel.dimensions) { - updateDimensionViewModels(parcatsViewModel); - - // Update path view models if we have at least 2 dimensions - updatePathViewModels(parcatsViewModel); - } - // Inside a categories view model - return parcatsViewModel; -} +}; /** - * Build the SVG string to represents a parallel categories path - * @param {Array.} leftXPositions - * Array of the x positions of the left edge of each dimension (in display order) - * @param {Array.} pathYs - * Array of the y positions of the top of the path at each dimension (in display order) - * @param {Array.} dimWidths - * Array of the widths of each dimension in display order - * @param {Number} pathHeight - * The height of the path in pixels - * @param {Number} curvature - * The curvature factor for the path. 0 results in a straight line and values greater than zero result in curved paths - * @return {string} + * Cartesian.plot + * + * @param {DOM div | object} gd + * @param {array | null} (optional) traces + * array of traces indices to plot + * if undefined, plots all cartesian traces, + * if null, plots no traces + * @param {object} (optional) transitionOpts + * transition option object + * @param {function} (optional) makeOnCompleteCallback + * transition make callback function from Plots.transition */ -function buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, curvature) { - - // Compute the x midpoint of each path segment - var xRefPoints1 = [], - xRefPoints2 = [], - refInterpolator, - d; +exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { + var fullLayout = gd._fullLayout; + var subplots = fullLayout._subplots.cartesian; + var calcdata = gd.calcdata; + var i; - for(d = 0; d < dimWidths.length - 1; d++) { - refInterpolator = d3.interpolateNumber(dimWidths[d] + leftXPositions[d], leftXPositions[d + 1]); - xRefPoints1.push(refInterpolator(curvature)); - xRefPoints2.push(refInterpolator(1 - curvature)); + if(traces === null) { + // this means no updates required, must return here + // so that plotOne doesn't remove the trace layers + return; + } else if(!Array.isArray(traces)) { + // If traces is not provided, then it's a complete replot and missing + // traces are removed + traces = []; + for(i = 0; i < calcdata.length; i++) traces.push(i); } - // Move to top of path on left edge of left-most category - var svgD = 'M ' + leftXPositions[0] + ',' + pathYs[0]; + for(i = 0; i < subplots.length; i++) { + var subplot = subplots[i]; + var subplotInfo = fullLayout._plots[subplot]; + + // Get all calcdata for this subplot: + var cdSubplot = []; + var pcd; - // Horizontal line to right edge - svgD += 'l' + dimWidths[0] + ',0 '; + for(var j = 0; j < calcdata.length; j++) { + var cd = calcdata[j]; + var trace = cd[0].trace; - // Horizontal line to right edge - for(d = 1; d < dimWidths.length; d++) { + // Skip trace if whitelist provided and it's not whitelisted: + // if (Array.isArray(traces) && traces.indexOf(i) === -1) continue; + if(trace.xaxis + trace.yaxis === subplot) { + // XXX: Should trace carpet dependencies. Only replot all carpet plots if the carpet + // axis has actually changed: + // + // If this trace is specifically requested, add it to the list: + if(traces.indexOf(trace.index) !== -1 || trace.carpet) { + // Okay, so example: traces 0, 1, and 2 have fill = tonext. You animate + // traces 0 and 2. Trace 1 also needs to be updated, otherwise its fill + // is outdated. So this retroactively adds the previous trace if the + // traces are interdependent. + 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); + } - // Curve to left edge of category - svgD += 'C' + xRefPoints1[d - 1] + ',' + pathYs[d - 1] + - ' ' + xRefPoints2[d - 1] + ',' + pathYs[d] + - ' ' + leftXPositions[d] + ',' + pathYs[d]; + cdSubplot.push(cd); + } - // svgD += 'L' + leftXPositions[d] + ',' + pathYs[d]; + // Track the previous trace on this subplot for the retroactive-add step + // above: + pcd = cd; + } + } - // Horizontal line to right edge - svgD += 'l' + dimWidths[d] + ',0 '; + plotOne(gd, subplotInfo, cdSubplot, transitionOpts, makeOnCompleteCallback); } +}; - // Line down - svgD += 'l' + '0,' + pathHeight + ' '; - - // Line to left edge of right-most category - svgD += 'l -' + dimWidths[dimWidths.length - 1] + ',0 '; - - for(d = dimWidths.length - 2; d >= 0; d--) { - - // Curve to right edge of category - svgD += 'C' + xRefPoints2[d] + ',' + (pathYs[d + 1] + pathHeight) + - ' ' + xRefPoints1[d] + ',' + (pathYs[d] + pathHeight) + - ' ' + (leftXPositions[d] + dimWidths[d]) + ',' + (pathYs[d] + pathHeight); +function plotOne(gd, plotinfo, cdSubplot, transitionOpts, makeOnCompleteCallback) { + var traceLayerClasses = constants.traceLayerClasses; + var fullLayout = gd._fullLayout; + var modules = fullLayout._modules; + var _module, cdModuleAndOthers, cdModule; - // svgD += 'L' + (leftXPositions[d] + dimWidths[d]) + ',' + (pathYs[d] + pathHeight); + var layerData = []; + var zoomScaleQueryParts = []; - // Horizontal line to right edge - svgD += 'l-' + dimWidths[d] + ',0 '; - } + for(var i = 0; i < modules.length; i++) { + _module = modules[i]; + var name = _module.name; + var categories = Registry.modules[name].categories; - // Close path - svgD += 'Z'; - return svgD; -} + if(categories.svg) { + var className = (_module.layerName || name + 'layer'); + var plotMethod = _module.plot; -/** - * Update the path view models based on the dimension view models in a ParcatsViewModel - * - * @param {ParcatsViewModel} parcatsViewModel - * View model for trace - */ -function updatePathViewModels(parcatsViewModel) { + // plot all visible traces of this type on this subplot at once + cdModuleAndOthers = getModuleCalcData(cdSubplot, plotMethod); + cdModule = cdModuleAndOthers[0]; + // don't need to search the found traces again - in fact we need to NOT + // so that if two modules share the same plotter we don't double-plot + cdSubplot = cdModuleAndOthers[1]; - // Initialize an array of the y position of the top of the next path to be added to each category. - // - // nextYPositions[d][c] is the y position of the next path through category with index c of dimension with index d - var dimensionViewModels = parcatsViewModel.dimensions; - var parcatsModel = parcatsViewModel.model; - var nextYPositions = dimensionViewModels.map( - function(d) { - return d.categories.map( - function(c) { - return c.y; + if(cdModule.length) { + layerData.push({ + i: traceLayerClasses.indexOf(className), + className: className, + plotMethod: plotMethod, + cdModule: cdModule }); - }); - - // Array from category index to category display index for each true dimension index - var catToDisplayIndPerDim = parcatsViewModel.model.dimensions.map( - function(d) { - return d.categories.map(function(c) {return c.displayInd;}); - }); - - // Array from true dimension index to dimension display index - var dimToDisplayInd = parcatsViewModel.model.dimensions.map(function(d) {return d.displayInd;}); - var displayToDimInd = parcatsViewModel.dimensions.map(function(d) {return d.model.dimensionInd;}); - - // Array of the x position of the left edge of the rectangles for each dimension - var leftXPositions = dimensionViewModels.map( - function(d) { - return d.x; - }); - - // Compute dimension widths - var dimWidths = dimensionViewModels.map(function(d) {return d.width;}); + } - // Build sorted Array of PathModel objects - var pathModels = []; - for(var p in parcatsModel.paths) { - if(parcatsModel.paths.hasOwnProperty(p)) { - pathModels.push(parcatsModel.paths[p]); + if(categories.zoomScale) { + zoomScaleQueryParts.push('.' + className); + } } } - // Compute category display inds to use for sorting paths - function pathDisplayCategoryInds(pathModel) { - var dimensionInds = pathModel.categoryInds.map(function(catInd, dimInd) {return catToDisplayIndPerDim[dimInd][catInd];}); - var displayInds = displayToDimInd.map(function(dimInd) { - return dimensionInds[dimInd]; - }); - return displayInds; - } + layerData.sort(function(a, b) { return a.i - b.i; }); - // Sort in ascending order by display index array - pathModels.sort(function(v1, v2) { + var layers = plotinfo.plot.selectAll('g.mlayer') + .data(layerData, function(d) { return d.className; }); - // Build display inds for each path - var sortArray1 = pathDisplayCategoryInds(v1); - var sortArray2 = pathDisplayCategoryInds(v2); + layers.enter().append('g') + .attr('class', function(d) { return d.className; }) + .classed('mlayer', true); - // Handle path sort order - if(parcatsViewModel.sortpaths === 'backward') { - sortArray1.reverse(); - sortArray2.reverse(); - } + layers.exit().remove(); - // Append the first value index of the path to break ties - sortArray1.push(v1.valueInds[0]); - sortArray2.push(v2.valueInds[0]); + layers.order(); - // Handle color bundling - if(parcatsViewModel.bundlecolors) { - // Prepend sort array with the raw color value - sortArray1.unshift(v1.rawColor); - sortArray2.unshift(v2.rawColor); - } + layers.each(function(d) { + var sel = d3.select(this); + var className = d.className; - // colors equal, sort by display categories - if(sortArray1 < sortArray2) { - return -1; - } - if(sortArray1 > sortArray2) { - return 1; - } + d.plotMethod( + gd, plotinfo, d.cdModule, sel, + transitionOpts, makeOnCompleteCallback + ); - return 0; + // layers that allow `cliponaxis: false` + if(className !== 'scatterlayer' && className !== 'barlayer') { + Drawing.setClipUrl(sel, plotinfo.layerClipId, gd); + } }); - // Create path models - var pathViewModels = new Array(pathModels.length), - totalCount = dimensionViewModels[0].model.count, - totalHeight = dimensionViewModels[0].categories - .map(function(c) { - return c.height;}).reduce( - function(v1, v2) {return v1 + v2;}); - + // call Scattergl.plot separately + if(fullLayout._has('scattergl')) { + _module = Registry.getModule('scattergl'); + cdModule = getModuleCalcData(cdSubplot, _module)[0]; + _module.plot(gd, plotinfo, cdModule); + } - for(var pathNumber = 0; pathNumber < pathModels.length; pathNumber++) { - var pathModel = pathModels[pathNumber]; - - var pathHeight; - if(totalCount > 0) { - pathHeight = totalHeight * (pathModel.count / totalCount); - } else { - pathHeight = 0; + // stash "hot" selections for faster interaction on drag and scroll + if(!gd._context.staticPlot) { + if(plotinfo._hasClipOnAxisFalse) { + plotinfo.clipOnAxisFalseTraces = plotinfo.plot + .selectAll('.scatterlayer, .barlayer') + .selectAll('.trace'); } - // Build path y coords - var pathYs = new Array(nextYPositions.length); - for(var d = 0; d < pathModel.categoryInds.length; d++) { - var catInd = pathModel.categoryInds[d]; - var catDisplayInd = catToDisplayIndPerDim[d][catInd]; - var dimDisplayInd = dimToDisplayInd[d]; - - // Update next y position - pathYs[dimDisplayInd] = nextYPositions[dimDisplayInd][catDisplayInd]; - nextYPositions[dimDisplayInd][catDisplayInd] += pathHeight; - - // Update category color information - var catViewModle = parcatsViewModel.dimensions[dimDisplayInd].categories[catDisplayInd]; - var numBands = catViewModle.bands.length; - var lastCatBand = catViewModle.bands[numBands - 1]; - - if(lastCatBand === undefined || pathModel.rawColor !== lastCatBand.rawColor) { - // Create a new band - var bandY = lastCatBand === undefined ? 0 : lastCatBand.y + lastCatBand.height; - catViewModle.bands.push({ - key: bandY, - color: pathModel.color, - rawColor: pathModel.rawColor, - height: pathHeight, - width: catViewModle.width, - count: pathModel.count, - y: bandY, - categoryViewModel: catViewModle, - parcatsViewModel: parcatsViewModel - }); - } else { - // Extend current band - var currentBand = catViewModle.bands[numBands - 1]; - currentBand.height += pathHeight; - currentBand.count += pathModel.count; - } - } + if(zoomScaleQueryParts.length) { + var traces = plotinfo.plot + .selectAll(zoomScaleQueryParts.join(',')) + .selectAll('.trace'); - // build svg path - var svgD; - if(parcatsViewModel.pathShape === 'hspline') { - svgD = buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, 0.5); - } else { - svgD = buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, 0); + plotinfo.zoomScalePts = traces.selectAll('path.point'); + plotinfo.zoomScaleTxt = traces.selectAll('.textpoint'); } - - pathViewModels[pathNumber] = { - key: pathModel.valueInds[0], - model: pathModel, - height: pathHeight, - leftXs: leftXPositions, - topYs: pathYs, - dimWidths: dimWidths, - svgD: svgD, - parcatsViewModel: parcatsViewModel - }; } - - parcatsViewModel.paths = pathViewModels; - - // * @property key - // * Unique key for this model - // * @property {PathModel} model - // * Source path model - // * @property {Number} height - // * Height of this path (pixels) - // * @property {String} svgD - // * SVG path "d" attribute string } -/** - * Update the dimension view models based on the dimension models in a ParcatsViewModel - * - * @param {ParcatsViewModel} parcatsViewModel - * View model for trace - */ -function updateDimensionViewModels(parcatsViewModel) { - - // Compute dimension ordering - var dimensionsIndInfo = parcatsViewModel.model.dimensions.map(function(d) { - return {displayInd: d.displayInd, dimensionInd: d.dimensionInd}; - }); - - dimensionsIndInfo.sort(function(a, b) { - return a.displayInd - b.displayInd; - }); +exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { + var oldPlots = oldFullLayout._plots || {}; + var newPlots = newFullLayout._plots || {}; + var oldSubplotList = oldFullLayout._subplots || {}; + var plotinfo; + var i, k; - var dimensions = []; - for(var displayInd in dimensionsIndInfo) { - var dimensionInd = dimensionsIndInfo[displayInd].dimensionInd; - var dimModel = parcatsViewModel.model.dimensions[dimensionInd]; - dimensions.push(createDimensionViewModel(parcatsViewModel, dimModel)); + // when going from a large splom graph to something else, + // we need to clear so that the new cartesian subplot + // can have the correct layer ordering + if(oldFullLayout._hasOnlyLargeSploms && !newFullLayout._hasOnlyLargeSploms) { + for(k in oldPlots) { + plotinfo = oldPlots[k]; + if(plotinfo.plotgroup) plotinfo.plotgroup.remove(); + } } - parcatsViewModel.dimensions = dimensions; -} - -/** - * Create a parcats DimensionViewModel - * - * @param {ParcatsViewModel} parcatsViewModel - * View model for trace - * @param {DimensionModel} dimensionModel - * @return {DimensionViewModel} - */ -function createDimensionViewModel(parcatsViewModel, dimensionModel) { - - // Compute dimension x position - var categoryLabelPad = 40, - dimWidth = 16, - numDimensions = parcatsViewModel.model.dimensions.length, - displayInd = dimensionModel.displayInd; - - // Compute x coordinate values - var dimDx, - dimX0, - dimX; + var hadGl = (oldFullLayout._has && oldFullLayout._has('gl')); + var hasGl = (newFullLayout._has && newFullLayout._has('gl')); - if(numDimensions > 1) { - dimDx = (parcatsViewModel.width - 2 * categoryLabelPad - dimWidth) / (numDimensions - 1); - } else { - dimDx = 0; + if(hadGl && !hasGl) { + for(k in oldPlots) { + plotinfo = oldPlots[k]; + if(plotinfo._scene) plotinfo._scene.destroy(); + } } - dimX0 = categoryLabelPad; - dimX = dimX0 + dimDx * displayInd; - // Compute categories - var categories = [], - maxCats = parcatsViewModel.model.maxCats, - numCats = dimensionModel.categories.length, - catSpacing = 8, - totalCount = dimensionModel.count, - totalHeight = parcatsViewModel.height - catSpacing * (maxCats - 1), - nextCatHeight, - nextCatModel, - nextCat, - catInd, - catDisplayInd; - - // Compute starting Y offset - var nextCatY = (maxCats - numCats) * catSpacing / 2.0; - - // Compute category ordering - var categoryIndInfo = dimensionModel.categories.map(function(c) { - return {displayInd: c.displayInd, categoryInd: c.categoryInd}; - }); - - categoryIndInfo.sort(function(a, b) { - return a.displayInd - b.displayInd; - }); - - for(catDisplayInd = 0; catDisplayInd < numCats; catDisplayInd++) { - catInd = categoryIndInfo[catDisplayInd].categoryInd; - nextCatModel = dimensionModel.categories[catInd]; - - if(totalCount > 0) { - nextCatHeight = (nextCatModel.count / totalCount) * totalHeight; - } else { - nextCatHeight = 0; + // delete any titles we don't need anymore + // check if axis list has changed, and if so clear old titles + 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(); + } } - - nextCat = { - key: nextCatModel.valueInds[0], - model: nextCatModel, - width: dimWidth, - height: nextCatHeight, - y: nextCatModel.dragY !== null ? nextCatModel.dragY : nextCatY, - bands: [], - parcatsViewModel: parcatsViewModel - }; - - nextCatY = nextCatY + nextCatHeight + catSpacing; - categories.push(nextCat); } - return { - key: dimensionModel.dimensionInd, - x: dimensionModel.dragX !== null ? dimensionModel.dragX : dimX, - y: 0, - width: dimWidth, - model: dimensionModel, - categories: categories, - parcatsViewModel: parcatsViewModel, - dragCategoryDisplayInd: null, - dragDimensionDisplayInd: null, - initialDragDimensionDisplayInds: null, - initialDragCategoryDisplayInds: null, - dragHasMoved: null, - potentialClickBand: null - }; -} - -// JSDoc typedefs -// ============== -/** - * @typedef {Object} Layout - * Object containing svg layout information - * - * @property {Number} width (pixels) - * Usable width for Figure (after margins are removed) - * @property {Number} height (pixels) - * Usable height for Figure (after margins are removed) - * @property {Margin} margin - * Margin around the Figure (pixels) - */ - -/** - * @typedef {Object} Margin - * Object containing padding information in pixels - * - * @property {Number} t - * Top margin - * @property {Number} r - * Right margin - * @property {Number} b - * Bottom margin - * @property {Number} l - * Left margin - */ - -/** - * @typedef {Object} Font - * Object containing font information - * - * @property {Number} size: Font size - * @property {String} color: Font color - * @property {String} family: Font family - */ - -/** - * @typedef {Object} ParcatsViewModel - * Object containing calculated parcats view information - * - * These are quantities that require Layout information to calculate - * @property key - * Unique key for this model - * @property {ParcatsModel} model - * Source parcats model - * @property {Array.} dimensions - * Array of dimension view models - * @property {Number} width - * Width for this trace (pixels) - * @property {Number} height - * Height for this trace (pixels) - * @property {Number} x - * X position of this trace with respect to the Figure (pixels) - * @property {Number} y - * Y position of this trace with respect to the Figure (pixels) - * @property {String} hoveron - * Hover interaction mode. One of: 'category', 'color', or 'dimension' - * @property {Array.} hoverinfoItems - * Info to display on hover. Array with a combination of 'counts' and/or 'probabilities', or 'none', or 'skip' - * @property {String} arrangement - * Category arrangement. One of: 'perpendicular', 'freeform', or 'fixed' - * @property {Boolean} bundlecolors - * Whether paths should be sorted so that like colors are bundled together as they pass through categories - * @property {String} sortpaths - * If 'forward' then sort paths based on dimensions from left to right. If 'backward' sort based on dimensions - * from right to left - * @property {Font} labelfont - * Font for the dimension labels - * @property {Font} categorylabelfont - * Font for the category labels - * @property {String} pathShape - * The shape of the paths. Either 'linear' or 'hspline'. - * @property {DimensionViewModel|null} dragDimension - * Dimension currently being dragged. Null if no drag in progress - * @property {Margin} margin - * Margin around the Figure - * @property {Object} graphDiv - * Top-level graph div element - * @property {Object} traceSelection - * D3 selection of this view models trace group element - * @property {Object} pathSelection - * D3 selection of this view models path elements - * @property {Object} dimensionSelection - * D3 selection of this view models dimension group element - */ - -/** - * @typedef {Object} DimensionViewModel - * Object containing calculated parcats dimension view information - * - * These are quantities that require Layout information to calculate - * @property key - * Unique key for this model - * @property {DimensionModel} model - * Source dimension model - * @property {Number} x - * X position of the center of this dimension with respect to the Figure (pixels) - * @property {Number} y - * Y position of the top of this dimension with respect to the Figure (pixels) - * @property {Number} width - * Width of categories in this dimension (pixels) - * @property {ParcatsViewModel} parcatsViewModel - * The parent trace's view model - * @property {Array.} categories - * Dimensions category view models - * @property {Number|null} dragCategoryDisplayInd - * Display index of category currently being dragged. null if no category is being dragged - * @property {Number|null} dragDimensionDisplayInd - * Display index of the dimension being dragged. null if no dimension is being dragged - * @property {Array.|null} initialDragDimensionDisplayInds - * Dimensions display indexes at the beginning of the current drag. null if no dimension is being dragged - * @property {Array.|null} initialDragCategoryDisplayInds - * Category display indexes for the at the beginning of the current drag. null if no category is being dragged - * @property {HTMLElement} potentialClickBand - * Band under mouse when current drag began. If no drag movement takes place then a click will be emitted for this - * band. Null if not drag in progress. - * @property {Boolean} dragHasMoved - * True if there is an active drag and the drag has moved. If drag doesn't move before being ended then - * this may be interpreted as a click. Null if no drag in progress - */ - -/** - * @typedef {Object} CategoryViewModel - * Object containing calculated parcats category view information - * - * These are quantities that require Layout information to calculate - * @property key - * Unique key for this model - * @property {CategoryModel} model - * Source category model - * @property {Number} width - * Width for this category (pixels) - * @property {Number} height - * Height for this category (pixels) - * @property {Number} y - * Y position of this cateogry with respect to the Figure (pixels) - * @property {Array.} bands - * Array of color bands inside the category - * @property {ParcatsViewModel} parcatsViewModel - * The parent trace's view model - */ - -/** - * @typedef {Object} CategoryBandViewModel - * Object containing calculated category band information. A category band is a region inside a category covering - * paths of a single color - * - * @property key - * Unique key for this model - * @property color - * Band color - * @property rawColor - * Raw color value for band - * @property {Number} width - * Band width - * @property {Number} height - * Band height - * @property {Number} y - * Y position of top of the band with respect to the category - * @property {Number} count - * The number of samples represented by the band - * @property {CategoryViewModel} categoryViewModel - * The parent categorie's view model - * @property {ParcatsViewModel} parcatsViewModel - * The parent trace's view model - */ - -/** - * @typedef {Object} PathViewModel - * Object containing calculated parcats path view information - * - * These are quantities that require Layout information to calculate - * @property key - * Unique key for this model - * @property {PathModel} model - * Source path model - * @property {Number} height - * Height of this path (pixels) - * @property {Array.} leftXs - * The x position of the left edge of each display dimension - * @property {Array.} topYs - * The y position of the top of the path for each display dimension - * @property {Array.} dimWidths - * The width of each display dimension - * @property {String} svgD - * SVG path "d" attribute string - * @property {ParcatsViewModel} parcatsViewModel - * The parent trace's view model - */ - -},{"../../components/drawing":595,"../../components/fx":612,"../../lib":696,"../../lib/svg_text_utils":720,"../../plot_api/plot_api":731,"d3":148,"tinycolor2":514}],1006:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - + // if we've gotten rid of all cartesian traces, remove all the subplot svg items + var hadCartesian = (oldFullLayout._has && oldFullLayout._has('cartesian')); + var hasCartesian = (newFullLayout._has && newFullLayout._has('cartesian')); -var parcats = _dereq_('./parcats'); - -/** - * Create / update parcat traces - * - * @param {Object} graphDiv - * @param {Array.} parcatsModels - */ -module.exports = function plot(graphDiv, parcatsModels, transitionOpts, makeOnCompleteCallback) { - var fullLayout = graphDiv._fullLayout, - svg = fullLayout._paper, - size = fullLayout._size; - - parcats( - graphDiv, - svg, - parcatsModels, - { - width: size.w, - height: size.h, - margin: { - t: size.t, - r: size.r, - b: size.b, - l: size.l + if(hadCartesian && !hasCartesian) { + purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); + oldFullLayout._defs.selectAll('.axesclip').remove(); + delete oldFullLayout._axisConstraintGroups; + } + // otherwise look for subplots we need to remove + else if(oldSubplotList.cartesian) { + for(i = 0; i < oldSubplotList.cartesian.length; i++) { + var oldSubplotId = oldSubplotList.cartesian[i]; + if(!newPlots[oldSubplotId]) { + var selector = '.' + oldSubplotId + ',.' + oldSubplotId + '-x,.' + oldSubplotId + '-y'; + oldFullLayout._cartesianlayer.selectAll(selector).remove(); + removeSubplotExtras(oldSubplotId, oldFullLayout); } - }, - transitionOpts, - makeOnCompleteCallback - ); + } + } }; -},{"./parcats":1005}],1007:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; +exports.drawFramework = function(gd) { + var fullLayout = gd._fullLayout; + var subplotData = makeSubplotData(gd); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var axesAttrs = _dereq_('../../plots/cartesian/layout_attributes'); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var domainAttrs = _dereq_('../../plots/domain').attributes; + var subplotLayers = fullLayout._cartesianlayer.selectAll('.subplot') + .data(subplotData, String); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; + subplotLayers.enter().append('g') + .attr('class', function(d) { return 'subplot ' + d[0]; }); -module.exports = { - domain: domainAttrs({name: 'parcoords', trace: true, editType: 'calc'}), + subplotLayers.order(); - hoverlabel: undefined, + subplotLayers.exit() + .call(purgeSubplotLayers, fullLayout); - labelfont: fontAttrs({ - editType: 'calc', - - }), - tickfont: fontAttrs({ - editType: 'calc', - - }), - rangefont: fontAttrs({ - editType: 'calc', - - }), + subplotLayers.each(function(d) { + var id = d[0]; + var plotinfo = fullLayout._plots[id]; - dimensions: templatedArray('dimension', { - label: { - valType: 'string', - - editType: 'calc', - - }, - // TODO: better way to determine ordinal vs continuous axes, - // so users can use tickvals/ticktext with a continuous axis. - tickvals: extendFlat({}, axesAttrs.tickvals, {editType: 'calc'}), - ticktext: extendFlat({}, axesAttrs.ticktext, {editType: 'calc'}), - tickformat: { - valType: 'string', - dflt: '3s', - - editType: 'calc', - - }, - visible: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - range: { - valType: 'info_array', - - items: [ - {valType: 'number', editType: 'calc'}, - {valType: 'number', editType: 'calc'} - ], - editType: 'calc', - - }, - constraintrange: { - valType: 'info_array', - - freeLength: true, - dimensions: '1-2', - items: [ - {valType: 'number', editType: 'calc'}, - {valType: 'number', editType: 'calc'} - ], - editType: 'calc', - - }, - multiselect: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - values: { - valType: 'data_array', - - editType: 'calc', - - }, - editType: 'calc', - - }), + plotinfo.plotgroup = d3.select(this); + makeSubplotLayer(gd, plotinfo); - line: extendFlat( - colorAttributes('line', { - // the default autocolorscale isn't quite usable for parcoords due to context ambiguity around 0 (grey, off-white) - // autocolorscale therefore defaults to false too, to avoid being overridden by the blue-white-red autocolor palette - colorscaleDflt: 'Viridis', - autoColorDflt: false, - editTypeOverride: 'calc' - }), { - colorbar: colorbarAttrs, - editType: 'calc' - }) + // make separate drag layers for each subplot, + // but append them to paper rather than the plot groups, + // so they end up on top of the rest + plotinfo.draglayer = ensureSingle(fullLayout._draggers, 'g', id); + }); }; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plot_api/plot_template":734,"../../plots/cartesian/layout_attributes":757,"../../plots/domain":770,"../../plots/font_attributes":771}],1008:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var c = _dereq_('./constants'); -var d3 = _dereq_('d3'); -var keyFun = _dereq_('../../lib/gup').keyFun; -var repeat = _dereq_('../../lib/gup').repeat; -var sortAsc = _dereq_('../../lib').sorterAsc; - -var snapRatio = c.bar.snapRatio; -function snapOvershoot(v, vAdjacent) { return v * (1 - snapRatio) + vAdjacent * snapRatio; } - -var snapClose = c.bar.snapClose; -function closeToCovering(v, vAdjacent) { return v * (1 - snapClose) + vAdjacent * snapClose; } - -// snap for the low end of a range on an ordinal scale -// on an ordinal scale, always show some overshoot from the exact value, -// so it's clear we're covering it -// find the interval we're in, and snap to 1/4 the distance to the next -// these two could be unified at a slight loss of readability / perf -function ordinalScaleSnapLo(a, v, existingRanges) { - if(overlappingExisting(v, existingRanges)) return v; - - var aPrev = a[0]; - var aPrevPrev = aPrev; - for(var i = 1; i < a.length; i++) { - var aNext = a[i]; - - // very close to the previous - snap down to it - if(v < closeToCovering(aPrev, aNext)) return snapOvershoot(aPrev, aPrevPrev); - if(v < aNext || i === a.length - 1) return snapOvershoot(aNext, aPrev); +exports.rangePlot = function(gd, plotinfo, cdSubplot) { + makeSubplotLayer(gd, plotinfo); + plotOne(gd, plotinfo, cdSubplot); + Plots.style(gd); +}; - aPrevPrev = aPrev; - aPrev = aNext; - } -} +function makeSubplotData(gd) { + var fullLayout = gd._fullLayout; + var ids = fullLayout._subplots.cartesian; + var len = ids.length; + var i, j, id, plotinfo, xa, ya; -function ordinalScaleSnapHi(a, v, existingRanges) { - if(overlappingExisting(v, existingRanges)) return v; + // split 'regular' and 'overlaying' subplots + var regulars = []; + var overlays = []; - var aPrev = a[a.length - 1]; - var aPrevPrev = aPrev; - for(var i = a.length - 2; i >= 0; i--) { - var aNext = a[i]; + for(i = 0; i < len; i++) { + id = ids[i]; + plotinfo = fullLayout._plots[id]; + xa = plotinfo.xaxis; + ya = plotinfo.yaxis; - // very close to the previous - snap down to it - if(v > closeToCovering(aPrev, aNext)) return snapOvershoot(aPrev, aPrevPrev); - if(v > aNext || i === a.length - 1) return snapOvershoot(aNext, aPrev); + var xa2 = xa._mainAxis; + var ya2 = ya._mainAxis; + var mainplot = xa2._id + ya2._id; + var mainplotinfo = fullLayout._plots[mainplot]; + plotinfo.overlays = []; - aPrevPrev = aPrev; - aPrev = aNext; + if(mainplot !== id && mainplotinfo) { + plotinfo.mainplot = mainplot; + plotinfo.mainplotinfo = mainplotinfo; + overlays.push(id); + } else { + plotinfo.mainplot = undefined; + plotinfo.mainPlotinfo = undefined; + regulars.push(id); + } } -} -function overlappingExisting(v, existingRanges) { - for(var i = 0; i < existingRanges.length; i++) { - if(v >= existingRanges[i][0] && v <= existingRanges[i][1]) return true; + // fill in list of overlaying subplots in 'main plot' + for(i = 0; i < overlays.length; i++) { + id = overlays[i]; + plotinfo = fullLayout._plots[id]; + plotinfo.mainplotinfo.overlays.push(plotinfo); } - return false; -} - -function barHorizontalSetup(selection) { - selection - .attr('x', -c.bar.captureWidth / 2) - .attr('width', c.bar.captureWidth); -} - -function backgroundBarHorizontalSetup(selection) { - selection - .attr('visibility', 'visible') - .style('visibility', 'visible') - .attr('fill', 'yellow') - .attr('opacity', 0); -} - -function setHighlight(d) { - if(!d.brush.filterSpecified) { - return '0,' + d.height; - } - var pixelRanges = unitToPx(d.brush.filter.getConsolidated(), d.height); - var dashArray = [0]; // we start with a 0 length selection as filter ranges are inclusive, not exclusive - var p, sectionHeight, iNext; - var currentGap = pixelRanges.length ? pixelRanges[0][0] : null; - for(var i = 0; i < pixelRanges.length; i++) { - p = pixelRanges[i]; - sectionHeight = p[1] - p[0]; - dashArray.push(currentGap); - dashArray.push(sectionHeight); - iNext = i + 1; - if(iNext < pixelRanges.length) { - currentGap = pixelRanges[iNext][0] - p[1]; - } - } - dashArray.push(d.height); - // d.height is added at the end to ensure that (1) we have an even number of dasharray points, MDN page says - // "If an odd number of values is provided, then the list of values is repeated to yield an even number of values." - // and (2) it's _at least_ as long as the full height (even if range is minuscule and at the bottom) though this - // may not be necessary, maybe duplicating the last point would do too. But no harm in a longer dasharray than line. - return dashArray; -} - -function unitToPx(unitRanges, height) { - return unitRanges.map(function(pr) { - return pr.map(function(v) { return v * height; }).sort(sortAsc); - }); -} - -// is the cursor over the north, middle, or south of a bar? -// the end handles extend over the last 10% of the bar -function getRegion(fPix, y) { - var pad = c.bar.handleHeight; - if(y > fPix[1] + pad || y < fPix[0] - pad) return; - if(y >= 0.9 * fPix[1] + 0.1 * fPix[0]) return 'n'; - if(y <= 0.9 * fPix[0] + 0.1 * fPix[1]) return 's'; - return 'ns'; -} - -function clearCursor() { - d3.select(document.body) - .style('cursor', null); -} - -function styleHighlight(selection) { - // stroke-dasharray is used to minimize the number of created DOM nodes, because the requirement calls for up to - // 1000 individual selections on an axis, and there can be 60 axes per parcoords, and multiple parcoords per - // dashboard. The technique is similar to https://codepen.io/monfera/pen/rLYqWR and using a `polyline` with - // multiple sections, or a `path` element via its `d` attribute would also be DOM-sparing alternatives. - selection.attr('stroke-dasharray', setHighlight); -} - -function renderHighlight(root, tweenCallback) { - var bar = d3.select(root).selectAll('.highlight, .highlight-shadow'); - var barToStyle = tweenCallback ? bar.transition().duration(c.bar.snapDuration).each('end', tweenCallback) : bar; - styleHighlight(barToStyle); -} - -function getInterval(d, y) { - var b = d.brush; - var active = b.filterSpecified; - var closestInterval = NaN; - var out = {}; - var i; - - if(active) { - var height = d.height; - var intervals = b.filter.getConsolidated(); - var pixIntervals = unitToPx(intervals, height); - var hoveredInterval = NaN; - var previousInterval = NaN; - var nextInterval = NaN; - for(i = 0; i <= pixIntervals.length; i++) { - var p = pixIntervals[i]; - if(p && p[0] <= y && y <= p[1]) { - // over a bar - hoveredInterval = i; - break; - } else { - // between bars, or before/after the first/last bar - previousInterval = i ? i - 1 : NaN; - if(p && p[0] > y) { - nextInterval = i; - break; // no point continuing as intervals are non-overlapping and sorted; could use log search - } - } - } - - closestInterval = hoveredInterval; - if(isNaN(closestInterval)) { - if(isNaN(previousInterval) || isNaN(nextInterval)) { - closestInterval = isNaN(previousInterval) ? nextInterval : previousInterval; - } - else { - closestInterval = (y - pixIntervals[previousInterval][1] < pixIntervals[nextInterval][0] - y) ? - previousInterval : nextInterval; - } - } - if(!isNaN(closestInterval)) { - var fPix = pixIntervals[closestInterval]; - var region = getRegion(fPix, y); + // put 'regular' subplot data before 'overlaying' + var subplotIds = regulars.concat(overlays); + var subplotData = new Array(len); - if(region) { - out.interval = intervals[closestInterval]; - out.intervalPix = fPix; - out.region = region; - } - } - } + for(i = 0; i < len; i++) { + id = subplotIds[i]; + plotinfo = fullLayout._plots[id]; + xa = plotinfo.xaxis; + ya = plotinfo.yaxis; - if(d.ordinal && !out.region) { - var a = d.unitTickvals; - var unitLocation = d.unitToPaddedPx.invert(y); - for(i = 0; i < a.length; i++) { - var rangei = [ - a[Math.max(i - 1, 0)] * 0.25 + a[i] * 0.75, - a[Math.min(i + 1, a.length - 1)] * 0.25 + a[i] * 0.75 - ]; - if(unitLocation >= rangei[0] && unitLocation <= rangei[1]) { - out.clickableOrdinalRange = rangei; - break; - } + // use info about axis layer and overlaying pattern + // to clean what need to be cleaned up in exit selection + var d = [id, xa.layer, ya.layer, xa.overlaying || '', ya.overlaying || '']; + for(j = 0; j < plotinfo.overlays.length; j++) { + d.push(plotinfo.overlays[j].id); } + subplotData[i] = d; } - return out; -} - -function attachDragBehavior(selection) { - // There's some fiddling with pointer cursor styling so that the cursor preserves its shape while dragging a brush - // even if the cursor strays from the interacting bar, which is bound to happen as bars are thin and the user - // will inevitably leave the hotspot strip. In this regard, it does something similar to what the D3 brush would do. - selection - .on('mousemove', function(d) { - d3.event.preventDefault(); - if(!d.parent.inBrushDrag) { - var y = d.height - d3.mouse(this)[1] - 2 * c.verticalPadding; - var interval = getInterval(d, y); - - var cursor = 'crosshair'; - if(interval.clickableOrdinalRange) cursor = 'pointer'; - else if(interval.region) cursor = interval.region + '-resize'; - d3.select(document.body) - .style('cursor', cursor); - } - }) - .on('mouseleave', function(d) { - if(!d.parent.inBrushDrag) clearCursor(); - }) - .call(d3.behavior.drag() - .on('dragstart', function(d) { - d3.event.sourceEvent.stopPropagation(); - var y = d.height - d3.mouse(this)[1] - 2 * c.verticalPadding; - var unitLocation = d.unitToPaddedPx.invert(y); - var b = d.brush; - var interval = getInterval(d, y); - var unitRange = interval.interval; - var s = b.svgBrush; - s.wasDragged = false; // we start assuming there won't be a drag - useful for reset - s.grabbingBar = interval.region === 'ns'; - if(s.grabbingBar) { - var pixelRange = unitRange.map(d.unitToPaddedPx); - s.grabPoint = y - pixelRange[0] - c.verticalPadding; - s.barLength = pixelRange[1] - pixelRange[0]; - } - s.clickableOrdinalRange = interval.clickableOrdinalRange; - s.stayingIntervals = (d.multiselect && b.filterSpecified) ? b.filter.getConsolidated() : []; - if(unitRange) { - s.stayingIntervals = s.stayingIntervals.filter(function(int2) { - return int2[0] !== unitRange[0] && int2[1] !== unitRange[1]; - }); - } - s.startExtent = interval.region ? unitRange[interval.region === 's' ? 1 : 0] : unitLocation; - d.parent.inBrushDrag = true; - s.brushStartCallback(); - }) - .on('drag', function(d) { - d3.event.sourceEvent.stopPropagation(); - var y = d.height - d3.mouse(this)[1] - 2 * c.verticalPadding; - var s = d.brush.svgBrush; - s.wasDragged = true; - - if(s.grabbingBar) { // moving the bar - s.newExtent = [y - s.grabPoint, y + s.barLength - s.grabPoint].map(d.unitToPaddedPx.invert); - } else { // south/north drag or new bar creation - s.newExtent = [s.startExtent, d.unitToPaddedPx.invert(y)].sort(sortAsc); - } - - // take care of the parcoords axis height constraint: bar can't breach it - var bottomViolation = Math.max(0, -s.newExtent[0]); - var topViolation = Math.max(0, s.newExtent[1] - 1); - s.newExtent[0] += bottomViolation; - s.newExtent[1] -= topViolation; - if(s.grabbingBar) { - // in case of bar dragging (non-resizing interaction, unlike north/south resize or new bar creation) - // the constraint adjustment must apply to the other end of the bar as well, otherwise it'd - // shorten or lengthen - s.newExtent[1] += bottomViolation; - s.newExtent[0] -= topViolation; - } - - d.brush.filterSpecified = true; - s.extent = s.stayingIntervals.concat([s.newExtent]); - s.brushCallback(d); - renderHighlight(this.parentNode); - }) - .on('dragend', function(d) { - var e = d3.event; - e.sourceEvent.stopPropagation(); - var brush = d.brush; - var filter = brush.filter; - var s = brush.svgBrush; - var grabbingBar = s.grabbingBar; - s.grabbingBar = false; - s.grabLocation = undefined; - d.parent.inBrushDrag = false; - clearCursor(); // instead of clearing, a nicer thing would be to set it according to current location - if(!s.wasDragged) { // a click+release on the same spot (ie. w/o dragging) means a bar or full reset - s.wasDragged = undefined; // logic-wise unneeded, just shows `wasDragged` has no longer a meaning - if(s.clickableOrdinalRange) { - if(brush.filterSpecified && d.multiselect) { - s.extent.push(s.clickableOrdinalRange); - } - else { - s.extent = [s.clickableOrdinalRange]; - brush.filterSpecified = true; - } - } - else if(grabbingBar) { - s.extent = s.stayingIntervals; - if(s.extent.length === 0) { - brushClear(brush); - } - } else { - brushClear(brush); - } - s.brushCallback(d); - renderHighlight(this.parentNode); - s.brushEndCallback(brush.filterSpecified ? filter.getConsolidated() : []); - return; // no need to fuse intervals or snap to ordinals, so we can bail early - } - - var mergeIntervals = function() { - // Key piece of logic: once the button is released, possibly overlapping intervals will be fused: - // Here it's done immediately on click release while on ordinal snap transition it's done at the end - filter.set(filter.getConsolidated()); - }; - - if(d.ordinal) { - var a = d.unitTickvals; - if(a[a.length - 1] < a[0]) a.reverse(); - s.newExtent = [ - ordinalScaleSnapLo(a, s.newExtent[0], s.stayingIntervals), - ordinalScaleSnapHi(a, s.newExtent[1], s.stayingIntervals) - ]; - var hasNewExtent = s.newExtent[1] > s.newExtent[0]; - s.extent = s.stayingIntervals.concat(hasNewExtent ? [s.newExtent] : []); - if(!s.extent.length) { - brushClear(brush); - } - s.brushCallback(d); - if(hasNewExtent) { - // merging intervals post the snap tween - renderHighlight(this.parentNode, mergeIntervals); - } - else { - // if no new interval, don't animate, just redraw the highlight immediately - mergeIntervals(); - renderHighlight(this.parentNode); - } - } else { - mergeIntervals(); // merging intervals immediately - } - s.brushEndCallback(brush.filterSpecified ? filter.getConsolidated() : []); - }) - ); + return subplotData; } -function startAsc(a, b) { return a[0] - b[0]; } - -function renderAxisBrush(axisBrush) { - - var background = axisBrush.selectAll('.background').data(repeat); - - background.enter() - .append('rect') - .classed('background', true) - .call(barHorizontalSetup) - .call(backgroundBarHorizontalSetup) - .style('pointer-events', 'auto') // parent pointer events are disabled; we must have it to register events - .attr('transform', 'translate(0 ' + c.verticalPadding + ')'); - - background - .call(attachDragBehavior) - .attr('height', function(d) { - return d.height - c.verticalPadding; - }); - - var highlightShadow = axisBrush.selectAll('.highlight-shadow').data(repeat); // we have a set here, can't call it `extent` +function makeSubplotLayer(gd, plotinfo) { + var plotgroup = plotinfo.plotgroup; + var id = plotinfo.id; + var xLayer = constants.layerValue2layerClass[plotinfo.xaxis.layer]; + var yLayer = constants.layerValue2layerClass[plotinfo.yaxis.layer]; + var hasOnlyLargeSploms = gd._fullLayout._hasOnlyLargeSploms; - highlightShadow.enter() - .append('line') - .classed('highlight-shadow', true) - .attr('x', -c.bar.width / 2) - .attr('stroke-width', c.bar.width + c.bar.strokeWidth) - .attr('stroke', c.bar.strokeColor) - .attr('opacity', c.bar.strokeOpacity) - .attr('stroke-linecap', 'butt'); + if(!plotinfo.mainplot) { + if(hasOnlyLargeSploms) { + // TODO could do even better + // - we don't need plot (but we would have to mock it in lsInner + // and other places + // - we don't (x|y)lines and (x|y)axislayer for most subplots + // usually just the bottom x and left y axes. + 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 { + var backLayer = ensureSingle(plotgroup, 'g', 'layer-subplot'); + plotinfo.shapelayer = ensureSingle(backLayer, 'g', 'shapelayer'); + plotinfo.imagelayer = ensureSingle(backLayer, 'g', 'imagelayer'); - highlightShadow - .attr('y1', function(d) { return d.height; }) - .call(styleHighlight); + plotinfo.gridlayer = ensureSingle(plotgroup, 'g', 'gridlayer'); + plotinfo.zerolinelayer = ensureSingle(plotgroup, 'g', 'zerolinelayer'); - var highlight = axisBrush.selectAll('.highlight').data(repeat); // we have a set here, can't call it `extent` + ensureSingle(plotgroup, 'path', 'xlines-below'); + ensureSingle(plotgroup, 'path', 'ylines-below'); + plotinfo.overlinesBelow = ensureSingle(plotgroup, 'g', 'overlines-below'); - highlight.enter() - .append('line') - .classed('highlight', true) - .attr('x', -c.bar.width / 2) - .attr('stroke-width', c.bar.width - c.bar.strokeWidth) - .attr('stroke', c.bar.fillColor) - .attr('opacity', c.bar.fillOpacity) - .attr('stroke-linecap', 'butt'); + ensureSingle(plotgroup, 'g', 'xaxislayer-below'); + ensureSingle(plotgroup, 'g', 'yaxislayer-below'); + plotinfo.overaxesBelow = ensureSingle(plotgroup, 'g', 'overaxes-below'); - highlight - .attr('y1', function(d) { return d.height; }) - .call(styleHighlight); -} + plotinfo.plot = ensureSingle(plotgroup, 'g', 'plot'); + plotinfo.overplot = ensureSingle(plotgroup, 'g', 'overplot'); -function ensureAxisBrush(axisOverlays) { - var axisBrush = axisOverlays.selectAll('.' + c.cn.axisBrush) - .data(repeat, keyFun); + plotinfo.xlines = ensureSingle(plotgroup, 'path', 'xlines-above'); + plotinfo.ylines = ensureSingle(plotgroup, 'path', 'ylines-above'); + plotinfo.overlinesAbove = ensureSingle(plotgroup, 'g', 'overlines-above'); - axisBrush.enter() - .append('g') - .classed(c.cn.axisBrush, true); + ensureSingle(plotgroup, 'g', 'xaxislayer-above'); + ensureSingle(plotgroup, 'g', 'yaxislayer-above'); + plotinfo.overaxesAbove = ensureSingle(plotgroup, 'g', 'overaxes-above'); - renderAxisBrush(axisBrush); -} + // set refs to correct layers as determined by 'axis.layer' + 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 = id + '-x'; + var yId = id + '-y'; -function getBrushExtent(brush) { - return brush.svgBrush.extent.map(function(e) {return e.slice();}); -} + // now make the components of overlaid subplots + // overlays don't have backgrounds, and append all + // their other components to the corresponding + // extra groups of their main plots. -function brushClear(brush) { - brush.filterSpecified = false; - brush.svgBrush.extent = [[0, 1]]; -} + plotinfo.gridlayer = mainplotinfo.gridlayer; + plotinfo.zerolinelayer = mainplotinfo.zerolinelayer; -function axisBrushMoved(callback) { - return function axisBrushMoved(dimension) { - var brush = dimension.brush; - var extent = getBrushExtent(brush); - var newExtent = extent.slice(); - brush.filter.set(newExtent); - callback(); - }; -} + ensureSingle(mainplotinfo.overlinesBelow, 'path', xId); + ensureSingle(mainplotinfo.overlinesBelow, 'path', yId); + ensureSingle(mainplotinfo.overaxesBelow, 'g', xId); + ensureSingle(mainplotinfo.overaxesBelow, 'g', yId); -function dedupeRealRanges(intervals) { - // Fuses elements of intervals if they overlap, yielding discontiguous intervals, results.length <= intervals.length - // Currently uses closed intervals, ie. dedupeRealRanges([[400, 800], [300, 400]]) -> [300, 800] - var queue = intervals.slice(); - var result = []; - var currentInterval; - var current = queue.shift(); - while(current) { // [].shift === undefined, so we don't descend into an empty array - currentInterval = current.slice(); - while((current = queue.shift()) && current[0] <= /* right-open interval would need `<` */ currentInterval[1]) { - currentInterval[1] = Math.max(currentInterval[1], current[1]); - } - result.push(currentInterval); - } - return result; -} + plotinfo.plot = ensureSingle(mainplotinfo.overplot, 'g', id); -function makeFilter() { - var filter = []; - var consolidated; - var bounds; - return { - set: function(a) { - filter = a - .map(function(d) { return d.slice().sort(sortAsc); }) - .sort(startAsc); - consolidated = dedupeRealRanges(filter); - bounds = filter.reduce(function(p, n) { - return [Math.min(p[0], n[0]), Math.max(p[1], n[1])]; - }, [Infinity, -Infinity]); - }, - get: function() { return filter.slice(); }, - getConsolidated: function() { return consolidated; }, - getBounds: function() { return bounds; } - }; -} + ensureSingle(mainplotinfo.overlinesAbove, 'path', xId); + ensureSingle(mainplotinfo.overlinesAbove, 'path', yId); + ensureSingle(mainplotinfo.overaxesAbove, 'g', xId); + ensureSingle(mainplotinfo.overaxesAbove, 'g', yId); -function makeBrush(state, rangeSpecified, initialRange, brushStartCallback, brushCallback, brushEndCallback) { - var filter = makeFilter(); - filter.set(initialRange); - return { - filter: filter, - filterSpecified: rangeSpecified, // there's a difference between not filtering and filtering a non-proper subset - svgBrush: { - extent: [], // this is where the svgBrush writes contents into - brushStartCallback: brushStartCallback, - brushCallback: axisBrushMoved(brushCallback), - brushEndCallback: brushEndCallback - } - }; -} + // set refs to correct layers as determined by 'abovetraces' + 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); + } -// for use by supplyDefaults, but it needed tons of pieces from here so -// seemed to make more sense just to put the whole routine here -function cleanRanges(ranges, dimension) { - if(Array.isArray(ranges[0])) { - ranges = ranges.map(function(ri) { return ri.sort(sortAsc); }); - - if(!dimension.multiselect) ranges = [ranges[0]]; - else ranges = dedupeRealRanges(ranges.sort(startAsc)); - } - else ranges = [ranges.sort(sortAsc)]; - - // ordinal snapping - if(dimension.tickvals) { - var sortedTickVals = dimension.tickvals.slice().sort(sortAsc); - ranges = ranges.map(function(ri) { - var rSnapped = [ - ordinalScaleSnapLo(sortedTickVals, ri[0], []), - ordinalScaleSnapHi(sortedTickVals, ri[1], []) - ]; - if(rSnapped[1] > rSnapped[0]) return rSnapped; - }) - .filter(function(ri) { return ri; }); + // common attributes for all subplots, overlays or not - if(!ranges.length) return; + if(!hasOnlyLargeSploms) { + 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); } - return ranges.length > 1 ? ranges : ranges[0]; + + plotinfo.xlines + .style('fill', 'none') + .classed('crisp', true); + + plotinfo.ylines + .style('fill', 'none') + .classed('crisp', true); } -module.exports = { - makeBrush: makeBrush, - ensureAxisBrush: ensureAxisBrush, - cleanRanges: cleanRanges -}; +function purgeSubplotLayers(layers, fullLayout) { + if(!layers) return; -},{"../../lib":696,"../../lib/gup":693,"./constants":1011,"d3":148}],1009:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var overlayIdsToRemove = {}; -'use strict'; + layers.each(function(d) { + var id = d[0]; + var plotgroup = d3.select(this); -var d3 = _dereq_('d3'); -var getModuleCalcData = _dereq_('../../plots/get_data').getModuleCalcData; -var parcoordsPlot = _dereq_('./plot'); -var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); + plotgroup.remove(); + removeSubplotExtras(id, fullLayout); + overlayIdsToRemove[id] = true; -var PARCOORDS = 'parcoords'; + // do not remove individual axis s here + // as other subplots may need them + }); -exports.name = PARCOORDS; + // must remove overlaid subplot trace layers 'manually' -exports.plot = function(gd) { - var calcData = getModuleCalcData(gd.calcdata, PARCOORDS)[0]; - if(calcData.length) parcoordsPlot(gd, calcData); -}; + for(var k in fullLayout._plots) { + var subplotInfo = fullLayout._plots[k]; + var overlays = subplotInfo.overlays || []; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var hadParcoords = (oldFullLayout._has && oldFullLayout._has(PARCOORDS)); - var hasParcoords = (newFullLayout._has && newFullLayout._has(PARCOORDS)); + for(var j = 0; j < overlays.length; j++) { + var overlayInfo = overlays[j]; - if(hadParcoords && !hasParcoords) { - oldFullLayout._paperdiv.selectAll('.parcoords').remove(); - oldFullLayout._glimages.selectAll('*').remove(); + 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(); +} exports.toSVG = function(gd) { var imageRoot = gd._fullLayout._glimages; @@ -157130,20 +55248,13 @@ } canvases.each(canvasToImage); - - // Chrome / Safari bug workaround - browser apparently loses connection to the defined pattern - // Without the workaround, these browsers 'lose' the filter brush styling (color etc.) after a snapshot - // on a subsequent interaction. - // Firefox works fine without this workaround - window.setTimeout(function() { - d3.selectAll('#filterBarPattern') - .attr('id', 'filterBarPattern'); - }, 60); }; -},{"../../constants/xmlns_namespaces":674,"../../plots/get_data":781,"./plot":1017,"d3":148}],1010:[function(_dereq_,module,exports){ +exports.updateFx = _dereq_('./graph_interact').updateFx; + +},{"../../components/drawing":64,"../../constants/xmlns_namespaces":141,"../../lib":159,"../../registry":243,"../get_data":232,"../plots":236,"./attributes":201,"./axis_ids":206,"./constants":209,"./graph_interact":213,"./layout_attributes":216,"./layout_defaults":217,"./transition_axes":226,"d3":8}],216:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157152,1462 +55263,845 @@ 'use strict'; -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var calcColorscale = _dereq_('../../components/colorscale/calc'); -var Lib = _dereq_('../../lib'); -var wrap = _dereq_('../../lib/gup').wrap; - -module.exports = function calc(gd, trace) { - var cs = !!trace.line.colorscale && Lib.isArrayOrTypedArray(trace.line.color); - var color = cs ? trace.line.color : constHalf(trace._length); - var cscale = cs ? trace.line.colorscale : [[0, trace.line.color], [1, trace.line.color]]; - - if(hasColorscale(trace, 'line')) { - calcColorscale(trace, color, 'line', 'c'); - } - - return wrap({ - lineColor: color, - cscale: cscale - }); -}; - -function constHalf(len) { - var out = new Array(len); - for(var i = 0; i < len; i++) { - out[i] = 0.5; - } - return out; -} - -},{"../../components/colorscale/calc":578,"../../components/colorscale/has_colorscale":584,"../../lib":696,"../../lib/gup":693}],1011:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +var fontAttrs = _dereq_('../font_attributes'); +var colorAttrs = _dereq_('../../components/color/attributes'); +var dash = _dereq_('../../components/drawing/attributes').dash; +var extendFlat = _dereq_('../../lib/extend').extendFlat; +var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; -'use strict'; +var constants = _dereq_('./constants'); module.exports = { - maxDimensionCount: 60, // this cannot be increased without WebGL code refactoring - overdrag: 45, - verticalPadding: 2, // otherwise, horizontal lines on top or bottom are of lower width - tickDistance: 50, - canvasPixelRatio: 1, - blockLineCount: 5000, - layers: ['contextLineLayer', 'focusLineLayer', 'pickLineLayer'], - axisTitleOffset: 28, - axisExtentOffset: 10, - bar: { - width: 4, // Visible width of the filter bar - captureWidth: 10, // Mouse-sensitive width for interaction (Fitts law) - fillColor: 'magenta', // Color of the filter bar fill - fillOpacity: 1, // Filter bar fill opacity - snapDuration: 150, // tween duration in ms for brush snap for ordinal axes - snapRatio: 0.25, // ratio of bar extension relative to the distance between two adjacent ordinal values - snapClose: 0.01, // fraction of inter-value distance to snap to the closer one, even if you're not over it - strokeColor: 'white', // Color of the filter bar side lines - strokeOpacity: 1, // Filter bar side stroke opacity - strokeWidth: 1, // Filter bar side stroke width in pixels - handleHeight: 8, // Height of the filter bar vertical resize areas on top and bottom - handleOpacity: 1, // Opacity of the filter bar vertical resize areas on top and bottom - handleOverlap: 0 // A larger than 0 value causes overlaps with the filter bar, represented as pixels + visible: { + valType: 'boolean', + + editType: 'plot', + + }, + color: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'ticks', + + }, + title: { + text: { + valType: 'string', + + editType: 'ticks', + + }, + font: fontAttrs({ + editType: 'ticks', + + }), + 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, + + }, + autorange: { + valType: 'enumerated', + values: [true, false, 'reversed'], + dflt: true, + + editType: 'axrange', + impliedEdits: {'range[0]': undefined, 'range[1]': undefined}, + + }, + rangemode: { + valType: 'enumerated', + values: ['normal', 'tozero', 'nonnegative'], + dflt: 'normal', + + editType: 'plot', + + }, + 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, + + }, + fixedrange: { + valType: 'boolean', + dflt: false, + + editType: 'calc', + + }, + // scaleanchor: not used directly, just put here for reference + // values are any opposite-letter axis id + scaleanchor: { + valType: 'enumerated', + values: [ + constants.idRegex.x.toString(), + constants.idRegex.y.toString() + ], + + editType: 'plot', + + }, + scaleratio: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'plot', + + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + editType: 'plot', + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + editType: 'plot', + + }, + // ticks + tickmode: { + valType: 'enumerated', + values: ['auto', 'linear', 'array'], + + editType: 'ticks', + impliedEdits: {tick0: undefined, dtick: undefined}, + + }, + nticks: { + valType: 'integer', + min: 0, + dflt: 0, + + editType: 'ticks', + + }, + tick0: { + valType: 'any', + + editType: 'ticks', + impliedEdits: {tickmode: 'linear'}, + + }, + dtick: { + valType: 'any', + + editType: 'ticks', + impliedEdits: {tickmode: 'linear'}, + + }, + tickvals: { + valType: 'data_array', + editType: 'ticks', + + }, + ticktext: { + valType: 'data_array', + editType: 'ticks', + + }, + ticks: { + valType: 'enumerated', + values: ['outside', 'inside', ''], + + editType: 'ticks', + + }, + tickson: { + valType: 'enumerated', + values: ['labels', 'boundaries'], + + dflt: 'labels', + editType: 'ticks', + + }, + mirror: { + valType: 'enumerated', + values: [true, 'ticks', false, 'all', 'allticks'], + dflt: false, + + editType: 'ticks+layoutstyle', + + }, + ticklen: { + valType: 'number', + min: 0, + dflt: 5, + + editType: 'ticks', + + }, + tickwidth: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'ticks', + + }, + tickcolor: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'ticks', + + }, + showticklabels: { + valType: 'boolean', + dflt: true, + + editType: 'ticks', + + }, + automargin: { + valType: 'boolean', + dflt: false, + + editType: 'ticks', + + }, + showspikes: { + valType: 'boolean', + dflt: false, + + editType: 'modebar', + + }, + spikecolor: { + valType: 'color', + dflt: null, + + editType: 'none', + + }, + spikethickness: { + valType: 'number', + dflt: 3, + + editType: 'none', + + }, + spikedash: extendFlat({}, dash, {dflt: 'dash', editType: 'none'}), + spikemode: { + valType: 'flaglist', + flags: ['toaxis', 'across', 'marker'], + + dflt: 'toaxis', + editType: 'none', + + }, + spikesnap: { + valType: 'enumerated', + values: ['data', 'cursor'], + dflt: 'data', + + editType: 'none', + + }, + tickfont: fontAttrs({ + editType: 'ticks', + + }), + tickangle: { + valType: 'angle', + dflt: 'auto', + + editType: 'ticks', + + }, + tickprefix: { + valType: 'string', + dflt: '', + + editType: 'ticks', + + }, + showtickprefix: { + valType: 'enumerated', + values: ['all', 'first', 'last', 'none'], + dflt: 'all', + + editType: 'ticks', + + }, + ticksuffix: { + valType: 'string', + dflt: '', + + editType: 'ticks', + + }, + showticksuffix: { + valType: 'enumerated', + values: ['all', 'first', 'last', 'none'], + dflt: 'all', + + editType: 'ticks', + + }, + showexponent: { + valType: 'enumerated', + values: ['all', 'first', 'last', 'none'], + dflt: 'all', + + editType: 'ticks', + + }, + exponentformat: { + valType: 'enumerated', + values: ['none', 'e', 'E', 'power', 'SI', 'B'], + dflt: 'B', + + editType: 'ticks', + + }, + separatethousands: { + valType: 'boolean', + dflt: false, + + editType: 'ticks', + + }, + tickformat: { + valType: 'string', + dflt: '', + + editType: 'ticks', + + }, + tickformatstops: templatedArray('tickformatstop', { + enabled: { + valType: 'boolean', + + dflt: true, + editType: 'ticks', + + }, + dtickrange: { + valType: 'info_array', + + items: [ + {valType: 'any', editType: 'ticks'}, + {valType: 'any', editType: 'ticks'} + ], + editType: 'ticks', + + }, + value: { + valType: 'string', + dflt: '', + + editType: 'ticks', + + }, + editType: 'ticks' + }), + hoverformat: { + valType: 'string', + dflt: '', + + editType: 'none', + + }, + // lines and grids + showline: { + valType: 'boolean', + dflt: false, + + editType: 'ticks+layoutstyle', + + }, + linecolor: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'layoutstyle', + + }, + linewidth: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'ticks+layoutstyle', + + }, + showgrid: { + valType: 'boolean', + + editType: 'ticks', + + }, + gridcolor: { + valType: 'color', + dflt: colorAttrs.lightLine, + + editType: 'ticks', + + }, + gridwidth: { + valType: 'number', + min: 0, + dflt: 1, + + editType: 'ticks', + + }, + zeroline: { + valType: 'boolean', + + editType: 'ticks', + + }, + zerolinecolor: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'ticks', + + }, + zerolinewidth: { + valType: 'number', + dflt: 1, + + editType: 'ticks', + }, - cn: { - axisExtentText: 'axis-extent-text', - parcoordsLineLayers: 'parcoords-line-layers', - parcoordsLineLayer: 'parcoords-lines', - parcoords: 'parcoords', - parcoordsControlView: 'parcoords-control-view', - yAxis: 'y-axis', - axisOverlays: 'axis-overlays', - axis: 'axis', - axisHeading: 'axis-heading', - axisTitle: 'axis-title', - axisExtent: 'axis-extent', - axisExtentTop: 'axis-extent-top', - axisExtentTopText: 'axis-extent-top-text', - axisExtentBottom: 'axis-extent-bottom', - axisExtentBottomText: 'axis-extent-bottom-text', - axisBrush: 'axis-brush' - }, - id: { - filterBarPattern: 'filter-bar-pattern' - - } -}; - -},{}],1012:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var handleDomainDefaults = _dereq_('../../plots/domain').defaults; -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - -var attributes = _dereq_('./attributes'); -var axisBrush = _dereq_('./axisbrush'); -var maxDimensionCount = _dereq_('./constants').maxDimensionCount; -var mergeLength = _dereq_('./merge_length'); - -function handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce) { - var lineColor = coerce('line.color', defaultColor); - - if(hasColorscale(traceIn, 'line') && Lib.isArrayOrTypedArray(lineColor)) { - if(lineColor.length) { - coerce('line.colorscale'); - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c'}); - // TODO: I think it would be better to keep showing lines beyond the last line color - // but I'm not sure what color to give these lines - probably black or white - // depending on the background color? - return lineColor.length; - } - else { - traceOut.line.color = defaultColor; - } - } - return Infinity; -} - -function dimensionDefaults(dimensionIn, dimensionOut) { - function coerce(attr, dflt) { - return Lib.coerce(dimensionIn, dimensionOut, attributes.dimensions, attr, dflt); - } - - var values = coerce('values'); - var visible = coerce('visible'); - if(!(values && values.length)) { - visible = dimensionOut.visible = false; - } - - if(visible) { - coerce('label'); - coerce('tickvals'); - coerce('ticktext'); - coerce('tickformat'); - coerce('range'); - - coerce('multiselect'); - var constraintRange = coerce('constraintrange'); - if(constraintRange) { - dimensionOut.constraintrange = axisBrush.cleanRanges(constraintRange, dimensionOut); - } - } -} - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - var dimensionsIn = traceIn.dimensions; - if(Array.isArray(dimensionsIn) && dimensionsIn.length > maxDimensionCount) { - Lib.log('parcoords traces support up to ' + maxDimensionCount + ' dimensions at the moment'); - dimensionsIn.splice(maxDimensionCount); - } - - var dimensions = handleArrayContainerDefaults(traceIn, traceOut, { - name: 'dimensions', - handleItemDefaults: dimensionDefaults - }); - var len = handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); + showdividers: { + valType: 'boolean', + dflt: true, + + editType: 'ticks', + + }, + dividercolor: { + valType: 'color', + dflt: colorAttrs.defaultLine, + + editType: 'ticks', + + }, + dividerwidth: { + valType: 'number', + dflt: 1, + + editType: 'ticks', + + }, + // TODO dividerlen: that would override "to label base" length? - handleDomainDefaults(traceOut, layout, coerce); + // 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', + + }, + // 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', + + }, + // 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', + + }, + layer: { + valType: 'enumerated', + values: ['above traces', 'below traces'], + dflt: 'above traces', + + editType: 'plot', + + }, + 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', + + }, + position: { + valType: 'number', + min: 0, + max: 1, + dflt: 0, + + editType: 'plot', + + }, + categoryorder: { + valType: 'enumerated', + values: [ + 'trace', 'category ascending', 'category descending', 'array' + /* , 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later + ], + dflt: 'trace', + + editType: 'calc', + + }, + categoryarray: { + valType: 'data_array', + + editType: 'calc', + + }, + uirevision: { + valType: 'any', + + editType: 'none', + + }, + editType: 'calc', - if(!Array.isArray(dimensions) || !dimensions.length) { - traceOut.visible = false; + _deprecated: { + autotick: { + valType: 'boolean', + + editType: 'ticks', + + }, + title: { + valType: 'string', + + editType: 'ticks', + + }, + titlefont: fontAttrs({ + editType: 'ticks', + + }) } - - mergeLength(traceOut, dimensions, 'values', len); - - // make default font size 10px (default is 12), - // scale linearly with global font size - var fontDflt = { - family: layout.font.family, - size: Math.round(layout.font.size / 1.2), - color: layout.font.color - }; - - Lib.coerceFont(coerce, 'labelfont', fontDflt); - Lib.coerceFont(coerce, 'tickfont', fontDflt); - Lib.coerceFont(coerce, 'rangefont', fontDflt); }; -},{"../../components/colorscale/defaults":580,"../../components/colorscale/has_colorscale":584,"../../lib":696,"../../plots/array_container_defaults":740,"../../plots/domain":770,"./attributes":1007,"./axisbrush":1008,"./constants":1011,"./merge_length":1015}],1013:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":42,"../../components/drawing/attributes":63,"../../lib/extend":153,"../../plot_api/plot_template":193,"../font_attributes":230,"./constants":209}],217:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Parcoords = {}; - -Parcoords.attributes = _dereq_('./attributes'); -Parcoords.supplyDefaults = _dereq_('./defaults'); -Parcoords.calc = _dereq_('./calc'); -Parcoords.plot = _dereq_('./plot'); -Parcoords.colorbar = { - container: 'line', - min: 'cmin', - max: 'cmax' -}; - -Parcoords.moduleType = 'trace'; -Parcoords.name = 'parcoords'; -Parcoords.basePlotModule = _dereq_('./base_plot'); -Parcoords.categories = ['gl', 'regl', 'noOpacity']; -Parcoords.meta = { - -}; - -module.exports = Parcoords; - -},{"./attributes":1007,"./base_plot":1009,"./calc":1010,"./defaults":1012,"./plot":1017}],1014:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ 'use strict'; -var glslify = _dereq_('glslify'); -var vertexShaderSource = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D palette;\nuniform sampler2D mask;\nuniform float maskHeight;\n\nuniform vec2 colorClamp;\n\nvarying vec4 fragColor;\n\nvec4 unit_1 = vec4(1, 1, 1, 1);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit_1, unit_1);\n}\n\nfloat axisY(\n float x,\n mat4 d[4],\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float y1 = val(d[0], dim1A) + val(d[1], dim1B) + val(d[2], dim1C) + val(d[3], dim1D);\n float y2 = val(d[0], dim2A) + val(d[1], dim2B) + val(d[2], dim2C) + val(d[3], dim2D);\n return y1 * (1.0 - x) + y2 * x;\n}\n\nconst int bitsPerByte = 8;\n\nint mod2(int a) {\n return a - 2 * (a / 2);\n}\n\nint mod8(int a) {\n return a - 8 * (a / 8);\n}\n\nvec4 zero = vec4(0, 0, 0, 0);\nvec4 unit_0 = vec4(1, 1, 1, 1);\nvec2 xyProjection = vec2(1, 1);\n\nmat4 mclamp(mat4 m, mat4 lo, mat4 hi) {\n return mat4(clamp(m[0], lo[0], hi[0]),\n clamp(m[1], lo[1], hi[1]),\n clamp(m[2], lo[2], hi[2]),\n clamp(m[3], lo[3], hi[3]));\n}\n\nbool mshow(mat4 p, mat4 lo, mat4 hi) {\n return mclamp(p, lo, hi) == p;\n}\n\nbool withinBoundingBox(\n mat4 d[4],\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD\n ) {\n\n return mshow(d[0], loA, hiA) &&\n mshow(d[1], loB, hiB) &&\n mshow(d[2], loC, hiC) &&\n mshow(d[3], loD, hiD);\n}\n\nbool withinRasterMask(mat4 d[4], sampler2D mask, float height) {\n bool result = true;\n int bitInByteStepper;\n float valY, valueY, scaleX;\n int hit, bitmask, valX;\n for(int i = 0; i < 4; i++) {\n for(int j = 0; j < 4; j++) {\n for(int k = 0; k < 4; k++) {\n bitInByteStepper = mod8(j * 4 + k);\n valX = i * 2 + j / 2;\n valY = d[i][j][k];\n valueY = valY * (height - 1.0) + 0.5;\n scaleX = (float(valX) + 0.5) / 8.0;\n hit = int(texture2D(mask, vec2(scaleX, (valueY + 0.5) / height))[3] * 255.0) / int(pow(2.0, float(bitInByteStepper)));\n result = result && mod2(hit) == 1;\n }\n }\n }\n return result;\n}\n\nvec4 position(\n float depth,\n vec2 resolution, vec2 viewBoxPosition, vec2 viewBoxSize,\n mat4 dims[4],\n float signum,\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D,\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD,\n sampler2D mask, float maskHeight\n ) {\n\n float x = 0.5 * signum + 0.5;\n float y = axisY(x, dims, dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D);\n\n float show = float(\n withinBoundingBox(dims, loA, hiA, loB, hiB, loC, hiC, loD, hiD)\n && withinRasterMask(dims, mask, maskHeight)\n );\n\n vec2 viewBoxXY = viewBoxPosition + viewBoxSize * vec2(x, y);\n float depthOrHide = depth + 2.0 * (1.0 - show);\n\n return vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depthOrHide,\n 1.0\n );\n}\n\nvoid main() {\n\n float prominence = abs(pf[3]);\n\n mat4 p[4];\n p[0] = mat4(p0, p1, p2, p3);\n p[1] = mat4(p4, p5, p6, p7);\n p[2] = mat4(p8, p9, pa, pb);\n p[3] = mat4(pc, pd, pe, abs(pf));\n\n gl_Position = position(\n 1.0 - prominence,\n resolution, viewBoxPosition, viewBoxSize,\n p,\n sign(pf[3]),\n dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD,\n mask, maskHeight\n );\n\n float clampedColorIndex = clamp((prominence - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);\n fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));\n}\n"]); -var contextShaderSource = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D palette;\n\nuniform vec2 colorClamp;\n\nvarying vec4 fragColor;\n\nvec2 xyProjection = vec2(1, 1);\n\nvec4 unit = vec4(1, 1, 1, 1);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit, unit);\n}\n\nfloat axisY(\n float x,\n mat4 d[4],\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float y1 = val(d[0], dim1A) + val(d[1], dim1B) + val(d[2], dim1C) + val(d[3], dim1D);\n float y2 = val(d[0], dim2A) + val(d[1], dim2B) + val(d[2], dim2C) + val(d[3], dim2D);\n return y1 * (1.0 - x) + y2 * x;\n}\n\nvec4 position(\n float depth,\n vec2 resolution, vec2 viewBoxPosition, vec2 viewBoxSize,\n mat4 dims[4],\n float signum,\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float x = 0.5 * signum + 0.5;\n float y = axisY(x, dims, dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D);\n\n vec2 viewBoxXY = viewBoxPosition + viewBoxSize * vec2(x, y);\n\n return vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depth,\n 1.0\n );\n}\n\nvoid main() {\n\n float prominence = abs(pf[3]);\n\n mat4 p[4];\n p[0] = mat4(p0, p1, p2, p3);\n p[1] = mat4(p4, p5, p6, p7);\n p[2] = mat4(p8, p9, pa, pb);\n p[3] = mat4(pc, pd, pe, abs(pf));\n\n gl_Position = position(\n 1.0 - prominence,\n resolution, viewBoxPosition, viewBoxSize,\n p,\n sign(pf[3]),\n dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D\n );\n\n float clampedColorIndex = clamp((prominence - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);\n fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));\n}\n"]); -var pickVertexShaderSource = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D mask;\nuniform float maskHeight;\n\nuniform vec2 colorClamp;\n\nvarying vec4 fragColor;\n\nvec4 unit_1 = vec4(1, 1, 1, 1);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit_1, unit_1);\n}\n\nfloat axisY(\n float x,\n mat4 d[4],\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float y1 = val(d[0], dim1A) + val(d[1], dim1B) + val(d[2], dim1C) + val(d[3], dim1D);\n float y2 = val(d[0], dim2A) + val(d[1], dim2B) + val(d[2], dim2C) + val(d[3], dim2D);\n return y1 * (1.0 - x) + y2 * x;\n}\n\nconst int bitsPerByte = 8;\n\nint mod2(int a) {\n return a - 2 * (a / 2);\n}\n\nint mod8(int a) {\n return a - 8 * (a / 8);\n}\n\nvec4 zero = vec4(0, 0, 0, 0);\nvec4 unit_0 = vec4(1, 1, 1, 1);\nvec2 xyProjection = vec2(1, 1);\n\nmat4 mclamp(mat4 m, mat4 lo, mat4 hi) {\n return mat4(clamp(m[0], lo[0], hi[0]),\n clamp(m[1], lo[1], hi[1]),\n clamp(m[2], lo[2], hi[2]),\n clamp(m[3], lo[3], hi[3]));\n}\n\nbool mshow(mat4 p, mat4 lo, mat4 hi) {\n return mclamp(p, lo, hi) == p;\n}\n\nbool withinBoundingBox(\n mat4 d[4],\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD\n ) {\n\n return mshow(d[0], loA, hiA) &&\n mshow(d[1], loB, hiB) &&\n mshow(d[2], loC, hiC) &&\n mshow(d[3], loD, hiD);\n}\n\nbool withinRasterMask(mat4 d[4], sampler2D mask, float height) {\n bool result = true;\n int bitInByteStepper;\n float valY, valueY, scaleX;\n int hit, bitmask, valX;\n for(int i = 0; i < 4; i++) {\n for(int j = 0; j < 4; j++) {\n for(int k = 0; k < 4; k++) {\n bitInByteStepper = mod8(j * 4 + k);\n valX = i * 2 + j / 2;\n valY = d[i][j][k];\n valueY = valY * (height - 1.0) + 0.5;\n scaleX = (float(valX) + 0.5) / 8.0;\n hit = int(texture2D(mask, vec2(scaleX, (valueY + 0.5) / height))[3] * 255.0) / int(pow(2.0, float(bitInByteStepper)));\n result = result && mod2(hit) == 1;\n }\n }\n }\n return result;\n}\n\nvec4 position(\n float depth,\n vec2 resolution, vec2 viewBoxPosition, vec2 viewBoxSize,\n mat4 dims[4],\n float signum,\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D,\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD,\n sampler2D mask, float maskHeight\n ) {\n\n float x = 0.5 * signum + 0.5;\n float y = axisY(x, dims, dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D);\n\n float show = float(\n withinBoundingBox(dims, loA, hiA, loB, hiB, loC, hiC, loD, hiD)\n && withinRasterMask(dims, mask, maskHeight)\n );\n\n vec2 viewBoxXY = viewBoxPosition + viewBoxSize * vec2(x, y);\n float depthOrHide = depth + 2.0 * (1.0 - show);\n\n return vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depthOrHide,\n 1.0\n );\n}\n\nvoid main() {\n\n float prominence = abs(pf[3]);\n\n mat4 p[4];\n p[0] = mat4(p0, p1, p2, p3);\n p[1] = mat4(p4, p5, p6, p7);\n p[2] = mat4(p8, p9, pa, pb);\n p[3] = mat4(pc, pd, pe, abs(pf));\n\n gl_Position = position(\n 1.0 - prominence,\n resolution, viewBoxPosition, viewBoxSize,\n p,\n sign(pf[3]),\n dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD,\n mask, maskHeight\n );\n\n fragColor = vec4(pf.rgb, 1.0);\n}\n"]); -var fragmentShaderSource = glslify(["precision lowp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n"]); - var Lib = _dereq_('../../lib'); +var Color = _dereq_('../../components/color'); +var Template = _dereq_('../../plot_api/plot_template'); +var basePlotLayoutAttributes = _dereq_('../layout_attributes'); -// don't change; otherwise near/far plane lines are lost -var depthLimitEpsilon = 1e-6; -// just enough buffer for an extra bit at single-precision floating point -// which on [0, 1] is 6e-8 (1/2^24) -var filterEpsilon = 1e-7; - -// precision of multiselect is the full range divided into this many parts -var maskHeight = 2048; - -var gpuDimensionCount = 64; -var sectionVertexCount = 2; -var vec4NumberCount = 4; -var bitsPerByte = 8; -var channelCount = gpuDimensionCount / bitsPerByte; // == 8 bytes needed to have 64 bits - -var contextColor = [119, 119, 119]; // middle gray to not drawn the focus; looks good on a black or white background - -var dummyPixel = new Uint8Array(4); -var pickPixel = new Uint8Array(4); - -var paletteTextureConfig = { - shape: [256, 1], - format: 'rgba', - type: 'uint8', - mag: 'nearest', - min: 'nearest' -}; - -function ensureDraw(regl) { - regl.read({ - x: 0, - y: 0, - width: 1, - height: 1, - data: dummyPixel - }); -} - -function clear(regl, x, y, width, height) { - var gl = regl._gl; - gl.enable(gl.SCISSOR_TEST); - gl.scissor(x, y, width, height); - regl.clear({color: [0, 0, 0, 0], depth: 1}); // clearing is done in scissored panel only -} - -function renderBlock(regl, glAes, renderState, blockLineCount, sampleCount, item) { - - var rafKey = item.key; - - function render(blockNumber) { - - var count; - - count = Math.min(blockLineCount, sampleCount - blockNumber * blockLineCount); - - item.offset = sectionVertexCount * blockNumber * blockLineCount; - item.count = sectionVertexCount * count; - if(blockNumber === 0) { - // stop drawing possibly stale glyphs before clearing - window.cancelAnimationFrame(renderState.currentRafs[rafKey]); - delete renderState.currentRafs[rafKey]; - clear(regl, item.scissorX, item.scissorY, item.scissorWidth, item.viewBoxSize[1]); - } - - if(renderState.clearOnly) { - return; - } - - glAes(item); - - if(blockNumber * blockLineCount + count < sampleCount) { - renderState.currentRafs[rafKey] = window.requestAnimationFrame(function() { - render(blockNumber + 1); - }); - } - - renderState.drawCompleted = false; - } - - if(!renderState.drawCompleted) { - ensureDraw(regl); - renderState.drawCompleted = true; - } - - // start with rendering item 0; recursion handles the rest - render(0); -} - -function adjustDepth(d) { - // WebGL matrix operations use floats with limited precision, potentially causing a number near a border of [0, 1] - // to end up slightly outside the border. With an epsilon, we reduce the chance that a line gets clipped by the - // near or the far plane. - return Math.max(depthLimitEpsilon, Math.min(1 - depthLimitEpsilon, d)); -} - -function palette(unitToColor, context, opacity) { - var result = []; - for(var j = 0; j < 256; j++) { - var c = unitToColor(j / 255); - result.push((context ? contextColor : c).concat(opacity)); - } - - return result; -} - -// Maps the sample index [0...sampleCount - 1] to a range of [0, 1] as the shader expects colors in the [0, 1] range. -// but first it shifts the sample index by 0, 8 or 16 bits depending on rgbIndex [0..2] -// with the end result that each line will be of a unique color, making it possible for the pick handler -// to uniquely identify which line is hovered over (bijective mapping). -// The inverse, i.e. readPixel is invoked from 'parcoords.js' -function calcPickColor(j, rgbIndex) { - return (j >>> 8 * rgbIndex) % 256 / 255; -} - -function makePoints(sampleCount, dimensions, color) { - var dimensionCount = dimensions.length; - - var points = []; - for(var j = 0; j < sampleCount; j++) { - for(var i = 0; i < gpuDimensionCount; i++) { - points.push(i < dimensionCount ? - dimensions[i].paddedUnitValues[j] : - i === (gpuDimensionCount - 1) ? - adjustDepth(color[j]) : - i >= gpuDimensionCount - 4 ? - calcPickColor(j, gpuDimensionCount - 2 - i) : - 0.5); - } - } - - return points; -} - -function makeVecAttr(sampleCount, points, vecIndex) { - var i, j, k; - var pointPairs = []; - - for(j = 0; j < sampleCount; j++) { - for(k = 0; k < sectionVertexCount; k++) { - for(i = 0; i < vec4NumberCount; i++) { - pointPairs.push(points[j * gpuDimensionCount + vecIndex * vec4NumberCount + i]); - if(vecIndex * vec4NumberCount + i === gpuDimensionCount - 1 && k % 2 === 0) { - pointPairs[pointPairs.length - 1] *= -1; - } - } - } - } +var layoutAttributes = _dereq_('./layout_attributes'); +var handleTypeDefaults = _dereq_('./type_defaults'); +var handleAxisDefaults = _dereq_('./axis_defaults'); +var handleConstraintDefaults = _dereq_('./constraint_defaults'); +var handlePositionDefaults = _dereq_('./position_defaults'); - return pointPairs; -} +var axisIds = _dereq_('./axis_ids'); +var id2name = axisIds.id2name; +var name2id = axisIds.name2id; -function setAttributes(attributes, sampleCount, points) { - for(var i = 0; i < 16; i++) { - attributes['p' + i.toString(16)](makeVecAttr(sampleCount, points, i)); - } -} +var Registry = _dereq_('../../registry'); +var traceIs = Registry.traceIs; +var getComponentMethod = Registry.getComponentMethod; -function emptyAttributes(regl) { - var attributes = {}; - for(var i = 0; i < 16; i++) { - attributes['p' + i.toString(16)] = regl.buffer({usage: 'dynamic', type: 'float', data: new Uint8Array(0)}); - } - return attributes; +function appendList(cont, k, item) { + if(Array.isArray(cont[k])) cont[k].push(item); + else cont[k] = [item]; } -module.exports = function(canvasGL, d) { - // context & pick describe which canvas we're talking about - won't change with new data - var context = d.context; - var pick = d.pick; - - var regl = d.regl; - - var renderState = { - currentRafs: {}, - drawCompleted: true, - clearOnly: false - }; - - // state to be set by update and used later - var model; - var vm; - var initialDims; - var sampleCount; - var attributes = emptyAttributes(regl); - var maskTexture; - var paletteTexture = regl.texture(paletteTextureConfig); - - update(d); - - var glAes = regl({ - - profile: false, - - blend: { - enable: context, - func: { - srcRGB: 'src alpha', - dstRGB: 'one minus src alpha', - srcAlpha: 1, - dstAlpha: 1 // 'one minus src alpha' - }, - equation: { - rgb: 'add', - alpha: 'add' - }, - color: [0, 0, 0, 0] - }, - - depth: { - enable: !context, - mask: true, - func: 'less', - range: [0, 1] - }, - - // for polygons - cull: { - enable: true, - face: 'back' - }, - - scissor: { - enable: true, - box: { - x: regl.prop('scissorX'), - y: regl.prop('scissorY'), - width: regl.prop('scissorWidth'), - height: regl.prop('scissorHeight') - } - }, - - viewport: { - x: regl.prop('viewportX'), - y: regl.prop('viewportY'), - width: regl.prop('viewportWidth'), - height: regl.prop('viewportHeight') - }, - - dither: false, - - vert: pick ? pickVertexShaderSource : context ? contextShaderSource : vertexShaderSource, - - frag: fragmentShaderSource, - - primitive: 'lines', - lineWidth: 1, - attributes: attributes, - uniforms: { - resolution: regl.prop('resolution'), - viewBoxPosition: regl.prop('viewBoxPosition'), - viewBoxSize: regl.prop('viewBoxSize'), - dim1A: regl.prop('dim1A'), - dim2A: regl.prop('dim2A'), - dim1B: regl.prop('dim1B'), - dim2B: regl.prop('dim2B'), - dim1C: regl.prop('dim1C'), - dim2C: regl.prop('dim2C'), - dim1D: regl.prop('dim1D'), - dim2D: regl.prop('dim2D'), - loA: regl.prop('loA'), - hiA: regl.prop('hiA'), - loB: regl.prop('loB'), - hiB: regl.prop('hiB'), - loC: regl.prop('loC'), - hiC: regl.prop('hiC'), - loD: regl.prop('loD'), - hiD: regl.prop('hiD'), - palette: paletteTexture, - mask: regl.prop('maskTexture'), - maskHeight: regl.prop('maskHeight'), - colorClamp: regl.prop('colorClamp') - }, - offset: regl.prop('offset'), - count: regl.prop('count') - }); - - function update(dNew) { - model = dNew.model; - vm = dNew.viewModel; - initialDims = vm.dimensions.slice(); - sampleCount = initialDims[0] ? initialDims[0].values.length : 0; - - var lines = model.lines; - var color = pick ? lines.color.map(function(_, i) {return i / lines.color.length;}) : lines.color; - var contextOpacity = Math.max(1 / 255, Math.pow(1 / color.length, 1 / 3)); - - var points = makePoints(sampleCount, initialDims, color); - setAttributes(attributes, sampleCount, points); - - paletteTexture = regl.texture(Lib.extendFlat({ - data: palette(model.unitToColor, context, Math.round((context ? contextOpacity : 1) * 255)) - }, paletteTextureConfig)); - } - - var colorClamp = [0, 1]; - - function setColorDomain(unitDomain) { - colorClamp[0] = unitDomain[0]; - colorClamp[1] = unitDomain[1]; - } - - var previousAxisOrder = []; - - function makeItem(i, ii, x, y, panelSizeX, canvasPanelSizeY, crossfilterDimensionIndex, I, leftmost, rightmost, constraints) { - var loHi, abcd, d, index; - var leftRight = [i, ii]; - - var dims = [0, 1].map(function() {return [0, 1, 2, 3].map(function() {return new Float32Array(16);});}); - - for(loHi = 0; loHi < 2; loHi++) { - index = leftRight[loHi]; - for(abcd = 0; abcd < 4; abcd++) { - for(d = 0; d < 16; d++) { - dims[loHi][abcd][d] = d + 16 * abcd === index ? 1 : 0; - } - } - } - - var overdrag = model.lines.canvasOverdrag; - var domain = model.domain; - var canvasWidth = model.canvasWidth; - var canvasHeight = model.canvasHeight; +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var ax2traces = {}; + var xaCheater = {}; + var xaNonCheater = {}; + var outerTicks = {}; + var noGrids = {}; + var i, j; - var itemModel = Lib.extendFlat({ - key: crossfilterDimensionIndex, - resolution: [canvasWidth, canvasHeight], - viewBoxPosition: [x + overdrag, y], - viewBoxSize: [panelSizeX, canvasPanelSizeY], - i: i, - ii: ii, + // look for axes in the data + for(i = 0; i < fullData.length; i++) { + var trace = fullData[i]; + if(!traceIs(trace, 'cartesian') && !traceIs(trace, 'gl2d')) continue; - dim1A: dims[0][0], - dim1B: dims[0][1], - dim1C: dims[0][2], - dim1D: dims[0][3], - dim2A: dims[1][0], - dim2B: dims[1][1], - dim2C: dims[1][2], - dim2D: dims[1][3], - - colorClamp: colorClamp, - - scissorX: (I === leftmost ? 0 : x + overdrag) + (model.pad.l - overdrag) + model.layoutWidth * domain.x[0], - scissorWidth: (I === rightmost ? canvasWidth - x + overdrag : panelSizeX + 0.5) + (I === leftmost ? x + overdrag : 0), - scissorY: y + model.pad.b + model.layoutHeight * domain.y[0], - scissorHeight: canvasPanelSizeY, - - viewportX: model.pad.l - overdrag + model.layoutWidth * domain.x[0], - viewportY: model.pad.b + model.layoutHeight * domain.y[0], - viewportWidth: canvasWidth, - viewportHeight: canvasHeight - }, constraints); - - return itemModel; - } - - function makeConstraints() { - var loHi, abcd, d; - - var lims = [0, 1].map(function() {return [0, 1, 2, 3].map(function() {return new Float32Array(16);});}); - - for(loHi = 0; loHi < 2; loHi++) { - for(abcd = 0; abcd < 4; abcd++) { - for(d = 0; d < 16; d++) { - var dimP = d + 16 * abcd; - var lim; - if(dimP < initialDims.length) { - lim = initialDims[dimP].brush.filter.getBounds()[loHi]; - } - else lim = loHi; - lims[loHi][abcd][d] = lim + (2 * loHi - 1) * filterEpsilon; - } + 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); } } - function expandedPixelRange(dim, bounds) { - var maskHMinus = maskHeight - 1; - return [ - Math.max(0, Math.floor(bounds[0] * maskHMinus)), - Math.min(maskHMinus, Math.ceil(bounds[1] * maskHMinus)) - ]; - } - - var mask = Array.apply(null, new Array(maskHeight * channelCount)).map(function() { - return 255; - }); - for(var dimIndex = 0; dimIndex < initialDims.length; dimIndex++) { - var bitIndex = dimIndex % bitsPerByte; - var byteIndex = (dimIndex - bitIndex) / bitsPerByte; - var bitMask = Math.pow(2, bitIndex); - var dim = initialDims[dimIndex]; - var ranges = dim.brush.filter.get(); - if(ranges.length < 2) continue; // bail if the bounding box based filter is sufficient - - var prevEnd = expandedPixelRange(dim, ranges[0])[1]; - for(var ri = 1; ri < ranges.length; ri++) { - var nextRange = expandedPixelRange(dim, ranges[ri]); - for(var pi = prevEnd + 1; pi < nextRange[0]; pi++) { - mask[pi * channelCount + byteIndex] &= ~bitMask; - } - prevEnd = Math.max(prevEnd, nextRange[1]); + 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); } } - var textureData = { - // 8 units x 8 bits = 64 bits, just sufficient for the almost 64 dimensions we support - shape: [channelCount, maskHeight], - format: 'alpha', - type: 'uint8', - mag: 'nearest', - min: 'nearest', - data: mask - }; - if(maskTexture) maskTexture(textureData); - else maskTexture = regl.texture(textureData); - - return { - maskTexture: maskTexture, - maskHeight: maskHeight, - loA: lims[0][0], - loB: lims[0][1], - loC: lims[0][2], - loD: lims[0][3], - hiA: lims[1][0], - hiB: lims[1][1], - hiC: lims[1][2], - hiD: lims[1][3] - }; - } - - function renderGLParcoords(panels, setChanged, clearOnly) { - var panelCount = panels.length; - var I; - - var leftmost, rightmost, lowestX = Infinity, highestX = -Infinity; - - for(I = 0; I < panelCount; I++) { - if(panels[I].dim2.canvasX > highestX) { - highestX = panels[I].dim2.canvasX; - rightmost = I; - } - if(panels[I].dim1.canvasX < lowestX) { - lowestX = panels[I].dim1.canvasX; - leftmost = I; - } + // Two things trigger axis visibility: + // 1. is not carpet + // 2. carpet that's not cheater + if(!traceIs(trace, 'carpet') || (trace.type === 'carpet' && !trace._cheater)) { + if(xaName) xaNonCheater[xaName] = 1; } - if(panelCount === 0) { - // clear canvas here, as the panel iteration below will not enter the loop body - clear(regl, 0, 0, model.canvasWidth, model.canvasHeight); + // The above check for definitely-not-cheater is not adequate. This + // second list tracks which axes *could* be a cheater so that the + // full condition triggering hiding is: + // *could* be a cheater and *is not definitely visible* + if(trace.type === 'carpet' && trace._cheater) { + if(xaName) xaCheater[xaName] = 1; } - var constraints = context ? {} : makeConstraints(); - for(I = 0; I < panelCount; I++) { - var panel = panels[I]; - var dim1 = panel.dim1; - var i = dim1.crossfilterDimensionIndex; - var x = panel.canvasX; - var y = panel.canvasY; - var dim2 = panel.dim2; - var ii = dim2.crossfilterDimensionIndex; - var panelSizeX = panel.panelSizeX; - var panelSizeY = panel.panelSizeY; - var xTo = x + panelSizeX; - if(setChanged || !previousAxisOrder[i] || previousAxisOrder[i][0] !== x || previousAxisOrder[i][1] !== xTo) { - previousAxisOrder[i] = [x, xTo]; - var item = makeItem(i, ii, x, y, panelSizeX, panelSizeY, dim1.crossfilterDimensionIndex, I, leftmost, rightmost, constraints); - renderState.clearOnly = clearOnly; - renderBlock(regl, glAes, renderState, setChanged ? model.lines.blockLineCount : sampleCount, sampleCount, item); - } + // check for default formatting tweaks + if(traceIs(trace, '2dMap')) { + outerTicks[xaName] = 1; + outerTicks[yaName] = 1; } - } - - function readPixel(canvasX, canvasY) { - regl.read({ - x: canvasX, - y: canvasY, - width: 1, - height: 1, - data: pickPixel - }); - return pickPixel; - } - - function readPixels(canvasX, canvasY, width, height) { - var pixelArray = new Uint8Array(4 * width * height); - regl.read({ - x: canvasX, - y: canvasY, - width: width, - height: height, - data: pixelArray - }); - return pixelArray; - } - - function destroy() { - canvasGL.style['pointer-events'] = 'none'; - paletteTexture.destroy(); - if(maskTexture) maskTexture.destroy(); - for(var k in attributes) attributes[k].destroy(); - } - - return { - setColorDomain: setColorDomain, - render: renderGLParcoords, - readPixel: readPixel, - readPixels: readPixels, - destroy: destroy, - update: update - }; -}; - -},{"../../lib":696,"glslify":392}],1015:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -/** - * mergeLength: set trace length as the minimum of all dimension data lengths - * and propagates this length into each dimension - * - * @param {object} traceOut: the fullData trace - * @param {Array(object)} dimensions: array of dimension objects - * @param {string} dataAttr: the attribute of each dimension containing the data - * @param {integer} len: an already-existing length from other attributes - */ -module.exports = function(traceOut, dimensions, dataAttr, len) { - if(!len) len = Infinity; - var i, dimi; - for(i = 0; i < dimensions.length; i++) { - dimi = dimensions[i]; - if(dimi.visible) len = Math.min(len, dimi[dataAttr].length); - } - if(len === Infinity) len = 0; - - traceOut._length = len; - for(i = 0; i < dimensions.length; i++) { - dimi = dimensions[i]; - if(dimi.visible) dimi._length = len; - } - - return len; -}; - -},{}],1016:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var lineLayerMaker = _dereq_('./lines'); -var c = _dereq_('./constants'); -var Lib = _dereq_('../../lib'); -var d3 = _dereq_('d3'); -var Drawing = _dereq_('../../components/drawing'); -var gup = _dereq_('../../lib/gup'); -var keyFun = gup.keyFun; -var repeat = gup.repeat; -var unwrap = gup.unwrap; -var brush = _dereq_('./axisbrush'); - -function visible(dimension) { return !('visible' in dimension) || dimension.visible; } -function dimensionExtent(dimension) { - - var lo = dimension.range ? dimension.range[0] : Lib.aggNums(Math.min, null, dimension.values, dimension._length); - var hi = dimension.range ? dimension.range[1] : Lib.aggNums(Math.max, null, dimension.values, dimension._length); - - if(isNaN(lo) || !isFinite(lo)) { - lo = 0; - } - - if(isNaN(hi) || !isFinite(hi)) { - hi = 0; - } - - // avoid a degenerate (zero-width) domain - if(lo === hi) { - if(lo === 0) { - // no use to multiplying zero, so add/subtract in this case - lo -= 1; - hi += 1; - } else { - // this keeps the range in the order of magnitude of the data - lo *= 0.9; - hi *= 1.1; + if(traceIs(trace, 'oriented')) { + var positionAxis = trace.orientation === 'h' ? yaName : xaName; + noGrids[positionAxis] = 1; } } - return [lo, hi]; -} - -function toText(formatter, texts) { - if(texts) { - return function(v, i) { - var text = texts[i]; - if(text === null || text === undefined) return formatter(v); - return text; - }; - } - return formatter; -} + 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); -function domainScale(height, padding, dimension, tickvals, ticktext) { - var extent = dimensionExtent(dimension); - if(tickvals) { - return d3.scale.ordinal() - .domain(tickvals.map(toText(d3.format(dimension.tickformat), ticktext))) - .range(tickvals - .map(function(d) { - var unitVal = (d - extent[0]) / (extent[1] - extent[0]); - return (height - padding + unitVal * (2 * padding - height)); - }) - ); + // plot_bgcolor only makes sense if there's a (2D) plot! + // TODO: bgcolor for each subplot, to inherit from the main one + var plotBgColor = Color.background; + if(xIds.length && yIds.length) { + plotBgColor = Lib.coerce(layoutIn, layoutOut, basePlotLayoutAttributes, 'plot_bgcolor'); } - return d3.scale.linear() - .domain(extent) - .range([height - padding, padding]); -} - -function unitToPaddedPx(height, padding) { return d3.scale.linear().range([padding, height - padding]); } - -function domainToPaddedUnitScale(dimension, padFraction) { - return d3.scale.linear() - .domain(dimensionExtent(dimension)) - .range([padFraction, 1 - padFraction]); -} - -function ordinalScale(dimension) { - if(!dimension.tickvals) return; - - var extent = dimensionExtent(dimension); - return d3.scale.ordinal() - .domain(dimension.tickvals) - .range(dimension.tickvals.map(function(d) { - return (d - extent[0]) / (extent[1] - extent[0]); - })); -} - -function unitToColorScale(cscale) { - - var colorStops = cscale.map(function(d) { return d[0]; }); - var colorTuples = cscale.map(function(d) { return d3.rgb(d[1]); }); - var prop = function(n) { return function(o) { return o[n]; }; }; - - // We can't use d3 color interpolation as we may have non-uniform color palette raster - // (various color stop distances). - var polylinearUnitScales = 'rgb'.split('').map(function(key) { - return d3.scale.linear() - .clamp(true) - .domain(colorStops) - .range(colorTuples.map(prop(key))); - }); - - return function(d) { - return polylinearUnitScales.map(function(s) { - return s(d); - }); - }; -} - -function someFiltersActive(view) { - return view.dimensions.some(function(p) { - return p.brush.filterSpecified; - }); -} - -function model(layout, d, i) { - var cd0 = unwrap(d), - trace = cd0.trace, - lineColor = cd0.lineColor, - cscale = cd0.cscale, - line = trace.line, - domain = trace.domain, - dimensions = trace.dimensions, - width = layout.width, - labelFont = trace.labelfont, - tickFont = trace.tickfont, - rangeFont = trace.rangefont; - - var lines = Lib.extendDeepNoArrays({}, line, { - color: lineColor.map(d3.scale.linear().domain(dimensionExtent({ - values: lineColor, - range: [line.cmin, line.cmax], - _length: trace._length - }))), - blockLineCount: c.blockLineCount, - canvasOverdrag: c.overdrag * c.canvasPixelRatio - }); - - var groupWidth = Math.floor(width * (domain.x[1] - domain.x[0])); - var groupHeight = Math.floor(layout.height * (domain.y[1] - domain.y[0])); - - var pad = layout.margin || {l: 80, r: 80, t: 100, b: 80}; - var rowContentWidth = groupWidth; - var rowHeight = groupHeight; - - return { - key: i, - colCount: dimensions.filter(visible).length, - dimensions: dimensions, - tickDistance: c.tickDistance, - unitToColor: unitToColorScale(cscale), - lines: lines, - labelFont: labelFont, - tickFont: tickFont, - rangeFont: rangeFont, - layoutWidth: width, - layoutHeight: layout.height, - domain: domain, - translateX: domain.x[0] * width, - translateY: layout.height - domain.y[1] * layout.height, - pad: pad, - canvasWidth: rowContentWidth * c.canvasPixelRatio + 2 * lines.canvasOverdrag, - canvasHeight: rowHeight * c.canvasPixelRatio, - width: rowContentWidth, - height: rowHeight, - canvasPixelRatio: c.canvasPixelRatio - }; -} - -function viewModel(state, callbacks, model) { - - var width = model.width; - var height = model.height; - var dimensions = model.dimensions; - var canvasPixelRatio = model.canvasPixelRatio; - - var xScale = function(d) {return width * d / Math.max(1, model.colCount - 1);}; - - var unitPad = c.verticalPadding / height; - var _unitToPaddedPx = unitToPaddedPx(height, c.verticalPadding); - - var viewModel = { - key: model.key, - xScale: xScale, - model: model, - inBrushDrag: false // consider factoring it out and putting it in a centralized global-ish gesture state object - }; - - var uniqueKeys = {}; - - viewModel.dimensions = dimensions.filter(visible).map(function(dimension, i) { - var domainToPaddedUnit = domainToPaddedUnitScale(dimension, unitPad); - var foundKey = uniqueKeys[dimension.label]; - uniqueKeys[dimension.label] = (foundKey || 0) + 1; - var key = dimension.label + (foundKey ? '__' + foundKey : ''); - var specifiedConstraint = dimension.constraintrange; - var filterRangeSpecified = specifiedConstraint && specifiedConstraint.length; - if(filterRangeSpecified && !Array.isArray(specifiedConstraint[0])) { - specifiedConstraint = [specifiedConstraint]; - } - var filterRange = filterRangeSpecified ? - specifiedConstraint.map(function(d) { return d.map(domainToPaddedUnit); }) : - [[0, 1]]; - var brushMove = function() { - var p = viewModel; - p.focusLayer && p.focusLayer.render(p.panels, true); - var filtersActive = someFiltersActive(p); - if(!state.contextShown() && filtersActive) { - p.contextLayer && p.contextLayer.render(p.panels, true); - state.contextShown(true); - } else if(state.contextShown() && !filtersActive) { - p.contextLayer && p.contextLayer.render(p.panels, true, true); - state.contextShown(false); - } - }; - - var truncatedValues = dimension.values; - if(truncatedValues.length > dimension._length) { - truncatedValues = truncatedValues.slice(0, dimension._length); - } - - var tickvals = dimension.tickvals; - var ticktext; - function makeTickItem(v, i) { return {val: v, text: ticktext[i]}; } - function sortTickItem(a, b) { return a.val - b.val; } - if(Array.isArray(tickvals) && tickvals.length) { - ticktext = dimension.ticktext; - - // ensure ticktext and tickvals have same length - if(!Array.isArray(ticktext) || !ticktext.length) { - ticktext = tickvals.map(d3.format(dimension.tickformat)); - } - else if(ticktext.length > tickvals.length) { - ticktext = ticktext.slice(0, tickvals.length); - } - else if(tickvals.length > ticktext.length) { - tickvals = tickvals.slice(0, ticktext.length); - } - - // check if we need to sort tickvals/ticktext - for(var j = 1; j < tickvals.length; j++) { - if(tickvals[j] < tickvals[j - 1]) { - var tickItems = tickvals.map(makeTickItem).sort(sortTickItem); - for(var k = 0; k < tickvals.length; k++) { - tickvals[k] = tickItems[k].val; - ticktext[k] = tickItems[k].text; - } - break; - } - } - } - else tickvals = undefined; - - return { - key: key, - label: dimension.label, - tickFormat: dimension.tickformat, - tickvals: tickvals, - ticktext: ticktext, - ordinal: !!tickvals, - multiselect: dimension.multiselect, - xIndex: i, - crossfilterDimensionIndex: i, - visibleIndex: dimension._index, - height: height, - values: truncatedValues, - paddedUnitValues: truncatedValues.map(domainToPaddedUnit), - unitTickvals: tickvals && tickvals.map(domainToPaddedUnit), - xScale: xScale, - x: xScale(i), - canvasX: xScale(i) * canvasPixelRatio, - unitToPaddedPx: _unitToPaddedPx, - domainScale: domainScale(height, c.verticalPadding, dimension, tickvals, ticktext), - ordinalScale: ordinalScale(dimension), - parent: viewModel, - model: model, - brush: brush.makeBrush( - state, - filterRangeSpecified, - filterRange, - function() { - state.linePickActive(false); - }, - brushMove, - function(f) { - var p = viewModel; - p.focusLayer.render(p.panels, true); - p.pickLayer && p.pickLayer.render(p.panels, true); - state.linePickActive(true); - if(callbacks && callbacks.filterChanged) { - var invScale = domainToPaddedUnit.invert; - - // update gd.data as if a Plotly.restyle were fired - var newRanges = f.map(function(r) { - return r.map(invScale).sort(Lib.sorterAsc); - }).sort(function(a, b) { return a[0] - b[0]; }); - callbacks.filterChanged(p.key, dimension._index, newRanges); - } - } - ) - }; - }); - - return viewModel; -} - -function styleExtentTexts(selection) { - selection - .classed(c.cn.axisExtentText, true) - .attr('text-anchor', 'middle') - .style('cursor', 'default') - .style('user-select', 'none'); -} - -function parcoordsInteractionState() { - var linePickActive = true; - var contextShown = false; - return { - linePickActive: function(val) {return arguments.length ? linePickActive = !!val : linePickActive;}, - contextShown: function(val) {return arguments.length ? contextShown = !!val : contextShown;} - }; -} - -module.exports = function(root, svg, parcoordsLineLayers, styledData, layout, callbacks) { - - var state = parcoordsInteractionState(); - - var vm = styledData - .filter(function(d) { return unwrap(d).trace.visible; }) - .map(model.bind(0, layout)) - .map(viewModel.bind(0, state, callbacks)); - - parcoordsLineLayers.each(function(d, i) { - return Lib.extendFlat(d, vm[i]); - }); - - var parcoordsLineLayer = parcoordsLineLayers.selectAll('.gl-canvas') - .each(function(d) { - // FIXME: figure out how to handle multiple instances - d.viewModel = vm[0]; - d.model = d.viewModel ? d.viewModel.model : null; - }); - - var lastHovered = null; - - var pickLayer = parcoordsLineLayer.filter(function(d) {return d.pick;}); - - // emit hover / unhover event - pickLayer - .style('pointer-events', 'auto') - .on('mousemove', function(d) { - if(state.linePickActive() && d.lineLayer && callbacks && callbacks.hover) { - var event = d3.event; - var cw = this.width; - var ch = this.height; - var pointer = d3.mouse(this); - var x = pointer[0]; - var y = pointer[1]; - - if(x < 0 || y < 0 || x >= cw || y >= ch) { - return; - } - var pixel = d.lineLayer.readPixel(x, ch - 1 - y); - var found = pixel[3] !== 0; - // inverse of the calcPickColor in `lines.js`; detailed comment there - var curveNumber = found ? pixel[2] + 256 * (pixel[1] + 256 * pixel[0]) : null; - var eventData = { - x: x, - y: y, - clientX: event.clientX, - clientY: event.clientY, - dataIndex: d.model.key, - curveNumber: curveNumber - }; - if(curveNumber !== lastHovered) { // don't unnecessarily repeat the same hit (or miss) - if(found) { - callbacks.hover(eventData); - } else if(callbacks.unhover) { - callbacks.unhover(eventData); - } - lastHovered = curveNumber; - } - } - }); - - parcoordsLineLayer - .style('opacity', function(d) {return d.pick ? 0.01 : 1;}); - - svg.style('background', 'rgba(255, 255, 255, 0)'); - var parcoordsControlOverlay = svg.selectAll('.' + c.cn.parcoords) - .data(vm, keyFun); - - parcoordsControlOverlay.exit().remove(); - - parcoordsControlOverlay.enter() - .append('g') - .classed(c.cn.parcoords, true) - .style('shape-rendering', 'crispEdges') - .style('pointer-events', 'none'); - - parcoordsControlOverlay.attr('transform', function(d) { - return 'translate(' + d.model.translateX + ',' + d.model.translateY + ')'; - }); - var parcoordsControlView = parcoordsControlOverlay.selectAll('.' + c.cn.parcoordsControlView) - .data(repeat, keyFun); + var bgColor = Color.combine(plotBgColor, layoutOut.paper_bgcolor); - parcoordsControlView.enter() - .append('g') - .classed(c.cn.parcoordsControlView, true); + var axName, axLetter, axLayoutIn, axLayoutOut; - parcoordsControlView.attr('transform', function(d) { - return 'translate(' + d.model.pad.l + ',' + d.model.pad.t + ')'; - }); + function coerce(attr, dflt) { + return Lib.coerce(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt); + } - var yAxis = parcoordsControlView.selectAll('.' + c.cn.yAxis) - .data(function(vm) { return vm.dimensions; }, keyFun); + function coerce2(attr, dflt) { + return Lib.coerce2(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt); + } - function updatePanelLayout(yAxis, vm) { - var panels = vm.panels || (vm.panels = []); - var dimData = yAxis.data(); - var panelCount = dimData.length - 1; - for(var p = 0; p < panelCount; p++) { - var panel = panels[p] || (panels[p] = {}); - var dim1 = dimData[p]; - var dim2 = dimData[p + 1]; - panel.dim1 = dim1; - panel.dim2 = dim2; - panel.canvasX = dim1.canvasX; - panel.panelSizeX = dim2.canvasX - dim1.canvasX; - panel.panelSizeY = vm.model.canvasHeight; - panel.y = 0; - panel.canvasY = 0; - } + function getCounterAxes(axLetter) { + return (axLetter === 'x') ? yIds : xIds; } - yAxis.enter() - .append('g') - .classed(c.cn.yAxis, true); + var counterAxes = {x: getCounterAxes('x'), y: getCounterAxes('y')}; - parcoordsControlView.each(function(vm) { - updatePanelLayout(yAxis, vm); - }); + function getOverlayableAxes(axLetter, axName) { + var list = (axLetter === 'x') ? xNames : yNames; + var out = []; - parcoordsLineLayer - .each(function(d) { - if(d.viewModel) { - if(!d.lineLayer || callbacks) { // recreate in case of having callbacks e.g. restyle. Should we test for callback to be a restyle? - d.lineLayer = lineLayerMaker(this, d); - } else d.lineLayer.update(d); - - if(d.key || d.key === 0) d.viewModel[d.key] = d.lineLayer; - - var setChanged = (!d.context || // don't update background - callbacks); // unless there is a callback on the context layer. Should we test the callback? - - d.lineLayer.render(d.viewModel.panels, setChanged); - } - }); + for(var j = 0; j < list.length; j++) { + var axName2 = list[j]; - yAxis.attr('transform', function(d) { - return 'translate(' + d.xScale(d.xIndex) + ', 0)'; - }); - - // drag column for reordering columns - yAxis.call(d3.behavior.drag() - .origin(function(d) { return d; }) - .on('drag', function(d) { - var p = d.parent; - state.linePickActive(false); - d.x = Math.max(-c.overdrag, Math.min(d.model.width + c.overdrag, d3.event.x)); - d.canvasX = d.x * d.model.canvasPixelRatio; - yAxis - .sort(function(a, b) { return a.x - b.x; }) - .each(function(dd, i) { - dd.xIndex = i; - dd.x = d === dd ? dd.x : dd.xScale(dd.xIndex); - dd.canvasX = dd.x * dd.model.canvasPixelRatio; - }); + if(axName2 !== axName && !(layoutIn[axName2] || {}).overlaying) { + out.push(name2id(axName2)); + } + } - updatePanelLayout(yAxis, p); + return out; + } - yAxis.filter(function(dd) { return Math.abs(d.xIndex - dd.xIndex) !== 0; }) - .attr('transform', function(d) { return 'translate(' + d.xScale(d.xIndex) + ', 0)'; }); - d3.select(this).attr('transform', 'translate(' + d.x + ', 0)'); - yAxis.each(function(dd, i, ii) { if(ii === d.parent.key) p.dimensions[i] = dd; }); - p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); - p.focusLayer.render && p.focusLayer.render(p.panels); - }) - .on('dragend', function(d) { - var p = d.parent; - d.x = d.xScale(d.xIndex); - d.canvasX = d.x * d.model.canvasPixelRatio; - updatePanelLayout(yAxis, p); - d3.select(this) - .attr('transform', function(d) { return 'translate(' + d.x + ', 0)'; }); - p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); - p.focusLayer && p.focusLayer.render(p.panels); - p.pickLayer && p.pickLayer.render(p.panels, true); - state.linePickActive(true); + // first pass creates the containers, determines types, and handles most of the settings + for(i = 0; i < axNames.length; i++) { + axName = axNames[i]; + axLetter = axName.charAt(0); - if(callbacks && callbacks.axesMoved) { - callbacks.axesMoved(p.key, p.dimensions.map(function(dd) {return dd.crossfilterDimensionIndex;})); - } - }) - ); + if(!Lib.isPlainObject(layoutIn[axName])) { + layoutIn[axName] = {}; + } - yAxis.exit() - .remove(); + axLayoutIn = layoutIn[axName]; + axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + 'axis'); - var axisOverlays = yAxis.selectAll('.' + c.cn.axisOverlays) - .data(repeat, keyFun); + var traces = ax2traces[axName] || []; + axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; }); + axLayoutOut._annIndices = []; + axLayoutOut._shapeIndices = []; + axLayoutOut._imgIndices = []; + axLayoutOut._subplotsWith = []; + axLayoutOut._counterAxes = []; - axisOverlays.enter() - .append('g') - .classed(c.cn.axisOverlays, true); + // set up some private properties + axLayoutOut._name = axLayoutOut._attr = axName; + var id = axLayoutOut._id = name2id(axName); - axisOverlays.selectAll('.' + c.cn.axis).remove(); + var overlayableAxes = getOverlayableAxes(axLetter, axName); - var axis = axisOverlays.selectAll('.' + c.cn.axis) - .data(repeat, keyFun); + var defaultOptions = { + letter: axLetter, + font: layoutOut.font, + outerTicks: outerTicks[axName], + showGrid: !noGrids[axName], + data: traces, + bgColor: bgColor, + calendar: layoutOut.calendar, + automargin: true, + cheateronly: axLetter === 'x' && xaCheater[axName] && !xaNonCheater[axName], + splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[id] + }; - axis.enter() - .append('g') - .classed(c.cn.axis, true); + coerce('uirevision', layoutOut.uirevision); - axis - .each(function(d) { - var wantedTickCount = d.model.height / d.model.tickDistance; - var scale = d.domainScale; - var sdom = scale.domain(); - d3.select(this) - .call(d3.svg.axis() - .orient('left') - .tickSize(4) - .outerTickSize(2) - .ticks(wantedTickCount, d.tickFormat) // works for continuous scales only... - .tickValues(d.ordinal ? // and this works for ordinal scales - sdom : - null) - .tickFormat(d.ordinal ? function(d) { return d; } : null) - .scale(scale)); - Drawing.font(axis.selectAll('text'), d.model.tickFont); - }); - - axis.selectAll('.domain, .tick>line') - .attr('fill', 'none') - .attr('stroke', 'black') - .attr('stroke-opacity', 0.25) - .attr('stroke-width', '1px'); - - axis.selectAll('text') - .style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff') - .style('cursor', 'default') - .style('user-select', 'none'); - - var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading) - .data(repeat, keyFun); - - axisHeading.enter() - .append('g') - .classed(c.cn.axisHeading, true); + handleTypeDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions); + handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut); - var axisTitle = axisHeading.selectAll('.' + c.cn.axisTitle) - .data(repeat, keyFun); + var spikecolor = coerce2('spikecolor'); + var spikethickness = coerce2('spikethickness'); + var spikedash = coerce2('spikedash'); + var spikemode = coerce2('spikemode'); + var spikesnap = coerce2('spikesnap'); + var showSpikes = coerce('showspikes', !!spikecolor || !!spikethickness || !!spikedash || !!spikemode || !!spikesnap); - axisTitle.enter() - .append('text') - .classed(c.cn.axisTitle, true) - .attr('text-anchor', 'middle') - .style('cursor', 'ew-resize') - .style('user-select', 'none') - .style('pointer-events', 'auto'); + if(!showSpikes) { + delete axLayoutOut.spikecolor; + delete axLayoutOut.spikethickness; + delete axLayoutOut.spikedash; + delete axLayoutOut.spikemode; + delete axLayoutOut.spikesnap; + } - axisTitle - .attr('transform', 'translate(0,' + -c.axisTitleOffset + ')') - .text(function(d) { return d.label; }) - .each(function(d) { Drawing.font(d3.select(this), d.model.labelFont); }); + var positioningOptions = { + letter: axLetter, + counterAxes: counterAxes[axLetter], + overlayableAxes: overlayableAxes, + grid: layoutOut.grid + }; - var axisExtent = axisOverlays.selectAll('.' + c.cn.axisExtent) - .data(repeat, keyFun); + handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, positioningOptions); - axisExtent.enter() - .append('g') - .classed(c.cn.axisExtent, true); + axLayoutOut._input = axLayoutIn; + } - var axisExtentTop = axisExtent.selectAll('.' + c.cn.axisExtentTop) - .data(repeat, keyFun); + // quick second pass for range slider and selector defaults + var rangeSliderDefaults = getComponentMethod('rangeslider', 'handleDefaults'); + var rangeSelectorDefaults = getComponentMethod('rangeselector', 'handleDefaults'); - axisExtentTop.enter() - .append('g') - .classed(c.cn.axisExtentTop, true); + for(i = 0; i < xNames.length; i++) { + axName = xNames[i]; + axLayoutIn = layoutIn[axName]; + axLayoutOut = layoutOut[axName]; - axisExtentTop - .attr('transform', 'translate(' + 0 + ',' + -c.axisExtentOffset + ')'); + rangeSliderDefaults(layoutIn, layoutOut, axName); - var axisExtentTopText = axisExtentTop.selectAll('.' + c.cn.axisExtentTopText) - .data(repeat, keyFun); + if(axLayoutOut.type === 'date') { + rangeSelectorDefaults( + axLayoutIn, + axLayoutOut, + layoutOut, + yNames, + axLayoutOut.calendar + ); + } - function extremeText(d, isTop) { - if(d.ordinal) return ''; - var domain = d.domainScale.domain(); - return d3.format(d.tickFormat)(domain[isTop ? domain.length - 1 : 0]); + coerce('fixedrange'); } - axisExtentTopText.enter() - .append('text') - .classed(c.cn.axisExtentTopText, true) - .call(styleExtentTexts); + for(i = 0; i < yNames.length; i++) { + axName = yNames[i]; + axLayoutIn = layoutIn[axName]; + axLayoutOut = layoutOut[axName]; - axisExtentTopText - .text(function(d) { return extremeText(d, true); }) - .each(function(d) { Drawing.font(d3.select(this), d.model.rangeFont); }); + var anchoredAxis = layoutOut[id2name(axLayoutOut.anchor)]; - var axisExtentBottom = axisExtent.selectAll('.' + c.cn.axisExtentBottom) - .data(repeat, keyFun); + var fixedRangeDflt = getComponentMethod('rangeslider', 'isVisible')(anchoredAxis); - axisExtentBottom.enter() - .append('g') - .classed(c.cn.axisExtentBottom, true); + coerce('fixedrange', fixedRangeDflt); + } - axisExtentBottom - .attr('transform', function(d) { - return 'translate(' + 0 + ',' + (d.model.height + c.axisExtentOffset) + ')'; - }); + // Finally, handle scale constraints. We need to do this after all axes have + // coerced both `type` (so we link only axes of the same type) and + // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - var axisExtentBottomText = axisExtentBottom.selectAll('.' + c.cn.axisExtentBottomText) - .data(repeat, keyFun); + // sets of axes linked by `scaleanchor` along with the scaleratios compounded + // together, populated in handleConstraintDefaults + layoutOut._axisConstraintGroups = []; + var allAxisIds = counterAxes.x.concat(counterAxes.y); - axisExtentBottomText.enter() - .append('text') - .classed(c.cn.axisExtentBottomText, true) - .attr('dy', '0.75em') - .call(styleExtentTexts); + for(i = 0; i < axNames.length; i++) { + axName = axNames[i]; + axLetter = axName.charAt(0); - axisExtentBottomText - .text(function(d) { return extremeText(d); }) - .each(function(d) { Drawing.font(d3.select(this), d.model.rangeFont); }); + axLayoutIn = layoutIn[axName]; + axLayoutOut = layoutOut[axName]; - brush.ensureAxisBrush(axisOverlays); + handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, allAxisIds, layoutOut); + } }; -},{"../../components/drawing":595,"../../lib":696,"../../lib/gup":693,"./axisbrush":1008,"./constants":1011,"./lines":1014,"d3":148}],1017:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../lib":159,"../../plot_api/plot_template":193,"../../registry":243,"../layout_attributes":234,"./axis_defaults":205,"./axis_ids":206,"./constraint_defaults":210,"./layout_attributes":216,"./position_defaults":219,"./type_defaults":227}],218:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -158616,1732 +56110,1696 @@ 'use strict'; -var parcoords = _dereq_('./parcoords'); -var prepareRegl = _dereq_('../../lib/prepare_regl'); +var colorMix = _dereq_('tinycolor2').mix; +var lightFraction = _dereq_('../../components/color/attributes').lightFraction; +var Lib = _dereq_('../../lib'); -module.exports = function plot(gd, cdparcoords) { - var fullLayout = gd._fullLayout; - var svg = fullLayout._toppaper; - var root = fullLayout._paperdiv; - var container = fullLayout._glcontainer; +/** + * @param {object} opts : + * - dfltColor {string} : default axis color + * - bgColor {string} : combined subplot bg color + * - blend {number, optional} : blend percentage (to compute dflt grid color) + * - showLine {boolean} : show line by default + * - showGrid {boolean} : show grid by default + * - noZeroLine {boolean} : don't coerce zeroline* attributes + * - attributes {object} : attribute object associated with input containers + */ +module.exports = function handleLineGridDefaults(containerIn, containerOut, coerce, opts) { + opts = opts || {}; - var success = prepareRegl(gd); - if(!success) return; + var dfltColor = opts.dfltColor; - var gdDimensions = {}; - var gdDimensionsOriginalOrder = {}; + function coerce2(attr, dflt) { + return Lib.coerce2(containerIn, containerOut, opts.attributes, attr, dflt); + } - var size = fullLayout._size; + var lineColor = coerce2('linecolor', dfltColor); + var lineWidth = coerce2('linewidth'); + var showLine = coerce('showline', opts.showLine || !!lineColor || !!lineWidth); - cdparcoords.forEach(function(d, i) { - gdDimensions[i] = gd.data[i].dimensions; - gdDimensionsOriginalOrder[i] = gd.data[i].dimensions.slice(); - }); + if(!showLine) { + delete containerOut.linecolor; + delete containerOut.linewidth; + } - var filterChanged = function(i, originalDimensionIndex, newRanges) { + var gridColorDflt = colorMix(dfltColor, opts.bgColor, opts.blend || lightFraction).toRgbString(); + var gridColor = coerce2('gridcolor', gridColorDflt); + var gridWidth = coerce2('gridwidth'); + var showGridLines = coerce('showgrid', opts.showGrid || !!gridColor || !!gridWidth); - // Have updated `constraintrange` data on `gd.data` and raise `Plotly.restyle` event - // without having to incur heavy UI blocking due to an actual `Plotly.restyle` call + if(!showGridLines) { + delete containerOut.gridcolor; + delete containerOut.gridwidth; + } - var gdDimension = gdDimensionsOriginalOrder[i][originalDimensionIndex]; - var newConstraints = newRanges.map(function(r) { return r.slice(); }); - if(!newConstraints.length) { - delete gdDimension.constraintrange; - newConstraints = null; - } - else { - if(newConstraints.length === 1) newConstraints = newConstraints[0]; - gdDimension.constraintrange = newConstraints; - // wrap in another array for restyle event data - newConstraints = [newConstraints]; + 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; } + } +}; - var restyleData = {}; - var aStr = 'dimensions[' + originalDimensionIndex + '].constraintrange'; - restyleData[aStr] = newConstraints; - gd.emit('plotly_restyle', [restyleData, [i]]); - }; +},{"../../components/color/attributes":42,"../../lib":159,"tinycolor2":26}],219:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var hover = function(eventData) { - gd.emit('plotly_hover', eventData); - }; - var unhover = function(eventData) { - gd.emit('plotly_unhover', eventData); - }; +'use strict'; - var axesMoved = function(i, visibleIndices) { +var isNumeric = _dereq_('fast-isnumeric'); - // Have updated order data on `gd.data` and raise `Plotly.restyle` event - // without having to incur heavy UI blocking due to an actual `Plotly.restyle` call +var Lib = _dereq_('../../lib'); - function visible(dimension) {return !('visible' in dimension) || dimension.visible;} - function newIdx(visibleIndices, orig, dim) { - var origIndex = orig.indexOf(dim); - var currentIndex = visibleIndices.indexOf(origIndex); - if(currentIndex === -1) { - // invisible dimensions initially go to the end - currentIndex += orig.length; - } - return currentIndex; +module.exports = function handlePositionDefaults(containerIn, containerOut, coerce, options) { + var counterAxes = options.counterAxes || []; + var overlayableAxes = options.overlayableAxes || []; + var letter = options.letter; + var grid = options.grid; + + var dfltAnchor, dfltDomain, dfltSide, dfltPosition; + + 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]; } + } - function sorter(orig) { - return function sorter(d1, d2) { - var i1 = newIdx(visibleIndices, orig, d1); - var i2 = newIdx(visibleIndices, orig, d2); - return i1 - i2; - }; + // Even if there's a grid, this axis may not be in it - fall back on non-grid defaults + dfltDomain = dfltDomain || [0, 1]; + dfltAnchor = dfltAnchor || (isNumeric(containerIn.position) ? 'free' : (counterAxes[0] || 'free')); + dfltSide = dfltSide || (letter === 'x' ? 'bottom' : 'left'); + dfltPosition = dfltPosition || 0; + + var anchor = Lib.coerce(containerIn, containerOut, { + anchor: { + valType: 'enumerated', + values: ['free'].concat(counterAxes), + dflt: dfltAnchor } + }, 'anchor'); - // drag&drop sorting of the visible dimensions - var orig = sorter(gdDimensionsOriginalOrder[i].filter(visible)); - gdDimensions[i].sort(orig); - - // invisible dimensions are not interpreted in the context of drag&drop sorting as an invisible dimension - // cannot be dragged; they're interspersed into their original positions by this subsequent merging step - gdDimensionsOriginalOrder[i].filter(function(d) {return !visible(d);}) - .sort(function(d) { - // subsequent splicing to be done left to right, otherwise indices may be incorrect - return gdDimensionsOriginalOrder[i].indexOf(d); - }) - .forEach(function(d) { - gdDimensions[i].splice(gdDimensions[i].indexOf(d), 1); // remove from the end - gdDimensions[i].splice(gdDimensionsOriginalOrder[i].indexOf(d), 0, d); // insert at original index - }); + if(anchor === 'free') coerce('position', dfltPosition); - gd.emit('plotly_restyle'); - }; + Lib.coerce(containerIn, containerOut, { + side: { + valType: 'enumerated', + values: letter === 'x' ? ['bottom', 'top'] : ['left', 'right'], + dflt: dfltSide + } + }, 'side'); - parcoords( - root, - svg, - container, - cdparcoords, - { - width: size.w, - height: size.h, - margin: { - t: size.t, - r: size.r, - b: size.b, - l: size.l + var overlaying = false; + if(overlayableAxes.length) { + overlaying = Lib.coerce(containerIn, containerOut, { + overlaying: { + valType: 'enumerated', + values: [false].concat(overlayableAxes), + dflt: false } - }, - { - filterChanged: filterChanged, - hover: hover, - unhover: unhover, - axesMoved: axesMoved - }); + }, 'overlaying'); + } + + if(!overlaying) { + // TODO: right now I'm copying this domain over to overlaying axes + // in ax.setscale()... but this means we still need (imperfect) logic + // in the axes popover to hide domain for the overlaying axis. + // perhaps I should make a private version _domain that all axes get??? + var domain = coerce('domain', dfltDomain); + + // according to https://www.npmjs.com/package/canvas-size + // the minimum value of max canvas width across browsers and devices is 4096 + // which applied in the calculation below: + if(domain[0] > domain[1] - 1 / 4096) containerOut.domain = dfltDomain; + Lib.noneOrAll(containerIn.domain, containerOut.domain, dfltDomain); + } + + coerce('layer'); + + return containerOut; }; -},{"../../lib/prepare_regl":709,"./parcoords":1016}],1018:[function(_dereq_,module,exports){ +},{"../../lib":159,"fast-isnumeric":10}],220:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var colorAttrs = _dereq_('../../components/color/attributes'); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var domainAttrs = _dereq_('../../plots/domain').attributes; - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var textFontAttrs = fontAttrs({ - editType: 'calc', - arrayOk: true, - colorEditType: 'plot', - -}); - -module.exports = { - labels: { - valType: 'data_array', - editType: 'calc', - - }, - // equivalent of x0 and dx, if label is missing - label0: { - valType: 'number', - - dflt: 0, - editType: 'calc', - - }, - dlabel: { - valType: 'number', - - dflt: 1, - editType: 'calc', - - }, - - values: { - valType: 'data_array', - editType: 'calc', - - }, - - marker: { - colors: { - valType: 'data_array', // TODO 'color_array' ? - editType: 'calc', - - }, - - line: { - color: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - arrayOk: true, - editType: 'style', - - }, - width: { - valType: 'number', - - min: 0, - dflt: 0, - arrayOk: true, - editType: 'style', - - }, - editType: 'calc' - }, - editType: 'calc' - }, - - text: { - valType: 'data_array', - editType: 'calc', - - }, - hovertext: { - valType: 'string', - - dflt: '', - arrayOk: true, - editType: 'style', - - }, - -// 'see eg:' -// 'https://www.e-education.psu.edu/natureofgeoinfo/sites/www.e-education.psu.edu.natureofgeoinfo/files/image/hisp_pies.gif', -// '(this example involves a map too - may someday be a whole trace type', -// 'of its own. but the point is the size of the whole pie is important.)' - scalegroup: { - valType: 'string', - - dflt: '', - editType: 'calc', - - }, - - // labels (legend is handled by plots.attributes.showlegend and layout.hiddenlabels) - textinfo: { - valType: 'flaglist', - - flags: ['label', 'text', 'value', 'percent'], - extras: ['none'], - editType: 'calc', - - }, - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['label', 'text', 'value', 'percent', 'name'] - }), - textposition: { - valType: 'enumerated', - - values: ['inside', 'outside', 'auto', 'none'], - dflt: 'auto', - arrayOk: true, - editType: 'calc', - - }, - textfont: extendFlat({}, textFontAttrs, { - - }), - insidetextfont: extendFlat({}, textFontAttrs, { - - }), - outsidetextfont: extendFlat({}, textFontAttrs, { - - }), - title: { - valType: 'string', - dflt: '', - - editType: 'calc', - - }, - titleposition: { - valType: 'enumerated', - values: [ - 'top left', 'top center', 'top right', - 'middle center', - 'bottom left', 'bottom center', 'bottom right' - ], - - editType: 'calc', - - }, - titlefont: extendFlat({}, textFontAttrs, { - - }), +'use strict'; - // position and shape - domain: domainAttrs({name: 'pie', trace: true, editType: 'calc'}), +var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; - hole: { - valType: 'number', - - min: 0, - max: 1, - dflt: 0, - editType: 'calc', - - }, +module.exports = function scaleZoom(ax, factor, centerFraction) { + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } - // ordering and direction - sort: { - valType: 'boolean', - - dflt: true, - editType: 'calc', - - }, - direction: { - /** - * there are two common conventions, both of which place the first - * (largest, if sorted) slice with its left edge at 12 o'clock but - * succeeding slices follow either cw or ccw from there. - * - * see http://visage.co/data-visualization-101-pie-charts/ - */ - valType: 'enumerated', - values: ['clockwise', 'counterclockwise'], - - dflt: 'counterclockwise', - editType: 'calc', - - }, - rotation: { - valType: 'number', - - min: -360, - max: 360, - dflt: 0, - editType: 'calc', - - }, + var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; + var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - pull: { - valType: 'number', - - min: 0, - max: 1, - dflt: 0, - arrayOk: true, - editType: 'calc', - - } + ax.range = ax._input.range = [ + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) + ]; }; -},{"../../components/color/attributes":569,"../../lib/extend":685,"../../plots/attributes":741,"../../plots/domain":770,"../../plots/font_attributes":771}],1019:[function(_dereq_,module,exports){ +},{"../../constants/alignment":138}],221:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; +var polybool = _dereq_('polybooljs'); + var Registry = _dereq_('../../registry'); -var getModuleCalcData = _dereq_('../../plots/get_data').getModuleCalcData; +var Color = _dereq_('../../components/color'); +var Fx = _dereq_('../../components/fx'); -exports.name = 'pie'; +var polygon = _dereq_('../../lib/polygon'); +var throttle = _dereq_('../../lib/throttle'); +var makeEventData = _dereq_('../../components/fx/helpers').makeEventData; +var getFromId = _dereq_('./axis_ids').getFromId; +var clearGlCanvases = _dereq_('../../lib/clear_gl_canvases'); +var redrawReglTraces = _dereq_('../../plot_api/subroutines').redrawReglTraces; -exports.plot = function(gd) { - var Pie = Registry.getModule('pie'); - var cdPie = getModuleCalcData(gd.calcdata, Pie)[0]; +var constants = _dereq_('./constants'); +var MINSELECT = constants.MINSELECT; - if(cdPie.length) Pie.plot(gd, cdPie); -}; +var filteredPolygon = polygon.filter; +var polygonTester = polygon.tester; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var hadPie = (oldFullLayout._has && oldFullLayout._has('pie')); - var hasPie = (newFullLayout._has && newFullLayout._has('pie')); +function getAxId(ax) { return ax._id; } + +function prepSelect(e, startX, startY, dragOptions, mode) { + var gd = dragOptions.gd; + var fullLayout = gd._fullLayout; + var zoomLayer = fullLayout._zoomlayer; + var dragBBox = dragOptions.element.getBoundingClientRect(); + var plotinfo = dragOptions.plotinfo; + var xs = plotinfo.xaxis._offset; + var ys = plotinfo.yaxis._offset; + var x0 = startX - dragBBox.left; + var y0 = startY - dragBBox.top; + var x1 = x0; + var y1 = y0; + var path0 = 'M' + x0 + ',' + y0; + var pw = dragOptions.xaxes[0]._length; + var ph = dragOptions.yaxes[0]._length; + var allAxes = dragOptions.xaxes.concat(dragOptions.yaxes); + var subtract = e.altKey; + + var filterPoly, selectionTester, mergedPolygons, currentPolygon; + var i, searchInfo, eventData; + + coerceSelectionsCache(e, gd, dragOptions); - if(hadPie && !hasPie) { - oldFullLayout._pielayer.selectAll('g.trace').remove(); + if(mode === 'lasso') { + filterPoly = filteredPolygon([[x0, y0]], constants.BENDPX); } -}; -},{"../../plots/get_data":781,"../../registry":827}],1020:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var outlines = zoomLayer.selectAll('path.select-outline-' + plotinfo.id).data([1, 2]); -'use strict'; + outlines.enter() + .append('path') + .attr('class', function(d) { return 'select-outline select-outline-' + d + ' select-outline-' + plotinfo.id; }) + .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('d', path0 + 'Z'); -var isNumeric = _dereq_('fast-isnumeric'); -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; -var tinycolor = _dereq_('tinycolor2'); + var corners = zoomLayer.append('path') + .attr('class', 'zoombox-corners') + .style({ + fill: Color.background, + stroke: Color.defaultLine, + 'stroke-width': 1 + }) + .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('d', 'M0,0Z'); -var Color = _dereq_('../../components/color'); -var helpers = _dereq_('./helpers'); -exports.calc = function calc(gd, trace) { - var vals = trace.values; - var hasVals = isArrayOrTypedArray(vals) && vals.length; - var labels = trace.labels; - var colors = trace.marker.colors || []; - var cd = []; - var fullLayout = gd._fullLayout; - var colorMap = fullLayout._piecolormap; - var allThisTraceLabels = {}; - var vTotal = 0; - var hiddenLabels = fullLayout.hiddenlabels || []; + var throttleID = fullLayout._uid + constants.SELECTID; + var selection = []; - var i, v, label, hidden, pt; + // find the traces to search for selection points + var searchTraces = determineSearchTraces(gd, dragOptions.xaxes, + dragOptions.yaxes, dragOptions.subplot); - if(trace.dlabel) { - labels = new Array(vals.length); - for(i = 0; i < vals.length; i++) { - labels[i] = String(trace.label0 + i * trace.dlabel); - } + function axValue(ax) { + var index = (ax._id.charAt(0) === 'y') ? 1 : 0; + return function(v) { return ax.p2d(v[index]); }; } - function pullColor(color, label) { - if(!color) return false; + function ascending(a, b) { return a - b; } - color = tinycolor(color); - if(!color.isValid()) return false; + // allow subplots to override fillRangeItems routine + var fillRangeItems; - color = Color.addOpacity(color, color.getAlpha()); - if(!colorMap[label]) colorMap[label] = color; + if(plotinfo.fillRangeItems) { + fillRangeItems = plotinfo.fillRangeItems; + } else { + if(mode === 'select') { + fillRangeItems = function(eventData, poly) { + var ranges = eventData.range = {}; - return color; - } + for(i = 0; i < allAxes.length; i++) { + var ax = allAxes[i]; + var axLetter = ax._id.charAt(0); - var seriesLen = (hasVals ? vals : labels).length; + ranges[ax._id] = [ + ax.p2d(poly[axLetter + 'min']), + ax.p2d(poly[axLetter + 'max']) + ].sort(ascending); + } + }; + } else { + fillRangeItems = function(eventData, poly, filterPoly) { + var dataPts = eventData.lassoPoints = {}; - for(i = 0; i < seriesLen; i++) { - if(hasVals) { - v = vals[i]; - if(!isNumeric(v)) continue; - v = +v; - if(v < 0) continue; + for(i = 0; i < allAxes.length; i++) { + var ax = allAxes[i]; + dataPts[ax._id] = filterPoly.filtered.map(axValue(ax)); + } + }; } - else v = 1; + } - label = labels[i]; - if(label === undefined || label === '') label = i; - label = String(label); + dragOptions.moveFn = function(dx0, dy0) { + x1 = Math.max(0, Math.min(pw, dx0 + x0)); + y1 = Math.max(0, Math.min(ph, dy0 + y0)); - var thisLabelIndex = allThisTraceLabels[label]; - if(thisLabelIndex === undefined) { - allThisTraceLabels[label] = cd.length; + var dx = Math.abs(x1 - x0); + var dy = Math.abs(y1 - y0); - hidden = hiddenLabels.indexOf(label) !== -1; + if(mode === 'select') { + var direction = fullLayout.selectdirection; - if(!hidden) vTotal += v; + if(fullLayout.selectdirection === '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 = fullLayout.selectdirection; + } - cd.push({ - v: v, - label: label, - color: pullColor(colors[i], label), - i: i, - pts: [i], - hidden: hidden - }); - } - else { - pt = cd[thisLabelIndex]; - pt.v += v; - pt.pts.push(i); - if(!pt.hidden) vTotal += v; + if(direction === 'h') { + // horizontal motion: make a vertical box + currentPolygon = [[x0, 0], [x0, ph], [x1, ph], [x1, 0]]; + currentPolygon.xmin = Math.min(x0, x1); + currentPolygon.xmax = Math.max(x0, x1); + currentPolygon.ymin = Math.min(0, ph); + currentPolygon.ymax = Math.max(0, ph); + // extras to guide users in keeping a straight selection + corners.attr('d', 'M' + currentPolygon.xmin + ',' + (y0 - MINSELECT) + + 'h-4v' + (2 * MINSELECT) + 'h4Z' + + 'M' + (currentPolygon.xmax - 1) + ',' + (y0 - MINSELECT) + + 'h4v' + (2 * MINSELECT) + 'h-4Z'); - if(pt.color === false && colors[i]) { - pt.color = pullColor(colors[i], label); + } + else if(direction === 'v') { + // vertical motion: make a horizontal box + currentPolygon = [[0, y0], [0, y1], [pw, y1], [pw, y0]]; + currentPolygon.xmin = Math.min(0, pw); + currentPolygon.xmax = Math.max(0, pw); + currentPolygon.ymin = Math.min(y0, y1); + currentPolygon.ymax = Math.max(y0, y1); + corners.attr('d', 'M' + (x0 - MINSELECT) + ',' + currentPolygon.ymin + + 'v-4h' + (2 * MINSELECT) + 'v4Z' + + 'M' + (x0 - MINSELECT) + ',' + (currentPolygon.ymax - 1) + + 'v4h' + (2 * MINSELECT) + 'v-4Z'); + } + else if(direction === 'd') { + // diagonal motion + currentPolygon = [[x0, y0], [x0, y1], [x1, y1], [x1, y0]]; + currentPolygon.xmin = Math.min(x0, x1); + currentPolygon.xmax = Math.max(x0, x1); + currentPolygon.ymin = Math.min(y0, y1); + currentPolygon.ymax = Math.max(y0, y1); + corners.attr('d', 'M0,0Z'); } } - } + else if(mode === 'lasso') { + filterPoly.addPt([x1, y1]); + currentPolygon = filterPoly.filtered; + } - if(trace.sort) cd.sort(function(a, b) { return b.v - a.v; }); + // create outline & tester + if(dragOptions.selectionDefs && dragOptions.selectionDefs.length) { + mergedPolygons = mergePolygons(dragOptions.mergedPolygons, currentPolygon, subtract); + currentPolygon.subtract = subtract; + selectionTester = multiTester(dragOptions.selectionDefs.concat([currentPolygon])); + } + else { + mergedPolygons = [currentPolygon]; + selectionTester = polygonTester(currentPolygon); + } - // include the sum of all values in the first point - if(cd[0]) cd[0].vTotal = vTotal; + // draw selection + drawSelection(mergedPolygons, outlines); - // now insert text - if(trace.textinfo && trace.textinfo !== 'none') { - var hasLabel = trace.textinfo.indexOf('label') !== -1; - var hasText = trace.textinfo.indexOf('text') !== -1; - var hasValue = trace.textinfo.indexOf('value') !== -1; - var hasPercent = trace.textinfo.indexOf('percent') !== -1; - var separators = fullLayout.separators; - var thisText; + throttle.throttle( + throttleID, + constants.SELECTDELAY, + function() { + selection = []; - for(i = 0; i < cd.length; i++) { - pt = cd[i]; - thisText = hasLabel ? [pt.label] : []; - if(hasText) { - var texti = helpers.getFirstFilled(trace.text, pt.pts); - if(texti) thisText.push(texti); + var thisSelection; + var traceSelections = []; + var traceSelection; + for(i = 0; i < searchTraces.length; i++) { + searchInfo = searchTraces[i]; + + traceSelection = searchInfo._module.selectPoints(searchInfo, selectionTester); + traceSelections.push(traceSelection); + + thisSelection = fillSelectionItem(traceSelection, searchInfo); + + if(selection.length) { + for(var j = 0; j < thisSelection.length; j++) { + selection.push(thisSelection[j]); + } + } + else selection = thisSelection; + } + + eventData = {points: selection}; + updateSelectedState(gd, searchTraces, eventData); + fillRangeItems(eventData, currentPolygon, filterPoly); + dragOptions.gd.emit('plotly_selecting', eventData); } - if(hasValue) thisText.push(helpers.formatPieValue(pt.v, separators)); - if(hasPercent) thisText.push(helpers.formatPiePercent(pt.v / vTotal, separators)); - pt.text = thisText.join('
'); - } - } + ); + }; - return cd; -}; + dragOptions.clickFn = function(numClicks, evt) { + var clickmode = fullLayout.clickmode; -/* - * `calc` filled in (and collated) explicit colors. - * Now we need to propagate these explicit colors to other traces, - * and fill in default colors. - * This is done after sorting, so we pick defaults - * in the order slices will be displayed - */ -exports.crossTraceCalc = function(gd) { - var fullLayout = gd._fullLayout; - var calcdata = gd.calcdata; - var pieColorWay = fullLayout.piecolorway; - var colorMap = fullLayout._piecolormap; + corners.remove(); - if(fullLayout.extendpiecolors) { - pieColorWay = generateExtendedColors(pieColorWay); - } - var dfltColorCount = 0; + throttle.done(throttleID).then(function() { + throttle.clear(throttleID); + if(numClicks === 2) { + // clear selection on doubleclick + outlines.remove(); + for(i = 0; i < searchTraces.length; i++) { + searchInfo = searchTraces[i]; + searchInfo._module.selectPoints(searchInfo, false); + } - var i, j, cd, pt; - for(i = 0; i < calcdata.length; i++) { - cd = calcdata[i]; - if(cd[0].trace.type !== 'pie') continue; + updateSelectedState(gd, searchTraces); - for(j = 0; j < cd.length; j++) { - pt = cd[j]; - if(pt.color === false) { - // have we seen this label and assigned a color to it in a previous trace? - if(colorMap[pt.label]) { - pt.color = colorMap[pt.label]; + clearSelectionsCache(dragOptions); + + gd.emit('plotly_deselect', null); + } else { + if(clickmode.indexOf('select') > -1) { + selectOnClick(evt, gd, dragOptions.xaxes, dragOptions.yaxes, + dragOptions.subplot, dragOptions, outlines); } - else { - colorMap[pt.label] = pt.color = pieColorWay[dfltColorCount % pieColorWay.length]; - dfltColorCount++; + + if(clickmode === 'event') { + // TODO: remove in v2 - this was probably never intended to work as it does, + // but in case anyone depends on it we don't want to break it now. + // Note that click-to-select introduced pre v2 also emitts proper + // event data when clickmode is having 'select' in its flag list. + gd.emit('plotly_selected', undefined); } } - } - } -}; -/** - * pick a default color from the main default set, augmented by - * itself lighter then darker before repeating - */ -var extendedColorWays = {}; + Fx.click(gd, evt); + }); + }; -function generateExtendedColors(colorList) { - var i; - var colorString = JSON.stringify(colorList); - var pieColors = extendedColorWays[colorString]; - if(!pieColors) { - pieColors = colorList.slice(); + dragOptions.doneFn = function() { + corners.remove(); - for(i = 0; i < colorList.length; i++) { - pieColors.push(tinycolor(colorList[i]).lighten(20).toHexString()); - } + throttle.done(throttleID).then(function() { + throttle.clear(throttleID); + dragOptions.gd.emit('plotly_selected', eventData); - for(i = 0; i < colorList.length; i++) { - pieColors.push(tinycolor(colorList[i]).darken(20).toHexString()); - } - extendedColorWays[colorString] = pieColors; - } + if(currentPolygon && dragOptions.selectionDefs) { + // save last polygons + currentPolygon.subtract = subtract; + dragOptions.selectionDefs.push(currentPolygon); - return pieColors; + // we have to keep reference to arrays container + dragOptions.mergedPolygons.length = 0; + [].push.apply(dragOptions.mergedPolygons, mergedPolygons); + } + }); + }; } -},{"../../components/color":570,"../../lib":696,"./helpers":1023,"fast-isnumeric":214,"tinycolor2":514}],1021:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function selectOnClick(evt, gd, xAxes, yAxes, subplot, dragOptions, polygonOutlines) { + var hoverData = gd._hoverdata; + var clickmode = gd._fullLayout.clickmode; + var sendEvents = clickmode.indexOf('event') > -1; + var selection = []; + var searchTraces, searchInfo, currentSelectionDef, selectionTester, traceSelection; + var thisTracesSelection, pointOrBinSelected, subtract, eventData, i; -'use strict'; + if(isHoverDataSet(hoverData)) { + coerceSelectionsCache(evt, gd, dragOptions); + searchTraces = determineSearchTraces(gd, xAxes, yAxes, subplot); + var clickedPtInfo = extractClickedPtInfo(hoverData, searchTraces); + var isBinnedTrace = clickedPtInfo.pointNumbers.length > 0; -var Lib = _dereq_('../../lib'); -var attributes = _dereq_('./attributes'); -var handleDomainDefaults = _dereq_('../../plots/domain').defaults; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } + // Note: potentially costly operation isPointOrBinSelected is + // called as late as possible through the use of an assignment + // in an if condition. + 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); + } - var coerceFont = Lib.coerceFont; - var len; + updateSelectedState(gd, searchTraces); - var vals = coerce('values'); - var hasVals = Lib.isArrayOrTypedArray(vals); - var labels = coerce('labels'); - if(Array.isArray(labels)) { - len = labels.length; - if(hasVals) len = Math.min(len, vals.length); - } - else if(hasVals) { - len = vals.length; + clearSelectionsCache(dragOptions); - coerce('label0'); - coerce('dlabel'); - } + if(sendEvents) { + gd.emit('plotly_deselect', null); + } + } else { + subtract = evt.shiftKey && + (pointOrBinSelected !== undefined ? + pointOrBinSelected : + isPointOrBinSelected(clickedPtInfo)); + currentSelectionDef = newPointSelectionDef(clickedPtInfo.pointNumber, clickedPtInfo.searchInfo, subtract); - if(!len) { - traceOut.visible = false; - return; - } - traceOut._length = len; + var allSelectionDefs = dragOptions.selectionDefs.concat([currentSelectionDef]); + selectionTester = multiTester(allSelectionDefs); - var lineWidth = coerce('marker.line.width'); - if(lineWidth) coerce('marker.line.color'); + for(i = 0; i < searchTraces.length; i++) { + traceSelection = searchTraces[i]._module.selectPoints(searchTraces[i], selectionTester); + thisTracesSelection = fillSelectionItem(traceSelection, searchTraces[i]); - coerce('marker.colors'); + if(selection.length) { + for(var j = 0; j < thisTracesSelection.length; j++) { + selection.push(thisTracesSelection[j]); + } + } + else selection = thisTracesSelection; + } - coerce('scalegroup'); - // TODO: hole needs to be coerced to the same value within a scaleegroup + eventData = {points: selection}; + updateSelectedState(gd, searchTraces, eventData); - var textData = coerce('text'); - var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); - coerce('hovertext'); + if(currentSelectionDef && dragOptions) { + dragOptions.selectionDefs.push(currentSelectionDef); + } - if(textInfo && textInfo !== 'none') { - var textPosition = coerce('textposition'), - hasBoth = Array.isArray(textPosition) || textPosition === 'auto', - hasInside = hasBoth || textPosition === 'inside', - hasOutside = hasBoth || textPosition === 'outside'; + if(polygonOutlines) drawSelection(dragOptions.mergedPolygons, polygonOutlines); - if(hasInside || hasOutside) { - var dfltFont = coerceFont(coerce, 'textfont', layout.font); - if(hasInside) { - 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(sendEvents) { + gd.emit('plotly_selected', eventData); } - if(hasOutside) coerceFont(coerce, 'outsidetextfont', dfltFont); + } + } +} + +/** + * Constructs a new point selection definition object. + */ +function newPointSelectionDef(pointNumber, searchInfo, subtract) { + return { + pointNumber: pointNumber, + searchInfo: searchInfo, + subtract: subtract + }; +} + +function isPointSelectionDef(o) { + return 'pointNumber' in o && 'searchInfo' in o; +} + +/* + * Constructs a new point number tester. + */ +function newPointNumTester(pointSelectionDef) { + return { + xmin: 0, + xmax: 0, + ymin: 0, + ymax: 0, + pts: [], + contains: function(pt, 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 + }; +} + +/** + * Wraps multiple selection testers. + * + * @param {Array} list - An array of selection testers. + * + * @return a selection tester object with a contains function + * that can be called to evaluate a point against all wrapped + * selection testers that were passed in list. + */ +function multiTester(list) { + 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 = polygon.tester(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); } } - handleDomainDefaults(traceOut, layout, coerce); + /** + * Tests if the given point is within this tester. + * + * @param {Array} pt - [0] is the x coordinate, [1] is the y coordinate of the point. + * @param {*} arg - An optional parameter to pass down to wrapped testers. + * @param {number} pointNumber - The point number of the point within the underlying data array. + * @param {number} searchInfo - An object identifying the trace the point is contained in. + * + * @return {boolean} true if point is considered to be selected, false otherwise. + */ + function contains(pt, arg, pointNumber, searchInfo) { + var contained = false; + for(var i = 0; i < testers.length; i++) { + if(testers[i].contains(pt, arg, pointNumber, searchInfo)) { + // if contained by subtract tester - exclude the point + contained = testers[i].subtract === false; + } + } - var hole = coerce('hole'); - var title = coerce('title'); - if(title) { - var titlePosition = coerce('titleposition', hole ? 'middle center' : 'top center'); - if(!hole && titlePosition === 'middle center') traceOut.titleposition = 'top center'; - coerceFont(coerce, 'titlefont', layout.font); + return contained; } - coerce('sort'); - coerce('direction'); - coerce('rotation'); - - coerce('pull'); -}; - -},{"../../lib":696,"../../plots/domain":770,"./attributes":1018}],1022:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var appendArrayMultiPointValues = _dereq_('../../components/fx/helpers').appendArrayMultiPointValues; + return { + xmin: xmin, + xmax: xmax, + ymin: ymin, + ymax: ymax, + pts: [], + contains: contains, + isRect: false, + degenerate: false + }; +} +function coerceSelectionsCache(evt, gd, dragOptions) { + var fullLayout = gd._fullLayout; + var zoomLayer = fullLayout._zoomlayer; + var plotinfo = dragOptions.plotinfo; -// Note: like other eventData routines, this creates the data for hover/unhover/click events -// but it has a different API and goes through a totally different pathway. -// So to ensure it doesn't get misused, it's not attached to the Pie module. -module.exports = function eventData(pt, trace) { - var out = { - curveNumber: trace.index, - pointNumbers: pt.pts, - data: trace._input, - fullData: trace, - label: pt.label, - color: pt.color, - value: pt.v, + var selectingOnSameSubplot = ( + fullLayout._lastSelectedSubplot && + fullLayout._lastSelectedSubplot === plotinfo.id + ); + var hasModifierKey = evt.shiftKey || evt.altKey; + if(selectingOnSameSubplot && hasModifierKey && + (plotinfo.selection && plotinfo.selection.selectionDefs) && !dragOptions.selectionDefs) { + // take over selection definitions from prev mode, if any + dragOptions.selectionDefs = plotinfo.selection.selectionDefs; + dragOptions.mergedPolygons = plotinfo.selection.mergedPolygons; + } else if(!hasModifierKey || !plotinfo.selection) { + clearSelectionsCache(dragOptions); + } - // pt.v (and pt.i below) for backward compatibility - v: pt.v - }; + // clear selection outline when selecting a different subplot + if(!selectingOnSameSubplot) { + clearSelect(zoomLayer); + fullLayout._lastSelectedSubplot = plotinfo.id; + } +} - // Only include pointNumber if it's unambiguous - if(pt.pts.length === 1) out.pointNumber = out.i = pt.pts[0]; +function clearSelectionsCache(dragOptions) { + var plotinfo = dragOptions.plotinfo; - // Add extra data arrays to the output - // notice that this is the multi-point version ('s' on the end!) - // so added data will be arrays matching the pointNumbers array. - appendArrayMultiPointValues(out, trace, pt.pts); + plotinfo.selection = {}; + plotinfo.selection.selectionDefs = dragOptions.selectionDefs = []; + plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = []; +} - return out; -}; +function determineSearchTraces(gd, xAxes, yAxes, subplot) { + var searchTraces = []; + var xAxisIds = xAxes.map(getAxId); + var yAxisIds = yAxes.map(getAxId); + var cd, trace, i; -},{"../../components/fx/helpers":609}],1023:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + for(i = 0; i < gd.calcdata.length; i++) { + cd = gd.calcdata[i]; + trace = cd[0].trace; -'use strict'; + if(trace.visible !== true || !trace._module || !trace._module.selectPoints) continue; -var Lib = _dereq_('../../lib'); + if(subplot && (trace.subplot === subplot || trace.geo === subplot)) { + searchTraces.push(createSearchInfo(trace._module, cd, xAxes[0], yAxes[0])); + } else if( + trace.type === 'splom' && + // FIXME: make sure we don't have more than single axis for splom + trace._xaxes[xAxisIds[0]] && trace._yaxes[yAxisIds[0]] + ) { + var info = createSearchInfo(trace._module, cd, xAxes[0], yAxes[0]); + info.scene = gd._fullLayout._splomScenes[trace.uid]; + searchTraces.push(info); + } else { + if(xAxisIds.indexOf(trace.xaxis) === -1) continue; + if(yAxisIds.indexOf(trace.yaxis) === -1) continue; -exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); + searchTraces.push(createSearchInfo(trace._module, cd, + getFromId(gd, trace.xaxis), getFromId(gd, trace.yaxis))); + } } - return Lib.numSeparate(vRounded, separators) + '%'; -}; -exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } - return Lib.numSeparate(vRounded, separators); -}; + return searchTraces; -exports.getFirstFilled = function getFirstFilled(array, indices) { - if(!Array.isArray(array)) return; - for(var i = 0; i < indices.length; i++) { - var v = array[indices[i]]; - if(v || v === 0) return v; + function createSearchInfo(module, calcData, xaxis, yaxis) { + return { + _module: module, + cd: calcData, + xaxis: xaxis, + yaxis: yaxis + }; } -}; - -exports.castOption = function castOption(item, indices) { - if(Array.isArray(item)) return exports.getFirstFilled(item, indices); - else if(item) return item; -}; - -},{"../../lib":696}],1024:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; +} -var Pie = {}; +function drawSelection(polygons, outlines) { + var paths = []; + var i, d; -Pie.attributes = _dereq_('./attributes'); -Pie.supplyDefaults = _dereq_('./defaults'); -Pie.supplyLayoutDefaults = _dereq_('./layout_defaults'); -Pie.layoutAttributes = _dereq_('./layout_attributes'); + for(i = 0; i < polygons.length; i++) { + var ppts = polygons[i]; + paths.push(ppts.join('L') + 'L' + ppts[0]); + } -var calcModule = _dereq_('./calc'); -Pie.calc = calcModule.calc; -Pie.crossTraceCalc = calcModule.crossTraceCalc; + d = polygons.length > 0 ? + 'M' + paths.join('M') + 'Z' : + 'M0,0Z'; + outlines.attr('d', d); +} -Pie.plot = _dereq_('./plot'); -Pie.style = _dereq_('./style'); -Pie.styleOne = _dereq_('./style_one'); +function isHoverDataSet(hoverData) { + return hoverData && + Array.isArray(hoverData) && + hoverData[0].hoverOnBox !== true; +} -Pie.moduleType = 'trace'; -Pie.name = 'pie'; -Pie.basePlotModule = _dereq_('./base_plot'); -Pie.categories = ['pie', 'showLegend']; -Pie.meta = { - -}; +function extractClickedPtInfo(hoverData, searchTraces) { + var hoverDatum = hoverData[0]; + var pointNumber = -1; + var pointNumbers = []; + var searchInfo, i; -module.exports = Pie; + for(i = 0; i < searchTraces.length; i++) { + searchInfo = searchTraces[i]; + if(hoverDatum.fullData._expandedIndex === searchInfo.cd[0].trace._expandedIndex) { -},{"./attributes":1018,"./base_plot":1019,"./calc":1020,"./defaults":1021,"./layout_attributes":1025,"./layout_defaults":1026,"./plot":1027,"./style":1028,"./style_one":1029}],1025:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // Special case for box (and violin) + if(hoverDatum.hoverOnBox === true) { + break; + } -'use strict'; + // Hint: in some traces like histogram, one graphical element + // doesn't correspond to one particular data point, but to + // bins of data points. Thus, hoverDatum can have a binNumber + // property instead of pointNumber. + if(hoverDatum.pointNumber !== undefined) { + pointNumber = hoverDatum.pointNumber; + } else if(hoverDatum.binNumber !== undefined) { + pointNumber = hoverDatum.binNumber; + pointNumbers = hoverDatum.pointNumbers; + } -module.exports = { - /** - * hiddenlabels is the pie chart analog of visible:'legendonly' - * but it can contain many labels, and can hide slices - * from several pies simultaneously - */ - hiddenlabels: { - valType: 'data_array', - editType: 'calc' - }, - piecolorway: { - valType: 'colorlist', - - editType: 'calc', - - }, - extendpiecolors: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - + break; + } } -}; - -},{}],1026:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; + return { + pointNumber: pointNumber, + pointNumbers: pointNumbers, + searchInfo: searchInfo + }; +} -var Lib = _dereq_('../../lib'); +function isPointOrBinSelected(clickedPtInfo) { + var trace = clickedPtInfo.searchInfo.cd[0].trace; + var ptNum = clickedPtInfo.pointNumber; + var ptNums = clickedPtInfo.pointNumbers; + var ptNumsSet = ptNums.length > 0; -var layoutAttributes = _dereq_('./layout_attributes'); + // When pointsNumbers is set (e.g. histogram's binning), + // it is assumed that when the first point of + // a bin is selected, all others are as well + var ptNumToTest = ptNumsSet ? ptNums[0] : ptNum; -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); - } - coerce('hiddenlabels'); - coerce('piecolorway', layoutOut.colorway); - coerce('extendpiecolors'); -}; + // TODO potential performance improvement + // Primarily we need this function to determine if a click adds + // or subtracts from a selection. + // In cases `trace.selectedpoints` is a huge array, indexOf + // might be slow. One remedy would be to introduce a hash somewhere. + return trace.selectedpoints ? trace.selectedpoints.indexOf(ptNumToTest) > -1 : false; +} -},{"../../lib":696,"./layout_attributes":1025}],1027:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function isOnlyThisBinSelected(searchTraces, clickedPtInfo) { + var tracesWithSelectedPts = []; + var searchInfo, trace, isSameTrace, i; -'use strict'; + 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); + } + } -var d3 = _dereq_('d3'); + 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; + } + } + } -var Fx = _dereq_('../../components/fx'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var Lib = _dereq_('../../lib'); -var svgTextUtils = _dereq_('../../lib/svg_text_utils'); + return false; +} -var helpers = _dereq_('./helpers'); -var eventData = _dereq_('./event_data'); +function isOnlyOnePointSelected(searchTraces) { + var len = 0; + var searchInfo, trace, i; -module.exports = function plot(gd, cdpie) { - var fullLayout = gd._fullLayout; + 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; - prerenderTitles(cdpie, gd); - scalePies(cdpie, fullLayout._size); + len += trace.selectedpoints.length; + if(len > 1) return false; + } + } - var pieGroups = Lib.makeTraceGroups(fullLayout._pielayer, cdpie, 'trace').each(function(cd) { - var pieGroup = d3.select(this); - var cd0 = cd[0]; - var trace = cd0.trace; + return len === 1; +} - setCoords(cd); +function updateSelectedState(gd, searchTraces, eventData) { + var i, searchInfo, cd, trace; - // TODO: miter might look better but can sometimes cause problems - // maybe miter with a small-ish stroke-miterlimit? - pieGroup.attr('stroke-linejoin', 'round'); + // before anything else, update preGUI if necessary + for(i = 0; i < searchTraces.length; i++) { + var fullInputTrace = searchTraces[i].cd[0].trace._fullInput; + var tracePreGUI = gd._fullLayout._tracePreGUI[fullInputTrace.uid]; + if(tracePreGUI.selectedpoints === undefined) { + tracePreGUI.selectedpoints = fullInputTrace._input.selectedpoints || null; + } + } - pieGroup.each(function() { - var slices = d3.select(this).selectAll('g.slice').data(cd); + if(eventData) { + var pts = eventData.points || []; - slices.enter().append('g') - .classed('slice', true); - slices.exit().remove(); + 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 = []; + } - var quadrants = [ - [[], []], // y<0: x<0, x>=0 - [[], []] // y>=0: x<0, x>=0 - ]; - var hasOutsideText = false; + for(i = 0; i < pts.length; i++) { + var pt = pts[i]; + var data = pt.data; + var fullData = pt.fullData; - slices.each(function(pt) { - if(pt.hidden) { - d3.select(this).selectAll('path,g').remove(); - return; + if(pt.pointIndices) { + [].push.apply(data.selectedpoints, pt.pointIndices); + if(trace._fullInput !== trace) { + [].push.apply(fullData.selectedpoints, pt.pointIndices); } + } else { + data.selectedpoints.push(pt.pointIndex); + if(trace._fullInput !== trace) { + fullData.selectedpoints.push(pt.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; + } + } + } - // to have consistent event data compared to other traces - pt.pointNumber = pt.i; - pt.curveNumber = trace.index; - - quadrants[pt.pxmid[1] < 0 ? 0 : 1][pt.pxmid[0] < 0 ? 0 : 1].push(pt); - - var cx = cd0.cx; - var cy = cd0.cy; - var sliceTop = d3.select(this); - var slicePath = sliceTop.selectAll('path.surface').data([pt]); - - // hover state vars - // have we drawn a hover label, so it should be cleared later - var hasHoverLabel = false; - // have we emitted a hover event, so later an unhover event should be emitted - // note that click events do not depend on this - you can still get them - // with hovermode: false or if you were earlier dragging, then clicked - // in the same slice that you moused up in - var hasHoverEvent = false; + var hasRegl = false; - function handleMouseOver() { - // in case fullLayout or fullData has changed without a replot - var fullLayout2 = gd._fullLayout; - var trace2 = gd._fullData[trace.index]; + for(i = 0; i < searchTraces.length; i++) { + searchInfo = searchTraces[i]; + cd = searchInfo.cd; + trace = cd[0].trace; - if(gd._dragging || fullLayout2.hovermode === false) return; + if(Registry.traceIs(trace, 'regl')) { + hasRegl = true; + } - var hoverinfo = trace2.hoverinfo; - if(Array.isArray(hoverinfo)) { - // super hacky: we need to pull out the *first* hoverinfo from - // pt.pts, then put it back into an array in a dummy trace - // and call castHoverinfo on that. - // TODO: do we want to have Fx.castHoverinfo somehow handle this? - // it already takes an array for index, for 2D, so this seems tricky. - hoverinfo = Fx.castHoverinfo({ - hoverinfo: [helpers.castOption(hoverinfo, pt.pts)], - _module: trace._module - }, fullLayout2, 0); - } + var _module = searchInfo._module; + var fn = _module.styleOnSelect || _module.style; + if(fn) fn(gd, cd); + } - if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; + if(hasRegl) { + clearGlCanvases(gd); + redrawReglTraces(gd); + } +} - // in case we dragged over the pie from another subplot, - // or if hover is turned off - if(hoverinfo !== 'none' && hoverinfo !== 'skip' && hoverinfo) { - var rInscribed = getInscribedRadiusFraction(pt, cd0); - var hoverCenterX = cx + pt.pxmid[0] * (1 - rInscribed); - var hoverCenterY = cy + pt.pxmid[1] * (1 - rInscribed); - var separators = fullLayout.separators; - var thisText = []; +function mergePolygons(list, poly, subtract) { + var res; - if(hoverinfo.indexOf('label') !== -1) thisText.push(pt.label); - if(hoverinfo.indexOf('text') !== -1) { - var texti = helpers.castOption(trace2.hovertext || trace2.text, pt.pts); - if(texti) thisText.push(texti); - } - if(hoverinfo.indexOf('value') !== -1) thisText.push(helpers.formatPieValue(pt.v, separators)); - if(hoverinfo.indexOf('percent') !== -1) thisText.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators)); + if(subtract) { + res = polybool.difference({ + regions: list, + inverted: false + }, { + regions: [poly], + inverted: false + }); - var hoverLabel = trace.hoverlabel; - var hoverFont = hoverLabel.font; + return res.regions; + } - Fx.loneHover({ - x0: hoverCenterX - rInscribed * cd0.r, - x1: hoverCenterX + rInscribed * cd0.r, - y: hoverCenterY, - text: thisText.join('
'), - name: hoverinfo.indexOf('name') !== -1 ? trace2.name : undefined, - idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', - color: helpers.castOption(hoverLabel.bgcolor, pt.pts) || pt.color, - borderColor: helpers.castOption(hoverLabel.bordercolor, pt.pts), - fontFamily: helpers.castOption(hoverFont.family, pt.pts), - fontSize: helpers.castOption(hoverFont.size, pt.pts), - fontColor: helpers.castOption(hoverFont.color, pt.pts) - }, { - container: fullLayout2._hoverlayer.node(), - outerContainer: fullLayout2._paper.node(), - gd: gd - }); + res = polybool.union({ + regions: list, + inverted: false + }, { + regions: [poly], + inverted: false + }); - hasHoverLabel = true; - } + return res.regions; +} - gd.emit('plotly_hover', { - points: [eventData(pt, trace2)], - event: d3.event - }); - hasHoverEvent = true; - } +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var cd = searchInfo.cd; + var trace = searchInfo.cd[0].trace; - function handleMouseOut(evt) { - var fullLayout2 = gd._fullLayout; - var trace2 = gd._fullData[trace.index]; + for(var i = 0; i < selection.length; i++) { + selection[i] = makeEventData(selection[i], trace, cd); + } + } - if(hasHoverEvent) { - evt.originalEvent = d3.event; - gd.emit('plotly_unhover', { - points: [eventData(pt, trace2)], - event: d3.event - }); - hasHoverEvent = false; - } + return selection; +} - if(hasHoverLabel) { - Fx.loneUnhover(fullLayout2._hoverlayer.node()); - hasHoverLabel = false; - } - } +function clearSelect(zoomlayer) { + // until we get around to persistent selections, remove the outline + // here. The selection itself will be removed when the plot redraws + // at the end. + zoomlayer.selectAll('.select-outline').remove(); +} - function handleClick() { - // TODO: this does not support right-click. If we want to support it, we - // would likely need to change pie to use dragElement instead of straight - // mapbox event binding. Or perhaps better, make a simple wrapper with the - // right mousedown, mousemove, and mouseup handlers just for a left/right click - // mapbox would use this too. - var fullLayout2 = gd._fullLayout; - var trace2 = gd._fullData[trace.index]; +module.exports = { + prepSelect: prepSelect, + clearSelect: clearSelect, + selectOnClick: selectOnClick +}; - if(gd._dragging || fullLayout2.hovermode === false) return; +},{"../../components/color":43,"../../components/fx":82,"../../components/fx/helpers":78,"../../lib/clear_gl_canvases":148,"../../lib/polygon":171,"../../lib/throttle":181,"../../plot_api/subroutines":194,"../../registry":243,"./axis_ids":206,"./constants":209,"polybooljs":17}],222:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - gd._hoverdata = [eventData(pt, trace2)]; - Fx.click(gd, d3.event); - } - slicePath.enter().append('path') - .classed('surface', true) - .style({'pointer-events': 'all'}); +'use strict'; - sliceTop.select('path.textline').remove(); +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); - sliceTop - .on('mouseover', handleMouseOver) - .on('mouseout', handleMouseOut) - .on('click', handleClick); +var Lib = _dereq_('../../lib'); +var cleanNumber = Lib.cleanNumber; +var ms2DateTime = Lib.ms2DateTime; +var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; - if(trace.pull) { - var pull = +helpers.castOption(trace.pull, pt.pts) || 0; - if(pull > 0) { - cx += pull * pt.pxmid[0]; - cy += pull * pt.pxmid[1]; - } - } +var numConstants = _dereq_('../../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; +var LOG_CLIP = numConstants.LOG_CLIP; - pt.cxFinal = cx; - pt.cyFinal = cy; +var constants = _dereq_('./constants'); +var axisIds = _dereq_('./axis_ids'); - function arc(start, finish, cw, scale) { - return 'a' + (scale * cd0.r) + ',' + (scale * cd0.r) + ' 0 ' + - pt.largeArc + (cw ? ' 1 ' : ' 0 ') + - (scale * (finish[0] - start[0])) + ',' + (scale * (finish[1] - start[1])); - } +function fromLog(v) { + return Math.pow(10, v); +} - var hole = trace.hole; - if(pt.v === cd0.vTotal) { // 100% fails bcs arc start and end are identical - var outerCircle = 'M' + (cx + pt.px0[0]) + ',' + (cy + pt.px0[1]) + - arc(pt.px0, pt.pxmid, true, 1) + - arc(pt.pxmid, pt.px0, true, 1) + 'Z'; - if(hole) { - slicePath.attr('d', - 'M' + (cx + hole * pt.px0[0]) + ',' + (cy + hole * pt.px0[1]) + - arc(pt.px0, pt.pxmid, false, hole) + - arc(pt.pxmid, pt.px0, false, hole) + - 'Z' + outerCircle); - } - else slicePath.attr('d', outerCircle); - } else { +function isValidCategory(v) { + return v !== null && v !== undefined; +} - var outerArc = arc(pt.px0, pt.px1, true, 1); +/** + * Define the conversion functions for an axis data is used in 5 ways: + * + * d: data, in whatever form it's provided + * c: calcdata: turned into numbers, but not linearized + * l: linearized - same as c except for log axes (and other nonlinear + * mappings later?) this is used when we need to know if it's + * *possible* to show some data on this axis, without caring about + * the current range + * p: pixel value - mapped to the screen with current size and zoom + * r: ranges, tick0, and annotation positions match one of the above + * but are handled differently for different types: + * - linear and date: data format (d) + * - category: calcdata format (c), and will stay that way because + * the data format has no continuous mapping + * - log: linearized (l) format + * TODO: in v2.0 we plan to change it to data format. At that point + * shapes will work the same way as ranges, tick0, and annotations + * so they can use this conversion too. + * + * Creates/updates these conversion functions, and a few more utilities + * like cleanRange, and makeCalcdata + * + * also clears the autotick constraints ._minDtick, ._forceTick0 + */ +module.exports = function setConvert(ax, fullLayout) { + fullLayout = fullLayout || {}; - if(hole) { - var rim = 1 - hole; - slicePath.attr('d', - 'M' + (cx + hole * pt.px1[0]) + ',' + (cy + hole * pt.px1[1]) + - arc(pt.px1, pt.px0, false, hole) + - 'l' + (rim * pt.px0[0]) + ',' + (rim * pt.px0[1]) + - outerArc + - 'Z'); - } else { - slicePath.attr('d', - 'M' + cx + ',' + cy + - 'l' + pt.px0[0] + ',' + pt.px0[1] + - outerArc + - 'Z'); - } - } + var axLetter = (ax._id || 'x').charAt(0); - // add text - var textPosition = helpers.castOption(trace.textposition, pt.pts); - var sliceTextGroup = sliceTop.selectAll('g.slicetext') - .data(pt.text && (textPosition !== 'none') ? [0] : []); + function toLog(v, clip) { + if(v > 0) return Math.log(v) / Math.LN10; - sliceTextGroup.enter().append('g') - .classed('slicetext', true); - sliceTextGroup.exit().remove(); + else if(v <= 0 && clip && ax.range && ax.range.length === 2) { + // clip NaN (ie past negative infinity) to LOG_CLIP axis + // length past the negative edge + var r0 = ax.range[0]; + var r1 = ax.range[1]; + return 0.5 * (r0 + r1 - 2 * LOG_CLIP * Math.abs(r0 - r1)); + } - sliceTextGroup.each(function() { - var sliceText = Lib.ensureSingle(d3.select(this), 'text', '', function(s) { - // prohibit tex interpretation until we can handle - // tex and regular text together - s.attr('data-notex', 1); - }); + else return BADNUM; + } - sliceText.text(pt.text) - .attr({ - 'class': 'slicetext', - transform: '', - 'text-anchor': 'middle' - }) - .call(Drawing.font, textPosition === 'outside' ? - determineOutsideTextFont(trace, pt, gd._fullLayout.font) : - determineInsideTextFont(trace, pt, gd._fullLayout.font)) - .call(svgTextUtils.convertToTspans, gd); + /* + * wrapped dateTime2ms that: + * - accepts ms numbers for backward compatibility + * - inserts a dummy arg so calendar is the 3rd arg (see notes below). + * - defaults to ax.calendar + */ + function dt2ms(v, _, calendar) { + // NOTE: Changed this behavior: previously we took any numeric value + // to be a ms, even if it was a string that could be a bare year. + // Now we convert it as a date if at all possible, and only try + // as (local) ms if that fails. + var ms = dateTime2ms(v, calendar || ax.calendar); + if(ms === BADNUM) { + if(isNumeric(v)) { + v = +v; + // keep track of tenths of ms, that `new Date` will drop + // same logic as in Lib.ms2DateTime + var msecTenths = Math.floor(Lib.mod(v + 0.05, 1) * 10); + var msRounded = Math.round(v - msecTenths / 10); + ms = dateTime2ms(new Date(msRounded)) + msecTenths / 10; + } + else return BADNUM; + } + return ms; + } - // position the text relative to the slice - var textBB = Drawing.bBox(sliceText.node()); - var transform; + // wrapped ms2DateTime to insert default ax.calendar + function ms2dt(v, r, calendar) { + return ms2DateTime(v, r, calendar || ax.calendar); + } - if(textPosition === 'outside') { - transform = transformOutsideText(textBB, pt); - } else { - transform = transformInsideText(textBB, pt, cd0); - if(textPosition === 'auto' && transform.scale < 1) { - sliceText.call(Drawing.font, trace.outsidetextfont); - if(trace.outsidetextfont.family !== trace.insidetextfont.family || - trace.outsidetextfont.size !== trace.insidetextfont.size) { - textBB = Drawing.bBox(sliceText.node()); - } - transform = transformOutsideText(textBB, pt); - } - } + function getCategoryName(v) { + return ax._categories[Math.round(v)]; + } - var translateX = cx + pt.pxmid[0] * transform.rCenter + (transform.x || 0); - var translateY = cy + pt.pxmid[1] * transform.rCenter + (transform.y || 0); + /* + * setCategoryIndex: return the index of category v, + * inserting it in the list if it's not already there + * + * this will enter the categories in the order it + * encounters them, ie all the categories from the + * first data set, then all the ones from the second + * that aren't in the first etc. + * + * it is assumed that this function is being invoked in the + * already sorted category order; otherwise there would be + * a disconnect between the array and the index returned + */ + function setCategoryIndex(v) { + if(isValidCategory(v)) { + if(ax._categoriesMap === undefined) { + ax._categoriesMap = {}; + } - // save some stuff to use later ensure no labels overlap - if(transform.outside) { - pt.yLabelMin = translateY - textBB.height / 2; - pt.yLabelMid = translateY; - pt.yLabelMax = translateY + textBB.height / 2; - pt.labelExtraX = 0; - pt.labelExtraY = 0; - hasOutsideText = true; - } + if(ax._categoriesMap[v] !== undefined) { + return ax._categoriesMap[v]; + } else { + ax._categories.push(v); - sliceText.attr('transform', - 'translate(' + translateX + ',' + translateY + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - (transform.rotate ? ('rotate(' + transform.rotate + ')') : '') + - 'translate(' + - (-(textBB.left + textBB.right) / 2) + ',' + - (-(textBB.top + textBB.bottom) / 2) + - ')'); - }); - }); + var curLength = ax._categories.length - 1; + ax._categoriesMap[v] = curLength; - // add the title - var titleTextGroup = d3.select(this).selectAll('g.titletext') - .data(trace.title ? [0] : []); + return curLength; + } + } + return BADNUM; + } - titleTextGroup.enter().append('g') - .classed('titletext', true); - titleTextGroup.exit().remove(); + function setMultiCategoryIndex(arrayIn, len) { + var arrayOut = new Array(len); - titleTextGroup.each(function() { - var titleText = Lib.ensureSingle(d3.select(this), 'text', '', function(s) { - // prohibit tex interpretation as above - s.attr('data-notex', 1); - }); + for(var i = 0; i < len; i++) { + var v0 = (arrayIn[0] || [])[i]; + var v1 = (arrayIn[1] || [])[i]; + arrayOut[i] = getCategoryIndex([v0, v1]); + } - titleText.text(trace.title) - .attr({ - 'class': 'titletext', - transform: '', - 'text-anchor': 'middle', - }) - .call(Drawing.font, trace.titlefont) - .call(svgTextUtils.convertToTspans, gd); + return arrayOut; + } - var transform; + function getCategoryIndex(v) { + if(ax._categoriesMap) { + return ax._categoriesMap[v]; + } + } - if(trace.titleposition === 'middle center') { - transform = positionTitleInside(cd0); - } else { - transform = positionTitleOutside(cd0, fullLayout._size); - } + function getCategoryPosition(v) { + // d2l/d2c variant that that won't add categories but will also + // allow numbers to be mapped to the linearized axis positions + var index = getCategoryIndex(v); + if(index !== undefined) return index; + if(isNumeric(v)) return +v; + } - titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); - }); + function l2p(v) { + if(!isNumeric(v)) return BADNUM; - // now make sure no labels overlap (at least within one pie) - if(hasOutsideText) scootLabels(quadrants, trace); - slices.each(function(pt) { - if(pt.labelExtraX || pt.labelExtraY) { - // first move the text to its new location - var sliceTop = d3.select(this); - var sliceText = sliceTop.select('g.slicetext text'); + // include 2 fractional digits on pixel, for PDF zooming etc + return d3.round(ax._b + ax._m * v, 2); + } - sliceText.attr('transform', 'translate(' + pt.labelExtraX + ',' + pt.labelExtraY + ')' + - sliceText.attr('transform')); + function p2l(px) { return (px - ax._b) / ax._m; } - // then add a line to the new location - var lineStartX = pt.cxFinal + pt.pxmid[0]; - var lineStartY = pt.cyFinal + pt.pxmid[1]; - var textLinePath = 'M' + lineStartX + ',' + lineStartY; - var finalX = (pt.yLabelMax - pt.yLabelMin) * (pt.pxmid[0] < 0 ? -1 : 1) / 4; + // conversions among c/l/p are fairly simple - do them together for all axis types + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; - if(pt.labelExtraX) { - var yFromX = pt.labelExtraX * pt.pxmid[1] / pt.pxmid[0]; - var yNet = pt.yLabelMid + pt.labelExtraY - (pt.cyFinal + pt.pxmid[1]); + ax.l2p = l2p; + ax.p2l = p2l; - if(Math.abs(yFromX) > Math.abs(yNet)) { - textLinePath += - 'l' + (yNet * pt.pxmid[0] / pt.pxmid[1]) + ',' + yNet + - 'H' + (lineStartX + pt.labelExtraX + finalX); - } else { - textLinePath += 'l' + pt.labelExtraX + ',' + yFromX + - 'v' + (yNet - yFromX) + - 'h' + finalX; - } - } else { - textLinePath += - 'V' + (pt.yLabelMid + pt.labelExtraY) + - 'h' + finalX; - } + 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; - sliceTop.append('path') - .classed('textline', true) - .call(Color.stroke, trace.outsidetextfont.color) - .attr({ - 'stroke-width': Math.min(2, trace.outsidetextfont.size / 8), - d: textLinePath, - fill: 'none' - }); - } - }); - }); - }); + /* + * now type-specific conversions for **ALL** other combinations + * they're all written out, instead of being combinations of each other, for + * both clarity and speed. + */ + if(['linear', '-'].indexOf(ax.type) !== -1) { + // all are data vals, but d and r need cleaning + ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - // This is for a bug in Chrome (as of 2015-07-22, and does not affect FF) - // if insidetextfont and outsidetextfont are different sizes, sometimes the size - // of an "em" gets taken from the wrong element at first so lines are - // spaced wrong. You just have to tell it to try again later and it gets fixed. - // I have no idea why we haven't seen this in other contexts. Also, sometimes - // it gets the initial draw correct but on redraw it gets confused. - setTimeout(function() { - pieGroups.selectAll('tspan').each(function() { - var s = d3.select(this); - if(s.attr('dy')) s.attr('dy', s.attr('dy')); - }); - }, 0); -}; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; + ax.p2d = ax.p2r = p2l; -function determineOutsideTextFont(trace, pt, layoutFont) { - var color = helpers.castOption(trace.outsidetextfont.color, pt.pts) || - helpers.castOption(trace.textfont.color, pt.pts) || - layoutFont.color; + ax.cleanPos = ensureNumber; + } + else if(ax.type === 'log') { + // d and c are data vals, r and l are logged (but d and r need cleaning) + ax.d2r = ax.d2l = function(v, clip) { return toLog(cleanNumber(v), clip); }; + ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; - var family = helpers.castOption(trace.outsidetextfont.family, pt.pts) || - helpers.castOption(trace.textfont.family, pt.pts) || - layoutFont.family; + ax.d2c = ax.r2l = cleanNumber; + ax.c2d = ax.l2r = ensureNumber; - var size = helpers.castOption(trace.outsidetextfont.size, pt.pts) || - helpers.castOption(trace.textfont.size, pt.pts) || - layoutFont.size; + ax.c2r = toLog; + ax.l2d = fromLog; - return { - color: color, - family: family, - size: size - }; -} + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; + ax.p2d = function(px) { return fromLog(p2l(px)); }; -function determineInsideTextFont(trace, pt, layoutFont) { - var customColor = helpers.castOption(trace.insidetextfont.color, pt.pts); - if(!customColor && trace._input.textfont) { + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; + ax.p2r = p2l; - // Why not simply using trace.textfont? Because if not set, it - // defaults to layout.font which has a default color. But if - // textfont.color and insidetextfont.color don't supply a value, - // a contrasting color shall be used. - customColor = helpers.castOption(trace._input.textfont.color, pt.pts); + ax.cleanPos = ensureNumber; } + else if(ax.type === 'date') { + // r and d are date strings, l and c are ms - var family = helpers.castOption(trace.insidetextfont.family, pt.pts) || - helpers.castOption(trace.textfont.family, pt.pts) || - layoutFont.family; - - var size = helpers.castOption(trace.insidetextfont.size, pt.pts) || - helpers.castOption(trace.textfont.size, pt.pts) || - layoutFont.size; + /* + * Any of these functions with r and d on either side, calendar is the + * **3rd** argument. log has reserved the second argument. + * + * Unless you need the special behavior of the second arg (ms2DateTime + * uses this to limit precision, toLog uses true to clip negatives + * to offscreen low rather than undefined), it's safe to pass 0. + */ + ax.d2r = ax.r2d = Lib.identity; - return { - color: customColor || Color.contrast(pt.color), - family: family, - size: size - }; -} + ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; -function prerenderTitles(cdpie, gd) { - var cd0, trace; - // Determine the width and height of the title for each pie. - for(var i = 0; i < cdpie.length; i++) { - cd0 = cdpie[i][0]; - trace = cd0.trace; + 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); }; - if(trace.title) { - var dummyTitle = Drawing.tester.append('text') - .attr('data-notex', 1) - .text(trace.title) - .call(Drawing.font, trace.titlefont) - .call(svgTextUtils.convertToTspans, gd); - var bBox = Drawing.bBox(dummyTitle.node(), true); - cd0.titleBox = { - width: bBox.width, - height: bBox.height, - }; - dummyTitle.remove(); - } + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } -} - -function transformInsideText(textBB, pt, cd0) { - var textDiameter = Math.sqrt(textBB.width * textBB.width + textBB.height * textBB.height); - var textAspect = textBB.width / textBB.height; - var halfAngle = Math.PI * Math.min(pt.v / cd0.vTotal, 0.5); - var ring = 1 - cd0.trace.hole; - var rInscribed = getInscribedRadiusFraction(pt, cd0), + else if(ax.type === 'category') { + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - // max size text can be inserted inside without rotating it - // this inscribes the text rectangle in a circle, which is then inscribed - // in the slice, so it will be an underestimate, which some day we may want - // to improve so this case can get more use - transform = { - scale: rInscribed * cd0.r * 2 / textDiameter, - - // and the center position and rotation in this case - rCenter: 1 - rInscribed, - rotate: 0 + ax.d2c = ax.d2l = setCategoryIndex; + ax.r2d = ax.c2d = ax.l2d = getCategoryName; + + ax.d2r = ax.d2l_noadd = getCategoryPosition; + + ax.r2c = function(v) { + var index = getCategoryPosition(v); + return index !== undefined ? index : ax.fraction2r(0.5); }; - if(transform.scale >= 1) return transform; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryPosition; - // max size if text is rotated radially - var Qr = textAspect + 1 / (2 * Math.tan(halfAngle)); - var maxHalfHeightRotRadial = cd0.r * Math.min( - 1 / (Math.sqrt(Qr * Qr + 0.5) + Qr), - ring / (Math.sqrt(textAspect * textAspect + ring / 2) + textAspect) - ); - var radialTransform = { - scale: maxHalfHeightRotRadial * 2 / textBB.height, - rCenter: Math.cos(maxHalfHeightRotRadial / cd0.r) - - maxHalfHeightRotRadial * textAspect / cd0.r, - rotate: (180 / Math.PI * pt.midangle + 720) % 180 - 90 - }; + 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; - // max size if text is rotated tangentially - var aspectInv = 1 / textAspect; - var Qt = aspectInv + 1 / (2 * Math.tan(halfAngle)); - var maxHalfWidthTangential = cd0.r * Math.min( - 1 / (Math.sqrt(Qt * Qt + 0.5) + Qt), - ring / (Math.sqrt(aspectInv * aspectInv + ring / 2) + aspectInv) - ); - var tangentialTransform = { - scale: maxHalfWidthTangential * 2 / textBB.width, - rCenter: Math.cos(maxHalfWidthTangential / cd0.r) - - maxHalfWidthTangential / textAspect / cd0.r, - rotate: (180 / Math.PI * pt.midangle + 810) % 180 - 90 - }; - // if we need a rotated transform, pick the biggest one - // even if both are bigger than 1 - var rotatedTransform = tangentialTransform.scale > radialTransform.scale ? - tangentialTransform : radialTransform; + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; + } + else if(ax.type === 'multicategory') { + // N.B. multicategory axes don't define d2c and d2l, + // as 'data-to-calcdata' conversion needs to take into + // account all data array items as in ax.makeCalcdata. - if(transform.scale < 1 && rotatedTransform.scale > transform.scale) return rotatedTransform; - return transform; -} + ax.r2d = ax.c2d = ax.l2d = getCategoryName; + ax.d2r = ax.d2l_noadd = getCategoryPosition; -function getInscribedRadiusFraction(pt, cd0) { - if(pt.v === cd0.vTotal && !cd0.trace.hole) return 1;// special case of 100% with no hole + ax.r2c = function(v) { + var index = getCategoryPosition(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - var halfAngle = Math.PI * Math.min(pt.v / cd0.vTotal, 0.5); - return Math.min(1 / (1 + 1 / Math.sin(halfAngle)), (1 - cd0.trace.hole) / 2); -} + ax.r2c_just_indices = getCategoryIndex; -function transformOutsideText(textBB, pt) { - var x = pt.pxmid[0]; - var y = pt.pxmid[1]; - var dx = textBB.width / 2; - var dy = textBB.height / 2; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryPosition; - if(x < 0) dx *= -1; - if(y < 0) dy *= -1; + 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; - return { - scale: 1, - rCenter: 1, - rotate: 0, - x: dx + Math.abs(dy) * (dx > 0 ? 1 : -1) / 2, - y: dy / (1 + x * x / (y * y)), - outside: true - }; -} + ax.cleanPos = function(v) { + if(Array.isArray(v) || (typeof v === 'string' && v !== '')) return v; + return ensureNumber(v); + }; -function positionTitleInside(cd0) { - var textDiameter = - Math.sqrt(cd0.titleBox.width * cd0.titleBox.width + cd0.titleBox.height * cd0.titleBox.height); - return { - x: cd0.cx, - y: cd0.cy, - scale: cd0.trace.hole * cd0.r * 2 / textDiameter, - tx: 0, - ty: - cd0.titleBox.height / 2 + cd0.trace.titlefont.size - }; -} + ax.setupMultiCategory = function(fullData) { + var traceIndices = ax._traceIndices; + var i, j; + + // [ [cnt, {$cat: index}], for 1,2 ] + var seen = ax._multicatSeen = [[0, {}], [0, {}]]; + // [ [arrayIn[0][i], arrayIn[1][i]], for i .. N ] + var list = ax._multicatList = []; + + 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 v0 = arrayIn[0][j]; + var v1 = arrayIn[1][j]; -function positionTitleOutside(cd0, plotSize) { - var scaleX = 1, scaleY = 1, maxWidth, maxPull; - var trace = cd0.trace; - // position of the baseline point of the text box in the plot, before scaling. - // we anchored the text in the middle, so the baseline is on the bottom middle - // of the first line of text. - var topMiddle = { - x: cd0.cx, - y: cd0.cy - }; - // relative translation of the text box after scaling - var translate = { - tx: 0, - ty: 0 - }; + if(isValidCategory(v0) && isValidCategory(v1)) { + list.push([v0, v1]); - // we reason below as if the baseline is the top middle point of the text box. - // so we must add the font size to approximate the y-coord. of the top. - // note that this correction must happen after scaling. - translate.ty += trace.titlefont.size; - maxPull = getMaxPull(trace); + if(!(v0 in seen[0][1])) { + seen[0][1][v0] = seen[0][0]++; + } + if(!(v1 in seen[1][1])) { + seen[1][1][v1] = seen[1][0]++; + } + } + } + } + } + } - if(trace.titleposition.indexOf('top') !== -1) { - topMiddle.y -= (1 + maxPull) * cd0.r; - translate.ty -= cd0.titleBox.height; - } - else if(trace.titleposition.indexOf('bottom') !== -1) { - topMiddle.y += (1 + maxPull) * cd0.r; - } + list.sort(function(a, b) { + var ind0 = seen[0][1]; + var d = ind0[a[0]] - ind0[b[0]]; + if(d) return d; - if(trace.titleposition.indexOf('left') !== -1) { - // we start the text at the left edge of the pie - maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]) / 2 + cd0.r; - topMiddle.x -= (1 + maxPull) * cd0.r; - translate.tx += cd0.titleBox.width / 2; - } else if(trace.titleposition.indexOf('center') !== -1) { - maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]); - } else if(trace.titleposition.indexOf('right') !== -1) { - maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]) / 2 + cd0.r; - topMiddle.x += (1 + maxPull) * cd0.r; - translate.tx -= cd0.titleBox.width / 2; + var ind1 = seen[1][1]; + return ind1[a[1]] - ind1[b[1]]; + }); + + for(i = 0; i < list.length; i++) { + setCategoryIndex(list[i]); + } + }; } - scaleX = maxWidth / cd0.titleBox.width; - scaleY = getTitleSpace(cd0, plotSize) / cd0.titleBox.height; - return { - x: topMiddle.x, - y: topMiddle.y, - scale: Math.min(scaleX, scaleY), - tx: translate.tx, - ty: translate.ty + + // find the range value at the specified (linear) fraction of the axis + 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)); }; -} -function getTitleSpace(cd0, plotSize) { - var trace = cd0.trace; - var pieBoxHeight = plotSize.h * (trace.domain.y[1] - trace.domain.y[0]); - // use at most half of the plot for the title - return Math.min(cd0.titleBox.height, pieBoxHeight / 2); -} + // find the fraction of the range at the specified range value + 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); + }; -function getMaxPull(trace) { - var maxPull = trace.pull, j; - if(Array.isArray(maxPull)) { - maxPull = 0; - for(j = 0; j < trace.pull.length; j++) { - if(trace.pull[j] > maxPull) maxPull = trace.pull[j]; - } - } - return maxPull; -} + /* + * cleanRange: make sure range is a couplet of valid & distinct values + * keep numbers away from the limits of floating point numbers, + * and dates away from the ends of our date system (+/- 9999 years) + * + * optional param rangeAttr: operate on a different attribute, like + * ax._r, rather than ax.range + */ + ax.cleanRange = function(rangeAttr, opts) { + if(!opts) opts = {}; + if(!rangeAttr) rangeAttr = 'range'; -function scootLabels(quadrants, trace) { - var xHalf, yHalf, equatorFirst, farthestX, farthestY, - xDiffSign, yDiffSign, thisQuad, oppositeQuad, - wholeSide, i, thisQuadOutside, firstOppositeOutsidePt; + var range = Lib.nestedProperty(ax, rangeAttr).get(); + var i, dflt; - function topFirst(a, b) { return a.pxmid[1] - b.pxmid[1]; } - function bottomFirst(a, b) { return b.pxmid[1] - a.pxmid[1]; } + if(ax.type === 'date') dflt = Lib.dfltRange(ax.calendar); + else if(axLetter === 'y') dflt = constants.DFLTRANGEY; + else dflt = opts.dfltRange || constants.DFLTRANGEX; - function scootOneLabel(thisPt, prevPt) { - if(!prevPt) prevPt = {}; + // make sure we don't later mutate the defaults + dflt = dflt.slice(); - var prevOuterY = prevPt.labelExtraY + (yHalf ? prevPt.yLabelMax : prevPt.yLabelMin); - var thisInnerY = yHalf ? thisPt.yLabelMin : thisPt.yLabelMax; - var thisOuterY = yHalf ? thisPt.yLabelMax : thisPt.yLabelMin; - var thisSliceOuterY = thisPt.cyFinal + farthestY(thisPt.px0[1], thisPt.px1[1]); - var newExtraY = prevOuterY - thisInnerY; + if(!range || range.length !== 2) { + Lib.nestedProperty(ax, rangeAttr).set(dflt); + return; + } - var xBuffer, i, otherPt, otherOuterY, otherOuterX, newExtraX; + if(ax.type === 'date') { + // check if milliseconds or js date objects are provided for range + // and convert to date strings + range[0] = Lib.cleanDate(range[0], BADNUM, ax.calendar); + range[1] = Lib.cleanDate(range[1], BADNUM, ax.calendar); + } - // make sure this label doesn't overlap other labels - // this *only* has us move these labels vertically - if(newExtraY * yDiffSign > 0) thisPt.labelExtraY = newExtraY; + for(i = 0; i < 2; i++) { + if(ax.type === 'date') { + if(!Lib.isDateTime(range[i], ax.calendar)) { + ax[rangeAttr] = dflt; + break; + } - // make sure this label doesn't overlap any slices - if(!Array.isArray(trace.pull)) return; // this can only happen with array pulls + if(ax.r2l(range[0]) === ax.r2l(range[1])) { + // split by +/- 1 second + var linCenter = Lib.constrain(ax.r2l(range[0]), + Lib.MIN_MS + 1000, Lib.MAX_MS - 1000); + range[0] = ax.l2r(linCenter - 1000); + range[1] = ax.l2r(linCenter + 1000); + break; + } + } + else { + if(!isNumeric(range[i])) { + if(isNumeric(range[1 - i])) { + range[i] = range[1 - i] * (i ? 10 : 0.1); + } + else { + ax[rangeAttr] = dflt; + break; + } + } - for(i = 0; i < wholeSide.length; i++) { - otherPt = wholeSide[i]; + if(range[i] < -FP_SAFE) range[i] = -FP_SAFE; + else if(range[i] > FP_SAFE) range[i] = FP_SAFE; - // overlap can only happen if the other point is pulled more than this one - if(otherPt === thisPt || ( - (helpers.castOption(trace.pull, thisPt.pts) || 0) >= - (helpers.castOption(trace.pull, otherPt.pts) || 0)) - ) { - continue; + if(range[0] === range[1]) { + // somewhat arbitrary: split by 1 or 1ppm, whichever is bigger + var inc = Math.max(1, Math.abs(range[0] * 1e-6)); + range[0] -= inc; + range[1] += inc; + } } + } + }; - if((thisPt.pxmid[1] - otherPt.pxmid[1]) * yDiffSign > 0) { - // closer to the equator - by construction all of these happen first - // move the text vertically to get away from these slices - otherOuterY = otherPt.cyFinal + farthestY(otherPt.px0[1], otherPt.px1[1]); - newExtraY = otherOuterY - thisInnerY - thisPt.labelExtraY; + // set scaling to pixels + ax.setScale = function(usePrivateRange) { + var gs = fullLayout._size; - if(newExtraY * yDiffSign > 0) thisPt.labelExtraY += newExtraY; + // make sure we have a domain (pull it in from the axis + // this one is overlaying if necessary) + if(ax.overlaying) { + var ax2 = axisIds.getFromId({ _fullLayout: fullLayout }, ax.overlaying); + ax.domain = ax2.domain; + } - } else if((thisOuterY + thisPt.labelExtraY - thisSliceOuterY) * yDiffSign > 0) { - // farther from the equator - happens after we've done all the - // vertical moving we're going to do - // move horizontally to get away from these more polar slices + // While transitions are occuring, occurring, we get a double-transform + // issue if we transform the drawn layer *and* use the new axis range to + // draw the data. This allows us to construct setConvert using the pre- + // interaction values of the range: + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + var calendar = ax.calendar; + ax.cleanRange(rangeAttr); - // if we're moving horz. based on a slice that's several slices away from this one - // then we need some extra space for the lines to labels between them - xBuffer = 3 * xDiffSign * Math.abs(i - wholeSide.indexOf(thisPt)); + var rl0 = ax.r2l(ax[rangeAttr][0], calendar); + var rl1 = ax.r2l(ax[rangeAttr][1], calendar); - otherOuterX = otherPt.cxFinal + farthestX(otherPt.px0[0], otherPt.px1[0]); - newExtraX = otherOuterX + xBuffer - (thisPt.cxFinal + thisPt.pxmid[0]) - thisPt.labelExtraX; + if(axLetter === 'y') { + ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; + ax._length = gs.h * (ax.domain[1] - ax.domain[0]); + ax._m = ax._length / (rl0 - rl1); + ax._b = -ax._m * rl1; + } + else { + ax._offset = gs.l + ax.domain[0] * gs.w; + ax._length = gs.w * (ax.domain[1] - ax.domain[0]); + ax._m = ax._length / (rl1 - rl0); + ax._b = -ax._m * rl0; + } - if(newExtraX * xDiffSign > 0) thisPt.labelExtraX += newExtraX; - } + if(!isFinite(ax._m) || !isFinite(ax._b)) { + fullLayout._replotting = false; + throw new Error('Something went wrong with axis scaling'); } - } + }; - for(yHalf = 0; yHalf < 2; yHalf++) { - equatorFirst = yHalf ? topFirst : bottomFirst; - farthestY = yHalf ? Math.max : Math.min; - yDiffSign = yHalf ? 1 : -1; + // makeCalcdata: takes an x or y array and converts it + // to a position on the axis object "ax" + // inputs: + // trace - a data object from gd.data + // axLetter - a string, either 'x' or 'y', for which item + // to convert (TODO: is this now always the same as + // the first letter of ax._id?) + // in case the expected data isn't there, make a list of + // integers based on the opposite data + ax.makeCalcdata = function(trace, axLetter) { + var arrayIn, arrayOut, i, len; - for(xHalf = 0; xHalf < 2; xHalf++) { - farthestX = xHalf ? Math.max : Math.min; - xDiffSign = xHalf ? 1 : -1; + var axType = ax.type; + var cal = axType === 'date' && trace[axLetter + 'calendar']; - // first sort the array - // note this is a copy of cd, so cd itself doesn't get sorted - // but we can still modify points in place. - thisQuad = quadrants[yHalf][xHalf]; - thisQuad.sort(equatorFirst); + if(axLetter in trace) { + arrayIn = trace[axLetter]; + len = trace._length || Lib.minRowLength(arrayIn); - oppositeQuad = quadrants[1 - yHalf][xHalf]; - wholeSide = oppositeQuad.concat(thisQuad); + if(Lib.isTypedArray(arrayIn) && (axType === 'linear' || axType === 'log')) { + if(len === arrayIn.length) { + return arrayIn; + } else if(arrayIn.subarray) { + return arrayIn.subarray(0, len); + } + } - thisQuadOutside = []; - for(i = 0; i < thisQuad.length; i++) { - if(thisQuad[i].yLabelMid !== undefined) thisQuadOutside.push(thisQuad[i]); + if(axType === 'multicategory') { + return setMultiCategoryIndex(arrayIn, len); } - firstOppositeOutsidePt = false; - for(i = 0; yHalf && i < oppositeQuad.length; i++) { - if(oppositeQuad[i].yLabelMid !== undefined) { - firstOppositeOutsidePt = oppositeQuad[i]; - break; - } + arrayOut = new Array(len); + for(i = 0; i < len; i++) { + arrayOut[i] = ax.d2c(arrayIn[i], 0, cal); } + } + else { + var v0 = ((axLetter + '0') in trace) ? ax.d2c(trace[axLetter + '0'], 0, cal) : 0; + var dv = (trace['d' + axLetter]) ? Number(trace['d' + axLetter]) : 1; - // each needs to avoid the previous - for(i = 0; i < thisQuadOutside.length; i++) { - var prevPt = i && thisQuadOutside[i - 1]; - // bottom half needs to avoid the first label of the top half - // top half we still need to call scootOneLabel on the first slice - // so we can avoid other slices, but we don't pass a prevPt - if(firstOppositeOutsidePt && !i) prevPt = firstOppositeOutsidePt; - scootOneLabel(thisQuadOutside[i], prevPt); + // the opposing data, for size if we have x and dx etc + arrayIn = trace[{x: 'y', y: 'x'}[axLetter]]; + len = trace._length || arrayIn.length; + arrayOut = new Array(len); + + for(i = 0; i < len; i++) { + arrayOut[i] = v0 + i * dv; } } - } -} -function scalePies(cdpie, plotSize) { - var scaleGroups = []; + return arrayOut; + }; - var pieBoxWidth, pieBoxHeight, i, j, cd0, trace, - maxPull, scaleGroup, minPxPerValUnit; + ax.isValidRange = function(range) { + return ( + Array.isArray(range) && + range.length === 2 && + isNumeric(ax.r2l(range[0])) && + isNumeric(ax.r2l(range[1])) + ); + }; - // first figure out the center and maximum radius for each pie - for(i = 0; i < cdpie.length; i++) { - cd0 = cdpie[i][0]; - trace = cd0.trace; + ax.isPtWithinRange = function(d, calendar) { + var coord = ax.c2l(d[axLetter], null, calendar); + var r0 = ax.r2l(ax.range[0]); + var r1 = ax.r2l(ax.range[1]); - pieBoxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]); - pieBoxHeight = plotSize.h * (trace.domain.y[1] - trace.domain.y[0]); - // leave some space for the title, if it will be displayed outside - if(trace.title && trace.titleposition !== 'middle center') { - pieBoxHeight -= getTitleSpace(cd0, plotSize); + if(r0 < r1) { + return r0 <= coord && coord <= r1; + } else { + // Reversed axis case. + return r1 <= coord && coord <= r0; } + }; - maxPull = getMaxPull(trace); - - cd0.r = Math.min(pieBoxWidth, pieBoxHeight) / (2 + 2 * maxPull); + ax.clearCalc = function() { + // initialize the category list, if there is one, so we start over + // to be filled in later by ax.d2c + ax._categories = (ax._initialCategories || []).slice(); - cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2; - cd0.cy = plotSize.t + plotSize.h * (1 - trace.domain.y[0]) - pieBoxHeight / 2; - if(trace.title && trace.titleposition.indexOf('bottom') !== -1) { - cd0.cy -= getTitleSpace(cd0, plotSize); + // Build the lookup map for initialized categories + ax._categoriesMap = {}; + for(var j = 0; j < ax._categories.length; j++) { + ax._categoriesMap[ax._categories[j]] = j; } + }; - if(trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) { - scaleGroups.push(trace.scalegroup); - } + // Propagate localization into the axis so that + // methods in Axes can use it w/o having to pass fullLayout + // Default (non-d3) number formatting uses separators directly + // dates and d3-formatted numbers use the d3 locale + // Fall back on default format for dummy axes that don't care about formatting + var locale = fullLayout._d3locale; + if(ax.type === 'date') { + ax._dateFormat = locale ? locale.timeFormat.utc : d3.time.format.utc; + ax._extraFormat = fullLayout._extraFormat; } + // occasionally we need _numFormat to pass through + // even though it won't be needed by this axis + ax._separators = fullLayout.separators; + ax._numFormat = locale ? locale.numberFormat : d3.format; - // Then scale any pies that are grouped - for(j = 0; j < scaleGroups.length; j++) { - minPxPerValUnit = Infinity; - scaleGroup = scaleGroups[j]; + // and for bar charts and box plots: reset forced minimum tick spacing + delete ax._minDtick; + delete ax._forceTick0; +}; - for(i = 0; i < cdpie.length; i++) { - cd0 = cdpie[i][0]; - if(cd0.trace.scalegroup === scaleGroup) { - minPxPerValUnit = Math.min(minPxPerValUnit, - cd0.r * cd0.r / cd0.vTotal); - } - } +},{"../../constants/numerical":140,"../../lib":159,"./axis_ids":206,"./constants":209,"d3":8,"fast-isnumeric":10}],223:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(i = 0; i < cdpie.length; i++) { - cd0 = cdpie[i][0]; - if(cd0.trace.scalegroup === scaleGroup) { - cd0.r = Math.sqrt(minPxPerValUnit * cd0.vTotal); - } - } - } -} +'use strict'; -function setCoords(cd) { - var cd0 = cd[0]; - var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; - var angleFactor = 2 * Math.PI / cd0.vTotal; - var firstPt = 'px0'; - var lastPt = 'px1'; +var Lib = _dereq_('../../lib'); +var layoutAttributes = _dereq_('./layout_attributes'); +var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); - var i, cdi, currentCoords; +module.exports = function handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options) { + var showAttrDflt = getShowAttrDflt(containerIn); - if(trace.direction === 'counterclockwise') { - for(i = 0; i < cd.length; i++) { - if(!cd[i].hidden) break; // find the first non-hidden slice + var tickPrefix = coerce('tickprefix'); + if(tickPrefix) coerce('showtickprefix', showAttrDflt); + + var tickSuffix = coerce('ticksuffix', options.tickSuffixDflt); + if(tickSuffix) coerce('showticksuffix', showAttrDflt); + + var showTickLabels = coerce('showticklabels'); + if(showTickLabels) { + var font = options.font || {}; + var contColor = containerOut.color; + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { + family: font.family, + size: font.size, + color: dfltFontColor + }); + coerce('tickangle'); + + if(axType !== 'category') { + var tickFormat = coerce('tickformat'); + var tickformatStops = containerIn.tickformatstops; + if(Array.isArray(tickformatStops) && tickformatStops.length) { + handleArrayContainerDefaults(containerIn, containerOut, { + name: 'tickformatstops', + inclusionAttr: 'enabled', + handleItemDefaults: tickformatstopDefaults + }); + } + if(!tickFormat && axType !== 'date') { + coerce('showexponent', showAttrDflt); + coerce('exponentformat'); + coerce('separatethousands'); + } } - if(i === cd.length) return; // all slices hidden - - currentAngle += angleFactor * cd[i].v; - angleFactor *= -1; - firstPt = 'px1'; - lastPt = 'px0'; - } - - function getCoords(angle) { - return [cd0.r * Math.sin(angle), -cd0.r * Math.cos(angle)]; } +}; - currentCoords = getCoords(currentAngle); - - for(i = 0; i < cd.length; i++) { - cdi = cd[i]; - if(cdi.hidden) continue; - - cdi[firstPt] = currentCoords; - - currentAngle += angleFactor * cdi.v / 2; - cdi.pxmid = getCoords(currentAngle); - cdi.midangle = currentAngle; +/* + * Attributes 'showexponent', 'showtickprefix' and 'showticksuffix' + * share values. + * + * If only 1 attribute is set, + * the remaining attributes inherit that value. + * + * If 2 attributes are set to the same value, + * the remaining attribute inherits that value. + * + * If 2 attributes are set to different values, + * the remaining is set to its dflt value. + * + */ +function getShowAttrDflt(containerIn) { + var showAttrsAll = ['showexponent', 'showtickprefix', 'showticksuffix']; + var showAttrs = showAttrsAll.filter(function(a) { + return containerIn[a] !== undefined; + }); + var sameVal = function(a) { + return containerIn[a] === containerIn[showAttrs[0]]; + }; - currentAngle += angleFactor * cdi.v / 2; - currentCoords = getCoords(currentAngle); + if(showAttrs.every(sameVal) || showAttrs.length === 1) { + return containerIn[showAttrs[0]]; + } +} - cdi[lastPt] = currentCoords; +function tickformatstopDefaults(valueIn, valueOut) { + function coerce(attr, dflt) { + return Lib.coerce(valueIn, valueOut, layoutAttributes.tickformatstops, attr, dflt); + } - cdi.largeArc = (cdi.v > cd0.vTotal / 2) ? 1 : 0; + var enabled = coerce('enabled'); + if(enabled) { + coerce('dtickrange'); + coerce('value'); } } -},{"../../components/color":570,"../../components/drawing":595,"../../components/fx":612,"../../lib":696,"../../lib/svg_text_utils":720,"./event_data":1022,"./helpers":1023,"d3":148}],1028:[function(_dereq_,module,exports){ +},{"../../lib":159,"../array_container_defaults":199,"./layout_attributes":216}],224:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var d3 = _dereq_('d3'); +var Lib = _dereq_('../../lib'); -var styleOne = _dereq_('./style_one'); +var layoutAttributes = _dereq_('./layout_attributes'); -module.exports = function style(gd) { - gd._fullLayout._pielayer.selectAll('.trace').each(function(cd) { - var cd0 = cd[0]; - var trace = cd0.trace; - var traceSelection = d3.select(this); - traceSelection.style({opacity: trace.opacity}); +/** + * options: inherits outerTicks from axes.handleAxisDefaults + */ +module.exports = function handleTickDefaults(containerIn, containerOut, coerce, options) { + var tickLen = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'ticklen'); + var tickWidth = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickwidth'); + var tickColor = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickcolor', containerOut.color); + var showTicks = coerce('ticks', (options.outerTicks || tickLen || tickWidth || tickColor) ? 'outside' : ''); - traceSelection.selectAll('path.surface').each(function(pt) { - d3.select(this).call(styleOne, pt, trace); - }); - }); + if(!showTicks) { + delete containerOut.ticklen; + delete containerOut.tickwidth; + delete containerOut.tickcolor; + } }; -},{"./style_one":1029,"d3":148}],1029:[function(_dereq_,module,exports){ +},{"../../lib":159,"./layout_attributes":216}],225:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -160350,22 +57808,40 @@ 'use strict'; -var Color = _dereq_('../../components/color'); -var castOption = _dereq_('./helpers').castOption; +var cleanTicks = _dereq_('./clean_ticks'); -module.exports = function styleOne(s, pt, trace) { - var line = trace.marker.line; - var lineColor = castOption(line.color, pt.pts) || Color.defaultLine; - var lineWidth = castOption(line.width, pt.pts) || 0; +module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) { + var tickmode; - s.style({'stroke-width': lineWidth}) - .call(Color.fill, pt.color) - .call(Color.stroke, lineColor); + if(containerIn.tickmode === 'array' && + (axType === 'log' || axType === 'date')) { + tickmode = containerOut.tickmode = 'auto'; + } else { + var tickmodeDefault = Array.isArray(containerIn.tickvals) ? 'array' : + containerIn.dtick ? 'linear' : + 'auto'; + tickmode = coerce('tickmode', tickmodeDefault); + } + + if(tickmode === 'auto') coerce('nticks'); + else if(tickmode === 'linear') { + // dtick is usually a positive number, but there are some + // special strings available for log or date axes + // tick0 also has special logic + var dtick = containerOut.dtick = cleanTicks.dtick( + containerIn.dtick, axType); + containerOut.tick0 = cleanTicks.tick0( + containerIn.tick0, axType, containerOut.calendar, dtick); + } else if(axType !== 'multicategory') { + var tickvals = coerce('tickvals'); + if(tickvals === undefined) containerOut.tickmode = 'auto'; + else coerce('ticktext'); + } }; -},{"../../components/color":570,"./helpers":1023}],1030:[function(_dereq_,module,exports){ +},{"./clean_ticks":208}],226:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -160374,672 +57850,770 @@ 'use strict'; -var scatterglAttrs = _dereq_('../scatter/attributes'); +var d3 = _dereq_('d3'); -module.exports = { - x: scatterglAttrs.x, - y: scatterglAttrs.y, - xy: { - valType: 'data_array', - editType: 'calc', - - }, - indices: { - valType: 'data_array', - editType: 'calc', - - }, - xbounds: { - valType: 'data_array', - editType: 'calc', - - }, - ybounds: { - valType: 'data_array', - editType: 'calc', - - }, - text: scatterglAttrs.text, - marker: { - color: { - valType: 'color', - arrayOk: false, - - editType: 'calc', - - }, - opacity: { - valType: 'number', - min: 0, - max: 1, - dflt: 1, - arrayOk: false, - - editType: 'calc', - - }, - blend: { - valType: 'boolean', - dflt: null, - - editType: 'calc', - - }, - sizemin: { - valType: 'number', - min: 0.1, - max: 2, - dflt: 0.5, - - editType: 'calc', - - }, - sizemax: { - valType: 'number', - min: 0.1, - dflt: 20, - - editType: 'calc', - - }, - border: { - color: { - valType: 'color', - arrayOk: false, - - editType: 'calc', - - }, - arearatio: { - valType: 'number', - min: 0, - max: 1, - dflt: 0, - - editType: 'calc', - - }, - editType: 'calc' - }, - editType: 'calc' - }, - transforms: undefined -}; +var Registry = _dereq_('../../registry'); +var Drawing = _dereq_('../../components/drawing'); +var Axes = _dereq_('./axes'); -},{"../scatter/attributes":1043}],1031:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; + * transitionAxes + * + * transition axes from one set of ranges to another, using a svg + * transformations, similar to during panning. + * + * @param {DOM element | object} gd + * @param {array} edits : array of 'edits', each item with + * - plotinfo {object} subplot object + * - xr0 {array} initial x-range + * - xr1 {array} end x-range + * - yr0 {array} initial y-range + * - yr1 {array} end y-range + * @param {object} transitionOpts + * @param {function} makeOnCompleteCallback + */ +module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnCompleteCallback) { + var fullLayout = gd._fullLayout; -var createPointCloudRenderer = _dereq_('gl-pointcloud2d'); + // special case for redraw:false Plotly.animate that relies on this + // to update axis-referenced layout components + if(edits.length === 0) { + Axes.redrawComponents(gd); + return; + } -var str2RGBArray = _dereq_('../../lib/str2rgbarray'); -var findExtremes = _dereq_('../../plots/cartesian/autorange').findExtremes; -var getTraceColor = _dereq_('../scatter/get_trace_color'); + function unsetSubplotTransform(subplot) { + var xa = subplot.xaxis; + var ya = subplot.yaxis; -function Pointcloud(scene, uid) { - this.scene = scene; - this.uid = uid; - this.type = 'pointcloud'; + fullLayout._defs.select('#' + subplot.clipId + '> rect') + .call(Drawing.setTranslate, 0, 0) + .call(Drawing.setScale, 1, 1); - this.pickXData = []; - this.pickYData = []; - this.xData = []; - this.yData = []; - this.textLabels = []; - this.color = 'rgb(0, 0, 0)'; - this.name = ''; - this.hoverinfo = 'all'; + subplot.plot + .call(Drawing.setTranslate, xa._offset, ya._offset) + .call(Drawing.setScale, 1, 1); - this.idToIndex = new Int32Array(0); - this.bounds = [0, 0, 0, 0]; + var traceGroups = subplot.plot.selectAll('.scatterlayer .trace'); - this.pointcloudOptions = { - positions: new Float32Array(0), - idToIndex: this.idToIndex, - sizemin: 0.5, - sizemax: 12, - color: [0, 0, 0, 1], - areaRatio: 1, - borderColor: [0, 0, 0, 1] - }; - this.pointcloud = createPointCloudRenderer(scene.glplot, this.pointcloudOptions); - this.pointcloud._trace = this; // scene2d requires this prop -} + // This is specifically directed at scatter traces, applying an inverse + // scale to individual points to counteract the scale of the trace + // as a whole: + traceGroups.selectAll('.point') + .call(Drawing.setPointGroupScale, 1, 1); + traceGroups.selectAll('.textpoint') + .call(Drawing.setTextPointsScale, 1, 1); + traceGroups + .call(Drawing.hideOutsideRangePoints, subplot); + } -var proto = Pointcloud.prototype; + function updateSubplot(edit, progress) { + var plotinfo = edit.plotinfo; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; -proto.handlePick = function(pickResult) { - var index = this.idToIndex[pickResult.pointId]; + var xr0 = edit.xr0; + var xr1 = edit.xr1; + var xlen = xa._length; + var yr0 = edit.yr0; + var yr1 = edit.yr1; + var ylen = ya._length; - // prefer the readout from XY, if present - return { - trace: this, - dataCoord: pickResult.dataCoord, - traceCoord: this.pickXYData ? - [this.pickXYData[index * 2], this.pickXYData[index * 2 + 1]] : - [this.pickXData[index], this.pickYData[index]], - textLabel: Array.isArray(this.textLabels) ? - this.textLabels[index] : - this.textLabels, - color: this.color, - name: this.name, - pointIndex: index, - hoverinfo: this.hoverinfo - }; -}; + var editX = !!xr1; + var editY = !!yr1; + var viewBox = []; -proto.update = function(options) { - this.index = options.index; - this.textLabels = options.text; - this.name = options.name; - this.hoverinfo = options.hoverinfo; - this.bounds = [Infinity, Infinity, -Infinity, -Infinity]; + if(editX) { + 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); + xa.range[0] = xr0[0] * (1 - progress) + progress * xr1[0]; + xa.range[1] = xr0[1] * (1 - progress) + progress * xr1[1]; + } else { + viewBox[0] = 0; + viewBox[2] = xlen; + } - this.updateFast(options); + if(editY) { + 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); + ya.range[0] = yr0[0] * (1 - progress) + progress * yr1[0]; + ya.range[1] = yr0[1] * (1 - progress) + progress * yr1[1]; + } else { + viewBox[1] = 0; + viewBox[3] = ylen; + } - this.color = getTraceColor(options, {}); -}; + Axes.drawOne(gd, xa, {skipTitle: true}); + Axes.drawOne(gd, ya, {skipTitle: true}); + Axes.redrawComponents(gd, [xa._id, ya._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 = xa._offset - fracDx; + var plotDy = ya._offset - fracDy; -proto.updateFast = function(options) { - var x = this.xData = this.pickXData = options.x; - var y = this.yData = this.pickYData = options.y; - var xy = this.pickXYData = options.xy; + plotinfo.clipRect + .call(Drawing.setTranslate, clipDx, clipDy) + .call(Drawing.setScale, 1 / xScaleFactor, 1 / yScaleFactor); - var userBounds = options.xbounds && options.ybounds; - var index = options.indices; + plotinfo.plot + .call(Drawing.setTranslate, plotDx, plotDy) + .call(Drawing.setScale, xScaleFactor, yScaleFactor); - var len, - idToIndex, - positions, - bounds = this.bounds; + // apply an inverse scale to individual points to counteract + // the scale of the trace group. + Drawing.setPointGroupScale(plotinfo.zoomScalePts, 1 / xScaleFactor, 1 / yScaleFactor); + Drawing.setTextPointsScale(plotinfo.zoomScaleTxt, 1 / xScaleFactor, 1 / yScaleFactor); + } - var xx, yy, i; + var onComplete; + if(makeOnCompleteCallback) { + // This module makes the choice whether or not it notifies Plotly.transition + // about completion: + onComplete = makeOnCompleteCallback(); + } - if(xy) { + function transitionComplete() { + var aobj = {}; - positions = xy; + for(var i = 0; i < edits.length; i++) { + var edit = edits[i]; + if(edit.xr1) aobj[edit.plotinfo.xaxis._name + '.range'] = edit.xr1.slice(); + if(edit.yr1) aobj[edit.plotinfo.yaxis._name + '.range'] = edit.yr1.slice(); + } - // dividing xy.length by 2 and truncating to integer if xy.length was not even - len = xy.length >>> 1; + // Signal that this transition has completed: + onComplete && onComplete(); - if(userBounds) { + return Registry.call('relayout', gd, aobj).then(function() { + for(var i = 0; i < edits.length; i++) { + unsetSubplotTransform(edits[i].plotinfo); + } + }); + } - bounds[0] = options.xbounds[0]; - bounds[2] = options.xbounds[1]; - bounds[1] = options.ybounds[0]; - bounds[3] = options.ybounds[1]; + function transitionInterrupt() { + var aobj = {}; - } else { + for(var i = 0; i < edits.length; i++) { + var edit = edits[i]; + if(edit.xr0) aobj[edit.plotinfo.xaxis._name + '.range'] = edit.xr0.slice(); + if(edit.yr0) aobj[edit.plotinfo.yaxis._name + '.range'] = edit.yr0.slice(); + } - for(i = 0; i < len; i++) { + return Registry.call('relayout', gd, aobj).then(function() { + for(var i = 0; i < edits.length; i++) { + unsetSubplotTransform(edits[i].plotinfo); + } + }); + } - xx = positions[i * 2]; - yy = positions[i * 2 + 1]; + var t1, t2, raf; + var easeFn = d3.ease(transitionOpts.easing); - if(xx < bounds[0]) bounds[0] = xx; - if(xx > bounds[2]) bounds[2] = xx; - if(yy < bounds[1]) bounds[1] = yy; - if(yy > bounds[3]) bounds[3] = yy; - } + gd._transitionData._interruptCallbacks.push(function() { + window.cancelAnimationFrame(raf); + raf = null; + return transitionInterrupt(); + }); - } + function doFrame() { + t2 = Date.now(); - if(index) { + var tInterp = Math.min(1, (t2 - t1) / transitionOpts.duration); + var progress = easeFn(tInterp); - idToIndex = index; + for(var i = 0; i < edits.length; i++) { + updateSubplot(edits[i], progress); + } + if(t2 - t1 > transitionOpts.duration) { + transitionComplete(); + raf = window.cancelAnimationFrame(doFrame); } else { + raf = window.requestAnimationFrame(doFrame); + } + } - idToIndex = new Int32Array(len); + t1 = Date.now(); + raf = window.requestAnimationFrame(doFrame); - for(i = 0; i < len; i++) { + return Promise.resolve(); +}; - idToIndex[i] = i; +},{"../../components/drawing":64,"../../registry":243,"./axes":203,"d3":8}],227:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - } +'use strict'; - } +var traceIs = _dereq_('../../registry').traceIs; +var autoType = _dereq_('./axis_autotype'); - } else { +/* + * data: the plot data to use in choosing auto type + * name: axis object name (ie 'xaxis') if one should be stored + */ +module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + var axType = coerce('type', (options.splomStash || {}).type); - len = x.length; + if(axType === '-') { + setAutoType(containerOut, options.data); - positions = new Float32Array(2 * len); - idToIndex = new Int32Array(len); + if(containerOut.type === '-') { + containerOut.type = 'linear'; + } else { + // copy autoType back to input axis + // note that if this object didn't exist + // in the input layout, we have to put it in + // this happens in the main supplyDefaults function + containerIn.type = containerOut.type; + } + } +}; - for(i = 0; i < len; i++) { - xx = x[i]; - yy = y[i]; +function setAutoType(ax, data) { + // new logic: let people specify any type they want, + // only autotype if type is '-' + if(ax.type !== '-') return; - idToIndex[i] = i; + var id = ax._id; + var axLetter = id.charAt(0); - positions[i * 2] = xx; - positions[i * 2 + 1] = yy; + // support 3d + if(id.indexOf('scene') !== -1) id = axLetter; - if(xx < bounds[0]) bounds[0] = xx; - if(xx > bounds[2]) bounds[2] = xx; - if(yy < bounds[1]) bounds[1] = yy; - if(yy > bounds[3]) bounds[3] = yy; - } + var d0 = getFirstNonEmptyTrace(data, id, axLetter); + if(!d0) return; + // first check for histograms, as the count direction + // should always default to a linear axis + if(d0.type === 'histogram' && + axLetter === {v: 'y', h: 'x'}[d0.orientation || 'v']) { + ax.type = 'linear'; + return; } - this.idToIndex = idToIndex; - this.pointcloudOptions.idToIndex = idToIndex; + var calAttr = axLetter + 'calendar'; + var calendar = d0[calAttr]; + var opts = {noMultiCategory: !traceIs(d0, 'cartesian') || traceIs(d0, 'noMultiCategory')}; + var i; + + // check all boxes on this x axis to see + // if they're dates, numbers, or categories + if(isBoxWithoutPositionCoords(d0, axLetter)) { + var posLetter = getBoxPosLetter(d0); + var boxPositions = []; - this.pointcloudOptions.positions = positions; + for(i = 0; i < data.length; i++) { + var trace = data[i]; + if(!traceIs(trace, 'box-violin') || (trace[axLetter + 'axis'] || axLetter) !== id) continue; - var markerColor = str2RGBArray(options.marker.color), - borderColor = str2RGBArray(options.marker.border.color), - opacity = options.opacity * options.marker.opacity; + if(trace[posLetter] !== undefined) boxPositions.push(trace[posLetter][0]); + else if(trace.name !== undefined) boxPositions.push(trace.name); + else boxPositions.push('text'); - markerColor[3] *= opacity; - this.pointcloudOptions.color = markerColor; + if(trace[calAttr] !== calendar) calendar = undefined; + } - // detect blending from the number of points, if undefined - // because large data with blending hits performance - var blend = options.marker.blend; - if(blend === null) { - var maxPoints = 100; - blend = x.length < maxPoints || y.length < maxPoints; + ax.type = autoType(boxPositions, calendar, opts); + } + else if(d0.type === 'splom') { + var dimensions = d0.dimensions; + var diag = d0._diag; + for(i = 0; i < dimensions.length; i++) { + var dim = dimensions[i]; + if(dim.visible && (diag[i][0] === id || diag[i][1] === id)) { + ax.type = autoType(dim.values, calendar, opts); + break; + } + } + } + else { + ax.type = autoType(d0[axLetter] || [d0[axLetter + '0']], calendar, opts); } - this.pointcloudOptions.blend = blend; +} - borderColor[3] *= opacity; - this.pointcloudOptions.borderColor = borderColor; +function getFirstNonEmptyTrace(data, id, axLetter) { + for(var i = 0; i < data.length; i++) { + var trace = data[i]; - var markerSizeMin = options.marker.sizemin; - var markerSizeMax = Math.max(options.marker.sizemax, options.marker.sizemin); - this.pointcloudOptions.sizeMin = markerSizeMin; - this.pointcloudOptions.sizeMax = markerSizeMax; - this.pointcloudOptions.areaRatio = options.marker.border.arearatio; + if(trace.type === 'splom' && + trace._length > 0 && + (trace['_' + axLetter + 'axes'] || {})[id] + ) { + return trace; + } - this.pointcloud.update(this.pointcloudOptions); + if((trace[axLetter + 'axis'] || axLetter) === id) { + if(isBoxWithoutPositionCoords(trace, axLetter)) { + return trace; + } + else if((trace[axLetter] || []).length || trace[axLetter + '0']) { + return trace; + } + } + } +} - // add item for autorange routine - var xa = this.scene.xaxis; - var ya = this.scene.yaxis; - var pad = markerSizeMax / 2 || 0.5; - options._extremes[xa._id] = findExtremes(xa, [bounds[0], bounds[2]], {ppad: pad}); - options._extremes[ya._id] = findExtremes(ya, [bounds[1], bounds[3]], {ppad: pad}); -}; +function getBoxPosLetter(trace) { + return {v: 'x', h: 'y'}[trace.orientation || 'v']; +} -proto.dispose = function() { - this.pointcloud.dispose(); -}; +function isBoxWithoutPositionCoords(trace, axLetter) { + var posLetter = getBoxPosLetter(trace); + var isBox = traceIs(trace, 'box-violin'); + var isCandlestick = traceIs(trace._fullInput || {}, 'candlestick'); -function createPointcloud(scene, data) { - var plot = new Pointcloud(scene, data.uid); - plot.update(data); - return plot; + return ( + isBox && + !isCandlestick && + axLetter === posLetter && + trace[posLetter] === undefined && + trace[posLetter + '0'] === undefined + ); } -module.exports = createPointcloud; - -},{"../../lib/str2rgbarray":719,"../../plots/cartesian/autorange":743,"../scatter/get_trace_color":1053,"gl-pointcloud2d":279}],1032:[function(_dereq_,module,exports){ +},{"../../registry":243,"./axis_autotype":204}],228:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Lib = _dereq_('../../lib'); +var Registry = _dereq_('../registry'); +var Lib = _dereq_('../lib'); -var attributes = _dereq_('./attributes'); +/* + * Create or update an observer. This function is designed to be + * idempotent so that it can be called over and over as the component + * updates, and will attach and detach listeners as needed. + * + * @param {optional object} container + * An object on which the observer is stored. This is the mechanism + * by which it is idempotent. If it already exists, another won't be + * added. Each time it's called, the value lookup table is updated. + * @param {array} commandList + * An array of commands, following either `buttons` of `updatemenus` + * or `steps` of `sliders`. + * @param {function} onchange + * A listener called when the value is changed. Receives data object + * with information about the new state. + */ +exports.manageCommandObserver = function(gd, container, commandList, onchange) { + var ret = {}; + var enabled = true; + + if(container && container._commandObserver) { + ret = container._commandObserver; + } + + if(!ret.cache) { + ret.cache = {}; + } + + // Either create or just recompute this: + ret.lookupTable = {}; + + var binding = exports.hasSimpleAPICommandBindings(gd, commandList, ret.lookupTable); + + if(container && container._commandObserver) { + if(!binding) { + // If container exists and there are no longer any bindings, + // remove existing: + if(container._commandObserver.remove) { + container._commandObserver.remove(); + container._commandObserver = null; + return ret; + } + } else { + // If container exists and there *are* bindings, then the lookup + // table should have been updated and check is already attached, + // so there's nothing to be done: + return ret; + + + } + } + + // Determine whether there's anything to do for this binding: + + if(binding) { + // Build the cache: + bindingValueHasChanged(gd, binding, ret.cache); + + ret.check = function check() { + if(!enabled) return; + + var update = bindingValueHasChanged(gd, binding, ret.cache); + + if(update.changed && onchange) { + // Disable checks for the duration of this command in order to avoid + // infinite loops: + if(ret.lookupTable[update.value] !== undefined) { + 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++) { + gd._internalOn(checkEvents[i], ret.check); + } + + ret.remove = function() { + for(var i = 0; i < checkEvents.length; i++) { + gd._removeInternalListener(checkEvents[i], ret.check); + } + }; + } else { + // TODO: It'd be really neat to actually give a *reason* for this, but at least a warning + // is a start + Lib.log('Unable to automatically bind plot updates to API command'); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + ret.lookupTable = {}; + ret.remove = function() {}; } - coerce('x'); - coerce('y'); - - coerce('xbounds'); - coerce('ybounds'); + ret.disable = function disable() { + enabled = false; + }; - if(traceIn.xy && traceIn.xy instanceof Float32Array) { - traceOut.xy = traceIn.xy; - } + ret.enable = function enable() { + enabled = true; + }; - if(traceIn.indices && traceIn.indices instanceof Int32Array) { - traceOut.indices = traceIn.indices; + if(container) { + container._commandObserver = ret; } - coerce('text'); - coerce('marker.color', defaultColor); - coerce('marker.opacity'); - coerce('marker.blend'); - coerce('marker.sizemin'); - coerce('marker.sizemax'); - coerce('marker.border.color', defaultColor); - coerce('marker.border.arearatio'); - - // disable 1D transforms - that would defeat the purpose of this trace type, performance! - traceOut._length = null; + return ret; }; -},{"../../lib":696,"./attributes":1030}],1033:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +/* + * This function checks to see if an array of objects containing + * method and args properties is compatible with automatic two-way + * binding. The criteria right now are that + * + * 1. multiple traces may be affected + * 2. only one property may be affected + * 3. the same property must be affected by all commands + */ +exports.hasSimpleAPICommandBindings = function(gd, commandList, bindingsByValue) { + var i; + var n = commandList.length; -'use strict'; + var refBinding; -var pointcloud = {}; + for(i = 0; i < n; i++) { + var binding; + var command = commandList[i]; + var method = command.method; + var args = command.args; -pointcloud.attributes = _dereq_('./attributes'); -pointcloud.supplyDefaults = _dereq_('./defaults'); + if(!Array.isArray(args)) args = []; -// reuse the Scatter3D 'dummy' calc step so that legends know what to do -pointcloud.calc = _dereq_('../scatter3d/calc'); -pointcloud.plot = _dereq_('./convert'); + // If any command has no method, refuse to bind: + if(!method) { + return false; + } + var bindings = exports.computeAPICommandBindings(gd, method, args); -pointcloud.moduleType = 'trace'; -pointcloud.name = 'pointcloud'; -pointcloud.basePlotModule = _dereq_('../../plots/gl2d'); -pointcloud.categories = ['gl', 'gl2d', 'showLegend']; -pointcloud.meta = { - -}; + // Right now, handle one and *only* one property being set: + if(bindings.length !== 1) { + return false; + } -module.exports = pointcloud; + 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; + } + } + } -},{"../../plots/gl2d":784,"../scatter3d/calc":1071,"./attributes":1030,"./convert":1031,"./defaults":1032}],1034:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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; + } + } -'use strict'; + return refBinding; +}; -var fontAttrs = _dereq_('../../plots/font_attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var colorAttrs = _dereq_('../../components/color/attributes'); -var fxAttrs = _dereq_('../../components/fx/attributes'); -var domainAttrs = _dereq_('../../plots/domain').attributes; +function bindingValueHasChanged(gd, binding, cache) { + var container, value, obj; + var changed = false; -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; + if(binding.type === 'data') { + // If it's data, we need to get a trace. Based on the limited scope + // of what we cover, we can just take the first trace from the list, + // or otherwise just the first trace: + container = gd._fullData[binding.traces !== null ? binding.traces[0] : 0]; + } else if(binding.type === 'layout') { + container = gd._fullLayout; + } else { + return false; + } -var attrs = module.exports = overrideAll({ - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: [], - arrayOk: false, - - }), - hoverlabel: fxAttrs.hoverlabel, - domain: domainAttrs({name: 'sankey', trace: true}), + value = Lib.nestedProperty(container, binding.prop).get(); - orientation: { - valType: 'enumerated', - values: ['v', 'h'], - dflt: 'h', - - - }, + obj = cache[binding.type] = cache[binding.type] || {}; - valueformat: { - valType: 'string', - dflt: '.3s', - - - }, + if(obj.hasOwnProperty(binding.prop)) { + if(obj[binding.prop] !== value) { + changed = true; + } + } - valuesuffix: { - valType: 'string', - dflt: '', - - - }, + obj[binding.prop] = value; - arrangement: { - valType: 'enumerated', - values: ['snap', 'perpendicular', 'freeform', 'fixed'], - dflt: 'snap', - - - }, + return { + changed: changed, + value: value + }; +} - textfont: fontAttrs({ - - }), +/* + * Execute an API command. There's really not much to this; it just provides + * a common hook so that implementations don't need to be synchronized across + * multiple components with the ability to invoke API commands. + * + * @param {string} method + * The name of the plotly command to execute. Must be one of 'animate', + * 'restyle', 'relayout', 'update'. + * @param {array} args + * A list of arguments passed to the API command + */ +exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); - node: { - label: { - valType: 'data_array', - dflt: [], - - - }, - color: { - valType: 'color', - - arrayOk: true, - - }, - line: { - color: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - arrayOk: true, - - }, - width: { - valType: 'number', - - min: 0, - dflt: 0.5, - arrayOk: true, - - } - }, - pad: { - valType: 'number', - arrayOk: false, - min: 0, - dflt: 20, - - - }, - thickness: { - valType: 'number', - arrayOk: false, - min: 1, - dflt: 20, - - - }, - hoverinfo: { - valType: 'enumerated', - values: ['all', 'none', 'skip'], - dflt: 'all', - - - }, - hoverlabel: fxAttrs.hoverlabel, // needs editType override, - - }, + var _method = Registry.apiMethodRegistry[method]; + var allArgs = [gd]; + if(!Array.isArray(args)) args = []; - link: { - label: { - valType: 'data_array', - dflt: [], - - - }, - color: { - valType: 'color', - - arrayOk: true, - - }, - line: { - color: { - valType: 'color', - - dflt: colorAttrs.defaultLine, - arrayOk: true, - - }, - width: { - valType: 'number', - - min: 0, - dflt: 0, - arrayOk: true, - - } - }, - source: { - valType: 'data_array', - - dflt: [], - - }, - target: { - valType: 'data_array', - - dflt: [], - - }, - value: { - valType: 'data_array', - dflt: [], - - - }, - hoverinfo: { - valType: 'enumerated', - values: ['all', 'none', 'skip'], - dflt: 'all', - - - }, - hoverlabel: fxAttrs.hoverlabel, // needs editType override, - + for(var i = 0; i < args.length; i++) { + allArgs.push(args[i]); } -}, 'calc', 'nested'); -attrs.transforms = undefined; -},{"../../components/color/attributes":569,"../../components/fx/attributes":604,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/attributes":741,"../../plots/domain":770,"../../plots/font_attributes":771}],1035:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return _method.apply(null, allArgs).catch(function(err) { + Lib.warn('API call to Plotly.' + method + ' rejected.', err); + return Promise.reject(err); + }); +}; -'use strict'; +exports.computeAPICommandBindings = function(gd, method, args) { + var bindings; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var getModuleCalcData = _dereq_('../../plots/get_data').getModuleCalcData; -var plot = _dereq_('./plot'); -var fxAttrs = _dereq_('../../components/fx/layout_attributes'); + if(!Array.isArray(args)) args = []; -var SANKEY = 'sankey'; + switch(method) { + case 'restyle': + bindings = computeDataBindings(gd, args); + break; + case 'relayout': + bindings = computeLayoutBindings(gd, args); + break; + case 'update': + bindings = computeDataBindings(gd, [args[0], args[2]]) + .concat(computeLayoutBindings(gd, [args[1]])); + break; + case 'animate': + bindings = computeAnimateBindings(gd, args); + break; + default: + // This is the case where intelligent logic about what affects + // this command is not implemented. It causes no ill effects. + // For example, addFrames simply won't bind to a control component. + bindings = []; + } + return bindings; +}; -exports.name = SANKEY; +function computeAnimateBindings(gd, args) { + // We'll assume that the only relevant modification an animation + // makes that's meaningfully tracked is the frame: + 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 []; + } +} -exports.baseLayoutAttrOverrides = overrideAll({ - hoverlabel: fxAttrs.hoverlabel -}, 'plot', 'nested'); +function computeLayoutBindings(gd, args) { + var bindings = []; -exports.plot = function(gd) { - var calcData = getModuleCalcData(gd.calcdata, SANKEY)[0]; - plot(gd, calcData); -}; + var astr = args[0]; + var aobj = {}; + if(typeof astr === 'string') { + aobj[astr] = args[1]; + } else if(Lib.isPlainObject(astr)) { + aobj = astr; + } else { + return bindings; + } -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var hadPlot = (oldFullLayout._has && oldFullLayout._has(SANKEY)); - var hasPlot = (newFullLayout._has && newFullLayout._has(SANKEY)); + crawl(aobj, function(path, attrName, attr) { + bindings.push({type: 'layout', prop: path, value: attr}); + }, '', 0); - if(hadPlot && !hasPlot) { - oldFullLayout._paperdiv.selectAll('.sankey').remove(); - } -}; + return bindings; +} -},{"../../components/fx/layout_attributes":613,"../../plot_api/edit_types":727,"../../plots/get_data":781,"./plot":1040}],1036:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function computeDataBindings(gd, args) { + var traces, astr, val, aobj; + var bindings = []; -'use strict'; + // Logic copied from Plotly.restyle: + astr = args[0]; + val = args[1]; + traces = args[2]; + aobj = {}; + if(typeof astr === 'string') { + aobj[astr] = val; + } else if(Lib.isPlainObject(astr)) { + // the 3-arg form + aobj = astr; -var tarjan = _dereq_('strongly-connected-components'); -var Lib = _dereq_('../../lib'); -var wrap = _dereq_('../../lib/gup').wrap; + if(traces === undefined) { + traces = val; + } + } else { + return bindings; + } -function circularityPresent(nodeList, sources, targets) { + if(traces === undefined) { + // Explicitly assign this to null instead of undefined: + traces = null; + } - var nodeLen = nodeList.length; - var nodes = Lib.init2dArray(nodeLen, 0); + crawl(aobj, function(path, attrName, attr) { + var thisTraces; + if(Array.isArray(attr)) { + var nAttr = Math.min(attr.length, gd.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 { + thisTraces = traces ? traces.slice(0) : null; + } - for(var i = 0; i < Math.min(sources.length, targets.length); i++) { - if(Lib.isIndex(sources[i], nodeLen) && Lib.isIndex(targets[i], nodeLen)) { - if(sources[i] === targets[i]) { - return true; // self-link which is also a scc of one + // Convert [7] to just 7 when traces is 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; + } } - nodes[sources[i]].push(targets[i]); + attr.length = Math.min(thisTraces.length, attr.length); } - } - var scc = tarjan(nodes); + bindings.push({ + type: 'data', + prop: path, + traces: thisTraces, + value: attr + }); + }, '', 0); - // Tarján's strongly connected components algorithm coded by Mikola Lysenko - // returns at least one non-singular component if there's circularity in the graph - return scc.components.some(function(c) { - return c.length > 1; - }); + return bindings; } -module.exports = function calc(gd, trace) { +function crawl(attrs, callback, path, depth) { + Object.keys(attrs).forEach(function(attrName) { + var attr = attrs[attrName]; - if(circularityPresent(trace.node.label, trace.link.source, trace.link.target)) { - Lib.error('Circularity is present in the Sankey data. Removing all nodes and links.'); - trace.link.label = []; - trace.link.source = []; - trace.link.target = []; - trace.link.value = []; - trace.link.color = []; - trace.node.label = []; - trace.node.color = []; - } + if(attrName[0] === '_') return; + + var thisPath = path + (depth > 0 ? '.' : '') + attrName; - return wrap({ - link: trace.link, - node: trace.node + if(Lib.isPlainObject(attr)) { + crawl(attr, callback, thisPath, depth + 1); + } else { + // Only execute the callback on leaf nodes: + callback(thisPath, attrName, attr); + } }); -}; +} -},{"../../lib":696,"../../lib/gup":693,"strongly-connected-components":506}],1037:[function(_dereq_,module,exports){ +},{"../lib":159,"../registry":243}],229:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -161048,114 +58622,106 @@ 'use strict'; -module.exports = { - nodeTextOffsetHorizontal: 4, - nodeTextOffsetVertical: 3, - nodePadAcross: 10, - sankeyIterations: 50, - forceIterations: 5, - forceTicksPerFrame: 10, - duration: 500, - ease: 'cubic-in-out', - cn: { - sankey: 'sankey', - sankeyLinks: 'sankey-links', - sankeyLink: 'sankey-link', - sankeyNodeSet: 'sankey-node-set', - sankeyNode: 'sankey-node', - nodeRect: 'node-rect', - nodeCapture: 'node-capture', - nodeCentered: 'node-entered', - nodeLabelGuide: 'node-label-guide', - nodeLabel: 'node-label', - nodeLabelTextPath: 'node-label-text-path' - } -}; +var extendFlat = _dereq_('../lib/extend').extendFlat; -},{}],1038:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var attributes = _dereq_('./attributes'); -var Color = _dereq_('../../components/color'); -var tinycolor = _dereq_('tinycolor2'); -var handleDomainDefaults = _dereq_('../../plots/domain').defaults; -var handleHoverLabelDefaults = _dereq_('../../components/fx/hoverlabel_defaults'); -var Template = _dereq_('../../plot_api/plot_template'); - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - var hoverlabelDefault = Lib.extendDeep(layout.hoverlabel, traceIn.hoverlabel); - - // node attributes - var nodeIn = traceIn.node, nodeOut = Template.newContainer(traceOut, 'node'); - function coerceNode(attr, dflt) { - return Lib.coerce(nodeIn, nodeOut, attributes.node, attr, dflt); - } - coerceNode('label'); - coerceNode('pad'); - coerceNode('thickness'); - coerceNode('line.color'); - coerceNode('line.width'); - coerceNode('hoverinfo', traceIn.hoverinfo); - handleHoverLabelDefaults(nodeIn, nodeOut, coerceNode, hoverlabelDefault); + * Make a xy domain attribute group + * + * @param {object} opts + * @param {string} + * opts.name: name to be inserted in the default description + * @param {boolean} + * opts.trace: set to true for trace containers + * @param {string} + * opts.editType: editType for all pieces + * @param {boolean} + * opts.noGridCell: set to true to omit `row` and `column` + * + * @param {object} extra + * @param {string} + * extra.description: extra description. N.B we use + * a separate extra container to make it compatible with + * the compress_attributes transform. + * + * @return {object} attributes object containing {x,y} as specified + */ +exports.attributes = function(opts, extra) { + opts = opts || {}; + extra = extra || {}; - var colors = layout.colorway; + 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 defaultNodePalette = function(i) {return colors[i % colors.length];}; + var namePart = opts.name ? opts.name + ' ' : ''; + var contPart = opts.trace ? 'trace ' : 'subplot '; + var descPart = extra.description ? ' ' + extra.description : ''; - coerceNode('color', nodeOut.label.map(function(d, i) { - return Color.addOpacity(defaultNodePalette(i), 0.8); - })); + var out = { + x: extendFlat({}, base, { + + }), + y: extendFlat({}, base, { + + }), + editType: opts.editType + }; - // link attributes - var linkIn = traceIn.link, linkOut = Template.newContainer(traceOut, 'link'); - function coerceLink(attr, dflt) { - return Lib.coerce(linkIn, linkOut, attributes.link, attr, dflt); - } - coerceLink('label'); - coerceLink('source'); - coerceLink('target'); - coerceLink('value'); - coerceLink('line.color'); - coerceLink('line.width'); - coerceLink('hoverinfo', traceIn.hoverinfo); - handleHoverLabelDefaults(linkIn, linkOut, coerceLink, hoverlabelDefault); - - var defaultLinkColor = tinycolor(layout.paper_bgcolor).getLuminance() < 0.333 ? - 'rgba(255, 255, 255, 0.6)' : - 'rgba(0, 0, 0, 0.2)'; + if(!opts.noGridCell) { + out.row = { + valType: 'integer', + min: 0, + dflt: 0, + + editType: opts.editType, + + }; + out.column = { + valType: 'integer', + min: 0, + dflt: 0, + + editType: opts.editType, + + }; + } - coerceLink('color', Lib.repeat(defaultLinkColor, linkOut.value.length)); + return out; +}; - handleDomainDefaults(traceOut, layout, coerce); +exports.defaults = function(containerOut, layout, coerce, dfltDomains) { + var dfltX = (dfltDomains && dfltDomains.x) || [0, 1]; + var dfltY = (dfltDomains && dfltDomains.y) || [0, 1]; - coerce('orientation'); - coerce('valueformat'); - coerce('valuesuffix'); - coerce('arrangement'); + var grid = layout.grid; + if(grid) { + var column = coerce('domain.column'); + if(column !== undefined) { + if(column < grid.columns) dfltX = grid._domains.x[column]; + else delete containerOut.domain.column; + } - Lib.coerceFont(coerce, 'textfont', Lib.extendFlat({}, layout.font)); + var row = coerce('domain.row'); + if(row !== undefined) { + if(row < grid.rows) dfltY = grid._domains.y[row]; + else delete containerOut.domain.row; + } + } - // disable 1D transforms - arrays here are 1D but their lengths/meanings - // don't match, between nodes and links - traceOut._length = null; + coerce('domain.x', dfltX); + coerce('domain.y', dfltY); }; -},{"../../components/color":570,"../../components/fx/hoverlabel_defaults":611,"../../lib":696,"../../plot_api/plot_template":734,"../../plots/domain":770,"./attributes":1034,"tinycolor2":514}],1039:[function(_dereq_,module,exports){ +},{"../lib/extend":153}],230:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -161164,26 +58730,63 @@ 'use strict'; -var Plot = {}; +/* + * make a font attribute group + * + * @param {object} opts + * @param {string} + * opts.description: where & how this font is used + * @param {optional bool} arrayOk: + * should each part (family, size, color) be arrayOk? default false. + * @param {string} editType: + * the editType for all pieces of this font + * @param {optional string} colorEditType: + * a separate editType just for color + * + * @return {object} attributes object containing {family, size, color} as specified + */ +module.exports = function(opts) { + var editType = opts.editType; + var colorEditType = opts.colorEditType; + if(colorEditType === undefined) colorEditType = editType; + var attrs = { + family: { + valType: 'string', + + noBlank: true, + strict: true, + editType: editType, + + }, + size: { + valType: 'number', + + min: 1, + editType: editType + }, + color: { + valType: 'color', + + editType: colorEditType + }, + editType: editType, + // blank strings so compress_attributes can remove + // TODO - that's uber hacky... better solution? + + }; -Plot.attributes = _dereq_('./attributes'); -Plot.supplyDefaults = _dereq_('./defaults'); -Plot.calc = _dereq_('./calc'); -Plot.plot = _dereq_('./plot'); + if(opts.arrayOk) { + attrs.family.arrayOk = true; + attrs.size.arrayOk = true; + attrs.color.arrayOk = true; + } -Plot.moduleType = 'trace'; -Plot.name = 'sankey'; -Plot.basePlotModule = _dereq_('./base_plot'); -Plot.categories = ['noOpacity']; -Plot.meta = { - + return attrs; }; -module.exports = Plot; - -},{"./attributes":1034,"./base_plot":1035,"./calc":1036,"./defaults":1038,"./plot":1040}],1040:[function(_dereq_,module,exports){ +},{}],231:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -161192,294 +58795,44 @@ 'use strict'; -var d3 = _dereq_('d3'); -var render = _dereq_('./render'); -var Fx = _dereq_('../../components/fx'); -var Color = _dereq_('../../components/color'); -var Lib = _dereq_('../../lib'); -var cn = _dereq_('./constants').cn; - -var _ = Lib._; - -function renderableValuePresent(d) {return d !== '';} - -function ownTrace(selection, d) { - return selection.filter(function(s) {return s.key === d.traceId;}); -} - -function makeTranslucent(element, alpha) { - d3.select(element) - .select('path') - .style('fill-opacity', alpha); - d3.select(element) - .select('rect') - .style('fill-opacity', alpha); -} - -function makeTextContrasty(element) { - d3.select(element) - .select('text.name') - .style('fill', 'black'); -} - -function relatedLinks(d) { - return function(l) { - return d.node.sourceLinks.indexOf(l.link) !== -1 || d.node.targetLinks.indexOf(l.link) !== -1; - }; -} - -function relatedNodes(l) { - return function(d) { - return d.node.sourceLinks.indexOf(l.link) !== -1 || d.node.targetLinks.indexOf(l.link) !== -1; - }; -} - -function nodeHoveredStyle(sankeyNode, d, sankey) { - if(d && sankey) { - ownTrace(sankey, d) - .selectAll('.' + cn.sankeyLink) - .filter(relatedLinks(d)) - .call(linkHoveredStyle.bind(0, d, sankey, false)); - } -} - -function nodeNonHoveredStyle(sankeyNode, d, sankey) { - if(d && sankey) { - ownTrace(sankey, d) - .selectAll('.' + cn.sankeyLink) - .filter(relatedLinks(d)) - .call(linkNonHoveredStyle.bind(0, d, sankey, false)); - } -} - -function linkHoveredStyle(d, sankey, visitNodes, sankeyLink) { - - var label = sankeyLink.datum().link.label; - - sankeyLink.style('fill-opacity', 0.4); - - if(label) { - ownTrace(sankey, d) - .selectAll('.' + cn.sankeyLink) - .filter(function(l) {return l.link.label === label;}) - .style('fill-opacity', 0.4); - } - - if(visitNodes) { - ownTrace(sankey, d) - .selectAll('.' + cn.sankeyNode) - .filter(relatedNodes(d)) - .call(nodeHoveredStyle); - } -} - -function linkNonHoveredStyle(d, sankey, visitNodes, sankeyLink) { - - var label = sankeyLink.datum().link.label; - - sankeyLink.style('fill-opacity', function(d) {return d.tinyColorAlpha;}); - - if(label) { - ownTrace(sankey, d) - .selectAll('.' + cn.sankeyLink) - .filter(function(l) {return l.link.label === label;}) - .style('fill-opacity', function(d) {return d.tinyColorAlpha;}); - } +module.exports = { + _isLinkedToArray: 'frames_entry', - if(visitNodes) { - ownTrace(sankey, d) - .selectAll(cn.sankeyNode) - .filter(relatedNodes(d)) - .call(nodeNonHoveredStyle); + group: { + valType: 'string', + + + }, + name: { + valType: 'string', + + + }, + traces: { + valType: 'any', + + + }, + baseframe: { + valType: 'string', + + + }, + data: { + valType: 'any', + + + }, + layout: { + valType: 'any', + + } -} - -// does not support array values for now -function castHoverOption(trace, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); - return Array.isArray(val) ? false : val; -} - -module.exports = function plot(gd, calcData) { - var fullLayout = gd._fullLayout; - var svg = fullLayout._paper; - var size = fullLayout._size; - - var linkSelect = function(element, d) { - var evt = d.link; - evt.originalEvent = d3.event; - gd._hoverdata = [evt]; - Fx.click(gd, { target: true }); - }; - - var linkHover = function(element, d, sankey) { - if(gd._fullLayout.hovermode === false) return; - d3.select(element).call(linkHoveredStyle.bind(0, d, sankey, true)); - if(d.link.trace.link.hoverinfo !== 'skip') { - gd.emit('plotly_hover', { - event: d3.event, - points: [d.link] - }); - } - - }; - - var sourceLabel = _(gd, 'source:') + ' '; - var targetLabel = _(gd, 'target:') + ' '; - var incomingLabel = _(gd, 'incoming flow count:') + ' '; - var outgoingLabel = _(gd, 'outgoing flow count:') + ' '; - - var linkHoverFollow = function(element, d) { - if(gd._fullLayout.hovermode === false) return; - var obj = d.link.trace.link; - if(obj.hoverinfo === 'none' || obj.hoverinfo === 'skip') return; - var rootBBox = gd._fullLayout._paperdiv.node().getBoundingClientRect(); - var boundingBox = element.getBoundingClientRect(); - var hoverCenterX = boundingBox.left + boundingBox.width / 2; - var hoverCenterY = boundingBox.top + boundingBox.height / 2; - - var tooltip = Fx.loneHover({ - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, - name: d3.format(d.valueFormat)(d.link.value) + d.valueSuffix, - text: [ - d.link.label || '', - sourceLabel + d.link.source.label, - targetLabel + d.link.target.label - ].filter(renderableValuePresent).join('
'), - color: castHoverOption(obj, 'bgcolor') || Color.addOpacity(d.tinyColorHue, 1), - borderColor: castHoverOption(obj, 'bordercolor'), - fontFamily: castHoverOption(obj, 'font.family'), - fontSize: castHoverOption(obj, 'font.size'), - fontColor: castHoverOption(obj, 'font.color'), - idealAlign: d3.event.x < hoverCenterX ? 'right' : 'left' - }, { - container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node(), - gd: gd - }); - - makeTranslucent(tooltip, 0.65); - makeTextContrasty(tooltip); - }; - - var linkUnhover = function(element, d, sankey) { - if(gd._fullLayout.hovermode === false) return; - d3.select(element).call(linkNonHoveredStyle.bind(0, d, sankey, true)); - if(d.link.trace.link.hoverinfo !== 'skip') { - gd.emit('plotly_unhover', { - event: d3.event, - points: [d.link] - }); - } - - Fx.loneUnhover(fullLayout._hoverlayer.node()); - }; - - var nodeSelect = function(element, d, sankey) { - var evt = d.node; - evt.originalEvent = d3.event; - gd._hoverdata = [evt]; - d3.select(element).call(nodeNonHoveredStyle, d, sankey); - Fx.click(gd, { target: true }); - }; - - var nodeHover = function(element, d, sankey) { - if(gd._fullLayout.hovermode === false) return; - d3.select(element).call(nodeHoveredStyle, d, sankey); - if(d.node.trace.node.hoverinfo !== 'skip') { - gd.emit('plotly_hover', { - event: d3.event, - points: [d.node] - }); - } - }; - - var nodeHoverFollow = function(element, d) { - if(gd._fullLayout.hovermode === false) return; - - var obj = d.node.trace.node; - if(obj.hoverinfo === 'none' || obj.hoverinfo === 'skip') return; - var nodeRect = d3.select(element).select('.' + cn.nodeRect); - var rootBBox = gd._fullLayout._paperdiv.node().getBoundingClientRect(); - var boundingBox = nodeRect.node().getBoundingClientRect(); - var hoverCenterX0 = boundingBox.left - 2 - rootBBox.left; - var hoverCenterX1 = boundingBox.right + 2 - rootBBox.left; - var hoverCenterY = boundingBox.top + boundingBox.height / 4 - rootBBox.top; - - var tooltip = Fx.loneHover({ - x0: hoverCenterX0, - x1: hoverCenterX1, - y: hoverCenterY, - name: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix, - text: [ - d.node.label, - incomingLabel + d.node.targetLinks.length, - outgoingLabel + d.node.sourceLinks.length - ].filter(renderableValuePresent).join('
'), - color: castHoverOption(obj, 'bgcolor') || d.tinyColorHue, - borderColor: castHoverOption(obj, 'bordercolor'), - fontFamily: castHoverOption(obj, 'font.family'), - fontSize: castHoverOption(obj, 'font.size'), - fontColor: castHoverOption(obj, 'font.color'), - idealAlign: 'left' - }, { - container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node(), - gd: gd - }); - - makeTranslucent(tooltip, 0.85); - makeTextContrasty(tooltip); - }; - - var nodeUnhover = function(element, d, sankey) { - if(gd._fullLayout.hovermode === false) return; - d3.select(element).call(nodeNonHoveredStyle, d, sankey); - if(d.node.trace.node.hoverinfo !== 'skip') { - gd.emit('plotly_unhover', { - event: d3.event, - points: [d.node] - }); - } - - Fx.loneUnhover(fullLayout._hoverlayer.node()); - }; - - render( - svg, - calcData, - { - width: size.w, - height: size.h, - margin: { - t: size.t, - r: size.r, - b: size.b, - l: size.l - } - }, - { - linkEvents: { - hover: linkHover, - follow: linkHoverFollow, - unhover: linkUnhover, - select: linkSelect - }, - nodeEvents: { - hover: nodeHover, - follow: nodeHoverFollow, - unhover: nodeUnhover, - select: nodeSelect - } - } - ); }; -},{"../../components/color":570,"../../components/fx":612,"../../lib":696,"./constants":1037,"./render":1041,"d3":148}],1041:[function(_dereq_,module,exports){ +},{}],232:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -161488,671 +58841,126 @@ 'use strict'; -var c = _dereq_('./constants'); -var d3 = _dereq_('d3'); -var tinycolor = _dereq_('tinycolor2'); -var Color = _dereq_('../../components/color'); -var Drawing = _dereq_('../../components/drawing'); -var d3sankey = _dereq_('@plotly/d3-sankey').sankey; -var d3Force = _dereq_('d3-force'); -var Lib = _dereq_('../../lib'); -var isArrayOrTypedArray = Lib.isArrayOrTypedArray; -var isIndex = Lib.isIndex; -var gup = _dereq_('../../lib/gup'); -var keyFun = gup.keyFun; -var repeat = gup.repeat; -var unwrap = gup.unwrap; - -// basic data utilities - -function persistOriginalPlace(nodes) { - var i, distinctLayerPositions = []; - for(i = 0; i < nodes.length; i++) { - nodes[i].originalX = nodes[i].x; - nodes[i].originalY = nodes[i].y; - if(distinctLayerPositions.indexOf(nodes[i].x) === -1) { - distinctLayerPositions.push(nodes[i].x); - } - } - distinctLayerPositions.sort(function(a, b) {return a - b;}); - for(i = 0; i < nodes.length; i++) { - nodes[i].originalLayerIndex = distinctLayerPositions.indexOf(nodes[i].originalX); - nodes[i].originalLayer = nodes[i].originalLayerIndex / (distinctLayerPositions.length - 1); - } -} - -function saveCurrentDragPosition(d) { - d.lastDraggedX = d.x; - d.lastDraggedY = d.y; -} - -function sameLayer(d) { - return function(n) {return n.node.originalX === d.node.originalX;}; -} - -function switchToForceFormat(nodes) { - // force uses x, y as centers - for(var i = 0; i < nodes.length; i++) { - nodes[i].y = nodes[i].y + nodes[i].dy / 2; - } -} - -function switchToSankeyFormat(nodes) { - // sankey uses x, y as top left - for(var i = 0; i < nodes.length; i++) { - nodes[i].y = nodes[i].y - nodes[i].dy / 2; - } -} - -// view models - -function sankeyModel(layout, d, traceIndex) { - var trace = unwrap(d).trace; - var domain = trace.domain; - var nodeSpec = trace.node; - var linkSpec = trace.link; - var arrangement = trace.arrangement; - var horizontal = trace.orientation === 'h'; - var nodePad = trace.node.pad; - var nodeThickness = trace.node.thickness; - var nodeLineColor = trace.node.line.color; - var nodeLineWidth = trace.node.line.width; - var linkLineColor = trace.link.line.color; - var linkLineWidth = trace.link.line.width; - var valueFormat = trace.valueformat; - var valueSuffix = trace.valuesuffix; - var textFont = trace.textfont; - - var width = layout.width * (domain.x[1] - domain.x[0]); - var height = layout.height * (domain.y[1] - domain.y[0]); - - var links = []; - var hasLinkColorArray = isArrayOrTypedArray(linkSpec.color); - var linkedNodes = {}; +var Registry = _dereq_('../registry'); +var SUBPLOT_PATTERN = _dereq_('./cartesian/constants').SUBPLOT_PATTERN; - var nodeCount = nodeSpec.label.length; - var i; - for(i = 0; i < linkSpec.value.length; i++) { - var val = linkSpec.value[i]; - // remove negative values, but keep zeros with special treatment - var source = linkSpec.source[i]; - var target = linkSpec.target[i]; - if(!(val > 0 && isIndex(source, nodeCount) && isIndex(target, nodeCount))) { - continue; - } +/** + * Get calcdata trace(s) associated with a given subplot + * + * @param {array} calcData: as in gd.calcdata + * @param {string} type: subplot type + * @param {string} subplotId: subplot id to look for + * + * @return {array} array of calcdata traces + */ +exports.getSubplotCalcData = function(calcData, type, subplotId) { + var basePlotModule = Registry.subplotsRegistry[type]; + if(!basePlotModule) return []; - source = +source; - target = +target; - linkedNodes[source] = linkedNodes[target] = true; - - links.push({ - pointNumber: i, - label: linkSpec.label[i], - color: hasLinkColorArray ? linkSpec.color[i] : linkSpec.color, - source: source, - target: target, - value: +val - }); - } + var attr = basePlotModule.attr; + var subplotCalcData = []; - var hasNodeColorArray = isArrayOrTypedArray(nodeSpec.color); - var nodes = []; - var removedNodes = false; - var nodeIndices = {}; - for(i = 0; i < nodeCount; i++) { - if(linkedNodes[i]) { - var l = nodeSpec.label[i]; - nodeIndices[i] = nodes.length; - nodes.push({ - pointNumber: i, - label: l, - color: hasNodeColorArray ? nodeSpec.color[i] : nodeSpec.color - }); - } - else removedNodes = true; - } + for(var i = 0; i < calcData.length; i++) { + var calcTrace = calcData[i]; + var trace = calcTrace[0].trace; - // need to re-index links now, since we didn't put all the nodes in - if(removedNodes) { - for(i = 0; i < links.length; i++) { - links[i].source = nodeIndices[links[i].source]; - links[i].target = nodeIndices[links[i].target]; - } + if(trace[attr] === subplotId) subplotCalcData.push(calcTrace); } - var sankey = d3sankey() - .size(horizontal ? [width, height] : [height, width]) - .nodeWidth(nodeThickness) - .nodePadding(nodePad) - .nodes(nodes) - .links(links) - .layout(c.sankeyIterations); + return subplotCalcData; +}; +/** + * Get calcdata trace(s) that can be plotted with a given module + * NOTE: this isn't necessarily just exactly matching trace type, + * if multiple trace types use the same plotting routine, they will be + * collected here. + * In order to not plot the same thing multiple times, we return two arrays, + * the calcdata we *will* plot with this module, and the ones we *won't* + * + * @param {array} calcdata: as in gd.calcdata + * @param {object|string|fn} arg1: + * the plotting module, or its name, or its plot method + * + * @return {array[array]} [foundCalcdata, remainingCalcdata] + */ +exports.getModuleCalcData = function(calcdata, arg1) { + var moduleCalcData = []; + var remainingCalcData = []; - if(sankey.nodePadding() < nodePad) { - Lib.warn('node.pad was reduced to ', sankey.nodePadding(), ' to fit within the figure.'); + var plotMethod; + if(typeof arg1 === 'string') { + plotMethod = Registry.getModule(arg1).plot; + } else if(typeof arg1 === 'function') { + plotMethod = arg1; + } else { + plotMethod = arg1.plot; } - - var node, sankeyNodes = sankey.nodes(); - for(var n = 0; n < sankeyNodes.length; n++) { - node = sankeyNodes[n]; - node.width = width; - node.height = height; + if(!plotMethod) { + return [moduleCalcData, calcdata]; } - switchToForceFormat(nodes); + for(var i = 0; i < calcdata.length; i++) { + var cd = calcdata[i]; + var trace = cd[0].trace; + // N.B. 'legendonly' traces do not make it past here + if(trace.visible !== true) continue; - return { - key: traceIndex, - trace: trace, - guid: Math.floor(1e12 * (1 + Math.random())), - horizontal: horizontal, - width: width, - height: height, - nodePad: nodePad, - nodeLineColor: nodeLineColor, - nodeLineWidth: nodeLineWidth, - linkLineColor: linkLineColor, - linkLineWidth: linkLineWidth, - valueFormat: valueFormat, - valueSuffix: valueSuffix, - textFont: textFont, - translateX: domain.x[0] * layout.width + layout.margin.l, - translateY: layout.height - domain.y[1] * layout.height + layout.margin.t, - dragParallel: horizontal ? height : width, - dragPerpendicular: horizontal ? width : height, - nodes: nodes, - links: links, - arrangement: arrangement, - sankey: sankey, - forceLayouts: {}, - interactionState: { - dragInProgress: false, - hovered: false + // group calcdata trace not by 'module' (as the name of this function + // would suggest), but by 'module plot method' so that if some traces + // share the same module plot method (e.g. bar and histogram), we + // only call it one! + if(trace._module.plot === plotMethod) { + moduleCalcData.push(cd); + } else { + remainingCalcData.push(cd); } - }; -} - -function linkModel(uniqueKeys, d, l) { - var tc = tinycolor(l.color); - var basicKey = l.source.label + '|' + l.target.label; - var foundKey = uniqueKeys[basicKey]; - uniqueKeys[basicKey] = (foundKey || 0) + 1; - var key = basicKey + '__' + uniqueKeys[basicKey]; - - // for event data - l.trace = d.trace; - l.curveNumber = d.trace.index; - - return { - key: key, - traceId: d.key, - link: l, - tinyColorHue: Color.tinyRGB(tc), - tinyColorAlpha: tc.getAlpha(), - linkLineColor: d.linkLineColor, - linkLineWidth: d.linkLineWidth, - valueFormat: d.valueFormat, - valueSuffix: d.valueSuffix, - sankey: d.sankey, - interactionState: d.interactionState - }; -} - -function nodeModel(uniqueKeys, d, n) { - var tc = tinycolor(n.color), - zoneThicknessPad = c.nodePadAcross, - zoneLengthPad = d.nodePad / 2, - visibleThickness = n.dx, - visibleLength = Math.max(0.5, n.dy); - - var basicKey = n.label; - var foundKey = uniqueKeys[basicKey]; - uniqueKeys[basicKey] = (foundKey || 0) + 1; - var key = basicKey + '__' + uniqueKeys[basicKey]; - - // for event data - n.trace = d.trace; - n.curveNumber = d.trace.index; - - return { - key: key, - traceId: d.key, - node: n, - nodePad: d.nodePad, - nodeLineColor: d.nodeLineColor, - nodeLineWidth: d.nodeLineWidth, - textFont: d.textFont, - size: d.horizontal ? d.height : d.width, - visibleWidth: Math.ceil(visibleThickness), - visibleHeight: visibleLength, - zoneX: -zoneThicknessPad, - zoneY: -zoneLengthPad, - zoneWidth: visibleThickness + 2 * zoneThicknessPad, - zoneHeight: visibleLength + 2 * zoneLengthPad, - labelY: d.horizontal ? n.dy / 2 + 1 : n.dx / 2 + 1, - left: n.originalLayer === 1, - sizeAcross: d.width, - forceLayouts: d.forceLayouts, - horizontal: d.horizontal, - darkBackground: tc.getBrightness() <= 128, - tinyColorHue: Color.tinyRGB(tc), - tinyColorAlpha: tc.getAlpha(), - valueFormat: d.valueFormat, - valueSuffix: d.valueSuffix, - sankey: d.sankey, - arrangement: d.arrangement, - uniqueNodeLabelPathId: [d.guid, d.key, key].join(' '), - interactionState: d.interactionState - }; -} - -// rendering snippets - -function updateNodePositions(sankeyNode) { - sankeyNode - .attr('transform', function(d) { - return 'translate(' + d.node.x.toFixed(3) + ', ' + (d.node.y - d.node.dy / 2).toFixed(3) + ')'; - }); -} - -function linkPath(d) { - var nodes = d.sankey.nodes(); - switchToSankeyFormat(nodes); - var result = d.sankey.link()(d.link); - switchToForceFormat(nodes); - return result; -} - -function updateNodeShapes(sankeyNode) { - sankeyNode.call(updateNodePositions); -} - -function updateShapes(sankeyNode, sankeyLink) { - sankeyNode.call(updateNodeShapes); - sankeyLink.attr('d', linkPath); -} - -function sizeNode(rect) { - rect.attr('width', function(d) {return d.visibleWidth;}) - .attr('height', function(d) {return d.visibleHeight;}); -} - -function salientEnough(d) {return d.link.dy > 1 || d.linkLineWidth > 0;} - -function sankeyTransform(d) { - var offset = 'translate(' + d.translateX + ',' + d.translateY + ')'; - return offset + (d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)'); -} - -function nodeCentering(d) { - return 'translate(' + (d.horizontal ? 0 : d.labelY) + ' ' + (d.horizontal ? d.labelY : 0) + ')'; -} - -function textGuidePath(d) { - return d3.svg.line()([ - [d.horizontal ? (d.left ? -d.sizeAcross : d.visibleWidth + c.nodeTextOffsetHorizontal) : c.nodeTextOffsetHorizontal, 0], - [d.horizontal ? (d.left ? - c.nodeTextOffsetHorizontal : d.sizeAcross) : d.visibleHeight - c.nodeTextOffsetHorizontal, 0] - ]);} - -function sankeyInverseTransform(d) {return d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)';} -function textFlip(d) {return d.horizontal ? 'scale(1 1)' : 'scale(-1 1)';} -function nodeTextColor(d) {return d.darkBackground && !d.horizontal ? 'rgb(255,255,255)' : 'rgb(0,0,0)';} -function nodeTextOffset(d) {return d.horizontal && d.left ? '100%' : '0%';} - -// event handling - -function attachPointerEvents(selection, sankey, eventSet) { - selection - .on('.basic', null) // remove any preexisting handlers - .on('mouseover.basic', function(d) { - if(!d.interactionState.dragInProgress) { - eventSet.hover(this, d, sankey); - d.interactionState.hovered = [this, d]; - } - }) - .on('mousemove.basic', function(d) { - if(!d.interactionState.dragInProgress) { - eventSet.follow(this, d); - d.interactionState.hovered = [this, d]; - } - }) - .on('mouseout.basic', function(d) { - if(!d.interactionState.dragInProgress) { - eventSet.unhover(this, d, sankey); - d.interactionState.hovered = false; - } - }) - .on('click.basic', function(d) { - if(d.interactionState.hovered) { - eventSet.unhover(this, d, sankey); - d.interactionState.hovered = false; - } - if(!d.interactionState.dragInProgress) { - eventSet.select(this, d, sankey); - } - }); -} - -function attachDragHandler(sankeyNode, sankeyLink, callbacks) { - - var dragBehavior = d3.behavior.drag() - - .origin(function(d) {return d.node;}) - - .on('dragstart', function(d) { - if(d.arrangement === 'fixed') return; - Lib.raiseToTop(this); - d.interactionState.dragInProgress = d.node; - saveCurrentDragPosition(d.node); - if(d.interactionState.hovered) { - callbacks.nodeEvents.unhover.apply(0, d.interactionState.hovered); - d.interactionState.hovered = false; - } - if(d.arrangement === 'snap') { - var forceKey = d.traceId + '|' + Math.floor(d.node.originalX); - if(d.forceLayouts[forceKey]) { - d.forceLayouts[forceKey].alpha(1); - } else { // make a forceLayout iff needed - attachForce(sankeyNode, forceKey, d); - } - startForce(sankeyNode, sankeyLink, d, forceKey); - } - }) + } - .on('drag', function(d) { - if(d.arrangement === 'fixed') return; - var x = d3.event.x; - var y = d3.event.y; - if(d.arrangement === 'snap') { - d.node.x = x; - d.node.y = y; - } else { - if(d.arrangement === 'freeform') { - d.node.x = x; - } - d.node.y = Math.max(d.node.dy / 2, Math.min(d.size - d.node.dy / 2, y)); - } - saveCurrentDragPosition(d.node); - if(d.arrangement !== 'snap') { - d.sankey.relayout(); - updateShapes(sankeyNode.filter(sameLayer(d)), sankeyLink); - } - }) + return [moduleCalcData, remainingCalcData]; +}; - .on('dragend', function(d) { - d.interactionState.dragInProgress = false; - }); +/** + * Get the data trace(s) associated with a given subplot. + * + * @param {array} data plotly full data array. + * @param {string} type subplot type to look for. + * @param {string} subplotId subplot id to look for. + * + * @return {array} list of trace objects. + * + */ +exports.getSubplotData = function getSubplotData(data, type, subplotId) { + if(!Registry.subplotsRegistry[type]) return []; - sankeyNode - .on('.drag', null) // remove possible previous handlers - .call(dragBehavior); -} + var attr = Registry.subplotsRegistry[type].attr; + var subplotData = []; + var trace, subplotX, subplotY; -function attachForce(sankeyNode, forceKey, d) { - var nodes = d.sankey.nodes().filter(function(n) {return n.originalX === d.node.originalX;}); - d.forceLayouts[forceKey] = d3Force.forceSimulation(nodes) - .alphaDecay(0) - .force('collide', d3Force.forceCollide() - .radius(function(n) {return n.dy / 2 + d.nodePad / 2;}) - .strength(1) - .iterations(c.forceIterations)) - .force('constrain', snappingForce(sankeyNode, forceKey, nodes, d)) - .stop(); -} + if(type === 'gl2d') { + var spmatch = subplotId.match(SUBPLOT_PATTERN); + subplotX = 'x' + spmatch[1]; + subplotY = 'y' + spmatch[2]; + } -function startForce(sankeyNode, sankeyLink, d, forceKey) { - window.requestAnimationFrame(function faster() { - for(var i = 0; i < c.forceTicksPerFrame; i++) { - d.forceLayouts[forceKey].tick(); - } - d.sankey.relayout(); - updateShapes(sankeyNode.filter(sameLayer(d)), sankeyLink); - if(d.forceLayouts[forceKey].alpha() > 0) { - window.requestAnimationFrame(faster); - } - }); -} + for(var i = 0; i < data.length; i++) { + trace = data[i]; -function snappingForce(sankeyNode, forceKey, nodes, d) { - return function _snappingForce() { - var maxVelocity = 0; - for(var i = 0; i < nodes.length; i++) { - var n = nodes[i]; - if(n === d.interactionState.dragInProgress) { // constrain node position to the dragging pointer - n.x = n.lastDraggedX; - n.y = n.lastDraggedY; - } else { - n.vx = (n.originalX - n.x) / c.forceTicksPerFrame; // snap to layer - n.y = Math.min(d.size - n.dy / 2, Math.max(n.dy / 2, n.y)); // constrain to extent + if(type === 'gl2d' && Registry.traceIs(trace, 'gl2d')) { + if(trace[attr[0]] === subplotX && trace[attr[1]] === subplotY) { + subplotData.push(trace); } - maxVelocity = Math.max(maxVelocity, Math.abs(n.vx), Math.abs(n.vy)); } - if(!d.interactionState.dragInProgress && maxVelocity < 0.1 && d.forceLayouts[forceKey].alpha() > 0) { - d.forceLayouts[forceKey].alpha(0); + else { + if(trace[attr] === subplotId) subplotData.push(trace); } - }; -} - -// scene graph -module.exports = function(svg, styledData, layout, callbacks) { - var sankey = svg.selectAll('.' + c.cn.sankey) - .data(styledData - .filter(function(d) {return unwrap(d).trace.visible;}) - .map(sankeyModel.bind(null, layout)), - keyFun); - - sankey.exit() - .remove(); - - sankey.enter() - .append('g') - .classed(c.cn.sankey, true) - .style('box-sizing', 'content-box') - .style('position', 'absolute') - .style('left', 0) - .style('shape-rendering', 'geometricPrecision') - .style('pointer-events', 'auto') - .attr('transform', sankeyTransform); - - sankey.transition() - .ease(c.ease).duration(c.duration) - .attr('transform', sankeyTransform); - - var sankeyLinks = sankey.selectAll('.' + c.cn.sankeyLinks) - .data(repeat, keyFun); - - sankeyLinks.enter() - .append('g') - .classed(c.cn.sankeyLinks, true) - .style('fill', 'none'); - - var sankeyLink = sankeyLinks.selectAll('.' + c.cn.sankeyLink) - .data(function(d) { - var uniqueKeys = {}; - return d.sankey.links() - .filter(function(l) {return l.value;}) - .map(linkModel.bind(null, uniqueKeys, d)); - }, keyFun); - - sankeyLink.enter() - .append('path') - .classed(c.cn.sankeyLink, true) - .attr('d', linkPath) - .call(attachPointerEvents, sankey, callbacks.linkEvents); - - sankeyLink - .style('stroke', function(d) { - return salientEnough(d) ? Color.tinyRGB(tinycolor(d.linkLineColor)) : d.tinyColorHue; - }) - .style('stroke-opacity', function(d) { - return salientEnough(d) ? Color.opacity(d.linkLineColor) : d.tinyColorAlpha; - }) - .style('stroke-width', function(d) {return salientEnough(d) ? d.linkLineWidth : 1;}) - .style('fill', function(d) {return d.tinyColorHue;}) - .style('fill-opacity', function(d) {return d.tinyColorAlpha;}); - - sankeyLink.transition() - .ease(c.ease).duration(c.duration) - .attr('d', linkPath); - - sankeyLink.exit().transition() - .ease(c.ease).duration(c.duration) - .style('opacity', 0) - .remove(); - - var sankeyNodeSet = sankey.selectAll('.' + c.cn.sankeyNodeSet) - .data(repeat, keyFun); - - sankeyNodeSet.enter() - .append('g') - .classed(c.cn.sankeyNodeSet, true); - - sankeyNodeSet - .style('cursor', function(d) { - switch(d.arrangement) { - case 'fixed': return 'default'; - case 'perpendicular': return 'ns-resize'; - default: return 'move'; - } - }); - - var sankeyNode = sankeyNodeSet.selectAll('.' + c.cn.sankeyNode) - .data(function(d) { - var nodes = d.sankey.nodes(); - var uniqueKeys = {}; - persistOriginalPlace(nodes); - return nodes - .filter(function(n) {return n.value;}) - .map(nodeModel.bind(null, uniqueKeys, d)); - }, keyFun); - - sankeyNode.enter() - .append('g') - .classed(c.cn.sankeyNode, true) - .call(updateNodePositions) - .call(attachPointerEvents, sankey, callbacks.nodeEvents); - - sankeyNode - .call(attachDragHandler, sankeyLink, callbacks); // has to be here as it binds sankeyLink - - sankeyNode.transition() - .ease(c.ease).duration(c.duration) - .call(updateNodePositions); - - sankeyNode.exit().transition() - .ease(c.ease).duration(c.duration) - .style('opacity', 0) - .remove(); - - var nodeRect = sankeyNode.selectAll('.' + c.cn.nodeRect) - .data(repeat); - - nodeRect.enter() - .append('rect') - .classed(c.cn.nodeRect, true) - .call(sizeNode); - - nodeRect - .style('stroke-width', function(d) {return d.nodeLineWidth;}) - .style('stroke', function(d) {return Color.tinyRGB(tinycolor(d.nodeLineColor));}) - .style('stroke-opacity', function(d) {return Color.opacity(d.nodeLineColor);}) - .style('fill', function(d) {return d.tinyColorHue;}) - .style('fill-opacity', function(d) {return d.tinyColorAlpha;}); - - nodeRect.transition() - .ease(c.ease).duration(c.duration) - .call(sizeNode); - - var nodeCapture = sankeyNode.selectAll('.' + c.cn.nodeCapture) - .data(repeat); - - nodeCapture.enter() - .append('rect') - .classed(c.cn.nodeCapture, true) - .style('fill-opacity', 0); - - nodeCapture - .attr('x', function(d) {return d.zoneX;}) - .attr('y', function(d) {return d.zoneY;}) - .attr('width', function(d) {return d.zoneWidth;}) - .attr('height', function(d) {return d.zoneHeight;}); - - var nodeCentered = sankeyNode.selectAll('.' + c.cn.nodeCentered) - .data(repeat); - - nodeCentered.enter() - .append('g') - .classed(c.cn.nodeCentered, true) - .attr('transform', nodeCentering); - - nodeCentered - .transition() - .ease(c.ease).duration(c.duration) - .attr('transform', nodeCentering); - - var nodeLabelGuide = nodeCentered.selectAll('.' + c.cn.nodeLabelGuide) - .data(repeat); - - nodeLabelGuide.enter() - .append('path') - .classed(c.cn.nodeLabelGuide, true) - .attr('id', function(d) {return d.uniqueNodeLabelPathId;}) - .attr('d', textGuidePath) - .attr('transform', sankeyInverseTransform); - - nodeLabelGuide - .transition() - .ease(c.ease).duration(c.duration) - .attr('d', textGuidePath) - .attr('transform', sankeyInverseTransform); - - var nodeLabel = nodeCentered.selectAll('.' + c.cn.nodeLabel) - .data(repeat); - - nodeLabel.enter() - .append('text') - .classed(c.cn.nodeLabel, true) - .attr('transform', textFlip) - .style('user-select', 'none') - .style('cursor', 'default') - .style('fill', 'black'); - - nodeLabel - .style('text-shadow', function(d) { - return d.horizontal ? '-1px 1px 1px #fff, 1px 1px 1px #fff, 1px -1px 1px #fff, -1px -1px 1px #fff' : 'none'; - }) - .each(function(d) {Drawing.font(nodeLabel, d.textFont);}); + } - nodeLabel - .transition() - .ease(c.ease).duration(c.duration) - .attr('transform', textFlip); - - var nodeLabelTextPath = nodeLabel.selectAll('.' + c.cn.nodeLabelTextPath) - .data(repeat); - - nodeLabelTextPath.enter() - .append('textPath') - .classed(c.cn.nodeLabelTextPath, true) - .attr('alignment-baseline', 'middle') - .attr('xlink:href', function(d) {return '#' + d.uniqueNodeLabelPathId;}) - .attr('startOffset', nodeTextOffset) - .style('fill', nodeTextColor); - - nodeLabelTextPath - .text(function(d) {return d.horizontal || d.node.dy > 5 ? d.node.label : '';}) - .attr('text-anchor', function(d) {return d.horizontal && d.left ? 'end' : 'start';}); - - nodeLabelTextPath - .transition() - .ease(c.ease).duration(c.duration) - .attr('startOffset', nodeTextOffset) - .style('fill', nodeTextColor); + return subplotData; }; -},{"../../components/color":570,"../../components/drawing":595,"../../lib":696,"../../lib/gup":693,"./constants":1037,"@plotly/d3-sankey":46,"d3":148,"d3-force":144,"tinycolor2":514}],1042:[function(_dereq_,module,exports){ +},{"../registry":243,"./cartesian/constants":209}],233:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -162162,49 +58970,31 @@ 'use strict'; -var Lib = _dereq_('../../lib'); - - -// arrayOk attributes, merge them into calcdata array -module.exports = function arraysToCalcdata(cd, trace) { - - // so each point knows which index it originally came from - for(var i = 0; i < cd.length; i++) cd[i].i = i; +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; - Lib.mergeArray(trace.text, cd, 'tx'); - Lib.mergeArray(trace.hovertext, cd, 'htx'); - Lib.mergeArray(trace.customdata, cd, 'data'); - Lib.mergeArray(trace.textposition, cd, 'tp'); - if(trace.textfont) { - Lib.mergeArray(trace.textfont.size, cd, 'ts'); - Lib.mergeArray(trace.textfont.color, cd, 'tc'); - Lib.mergeArray(trace.textfont.family, cd, 'tf'); + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } } - var marker = trace.marker; - if(marker) { - Lib.mergeArray(marker.size, cd, 'ms'); - Lib.mergeArray(marker.opacity, cd, 'mo'); - Lib.mergeArray(marker.symbol, cd, 'mx'); - Lib.mergeArray(marker.color, cd, 'mc'); + return out; +} - var markerLine = marker.line; - if(marker.line) { - Lib.mergeArray(markerLine.color, cd, 'mlc'); - Lib.mergeArray(markerLine.width, cd, 'mlw'); - } +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} - var markerGradient = marker.gradient; - if(markerGradient && markerGradient.type !== 'none') { - Lib.mergeArray(markerGradient.type, cd, 'mgt'); - Lib.mergeArray(markerGradient.color, cd, 'mgc'); - } - } -}; +module.exports = project; -},{"../../lib":696}],1043:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -162213,3261 +59003,3481 @@ 'use strict'; -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var fontAttrs = _dereq_('../../plots/font_attributes'); -var dash = _dereq_('../../components/drawing/attributes').dash; +var fontAttrs = _dereq_('./font_attributes'); +var animationAttrs = _dereq_('./animation_attributes'); +var colorAttrs = _dereq_('../components/color/attributes'); +var colorscaleAttrs = _dereq_('../components/colorscale/layout_attributes'); +var padAttrs = _dereq_('./pad_attributes'); +var extendFlat = _dereq_('../lib/extend').extendFlat; -var Drawing = _dereq_('../../components/drawing'); -var constants = _dereq_('./constants'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; +var globalFont = fontAttrs({ + editType: 'calc', + +}); +globalFont.family.dflt = '"Open Sans", verdana, arial, sans-serif'; +globalFont.size.dflt = 12; +globalFont.color.dflt = colorAttrs.defaultLine; module.exports = { - x: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - + font: globalFont, + title: { + text: { + valType: 'string', + + editType: 'layoutstyle', + + }, + font: fontAttrs({ + editType: 'layoutstyle', + + }), + xref: { + valType: 'enumerated', + dflt: 'container', + values: ['container', 'paper'], + + editType: 'layoutstyle', + + }, + yref: { + valType: 'enumerated', + dflt: 'container', + values: ['container', 'paper'], + + editType: 'layoutstyle', + + }, + x: { + valType: 'number', + min: 0, + max: 1, + dflt: 0.5, + + editType: 'layoutstyle', + + }, + y: { + valType: 'number', + min: 0, + max: 1, + dflt: 'auto', + + editType: 'layoutstyle', + + }, + xanchor: { + valType: 'enumerated', + dflt: 'auto', + values: ['auto', 'left', 'center', 'right'], + + editType: 'layoutstyle', + + }, + yanchor: { + valType: 'enumerated', + dflt: 'auto', + values: ['auto', 'top', 'middle', 'bottom'], + + editType: 'layoutstyle', + + }, + pad: extendFlat(padAttrs({editType: 'layoutstyle'}), { + + }), + editType: 'layoutstyle' }, - x0: { - valType: 'any', - dflt: 0, + autosize: { + valType: 'boolean', - editType: 'calc+clearAxisTypes', + dflt: false, + // autosize, width, and height get special editType treatment in _relayout + // so we can handle noop resizes more efficiently + editType: 'none', }, - dx: { + width: { valType: 'number', - dflt: 1, - editType: 'calc', + min: 10, + dflt: 700, + editType: 'plot', }, - y: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', + height: { + valType: 'number', + + min: 10, + dflt: 450, + editType: 'plot', }, - y0: { - valType: 'any', - dflt: 0, + margin: { + l: { + valType: 'number', + + min: 0, + dflt: 80, + editType: 'plot', + + }, + r: { + valType: 'number', + + min: 0, + dflt: 80, + editType: 'plot', + + }, + t: { + valType: 'number', + + min: 0, + dflt: 100, + editType: 'plot', + + }, + b: { + valType: 'number', + + min: 0, + dflt: 80, + editType: 'plot', + + }, + pad: { + valType: 'number', + + min: 0, + dflt: 0, + editType: 'plot', + + }, + autoexpand: { + valType: 'boolean', + + dflt: true, + editType: 'plot' + }, + editType: 'plot' + }, + paper_bgcolor: { + valType: 'color', - editType: 'calc+clearAxisTypes', + dflt: colorAttrs.background, + editType: 'plot', }, - dy: { - valType: 'number', - dflt: 1, + plot_bgcolor: { + // defined here, but set in cartesian.supplyLayoutDefaults + // because it needs to know if there are (2D) axes or not + valType: 'color', - editType: 'calc', + dflt: colorAttrs.background, + editType: 'layoutstyle', }, - - stackgroup: { + separators: { valType: 'string', - dflt: '', - editType: 'calc', + editType: 'plot', }, - orientation: { - valType: 'enumerated', + hidesources: { + valType: 'boolean', - values: ['v', 'h'], - editType: 'calc', + dflt: false, + editType: 'plot', }, - groupnorm: { - valType: 'enumerated', - values: ['', 'fraction', 'percent'], - dflt: '', + showlegend: { + // handled in legend.supplyLayoutDefaults + // but included here because it's not in the legend object + valType: 'boolean', - editType: 'calc', + editType: 'legend', }, - stackgaps: { - valType: 'enumerated', - values: ['infer zero', 'interpolate'], - dflt: 'infer zero', + colorway: { + valType: 'colorlist', + dflt: colorAttrs.defaults, editType: 'calc', }, - - text: { - valType: 'string', + colorscale: colorscaleAttrs, + datarevision: { + valType: 'any', - dflt: '', - arrayOk: true, editType: 'calc', }, - hovertext: { - valType: 'string', + uirevision: { + valType: 'any', - dflt: '', - arrayOk: true, - editType: 'style', + editType: 'none', }, - mode: { - valType: 'flaglist', - flags: ['lines', 'markers', 'text'], - extras: ['none'], + editrevision: { + valType: 'any', - editType: 'calc', + editType: 'none', }, - hoveron: { - valType: 'flaglist', - flags: ['points', 'fills'], + selectionrevision: { + valType: 'any', - editType: 'style', + editType: 'none', }, - line: { - color: { - valType: 'color', + template: { + valType: 'any', + + editType: 'calc', + + }, + modebar: { + orientation: { + valType: 'enumerated', + values: ['v', 'h'], + dflt: 'h', - editType: 'style', + editType: 'modebar', }, - width: { - valType: 'number', - min: 0, - dflt: 2, + bgcolor: { + valType: 'color', - editType: 'style', + editType: 'modebar', }, - shape: { - valType: 'enumerated', - values: ['linear', 'spline', 'hv', 'vh', 'hvh', 'vhv'], - dflt: 'linear', + color: { + valType: 'color', - editType: 'plot', + editType: 'modebar', }, - smoothing: { - valType: 'number', - min: 0, - max: 1.3, - dflt: 1, + activecolor: { + valType: 'color', - editType: 'plot', + editType: 'modebar', }, - dash: extendFlat({}, dash, {editType: 'style'}), - simplify: { - valType: 'boolean', - dflt: true, + uirevision: { + valType: 'any', - editType: 'plot', + editType: 'none', }, - editType: 'plot' + editType: 'modebar' }, - connectgaps: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - cliponaxis: { - valType: 'boolean', - dflt: true, - + meta: { + valType: 'data_array', editType: 'plot', }, - fill: { - valType: 'enumerated', - values: ['none', 'tozeroy', 'tozerox', 'tonexty', 'tonextx', 'toself', 'tonext'], - - editType: 'calc', - - }, - fillcolor: { - valType: 'color', - - editType: 'style', + transition: extendFlat({}, animationAttrs.transition, { - }, - marker: extendFlat({ - symbol: { - valType: 'enumerated', - values: Drawing.symbolList, - dflt: 'circle', - arrayOk: true, + editType: 'none' + }), + + _deprecated: { + title: { + valType: 'string', - editType: 'style', + editType: 'layoutstyle', }, - opacity: { - valType: 'number', - min: 0, - max: 1, - arrayOk: true, - - editType: 'style', + titlefont: fontAttrs({ + editType: 'layoutstyle', - }, - size: { + }) + } +}; + +},{"../components/color/attributes":42,"../components/colorscale/layout_attributes":56,"../lib/extend":153,"./animation_attributes":198,"./font_attributes":230,"./pad_attributes":235}],235:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +/** + * Creates a set of padding attributes. + * + * @param {object} opts + * @param {string} editType: + * the editType for all pieces of this padding definition + * + * @return {object} attributes object containing {t, r, b, l} as specified + */ +module.exports = function(opts) { + var editType = opts.editType; + return { + t: { valType: 'number', - min: 0, - dflt: 6, - arrayOk: true, + dflt: 0, - editType: 'calc', + editType: editType, }, - maxdisplayed: { + r: { valType: 'number', - min: 0, dflt: 0, - editType: 'plot', + editType: editType, }, - sizeref: { + b: { valType: 'number', - dflt: 1, + dflt: 0, - editType: 'calc', + editType: editType, }, - sizemin: { + l: { valType: 'number', - min: 0, dflt: 0, - editType: 'calc', - - }, - sizemode: { - valType: 'enumerated', - values: ['diameter', 'area'], - dflt: 'diameter', - - editType: 'calc', + editType: editType, }, + editType: editType + }; +}; - colorbar: colorbarAttrs, +},{}],236:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - line: extendFlat({ - width: { - valType: 'number', - min: 0, - arrayOk: true, - - editType: 'style', - - }, - editType: 'calc' - }, - colorAttributes('marker.line') - ), - gradient: { - type: { - valType: 'enumerated', - values: ['radial', 'horizontal', 'vertical', 'none'], - arrayOk: true, - dflt: 'none', - - editType: 'calc', - - }, - color: { - valType: 'color', - arrayOk: true, - - editType: 'calc', - - }, - editType: 'calc' - }, - editType: 'calc' - }, - colorAttributes('marker') - ), - selected: { - marker: { - opacity: { - valType: 'number', - min: 0, - max: 1, - - editType: 'style', - - }, - color: { - valType: 'color', - - editType: 'style', - - }, - size: { - valType: 'number', - min: 0, - - editType: 'style', - - }, - editType: 'style' - }, - textfont: { - color: { - valType: 'color', - - editType: 'style', - - }, - editType: 'style' - }, - editType: 'style' - }, - unselected: { - marker: { - opacity: { - valType: 'number', - min: 0, - max: 1, - - editType: 'style', - - }, - color: { - valType: 'color', - - editType: 'style', - - }, - size: { - valType: 'number', - min: 0, - - editType: 'style', - - }, - editType: 'style' - }, - textfont: { - color: { - valType: 'color', - - editType: 'style', - - }, - 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', - - }, - textfont: fontAttrs({ - editType: 'calc', - colorEditType: 'style', - arrayOk: true, - - }), +'use strict'; + +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); + +var Registry = _dereq_('../registry'); +var PlotSchema = _dereq_('../plot_api/plot_schema'); +var Template = _dereq_('../plot_api/plot_template'); +var Lib = _dereq_('../lib'); +var Color = _dereq_('../components/color'); +var BADNUM = _dereq_('../constants/numerical').BADNUM; + +var axisIDs = _dereq_('../plots/cartesian/axis_ids'); + +var animationAttrs = _dereq_('./animation_attributes'); +var frameAttrs = _dereq_('./frame_attributes'); + +var relinkPrivateKeys = Lib.relinkPrivateKeys; +var _ = Lib._; + +var plots = module.exports = {}; + +// Expose registry methods on Plots for backward-compatibility +Lib.extendFlat(plots, Registry); + +plots.attributes = _dereq_('./attributes'); +plots.attributes.type.values = plots.allTypes; +plots.fontAttrs = _dereq_('./font_attributes'); +plots.layoutAttributes = _dereq_('./layout_attributes'); + +// TODO make this a plot attribute? +plots.fontWeight = 'normal'; + +var transformsRegistry = plots.transformsRegistry; + +var commandModule = _dereq_('./command'); +plots.executeAPICommand = commandModule.executeAPICommand; +plots.computeAPICommandBindings = commandModule.computeAPICommandBindings; +plots.manageCommandObserver = commandModule.manageCommandObserver; +plots.hasSimpleAPICommandBindings = commandModule.hasSimpleAPICommandBindings; + +// in some cases the browser doesn't seem to know how big +// the text is at first, so it needs to draw it, +// then wait a little, then draw it again +plots.redrawText = function(gd) { + gd = Lib.getGraphDiv(gd); + + // do not work if polar is present + if((gd.data && gd.data[0] && gd.data[0].r)) return; + + return new Promise(function(resolve) { + setTimeout(function() { + Registry.getComponentMethod('annotations', 'draw')(gd); + Registry.getComponentMethod('legend', 'draw')(gd); + + (gd.calcdata || []).forEach(function(d) { + if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb(); + }); + + resolve(plots.previousPromises(gd)); + }, 300); + }); +}; + +// resize plot about the container size +plots.resize = function(gd) { + gd = Lib.getGraphDiv(gd); + + return new Promise(function(resolve, reject) { + + function isHidden(gd) { + var display = window.getComputedStyle(gd).display; + return !display || display === 'none'; + } + + if(!gd || isHidden(gd)) { + reject(new Error('Resize must be passed a displayed plot div element.')); + } + + if(gd._redrawTimer) clearTimeout(gd._redrawTimer); + + gd._redrawTimer = setTimeout(function() { + // return if there is nothing to resize or is hidden + if(!gd.layout || (gd.layout.width && gd.layout.height) || isHidden(gd)) { + resolve(gd); + return; + } + + delete gd.layout.width; + delete gd.layout.height; - r: { - valType: 'data_array', - editType: 'calc', - - }, - t: { - valType: 'data_array', - editType: 'calc', - + // autosizing doesn't count as a change that needs saving + var oldchanged = gd.changed; + + // nor should it be included in the undo queue + gd.autoplay = true; + + Registry.call('relayout', gd, {autosize: true}).then(function() { + gd.changed = oldchanged; + resolve(gd); + }); + }, 100); + }); +}; + + +// for use in Lib.syncOrAsync, check if there are any +// pending promises in this plot and wait for them +plots.previousPromises = function(gd) { + if((gd._promises || []).length) { + return Promise.all(gd._promises) + .then(function() { gd._promises = []; }); } }; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../components/drawing":595,"../../components/drawing/attributes":594,"../../lib/extend":685,"../../plots/font_attributes":771,"./constants":1047}],1044:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * Adds the 'Edit chart' link. + * Note that now Plotly.plot() calls this so it can regenerate whenever it replots + * + * Add source links to your graph inside the 'showSources' config argument. + */ +plots.addLinks = function(gd) { + // Do not do anything if showLink and showSources are not set to true in config + if(!gd._context.showLink && !gd._context.showSources) return; -'use strict'; + var fullLayout = gd._fullLayout; -var isNumeric = _dereq_('fast-isnumeric'); -var Lib = _dereq_('../../lib'); + 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 Axes = _dereq_('../../plots/cartesian/axes'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; + // The text node inside svg + var text = linkContainer.node(); + var attrs = {y: fullLayout._paper.attr('height') - 9}; -var subTypes = _dereq_('./subtypes'); -var calcColorscale = _dereq_('./colorscale_calc'); -var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); -var calcSelection = _dereq_('./calc_selection'); + // If text's width is bigger than the layout + // Check that text is a child node or document.body + // because otherwise IE/Edge might throw an exception + // when calling getComputedTextLength(). + // Apparently offsetParent is null for invisibles. + if(document.body.contains(text) && text.getComputedTextLength() >= (fullLayout.width - 20)) { + // Align the text at the left + attrs['text-anchor'] = 'start'; + attrs.x = 5; + } + else { + // Align the text at the right + attrs['text-anchor'] = 'end'; + attrs.x = fullLayout._paper.attr('width') - 7; + } -function calc(gd, trace) { - var fullLayout = gd._fullLayout; - var xa = Axes.getFromId(gd, trace.xaxis || 'x'); - var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); - var serieslen = trace._length; - var cd = new Array(serieslen); - var ids = trace.ids; - var stackGroupOpts = getStackOpts(trace, fullLayout, xa, ya); - var interpolateGaps = false; - var isV, i, j, k, interpolate, vali; + linkContainer.attr(attrs); - setFirstScatter(fullLayout, trace); + var toolspan = linkContainer.select('.js-link-to-tool'); + var spacespan = linkContainer.select('.js-link-spacer'); + var sourcespan = linkContainer.select('.js-sourcelinks'); - var xAttr = 'x'; - var yAttr = 'y'; - var posAttr; - if(stackGroupOpts) { - stackGroupOpts.traceIndices.push(trace.index); - isV = stackGroupOpts.orientation === 'v'; - // size, like we use for bar - if(isV) { - yAttr = 's'; - posAttr = 'x'; - } - else { - xAttr = 's'; - posAttr = 'y'; - } - interpolate = stackGroupOpts.stackgaps === 'interpolate'; + if(gd._context.showSources) gd._context.showSources(gd); + + // 'view in plotly' link for embedded plots + if(gd._context.showLink) positionPlayWithData(gd, toolspan); + + // separator if we have both sources and tool link + spacespan.text((toolspan.text() && sourcespan.text()) ? ' - ' : ''); +}; + +// note that now this function is only adding the brand in +// iframes and 3rd-party apps +function positionPlayWithData(gd, container) { + container.text(''); + var link = container.append('a') + .attr({ + 'xlink:xlink:href': '#', + 'class': 'link--impt link--embedview', + 'font-weight': 'bold' + }) + .text(gd._context.linkText + ' ' + String.fromCharCode(187)); + + if(gd._context.sendData) { + link.on('click', function() { + plots.sendDataToCloud(gd); + }); } else { - var ppad = calcMarkerSize(trace, serieslen); - calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); + 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 + }); } +} - for(i = 0; i < serieslen; i++) { - var cdi = cd[i] = {}; - var xValid = isNumeric(x[i]); - var yValid = isNumeric(y[i]); - if(xValid && yValid) { - cdi[xAttr] = x[i]; - cdi[yAttr] = y[i]; - } - // if we're stacking we need to hold on to all valid positions - // even with invalid sizes - 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; - } +plots.sendDataToCloud = function(gd) { + gd.emit('plotly_beforeexport'); - if(ids) { - cdi.id = String(ids[i]); - } - } + var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL; - arraysToCalcdata(cd, trace); - calcColorscale(trace); - calcSelection(cd, trace); + var hiddenformDiv = d3.select(gd) + .append('div') + .attr('id', 'hiddenform') + .style('display', 'none'); - if(stackGroupOpts) { - // remove bad positions and sort - // note that original indices get added to cd in arraysToCalcdata - i = 0; - while(i < cd.length) { - if(cd[i][posAttr] === BADNUM) { - cd.splice(i, 1); - } - else i++; - } + var hiddenform = hiddenformDiv + .append('form') + .attr({ + action: baseUrl + '/external', + method: 'post', + target: '_blank' + }); - Lib.sort(cd, function(a, b) { - return (a[posAttr] - b[posAttr]) || (a.i - b.i); + var hiddenformInput = hiddenform + .append('input') + .attr({ + type: 'text', + name: 'data' }); - if(interpolateGaps) { - // first fill the beginning with constant from the first point - i = 0; - while(i < cd.length - 1 && cd[i].gap) { - i++; - } - vali = cd[i].s; - if(!vali) vali = cd[i].s = 0; // in case of no data AT ALL in this trace - use 0 - for(j = 0; j < i; j++) { - cd[j].s = vali; - } - // then fill the end with constant from the last point - k = cd.length - 1; - while(k > i && cd[k].gap) { - k--; - } - vali = cd[k].s; - for(j = cd.length - 1; j > k; j--) { - cd[j].s = vali; - } - // now interpolate internal gaps linearly - while(i < k) { - i++; - if(cd[i].gap) { - j = i + 1; - while(cd[j].gap) { - j++; - } - var pos0 = cd[i - 1][posAttr]; - var size0 = cd[i - 1].s; - var m = (cd[j].s - size0) / (cd[j][posAttr] - pos0); - while(i < j) { - cd[i].s = size0 + (cd[i][posAttr] - pos0) * m; - i++; - } - } - } + hiddenformInput.node().value = plots.graphJson(gd, false, 'keepdata'); + hiddenform.node().submit(); + hiddenformDiv.remove(); + + gd.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' +]; + +/* + * Fill in default values + * @param {DOM element} gd + * @param {object} opts + * @param {boolean} opts.skipUpdateCalc: normally if the existing gd.calcdata looks + * compatible with the new gd._fullData we finish by linking the new _fullData traces + * to the old gd.calcdata, so it's correctly set if we're not going to recalc. But also, + * if there are calcTransforms on the trace, we first remap data arrays from the old full + * trace into the new one. Use skipUpdateCalc to defer this (needed by Plotly.react) + * + * gd.data, gd.layout: + * are precisely what the user specified (except as modified by cleanData/cleanLayout), + * these fields shouldn't be modified (except for filling in some auto values) + * nor used directly after the supply defaults step. + * + * gd._fullData, gd._fullLayout: + * are complete descriptions of how to draw the plot, + * use these fields in all required computations. + * + * gd._fullLayout._modules + * is a list of all the trace modules required to draw the plot. + * + * gd._fullLayout._visibleModules + * subset of _modules, a list of modules corresponding to visible:true traces. + * + * gd._fullLayout._basePlotModules + * is a list of all the plot modules required to draw the plot. + * + * gd._fullLayout._transformModules + * is a list of all the transform modules invoked. + * + */ +plots.supplyDefaults = function(gd, opts) { + var skipUpdateCalc = opts && opts.skipUpdateCalc; + var oldFullLayout = gd._fullLayout || {}; + + if(oldFullLayout._skipDefaults) { + delete oldFullLayout._skipDefaults; + return; + } + + var newFullLayout = gd._fullLayout = {}; + var newLayout = gd.layout || {}; + + var oldFullData = gd._fullData || []; + var newFullData = gd._fullData = []; + var newData = gd.data || []; + + var oldCalcdata = gd.calcdata || []; + + var context = gd._context || {}; + + var i; + + // Create all the storage space for frames, but only if doesn't already exist + if(!gd._transitionData) plots.createTransitionData(gd); + + // So we only need to do this once (and since we have gd here) + // get the translated placeholder titles. + // These ones get used as default values so need to be known at supplyDefaults + // others keep their blank defaults but render the placeholder as desired later + // TODO: make these work the same way, only inserting the placeholder text at draw time? + // The challenge is that this has slightly different behavior right now in editable mode: + // using the placeholder as default makes this text permanently (but lightly) visible, + // but explicit '' for these titles gives you a placeholder that's hidden until you mouse + // over it - so you're not distracted by it if you really don't want a title, but if you do + // and you're new to plotly you may not be able to find it. + // When editable=false the two behave the same, no title is drawn. + newFullLayout._dfltTitle = { + plot: _(gd, 'Click to enter Plot title'), + x: _(gd, 'Click to enter X axis title'), + y: _(gd, 'Click to enter Y axis title'), + colorbar: _(gd, 'Click to enter Colorscale title'), + annotation: _(gd, 'new text') + }; + newFullLayout._traceWord = _(gd, 'trace'); + + var formatObj = getFormatObj(gd, d3FormatKeys); + + // stash the token from context so mapbox subplots can use it as default + newFullLayout._mapboxAccessToken = context.mapboxAccessToken; + + // first fill in what we can of layout without looking at data + // because fullData needs a few things from layout + if(oldFullLayout._initialAutoSizeIsDone) { + + // coerce the updated layout while preserving width and height + 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 { + + // coerce the updated layout and autosize if needed + 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(gd, newLayout, newFullLayout); + else if(missingWidthOrHeight) plots.sanitizeMargins(newFullLayout); + + // for backwards-compatibility with Plotly v1.x.x + if(!autosize && missingWidthOrHeight) { + newLayout.width = newFullLayout.width; + newLayout.height = newFullLayout.height; } } - return cd; -} + newFullLayout._d3locale = getFormatter(formatObj, newFullLayout.separators); + newFullLayout._extraFormat = getFormatObj(gd, extraFormatKeys); -function calcAxisExpansion(gd, trace, xa, ya, x, y, ppad) { - var serieslen = trace._length; - var fullLayout = gd._fullLayout; - var xId = xa._id; - var yId = ya._id; - var firstScatter = fullLayout._firstScatter[firstScatterGroup(trace)] === trace.uid; - var stackOrientation = (getStackOpts(trace, fullLayout, xa, ya) || {}).orientation; - var fill = trace.fill; + newFullLayout._initialAutoSizeIsDone = true; - // cancel minimum tick spacings (only applies to bars and boxes) - xa._minDtick = 0; - ya._minDtick = 0; + // keep track of how many traces are inputted + newFullLayout._dataLength = newData.length; - // check whether bounds should be tight, padded, extended to zero... - // most cases both should be padded on both ends, so start with that. - var xOptions = {padded: true}; - var yOptions = {padded: true}; + // clear the lists of trace and baseplot modules, and subplots + newFullLayout._modules = []; + newFullLayout._visibleModules = []; + newFullLayout._basePlotModules = []; + var subplots = newFullLayout._subplots = emptySubplotLists(); - if(ppad) { - xOptions.ppad = yOptions.ppad = ppad; + // initialize axis and subplot hash objects for splom-generated grids + var splomAxes = newFullLayout._splomAxes = {x: {}, y: {}}; + var splomSubplots = newFullLayout._splomSubplots = {}; + // initialize splom grid defaults + newFullLayout._splomGridDflt = {}; + + // for stacked area traces to share config across traces + newFullLayout._scatterStackOpts = {}; + // for the first scatter trace on each subplot (so it knows tonext->tozero) + newFullLayout._firstScatter = {}; + + // for traces to request a default rangeslider on their x axes + // eg set `_requestRangeslider.x2 = true` for xaxis2 + newFullLayout._requestRangeslider = {}; + + // pull uids from old data to use as new defaults + newFullLayout._traceUids = getTraceUids(oldFullData, newData); + + // then do the data + newFullLayout._globalTransforms = (gd._context || {}).globalTransforms; + plots.supplyDataDefaults(newData, newFullData, newLayout, newFullLayout); + + // redo grid size defaults with info about splom x/y axes, + // and fill in generated cartesian axes and subplots + 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); + } } - // TODO: text size + // attach helper method to check whether a plot type is present on graph + newFullLayout._has = plots._hasPlotType.bind(newFullLayout); - var openEnded = serieslen < 2 || (x[0] !== x[serieslen - 1]) || (y[0] !== y[serieslen - 1]); + if(oldFullData.length === newFullData.length) { + for(i = 0; i < newFullData.length; i++) { + relinkPrivateKeys(newFullData[i], oldFullData[i]); + } + } + + // finally, fill in the pieces of layout that may need to look at data + plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); + + // Special cases that introduce interactions between traces. + // This is after relinkPrivateKeys so we can use those in crossTraceDefaults + // and after layout module defaults, so we can use eg barmode + var _modules = newFullLayout._visibleModules; + var crossTraceDefaultsFuncs = []; + for(i = 0; i < _modules.length; i++) { + var funci = _modules[i].crossTraceDefaults; + // some trace types share crossTraceDefaults (ie histogram2d, histogram2dcontour) + if(funci) Lib.pushUnique(crossTraceDefaultsFuncs, funci); + } + for(i = 0; i < crossTraceDefaultsFuncs.length; i++) { + crossTraceDefaultsFuncs[i](newFullData, newFullLayout); + } + Registry.getComponentMethod('colorscale', 'crossTraceDefaults')(newFullData, newFullLayout); + + // turn on flag to optimize large splom-only graphs + // mostly by omitting SVG layers during Cartesian.drawFramework + 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 + ); + + // TODO remove in v2.0.0 + // add has-plot-type refs to fullLayout for backward compatibility + newFullLayout._hasCartesian = newFullLayout._has('cartesian'); + newFullLayout._hasGeo = newFullLayout._has('geo'); + newFullLayout._hasGL3D = newFullLayout._has('gl3d'); + newFullLayout._hasGL2D = newFullLayout._has('gl2d'); + newFullLayout._hasTernary = newFullLayout._has('ternary'); + newFullLayout._hasPie = newFullLayout._has('pie'); - // include zero (tight) and extremes (padded) if fill to zero - // (unless the shape is closed, then it's just filling the shape regardless) - if(openEnded && ( - (fill === 'tozerox') || - ((fill === 'tonextx') && (firstScatter || stackOrientation === 'h')) - )) { - xOptions.tozero = true; - } + // relink / initialize subplot axis objects + plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout); - // if no error bars, markers or text, or fill to y=0 remove x padding - else if(!(trace.error_y || {}).visible && ( - (fill === 'tonexty' || fill === 'tozeroy') || - (!subTypes.hasMarkers(trace) && !subTypes.hasText(trace)) - )) { - xOptions.padded = false; - xOptions.ppad = 0; - } + // clean subplots and other artifacts from previous plot calls + plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout); - // now check for y - rather different logic, though still mostly padded both ends - // include zero (tight) and extremes (padded) if fill to zero - // (unless the shape is closed, then it's just filling the shape regardless) - if(openEnded && ( - (fill === 'tozeroy') || - ((fill === 'tonexty') && (firstScatter || stackOrientation === 'v')) - )) { - yOptions.tozero = true; - } + // relink functions and _ attributes to promote consistency between plots + relinkPrivateKeys(newFullLayout, oldFullLayout); - // tight y: any x fill - else if(fill === 'tonextx' || fill === 'tozerox') { - yOptions.padded = false; + // For persisting GUI-driven changes in layout + // _preGUI and _tracePreGUI were already copied over in relinkPrivateKeys + if(!newFullLayout._preGUI) newFullLayout._preGUI = {}; + // track trace GUI changes by uid rather than by trace index + 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]; } - // N.B. asymmetric splom traces call this with blank {} xa or ya - if(xId) trace._extremes[xId] = Axes.findExtremes(xa, x, xOptions); - if(yId) trace._extremes[yId] = Axes.findExtremes(ya, y, yOptions); -} - -function calcMarkerSize(trace, serieslen) { - if(!subTypes.hasMarkers(trace)) return; + // set up containers for margin calculations + initMargins(newFullLayout); - // Treat size like x or y arrays --- Run d2c - // this needs to go before ppad computation - var marker = trace.marker; - var sizeref = 1.6 * (trace.marker.sizeref || 1); - var markerTrans; + // collect and do some initial calculations for rangesliders + Registry.getComponentMethod('rangeslider', 'makeData')(newFullLayout); - 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); - }; + // update object references in calcdata + if(!skipUpdateCalc && oldCalcdata.length === newFullData.length) { + plots.supplyDefaultsUpdateCalc(oldCalcdata, newFullData); } +}; - if(Lib.isArrayOrTypedArray(marker.size)) { - // I tried auto-type but category and dates dont make much sense. - var ax = {type: 'linear'}; - Axes.setConvert(ax); - - var s = ax.makeCalcdata(trace.marker, 'size'); +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; - var sizeOut = new Array(serieslen); - for(var i = 0; i < serieslen; i++) { - sizeOut[i] = markerTrans(s[i]); + 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; } - return sizeOut; - - } else { - return markerTrans(marker.size); } -} +}; /** - * mark the first scatter trace for each subplot - * note that scatter and scattergl each get their own first trace - * note also that I'm doing this during calc rather than supplyDefaults - * so I don't need to worry about transforms, but if we ever do - * per-trace calc this will get confused. + * Create a list of uid strings satisfying (in this order of importance): + * 1. all unique, all strings + * 2. matches input uids if provided + * 3. matches previous data uids */ -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, xa, ya) { - var stackGroup = trace.stackgroup; - if(!stackGroup) return; - var stackOpts = fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup]; - var stackAx = stackOpts.orientation === 'v' ? ya : xa; - // Allow stacking only on numeric axes - // calc is a little late to be figuring this out, but during supplyDefaults - // we don't know the axis type yet - if(stackAx.type === 'linear' || stackAx.type === 'log') return stackOpts; -} - -module.exports = { - calc: calc, - calcMarkerSize: calcMarkerSize, - calcAxisExpansion: calcAxisExpansion, - setFirstScatter: setFirstScatter, - getStackOpts: getStackOpts -}; +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 = {}; -},{"../../constants/numerical":673,"../../lib":696,"../../plots/cartesian/axes":744,"./arrays_to_calcdata":1042,"./calc_selection":1045,"./colorscale_calc":1046,"./subtypes":1067,"fast-isnumeric":214}],1045:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + function setUid(uid, i) { + out[i] = uid; + seenUids[uid] = 1; + } -'use strict'; + function tryUid(uid, i) { + if(uid && typeof uid === 'string' && !seenUids[uid]) { + setUid(uid, i); + return true; + } + } -var Lib = _dereq_('../../lib'); + for(i = 0; i < len; i++) { + var newUid = newData[i].uid; + if(typeof newUid === 'number') newUid = String(newUid); -module.exports = function calcSelection(cd, trace) { - if(Lib.isArrayOrTypedArray(trace.selectedpoints)) { - Lib.tagSelected(cd, trace); + if(tryUid(newUid, i)) continue; + if(i < oldLen && tryUid(oldFullInput[i].uid, i)) continue; + setUid(Lib.randstr(seenUids), i); } -}; -},{"../../lib":696}],1046:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return out; +} +/** + * Make a container for collecting subplots we need to display. + * + * Finds all subplot types we need to enumerate once and caches it, + * but makes a new output object each time. + * Single-trace subplots (which have no `id`) such as pie, table, etc + * do not need to be collected because we just draw all visible traces. + */ +function emptySubplotLists() { + var collectableSubplotTypes = Registry.collectableSubplotTypes; + var out = {}; + var i, j; -'use strict'; + if(!collectableSubplotTypes) { + collectableSubplotTypes = []; -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var calcColorscale = _dereq_('../../components/colorscale/calc'); + var subplotsRegistry = Registry.subplotsRegistry; -var subTypes = _dereq_('./subtypes'); + for(var subplotType in subplotsRegistry) { + var subplotModule = subplotsRegistry[subplotType]; + var subplotAttr = subplotModule.attr; + if(subplotAttr) { + collectableSubplotTypes.push(subplotType); -module.exports = function calcMarkerColorscale(trace) { - if(subTypes.hasLines(trace) && hasColorscale(trace, 'line')) { - calcColorscale(trace, trace.line.color, 'line', 'c'); + // special case, currently just for cartesian: + // we need to enumerate axes, not just subplots + if(Array.isArray(subplotAttr)) { + for(j = 0; j < subplotAttr.length; j++) { + Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]); + } + } + } + } } - if(subTypes.hasMarkers(trace)) { - if(hasColorscale(trace, 'marker')) { - calcColorscale(trace, trace.marker.color, 'marker', 'c'); - } - if(hasColorscale(trace, 'marker.line')) { - calcColorscale(trace, trace.marker.line.color, 'marker.line', 'c'); - } + for(i = 0; i < collectableSubplotTypes.length; i++) { + out[collectableSubplotTypes[i]] = []; } -}; + return out; +} -},{"../../components/colorscale/calc":578,"../../components/colorscale/has_colorscale":584,"./subtypes":1067}],1047:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * getFormatObj: use _context to get the format object from locale. + * Used to get d3.locale argument object and extraFormat argument object + * + * Regarding d3.locale argument : + * decimal and thousands can be overridden later by layout.separators + * grouping and currency are not presently used by our automatic number + * formatting system but can be used by custom formats. + * + * @returns {object} d3.locale format object + */ +function getFormatObj(gd, formatKeys) { + var locale = gd._context.locale; + if(!locale) locale === 'en-US'; + var formatDone = false; + var formatObj = {}; -'use strict'; + function includeFormat(newFormat) { + var formatFinished = true; + for(var i = 0; i < formatKeys.length; i++) { + var formatKey = formatKeys[i]; + if(!formatObj[formatKey]) { + if(newFormat[formatKey]) { + formatObj[formatKey] = newFormat[formatKey]; + } + else formatFinished = false; + } + } + if(formatFinished) formatDone = true; + } -module.exports = { - PTS_LINESONLY: 20, + // same as localize, look for format parts in each format spec in the chain + for(var i = 0; i < 2; i++) { + var locales = gd._context.locales; + for(var j = 0; j < 2; j++) { + var formatj = (locales[locale] || {}).format; + if(formatj) { + includeFormat(formatj); + if(formatDone) break; + } + locales = Registry.localeRegistry; + } - // fixed parameters of clustering and clipping algorithms + var baseLocale = locale.split('-')[0]; + if(formatDone || baseLocale === locale) break; + locale = baseLocale; + } - // 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, + // lastly pick out defaults from english (non-US, as DMY is so much more common) + if(!formatDone) includeFormat(Registry.localeRegistry.en.format); - // number of viewport sizes away from the visible region - // at which we clip all lines to the perimeter - maxScreensAway: 20 -}; + return formatObj; +} -},{}],1048:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * getFormatter: combine the final separators with the locale formatting object + * we pulled earlier to generate number and time formatters + * TODO: remove separators in v2, only use locale, so we don't need this step? + * + * @param {object} formatObj: d3.locale format object + * @param {string} separators: length-2 string to override decimal and thousands + * separators in number formatting + * + * @returns {object} {numberFormat, timeFormat} d3 formatter factory functions + * for numbers and time + */ +function getFormatter(formatObj, separators) { + formatObj.decimal = separators.charAt(0); + formatObj.thousands = separators.charAt(1); + return d3.locale(formatObj); +} -'use strict'; +// Create storage for all of the data related to frames and transitions: +plots.createTransitionData = function(gd) { + // Set up the default keyframe if it doesn't exist: + if(!gd._transitionData) { + gd._transitionData = {}; + } -var calc = _dereq_('./calc'); + if(!gd._transitionData._frames) { + gd._transitionData._frames = []; + } -/* - * Scatter stacking & normalization calculations - * runs per subplot, and can handle multiple stacking groups - */ + if(!gd._transitionData._frameHash) { + gd._transitionData._frameHash = {}; + } -module.exports = function crossTraceCalc(gd, plotinfo) { - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - var subplot = xa._id + ya._id; + if(!gd._transitionData._counter) { + gd._transitionData._counter = 0; + } - var subplotStackOpts = gd._fullLayout._scatterStackOpts[subplot]; - if(!subplotStackOpts) return; + if(!gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks = []; + } +}; - var calcTraces = gd.calcdata; +// helper function to be bound to fullLayout to check +// whether a certain plot type is present on plot +// or trace has a category +plots._hasPlotType = function(category) { + var i; - var i, j, k, i2, cd, cd0, posj, sumj, norm; - var groupOpts, interpolate, groupnorm, posAttr, valAttr; - var hasAnyBlanks; + // check base plot modules + var basePlotModules = this._basePlotModules || []; + for(i = 0; i < basePlotModules.length; i++) { + if(basePlotModules[i].name === category) return true; + } - for(var stackGroup in subplotStackOpts) { - groupOpts = subplotStackOpts[stackGroup]; - var indices = groupOpts.traceIndices; + // check trace modules (including non-visible:true) + var modules = this._modules || []; + for(i = 0; i < modules.length; i++) { + var name = modules[i].name; + if(name === category) return true; + // N.B. this is modules[i] along with 'categories' as a hash object + var _module = Registry.modules[name]; + if(_module && _module.categories[category]) return true; + } - // can get here with no indices if the stack axis is non-numeric - if(!indices.length) continue; + return false; +}; - 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; - } +plots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { + var i, j; - // Collect the complete set of all positions across ALL traces. - // Start with the first trace, then interleave items from later traces - // as needed. - // Fill in mising items as we go. - cd0 = calcTraces[indices[0]]; - var allPositions = new Array(cd0.length); - for(i = 0; i < cd0.length; i++) { - allPositions[i] = cd0[i][posAttr]; + var basePlotModules = oldFullLayout._basePlotModules || []; + for(i = 0; i < basePlotModules.length; i++) { + var _module = basePlotModules[i]; + + if(_module.clean) { + _module.clean(newFullData, newFullLayout, oldFullData, oldFullLayout); } + } - for(i = 1; i < indices.length; i++) { - cd = calcTraces[indices[i]]; + var hadGl = oldFullLayout._has && oldFullLayout._has('gl'); + var hasGl = newFullLayout._has && newFullLayout._has('gl'); - for(j = k = 0; j < cd.length; j++) { - posj = cd[j][posAttr]; - for(; posj > allPositions[k] && k < allPositions.length; k++) { - // the current trace is missing a position from some previous trace(s) - insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr); - j++; - } - if(posj !== allPositions[k]) { - // previous trace(s) are missing a position from the current trace - 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(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr); - j++; - } + if(hadGl && !hasGl) { + if(oldFullLayout._glcontainer !== undefined) { + oldFullLayout._glcontainer.selectAll('.gl-canvas').remove(); + oldFullLayout._glcontainer.selectAll('.no-webgl').remove(); + oldFullLayout._glcanvas = null; } + } - var serieslen = allPositions.length; + var hasInfoLayer = !!oldFullLayout._infolayer; - // stack (and normalize)! - for(j = 0; j < cd0.length; j++) { - sumj = cd0[j][valAttr] = cd0[j].s; - for(i = 1; i < indices.length; i++) { - cd = calcTraces[indices[i]]; - cd[0].trace._rawLength = cd[0].trace._length; - cd[0].trace._length = serieslen; - sumj += cd[j].s; - cd[j][valAttr] = sumj; - } + oldLoop: + for(i = 0; i < oldFullData.length; i++) { + var oldTrace = oldFullData[i]; + var oldUid = oldTrace.uid; - 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(j = 0; j < newFullData.length; j++) { + var newTrace = newFullData[j]; - // autorange - for(i = 0; i < indices.length; i++) { - cd = calcTraces[indices[i]]; - var trace = cd[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] = cd[j].gap ? 0 : (arrayPad ? ppadRaw[cd[j].i] : ppadRaw); - } - } - var x = new Array(serieslen); - var y = new Array(serieslen); - for(j = 0; j < serieslen; j++) { - x[j] = cd[j].x; - y[j] = cd[j].y; - } - calc.calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); + if(oldUid === newTrace.uid) continue oldLoop; + } - // while we're here (in a loop over all traces in the stack) - // record the orientation, so hover can find it easily - cd[0].t.orientation = groupOpts.orientation; + // clean old colorbars + if(hasInfoLayer) { + oldFullLayout._infolayer.select('.cb' + oldUid).remove(); } } -}; -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); - // Even if we're not interpolating, if one trace has multiple - // values at the same position and this trace only has one value there, - // we just duplicate that one value rather than insert a zero. - // We also make it look like a real point - because it's ambiguous which - // one really is the real one! - if(index && position === calcTrace[index - 1][posAttr]) { - var prevEntry = calcTrace[index - 1]; - newEntry.s = prevEntry.s; - // TODO is it going to cause any problems to have multiple - // calcdata points with the same index? - newEntry.i = prevEntry.i; - newEntry.gap = prevEntry.gap; - } - else if(interpolate) { - newEntry.s = getInterp(calcTrace, index, position, posAttr); - } - if(!index) { - // t and trace need to stay on the first cd entry - calcTrace[0].t = calcTrace[1].t; - calcTrace[0].trace = calcTrace[1].trace; - delete calcTrace[1].t; - delete calcTrace[1].trace; + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); } -} +}; + +plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { + var i, j; -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]); -} + var oldSubplots = oldFullLayout._plots || {}; + var newSubplots = newFullLayout._plots = {}; + var newSubplotList = newFullLayout._subplots; -},{"./calc":1044}],1049:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var mockGd = { + _fullData: newFullData, + _fullLayout: newFullLayout + }; + var ids = newSubplotList.cartesian.concat(newSubplotList.gl2d || []); -'use strict'; + for(i = 0; i < ids.length; i++) { + var id = ids[i]; + var oldSubplot = oldSubplots[id]; + var xaxis = axisIDs.getFromId(mockGd, id, 'x'); + var yaxis = axisIDs.getFromId(mockGd, id, 'y'); + var plotinfo; + // link or create subplot object + if(oldSubplot) { + plotinfo = newSubplots[id] = oldSubplot; + } else { + plotinfo = newSubplots[id] = {}; + plotinfo.id = id; + } -// remove opacity for any trace that has a fill or is filled to -module.exports = function crossTraceDefaults(fullData) { - for(var i = 0; i < fullData.length; i++) { - var tracei = fullData[i]; - if(tracei.type !== 'scatter') continue; + // add these axis ids to each others' subplot lists + xaxis._counterAxes.push(yaxis._id); + yaxis._counterAxes.push(xaxis._id); + xaxis._subplotsWith.push(id); + yaxis._subplotsWith.push(id); - var filli = tracei.fill; - if(filli === 'none' || filli === 'toself') continue; + // update x and y axis layout object refs + plotinfo.xaxis = xaxis; + plotinfo.yaxis = yaxis; - tracei.opacity = undefined; + // By default, we clip at the subplot level, + // but if one trace on a given subplot has *cliponaxis* set to false, + // we need to clip at the trace module layer level; + // find this out here, once of for all. + plotinfo._hasClipOnAxisFalse = false; - if(filli === 'tonexty' || filli === 'tonextx') { - for(var j = i - 1; j >= 0; j--) { - var tracej = fullData[j]; + for(j = 0; j < newFullData.length; j++) { + var trace = newFullData[j]; - if((tracej.type === 'scatter') && - (tracej.xaxis === tracei.xaxis) && - (tracej.yaxis === tracei.yaxis)) { - tracej.opacity = undefined; - break; - } + if( + trace.xaxis === plotinfo.xaxis._id && + trace.yaxis === plotinfo.yaxis._id && + trace.cliponaxis === false + ) { + plotinfo._hasClipOnAxisFalse = true; + break; } } } -}; -},{}],1050:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // while we're at it, link overlaying axes to their main axes and + // anchored axes to the axes they're anchored to + var axList = axisIDs.list(mockGd, null, true); + var ax; + for(i = 0; i < axList.length; i++) { + ax = axList[i]; + var mainAx = null; -'use strict'; + if(ax.overlaying) { + mainAx = axisIDs.getFromId(mockGd, ax.overlaying); -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); + // you cannot overlay an axis that's already overlaying another + if(mainAx && mainAx.overlaying) { + ax.overlaying = false; + mainAx = null; + } + } + ax._mainAxis = mainAx || ax; -var attributes = _dereq_('./attributes'); -var constants = _dereq_('./constants'); -var subTypes = _dereq_('./subtypes'); -var handleXYDefaults = _dereq_('./xy_defaults'); -var handleStackDefaults = _dereq_('./stack_defaults'); -var handleMarkerDefaults = _dereq_('./marker_defaults'); -var handleLineDefaults = _dereq_('./line_defaults'); -var handleLineShapeDefaults = _dereq_('./line_shape_defaults'); -var handleTextDefaults = _dereq_('./text_defaults'); -var handleFillColorDefaults = _dereq_('./fillcolor_defaults'); + /* + * For now force overlays to overlay completely... so they + * can drag together correctly and share backgrounds. + * Later perhaps we make separate axis domain and + * tick/line domain or something, so they can still share + * the (possibly larger) dragger and background but don't + * have to both be drawn over that whole domain + */ + if(mainAx) ax.domain = mainAx.domain.slice(); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + ax._anchorAxis = ax.anchor === 'free' ? + null : + axisIDs.getFromId(mockGd, ax.anchor); } - var len = handleXYDefaults(traceIn, traceOut, layout, coerce); - if(!len) traceOut.visible = false; - - if(!traceOut.visible) return; + // finally, we can find the main subplot for each axis + // (on which the ticks & labels are drawn) + 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); + } +}; - var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); +function findMainSubplot(ax, fullLayout) { + var mockGd = {_fullLayout: fullLayout}; - var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? - 'lines+markers' : 'lines'; - coerce('text'); - coerce('hovertext'); - coerce('mode', defaultMode); + var isX = ax._id.charAt(0) === 'x'; + var anchorAx = ax._mainAxis._anchorAxis; + var mainSubplotID = ''; + var nextBestMainSubplotID = ''; + var anchorID = ''; - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - handleLineShapeDefaults(traceIn, traceOut, coerce); - coerce('connectgaps'); - coerce('line.simplify'); + // First try the main ID with the anchor + if(anchorAx) { + anchorID = anchorAx._mainAxis._id; + mainSubplotID = isX ? (ax._id + anchorID) : (anchorID + ax._id); } - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true}); - } + // Then look for a subplot with the counteraxis overlaying the anchor + // If that fails just use the first subplot including this axis + if(!mainSubplotID || !fullLayout._plots[mainSubplotID]) { + mainSubplotID = ''; - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); + var counterIDs = ax._counterAxes; + for(var j = 0; j < counterIDs.length; j++) { + var counterPart = counterIDs[j]; + var id = isX ? (ax._id + counterPart) : (counterPart + ax._id); + if(!nextBestMainSubplotID) nextBestMainSubplotID = id; + var counterAx = axisIDs.getFromId(mockGd, counterPart); + if(anchorID && counterAx.overlaying === anchorID) { + mainSubplotID = id; + break; + } + } } - var dfltHoverOn = []; + return mainSubplotID || nextBestMainSubplotID; +} - if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) { - coerce('cliponaxis'); - coerce('marker.maxdisplayed'); - dfltHoverOn.push('points'); - } +// This function clears any trace attributes with valType: color and +// no set dflt filed in the plot schema. This is needed because groupby (which +// is the only transform for which this currently applies) supplies parent +// trace defaults, then expanded trace defaults. The result is that `null` +// colors are default-supplied and inherited as a color instead of a null. +// The result is that expanded trace default colors have no effect, with +// the final result that groups are indistinguishable. This function clears +// those colors so that individual groupby groups get unique colors. +plots.clearExpandedTraceDefaultColors = function(trace) { + var colorAttrs, path, i; - // It's possible for this default to be changed by a later trace. - // We handle that case in some hacky code inside handleStackDefaults. - coerce('fill', stackGroupOpts ? stackGroupOpts.fillDflt : 'none'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); - if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); + // This uses weird closure state in order to satisfy the linter rule + // that we can't create functions in a loop. + function locateColorAttrs(attr, attrName, attrs, level) { + path[level] = attrName; + path.length = level + 1; + if(attr.valType === 'color' && attr.dflt === undefined) { + colorAttrs.push(path.join('.')); + } } - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { - dfltHoverOn.push('fills'); + path = []; + + // Get the cached colorAttrs: + colorAttrs = trace._module._colorAttrs; + + // Or else compute and cache the colorAttrs on the module: + if(!colorAttrs) { + trace._module._colorAttrs = colorAttrs = []; + PlotSchema.crawl( + trace._module.attributes, + locateColorAttrs + ); } - coerce('hoveron', dfltHoverOn.join('+') || 'points'); - var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); + for(i = 0; i < colorAttrs.length; i++) { + var origprop = Lib.nestedProperty(trace, '_input.' + colorAttrs[i]); - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); + if(!origprop.get()) { + Lib.nestedProperty(trace, colorAttrs[i]).set(null); + } + } }; -},{"../../lib":696,"../../registry":827,"./attributes":1043,"./constants":1047,"./fillcolor_defaults":1052,"./line_defaults":1056,"./line_shape_defaults":1058,"./marker_defaults":1062,"./stack_defaults":1065,"./subtypes":1067,"./text_defaults":1068,"./xy_defaults":1069}],1051:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; +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 Lib = _dereq_('../../lib'); + var i, fullTrace, trace; -/** Fill hover 'pointData' container with 'correct' hover text value - * - * - If trace hoverinfo contains a 'text' flag and hovertext is not set, - * the text elements will be seen in the hover labels. - * - * - If trace hoverinfo contains a 'text' flag and hovertext is set, - * hovertext takes precedence over text - * i.e. the hoverinfo elements will be seen in the hover labels - * - * @param {object} calcPt - * @param {object} trace - * @param {object || array} contOut (mutated here) - */ -module.exports = function fillHoverText(calcPt, trace, contOut) { - var fill = Array.isArray(contOut) ? - function(v) { contOut.push(v); } : - function(v) { contOut.text = v; }; + fullLayout._transformModules = []; - var htx = Lib.extractOption(calcPt, trace, 'htx', 'hovertext'); - if(isValid(htx)) return fill(htx); + function pushModule(fullTrace) { + dataOut.push(fullTrace); - var tx = Lib.extractOption(calcPt, trace, 'tx', 'text'); - if(isValid(tx)) return fill(tx); -}; + var _module = fullTrace._module; + if(!_module) return; -// accept all truthy values and 0 (which gets cast to '0' in the hover labels) -function isValid(v) { - return v || v === 0; -} + Lib.pushUnique(modules, _module); + if(fullTrace.visible === true) Lib.pushUnique(visibleModules, _module); + Lib.pushUnique(basePlotModules, fullTrace._module.basePlotModule); + cnt++; -},{"../../lib":696}],1052:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // TODO: do we really want color not to increment for explicitly invisible traces? + // This logic is weird, but matches previous behavior: traces that you explicitly + // set to visible:false do not increment the color, but traces WE determine to be + // empty or invalid (and thus set to visible:false) DO increment color. + // I kind of think we should just let all traces increment color, visible or not. + // see mock: axes-autotype-empty vs. a test of restyling visible: false that + // I can't find right now... + if(fullTrace._input.visible !== false) colorCnt++; + } + var carpetIndex = {}; + var carpetDependents = []; + var dataTemplate = (layout.template || {}).data || {}; + var templater = Template.traceTemplater(dataTemplate); -'use strict'; + for(i = 0; i < dataIn.length; i++) { + trace = dataIn[i]; -var Color = _dereq_('../../components/color'); -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; + // reuse uid we may have pulled out of oldFullData + // Note: templater supplies trace type + fullTrace = templater.newTrace(trace); + fullTrace.uid = fullLayout._traceUids[i]; + plots.supplyTraceDefaults(trace, fullTrace, colorCnt, fullLayout, i); -module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce) { - var inheritColorFromMarker = false; + fullTrace.index = i; + fullTrace._input = trace; + fullTrace._expandedIndex = cnt; - if(traceOut.marker) { - // don't try to inherit a color array - var markerColor = traceOut.marker.color, - markerLineColor = (traceOut.marker.line || {}).color; + if(fullTrace.transforms && fullTrace.transforms.length) { + var sdInvisible = trace.visible !== false && fullTrace.visible === false; - if(markerColor && !isArrayOrTypedArray(markerColor)) { - inheritColorFromMarker = markerColor; + var expandedTraces = applyTransforms(fullTrace, dataOut, layout, fullLayout); + + for(var j = 0; j < expandedTraces.length; j++) { + var expandedTrace = expandedTraces[j]; + + // No further templating during transforms. + 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 the first supplyDefaults created `visible: false`, + // clear it before running supplyDefaults a second time, + // because sometimes there are items we still want to coerce + // inside trace modules before determining that the trace is + // again `visible: false`, for example partial visibilities + // in `splom` traces. + if(sdInvisible && expandedTrace.visible === false) { + delete expandedTrace.visible; + } + + plots.supplyTraceDefaults(expandedTrace, fullExpandedTrace, cnt, fullLayout, i); + + // relink private (i.e. underscore) keys expanded trace to full expanded trace so + // that transform supply-default methods can set _ keys for future use. + relinkPrivateKeys(fullExpandedTrace, expandedTrace); + + // add info about parent data trace + fullExpandedTrace.index = i; + fullExpandedTrace._input = trace; + fullExpandedTrace._fullInput = fullTrace; + + // add info about the expanded data + fullExpandedTrace._expandedIndex = cnt; + fullExpandedTrace._expandedInput = expandedTrace; + + pushModule(fullExpandedTrace); + } } - else if(markerLineColor && !isArrayOrTypedArray(markerLineColor)) { - inheritColorFromMarker = markerLineColor; + else { + // add identify refs for consistency with transformed traces + fullTrace._fullInput = fullTrace; + fullTrace._expandedInput = fullTrace; + + pushModule(fullTrace); } - } - coerce('fillcolor', Color.addOpacity( - (traceOut.line || {}).color || - inheritColorFromMarker || - defaultColor, 0.5 - )); -}; + if(Registry.traceIs(fullTrace, 'carpetAxis')) { + carpetIndex[fullTrace.carpet] = fullTrace; + } -},{"../../components/color":570,"../../lib":696}],1053:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(Registry.traceIs(fullTrace, 'carpetDependent')) { + carpetDependents.push(i); + } + } + for(i = 0; i < carpetDependents.length; i++) { + fullTrace = dataOut[carpetDependents[i]]; -'use strict'; + if(!fullTrace.visible) continue; -var Color = _dereq_('../../components/color'); -var subtypes = _dereq_('./subtypes'); + var carpetAxis = carpetIndex[fullTrace.carpet]; + fullTrace._carpet = carpetAxis; + if(!carpetAxis || !carpetAxis.visible) { + fullTrace.visible = false; + continue; + } -module.exports = function getTraceColor(trace, di) { - var lc, tc; + fullTrace.xaxis = carpetAxis.xaxis; + fullTrace.yaxis = carpetAxis.yaxis; + } +}; - // TODO: text modes +plots.supplyAnimationDefaults = function(opts) { + opts = opts || {}; + var i; + var optsOut = {}; - if(trace.mode === 'lines') { - lc = trace.line.color; - return (lc && Color.opacity(lc)) ? - lc : trace.fillcolor; - } - else if(trace.mode === 'none') { - return trace.fill ? trace.fillcolor : ''; + function coerce(attr, dflt) { + return Lib.coerce(opts || {}, optsOut, animationAttrs, attr, dflt); } - else { - var mc = di.mcc || (trace.marker || {}).color, - mlc = di.mlcc || ((trace.marker || {}).line || {}).color; - tc = (mc && Color.opacity(mc)) ? mc : - (mlc && Color.opacity(mlc) && - (di.mlw || ((trace.marker || {}).line || {}).width)) ? mlc : ''; + coerce('mode'); + coerce('direction'); + coerce('fromcurrent'); - if(tc) { - // make sure the points aren't TOO transparent - if(Color.opacity(tc) < 0.3) { - return Color.addOpacity(tc, 0.3); - } - else return tc; + if(Array.isArray(opts.frame)) { + optsOut.frame = []; + for(i = 0; i < opts.frame.length; i++) { + optsOut.frame[i] = plots.supplyAnimationFrameDefaults(opts.frame[i] || {}); } - else { - lc = (trace.line || {}).color; - return (lc && Color.opacity(lc) && - subtypes.hasLines(trace) && trace.line.width) ? - lc : trace.fillcolor; + } 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 || {}); } -}; -},{"../../components/color":570,"./subtypes":1067}],1054:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return optsOut; +}; -'use strict'; +plots.supplyAnimationFrameDefaults = function(opts) { + var optsOut = {}; -var Lib = _dereq_('../../lib'); -var Fx = _dereq_('../../components/fx'); -var Registry = _dereq_('../../registry'); -var getTraceColor = _dereq_('./get_trace_color'); -var Color = _dereq_('../../components/color'); -var fillHoverText = _dereq_('./fill_hover_text'); + function coerce(attr, dflt) { + return Lib.coerce(opts || {}, optsOut, animationAttrs.frame, attr, dflt); + } -module.exports = function hoverPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var trace = cd[0].trace; - var xa = pointData.xa; - var ya = pointData.ya; - var xpx = xa.c2p(xval); - var ypx = ya.c2p(yval); - var pt = [xpx, ypx]; - var hoveron = trace.hoveron || ''; - var minRad = (trace.mode.indexOf('markers') !== -1) ? 3 : 0.5; + coerce('duration'); + coerce('redraw'); - // look for points to hover on first, then take fills only if we - // didn't find a point - if(hoveron.indexOf('points') !== -1) { - var dx = function(di) { - // dx and dy are used in compare modes - here we want to always - // prioritize the closest data point, at least as long as markers are - // the same size or nonexistent, but still try to prioritize small markers too. - var rad = Math.max(3, di.mrc || 0); - var kink = 1 - 1 / rad; - var dxRaw = Math.abs(xa.c2p(di.x) - xpx); - var d = (dxRaw < rad) ? (kink * dxRaw / rad) : (dxRaw - rad + kink); - return d; - }; - var dy = function(di) { - var rad = Math.max(3, di.mrc || 0); - var kink = 1 - 1 / rad; - var dyRaw = Math.abs(ya.c2p(di.y) - ypx); - return (dyRaw < rad) ? (kink * dyRaw / rad) : (dyRaw - rad + kink); - }; - var dxy = function(di) { - // scatter points: d.mrc is the calculated marker radius - // adjust the distance so if you're inside the marker it - // always will show up regardless of point size, but - // prioritize smaller points - var rad = Math.max(minRad, di.mrc || 0); - var dx = xa.c2p(di.x) - xpx; - var dy = ya.c2p(di.y) - ypx; - return Math.max(Math.sqrt(dx * dx + dy * dy) - rad, 1 - minRad / rad); - }; - var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); + return optsOut; +}; - Fx.getClosest(cd, distfn, pointData); +plots.supplyAnimationTransitionDefaults = function(opts) { + var optsOut = {}; - // skip the rest (for this trace) if we didn't find a close point - if(pointData.index !== false) { + function coerce(attr, dflt) { + return Lib.coerce(opts || {}, optsOut, animationAttrs.transition, attr, dflt); + } - // the closest data point - var di = cd[pointData.index]; - var xc = xa.c2p(di.x, true); - var yc = ya.c2p(di.y, true); - var rad = di.mrc || 1; + coerce('duration'); + coerce('easing'); - // now we're done using the whole `calcdata` array, replace the - // index with the original index (in case of inserted point from - // stacked area) - pointData.index = di.i; + return optsOut; +}; - var orientation = cd[0].t.orientation; - // TODO: for scatter and bar, option to show (sub)totals and - // raw data? Currently stacked and/or normalized bars just show - // the normalized individual sizes, so that's what I'm doing here - // for now. - var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; +plots.supplyFrameDefaults = function(frameIn) { + var frameOut = {}; - Lib.extendFlat(pointData, { - color: getTraceColor(trace, di), + function coerce(attr, dflt) { + return Lib.coerce(frameIn, frameOut, frameAttrs, attr, dflt); + } - x0: xc - rad, - x1: xc + rad, - xLabelVal: xLabelVal, + coerce('group'); + coerce('name'); + coerce('traces'); + coerce('baseframe'); + coerce('data'); + coerce('layout'); - y0: yc - rad, - y1: yc + rad, - yLabelVal: yLabelVal, + return frameOut; +}; - spikeDistance: dxy(di) - }); +plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, traceInIndex) { + var colorway = layout.colorway || Color.defaults; + var defaultColor = colorway[colorIndex % colorway.length]; - fillHoverText(di, trace, pointData); - Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, pointData); + var i; - return [pointData]; - } + function coerce(attr, dflt) { + return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt); } - // even if hoveron is 'fills', only use it if we have polygons too - if(hoveron.indexOf('fills') !== -1 && trace._polygons) { - var polygons = trace._polygons; - var polygonsIn = []; - var inside = false; - var xmin = Infinity; - var xmax = -Infinity; - var ymin = Infinity; - var ymax = -Infinity; + var visible = coerce('visible'); - var i, j, polygon, pts, xCross, x0, x1, y0, y1; + coerce('type'); + coerce('name', layout._traceWord + ' ' + traceInIndex); - for(i = 0; i < polygons.length; i++) { - polygon = polygons[i]; - // TODO: this is not going to work right for curved edges, it will - // act as though they're straight. That's probably going to need - // the elements themselves to capture the events. Worth it? - if(polygon.contains(pt)) { - inside = !inside; - // TODO: need better than just the overall bounding box - polygonsIn.push(polygon); - ymin = Math.min(ymin, polygon.ymin); - ymax = Math.max(ymax, polygon.ymax); - } - } + coerce('uirevision', layout.uirevision); - if(inside) { - // constrain ymin/max to the visible plot, so the label goes - // at the middle of the piece you can see - ymin = Math.max(ymin, 0); - ymax = Math.min(ymax, ya._length); + // we want even invisible traces to make their would-be subplots visible + // so coerce the subplot id(s) now no matter what + var _module = plots.getModule(traceOut); - // find the overall left-most and right-most points of the - // polygon(s) we're inside at their combined vertical midpoint. - // This is where we will draw the hover label. - // Note that this might not be the vertical midpoint of the - // whole trace, if it's disjoint. - var yAvg = (ymin + ymax) / 2; - for(i = 0; i < polygonsIn.length; i++) { - pts = polygonsIn[i].pts; - for(j = 1; j < pts.length; j++) { - y0 = pts[j - 1][1]; - y1 = pts[j][1]; - if((y0 > yAvg) !== (y1 >= yAvg)) { - x0 = pts[j - 1][0]; - x1 = pts[j][0]; - if(y1 - y0) { - xCross = x0 + (x1 - x0) * (yAvg - y0) / (y1 - y0); - xmin = Math.min(xmin, xCross); - xmax = Math.max(xmax, xCross); - } + 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 = ''; + + // TODO - currently if we draw an empty gl2d subplot, it draws + // nothing then gets stuck and you can't get it back without newPlot + // sort this out in the regl refactor? but for now just drop empty gl2d subplots + if(basePlotModule.name !== 'gl2d' || visible) { + 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); + } - // constrain xmin/max to the visible plot now too - xmin = Math.max(xmin, 0); - xmax = Math.min(xmax, xa._length); + if(subplots[basePlotModule.name]) { + Lib.pushUnique(subplots[basePlotModule.name], subplotId); + } + } + } + } - // get only fill or line color for the hover color - var color = Color.defaultLine; - if(Color.opacity(trace.fillcolor)) color = trace.fillcolor; - else if(Color.opacity((trace.line || {}).color)) { - color = trace.line.color; + function coerceUnlessPruned(attr, dflt, cb) { + if(_module && (attr in _module.attributes) && _module.attributes[attr] === undefined) { + // Pruned + } else { + if(cb && typeof cb === 'function') { + cb(); + } else { + coerce(attr, dflt); } + } + } - 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: xmin, - x1: xmax, - y0: yAvg, - y1: yAvg, - color: color - }); + if(visible) { + coerce('customdata'); + coerce('ids'); - delete pointData.index; + if(Registry.traceIs(traceOut, 'showLegend')) { + traceOut._dfltShowLegend = true; + coerce('showlegend'); + coerce('legendgroup'); + } + else { + traceOut._dfltShowLegend = false; + } - if(trace.text && !Array.isArray(trace.text)) { - pointData.text = String(trace.text); - } - else pointData.text = trace.name; + coerceUnlessPruned('hoverlabel', '', function() { + Registry.getComponentMethod( + 'fx', + 'supplyDefaults' + )(traceIn, traceOut, defaultColor, layout); + }); - return [pointData]; + // TODO add per-base-plot-module trace defaults step + + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout); + } + + if(!Registry.traceIs(traceOut, 'noOpacity')) coerce('opacity'); + + if(Registry.traceIs(traceOut, 'notLegendIsolatable')) { + // This clears out the legendonly state for traces like carpet that + // cannot be isolated in the legend + traceOut.visible = !!traceOut.visible; + } + + if(_module && _module.selectPoints) { + coerce('selectedpoints'); } + + plots.supplyTransformDefaults(traceIn, traceOut, layout); } + + return traceOut; }; -},{"../../components/color":570,"../../components/fx":612,"../../lib":696,"../../registry":827,"./fill_hover_text":1051,"./get_trace_color":1053}],1055:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; + * hasMakesDataTransform: does this trace have a transform that makes its own + * data, either by grabbing it from somewhere else or by creating it from input + * parameters? If so, we should still keep going with supplyDefaults + * even if the trace is invisible, which may just be because it has no data yet. + */ +function hasMakesDataTransform(trace) { + var transforms = trace.transforms; + if(Array.isArray(transforms) && transforms.length) { + for(var i = 0; i < transforms.length; i++) { + var ti = transforms[i]; + var _module = ti._module || transformsRegistry[ti.type]; + if(_module && _module.makesData) return true; + } + } + return false; +} -var Scatter = {}; +plots.hasMakesDataTransform = hasMakesDataTransform; -var subtypes = _dereq_('./subtypes'); -Scatter.hasLines = subtypes.hasLines; -Scatter.hasMarkers = subtypes.hasMarkers; -Scatter.hasText = subtypes.hasText; -Scatter.isBubble = subtypes.isBubble; +plots.supplyTransformDefaults = function(traceIn, traceOut, layout) { + // For now we only allow transforms on 1D traces, ie those that specify a _length. + // If we were to implement 2D transforms, we'd need to have each transform + // describe its own applicability and disable itself when it doesn't apply. + // Also allow transforms that make their own data, but not in globalTransforms + if(!(traceOut._length || hasMakesDataTransform(traceIn))) return; -Scatter.attributes = _dereq_('./attributes'); -Scatter.supplyDefaults = _dereq_('./defaults'); -Scatter.crossTraceDefaults = _dereq_('./cross_trace_defaults'); -Scatter.calc = _dereq_('./calc').calc; -Scatter.crossTraceCalc = _dereq_('./cross_trace_calc'); -Scatter.arraysToCalcdata = _dereq_('./arrays_to_calcdata'); -Scatter.plot = _dereq_('./plot'); -Scatter.colorbar = _dereq_('./marker_colorbar'); -Scatter.style = _dereq_('./style').style; -Scatter.styleOnSelect = _dereq_('./style').styleOnSelect; -Scatter.hoverPoints = _dereq_('./hover'); -Scatter.selectPoints = _dereq_('./select'); -Scatter.animatable = true; + var globalTransforms = layout._globalTransforms || []; + var transformModules = layout._transformModules || []; -Scatter.moduleType = 'trace'; -Scatter.name = 'scatter'; -Scatter.basePlotModule = _dereq_('../../plots/cartesian'); -Scatter.categories = [ - 'cartesian', 'svg', 'symbols', 'errorBarsOK', 'showLegend', 'scatter-like', - 'zoomScale' -]; -Scatter.meta = { - -}; + if(!Array.isArray(traceIn.transforms) && globalTransforms.length === 0) return; -module.exports = Scatter; + var containerIn = traceIn.transforms || []; + var transformList = globalTransforms.concat(containerIn); + var containerOut = traceOut.transforms = []; -},{"../../plots/cartesian":756,"./arrays_to_calcdata":1042,"./attributes":1043,"./calc":1044,"./cross_trace_calc":1048,"./cross_trace_defaults":1049,"./defaults":1050,"./hover":1054,"./marker_colorbar":1061,"./plot":1063,"./select":1064,"./style":1066,"./subtypes":1067}],1056:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + for(var i = 0; i < transformList.length; i++) { + var transformIn = transformList[i]; + var type = transformIn.type; + var _module = transformsRegistry[type]; + var transformOut; -'use strict'; + /* + * Supply defaults may run twice. First pass runs all supply defaults steps + * and adds the _module to any output transforms. + * If transforms exist another pass is run so that any generated traces also + * go through supply defaults. This has the effect of rerunning + * supplyTransformDefaults. If the transform does not have a `transform` + * function it could not have generated any new traces and the second stage + * is unnecessary. We detect this case with the following variables. + */ + var isFirstStage = !(transformIn._module && transformIn._module === _module); + var doLaterStages = _module && typeof _module.transform === 'function'; -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); + if(!_module) Lib.warn('Unrecognized transform type ' + type + '.'); -module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { - var markerColor = (traceIn.marker || {}).color; + if(_module && _module.supplyDefaults && (isFirstStage || doLaterStages)) { + transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); + transformOut.type = type; + transformOut._module = _module; - coerce('line.color', defaultColor); + Lib.pushUnique(transformModules, _module); + } + else { + transformOut = Lib.extendFlat({}, transformIn); + } - if(hasColorscale(traceIn, 'line')) { - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c', noScale: true}); - } else { - var lineColorDflt = (isArrayOrTypedArray(markerColor) ? false : markerColor) || defaultColor; - coerce('line.color', lineColorDflt); + containerOut.push(transformOut); } - - coerce('line.width'); - if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":580,"../../components/colorscale/has_colorscale":584,"../../lib":696}],1057:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +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]; -'use strict'; + if(_module && _module.transform) { + dataOut = _module.transform(dataOut, { + transform: transform, + fullTrace: fullTrace, + fullData: fullData, + layout: layout, + fullLayout: fullLayout, + transformIndex: i + }); + } + } -var numConstants = _dereq_('../../constants/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 = _dereq_('../../lib'); -var segmentsIntersect = Lib.segmentsIntersect; -var constrain = Lib.constrain; -var constants = _dereq_('./constants'); + return dataOut; +} +plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { + function coerce(attr, dflt) { + return Lib.coerce(layoutIn, layoutOut, plots.layoutAttributes, attr, dflt); + } -module.exports = function linePoints(d, opts) { - var xa = opts.xaxis; - var ya = opts.yaxis; - var xLog = xa.type === 'log'; - var yLog = ya.type === 'log'; - var xLen = xa._length; - var yLen = ya._length; - var connectGaps = opts.connectGaps; - var baseTolerance = opts.baseTolerance; - var shape = opts.shape; - var linear = shape === 'linear'; - var segments = []; - var minTolerance = constants.minTolerance; - var pts = new Array(d.length); - var pti = 0; + var template = layoutIn.template; + if(Lib.isPlainObject(template)) { + layoutOut.template = template; + layoutOut._template = template.layout; + layoutOut._dataTemplate = template.data; + } - var i; + var globalFont = Lib.coerceFont(coerce, 'font'); - // pt variables are pixel coordinates [x,y] of one point - // these four are the outputs of clustering on a line - var clusterStartPt, clusterEndPt, clusterHighPt, clusterLowPt; + coerce('title.text', layoutOut._dfltTitle.plot); - // "this" is the next point we're considering adding to the cluster - var thisPt; + Lib.coerceFont(coerce, 'title.font', { + family: globalFont.family, + size: Math.round(globalFont.size * 1.4), + color: globalFont.color + }); - // did we encounter the high point first, then a low point, or vice versa? - var clusterHighFirst; + coerce('title.xref'); + coerce('title.yref'); + coerce('title.x'); + coerce('title.y'); + coerce('title.xanchor'); + coerce('title.yanchor'); + coerce('title.pad.t'); + coerce('title.pad.r'); + coerce('title.pad.b'); + coerce('title.pad.l'); - // the first two points in the cluster determine its unit vector - // so the second is always in the "High" direction - var clusterUnitVector; + // Make sure that autosize is defaulted to *true* + // on layouts with no set width and height for backward compatibly, + // in particular https://plot.ly/javascript/responsive-fluid-layout/ + // + // Before https://github.com/plotly/plotly.js/pull/635 , + // layouts with no set width and height were set temporary set to 'initial' + // to pass through the autosize routine + // + // This behavior is subject to change in v2. + coerce('autosize', !(layoutIn.width && layoutIn.height)); - // the pixel delta from clusterStartPt - var thisVector; + coerce('width'); + coerce('height'); + coerce('margin.l'); + coerce('margin.r'); + coerce('margin.t'); + coerce('margin.b'); + coerce('margin.pad'); + coerce('margin.autoexpand'); - // val variables are (signed) pixel distances along the cluster vector - var clusterRefDist, clusterHighVal, clusterLowVal, thisVal; + if(layoutIn.width && layoutIn.height) plots.sanitizeMargins(layoutOut); - // deviation variables are (signed) pixel distances normal to the cluster vector - var clusterMinDeviation, clusterMaxDeviation, thisDeviation; + Registry.getComponentMethod('grid', 'sizeDefaults')(layoutIn, layoutOut); - // turn one calcdata point into pixel coordinates - function getPt(index) { - var di = d[index]; - if(!di) return false; - var x = xa.c2p(di.x); - var y = ya.c2p(di.y); + coerce('paper_bgcolor'); - // if non-positive log values, set them VERY far off-screen - // so the line looks essentially straight from the previous point. - if(x === BADNUM) { - if(xLog) x = xa.c2p(di.x, true); - if(x === BADNUM) return false; - // If BOTH were bad log values, make the line follow a constant - // exponent rather than a constant slope - if(yLog && y === BADNUM) { - x *= Math.abs(xa._m * yLen * (xa._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS) / - (ya._m * xLen * (ya._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS))); - } - x *= 1000; - } - if(y === BADNUM) { - if(yLog) y = ya.c2p(di.y, true); - if(y === BADNUM) return false; - y *= 1000; - } - return [x, y]; - } + coerce('separators', formatObj.decimal + formatObj.thousands); + coerce('hidesources'); - 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; - } - } + coerce('colorway'); - var latestXFrac, latestYFrac; - // if we're off-screen, increase tolerance over baseTolerance - function getTolerance(pt, nextPt) { - var xFrac = pt[0] / xLen; - var yFrac = pt[1] / yLen; - var offScreenFraction = Math.max(0, -xFrac, xFrac - 1, -yFrac, yFrac - 1); - if(offScreenFraction && (latestXFrac !== undefined) && - crossesViewport(xFrac, yFrac, latestXFrac, latestYFrac) - ) { - offScreenFraction = 0; - } - if(offScreenFraction && nextPt && - crossesViewport(xFrac, yFrac, nextPt[0] / xLen, nextPt[1] / yLen) - ) { - offScreenFraction = 0; - } + coerce('datarevision'); + var uirevision = coerce('uirevision'); + coerce('editrevision', uirevision); + coerce('selectionrevision', uirevision); - return (1 + constants.toleranceGrowth * offScreenFraction) * baseTolerance; - } + coerce('modebar.orientation'); + coerce('modebar.bgcolor', Color.addOpacity(layoutOut.paper_bgcolor, 0.5)); + var modebarDefaultColor = Color.contrast(Color.rgb(layoutOut.modebar.bgcolor)); + coerce('modebar.color', Color.addOpacity(modebarDefaultColor, 0.3)); + coerce('modebar.activecolor', Color.addOpacity(modebarDefaultColor, 0.7)); + coerce('modebar.uirevision', uirevision); - function ptDist(pt1, pt2) { - var dx = pt1[0] - pt2[0]; - var dy = pt1[1] - pt2[1]; - return Math.sqrt(dx * dx + dy * dy); + coerce('meta'); + + // do not include defaults in fullLayout when users do not set transition + if(Lib.isPlainObject(layoutIn.transition)) { + coerce('transition.duration'); + coerce('transition.easing'); + coerce('transition.ordering'); } - // last bit of filtering: clip paths that are VERY far off-screen - // so we don't get near the browser's hard limit (+/- 2^29 px in Chrome and FF) + Registry.getComponentMethod( + 'calendars', + 'handleDefaults' + )(layoutIn, layoutOut, 'calendar'); - var maxScreensAway = constants.maxScreensAway; + Registry.getComponentMethod( + 'fx', + 'supplyLayoutGlobalDefaults' + )(layoutIn, layoutOut, coerce); +}; - // find the intersections between the segment from pt1 to pt2 - // and the large rectangle maxScreensAway around the viewport - // if one of pt1 and pt2 is inside and the other outside, there - // will be only one intersection. - // if both are outside there will be 0 or 2 intersections - // (or 1 if it's right at a corner - we'll treat that like 0) - // returns an array of intersection pts - 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; +plots.plotAutoSize = function plotAutoSize(gd, layout, fullLayout) { + var context = gd._context || {}; + var frameMargins = context.frameMargins; + var newWidth; + var newHeight; - // for linear line shape, edge intersections should be linearly interpolated - // spline uses this too, which isn't precisely correct but is actually pretty - // good, because Catmull-Rom weights far-away points less in creating the curvature - function getLinearEdgeIntersections(pt1, pt2) { - var out = []; - var ptCount = 0; - for(var i = 0; i < 4; i++) { - var edge = edges[i]; - 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 we have 2 intersections, make sure the closest one to pt1 comes first - if(ptCount && ptDist(ptInt, pt1) < ptDist(out[0], pt1)) out.unshift(ptInt); - else out.push(ptInt); - ptCount++; - } - } - return out; + var isPlotDiv = Lib.isPlotDiv(gd); + + if(isPlotDiv) gd.emit('plotly_autosize'); + + // embedded in an iframe - just take the full iframe size + // if we get to this point, with no aspect ratio restrictions + if(context.fillFrame) { + newWidth = window.innerWidth; + newHeight = window.innerHeight; + + // somehow we get a few extra px height sometimes... + // just hide it + document.body.style.overflow = 'hidden'; } + else { + // plotly.js - let the developers do what they want, either + // provide height and width for the container div, + // specify size in layout, or take the defaults, + // but don't enforce any ratio restrictions + var computedStyle = isPlotDiv ? window.getComputedStyle(gd) : {}; - function onlyConstrainedPoint(pt) { - if(pt[0] < xEdge0 || pt[0] > xEdge1 || pt[1] < yEdge0 || pt[1] > yEdge1) { - return [constrain(pt[0], xEdge0, xEdge1), constrain(pt[1], yEdge0, yEdge1)]; + newWidth = parseFloat(computedStyle.width) || parseFloat(computedStyle.maxWidth) || fullLayout.width; + newHeight = parseFloat(computedStyle.height) || parseFloat(computedStyle.maxHeight) || fullLayout.height; + + if(isNumeric(frameMargins) && frameMargins > 0) { + var factor = 1 - 2 * frameMargins; + newWidth = Math.round(factor * newWidth); + newHeight = Math.round(factor * newHeight); } } - 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; - } + var minWidth = plots.layoutAttributes.width.min; + var minHeight = plots.layoutAttributes.height.min; + if(newWidth < minWidth) newWidth = minWidth; + if(newHeight < minHeight) newHeight = minHeight; - // for line shapes hv and vh, movement in the two dimensions is decoupled, - // so all we need to do is constrain each dimension independently - function getHVEdgeIntersections(pt1, pt2) { - var out = []; - var ptInt1 = onlyConstrainedPoint(pt1); - var ptInt2 = onlyConstrainedPoint(pt2); - if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out; + var widthHasChanged = !layout.width && + (Math.abs(fullLayout.width - newWidth) > 1); + var heightHasChanged = !layout.height && + (Math.abs(fullLayout.height - newHeight) > 1); - if(ptInt1) out.push(ptInt1); - if(ptInt2) out.push(ptInt2); - return out; + if(heightHasChanged || widthHasChanged) { + if(widthHasChanged) fullLayout.width = newWidth; + if(heightHasChanged) fullLayout.height = newHeight; } - // hvh and vhv we sometimes have to move one of the intersection points - // out BEYOND the clipping rect, by a maximum of a factor of 2, so that - // the midpoint line is drawn in the right place - function getABAEdgeIntersections(dim, limit0, limit1) { - return function(pt1, pt2) { - var ptInt1 = onlyConstrainedPoint(pt1); - var ptInt2 = onlyConstrainedPoint(pt2); + // cache initial autosize value, used in relayout when + // width or height values are set to null + if(!gd._initialAutoSize) { + gd._initialAutoSize = { width: newWidth, height: newHeight }; + } - var out = []; - if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out; + plots.sanitizeMargins(fullLayout); +}; - if(ptInt1) out.push(ptInt1); - if(ptInt2) out.push(ptInt2); +plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { + var componentsRegistry = Registry.componentsRegistry; + var basePlotModules = layoutOut._basePlotModules; + var component, i, _module; - 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; + var Cartesian = Registry.subplotsRegistry.cartesian; - ptToAlter[dim] += midShift; - } + // check if any components need to add more base plot modules + // that weren't captured by traces + for(component in componentsRegistry) { + _module = componentsRegistry[component]; - return out; - }; + if(_module.includeBasePlot) { + _module.includeBasePlot(layoutIn, layoutOut); + } } - var getEdgeIntersections; - if(shape === 'linear' || shape === 'spline') { - getEdgeIntersections = getLinearEdgeIntersections; - } - else if(shape === 'hv' || shape === 'vh') { - getEdgeIntersections = getHVEdgeIntersections; + // make sure we *at least* have some cartesian axes + if(!basePlotModules.length) { + basePlotModules.push(Cartesian); } - else if(shape === 'hvh') getEdgeIntersections = getABAEdgeIntersections(0, xEdge0, xEdge1); - else if(shape === 'vhv') getEdgeIntersections = getABAEdgeIntersections(1, yEdge0, yEdge1); - // a segment pt1->pt2 entirely outside the nearby region: - // find the corner it gets closest to touching - 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; + // ensure all cartesian axes have at least one subplot + if(layoutOut._has('cartesian')) { + Registry.getComponentMethod('grid', 'contentDefaults')(layoutIn, layoutOut); + Cartesian.finalizeSubplots(layoutIn, layoutOut); + } - if(b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1]; - else return [m > 0 ? xEdge1 : xEdge0, yEdge0]; + // sort subplot lists + for(var subplotType in layoutOut._subplots) { + layoutOut._subplots[subplotType].sort(Lib.subplotSort); } - function updateEdge(pt) { - var x = pt[0]; - var y = pt[1]; - var xSame = x === pts[pti - 1][0]; - var ySame = y === pts[pti - 1][1]; - // duplicate point? - if(xSame && ySame) return; - if(pti > 1) { - // backtracking along an edge? - var xSame2 = x === pts[pti - 2][0]; - var ySame2 = y === pts[pti - 2][1]; - if(xSame && (x === xEdge0 || x === xEdge1) && xSame2) { - if(ySame2) pti--; // backtracking exactly - drop prev pt and don't add - else pts[pti - 1] = pt; // not exact: replace the prev pt - } - else if(ySame && (y === yEdge0 || y === yEdge1) && ySame2) { - if(xSame2) pti--; - else pts[pti - 1] = pt; - } - else pts[pti++] = pt; + // base plot module layout defaults + for(i = 0; i < basePlotModules.length; i++) { + _module = basePlotModules[i]; + + // e.g. pie does not have a layout-defaults step + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); } - else pts[pti++] = pt; } - function updateEdgesForReentry(pt) { - // if we're outside the nearby region and going back in, - // we may need to loop around a corner point - if(pts[pti - 1][0] !== pt[0] && pts[pti - 1][1] !== pt[1]) { - updateEdge([lastXEdge, lastYEdge]); + // trace module layout defaults + // use _modules rather than _visibleModules so that even + // legendonly traces can include settings - eg barmode, which affects + // legend.traceorder default value. + var modules = layoutOut._modules; + for(i = 0; i < modules.length; i++) { + _module = modules[i]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); } - updateEdge(pt); - lastFarPt = null; - lastXEdge = lastYEdge = 0; } - function addPt(pt) { - latestXFrac = pt[0] / xLen; - latestYFrac = pt[1] / yLen; - // Are we more than maxScreensAway off-screen any direction? - // if so, clip to this box, but in such a way that on-screen - // drawing is unchanged - xEdge = (pt[0] < xEdge0) ? xEdge0 : (pt[0] > xEdge1) ? xEdge1 : 0; - yEdge = (pt[1] < yEdge0) ? yEdge0 : (pt[1] > yEdge1) ? yEdge1 : 0; - if(xEdge || yEdge) { - // to get fills right - if first point is far, push it toward the - // screen in whichever direction(s) are far - if(!pti) { - pts[pti++] = [xEdge || pt[0], yEdge || pt[1]]; - } - else if(lastFarPt) { - // both this point and the last are outside the nearby region - // check if we're crossing the nearby region - var intersections = getEdgeIntersections(lastFarPt, pt); - if(intersections.length > 1) { - updateEdgesForReentry(intersections[0]); - pts[pti++] = intersections[1]; - } - } - // we're leaving the nearby region - add the point where we left it - else { - edgePt = getEdgeIntersections(pts[pti - 1], pt)[0]; - pts[pti++] = edgePt; - } + // transform module layout defaults + var transformModules = layoutOut._transformModules; + for(i = 0; i < transformModules.length; i++) { + _module = transformModules[i]; - var lastPt = pts[pti - 1]; - if(xEdge && yEdge && (lastPt[0] !== xEdge || lastPt[1] !== yEdge)) { - // we've gone out beyond a new corner: add the corner too - // so that the next point will take the right winding - if(lastFarPt) { - if(lastXEdge !== xEdge && lastYEdge !== yEdge) { - if(lastXEdge && lastYEdge) { - // we've gone around to an opposite corner - we - // need to add the correct extra corner - // in order to get the right winding - updateEdge(getClosestCorner(lastFarPt, pt)); - } - else { - // we're coming from a far edge - the extra corner - // we need is determined uniquely by the sectors - updateEdge([lastXEdge || xEdge, lastYEdge || yEdge]); - } - } - else if(lastXEdge && lastYEdge) { - updateEdge([lastXEdge, lastYEdge]); - } - } - updateEdge([xEdge, yEdge]); - } - else if((lastXEdge - xEdge) && (lastYEdge - yEdge)) { - // we're coming from an edge or far corner to an edge - again the - // extra corner we need is uniquely determined by the sectors - updateEdge([xEdge || lastXEdge, yEdge || lastYEdge]); - } - lastFarPt = pt; - lastXEdge = xEdge; - lastYEdge = yEdge; + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); } - else { - if(lastFarPt) { - // this point is in range but the previous wasn't: add its entry pt first - updateEdgesForReentry(getEdgeIntersections(lastFarPt, pt)[0]); - } + } - pts[pti++] = pt; + for(component in componentsRegistry) { + _module = componentsRegistry[component]; + + if(_module.supplyLayoutDefaults) { + _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); } } +}; - // loop over ALL points in this trace - for(i = 0; i < d.length; i++) { - clusterStartPt = getPt(i); - if(!clusterStartPt) continue; +// Remove all plotly attributes from a div so it can be replotted fresh +// TODO: these really need to be encapsulated into a much smaller set... +plots.purge = function(gd) { + // note: we DO NOT remove _context because it doesn't change when we insert + // a new plot, and may have been set outside of our scope. - pti = 0; - lastFarPt = null; - addPt(clusterStartPt); + var fullLayout = gd._fullLayout || {}; + if(fullLayout._glcontainer !== undefined) { + fullLayout._glcontainer.selectAll('.gl-canvas').remove(); + fullLayout._glcontainer.remove(); + fullLayout._glcanvas = null; + } + if(fullLayout._geocontainer !== undefined) fullLayout._geocontainer.remove(); - // loop over one segment of the trace - for(i++; i < d.length; i++) { - clusterHighPt = getPt(i); - if(!clusterHighPt) { - if(connectGaps) continue; - else break; - } + // remove modebar + if(fullLayout._modeBar) fullLayout._modeBar.destroy(); - // can't decimate if nonlinear line shape - // TODO: we *could* decimate [hv]{2,3} shapes if we restricted clusters to horz or vert again - // but spline would be verrry awkward to decimate - if(!linear || !opts.simplify) { - addPt(clusterHighPt); - continue; - } + if(gd._transitionData) { + // Ensure any dangling callbacks are simply dropped if the plot is purged. + // This is more or less only actually important for testing. + if(gd._transitionData._interruptCallbacks) { + gd._transitionData._interruptCallbacks.length = 0; + } - var nextPt = getPt(i + 1); + if(gd._transitionData._animationRaf) { + window.cancelAnimationFrame(gd._transitionData._animationRaf); + } + } - clusterRefDist = ptDist(clusterHighPt, clusterStartPt); + // remove any planned throttles + Lib.clearThrottle(); - if(clusterRefDist < getTolerance(clusterHighPt, nextPt) * minTolerance) continue; + // remove responsive handler + Lib.clearResponsive(gd); - clusterUnitVector = [ - (clusterHighPt[0] - clusterStartPt[0]) / clusterRefDist, - (clusterHighPt[1] - clusterStartPt[1]) / clusterRefDist - ]; + // data and layout + delete gd.data; + delete gd.layout; + delete gd._fullData; + delete gd._fullLayout; + delete gd.calcdata; + delete gd.framework; + delete gd.empty; - clusterLowPt = clusterStartPt; - clusterHighVal = clusterRefDist; - clusterLowVal = clusterMinDeviation = clusterMaxDeviation = 0; - clusterHighFirst = false; - clusterEndPt = clusterHighPt; + delete gd.fid; - // loop over one cluster of points that collapse onto one line - 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] - ]; - // cross product (or dot with normal to the cluster vector) - thisDeviation = thisVector[0] * clusterUnitVector[1] - thisVector[1] * clusterUnitVector[0]; - clusterMinDeviation = Math.min(clusterMinDeviation, thisDeviation); - clusterMaxDeviation = Math.max(clusterMaxDeviation, thisDeviation); + delete gd.undoqueue; // action queue + delete gd.undonum; + delete gd.autoplay; // are we doing an action that doesn't go in undo queue? + delete gd.changed; - if(clusterMaxDeviation - clusterMinDeviation > getTolerance(thisPt, nextPt)) break; + // these get recreated on Plotly.plot anyway, but just to be safe + // (and to have a record of them...) + delete gd._promises; + delete gd._redrawTimer; + delete gd._hmlumcount; + delete gd._hmpixcount; + delete gd._transitionData; + delete gd._transitioning; + delete gd._initialAutoSize; + delete gd._transitioningWithDuration; - clusterEndPt = thisPt; - thisVal = thisVector[0] * clusterUnitVector[0] + thisVector[1] * clusterUnitVector[1]; + // created during certain events, that *should* clean them up + // themselves, but may not if there was an error + delete gd._dragging; + delete gd._dragged; + delete gd._hoverdata; + delete gd._snapshotInProgress; + delete gd._editing; + delete gd._replotPending; + delete gd._mouseDownTime; + delete gd._legendMouseDownTime; - if(thisVal > clusterHighVal) { - clusterHighVal = thisVal; - clusterHighPt = thisPt; - clusterHighFirst = false; - } else if(thisVal < clusterLowVal) { - clusterLowVal = thisVal; - clusterLowPt = thisPt; - clusterHighFirst = true; - } - } + // remove all event listeners + if(gd.removeAllListeners) gd.removeAllListeners(); +}; - // insert this cluster into pts - // we've already inserted the start pt, now check if we have high and low pts - if(clusterHighFirst) { - addPt(clusterHighPt); - if(clusterEndPt !== clusterLowPt) addPt(clusterLowPt); - } else { - if(clusterLowPt !== clusterStartPt) addPt(clusterLowPt); - if(clusterEndPt !== clusterHighPt) addPt(clusterHighPt); - } - // and finally insert the end pt - addPt(clusterEndPt); +plots.style = function(gd) { + var _modules = gd._fullLayout._visibleModules; + var styleModules = []; + var i; - // have we reached the end of this segment? - if(i >= d.length || !thisPt) break; + // some trace modules reuse the same style method, + // make sure to not unnecessary call them multiple times. - // otherwise we have an out-of-cluster point to insert as next clusterStartPt - addPt(thisPt); - clusterStartPt = thisPt; + for(i = 0; i < _modules.length; i++) { + var _module = _modules[i]; + if(_module.style) { + Lib.pushUnique(styleModules, _module.style); } + } - // to get fills right - repeat what we did at the start - if(lastFarPt) updateEdge([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]); + for(i = 0; i < styleModules.length; i++) { + styleModules[i](gd); + } +}; - segments.push(pts.slice(0, pti)); +plots.sanitizeMargins = function(fullLayout) { + // polar doesn't do margins... + 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 margin.l + margin.r = 0 then plotWidth > 0 + // as width >= 10 by supplyDefaults + // similarly for margin.t + margin.b + + if(plotWidth < 0) { + correction = (width - 1) / (margin.l + margin.r); + margin.l = Math.floor(correction * margin.l); + margin.r = Math.floor(correction * margin.r); } - return segments; + 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(gd) { + gd._fullLayout._pushmarginIds = {}; +}; + +plots.allowAutoMargin = function(gd, id) { + gd._fullLayout._pushmarginIds[id] = 1; }; -},{"../../constants/numerical":673,"../../lib":696,"./constants":1047}],1058:[function(_dereq_,module,exports){ +function initMargins(fullLayout) { + var margin = fullLayout.margin; + + if(!fullLayout._size) { + var gs = 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) + }; + gs.w = Math.round(fullLayout.width) - gs.l - gs.r; + gs.h = Math.round(fullLayout.height) - gs.t - gs.b; + } + if(!fullLayout._pushmargin) fullLayout._pushmargin = {}; + if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; +} + /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * autoMargin: called by components that may need to expand the margins to + * be rendered on-plot. + * + * @param {DOM element} gd + * @param {string} id - an identifier unique (within this plot) to this object, + * so we can remove a previous margin expansion from the same object. + * @param {object} o - the margin requirements of this object, or omit to delete + * this entry (like if it's hidden). Keys are: + * x, y: plot fraction of the anchor point. + * xl, xr, yt, yb: if the object has an extent defined in plot fraction, + * you can specify both edges as plot fractions in each dimension + * l, r, t, b: the pixels to pad past the plot fraction x[l|r] and y[t|b] + * pad: extra pixels to add in all directions, default 12 (why?) + */ +plots.autoMargin = function(gd, id, o) { + var fullLayout = gd._fullLayout; + var pushMargin = fullLayout._pushmargin; + var pushMarginIds = fullLayout._pushmarginIds; -'use strict'; + if(fullLayout.margin.autoexpand !== false) { + if(!o) { + delete pushMargin[id]; + delete pushMarginIds[id]; + } + else { + var pad = o.pad; + if(pad === undefined) { + var margin = fullLayout.margin; + // if no explicit pad is given, use 12px unless there's a + // specified margin that's smaller than that + pad = Math.min(12, margin.l, margin.r, margin.t, margin.b); + } + + // if the item is too big, just give it enough automargin to + // make sure you can still grab it and bring it back + if(o.l + o.r > fullLayout.width * 0.5) o.l = o.r = 0; + if(o.b + o.t > fullLayout.height * 0.5) o.b = o.t = 0; + + var xl = o.xl !== undefined ? o.xl : o.x; + var xr = o.xr !== undefined ? o.xr : o.x; + var yt = o.yt !== undefined ? o.yt : o.y; + var yb = o.yb !== undefined ? o.yb : o.y; + pushMargin[id] = { + l: {val: xl, size: o.l + pad}, + r: {val: xr, size: o.r + pad}, + b: {val: yb, size: o.b + pad}, + t: {val: yt, size: o.t + pad} + }; + pushMarginIds[id] = 1; + } -// common to 'scatter' and 'scatterternary' -module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { - var shape = coerce('line.shape'); - if(shape === 'spline') coerce('line.smoothing'); + if(!fullLayout._replotting) plots.doAutoMargin(gd); + } }; -},{}],1059:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +plots.doAutoMargin = function(gd) { + var fullLayout = gd._fullLayout; + if(!fullLayout._size) fullLayout._size = {}; + initMargins(fullLayout); -'use strict'; + var gs = fullLayout._size; + var oldmargins = JSON.stringify(gs); + var margin = fullLayout.margin; -var LINKEDFILLS = {tonextx: 1, tonexty: 1, tonext: 1}; + // adjust margins for outside components + // fullLayout.margin is the requested margin, + // fullLayout._size has margins and plotsize after adjustment + var ml = margin.l; + var mr = margin.r; + var mt = margin.t; + var mb = margin.b; + var pushMargin = fullLayout._pushmargin; + var pushMarginIds = fullLayout._pushmarginIds; -module.exports = function linkTraces(gd, plotinfo, cdscatter) { - var trace, i, group, prevtrace, groupIndex; + if(fullLayout.margin.autoexpand !== false) { - // first sort traces to keep stacks & filled-together groups together - 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++; + for(var k in pushMargin) { + if(!pushMarginIds[k]) delete pushMargin[k]; } - if(groupIndex < prevGroupIndex) needsSort = true; - trace._groupIndex = prevGroupIndex = groupIndex; - } + // fill in the requested margins + pushMargin.base = { + l: {val: 0, size: ml}, + r: {val: 1, size: mr}, + t: {val: 1, size: mt}, + b: {val: 0, size: mb} + }; - 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); - }); - } + // now cycle through all the combinations of l and r + // (and t and b) to find the required margins - // now link traces to each other - var prevtraces = {}; - for(i = 0; i < cdscatterSorted.length; i++) { - trace = cdscatterSorted[i][0].trace; - group = trace.stackgroup || ''; + for(var k1 in pushMargin) { - // Note: The check which ensures all cdscatter here are for the same axis and - // are either cartesian or scatterternary has been removed. This code assumes - // the passed scattertraces have been filtered to the proper plot types and - // the proper subplots. - if(trace.visible === true) { - trace._nexttrace = null; + 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; - if(trace.fill in LINKEDFILLS) { - prevtrace = prevtraces[group]; - trace._prevtrace = prevtrace || null; + for(var k2 in pushMargin) { + if(isNumeric(pl) && pushMargin[k2].r) { + var fr = pushMargin[k2].r.val; + var pr = pushMargin[k2].r.size; - if(prevtrace) { - prevtrace._nexttrace = trace; + if(fr > fl) { + var newl = (pl * fr + + (pr - fullLayout.width) * fl) / (fr - fl); + var newr = (pr * (1 - fl) + + (pl - fullLayout.width) * (1 - fr)) / (fr - fl); + if(newl >= 0 && newr >= 0 && newl + newr > ml + mr) { + ml = newl; + mr = newr; + } + } + } + + if(isNumeric(pb) && pushMargin[k2].t) { + var ft = pushMargin[k2].t.val; + var pt = pushMargin[k2].t.size; + + if(ft > fb) { + var newb = (pb * ft + + (pt - fullLayout.height) * fb) / (ft - fb); + var newt = (pt * (1 - fb) + + (pb - fullLayout.height) * (1 - ft)) / (ft - fb); + if(newb >= 0 && newt >= 0 && newb + newt > mb + mt) { + mb = newb; + mt = newt; + } + } } } + } + } - trace._ownfill = (trace.fill && ( - trace.fill.substr(0, 6) === 'tozero' || - trace.fill === 'toself' || - (trace.fill.substr(0, 2) === 'to' && !trace._prevtrace) - )); + gs.l = Math.round(ml); + gs.r = Math.round(mr); + gs.t = Math.round(mt); + gs.b = Math.round(mb); + gs.p = Math.round(margin.pad); + gs.w = Math.round(fullLayout.width) - gs.l - gs.r; + gs.h = Math.round(fullLayout.height) - gs.t - gs.b; - prevtraces[group] = trace; + // if things changed and we're not already redrawing, trigger a redraw + if(!fullLayout._replotting && + oldmargins !== '{}' && + oldmargins !== JSON.stringify(fullLayout._size) + ) { + if('_redrawFromAutoMarginCount' in fullLayout) { + fullLayout._redrawFromAutoMarginCount++; } else { - trace._prevtrace = trace._nexttrace = trace._ownfill = null; + fullLayout._redrawFromAutoMarginCount = 1; } + return Registry.call('plot', gd); } - - return cdscatterSorted; }; -},{}],1060:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + * JSONify the graph data and layout + * + * This function needs to recurse because some src can be inside + * sub-objects. + * + * It also strips out functions and private (starts with _) elements. + * Therefore, we can add temporary things to data and layout that don't + * get saved. + * + * @param gd The graphDiv + * @param {Boolean} dataonly If true, don't return layout. + * @param {'keepref'|'keepdata'|'keepall'} [mode='keepref'] Filter what's kept + * keepref: remove data for which there's a src present + * eg if there's xsrc present (and xsrc is well-formed, + * ie has : and some chars before it), strip out x + * keepdata: remove all src tags, don't remove the data itself + * keepall: keep data and src + * @param {String} output If you specify 'object', the result will not be stringified + * @param {Boolean} useDefaults If truthy, use _fullLayout and _fullData + * @returns {Object|String} + */ +plots.graphJson = function(gd, dataonly, mode, output, useDefaults) { + // if the defaults aren't supplied yet, we need to do that... + if((useDefaults && dataonly && !gd._fullData) || + (useDefaults && !dataonly && !gd._fullLayout)) { + plots.supplyDefaults(gd); + } + var data = (useDefaults) ? gd._fullData : gd.data; + var layout = (useDefaults) ? gd._fullLayout : gd.layout; + var frames = (gd._transitionData || {})._frames; -'use strict'; + function stripObj(d) { + if(typeof d === 'function') { + return null; + } + if(Lib.isPlainObject(d)) { + var o = {}; + var v, src; + for(v in d) { + // remove private elements and functions + // _ is for private, [ is a mistake ie [object Object] + if(typeof d[v] === 'function' || + ['_', '['].indexOf(v.charAt(0)) !== -1) { + continue; + } -var isNumeric = _dereq_('fast-isnumeric'); + // look for src/data matches and remove the appropriate one + if(mode === 'keepdata') { + // keepdata: remove all ...src tags + if(v.substr(v.length - 3) === 'src') { + continue; + } + } + else if(mode === 'keepstream') { + // keep sourced data if it's being streamed. + // similar to keepref, but if the 'stream' object exists + // in a trace, we will keep the data array. + src = d[v + 'src']; + if(typeof src === 'string' && src.indexOf(':') > 0) { + if(!Lib.isPlainObject(d.stream)) { + continue; + } + } + } + else if(mode !== 'keepall') { + // keepref: remove sourced data but only + // if the source tag is well-formed + src = d[v + 'src']; + if(typeof src === 'string' && src.indexOf(':') > 0) { + continue; + } + } + // OK, we're including this... recurse into it + o[v] = stripObj(d[v]); + } + return o; + } -// used in the drawing step for 'scatter' and 'scattegeo' and -// in the convert step for 'scatter3d' -module.exports = function makeBubbleSizeFn(trace) { - var marker = trace.marker, - sizeRef = marker.sizeref || 1, - sizeMin = marker.sizemin || 0; + if(Array.isArray(d)) { + return d.map(stripObj); + } - // for bubble charts, allow scaling the provided value linearly - // and by area or diameter. - // Note this only applies to the array-value sizes + if(Lib.isTypedArray(d)) { + return Lib.simpleMap(d, Lib.identity); + } - var baseFn = (marker.sizemode === 'area') ? - function(v) { return Math.sqrt(v / sizeRef); } : - function(v) { return v / sizeRef; }; + // convert native dates to date strings... + // mostly for external users exporting to plotly + if(Lib.isJSDate(d)) return Lib.ms2DateTimeLocal(+d); - // TODO add support for position/negative bubbles? - // TODO add 'sizeoffset' attribute? - return function(v) { - var baseSize = baseFn(v / 2); + return d; + } - // don't show non-numeric and negative sizes - return (isNumeric(baseSize) && (baseSize > 0)) ? - Math.max(baseSize, sizeMin) : - 0; + var obj = { + data: (data || []).map(function(v) { + var d = stripObj(v); + // fit has some little arrays in it that don't contain data, + // just fit params and meta + if(dataonly) { delete d.fit; } + return d; + }) }; -}; - -},{"fast-isnumeric":214}],1061:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(!dataonly) { obj.layout = stripObj(layout); } + if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); -'use strict'; + if(frames) obj.frames = stripObj(frames); -module.exports = { - container: 'marker', - min: 'cmin', - max: 'cmax' + return (output === 'object') ? obj : JSON.stringify(obj); }; -},{}],1062:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Color = _dereq_('../../components/color'); -var hasColorscale = _dereq_('../../components/colorscale/has_colorscale'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); - -var subTypes = _dereq_('./subtypes'); - -/* - * opts: object of flags to control features not all marker users support - * noLine: caller does not support marker lines - * gradient: caller supports gradients - * noSelect: caller does not support selected/unselected attribute containers + * Modify a keyframe using a list of operations: + * + * @param {array of objects} operations + * Sequence of operations to be performed on the keyframes */ -module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { - var isBubble = subTypes.isBubble(traceIn), - lineColor = (traceIn.line || {}).color, - defaultMLC; - - opts = opts || {}; +plots.modifyFrames = function(gd, operations) { + var i, op, frame; + var _frames = gd._transitionData._frames; + var _frameHash = gd._transitionData._frameHash; - // marker.color inherit from line.color (even if line.color is an array) - if(lineColor) defaultColor = lineColor; + for(i = 0; i < operations.length; i++) { + op = operations[i]; - coerce('marker.symbol'); - coerce('marker.opacity', isBubble ? 0.7 : 1); - coerce('marker.size'); + switch(op.type) { + // No reason this couldn't exist, but is currently unused/untested: + /* case 'rename': + frame = _frames[op.index]; + delete _frameHash[frame.name]; + _frameHash[op.name] = frame; + frame.name = op.name; + break;*/ + case 'replace': + frame = op.value; + var oldName = (_frames[op.index] || {}).name; + var newName = frame.name; + _frames[op.index] = _frameHash[newName] = frame; - coerce('marker.color', defaultColor); - if(hasColorscale(traceIn, 'marker')) { - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'}); - } + if(newName !== oldName) { + // If name has changed in addition to replacement, then update + // the lookup table: + delete _frameHash[oldName]; + _frameHash[newName] = frame; + } - if(!opts.noSelect) { - coerce('selected.marker.color'); - coerce('unselected.marker.color'); - coerce('selected.marker.size'); - coerce('unselected.marker.size'); + break; + case 'insert': + frame = op.value; + _frameHash[frame.name] = frame; + _frames.splice(op.index, 0, frame); + break; + case 'delete': + frame = _frames[op.index]; + delete _frameHash[frame.name]; + _frames.splice(op.index, 1); + break; + } } - if(!opts.noLine) { - // if there's a line with a different color than the marker, use - // that line color as the default marker line color - // (except when it's an array) - // mostly this is for transparent markers to behave nicely - if(lineColor && !Array.isArray(lineColor) && (traceOut.marker.color !== lineColor)) { - defaultMLC = lineColor; - } - else if(isBubble) defaultMLC = Color.background; - else defaultMLC = Color.defaultLine; + return Promise.resolve(); +}; - coerce('marker.line.color', defaultMLC); - if(hasColorscale(traceIn, 'marker.line')) { - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.line.', cLetter: 'c'}); - } +/* + * Compute a keyframe. Merge a keyframe into its base frame(s) and + * expand properties. + * + * @param {object} frameLookup + * An object containing frames keyed by name (i.e. gd._transitionData._frameHash) + * @param {string} frame + * The name of the keyframe to be computed + * + * Returns: a new object with the merged content + */ +plots.computeFrame = function(gd, frameName) { + var frameLookup = gd._transitionData._frameHash; + var i, traceIndices, traceIndex, destIndex; - coerce('marker.line.width', isBubble ? 1 : 0); + // Null or undefined will fail on .toString(). We'll allow numbers since we + // make it clear frames must be given string names, but we'll allow numbers + // here since they're otherwise fine for looking up frames as long as they're + // properly cast to strings. We really just want to ensure here that this + // 1) doesn't fail, and + // 2) doens't give an incorrect answer (which String(frameName) would) + if(!frameName) { + throw new Error('computeFrame must be given a string frame name'); } - if(isBubble) { - coerce('marker.sizeref'); - coerce('marker.sizemin'); - coerce('marker.sizemode'); - } + var framePtr = frameLookup[frameName.toString()]; - if(opts.gradient) { - var gradientType = coerce('marker.gradient.type'); - if(gradientType !== 'none') { - coerce('marker.gradient.color'); - } + // Return false if the name is invalid: + if(!framePtr) { + return false; } -}; - -},{"../../components/color":570,"../../components/colorscale/defaults":580,"../../components/colorscale/has_colorscale":584,"./subtypes":1067}],1063:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var frameStack = [framePtr]; + var frameNameStack = [framePtr.name]; -'use strict'; - -var d3 = _dereq_('d3'); + // Follow frame pointers: + while(framePtr.baseframe && (framePtr = frameLookup[framePtr.baseframe.toString()])) { + // Avoid infinite loops: + if(frameNameStack.indexOf(framePtr.name) !== -1) break; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var ensureSingle = Lib.ensureSingle; -var identity = Lib.identity; -var Drawing = _dereq_('../../components/drawing'); + frameStack.push(framePtr); + frameNameStack.push(framePtr.name); + } -var subTypes = _dereq_('./subtypes'); -var linePoints = _dereq_('./line_points'); -var linkTraces = _dereq_('./link_traces'); -var polygonTester = _dereq_('../../lib/polygon').tester; + // A new object for the merged result: + var result = {}; -module.exports = function plot(gd, plotinfo, cdscatter, scatterLayer, transitionOpts, makeOnCompleteCallback) { - var join, onComplete; + // Merge, starting with the last and ending with the desired frame: + while((framePtr = frameStack.pop())) { + if(framePtr.layout) { + result.layout = plots.extendLayout(result.layout, framePtr.layout); + } - // If transition config is provided, then it is only a partial replot and traces not - // updated are removed. - var isFullReplot = !transitionOpts; - var hasTransition = !!transitionOpts && transitionOpts.duration > 0; + if(framePtr.data) { + if(!result.data) { + result.data = []; + } + traceIndices = framePtr.traces; - // Link traces so the z-order of fill layers is correct - var cdscatterSorted = linkTraces(gd, plotinfo, cdscatter); + if(!traceIndices) { + // If not defined, assume serial order starting at zero + traceIndices = []; + for(i = 0; i < framePtr.data.length; i++) { + traceIndices[i] = i; + } + } - join = scatterLayer.selectAll('g.trace') - .data(cdscatterSorted, function(d) { return d[0].trace.uid; }); + if(!result.traces) { + result.traces = []; + } - // Append new traces: - join.enter().append('g') - .attr('class', function(d) { - return 'trace scatter trace' + d[0].trace.uid; - }) - .style('stroke-miterlimit', 2); - join.order(); + for(i = 0; i < framePtr.data.length; i++) { + // Loop through this frames data, find out where it should go, + // and merge it! + traceIndex = traceIndices[i]; + if(traceIndex === undefined || traceIndex === null) { + continue; + } - createFills(gd, join, plotinfo); + destIndex = result.traces.indexOf(traceIndex); + if(destIndex === -1) { + destIndex = result.data.length; + result.traces[destIndex] = traceIndex; + } - if(hasTransition) { - if(makeOnCompleteCallback) { - // If it was passed a callback to register completion, make a callback. If - // this is created, then it must be executed on completion, otherwise the - // pos-transition redraw will not execute: - onComplete = makeOnCompleteCallback(); + result.data[destIndex] = plots.extendTrace(result.data[destIndex], framePtr.data[i]); + } } - - var transition = d3.transition() - .duration(transitionOpts.duration) - .ease(transitionOpts.easing) - .each('end', function() { - onComplete && onComplete(); - }) - .each('interrupt', function() { - onComplete && onComplete(); - }); - - transition.each(function() { - // Must run the selection again since otherwise enters/updates get grouped together - // and these get executed out of order. Except we need them in order! - scatterLayer.selectAll('g.trace').each(function(d, i) { - plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts); - }); - }); - } else { - join.each(function(d, i) { - plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts); - }); } - if(isFullReplot) { - join.exit().remove(); + return result; +}; + +/* + * Recompute the lookup table that maps frame name -> frame object. addFrames/ + * deleteFrames already manages this data one at a time, so the only time this + * is necessary is if you poke around manually in `gd._transitionData._frames` + * and create and haven't updated the lookup table. + */ +plots.recomputeFrameHash = function(gd) { + var hash = gd._transitionData._frameHash = {}; + var frames = gd._transitionData._frames; + for(var i = 0; i < frames.length; i++) { + var frame = frames[i]; + if(frame && frame.name) { + hash[frame.name] = frame; + } } - - // remove paths that didn't get used - scatterLayer.selectAll('path:not([d])').remove(); }; -function createFills(gd, traceJoin, plotinfo) { - traceJoin.each(function(d) { - var fills = ensureSingle(d3.select(this), 'g', 'fills'); - Drawing.setClipUrl(fills, plotinfo.layerClipId); +/** + * Extend an object, treating container arrays very differently by extracting + * their contents and merging them separately. + * + * This exists so that we can extendDeepNoArrays and avoid stepping into data + * arrays without knowledge of the plot schema, but so that we may also manually + * recurse into known container arrays, such as transforms. + * + * See extendTrace and extendLayout below for usage. + */ +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 = {}; - var trace = d[0].trace; + // Step through and extract any container properties. Otherwise extendDeepNoArrays + // will clobber any existing properties with an empty array and then supplyDefaults + // will reset everything to defaults. + if(containerPaths && containerPaths.length) { + for(i = 0; i < containerPaths.length; i++) { + containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); + containerVal = containerProp.get(); - var fillData = []; - if(trace._ownfill) fillData.push('_ownFill'); - if(trace._nexttrace) fillData.push('_nextFill'); + if(containerVal === undefined) { + Lib.nestedProperty(containerObj, containerPaths[i]).set(null); + } + else { + containerProp.set(null); + Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); + } + } + } - var fillJoin = fills.selectAll('g').data(fillData, identity); + dest = Lib.extendDeepNoArrays(dest || {}, expandedObj); - fillJoin.enter().append('g'); + if(containerPaths && containerPaths.length) { + for(i = 0; i < containerPaths.length; i++) { + srcProp = Lib.nestedProperty(containerObj, containerPaths[i]); + srcContainer = srcProp.get(); - fillJoin.exit() - .each(function(d) { trace[d] = null; }) - .remove(); + if(!srcContainer) continue; - fillJoin.order().each(function(d) { - // make a path element inside the fill group, just so - // we can give it its own data later on and the group can - // keep its simple '_*Fill' data - trace[d] = ensureSingle(d3.select(this), 'path', 'js-fill'); - }); - }); -} + destProp = Lib.nestedProperty(dest, containerPaths[i]); + destContainer = destProp.get(); -function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transitionOpts) { - var i; + if(!Array.isArray(destContainer)) { + destContainer = []; + destProp.set(destContainer); + } - // Since this has been reorganized and we're executing this on individual traces, - // we need to pass it the full list of cdscatter as well as this trace's index (idx) - // since it does an internal n^2 loop over comparisons with other traces: - selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll); + for(j = 0; j < srcContainer.length; j++) { + var srcObj = srcContainer[j]; - var hasTransition = !!transitionOpts && transitionOpts.duration > 0; + if(srcObj === null) destContainer[j] = null; + else { + destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); + } + } - function transition(selection) { - return hasTransition ? selection.transition() : selection; + destProp.set(destContainer); + } } - var xa = plotinfo.xaxis, - ya = plotinfo.yaxis; - - var trace = cdscatter[0].trace; - var line = trace.line; - var tr = d3.select(element); + return dest; +}; - var errorBarGroup = ensureSingle(tr, 'g', 'errorbars'); - var lines = ensureSingle(tr, 'g', 'lines'); - var points = ensureSingle(tr, 'g', 'points'); - var text = ensureSingle(tr, 'g', 'text'); +plots.dataArrayContainers = ['transforms', 'dimensions']; +plots.layoutArrayContainers = Registry.layoutArrayContainers; - // error bars are at the bottom - Registry.getComponentMethod('errorbars', 'plot')(errorBarGroup, plotinfo, transitionOpts); +/* + * Extend a trace definition. This method: + * + * 1. directly transfers any array references + * 2. manually recurses into container arrays like transforms + * + * The result is the original object reference with the new contents merged in. + */ +plots.extendTrace = function(destTrace, srcTrace) { + return plots.extendObjectWithContainers(destTrace, srcTrace, plots.dataArrayContainers); +}; - if(trace.visible !== true) return; +/* + * Extend a layout definition. This method: + * + * 1. directly transfers any array references (not critically important for + * layout since there aren't really data arrays) + * 2. manually recurses into container arrays like annotations + * + * The result is the original object reference with the new contents merged in. + */ +plots.extendLayout = function(destLayout, srcLayout) { + return plots.extendObjectWithContainers(destLayout, srcLayout, plots.layoutArrayContainers); +}; - transition(tr).style('opacity', trace.opacity); +/** + * Transition to a set of new data and layout properties from Plotly.animate + * + * @param {DOM element} gd + * @param {Object[]} data + * an array of data objects following the normal Plotly data definition format + * @param {Object} layout + * a layout object, following normal Plotly layout format + * @param {Number[]} traces + * indices of the corresponding traces specified in `data` + * @param {Object} frameOpts + * options for the frame (i.e. whether to redraw post-transition) + * @param {Object} transitionOpts + * options for the transition + */ +plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) { + var opts = {redraw: frameOpts.redraw}; + var transitionedTraces = []; + var axEdits = []; - // BUILD LINES AND FILLS - var ownFillEl3, tonext; - var ownFillDir = trace.fill.charAt(trace.fill.length - 1); - if(ownFillDir !== 'x' && ownFillDir !== 'y') ownFillDir = ''; + opts.prepareFn = function() { + var dataLength = Array.isArray(data) ? data.length : 0; + var traceIndices = traces.slice(0, dataLength); - // store node for tweaking by selectPoints - if(!plotinfo.isRangePlot) cdscatter[0].node3 = tr; + for(var i = 0; i < traceIndices.length; i++) { + var traceIdx = traceIndices[i]; + var trace = gd._fullData[traceIdx]; + var module = trace._module; - var prevRevpath = ''; - var prevPolygons = []; - var prevtrace = trace._prevtrace; + // There's nothing to do if this module is not defined: + if(!module) continue; - if(prevtrace) { - prevRevpath = prevtrace._prevRevpath || ''; - tonext = prevtrace._nextFill; - prevPolygons = prevtrace._polygons; - } + // Don't register the trace as transitioned if it doesn't know what to do. + // If it *is* registered, it will receive a callback that it's responsible + // for calling in order to register the transition as having completed. + if(module.animatable) { + transitionedTraces.push(traceIdx); + } - var thispath, - thisrevpath, - // fullpath is all paths for this curve, joined together straight - // across gaps, for filling - fullpath = '', - // revpath is fullpath reversed, for fill-to-next - revpath = '', - // functions for converting a point array to a path - pathfn, revpathbase, revpathfn, - // variables used before and after the data join - pt0, lastSegment, pt1, thisPolygons; + gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]); + } - // initialize line join data / method - var segments = [], - makeUpdate = Lib.noop; + // Follow the same procedure. Clone it so we don't mangle the input, then + // expand any object paths so we can merge deep into gd.layout: + var layoutUpdate = Lib.expandObjectPaths(Lib.extendDeepNoArrays({}, layout)); - ownFillEl3 = trace._ownFill; + // Before merging though, we need to modify the incoming layout. We only + // know how to *transition* layout ranges, so it's imperative that a new + // range not be sent to the layout before the transition has started. So + // we must remove the things we can transition: + var axisAttrRe = /^[xy]axis[0-9]*$/; + for(var attr in layoutUpdate) { + if(!axisAttrRe.test(attr)) continue; + delete layoutUpdate[attr].range; + } - if(subTypes.hasLines(trace) || trace.fill !== 'none') { + plots.extendLayout(gd.layout, layoutUpdate); - if(tonext) { - // This tells .style which trace to use for fill information: - tonext.datum(cdscatter); - } + // Supply defaults after applying the incoming properties. Note that any attempt + // to simplify this step and reduce the amount of work resulted in the reconstruction + // of essentially the whole supplyDefaults step, so that it seems sensible to just use + // supplyDefaults even though it's heavier than would otherwise be desired for + // transitions: - 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(pts) { - var pLast = pts[pts.length - 1]; - if(pts.length > 1 && pts[0][0] === pLast[0] && pts[0][1] === pLast[1]) { - // identical start and end points: treat it as a - // closed curve so we don't get a kink - return Drawing.smoothclosed(pts.slice(1), line.smoothing); - } - else { - return Drawing.smoothopen(pts, line.smoothing); - } - }; - } - else { - pathfn = revpathbase = function(pts) { - return 'M' + pts.join('L'); - }; - } + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; - revpathfn = function(pts) { - // note: this is destructive (reverses pts in place) so can't use pts after this - return revpathbase(pts.reverse()); - }; + plots.supplyDefaults(gd); + plots.doCalcdata(gd); - segments = linePoints(cdscatter, { - xaxis: xa, - yaxis: ya, - connectGaps: trace.connectgaps, - baseTolerance: Math.max(line.width || 1, 3) / 4, - shape: line.shape, - simplify: line.simplify - }); + var newLayout = Lib.expandObjectPaths(layout); - // since we already have the pixel segments here, use them to make - // polygons for hover on fill - // TODO: can we skip this if hoveron!=fills? That would mean we - // need to redraw when you change hoveron... - thisPolygons = trace._polygons = new Array(segments.length); - for(i = 0; i < segments.length; i++) { - trace._polygons[i] = polygonTester(segments[i]); - } + if(newLayout) { + var subplots = gd._fullLayout._plots; - if(segments.length) { - pt0 = segments[0][0]; - lastSegment = segments[segments.length - 1]; - pt1 = lastSegment[lastSegment.length - 1]; - } + for(var k in subplots) { + var plotinfo = subplots[k]; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var xr0 = xa.range.slice(); + var yr0 = ya.range.slice(); - makeUpdate = function(isEnter) { - return function(pts) { - thispath = pathfn(pts); - thisrevpath = revpathfn(pts); - if(!fullpath) { - fullpath = thispath; - revpath = thisrevpath; - } - else if(ownFillDir) { - fullpath += 'L' + thispath.substr(1); - revpath = thisrevpath + ('L' + revpath.substr(1)); + var xr1; + if(Array.isArray(newLayout[xa._name + '.range'])) { + xr1 = newLayout[xa._name + '.range'].slice(); + } else if(Array.isArray((newLayout[xa._name] || {}).range)) { + xr1 = newLayout[xa._name].range.slice(); } - else { - fullpath += 'Z' + thispath; - revpath = thisrevpath + 'Z' + revpath; + + var yr1; + if(Array.isArray(newLayout[ya._name + '.range'])) { + yr1 = newLayout[ya._name + '.range'].slice(); + } else if(Array.isArray((newLayout[ya._name] || {}).range)) { + yr1 = newLayout[ya._name].range.slice(); } - if(subTypes.hasLines(trace) && pts.length > 1) { - var el = d3.select(this); + var editX; + if(xr0 && xr1 && (xr0[0] !== xr1[0] || xr0[1] !== xr1[1])) { + editX = {xr0: xr0, xr1: xr1}; + } - // This makes the coloring work correctly: - el.datum(cdscatter); + var editY; + if(yr0 && yr1 && (yr0[0] !== yr1[0] || yr0[1] !== yr1[1])) { + editY = {yr0: yr0, yr1: yr1}; + } - 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); - } + if(editX || editY) { + axEdits.push(Lib.extendFlat({plotinfo: plotinfo}, editX, editY)); } - }; - }; - } + } + } - var lineJoin = lines.selectAll('.js-line').data(segments); + return Promise.resolve(); + }; - transition(lineJoin.exit()) - .style('opacity', 0) - .remove(); + opts.runFn = function(makeCallback) { + var traceTransitionOpts; + var basePlotModules = gd._fullLayout._basePlotModules; + var hasAxisTransition = axEdits.length; + var i; - lineJoin.each(makeUpdate(false)); + if(layout) { + for(i = 0; i < basePlotModules.length; i++) { + if(basePlotModules[i].transitionAxes) { + basePlotModules[i].transitionAxes(gd, axEdits, transitionOpts, makeCallback); + } + } + } - lineJoin.enter().append('path') - .classed('js-line', true) - .style('vector-effect', 'non-scaling-stroke') - .call(Drawing.lineGroupStyle) - .each(makeUpdate(true)); + // Here handle the exception that we refuse to animate scales and axes at the same + // time. In other words, if there's an axis transition, then set the data transition + // to instantaneous. + if(hasAxisTransition) { + traceTransitionOpts = Lib.extendFlat({}, transitionOpts); + traceTransitionOpts.duration = 0; + // This means do not transition traces, + // this happens on layout-only (e.g. axis range) animations + transitionedTraces = null; + } else { + traceTransitionOpts = transitionOpts; + } - Drawing.setClipUrl(lineJoin, plotinfo.layerClipId); + for(i = 0; i < basePlotModules.length; i++) { + // Note that we pass a callback to *create* the callback that must be invoked on completion. + // This is since not all traces know about transitions, so it greatly simplifies matters if + // the trace is responsible for creating a callback, if needed, and then executing it when + // the time is right. + basePlotModules[i].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback); + } + }; - function clearFill(selection) { - transition(selection).attr('d', 'M0,0Z'); - } + return _transition(gd, transitionOpts, opts); +}; - if(segments.length) { - if(ownFillEl3) { - ownFillEl3.datum(cdscatter); - if(pt0 && pt1) { - if(ownFillDir) { - if(ownFillDir === 'y') { - pt0[1] = pt1[1] = ya.c2p(0, true); - } - else if(ownFillDir === 'x') { - pt0[0] = pt1[0] = xa.c2p(0, true); - } +/** + * Transition to a set of new data and layout properties from Plotly.react + * + * @param {DOM element} gd + * @param {object} restyleFlags + * - anim {'all'|'some'} + * @param {object} relayoutFlags + * - anim {'all'|'some'} + * @param {object} oldFullLayout : old (pre Plotly.react) fullLayout + */ +plots.transitionFromReact = function(gd, restyleFlags, relayoutFlags, oldFullLayout) { + var fullLayout = gd._fullLayout; + var transitionOpts = fullLayout.transition; + var opts = {}; + var axEdits = []; - // fill to zero: full trace path, plus extension of - // the endpoints to the appropriate axis - // For the sake of animations, wrap the points around so that - // the points on the axes are the first two points. Otherwise - // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) - .call(Drawing.singleFillStyle); - } else { - // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z') - .call(Drawing.singleFillStyle); - } - } - } - else if(tonext) { - if(trace.fill.substr(0, 6) === 'tonext' && fullpath && prevRevpath) { - // fill to next: full trace path, plus the previous path reversed - if(trace.fill === 'tonext') { - // tonext: for use by concentric shapes, like manually constructed - // contours, we just add the two paths closed on themselves. - // This makes strange results if one path is *not* entirely - // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') - .call(Drawing.singleFillStyle); - } - else { - // tonextx/y: for now just connect endpoints with lines. This is - // the correct behavior if the endpoints are at the same value of - // y/x, but if they *aren't*, we should ideally do more complicated - // things depending on whether the new endpoint projects onto the - // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') - .call(Drawing.singleFillStyle); - } - trace._polygons = trace._polygons.concat(prevPolygons); - } - else { - clearFill(tonext); - trace._polygons = null; - } - } - trace._prevRevpath = revpath; - trace._prevPolygons = thisPolygons; - } - else { - if(ownFillEl3) clearFill(ownFillEl3); - else if(tonext) clearFill(tonext); - trace._polygons = trace._prevRevpath = trace._prevPolygons = null; - } + opts.prepareFn = function() { + var subplots = fullLayout._plots; + // no need to redraw at end of transition, + // if all changes are animatable + opts.redraw = false; + if(restyleFlags.anim === 'some') opts.redraw = true; + if(relayoutFlags.anim === 'some') opts.redraw = true; - function visFilter(d) { - return d.filter(function(v) { return !v.gap && v.vis; }); - } + for(var k in subplots) { + var plotinfo = subplots[k]; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var xr0 = oldFullLayout[xa._name].range.slice(); + var yr0 = oldFullLayout[ya._name].range.slice(); + var xr1 = xa.range.slice(); + var yr1 = ya.range.slice(); - function visFilterWithGaps(d) { - return d.filter(function(v) { return v.vis; }); - } + xa.setScale(); + ya.setScale(); - function gapFilter(d) { - return d.filter(function(v) { return !v.gap; }); - } + var editX; + if(xr0[0] !== xr1[0] || xr0[1] !== xr1[1]) { + editX = {xr0: xr0, xr1: xr1}; + } - function keyFunc(d) { - return d.id; - } + var editY; + if(yr0[0] !== yr1[0] || yr0[1] !== yr1[1]) { + editY = {yr0: yr0, yr1: yr1}; + } - // Returns a function if the trace is keyed, otherwise returns undefined - function getKeyFunc(trace) { - if(trace.ids) { - return keyFunc; + if(editX || editY) { + axEdits.push(Lib.extendFlat({plotinfo: plotinfo}, editX, editY)); + } } - } - function hideFilter() { - return false; - } + return Promise.resolve(); + }; - function makePoints(points, text, cdscatter) { - var join, selection, hasNode; + opts.runFn = function(makeCallback) { + var fullData = gd._fullData; + var fullLayout = gd._fullLayout; + var basePlotModules = fullLayout._basePlotModules; - var trace = cdscatter[0].trace; - var showMarkers = subTypes.hasMarkers(trace); - var showText = subTypes.hasText(trace); + var axisTransitionOpts; + var traceTransitionOpts; + var transitionedTraces; - var keyFunc = getKeyFunc(trace); - var markerFilter = hideFilter; - var textFilter = hideFilter; + var allTraceIndices = []; + for(var i = 0; i < fullData.length; i++) { + allTraceIndices.push(i); + } - if(showMarkers || showText) { - var showFilter = identity; - // if we're stacking, "infer zero" gap mode gets markers in the - // gap points - because we've inferred a zero there - but other - // modes (currently "interpolate", later "interrupt" hopefully) - // we don't draw generated markers - var stackGroup = trace.stackgroup; - var isInferZero = stackGroup && ( - gd._fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup].stackgaps === 'infer zero'); - if(trace.marker.maxdisplayed || trace._needsCull) { - showFilter = isInferZero ? visFilterWithGaps : visFilter; - } - else if(stackGroup && !isInferZero) { - showFilter = gapFilter; + function transitionAxes() { + for(var j = 0; j < basePlotModules.length; j++) { + if(basePlotModules[j].transitionAxes) { + basePlotModules[j].transitionAxes(gd, axEdits, axisTransitionOpts, makeCallback); + } } - - if(showMarkers) markerFilter = showFilter; - if(showText) textFilter = showFilter; } - // marker points + function transitionTraces() { + for(var j = 0; j < basePlotModules.length; j++) { + basePlotModules[j].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback); + } + } - selection = points.selectAll('path.point'); + if(axEdits.length && restyleFlags.anim) { + if(transitionOpts.ordering === 'traces first') { + axisTransitionOpts = Lib.extendFlat({}, transitionOpts, {duration: 0}); + transitionedTraces = allTraceIndices; + traceTransitionOpts = transitionOpts; + transitionTraces(); + setTimeout(transitionAxes, transitionOpts.duration); + } else { + axisTransitionOpts = transitionOpts; + transitionedTraces = null; + traceTransitionOpts = Lib.extendFlat({}, transitionOpts, {duration: 0}); + transitionAxes(); + transitionTraces(); + } + } else if(axEdits.length) { + axisTransitionOpts = transitionOpts; + transitionAxes(); + } else if(restyleFlags.anim) { + transitionedTraces = allTraceIndices; + traceTransitionOpts = transitionOpts; + transitionTraces(); + } + }; - join = selection.data(markerFilter, keyFunc); + return _transition(gd, transitionOpts, opts); +}; - var enter = join.enter().append('path') - .classed('point', true); +/** + * trace/layout transition wrapper that works + * for transitions initiated by Plotly.animate and Plotly.react. + * + * @param {DOM element} gd + * @param {object} transitionOpts + * @param {object} opts + * - redraw {boolean} + * - prepareFn {function} *should return a Promise* + * - runFn {function} ran inside executeTransitions + */ +function _transition(gd, transitionOpts, opts) { + var aborted = false; - if(hasTransition) { - enter - .call(Drawing.pointStyle, trace, gd) - .call(Drawing.translatePoints, xa, ya) - .style('opacity', 0) - .transition() - .style('opacity', 1); + function executeCallbacks(list) { + var p = Promise.resolve(); + if(!list) return p; + while(list.length) { + p = p.then((list.shift())); } + return p; + } - join.order(); - - var styleFns; - if(showMarkers) { - styleFns = Drawing.makePointStyleFns(trace); + function flushCallbacks(list) { + if(!list) return; + while(list.length) { + list.shift(); } + } - join.each(function(d) { - var el = d3.select(this); - var sel = transition(el); - hasNode = Drawing.translatePoint(d, sel, xa, ya); - - if(hasNode) { - Drawing.singlePointStyle(d, sel, trace, styleFns, gd); + function executeTransitions() { + gd.emit('plotly_transitioning', []); - if(plotinfo.layerClipId) { - Drawing.hideOutsideRangePoint(d, sel, xa, ya, trace.xcalendar, trace.ycalendar); - } + return new Promise(function(resolve) { + // This flag is used to disabled things like autorange: + gd._transitioning = true; - if(trace.customdata) { - el.classed('plotly-customdata', d.data !== null && d.data !== undefined); - } - } else { - sel.remove(); + // When instantaneous updates are coming through quickly, it's too much to simply disable + // all interaction, so store this flag so we can disambiguate whether mouse interactions + // should be fully disabled or not: + if(transitionOpts.duration > 0) { + gd._transitioningWithDuration = true; } - }); - if(hasTransition) { - join.exit().transition() - .style('opacity', 0) - .remove(); - } else { - join.exit().remove(); - } + // If another transition is triggered, this callback will be executed simply because it's + // in the interruptCallbacks queue. If this transition completes, it will instead flush + // that queue and forget about this callback. + gd._transitionData._interruptCallbacks.push(function() { + aborted = true; + }); - // text points - selection = text.selectAll('g'); - join = selection.data(textFilter, keyFunc); + if(opts.redraw) { + gd._transitionData._interruptCallbacks.push(function() { + return Registry.call('redraw', gd); + }); + } - // each text needs to go in its own 'g' in case - // it gets converted to mathjax - join.enter().append('g').classed('textpoint', true).append('text'); + // Emit this and make sure it happens last: + gd._transitionData._interruptCallbacks.push(function() { + gd.emit('plotly_transitioninterrupted', []); + }); - join.order(); + // Construct callbacks that are executed on transition end. This ensures the d3 transitions + // are *complete* before anything else is done. + var numCallbacks = 0; + var numCompleted = 0; + function makeCallback() { + numCallbacks++; + return function() { + numCompleted++; + // When all are complete, perform a redraw: + if(!aborted && numCompleted === numCallbacks) { + completeTransition(resolve); + } + }; + } - join.each(function(d) { - var g = d3.select(this); - var sel = transition(g.select('text')); - hasNode = Drawing.translatePoint(d, sel, xa, ya); + opts.runFn(makeCallback); - if(hasNode) { - if(plotinfo.layerClipId) { - Drawing.hideOutsideRangePoint(d, g, xa, ya, trace.xcalendar, trace.ycalendar); - } - } else { - g.remove(); - } + // If nothing else creates a callback, then this will trigger the completion in the next tick: + setTimeout(makeCallback()); }); + } - join.selectAll('text') - .call(Drawing.textPointStyle, trace, gd) - .each(function(d) { - // This just *has* to be totally custom becuase of SVG text positioning :( - // It's obviously copied from translatePoint; we just can't use that - var x = xa.c2p(d.x); - var y = ya.c2p(d.y); + function completeTransition(callback) { + // This a simple workaround for tests which purge the graph before animations + // have completed. That's not a very common case, so this is the simplest + // fix. + if(!gd._transitionData) return; - d3.select(this).selectAll('tspan.line').each(function() { - transition(d3.select(this)).attr({x: x, y: y}); - }); - }); + flushCallbacks(gd._transitionData._interruptCallbacks); - join.exit().remove(); - } + return Promise.resolve().then(function() { + if(opts.redraw) { + return Registry.call('redraw', gd); + } + }).then(function() { + // Set transitioning false again once the redraw has occurred. This is used, for example, + // to prevent the trailing redraw from autoranging: + gd._transitioning = false; + gd._transitioningWithDuration = false; - points.datum(cdscatter); - text.datum(cdscatter); - makePoints(points, text, cdscatter); + gd.emit('plotly_transitioned', []); + }).then(callback); + } - // lastly, clip points groups of `cliponaxis !== false` traces - // on `plotinfo._hasClipOnAxisFalse === true` subplots - var hasClipOnAxisFalse = trace.cliponaxis === false; - var clipUrl = hasClipOnAxisFalse ? null : plotinfo.layerClipId; - Drawing.setClipUrl(points, clipUrl); - Drawing.setClipUrl(text, clipUrl); -} + function interruptPreviousTransitions() { + // Fail-safe against purged plot: + if(!gd._transitionData) return; -function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { - var xa = plotinfo.xaxis, - ya = plotinfo.yaxis, - xr = d3.extent(Lib.simpleMap(xa.range, xa.r2c)), - yr = d3.extent(Lib.simpleMap(ya.range, ya.r2c)); + // If a transition is interrupted, set this to false. At the moment, the only thing that would + // interrupt a transition is another transition, so that it will momentarily be set to true + // again, but this determines whether autorange or dragbox work, so it's for the sake of + // cleanliness: + gd._transitioning = false; - var trace = cdscatter[0].trace; - if(!subTypes.hasMarkers(trace)) return; - // if marker.maxdisplayed is used, select a maximum of - // mnum markers to show, from the set that are in the viewport - var mnum = trace.marker.maxdisplayed; + return executeCallbacks(gd._transitionData._interruptCallbacks); + } - // TODO: remove some as we get away from the viewport? - if(mnum === 0) return; + var seq = [ + plots.previousPromises, + interruptPreviousTransitions, + opts.prepareFn, + plots.rehover, + executeTransitions + ]; - var cd = cdscatter.filter(function(v) { - return v.x >= xr[0] && v.x <= xr[1] && v.y >= yr[0] && v.y <= yr[1]; - }), - inc = Math.ceil(cd.length / mnum), - tnum = 0; - cdscatterAll.forEach(function(cdj, j) { - var tracei = cdj[0].trace; - if(subTypes.hasMarkers(tracei) && - tracei.marker.maxdisplayed > 0 && j < idx) { - tnum++; - } - }); + var transitionStarting = Lib.syncOrAsync(seq, gd); - // if multiple traces use maxdisplayed, stagger which markers we - // display this formula offsets successive traces by 1/3 of the - // increment, adding an extra small amount after each triplet so - // it's not quite periodic - var i0 = Math.round(tnum * inc / 3 + Math.floor(tnum / 3) * inc / 7.1); + if(!transitionStarting || !transitionStarting.then) { + transitionStarting = Promise.resolve(); + } - // for error bars: save in cd which markers to show - // so we don't have to repeat this - cdscatter.forEach(function(v) { delete v.vis; }); - cd.forEach(function(v, i) { - if(Math.round((i + i0) % inc) === 0) v.vis = true; - }); + return transitionStarting.then(function() { return gd; }); } -},{"../../components/drawing":595,"../../lib":696,"../../lib/polygon":708,"../../registry":827,"./line_points":1057,"./link_traces":1059,"./subtypes":1067,"d3":148}],1064:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +plots.doCalcdata = function(gd, traces) { + var axList = axisIDs.list(gd); + var fullData = gd._fullData; + var fullLayout = gd._fullLayout; + var trace, _module, i, j; -'use strict'; + // XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without + // *all* needing doCalcdata: + var calcdata = new Array(fullData.length); + var oldCalcdata = (gd.calcdata || []).slice(0); + gd.calcdata = calcdata; -var subtypes = _dereq_('./subtypes'); + // extra helper variables -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd, - xa = searchInfo.xaxis, - ya = searchInfo.yaxis, - selection = [], - trace = cd[0].trace, - i, - di, - x, - y; + // how many box/violins plots do we have (in case they're grouped) + fullLayout._numBoxes = 0; + fullLayout._numViolins = 0; - var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); - if(hasOnlyLines) return []; + // initialize violin per-scale-group stats container + fullLayout._violinScaleGroupStats = {}; - if(selectionTester === false) { // clear selection - for(i = 0; i < cd.length; i++) { - cd[i].selected = 0; - } - } - else { - for(i = 0; i < cd.length; i++) { - di = cd[i]; - x = xa.c2p(di.x); - y = ya.c2p(di.y); + // for calculating avg luminosity of heatmaps + gd._hmpixcount = 0; + gd._hmlumcount = 0; - if((di.i !== null) && selectionTester.contains([x, y], false, i, searchInfo)) { - selection.push({ - pointNumber: di.i, - x: xa.c2d(di.x), - y: ya.c2d(di.y) - }); - di.selected = 1; - } else { - di.selected = 0; - } + // for sharing colors across pies (and for legend) + fullLayout._piecolormap = {}; + + // If traces were specified and this trace was not included, + // then transfer it over from the old calcdata: + for(i = 0; i < fullData.length; i++) { + if(Array.isArray(traces) && traces.indexOf(i) === -1) { + calcdata[i] = oldCalcdata[i]; + continue; } } - return selection; -}; - -},{"./subtypes":1067}],1065:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; -'use strict'; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); -var perStackAttrs = ['orientation', 'groupnorm', 'stackgaps']; + // keep track of trace extremes (for autorange) in here + trace._extremes = {}; + } -module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) { - var stackOpts = layout._scatterStackOpts; + // add polar axes to axis list + var polarIds = fullLayout._subplots.polar || []; + for(i = 0; i < polarIds.length; i++) { + axList.push( + fullLayout[polarIds[i]].radialaxis, + fullLayout[polarIds[i]].angularaxis + ); + } - var stackGroup = coerce('stackgroup'); - if(stackGroup) { - // use independent stacking options per subplot - var subplot = traceOut.xaxis + traceOut.yaxis; - var subplotStackOpts = stackOpts[subplot]; - if(!subplotStackOpts) subplotStackOpts = stackOpts[subplot] = {}; + setupAxisCategories(axList, fullData); - 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; - } - // TODO: how is this going to work with groupby transforms? - // in principle it should be OK I guess, as long as explicit group styles - // don't override explicit base-trace styles? + var hasCalcTransform = false; - var dflts = { - orientation: (traceOut.x && !traceOut.y) ? 'h' : 'v' - }; + // transform loop + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; - for(var i = 0; i < perStackAttrs.length; i++) { - var attr = perStackAttrs[i]; - var attrFound = attr + 'Found'; - if(!groupOpts[attrFound]) { - var traceHasAttr = traceIn[attr] !== undefined; - var isOrientation = attr === 'orientation'; - if(traceHasAttr || firstTrace) { - groupOpts[attr] = coerce(attr, dflts[attr]); + if(trace.visible === true && trace.transforms) { + _module = trace._module; - if(isOrientation) { - groupOpts.fillDflt = groupOpts[attr] === 'h' ? - 'tonextx' : 'tonexty'; - } + // we need one round of trace module calc before + // the calc transform to 'fill in' the categories list + // used for example in the data-to-coordinate method + if(_module && _module.calc) { + var cdi = _module.calc(gd, trace); - if(traceHasAttr) { - // Note: this will show a value here even if it's invalid - // in which case it will revert to default. - groupOpts[attrFound] = true; + // must clear scene 'batches', so that 2nd + // _module.calc call starts from scratch + if(cdi[0] && cdi[0].t && cdi[0].t._scene) { + delete cdi[0].t._scene.dirty; + } + } - // Note: only one trace in the stack will get a _fullData - // entry for a given stack-wide attribute. If no traces - // (or the first trace) specify that attribute, the - // first trace will get it. If the first trace does NOT - // specify it but some later trace does, then it gets - // removed from the first trace and only included in the - // one that specified it. This is mostly important for - // editors (that want to see the full values to know - // what settings are available) and Plotly.react diffing. - // Editors may want to use fullLayout._scatterStackOpts - // directly and make these settings available from all - // traces in the stack... then set the new value into - // the first trace, and clear all later traces. - if(!firstTrace) { - delete groupOpts.traces[0][attr]; + for(j = 0; j < trace.transforms.length; j++) { + var transform = trace.transforms[j]; - // orientation can affect default fill of previous traces - 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; - } - } - } - } - } + _module = transformsRegistry[transform.type]; + if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; + hasCalcTransform = true; + _module.calcTransform(gd, trace, transform); } } } - return groupOpts; } -}; - -},{}],1066:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // clear stuff that should recomputed in 'regular' loop + if(hasCalcTransform) setupAxisCategories(axList, fullData); -'use strict'; + function calci(i, isContainer) { + trace = fullData[i]; + _module = trace._module; -var d3 = _dereq_('d3'); -var Drawing = _dereq_('../../components/drawing'); -var Registry = _dereq_('../../registry'); + if(!!_module.isContainer !== isContainer) return; -function style(gd, cd) { - var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.scatter'); + var cd = []; - s.style('opacity', function(d) { - return d[0].trace.opacity; - }); + if(trace.visible === true) { - s.selectAll('g.points').each(function(d) { - var sel = d3.select(this); - var trace = d.trace || d[0].trace; - stylePoints(sel, trace, gd); - }); + // clear existing ref in case it got relinked + delete trace._indexToPoints; + // keep ref of index-to-points map object of the *last* enabled transform, + // this index-to-points map object is required to determine the calcdata indices + // that correspond to input indices (e.g. from 'selectedpoints') + var transforms = trace.transforms || []; + for(j = transforms.length - 1; j >= 0; j--) { + if(transforms[j].enabled) { + trace._indexToPoints = transforms[j]._indexToPoints; + break; + } + } - s.selectAll('g.text').each(function(d) { - var sel = d3.select(this); - var trace = d.trace || d[0].trace; - styleText(sel, trace, gd); - }); + if(_module && _module.calc) { + cd = _module.calc(gd, trace); + } + } - s.selectAll('g.trace path.js-line') - .call(Drawing.lineGroupStyle); + // Make sure there is a first point. + // + // This ensures there is a calcdata item for every trace, + // even if cartesian logic doesn't handle it (for things like legends). + if(!Array.isArray(cd) || !cd[0]) { + cd = [{x: BADNUM, y: BADNUM}]; + } - s.selectAll('g.trace path.js-fill') - .call(Drawing.fillGroupStyle); + // add the trace-wide properties to the first point, + // per point properties to every point + // t is the holder for trace-wide properties + if(!cd[0].t) cd[0].t = {}; + cd[0].trace = trace; - Registry.getComponentMethod('errorbars', 'style')(s); -} + calcdata[i] = cd; + } -function stylePoints(sel, trace, gd) { - Drawing.pointStyle(sel.selectAll('path.point'), trace, gd); -} + // 'regular' loop - make sure container traces (eg carpet) calc before + // contained traces (eg contourcarpet) + for(i = 0; i < fullData.length; i++) calci(i, true); + for(i = 0; i < fullData.length; i++) calci(i, false); -function styleText(sel, trace, gd) { - Drawing.textPointStyle(sel.selectAll('text'), trace, gd); -} + doCrossTraceCalc(gd); -function styleOnSelect(gd, cd) { - var s = cd[0].node3; - var trace = cd[0].trace; + Registry.getComponentMethod('fx', 'calc')(gd); + Registry.getComponentMethod('errorbars', 'calc')(gd); +}; - if(trace.selectedpoints) { - Drawing.selectedPointStyle(s.selectAll('path.point'), trace); - Drawing.selectedTextStyle(s.selectAll('text'), trace); - } else { - stylePoints(s, trace, gd); - styleText(s, trace, gd); +function setupAxisCategories(axList, fullData) { + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + ax.clearCalc(); + if(ax.type === 'multicategory') { + ax.setupMultiCategory(fullData); + } } } -module.exports = { - style: style, - stylePoints: stylePoints, - styleText: styleText, - styleOnSelect: styleOnSelect -}; - -},{"../../components/drawing":595,"../../registry":827,"d3":148}],1067:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; +function doCrossTraceCalc(gd) { + var fullLayout = gd._fullLayout; + var modules = fullLayout._visibleModules; + var hash = {}; + var i, j, k; -var Lib = _dereq_('../../lib'); + // position and range calculations for traces that + // depend on each other ie bars (stacked or grouped) + // and boxes (grouped) push each other out of the way -module.exports = { - hasLines: function(trace) { - return trace.visible && trace.mode && - trace.mode.indexOf('lines') !== -1; - }, + 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]; + } + } + } - hasMarkers: function(trace) { - return trace.visible && ( - (trace.mode && trace.mode.indexOf('markers') !== -1) || - // until splom implements 'mode' - trace.type === 'splom' - ); - }, + for(k in hash) { + var methods = hash[k]; + var subplots = fullLayout._subplots[k]; - hasText: function(trace) { - return trace.visible && trace.mode && - trace.mode.indexOf('text') !== -1; - }, + if(Array.isArray(subplots)) { + for(i = 0; i < subplots.length; i++) { + var sp = subplots[i]; + var spInfo = k === 'cartesian' ? + fullLayout._plots[sp] : + fullLayout[sp]; - isBubble: function(trace) { - return Lib.isPlainObject(trace.marker) && - Lib.isArrayOrTypedArray(trace.marker.size); + for(j = 0; j < methods.length; j++) { + methods[j](gd, spInfo, sp); + } + } + } + else { + for(j = 0; j < methods.length; j++) { + methods[j](gd); + } + } } -}; +} -},{"../../lib":696}],1068:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +plots.rehover = function(gd) { + if(gd._fullLayout._rehover) { + gd._fullLayout._rehover(); + } +}; +plots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) { + var traceHashOld = subplot.traceHash; + var traceHash = {}; + var i; -'use strict'; + // build up moduleName -> calcData hash + for(i = 0; i < subplotCalcData.length; i++) { + var calcTraces = subplotCalcData[i]; + var trace = calcTraces[0].trace; -var Lib = _dereq_('../../lib'); + // skip over visible === false traces + // as they don't have `_module` ref + if(trace.visible) { + traceHash[trace.type] = traceHash[trace.type] || []; + traceHash[trace.type].push(calcTraces); + } + } -/* - * opts: object of flags to control features not all text users support - * noSelect: caller does not support selected/unselected attribute containers - */ -module.exports = function(traceIn, traceOut, layout, coerce, opts) { - opts = opts || {}; + // when a trace gets deleted, make sure that its module's + // plot method is called so that it is properly + // removed from the DOM. + for(var moduleNameOld in traceHashOld) { + if(!traceHash[moduleNameOld]) { + var fakeCalcTrace = traceHashOld[moduleNameOld][0]; + var fakeTrace = fakeCalcTrace[0].trace; - coerce('textposition'); - Lib.coerceFont(coerce, 'textfont', layout.font); + fakeTrace.visible = false; + traceHash[moduleNameOld] = [fakeCalcTrace]; + } + } - if(!opts.noSelect) { - coerce('selected.textfont.color'); - coerce('unselected.textfont.color'); + // call module plot method + for(var moduleName in traceHash) { + var moduleCalcData = traceHash[moduleName]; + var _module = moduleCalcData[0][0].trace._module; + + _module.plot(gd, subplot, Lib.filterVisible(moduleCalcData), subplotLayout); } + + // update moduleName -> calcData hash + subplot.traceHash = traceHash; }; -},{"../../lib":696}],1069:[function(_dereq_,module,exports){ +},{"../components/color":43,"../constants/numerical":140,"../lib":159,"../plot_api/plot_schema":192,"../plot_api/plot_template":193,"../plots/cartesian/axis_ids":206,"../registry":243,"./animation_attributes":198,"./attributes":200,"./command":228,"./font_attributes":230,"./frame_attributes":231,"./layout_attributes":234,"d3":8,"fast-isnumeric":10}],237:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Registry = _dereq_('../../registry'); - - -module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { - var len, - x = coerce('x'), - y = coerce('y'); - - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); +var scatterAttrs = _dereq_('../../../traces/scatter/attributes'); +var scatterMarkerAttrs = scatterAttrs.marker; +var extendFlat = _dereq_('../../../lib/extend').extendFlat; - if(x) { - if(y) { - len = Math.min(x.length, y.length); - } - else { - len = x.length; - coerce('y0'); - coerce('dy'); - } - } - else { - if(!y) return 0; +var deprecationWarning = [ + 'Area traces are deprecated!', + 'Please switch to the *barpolar* trace type.' +].join(' '); - len = traceOut.y.length; - coerce('x0'); - coerce('dx'); +module.exports = { + r: extendFlat({}, scatterAttrs.r, { + + }), + t: extendFlat({}, scatterAttrs.t, { + + }), + marker: { + color: extendFlat({}, scatterMarkerAttrs.color, { + + }), + size: extendFlat({}, scatterMarkerAttrs.size, { + + }), + symbol: extendFlat({}, scatterMarkerAttrs.symbol, { + + }), + opacity: extendFlat({}, scatterMarkerAttrs.opacity, { + + }), + editType: 'calc' } - - traceOut._length = len; - - return len; }; -},{"../../registry":827}],1070:[function(_dereq_,module,exports){ +},{"../../../lib/extend":153,"../../../traces/scatter/attributes":281}],238:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var baseAttrs = _dereq_('../../plots/attributes'); -var DASHES = _dereq_('../../constants/gl3d_dashes'); +'use strict'; -var MARKER_SYMBOLS = _dereq_('../../constants/gl3d_markers'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; +var axesAttrs = _dereq_('../../cartesian/layout_attributes'); +var extendFlat = _dereq_('../../../lib/extend').extendFlat; +var overrideAll = _dereq_('../../../plot_api/edit_types').overrideAll; -var scatterLineAttrs = scatterAttrs.line; -var scatterMarkerAttrs = scatterAttrs.marker; -var scatterMarkerLineAttrs = scatterMarkerAttrs.line; +var deprecationWarning = [ + 'Legacy polar charts are deprecated!', + 'Please switch to *polar* subplots.' +].join(' '); -var lineAttrs = extendFlat({ - width: scatterLineAttrs.width, - dash: { - valType: 'enumerated', - values: Object.keys(DASHES), - dflt: 'solid', - - - } -}, colorAttributes('line')); -// not yet implemented -delete lineAttrs.showscale; -delete lineAttrs.colorbar; +var domainAttr = extendFlat({}, axesAttrs.domain, { + +}); -function makeProjectionAttr(axLetter) { - return { - show: { +function mergeAttrs(axisName, nonCommonAttrs) { + var commonAttrs = { + showline: { valType: 'boolean', - dflt: false, }, - opacity: { - valType: 'number', + showticklabels: { + valType: 'boolean', + + + }, + tickorientation: { + valType: 'enumerated', + values: ['horizontal', 'vertical'], + + }, + ticklen: { + valType: 'number', min: 0, - max: 1, - dflt: 1, + + + }, + tickcolor: { + valType: 'color', + + + }, + ticksuffix: { + valType: 'string', + }, - scale: { + endpadding: { valType: 'number', - min: 0, - max: 10, - dflt: 2 / 3, + description: deprecationWarning, + }, + visible: { + valType: 'boolean', + } }; -} -var attrs = module.exports = overrideAll({ - x: scatterAttrs.x, - y: scatterAttrs.y, - z: { - valType: 'data_array', - - }, + return extendFlat({}, nonCommonAttrs, commonAttrs); +} - text: extendFlat({}, scatterAttrs.text, { - - }), - hovertext: extendFlat({}, scatterAttrs.hovertext, { - +module.exports = overrideAll({ + radialaxis: mergeAttrs('radial', { + range: { + valType: 'info_array', + + items: [ + { valType: 'number' }, + { valType: 'number' } + ], + + }, + domain: domainAttr, + orientation: { + valType: 'number', + + + } }), - mode: extendFlat({}, scatterAttrs.mode, // shouldn't this be on-par with 2D? - {dflt: 'lines+markers'}), - surfaceaxis: { - valType: 'enumerated', - - values: [-1, 0, 1, 2], - dflt: -1, - - }, - surfacecolor: { - valType: 'color', - - - }, - projection: { - x: makeProjectionAttr('x'), - y: makeProjectionAttr('y'), - z: makeProjectionAttr('z') - }, - - connectgaps: scatterAttrs.connectgaps, - line: lineAttrs, + angularaxis: mergeAttrs('angular', { + range: { + valType: 'info_array', + + items: [ + { valType: 'number', dflt: 0 }, + { valType: 'number', dflt: 360 } + ], + + }, + domain: domainAttr + }), - marker: extendFlat({ // Parity with scatter.js? - symbol: { + // attributes that appear at layout root + layout: { + direction: { valType: 'enumerated', - values: Object.keys(MARKER_SYMBOLS), + values: ['clockwise', 'counterclockwise'], - dflt: 'circle', - arrayOk: true, }, - size: extendFlat({}, scatterMarkerAttrs.size, {dflt: 8}), - sizeref: scatterMarkerAttrs.sizeref, - sizemin: scatterMarkerAttrs.sizemin, - sizemode: scatterMarkerAttrs.sizemode, - opacity: extendFlat({}, scatterMarkerAttrs.opacity, { - arrayOk: false, + orientation: { + valType: 'angle', - }), - colorbar: scatterMarkerAttrs.colorbar, - - line: extendFlat({ - width: extendFlat({}, scatterMarkerLineAttrs.width, {arrayOk: false}) - }, - colorAttributes('marker.line') - ) - }, - colorAttributes('marker') - ), - - textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center', arrayOk: false}), - textfont: { - color: scatterAttrs.textfont.color, - size: scatterAttrs.textfont.size, - family: extendFlat({}, scatterAttrs.textfont.family, {arrayOk: false}) - }, - - hoverinfo: extendFlat({}, baseAttrs.hoverinfo) -}, 'calc', 'nested'); - -attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; + + } + } +}, 'plot', 'nested'); -},{"../../components/colorscale/attributes":577,"../../constants/gl3d_dashes":670,"../../constants/gl3d_markers":671,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/attributes":741,"../scatter/attributes":1043}],1071:[function(_dereq_,module,exports){ +},{"../../../lib/extend":153,"../../../plot_api/edit_types":186,"../../cartesian/layout_attributes":216}],239:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -165476,1131 +62486,1585 @@ 'use strict'; -var arraysToCalcdata = _dereq_('../scatter/arrays_to_calcdata'); -var calcColorscales = _dereq_('../scatter/colorscale_calc'); - - -/** - * This is a kludge to put the array attributes into - * calcdata the way Scatter.plot does, so that legends and - * popovers know what to do with them. - */ -module.exports = function calc(gd, trace) { - var cd = [{x: false, y: false, trace: trace, t: {}}]; - - arraysToCalcdata(cd, trace); - calcColorscales(trace); +var Polar = module.exports = _dereq_('./micropolar'); - return cd; -}; +Polar.manager = _dereq_('./micropolar_manager'); -},{"../scatter/arrays_to_calcdata":1042,"../scatter/colorscale_calc":1046}],1072:[function(_dereq_,module,exports){ +},{"./micropolar":240,"./micropolar_manager":241}],240:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Registry = _dereq_('../../registry'); - -function calculateAxisErrors(data, params, scaleFactor, axis) { - if(!params || !params.visible) return null; - - var computeError = Registry.getComponentMethod('errorbars', 'makeComputeError')(params); - var result = new Array(data.length); - - for(var i = 0; i < data.length; i++) { - var errors = computeError(+data[i], i); +var d3 = _dereq_('d3'); +var Lib = _dereq_('../../../lib'); +var extendDeepAll = Lib.extendDeepAll; +var MID_SHIFT = _dereq_('../../../constants/alignment').MID_SHIFT; - if(axis.type === 'log') { - var point = axis.c2l(data[i]); - var min = data[i] - errors[0], - max = data[i] + errors[1]; - - result[i] = [ - (axis.c2l(min, true) - point) * scaleFactor, - (axis.c2l(max, true) - point) * scaleFactor - ]; +var µ = module.exports = { version: '0.2.2' }; - // Keep track of the lower error bound which isn't negative! - if(min > 0) { - var lower = axis.c2l(min); - if(!axis._lowerLogErrorBound) axis._lowerLogErrorBound = lower; - axis._lowerErrorBound = Math.min(axis._lowerLogErrorBound, lower); +µ.Axis = function module() { + var config = { + data: [], + layout: {} + }, inputConfig = {}, liveConfig = {}; + var svg, container, dispatch = d3.dispatch('hover'), radialScale, angularScale; + var exports = {}; + function render(_container) { + container = _container || container; + var data = config.data; + var axisConfig = config.layout; + if (typeof container == 'string' || container.nodeName) container = d3.select(container); + container.datum(data).each(function(_data, _index) { + var dataOriginal = _data.slice(); + liveConfig = { + data: µ.util.cloneJson(dataOriginal), + layout: µ.util.cloneJson(axisConfig) + }; + var colorIndex = 0; + dataOriginal.forEach(function(d, i) { + if (!d.color) { + d.color = axisConfig.defaultColorRange[colorIndex]; + colorIndex = (colorIndex + 1) % axisConfig.defaultColorRange.length; + } + if (!d.strokeColor) { + d.strokeColor = d.geometry === 'LinePlot' ? d.color : d3.rgb(d.color).darker().toString(); + } + liveConfig.data[i].color = d.color; + liveConfig.data[i].strokeColor = d.strokeColor; + liveConfig.data[i].strokeDash = d.strokeDash; + liveConfig.data[i].strokeSize = d.strokeSize; + }); + var data = dataOriginal.filter(function(d, i) { + var visible = d.visible; + return typeof visible === 'undefined' || visible === true; + }); + var isStacked = false; + var dataWithGroupId = data.map(function(d, i) { + isStacked = isStacked || typeof d.groupId !== 'undefined'; + return d; + }); + if (isStacked) { + var grouped = d3.nest().key(function(d, i) { + return typeof d.groupId != 'undefined' ? d.groupId : 'unstacked'; + }).entries(dataWithGroupId); + var dataYStack = []; + var stacked = grouped.map(function(d, i) { + if (d.key === 'unstacked') return d.values; else { + var prevArray = d.values[0].r.map(function(d, i) { + return 0; + }); + d.values.forEach(function(d, i, a) { + d.yStack = [ prevArray ]; + dataYStack.push(prevArray); + prevArray = µ.util.sumArrays(d.r, prevArray); + }); + return d.values; + } + }); + data = d3.merge(stacked); } - } else { - result[i] = [ - -errors[0] * scaleFactor, - errors[1] * scaleFactor - ]; - } - } - - return result; -} - -function dataLength(array) { - for(var i = 0; i < array.length; i++) { - if(array[i]) return array[i].length; - } - return 0; -} - -function calculateErrors(data, scaleFactor, sceneLayout) { - var errors = [ - calculateAxisErrors(data.x, data.error_x, scaleFactor[0], sceneLayout.xaxis), - calculateAxisErrors(data.y, data.error_y, scaleFactor[1], sceneLayout.yaxis), - calculateAxisErrors(data.z, data.error_z, scaleFactor[2], sceneLayout.zaxis) - ]; - - var n = dataLength(errors); - if(n === 0) return null; - - var errorBounds = new Array(n); + data.forEach(function(d, i) { + d.t = Array.isArray(d.t[0]) ? d.t : [ d.t ]; + d.r = Array.isArray(d.r[0]) ? d.r : [ d.r ]; + }); + var radius = Math.min(axisConfig.width - axisConfig.margin.left - axisConfig.margin.right, axisConfig.height - axisConfig.margin.top - axisConfig.margin.bottom) / 2; + radius = Math.max(10, radius); + var chartCenter = [ axisConfig.margin.left + radius, axisConfig.margin.top + radius ]; + var extent; + if (isStacked) { + var highestStackedValue = d3.max(µ.util.sumArrays(µ.util.arrayLast(data).r[0], µ.util.arrayLast(dataYStack))); + extent = [ 0, highestStackedValue ]; + } else extent = d3.extent(µ.util.flattenArray(data.map(function(d, i) { + return d.r; + }))); + if (axisConfig.radialAxis.domain != µ.DATAEXTENT) extent[0] = 0; + radialScale = d3.scale.linear().domain(axisConfig.radialAxis.domain != µ.DATAEXTENT && axisConfig.radialAxis.domain ? axisConfig.radialAxis.domain : extent).range([ 0, radius ]); + liveConfig.layout.radialAxis.domain = radialScale.domain(); + var angularDataMerged = µ.util.flattenArray(data.map(function(d, i) { + return d.t; + })); + var isOrdinal = typeof angularDataMerged[0] === 'string'; + var ticks; + if (isOrdinal) { + angularDataMerged = µ.util.deduplicate(angularDataMerged); + ticks = angularDataMerged.slice(); + angularDataMerged = d3.range(angularDataMerged.length); + data = data.map(function(d, i) { + var result = d; + d.t = [ angularDataMerged ]; + if (isStacked) result.yStack = d.yStack; + return result; + }); + } + var hasOnlyLineOrDotPlot = data.filter(function(d, i) { + return d.geometry === 'LinePlot' || d.geometry === 'DotPlot'; + }).length === data.length; + var needsEndSpacing = axisConfig.needsEndSpacing === null ? isOrdinal || !hasOnlyLineOrDotPlot : axisConfig.needsEndSpacing; + var useProvidedDomain = axisConfig.angularAxis.domain && axisConfig.angularAxis.domain != µ.DATAEXTENT && !isOrdinal && axisConfig.angularAxis.domain[0] >= 0; + var angularDomain = useProvidedDomain ? axisConfig.angularAxis.domain : d3.extent(angularDataMerged); + var angularDomainStep = Math.abs(angularDataMerged[1] - angularDataMerged[0]); + if (hasOnlyLineOrDotPlot && !isOrdinal) angularDomainStep = 0; + var angularDomainWithPadding = angularDomain.slice(); + if (needsEndSpacing && isOrdinal) angularDomainWithPadding[1] += angularDomainStep; + var tickCount = axisConfig.angularAxis.ticksCount || 4; + if (tickCount > 8) tickCount = tickCount / (tickCount / 8) + tickCount % 8; + if (axisConfig.angularAxis.ticksStep) { + tickCount = (angularDomainWithPadding[1] - angularDomainWithPadding[0]) / tickCount; + } + var angularTicksStep = axisConfig.angularAxis.ticksStep || (angularDomainWithPadding[1] - angularDomainWithPadding[0]) / (tickCount * (axisConfig.minorTicks + 1)); + if (ticks) angularTicksStep = Math.max(Math.round(angularTicksStep), 1); + if (!angularDomainWithPadding[2]) angularDomainWithPadding[2] = angularTicksStep; + var angularAxisRange = d3.range.apply(this, angularDomainWithPadding); + angularAxisRange = angularAxisRange.map(function(d, i) { + return parseFloat(d.toPrecision(12)); + }); + angularScale = d3.scale.linear().domain(angularDomainWithPadding.slice(0, 2)).range(axisConfig.direction === 'clockwise' ? [ 0, 360 ] : [ 360, 0 ]); + liveConfig.layout.angularAxis.domain = angularScale.domain(); + liveConfig.layout.angularAxis.endPadding = needsEndSpacing ? angularDomainStep : 0; + svg = d3.select(this).select('svg.chart-root'); + if (typeof svg === 'undefined' || svg.empty()) { + var skeleton = "' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '"; + var doc = new DOMParser().parseFromString(skeleton, 'application/xml'); + var newSvg = this.appendChild(this.ownerDocument.importNode(doc.documentElement, true)); + svg = d3.select(newSvg); + } + svg.select('.guides-group').style({ + 'pointer-events': 'none' + }); + svg.select('.angular.axis-group').style({ + 'pointer-events': 'none' + }); + svg.select('.radial.axis-group').style({ + 'pointer-events': 'none' + }); + var chartGroup = svg.select('.chart-group'); + var lineStyle = { + fill: 'none', + stroke: axisConfig.tickColor + }; + var fontStyle = { + 'font-size': axisConfig.font.size, + 'font-family': axisConfig.font.family, + fill: axisConfig.font.color, + 'text-shadow': [ '-1px 0px', '1px -1px', '-1px 1px', '1px 1px' ].map(function(d, i) { + return ' ' + d + ' 0 ' + axisConfig.font.outlineColor; + }).join(',') + }; + var legendContainer; + if (axisConfig.showLegend) { + legendContainer = svg.select('.legend-group').attr({ + transform: 'translate(' + [ radius, axisConfig.margin.top ] + ')' + }).style({ + display: 'block' + }); + var elements = data.map(function(d, i) { + var datumClone = µ.util.cloneJson(d); + datumClone.symbol = d.geometry === 'DotPlot' ? d.dotType || 'circle' : d.geometry != 'LinePlot' ? 'square' : 'line'; + datumClone.visibleInLegend = typeof d.visibleInLegend === 'undefined' || d.visibleInLegend; + datumClone.color = d.geometry === 'LinePlot' ? d.strokeColor : d.color; + return datumClone; + }); - for(var i = 0; i < n; i++) { - var bound = [[0, 0, 0], [0, 0, 0]]; + µ.Legend().config({ + data: data.map(function(d, i) { + return d.name || 'Element' + i; + }), + legendConfig: extendDeepAll({}, + µ.Legend.defaultConfig().legendConfig, + { + container: legendContainer, + elements: elements, + reverseOrder: axisConfig.legend.reverseOrder + } + ) + })(); - for(var j = 0; j < 3; j++) { - if(errors[j]) { - for(var k = 0; k < 2; k++) { - bound[k][j] = errors[j][i][k]; - } + var legendBBox = legendContainer.node().getBBox(); + radius = Math.min(axisConfig.width - legendBBox.width - axisConfig.margin.left - axisConfig.margin.right, axisConfig.height - axisConfig.margin.top - axisConfig.margin.bottom) / 2; + radius = Math.max(10, radius); + chartCenter = [ axisConfig.margin.left + radius, axisConfig.margin.top + radius ]; + radialScale.range([ 0, radius ]); + liveConfig.layout.radialAxis.domain = radialScale.domain(); + legendContainer.attr('transform', 'translate(' + [ chartCenter[0] + radius, chartCenter[1] - radius ] + ')'); + } else { + legendContainer = svg.select('.legend-group').style({ + display: 'none' + }); + } + svg.attr({ + width: axisConfig.width, + height: axisConfig.height + }).style({ + opacity: axisConfig.opacity + }); + chartGroup.attr('transform', 'translate(' + chartCenter + ')').style({ + cursor: 'crosshair' + }); + var centeringOffset = [ (axisConfig.width - (axisConfig.margin.left + axisConfig.margin.right + radius * 2 + (legendBBox ? legendBBox.width : 0))) / 2, (axisConfig.height - (axisConfig.margin.top + axisConfig.margin.bottom + radius * 2)) / 2 ]; + centeringOffset[0] = Math.max(0, centeringOffset[0]); + centeringOffset[1] = Math.max(0, centeringOffset[1]); + svg.select('.outer-group').attr('transform', 'translate(' + centeringOffset + ')'); + if (axisConfig.title && axisConfig.title.text) { + var title = svg.select('g.title-group text').style(fontStyle).text(axisConfig.title.text); + var titleBBox = title.node().getBBox(); + title.attr({ + x: chartCenter[0] - titleBBox.width / 2, + y: chartCenter[1] - radius - 20 + }); + } + var radialAxis = svg.select('.radial.axis-group'); + if (axisConfig.radialAxis.gridLinesVisible) { + var gridCircles = radialAxis.selectAll('circle.grid-circle').data(radialScale.ticks(5)); + gridCircles.enter().append('circle').attr({ + 'class': 'grid-circle' + }).style(lineStyle); + gridCircles.attr('r', radialScale); + gridCircles.exit().remove(); + } + radialAxis.select('circle.outside-circle').attr({ + r: radius + }).style(lineStyle); + var backgroundCircle = svg.select('circle.background-circle').attr({ + r: radius + }).style({ + fill: axisConfig.backgroundColor, + stroke: axisConfig.stroke + }); + function currentAngle(d, i) { + return angularScale(d) % 360 + axisConfig.orientation; + } + if (axisConfig.radialAxis.visible) { + var axis = d3.svg.axis().scale(radialScale).ticks(5).tickSize(5); + radialAxis.call(axis).attr({ + transform: 'rotate(' + axisConfig.radialAxis.orientation + ')' + }); + radialAxis.selectAll('.domain').style(lineStyle); + radialAxis.selectAll('g>text').text(function(d, i) { + return this.textContent + axisConfig.radialAxis.ticksSuffix; + }).style(fontStyle).style({ + 'text-anchor': 'start' + }).attr({ + x: 0, + y: 0, + dx: 0, + dy: 0, + transform: function(d, i) { + if (axisConfig.radialAxis.tickOrientation === 'horizontal') { + return 'rotate(' + -axisConfig.radialAxis.orientation + ') translate(' + [ 0, fontStyle['font-size'] ] + ')'; + } else return 'translate(' + [ 0, fontStyle['font-size'] ] + ')'; + } + }); + radialAxis.selectAll('g>line').style({ + stroke: 'black' + }); } - } - - errorBounds[i] = bound; - } - - return errorBounds; -} - -module.exports = calculateErrors; - -},{"../../registry":827}],1073:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var createLinePlot = _dereq_('gl-line3d'); -var createScatterPlot = _dereq_('gl-scatter3d'); -var createErrorBars = _dereq_('gl-error3d'); -var createMesh = _dereq_('gl-mesh3d'); -var triangulate = _dereq_('delaunay-triangulate'); - -var Lib = _dereq_('../../lib'); -var str2RgbaArray = _dereq_('../../lib/str2rgbarray'); -var formatColor = _dereq_('../../lib/gl_format_color').formatColor; -var makeBubbleSizeFn = _dereq_('../scatter/make_bubble_size_func'); -var DASH_PATTERNS = _dereq_('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = _dereq_('../../constants/gl3d_markers'); - -var calculateError = _dereq_('./calc_errors'); - -function LineWithMarkers(scene, uid) { - this.scene = scene; - this.uid = uid; - this.linePlot = null; - this.scatterPlot = null; - this.errorBars = null; - this.textMarkers = null; - this.delaunayMesh = null; - this.color = null; - this.mode = ''; - this.dataPoints = []; - this.axesBounds = [ - [-Infinity, -Infinity, -Infinity], - [Infinity, Infinity, Infinity] - ]; - this.textLabels = null; - this.data = null; -} - -var proto = LineWithMarkers.prototype; - -proto.handlePick = function(selection) { - if(selection.object && - (selection.object === this.linePlot || - selection.object === this.delaunayMesh || - selection.object === this.textMarkers || - selection.object === this.scatterPlot) - ) { - var ind = selection.index = selection.data.index; - - if(selection.object.highlight) { - selection.object.highlight(null); - } - if(this.scatterPlot) { - selection.object = this.scatterPlot; - this.scatterPlot.highlight(selection.data); - } - - selection.textLabel = ''; - if(this.textLabels) { - if(Array.isArray(this.textLabels)) { - if(this.textLabels[ind] || this.textLabels[ind] === 0) { - selection.textLabel = this.textLabels[ind]; + var angularAxis = svg.select('.angular.axis-group').selectAll('g.angular-tick').data(angularAxisRange); + var angularAxisEnter = angularAxis.enter().append('g').classed('angular-tick', true); + angularAxis.attr({ + transform: function(d, i) { + return 'rotate(' + currentAngle(d, i) + ')'; } - } else { - selection.textLabel = this.textLabels; + }).style({ + display: axisConfig.angularAxis.visible ? 'block' : 'none' + }); + angularAxis.exit().remove(); + angularAxisEnter.append('line').classed('grid-line', true).classed('major', function(d, i) { + return i % (axisConfig.minorTicks + 1) == 0; + }).classed('minor', function(d, i) { + return !(i % (axisConfig.minorTicks + 1) == 0); + }).style(lineStyle); + angularAxisEnter.selectAll('.minor').style({ + stroke: axisConfig.minorTickColor + }); + angularAxis.select('line.grid-line').attr({ + x1: axisConfig.tickLength ? radius - axisConfig.tickLength : 0, + x2: radius + }).style({ + display: axisConfig.angularAxis.gridLinesVisible ? 'block' : 'none' + }); + angularAxisEnter.append('text').classed('axis-text', true).style(fontStyle); + var ticksText = angularAxis.select('text.axis-text').attr({ + x: radius + axisConfig.labelOffset, + dy: MID_SHIFT + 'em', + transform: function(d, i) { + var angle = currentAngle(d, i); + var rad = radius + axisConfig.labelOffset; + var orient = axisConfig.angularAxis.tickOrientation; + if (orient == 'horizontal') return 'rotate(' + -angle + ' ' + rad + ' 0)'; else if (orient == 'radial') return angle < 270 && angle > 90 ? 'rotate(180 ' + rad + ' 0)' : null; else return 'rotate(' + (angle <= 180 && angle > 0 ? -90 : 90) + ' ' + rad + ' 0)'; + } + }).style({ + 'text-anchor': 'middle', + display: axisConfig.angularAxis.labelsVisible ? 'block' : 'none' + }).text(function(d, i) { + if (i % (axisConfig.minorTicks + 1) != 0) return ''; + if (ticks) { + return ticks[d] + axisConfig.angularAxis.ticksSuffix; + } else return d + axisConfig.angularAxis.ticksSuffix; + }).style(fontStyle); + if (axisConfig.angularAxis.rewriteTicks) ticksText.text(function(d, i) { + if (i % (axisConfig.minorTicks + 1) != 0) return ''; + return axisConfig.angularAxis.rewriteTicks(this.textContent, i); + }); + var rightmostTickEndX = d3.max(chartGroup.selectAll('.angular-tick text')[0].map(function(d, i) { + return d.getCTM().e + d.getBBox().width; + })); + legendContainer.attr({ + transform: 'translate(' + [ radius + rightmostTickEndX, axisConfig.margin.top ] + ')' + }); + var hasGeometry = svg.select('g.geometry-group').selectAll('g').size() > 0; + var geometryContainer = svg.select('g.geometry-group').selectAll('g.geometry').data(data); + geometryContainer.enter().append('g').attr({ + 'class': function(d, i) { + return 'geometry geometry' + i; + } + }); + geometryContainer.exit().remove(); + if (data[0] || hasGeometry) { + var geometryConfigs = []; + data.forEach(function(d, i) { + var geometryConfig = {}; + geometryConfig.radialScale = radialScale; + geometryConfig.angularScale = angularScale; + geometryConfig.container = geometryContainer.filter(function(dB, iB) { + return iB == i; + }); + geometryConfig.geometry = d.geometry; + geometryConfig.orientation = axisConfig.orientation; + geometryConfig.direction = axisConfig.direction; + geometryConfig.index = i; + geometryConfigs.push({ + data: d, + geometryConfig: geometryConfig + }); + }); + var geometryConfigsGrouped = d3.nest().key(function(d, i) { + return typeof d.data.groupId != 'undefined' || 'unstacked'; + }).entries(geometryConfigs); + var geometryConfigsGrouped2 = []; + geometryConfigsGrouped.forEach(function(d, i) { + if (d.key === 'unstacked') geometryConfigsGrouped2 = geometryConfigsGrouped2.concat(d.values.map(function(d, i) { + return [ d ]; + })); else geometryConfigsGrouped2.push(d.values); + }); + geometryConfigsGrouped2.forEach(function(d, i) { + var geometry; + if (Array.isArray(d)) geometry = d[0].geometryConfig.geometry; else geometry = d.geometryConfig.geometry; + var finalGeometryConfig = d.map(function(dB, iB) { + return extendDeepAll(µ[geometry].defaultConfig(), dB); + }); + µ[geometry]().config(finalGeometryConfig)(); + }); } - } - - selection.traceCoordinate = [ - this.data.x[ind], - this.data.y[ind], - this.data.z[ind] - ]; - - return true; - } -}; - -function constructDelaunay(points, color, axis) { - var u = (axis + 1) % 3; - var v = (axis + 2) % 3; - var filteredPoints = []; - var filteredIds = []; - var i; - - for(i = 0; i < points.length; ++i) { - var p = points[i]; - if(isNaN(p[u]) || !isFinite(p[u]) || - isNaN(p[v]) || !isFinite(p[v])) { - continue; - } - filteredPoints.push([p[u], p[v]]); - filteredIds.push(i); - } - var cells = triangulate(filteredPoints); - for(i = 0; i < cells.length; ++i) { - var c = cells[i]; - for(var j = 0; j < c.length; ++j) { - c[j] = filteredIds[c[j]]; - } + var guides = svg.select('.guides-group'); + var tooltipContainer = svg.select('.tooltips-group'); + var angularTooltip = µ.tooltipPanel().config({ + container: tooltipContainer, + fontSize: 8 + })(); + var radialTooltip = µ.tooltipPanel().config({ + container: tooltipContainer, + fontSize: 8 + })(); + var geometryTooltip = µ.tooltipPanel().config({ + container: tooltipContainer, + hasTick: true + })(); + var angularValue, radialValue; + if (!isOrdinal) { + var angularGuideLine = guides.select('line').attr({ + x1: 0, + y1: 0, + y2: 0 + }).style({ + stroke: 'grey', + 'pointer-events': 'none' + }); + chartGroup.on('mousemove.angular-guide', function(d, i) { + var mouseAngle = µ.util.getMousePos(backgroundCircle).angle; + angularGuideLine.attr({ + x2: -radius, + transform: 'rotate(' + mouseAngle + ')' + }).style({ + opacity: .5 + }); + var angleWithOriginOffset = (mouseAngle + 180 + 360 - axisConfig.orientation) % 360; + angularValue = angularScale.invert(angleWithOriginOffset); + var pos = µ.util.convertToCartesian(radius + 12, mouseAngle + 180); + angularTooltip.text(µ.util.round(angularValue)).move([ pos[0] + chartCenter[0], pos[1] + chartCenter[1] ]); + }).on('mouseout.angular-guide', function(d, i) { + guides.select('line').style({ + opacity: 0 + }); + }); + } + var angularGuideCircle = guides.select('circle').style({ + stroke: 'grey', + fill: 'none' + }); + chartGroup.on('mousemove.radial-guide', function(d, i) { + var r = µ.util.getMousePos(backgroundCircle).radius; + angularGuideCircle.attr({ + r: r + }).style({ + opacity: .5 + }); + radialValue = radialScale.invert(µ.util.getMousePos(backgroundCircle).radius); + var pos = µ.util.convertToCartesian(r, axisConfig.radialAxis.orientation); + radialTooltip.text(µ.util.round(radialValue)).move([ pos[0] + chartCenter[0], pos[1] + chartCenter[1] ]); + }).on('mouseout.radial-guide', function(d, i) { + angularGuideCircle.style({ + opacity: 0 + }); + geometryTooltip.hide(); + angularTooltip.hide(); + radialTooltip.hide(); + }); + svg.selectAll('.geometry-group .mark').on('mouseover.tooltip', function(d, i) { + var el = d3.select(this); + var color = this.style.fill; + var newColor = 'black'; + var opacity = this.style.opacity || 1; + el.attr({ + 'data-opacity': opacity + }); + if (color && color !== 'none') { + el.attr({ + 'data-fill': color + }); + newColor = d3.hsl(color).darker().toString(); + el.style({ + fill: newColor, + opacity: 1 + }); + var textData = { + t: µ.util.round(d[0]), + r: µ.util.round(d[1]) + }; + if (isOrdinal) textData.t = ticks[d[0]]; + var text = 't: ' + textData.t + ', r: ' + textData.r; + var bbox = this.getBoundingClientRect(); + var svgBBox = svg.node().getBoundingClientRect(); + var pos = [ bbox.left + bbox.width / 2 - centeringOffset[0] - svgBBox.left, bbox.top + bbox.height / 2 - centeringOffset[1] - svgBBox.top ]; + geometryTooltip.config({ + color: newColor + }).text(text); + geometryTooltip.move(pos); + } else { + color = this.style.stroke || 'black'; + el.attr({ + 'data-stroke': color + }); + newColor = d3.hsl(color).darker().toString(); + el.style({ + stroke: newColor, + opacity: 1 + }); + } + }).on('mousemove.tooltip', function(d, i) { + if (d3.event.which != 0) return false; + if (d3.select(this).attr('data-fill')) geometryTooltip.show(); + }).on('mouseout.tooltip', function(d, i) { + geometryTooltip.hide(); + var el = d3.select(this); + var fillColor = el.attr('data-fill'); + if (fillColor) el.style({ + fill: fillColor, + opacity: el.attr('data-opacity') + }); else el.style({ + stroke: el.attr('data-stroke'), + opacity: el.attr('data-opacity') + }); + }); + }); + return exports; } - return { - positions: points, - cells: cells, - meshColor: color + exports.render = function(_container) { + render(_container); + return this; }; -} - -function calculateErrorParams(errors) { - var capSize = [0.0, 0.0, 0.0], - color = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], - lineWidth = [1.0, 1.0, 1.0]; - - for(var i = 0; i < 3; i++) { - var e = errors[i]; - - if(e && e.copy_zstyle !== false && errors[2].visible !== false) e = errors[2]; - if(!e || !e.visible) continue; - - capSize[i] = e.width / 2; // ballpark rescaling - color[i] = str2RgbaArray(e.color); - lineWidth[i] = e.thickness; - - } - - return {capSize: capSize, color: color, lineWidth: lineWidth}; -} - -function calculateTextOffset(tp) { - // Read out text properties - var textOffset = [0, 0]; - if(Array.isArray(tp)) return [0, -1]; - if(tp.indexOf('bottom') >= 0) textOffset[1] += 1; - if(tp.indexOf('top') >= 0) textOffset[1] -= 1; - if(tp.indexOf('left') >= 0) textOffset[0] -= 1; - if(tp.indexOf('right') >= 0) textOffset[0] += 1; - return textOffset; -} - - -function calculateSize(sizeIn, sizeFn) { - // rough parity with Plotly 2D markers - return sizeFn(sizeIn * 4); -} - -function calculateSymbol(symbolIn) { - return MARKER_SYMBOLS[symbolIn]; -} - -function formatParam(paramIn, len, calculate, dflt, extraFn) { - var paramOut = null; - - if(Lib.isArrayOrTypedArray(paramIn)) { - paramOut = []; - - for(var i = 0; i < len; i++) { - if(paramIn[i] === undefined) paramOut[i] = dflt; - else paramOut[i] = calculate(paramIn[i], extraFn); - } - - } - else paramOut = calculate(paramIn, Lib.identity); - - return paramOut; -} - - -function convertPlotlyOptions(scene, data) { - var params, i, - points = [], - sceneLayout = scene.fullSceneLayout, - scaleFactor = scene.dataScale, - xaxis = sceneLayout.xaxis, - yaxis = sceneLayout.yaxis, - zaxis = sceneLayout.zaxis, - marker = data.marker, - line = data.line, - xc, x = data.x || [], - yc, y = data.y || [], - zc, z = data.z || [], - len = x.length, - xcalendar = data.xcalendar, - ycalendar = data.ycalendar, - zcalendar = data.zcalendar, - text; - - // Convert points - for(i = 0; i < len; i++) { - // sanitize numbers and apply transforms based on axes.type - xc = xaxis.d2l(x[i], 0, xcalendar) * scaleFactor[0]; - yc = yaxis.d2l(y[i], 0, ycalendar) * scaleFactor[1]; - zc = zaxis.d2l(z[i], 0, zcalendar) * scaleFactor[2]; - - points[i] = [xc, yc, zc]; - } - - // convert text - if(Array.isArray(data.text)) text = data.text; - else if(data.text !== undefined) { - text = new Array(len); - for(i = 0; i < len; i++) text[i] = data.text; - } - - // Build object parameters - params = { - position: points, - mode: data.mode, - text: text + exports.config = function(_x) { + if (!arguments.length) return config; + var xClone = µ.util.cloneJson(_x); + xClone.data.forEach(function(d, i) { + if (!config.data[i]) config.data[i] = {}; + extendDeepAll(config.data[i], µ.Axis.defaultConfig().data[0]); + extendDeepAll(config.data[i], d); + }); + extendDeepAll(config.layout, µ.Axis.defaultConfig().layout); + extendDeepAll(config.layout, xClone.layout); + return this; }; + exports.getLiveConfig = function() { + return liveConfig; + }; + exports.getinputConfig = function() { + return inputConfig; + }; + exports.radialScale = function(_x) { + return radialScale; + }; + exports.angularScale = function(_x) { + return angularScale; + }; + exports.svg = function() { + return svg; + }; + d3.rebind(exports, dispatch, 'on'); + return exports; +}; - if('line' in data) { - params.lineColor = formatColor(line, 1, len); - params.lineWidth = line.width; - params.lineDashes = line.dash; - } - - if('marker' in data) { - var sizeFn = makeBubbleSizeFn(data); - - params.scatterColor = formatColor(marker, 1, len); - params.scatterSize = formatParam(marker.size, len, calculateSize, 20, sizeFn); - params.scatterMarker = formatParam(marker.symbol, len, calculateSymbol, '●'); - params.scatterLineWidth = marker.line.width; // arrayOk === false - params.scatterLineColor = formatColor(marker.line, 1, len); - params.scatterAngle = 0; - } - - if('textposition' in data) { - params.textOffset = calculateTextOffset(data.textposition); // arrayOk === false - params.textColor = formatColor(data.textfont, 1, len); - params.textSize = formatParam(data.textfont.size, len, Lib.identity, 12); - params.textFont = data.textfont.family; // arrayOk === false - params.textAngle = 0; - } - - var dims = ['x', 'y', 'z']; - params.project = [false, false, false]; - params.projectScale = [1, 1, 1]; - params.projectOpacity = [1, 1, 1]; - for(i = 0; i < 3; ++i) { - var projection = data.projection[dims[i]]; - if((params.project[i] = projection.show)) { - params.projectOpacity[i] = projection.opacity; - params.projectScale[i] = projection.scale; +µ.Axis.defaultConfig = function(d, i) { + var config = { + data: [ { + t: [ 1, 2, 3, 4 ], + r: [ 10, 11, 12, 13 ], + name: 'Line1', + geometry: 'LinePlot', + color: null, + strokeDash: 'solid', + strokeColor: null, + strokeSize: '1', + visibleInLegend: true, + opacity: 1 + } ], + layout: { + defaultColorRange: d3.scale.category10().range(), + title: null, + height: 450, + width: 500, + margin: { + top: 40, + right: 40, + bottom: 40, + left: 40 + }, + font: { + size: 12, + color: 'gray', + outlineColor: 'white', + family: 'Tahoma, sans-serif' + }, + direction: 'clockwise', + orientation: 0, + labelOffset: 10, + radialAxis: { + domain: null, + orientation: -45, + ticksSuffix: '', + visible: true, + gridLinesVisible: true, + tickOrientation: 'horizontal', + rewriteTicks: null + }, + angularAxis: { + domain: [ 0, 360 ], + ticksSuffix: '', + visible: true, + gridLinesVisible: true, + labelsVisible: true, + tickOrientation: 'horizontal', + rewriteTicks: null, + ticksCount: null, + ticksStep: null + }, + minorTicks: 0, + tickLength: null, + tickColor: 'silver', + minorTickColor: '#eee', + backgroundColor: 'none', + needsEndSpacing: null, + showLegend: true, + legend: { + reverseOrder: false + }, + opacity: 1 } - } - - params.errorBounds = calculateError(data, scaleFactor, sceneLayout); - - var errorParams = calculateErrorParams([data.error_x, data.error_y, data.error_z]); - params.errorColor = errorParams.color; - params.errorLineWidth = errorParams.lineWidth; - params.errorCapSize = errorParams.capSize; - - params.delaunayAxis = data.surfaceaxis; - params.delaunayColor = str2RgbaArray(data.surfacecolor); - - return params; -} - -function arrayToColor(color) { - if(Array.isArray(color)) { - var c = color[0]; - - if(Array.isArray(c)) color = c; + }; + return config; +}; - return 'rgb(' + color.slice(0, 3).map(function(x) { - return Math.round(x * 255); - }) + ')'; - } +µ.util = {}; - return null; -} +µ.DATAEXTENT = 'dataExtent'; -proto.update = function(data) { - var gl = this.scene.glplot.gl, - lineOptions, - scatterOptions, - errorOptions, - textOptions, - dashPattern = DASH_PATTERNS.solid; +µ.AREA = 'AreaChart'; - // Save data - this.data = data; +µ.LINE = 'LinePlot'; - // Run data conversion - var options = convertPlotlyOptions(this.scene, data); +µ.DOT = 'DotPlot'; - if('mode' in options) { - this.mode = options.mode; - } - if('lineDashes' in options) { - if(options.lineDashes in DASH_PATTERNS) { - dashPattern = DASH_PATTERNS[options.lineDashes]; - } - } +µ.BAR = 'BarChart'; - this.color = arrayToColor(options.scatterColor) || - arrayToColor(options.lineColor); +µ.util._override = function(_objA, _objB) { + for (var x in _objA) if (x in _objB) _objB[x] = _objA[x]; +}; - // Save data points - this.dataPoints = options.position; +µ.util._extend = function(_objA, _objB) { + for (var x in _objA) _objB[x] = _objA[x]; +}; - lineOptions = { - gl: gl, - position: options.position, - color: options.lineColor, - lineWidth: options.lineWidth || 1, - dashes: dashPattern[0], - dashScale: dashPattern[1], - opacity: data.opacity, - connectGaps: data.connectgaps - }; +µ.util._rndSnd = function() { + return Math.random() * 2 - 1 + (Math.random() * 2 - 1) + (Math.random() * 2 - 1); +}; - if(this.mode.indexOf('lines') !== -1) { - if(this.linePlot) this.linePlot.update(lineOptions); - else { - this.linePlot = createLinePlot(lineOptions); - this.linePlot._trace = this; - this.scene.glplot.add(this.linePlot); - } - } else if(this.linePlot) { - this.scene.glplot.remove(this.linePlot); - this.linePlot.dispose(); - this.linePlot = null; - } - - // N.B. marker.opacity must be a scalar for performance - var scatterOpacity = data.opacity; - if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity; - - scatterOptions = { - gl: gl, - position: options.position, - color: options.scatterColor, - size: options.scatterSize, - glyph: options.scatterMarker, - opacity: scatterOpacity, - orthographic: true, - lineWidth: options.scatterLineWidth, - lineColor: options.scatterLineColor, - project: options.project, - projectScale: options.projectScale, - projectOpacity: options.projectOpacity - }; +µ.util.dataFromEquation2 = function(_equation, _step) { + var step = _step || 6; + var data = d3.range(0, 360 + step, step).map(function(deg, index) { + var theta = deg * Math.PI / 180; + var radius = _equation(theta); + return [ deg, radius ]; + }); + return data; +}; - if(this.mode.indexOf('markers') !== -1) { - if(this.scatterPlot) this.scatterPlot.update(scatterOptions); - else { - this.scatterPlot = createScatterPlot(scatterOptions); - this.scatterPlot._trace = this; - this.scatterPlot.highlightScale = 1; - this.scene.glplot.add(this.scatterPlot); - } - } else if(this.scatterPlot) { - this.scene.glplot.remove(this.scatterPlot); - this.scatterPlot.dispose(); - this.scatterPlot = null; - } - - textOptions = { - gl: gl, - position: options.position, - glyph: options.text, - color: options.textColor, - size: options.textSize, - angle: options.textAngle, - alignment: options.textOffset, - font: options.textFont, - orthographic: true, - lineWidth: 0, - project: false, - opacity: data.opacity +µ.util.dataFromEquation = function(_equation, _step, _name) { + var step = _step || 6; + var t = [], r = []; + d3.range(0, 360 + step, step).forEach(function(deg, index) { + var theta = deg * Math.PI / 180; + var radius = _equation(theta); + t.push(deg); + r.push(radius); + }); + var result = { + t: t, + r: r }; - - this.textLabels = data.hovertext || data.text; - - if(this.mode.indexOf('text') !== -1) { - if(this.textMarkers) this.textMarkers.update(textOptions); - else { - this.textMarkers = createScatterPlot(textOptions); - this.textMarkers._trace = this; - this.textMarkers.highlightScale = 1; - this.scene.glplot.add(this.textMarkers); - } - } else if(this.textMarkers) { - this.scene.glplot.remove(this.textMarkers); - this.textMarkers.dispose(); - this.textMarkers = null; - } - - errorOptions = { - gl: gl, - position: options.position, - color: options.errorColor, - error: options.errorBounds, - lineWidth: options.errorLineWidth, - capSize: options.errorCapSize, - opacity: data.opacity - }; - if(this.errorBars) { - if(options.errorBounds) { - this.errorBars.update(errorOptions); - } else { - this.scene.glplot.remove(this.errorBars); - this.errorBars.dispose(); - this.errorBars = null; - } - } else if(options.errorBounds) { - this.errorBars = createErrorBars(errorOptions); - this.errorBars._trace = this; - this.scene.glplot.add(this.errorBars); - } - - if(options.delaunayAxis >= 0) { - var delaunayOptions = constructDelaunay( - options.position, - options.delaunayColor, - options.delaunayAxis - ); - delaunayOptions.opacity = data.opacity; - - if(this.delaunayMesh) { - this.delaunayMesh.update(delaunayOptions); - } else { - delaunayOptions.gl = gl; - this.delaunayMesh = createMesh(delaunayOptions); - this.delaunayMesh._trace = this; - this.scene.glplot.add(this.delaunayMesh); - } - } else if(this.delaunayMesh) { - this.scene.glplot.remove(this.delaunayMesh); - this.delaunayMesh.dispose(); - this.delaunayMesh = null; - } + if (_name) result.name = _name; + return result; }; -proto.dispose = function() { - if(this.linePlot) { - this.scene.glplot.remove(this.linePlot); - this.linePlot.dispose(); - } - if(this.scatterPlot) { - this.scene.glplot.remove(this.scatterPlot); - this.scatterPlot.dispose(); - } - if(this.errorBars) { - this.scene.glplot.remove(this.errorBars); - this.errorBars.dispose(); - } - if(this.textMarkers) { - this.scene.glplot.remove(this.textMarkers); - this.textMarkers.dispose(); - } - if(this.delaunayMesh) { - this.scene.glplot.remove(this.delaunayMesh); - this.delaunayMesh.dispose(); - } +µ.util.ensureArray = function(_val, _count) { + if (typeof _val === 'undefined') return null; + var arr = [].concat(_val); + return d3.range(_count).map(function(d, i) { + return arr[i] || arr[0]; + }); }; -function createLineWithMarkers(scene, data) { - var plot = new LineWithMarkers(scene, data.uid); - plot.update(data); - return plot; -} - -module.exports = createLineWithMarkers; - -},{"../../constants/gl3d_dashes":670,"../../constants/gl3d_markers":671,"../../lib":696,"../../lib/gl_format_color":692,"../../lib/str2rgbarray":719,"../scatter/make_bubble_size_func":1060,"./calc_errors":1072,"delaunay-triangulate":150,"gl-error3d":237,"gl-line3d":245,"gl-mesh3d":268,"gl-scatter3d":284}],1074:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; +µ.util.fillArrays = function(_obj, _valueNames, _count) { + _valueNames.forEach(function(d, i) { + _obj[d] = µ.util.ensureArray(_obj[d], _count); + }); + return _obj; +}; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); +µ.util.cloneJson = function(json) { + return JSON.parse(JSON.stringify(json)); +}; -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); +µ.util.validateKeys = function(obj, keys) { + if (typeof keys === 'string') keys = keys.split('.'); + var next = keys.shift(); + return obj[next] && (!keys.length || objHasKeys(obj[next], keys)); +}; -var attributes = _dereq_('./attributes'); +µ.util.sumArrays = function(a, b) { + return d3.zip(a, b).map(function(d, i) { + return d3.sum(d); + }); +}; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { +µ.util.arrayLast = function(a) { + return a[a.length - 1]; +}; - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } +µ.util.arrayEqual = function(a, b) { + var i = Math.max(a.length, b.length, 1); + while (i-- >= 0 && a[i] === b[i]) ; + return i === -2; +}; - var len = handleXYZDefaults(traceIn, traceOut, coerce, layout); - if(!len) { - traceOut.visible = false; - return; +µ.util.flattenArray = function(arr) { + var r = []; + while (!µ.util.arrayEqual(r, arr)) { + r = arr; + arr = [].concat.apply([], arr); } + return arr; +}; - coerce('text'); - coerce('hovertext'); - coerce('mode'); +µ.util.deduplicate = function(arr) { + return arr.filter(function(v, i, a) { + return a.indexOf(v) == i; + }); +}; - if(subTypes.hasLines(traceOut)) { - coerce('connectgaps'); - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - } +µ.util.convertToCartesian = function(radius, theta) { + var thetaRadians = theta * Math.PI / 180; + var x = radius * Math.cos(thetaRadians); + var y = radius * Math.sin(thetaRadians); + return [ x, y ]; +}; - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {noSelect: true}); - } +µ.util.round = function(_value, _digits) { + var digits = _digits || 2; + var mult = Math.pow(10, digits); + return Math.round(_value * mult) / mult; +}; - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true}); - } +µ.util.getMousePos = function(_referenceElement) { + var mousePos = d3.mouse(_referenceElement.node()); + var mouseX = mousePos[0]; + var mouseY = mousePos[1]; + var mouse = {}; + mouse.x = mouseX; + mouse.y = mouseY; + mouse.pos = mousePos; + mouse.angle = (Math.atan2(mouseY, mouseX) + Math.PI) * 180 / Math.PI; + mouse.radius = Math.sqrt(mouseX * mouseX + mouseY * mouseY); + return mouse; +}; - var lineColor = (traceOut.line || {}).color, - markerColor = (traceOut.marker || {}).color; - if(coerce('surfaceaxis') >= 0) coerce('surfacecolor', lineColor || markerColor); - - var dims = ['x', 'y', 'z']; - for(var i = 0; i < 3; ++i) { - var projection = 'projection.' + dims[i]; - if(coerce(projection + '.show')) { - coerce(projection + '.opacity'); - coerce(projection + '.scale'); +µ.util.duplicatesCount = function(arr) { + var uniques = {}, val; + var dups = {}; + for (var i = 0, len = arr.length; i < len; i++) { + val = arr[i]; + if (val in uniques) { + uniques[val]++; + dups[val] = uniques[val]; + } else { + uniques[val] = 1; } } - - var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'z'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y', inherit: 'z'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'z'}); + return dups; }; -function handleXYZDefaults(traceIn, traceOut, coerce, layout) { - var len = 0, - x = coerce('x'), - y = coerce('y'), - z = coerce('z'); - - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout); +µ.util.duplicates = function(arr) { + return Object.keys(µ.util.duplicatesCount(arr)); +}; - if(x && y && z) { - // TODO: what happens if one is missing? - len = Math.min(x.length, y.length, z.length); - traceOut._length = traceOut._xlength = traceOut._ylength = traceOut._zlength = len; +µ.util.translator = function(obj, sourceBranch, targetBranch, reverse) { + if (reverse) { + var targetBranchCopy = targetBranch.slice(); + targetBranch = sourceBranch; + sourceBranch = targetBranchCopy; } - - return len; -} - -},{"../../lib":696,"../../registry":827,"../scatter/line_defaults":1056,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"./attributes":1070}],1075:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Scatter3D = {}; - -Scatter3D.plot = _dereq_('./convert'); -Scatter3D.attributes = _dereq_('./attributes'); -Scatter3D.markerSymbols = _dereq_('../../constants/gl3d_markers'); -Scatter3D.supplyDefaults = _dereq_('./defaults'); -Scatter3D.colorbar = _dereq_('../scatter/marker_colorbar'); -Scatter3D.calc = _dereq_('./calc'); - -Scatter3D.moduleType = 'trace'; -Scatter3D.name = 'scatter3d'; -Scatter3D.basePlotModule = _dereq_('../../plots/gl3d'); -Scatter3D.categories = ['gl3d', 'symbols', 'showLegend']; -Scatter3D.meta = { - - + var value = sourceBranch.reduce(function(previousValue, currentValue) { + if (typeof previousValue != 'undefined') return previousValue[currentValue]; + }, obj); + if (typeof value === 'undefined') return; + sourceBranch.reduce(function(previousValue, currentValue, index) { + if (typeof previousValue == 'undefined') return; + if (index === sourceBranch.length - 1) delete previousValue[currentValue]; + return previousValue[currentValue]; + }, obj); + targetBranch.reduce(function(previousValue, currentValue, index) { + if (typeof previousValue[currentValue] === 'undefined') previousValue[currentValue] = {}; + if (index === targetBranch.length - 1) previousValue[currentValue] = value; + return previousValue[currentValue]; + }, obj); }; -module.exports = Scatter3D; - -},{"../../constants/gl3d_markers":671,"../../plots/gl3d":787,"../scatter/marker_colorbar":1061,"./attributes":1070,"./calc":1071,"./convert":1073,"./defaults":1074}],1076:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var scatterAttrs = _dereq_('../scatter/attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var scatterMarkerAttrs = scatterAttrs.marker, - scatterLineAttrs = scatterAttrs.line, - scatterMarkerLineAttrs = scatterMarkerAttrs.line; +µ.PolyChart = function module() { + var config = [ µ.PolyChart.defaultConfig() ]; + var dispatch = d3.dispatch('hover'); + var dashArray = { + solid: 'none', + dash: [ 5, 2 ], + dot: [ 2, 5 ] + }; + var colorScale; + function exports() { + var geometryConfig = config[0].geometryConfig; + var container = geometryConfig.container; + if (typeof container == 'string') container = d3.select(container); + container.datum(config).each(function(_config, _index) { + var isStack = !!_config[0].data.yStack; + var data = _config.map(function(d, i) { + if (isStack) return d3.zip(d.data.t[0], d.data.r[0], d.data.yStack[0]); else return d3.zip(d.data.t[0], d.data.r[0]); + }); + var angularScale = geometryConfig.angularScale; + var domainMin = geometryConfig.radialScale.domain()[0]; + var generator = {}; + generator.bar = function(d, i, pI) { + var dataConfig = _config[pI].data; + var h = geometryConfig.radialScale(d[1]) - geometryConfig.radialScale(0); + var stackTop = geometryConfig.radialScale(d[2] || 0); + var w = dataConfig.barWidth; + d3.select(this).attr({ + 'class': 'mark bar', + d: 'M' + [ [ h + stackTop, -w / 2 ], [ h + stackTop, w / 2 ], [ stackTop, w / 2 ], [ stackTop, -w / 2 ] ].join('L') + 'Z', + transform: function(d, i) { + return 'rotate(' + (geometryConfig.orientation + angularScale(d[0])) + ')'; + } + }); + }; + generator.dot = function(d, i, pI) { + var stackedData = d[2] ? [ d[0], d[1] + d[2] ] : d; + var symbol = d3.svg.symbol().size(_config[pI].data.dotSize).type(_config[pI].data.dotType)(d, i); + d3.select(this).attr({ + 'class': 'mark dot', + d: symbol, + transform: function(d, i) { + var coord = convertToCartesian(getPolarCoordinates(stackedData)); + return 'translate(' + [ coord.x, coord.y ] + ')'; + } + }); + }; + var line = d3.svg.line.radial().interpolate(_config[0].data.lineInterpolation).radius(function(d) { + return geometryConfig.radialScale(d[1]); + }).angle(function(d) { + return geometryConfig.angularScale(d[0]) * Math.PI / 180; + }); + generator.line = function(d, i, pI) { + var lineData = d[2] ? data[pI].map(function(d, i) { + return [ d[0], d[1] + d[2] ]; + }) : data[pI]; + d3.select(this).each(generator['dot']).style({ + opacity: function(dB, iB) { + return +_config[pI].data.dotVisible; + }, + fill: markStyle.stroke(d, i, pI) + }).attr({ + 'class': 'mark dot' + }); + if (i > 0) return; + var lineSelection = d3.select(this.parentNode).selectAll('path.line').data([ 0 ]); + lineSelection.enter().insert('path'); + lineSelection.attr({ + 'class': 'line', + d: line(lineData), + transform: function(dB, iB) { + return 'rotate(' + (geometryConfig.orientation + 90) + ')'; + }, + 'pointer-events': 'none' + }).style({ + fill: function(dB, iB) { + return markStyle.fill(d, i, pI); + }, + 'fill-opacity': 0, + stroke: function(dB, iB) { + return markStyle.stroke(d, i, pI); + }, + 'stroke-width': function(dB, iB) { + return markStyle['stroke-width'](d, i, pI); + }, + 'stroke-dasharray': function(dB, iB) { + return markStyle['stroke-dasharray'](d, i, pI); + }, + opacity: function(dB, iB) { + return markStyle.opacity(d, i, pI); + }, + display: function(dB, iB) { + return markStyle.display(d, i, pI); + } + }); + }; + var angularRange = geometryConfig.angularScale.range(); + var triangleAngle = Math.abs(angularRange[1] - angularRange[0]) / data[0].length * Math.PI / 180; + var arc = d3.svg.arc().startAngle(function(d) { + return -triangleAngle / 2; + }).endAngle(function(d) { + return triangleAngle / 2; + }).innerRadius(function(d) { + return geometryConfig.radialScale(domainMin + (d[2] || 0)); + }).outerRadius(function(d) { + return geometryConfig.radialScale(domainMin + (d[2] || 0)) + geometryConfig.radialScale(d[1]); + }); + generator.arc = function(d, i, pI) { + d3.select(this).attr({ + 'class': 'mark arc', + d: arc, + transform: function(d, i) { + return 'rotate(' + (geometryConfig.orientation + angularScale(d[0]) + 90) + ')'; + } + }); + }; + var markStyle = { + fill: function(d, i, pI) { + return _config[pI].data.color; + }, + stroke: function(d, i, pI) { + return _config[pI].data.strokeColor; + }, + 'stroke-width': function(d, i, pI) { + return _config[pI].data.strokeSize + 'px'; + }, + 'stroke-dasharray': function(d, i, pI) { + return dashArray[_config[pI].data.strokeDash]; + }, + opacity: function(d, i, pI) { + return _config[pI].data.opacity; + }, + display: function(d, i, pI) { + return typeof _config[pI].data.visible === 'undefined' || _config[pI].data.visible ? 'block' : 'none'; + } + }; + var geometryLayer = d3.select(this).selectAll('g.layer').data(data); + geometryLayer.enter().append('g').attr({ + 'class': 'layer' + }); + var geometry = geometryLayer.selectAll('path.mark').data(function(d, i) { + return d; + }); + geometry.enter().append('path').attr({ + 'class': 'mark' + }); + geometry.style(markStyle).each(generator[geometryConfig.geometryType]); + geometry.exit().remove(); + geometryLayer.exit().remove(); + function getPolarCoordinates(d, i) { + var r = geometryConfig.radialScale(d[1]); + var t = (geometryConfig.angularScale(d[0]) + geometryConfig.orientation) * Math.PI / 180; + return { + r: r, + t: t + }; + } + function convertToCartesian(polarCoordinates) { + var x = polarCoordinates.r * Math.cos(polarCoordinates.t); + var y = polarCoordinates.r * Math.sin(polarCoordinates.t); + return { + x: x, + y: y + }; + } + }); + } + exports.config = function(_x) { + if (!arguments.length) return config; + _x.forEach(function(d, i) { + if (!config[i]) config[i] = {}; + extendDeepAll(config[i], µ.PolyChart.defaultConfig()); + extendDeepAll(config[i], d); + }); + return this; + }; + exports.getColorScale = function() { + return colorScale; + }; + d3.rebind(exports, dispatch, 'on'); + return exports; +}; -module.exports = { - carpet: { - valType: 'string', - - editType: 'calc', - - }, - a: { - valType: 'data_array', - editType: 'calc', - - }, - b: { - valType: 'data_array', - editType: 'calc', - - }, - mode: extendFlat({}, scatterAttrs.mode, {dflt: 'markers'}), - text: extendFlat({}, scatterAttrs.text, { - - }), - line: { - color: scatterLineAttrs.color, - width: scatterLineAttrs.width, - dash: scatterLineAttrs.dash, - shape: extendFlat({}, scatterLineAttrs.shape, - {values: ['linear', 'spline']}), - smoothing: scatterLineAttrs.smoothing, - editType: 'calc' - }, - connectgaps: scatterAttrs.connectgaps, - fill: extendFlat({}, scatterAttrs.fill, { - values: ['none', 'toself', 'tonext'], - dflt: 'none', - - }), - fillcolor: scatterAttrs.fillcolor, - marker: extendFlat({ - symbol: scatterMarkerAttrs.symbol, - opacity: scatterMarkerAttrs.opacity, - maxdisplayed: scatterMarkerAttrs.maxdisplayed, - size: scatterMarkerAttrs.size, - sizeref: scatterMarkerAttrs.sizeref, - sizemin: scatterMarkerAttrs.sizemin, - sizemode: scatterMarkerAttrs.sizemode, - line: extendFlat({ - width: scatterMarkerLineAttrs.width, - editType: 'calc' +µ.PolyChart.defaultConfig = function() { + var config = { + data: { + name: 'geom1', + t: [ [ 1, 2, 3, 4 ] ], + r: [ [ 1, 2, 3, 4 ] ], + dotType: 'circle', + dotSize: 64, + dotVisible: false, + barWidth: 20, + color: '#ffa500', + strokeSize: 1, + strokeColor: 'silver', + strokeDash: 'solid', + opacity: 1, + index: 0, + visible: true, + visibleInLegend: true }, - colorAttributes('marker.line') - ), - gradient: scatterMarkerAttrs.gradient, - editType: 'calc' - }, colorAttributes('marker'), { - colorbar: colorbarAttrs - }), - - textfont: scatterAttrs.textfont, - textposition: scatterAttrs.textposition, - - selected: scatterAttrs.selected, - unselected: scatterAttrs.unselected, + geometryConfig: { + geometry: 'LinePlot', + geometryType: 'arc', + direction: 'clockwise', + orientation: 0, + container: 'body', + radialScale: null, + angularScale: null, + colorScale: d3.scale.category20() + } + }; + return config; +}; - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['a', 'b', 'text', 'name'] - }), - hoveron: scatterAttrs.hoveron, +µ.BarChart = function module() { + return µ.PolyChart(); }; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/attributes":741,"../scatter/attributes":1043}],1077:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +µ.BarChart.defaultConfig = function() { + var config = { + geometryConfig: { + geometryType: 'bar' + } + }; + return config; +}; +µ.AreaChart = function module() { + return µ.PolyChart(); +}; -'use strict'; +µ.AreaChart.defaultConfig = function() { + var config = { + geometryConfig: { + geometryType: 'arc' + } + }; + return config; +}; -var isNumeric = _dereq_('fast-isnumeric'); +µ.DotPlot = function module() { + return µ.PolyChart(); +}; -var calcColorscale = _dereq_('../scatter/colorscale_calc'); -var arraysToCalcdata = _dereq_('../scatter/arrays_to_calcdata'); -var calcSelection = _dereq_('../scatter/calc_selection'); -var calcMarkerSize = _dereq_('../scatter/calc').calcMarkerSize; -var lookupCarpet = _dereq_('../carpet/lookup_carpetid'); +µ.DotPlot.defaultConfig = function() { + var config = { + geometryConfig: { + geometryType: 'dot', + dotType: 'circle' + } + }; + return config; +}; -module.exports = function calc(gd, trace) { - var carpet = trace._carpetTrace = lookupCarpet(gd, trace); - if(!carpet || !carpet.visible || carpet.visible === 'legendonly') return; - var i; +µ.LinePlot = function module() { + return µ.PolyChart(); +}; - // Transfer this over from carpet before plotting since this is a necessary - // condition in order for cartesian to actually plot this trace: - trace.xaxis = carpet.xaxis; - trace.yaxis = carpet.yaxis; +µ.LinePlot.defaultConfig = function() { + var config = { + geometryConfig: { + geometryType: 'line' + } + }; + return config; +}; - // make the calcdata array - var serieslen = trace._length; - var cd = new Array(serieslen); - var a, b; - var needsCull = false; - for(i = 0; i < serieslen; i++) { - a = trace.a[i]; - b = trace.b[i]; - if(isNumeric(a) && isNumeric(b)) { - var xy = carpet.ab2xy(+a, +b, true); - var visible = carpet.isVisible(+a, +b); - if(!visible) needsCull = true; - cd[i] = {x: xy[0], y: xy[1], a: a, b: b, vis: visible}; +µ.Legend = function module() { + var config = µ.Legend.defaultConfig(); + var dispatch = d3.dispatch('hover'); + function exports() { + var legendConfig = config.legendConfig; + var flattenData = config.data.map(function(d, i) { + return [].concat(d).map(function(dB, iB) { + var element = extendDeepAll({}, legendConfig.elements[i]); + element.name = dB; + element.color = [].concat(legendConfig.elements[i].color)[iB]; + return element; + }); + }); + var data = d3.merge(flattenData); + data = data.filter(function(d, i) { + return legendConfig.elements[i] && (legendConfig.elements[i].visibleInLegend || typeof legendConfig.elements[i].visibleInLegend === 'undefined'); + }); + if (legendConfig.reverseOrder) data = data.reverse(); + var container = legendConfig.container; + if (typeof container == 'string' || container.nodeName) container = d3.select(container); + var colors = data.map(function(d, i) { + return d.color; + }); + var lineHeight = legendConfig.fontSize; + var isContinuous = legendConfig.isContinuous == null ? typeof data[0] === 'number' : legendConfig.isContinuous; + var height = isContinuous ? legendConfig.height : lineHeight * data.length; + var legendContainerGroup = container.classed('legend-group', true); + var svg = legendContainerGroup.selectAll('svg').data([ 0 ]); + var svgEnter = svg.enter().append('svg').attr({ + width: 300, + height: height + lineHeight, + xmlns: 'http://www.w3.org/2000/svg', + 'xmlns:xlink': 'http://www.w3.org/1999/xlink', + version: '1.1' + }); + svgEnter.append('g').classed('legend-axis', true); + svgEnter.append('g').classed('legend-marks', true); + var dataNumbered = d3.range(data.length); + var colorScale = d3.scale[isContinuous ? 'linear' : 'ordinal']().domain(dataNumbered).range(colors); + var dataScale = d3.scale[isContinuous ? 'linear' : 'ordinal']().domain(dataNumbered)[isContinuous ? 'range' : 'rangePoints']([ 0, height ]); + var shapeGenerator = function(_type, _size) { + var squareSize = _size * 3; + if (_type === 'line') { + return 'M' + [ [ -_size / 2, -_size / 12 ], [ _size / 2, -_size / 12 ], [ _size / 2, _size / 12 ], [ -_size / 2, _size / 12 ] ] + 'Z'; + } else if (d3.svg.symbolTypes.indexOf(_type) != -1) return d3.svg.symbol().type(_type).size(squareSize)(); else return d3.svg.symbol().type('square').size(squareSize)(); + }; + if (isContinuous) { + var gradient = svg.select('.legend-marks').append('defs').append('linearGradient').attr({ + id: 'grad1', + x1: '0%', + y1: '0%', + x2: '0%', + y2: '100%' + }).selectAll('stop').data(colors); + gradient.enter().append('stop'); + gradient.attr({ + offset: function(d, i) { + return i / (colors.length - 1) * 100 + '%'; + } + }).style({ + 'stop-color': function(d, i) { + return d; + } + }); + svg.append('rect').classed('legend-mark', true).attr({ + height: legendConfig.height, + width: legendConfig.colorBandWidth, + fill: 'url(#grad1)' + }); + } else { + var legendElement = svg.select('.legend-marks').selectAll('path.legend-mark').data(data); + legendElement.enter().append('path').classed('legend-mark', true); + legendElement.attr({ + transform: function(d, i) { + return 'translate(' + [ lineHeight / 2, dataScale(i) + lineHeight / 2 ] + ')'; + }, + d: function(d, i) { + var symbolType = d.symbol; + return shapeGenerator(symbolType, lineHeight); + }, + fill: function(d, i) { + return colorScale(i); + } + }); + legendElement.exit().remove(); } - else cd[i] = {x: false, y: false}; + var legendAxis = d3.svg.axis().scale(dataScale).orient('right'); + var axis = svg.select('g.legend-axis').attr({ + transform: 'translate(' + [ isContinuous ? legendConfig.colorBandWidth : lineHeight, lineHeight / 2 ] + ')' + }).call(legendAxis); + axis.selectAll('.domain').style({ + fill: 'none', + stroke: 'none' + }); + axis.selectAll('line').style({ + fill: 'none', + stroke: isContinuous ? legendConfig.textColor : 'none' + }); + axis.selectAll('text').style({ + fill: legendConfig.textColor, + 'font-size': legendConfig.fontSize + }).text(function(d, i) { + return data[i].name; + }); + return exports; } - - trace._needsCull = needsCull; - - cd[0].carpet = carpet; - cd[0].trace = trace; - - calcMarkerSize(trace, serieslen); - calcColorscale(trace); - arraysToCalcdata(cd, trace); - calcSelection(cd, trace); - - return cd; + exports.config = function(_x) { + if (!arguments.length) return config; + extendDeepAll(config, _x); + return this; + }; + d3.rebind(exports, dispatch, 'on'); + return exports; }; -},{"../carpet/lookup_carpetid":894,"../scatter/arrays_to_calcdata":1042,"../scatter/calc":1044,"../scatter/calc_selection":1045,"../scatter/colorscale_calc":1046,"fast-isnumeric":214}],1078:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var Lib = _dereq_('../../lib'); - -var constants = _dereq_('../scatter/constants'); -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleLineShapeDefaults = _dereq_('../scatter/line_shape_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); - -var attributes = _dereq_('./attributes'); - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - coerce('carpet'); - - // XXX: Don't hard code this - traceOut.xaxis = 'x'; - traceOut.yaxis = 'y'; - - var a = coerce('a'); - var b = coerce('b'); - var len = Math.min(a.length, b.length); - - if(!len) { - traceOut.visible = false; - return; - } - - traceOut._length = len; - - coerce('text'); - - var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; - coerce('mode', defaultMode); - - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - handleLineShapeDefaults(traceIn, traceOut, coerce); - coerce('connectgaps'); - } - - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true}); - } - - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); - } - - var dfltHoverOn = []; - - if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) { - coerce('marker.maxdisplayed'); - dfltHoverOn.push('points'); - } - - coerce('fill'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); - if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); - } - - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { - dfltHoverOn.push('fills'); - } - coerce('hoveron', dfltHoverOn.join('+') || 'points'); +µ.Legend.defaultConfig = function(d, i) { + var config = { + data: [ 'a', 'b', 'c' ], + legendConfig: { + elements: [ { + symbol: 'line', + color: 'red' + }, { + symbol: 'square', + color: 'yellow' + }, { + symbol: 'diamond', + color: 'limegreen' + } ], + height: 150, + colorBandWidth: 30, + fontSize: 12, + container: 'body', + isContinuous: null, + textColor: 'grey', + reverseOrder: false + } + }; + return config; +}; - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); +µ.tooltipPanel = function() { + var tooltipEl, tooltipTextEl, backgroundEl; + var config = { + container: null, + hasTick: false, + fontSize: 12, + color: 'white', + padding: 5 + }; + var id = 'tooltip-' + µ.tooltipPanel.uid++; + var tickSize = 10; + var exports = function() { + tooltipEl = config.container.selectAll('g.' + id).data([ 0 ]); + var tooltipEnter = tooltipEl.enter().append('g').classed(id, true).style({ + 'pointer-events': 'none', + display: 'none' + }); + backgroundEl = tooltipEnter.append('path').style({ + fill: 'white', + 'fill-opacity': .9 + }).attr({ + d: 'M0 0' + }); + tooltipTextEl = tooltipEnter.append('text').attr({ + dx: config.padding + tickSize, + dy: +config.fontSize * .3 + }); + return exports; + }; + exports.text = function(_text) { + var l = d3.hsl(config.color).l; + var strokeColor = l >= .5 ? '#aaa' : 'white'; + var fillColor = l >= .5 ? 'black' : 'white'; + var text = _text || ''; + tooltipTextEl.style({ + fill: fillColor, + 'font-size': config.fontSize + 'px' + }).text(text); + var padding = config.padding; + var bbox = tooltipTextEl.node().getBBox(); + var boxStyle = { + fill: config.color, + stroke: strokeColor, + 'stroke-width': '2px' + }; + var backGroundW = bbox.width + padding * 2 + tickSize; + var backGroundH = bbox.height + padding * 2; + backgroundEl.attr({ + d: 'M' + [ [ tickSize, -backGroundH / 2 ], [ tickSize, -backGroundH / 4 ], [ config.hasTick ? 0 : tickSize, 0 ], [ tickSize, backGroundH / 4 ], [ tickSize, backGroundH / 2 ], [ backGroundW, backGroundH / 2 ], [ backGroundW, -backGroundH / 2 ] ].join('L') + 'Z' + }).style(boxStyle); + tooltipEl.attr({ + transform: 'translate(' + [ tickSize, -backGroundH / 2 + padding * 2 ] + ')' + }); + tooltipEl.style({ + display: 'block' + }); + return exports; + }; + exports.move = function(_pos) { + if (!tooltipEl) return; + tooltipEl.attr({ + transform: 'translate(' + [ _pos[0], _pos[1] ] + ')' + }).style({ + display: 'block' + }); + return exports; + }; + exports.hide = function() { + if (!tooltipEl) return; + tooltipEl.style({ + display: 'none' + }); + return exports; + }; + exports.show = function() { + if (!tooltipEl) return; + tooltipEl.style({ + display: 'block' + }); + return exports; + }; + exports.config = function(_x) { + extendDeepAll(config, _x); + return exports; + }; + return exports; }; -},{"../../lib":696,"../scatter/constants":1047,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/line_shape_defaults":1058,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"./attributes":1076}],1079:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +µ.tooltipPanel.uid = 1; -'use strict'; +µ.adapter = {}; -module.exports = function eventData(out, pt, trace, cd, pointNumber) { - var cdi = cd[pointNumber]; +µ.adapter.plotly = function module() { + var exports = {}; + exports.convert = function(_inputConfig, reverse) { + var outputConfig = {}; + if (_inputConfig.data) { + outputConfig.data = _inputConfig.data.map(function(d, i) { + var r = extendDeepAll({}, d); + var toTranslate = [ + [ r, [ 'marker', 'color' ], [ 'color' ] ], + [ r, [ 'marker', 'opacity' ], [ 'opacity' ] ], + [ r, [ 'marker', 'line', 'color' ], [ 'strokeColor' ] ], + [ r, [ 'marker', 'line', 'dash' ], [ 'strokeDash' ] ], + [ r, [ 'marker', 'line', 'width' ], [ 'strokeSize' ] ], + [ r, [ 'marker', 'symbol' ], [ 'dotType' ] ], + [ r, [ 'marker', 'size' ], [ 'dotSize' ] ], + [ r, [ 'marker', 'barWidth' ], [ 'barWidth' ] ], + [ r, [ 'line', 'interpolation' ], [ 'lineInterpolation' ] ], + [ r, [ 'showlegend' ], [ 'visibleInLegend' ] ] + ]; + toTranslate.forEach(function(d, i) { + µ.util.translator.apply(null, d.concat(reverse)); + }); - out.a = cdi.a; - out.b = cdi.b; + if (!reverse) delete r.marker; + if (reverse) delete r.groupId; + if (!reverse) { + if (r.type === 'scatter') { + if (r.mode === 'lines') r.geometry = 'LinePlot'; else if (r.mode === 'markers') r.geometry = 'DotPlot'; else if (r.mode === 'lines+markers') { + r.geometry = 'LinePlot'; + r.dotVisible = true; + } + } else if (r.type === 'area') r.geometry = 'AreaChart'; else if (r.type === 'bar') r.geometry = 'BarChart'; + delete r.mode; + delete r.type; + } else { + if (r.geometry === 'LinePlot') { + r.type = 'scatter'; + if (r.dotVisible === true) { + delete r.dotVisible; + r.mode = 'lines+markers'; + } else r.mode = 'lines'; + } else if (r.geometry === 'DotPlot') { + r.type = 'scatter'; + r.mode = 'markers'; + } else if (r.geometry === 'AreaChart') r.type = 'area'; else if (r.geometry === 'BarChart') r.type = 'bar'; + delete r.geometry; + } + return r; + }); + if (!reverse && _inputConfig.layout && _inputConfig.layout.barmode === 'stack') { + var duplicates = µ.util.duplicates(outputConfig.data.map(function(d, i) { + return d.geometry; + })); + outputConfig.data.forEach(function(d, i) { + var idx = duplicates.indexOf(d.geometry); + if (idx != -1) outputConfig.data[i].groupId = idx; + }); + } + } + if (_inputConfig.layout) { + var r = extendDeepAll({}, _inputConfig.layout); + var toTranslate = [ + [ r, [ 'plot_bgcolor' ], [ 'backgroundColor' ] ], + [ r, [ 'showlegend' ], [ 'showLegend' ] ], + [ r, [ 'radialaxis' ], [ 'radialAxis' ] ], + [ r, [ 'angularaxis' ], [ 'angularAxis' ] ], + [ r.angularaxis, [ 'showline' ], [ 'gridLinesVisible' ] ], + [ r.angularaxis, [ 'showticklabels' ], [ 'labelsVisible' ] ], + [ r.angularaxis, [ 'nticks' ], [ 'ticksCount' ] ], + [ r.angularaxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], + [ r.angularaxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], + [ r.angularaxis, [ 'range' ], [ 'domain' ] ], + [ r.angularaxis, [ 'endpadding' ], [ 'endPadding' ] ], + [ r.radialaxis, [ 'showline' ], [ 'gridLinesVisible' ] ], + [ r.radialaxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], + [ r.radialaxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], + [ r.radialaxis, [ 'range' ], [ 'domain' ] ], + [ r.angularAxis, [ 'showline' ], [ 'gridLinesVisible' ] ], + [ r.angularAxis, [ 'showticklabels' ], [ 'labelsVisible' ] ], + [ r.angularAxis, [ 'nticks' ], [ 'ticksCount' ] ], + [ r.angularAxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], + [ r.angularAxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], + [ r.angularAxis, [ 'range' ], [ 'domain' ] ], + [ r.angularAxis, [ 'endpadding' ], [ 'endPadding' ] ], + [ r.radialAxis, [ 'showline' ], [ 'gridLinesVisible' ] ], + [ r.radialAxis, [ 'tickorientation' ], [ 'tickOrientation' ] ], + [ r.radialAxis, [ 'ticksuffix' ], [ 'ticksSuffix' ] ], + [ r.radialAxis, [ 'range' ], [ 'domain' ] ], + [ r.font, [ 'outlinecolor' ], [ 'outlineColor' ] ], + [ r.legend, [ 'traceorder' ], [ 'reverseOrder' ] ], + [ r, [ 'labeloffset' ], [ 'labelOffset' ] ], + [ r, [ 'defaultcolorrange' ], [ 'defaultColorRange' ] ] + ]; + toTranslate.forEach(function(d, i) { + µ.util.translator.apply(null, d.concat(reverse)); + }); - return out; + if (!reverse) { + if (r.angularAxis && typeof r.angularAxis.ticklen !== 'undefined') r.tickLength = r.angularAxis.ticklen; + if (r.angularAxis && typeof r.angularAxis.tickcolor !== 'undefined') r.tickColor = r.angularAxis.tickcolor; + } else { + if (typeof r.tickLength !== 'undefined') { + r.angularaxis.ticklen = r.tickLength; + delete r.tickLength; + } + if (r.tickColor) { + r.angularaxis.tickcolor = r.tickColor; + delete r.tickColor; + } + } + if (r.legend && typeof r.legend.reverseOrder != 'boolean') { + r.legend.reverseOrder = r.legend.reverseOrder != 'normal'; + } + if (r.legend && typeof r.legend.traceorder == 'boolean') { + r.legend.traceorder = r.legend.traceorder ? 'reversed' : 'normal'; + delete r.legend.reverseOrder; + } + if (r.margin && typeof r.margin.t != 'undefined') { + var source = [ 't', 'r', 'b', 'l', 'pad' ]; + var target = [ 'top', 'right', 'bottom', 'left', 'pad' ]; + var margin = {}; + d3.entries(r.margin).forEach(function(dB, iB) { + margin[target[source.indexOf(dB.key)]] = dB.value; + }); + r.margin = margin; + } + if (reverse) { + delete r.needsEndSpacing; + delete r.minorTickColor; + delete r.minorTicks; + delete r.angularaxis.ticksCount; + delete r.angularaxis.ticksCount; + delete r.angularaxis.ticksStep; + delete r.angularaxis.rewriteTicks; + delete r.angularaxis.nticks; + delete r.radialaxis.ticksCount; + delete r.radialaxis.ticksCount; + delete r.radialaxis.ticksStep; + delete r.radialaxis.rewriteTicks; + delete r.radialaxis.nticks; + } + outputConfig.layout = r; + } + return outputConfig; + }; + return exports; }; -},{}],1080:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":138,"../../../lib":159,"d3":8}],241:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +/* eslint-disable new-cap */ 'use strict'; -var scatterHover = _dereq_('../scatter/hover'); +var d3 = _dereq_('d3'); +var Lib = _dereq_('../../../lib'); +var Color = _dereq_('../../../components/color'); -module.exports = function hoverPoints(pointData, xval, yval, hovermode) { - var scatterPointData = scatterHover(pointData, xval, yval, hovermode); - if(!scatterPointData || scatterPointData[0].index === false) return; +var micropolar = _dereq_('./micropolar'); +var UndoManager = _dereq_('./undo_manager'); +var extendDeepAll = Lib.extendDeepAll; - var newPointData = scatterPointData[0]; +var manager = module.exports = {}; - // if hovering on a fill, we don't show any point data so the label is - // unchanged from what scatter gives us - except that it needs to - // be constrained to the trianglular plot area, not just the rectangular - // area defined by the synthetic x and y axes - // TODO: in some cases the vertical middle of the shape is not within - // the triangular viewport at all, so the label can become disconnected - // from the shape entirely. But calculating what portion of the shape - // is actually visible, as constrained by the diagonal axis lines, is not - // so easy and anyway we lost the information we would have needed to do - // this inside scatterHover. - if(newPointData.index === undefined) { - var yFracUp = 1 - (newPointData.y0 / pointData.ya._length), - xLen = pointData.xa._length, - xMin = xLen * yFracUp / 2, - xMax = xLen - xMin; - newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin); - newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin); - return scatterPointData; - } - - var cdi = newPointData.cd[newPointData.index]; - - newPointData.a = cdi.a; - newPointData.b = cdi.b; - - newPointData.xLabelVal = undefined; - newPointData.yLabelVal = undefined; - // TODO: nice formatting, and label by axis title, for a, b, and c? - - var trace = newPointData.trace; - var carpet = trace._carpet; - var hoverinfo = cdi.hi || trace.hoverinfo; - var parts = hoverinfo.split('+'); - var text = []; +manager.framework = function(_gd) { + var config, previousConfigClone, plot, convertedInput, container; + var undoManager = new UndoManager(); - function textPart(ax, val) { - var prefix; + function exports(_inputConfig, _container) { + if(_container) container = _container; + d3.select(d3.select(container).node().parentNode).selectAll('.svg-container>*:not(.chart-root)').remove(); - if(ax.labelprefix && ax.labelprefix.length > 0) { - prefix = ax.labelprefix.replace(/ = $/, ''); - } else { - prefix = ax._hovertitle; - } + config = (!config) ? + _inputConfig : + extendDeepAll(config, _inputConfig); - text.push(prefix + ': ' + val.toFixed(3) + ax.labelsuffix); + if(!plot) plot = micropolar.Axis(); + convertedInput = micropolar.adapter.plotly().convert(config); + plot.config(convertedInput).render(container); + _gd.data = config.data; + _gd.layout = config.layout; + manager.fillLayout(_gd); + return config; } - - if(parts.indexOf('all') !== -1) parts = ['a', 'b']; - if(parts.indexOf('a') !== -1) textPart(carpet.aaxis, cdi.a); - if(parts.indexOf('b') !== -1) textPart(carpet.baxis, cdi.b); - - var ij = carpet.ab2ij([cdi.a, cdi.b]); - var i0 = Math.floor(ij[0]); - var ti = ij[0] - i0; - - var j0 = Math.floor(ij[1]); - var tj = ij[1] - j0; - - var xy = carpet.evalxy([], i0, j0, ti, tj); - text.push('y: ' + xy[1].toFixed(3)); - - newPointData.extraText = text.join('
'); - - return scatterPointData; + exports.isPolar = true; + exports.svg = function() { return plot.svg(); }; + exports.getConfig = function() { return config; }; + exports.getLiveConfig = function() { + return micropolar.adapter.plotly().convert(plot.getLiveConfig(), true); + }; + exports.getLiveScales = function() { return {t: plot.angularScale(), r: plot.radialScale()}; }; + exports.setUndoPoint = function() { + var that = this; + var configClone = micropolar.util.cloneJson(config); + (function(_configClone, _previousConfigClone) { + undoManager.add({ + undo: function() { + if(_previousConfigClone) that(_previousConfigClone); + }, + redo: function() { + that(_configClone); + } + }); + })(configClone, previousConfigClone); + previousConfigClone = micropolar.util.cloneJson(configClone); + }; + exports.undo = function() { undoManager.undo(); }; + exports.redo = function() { undoManager.redo(); }; + return exports; }; -},{"../scatter/hover":1054}],1081:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var ScatterCarpet = {}; - -ScatterCarpet.attributes = _dereq_('./attributes'); -ScatterCarpet.supplyDefaults = _dereq_('./defaults'); -ScatterCarpet.colorbar = _dereq_('../scatter/marker_colorbar'); -ScatterCarpet.calc = _dereq_('./calc'); -ScatterCarpet.plot = _dereq_('./plot'); -ScatterCarpet.style = _dereq_('../scatter/style').style; -ScatterCarpet.styleOnSelect = _dereq_('../scatter/style').styleOnSelect; -ScatterCarpet.hoverPoints = _dereq_('./hover'); -ScatterCarpet.selectPoints = _dereq_('../scatter/select'); -ScatterCarpet.eventData = _dereq_('./event_data'); +manager.fillLayout = function(_gd) { + var container = d3.select(_gd).selectAll('.plot-container'); + var paperDiv = container.selectAll('.svg-container'); + var paper = _gd.framework && _gd.framework.svg && _gd.framework.svg(); + var dflts = { + width: 800, + height: 600, + paper_bgcolor: Color.background, + _container: container, + _paperdiv: paperDiv, + _paper: paper + }; -ScatterCarpet.moduleType = 'trace'; -ScatterCarpet.name = 'scattercarpet'; -ScatterCarpet.basePlotModule = _dereq_('../../plots/cartesian'); -ScatterCarpet.categories = ['svg', 'carpet', 'symbols', 'showLegend', 'carpetDependent', 'zoomScale']; -ScatterCarpet.meta = { - - + _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -module.exports = ScatterCarpet; - -},{"../../plots/cartesian":756,"../scatter/marker_colorbar":1061,"../scatter/select":1064,"../scatter/style":1066,"./attributes":1076,"./calc":1077,"./defaults":1078,"./event_data":1079,"./hover":1080,"./plot":1082}],1082:[function(_dereq_,module,exports){ +},{"../../../components/color":43,"../../../lib":159,"./micropolar":240,"./undo_manager":242,"d3":8}],242:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var scatterPlot = _dereq_('../scatter/plot'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var Drawing = _dereq_('../../components/drawing'); - -module.exports = function plot(gd, plotinfoproxy, data, layer) { - var i, trace, node; - - var carpet = data[0][0].carpet; - // mimic cartesian plotinfo - var plotinfo = { - xaxis: Axes.getFromId(gd, carpet.xaxis || 'x'), - yaxis: Axes.getFromId(gd, carpet.yaxis || 'y'), - plot: plotinfoproxy.plot, - }; - - scatterPlot(gd, plotinfo, data, layer); +// Modified from https://github.com/ArthurClemens/Javascript-Undo-Manager +// Copyright (c) 2010-2013 Arthur Clemens, arthur@visiblearea.com +module.exports = function UndoManager() { + var undoCommands = []; + var index = -1; + var isExecuting = false; + var callback; - for(i = 0; i < data.length; i++) { - trace = data[i][0].trace; + function execute(command, action) { + if(!command) return this; - // Note: .select is adequate but seems to mutate the node data, - // which is at least a bit suprising and causes problems elsewhere - node = layer.selectAll('g.trace' + trace.uid + ' .js-line'); + isExecuting = true; + command[action](); + isExecuting = false; - // Note: it would be more efficient if this didn't need to be applied - // separately to all scattercarpet traces, but that would require - // lots of reorganization of scatter traces that is otherwise not - // necessary. That makes this a potential optimization. - Drawing.setClipUrl(node, carpet._clipPathId); + return this; } + + return { + add: function(command) { + if(isExecuting) return this; + undoCommands.splice(index + 1, undoCommands.length - index); + undoCommands.push(command); + index = undoCommands.length - 1; + return this; + }, + setCallback: function(callbackFunc) { callback = callbackFunc; }, + undo: function() { + var command = undoCommands[index]; + if(!command) return this; + execute(command, 'undo'); + index -= 1; + if(callback) callback(command.undo); + return this; + }, + redo: function() { + var command = undoCommands[index + 1]; + if(!command) return this; + execute(command, 'redo'); + index += 1; + if(callback) callback(command.redo); + return this; + }, + clear: function() { + undoCommands = []; + index = -1; + }, + hasUndo: function() { return index !== -1; }, + hasRedo: function() { return index < (undoCommands.length - 1); }, + getCommands: function() { return undoCommands; }, + getPreviousCommand: function() { return undoCommands[index - 1]; }, + getIndex: function() { return index; } + }; }; -},{"../../components/drawing":595,"../../plots/cartesian/axes":744,"../scatter/plot":1063}],1083:[function(_dereq_,module,exports){ +},{}],243:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -166609,726 +64073,820 @@ 'use strict'; -var scatterAttrs = _dereq_('../scatter/attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var dash = _dereq_('../../components/drawing/attributes').dash; +var Loggers = _dereq_('./lib/loggers'); +var noop = _dereq_('./lib/noop'); +var pushUnique = _dereq_('./lib/push_unique'); +var isPlainObject = _dereq_('./lib/is_plain_object'); +var ExtendModule = _dereq_('./lib/extend'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; +var basePlotAttributes = _dereq_('./plots/attributes'); +var baseLayoutAttributes = _dereq_('./plots/layout_attributes'); -var scatterMarkerAttrs = scatterAttrs.marker, - scatterLineAttrs = scatterAttrs.line, - scatterMarkerLineAttrs = scatterMarkerAttrs.line; +var extendFlat = ExtendModule.extendFlat; +var extendDeepAll = ExtendModule.extendDeepAll; -module.exports = overrideAll({ - lon: { - valType: 'data_array', - - }, - lat: { - valType: 'data_array', - - }, +exports.modules = {}; +exports.allCategories = {}; +exports.allTypes = []; +exports.subplotsRegistry = {}; +exports.transformsRegistry = {}; +exports.componentsRegistry = {}; +exports.layoutArrayContainers = []; +exports.layoutArrayRegexes = []; +exports.traceLayoutAttributes = {}; +exports.localeRegistry = {}; +exports.apiMethodRegistry = {}; +exports.collectableSubplotTypes = null; - locations: { - valType: 'data_array', - - }, - locationmode: { - valType: 'enumerated', - values: ['ISO-3', 'USA-states', 'country names'], - - dflt: 'ISO-3', - - }, +/** + * Top-level register routine, exported as Plotly.register + * + * @param {object array or array of objects} _modules : + * module object or list of module object to register. + * + * A valid `moduleType: 'trace'` module has fields: + * - name {string} : the trace type + * - categories {array} : categories associated with this trace type, + * tested with Register.traceIs() + * - meta {object} : meta info (mostly for plot-schema) + * + * A valid `moduleType: 'locale'` module has fields: + * - name {string} : the locale name. Should be a 2-digit language string ('en', 'de') + * optionally with a country/region code ('en-GB', 'de-CH'). If a country + * code is used but the base language locale has not yet been supplied, + * we will use this locale for the base as well. + * - dictionary {object} : the dictionary mapping input strings to localized strings + * generally the keys should be the literal input strings, but + * if default translations are provided you can use any string as a key. + * - format {object} : a `d3.locale` format specifier for this locale + * any omitted keys we'll fall back on en-US. + * + * A valid `moduleType: 'transform'` module has fields: + * - name {string} : transform name + * - transform {function} : default-level transform function + * - calcTransform {function} : calc-level transform function + * - attributes {object} : transform attributes declarations + * - supplyDefaults {function} : attributes default-supply function + * + * A valid `moduleType: 'component'` module has fields: + * - name {string} : the component name, used it with Register.getComponentMethod() + * to employ component method. + * + * A valid `moduleType: 'apiMethod'` module has fields: + * - name {string} : the api method name. + * - fn {function} : the api method called with Register.call(); + * + */ +exports.register = function register(_modules) { + exports.collectableSubplotTypes = null; - mode: extendFlat({}, scatterAttrs.mode, {dflt: 'markers'}), + if(!_modules) { + throw new Error('No argument passed to Plotly.register.'); + } else if(_modules && !Array.isArray(_modules)) { + _modules = [_modules]; + } - text: extendFlat({}, scatterAttrs.text, { - - }), - hovertext: extendFlat({}, scatterAttrs.hovertext, { - - }), + for(var i = 0; i < _modules.length; i++) { + var newModule = _modules[i]; - textfont: scatterAttrs.textfont, - textposition: scatterAttrs.textposition, + if(!newModule) { + throw new Error('Invalid module was attempted to be registered!'); + } - line: { - color: scatterLineAttrs.color, - width: scatterLineAttrs.width, - dash: dash - }, - connectgaps: scatterAttrs.connectgaps, + 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; + exports.apiMethodRegistry[name] = newModule.fn; + break; + default: + throw new Error('Invalid module was attempted to be registered!'); + } + } +}; - marker: extendFlat({ - symbol: scatterMarkerAttrs.symbol, - opacity: scatterMarkerAttrs.opacity, - size: scatterMarkerAttrs.size, - sizeref: scatterMarkerAttrs.sizeref, - sizemin: scatterMarkerAttrs.sizemin, - sizemode: scatterMarkerAttrs.sizemode, - colorbar: scatterMarkerAttrs.colorbar, - line: extendFlat({ - width: scatterMarkerLineAttrs.width - }, - colorAttributes('marker.line') - ), - gradient: scatterMarkerAttrs.gradient - }, - colorAttributes('marker') - ), +/** + * Get registered module using trace object or trace type + * + * @param {object||string} trace + * trace object with prop 'type' or trace type as a string + * @return {object} + * module object corresponding to trace type + */ +exports.getModule = function(trace) { + var _module = exports.modules[getTraceType(trace)]; + if(!_module) return false; + return _module._module; +}; - fill: { - valType: 'enumerated', - values: ['none', 'toself'], - dflt: 'none', - - - }, - fillcolor: scatterAttrs.fillcolor, +/** + * Determine if this trace type is in a given category + * + * @param {object||string} traceType + * a trace (object) or trace type (string) + * @param {string} category + * category in question + * @return {boolean} + */ +exports.traceIs = function(traceType, category) { + traceType = getTraceType(traceType); - selected: scatterAttrs.selected, - unselected: scatterAttrs.unselected, + // old plot.ly workspace hack, nothing to see here + if(traceType === 'various') return false; - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['lon', 'lat', 'location', 'text', 'name'] - }) -}, 'calc', 'nested'); + var _module = exports.modules[traceType]; -},{"../../components/colorscale/attributes":577,"../../components/drawing/attributes":594,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/attributes":741,"../scatter/attributes":1043}],1084:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(!_module) { + if(traceType && traceType !== 'area') { + Loggers.log('Unrecognized trace type ' + traceType + '.'); + } + _module = exports.modules[basePlotAttributes.type.dflt]; + } -'use strict'; + return !!_module.categories[category]; +}; -var isNumeric = _dereq_('fast-isnumeric'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; +/** + * Determine if this trace has a transform of the given type and return + * array of matching indices. + * + * @param {object} data + * a trace object (member of data or fullData) + * @param {string} type + * type of trace to test + * @return {array} + * array of matching indices. If none found, returns [] + */ +exports.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; +}; -var calcMarkerColorscale = _dereq_('../scatter/colorscale_calc'); -var arraysToCalcdata = _dereq_('../scatter/arrays_to_calcdata'); -var calcSelection = _dereq_('../scatter/calc_selection'); +/** + * Determine if this trace has a transform of the given type + * + * @param {object} data + * a trace object (member of data or fullData) + * @param {string} type + * type of trace to test + * @return {boolean} + */ +exports.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; +}; -var _ = _dereq_('../../lib')._; +/** + * Retrieve component module method. Falls back on noop if either the + * module or the method is missing, so the result can always be safely called + * + * @param {string} name + * name of component (as declared in component module) + * @param {string} method + * name of component module method + * @return {function} + */ +exports.getComponentMethod = function(name, method) { + var _module = exports.componentsRegistry[name]; -module.exports = function calc(gd, trace) { - var hasLocationData = Array.isArray(trace.locations); - var len = hasLocationData ? trace.locations.length : trace._length; - var calcTrace = new Array(len); + if(!_module) return noop; + return _module[method] || noop; +}; - for(var i = 0; i < len; i++) { - var calcPt = calcTrace[i] = {}; +/** + * Call registered api method. + * + * @param {string} name : api method name + * @param {...array} args : arguments passed to api method + * @return {any} : returns api method output + */ +exports.call = function() { + var name = arguments[0]; + var args = [].slice.call(arguments, 1); + return exports.apiMethodRegistry[name].apply(null, args); +}; - if(hasLocationData) { - var loc = trace.locations[i]; - calcPt.loc = typeof loc === 'string' ? loc : null; - } else { - var lon = trace.lon[i]; - var lat = trace.lat[i]; +function registerTraceModule(_module) { + var thisType = _module.name; + var categoriesIn = _module.categories; + var meta = _module.meta; - if(isNumeric(lon) && isNumeric(lat)) calcPt.lonlat = [+lon, +lat]; - else calcPt.lonlat = [BADNUM, BADNUM]; - } + if(exports.modules[thisType]) { + Loggers.log('Type ' + thisType + ' already registered'); + return; } - arraysToCalcdata(calcTrace, trace); - calcMarkerColorscale(trace); - calcSelection(calcTrace, trace); + if(!exports.subplotsRegistry[_module.basePlotModule.name]) { + registerSubplot(_module.basePlotModule); + } - if(len) { - calcTrace[0].t = { - labels: { - lat: _(gd, 'lat:') + ' ', - lon: _(gd, 'lon:') + ' ' - } - }; + var categoryObj = {}; + for(var i = 0; i < categoriesIn.length; i++) { + categoryObj[categoriesIn[i]] = true; + exports.allCategories[categoriesIn[i]] = true; } - return calcTrace; -}; + exports.modules[thisType] = { + _module: _module, + categories: categoryObj + }; -},{"../../constants/numerical":673,"../../lib":696,"../scatter/arrays_to_calcdata":1042,"../scatter/calc_selection":1045,"../scatter/colorscale_calc":1046,"fast-isnumeric":214}],1085:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(meta && Object.keys(meta).length) { + exports.modules[thisType].meta = meta; + } + exports.allTypes.push(thisType); -'use strict'; + for(var componentName in exports.componentsRegistry) { + mergeComponentAttrsToTrace(componentName, thisType); + } -var Lib = _dereq_('../../lib'); + /* + * Collect all trace layout attributes in one place for easier lookup later + * but don't merge them into the base schema as it would confuse the docs + * (at least after https://github.com/plotly/documentation/issues/202 gets done!) + */ + if(_module.layoutAttributes) { + extendFlat(exports.traceLayoutAttributes, _module.layoutAttributes); + } +} -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); +function registerSubplot(_module) { + var plotType = _module.name; -var attributes = _dereq_('./attributes'); + if(exports.subplotsRegistry[plotType]) { + Loggers.log('Plot type ' + plotType + ' already registered.'); + return; + } + + // relayout array handling will look for component module methods with this + // name and won't find them because this is a subplot module... but that + // should be fine, it will just fall back on redrawing the plot. + findArrayRegexps(_module); + // not sure what's best for the 'cartesian' type at this point + exports.subplotsRegistry[plotType] = _module; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + for(var componentName in exports.componentsRegistry) { + mergeComponentAttrsToSubplot(componentName, _module.name); } +} - var len = handleLonLatLocDefaults(traceIn, traceOut, coerce); - if(!len) { - traceOut.visible = false; - return; +function registerComponentModule(_module) { + if(typeof _module.name !== 'string') { + throw new Error('Component module *name* must be a string.'); } - coerce('text'); - coerce('hovertext'); - coerce('mode'); + var name = _module.name; + exports.componentsRegistry[name] = _module; - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - coerce('connectgaps'); + if(_module.layoutAttributes) { + if(_module.layoutAttributes._isLinkedToArray) { + pushUnique(exports.layoutArrayContainers, name); + } + findArrayRegexps(_module); } - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true}); + for(var traceType in exports.modules) { + mergeComponentAttrsToTrace(name, traceType); } - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); + for(var subplotName in exports.subplotsRegistry) { + mergeComponentAttrsToSubplot(name, subplotName); } - coerce('fill'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); + for(var transformType in exports.transformsRegistry) { + mergeComponentAttrsToTransform(name, transformType); } - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -}; + if(_module.schema && _module.schema.layout) { + extendDeepAll(baseLayoutAttributes, _module.schema.layout); + } +} -function handleLonLatLocDefaults(traceIn, traceOut, coerce) { - var len = 0, - locations = coerce('locations'); +function registerTransformModule(_module) { + if(typeof _module.name !== 'string') { + throw new Error('Transform module *name* must be a string.'); + } - var lon, lat; + var prefix = 'Transform module ' + _module.name; + var hasTransform = typeof _module.transform === 'function'; + var hasCalcTransform = typeof _module.calcTransform === 'function'; - if(locations) { - coerce('locationmode'); - len = locations.length; - return len; + 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.'); } - lon = coerce('lon') || []; - lat = coerce('lat') || []; - len = Math.min(lon.length, lat.length); - traceOut._length = len; + exports.transformsRegistry[_module.name] = _module; - return len; + for(var componentName in exports.componentsRegistry) { + mergeComponentAttrsToTransform(componentName, _module.name); + } } -},{"../../lib":696,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"./attributes":1083}],1086:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - +function registerLocale(_module) { + var locale = _module.name; + var baseLocale = locale.split('-')[0]; -module.exports = function eventData(out, pt) { - out.lon = pt.lon; - out.lat = pt.lat; - out.location = pt.loc ? pt.loc : null; + var newDict = _module.dictionary; + var newFormat = _module.format; + var hasDict = newDict && Object.keys(newDict).length; + var hasFormat = newFormat && Object.keys(newFormat).length; - return out; -}; + var locales = exports.localeRegistry; -},{}],1087:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var localeObj = locales[locale]; + if(!localeObj) locales[locale] = localeObj = {}; + // Should we use this dict for the base locale? + // In case we're overwriting a previous dict for this locale, check + // whether the base matches the full locale dict now. If we're not + // overwriting, locales[locale] is undefined so this just checks if + // baseLocale already had a dict or not. + // Same logic for dateFormats + if(baseLocale !== locale) { + var baseLocaleObj = locales[baseLocale]; + if(!baseLocaleObj) locales[baseLocale] = baseLocaleObj = {}; -'use strict'; + if(hasDict && baseLocaleObj.dictionary === localeObj.dictionary) { + baseLocaleObj.dictionary = newDict; + } + if(hasFormat && baseLocaleObj.format === localeObj.format) { + baseLocaleObj.format = newFormat; + } + } -var Fx = _dereq_('../../components/fx'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; + if(hasDict) localeObj.dictionary = newDict; + if(hasFormat) localeObj.format = newFormat; +} -var getTraceColor = _dereq_('../scatter/get_trace_color'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); -var attributes = _dereq_('./attributes'); +function findArrayRegexps(_module) { + if(_module.layoutAttributes) { + var arrayAttrRegexps = _module.layoutAttributes._arrayAttrRegexps; + if(arrayAttrRegexps) { + for(var i = 0; i < arrayAttrRegexps.length; i++) { + pushUnique(exports.layoutArrayRegexes, arrayAttrRegexps[i]); + } + } + } +} -module.exports = function hoverPoints(pointData, xval, yval) { - var cd = pointData.cd; - var trace = cd[0].trace; - var xa = pointData.xa; - var ya = pointData.ya; - var geo = pointData.subplot; +function mergeComponentAttrsToTrace(componentName, traceType) { + var componentSchema = exports.componentsRegistry[componentName].schema; + if(!componentSchema || !componentSchema.traces) return; - var isLonLatOverEdges = geo.projection.isLonLatOverEdges; - var project = geo.project; + var traceAttrs = componentSchema.traces[traceType]; + if(traceAttrs) { + extendDeepAll(exports.modules[traceType]._module.attributes, traceAttrs); + } +} - function distFn(d) { - var lonlat = d.lonlat; +function mergeComponentAttrsToTransform(componentName, transformType) { + var componentSchema = exports.componentsRegistry[componentName].schema; + if(!componentSchema || !componentSchema.transforms) return; - if(lonlat[0] === BADNUM) return Infinity; - if(isLonLatOverEdges(lonlat)) return Infinity; + var transformAttrs = componentSchema.transforms[transformType]; + if(transformAttrs) { + extendDeepAll(exports.transformsRegistry[transformType].attributes, transformAttrs); + } +} - var pt = project(lonlat); - var px = project([xval, yval]); - var dx = Math.abs(pt[0] - px[0]); - var dy = Math.abs(pt[1] - px[1]); - var rad = Math.max(3, d.mrc || 0); +function mergeComponentAttrsToSubplot(componentName, subplotName) { + var componentSchema = exports.componentsRegistry[componentName].schema; + if(!componentSchema || !componentSchema.subplots) return; - // N.B. d.mrc is the calculated marker radius - // which is only set for trace with 'markers' mode. + var subplotModule = exports.subplotsRegistry[subplotName]; + var subplotAttrs = subplotModule.layoutAttributes; + var subplotAttr = subplotModule.attr === 'subplot' ? subplotModule.name : subplotModule.attr; + if(Array.isArray(subplotAttr)) subplotAttr = subplotAttr[0]; - return Math.max(Math.sqrt(dx * dx + dy * dy) - rad, 1 - 3 / rad); + var componentLayoutAttrs = componentSchema.subplots[subplotAttr]; + if(subplotAttrs && componentLayoutAttrs) { + extendDeepAll(subplotAttrs, componentLayoutAttrs); } +} - Fx.getClosest(cd, distFn, pointData); +function getTraceType(traceType) { + if(typeof traceType === 'object') traceType = traceType.type; + return traceType; +} - // skip the rest (for this trace) if we didn't find a close point - if(pointData.index === false) return; +},{"./lib/extend":153,"./lib/is_plain_object":160,"./lib/loggers":163,"./lib/noop":168,"./lib/push_unique":172,"./plots/attributes":200,"./plots/layout_attributes":234}],244:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var di = cd[pointData.index]; - var lonlat = di.lonlat; - var pos = [xa.c2p(lonlat), ya.c2p(lonlat)]; - var rad = di.mrc || 1; - - pointData.x0 = pos[0] - rad; - pointData.x1 = pos[0] + rad; - pointData.y0 = pos[1] - rad; - pointData.y1 = pos[1] + rad; - - pointData.loc = di.loc; - pointData.lon = lonlat[0]; - pointData.lat = lonlat[1]; - pointData.color = getTraceColor(trace, di); - pointData.extraText = getExtraText(trace, di, geo.mockAxis, cd[0].t.labels); +'use strict'; - return [pointData]; -}; +var Lib = _dereq_('../lib'); -function getExtraText(trace, pt, axis, labels) { - var hoverinfo = pt.hi || trace.hoverinfo; +var extendFlat = Lib.extendFlat; +var extendDeep = Lib.extendDeep; - var parts = hoverinfo === 'all' ? - attributes.hoverinfo.flags : - hoverinfo.split('+'); +// Put default plotTile layouts here +function cloneLayoutOverride(tileClass) { + var override; - var hasLocation = parts.indexOf('location') !== -1 && Array.isArray(trace.locations); - var hasLon = (parts.indexOf('lon') !== -1); - var hasLat = (parts.indexOf('lat') !== -1); - var hasText = (parts.indexOf('text') !== -1); - var text = []; + 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; - function format(val) { - return Axes.tickText(axis, axis.c2l(val), 'hover').text + '\u00B0'; - } + 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; - if(hasLocation) { - text.push(pt.loc); - } else if(hasLon && hasLat) { - text.push('(' + format(pt.lonlat[0]) + ', ' + format(pt.lonlat[1]) + ')'); - } else if(hasLon) { - text.push(labels.lon + format(pt.lonlat[0])); - } else if(hasLat) { - text.push(labels.lat + format(pt.lonlat[1])); + default: + override = {}; } - if(hasText) { - fillHoverText(pt, trace, text); - } - return text.join('
'); + return override; } -},{"../../components/fx":612,"../../constants/numerical":673,"../../plots/cartesian/axes":744,"../scatter/fill_hover_text":1051,"../scatter/get_trace_color":1053,"./attributes":1083}],1088:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var ScatterGeo = {}; - -ScatterGeo.attributes = _dereq_('./attributes'); -ScatterGeo.supplyDefaults = _dereq_('./defaults'); -ScatterGeo.colorbar = _dereq_('../scatter/marker_colorbar'); -ScatterGeo.calc = _dereq_('./calc'); -ScatterGeo.plot = _dereq_('./plot'); -ScatterGeo.style = _dereq_('./style'); -ScatterGeo.styleOnSelect = _dereq_('../scatter/style').styleOnSelect; -ScatterGeo.hoverPoints = _dereq_('./hover'); -ScatterGeo.eventData = _dereq_('./event_data'); -ScatterGeo.selectPoints = _dereq_('./select'); +function keyIsAxis(keyName) { + var types = ['xaxis', 'yaxis', 'zaxis']; + return (types.indexOf(keyName.slice(0, 5)) > -1); +} -ScatterGeo.moduleType = 'trace'; -ScatterGeo.name = 'scattergeo'; -ScatterGeo.basePlotModule = _dereq_('../../plots/geo'); -ScatterGeo.categories = ['geo', 'symbols', 'showLegend', 'scatter-like']; -ScatterGeo.meta = { - - -}; -module.exports = ScatterGeo; +module.exports = function clonePlot(graphObj, options) { -},{"../../plots/geo":775,"../scatter/marker_colorbar":1061,"../scatter/style":1066,"./attributes":1083,"./calc":1084,"./defaults":1085,"./event_data":1086,"./hover":1087,"./plot":1089,"./select":1090,"./style":1091}],1089:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // Polar plot compatibility + if(graphObj.framework && graphObj.framework.isPolar) { + graphObj = graphObj.framework.getConfig(); + } + 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 || {}; -'use strict'; + if(options.width) newLayout.width = options.width; + if(options.height) newLayout.height = options.height; -var d3 = _dereq_('d3'); + if(options.tileClass === 'thumbnail' || options.tileClass === 'themes__thumb') { + // kill annotations + newLayout.annotations = []; + var keys = Object.keys(newLayout); -var Lib = _dereq_('../../lib'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; -var getTopojsonFeatures = _dereq_('../../lib/topojson_utils').getTopojsonFeatures; -var locationToFeature = _dereq_('../../lib/geo_location_utils').locationToFeature; -var geoJsonUtils = _dereq_('../../lib/geojson_utils'); -var subTypes = _dereq_('../scatter/subtypes'); -var style = _dereq_('./style'); + for(i = 0; i < keys.length; i++) { + if(keyIsAxis(keys[i])) { + newLayout[keys[i]].title = {text: ''}; + } + } -module.exports = function plot(gd, geo, calcData) { - for(var i = 0; i < calcData.length; i++) { - calcGeoJSON(calcData[i], geo.topojson); + // kill colorbar and pie labels + for(i = 0; i < newData.length; i++) { + var trace = newData[i]; + trace.showscale = false; + if(trace.marker) trace.marker.showscale = false; + if(trace.type === 'pie') trace.textposition = 'none'; + } } - function removeBADNUM(d, node) { - if(d.lonlat[0] === BADNUM) { - d3.select(node).remove(); + if(Array.isArray(options.annotations)) { + for(i = 0; i < options.annotations.length; i++) { + newLayout.annotations.push(options.annotations[i]); } } - var scatterLayer = geo.layers.frontplot.select('.scatterlayer'); - var gTraces = Lib.makeTraceGroups(scatterLayer, calcData, 'trace scattergeo'); + // TODO: does this scene modification really belong here? + // If we still need it, can it move into the gl3d module? + 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]]; - // TODO find a way to order the inner nodes on update - gTraces.selectAll('*').remove(); + if(!scene.xaxis) { + scene.xaxis = {}; + } - gTraces.each(function(calcTrace) { - var s = calcTrace[0].node3 = d3.select(this); - var trace = calcTrace[0].trace; + if(!scene.yaxis) { + scene.yaxis = {}; + } - if(subTypes.hasLines(trace) || trace.fill !== 'none') { - var lineCoords = geoJsonUtils.calcTraceToLineCoords(calcTrace); + if(!scene.zaxis) { + scene.zaxis = {}; + } - var lineData = (trace.fill !== 'none') ? - geoJsonUtils.makePolygon(lineCoords) : - geoJsonUtils.makeLine(lineCoords); + extendFlat(scene.xaxis, axesImageOverride); + extendFlat(scene.yaxis, axesImageOverride); + extendFlat(scene.zaxis, axesImageOverride); - s.selectAll('path.js-line') - .data([{geojson: lineData, trace: trace}]) - .enter().append('path') - .classed('js-line', true) - .style('stroke-miterlimit', 2); + // TODO what does this do? + scene._scene = null; } + } - if(subTypes.hasMarkers(trace)) { - s.selectAll('path.point') - .data(Lib.identity) - .enter().append('path') - .classed('point', true) - .each(function(calcPt) { removeBADNUM(calcPt, this); }); - } + var gd = document.createElement('div'); + if(options.tileClass) gd.className = options.tileClass; - if(subTypes.hasText(trace)) { - s.selectAll('g') - .data(Lib.identity) - .enter().append('g') - .append('text') - .each(function(calcPt) { removeBADNUM(calcPt, this); }); + var plotTile = { + gd: gd, + td: gd, // for external (image server) compatibility + layout: newLayout, + data: newData, + config: { + staticPlot: (options.staticPlot === undefined) ? + true : + options.staticPlot, + plotGlPixelRatio: (options.plotGlPixelRatio === undefined) ? + 2 : + options.plotGlPixelRatio, + displaylogo: options.displaylogo || false, + showLink: options.showLink || false, + showTips: options.showTips || false, + mapboxAccessToken: context.mapboxAccessToken } + }; - // call style here within topojson request callback - style(gd, calcTrace); - }); -}; - -function calcGeoJSON(calcTrace, topojson) { - var trace = calcTrace[0].trace; - - if(!Array.isArray(trace.locations)) return; - - var features = getTopojsonFeatures(trace, topojson); - var locationmode = trace.locationmode; + if(options.setBackground !== 'transparent') { + plotTile.config.setBackground = options.setBackground || 'opaque'; + } - for(var i = 0; i < calcTrace.length; i++) { - var calcPt = calcTrace[i]; - var feature = locationToFeature(locationmode, calcPt.loc, features); + // attaching the default Layout the gd, so you can grab it later + plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); - calcPt.lonlat = feature ? feature.properties.ct : [BADNUM, BADNUM]; - } -} + return plotTile; +}; -},{"../../constants/numerical":673,"../../lib":696,"../../lib/geo_location_utils":688,"../../lib/geojson_utils":689,"../../lib/topojson_utils":723,"../scatter/subtypes":1067,"./style":1091,"d3":148}],1090:[function(_dereq_,module,exports){ +},{"../lib":159}],245:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var subtypes = _dereq_('../scatter/subtypes'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var toImage = _dereq_('../plot_api/to_image'); +var Lib = _dereq_('../lib'); // for isIE +var fileSaver = _dereq_('./filesaver'); -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; - var trace = cd[0].trace; +/** Plotly.downloadImage + * + * @param {object | string | HTML div} gd + * can either be a data/layout/config object + * or an existing graph
+ * or an id to an existing graph
+ * @param {object} opts (see ../plot_api/to_image) + * @return {promise} + */ +function downloadImage(gd, opts) { + var _gd; + if(!Lib.isPlainObject(gd)) _gd = Lib.getGraphDiv(gd); - var di, lonlat, x, y, i; + // check for undefined opts + opts = opts || {}; + // default to png + opts.format = opts.format || 'png'; - var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); - if(hasOnlyLines) return []; + return new Promise(function(resolve, reject) { + if(_gd && _gd._snapshotInProgress) { + reject(new Error('Snapshotting already in progress.')); + } - if(selectionTester === false) { - for(i = 0; i < cd.length; i++) { - cd[i].selected = 0; + // see comments within svgtoimg for additional + // discussion of problems with IE + // can now draw to canvas, but CORS tainted canvas + // does not allow toDataURL + // svg format will work though + if(Lib.isIE() && opts.format !== 'svg') { + reject(new Error('Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.')); } - } else { - for(i = 0; i < cd.length; i++) { - di = cd[i]; - lonlat = di.lonlat; - // some projection types can't handle BADNUMs - if(lonlat[0] === BADNUM) continue; + if(_gd) _gd._snapshotInProgress = true; + var promise = toImage(gd, opts); - x = xa.c2p(lonlat); - y = ya.c2p(lonlat); + var filename = opts.filename || gd.fn || 'newplot'; + filename += '.' + opts.format; - if(selectionTester.contains([x, y], null, i, searchInfo)) { - selection.push({ - pointNumber: i, - lon: lonlat[0], - lat: lonlat[1] - }); - di.selected = 1; - } else { - di.selected = 0; - } - } - } + promise.then(function(result) { + if(_gd) _gd._snapshotInProgress = false; + return fileSaver(result, filename); + }).then(function(name) { + resolve(name); + }).catch(function(err) { + if(_gd) _gd._snapshotInProgress = false; + reject(err); + }); + }); +} - return selection; -}; +module.exports = downloadImage; -},{"../../constants/numerical":673,"../scatter/subtypes":1067}],1091:[function(_dereq_,module,exports){ +},{"../lib":159,"../plot_api/to_image":196,"./filesaver":246}],246:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; +/* +* substantial portions of this code from FileSaver.js +* https://github.com/eligrey/FileSaver.js +* License: https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md +* FileSaver.js +* A saveAs() FileSaver implementation. +* 1.1.20160328 +* +* By Eli Grey, http://eligrey.com +* License: MIT +* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md +*/ -var d3 = _dereq_('d3'); -var Drawing = _dereq_('../../components/drawing'); -var Color = _dereq_('../../components/color'); +'use strict'; -var scatterStyle = _dereq_('../scatter/style'); -var stylePoints = scatterStyle.stylePoints; -var styleText = scatterStyle.styleText; +var fileSaver = function(url, name) { + var saveLink = document.createElement('a'); + var canUseSaveLink = 'download' in saveLink; + var isSafari = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent); + var promise = new Promise(function(resolve, reject) { + // IE <10 is explicitly unsupported + if(typeof navigator !== 'undefined' && /MSIE [1-9]\./.test(navigator.userAgent)) { + reject(new Error('IE < 10 unsupported')); + } -module.exports = function style(gd, calcTrace) { - if(calcTrace) styleTrace(gd, calcTrace); -}; + // First try a.download, then web filesystem, then object URLs + if(isSafari) { + // Safari doesn't allow downloading of blob urls + document.location.href = 'data:application/octet-stream' + url.slice(url.search(/[,;]/)); + resolve(name); + } -function styleTrace(gd, calcTrace) { - var trace = calcTrace[0].trace; - var s = calcTrace[0].node3; + if(!name) { + name = 'download'; + } - s.style('opacity', calcTrace[0].trace.opacity); + if(canUseSaveLink) { + saveLink.href = url; + saveLink.download = name; + document.body.appendChild(saveLink); + saveLink.click(); + document.body.removeChild(saveLink); + resolve(name); + } - stylePoints(s, trace, gd); - styleText(s, trace, gd); + // IE 10+ (native saveAs) + if(typeof navigator !== 'undefined' && navigator.msSaveBlob) { + // At this point we are only dealing with a SVG encoded as + // a data URL (since IE only supports SVG) + var encoded = url.split(/^data:image\/svg\+xml,/)[1]; + var svg = decodeURIComponent(encoded); + navigator.msSaveBlob(new Blob([svg]), name); + resolve(name); + } - // this part is incompatible with Drawing.lineGroupStyle - s.selectAll('path.js-line') - .style('fill', 'none') - .each(function(d) { - var path = d3.select(this); - var trace = d.trace; - var line = trace.line || {}; + reject(new Error('download error')); + }); - path.call(Color.stroke, line.color) - .call(Drawing.dashLine, line.dash || '', line.width || 0); + return promise; +}; - if(trace.fill !== 'none') { - path.call(Color.fill, trace.fillcolor); - } - }); -} +module.exports = fileSaver; -},{"../../components/color":570,"../../components/drawing":595,"../scatter/style":1066,"d3":148}],1092:[function(_dereq_,module,exports){ +},{}],247:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var plotAttrs = _dereq_('../../plots/attributes'); -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorAttrs = _dereq_('../../components/colorscale/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var DASHES = _dereq_('./constants').DASHES; - -var scatterLineAttrs = scatterAttrs.line; -var scatterMarkerAttrs = scatterAttrs.marker; -var scatterMarkerLineAttrs = scatterMarkerAttrs.line; - -var attrs = module.exports = overrideAll({ - x: scatterAttrs.x, - x0: scatterAttrs.x0, - dx: scatterAttrs.dx, - y: scatterAttrs.y, - y0: scatterAttrs.y0, - dy: scatterAttrs.dy, - - text: scatterAttrs.text, - hovertext: scatterAttrs.hovertext, - - textposition: scatterAttrs.textposition, - textfont: scatterAttrs.textfont, - mode: { - valType: 'flaglist', - flags: ['lines', 'markers', 'text'], - extras: ['none'], - - - }, - line: { - color: scatterLineAttrs.color, - width: scatterLineAttrs.width, - shape: { - valType: 'enumerated', - values: ['linear', 'hv', 'vh', 'hvh', 'vhv'], - dflt: 'linear', - - editType: 'plot', - - }, - dash: { - valType: 'enumerated', - values: Object.keys(DASHES), - dflt: 'solid', - - - } - }, - marker: extendFlat({}, colorAttrs('marker'), { - symbol: scatterMarkerAttrs.symbol, - size: scatterMarkerAttrs.size, - sizeref: scatterMarkerAttrs.sizeref, - sizemin: scatterMarkerAttrs.sizemin, - sizemode: scatterMarkerAttrs.sizemode, - opacity: scatterMarkerAttrs.opacity, - colorbar: scatterMarkerAttrs.colorbar, - line: extendFlat({}, colorAttrs('marker.line'), { - width: scatterMarkerLineAttrs.width - }) - }), - connectgaps: scatterAttrs.connectgaps, - fill: extendFlat({}, scatterAttrs.fill, {dflt: 'none'}), - fillcolor: scatterAttrs.fillcolor, +'use strict'; - // no hoveron +exports.getDelay = function(fullLayout) { + if(!fullLayout._has) return 0; - selected: { - marker: scatterAttrs.selected.marker, - textfont: scatterAttrs.selected.textfont - }, - unselected: { - marker: scatterAttrs.unselected.marker, - textfont: scatterAttrs.unselected.textfont - }, + return ( + fullLayout._has('gl3d') || + fullLayout._has('gl2d') || + fullLayout._has('mapbox') + ) ? 500 : 0; +}; - opacity: plotAttrs.opacity +exports.getRedrawFunc = function(gd) { + var fullLayout = gd._fullLayout || {}; + var hasPolar = fullLayout._has && fullLayout._has('polar'); + var hasLegacyPolar = !hasPolar && gd.data && gd.data[0] && gd.data[0].r; -}, 'calc', 'nested'); + // do not work for legacy polar + if(hasLegacyPolar) return; -attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = 'calc+clearAxisTypes'; + return function() { + (gd.calcdata || []).forEach(function(d) { + if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb(); + }); + }; +}; -},{"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/attributes":741,"../scatter/attributes":1043,"./constants":1093}],1093:[function(_dereq_,module,exports){ +},{}],248:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var SYMBOL_SIZE = 20; - -module.exports = { - TOO_MANY_POINTS: 1e5, - SYMBOL_SDF_SIZE: 200, - SYMBOL_SIZE: SYMBOL_SIZE, - SYMBOL_STROKE: SYMBOL_SIZE / 20, +'use strict'; - DOT_RE: /-dot/, - OPEN_RE: /-open/, +var helpers = _dereq_('./helpers'); - DASHES: { - solid: [1], - dot: [1, 1], - dash: [4, 1], - longdash: [8, 1], - dashdot: [4, 1, 1, 1], - longdashdot: [8, 1, 1, 1] - } +var Snapshot = { + getDelay: helpers.getDelay, + getRedrawFunc: helpers.getRedrawFunc, + clone: _dereq_('./cloneplot'), + toSVG: _dereq_('./tosvg'), + svgToImg: _dereq_('./svgtoimg'), + toImage: _dereq_('./toimage'), + downloadImage: _dereq_('./download') }; -},{}],1094:[function(_dereq_,module,exports){ +module.exports = Snapshot; + +},{"./cloneplot":244,"./download":245,"./helpers":247,"./svgtoimg":249,"./toimage":250,"./tosvg":251}],249:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -167337,682 +64895,410 @@ 'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); -var svgSdf = _dereq_('svg-path-sdf'); -var rgba = _dereq_('color-normalize'); +var Lib = _dereq_('../lib'); +var EventEmitter = _dereq_('events').EventEmitter; -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../../components/drawing'); -var AxisIDs = _dereq_('../../plots/cartesian/axis_ids'); +function svgToImg(opts) { + var ev = opts.emitter || new EventEmitter(); -var formatColor = _dereq_('../../lib/gl_format_color').formatColor; -var subTypes = _dereq_('../scatter/subtypes'); -var makeBubbleSizeFn = _dereq_('../scatter/make_bubble_size_func'); + var promise = new Promise(function(resolve, reject) { + var Image = window.Image; + var svg = opts.svg; + var format = opts.format || 'png'; -var constants = _dereq_('./constants'); -var DESELECTDIM = _dereq_('../../constants/interactions').DESELECTDIM; + // IE only support svg + if(Lib.isIE() && format !== 'svg') { + var ieSvgError = new Error('Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'); + reject(ieSvgError); + // eventually remove the ev + // in favor of promises + if(!opts.promise) { + return ev.emit('error', ieSvgError); + } else { + return promise; + } + } -var TEXTOFFSETSIGN = { - start: 1, left: 1, end: -1, right: -1, middle: 0, center: 0, bottom: 1, top: -1 -}; + var canvas = opts.canvas; + var scale = opts.scale || 1; + var w0 = opts.width || 300; + var h0 = opts.height || 150; + var w1 = scale * w0; + var h1 = scale * h0; -function convertStyle(gd, trace) { - var i; + var ctx = canvas.getContext('2d'); + var img = new Image(); - var opts = { - marker: undefined, - markerSel: undefined, - markerUnsel: undefined, - line: undefined, - fill: undefined, - errorX: undefined, - errorY: undefined, - text: undefined, - textSel: undefined, - textUnsel: undefined - }; - - if(trace.visible !== true) return opts; - - if(subTypes.hasText(trace)) { - opts.text = convertTextStyle(trace); - opts.textSel = convertTextSelection(trace, trace.selected); - opts.textUnsel = convertTextSelection(trace, trace.unselected); - } + // for Safari support, eliminate createObjectURL + // this decision could cause problems if content + // is not restricted to svg + var url = 'data:image/svg+xml,' + encodeURIComponent(svg); - if(subTypes.hasMarkers(trace)) { - opts.marker = convertMarkerStyle(trace); - opts.markerSel = convertMarkerSelection(trace, trace.selected); - opts.markerUnsel = convertMarkerSelection(trace, trace.unselected); + canvas.width = w1; + canvas.height = h1; - if(!trace.unselected && Array.isArray(trace.marker.opacity)) { - var mo = trace.marker.opacity; - opts.markerUnsel.opacity = new Array(mo.length); - for(i = 0; i < mo.length; i++) { - opts.markerUnsel.opacity[i] = DESELECTDIM * mo[i]; + img.onload = function() { + var imgData; + + // don't need to draw to canvas if svg + // save some time and also avoid failure on IE + if(format !== 'svg') { + ctx.drawImage(img, 0, 0, w1, h1); } - } - } - if(subTypes.hasLines(trace)) { - opts.line = { - overlay: true, - thickness: trace.line.width, - color: trace.line.color, - opacity: trace.opacity + switch(format) { + 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)); + // eventually remove the ev + // in favor of promises + if(!opts.promise) { + return ev.emit('error', errorMsg); + } + } + resolve(imgData); + // eventually remove the ev + // in favor of promises + if(!opts.promise) { + ev.emit('success', imgData); + } }; - var dashes = (constants.DASHES[trace.line.dash] || [1]).slice(); - for(i = 0; i < dashes.length; ++i) { - dashes[i] *= trace.line.width; - } - opts.line.dashes = dashes; - } - - if(trace.error_x && trace.error_x.visible) { - opts.errorX = convertErrorBarStyle(trace, trace.error_x); - } - - if(trace.error_y && trace.error_y.visible) { - opts.errorY = convertErrorBarStyle(trace, trace.error_y); - } - - if(!!trace.fill && trace.fill !== 'none') { - opts.fill = { - closed: true, - fill: trace.fillcolor, - thickness: 0 + img.onerror = function(err) { + reject(err); + // eventually remove the ev + // in favor of promises + if(!opts.promise) { + return ev.emit('error', err); + } }; - } - return opts; -} - -function convertTextStyle(trace) { - var count = trace._length; - var textfontIn = trace.textfont; - var textpositionIn = trace.textposition; - var textPos = Array.isArray(textpositionIn) ? textpositionIn : [textpositionIn]; - var tfc = textfontIn.color; - var tfs = textfontIn.size; - var tff = textfontIn.family; - var optsOut = {}; - var i; + img.src = url; + }); - optsOut.text = trace.text; - optsOut.opacity = trace.opacity; - optsOut.font = {}; - optsOut.align = []; - optsOut.baseline = []; - - for(i = 0; i < textPos.length; i++) { - var tp = textPos[i].split(/\s+/); - - switch(tp[1]) { - case 'left': - optsOut.align.push('right'); - break; - case 'right': - optsOut.align.push('left'); - break; - default: - optsOut.align.push(tp[1]); - } - switch(tp[0]) { - case 'top': - optsOut.baseline.push('bottom'); - break; - case 'bottom': - optsOut.baseline.push('top'); - break; - default: - optsOut.baseline.push(tp[0]); - } + // temporary for backward compatibility + // move to only Promise in 2.0.0 + // and eliminate the EventEmitter + if(opts.promise) { + return promise; } - if(Array.isArray(tfc)) { - optsOut.color = new Array(count); - for(i = 0; i < count; i++) { - optsOut.color[i] = tfc[i]; - } - } else { - optsOut.color = tfc; - } + return ev; +} - if(Array.isArray(tfs) || Array.isArray(tff)) { - // if any textfont param is array - make render a batch - optsOut.font = new Array(count); - for(i = 0; i < count; i++) { - var fonti = optsOut.font[i] = {}; +module.exports = svgToImg; - fonti.size = Array.isArray(tfs) ? - (isNumeric(tfs[i]) ? tfs[i] : 0) : - tfs; +},{"../lib":159,"events":7}],250:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - fonti.family = Array.isArray(tff) ? tff[i] : tff; - } - } else { - // if both are single values, make render fast single-value - optsOut.font = {size: tfs, family: tff}; - } +'use strict'; - return optsOut; -} +var EventEmitter = _dereq_('events').EventEmitter; +var Registry = _dereq_('../registry'); +var Lib = _dereq_('../lib'); -function convertMarkerStyle(trace) { - var count = trace._length; - var optsIn = trace.marker; - var optsOut = {}; - var i; +var helpers = _dereq_('./helpers'); +var clonePlot = _dereq_('./cloneplot'); +var toSVG = _dereq_('./tosvg'); +var svgToImg = _dereq_('./svgtoimg'); - var multiSymbol = Array.isArray(optsIn.symbol); - var multiColor = Lib.isArrayOrTypedArray(optsIn.color); - var multiLineColor = Lib.isArrayOrTypedArray(optsIn.line.color); - var multiOpacity = Lib.isArrayOrTypedArray(optsIn.opacity); - var multiSize = Lib.isArrayOrTypedArray(optsIn.size); - var multiLineWidth = Lib.isArrayOrTypedArray(optsIn.line.width); +/** + * @param {object} gd figure Object + * @param {object} opts option object + * @param opts.format 'jpeg' | 'png' | 'webp' | 'svg' + */ +function toImage(gd, opts) { - var isOpen; - if(!multiSymbol) isOpen = constants.OPEN_RE.test(optsIn.symbol); + // first clone the GD so we can operate in a clean environment + var ev = new EventEmitter(); - // prepare colors - if(multiSymbol || multiColor || multiLineColor || multiOpacity) { - optsOut.colors = new Array(count); - optsOut.borderColors = new Array(count); + var clone = clonePlot(gd, {format: 'png'}); + var clonedGd = clone.gd; - var colors = formatColor(optsIn, optsIn.opacity, count); - var borderColors = formatColor(optsIn.line, optsIn.opacity, count); + // put the cloned div somewhere off screen before attaching to DOM + clonedGd.style.position = 'absolute'; + clonedGd.style.left = '-5000px'; + document.body.appendChild(clonedGd); - if(!Array.isArray(borderColors[0])) { - var borderColor = borderColors; - borderColors = Array(count); - for(i = 0; i < count; i++) { - borderColors[i] = borderColor; - } - } - if(!Array.isArray(colors[0])) { - var color = colors; - colors = Array(count); - for(i = 0; i < count; i++) { - colors[i] = color; - } - } + function wait() { + var delay = helpers.getDelay(clonedGd._fullLayout); - optsOut.colors = colors; - optsOut.borderColors = borderColors; + setTimeout(function() { + var svg = toSVG(clonedGd); - for(i = 0; i < count; i++) { - if(multiSymbol) { - var symbol = optsIn.symbol[i]; - isOpen = constants.OPEN_RE.test(symbol); - } - if(isOpen) { - borderColors[i] = colors[i].slice(); - colors[i] = colors[i].slice(); - colors[i][3] = 0; - } - } + var canvas = document.createElement('canvas'); + canvas.id = Lib.randstr(); - optsOut.opacity = trace.opacity; - } else { - if(isOpen) { - optsOut.color = rgba(optsIn.color, 'uint8'); - optsOut.color[3] = 0; - optsOut.borderColor = rgba(optsIn.color, 'uint8'); - } else { - optsOut.color = rgba(optsIn.color, 'uint8'); - optsOut.borderColor = rgba(optsIn.line.color, 'uint8'); - } + ev = svgToImg({ + format: opts.format, + width: clonedGd._fullLayout.width, + height: clonedGd._fullLayout.height, + canvas: canvas, + emitter: ev, + svg: svg + }); - optsOut.opacity = trace.opacity * optsIn.opacity; - } + ev.clean = function() { + if(clonedGd) document.body.removeChild(clonedGd); + }; - // prepare symbols - if(multiSymbol) { - optsOut.markers = new Array(count); - for(i = 0; i < count; i++) { - optsOut.markers[i] = getSymbolSdf(optsIn.symbol[i]); - } - } else { - optsOut.marker = getSymbolSdf(optsIn.symbol); + }, delay); } - // prepare sizes - var markerSizeFunc = makeBubbleSizeFn(trace); - var s; - - if(multiSize || multiLineWidth) { - var sizes = optsOut.sizes = new Array(count); - var borderSizes = optsOut.borderSizes = new Array(count); - var sizeTotal = 0; - var sizeAvg; - - if(multiSize) { - for(i = 0; i < count; i++) { - sizes[i] = markerSizeFunc(optsIn.size[i]); - sizeTotal += sizes[i]; - } - sizeAvg = sizeTotal / count; - } else { - s = markerSizeFunc(optsIn.size); - for(i = 0; i < count; i++) { - sizes[i] = s; - } - } + var redrawFunc = helpers.getRedrawFunc(clonedGd); - // See https://github.com/plotly/plotly.js/pull/1781#discussion_r121820798 - if(multiLineWidth) { - for(i = 0; i < count; i++) { - borderSizes[i] = optsIn.line.width[i] / 2; - } - } else { - s = optsIn.line.width / 2; - for(i = 0; i < count; i++) { - borderSizes[i] = s; - } - } + Registry.call('plot', clonedGd, clone.data, clone.layout, clone.config) + .then(redrawFunc) + .then(wait) + .catch(function(err) { + ev.emit('error', err); + }); - optsOut.sizeAvg = sizeAvg; - } else { - optsOut.size = markerSizeFunc(optsIn && optsIn.size || 10); - optsOut.borderSizes = markerSizeFunc(optsIn.line.width); - } - return optsOut; + return ev; } -function convertMarkerSelection(trace, target) { - var optsIn = trace.marker; - var optsOut = {}; +module.exports = toImage; - if(!target) return optsOut; +},{"../lib":159,"../registry":243,"./cloneplot":244,"./helpers":247,"./svgtoimg":249,"./tosvg":251,"events":7}],251:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(target.marker && target.marker.symbol) { - optsOut = convertMarkerStyle(Lib.extendFlat({}, optsIn, target.marker)); - } else if(target.marker) { - if(target.marker.size) optsOut.size = target.marker.size / 2; - if(target.marker.color) optsOut.colors = target.marker.color; - if(target.marker.opacity !== undefined) optsOut.opacity = target.marker.opacity; - } - return optsOut; -} +'use strict'; -function convertTextSelection(trace, target) { - var optsOut = {}; +var d3 = _dereq_('d3'); - if(!target) return optsOut; +var Lib = _dereq_('../lib'); +var Drawing = _dereq_('../components/drawing'); +var Color = _dereq_('../components/color'); - if(target.textfont) { - var optsIn = { - opacity: 1, - text: trace.text, - textposition: trace.textposition, - textfont: Lib.extendFlat({}, trace.textfont) - }; - if(target.textfont) { - Lib.extendFlat(optsIn.textfont, target.textfont); - } - optsOut = convertTextStyle(optsIn); - } +var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); - return optsOut; +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; } -function convertErrorBarStyle(trace, target) { - var optsOut = { - capSize: target.width * 2, - lineWidth: target.thickness, - color: target.color - }; - - if(target.copy_ystyle) { - optsOut = trace.error_y; - } - - return optsOut; +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); } -var SYMBOL_SDF_SIZE = constants.SYMBOL_SDF_SIZE; -var SYMBOL_SIZE = constants.SYMBOL_SIZE; -var SYMBOL_STROKE = constants.SYMBOL_STROKE; -var SYMBOL_SDF = {}; -var SYMBOL_SVG_CIRCLE = Drawing.symbolFuncs[0](SYMBOL_SIZE * 0.05); - -function getSymbolSdf(symbol) { - if(symbol === 'circle') return null; - - var symbolPath, symbolSdf; - var symbolNumber = Drawing.symbolNumber(symbol); - var symbolFunc = Drawing.symbolFuncs[symbolNumber % 100]; - var symbolNoDot = !!Drawing.symbolNoDot[symbolNumber % 100]; - var symbolNoFill = !!Drawing.symbolNoFill[symbolNumber % 100]; +module.exports = function toSVG(gd, format, scale) { + var fullLayout = gd._fullLayout; + var svg = fullLayout._paper; + var toppaper = fullLayout._toppaper; + var width = fullLayout.width; + var height = fullLayout.height; + var i; - var isDot = constants.DOT_RE.test(symbol); + // make background color a rect in the svg, then revert after scraping + // all other alterations have been dealt with by properly preparing the svg + // in the first place... like setting cursors with css classes so we don't + // have to remove them, and providing the right namespaces in the svg to + // begin with + svg.insert('rect', ':first-child') + .call(Drawing.setRect, 0, 0, width, height) + .call(Color.fill, fullLayout.paper_bgcolor); - // get symbol sdf from cache or generate it - if(SYMBOL_SDF[symbol]) return SYMBOL_SDF[symbol]; + // subplot-specific to-SVG methods + // which notably add the contents of the gl-container + // into the main svg node + var basePlotModules = fullLayout._basePlotModules || []; + for(i = 0; i < basePlotModules.length; i++) { + var _module = basePlotModules[i]; - if(isDot && !symbolNoDot) { - symbolPath = symbolFunc(SYMBOL_SIZE * 1.1) + SYMBOL_SVG_CIRCLE; - } - else { - symbolPath = symbolFunc(SYMBOL_SIZE); + if(_module.toSVG) _module.toSVG(gd); } - symbolSdf = svgSdf(symbolPath, { - w: SYMBOL_SDF_SIZE, - h: SYMBOL_SDF_SIZE, - viewBox: [-SYMBOL_SIZE, -SYMBOL_SIZE, SYMBOL_SIZE, SYMBOL_SIZE], - stroke: symbolNoFill ? SYMBOL_STROKE : -SYMBOL_STROKE - }); - SYMBOL_SDF[symbol] = symbolSdf; + // add top items above them assumes everything in toppaper is either + // a group or a defs, and if it's empty (like hoverlayer) we can ignore it. + if(toppaper) { + var nodes = toppaper.node().childNodes; - return symbolSdf || null; -} + // make copy of nodes as childNodes prop gets mutated in loop below + var topGroups = Array.prototype.slice.call(nodes); -function convertLinePositions(gd, trace, positions) { - var len = positions.length; - var count = len / 2; - var linePositions; - var i; + for(i = 0; i < topGroups.length; i++) { + var topGroup = topGroups[i]; - if(subTypes.hasLines(trace) && count) { - if(trace.line.shape === 'hv') { - linePositions = []; - for(i = 0; i < count - 1; i++) { - if(isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1])) { - linePositions.push(NaN, NaN, NaN, NaN); - } else { - linePositions.push(positions[i * 2], positions[i * 2 + 1]); - if(!isNaN(positions[i * 2 + 2]) && !isNaN(positions[i * 2 + 3])) { - linePositions.push(positions[i * 2 + 2], positions[i * 2 + 1]); - } else { - linePositions.push(NaN, NaN); - } - } - } - linePositions.push(positions[len - 2], positions[len - 1]); - } else if(trace.line.shape === 'hvh') { - linePositions = []; - for(i = 0; i < count - 1; i++) { - if(isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1]) || isNaN(positions[i * 2 + 2]) || isNaN(positions[i * 2 + 3])) { - if(!isNaN(positions[i * 2]) && !isNaN(positions[i * 2 + 1])) { - linePositions.push(positions[i * 2], positions[i * 2 + 1]); - } else { - linePositions.push(NaN, NaN); - } - linePositions.push(NaN, NaN); - } - else { - var midPtX = (positions[i * 2] + positions[i * 2 + 2]) / 2; - linePositions.push( - positions[i * 2], - positions[i * 2 + 1], - midPtX, - positions[i * 2 + 1], - midPtX, - positions[i * 2 + 3] - ); - } - } - linePositions.push(positions[len - 2], positions[len - 1]); - } else if(trace.line.shape === 'vhv') { - linePositions = []; - for(i = 0; i < count - 1; i++) { - if(isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1]) || isNaN(positions[i * 2 + 2]) || isNaN(positions[i * 2 + 3])) { - if(!isNaN(positions[i * 2]) && !isNaN(positions[i * 2 + 1])) { - linePositions.push(positions[i * 2], positions[i * 2 + 1]); - } else { - linePositions.push(NaN, NaN); - } - linePositions.push(NaN, NaN); - } - else { - var midPtY = (positions[i * 2 + 1] + positions[i * 2 + 3]) / 2; - linePositions.push( - positions[i * 2], - positions[i * 2 + 1], - positions[i * 2], - midPtY, - positions[i * 2 + 2], - midPtY - ); - } - } - linePositions.push(positions[len - 2], positions[len - 1]); - } else if(trace.line.shape === 'vh') { - linePositions = []; - for(i = 0; i < count - 1; i++) { - if(isNaN(positions[i * 2]) || isNaN(positions[i * 2 + 1])) { - linePositions.push(NaN, NaN, NaN, NaN); - } - else { - linePositions.push(positions[i * 2], positions[i * 2 + 1]); - if(!isNaN(positions[i * 2 + 2]) && !isNaN(positions[i * 2 + 3])) { - linePositions.push(positions[i * 2], positions[i * 2 + 3]); - } else { - linePositions.push(NaN, NaN); - } - } - } - linePositions.push(positions[len - 2], positions[len - 1]); - } else { - linePositions = positions; + if(topGroup.childNodes.length) svg.node().appendChild(topGroup); } } - // If we have data with gaps, we ought to use rect joins - // FIXME: get rid of this - var hasNaN = false; - for(i = 0; i < linePositions.length; i++) { - if(isNaN(linePositions[i])) { - hasNaN = true; - break; - } + // remove draglayer for Adobe Illustrator compatibility + if(fullLayout._draggers) { + fullLayout._draggers.remove(); } - var join = (hasNaN || linePositions.length > constants.TOO_MANY_POINTS) ? 'rect' : - subTypes.hasMarkers(trace) ? 'rect' : 'round'; + // in case the svg element had an explicit background color, remove this + // we want the rect to get the color so it's the right size; svg bg will + // fill whatever container it's displayed in regardless of plot size. + svg.node().style.background = ''; + + svg.selectAll('text') + .attr({'data-unformatted': null, 'data-math': null}) + .each(function() { + var txt = d3.select(this); - // fill gaps - if(hasNaN && trace.connectgaps) { - var lastX = linePositions[0]; - var lastY = linePositions[1]; - - for(i = 0; i < linePositions.length; i += 2) { - if(isNaN(linePositions[i]) || isNaN(linePositions[i + 1])) { - linePositions[i] = lastX; - linePositions[i + 1] = lastY; + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(this.style.visibility === 'hidden' || this.style.display === 'none') { + txt.remove(); + return; } else { - lastX = linePositions[i]; - lastY = linePositions[i + 1]; + // clear other visibility/display values to default + // to not potentially confuse non-browser SVG implementations + txt.style({visibility: null, display: null}); } - } - } - return { - join: join, - positions: linePositions - }; -} - -function convertErrorBarPositions(gd, trace, positions, x, y) { - var makeComputeError = Registry.getComponentMethod('errorbars', 'makeComputeError'); - var xa = AxisIDs.getFromId(gd, trace.xaxis); - var ya = AxisIDs.getFromId(gd, trace.yaxis); - var count = positions.length / 2; - var out = {}; + // Font family styles break things because of quotation marks, + // so we must remove them *after* the SVG DOM has been serialized + // to a string (browsers convert singles back) + var ff = this.style.fontFamily; + if(ff && ff.indexOf('"') !== -1) { + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); - function convertOneAxis(coords, ax) { - var axLetter = ax._id.charAt(0); - var opts = trace['error_' + axLetter]; - - if(opts && opts.visible && (ax.type === 'linear' || ax.type === 'log')) { - var computeError = makeComputeError(opts); - var pOffset = {x: 0, y: 1}[axLetter]; - var eOffset = {x: [0, 1, 2, 3], y: [2, 3, 0, 1]}[axLetter]; - var errors = new Float64Array(4 * count); - var minShoe = Infinity; - var maxHat = -Infinity; - - for(var i = 0, j = 0; i < count; i++, j += 4) { - var dc = coords[i]; - - if(isNumeric(dc)) { - var dl = positions[i * 2 + pOffset]; - var vals = computeError(dc, i); - var lv = vals[0]; - var hv = vals[1]; - - if(isNumeric(lv) && isNumeric(hv)) { - var shoe = dc - lv; - var hat = dc + hv; - - errors[j + eOffset[0]] = dl - ax.c2l(shoe); - errors[j + eOffset[1]] = ax.c2l(hat) - dl; - errors[j + eOffset[2]] = 0; - errors[j + eOffset[3]] = 0; + svg.selectAll('.point, .scatterpts, .legendfill>path, .legendlines>path, .cbfill').each(function() { + var pt = d3.select(this); - minShoe = Math.min(minShoe, dc - lv); - maxHat = Math.max(maxHat, dc + hv); - } - } - } + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + var fill = this.style.fill; + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } - out[axLetter] = { - positions: positions, - errors: errors, - _bnds: [minShoe, maxHat] - }; + var stroke = this.style.stroke; + if(stroke && stroke.indexOf('url(') !== -1) { + pt.style('stroke', stroke.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } - } + }); - convertOneAxis(x, xa); - convertOneAxis(y, ya); - return out; -} + if(format === 'pdf' || format === 'eps') { + // these formats make the extra line MathJax adds around symbols look super thick in some cases + // it looks better if this is removed entirely. + svg.selectAll('#MathJax_SVG_glyphs path') + .attr('stroke-width', 0); + } -function convertTextPosition(gd, trace, textOpts, markerOpts) { - var count = trace._length; - var out = {}; - var i; + // fix for IE namespacing quirk? + // http://stackoverflow.com/questions/19610089/unwanted-namespaces-on-svg-markup-when-using-xmlserializer-in-javascript-with-ie + svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns', xmlnsNamespaces.svg); + svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); - // corresponds to textPointPosition from component.drawing - if(subTypes.hasMarkers(trace)) { - var fontOpts = textOpts.font; - var align = textOpts.align; - var baseline = textOpts.baseline; - out.offset = new Array(count); - - for(i = 0; i < count; i++) { - var ms = markerOpts.sizes ? markerOpts.sizes[i] : markerOpts.size; - var fs = Array.isArray(fontOpts) ? fontOpts[i].size : fontOpts.size; - - var a = Array.isArray(align) ? - (align.length > 1 ? align[i] : align[0]) : - align; - var b = Array.isArray(baseline) ? - (baseline.length > 1 ? baseline[i] : baseline[0]) : - baseline; - - var hSign = TEXTOFFSETSIGN[a]; - var vSign = TEXTOFFSETSIGN[b]; - var xPad = ms ? ms / 0.8 + 1 : 0; - var yPad = -vSign * xPad - vSign * 0.5; - out.offset[i] = [hSign * xPad / fs, yPad / fs]; - } + if(format === 'svg' && scale) { + svg.attr('width', scale * width); + svg.attr('height', scale * height); + svg.attr('viewBox', '0 0 ' + width + ' ' + height); } - return out; -} + var s = new window.XMLSerializer().serializeToString(svg.node()); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); -module.exports = { - style: convertStyle, + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); - markerStyle: convertMarkerStyle, - markerSelection: convertMarkerSelection, + // IE is very strict, so we will need to clean + // svg with the following regex + // yes this is messy, but do not know a better way + // Even with this IE will not work due to tainted canvas + // see https://github.com/kangax/fabric.js/issues/1957 + // http://stackoverflow.com/questions/18112047/canvas-todataurl-working-in-all-browsers-except-ie10 + // Leave here just in case the CORS/tainted IE issue gets resolved + if(Lib.isIE()) { + // replace double quote with single quote + s = s.replace(/"/gi, '\''); + // url in svg are single quoted + // since we changed double to single + // we'll need to change these to double-quoted + s = s.replace(/(\('#)([^']*)('\))/gi, '(\"#$2\")'); + // font names with spaces will be escaped single-quoted + // we'll need to change these to double-quoted + s = s.replace(/(\\')/gi, '\"'); + } - linePositions: convertLinePositions, - errorBarPositions: convertErrorBarPositions, - textPosition: convertTextPosition + return s; }; -},{"../../components/drawing":595,"../../constants/interactions":672,"../../lib":696,"../../lib/gl_format_color":692,"../../plots/cartesian/axis_ids":747,"../../registry":827,"../scatter/make_bubble_size_func":1060,"../scatter/subtypes":1067,"./constants":1093,"color-normalize":108,"fast-isnumeric":214,"svg-path-sdf":512}],1095:[function(_dereq_,module,exports){ +},{"../components/color":43,"../components/drawing":64,"../constants/xmlns_namespaces":141,"../lib":159,"d3":8}],252:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../../lib'); -var Registry = _dereq_('../../registry'); - -var attributes = _dereq_('./attributes'); -var constants = _dereq_('../scatter/constants'); -var subTypes = _dereq_('../scatter/subtypes'); -var handleXYDefaults = _dereq_('../scatter/xy_defaults'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - var isOpen = traceIn.marker ? /-open/.test(traceIn.marker.symbol) : false; - var isBubble = subTypes.isBubble(traceIn); +'use strict'; - var len = handleXYDefaults(traceIn, traceOut, layout, coerce); - if(!len) { - traceOut.visible = false; - return; - } - var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; +var mergeArray = _dereq_('../../lib').mergeArray; - coerce('text'); - coerce('hovertext'); - coerce('mode', defaultMode); - if(subTypes.hasLines(traceOut)) { - coerce('connectgaps'); - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - coerce('line.shape'); - } +// arrayOk attributes, merge them into calcdata array +module.exports = function arraysToCalcdata(cd, trace) { + for(var i = 0; i < cd.length; i++) cd[i].i = i; - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce); - coerce('marker.line.width', isOpen || isBubble ? 1 : 0); - } + mergeArray(trace.text, cd, 'tx'); + mergeArray(trace.hovertext, cd, 'htx'); - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); - } + var marker = trace.marker; + if(marker) { + mergeArray(marker.opacity, cd, 'mo'); + mergeArray(marker.color, cd, 'mc'); - coerce('fill'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); + var markerLine = marker.line; + if(markerLine) { + mergeArray(markerLine.color, cd, 'mlc'); + mergeArray(markerLine.width, cd, 'mlw'); + } } - - var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); - - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":696,"../../registry":827,"../scatter/constants":1047,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"../scatter/xy_defaults":1069,"./attributes":1092}],1096:[function(_dereq_,module,exports){ +},{"../../lib":159}],253:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -168021,1383 +65307,952 @@ 'use strict'; -var createScatter = _dereq_('regl-scatter2d'); -var createLine = _dereq_('regl-line2d'); -var createError = _dereq_('regl-error2d'); -var cluster = _dereq_('point-cluster'); -var arrayRange = _dereq_('array-range'); -var Text = _dereq_('gl-text'); +var scatterAttrs = _dereq_('../scatter/attributes'); +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); +var colorAttributes = _dereq_('../../components/colorscale/attributes'); +var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var constants = _dereq_('./constants.js'); -var Registry = _dereq_('../../registry'); -var Lib = _dereq_('../../lib'); -var prepareRegl = _dereq_('../../lib/prepare_regl'); -var AxisIDs = _dereq_('../../plots/cartesian/axis_ids'); -var findExtremes = _dereq_('../../plots/cartesian/autorange').findExtremes; -var Color = _dereq_('../../components/color'); +var extendFlat = _dereq_('../../lib/extend').extendFlat; -var subTypes = _dereq_('../scatter/subtypes'); -var scatterCalc = _dereq_('../scatter/calc'); -var calcMarkerSize = scatterCalc.calcMarkerSize; -var calcAxisExpansion = scatterCalc.calcAxisExpansion; -var setFirstScatter = scatterCalc.setFirstScatter; -var calcColorscales = _dereq_('../scatter/colorscale_calc'); -var linkTraces = _dereq_('../scatter/link_traces'); -var getTraceColor = _dereq_('../scatter/get_trace_color'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); -var convert = _dereq_('./convert'); +var textFontAttrs = fontAttrs({ + editType: 'calc', + arrayOk: true, + colorEditType: 'style', + +}); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; -var TOO_MANY_POINTS = _dereq_('./constants').TOO_MANY_POINTS; -var DESELECTDIM = _dereq_('../../constants/interactions').DESELECTDIM; +var scatterMarkerAttrs = scatterAttrs.marker; +var scatterMarkerLineAttrs = scatterMarkerAttrs.line; -function calc(gd, trace) { - var fullLayout = gd._fullLayout; - var xa = AxisIDs.getFromId(gd, trace.xaxis); - var ya = AxisIDs.getFromId(gd, trace.yaxis); - var subplot = fullLayout._plots[trace.xaxis + trace.yaxis]; - var len = trace._length; - var len2 = len * 2; - var stash = {}; - var i, xx, yy; +var markerLineWidth = extendFlat({}, + scatterMarkerLineAttrs.width, { dflt: 0 }); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); +var markerLine = extendFlat({ + width: markerLineWidth, + editType: 'calc' +}, colorAttributes('marker.line')); - // we need hi-precision for scatter2d, - // regl-scatter2d uses NaNs for bad/missing values - var positions = new Array(len2); - for(i = 0; i < len; i++) { - xx = x[i]; - yy = y[i]; - positions[i * 2] = xx === BADNUM ? NaN : xx; - positions[i * 2 + 1] = yy === BADNUM ? NaN : yy; +var marker = extendFlat({ + line: markerLine, + editType: 'calc' +}, colorAttributes('marker'), { + colorbar: colorbarAttrs, + opacity: { + valType: 'number', + arrayOk: true, + dflt: 1, + min: 0, + max: 1, + + editType: 'style', + } +}); - if(xa.type === 'log') { - for(i = 0; i < len2; i += 2) { - positions[i] = xa.c2l(positions[i]); - } - } - if(ya.type === 'log') { - for(i = 1; i < len2; i += 2) { - positions[i] = ya.c2l(positions[i]); - } - } +module.exports = { + x: scatterAttrs.x, + x0: scatterAttrs.x0, + dx: scatterAttrs.dx, + y: scatterAttrs.y, + y0: scatterAttrs.y0, + dy: scatterAttrs.dy, - // we don't build a tree for log axes since it takes long to convert log2px - // and it is also - if(xa.type !== 'log' && ya.type !== 'log') { - // FIXME: delegate this to webworker - stash.tree = cluster(positions); - } else { - var ids = stash.ids = new Array(len); - for(i = 0; i < len; i++) { - ids[i] = i; + text: scatterAttrs.text, + hovertext: scatterAttrs.hovertext, + hovertemplate: hovertemplateAttrs({}, { + keys: constants.eventDataKeys + }), + + textposition: { + valType: 'enumerated', + + values: ['inside', 'outside', 'auto', 'none'], + dflt: 'none', + arrayOk: true, + editType: 'calc', + + }, + + textfont: extendFlat({}, textFontAttrs, { + + }), + + insidetextfont: extendFlat({}, textFontAttrs, { + + }), + + outsidetextfont: extendFlat({}, textFontAttrs, { + + }), + + constraintext: { + valType: 'enumerated', + values: ['inside', 'outside', 'both', 'none'], + + dflt: 'both', + editType: 'calc', + + }, + + cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, { + + }), + + orientation: { + valType: 'enumerated', + + values: ['v', 'h'], + editType: 'calc+clearAxisTypes', + + }, + + base: { + valType: 'any', + dflt: null, + arrayOk: true, + + editType: 'calc', + + }, + + offset: { + valType: 'number', + dflt: null, + arrayOk: true, + + editType: 'calc', + + }, + + width: { + valType: 'number', + dflt: null, + min: 0, + arrayOk: true, + + editType: 'calc', + + }, + + marker: marker, + + 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' + }, + + r: scatterAttrs.r, + t: scatterAttrs.t, + + _deprecated: { + bardir: { + valType: 'enumerated', + + editType: 'calc', + values: ['v', 'h'], + } } +}; + +},{"../../components/colorbar/attributes":44,"../../components/colorscale/attributes":50,"../../components/fx/hovertemplate_attributes":81,"../../lib/extend":153,"../../plots/font_attributes":230,"../scatter/attributes":281,"./constants.js":255}],254:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // create scene options and scene - calcColorscales(trace); - var opts = sceneOptions(gd, subplot, trace, positions, x, y); - var scene = sceneUpdate(gd, subplot); +'use strict'; - // Reuse SVG scatter axis expansion routine. - // For graphs with very large number of points and array marker.size, - // use average marker size instead to speed things up. - setFirstScatter(fullLayout, trace); - var ppad; - if(len < TOO_MANY_POINTS) { - ppad = calcMarkerSize(trace, len); - } else if(opts.marker) { - ppad = 2 * (opts.marker.sizeAvg || Math.max(opts.marker.size, 3)); - } - calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); - if(opts.errorX) expandForErrorBars(trace, xa, opts.errorX); - if(opts.errorY) expandForErrorBars(trace, ya, opts.errorY); - - // set flags to create scene renderers - if(opts.fill && !scene.fill2d) scene.fill2d = true; - if(opts.marker && !scene.scatter2d) scene.scatter2d = true; - if(opts.line && !scene.line2d) scene.line2d = true; - if((opts.errorX || opts.errorY) && !scene.error2d) scene.error2d = true; - if(opts.text && !scene.glText) scene.glText = true; - - // FIXME: organize it in a more appropriate manner, probably in sceneOptions - // put point-cluster instance for optimized regl calc - if(opts.marker && len >= TOO_MANY_POINTS) { - opts.marker.cluster = stash.tree; - } - - // save scene opts batch - scene.lineOptions.push(opts.line); - scene.errorXOptions.push(opts.errorX); - scene.errorYOptions.push(opts.errorY); - scene.fillOptions.push(opts.fill); - scene.markerOptions.push(opts.marker); - scene.markerSelectedOptions.push(opts.markerSel); - scene.markerUnselectedOptions.push(opts.markerUnsel); - scene.textOptions.push(opts.text); - scene.textSelectedOptions.push(opts.textSel); - scene.textUnselectedOptions.push(opts.textUnsel); - - // stash scene ref - stash._scene = scene; - stash.index = scene.count; - stash.x = x; - stash.y = y; - stash.positions = positions; - scene.count++; - - return [{x: false, y: false, t: stash, trace: trace}]; -} - -function expandForErrorBars(trace, ax, opts) { - var extremes = trace._extremes[ax._id]; - var errExt = findExtremes(ax, opts._bnds, {padded: true}); - extremes.min = extremes.min.concat(errExt.min); - extremes.max = extremes.max.concat(errExt.max); -} - -// create scene options -function sceneOptions(gd, subplot, trace, positions, x, y) { - var opts = convert.style(gd, trace); - - if(opts.marker) { - opts.marker.positions = positions; - } - - if(opts.line && positions.length > 1) { - Lib.extendFlat( - opts.line, - convert.linePositions(gd, trace, positions) - ); +var Axes = _dereq_('../../plots/cartesian/axes'); +var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; +var colorscaleCalc = _dereq_('../../components/colorscale/calc'); +var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); +var calcSelection = _dereq_('../scatter/calc_selection'); + +module.exports = function calc(gd, trace) { + var xa = Axes.getFromId(gd, trace.xaxis || 'x'); + var ya = Axes.getFromId(gd, trace.yaxis || 'y'); + var size, pos; + + if(trace.orientation === 'h') { + size = xa.makeCalcdata(trace, 'x'); + pos = ya.makeCalcdata(trace, 'y'); + } else { + size = ya.makeCalcdata(trace, 'y'); + pos = xa.makeCalcdata(trace, 'x'); } - if(opts.errorX || opts.errorY) { - var errors = convert.errorBarPositions(gd, trace, positions, x, y); + // create the "calculated data" to plot + var serieslen = Math.min(pos.length, size.length); + var cd = new Array(serieslen); - if(opts.errorX) { - Lib.extendFlat(opts.errorX, errors.x); - } - if(opts.errorY) { - Lib.extendFlat(opts.errorY, errors.y); + // set position and size + for(var i = 0; i < serieslen; i++) { + cd[i] = { p: pos[i], s: size[i] }; + + if(trace.ids) { + cd[i].id = String(trace.ids[i]); } } - if(opts.text) { - Lib.extendFlat( - opts.text, - {positions: positions}, - convert.textPosition(gd, trace, opts.text, opts.marker) - ); - Lib.extendFlat( - opts.textSel, - {positions: positions}, - convert.textPosition(gd, trace, opts.text, opts.markerSel) - ); - Lib.extendFlat( - opts.textUnsel, - {positions: positions}, - convert.textPosition(gd, trace, opts.text, opts.markerUnsel) - ); + // auto-z and autocolorscale if applicable + if(hasColorscale(trace, 'marker')) { + colorscaleCalc(gd, trace, { + vals: trace.marker.color, + containerStr: 'marker', + cLetter: 'c' + }); + } + if(hasColorscale(trace, 'marker.line')) { + colorscaleCalc(gd, trace, { + vals: trace.marker.line.color, + containerStr: 'marker.line', + cLetter: 'c' + }); } - return opts; -} + arraysToCalcdata(cd, trace); + calcSelection(cd, trace); + return cd; +}; -// make sure scene exists on subplot, return it -function sceneUpdate(gd, subplot) { - var scene = subplot._scene; - - var resetOpts = { - // number of traces in subplot, since scene:subplot → 1:1 - count: 0, - // whether scene requires init hook in plot call (dirty plot call) - dirty: true, - // last used options - lineOptions: [], - fillOptions: [], - markerOptions: [], - markerSelectedOptions: [], - markerUnselectedOptions: [], - errorXOptions: [], - errorYOptions: [], - textOptions: [], - textSelectedOptions: [], - textUnselectedOptions: [] - }; - - var initOpts = { - selectBatch: null, - unselectBatch: null, - // regl- component stubs, initialized in dirty plot call - fill2d: false, - scatter2d: false, - error2d: false, - line2d: false, - glText: false, - select2d: null - }; +},{"../../components/colorscale/calc":51,"../../components/colorscale/helpers":54,"../../plots/cartesian/axes":203,"../scatter/calc_selection":283,"./arrays_to_calcdata":252}],255:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - if(!subplot._scene) { - scene = subplot._scene = {}; - scene.init = function init() { - Lib.extendFlat(scene, initOpts, resetOpts); - }; +'use strict'; - scene.init(); +module.exports = { + eventDataKeys: [] +}; - // apply new option to all regl components (used on drag) - scene.update = function update(opt) { - var opts = Lib.repeat(opt, scene.count); - - if(scene.fill2d) scene.fill2d.update(opts); - if(scene.scatter2d) scene.scatter2d.update(opts); - if(scene.line2d) scene.line2d.update(opts); - if(scene.error2d) scene.error2d.update(opts.concat(opts)); - if(scene.select2d) scene.select2d.update(opts); - if(scene.glText) { - for(var i = 0; i < scene.count; i++) { - scene.glText[i].update(opt); - } - } - }; +},{}],256:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // draw traces in proper order - scene.draw = function draw() { - var count = scene.count; - var fill2d = scene.fill2d; - var error2d = scene.error2d; - var line2d = scene.line2d; - var scatter2d = scene.scatter2d; - var glText = scene.glText; - var select2d = scene.select2d; - var selectBatch = scene.selectBatch; - var unselectBatch = scene.unselectBatch; +'use strict'; - for(var i = 0; i < count; i++) { - if(fill2d && scene.fillOrder[i]) { - fill2d.draw(scene.fillOrder[i]); - } - if(line2d && scene.lineOptions[i]) { - line2d.draw(i); - } - if(error2d) { - if(scene.errorXOptions[i]) error2d.draw(i); - if(scene.errorYOptions[i]) error2d.draw(i + count); - } - if(scatter2d && scene.markerOptions[i] && (!selectBatch || !selectBatch[i])) { - scatter2d.draw(i); - } - if(glText[i] && scene.textOptions[i]) { - glText[i].render(); - } - } +var isNumeric = _dereq_('fast-isnumeric'); +var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; +var BADNUM = _dereq_('../../constants/numerical').BADNUM; - if(scatter2d && select2d && selectBatch) { - select2d.draw(selectBatch); - scatter2d.draw(unselectBatch); - } +var Registry = _dereq_('../../registry'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var Sieve = _dereq_('./sieve.js'); - scene.dirty = false; - }; +/* + * Bar chart stacking/grouping positioning and autoscaling calculations + * for each direction separately calculate the ranges and positions + * note that this handles histograms too + * now doing this one subplot at a time + */ - // remove scene resources - scene.destroy = function destroy() { - if(scene.fill2d && scene.fill2d.destroy) scene.fill2d.destroy(); - if(scene.scatter2d && scene.scatter2d.destroy) scene.scatter2d.destroy(); - if(scene.error2d && scene.error2d.destroy) scene.error2d.destroy(); - if(scene.line2d && scene.line2d.destroy) scene.line2d.destroy(); - if(scene.select2d && scene.select2d.destroy) scene.select2d.destroy(); - if(scene.glText) { - scene.glText.forEach(function(text) { - if(text.destroy) text.destroy(); - }); - } +function crossTraceCalc(gd, plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - scene.lineOptions = null; - scene.fillOptions = null; - scene.markerOptions = null; - scene.markerSelectedOptions = null; - scene.markerUnselectedOptions = null; - scene.errorXOptions = null; - scene.errorYOptions = null; - scene.textOptions = null; - scene.textSelectedOptions = null; - scene.textUnselectedOptions = null; - - scene.selectBatch = null; - scene.unselectBatch = null; - - // we can't just delete _scene, because `destroy` is called in the - // middle of supplyDefaults, before relinkPrivateKeys which will put it back. - subplot._scene = null; - }; - } + var fullTraces = gd._fullData; + var calcTraces = gd.calcdata; + var calcTracesHorizontal = []; + var calcTracesVertical = []; - // In case if we have scene from the last calc - reset data - if(!scene.dirty) { - Lib.extendFlat(scene, resetOpts); + for(var i = 0; i < fullTraces.length; i++) { + var fullTrace = fullTraces[i]; + if( + fullTrace.visible === true && + Registry.traceIs(fullTrace, 'bar') && + fullTrace.xaxis === xa._id && + fullTrace.yaxis === ya._id + ) { + if(fullTrace.orientation === 'h') { + calcTracesHorizontal.push(calcTraces[i]); + } else { + calcTracesVertical.push(calcTraces[i]); + } + } } - return scene; -} - -function getViewport(fullLayout, xaxis, yaxis) { - var gs = fullLayout._size; - var width = fullLayout.width; - var height = fullLayout.height; - return [ - gs.l + xaxis.domain[0] * gs.w, - gs.b + yaxis.domain[0] * gs.h, - (width - gs.r) - (1 - xaxis.domain[1]) * gs.w, - (height - gs.t) - (1 - yaxis.domain[1]) * gs.h - ]; + setGroupPositions(gd, xa, ya, calcTracesVertical); + setGroupPositions(gd, ya, xa, calcTracesHorizontal); } -function plot(gd, subplot, cdata) { - if(!cdata.length) return; - - var fullLayout = gd._fullLayout; - var scene = subplot._scene; - var xaxis = subplot.xaxis; - var yaxis = subplot.yaxis; - var i, j; - - // we may have more subplots than initialized data due to Axes.getSubplots method - if(!scene) return; +function setGroupPositions(gd, pa, sa, calcTraces) { + if(!calcTraces.length) return; - var success = prepareRegl(gd, ['ANGLE_instanced_arrays', 'OES_element_index_uint']); - if(!success) { - scene.init(); - return; - } + var barmode = gd._fullLayout.barmode; + var overlay = (barmode === 'overlay'); + var group = (barmode === 'group'); + var excluded; + var included; + var i, calcTrace, fullTrace; - var regl = fullLayout._glcanvas.data()[0].regl; + initBase(gd, pa, sa, calcTraces); - // that is needed for fills - linkTraces(gd, subplot, cdata); + if(overlay) { + setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces); + } else if(group) { + // exclude from the group those traces for which the user set an offset + excluded = []; + included = []; + for(i = 0; i < calcTraces.length; i++) { + calcTrace = calcTraces[i]; + fullTrace = calcTrace[0].trace; - if(scene.dirty) { - // make sure scenes are created - if(scene.error2d === true) { - scene.error2d = createError(regl); - } - if(scene.line2d === true) { - scene.line2d = createLine(regl); - } - if(scene.scatter2d === true) { - scene.scatter2d = createScatter(regl); + if(fullTrace.offset === undefined) included.push(calcTrace); + else excluded.push(calcTrace); } - if(scene.fill2d === true) { - scene.fill2d = createLine(regl); + + if(included.length) { + setGroupPositionsInGroupMode(gd, pa, sa, included); } - if(scene.glText === true) { - scene.glText = new Array(scene.count); - for(i = 0; i < scene.count; i++) { - scene.glText[i] = new Text(regl); - } + if(excluded.length) { + setGroupPositionsInOverlayMode(gd, pa, sa, excluded); } + } else { + // exclude from the stack those traces for which the user set a base + excluded = []; + included = []; + for(i = 0; i < calcTraces.length; i++) { + calcTrace = calcTraces[i]; + fullTrace = calcTrace[0].trace; - // update main marker options - if(scene.glText) { - for(i = 0; i < scene.count; i++) { - scene.glText[i].update(scene.textOptions[i]); - } + if(fullTrace.base === undefined) included.push(calcTrace); + else excluded.push(calcTrace); } - if(scene.line2d) { - scene.line2d.update(scene.lineOptions); - scene.lineOptions = scene.lineOptions.map(function(lineOptions) { - if(lineOptions && lineOptions.positions) { - var srcPos = lineOptions.positions; - var firstptdef = 0; - while(firstptdef < srcPos.length && (isNaN(srcPos[firstptdef]) || isNaN(srcPos[firstptdef + 1]))) { - firstptdef += 2; - } - var lastptdef = srcPos.length - 2; - while(lastptdef > firstptdef && (isNaN(srcPos[lastptdef]) || isNaN(srcPos[lastptdef + 1]))) { - lastptdef -= 2; - } - lineOptions.positions = srcPos.slice(firstptdef, lastptdef + 2); - } - return lineOptions; - }); - scene.line2d.update(scene.lineOptions); + if(included.length) { + setGroupPositionsInStackOrRelativeMode(gd, pa, sa, included); } - if(scene.error2d) { - var errorBatch = (scene.errorXOptions || []).concat(scene.errorYOptions || []); - scene.error2d.update(errorBatch); - } - if(scene.scatter2d) { - scene.scatter2d.update(scene.markerOptions); - } - - // fill requires linked traces, so we generate it's positions here - scene.fillOrder = Lib.repeat(null, scene.count); - if(scene.fill2d) { - scene.fillOptions = scene.fillOptions.map(function(fillOptions, i) { - var cdscatter = cdata[i]; - if(!fillOptions || !cdscatter || !cdscatter[0] || !cdscatter[0].trace) return; - var cd = cdscatter[0]; - var trace = cd.trace; - var stash = cd.t; - var lineOptions = scene.lineOptions[i]; - var last, j; - - var fillData = []; - if(trace._ownfill) fillData.push(i); - if(trace._nexttrace) fillData.push(i + 1); - if(fillData.length) scene.fillOrder[i] = fillData; - - var pos = []; - var srcPos = (lineOptions && lineOptions.positions) || stash.positions; - var firstptdef, lastptdef; - - if(trace.fill === 'tozeroy') { - firstptdef = 0; - while(firstptdef < srcPos.length && isNaN(srcPos[firstptdef + 1])) { - firstptdef += 2; - } - lastptdef = srcPos.length - 2; - while(lastptdef > firstptdef && isNaN(srcPos[lastptdef + 1])) { - lastptdef -= 2; - } - if(srcPos[firstptdef + 1] !== 0) { - pos = [srcPos[firstptdef], 0]; - } - pos = pos.concat(srcPos.slice(firstptdef, lastptdef + 2)); - if(srcPos[lastptdef + 1] !== 0) { - pos = pos.concat([srcPos[lastptdef], 0]); - } - } - else if(trace.fill === 'tozerox') { - firstptdef = 0; - while(firstptdef < srcPos.length && isNaN(srcPos[firstptdef])) { - firstptdef += 2; - } - lastptdef = srcPos.length - 2; - while(lastptdef > firstptdef && isNaN(srcPos[lastptdef])) { - lastptdef -= 2; - } - if(srcPos[firstptdef] !== 0) { - pos = [0, srcPos[firstptdef + 1]]; - } - pos = pos.concat(srcPos.slice(firstptdef, lastptdef + 2)); - if(srcPos[lastptdef] !== 0) { - pos = pos.concat([ 0, srcPos[lastptdef + 1]]); - } - } - else if(trace.fill === 'toself' || trace.fill === 'tonext') { - pos = []; - last = 0; - for(j = 0; j < srcPos.length; j += 2) { - if(isNaN(srcPos[j]) || isNaN(srcPos[j + 1])) { - pos = pos.concat(srcPos.slice(last, j)); - pos.push(srcPos[last], srcPos[last + 1]); - last = j + 2; - } - } - pos = pos.concat(srcPos.slice(last)); - if(last) { - pos.push(srcPos[last], srcPos[last + 1]); - } - } - else { - var nextTrace = trace._nexttrace; - - if(nextTrace) { - var nextOptions = scene.lineOptions[i + 1]; - - if(nextOptions) { - var nextPos = nextOptions.positions; - if(trace.fill === 'tonexty') { - pos = srcPos.slice(); - - for(i = Math.floor(nextPos.length / 2); i--;) { - var xx = nextPos[i * 2], yy = nextPos[i * 2 + 1]; - if(isNaN(xx) || isNaN(yy)) continue; - pos.push(xx, yy); - } - fillOptions.fill = nextTrace.fillcolor; - } - } - } - } + if(excluded.length) { + setGroupPositionsInOverlayMode(gd, pa, sa, excluded); + } + } - // detect prev trace positions to exclude from current fill - if(trace._prevtrace && trace._prevtrace.fill === 'tonext') { - var prevLinePos = scene.lineOptions[i - 1].positions; - - // FIXME: likely this logic should be tested better - var offset = pos.length / 2; - last = offset; - var hole = [last]; - for(j = 0; j < prevLinePos.length; j += 2) { - if(isNaN(prevLinePos[j]) || isNaN(prevLinePos[j + 1])) { - hole.push(j / 2 + offset + 1); - last = j + 2; - } - } + collectExtents(calcTraces, pa); +} - pos = pos.concat(prevLinePos); - fillOptions.hole = hole; - } - fillOptions.fillmode = trace.fill; - fillOptions.opacity = trace.opacity; - fillOptions.positions = pos; +function initBase(gd, pa, sa, calcTraces) { + var i, j; - return fillOptions; - }); + for(i = 0; i < calcTraces.length; i++) { + var cd = calcTraces[i]; + var trace = cd[0].trace; + var base = trace.base; + var b; - scene.fill2d.update(scene.fillOptions); - } - } + // not sure if it really makes sense to have dates for bar size data... + // ideally if we want to make gantt charts or something we'd treat + // the actual size (trace.x or y) as time delta but base as absolute + // time. But included here for completeness. + var scalendar = trace.orientation === 'h' ? trace.xcalendar : trace.ycalendar; - // form batch arrays, and check for selected points - scene.selectBatch = null; - scene.unselectBatch = null; - var dragmode = fullLayout.dragmode; - var selectMode = dragmode === 'lasso' || dragmode === 'select'; - var clickSelectEnabled = fullLayout.clickmode.indexOf('select') > -1; + // 'base' on categorical axes makes no sense + var d2c = sa.type === 'category' || sa.type === 'multicategory' ? + function() { return null; } : + sa.d2c; - for(i = 0; i < cdata.length; i++) { - var cd0 = cdata[i][0]; - var trace = cd0.trace; - var stash = cd0.t; - var index = stash.index; - var len = trace._length; - var x = stash.x; - var y = stash.y; - - if(trace.selectedpoints || selectMode || clickSelectEnabled) { - if(!selectMode) selectMode = true; - - if(!scene.selectBatch) { - scene.selectBatch = []; - scene.unselectBatch = []; - } - - // regenerate scene batch, if traces number changed during selection - if(trace.selectedpoints) { - var selPts = scene.selectBatch[index] = Lib.selIndices2selPoints(trace); - - var selDict = {}; - for(j = 0; j < selPts.length; j++) { - selDict[selPts[j]] = 1; - } - var unselPts = []; - for(j = 0; j < len; j++) { - if(!selDict[j]) unselPts.push(j); - } - scene.unselectBatch[index] = unselPts; - } - - // precalculate px coords since we are not going to pan during select - // TODO, could do better here e.g. - // - spin that in a webworker - // - compute selection from polygons in data coordinates - // (maybe just for linear axes) - var xpx = stash.xpx = new Array(len); - var ypx = stash.ypx = new Array(len); - for(j = 0; j < len; j++) { - xpx[j] = xaxis.c2p(x[j]); - ypx[j] = yaxis.c2p(y[j]); + if(isArrayOrTypedArray(base)) { + for(j = 0; j < Math.min(base.length, cd.length); j++) { + b = d2c(base[j], 0, scalendar); + if(isNumeric(b)) { + cd[j].b = +b; + cd[j].hasB = 1; + } + else cd[j].b = 0; + } + for(; j < cd.length; j++) { + cd[j].b = 0; } } else { - stash.xpx = stash.ypx = null; + b = d2c(base, 0, scalendar); + var hasBase = isNumeric(b); + b = hasBase ? b : 0; + for(j = 0; j < cd.length; j++) { + cd[j].b = b; + if(hasBase) cd[j].hasB = 1; + } } } +} +function setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces) { + var barnorm = gd._fullLayout.barnorm; + var separateNegativeValues = false; + var dontMergeOverlappingData = !barnorm; - if(selectMode) { - // create select2d - if(!scene.select2d) { - // create scatter instance by cloning scatter2d - scene.select2d = createScatter(fullLayout._glcanvas.data()[1].regl); - } - - if(scene.scatter2d && scene.selectBatch && scene.selectBatch.length) { - // update only traces with selection - scene.scatter2d.update(scene.markerUnselectedOptions.map(function(opts, i) { - return scene.selectBatch[i] ? opts : null; - })); - } + // update position axis and set bar offsets and widths + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var sieve = new Sieve([calcTrace], separateNegativeValues, dontMergeOverlappingData); - if(scene.select2d) { - scene.select2d.update(scene.markerOptions); - scene.select2d.update(scene.markerSelectedOptions); - } + // set bar offsets and widths, and update position axis + setOffsetAndWidth(gd, pa, sieve); - if(scene.glText) { - cdata.forEach(function(cdscatter) { - if(cdscatter && cdscatter[0] && cdscatter[0].trace) { - styleTextSelection(cdscatter); - } - }); - } - } else { - if(scene.scatter2d) { - // reset scatter2d opts to base opts, - // thus unsetting markerUnselectedOptions from selection - scene.scatter2d.update(scene.markerOptions); + // set bar bases and sizes, and update size axis + // + // (note that `setGroupPositionsInOverlayMode` handles the case barnorm + // is defined, because this function is also invoked for traces that + // can't be grouped or stacked) + if(barnorm) { + sieveBars(gd, sa, sieve); + normalizeBars(gd, sa, sieve); + } else { + setBaseAndTop(gd, sa, sieve); } } +} - // provide viewport and range - var vpRange0 = { - viewport: getViewport(fullLayout, xaxis, yaxis), - // TODO do we need those fallbacks? - range: [ - (xaxis._rl || xaxis.range)[0], - (yaxis._rl || yaxis.range)[0], - (xaxis._rl || xaxis.range)[1], - (yaxis._rl || yaxis.range)[1] - ] - }; - var vpRange = Lib.repeat(vpRange0, scene.count); +function setGroupPositionsInGroupMode(gd, pa, sa, calcTraces) { + var fullLayout = gd._fullLayout; + var barnorm = fullLayout.barnorm; + var separateNegativeValues = false; + var dontMergeOverlappingData = !barnorm; + var sieve = new Sieve(calcTraces, separateNegativeValues, dontMergeOverlappingData); - // upload viewport/range data to GPU - if(scene.fill2d) { - scene.fill2d.update(vpRange); - } - if(scene.line2d) { - scene.line2d.update(vpRange); - } - if(scene.error2d) { - scene.error2d.update(vpRange.concat(vpRange)); - } - if(scene.scatter2d) { - scene.scatter2d.update(vpRange); - } - if(scene.select2d) { - scene.select2d.update(vpRange); - } - if(scene.glText) { - scene.glText.forEach(function(text) { text.update(vpRange0); }); + // set bar offsets and widths, and update position axis + setOffsetAndWidthInGroupMode(gd, pa, sieve); + + // set bar bases and sizes, and update size axis + if(barnorm) { + sieveBars(gd, sa, sieve); + normalizeBars(gd, sa, sieve); + } else { + setBaseAndTop(gd, sa, sieve); } } +function setGroupPositionsInStackOrRelativeMode(gd, pa, sa, calcTraces) { + var fullLayout = gd._fullLayout; + var barmode = fullLayout.barmode; + var stack = barmode === 'stack'; + var relative = barmode === 'relative'; + var barnorm = fullLayout.barnorm; + var separateNegativeValues = relative; + var dontMergeOverlappingData = !(barnorm || stack || relative); + var sieve = new Sieve(calcTraces, separateNegativeValues, dontMergeOverlappingData); -function hoverPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var stash = cd[0].t; - var trace = cd[0].trace; - var xa = pointData.xa; - var ya = pointData.ya; - var x = stash.x; - var y = stash.y; - var xpx = xa.c2p(xval); - var ypx = ya.c2p(yval); - var maxDistance = pointData.distance; - var ids; + // set bar offsets and widths, and update position axis + setOffsetAndWidth(gd, pa, sieve); - // FIXME: make sure this is a proper way to calc search radius - if(stash.tree) { - var xl = xa.p2c(xpx - maxDistance); - var xr = xa.p2c(xpx + maxDistance); - var yl = ya.p2c(ypx - maxDistance); - var yr = ya.p2c(ypx + maxDistance); + // set bar bases and sizes, and update size axis + stackBars(gd, sa, sieve); - if(hovermode === 'x') { - ids = stash.tree.range( - Math.min(xl, xr), Math.min(ya._rl[0], ya._rl[1]), - Math.max(xl, xr), Math.max(ya._rl[0], ya._rl[1]) - ); - } - else { - ids = stash.tree.range( - Math.min(xl, xr), Math.min(yl, yr), - Math.max(xl, xr), Math.max(yl, yr) - ); - } - } - else if(stash.ids) { - ids = stash.ids; - } - else return [pointData]; + // flag the outmost bar (for text display purposes) + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; - // pick the id closest to the point - // note that point possibly may not be found - var id, ptx, pty, i, dx, dy, dist, dxy; - - var minDist = maxDistance; - if(hovermode === 'x') { - for(i = 0; i < ids.length; i++) { - ptx = x[ids[i]]; - dx = Math.abs(xa.c2p(ptx) - xpx); - if(dx < minDist) { - minDist = dx; - dy = ya.c2p(y[ids[i]]) - ypx; - dxy = Math.sqrt(dx * dx + dy * dy); - id = ids[i]; - } - } - } - else { - for(i = 0; i < ids.length; i++) { - ptx = x[ids[i]]; - pty = y[ids[i]]; - dx = xa.c2p(ptx) - xpx; - dy = ya.c2p(pty) - ypx; + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; - dist = Math.sqrt(dx * dx + dy * dy); - if(dist < minDist) { - minDist = dxy = dist; - id = ids[i]; + if(bar.s !== BADNUM) { + var isOutmostBar = ((bar.b + bar.s) === sieve.get(bar.p, bar.s)); + if(isOutmostBar) bar._outmost = true; } } } - pointData.index = id; - pointData.distance = minDist; - pointData.dxy = dxy; - - if(id === undefined) return [pointData]; - - calcHover(pointData, x, y, trace); - - return [pointData]; + // Note that marking the outmost bars has to be done + // before `normalizeBars` changes `bar.b` and `bar.s`. + if(barnorm) normalizeBars(gd, sa, sieve); } +function setOffsetAndWidth(gd, pa, sieve) { + var fullLayout = gd._fullLayout; + var bargap = fullLayout.bargap; + var bargroupgap = fullLayout.bargroupgap || 0; + var minDiff = sieve.minDiff; + var calcTraces = sieve.traces; -function calcHover(pointData, x, y, trace) { - var xa = pointData.xa; - var ya = pointData.ya; - var minDist = pointData.distance; - var dxy = pointData.dxy; - var id = pointData.index; - - // the closest data point - var di = { - pointNumber: id, - x: x[id], - y: y[id] - }; - - // that is single-item arrays_to_calcdata excerpt, since we are doing it for a single point and we don't have to do it beforehead for 1e6 points - di.tx = Array.isArray(trace.text) ? trace.text[id] : trace.text; - di.htx = Array.isArray(trace.hovertext) ? trace.hovertext[id] : trace.hovertext; - di.data = Array.isArray(trace.customdata) ? trace.customdata[id] : trace.customdata; - di.tp = Array.isArray(trace.textposition) ? trace.textposition[id] : trace.textposition; - - var font = trace.textfont; - if(font) { - di.ts = Array.isArray(font.size) ? font.size[id] : font.size; - di.tc = Array.isArray(font.color) ? font.color[id] : font.color; - di.tf = Array.isArray(font.family) ? font.family[id] : font.family; - } - - var marker = trace.marker; - if(marker) { - di.ms = Lib.isArrayOrTypedArray(marker.size) ? marker.size[id] : marker.size; - di.mo = Lib.isArrayOrTypedArray(marker.opacity) ? marker.opacity[id] : marker.opacity; - di.mx = Array.isArray(marker.symbol) ? marker.symbol[id] : marker.symbol; - di.mc = Lib.isArrayOrTypedArray(marker.color) ? marker.color[id] : marker.color; - } - - var line = marker && marker.line; - if(line) { - di.mlc = Array.isArray(line.color) ? line.color[id] : line.color; - di.mlw = Lib.isArrayOrTypedArray(line.width) ? line.width[id] : line.width; - } - - var grad = marker && marker.gradient; - if(grad && grad.type !== 'none') { - di.mgt = Array.isArray(grad.type) ? grad.type[id] : grad.type; - di.mgc = Array.isArray(grad.color) ? grad.color[id] : grad.color; - } + // set bar offsets and widths + var barGroupWidth = minDiff * (1 - bargap); + var barWidthPlusGap = barGroupWidth; + var barWidth = barWidthPlusGap * (1 - bargroupgap); - var xp = xa.c2p(di.x, true); - var yp = ya.c2p(di.y, true); - var rad = di.mrc || 1; + // computer bar group center and bar offset + var offsetFromCenter = -barWidth / 2; - var hoverlabel = trace.hoverlabel; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var t = calcTrace[0].t; - if(hoverlabel) { - di.hbg = Array.isArray(hoverlabel.bgcolor) ? hoverlabel.bgcolor[id] : hoverlabel.bgcolor; - di.hbc = Array.isArray(hoverlabel.bordercolor) ? hoverlabel.bordercolor[id] : hoverlabel.bordercolor; - di.hts = Array.isArray(hoverlabel.font.size) ? hoverlabel.font.size[id] : hoverlabel.font.size; - di.htc = Array.isArray(hoverlabel.font.color) ? hoverlabel.font.color[id] : hoverlabel.font.color; - di.htf = Array.isArray(hoverlabel.font.family) ? hoverlabel.font.family[id] : hoverlabel.font.family; - di.hnl = Array.isArray(hoverlabel.namelength) ? hoverlabel.namelength[id] : hoverlabel.namelength; - } - var hoverinfo = trace.hoverinfo; - if(hoverinfo) { - di.hi = Array.isArray(hoverinfo) ? hoverinfo[id] : hoverinfo; + // store bar width and offset for this trace + t.barwidth = barWidth; + t.poffset = offsetFromCenter; + t.bargroupwidth = barGroupWidth; + t.bardelta = minDiff; } - var fakeCd = {}; - fakeCd[pointData.index] = di; - - Lib.extendFlat(pointData, { - color: getTraceColor(trace, di), - - x0: xp - rad, - x1: xp + rad, - xLabelVal: di.x, - - y0: yp - rad, - y1: yp + rad, - yLabelVal: di.y, - - cd: fakeCd, - distance: minDist, - spikeDistance: dxy - }); + // stack bars that only differ by rounding + sieve.binWidth = calcTraces[0][0].t.barwidth / 100; - if(di.htx) pointData.text = di.htx; - else if(di.tx) pointData.text = di.tx; - else if(trace.text) pointData.text = trace.text; + // if defined, apply trace offset and width + applyAttributes(sieve); - fillHoverText(di, trace, pointData); - Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, pointData); + // store the bar center in each calcdata item + setBarCenterAndWidth(gd, pa, sieve); - return pointData; + // update position axes + updatePositionAxis(gd, pa, sieve); } +function setOffsetAndWidthInGroupMode(gd, pa, sieve) { + var fullLayout = gd._fullLayout; + var bargap = fullLayout.bargap; + var bargroupgap = fullLayout.bargroupgap || 0; + var positions = sieve.positions; + var distinctPositions = sieve.distinctPositions; + var minDiff = sieve.minDiff; + var calcTraces = sieve.traces; -function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var selection = []; - var trace = cd[0].trace; - var stash = cd[0].t; - var len = trace._length; - var x = stash.x; - var y = stash.y; - var scene = stash._scene; - - if(!scene) return selection; - - var hasText = subTypes.hasText(trace); - var hasMarkers = subTypes.hasMarkers(trace); - var hasOnlyLines = !hasMarkers && !hasText; - if(trace.visible !== true || hasOnlyLines) return selection; - - // degenerate polygon does not enable selection - // filter out points by visible scatter ones - var els = null; - var unels = null; - // FIXME: clearing selection does not work here - var i; - if(selectionTester !== false && !selectionTester.degenerate) { - els = [], unels = []; - for(i = 0; i < len; i++) { - if(selectionTester.contains([stash.xpx[i], stash.ypx[i]], false, i, searchInfo)) { - els.push(i); - selection.push({ - pointNumber: i, - x: x[i], - y: y[i] - }); - } - else { - unels.push(i); - } - } - } else { - unels = arrayRange(len); - } + // if there aren't any overlapping positions, + // let them have full width even if mode is group + var overlap = (positions.length !== distinctPositions.length); - // make sure selectBatch is created - if(!scene.selectBatch) { - scene.selectBatch = []; - scene.unselectBatch = []; - } + var nTraces = calcTraces.length; + var barGroupWidth = minDiff * (1 - bargap); + var barWidthPlusGap = (overlap) ? barGroupWidth / nTraces : barGroupWidth; + var barWidth = barWidthPlusGap * (1 - bargroupgap); - if(!scene.selectBatch[stash.index]) { - // enter every trace select mode - for(i = 0; i < scene.count; i++) { - scene.selectBatch[i] = []; - scene.unselectBatch[i] = []; - } - // we should turn scatter2d into unselected once we have any points selected - if(hasMarkers) { - scene.scatter2d.update(scene.markerUnselectedOptions); - } - } + for(var i = 0; i < nTraces; i++) { + var calcTrace = calcTraces[i]; + var t = calcTrace[0].t; - scene.selectBatch[stash.index] = els; - scene.unselectBatch[stash.index] = unels; + // computer bar group center and bar offset + var offsetFromCenter = overlap ? + ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 : + -barWidth / 2; - // update text options - if(hasText) { - styleTextSelection(cd); + // store bar width and offset for this trace + t.barwidth = barWidth; + t.poffset = offsetFromCenter; + t.bargroupwidth = barGroupWidth; + t.bardelta = minDiff; } - return selection; -} + // stack bars that only differ by rounding + sieve.binWidth = calcTraces[0][0].t.barwidth / 100; -function styleTextSelection(cd) { - var cd0 = cd[0]; - var trace = cd0.trace; - var stash = cd0.t; - var scene = stash._scene; - var index = stash.index; - var els = scene.selectBatch[index]; - var unels = scene.unselectBatch[index]; - var baseOpts = scene.textOptions[index]; - var selOpts = scene.textSelectedOptions[index] || {}; - var unselOpts = scene.textUnselectedOptions[index] || {}; - var opts = Lib.extendFlat({}, baseOpts); - var i, j; + // if defined, apply trace width + applyAttributes(sieve); - if(els && unels) { - var stc = selOpts.color; - var utc = unselOpts.color; - var base = baseOpts.color; - var hasArrayBase = Array.isArray(base); - opts.color = new Array(trace._length); - - for(i = 0; i < els.length; i++) { - j = els[i]; - opts.color[j] = stc || (hasArrayBase ? base[j] : base); - } - for(i = 0; i < unels.length; i++) { - j = unels[i]; - var basej = hasArrayBase ? base[j] : base; - opts.color[j] = utc ? utc : - stc ? basej : Color.addOpacity(basej, DESELECTDIM); - } - } + // store the bar center in each calcdata item + setBarCenterAndWidth(gd, pa, sieve); - scene.glText[index].update(opts); + // update position axes + updatePositionAxis(gd, pa, sieve, overlap); } -module.exports = { - moduleType: 'trace', - name: 'scattergl', - basePlotModule: _dereq_('../../plots/cartesian'), - categories: ['gl', 'regl', 'cartesian', 'symbols', 'errorBarsOK', 'showLegend', 'scatter-like'], - - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults'), - crossTraceDefaults: _dereq_('../scatter/cross_trace_defaults'), - colorbar: _dereq_('../scatter/marker_colorbar'), - calc: calc, - plot: plot, - hoverPoints: hoverPoints, - selectPoints: selectPoints, - - sceneUpdate: sceneUpdate, - calcHover: calcHover, - - meta: { - - - } -}; - -},{"../../components/color":570,"../../constants/interactions":672,"../../constants/numerical":673,"../../lib":696,"../../lib/prepare_regl":709,"../../plots/cartesian":756,"../../plots/cartesian/autorange":743,"../../plots/cartesian/axis_ids":747,"../../registry":827,"../scatter/calc":1044,"../scatter/colorscale_calc":1046,"../scatter/cross_trace_defaults":1049,"../scatter/fill_hover_text":1051,"../scatter/get_trace_color":1053,"../scatter/link_traces":1059,"../scatter/marker_colorbar":1061,"../scatter/subtypes":1067,"./attributes":1092,"./constants":1093,"./convert":1094,"./defaults":1095,"array-range":55,"gl-text":304,"point-cluster":452,"regl-error2d":473,"regl-line2d":474,"regl-scatter2d":475}],1097:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var scatterGeoAttrs = _dereq_('../scattergeo/attributes'); -var scatterAttrs = _dereq_('../scatter/attributes'); -var mapboxAttrs = _dereq_('../../plots/mapbox/layout_attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); - -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; - -var lineAttrs = scatterGeoAttrs.line; -var markerAttrs = scatterGeoAttrs.marker; - -module.exports = overrideAll({ - lon: scatterGeoAttrs.lon, - lat: scatterGeoAttrs.lat, - - // locations - // locationmode +function applyAttributes(sieve) { + var calcTraces = sieve.traces; + var i, j; - mode: extendFlat({}, scatterAttrs.mode, { - dflt: 'markers', - - }), + 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; - text: extendFlat({}, scatterAttrs.text, { - - }), - hovertext: extendFlat({}, scatterAttrs.hovertext, { - - }), + if(isArrayOrTypedArray(offset)) { + // if offset is an array, then clone it into t.poffset. + newPoffset = Array.prototype.slice.call(offset, 0, calcTrace.length); - line: { - color: lineAttrs.color, - width: lineAttrs.width + // guard against non-numeric items + for(j = 0; j < newPoffset.length; j++) { + if(!isNumeric(newPoffset[j])) { + newPoffset[j] = initialPoffset; + } + } - // TODO - // dash: dash - }, + // if the length of the array is too short, + // then extend it with the initial value of t.poffset + for(j = newPoffset.length; j < calcTrace.length; j++) { + newPoffset.push(initialPoffset); + } - connectgaps: scatterAttrs.connectgaps, + t.poffset = newPoffset; + } else if(offset !== undefined) { + t.poffset = offset; + } - marker: { - symbol: { - valType: 'string', - dflt: 'circle', - - arrayOk: true, - - }, - opacity: markerAttrs.opacity, - size: markerAttrs.size, - sizeref: markerAttrs.sizeref, - sizemin: markerAttrs.sizemin, - sizemode: markerAttrs.sizemode, - color: markerAttrs.color, - colorscale: markerAttrs.colorscale, - cauto: markerAttrs.cauto, - cmax: markerAttrs.cmax, - cmin: markerAttrs.cmin, - autocolorscale: markerAttrs.autocolorscale, - reversescale: markerAttrs.reversescale, - showscale: markerAttrs.showscale, - colorbar: colorbarAttrs, + var width = fullTrace._width || fullTrace.width; + var initialBarwidth = t.barwidth; - // line - }, + if(isArrayOrTypedArray(width)) { + // if width is an array, then clone it into t.barwidth. + var newBarwidth = Array.prototype.slice.call(width, 0, calcTrace.length); - fill: scatterGeoAttrs.fill, - fillcolor: scatterAttrs.fillcolor, + // guard against non-numeric items + for(j = 0; j < newBarwidth.length; j++) { + if(!isNumeric(newBarwidth[j])) newBarwidth[j] = initialBarwidth; + } - textfont: mapboxAttrs.layers.symbol.textfont, - textposition: mapboxAttrs.layers.symbol.textposition, + // if the length of the array is too short, + // then extend it with the initial value of t.barwidth + for(j = newBarwidth.length; j < calcTrace.length; j++) { + newBarwidth.push(initialBarwidth); + } - selected: { - marker: scatterAttrs.selected.marker - }, - unselected: { - marker: scatterAttrs.unselected.marker - }, + t.barwidth = newBarwidth; - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['lon', 'lat', 'text', 'name'] - }) -}, 'calc', 'nested'); + // if user didn't set offset, + // then correct t.poffset to ensure bars remain centered + if(offset === undefined) { + newPoffset = []; + for(j = 0; j < calcTrace.length; j++) { + newPoffset.push( + initialPoffset + (initialBarwidth - newBarwidth[j]) / 2 + ); + } + t.poffset = newPoffset; + } + } else if(width !== undefined) { + t.barwidth = width; -},{"../../components/colorbar/attributes":571,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/attributes":741,"../../plots/mapbox/layout_attributes":804,"../scatter/attributes":1043,"../scattergeo/attributes":1083}],1098:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // if user didn't set offset, + // then correct t.poffset to ensure bars remain centered + if(offset === undefined) { + t.poffset = initialPoffset + (initialBarwidth - width) / 2; + } + } + } +} -'use strict'; +function setBarCenterAndWidth(gd, pa, sieve) { + var calcTraces = sieve.traces; + var pLetter = getAxisLetter(pa); -var isNumeric = _dereq_('fast-isnumeric'); + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var t = calcTrace[0].t; + var poffset = t.poffset; + var poffsetIsArray = Array.isArray(poffset); + var barwidth = t.barwidth; + var barwidthIsArray = Array.isArray(barwidth); -var Lib = _dereq_('../../lib'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; -var geoJsonUtils = _dereq_('../../lib/geojson_utils'); + for(var j = 0; j < calcTrace.length; j++) { + var calcBar = calcTrace[j]; -var Colorscale = _dereq_('../../components/colorscale'); -var Drawing = _dereq_('../../components/drawing'); -var makeBubbleSizeFn = _dereq_('../scatter/make_bubble_size_func'); -var subTypes = _dereq_('../scatter/subtypes'); -var convertTextOpts = _dereq_('../../plots/mapbox/convert_text_opts'); + // store the actual bar width and position, for use by hover + var width = calcBar.w = barwidthIsArray ? barwidth[j] : barwidth; + calcBar[pLetter] = calcBar.p + (poffsetIsArray ? poffset[j] : poffset) + width / 2; + } + } +} -module.exports = function convert(calcTrace) { - var trace = calcTrace[0].trace; +function updatePositionAxis(gd, pa, sieve, allowMinDtick) { + var calcTraces = sieve.traces; + var minDiff = sieve.minDiff; + var vpad = minDiff / 2; - var isVisible = (trace.visible === true); - var hasFill = (trace.fill !== 'none'); - var hasLines = subTypes.hasLines(trace); - var hasMarkers = subTypes.hasMarkers(trace); - var hasText = subTypes.hasText(trace); - var hasCircles = (hasMarkers && trace.marker.symbol === 'circle'); - var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle'); - - var fill = initContainer(); - var line = initContainer(); - var circle = initContainer(); - var symbol = initContainer(); + Axes.minDtick(pa, sieve.minDiff, sieve.distinctPositions[0], allowMinDtick); - var opts = { - fill: fill, - line: line, - circle: circle, - symbol: symbol - }; + 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; - // early return if not visible or placeholder - if(!isVisible) return opts; + 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 = Array.isArray(poffset); + var barwidthIsArray = Array.isArray(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); + } + } - // fill layer and line layer use the same coords - var lineCoords; - if(hasFill || hasLines) { - lineCoords = geoJsonUtils.calcTraceToLineCoords(calcTrace); + fullTrace._extremes[pa._id] = Axes.findExtremes(pa, pts, {padded: false}); } +} - if(hasFill) { - fill.geojson = geoJsonUtils.makePolygon(lineCoords); - fill.layout.visibility = 'visible'; - - Lib.extendFlat(fill.paint, { - 'fill-color': trace.fillcolor - }); - } +// store these bar bases and tops in calcdata +// and make sure the size axis includes zero, +// along with the bases and tops of each bar. +function setBaseAndTop(gd, sa, sieve) { + var calcTraces = sieve.traces; + var sLetter = getAxisLetter(sa); - if(hasLines) { - line.geojson = geoJsonUtils.makeLine(lineCoords); - line.layout.visibility = 'visible'; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var fullTrace = calcTrace[0].trace; + var pts = []; + var allBarBaseAboveZero = true; - Lib.extendFlat(line.paint, { - 'line-width': trace.line.width, - 'line-color': trace.line.color, - 'line-opacity': trace.opacity - }); + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; + var barBase = bar.b; + var barTop = barBase + bar.s; - // TODO convert line.dash into line-dasharray - } + bar[sLetter] = barTop; + pts.push(barTop); + if(bar.hasB) pts.push(barBase); - if(hasCircles) { - var circleOpts = makeCircleOpts(calcTrace); - circle.geojson = circleOpts.geojson; - circle.layout.visibility = 'visible'; + if(!bar.hasB || !(bar.b > 0 && bar.s > 0)) { + allBarBaseAboveZero = false; + } + } - Lib.extendFlat(circle.paint, { - 'circle-color': circleOpts.mcc, - 'circle-radius': circleOpts.mrc, - 'circle-opacity': circleOpts.mo + fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, { + tozero: !allBarBaseAboveZero, + padded: true }); } +} - if(hasSymbols || hasText) { - symbol.geojson = makeSymbolGeoJSON(calcTrace); - - Lib.extendFlat(symbol.layout, { - visibility: 'visible', - 'icon-image': '{symbol}-15', - 'text-field': '{text}' - }); +function stackBars(gd, sa, sieve) { + var fullLayout = gd._fullLayout; + var barnorm = fullLayout.barnorm; + var sLetter = getAxisLetter(sa); + var calcTraces = sieve.traces; - if(hasSymbols) { - Lib.extendFlat(symbol.layout, { - 'icon-size': trace.marker.size / 10 - }); + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var fullTrace = calcTrace[0].trace; + var pts = []; - Lib.extendFlat(symbol.paint, { - 'icon-opacity': trace.opacity * trace.marker.opacity, + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; - // TODO does not work ?? - 'icon-color': trace.marker.color - }); - } + if(bar.s !== BADNUM) { + // stack current bar and get previous sum + var barBase = sieve.put(bar.p, bar.b + bar.s); + var barTop = barBase + bar.b + bar.s; - if(hasText) { - var iconSize = (trace.marker || {}).size, - textOpts = convertTextOpts(trace.textposition, iconSize); - - // all data-driven below !! - - Lib.extendFlat(symbol.layout, { - 'text-size': trace.textfont.size, - 'text-anchor': textOpts.anchor, - 'text-offset': textOpts.offset + // store the bar base and top in each calcdata item + bar.b = barBase; + bar[sLetter] = barTop; - // TODO font family - // 'text-font': symbol.textfont.family.split(', '), - }); + if(!barnorm) { + pts.push(barTop); + if(bar.hasB) pts.push(barBase); + } + } + } - Lib.extendFlat(symbol.paint, { - 'text-color': trace.textfont.color, - 'text-opacity': trace.opacity + // if barnorm is set, let normalizeBars update the axis range + if(!barnorm) { + fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, { + // N.B. we don't stack base with 'base', + // so set tozero:true always! + tozero: true, + padded: true }); } } - - return opts; -}; - -function initContainer() { - return { - geojson: geoJsonUtils.makeBlank(), - layout: { visibility: 'none' }, - paint: {} - }; } -function makeCircleOpts(calcTrace) { - var trace = calcTrace[0].trace; - var marker = trace.marker; - var selectedpoints = trace.selectedpoints; - var arrayColor = Lib.isArrayOrTypedArray(marker.color); - var arraySize = Lib.isArrayOrTypedArray(marker.size); - var arrayOpacity = Lib.isArrayOrTypedArray(marker.opacity); - var i; +function sieveBars(gd, sa, sieve) { + var calcTraces = sieve.traces; - function addTraceOpacity(o) { return trace.opacity * o; } + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; - function size2radius(s) { return s / 2; } + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; - var colorFn; - if(arrayColor) { - if(Colorscale.hasColorscale(trace, 'marker')) { - colorFn = Colorscale.makeColorScaleFunc( - Colorscale.extractScale(marker.colorscale, marker.cmin, marker.cmax) - ); - } else { - colorFn = Lib.identity; + if(bar.s !== BADNUM) sieve.put(bar.p, bar.b + bar.s); } } +} - var sizeFn; - if(arraySize) { - sizeFn = makeBubbleSizeFn(trace); - } +// Note: +// +// normalizeBars requires that either sieveBars or stackBars has been +// previously invoked. +function normalizeBars(gd, sa, sieve) { + var fullLayout = gd._fullLayout; + var calcTraces = sieve.traces; + var sLetter = getAxisLetter(sa); + var sTop = fullLayout.barnorm === 'fraction' ? 1 : 100; + var sTiny = sTop / 1e9; // in case of rounding error in sum + var sMin = sa.l2c(sa.c2l(0)); + var sMax = fullLayout.barmode === 'stack' ? sTop : sMin; - var opacityFn; - if(arrayOpacity) { - opacityFn = function(mo) { - var mo2 = isNumeric(mo) ? +Lib.constrain(mo, 0, 1) : 0; - return addTraceOpacity(mo2); - }; + function needsPadding(v) { + return ( + isNumeric(sa.c2l(v)) && + ((v < sMin - sTiny) || (v > sMax + sTiny) || !isNumeric(sMin)) + ); } - var features = []; - for(i = 0; i < calcTrace.length; i++) { - var calcPt = calcTrace[i]; - var lonlat = calcPt.lonlat; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var fullTrace = calcTrace[0].trace; + var pts = []; + var allBarBaseAboveZero = true; + 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; - if(isBADNUM(lonlat)) continue; + var barBase = bar.b; + var barTop = barBase + bar.s; - var props = {}; - if(colorFn) props.mcc = calcPt.mcc = colorFn(calcPt.mc); - if(sizeFn) props.mrc = calcPt.mrc = sizeFn(calcPt.ms); - if(opacityFn) props.mo = opacityFn(calcPt.mo); - if(selectedpoints) props.selected = calcPt.selected || 0; + bar[sLetter] = barTop; + pts.push(barTop); + padded = padded || needsPadding(barTop); - features.push({ - type: 'Feature', - geometry: {type: 'Point', coordinates: lonlat}, - properties: props + if(bar.hasB) { + pts.push(barBase); + padded = padded || needsPadding(barBase); + } + + if(!bar.hasB || !(bar.b > 0 && bar.s > 0)) { + allBarBaseAboveZero = false; + } + } + } + + fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, { + tozero: !allBarBaseAboveZero, + padded: padded }); } +} - var fns; - if(selectedpoints) { - fns = Drawing.makeSelectedPointStyleFns(trace); +// find the full position span of bars at each position +// for use by hover, to ensure labels move in if bars are +// narrower than the space they're in. +// run once per trace group (subplot & direction) and +// the same mapping is attached to all calcdata traces +function collectExtents(calcTraces, pa) { + var pLetter = getAxisLetter(pa); + var extents = {}; + var i, j, cd; - for(i = 0; i < features.length; i++) { - var d = features[i].properties; + var pMin = Infinity; + var pMax = -Infinity; - if(fns.selectedOpacityFn) { - d.mo = addTraceOpacity(fns.selectedOpacityFn(d)); - } - if(fns.selectedColorFn) { - d.mcc = fns.selectedColorFn(d); - } - if(fns.selectedSizeFn) { - d.mrc = fns.selectedSizeFn(d); + for(i = 0; i < calcTraces.length; i++) { + cd = calcTraces[i]; + for(j = 0; j < cd.length; j++) { + var p = cd[j].p; + if(isNumeric(p)) { + pMin = Math.min(pMin, p); + pMax = Math.max(pMax, p); } } } - return { - geojson: {type: 'FeatureCollection', features: features}, - mcc: arrayColor || (fns && fns.selectedColorFn) ? - {type: 'identity', property: 'mcc'} : - marker.color, - mrc: arraySize || (fns && fns.selectedSizeFn) ? - {type: 'identity', property: 'mrc'} : - size2radius(marker.size), - mo: arrayOpacity || (fns && fns.selectedOpacityFn) ? - {type: 'identity', property: 'mo'} : - addTraceOpacity(marker.opacity) + // this is just for positioning of hover labels, and nobody will care if + // the label is 1px too far out; so round positions to 1/10K in case + // position values don't exactly match from trace to trace + var roundFactor = 10000 / (pMax - pMin); + var round = extents.round = function(p) { + return String(Math.round(roundFactor * (p - pMin))); }; -} - -function makeSymbolGeoJSON(calcTrace) { - var trace = calcTrace[0].trace; - var marker = trace.marker || {}, - symbol = marker.symbol, - text = trace.text; - - var fillSymbol = (symbol !== 'circle') ? - getFillFunc(symbol) : - blankFillFunc; - - var fillText = subTypes.hasText(trace) ? - getFillFunc(text) : - blankFillFunc; - - var features = []; + for(i = 0; i < calcTraces.length; i++) { + cd = calcTraces[i]; + cd[0].t.extents = extents; - for(var i = 0; i < calcTrace.length; i++) { - var calcPt = calcTrace[i]; + var poffset = cd[0].t.poffset; + var poffsetIsArray = Array.isArray(poffset); - if(isBADNUM(calcPt.lonlat)) continue; + for(j = 0; j < cd.length; j++) { + var di = cd[j]; + var p0 = di[pLetter] - di.w / 2; - features.push({ - type: 'Feature', - geometry: { - type: 'Point', - coordinates: calcPt.lonlat - }, - properties: { - symbol: fillSymbol(calcPt.mx), - text: fillText(calcPt.tx) + if(isNumeric(p0)) { + var p1 = di[pLetter] + di.w / 2; + var pVal = round(di.p); + if(extents[pVal]) { + extents[pVal] = [Math.min(p0, extents[pVal][0]), Math.max(p1, extents[pVal][1])]; + } else { + extents[pVal] = [p0, p1]; + } } - }); - } - - return { - type: 'FeatureCollection', - features: features - }; -} -function getFillFunc(attr) { - if(Lib.isArrayOrTypedArray(attr)) { - return function(v) { return v; }; - } - else if(attr) { - return function() { return attr; }; - } - else { - return blankFillFunc; + di.p0 = di.p + (poffsetIsArray ? poffset[j] : poffset); + di.p1 = di.p0 + di.w; + di.s0 = di.b; + di.s1 = di.s0 + di.s; + } } } -function blankFillFunc() { return ''; } - -// only need to check lon (OR lat) -function isBADNUM(lonlat) { - return lonlat[0] === BADNUM; +function getAxisLetter(ax) { + return ax._id.charAt(0); } -},{"../../components/colorscale":585,"../../components/drawing":595,"../../constants/numerical":673,"../../lib":696,"../../lib/geojson_utils":689,"../../plots/mapbox/convert_text_opts":801,"../scatter/make_bubble_size_func":1060,"../scatter/subtypes":1067,"fast-isnumeric":214}],1099:[function(_dereq_,module,exports){ +module.exports = { + crossTraceCalc: crossTraceCalc, + setGroupPositions: setGroupPositions +}; + +},{"../../constants/numerical":140,"../../lib":159,"../../plots/cartesian/axes":203,"../../registry":243,"./sieve.js":265,"fast-isnumeric":10}],257:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; var Lib = _dereq_('../../lib'); +var Color = _dereq_('../../components/color'); +var Registry = _dereq_('../../registry'); -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); +var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handleStyleDefaults = _dereq_('../bar/style_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -169405,498 +66260,293 @@ return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } - var len = handleLonLatDefaults(traceIn, traceOut, coerce); + var coerceFont = Lib.coerceFont; + + var len = handleXYDefaults(traceIn, traceOut, layout, coerce); if(!len) { traceOut.visible = false; return; } + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); + coerce('base'); + coerce('offset'); + coerce('width'); + coerce('text'); coerce('hovertext'); - coerce('mode'); + coerce('hovertemplate'); - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, {noDash: true}); - coerce('connectgaps'); - } + var textPosition = coerce('textposition'); - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {noLine: true}); + var hasBoth = Array.isArray(textPosition) || textPosition === 'auto'; + var hasInside = hasBoth || textPosition === 'inside'; + var hasOutside = hasBoth || textPosition === 'outside'; - // array marker.size and marker.color are only supported with circles - var marker = traceOut.marker; - if(marker.symbol !== 'circle') { - if(Lib.isArrayOrTypedArray(marker.size)) marker.size = marker.size[0]; - if(Lib.isArrayOrTypedArray(marker.color)) marker.color = marker.color[0]; + if(hasInside || hasOutside) { + var textFont = coerceFont(coerce, 'textfont', layout.font); + + // Note that coercing `insidetextfont` is always needed – + // even if `textposition` is `outside` for each trace – since + // an outside label can become an inside one, for example because + // of a bar being stacked on top of it. + var insideTextFontDefault = Lib.extendFlat({}, textFont); + var isTraceTextfontColorSet = traceIn.textfont && traceIn.textfont.color; + var isColorInheritedFromLayoutFont = !isTraceTextfontColorSet; + if(isColorInheritedFromLayoutFont) { + delete insideTextFontDefault.color; } - } + coerceFont(coerce, 'insidetextfont', insideTextFontDefault); - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true}); - } + if(hasOutside) coerceFont(coerce, 'outsidetextfont', textFont); - coerce('fill'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); + coerce('constraintext'); + coerce('selected.textfont.color'); + coerce('unselected.textfont.color'); + coerce('cliponaxis'); } - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -}; - -function handleLonLatDefaults(traceIn, traceOut, coerce) { - var lon = coerce('lon') || []; - var lat = coerce('lat') || []; - var len = Math.min(lon.length, lat.length); - traceOut._length = len; - - return len; -} - -},{"../../lib":696,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"./attributes":1097}],1100:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; + handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); + var lineColor = (traceOut.marker.line || {}).color; -module.exports = function eventData(out, pt) { - out.lon = pt.lon; - out.lat = pt.lat; + // override defaultColor for error bars with defaultLine + var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); - return out; + Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{}],1101:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../lib":159,"../../registry":243,"../bar/style_defaults":267,"../scatter/xy_defaults":307,"./attributes":253}],258:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Fx = _dereq_('../../components/fx'); -var Lib = _dereq_('../../lib'); -var getTraceColor = _dereq_('../scatter/get_trace_color'); -var fillHoverText = _dereq_('../scatter/fill_hover_text'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; - -module.exports = function hoverPoints(pointData, xval, yval) { - var cd = pointData.cd; - var trace = cd[0].trace; - var xa = pointData.xa; - var ya = pointData.ya; - var subplot = pointData.subplot; - - // compute winding number about [-180, 180] globe - var winding = (xval >= 0) ? - Math.floor((xval + 180) / 360) : - Math.ceil((xval - 180) / 360); - - // shift longitude to [-180, 180] to determine closest point - var lonShift = winding * 360; - var xval2 = xval - lonShift; - - function distFn(d) { - var lonlat = d.lonlat; - if(lonlat[0] === BADNUM) return Infinity; - - var lon = Lib.modHalf(lonlat[0], 360); - var lat = lonlat[1]; - var pt = subplot.project([lon, lat]); - var dx = pt.x - xa.c2p([xval2, lat]); - var dy = pt.y - ya.c2p([lon, yval]); - var rad = Math.max(3, d.mrc || 0); +var isNumeric = _dereq_('fast-isnumeric'); +var tinycolor = _dereq_('tinycolor2'); - return Math.max(Math.sqrt(dx * dx + dy * dy) - rad, 1 - 3 / rad); +exports.coerceString = function(attributeDefinition, value, defaultValue) { + if(typeof value === 'string') { + if(value || !attributeDefinition.noBlank) return value; + } else if(typeof value === 'number') { + if(!attributeDefinition.strict) return String(value); } - Fx.getClosest(cd, distFn, pointData); - - // skip the rest (for this trace) if we didn't find a close point - if(pointData.index === false) return; - - var di = cd[pointData.index]; - var lonlat = di.lonlat; - var lonlatShifted = [Lib.modHalf(lonlat[0], 360) + lonShift, lonlat[1]]; - - // shift labels back to original winded globe - var xc = xa.c2p(lonlatShifted); - var yc = ya.c2p(lonlatShifted); - var rad = di.mrc || 1; - - pointData.x0 = xc - rad; - pointData.x1 = xc + rad; - pointData.y0 = yc - rad; - pointData.y1 = yc + rad; - - pointData.color = getTraceColor(trace, di); - pointData.extraText = getExtraText(trace, di, cd[0].t.labels); - - return [pointData]; + return (defaultValue !== undefined) ? + defaultValue : + attributeDefinition.dflt; }; -function getExtraText(trace, di, labels) { - var hoverinfo = di.hi || trace.hoverinfo; - var parts = hoverinfo.split('+'); - var isAll = parts.indexOf('all') !== -1; - var hasLon = parts.indexOf('lon') !== -1; - var hasLat = parts.indexOf('lat') !== -1; - var lonlat = di.lonlat; - var text = []; - - // TODO should we use a mock axis to format hover? - // If so, we'll need to make precision be zoom-level dependent - function format(v) { - return v + '\u00B0'; - } +exports.coerceNumber = function(attributeDefinition, value, defaultValue) { + if(isNumeric(value)) { + value = +value; - if(isAll || (hasLon && hasLat)) { - text.push('(' + format(lonlat[0]) + ', ' + format(lonlat[1]) + ')'); - } else if(hasLon) { - text.push(labels.lon + format(lonlat[0])); - } else if(hasLat) { - text.push(labels.lat + format(lonlat[1])); - } + var min = attributeDefinition.min; + var max = attributeDefinition.max; + var isOutOfBounds = (min !== undefined && value < min) || + (max !== undefined && value > max); - if(isAll || parts.indexOf('text') !== -1) { - fillHoverText(di, trace, text); + if(!isOutOfBounds) return value; } - return text.join('
'); -} - -},{"../../components/fx":612,"../../constants/numerical":673,"../../lib":696,"../scatter/fill_hover_text":1051,"../scatter/get_trace_color":1053}],1102:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + return (defaultValue !== undefined) ? + defaultValue : + attributeDefinition.dflt; +}; -'use strict'; +exports.coerceColor = function(attributeDefinition, value, defaultValue) { + if(tinycolor(value).isValid()) return value; + return (defaultValue !== undefined) ? + defaultValue : + attributeDefinition.dflt; +}; -var ScatterMapbox = {}; +exports.coerceEnumerated = function(attributeDefinition, value, defaultValue) { + if(attributeDefinition.coerceNumber) value = +value; -ScatterMapbox.attributes = _dereq_('./attributes'); -ScatterMapbox.supplyDefaults = _dereq_('./defaults'); -ScatterMapbox.colorbar = _dereq_('../scatter/marker_colorbar'); -ScatterMapbox.calc = _dereq_('../scattergeo/calc'); -ScatterMapbox.plot = _dereq_('./plot'); -ScatterMapbox.hoverPoints = _dereq_('./hover'); -ScatterMapbox.eventData = _dereq_('./event_data'); -ScatterMapbox.selectPoints = _dereq_('./select'); + if(attributeDefinition.values.indexOf(value) !== -1) return value; -ScatterMapbox.style = function(_, cd) { - if(cd) { - var trace = cd[0].trace; - trace._glTrace.update(cd); - } + return (defaultValue !== undefined) ? + defaultValue : + attributeDefinition.dflt; }; -ScatterMapbox.moduleType = 'trace'; -ScatterMapbox.name = 'scattermapbox'; -ScatterMapbox.basePlotModule = _dereq_('../../plots/mapbox'); -ScatterMapbox.categories = ['mapbox', 'gl', 'symbols', 'showLegend', 'scatterlike']; -ScatterMapbox.meta = { - - +exports.getValue = function(arrayOrScalar, index) { + var value; + if(!Array.isArray(arrayOrScalar)) value = arrayOrScalar; + else if(index < arrayOrScalar.length) value = arrayOrScalar[index]; + return value; }; -module.exports = ScatterMapbox; - -},{"../../plots/mapbox":802,"../scatter/marker_colorbar":1061,"../scattergeo/calc":1084,"./attributes":1097,"./defaults":1099,"./event_data":1100,"./hover":1101,"./plot":1103,"./select":1104}],1103:[function(_dereq_,module,exports){ +},{"fast-isnumeric":10,"tinycolor2":26}],259:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var convert = _dereq_('./convert'); - -function ScatterMapbox(subplot, uid) { - this.subplot = subplot; - this.uid = uid; - - this.sourceIds = { - fill: uid + '-source-fill', - line: uid + '-source-line', - circle: uid + '-source-circle', - symbol: uid + '-source-symbol' - }; - - this.layerIds = { - fill: uid + '-layer-fill', - line: uid + '-layer-line', - circle: uid + '-layer-circle', - symbol: uid + '-layer-symbol' - }; - - this.order = ['fill', 'line', 'circle', 'symbol']; - - // We could merge the 'fill' source with the 'line' source and - // the 'circle' source with the 'symbol' source if ever having - // for up-to 4 sources per 'scattermapbox' traces becomes a problem. -} -var proto = ScatterMapbox.prototype; +'use strict'; -proto.addSource = function(k, opts) { - this.subplot.map.addSource(this.sourceIds[k], { - type: 'geojson', - data: opts.geojson - }); -}; +var Fx = _dereq_('../../components/fx'); +var Registry = _dereq_('../../registry'); +var Color = _dereq_('../../components/color'); +var fillHoverText = _dereq_('../scatter/fill_hover_text'); -proto.setSourceData = function(k, opts) { - this.subplot.map - .getSource(this.sourceIds[k]) - .setData(opts.geojson); -}; +function hoverPoints(pointData, xval, yval, hovermode) { + var cd = pointData.cd; + var trace = cd[0].trace; + var t = cd[0].t; + var isClosest = (hovermode === 'closest'); + var maxHoverDistance = pointData.maxHoverDistance; + var maxSpikeDistance = pointData.maxSpikeDistance; -proto.addLayer = function(k, opts) { - this.subplot.map.addLayer({ - type: k, - id: this.layerIds[k], - source: this.sourceIds[k], - layout: opts.layout, - paint: opts.paint - }); -}; + var posVal, sizeVal, posLetter, sizeLetter, dx, dy, pRangeCalc; -proto.update = function update(calcTrace) { - var subplot = this.subplot; - var optsAll = convert(calcTrace); + function thisBarMinPos(di) { return di[posLetter] - di.w / 2; } + function thisBarMaxPos(di) { return di[posLetter] + di.w / 2; } - for(var i = 0; i < this.order.length; i++) { - var k = this.order[i]; - var opts = optsAll[k]; + var minPos = isClosest ? + thisBarMinPos : + function(di) { + /* + * In compare mode, accept a bar if you're on it *or* its group. + * Nearly always it's the group that matters, but in case the bar + * was explicitly set wider than its group we'd better accept the + * whole bar. + * + * use `bardelta` instead of `bargroupwidth` so we accept hover + * in the gap. That way hover doesn't flash on and off as you + * mouse over the plot in compare modes. + * In 'closest' mode though the flashing seems inevitable, + * without far more complex logic + */ + return Math.min(thisBarMinPos(di), di.p - t.bardelta / 2); + }; - subplot.setOptions(this.layerIds[k], 'setLayoutProperty', opts.layout); + var maxPos = isClosest ? + thisBarMaxPos : + function(di) { + return Math.max(thisBarMaxPos(di), di.p + t.bardelta / 2); + }; - if(opts.layout.visibility === 'visible') { - this.setSourceData(k, opts); - subplot.setOptions(this.layerIds[k], 'setPaintProperty', opts.paint); - } + function _positionFn(_minPos, _maxPos) { + // add a little to the pseudo-distance for wider bars, so that like scatter, + // if you are over two overlapping bars, the narrower one wins. + return Fx.inbox(_minPos - posVal, _maxPos - posVal, + maxHoverDistance + Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc) - 1); } - // link ref for quick update during selections - calcTrace[0].trace._glTrace = this; -}; - -proto.dispose = function dispose() { - var map = this.subplot.map; - - for(var i = 0; i < this.order.length; i++) { - var k = this.order[i]; - map.removeLayer(this.layerIds[k]); - map.removeSource(this.sourceIds[k]); + function positionFn(di) { + return _positionFn(minPos(di), maxPos(di)); } -}; - -module.exports = function createScatterMapbox(subplot, calcTrace) { - var trace = calcTrace[0].trace; - var scatterMapbox = new ScatterMapbox(subplot, trace.uid); - var optsAll = convert(calcTrace); - - for(var i = 0; i < scatterMapbox.order.length; i++) { - var k = scatterMapbox.order[i]; - var opts = optsAll[k]; - scatterMapbox.addSource(k, opts); - scatterMapbox.addLayer(k, opts); + function thisBarPositionFn(di) { + return _positionFn(thisBarMinPos(di), thisBarMaxPos(di)); } - // link ref for quick update during selections - calcTrace[0].trace._glTrace = scatterMapbox; - - return scatterMapbox; -}; - -},{"./convert":1098}],1104:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var Lib = _dereq_('../../lib'); -var subtypes = _dereq_('../scatter/subtypes'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; - -module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; - var trace = cd[0].trace; - var i; - - if(!subtypes.hasMarkers(trace)) return []; - - if(selectionTester === false) { - for(i = 0; i < cd.length; i++) { - cd[i].selected = 0; - } - } else { - for(i = 0; i < cd.length; i++) { - var di = cd[i]; - var lonlat = di.lonlat; - - if(lonlat[0] !== BADNUM) { - var lonlat2 = [Lib.modHalf(lonlat[0], 360), lonlat[1]]; - var xy = [xa.c2p(lonlat2), ya.c2p(lonlat2)]; - - if(selectionTester.contains(xy, null, i, searchInfo)) { - selection.push({ - pointNumber: i, - lon: lonlat[0], - lat: lonlat[1] - }); - di.selected = 1; - } else { - di.selected = 0; - } - } - } + function sizeFn(di) { + // add a gradient so hovering near the end of a + // bar makes it a little closer match + return Fx.inbox(di.b - sizeVal, di[sizeLetter] - sizeVal, + maxHoverDistance + (di[sizeLetter] - sizeVal) / (di[sizeLetter] - di.b) - 1); } - return selection; -}; - -},{"../../constants/numerical":673,"../../lib":696,"../scatter/subtypes":1067}],1105:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; - -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var scatterAttrs = _dereq_('../scatter/attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var lineAttrs = scatterAttrs.line; + 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; + } -module.exports = { - mode: scatterAttrs.mode, + var pa = pointData[posLetter + 'a']; + var sa = pointData[sizeLetter + 'a']; - r: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, + pRangeCalc = Math.abs(pa.r2c(pa.range[1]) - pa.r2c(pa.range[0])); - theta: { - valType: 'data_array', - editType: 'calc+clearAxisTypes', - - }, + function dxy(di) { return (dx(di) + dy(di)) / 2; } + var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); + Fx.getClosest(cd, distfn, pointData); - r0: { - valType: 'any', - dflt: 0, - - editType: 'calc+clearAxisTypes', - - }, - dr: { - valType: 'number', - dflt: 1, - - editType: 'calc', - - }, + // skip the rest (for this trace) if we didn't find a close point + if(pointData.index === false) return; - theta0: { - valType: 'any', - dflt: 0, - - editType: 'calc+clearAxisTypes', - - }, - dtheta: { - valType: 'number', - - editType: 'calc', - - }, + // if we get here and we're not in 'closest' mode, push min/max pos back + // onto the group - even though that means occasionally the mouse will be + // over the hover label. + if(!isClosest) { + minPos = function(di) { + return Math.min(thisBarMinPos(di), di.p - t.bargroupwidth / 2); + }; + maxPos = function(di) { + return Math.max(thisBarMaxPos(di), di.p + t.bargroupwidth / 2); + }; + } - thetaunit: { - valType: 'enumerated', - values: ['radians', 'degrees', 'gradians'], - dflt: 'degrees', - - editType: 'calc+clearAxisTypes', - - }, + // the closest data point + var index = pointData.index; + var di = cd[index]; - text: scatterAttrs.text, - hovertext: scatterAttrs.hovertext, + var size = (trace.base) ? di.b + di.s : di.s; + pointData[sizeLetter + '0'] = pointData[sizeLetter + '1'] = sa.c2p(di[sizeLetter], true); + pointData[sizeLetter + 'LabelVal'] = size; - line: { - color: lineAttrs.color, - width: lineAttrs.width, - dash: lineAttrs.dash, - shape: extendFlat({}, lineAttrs.shape, { - values: ['linear', 'spline'] - }), - smoothing: lineAttrs.smoothing, - editType: 'calc' - }, - connectgaps: scatterAttrs.connectgaps, + var extent = t.extents[t.extents.round(di.p)]; + pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); + pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); + pointData[posLetter + 'LabelVal'] = di.p; - marker: scatterAttrs.marker, - cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, {dflt: false}), + // spikelines always want "closest" distance regardless of hovermode + pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 + maxSpikeDistance - maxHoverDistance; + // they also want to point to the data value, regardless of where the label goes + // in case of bars shifted within groups + pointData[posLetter + 'Spike'] = pa.c2p(di.p, true); - textposition: scatterAttrs.textposition, - textfont: scatterAttrs.textfont, + pointData.color = getTraceColor(trace, di); + fillHoverText(di, trace, pointData); + Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, pointData); - fill: extendFlat({}, scatterAttrs.fill, { - values: ['none', 'toself', 'tonext'], - dflt: 'none', - - }), - fillcolor: scatterAttrs.fillcolor, + pointData.hovertemplate = trace.hovertemplate; + return [pointData]; +} - // TODO error bars - // https://stackoverflow.com/a/26597487/4068492 - // error_x (error_r, error_theta) - // error_y +function getTraceColor(trace, di) { + var mc = di.mcc || trace.marker.color; + var mlc = di.mlcc || trace.marker.line.color; + var mlw = di.mlw || trace.marker.line.width; - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['r', 'theta', 'text', 'name'] - }), - hoveron: scatterAttrs.hoveron, + if(Color.opacity(mc)) return mc; + else if(Color.opacity(mlc) && mlw) return mlc; +} - selected: scatterAttrs.selected, - unselected: scatterAttrs.unselected +module.exports = { + hoverPoints: hoverPoints, + getTraceColor: getTraceColor }; -},{"../../lib/extend":685,"../../plots/attributes":741,"../scatter/attributes":1043}],1106:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/fx":82,"../../registry":243,"../scatter/fill_hover_text":289}],260:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169906,52 +66556,35 @@ 'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; - -var Axes = _dereq_('../../plots/cartesian/axes'); - -var calcColorscale = _dereq_('../scatter/colorscale_calc'); -var arraysToCalcdata = _dereq_('../scatter/arrays_to_calcdata'); -var calcSelection = _dereq_('../scatter/calc_selection'); -var calcMarkerSize = _dereq_('../scatter/calc').calcMarkerSize; - -module.exports = function calc(gd, trace) { - var fullLayout = gd._fullLayout; - var subplotId = trace.subplot; - var radialAxis = fullLayout[subplotId].radialaxis; - var angularAxis = fullLayout[subplotId].angularaxis; - var rArray = radialAxis.makeCalcdata(trace, 'r'); - var thetaArray = angularAxis.makeCalcdata(trace, 'theta'); - var len = trace._length; - var cd = new Array(len); - - for(var i = 0; i < len; i++) { - var r = rArray[i]; - var theta = thetaArray[i]; - var cdi = cd[i] = {}; - - if(isNumeric(r) && isNumeric(theta)) { - cdi.r = r; - cdi.theta = theta; - } else { - cdi.r = BADNUM; - } - } - - var ppad = calcMarkerSize(trace, len); - trace._extremes.x = Axes.findExtremes(radialAxis, rArray, {ppad: ppad}); +var Bar = {}; - calcColorscale(trace); - arraysToCalcdata(cd, trace); - calcSelection(cd, trace); +Bar.attributes = _dereq_('./attributes'); +Bar.layoutAttributes = _dereq_('./layout_attributes'); +Bar.supplyDefaults = _dereq_('./defaults'); +Bar.supplyLayoutDefaults = _dereq_('./layout_defaults'); +Bar.calc = _dereq_('./calc'); +Bar.crossTraceCalc = _dereq_('./cross_trace_calc').crossTraceCalc; +Bar.colorbar = _dereq_('../scatter/marker_colorbar'); +Bar.arraysToCalcdata = _dereq_('./arrays_to_calcdata'); +Bar.plot = _dereq_('./plot'); +Bar.style = _dereq_('./style').style; +Bar.styleOnSelect = _dereq_('./style').styleOnSelect; +Bar.hoverPoints = _dereq_('./hover').hoverPoints; +Bar.selectPoints = _dereq_('./select'); - return cd; +Bar.moduleType = 'trace'; +Bar.name = 'bar'; +Bar.basePlotModule = _dereq_('../../plots/cartesian'); +Bar.categories = ['cartesian', 'svg', 'bar', 'oriented', 'errorBarsOK', 'showLegend', 'zoomScale']; +Bar.meta = { + }; -},{"../../constants/numerical":673,"../../plots/cartesian/axes":744,"../scatter/arrays_to_calcdata":1042,"../scatter/calc":1044,"../scatter/calc_selection":1045,"../scatter/colorscale_calc":1046,"fast-isnumeric":214}],1107:[function(_dereq_,module,exports){ +module.exports = Bar; + +},{"../../plots/cartesian":215,"../scatter/marker_colorbar":299,"./arrays_to_calcdata":252,"./attributes":253,"./calc":254,"./cross_trace_calc":256,"./defaults":257,"./hover":259,"./layout_attributes":261,"./layout_defaults":262,"./plot":263,"./select":264,"./style":266}],261:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169960,595 +66593,542 @@ 'use strict'; -var Lib = _dereq_('../../lib'); - -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleLineShapeDefaults = _dereq_('../scatter/line_shape_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); -var PTS_LINESONLY = _dereq_('../scatter/constants').PTS_LINESONLY; - -var attributes = _dereq_('./attributes'); - -function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce); - if(!len) { - traceOut.visible = false; - return; - } - - coerce('thetaunit'); - coerce('mode', len < PTS_LINESONLY ? 'lines+markers' : 'lines'); - coerce('text'); - coerce('hovertext'); - - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - handleLineShapeDefaults(traceIn, traceOut, coerce); - coerce('connectgaps'); - } - - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true}); - } - - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); - } - - var dfltHoverOn = []; - - if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) { - coerce('cliponaxis'); - coerce('marker.maxdisplayed'); - dfltHoverOn.push('points'); - } - - coerce('fill'); - - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); - if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); - } - - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { - dfltHoverOn.push('fills'); - } - coerce('hoveron', dfltHoverOn.join('+') || 'points'); - - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -} - -function handleRThetaDefaults(traceIn, traceOut, layout, coerce) { - var r = coerce('r'); - var theta = coerce('theta'); - var len; - - if(r) { - if(theta) { - len = Math.min(r.length, theta.length); - } else { - len = r.length; - coerce('theta0'); - coerce('dtheta'); - } - } else { - if(!theta) return 0; - len = traceOut.theta.length; - coerce('r0'); - coerce('dr'); - } - - traceOut._length = len; - return len; -} module.exports = { - handleRThetaDefaults: handleRThetaDefaults, - supplyDefaults: supplyDefaults + barmode: { + valType: 'enumerated', + values: ['stack', 'group', 'overlay', 'relative'], + dflt: 'group', + + editType: 'calc', + + }, + barnorm: { + valType: 'enumerated', + values: ['', 'fraction', 'percent'], + dflt: '', + + editType: 'calc', + + }, + bargap: { + valType: 'number', + min: 0, + max: 1, + + editType: 'calc', + + }, + bargroupgap: { + valType: 'number', + min: 0, + max: 1, + dflt: 0, + + editType: 'calc', + + } }; -},{"../../lib":696,"../scatter/constants":1047,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/line_shape_defaults":1058,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"./attributes":1105}],1108:[function(_dereq_,module,exports){ +},{}],262:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var scatterHover = _dereq_('../scatter/hover'); +var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); -function hoverPoints(pointData, xval, yval, hovermode) { - var scatterPointData = scatterHover(pointData, xval, yval, hovermode); - if(!scatterPointData || scatterPointData[0].index === false) return; +var layoutAttributes = _dereq_('./layout_attributes'); - var newPointData = scatterPointData[0]; - // hovering on fill case - if(newPointData.index === undefined) { - return scatterPointData; +module.exports = function(layoutIn, layoutOut, fullData) { + function coerce(attr, dflt) { + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } - var subplot = pointData.subplot; - var cdi = newPointData.cd[newPointData.index]; - var trace = newPointData.trace; - - if(!subplot.isPtInside(cdi)) return; - - newPointData.xLabelVal = undefined; - newPointData.yLabelVal = undefined; - makeHoverPointText(cdi, trace, subplot, newPointData); - - return scatterPointData; -} + var hasBars = false; + var shouldBeGapless = false; + var gappedAnyway = false; + var usedSubplots = {}; -function makeHoverPointText(cdi, trace, subplot, pointData) { - var radialAxis = subplot.radialAxis; - var angularAxis = subplot.angularAxis; - var hoverinfo = cdi.hi || trace.hoverinfo; - var parts = hoverinfo.split('+'); - var text = []; + for(var i = 0; i < fullData.length; i++) { + var trace = fullData[i]; + if(Registry.traceIs(trace, 'bar') && trace.visible) hasBars = true; + else continue; - radialAxis._hovertitle = 'r'; - angularAxis._hovertitle = 'θ'; + // if we have at least 2 grouped bar traces on the same subplot, + // we should default to a gap anyway, even if the data is histograms + if(layoutIn.barmode !== 'overlay' && layoutIn.barmode !== 'stack') { + var subploti = trace.xaxis + trace.yaxis; + if(usedSubplots[subploti]) gappedAnyway = true; + usedSubplots[subploti] = true; + } - function textPart(ax, val) { - text.push(ax._hovertitle + ': ' + Axes.tickText(ax, val, 'hover').text); + if(trace.visible && trace.type === 'histogram') { + var pa = Axes.getFromId({_fullLayout: layoutOut}, + trace[trace.orientation === 'v' ? 'xaxis' : 'yaxis']); + if(pa.type !== 'category') shouldBeGapless = true; + } } - if(parts.indexOf('all') !== -1) parts = ['r', 'theta', 'text']; - if(parts.indexOf('r') !== -1) { - textPart(radialAxis, radialAxis.c2l(cdi.r)); - } - if(parts.indexOf('theta') !== -1) { - var theta = cdi.theta; - textPart( - angularAxis, - angularAxis.thetaunit === 'degrees' ? Lib.rad2deg(theta) : theta - ); - } - if(parts.indexOf('text') !== -1 && pointData.text) { - text.push(pointData.text); - delete pointData.text; - } + if(!hasBars) return; - pointData.extraText = text.join('
'); -} + var mode = coerce('barmode'); + if(mode !== 'overlay') coerce('barnorm'); -module.exports = { - hoverPoints: hoverPoints, - makeHoverPointText: makeHoverPointText + coerce('bargap', (shouldBeGapless && !gappedAnyway) ? 0 : 0.2); + coerce('bargroupgap'); }; -},{"../../lib":696,"../../plots/cartesian/axes":744,"../scatter/hover":1054}],1109:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../plots/cartesian/axes":203,"../../registry":243,"./layout_attributes":261}],263:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -module.exports = { - moduleType: 'trace', - name: 'scatterpolar', - basePlotModule: _dereq_('../../plots/polar'), - categories: ['polar', 'symbols', 'showLegend', 'scatter-like'], +var d3 = _dereq_('d3'); +var isNumeric = _dereq_('fast-isnumeric'); - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults').supplyDefaults, - colorbar: _dereq_('../scatter/marker_colorbar'), - calc: _dereq_('./calc'), - plot: _dereq_('./plot'), - style: _dereq_('../scatter/style').style, - hoverPoints: _dereq_('./hover').hoverPoints, - selectPoints: _dereq_('../scatter/select'), +var Lib = _dereq_('../../lib'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); - meta: { - - - } -}; +var Color = _dereq_('../../components/color'); +var Drawing = _dereq_('../../components/drawing'); +var Registry = _dereq_('../../registry'); -},{"../../plots/polar":811,"../scatter/marker_colorbar":1061,"../scatter/select":1064,"../scatter/style":1066,"./attributes":1105,"./calc":1106,"./defaults":1107,"./hover":1108,"./plot":1110}],1110:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +var attributes = _dereq_('./attributes'); +var attributeText = attributes.text; +var attributeTextPosition = attributes.textposition; +var helpers = _dereq_('./helpers'); +var style = _dereq_('./style'); -'use strict'; +// padding in pixels around text +var TEXTPAD = 3; -var scatterPlot = _dereq_('../scatter/plot'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; +module.exports = function plot(gd, plotinfo, cdbar, barLayer) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var fullLayout = gd._fullLayout; -module.exports = function plot(gd, subplot, moduleCalcData) { - var mlayer = subplot.layers.frontplot.select('g.scatterlayer'); + var bartraces = Lib.makeTraceGroups(barLayer, cdbar, 'trace bars').each(function(cd) { + var plotGroup = d3.select(this); + var cd0 = cd[0]; + var trace = cd0.trace; - var plotinfo = { - xaxis: subplot.xaxis, - yaxis: subplot.yaxis, - plot: subplot.framework, - layerClipId: subplot._hasClipOnAxisFalse ? subplot.clipIds.forTraces : null - }; - - var radialAxis = subplot.radialAxis; - var angularAxis = subplot.angularAxis; - - // convert: - // 'c' (r,theta) -> 'geometric' (r,theta) -> (x,y) - for(var i = 0; i < moduleCalcData.length; i++) { - var cdi = moduleCalcData[i]; - - for(var j = 0; j < cdi.length; j++) { - var cd = cdi[j]; - var r = cd.r; + if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; - if(r === BADNUM) { - cd.x = cd.y = BADNUM; - } else { - var rg = radialAxis.c2g(r); - var thetag = angularAxis.c2g(cd.theta); - cd.x = rg * Math.cos(thetag); - cd.y = rg * Math.sin(thetag); - } - } - } + var pointGroup = Lib.ensureSingle(plotGroup, 'g', 'points'); - scatterPlot(gd, plotinfo, moduleCalcData, mlayer); -}; + var bars = pointGroup.selectAll('g.point').data(Lib.identity); -},{"../../constants/numerical":673,"../scatter/plot":1063}],1111:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + bars.enter().append('g') + .classed('point', true); -'use strict'; + bars.exit().remove(); -var scatterPolarAttrs = _dereq_('../scatterpolar/attributes'); -var scatterGlAttrs = _dereq_('../scattergl/attributes'); + bars.each(function(di, i) { + var bar = d3.select(this); -module.exports = { - mode: scatterPolarAttrs.mode, - r: scatterPolarAttrs.r, - theta: scatterPolarAttrs.theta, - r0: scatterPolarAttrs.r0, - dr: scatterPolarAttrs.dr, - theta0: scatterPolarAttrs.theta0, - dtheta: scatterPolarAttrs.dtheta, - thetaunit: scatterPolarAttrs.thetaunit, + // now display the bar + // clipped xf/yf (2nd arg true): non-positive + // log values go off-screen by plotwidth + // so you see them continue if you drag the plot + var x0, x1, y0, y1; + if(trace.orientation === 'h') { + y0 = ya.c2p(di.p0, true); + y1 = ya.c2p(di.p1, true); + x0 = xa.c2p(di.s0, true); + x1 = xa.c2p(di.s1, true); + + // for selections + di.ct = [x1, (y0 + y1) / 2]; + } + else { + x0 = xa.c2p(di.p0, true); + x1 = xa.c2p(di.p1, true); + y0 = ya.c2p(di.s0, true); + y1 = ya.c2p(di.s1, true); + + // for selections + di.ct = [(x0 + x1) / 2, y1]; + } - text: scatterPolarAttrs.text, - hovertext: scatterPolarAttrs.hovertext, + if(!isNumeric(x0) || !isNumeric(x1) || + !isNumeric(y0) || !isNumeric(y1) || + x0 === x1 || y0 === y1) { + bar.remove(); + return; + } - line: scatterGlAttrs.line, - connectgaps: scatterGlAttrs.connectgaps, + var lw = (di.mlw + 1 || trace.marker.line.width + 1 || + (di.trace ? di.trace.marker.line.width : 0) + 1) - 1; + var offset = d3.round((lw / 2) % 1, 2); - marker: scatterGlAttrs.marker, - // no cliponaxis + function roundWithLine(v) { + // if there are explicit gaps, don't round, + // it can make the gaps look crappy + return (fullLayout.bargap === 0 && fullLayout.bargroupgap === 0) ? + d3.round(Math.round(v) - offset, 2) : v; + } - fill: scatterGlAttrs.fill, - fillcolor: scatterGlAttrs.fillcolor, + function expandToVisible(v, vc) { + // if it's not in danger of disappearing entirely, + // round more precisely + return Math.abs(v - vc) >= 2 ? roundWithLine(v) : + // but if it's very thin, expand it so it's + // necessarily visible, even if it might overlap + // its neighbor + (v > vc ? Math.ceil(v) : Math.floor(v)); + } - textposition: scatterGlAttrs.textposition, - textfont: scatterGlAttrs.textfont, + if(!gd._context.staticPlot) { + // if bars are not fully opaque or they have a line + // around them, round to integer pixels, mainly for + // safari so we prevent overlaps from its expansive + // pixelation. if the bars ARE fully opaque and have + // no line, expand to a full pixel to make sure we + // can see them + var op = Color.opacity(di.mc || trace.marker.color); + var fixpx = (op < 1 || lw > 0.01) ? roundWithLine : expandToVisible; + x0 = fixpx(x0, x1); + x1 = fixpx(x1, x0); + y0 = fixpx(y0, y1); + y1 = fixpx(y1, y0); + } - hoverinfo: scatterPolarAttrs.hoverinfo, - // no hoveron + Lib.ensureSingle(bar, 'path') + .style('vector-effect', 'non-scaling-stroke') + .attr('d', + 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); - selected: scatterPolarAttrs.selected, - unselected: scatterPolarAttrs.unselected -}; + appendBarText(gd, bar, cd, i, x0, x1, y0, y1); -},{"../scattergl/attributes":1092,"../scatterpolar/attributes":1105}],1112:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + if(plotinfo.layerClipId) { + Drawing.hideOutsideRangePoint(di, bar.select('text'), xa, ya, trace.xcalendar, trace.ycalendar); + } + }); -'use strict'; + // lastly, clip points groups of `cliponaxis !== false` traces + // on `plotinfo._hasClipOnAxisFalse === true` subplots + var hasClipOnAxisFalse = cd0.trace.cliponaxis === false; + Drawing.setClipUrl(plotGroup, hasClipOnAxisFalse ? null : plotinfo.layerClipId, gd); + }); -var Lib = _dereq_('../../lib'); + // error bars are on the top + Registry.getComponentMethod('errorbars', 'plot')(gd, bartraces, plotinfo); +}; -var subTypes = _dereq_('../scatter/subtypes'); -var handleRThetaDefaults = _dereq_('../scatterpolar/defaults').handleRThetaDefaults; -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); -var PTS_LINESONLY = _dereq_('../scatter/constants').PTS_LINESONLY; +function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { + var textPosition; -var attributes = _dereq_('./attributes'); + function appendTextNode(bar, text, textFont) { + var textSelection = Lib.ensureSingle(bar, 'text') + .text(text) + .attr({ + 'class': 'bartext bartext-' + textPosition, + transform: '', + 'text-anchor': 'middle', + // prohibit tex interpretation until we can handle + // tex and regular text together + 'data-notex': 1 + }) + .call(Drawing.font, textFont) + .call(svgTextUtils.convertToTspans, gd); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + return textSelection; } - var len = handleRThetaDefaults(traceIn, traceOut, layout, coerce); - if(!len) { - traceOut.visible = false; + // get trace attributes + var trace = calcTrace[0].trace; + var orientation = trace.orientation; + + var text = getText(trace, i); + textPosition = getTextPosition(trace, i); + + if(!text || textPosition === 'none') { + bar.select('text').remove(); return; } - coerce('thetaunit'); - coerce('mode', len < PTS_LINESONLY ? 'lines+markers' : 'lines'); - coerce('text'); - coerce('hovertext'); + var layoutFont = gd._fullLayout.font; + var barColor = style.getBarColor(calcTrace[i], trace); + var insideTextFont = style.getInsideTextFont(trace, i, layoutFont, barColor); + var outsideTextFont = style.getOutsideTextFont(trace, i, layoutFont); - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - coerce('connectgaps'); + // compute text position + var barmode = gd._fullLayout.barmode; + var inStackMode = (barmode === 'stack'); + var inRelativeMode = (barmode === 'relative'); + var inStackOrRelativeMode = inStackMode || inRelativeMode; + + var calcBar = calcTrace[i]; + var isOutmostBar = !inStackOrRelativeMode || calcBar._outmost; + + var barWidth = Math.abs(x1 - x0) - 2 * TEXTPAD; // padding excluded + var barHeight = Math.abs(y1 - y0) - 2 * TEXTPAD; // padding excluded + + var textSelection; + var textBB; + var textWidth; + var textHeight; + + if(textPosition === 'outside') { + if(!isOutmostBar && !calcBar.hasB) textPosition = 'inside'; } - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce); + if(textPosition === 'auto') { + if(isOutmostBar) { + // draw text using insideTextFont and check if it fits inside bar + textPosition = 'inside'; + textSelection = appendTextNode(bar, text, insideTextFont); + + textBB = Drawing.bBox(textSelection.node()), + textWidth = textBB.width, + textHeight = textBB.height; + + var textHasSize = (textWidth > 0 && textHeight > 0); + var fitsInside = (textWidth <= barWidth && textHeight <= barHeight); + var fitsInsideIfRotated = (textWidth <= barHeight && textHeight <= barWidth); + var fitsInsideIfShrunk = (orientation === 'h') ? + (barWidth >= textWidth * (barHeight / textHeight)) : + (barHeight >= textHeight * (barWidth / textWidth)); + + if(textHasSize && + (fitsInside || fitsInsideIfRotated || fitsInsideIfShrunk)) { + textPosition = 'inside'; + } + else { + textPosition = 'outside'; + textSelection.remove(); + textSelection = null; + } + } + else textPosition = 'inside'; } - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); + if(!textSelection) { + textSelection = appendTextNode(bar, text, + (textPosition === 'outside') ? + outsideTextFont : insideTextFont); + + textBB = Drawing.bBox(textSelection.node()), + textWidth = textBB.width, + textHeight = textBB.height; + + if(textWidth <= 0 || textHeight <= 0) { + textSelection.remove(); + return; + } } - coerce('fill'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); + // compute text transform + var transform, constrained; + if(textPosition === 'outside') { + constrained = trace.constraintext === 'both' || trace.constraintext === 'outside'; + transform = getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, + orientation, constrained); + } + else { + constrained = trace.constraintext === 'both' || trace.constraintext === 'inside'; + transform = getTransformToMoveInsideBar(x0, x1, y0, y1, textBB, + orientation, constrained); } - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -}; + textSelection.attr('transform', transform); +} -},{"../../lib":696,"../scatter/constants":1047,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"../scatterpolar/defaults":1107,"./attributes":1111}],1113:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function getTransformToMoveInsideBar(x0, x1, y0, y1, textBB, orientation, constrained) { + // compute text and target positions + var textWidth = textBB.width; + var textHeight = textBB.height; + var textX = (textBB.left + textBB.right) / 2; + var textY = (textBB.top + textBB.bottom) / 2; + var barWidth = Math.abs(x1 - x0); + var barHeight = Math.abs(y1 - y0); + var targetWidth; + var targetHeight; + var targetX; + var targetY; -'use strict'; + // apply text padding + var textpad; + if(barWidth > (2 * TEXTPAD) && barHeight > (2 * TEXTPAD)) { + textpad = TEXTPAD; + barWidth -= 2 * textpad; + barHeight -= 2 * textpad; + } + else textpad = 0; -var cluster = _dereq_('point-cluster'); -var isNumeric = _dereq_('fast-isnumeric'); + // compute rotation and scale + var rotate, + scale; -var ScatterGl = _dereq_('../scattergl'); -var calcColorscales = _dereq_('../scatter/colorscale_calc'); -var calcMarkerSize = _dereq_('../scatter/calc').calcMarkerSize; -var convert = _dereq_('../scattergl/convert'); + if(textWidth <= barWidth && textHeight <= barHeight) { + // no scale or rotation is required + rotate = false; + scale = 1; + } + else if(textWidth <= barHeight && textHeight <= barWidth) { + // only rotation is required + rotate = true; + scale = 1; + } + else if((textWidth < textHeight) === (barWidth < barHeight)) { + // only scale is required + rotate = false; + scale = constrained ? Math.min(barWidth / textWidth, barHeight / textHeight) : 1; + } + else { + // both scale and rotation are required + rotate = true; + scale = constrained ? Math.min(barHeight / textWidth, barWidth / textHeight) : 1; + } -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var makeHoverPointText = _dereq_('../scatterpolar/hover').makeHoverPointText; + if(rotate) rotate = 90; // rotate clockwise -var TOO_MANY_POINTS = _dereq_('../scattergl/constants').TOO_MANY_POINTS; + // compute text and target positions + if(rotate) { + targetWidth = scale * textHeight; + targetHeight = scale * textWidth; + } + else { + targetWidth = scale * textWidth; + targetHeight = scale * textHeight; + } -function calc(gd, trace) { - var fullLayout = gd._fullLayout; - var subplotId = trace.subplot; - var radialAxis = fullLayout[subplotId].radialaxis; - var angularAxis = fullLayout[subplotId].angularaxis; - var rArray = radialAxis.makeCalcdata(trace, 'r'); - var thetaArray = angularAxis.makeCalcdata(trace, 'theta'); - var len = trace._length; - var stash = {}; - - if(len < rArray.length) rArray = rArray.slice(0, len); - if(len < thetaArray.length) thetaArray = thetaArray.slice(0, len); - - stash.r = rArray; - stash.theta = thetaArray; - - calcColorscales(trace); - - // only compute 'style' options in calc, as position options - // depend on the radial range and must be set in plot - var opts = stash.opts = convert.style(gd, trace); - - // For graphs with very large number of points and array marker.size, - // use average marker size instead to speed things up. - var ppad; - if(len < TOO_MANY_POINTS) { - ppad = calcMarkerSize(trace, len); - } else if(opts.marker) { - ppad = 2 * (opts.marker.sizeAvg || Math.max(opts.marker.size, 3)); - } - trace._extremes.x = Axes.findExtremes(radialAxis, rArray, {ppad: ppad}); - - return [{x: false, y: false, t: stash, trace: trace}]; -} - -function plot(gd, subplot, cdata) { - if(!cdata.length) return; - - var radialAxis = subplot.radialAxis; - var angularAxis = subplot.angularAxis; - var scene = ScatterGl.sceneUpdate(gd, subplot); - - cdata.forEach(function(cdscatter) { - if(!cdscatter || !cdscatter[0] || !cdscatter[0].trace) return; - var cd = cdscatter[0]; - var trace = cd.trace; - var stash = cd.t; - var len = trace._length; - var rArray = stash.r; - var thetaArray = stash.theta; - var opts = stash.opts; - var i; + if(orientation === 'h') { + if(x1 < x0) { + // bar end is on the left hand side + targetX = x1 + textpad + targetWidth / 2; + targetY = (y0 + y1) / 2; + } + else { + targetX = x1 - textpad - targetWidth / 2; + targetY = (y0 + y1) / 2; + } + } + else { + if(y1 > y0) { + // bar end is on the bottom + targetX = (x0 + x1) / 2; + targetY = y1 - textpad - targetHeight / 2; + } + else { + targetX = (x0 + x1) / 2; + targetY = y1 + textpad + targetHeight / 2; + } + } - var subRArray = rArray.slice(); - var subThetaArray = thetaArray.slice(); + return getTransform(textX, textY, targetX, targetY, scale, rotate); +} - // filter out by range - for(i = 0; i < rArray.length; i++) { - if(!subplot.isPtInside({r: rArray[i], theta: thetaArray[i]})) { - subRArray[i] = NaN; - subThetaArray[i] = NaN; - } - } +function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation, constrained) { + var barWidth = (orientation === 'h') ? + Math.abs(y1 - y0) : + Math.abs(x1 - x0); + var textpad; - var positions = new Array(len * 2); - var x = Array(len); - var y = Array(len); + // Keep the padding so the text doesn't sit right against + // the bars, but don't factor it into barWidth + if(barWidth > 2 * TEXTPAD) { + textpad = TEXTPAD; + } - for(i = 0; i < len; i++) { - var r = subRArray[i]; - var xx, yy; + // compute rotation and scale + var scale = 1; + if(constrained) { + scale = (orientation === 'h') ? + Math.min(1, barWidth / textBB.height) : + Math.min(1, barWidth / textBB.width); + } - if(isNumeric(r)) { - var rg = radialAxis.c2g(r); - var thetag = angularAxis.c2g(subThetaArray[i], trace.thetaunit); - xx = rg * Math.cos(thetag); - yy = rg * Math.sin(thetag); - } else { - xx = yy = NaN; - } - x[i] = positions[i * 2] = xx; - y[i] = positions[i * 2 + 1] = yy; - } + // compute text and target positions + var textX = (textBB.left + textBB.right) / 2; + var textY = (textBB.top + textBB.bottom) / 2; + var targetWidth; + var targetHeight; + var targetX; + var targetY; - stash.tree = cluster(positions); + targetWidth = scale * textBB.width; + targetHeight = scale * textBB.height; - // FIXME: see scattergl.js#109 - if(opts.marker && len >= TOO_MANY_POINTS) { - opts.marker.cluster = stash.tree; + if(orientation === 'h') { + if(x1 < x0) { + // bar end is on the left hand side + targetX = x1 - textpad - targetWidth / 2; + targetY = (y0 + y1) / 2; } - - if(opts.marker) { - opts.markerSel.positions = opts.markerUnsel.positions = opts.marker.positions = positions; + else { + targetX = x1 + textpad + targetWidth / 2; + targetY = (y0 + y1) / 2; } - - if(opts.line && positions.length > 1) { - Lib.extendFlat( - opts.line, - convert.linePositions(gd, trace, positions) - ); + } + else { + if(y1 > y0) { + // bar end is on the bottom + targetX = (x0 + x1) / 2; + targetY = y1 + textpad + targetHeight / 2; } - - if(opts.text) { - Lib.extendFlat( - opts.text, - {positions: positions}, - convert.textPosition(gd, trace, opts.text, opts.marker) - ); - Lib.extendFlat( - opts.textSel, - {positions: positions}, - convert.textPosition(gd, trace, opts.text, opts.markerSel) - ); - Lib.extendFlat( - opts.textUnsel, - {positions: positions}, - convert.textPosition(gd, trace, opts.text, opts.markerUnsel) - ); + else { + targetX = (x0 + x1) / 2; + targetY = y1 - textpad - targetHeight / 2; } + } - if(opts.fill && !scene.fill2d) scene.fill2d = true; - if(opts.marker && !scene.scatter2d) scene.scatter2d = true; - if(opts.line && !scene.line2d) scene.line2d = true; - if(opts.text && !scene.glText) scene.glText = true; - - scene.lineOptions.push(opts.line); - scene.fillOptions.push(opts.fill); - scene.markerOptions.push(opts.marker); - scene.markerSelectedOptions.push(opts.markerSel); - scene.markerUnselectedOptions.push(opts.markerUnsel); - scene.textOptions.push(opts.text); - scene.textSelectedOptions.push(opts.textSel); - scene.textUnselectedOptions.push(opts.textUnsel); - - stash.x = x; - stash.y = y; - stash.rawx = x; - stash.rawy = y; - stash.r = rArray; - stash.theta = thetaArray; - stash.positions = positions; - stash._scene = scene; - stash.index = scene.count; - scene.count++; - }); - - return ScatterGl.plot(gd, subplot, cdata); + return getTransform(textX, textY, targetX, targetY, scale, false); } -function hoverPoints(pointData, xval, yval, hovermode) { - var cd = pointData.cd; - var stash = cd[0].t; - var rArray = stash.r; - var thetaArray = stash.theta; - - var scatterPointData = ScatterGl.hoverPoints(pointData, xval, yval, hovermode); - if(!scatterPointData || scatterPointData[0].index === false) return; - - var newPointData = scatterPointData[0]; +function getTransform(textX, textY, targetX, targetY, scale, rotate) { + var transformScale; + var transformRotate; + var transformTranslate; - if(newPointData.index === undefined) { - return scatterPointData; + if(scale < 1) transformScale = 'scale(' + scale + ') '; + else { + scale = 1; + transformScale = ''; } - var subplot = pointData.subplot; - var cdi = newPointData.cd[newPointData.index]; - var trace = newPointData.trace; - - // augment pointData with r/theta param - cdi.r = rArray[newPointData.index]; - cdi.theta = thetaArray[newPointData.index]; - - if(!subplot.isPtInside(cdi)) return; + transformRotate = (rotate) ? + 'rotate(' + rotate + ' ' + textX + ' ' + textY + ') ' : ''; - newPointData.xLabelVal = undefined; - newPointData.yLabelVal = undefined; - makeHoverPointText(cdi, trace, subplot, newPointData); + // Note that scaling also affects the center of the text box + var translateX = (targetX - scale * textX); + var translateY = (targetY - scale * textY); + transformTranslate = 'translate(' + translateX + ' ' + translateY + ')'; - return scatterPointData; + return transformTranslate + transformScale + transformRotate; } -module.exports = { - moduleType: 'trace', - name: 'scatterpolargl', - basePlotModule: _dereq_('../../plots/polar'), - categories: ['gl', 'regl', 'polar', 'symbols', 'showLegend', 'scatter-like'], - - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults'), - colorbar: _dereq_('../scatter/marker_colorbar'), - - calc: calc, - plot: plot, - hoverPoints: hoverPoints, - selectPoints: ScatterGl.selectPoints, +function getText(trace, index) { + var value = helpers.getValue(trace.text, index); + return helpers.coerceString(attributeText, value); +} - meta: { - - - } -}; +function getTextPosition(trace, index) { + var value = helpers.getValue(trace.textposition, index); + return helpers.coerceEnumerated(attributeTextPosition, value); +} -},{"../../lib":696,"../../plots/cartesian/axes":744,"../../plots/polar":811,"../scatter/calc":1044,"../scatter/colorscale_calc":1046,"../scatter/marker_colorbar":1061,"../scattergl":1096,"../scattergl/constants":1093,"../scattergl/convert":1094,"../scatterpolar/hover":1108,"./attributes":1111,"./defaults":1112,"fast-isnumeric":214,"point-cluster":452}],1114:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/drawing":64,"../../lib":159,"../../lib/svg_text_utils":180,"../../registry":243,"./attributes":253,"./helpers":258,"./style":266,"d3":8,"fast-isnumeric":10}],264:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170557,183 +67137,150 @@ 'use strict'; -var scatterAttrs = _dereq_('../scatter/attributes'); -var plotAttrs = _dereq_('../../plots/attributes'); -var colorAttributes = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var dash = _dereq_('../../components/drawing/attributes').dash; - -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var scatterMarkerAttrs = scatterAttrs.marker, - scatterLineAttrs = scatterAttrs.line, - scatterMarkerLineAttrs = scatterMarkerAttrs.line; - -module.exports = { - a: { - valType: 'data_array', - editType: 'calc', - - }, - b: { - valType: 'data_array', - editType: 'calc', - - }, - c: { - valType: 'data_array', - editType: 'calc', - - }, - sum: { - valType: 'number', - - dflt: 0, - min: 0, - editType: 'calc', - - }, - mode: extendFlat({}, scatterAttrs.mode, {dflt: 'markers'}), - text: extendFlat({}, scatterAttrs.text, { - - }), - hovertext: extendFlat({}, scatterAttrs.hovertext, { - - }), - line: { - color: scatterLineAttrs.color, - width: scatterLineAttrs.width, - dash: dash, - shape: extendFlat({}, scatterLineAttrs.shape, - {values: ['linear', 'spline']}), - smoothing: scatterLineAttrs.smoothing, - editType: 'calc' - }, - connectgaps: scatterAttrs.connectgaps, - cliponaxis: scatterAttrs.cliponaxis, - fill: extendFlat({}, scatterAttrs.fill, { - values: ['none', 'toself', 'tonext'], - dflt: 'none', - - }), - fillcolor: scatterAttrs.fillcolor, - marker: extendFlat({ - symbol: scatterMarkerAttrs.symbol, - opacity: scatterMarkerAttrs.opacity, - maxdisplayed: scatterMarkerAttrs.maxdisplayed, - size: scatterMarkerAttrs.size, - sizeref: scatterMarkerAttrs.sizeref, - sizemin: scatterMarkerAttrs.sizemin, - sizemode: scatterMarkerAttrs.sizemode, - line: extendFlat({ - width: scatterMarkerLineAttrs.width, - editType: 'calc' - }, - colorAttributes('marker.line') - ), - gradient: scatterMarkerAttrs.gradient, - editType: 'calc' - }, colorAttributes('marker'), { - colorbar: colorbarAttrs - }), +module.exports = function selectPoints(searchInfo, selectionTester) { + var cd = searchInfo.cd; + var xa = searchInfo.xaxis; + var ya = searchInfo.yaxis; + var selection = []; + var i; - textfont: scatterAttrs.textfont, - textposition: scatterAttrs.textposition, + if(selectionTester === false) { + // clear selection + for(i = 0; i < cd.length; i++) { + cd[i].selected = 0; + } + } else { + for(i = 0; i < cd.length; i++) { + var di = cd[i]; - selected: scatterAttrs.selected, - unselected: scatterAttrs.unselected, + if(selectionTester.contains(di.ct, false, i, searchInfo)) { + selection.push({ + pointNumber: i, + x: xa.c2d(di.x), + y: ya.c2d(di.y) + }); + di.selected = 1; + } else { + di.selected = 0; + } + } + } - hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['a', 'b', 'c', 'text', 'name'] - }), - hoveron: scatterAttrs.hoveron, + return selection; }; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../components/drawing/attributes":594,"../../lib/extend":685,"../../plots/attributes":741,"../scatter/attributes":1043}],1115:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var isNumeric = _dereq_('fast-isnumeric'); - -var calcColorscale = _dereq_('../scatter/colorscale_calc'); -var arraysToCalcdata = _dereq_('../scatter/arrays_to_calcdata'); -var calcSelection = _dereq_('../scatter/calc_selection'); -var calcMarkerSize = _dereq_('../scatter/calc').calcMarkerSize; - -var dataArrays = ['a', 'b', 'c']; -var arraysToFill = {a: ['b', 'c'], b: ['a', 'c'], c: ['a', 'b']}; +module.exports = Sieve; -module.exports = function calc(gd, trace) { - var ternary = gd._fullLayout[trace.subplot]; - var displaySum = ternary.sum; - var normSum = trace.sum || displaySum; - var arrays = {a: trace.a, b: trace.b, c: trace.c}; +var Lib = _dereq_('../../lib'); +var BADNUM = _dereq_('../../constants/numerical').BADNUM; - var i, j, dataArray, newArray, fillArray1, fillArray2; +/** + * Helper class to sieve data from traces into bins + * + * @class + * @param {Array} traces + * Array of calculated traces + * @param {boolean} [separateNegativeValues] + * If true, then split data at the same position into a bar + * for positive values and another for negative values + * @param {boolean} [dontMergeOverlappingData] + * If true, then don't merge overlapping bars into a single bar + */ +function Sieve(traces, separateNegativeValues, dontMergeOverlappingData) { + this.traces = traces; + this.separateNegativeValues = separateNegativeValues; + this.dontMergeOverlappingData = dontMergeOverlappingData; - // fill in one missing component - for(i = 0; i < dataArrays.length; i++) { - dataArray = dataArrays[i]; - if(arrays[dataArray]) continue; + // for single-bin histograms - see histogram/calc + var width1 = Infinity; - fillArray1 = arrays[arraysToFill[dataArray][0]]; - fillArray2 = arrays[arraysToFill[dataArray][1]]; - newArray = new Array(fillArray1.length); - for(j = 0; j < fillArray1.length; j++) { - newArray[j] = normSum - fillArray1[j] - fillArray2[j]; + 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]; + if(bar.p !== BADNUM) positions.push(bar.p); } - arrays[dataArray] = newArray; - } - - // make the calcdata array - var serieslen = trace._length; - var cd = new Array(serieslen); - var a, b, c, norm, x, y; - for(i = 0; i < serieslen; i++) { - a = arrays.a[i]; - b = arrays.b[i]; - c = arrays.c[i]; - if(isNumeric(a) && isNumeric(b) && isNumeric(c)) { - a = +a; - b = +b; - c = +c; - norm = displaySum / (a + b + c); - if(norm !== 1) { - a *= norm; - b *= norm; - c *= norm; - } - // map a, b, c onto x and y where the full scale of y - // is [0, sum], and x is [-sum, sum] - // TODO: this makes `a` always the top, `b` the bottom left, - // and `c` the bottom right. Do we want options to rearrange - // these? - y = a; - x = c - b; - cd[i] = {x: x, y: y, a: a, b: b, c: c}; + if(trace[0] && trace[0].width1) { + width1 = Math.min(trace[0].width1, width1); } - else cd[i] = {x: false, y: false}; } + this.positions = positions; - calcMarkerSize(trace, serieslen); - calcColorscale(trace); - arraysToCalcdata(cd, trace); - calcSelection(cd, trace); + var dv = Lib.distinctVals(positions); + this.distinctPositions = dv.vals; + if(dv.vals.length === 1 && width1 !== Infinity) this.minDiff = width1; + else this.minDiff = Math.min(dv.minDiff, width1); - return cd; + this.binWidth = this.minDiff; + + this.bins = {}; +} + +/** + * Sieve datum + * + * @method + * @param {number} position + * @param {number} value + * @returns {number} Previous bin value + */ +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; +}; + +/** + * Get current bin value for a given datum + * + * @method + * @param {number} position Position of datum + * @param {number} [value] Value of datum + * (required if this.separateNegativeValues is true) + * @returns {number} Current bin value + */ +Sieve.prototype.get = function put(position, value) { + var label = this.getLabel(position, value); + return this.bins[label] || 0; +}; + +/** + * Get bin label for a given datum + * + * @method + * @param {number} position Position of datum + * @param {number} [value] Value of datum + * (required if this.separateNegativeValues is true) + * @returns {string} Bin label + * (prefixed with a 'v' if value is negative and this.separateNegativeValues is + * true; otherwise prefixed with '^') + */ +Sieve.prototype.getLabel = function getLabel(position, value) { + var prefix = (value < 0 && this.separateNegativeValues) ? 'v' : '^'; + var label = (this.dontMergeOverlappingData) ? + position : + Math.round(position / this.binWidth); + return prefix + label; }; -},{"../scatter/arrays_to_calcdata":1042,"../scatter/calc":1044,"../scatter/calc_selection":1045,"../scatter/colorscale_calc":1046,"fast-isnumeric":214}],1116:[function(_dereq_,module,exports){ +},{"../../constants/numerical":140,"../../lib":159}],266:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170743,273 +67290,209 @@ 'use strict'; +var d3 = _dereq_('d3'); +var Color = _dereq_('../../components/color'); +var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); - -var constants = _dereq_('../scatter/constants'); -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var handleLineDefaults = _dereq_('../scatter/line_defaults'); -var handleLineShapeDefaults = _dereq_('../scatter/line_shape_defaults'); -var handleTextDefaults = _dereq_('../scatter/text_defaults'); -var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); +var Registry = _dereq_('../../registry'); var attributes = _dereq_('./attributes'); +var attributeTextFont = attributes.textfont; +var attributeInsideTextFont = attributes.insidetextfont; +var attributeOutsideTextFont = attributes.outsidetextfont; +var helpers = _dereq_('./helpers'); +function style(gd, cd) { + var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.bars'); + var barcount = s.size(); + var fullLayout = gd._fullLayout; -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } + // trace styling + s.style('opacity', function(d) { return d[0].trace.opacity; }) - var a = coerce('a'), - b = coerce('b'), - c = coerce('c'), - len; - - // allow any one array to be missing, len is the minimum length of those - // present. Note that after coerce data_array's are either Arrays (which - // are truthy even if empty) or undefined. As in scatter, an empty array - // is different from undefined, because it can signify that this data is - // not known yet but expected in the future - if(a) { - len = a.length; - if(b) { - len = Math.min(len, b.length); - if(c) len = Math.min(len, c.length); + // for gapless (either stacked or neighboring grouped) bars use + // crispEdges to turn off antialiasing so an artificial gap + // isn't introduced. + .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'); } - else if(c) len = Math.min(len, c.length); - else len = 0; - } - else if(b && c) { - len = Math.min(b.length, c.length); - } - - if(!len) { - traceOut.visible = false; - return; - } - - traceOut._length = len; - - coerce('sum'); - - coerce('text'); - coerce('hovertext'); - - var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; - coerce('mode', defaultMode); - - if(subTypes.hasLines(traceOut)) { - handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); - handleLineShapeDefaults(traceIn, traceOut, coerce); - coerce('connectgaps'); - } - - if(subTypes.hasMarkers(traceOut)) { - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true}); - } - - if(subTypes.hasText(traceOut)) { - handleTextDefaults(traceIn, traceOut, layout, coerce); - } - - var dfltHoverOn = []; - - if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) { - coerce('cliponaxis'); - coerce('marker.maxdisplayed'); - dfltHoverOn.push('points'); - } - - coerce('fill'); - if(traceOut.fill !== 'none') { - handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); - if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); - } + }); - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { - dfltHoverOn.push('fills'); - } - coerce('hoveron', dfltHoverOn.join('+') || 'points'); + s.selectAll('g.points').each(function(d) { + var sel = d3.select(this); + var trace = d[0].trace; + stylePoints(sel, trace, gd); + }); - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); -}; + Registry.getComponentMethod('errorbars', 'style')(s); +} -},{"../../lib":696,"../scatter/constants":1047,"../scatter/fillcolor_defaults":1052,"../scatter/line_defaults":1056,"../scatter/line_shape_defaults":1058,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"../scatter/text_defaults":1068,"./attributes":1114}],1117:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function stylePoints(sel, trace, gd) { + var pts = sel.selectAll('path'); + var txs = sel.selectAll('text'); -'use strict'; + Drawing.pointStyle(pts, trace, gd); -module.exports = function eventData(out, pt, trace, cd, pointNumber) { - if(pt.xa) out.xaxis = pt.xa; - if(pt.ya) out.yaxis = pt.ya; + txs.each(function(d) { + var tx = d3.select(this); + var font = determineFont(tx, d, trace, gd); + Drawing.font(tx, font); + }); +} - if(cd[pointNumber]) { - var cdi = cd[pointNumber]; +function styleOnSelect(gd, cd) { + var s = cd[0].node3; + var trace = cd[0].trace; - // N.B. These are the normalized coordinates. - out.a = cdi.a; - out.b = cdi.b; - out.c = cdi.c; + if(trace.selectedpoints) { + stylePointsInSelectionMode(s, trace, gd); } else { - // for fill-hover only - out.a = pt.a; - out.b = pt.b; - out.c = pt.c; + stylePoints(s, trace, gd); } +} - return out; -}; - -},{}],1118:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - +function stylePointsInSelectionMode(s, trace, gd) { + Drawing.selectedPointStyle(s.selectAll('path'), trace); + styleTextInSelectionMode(s.selectAll('text'), trace, gd); +} -'use strict'; +function styleTextInSelectionMode(txs, trace, gd) { + txs.each(function(d) { + var tx = d3.select(this); + var font; -var scatterHover = _dereq_('../scatter/hover'); -var Axes = _dereq_('../../plots/cartesian/axes'); + if(d.selected) { + font = Lib.extendFlat({}, determineFont(tx, d, trace, gd)); + var selectedFontColor = trace.selected.textfont && trace.selected.textfont.color; + if(selectedFontColor) { + font.color = selectedFontColor; + } -module.exports = function hoverPoints(pointData, xval, yval, hovermode) { - var scatterPointData = scatterHover(pointData, xval, yval, hovermode); - if(!scatterPointData || scatterPointData[0].index === false) return; + Drawing.font(tx, font); + } else { + Drawing.selectedTextStyle(tx, trace); + } + }); +} - var newPointData = scatterPointData[0]; +function determineFont(tx, d, trace, gd) { + var layoutFont = gd._fullLayout.font; + var textFont = trace.textfont; - // if hovering on a fill, we don't show any point data so the label is - // unchanged from what scatter gives us - except that it needs to - // be constrained to the trianglular plot area, not just the rectangular - // area defined by the synthetic x and y axes - // TODO: in some cases the vertical middle of the shape is not within - // the triangular viewport at all, so the label can become disconnected - // from the shape entirely. But calculating what portion of the shape - // is actually visible, as constrained by the diagonal axis lines, is not - // so easy and anyway we lost the information we would have needed to do - // this inside scatterHover. - if(newPointData.index === undefined) { - var yFracUp = 1 - (newPointData.y0 / pointData.ya._length), - xLen = pointData.xa._length, - xMin = xLen * yFracUp / 2, - xMax = xLen - xMin; - newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin); - newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin); - return scatterPointData; + 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); } - var cdi = newPointData.cd[newPointData.index]; - - newPointData.a = cdi.a; - newPointData.b = cdi.b; - newPointData.c = cdi.c; + return textFont; +} - newPointData.xLabelVal = undefined; - newPointData.yLabelVal = undefined; - // TODO: nice formatting, and label by axis title, for a, b, and c? +function getTextFont(trace, index, defaultValue) { + return getFontValue( + attributeTextFont, trace.textfont, index, defaultValue); +} - var trace = newPointData.trace; - var ternary = newPointData.subplot; - var hoverinfo = cdi.hi || trace.hoverinfo; - var parts = hoverinfo.split('+'); - var text = []; +function getInsideTextFont(trace, index, layoutFont, barColor) { + var defaultFont = getTextFont(trace, index, layoutFont); - function textPart(ax, val) { - text.push(ax._hovertitle + ': ' + Axes.tickText(ax, val, 'hover').text); + var wouldFallBackToLayoutFont = + (trace._input.textfont === undefined || trace._input.textfont.color === undefined) || + (Array.isArray(trace.textfont.color) && trace.textfont.color[index] === undefined); + if(wouldFallBackToLayoutFont) { + defaultFont = { + color: Color.contrast(barColor), + family: defaultFont.family, + size: defaultFont.size + }; } - if(parts.indexOf('all') !== -1) parts = ['a', 'b', 'c']; - if(parts.indexOf('a') !== -1) textPart(ternary.aaxis, cdi.a); - if(parts.indexOf('b') !== -1) textPart(ternary.baxis, cdi.b); - if(parts.indexOf('c') !== -1) textPart(ternary.caxis, cdi.c); - - newPointData.extraText = text.join('
'); + return getFontValue( + attributeInsideTextFont, trace.insidetextfont, index, defaultFont); +} - return scatterPointData; -}; +function getOutsideTextFont(trace, index, layoutFont) { + var defaultFont = getTextFont(trace, index, layoutFont); + return getFontValue( + attributeOutsideTextFont, trace.outsidetextfont, index, defaultFont); +} -},{"../../plots/cartesian/axes":744,"../scatter/hover":1054}],1119:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function getFontValue(attributeDefinition, attributeValue, index, defaultValue) { + attributeValue = attributeValue || {}; -'use strict'; + var familyValue = helpers.getValue(attributeValue.family, index); + var sizeValue = helpers.getValue(attributeValue.size, index); + var colorValue = helpers.getValue(attributeValue.color, index); -var ScatterTernary = {}; + 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) + }; +} -ScatterTernary.attributes = _dereq_('./attributes'); -ScatterTernary.supplyDefaults = _dereq_('./defaults'); -ScatterTernary.colorbar = _dereq_('../scatter/marker_colorbar'); -ScatterTernary.calc = _dereq_('./calc'); -ScatterTernary.plot = _dereq_('./plot'); -ScatterTernary.style = _dereq_('../scatter/style').style; -ScatterTernary.styleOnSelect = _dereq_('../scatter/style').styleOnSelect; -ScatterTernary.hoverPoints = _dereq_('./hover'); -ScatterTernary.selectPoints = _dereq_('../scatter/select'); -ScatterTernary.eventData = _dereq_('./event_data'); +function getBarColor(cd, trace) { + return cd.mc || trace.marker.color; +} -ScatterTernary.moduleType = 'trace'; -ScatterTernary.name = 'scatterternary'; -ScatterTernary.basePlotModule = _dereq_('../../plots/ternary'); -ScatterTernary.categories = ['ternary', 'symbols', 'showLegend', 'scatter-like']; -ScatterTernary.meta = { - - +module.exports = { + style: style, + styleOnSelect: styleOnSelect, + getInsideTextFont: getInsideTextFont, + getOutsideTextFont: getOutsideTextFont, + getBarColor: getBarColor }; -module.exports = ScatterTernary; - -},{"../../plots/ternary":823,"../scatter/marker_colorbar":1061,"../scatter/select":1064,"../scatter/style":1066,"./attributes":1114,"./calc":1115,"./defaults":1116,"./event_data":1117,"./hover":1118,"./plot":1120}],1120:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/drawing":64,"../../lib":159,"../../registry":243,"./attributes":253,"./helpers":258,"d3":8}],267:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var scatterPlot = _dereq_('../scatter/plot'); +var Color = _dereq_('../../components/color'); +var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; +var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -module.exports = function plot(gd, ternary, moduleCalcData) { - var plotContainer = ternary.plotContainer; +module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout) { + coerce('marker.color', defaultColor); - // remove all nodes inside the scatter layer - plotContainer.select('.scatterlayer').selectAll('*').remove(); + if(hasColorscale(traceIn, 'marker')) { + colorscaleDefaults( + traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'} + ); + } - // mimic cartesian plotinfo - var plotinfo = { - xaxis: ternary.xaxis, - yaxis: ternary.yaxis, - plot: plotContainer, - layerClipId: ternary._hasClipOnAxisFalse ? ternary.clipIdRelative : null - }; + coerce('marker.line.color', Color.defaultLine); - var scatterLayer = ternary.layers.frontplot.select('g.scatterlayer'); + if(hasColorscale(traceIn, 'marker.line')) { + colorscaleDefaults( + traceIn, traceOut, layout, coerce, {prefix: 'marker.line.', cLetter: 'c'} + ); + } - scatterPlot(gd, plotinfo, moduleCalcData, scatterLayer); + coerce('marker.line.width'); + coerce('marker.opacity'); + coerce('selected.marker.color'); + coerce('unselected.marker.color'); }; -},{"../scatter/plot":1063}],1121:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/colorscale/defaults":53,"../../components/colorscale/helpers":54}],268:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171018,150 +67501,250 @@ 'use strict'; -var scatterAttrs = _dereq_('../scatter/attributes'); -var colorAttrs = _dereq_('../../components/colorscale/attributes'); -var scatterGlAttrs = _dereq_('../scattergl/attributes'); -var cartesianIdRegex = _dereq_('../../plots/cartesian/constants').idRegex; -var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -var scatterMarkerAttrs = scatterAttrs.marker; -var scatterMarkerLineAttrs = scatterMarkerAttrs.line; +var colorAttrs = _dereq_('../../components/color/attributes'); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var plotAttrs = _dereq_('../../plots/attributes'); +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); +var domainAttrs = _dereq_('../../plots/domain').attributes; -var markerLineAttrs = extendFlat(colorAttrs('marker.line', {editTypeOverride: 'calc'}), { - width: extendFlat({}, scatterMarkerLineAttrs.width, {editType: 'calc'}), - editType: 'calc' -}); +var extendFlat = _dereq_('../../lib/extend').extendFlat; -var markerAttrs = extendFlat(colorAttrs('marker'), { - symbol: scatterMarkerAttrs.symbol, - size: extendFlat({}, scatterMarkerAttrs.size, {editType: 'markerSize'}), - sizeref: scatterMarkerAttrs.sizeref, - sizemin: scatterMarkerAttrs.sizemin, - sizemode: scatterMarkerAttrs.sizemode, - opacity: scatterMarkerAttrs.opacity, - colorbar: scatterMarkerAttrs.colorbar, - line: markerLineAttrs, - editType: 'calc' +var textFontAttrs = fontAttrs({ + editType: 'calc', + arrayOk: true, + colorEditType: 'plot', + }); -markerAttrs.color.editType = markerAttrs.cmin.editType = markerAttrs.cmax.editType = 'style'; - -function makeAxesValObject(axLetter) { - return { - valType: 'info_array', - freeLength: true, +module.exports = { + labels: { + valType: 'data_array', + editType: 'calc', + + }, + // equivalent of x0 and dx, if label is missing + label0: { + valType: 'number', + + dflt: 0, + editType: 'calc', + + }, + dlabel: { + valType: 'number', + dflt: 1, editType: 'calc', - items: { - valType: 'subplotid', - regex: cartesianIdRegex[axLetter], - editType: 'plot' - }, - }; -} + }, -module.exports = { - dimensions: templatedArray('dimension', { - visible: { - valType: 'boolean', - - dflt: true, - editType: 'calc', - - }, - label: { - valType: 'string', - + values: { + valType: 'data_array', + editType: 'calc', + + }, + + marker: { + colors: { + valType: 'data_array', // TODO 'color_array' ? editType: 'calc', }, - values: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, - axis: { - type: { - valType: 'enumerated', - values: ['linear', 'log', 'date', 'category'], + line: { + color: { + valType: 'color', - editType: 'calc+clearAxisTypes', + dflt: colorAttrs.defaultLine, + arrayOk: true, + editType: 'style', }, - - editType: 'calc+clearAxisTypes' + width: { + valType: 'number', + + min: 0, + dflt: 0, + arrayOk: true, + editType: 'style', + + }, + editType: 'calc' }, + editType: 'calc' + }, - // TODO should add an attribute to pin down x only vars and y only vars - // like https://seaborn.pydata.org/generated/seaborn.pairplot.html - // x_vars and y_vars + text: { + valType: 'data_array', + editType: 'calc', + + }, + hovertext: { + valType: 'string', + + dflt: '', + arrayOk: true, + editType: 'style', + + }, - // maybe more axis defaulting option e.g. `showgrid: false` +// 'see eg:' +// 'https://www.e-education.psu.edu/natureofgeoinfo/sites/www.e-education.psu.edu.natureofgeoinfo/files/image/hisp_pies.gif', +// '(this example involves a map too - may someday be a whole trace type', +// 'of its own. but the point is the size of the whole pie is important.)' + scalegroup: { + valType: 'string', + + dflt: '', + editType: 'calc', + + }, - editType: 'calc+clearAxisTypes' + // labels (legend is handled by plots.attributes.showlegend and layout.hiddenlabels) + textinfo: { + valType: 'flaglist', + + flags: ['label', 'text', 'value', 'percent'], + extras: ['none'], + editType: 'calc', + + }, + hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { + flags: ['label', 'text', 'value', 'percent', 'name'] }), - - // mode: {}, (only 'markers' for now) - - text: extendFlat({}, scatterGlAttrs.text, { + hovertemplate: hovertemplateAttrs({}, { + keys: ['label', 'color', 'value', 'percent', 'text'] + }), + textposition: { + valType: 'enumerated', + + values: ['inside', 'outside', 'auto', 'none'], + dflt: 'auto', + arrayOk: true, + editType: 'calc', + + }, + textfont: extendFlat({}, textFontAttrs, { + + }), + insidetextfont: extendFlat({}, textFontAttrs, { + + }), + outsidetextfont: extendFlat({}, textFontAttrs, { }), - marker: markerAttrs, - - xaxes: makeAxesValObject('x'), - yaxes: makeAxesValObject('y'), - - diagonal: { - visible: { - valType: 'boolean', + title: { + text: { + valType: 'string', + dflt: '', + + editType: 'calc', + + }, + font: extendFlat({}, textFontAttrs, { + + }), + position: { + valType: 'enumerated', + values: [ + 'top left', 'top center', 'top right', + 'middle center', + 'bottom left', 'bottom center', 'bottom right' + ], - dflt: true, editType: 'calc', }, - - // type: 'scattergl' | 'histogram' | 'box' | 'violin' - // ... - // more options editType: 'calc' }, - showupperhalf: { - valType: 'boolean', + // position and shape + domain: domainAttrs({name: 'pie', trace: true, editType: 'calc'}), + + hole: { + valType: 'number', - dflt: true, + min: 0, + max: 1, + dflt: 0, editType: 'calc', }, - showlowerhalf: { + + // ordering and direction + sort: { valType: 'boolean', dflt: true, editType: 'calc', }, - - selected: { - marker: scatterGlAttrs.selected.marker, - editType: 'calc' + direction: { + /** + * there are two common conventions, both of which place the first + * (largest, if sorted) slice with its left edge at 12 o'clock but + * succeeding slices follow either cw or ccw from there. + * + * see http://visage.co/data-visualization-101-pie-charts/ + */ + valType: 'enumerated', + values: ['clockwise', 'counterclockwise'], + + dflt: 'counterclockwise', + editType: 'calc', + }, - unselected: { - marker: scatterGlAttrs.unselected.marker, - editType: 'calc' + rotation: { + valType: 'number', + + min: -360, + max: 360, + dflt: 0, + editType: 'calc', + + }, + + pull: { + valType: 'number', + + min: 0, + max: 1, + dflt: 0, + arrayOk: true, + editType: 'calc', + }, - opacity: scatterGlAttrs.opacity + _deprecated: { + title: { + valType: 'string', + dflt: '', + + editType: 'calc', + + }, + titlefont: extendFlat({}, textFontAttrs, { + + }), + titleposition: { + valType: 'enumerated', + values: [ + 'top left', 'top center', 'top right', + 'middle center', + 'bottom left', 'bottom center', 'bottom right' + ], + + editType: 'calc', + + } + } }; -},{"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plot_api/plot_template":734,"../../plots/cartesian/constants":750,"../scatter/attributes":1043,"../scattergl/attributes":1092}],1122:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":42,"../../components/fx/hovertemplate_attributes":81,"../../lib/extend":153,"../../plots/attributes":200,"../../plots/domain":229,"../../plots/font_attributes":230}],269:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171170,241 +67753,221 @@ 'use strict'; -var createLine = _dereq_('regl-line2d'); - var Registry = _dereq_('../../registry'); -var prepareRegl = _dereq_('../../lib/prepare_regl'); var getModuleCalcData = _dereq_('../../plots/get_data').getModuleCalcData; -var Cartesian = _dereq_('../../plots/cartesian'); -var getFromId = _dereq_('../../plots/cartesian/axis_ids').getFromId; -var shouldShowZeroLine = _dereq_('../../plots/cartesian/axes').shouldShowZeroLine; -var SPLOM = 'splom'; +exports.name = 'pie'; -function plot(gd) { - var fullLayout = gd._fullLayout; - var _module = Registry.getModule(SPLOM); - var splomCalcData = getModuleCalcData(gd.calcdata, _module)[0]; +exports.plot = function(gd) { + var Pie = Registry.getModule('pie'); + var cdPie = getModuleCalcData(gd.calcdata, Pie)[0]; + + if(cdPie.length) Pie.plot(gd, cdPie); +}; - var success = prepareRegl(gd, ['ANGLE_instanced_arrays', 'OES_element_index_uint']); - if(!success) return; +exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { + var hadPie = (oldFullLayout._has && oldFullLayout._has('pie')); + var hasPie = (newFullLayout._has && newFullLayout._has('pie')); - if(fullLayout._hasOnlyLargeSploms) { - updateGrid(gd); + if(hadPie && !hasPie) { + oldFullLayout._pielayer.selectAll('g.trace').remove(); } +}; - _module.plot(gd, {}, splomCalcData); -} +},{"../../plots/get_data":232,"../../registry":243}],270:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -function drag(gd) { - var cd = gd.calcdata; - var fullLayout = gd._fullLayout; +'use strict'; - if(fullLayout._hasOnlyLargeSploms) { - updateGrid(gd); - } +var isNumeric = _dereq_('fast-isnumeric'); +var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; +var tinycolor = _dereq_('tinycolor2'); - for(var i = 0; i < cd.length; i++) { - var cd0 = cd[i][0]; - var trace = cd0.trace; - var scene = fullLayout._splomScenes[trace.uid]; +var Color = _dereq_('../../components/color'); +var helpers = _dereq_('./helpers'); + +exports.calc = function calc(gd, trace) { + var vals = trace.values; + var hasVals = isArrayOrTypedArray(vals) && vals.length; + var labels = trace.labels; + var colors = trace.marker.colors || []; + var cd = []; + var fullLayout = gd._fullLayout; + var colorMap = fullLayout._piecolormap; + var allThisTraceLabels = {}; + var vTotal = 0; + var hiddenLabels = fullLayout.hiddenlabels || []; + + var i, v, label, hidden, pt; - if(trace.type === 'splom' && scene && scene.matrix) { - dragOne(gd, trace, scene); + if(trace.dlabel) { + labels = new Array(vals.length); + for(i = 0; i < vals.length; i++) { + labels[i] = String(trace.label0 + i * trace.dlabel); } } -} - -function dragOne(gd, trace, scene) { - var visibleLength = scene.matrixOptions.data.length; - var visibleDims = trace._visibleDims; - var ranges = scene.viewOpts.ranges = new Array(visibleLength); - for(var k = 0; k < visibleDims.length; k++) { - var i = visibleDims[k]; - var rng = ranges[k] = new Array(4); + function pullColor(color, label) { + if(!color) return false; - var xa = getFromId(gd, trace._diag[i][0]); - if(xa) { - rng[0] = xa.r2l(xa.range[0]); - rng[2] = xa.r2l(xa.range[1]); - } + color = tinycolor(color); + if(!color.isValid()) return false; - var ya = getFromId(gd, trace._diag[i][1]); - if(ya) { - rng[1] = ya.r2l(ya.range[0]); - rng[3] = ya.r2l(ya.range[1]); - } - } + color = Color.addOpacity(color, color.getAlpha()); + if(!colorMap[label]) colorMap[label] = color; - if(scene.selectBatch) { - scene.matrix.update({ranges: ranges}, {ranges: ranges}); - } else { - scene.matrix.update({ranges: ranges}); + return color; } -} -function updateGrid(gd) { - var fullLayout = gd._fullLayout; - var regl = fullLayout._glcanvas.data()[0].regl; - var splomGrid = fullLayout._splomGrid; + var seriesLen = (hasVals ? vals : labels).length; - if(!splomGrid) { - splomGrid = fullLayout._splomGrid = createLine(regl); - } - splomGrid.update(makeGridData(gd)); -} + for(i = 0; i < seriesLen; i++) { + if(hasVals) { + v = vals[i]; + if(!isNumeric(v)) continue; + v = +v; + if(v < 0) continue; + } + else v = 1; -function makeGridData(gd) { - var fullLayout = gd._fullLayout; - var gs = fullLayout._size; - var fullView = [0, 0, fullLayout.width, fullLayout.height]; - var lookup = {}; - var k; + label = labels[i]; + if(label === undefined || label === '') label = i; + label = String(label); - function push(prefix, ax, x0, x1, y0, y1) { - var lcolor = ax[prefix + 'color']; - var lwidth = ax[prefix + 'width']; - var key = String(lcolor + lwidth); + var thisLabelIndex = allThisTraceLabels[label]; + if(thisLabelIndex === undefined) { + allThisTraceLabels[label] = cd.length; - if(key in lookup) { - lookup[key].data.push(NaN, NaN, x0, x1, y0, y1); - } else { - lookup[key] = { - data: [x0, x1, y0, y1], - join: 'rect', - thickness: lwidth, - color: lcolor, - viewport: fullView, - range: fullView, - overlay: false - }; - } - } + hidden = hiddenLabels.indexOf(label) !== -1; - for(k in fullLayout._splomSubplots) { - var sp = fullLayout._plots[k]; - var xa = sp.xaxis; - var ya = sp.yaxis; - var xVals = xa._vals; - var yVals = ya._vals; - // ya.l2p assumes top-to-bottom coordinate system (a la SVG), - // we need to compute bottom-to-top offsets and slopes: - var yOffset = gs.b + ya.domain[0] * gs.h; - var ym = -ya._m; - var yb = -ym * ya.r2l(ya.range[0], ya.calendar); - var x, y; + if(!hidden) vTotal += v; - if(xa.showgrid) { - for(k = 0; k < xVals.length; k++) { - x = xa._offset + xa.l2p(xVals[k].x); - push('grid', xa, x, yOffset, x, yOffset + ya._length); - } + cd.push({ + v: v, + label: label, + color: pullColor(colors[i], label), + i: i, + pts: [i], + hidden: hidden + }); } - if(ya.showgrid) { - for(k = 0; k < yVals.length; k++) { - y = yOffset + yb + ym * yVals[k].x; - push('grid', ya, xa._offset, y, xa._offset + xa._length, y); + else { + pt = cd[thisLabelIndex]; + pt.v += v; + pt.pts.push(i); + if(!pt.hidden) vTotal += v; + + if(pt.color === false && colors[i]) { + pt.color = pullColor(colors[i], label); } } - if(shouldShowZeroLine(gd, xa, ya)) { - x = xa._offset + xa.l2p(0); - push('zeroline', xa, x, yOffset, x, yOffset + ya._length); - } - if(shouldShowZeroLine(gd, ya, xa)) { - y = yOffset + yb + 0; - push('zeroline', ya, xa._offset, y, xa._offset + xa._length, y); - } } - var gridBatches = []; - for(k in lookup) { - gridBatches.push(lookup[k]); - } + if(trace.sort) cd.sort(function(a, b) { return b.v - a.v; }); - return gridBatches; -} + // include the sum of all values in the first point + if(cd[0]) cd[0].vTotal = vTotal; -function clean(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var lookup = {}; - var i; + // now insert text + if(trace.textinfo && trace.textinfo !== 'none') { + var hasLabel = trace.textinfo.indexOf('label') !== -1; + var hasText = trace.textinfo.indexOf('text') !== -1; + var hasValue = trace.textinfo.indexOf('value') !== -1; + var hasPercent = trace.textinfo.indexOf('percent') !== -1; + var separators = fullLayout.separators; - if(oldFullLayout._splomScenes) { - for(i = 0; i < newFullData.length; i++) { - var newTrace = newFullData[i]; - if(newTrace.type === 'splom') { - lookup[newTrace.uid] = 1; - } - } - for(i = 0; i < oldFullData.length; i++) { - var oldTrace = oldFullData[i]; - if(!lookup[oldTrace.uid]) { - var scene = oldFullLayout._splomScenes[oldTrace.uid]; - if(scene && scene.destroy) scene.destroy(); - // must first set scene to null in order to get garbage collected - oldFullLayout._splomScenes[oldTrace.uid] = null; - delete oldFullLayout._splomScenes[oldTrace.uid]; + var thisText; + + for(i = 0; i < cd.length; i++) { + pt = cd[i]; + thisText = hasLabel ? [pt.label] : []; + if(hasText) { + var texti = helpers.getFirstFilled(trace.text, pt.pts); + if(texti) thisText.push(texti); } + if(hasValue) thisText.push(helpers.formatPieValue(pt.v, separators)); + if(hasPercent) thisText.push(helpers.formatPiePercent(pt.v / vTotal, separators)); + pt.text = thisText.join('
'); } } - if(Object.keys(oldFullLayout._splomScenes || {}).length === 0) { - delete oldFullLayout._splomScenes; - } + return cd; +}; + +/* + * `calc` filled in (and collated) explicit colors. + * Now we need to propagate these explicit colors to other traces, + * and fill in default colors. + * This is done after sorting, so we pick defaults + * in the order slices will be displayed + */ +exports.crossTraceCalc = function(gd) { + var fullLayout = gd._fullLayout; + var calcdata = gd.calcdata; + var pieColorWay = fullLayout.piecolorway; + var colorMap = fullLayout._piecolormap; - if(oldFullLayout._splomGrid && - (!newFullLayout._hasOnlyLargeSploms && oldFullLayout._hasOnlyLargeSploms)) { - // must first set scene to null in order to get garbage collected - oldFullLayout._splomGrid.destroy(); - oldFullLayout._splomGrid = null; - delete oldFullLayout._splomGrid; + if(fullLayout.extendpiecolors) { + pieColorWay = generateExtendedColors(pieColorWay); } + var dfltColorCount = 0; - Cartesian.clean(newFullData, newFullLayout, oldFullData, oldFullLayout); -} + var i, j, cd, pt; + for(i = 0; i < calcdata.length; i++) { + cd = calcdata[i]; + if(cd[0].trace.type !== 'pie') continue; -function updateFx(gd) { - Cartesian.updateFx(gd); + for(j = 0; j < cd.length; j++) { + pt = cd[j]; + if(pt.color === false) { + // have we seen this label and assigned a color to it in a previous trace? + if(colorMap[pt.label]) { + pt.color = colorMap[pt.label]; + } + else { + colorMap[pt.label] = pt.color = pieColorWay[dfltColorCount % pieColorWay.length]; + dfltColorCount++; + } + } + } + } +}; - var fullLayout = gd._fullLayout; - var dragmode = fullLayout.dragmode; +/** + * pick a default color from the main default set, augmented by + * itself lighter then darker before repeating + */ +var extendedColorWays = {}; - // unset selection styles when coming out of a selection mode - if(dragmode === 'zoom' || dragmode === 'pan') { - var cd = gd.calcdata; +function generateExtendedColors(colorList) { + var i; + var colorString = JSON.stringify(colorList); + var pieColors = extendedColorWays[colorString]; + if(!pieColors) { + pieColors = colorList.slice(); - for(var i = 0; i < cd.length; i++) { - var cd0 = cd[i][0]; - var trace = cd0.trace; + for(i = 0; i < colorList.length; i++) { + pieColors.push(tinycolor(colorList[i]).lighten(20).toHexString()); + } - if(trace.type === 'splom') { - var scene = fullLayout._splomScenes[trace.uid]; - if(scene.selectBatch === null) { - scene.matrix.update(scene.matrixOptions, null); - } - } + for(i = 0; i < colorList.length; i++) { + pieColors.push(tinycolor(colorList[i]).darken(20).toHexString()); } + extendedColorWays[colorString] = pieColors; } -} -module.exports = { - name: SPLOM, - attr: Cartesian.attr, - attrRegex: Cartesian.attrRegex, - layoutAttributes: Cartesian.layoutAttributes, - supplyLayoutDefaults: Cartesian.supplyLayoutDefaults, - drawFramework: Cartesian.drawFramework, - plot: plot, - drag: drag, - updateGrid: updateGrid, - clean: clean, - updateFx: updateFx, - toSVG: Cartesian.toSVG -}; + return pieColors; +} -},{"../../lib/prepare_regl":709,"../../plots/cartesian":756,"../../plots/cartesian/axes":744,"../../plots/cartesian/axis_ids":747,"../../plots/get_data":781,"../../registry":827,"regl-line2d":474}],1123:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../lib":159,"./helpers":273,"fast-isnumeric":10,"tinycolor2":26}],271:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171414,167 +67977,274 @@ 'use strict'; var Lib = _dereq_('../../lib'); -var handleArrayContainerDefaults = _dereq_('../../plots/array_container_defaults'); - var attributes = _dereq_('./attributes'); -var subTypes = _dereq_('../scatter/subtypes'); -var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); -var mergeLength = _dereq_('../parcoords/merge_length'); -var OPEN_RE = /-open/; +var handleDomainDefaults = _dereq_('../../plots/domain').defaults; module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } - var dimensions = handleArrayContainerDefaults(traceIn, traceOut, { - name: 'dimensions', - handleItemDefaults: dimensionDefaults - }); + var coerceFont = Lib.coerceFont; + var len; - var showDiag = coerce('diagonal.visible'); - var showUpper = coerce('showupperhalf'); - var showLower = coerce('showlowerhalf'); + var vals = coerce('values'); + var hasVals = Lib.isArrayOrTypedArray(vals); + var labels = coerce('labels'); + if(Array.isArray(labels)) { + len = labels.length; + if(hasVals) len = Math.min(len, vals.length); + } + else if(hasVals) { + len = vals.length; - var dimLength = mergeLength(traceOut, dimensions, 'values'); + coerce('label0'); + coerce('dlabel'); + } - if(!dimLength || (!showDiag && !showUpper && !showLower)) { + if(!len) { traceOut.visible = false; return; } + traceOut._length = len; - coerce('text'); + var lineWidth = coerce('marker.line.width'); + if(lineWidth) coerce('marker.line.color'); - handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce); + coerce('marker.colors'); - var isOpen = OPEN_RE.test(traceOut.marker.symbol); - var isBubble = subTypes.isBubble(traceOut); - coerce('marker.line.width', isOpen || isBubble ? 1 : 0); + coerce('scalegroup'); + // TODO: hole needs to be coerced to the same value within a scaleegroup - handleAxisDefaults(traceIn, traceOut, layout, coerce); + var textData = coerce('text'); + var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); + coerce('hovertext'); + coerce('hovertemplate'); - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); + if(textInfo && textInfo !== 'none') { + var textPosition = coerce('textposition'); + 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); + if(hasInside) { + 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(hasOutside) coerceFont(coerce, 'outsidetextfont', dfltFont); + } + } + + handleDomainDefaults(traceOut, layout, coerce); + + var hole = coerce('hole'); + var title = coerce('title.text'); + if(title) { + var titlePosition = coerce('title.position', hole ? 'middle center' : 'top center'); + if(!hole && titlePosition === 'middle center') traceOut.title.position = 'top center'; + coerceFont(coerce, 'title.font', layout.font); + } + + coerce('sort'); + coerce('direction'); + coerce('rotation'); + + coerce('pull'); +}; + +},{"../../lib":159,"../../plots/domain":229,"./attributes":268}],272:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +var appendArrayMultiPointValues = _dereq_('../../components/fx/helpers').appendArrayMultiPointValues; + + +// Note: like other eventData routines, this creates the data for hover/unhover/click events +// but it has a different API and goes through a totally different pathway. +// So to ensure it doesn't get misused, it's not attached to the Pie module. +module.exports = function eventData(pt, trace) { + var out = { + curveNumber: trace.index, + pointNumbers: pt.pts, + data: trace._input, + fullData: trace, + label: pt.label, + color: pt.color, + value: pt.v, + percent: pt.percent, + text: pt.text, + + // pt.v (and pt.i below) for backward compatibility + v: pt.v + }; + + // Only include pointNumber if it's unambiguous + if(pt.pts.length === 1) out.pointNumber = out.i = pt.pts[0]; + + // Add extra data arrays to the output + // notice that this is the multi-point version ('s' on the end!) + // so added data will be arrays matching the pointNumbers array. + appendArrayMultiPointValues(out, trace, pt.pts); + + return out; +}; + +},{"../../components/fx/helpers":78}],273:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var Lib = _dereq_('../../lib'); + +exports.formatPiePercent = function formatPiePercent(v, separators) { + var vRounded = (v * 100).toPrecision(3); + if(vRounded.lastIndexOf('.') !== -1) { + vRounded = vRounded.replace(/[.]?0+$/, ''); + } + return Lib.numSeparate(vRounded, separators) + '%'; }; -function dimensionDefaults(dimIn, dimOut) { - function coerce(attr, dflt) { - return Lib.coerce(dimIn, dimOut, attributes.dimensions, attr, dflt); +exports.formatPieValue = function formatPieValue(v, separators) { + var vRounded = v.toPrecision(10); + if(vRounded.lastIndexOf('.') !== -1) { + vRounded = vRounded.replace(/[.]?0+$/, ''); } + return Lib.numSeparate(vRounded, separators); +}; - coerce('label'); - var values = coerce('values'); - - if(!(values && values.length)) dimOut.visible = false; - else coerce('visible'); +exports.getFirstFilled = function getFirstFilled(array, indices) { + if(!Array.isArray(array)) return; + for(var i = 0; i < indices.length; i++) { + var v = array[indices[i]]; + if(v || v === 0) return v; + } +}; - coerce('axis.type'); -} +exports.castOption = function castOption(item, indices) { + if(Array.isArray(item)) return exports.getFirstFilled(item, indices); + else if(item) return item; +}; -function handleAxisDefaults(traceIn, traceOut, layout, coerce) { - var dimensions = traceOut.dimensions; - var dimLength = dimensions.length; - var showUpper = traceOut.showupperhalf; - var showLower = traceOut.showlowerhalf; - var showDiag = traceOut.diagonal.visible; - var i, j; +},{"../../lib":159}],274:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var xAxesDflt = new Array(dimLength); - var yAxesDflt = new Array(dimLength); +'use strict'; - for(i = 0; i < dimLength; i++) { - var suffix = i ? i + 1 : ''; - xAxesDflt[i] = 'x' + suffix; - yAxesDflt[i] = 'y' + suffix; - } +var Pie = {}; - var xaxes = coerce('xaxes', xAxesDflt); - var yaxes = coerce('yaxes', yAxesDflt); +Pie.attributes = _dereq_('./attributes'); +Pie.supplyDefaults = _dereq_('./defaults'); +Pie.supplyLayoutDefaults = _dereq_('./layout_defaults'); +Pie.layoutAttributes = _dereq_('./layout_attributes'); - // build list of [x,y] axis corresponding to each dimensions[i], - // very useful for passing options to regl-splom - var diag = traceOut._diag = new Array(dimLength); +var calcModule = _dereq_('./calc'); +Pie.calc = calcModule.calc; +Pie.crossTraceCalc = calcModule.crossTraceCalc; - // lookup for 'drawn' x|y axes, to avoid costly indexOf downstream - traceOut._xaxes = {}; - traceOut._yaxes = {}; +Pie.plot = _dereq_('./plot'); +Pie.style = _dereq_('./style'); +Pie.styleOne = _dereq_('./style_one'); - // list of 'drawn' x|y axes, use to generate list of subplots - var xList = []; - var yList = []; +Pie.moduleType = 'trace'; +Pie.name = 'pie'; +Pie.basePlotModule = _dereq_('./base_plot'); +Pie.categories = ['pie', 'showLegend']; +Pie.meta = { + +}; - function fillAxisStashes(axId, dim, list) { - if(!axId) return; +module.exports = Pie; - var axLetter = axId.charAt(0); - var stash = layout._splomAxes[axLetter]; +},{"./attributes":268,"./base_plot":269,"./calc":270,"./defaults":271,"./layout_attributes":275,"./layout_defaults":276,"./plot":277,"./style":278,"./style_one":279}],275:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - traceOut['_' + axLetter + 'axes'][axId] = 1; - list.push(axId); +'use strict'; - if(!(axId in stash)) { - var s = stash[axId] = {}; - if(dim) { - s.label = dim.label || ''; - if(dim.visible && dim.axis) { - s.type = dim.axis.type; - } - } - } +module.exports = { + /** + * hiddenlabels is the pie chart analog of visible:'legendonly' + * but it can contain many labels, and can hide slices + * from several pies simultaneously + */ + hiddenlabels: { + valType: 'data_array', + editType: 'calc' + }, + piecolorway: { + valType: 'colorlist', + + editType: 'calc', + + }, + extendpiecolors: { + valType: 'boolean', + dflt: true, + + editType: 'calc', + } +}; - // cases where showDiag and showLower or showUpper are false - // no special treatment as the 'drawn' x-axes and y-axes no longer match - // the dimensions items and xaxes|yaxes 1-to-1 - var mustShiftX = !showDiag && !showLower; - var mustShiftY = !showDiag && !showUpper; - - for(i = 0; i < dimLength; i++) { - var dim = dimensions[i]; - var i0 = i === 0; - var iN = i === dimLength - 1; - - var xaId = (i0 && mustShiftX) || (iN && mustShiftY) ? - undefined : - xaxes[i]; - - var yaId = (i0 && mustShiftY) || (iN && mustShiftX) ? - undefined : - yaxes[i]; +},{}],276:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - fillAxisStashes(xaId, dim, xList); - fillAxisStashes(yaId, dim, yList); - diag[i] = [xaId, yaId]; - } +'use strict'; - // fill in splom subplot keys - for(i = 0; i < xList.length; i++) { - for(j = 0; j < yList.length; j++) { - var id = xList[i] + yList[j]; +var Lib = _dereq_('../../lib'); - if(i > j && showUpper) { - layout._splomSubplots[id] = 1; - } else if(i < j && showLower) { - layout._splomSubplots[id] = 1; - } else if(i === j && (showDiag || !showLower || !showUpper)) { - // need to include diagonal subplots when - // hiding one half and the diagonal - layout._splomSubplots[id] = 1; - } - } - } +var layoutAttributes = _dereq_('./layout_attributes'); - // when lower half is omitted, or when just the diagonal is gone, - // override grid default to make sure axes remain on - // the left/bottom of the plot area - if(!showLower || (!showDiag && showUpper && showLower)) { - layout._splomGridDflt.xside = 'bottom'; - layout._splomGridDflt.yside = 'left'; +module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { + function coerce(attr, dflt) { + return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } -} + coerce('hiddenlabels'); + coerce('piecolorway', layoutOut.colorway); + coerce('extendpiecolors'); +}; -},{"../../lib":696,"../../plots/array_container_defaults":740,"../parcoords/merge_length":1015,"../scatter/marker_defaults":1062,"../scatter/subtypes":1067,"./attributes":1121}],1124:[function(_dereq_,module,exports){ +},{"../../lib":159,"./layout_attributes":275}],277:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171583,936 +68253,878 @@ 'use strict'; -var createMatrix = _dereq_('regl-splom'); -var arrayRange = _dereq_('array-range'); +var d3 = _dereq_('d3'); -var Registry = _dereq_('../../registry'); -var Grid = _dereq_('../../components/grid'); +var Fx = _dereq_('../../components/fx'); +var Color = _dereq_('../../components/color'); +var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); -var AxisIDs = _dereq_('../../plots/cartesian/axis_ids'); +var svgTextUtils = _dereq_('../../lib/svg_text_utils'); -var subTypes = _dereq_('../scatter/subtypes'); -var calcMarkerSize = _dereq_('../scatter/calc').calcMarkerSize; -var calcAxisExpansion = _dereq_('../scatter/calc').calcAxisExpansion; -var calcColorscales = _dereq_('../scatter/colorscale_calc'); -var convertMarkerSelection = _dereq_('../scattergl/convert').markerSelection; -var convertMarkerStyle = _dereq_('../scattergl/convert').markerStyle; -var calcHover = _dereq_('../scattergl').calcHover; +var helpers = _dereq_('./helpers'); +var eventData = _dereq_('./event_data'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; -var TOO_MANY_POINTS = _dereq_('../scattergl/constants').TOO_MANY_POINTS; +module.exports = function plot(gd, cdpie) { + var fullLayout = gd._fullLayout; -function calc(gd, trace) { - var dimensions = trace.dimensions; - var commonLength = trace._length; - var opts = {}; - // 'c' for calculated, 'l' for linear, - // only differ here for log axes, pass ldata to createMatrix as 'data' - var cdata = opts.cdata = []; - var ldata = opts.data = []; - // keep track of visible dimensions - var visibleDims = trace._visibleDims = []; - var i, k, dim, xa, ya; - - function makeCalcdata(ax, dim) { - // call makeCalcdata with fake input - var ccol = ax.makeCalcdata({ - v: dim.values, - vcalendar: trace.calendar - }, 'v'); - - for(var j = 0; j < ccol.length; j++) { - ccol[j] = ccol[j] === BADNUM ? NaN : ccol[j]; - } - cdata.push(ccol); - ldata.push(ax.type === 'log' ? Lib.simpleMap(ccol, ax.c2l) : ccol); - } - - for(i = 0; i < dimensions.length; i++) { - dim = dimensions[i]; - - if(dim.visible) { - xa = AxisIDs.getFromId(gd, trace._diag[i][0]); - ya = AxisIDs.getFromId(gd, trace._diag[i][1]); - - // if corresponding x & y axes don't have matching types, skip dim - if(xa && ya && xa.type !== ya.type) { - Lib.log('Skipping splom dimension ' + i + ' with conflicting axis types'); - continue; - } + prerenderTitles(cdpie, gd); + scalePies(cdpie, fullLayout._size); - if(xa) { - makeCalcdata(xa, dim); - if(ya && ya.type === 'category') { - ya._categories = xa._categories.slice(); - } - } else { - // should not make it here, if both xa and ya undefined - makeCalcdata(ya, dim); - } + var pieGroups = Lib.makeTraceGroups(fullLayout._pielayer, cdpie, 'trace').each(function(cd) { + var pieGroup = d3.select(this); + var cd0 = cd[0]; + var trace = cd0.trace; - visibleDims.push(i); - } - } + setCoords(cd); - calcColorscales(trace); - Lib.extendFlat(opts, convertMarkerStyle(trace)); + // TODO: miter might look better but can sometimes cause problems + // maybe miter with a small-ish stroke-miterlimit? + pieGroup.attr('stroke-linejoin', 'round'); - var visibleLength = cdata.length; - var hasTooManyPoints = (visibleLength * commonLength) > TOO_MANY_POINTS; + pieGroup.each(function() { + var slices = d3.select(this).selectAll('g.slice').data(cd); - // Reuse SVG scatter axis expansion routine. - // For graphs with very large number of points and array marker.size, - // use average marker size instead to speed things up. - var ppad; - if(hasTooManyPoints) { - ppad = 2 * (opts.sizeAvg || Math.max(opts.size, 3)); - } else { - ppad = calcMarkerSize(trace, commonLength); - } + slices.enter().append('g') + .classed('slice', true); + slices.exit().remove(); - for(k = 0; k < visibleDims.length; k++) { - i = visibleDims[k]; - dim = dimensions[i]; - xa = AxisIDs.getFromId(gd, trace._diag[i][0]) || {}; - ya = AxisIDs.getFromId(gd, trace._diag[i][1]) || {}; - calcAxisExpansion(gd, trace, xa, ya, cdata[k], cdata[k], ppad); - } + var quadrants = [ + [[], []], // y<0: x<0, x>=0 + [[], []] // y>=0: x<0, x>=0 + ]; + var hasOutsideText = false; - var scene = sceneUpdate(gd, trace); - if(!scene.matrix) scene.matrix = true; - scene.matrixOptions = opts; + slices.each(function(pt) { + if(pt.hidden) { + d3.select(this).selectAll('path,g').remove(); + return; + } - scene.selectedOptions = convertMarkerSelection(trace, trace.selected); - scene.unselectedOptions = convertMarkerSelection(trace, trace.unselected); + // to have consistent event data compared to other traces + pt.pointNumber = pt.i; + pt.curveNumber = trace.index; - return [{x: false, y: false, t: {}, trace: trace}]; -} + quadrants[pt.pxmid[1] < 0 ? 0 : 1][pt.pxmid[0] < 0 ? 0 : 1].push(pt); -function sceneUpdate(gd, trace) { - var fullLayout = gd._fullLayout; - var uid = trace.uid; + var cx = cd0.cx; + var cy = cd0.cy; + var sliceTop = d3.select(this); + var slicePath = sliceTop.selectAll('path.surface').data([pt]); - // must place ref to 'scene' in fullLayout, so that: - // - it can be relinked properly on updates - // - it can be destroyed properly when needed - var splomScenes = fullLayout._splomScenes; - if(!splomScenes) splomScenes = fullLayout._splomScenes = {}; + // hover state vars + // have we drawn a hover label, so it should be cleared later + var hasHoverLabel = false; + // have we emitted a hover event, so later an unhover event should be emitted + // note that click events do not depend on this - you can still get them + // with hovermode: false or if you were earlier dragging, then clicked + // in the same slice that you moused up in + var hasHoverEvent = false; - var reset = {dirty: true}; + function handleMouseOver() { + // in case fullLayout or fullData has changed without a replot + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; - var first = { - selectBatch: null, - unselectBatch: null, - matrix: false, - select: null - }; + if(gd._dragging || fullLayout2.hovermode === false) return; - var scene = splomScenes[trace.uid]; + var hoverinfo = trace2.hoverinfo; + if(Array.isArray(hoverinfo)) { + // super hacky: we need to pull out the *first* hoverinfo from + // pt.pts, then put it back into an array in a dummy trace + // and call castHoverinfo on that. + // TODO: do we want to have Fx.castHoverinfo somehow handle this? + // it already takes an array for index, for 2D, so this seems tricky. + hoverinfo = Fx.castHoverinfo({ + hoverinfo: [helpers.castOption(hoverinfo, pt.pts)], + _module: trace._module + }, fullLayout2, 0); + } - if(!scene) { - scene = splomScenes[uid] = Lib.extendFlat({}, reset, first); + if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; - scene.draw = function draw() { - if(scene.matrix && scene.matrix.draw) { - if(scene.selectBatch) { - scene.matrix.draw(scene.unselectBatch, scene.selectBatch); - } else { - scene.matrix.draw(); - } - } + // in case we dragged over the pie from another subplot, + // or if hover is turned off + if(trace2.hovertemplate || (hoverinfo !== 'none' && hoverinfo !== 'skip' && hoverinfo)) { + var rInscribed = getInscribedRadiusFraction(pt, cd0); + var hoverCenterX = cx + pt.pxmid[0] * (1 - rInscribed); + var hoverCenterY = cy + pt.pxmid[1] * (1 - rInscribed); + var separators = fullLayout.separators; + var thisText = []; - scene.dirty = false; - }; + if(hoverinfo && hoverinfo.indexOf('label') !== -1) thisText.push(pt.label); + pt.text = helpers.castOption(trace2.hovertext || trace2.text, pt.pts); + if(hoverinfo && hoverinfo.indexOf('text') !== -1) { + var texti = pt.text; + if(texti) thisText.push(texti); + } + pt.value = pt.v; + pt.valueLabel = helpers.formatPieValue(pt.v, separators); + if(hoverinfo && hoverinfo.indexOf('value') !== -1) thisText.push(pt.valueLabel); + pt.percent = pt.v / cd0.vTotal; + pt.percentLabel = helpers.formatPiePercent(pt.percent, separators); + if(hoverinfo && hoverinfo.indexOf('percent') !== -1) thisText.push(pt.percentLabel); - // remove scene resources - scene.destroy = function destroy() { - if(scene.matrix && scene.matrix.destroy) { - scene.matrix.destroy(); - } - scene.matrixOptions = null; - scene.selectBatch = null; - scene.unselectBatch = null; - scene = null; - }; - } + var hoverLabel = trace.hoverlabel; + var hoverFont = hoverLabel.font; - // In case if we have scene from the last calc - reset data - if(!scene.dirty) { - Lib.extendFlat(scene, reset); - } + Fx.loneHover({ + x0: hoverCenterX - rInscribed * cd0.r, + x1: hoverCenterX + rInscribed * cd0.r, + y: hoverCenterY, + text: thisText.join('
'), + name: (trace2.hovertemplate || hoverinfo.indexOf('name') !== -1) ? trace2.name : undefined, + idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', + color: helpers.castOption(hoverLabel.bgcolor, pt.pts) || pt.color, + borderColor: helpers.castOption(hoverLabel.bordercolor, pt.pts), + fontFamily: helpers.castOption(hoverFont.family, pt.pts), + fontSize: helpers.castOption(hoverFont.size, pt.pts), + fontColor: helpers.castOption(hoverFont.color, pt.pts), - return scene; -} + trace: trace2, + hovertemplate: helpers.castOption(trace2.hovertemplate, pt.pts), + hovertemplateLabels: pt, + eventData: [eventData(pt, trace2)] + }, { + container: fullLayout2._hoverlayer.node(), + outerContainer: fullLayout2._paper.node(), + gd: gd + }); -function plot(gd, _, splomCalcData) { - if(!splomCalcData.length) return; + hasHoverLabel = true; + } - for(var i = 0; i < splomCalcData.length; i++) { - plotOne(gd, splomCalcData[i][0]); - } -} + gd.emit('plotly_hover', { + points: [eventData(pt, trace2)], + event: d3.event + }); + hasHoverEvent = true; + } -function plotOne(gd, cd0) { - var fullLayout = gd._fullLayout; - var gs = fullLayout._size; - var trace = cd0.trace; - var stash = cd0.t; - var scene = fullLayout._splomScenes[trace.uid]; - var matrixOpts = scene.matrixOptions; - var cdata = matrixOpts.cdata; - var regl = fullLayout._glcanvas.data()[0].regl; - var dragmode = fullLayout.dragmode; - var xa, ya; - var i, j, k; + function handleMouseOut(evt) { + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; + + if(hasHoverEvent) { + evt.originalEvent = d3.event; + gd.emit('plotly_unhover', { + points: [eventData(pt, trace2)], + event: d3.event + }); + hasHoverEvent = false; + } + + if(hasHoverLabel) { + Fx.loneUnhover(fullLayout2._hoverlayer.node()); + hasHoverLabel = false; + } + } - if(cdata.length === 0) return; + function handleClick() { + // TODO: this does not support right-click. If we want to support it, we + // would likely need to change pie to use dragElement instead of straight + // mapbox event binding. Or perhaps better, make a simple wrapper with the + // right mousedown, mousemove, and mouseup handlers just for a left/right click + // mapbox would use this too. + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; - // augment options with proper upper/lower halves - // regl-splom's default grid starts from bottom-left - matrixOpts.lower = trace.showupperhalf; - matrixOpts.upper = trace.showlowerhalf; - matrixOpts.diagonal = trace.diagonal.visible; + if(gd._dragging || fullLayout2.hovermode === false) return; - var visibleDims = trace._visibleDims; - var visibleLength = cdata.length; - var viewOpts = scene.viewOpts = {}; - viewOpts.ranges = new Array(visibleLength); - viewOpts.domains = new Array(visibleLength); + gd._hoverdata = [eventData(pt, trace2)]; + Fx.click(gd, d3.event); + } - for(k = 0; k < visibleDims.length; k++) { - i = visibleDims[k]; + slicePath.enter().append('path') + .classed('surface', true) + .style({'pointer-events': 'all'}); - var rng = viewOpts.ranges[k] = new Array(4); - var dmn = viewOpts.domains[k] = new Array(4); + sliceTop.select('path.textline').remove(); - xa = AxisIDs.getFromId(gd, trace._diag[i][0]); - if(xa) { - rng[0] = xa._rl[0]; - rng[2] = xa._rl[1]; - dmn[0] = xa.domain[0]; - dmn[2] = xa.domain[1]; - } + sliceTop + .on('mouseover', handleMouseOver) + .on('mouseout', handleMouseOut) + .on('click', handleClick); - ya = AxisIDs.getFromId(gd, trace._diag[i][1]); - if(ya) { - rng[1] = ya._rl[0]; - rng[3] = ya._rl[1]; - dmn[1] = ya.domain[0]; - dmn[3] = ya.domain[1]; - } - } + if(trace.pull) { + var pull = +helpers.castOption(trace.pull, pt.pts) || 0; + if(pull > 0) { + cx += pull * pt.pxmid[0]; + cy += pull * pt.pxmid[1]; + } + } - viewOpts.viewport = [gs.l, gs.b, gs.w + gs.l, gs.h + gs.b]; + pt.cxFinal = cx; + pt.cyFinal = cy; - if(scene.matrix === true) { - scene.matrix = createMatrix(regl); - } + function arc(start, finish, cw, scale) { + return 'a' + (scale * cd0.r) + ',' + (scale * cd0.r) + ' 0 ' + + pt.largeArc + (cw ? ' 1 ' : ' 0 ') + + (scale * (finish[0] - start[0])) + ',' + (scale * (finish[1] - start[1])); + } - var clickSelectEnabled = fullLayout.clickmode.indexOf('select') > -1; - var selectMode = dragmode === 'lasso' || dragmode === 'select' || - !!trace.selectedpoints || clickSelectEnabled; - scene.selectBatch = null; - scene.unselectBatch = null; + var hole = trace.hole; + if(pt.v === cd0.vTotal) { // 100% fails bcs arc start and end are identical + var outerCircle = 'M' + (cx + pt.px0[0]) + ',' + (cy + pt.px0[1]) + + arc(pt.px0, pt.pxmid, true, 1) + + arc(pt.pxmid, pt.px0, true, 1) + 'Z'; + if(hole) { + slicePath.attr('d', + 'M' + (cx + hole * pt.px0[0]) + ',' + (cy + hole * pt.px0[1]) + + arc(pt.px0, pt.pxmid, false, hole) + + arc(pt.pxmid, pt.px0, false, hole) + + 'Z' + outerCircle); + } + else slicePath.attr('d', outerCircle); + } else { - if(selectMode) { - var commonLength = trace._length; + var outerArc = arc(pt.px0, pt.px1, true, 1); - if(!scene.selectBatch) { - scene.selectBatch = []; - scene.unselectBatch = []; - } + if(hole) { + var rim = 1 - hole; + slicePath.attr('d', + 'M' + (cx + hole * pt.px1[0]) + ',' + (cy + hole * pt.px1[1]) + + arc(pt.px1, pt.px0, false, hole) + + 'l' + (rim * pt.px0[0]) + ',' + (rim * pt.px0[1]) + + outerArc + + 'Z'); + } else { + slicePath.attr('d', + 'M' + cx + ',' + cy + + 'l' + pt.px0[0] + ',' + pt.px0[1] + + outerArc + + 'Z'); + } + } - // regenerate scene batch, if traces number changed during selection - if(trace.selectedpoints) { - scene.selectBatch = trace.selectedpoints; + // add text + var textPosition = helpers.castOption(trace.textposition, pt.pts); + var sliceTextGroup = sliceTop.selectAll('g.slicetext') + .data(pt.text && (textPosition !== 'none') ? [0] : []); - var selPts = trace.selectedpoints; - var selDict = {}; - for(i = 0; i < selPts.length; i++) { - selDict[selPts[i]] = true; - } - var unselPts = []; - for(i = 0; i < commonLength; i++) { - if(!selDict[i]) unselPts.push(i); - } - scene.unselectBatch = unselPts; - } + sliceTextGroup.enter().append('g') + .classed('slicetext', true); + sliceTextGroup.exit().remove(); - // precalculate px coords since we are not going to pan during select - var xpx = stash.xpx = new Array(visibleLength); - var ypx = stash.ypx = new Array(visibleLength); + sliceTextGroup.each(function() { + var sliceText = Lib.ensureSingle(d3.select(this), 'text', '', function(s) { + // prohibit tex interpretation until we can handle + // tex and regular text together + s.attr('data-notex', 1); + }); - for(k = 0; k < visibleDims.length; k++) { - i = visibleDims[k]; + sliceText.text(pt.text) + .attr({ + 'class': 'slicetext', + transform: '', + 'text-anchor': 'middle' + }) + .call(Drawing.font, textPosition === 'outside' ? + determineOutsideTextFont(trace, pt, gd._fullLayout.font) : + determineInsideTextFont(trace, pt, gd._fullLayout.font)) + .call(svgTextUtils.convertToTspans, gd); - xa = AxisIDs.getFromId(gd, trace._diag[i][0]); - if(xa) { - xpx[k] = new Array(commonLength); - for(j = 0; j < commonLength; j++) { - xpx[k][j] = xa.c2p(cdata[k][j]); - } - } + // position the text relative to the slice + var textBB = Drawing.bBox(sliceText.node()); + var transform; - ya = AxisIDs.getFromId(gd, trace._diag[i][1]); - if(ya) { - ypx[k] = new Array(commonLength); - for(j = 0; j < commonLength; j++) { - ypx[k][j] = ya.c2p(cdata[k][j]); - } - } - } + if(textPosition === 'outside') { + transform = transformOutsideText(textBB, pt); + } else { + transform = transformInsideText(textBB, pt, cd0); + if(textPosition === 'auto' && transform.scale < 1) { + sliceText.call(Drawing.font, trace.outsidetextfont); + if(trace.outsidetextfont.family !== trace.insidetextfont.family || + trace.outsidetextfont.size !== trace.insidetextfont.size) { + textBB = Drawing.bBox(sliceText.node()); + } + transform = transformOutsideText(textBB, pt); + } + } - if(scene.selectBatch) { - scene.matrix.update(matrixOpts, matrixOpts); - scene.matrix.update(scene.unselectedOptions, scene.selectedOptions); - scene.matrix.update(viewOpts, viewOpts); - } - else { - // delete selection pass - scene.matrix.update(viewOpts, null); - } - } - else { - var opts = Lib.extendFlat({}, matrixOpts, viewOpts); - scene.matrix.update(opts, null); - stash.xpx = stash.ypx = null; - } -} + var translateX = cx + pt.pxmid[0] * transform.rCenter + (transform.x || 0); + var translateY = cy + pt.pxmid[1] * transform.rCenter + (transform.y || 0); -function editStyle(gd, cd0) { - var trace = cd0.trace; - var scene = gd._fullLayout._splomScenes[trace.uid]; + // save some stuff to use later ensure no labels overlap + if(transform.outside) { + pt.yLabelMin = translateY - textBB.height / 2; + pt.yLabelMid = translateY; + pt.yLabelMax = translateY + textBB.height / 2; + pt.labelExtraX = 0; + pt.labelExtraY = 0; + hasOutsideText = true; + } - if(scene) { - calcColorscales(trace); + sliceText.attr('transform', + 'translate(' + translateX + ',' + translateY + ')' + + (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + + (transform.rotate ? ('rotate(' + transform.rotate + ')') : '') + + 'translate(' + + (-(textBB.left + textBB.right) / 2) + ',' + + (-(textBB.top + textBB.bottom) / 2) + + ')'); + }); + }); - Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(trace)); - // TODO [un]selected styles? + // add the title + var titleTextGroup = d3.select(this).selectAll('g.titletext') + .data(trace.title.text ? [0] : []); - var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts); + titleTextGroup.enter().append('g') + .classed('titletext', true); + titleTextGroup.exit().remove(); - // TODO this is too long for arrayOk attributes! - scene.matrix.update(opts, null); - } -} + titleTextGroup.each(function() { + var titleText = Lib.ensureSingle(d3.select(this), 'text', '', function(s) { + // prohibit tex interpretation as above + s.attr('data-notex', 1); + }); -function hoverPoints(pointData, xval, yval) { - var cd = pointData.cd; - var trace = cd[0].trace; - var scene = pointData.scene; - var cdata = scene.matrixOptions.cdata; - var xa = pointData.xa; - var ya = pointData.ya; - var xpx = xa.c2p(xval); - var ypx = ya.c2p(yval); - var maxDistance = pointData.distance; + var txt = fullLayout.meta ? + Lib.templateString(trace.title.text, {meta: fullLayout.meta}) : + trace.title.text; - var xi = getDimIndex(trace, xa); - var yi = getDimIndex(trace, ya); - if(xi === false || yi === false) return [pointData]; + titleText.text(txt) + .attr({ + 'class': 'titletext', + transform: '', + 'text-anchor': 'middle', + }) + .call(Drawing.font, trace.title.font) + .call(svgTextUtils.convertToTspans, gd); - var x = cdata[xi]; - var y = cdata[yi]; + var transform; - var id, dxy; - var minDist = maxDistance; + if(trace.title.position === 'middle center') { + transform = positionTitleInside(cd0); + } else { + transform = positionTitleOutside(cd0, fullLayout._size); + } - for(var i = 0; i < x.length; i++) { - var ptx = x[i]; - var pty = y[i]; - var dx = xa.c2p(ptx) - xpx; - var dy = ya.c2p(pty) - ypx; - var dist = Math.sqrt(dx * dx + dy * dy); + titleText.attr('transform', + 'translate(' + transform.x + ',' + transform.y + ')' + + (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + + 'translate(' + transform.tx + ',' + transform.ty + ')'); + }); - if(dist < minDist) { - minDist = dxy = dist; - id = i; - } - } + // now make sure no labels overlap (at least within one pie) + if(hasOutsideText) scootLabels(quadrants, trace); + slices.each(function(pt) { + if(pt.labelExtraX || pt.labelExtraY) { + // first move the text to its new location + var sliceTop = d3.select(this); + var sliceText = sliceTop.select('g.slicetext text'); - pointData.index = id; - pointData.distance = minDist; - pointData.dxy = dxy; + sliceText.attr('transform', 'translate(' + pt.labelExtraX + ',' + pt.labelExtraY + ')' + + sliceText.attr('transform')); - if(id === undefined) return [pointData]; + // then add a line to the new location + var lineStartX = pt.cxFinal + pt.pxmid[0]; + var lineStartY = pt.cyFinal + pt.pxmid[1]; + var textLinePath = 'M' + lineStartX + ',' + lineStartY; + var finalX = (pt.yLabelMax - pt.yLabelMin) * (pt.pxmid[0] < 0 ? -1 : 1) / 4; - calcHover(pointData, x, y, trace); + if(pt.labelExtraX) { + var yFromX = pt.labelExtraX * pt.pxmid[1] / pt.pxmid[0]; + var yNet = pt.yLabelMid + pt.labelExtraY - (pt.cyFinal + pt.pxmid[1]); - return [pointData]; -} + if(Math.abs(yFromX) > Math.abs(yNet)) { + textLinePath += + 'l' + (yNet * pt.pxmid[0] / pt.pxmid[1]) + ',' + yNet + + 'H' + (lineStartX + pt.labelExtraX + finalX); + } else { + textLinePath += 'l' + pt.labelExtraX + ',' + yFromX + + 'v' + (yNet - yFromX) + + 'h' + finalX; + } + } else { + textLinePath += + 'V' + (pt.yLabelMid + pt.labelExtraY) + + 'h' + finalX; + } -function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd; - var trace = cd[0].trace; - var stash = cd[0].t; - var scene = searchInfo.scene; - var cdata = scene.matrixOptions.cdata; - var xa = searchInfo.xaxis; - var ya = searchInfo.yaxis; - var selection = []; - var i; + sliceTop.append('path') + .classed('textline', true) + .call(Color.stroke, trace.outsidetextfont.color) + .attr({ + 'stroke-width': Math.min(2, trace.outsidetextfont.size / 8), + d: textLinePath, + fill: 'none' + }); + } + }); + }); + }); + + // This is for a bug in Chrome (as of 2015-07-22, and does not affect FF) + // if insidetextfont and outsidetextfont are different sizes, sometimes the size + // of an "em" gets taken from the wrong element at first so lines are + // spaced wrong. You just have to tell it to try again later and it gets fixed. + // I have no idea why we haven't seen this in other contexts. Also, sometimes + // it gets the initial draw correct but on redraw it gets confused. + setTimeout(function() { + pieGroups.selectAll('tspan').each(function() { + var s = d3.select(this); + if(s.attr('dy')) s.attr('dy', s.attr('dy')); + }); + }, 0); +}; + +function determineOutsideTextFont(trace, pt, layoutFont) { + var color = helpers.castOption(trace.outsidetextfont.color, pt.pts) || + helpers.castOption(trace.textfont.color, pt.pts) || + layoutFont.color; - if(!scene) return selection; + var family = helpers.castOption(trace.outsidetextfont.family, pt.pts) || + helpers.castOption(trace.textfont.family, pt.pts) || + layoutFont.family; - var hasOnlyLines = (!subTypes.hasMarkers(trace) && !subTypes.hasText(trace)); - if(trace.visible !== true || hasOnlyLines) return selection; + var size = helpers.castOption(trace.outsidetextfont.size, pt.pts) || + helpers.castOption(trace.textfont.size, pt.pts) || + layoutFont.size; - var xi = getDimIndex(trace, xa); - var yi = getDimIndex(trace, ya); - if(xi === false || yi === false) return selection; - - var xpx = stash.xpx[xi]; - var ypx = stash.ypx[yi]; - var x = cdata[xi]; - var y = cdata[yi]; - - // degenerate polygon does not enable selection - // filter out points by visible scatter ones - var els = null; - var unels = null; - if(selectionTester !== false && !selectionTester.degenerate) { - els = [], unels = []; - for(i = 0; i < x.length; i++) { - if(selectionTester.contains([xpx[i], ypx[i]], null, i, searchInfo)) { - els.push(i); - selection.push({ - pointNumber: i, - x: x[i], - y: y[i] - }); - } - else { - unels.push(i); - } - } - } else { - unels = arrayRange(stash.count); - } + return { + color: color, + family: family, + size: size + }; +} - // make sure selectBatch is created - if(!scene.selectBatch) { - scene.selectBatch = []; - scene.unselectBatch = []; - } +function determineInsideTextFont(trace, pt, layoutFont) { + var customColor = helpers.castOption(trace.insidetextfont.color, pt.pts); + if(!customColor && trace._input.textfont) { - if(!scene.selectBatch) { - // enter every trace select mode - for(i = 0; i < scene.count; i++) { - scene.selectBatch = []; - scene.unselectBatch = []; - } - // we should turn scatter2d into unselected once we have any points selected - scene.matrix.update(scene.unselectedOptions, scene.selectedOptions); + // Why not simply using trace.textfont? Because if not set, it + // defaults to layout.font which has a default color. But if + // textfont.color and insidetextfont.color don't supply a value, + // a contrasting color shall be used. + customColor = helpers.castOption(trace._input.textfont.color, pt.pts); } - scene.selectBatch = els; - scene.unselectBatch = unels; + var family = helpers.castOption(trace.insidetextfont.family, pt.pts) || + helpers.castOption(trace.textfont.family, pt.pts) || + layoutFont.family; + var size = helpers.castOption(trace.insidetextfont.size, pt.pts) || + helpers.castOption(trace.textfont.size, pt.pts) || + layoutFont.size; - return selection; + return { + color: customColor || Color.contrast(pt.color), + family: family, + size: size + }; } -function getDimIndex(trace, ax) { - var axId = ax._id; - var axLetter = axId.charAt(0); - var ind = {x: 0, y: 1}[axLetter]; - var visibleDims = trace._visibleDims; +function prerenderTitles(cdpie, gd) { + var fullLayout = gd._fullLayout; + + var cd0, trace; + // Determine the width and height of the title for each pie. + for(var i = 0; i < cdpie.length; i++) { + cd0 = cdpie[i][0]; + trace = cd0.trace; - for(var k = 0; k < visibleDims.length; k++) { - var i = visibleDims[k]; - if(trace._diag[i][ind] === axId) return k; + if(trace.title.text) { + var txt = fullLayout.meta ? + Lib.templateString(trace.title.text, {meta: fullLayout.meta}) : + trace.title.text; + + var dummyTitle = Drawing.tester.append('text') + .attr('data-notex', 1) + .text(txt) + .call(Drawing.font, trace.title.font) + .call(svgTextUtils.convertToTspans, gd); + var bBox = Drawing.bBox(dummyTitle.node(), true); + cd0.titleBox = { + width: bBox.width, + height: bBox.height, + }; + dummyTitle.remove(); + } } - return false; } -module.exports = { - moduleType: 'trace', - name: 'splom', +function transformInsideText(textBB, pt, cd0) { + var textDiameter = Math.sqrt(textBB.width * textBB.width + textBB.height * textBB.height); + var textAspect = textBB.width / textBB.height; + var halfAngle = Math.PI * Math.min(pt.v / cd0.vTotal, 0.5); + var ring = 1 - cd0.trace.hole; + var rInscribed = getInscribedRadiusFraction(pt, cd0); - basePlotModule: _dereq_('./base_plot'), - categories: ['gl', 'regl', 'cartesian', 'symbols', 'showLegend', 'scatter-like'], + // max size text can be inserted inside without rotating it + // this inscribes the text rectangle in a circle, which is then inscribed + // in the slice, so it will be an underestimate, which some day we may want + // to improve so this case can get more use + var transform = { + scale: rInscribed * cd0.r * 2 / textDiameter, + + // and the center position and rotation in this case + rCenter: 1 - rInscribed, + rotate: 0 + }; - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults'), - colorbar: _dereq_('../scatter/marker_colorbar'), + if(transform.scale >= 1) return transform; - calc: calc, - plot: plot, - hoverPoints: hoverPoints, - selectPoints: selectPoints, - editStyle: editStyle, + // max size if text is rotated radially + var Qr = textAspect + 1 / (2 * Math.tan(halfAngle)); + var maxHalfHeightRotRadial = cd0.r * Math.min( + 1 / (Math.sqrt(Qr * Qr + 0.5) + Qr), + ring / (Math.sqrt(textAspect * textAspect + ring / 2) + textAspect) + ); + var radialTransform = { + scale: maxHalfHeightRotRadial * 2 / textBB.height, + rCenter: Math.cos(maxHalfHeightRotRadial / cd0.r) - + maxHalfHeightRotRadial * textAspect / cd0.r, + rotate: (180 / Math.PI * pt.midangle + 720) % 180 - 90 + }; - meta: { - - } -}; + // max size if text is rotated tangentially + var aspectInv = 1 / textAspect; + var Qt = aspectInv + 1 / (2 * Math.tan(halfAngle)); + var maxHalfWidthTangential = cd0.r * Math.min( + 1 / (Math.sqrt(Qt * Qt + 0.5) + Qt), + ring / (Math.sqrt(aspectInv * aspectInv + ring / 2) + aspectInv) + ); + var tangentialTransform = { + scale: maxHalfWidthTangential * 2 / textBB.width, + rCenter: Math.cos(maxHalfWidthTangential / cd0.r) - + maxHalfWidthTangential / textAspect / cd0.r, + rotate: (180 / Math.PI * pt.midangle + 810) % 180 - 90 + }; + // if we need a rotated transform, pick the biggest one + // even if both are bigger than 1 + var rotatedTransform = tangentialTransform.scale > radialTransform.scale ? + tangentialTransform : radialTransform; -// splom traces use the 'grid' component to generate their axes, -// register it here -Registry.register(Grid); + if(transform.scale < 1 && rotatedTransform.scale > transform.scale) return rotatedTransform; + return transform; +} -},{"../../components/grid":616,"../../constants/numerical":673,"../../lib":696,"../../plots/cartesian/axis_ids":747,"../../registry":827,"../scatter/calc":1044,"../scatter/colorscale_calc":1046,"../scatter/marker_colorbar":1061,"../scatter/subtypes":1067,"../scattergl":1096,"../scattergl/constants":1093,"../scattergl/convert":1094,"./attributes":1121,"./base_plot":1122,"./defaults":1123,"array-range":55,"regl-splom":477}],1125:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ +function getInscribedRadiusFraction(pt, cd0) { + if(pt.v === cd0.vTotal && !cd0.trace.hole) return 1;// special case of 100% with no hole -'use strict'; + var halfAngle = Math.PI * Math.min(pt.v / cd0.vTotal, 0.5); + return Math.min(1 / (1 + 1 / Math.sin(halfAngle)), (1 - cd0.trace.hole) / 2); +} -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); -var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var mesh3dAttrs = _dereq_('../mesh3d/attributes'); -var baseAttrs = _dereq_('../../plots/attributes'); +function transformOutsideText(textBB, pt) { + var x = pt.pxmid[0]; + var y = pt.pxmid[1]; + var dx = textBB.width / 2; + var dy = textBB.height / 2; -var extendFlat = _dereq_('../../lib/extend').extendFlat; + if(x < 0) dx *= -1; + if(y < 0) dy *= -1; -var attrs = { - x: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, - y: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, - z: { - valType: 'data_array', - - editType: 'calc+clearAxisTypes', - - }, + return { + scale: 1, + rCenter: 1, + rotate: 0, + x: dx + Math.abs(dy) * (dx > 0 ? 1 : -1) / 2, + y: dy / (1 + x * x / (y * y)), + outside: true + }; +} - u: { - valType: 'data_array', - editType: 'calc', - - }, - v: { - valType: 'data_array', - editType: 'calc', - - }, - w: { - valType: 'data_array', - editType: 'calc', - - }, +function positionTitleInside(cd0) { + var textDiameter = + Math.sqrt(cd0.titleBox.width * cd0.titleBox.width + cd0.titleBox.height * cd0.titleBox.height); + return { + x: cd0.cx, + y: cd0.cy, + scale: cd0.trace.hole * cd0.r * 2 / textDiameter, + tx: 0, + ty: - cd0.titleBox.height / 2 + cd0.trace.title.font.size + }; +} - starts: { - x: { - valType: 'data_array', - editType: 'calc', - - }, - y: { - valType: 'data_array', - editType: 'calc', - - }, - z: { - valType: 'data_array', - editType: 'calc', - - }, - editType: 'calc' - }, +function positionTitleOutside(cd0, plotSize) { + var scaleX = 1; + var scaleY = 1; + var maxWidth, maxPull; - maxdisplayed: { - valType: 'integer', - min: 0, - dflt: 1000, - - editType: 'calc', - - }, + var trace = cd0.trace; + // position of the baseline point of the text box in the plot, before scaling. + // we anchored the text in the middle, so the baseline is on the bottom middle + // of the first line of text. + var topMiddle = { + x: cd0.cx, + y: cd0.cy + }; + // relative translation of the text box after scaling + var translate = { + tx: 0, + ty: 0 + }; - // TODO - // - // Should add 'absolute' (like cone traces have), but currently gl-streamtube3d's - // `absoluteTubeSize` doesn't behave well enough for our needs. - // - // 'fixed' would be a nice addition to plot stream 'lines', see - // https://github.com/plotly/plotly.js/commit/812be20750e21e0a1831975001c248d365850f73#r29129877 - // - // sizemode: { - // valType: 'enumerated', - // values: ['scaled', 'absolute', 'fixed'], - // dflt: 'scaled', - // - // editType: 'calc', - // - // }, + // we reason below as if the baseline is the top middle point of the text box. + // so we must add the font size to approximate the y-coord. of the top. + // note that this correction must happen after scaling. + translate.ty += trace.title.font.size; + maxPull = getMaxPull(trace); - sizeref: { - valType: 'number', - - editType: 'calc', - min: 0, - dflt: 1, - - }, + if(trace.title.position.indexOf('top') !== -1) { + topMiddle.y -= (1 + maxPull) * cd0.r; + translate.ty -= cd0.titleBox.height; + } + else if(trace.title.position.indexOf('bottom') !== -1) { + topMiddle.y += (1 + maxPull) * cd0.r; + } - text: { - valType: 'string', - - dflt: '', - editType: 'calc', - + if(trace.title.position.indexOf('left') !== -1) { + // we start the text at the left edge of the pie + maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]) / 2 + cd0.r; + topMiddle.x -= (1 + maxPull) * cd0.r; + translate.tx += cd0.titleBox.width / 2; + } else if(trace.title.position.indexOf('center') !== -1) { + maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]); + } else if(trace.title.position.indexOf('right') !== -1) { + maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]) / 2 + cd0.r; + topMiddle.x += (1 + maxPull) * cd0.r; + translate.tx -= cd0.titleBox.width / 2; } -}; + scaleX = maxWidth / cd0.titleBox.width; + scaleY = getTitleSpace(cd0, plotSize) / cd0.titleBox.height; + return { + x: topMiddle.x, + y: topMiddle.y, + scale: Math.min(scaleX, scaleY), + tx: translate.tx, + ty: translate.ty + }; +} -extendFlat(attrs, colorscaleAttrs('', { - colorAttr: 'u/v/w norm', - showScaleDflt: true, - editTypeOverride: 'calc' -}), { - colorbar: colorbarAttrs -}); +function getTitleSpace(cd0, plotSize) { + var trace = cd0.trace; + var pieBoxHeight = plotSize.h * (trace.domain.y[1] - trace.domain.y[0]); + // use at most half of the plot for the title + return Math.min(cd0.titleBox.height, pieBoxHeight / 2); +} -var fromMesh3d = ['opacity', 'lightposition', 'lighting']; -fromMesh3d.forEach(function(k) { - attrs[k] = mesh3dAttrs[k]; -}); +function getMaxPull(trace) { + var maxPull = trace.pull; + var j; + if(Array.isArray(maxPull)) { + maxPull = 0; + for(j = 0; j < trace.pull.length; j++) { + if(trace.pull[j] > maxPull) maxPull = trace.pull[j]; + } + } + return maxPull; +} -attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, { - editType: 'calc', - flags: ['x', 'y', 'z', 'u', 'v', 'w', 'norm', 'divergence', 'text', 'name'], - dflt: 'x+y+z+norm+text+name' -}); +function scootLabels(quadrants, trace) { + var xHalf, yHalf, equatorFirst, farthestX, farthestY, + xDiffSign, yDiffSign, thisQuad, oppositeQuad, + wholeSide, i, thisQuadOutside, firstOppositeOutsidePt; -attrs.transforms = undefined; + function topFirst(a, b) { return a.pxmid[1] - b.pxmid[1]; } + function bottomFirst(a, b) { return b.pxmid[1] - a.pxmid[1]; } -module.exports = attrs; + function scootOneLabel(thisPt, prevPt) { + if(!prevPt) prevPt = {}; -},{"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plots/attributes":741,"../mesh3d/attributes":986}],1126:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + var prevOuterY = prevPt.labelExtraY + (yHalf ? prevPt.yLabelMax : prevPt.yLabelMin); + var thisInnerY = yHalf ? thisPt.yLabelMin : thisPt.yLabelMax; + var thisOuterY = yHalf ? thisPt.yLabelMax : thisPt.yLabelMin; + var thisSliceOuterY = thisPt.cyFinal + farthestY(thisPt.px0[1], thisPt.px1[1]); + var newExtraY = prevOuterY - thisInnerY; -'use strict'; + var xBuffer, i, otherPt, otherOuterY, otherOuterX, newExtraX; -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); + // make sure this label doesn't overlap other labels + // this *only* has us move these labels vertically + if(newExtraY * yDiffSign > 0) thisPt.labelExtraY = newExtraY; -module.exports = function calc(gd, trace) { - var i; + // make sure this label doesn't overlap any slices + if(!Array.isArray(trace.pull)) return; // this can only happen with array pulls - var u = trace.u; - var v = trace.v; - var w = trace.w; - var x = trace.x; - var y = trace.y; - var z = trace.z; - var len = Math.min(x.length, y.length, z.length, u.length, v.length, w.length); - - var slen = 0; - var startx, starty, startz; - if(trace.starts) { - startx = trace.starts.x || []; - starty = trace.starts.y || []; - startz = trace.starts.z || []; - slen = Math.min(startx.length, starty.length, startz.length); - } + for(i = 0; i < wholeSide.length; i++) { + otherPt = wholeSide[i]; - var normMax = 0; - var normMin = Infinity; + // overlap can only happen if the other point is pulled more than this one + if(otherPt === thisPt || ( + (helpers.castOption(trace.pull, thisPt.pts) || 0) >= + (helpers.castOption(trace.pull, otherPt.pts) || 0)) + ) { + continue; + } - for(i = 0; i < len; i++) { - var uu = u[i]; - var vv = v[i]; - var ww = w[i]; - var norm = Math.sqrt(uu * uu + vv * vv + ww * ww); - - normMax = Math.max(normMax, norm); - normMin = Math.min(normMin, norm); - } - - colorscaleCalc(trace, [normMin, normMax], '', 'c'); - - var xMax = -Infinity; - var xMin = Infinity; - var yMax = -Infinity; - var yMin = Infinity; - var zMax = -Infinity; - var zMin = Infinity; + if((thisPt.pxmid[1] - otherPt.pxmid[1]) * yDiffSign > 0) { + // closer to the equator - by construction all of these happen first + // move the text vertically to get away from these slices + otherOuterY = otherPt.cyFinal + farthestY(otherPt.px0[1], otherPt.px1[1]); + newExtraY = otherOuterY - thisInnerY - thisPt.labelExtraY; - for(i = 0; i < len; i++) { - var xx = x[i]; - xMax = Math.max(xMax, xx); - xMin = Math.min(xMin, xx); + if(newExtraY * yDiffSign > 0) thisPt.labelExtraY += newExtraY; - var yy = y[i]; - yMax = Math.max(yMax, yy); - yMin = Math.min(yMin, yy); + } else if((thisOuterY + thisPt.labelExtraY - thisSliceOuterY) * yDiffSign > 0) { + // farther from the equator - happens after we've done all the + // vertical moving we're going to do + // move horizontally to get away from these more polar slices - var zz = z[i]; - zMax = Math.max(zMax, zz); - zMin = Math.min(zMin, zz); - } - for(i = 0; i < slen; i++) { - var sx = startx[i]; - xMax = Math.max(xMax, sx); - xMin = Math.min(xMin, sx); + // if we're moving horz. based on a slice that's several slices away from this one + // then we need some extra space for the lines to labels between them + xBuffer = 3 * xDiffSign * Math.abs(i - wholeSide.indexOf(thisPt)); - var sy = starty[i]; - yMax = Math.max(yMax, sy); - yMin = Math.min(yMin, sy); + otherOuterX = otherPt.cxFinal + farthestX(otherPt.px0[0], otherPt.px1[0]); + newExtraX = otherOuterX + xBuffer - (thisPt.cxFinal + thisPt.pxmid[0]) - thisPt.labelExtraX; - var sz = startz[i]; - zMax = Math.max(zMax, sz); - zMin = Math.min(zMin, sz); + if(newExtraX * xDiffSign > 0) thisPt.labelExtraX += newExtraX; + } + } } - trace._len = len; - trace._slen = slen; - trace._normMax = normMax; - trace._xbnds = [xMin, xMax]; - trace._ybnds = [yMin, yMax]; - trace._zbnds = [zMin, zMax]; -}; + for(yHalf = 0; yHalf < 2; yHalf++) { + equatorFirst = yHalf ? topFirst : bottomFirst; + farthestY = yHalf ? Math.max : Math.min; + yDiffSign = yHalf ? 1 : -1; -},{"../../components/colorscale/calc":578}],1127:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + for(xHalf = 0; xHalf < 2; xHalf++) { + farthestX = xHalf ? Math.max : Math.min; + xDiffSign = xHalf ? 1 : -1; -'use strict'; + // first sort the array + // note this is a copy of cd, so cd itself doesn't get sorted + // but we can still modify points in place. + thisQuad = quadrants[yHalf][xHalf]; + thisQuad.sort(equatorFirst); -var tube2mesh = _dereq_('gl-streamtube3d'); -var createTubeMesh = tube2mesh.createTubeMesh; + oppositeQuad = quadrants[1 - yHalf][xHalf]; + wholeSide = oppositeQuad.concat(thisQuad); -var Lib = _dereq_('../../lib'); -var parseColorScale = _dereq_('../../lib/gl_format_color').parseColorScale; -var zip3 = _dereq_('../../plots/gl3d/zip3'); + thisQuadOutside = []; + for(i = 0; i < thisQuad.length; i++) { + if(thisQuad[i].yLabelMid !== undefined) thisQuadOutside.push(thisQuad[i]); + } -var axisName2scaleIndex = {xaxis: 0, yaxis: 1, zaxis: 2}; + firstOppositeOutsidePt = false; + for(i = 0; yHalf && i < oppositeQuad.length; i++) { + if(oppositeQuad[i].yLabelMid !== undefined) { + firstOppositeOutsidePt = oppositeQuad[i]; + break; + } + } -function Streamtube(scene, uid) { - this.scene = scene; - this.uid = uid; - this.mesh = null; - this.data = null; + // each needs to avoid the previous + for(i = 0; i < thisQuadOutside.length; i++) { + var prevPt = i && thisQuadOutside[i - 1]; + // bottom half needs to avoid the first label of the top half + // top half we still need to call scootOneLabel on the first slice + // so we can avoid other slices, but we don't pass a prevPt + if(firstOppositeOutsidePt && !i) prevPt = firstOppositeOutsidePt; + scootOneLabel(thisQuadOutside[i], prevPt); + } + } + } } -var proto = Streamtube.prototype; - -proto.handlePick = function(selection) { - var sceneLayout = this.scene.fullSceneLayout; - var dataScale = this.scene.dataScale; +function scalePies(cdpie, plotSize) { + var scaleGroups = []; - function fromDataScale(v, axisName) { - var ax = sceneLayout[axisName]; - var scale = dataScale[axisName2scaleIndex[axisName]]; - return ax.l2c(v) / scale; - } + var pieBoxWidth, pieBoxHeight, i, j, cd0, trace, + maxPull, scaleGroup, minPxPerValUnit; - if(selection.object === this.mesh) { - var pos = selection.data.position; - var uvx = selection.data.velocity; + // first figure out the center and maximum radius for each pie + for(i = 0; i < cdpie.length; i++) { + cd0 = cdpie[i][0]; + trace = cd0.trace; - selection.traceCoordinate = [ - fromDataScale(pos[0], 'xaxis'), - fromDataScale(pos[1], 'yaxis'), - fromDataScale(pos[2], 'zaxis'), + pieBoxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]); + pieBoxHeight = plotSize.h * (trace.domain.y[1] - trace.domain.y[0]); + // leave some space for the title, if it will be displayed outside + if(trace.title.text && trace.title.position !== 'middle center') { + pieBoxHeight -= getTitleSpace(cd0, plotSize); + } - fromDataScale(uvx[0], 'xaxis'), - fromDataScale(uvx[1], 'yaxis'), - fromDataScale(uvx[2], 'zaxis'), + maxPull = getMaxPull(trace); - // u/v/w norm - selection.data.intensity * this.data._normMax, - // divergence - selection.data.divergence - ]; + cd0.r = Math.min(pieBoxWidth, pieBoxHeight) / (2 + 2 * maxPull); - selection.textLabel = this.data.text; + cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2; + cd0.cy = plotSize.t + plotSize.h * (1 - trace.domain.y[0]) - pieBoxHeight / 2; + if(trace.title.text && trace.title.position.indexOf('bottom') !== -1) { + cd0.cy -= getTitleSpace(cd0, plotSize); + } - return true; + if(trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) { + scaleGroups.push(trace.scalegroup); + } } -}; -function distinctVals(col) { - return Lib.distinctVals(col).vals; -} + // Then scale any pies that are grouped + for(j = 0; j < scaleGroups.length; j++) { + minPxPerValUnit = Infinity; + scaleGroup = scaleGroups[j]; -function getDfltStartingPositions(vec) { - var len = vec.length; - var s; + for(i = 0; i < cdpie.length; i++) { + cd0 = cdpie[i][0]; + if(cd0.trace.scalegroup === scaleGroup) { + minPxPerValUnit = Math.min(minPxPerValUnit, + cd0.r * cd0.r / cd0.vTotal); + } + } - if(len > 2) { - s = vec.slice(1, len - 1); - } else if(len === 2) { - s = [(vec[0] + vec[1]) / 2]; - } else { - s = vec; + for(i = 0; i < cdpie.length; i++) { + cd0 = cdpie[i][0]; + if(cd0.trace.scalegroup === scaleGroup) { + cd0.r = Math.sqrt(minPxPerValUnit * cd0.vTotal); + } + } } - return s; -} -function getBoundPads(vec) { - var len = vec.length; - if(len === 1) { - return [0.5, 0.5]; - } else { - return [vec[1] - vec[0], vec[len - 1] - vec[len - 2]]; - } } -function convert(scene, trace) { - var sceneLayout = scene.fullSceneLayout; - var dataScale = scene.dataScale; - var len = trace._len; - var tubeOpts = {}; - - function toDataCoords(arr, axisName) { - var ax = sceneLayout[axisName]; - var scale = dataScale[axisName2scaleIndex[axisName]]; - return Lib.simpleMap(arr, function(v) { return ax.d2l(v) * scale; }); - } - - tubeOpts.vectors = zip3( - toDataCoords(trace.u, 'xaxis'), - toDataCoords(trace.v, 'yaxis'), - toDataCoords(trace.w, 'zaxis'), - len - ); - - var valsx = distinctVals(trace.x.slice(0, len)); - var valsy = distinctVals(trace.y.slice(0, len)); - var valsz = distinctVals(trace.z.slice(0, len)); - - // Over-specified mesh case, this would error in tube2mesh - if(valsx.length * valsy.length * valsz.length > len) { - return {positions: [], cells: []}; - } - - var meshx = toDataCoords(valsx, 'xaxis'); - var meshy = toDataCoords(valsy, 'yaxis'); - var meshz = toDataCoords(valsz, 'zaxis'); - - tubeOpts.meshgrid = [meshx, meshy, meshz]; - - if(trace.starts) { - var slen = trace._slen; - tubeOpts.startingPositions = zip3( - toDataCoords(trace.starts.x.slice(0, slen), 'xaxis'), - toDataCoords(trace.starts.y.slice(0, slen), 'yaxis'), - toDataCoords(trace.starts.z.slice(0, slen), 'zaxis') - ); - } else { - // Default starting positions: - // - // if len>2, cut xz plane at min-y, - // takes all x/y/z pts on that plane except those on the edges - // to generate "well-defined" tubes, - // - // if len=2, take position halfway between two the pts, - // - // if len=1, take that pt - var sy0 = meshy[0]; - var sx = getDfltStartingPositions(meshx); - var sz = getDfltStartingPositions(meshz); - var startingPositions = new Array(sx.length * sz.length); - var m = 0; - - for(var i = 0; i < sx.length; i++) { - for(var k = 0; k < sz.length; k++) { - startingPositions[m++] = [sx[i], sy0, sz[k]]; - } - } - tubeOpts.startingPositions = startingPositions; - } - - tubeOpts.colormap = parseColorScale(trace.colorscale); - tubeOpts.tubeSize = trace.sizeref; - tubeOpts.maxLength = trace.maxdisplayed; - - // add some padding around the bounds - // to e.g. allow tubes starting from a slice of the x/y/z mesh - // to go beyond bounds a little bit w/o getting clipped - var xbnds = toDataCoords(trace._xbnds, 'xaxis'); - var ybnds = toDataCoords(trace._ybnds, 'yaxis'); - var zbnds = toDataCoords(trace._zbnds, 'zaxis'); - var xpads = getBoundPads(meshx); - var ypads = getBoundPads(meshy); - var zpads = getBoundPads(meshz); - - var bounds = [ - [xbnds[0] - xpads[0], ybnds[0] - ypads[0], zbnds[0] - zpads[0]], - [xbnds[1] + xpads[1], ybnds[1] + ypads[1], zbnds[1] + zpads[1]] - ]; - - var meshData = tube2mesh(tubeOpts, bounds); - - // N.B. cmin/cmax correspond to the min/max vector norm - // in the u/v/w arrays, which in general is NOT equal to max - // intensity that colors the tubes. - meshData.vertexIntensityBounds = [trace.cmin / trace._normMax, trace.cmax / trace._normMax]; +function setCoords(cd) { + var cd0 = cd[0]; + var trace = cd0.trace; + var currentAngle = trace.rotation * Math.PI / 180; + var angleFactor = 2 * Math.PI / cd0.vTotal; + var firstPt = 'px0'; + var lastPt = 'px1'; - // pass gl-mesh3d lighting attributes - var lp = trace.lightposition; - meshData.lightPosition = [lp.x, lp.y, lp.z]; - meshData.ambient = trace.lighting.ambient; - meshData.diffuse = trace.lighting.diffuse; - meshData.specular = trace.lighting.specular; - meshData.roughness = trace.lighting.roughness; - meshData.fresnel = trace.lighting.fresnel; - meshData.opacity = trace.opacity; + var i, cdi, currentCoords; - // stash autorange pad value - trace._pad = meshData.tubeScale * trace.sizeref * 2; + if(trace.direction === 'counterclockwise') { + for(i = 0; i < cd.length; i++) { + if(!cd[i].hidden) break; // find the first non-hidden slice + } + if(i === cd.length) return; // all slices hidden - return meshData; -} + currentAngle += angleFactor * cd[i].v; + angleFactor *= -1; + firstPt = 'px1'; + lastPt = 'px0'; + } -proto.update = function(data) { - this.data = data; + function getCoords(angle) { + return [cd0.r * Math.sin(angle), -cd0.r * Math.cos(angle)]; + } - var meshData = convert(this.scene, data); - this.mesh.update(meshData); -}; + currentCoords = getCoords(currentAngle); -proto.dispose = function() { - this.scene.glplot.remove(this.mesh); - this.mesh.dispose(); -}; + for(i = 0; i < cd.length; i++) { + cdi = cd[i]; + if(cdi.hidden) continue; -function createStreamtubeTrace(scene, data) { - var gl = scene.glplot.gl; + cdi[firstPt] = currentCoords; - var meshData = convert(scene, data); - var mesh = createTubeMesh(gl, meshData); + currentAngle += angleFactor * cdi.v / 2; + cdi.pxmid = getCoords(currentAngle); + cdi.midangle = currentAngle; - var streamtube = new Streamtube(scene, data.uid); - streamtube.mesh = mesh; - streamtube.data = data; - mesh._trace = streamtube; + currentAngle += angleFactor * cdi.v / 2; + currentCoords = getCoords(currentAngle); - scene.glplot.add(mesh); + cdi[lastPt] = currentCoords; - return streamtube; + cdi.largeArc = (cdi.v > cd0.vTotal / 2) ? 1 : 0; + } } -module.exports = createStreamtubeTrace; - -},{"../../lib":696,"../../lib/gl_format_color":692,"../../plots/gl3d/zip3":798,"gl-streamtube3d":301}],1128:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/drawing":64,"../../components/fx":82,"../../lib":159,"../../lib/svg_text_utils":180,"./event_data":272,"./helpers":273,"d3":8}],278:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172521,111 +69133,103 @@ 'use strict'; -var Lib = _dereq_('../../lib'); - -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); +var d3 = _dereq_('d3'); -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } +var styleOne = _dereq_('./style_one'); - var u = coerce('u'); - var v = coerce('v'); - var w = coerce('w'); +module.exports = function style(gd) { + gd._fullLayout._pielayer.selectAll('.trace').each(function(cd) { + var cd0 = cd[0]; + var trace = cd0.trace; + var traceSelection = d3.select(this); - var x = coerce('x'); - var y = coerce('y'); - var z = coerce('z'); + traceSelection.style({opacity: trace.opacity}); - if( - !u || !u.length || !v || !v.length || !w || !w.length || - !x || !x.length || !y || !y.length || !z || !z.length - ) { - traceOut.visible = false; - return; - } + traceSelection.selectAll('path.surface').each(function(pt) { + d3.select(this).call(styleOne, pt, trace); + }); + }); +}; + +},{"./style_one":279,"d3":8}],279:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - coerce('starts.x'); - coerce('starts.y'); - coerce('starts.z'); - - coerce('maxdisplayed'); - coerce('sizeref'); - - coerce('lighting.ambient'); - coerce('lighting.diffuse'); - coerce('lighting.specular'); - coerce('lighting.roughness'); - coerce('lighting.fresnel'); - coerce('lightposition.x'); - coerce('lightposition.y'); - coerce('lightposition.z'); +'use strict'; - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); +var Color = _dereq_('../../components/color'); +var castOption = _dereq_('./helpers').castOption; - coerce('text'); +module.exports = function styleOne(s, pt, trace) { + var line = trace.marker.line; + var lineColor = castOption(line.color, pt.pts) || Color.defaultLine; + var lineWidth = castOption(line.width, pt.pts) || 0; - // disable 1D transforms (for now) - // x/y/z and u/v/w have matching lengths, - // but they don't have to match with starts.(x|y|z) - traceOut._length = null; + s.style({'stroke-width': lineWidth}) + .call(Color.fill, pt.color) + .call(Color.stroke, lineColor); }; -},{"../../components/colorscale/defaults":580,"../../lib":696,"./attributes":1125}],1129:[function(_dereq_,module,exports){ +},{"../../components/color":43,"./helpers":273}],280:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -module.exports = { - moduleType: 'trace', - name: 'streamtube', - basePlotModule: _dereq_('../../plots/gl3d'), - categories: ['gl3d'], +var Lib = _dereq_('../../lib'); - attributes: _dereq_('./attributes'), - supplyDefaults: _dereq_('./defaults'), - colorbar: { - min: 'cmin', - max: 'cmax' - }, - calc: _dereq_('./calc'), - plot: _dereq_('./convert'), - eventData: function(out, pt) { - out.tubex = out.x; - out.tubey = out.y; - out.tubez = out.z; - - out.tubeu = pt.traceCoordinate[3]; - out.tubev = pt.traceCoordinate[4]; - out.tubew = pt.traceCoordinate[5]; - - out.norm = pt.traceCoordinate[6]; - out.divergence = pt.traceCoordinate[7]; - - // Does not correspond to input x/y/z, so delete them - delete out.x; - delete out.y; - delete out.z; - return out; - }, +// arrayOk attributes, merge them into calcdata array +module.exports = function arraysToCalcdata(cd, trace) { - meta: { - + // so each point knows which index it originally came from + for(var i = 0; i < cd.length; i++) cd[i].i = i; + + Lib.mergeArray(trace.text, cd, 'tx'); + Lib.mergeArray(trace.hovertext, cd, 'htx'); + Lib.mergeArray(trace.customdata, cd, 'data'); + Lib.mergeArray(trace.textposition, cd, 'tp'); + if(trace.textfont) { + Lib.mergeArray(trace.textfont.size, cd, 'ts'); + Lib.mergeArray(trace.textfont.color, cd, 'tc'); + Lib.mergeArray(trace.textfont.family, cd, 'tf'); + } + + var marker = trace.marker; + if(marker) { + Lib.mergeArray(marker.size, cd, 'ms'); + Lib.mergeArray(marker.opacity, cd, 'mo'); + Lib.mergeArray(marker.symbol, cd, 'mx'); + Lib.mergeArray(marker.color, cd, 'mc'); + + var markerLine = marker.line; + if(marker.line) { + Lib.mergeArray(markerLine.color, cd, 'mlc'); + Lib.mergeArray(markerLine.width, cd, 'mlw'); + } + + var markerGradient = marker.gradient; + if(markerGradient && markerGradient.type !== 'none') { + Lib.mergeArray(markerGradient.type, cd, 'mgt'); + Lib.mergeArray(markerGradient.color, cd, 'mgc'); + } } }; -},{"../../plots/gl3d":787,"./attributes":1125,"./calc":1126,"./convert":1127,"./defaults":1128}],1130:[function(_dereq_,module,exports){ +},{"../../lib":159}],281:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172634,745 +69238,762 @@ 'use strict'; -var Color = _dereq_('../../components/color'); -var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); +var colorAttributes = _dereq_('../../components/colorscale/attributes'); var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); -var baseAttrs = _dereq_('../../plots/attributes'); +var fontAttrs = _dereq_('../../plots/font_attributes'); +var dash = _dereq_('../../components/drawing/attributes').dash; +var Drawing = _dereq_('../../components/drawing'); +var constants = _dereq_('./constants'); var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -function makeContourProjAttr(axLetter) { - return { - valType: 'boolean', +module.exports = { + x: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + anim: true, - dflt: false, + }, + x0: { + valType: 'any', + dflt: 0, - }; -} + editType: 'calc+clearAxisTypes', + anim: true, + + }, + dx: { + valType: 'number', + dflt: 1, + + editType: 'calc', + anim: true, + + }, + y: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + anim: true, + + }, + y0: { + valType: 'any', + dflt: 0, + + editType: 'calc+clearAxisTypes', + anim: true, + + }, + dy: { + valType: 'number', + dflt: 1, + + editType: 'calc', + anim: true, + + }, -function makeContourAttr(axLetter) { - return { - show: { - valType: 'boolean', - - dflt: false, - - }, - project: { - x: makeContourProjAttr('x'), - y: makeContourProjAttr('y'), - z: makeContourProjAttr('z') - }, + stackgroup: { + valType: 'string', + + dflt: '', + editType: 'calc', + + }, + orientation: { + valType: 'enumerated', + + values: ['v', 'h'], + editType: 'calc', + + }, + groupnorm: { + valType: 'enumerated', + values: ['', 'fraction', 'percent'], + dflt: '', + + editType: 'calc', + + }, + stackgaps: { + valType: 'enumerated', + values: ['infer zero', 'interpolate'], + dflt: 'infer zero', + + editType: 'calc', + + }, + + text: { + valType: 'string', + + dflt: '', + arrayOk: true, + editType: 'calc', + + }, + hovertext: { + valType: 'string', + + dflt: '', + arrayOk: true, + editType: 'style', + + }, + mode: { + valType: 'flaglist', + flags: ['lines', 'markers', 'text'], + extras: ['none'], + + editType: 'calc', + + }, + hoveron: { + valType: 'flaglist', + flags: ['points', 'fills'], + + editType: 'style', + + }, + hovertemplate: hovertemplateAttrs({}, { + keys: constants.eventDataKeys + }), + line: { color: { valType: 'color', - dflt: Color.defaultLine, - - }, - usecolormap: { - valType: 'boolean', - - dflt: false, + editType: 'style', + anim: true, }, width: { valType: 'number', - - min: 1, - max: 16, + min: 0, dflt: 2, + editType: 'style', + anim: true, + }, - highlight: { - valType: 'boolean', + shape: { + valType: 'enumerated', + values: ['linear', 'spline', 'hv', 'vh', 'hvh', 'vhv'], + dflt: 'linear', - dflt: true, + editType: 'plot', }, - highlightcolor: { - valType: 'color', + smoothing: { + valType: 'number', + min: 0, + max: 1.3, + dflt: 1, - dflt: Color.defaultLine, + editType: 'plot', }, - highlightwidth: { - valType: 'number', + dash: extendFlat({}, dash, {editType: 'style'}), + simplify: { + valType: 'boolean', + dflt: true, - min: 1, - max: 16, - dflt: 2, + editType: 'plot', - } - }; -} - -var attrs = module.exports = overrideAll(extendFlat({ - z: { - valType: 'data_array', - + }, + editType: 'plot' }, - x: { - valType: 'data_array', + + connectgaps: { + valType: 'boolean', + dflt: false, - }, - y: { - valType: 'data_array', + editType: 'calc', }, - - text: { - valType: 'string', + cliponaxis: { + valType: 'boolean', + dflt: true, - dflt: '', - arrayOk: true, + editType: 'plot', }, - surfacecolor: { - valType: 'data_array', + fill: { + valType: 'enumerated', + values: ['none', 'tozeroy', 'tozerox', 'tonexty', 'tonextx', 'toself', 'tonext'], + + editType: 'calc', }, -}, - -colorscaleAttrs('', { - colorAttr: 'z or surfacecolor', - showScaleDflt: true, - autoColorDflt: false, - editTypeOverride: 'calc' -}), { - colorbar: colorbarAttrs, - - contours: { - x: makeContourAttr('x'), - y: makeContourAttr('y'), - z: makeContourAttr('z') - }, - hidesurface: { - valType: 'boolean', + fillcolor: { + valType: 'color', - dflt: false, + editType: 'style', + anim: true, }, - - lightposition: { - x: { - valType: 'number', + marker: extendFlat({ + symbol: { + valType: 'enumerated', + values: Drawing.symbolList, + dflt: 'circle', + arrayOk: true, - min: -1e5, - max: 1e5, - dflt: 10, + editType: 'style', }, - y: { + opacity: { valType: 'number', + min: 0, + max: 1, + arrayOk: true, - min: -1e5, - max: 1e5, - dflt: 1e4, + editType: 'style', + anim: true, }, - z: { - valType: 'number', - - min: -1e5, - max: 1e5, - dflt: 0, - - } - }, - - lighting: { - ambient: { + size: { valType: 'number', + min: 0, + dflt: 6, + arrayOk: true, - min: 0.00, - max: 1.0, - dflt: 0.8, + editType: 'calc', + anim: true, }, - diffuse: { + maxdisplayed: { valType: 'number', + min: 0, + dflt: 0, - min: 0.00, - max: 1.00, - dflt: 0.8, + editType: 'plot', }, - specular: { + sizeref: { valType: 'number', + dflt: 1, - min: 0.00, - max: 2.00, - dflt: 0.05, + editType: 'calc', }, - roughness: { + sizemin: { valType: 'number', + min: 0, + dflt: 0, - min: 0.00, - max: 1.00, - dflt: 0.5, + editType: 'calc', }, - fresnel: { - valType: 'number', + sizemode: { + valType: 'enumerated', + values: ['diameter', 'area'], + dflt: 'diameter', - min: 0.00, - max: 5.00, - dflt: 0.2, + editType: 'calc', - } + }, + + colorbar: colorbarAttrs, + + line: extendFlat({ + width: { + valType: 'number', + min: 0, + arrayOk: true, + + editType: 'style', + anim: true, + + }, + editType: 'calc' + }, + colorAttributes('marker.line', {anim: true}) + ), + gradient: { + type: { + valType: 'enumerated', + values: ['radial', 'horizontal', 'vertical', 'none'], + arrayOk: true, + dflt: 'none', + + editType: 'calc', + + }, + color: { + valType: 'color', + arrayOk: true, + + editType: 'calc', + + }, + editType: 'calc' + }, + editType: 'calc' + }, + colorAttributes('marker', {anim: true}) + ), + selected: { + marker: { + opacity: { + valType: 'number', + min: 0, + max: 1, + + editType: 'style', + + }, + color: { + valType: 'color', + + editType: 'style', + + }, + size: { + valType: 'number', + min: 0, + + editType: 'style', + + }, + editType: 'style' + }, + textfont: { + color: { + valType: 'color', + + editType: 'style', + + }, + editType: 'style' + }, + editType: 'style' + }, + unselected: { + marker: { + opacity: { + valType: 'number', + min: 0, + max: 1, + + editType: 'style', + + }, + color: { + valType: 'color', + + editType: 'style', + + }, + size: { + valType: 'number', + min: 0, + + editType: 'style', + + }, + editType: 'style' + }, + textfont: { + color: { + valType: 'color', + + editType: 'style', + + }, + editType: 'style' + }, + editType: 'style' }, - opacity: { - valType: 'number', + 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, - min: 0, - max: 1, - dflt: 1, + editType: 'calc', }, + textfont: fontAttrs({ + editType: 'calc', + colorEditType: 'style', + arrayOk: true, + + }), - _deprecated: { - zauto: extendFlat({}, colorscaleAttrs.zauto, { - - }), - zmin: extendFlat({}, colorscaleAttrs.zmin, { - - }), - zmax: extendFlat({}, colorscaleAttrs.zmax, { - - }) + r: { + valType: 'data_array', + editType: 'calc', + }, - - hoverinfo: extendFlat({}, baseAttrs.hoverinfo) -}), 'calc', 'nested'); - -attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; -attrs.transforms = undefined; - -},{"../../components/color":570,"../../components/colorbar/attributes":571,"../../components/colorscale/attributes":577,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/attributes":741}],1131:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - - -'use strict'; - -var colorscaleCalc = _dereq_('../../components/colorscale/calc'); - - -// Compute auto-z and autocolorscale if applicable -module.exports = function calc(gd, trace) { - if(trace.surfacecolor) { - colorscaleCalc(trace, trace.surfacecolor, '', 'c'); - } else { - colorscaleCalc(trace, trace.z, '', 'c'); + t: { + valType: 'data_array', + editType: 'calc', + } }; -},{"../../components/colorscale/calc":578}],1132:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":44,"../../components/colorscale/attributes":50,"../../components/drawing":64,"../../components/drawing/attributes":63,"../../components/fx/hovertemplate_attributes":81,"../../lib/extend":153,"../../plots/font_attributes":230,"./constants":285}],282:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var createSurface = _dereq_('gl-surface3d'); -var ndarray = _dereq_('ndarray'); -var homography = _dereq_('ndarray-homography'); -var fill = _dereq_('ndarray-fill'); -var ops = _dereq_('ndarray-ops'); +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); -var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; -var parseColorScale = _dereq_('../../lib/gl_format_color').parseColorScale; -var str2RgbaArray = _dereq_('../../lib/str2rgbarray'); +var Axes = _dereq_('../../plots/cartesian/axes'); +var BADNUM = _dereq_('../../constants/numerical').BADNUM; + +var subTypes = _dereq_('./subtypes'); +var calcColorscale = _dereq_('./colorscale_calc'); +var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); +var calcSelection = _dereq_('./calc_selection'); -var MIN_RESOLUTION = 128; +function calc(gd, trace) { + var fullLayout = gd._fullLayout; + var xa = Axes.getFromId(gd, trace.xaxis || 'x'); + var ya = Axes.getFromId(gd, trace.yaxis || 'y'); + var x = xa.makeCalcdata(trace, 'x'); + var y = ya.makeCalcdata(trace, 'y'); + var serieslen = trace._length; + var cd = new Array(serieslen); + var ids = trace.ids; + var stackGroupOpts = getStackOpts(trace, fullLayout, xa, ya); + var interpolateGaps = false; + var isV, i, j, k, interpolate, vali; -function SurfaceTrace(scene, surface, uid) { - this.scene = scene; - this.uid = uid; - this.surface = surface; - this.data = null; - this.showContour = [false, false, false]; - this.dataScale = 1.0; -} - -var proto = SurfaceTrace.prototype; - -proto.handlePick = function(selection) { - if(selection.object === this.surface) { - var selectIndex = selection.index = [ - Math.min( - Math.round(selection.data.index[0] / this.dataScale - 1)|0, - this.data.z[0].length - 1 - ), - Math.min( - Math.round(selection.data.index[1] / this.dataScale - 1)|0, - this.data.z.length - 1 - ) - ]; - var traceCoordinate = [0, 0, 0]; + setFirstScatter(fullLayout, trace); - if(!isArrayOrTypedArray(this.data.x)) { - traceCoordinate[0] = selectIndex[0]; - } else if(isArrayOrTypedArray(this.data.x[0])) { - traceCoordinate[0] = this.data.x[selectIndex[1]][selectIndex[0]]; - } else { - traceCoordinate[0] = this.data.x[selectIndex[0]]; + var xAttr = 'x'; + var yAttr = 'y'; + var posAttr; + if(stackGroupOpts) { + stackGroupOpts.traceIndices.push(trace.index); + isV = stackGroupOpts.orientation === 'v'; + // size, like we use for bar + if(isV) { + yAttr = 's'; + posAttr = 'x'; + } + else { + xAttr = 's'; + posAttr = 'y'; } + interpolate = stackGroupOpts.stackgaps === 'interpolate'; + } + else { + var ppad = calcMarkerSize(trace, serieslen); + calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); + } - if(!isArrayOrTypedArray(this.data.y)) { - traceCoordinate[1] = selectIndex[1]; - } else if(isArrayOrTypedArray(this.data.y[0])) { - traceCoordinate[1] = this.data.y[selectIndex[1]][selectIndex[0]]; - } else { - traceCoordinate[1] = this.data.y[selectIndex[1]]; + for(i = 0; i < serieslen; i++) { + var cdi = cd[i] = {}; + var xValid = isNumeric(x[i]); + var yValid = isNumeric(y[i]); + if(xValid && yValid) { + cdi[xAttr] = x[i]; + cdi[yAttr] = y[i]; } - - traceCoordinate[2] = this.data.z[selectIndex[1]][selectIndex[0]]; - selection.traceCoordinate = traceCoordinate; - - var sceneLayout = this.scene.fullSceneLayout; - selection.dataCoordinate = [ - sceneLayout.xaxis.d2l(traceCoordinate[0], 0, this.data.xcalendar) * this.scene.dataScale[0], - sceneLayout.yaxis.d2l(traceCoordinate[1], 0, this.data.ycalendar) * this.scene.dataScale[1], - sceneLayout.zaxis.d2l(traceCoordinate[2], 0, this.data.zcalendar) * this.scene.dataScale[2] - ]; - - var text = this.data.text; - if(Array.isArray(text) && text[selectIndex[1]] && text[selectIndex[1]][selectIndex[0]] !== undefined) { - selection.textLabel = text[selectIndex[1]][selectIndex[0]]; - } else if(text) { - selection.textLabel = text; - } else { - selection.textLabel = ''; + // if we're stacking we need to hold on to all valid positions + // even with invalid sizes + 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; } - selection.data.dataCoordinate = selection.dataCoordinate.slice(); - - this.surface.highlight(selection.data); - - // Snap spikes to data coordinate - this.scene.glplot.spikes.position = selection.dataCoordinate; - - return true; + if(ids) { + cdi.id = String(ids[i]); + } } -}; - -function isColormapCircular(colormap) { - var first = colormap[0].rgb, - last = colormap[colormap.length - 1].rgb; - - return ( - first[0] === last[0] && - first[1] === last[1] && - first[2] === last[2] && - first[3] === last[3] - ); -} - -// Pad coords by +1 -function padField(field) { - var shape = field.shape; - var nshape = [shape[0] + 2, shape[1] + 2]; - var nfield = ndarray(new Float32Array(nshape[0] * nshape[1]), nshape); - // Center - ops.assign(nfield.lo(1, 1).hi(shape[0], shape[1]), field); - - // Edges - ops.assign(nfield.lo(1).hi(shape[0], 1), - field.hi(shape[0], 1)); - ops.assign(nfield.lo(1, nshape[1] - 1).hi(shape[0], 1), - field.lo(0, shape[1] - 1).hi(shape[0], 1)); - ops.assign(nfield.lo(0, 1).hi(1, shape[1]), - field.hi(1)); - ops.assign(nfield.lo(nshape[0] - 1, 1).hi(1, shape[1]), - field.lo(shape[0] - 1)); - - // Corners - nfield.set(0, 0, field.get(0, 0)); - nfield.set(0, nshape[1] - 1, field.get(0, shape[1] - 1)); - nfield.set(nshape[0] - 1, 0, field.get(shape[0] - 1, 0)); - nfield.set(nshape[0] - 1, nshape[1] - 1, field.get(shape[0] - 1, shape[1] - 1)); - - return nfield; -} + arraysToCalcdata(cd, trace); + calcColorscale(gd, trace); + calcSelection(cd, trace); -function refine(coords) { - var minScale = Math.max(coords[0].shape[0], coords[0].shape[1]); + if(stackGroupOpts) { + // remove bad positions and sort + // note that original indices get added to cd in arraysToCalcdata + i = 0; + while(i < cd.length) { + if(cd[i][posAttr] === BADNUM) { + cd.splice(i, 1); + } + else i++; + } - if(minScale < MIN_RESOLUTION) { - var scaleF = MIN_RESOLUTION / minScale; - var nshape = [ - Math.floor((coords[0].shape[0]) * scaleF + 1)|0, - Math.floor((coords[0].shape[1]) * scaleF + 1)|0 ]; - var nsize = nshape[0] * nshape[1]; + Lib.sort(cd, function(a, b) { + return (a[posAttr] - b[posAttr]) || (a.i - b.i); + }); - for(var i = 0; i < coords.length; ++i) { - var padImg = padField(coords[i]); - var scaledImg = ndarray(new Float32Array(nsize), nshape); - homography(scaledImg, padImg, [scaleF, 0, 0, - 0, scaleF, 0, - 0, 0, 1]); - coords[i] = scaledImg; + if(interpolateGaps) { + // first fill the beginning with constant from the first point + i = 0; + while(i < cd.length - 1 && cd[i].gap) { + i++; + } + vali = cd[i].s; + if(!vali) vali = cd[i].s = 0; // in case of no data AT ALL in this trace - use 0 + for(j = 0; j < i; j++) { + cd[j].s = vali; + } + // then fill the end with constant from the last point + k = cd.length - 1; + while(k > i && cd[k].gap) { + k--; + } + vali = cd[k].s; + for(j = cd.length - 1; j > k; j--) { + cd[j].s = vali; + } + // now interpolate internal gaps linearly + while(i < k) { + i++; + if(cd[i].gap) { + j = i + 1; + while(cd[j].gap) { + j++; + } + var pos0 = cd[i - 1][posAttr]; + var size0 = cd[i - 1].s; + var m = (cd[j].s - size0) / (cd[j][posAttr] - pos0); + while(i < j) { + cd[i].s = size0 + (cd[i][posAttr] - pos0) * m; + i++; + } + } + } } - - return scaleF; } - return 1.0; + return cd; } -proto.setContourLevels = function() { - var nlevels = [[], [], []]; - var needsUpdate = false; +function calcAxisExpansion(gd, trace, xa, ya, x, y, ppad) { + var serieslen = trace._length; + var fullLayout = gd._fullLayout; + var xId = xa._id; + var yId = ya._id; + var firstScatter = fullLayout._firstScatter[firstScatterGroup(trace)] === trace.uid; + var stackOrientation = (getStackOpts(trace, fullLayout, xa, ya) || {}).orientation; + var fill = trace.fill; - for(var i = 0; i < 3; ++i) { - if(this.showContour[i]) { - needsUpdate = true; - nlevels[i] = this.scene.contourLevels[i]; - } - } + // cancel minimum tick spacings (only applies to bars and boxes) + xa._minDtick = 0; + ya._minDtick = 0; - if(needsUpdate) { - this.surface.update({ levels: nlevels }); - } -}; + // check whether bounds should be tight, padded, extended to zero... + // most cases both should be padded on both ends, so start with that. + var xOptions = {padded: true}; + var yOptions = {padded: true}; -proto.update = function(data) { - var i, - scene = this.scene, - sceneLayout = scene.fullSceneLayout, - surface = this.surface, - alpha = data.opacity, - colormap = parseColorScale(data.colorscale, alpha), - z = data.z, - x = data.x, - y = data.y, - xaxis = sceneLayout.xaxis, - yaxis = sceneLayout.yaxis, - zaxis = sceneLayout.zaxis, - scaleFactor = scene.dataScale, - xlen = z[0].length, - ylen = data._ylength, - coords = [ - ndarray(new Float32Array(xlen * ylen), [xlen, ylen]), - ndarray(new Float32Array(xlen * ylen), [xlen, ylen]), - ndarray(new Float32Array(xlen * ylen), [xlen, ylen]) - ], - xc = coords[0], - yc = coords[1], - contourLevels = scene.contourLevels; + if(ppad) { + xOptions.ppad = yOptions.ppad = ppad; + } - // Save data - this.data = data; + // TODO: text size - /* - * Fill and transpose zdata. - * Consistent with 'heatmap' and 'contour', plotly 'surface' - * 'z' are such that sub-arrays correspond to y-coords - * and that the sub-array entries correspond to a x-coords, - * which is the transpose of 'gl-surface-plot'. - */ + var openEnded = serieslen < 2 || (x[0] !== x[serieslen - 1]) || (y[0] !== y[serieslen - 1]); - var xcalendar = data.xcalendar, - ycalendar = data.ycalendar, - zcalendar = data.zcalendar; - - fill(coords[2], function(row, col) { - return zaxis.d2l(z[col][row], 0, zcalendar) * scaleFactor[2]; - }); - - // coords x - if(!isArrayOrTypedArray(x)) { - fill(xc, function(row) { - return xaxis.d2l(row, 0, xcalendar) * scaleFactor[0]; - }); - } else if(isArrayOrTypedArray(x[0])) { - fill(xc, function(row, col) { - return xaxis.d2l(x[col][row], 0, xcalendar) * scaleFactor[0]; - }); - } else { - // ticks x - fill(xc, function(row) { - return xaxis.d2l(x[row], 0, xcalendar) * scaleFactor[0]; - }); + // include zero (tight) and extremes (padded) if fill to zero + // (unless the shape is closed, then it's just filling the shape regardless) + if(openEnded && ( + (fill === 'tozerox') || + ((fill === 'tonextx') && (firstScatter || stackOrientation === 'h')) + )) { + xOptions.tozero = true; } - // coords y - if(!isArrayOrTypedArray(x)) { - fill(yc, function(row, col) { - return yaxis.d2l(col, 0, xcalendar) * scaleFactor[1]; - }); - } else if(isArrayOrTypedArray(y[0])) { - fill(yc, function(row, col) { - return yaxis.d2l(y[col][row], 0, ycalendar) * scaleFactor[1]; - }); - } else { - // ticks y - fill(yc, function(row, col) { - return yaxis.d2l(y[col], 0, ycalendar) * scaleFactor[1]; - }); + // if no error bars, markers or text, or fill to y=0 remove x padding + else if(!(trace.error_y || {}).visible && ( + (fill === 'tonexty' || fill === 'tozeroy') || + (!subTypes.hasMarkers(trace) && !subTypes.hasText(trace)) + )) { + xOptions.padded = false; + xOptions.ppad = 0; } - var params = { - colormap: colormap, - levels: [[], [], []], - showContour: [true, true, true], - showSurface: !data.hidesurface, - contourProject: [ - [false, false, false], - [false, false, false], - [false, false, false] - ], - contourWidth: [1, 1, 1], - contourColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], - contourTint: [1, 1, 1], - dynamicColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], - dynamicWidth: [1, 1, 1], - dynamicTint: [1, 1, 1], - opacity: data.opacity - }; - - params.intensityBounds = [data.cmin, data.cmax]; - - // Refine if necessary - if(data.surfacecolor) { - var intensity = ndarray(new Float32Array(xlen * ylen), [xlen, ylen]); - - fill(intensity, function(row, col) { - return data.surfacecolor[col][row]; - }); - - coords.push(intensity); - } - else { - // when 'z' is used as 'intensity', - // we must scale its value - params.intensityBounds[0] *= scaleFactor[2]; - params.intensityBounds[1] *= scaleFactor[2]; + // now check for y - rather different logic, though still mostly padded both ends + // include zero (tight) and extremes (padded) if fill to zero + // (unless the shape is closed, then it's just filling the shape regardless) + if(openEnded && ( + (fill === 'tozeroy') || + ((fill === 'tonexty') && (firstScatter || stackOrientation === 'v')) + )) { + yOptions.tozero = true; } - this.dataScale = refine(coords); - - if(data.surfacecolor) { - params.intensity = coords.pop(); + // tight y: any x fill + else if(fill === 'tonextx' || fill === 'tozerox') { + yOptions.padded = false; } - var highlightEnable = [true, true, true]; - var axis = ['x', 'y', 'z']; - - for(i = 0; i < 3; ++i) { - var contourParams = data.contours[axis[i]]; - highlightEnable[i] = contourParams.highlight; - - params.showContour[i] = contourParams.show || contourParams.highlight; - if(!params.showContour[i]) continue; - - params.contourProject[i] = [ - contourParams.project.x, - contourParams.project.y, - contourParams.project.z - ]; - - if(contourParams.show) { - this.showContour[i] = true; - params.levels[i] = contourLevels[i]; - surface.highlightColor[i] = params.contourColor[i] = str2RgbaArray(contourParams.color); + // N.B. asymmetric splom traces call this with blank {} xa or ya + if(xId) trace._extremes[xId] = Axes.findExtremes(xa, x, xOptions); + if(yId) trace._extremes[yId] = Axes.findExtremes(ya, y, yOptions); +} - if(contourParams.usecolormap) { - surface.highlightTint[i] = params.contourTint[i] = 0; - } - else { - surface.highlightTint[i] = params.contourTint[i] = 1; - } - params.contourWidth[i] = contourParams.width; - } else { - this.showContour[i] = false; - } +function calcMarkerSize(trace, serieslen) { + if(!subTypes.hasMarkers(trace)) return; - if(contourParams.highlight) { - params.dynamicColor[i] = str2RgbaArray(contourParams.highlightcolor); - params.dynamicWidth[i] = contourParams.highlightwidth; - } - } + // Treat size like x or y arrays --- Run d2c + // this needs to go before ppad computation + var marker = trace.marker; + var sizeref = 1.6 * (trace.marker.sizeref || 1); + var markerTrans; - // see https://github.com/plotly/plotly.js/issues/940 - if(isColormapCircular(colormap)) { - params.vertexColor = true; + 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); + }; } - params.coords = coords; - - surface.update(params); - - surface.visible = data.visible; - surface.enableDynamic = highlightEnable; - surface.enableHighlight = highlightEnable; + if(Lib.isArrayOrTypedArray(marker.size)) { + // I tried auto-type but category and dates dont make much sense. + var ax = {type: 'linear'}; + Axes.setConvert(ax); - surface.snapToData = true; + var s = ax.makeCalcdata(trace.marker, 'size'); - if('lighting' in data) { - surface.ambientLight = data.lighting.ambient; - surface.diffuseLight = data.lighting.diffuse; - surface.specularLight = data.lighting.specular; - surface.roughness = data.lighting.roughness; - surface.fresnel = data.lighting.fresnel; - } + var sizeOut = new Array(serieslen); + for(var i = 0; i < serieslen; i++) { + sizeOut[i] = markerTrans(s[i]); + } + return sizeOut; - if('lightposition' in data) { - surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z]; + } else { + return markerTrans(marker.size); } +} - if(alpha && alpha < 1) { - surface.supportsTransparency = true; - } -}; +/** + * mark the first scatter trace for each subplot + * note that scatter and scattergl each get their own first trace + * note also that I'm doing this during calc rather than supplyDefaults + * so I don't need to worry about transforms, but if we ever do + * per-trace calc this will get confused. + */ +function setFirstScatter(fullLayout, trace) { + var group = firstScatterGroup(trace); + var firstScatter = fullLayout._firstScatter; + if(!firstScatter[group]) firstScatter[group] = trace.uid; +} -proto.dispose = function() { - this.scene.glplot.remove(this.surface); - this.surface.dispose(); -}; +function firstScatterGroup(trace) { + var stackGroup = trace.stackgroup; + return trace.xaxis + trace.yaxis + trace.type + + (stackGroup ? '-' + stackGroup : ''); +} -function createSurfaceTrace(scene, data) { - var gl = scene.glplot.gl; - var surface = createSurface({ gl: gl }); - var result = new SurfaceTrace(scene, surface, data.uid); - surface._trace = result; - result.update(data); - scene.glplot.add(surface); - return result; +function getStackOpts(trace, fullLayout, xa, ya) { + var stackGroup = trace.stackgroup; + if(!stackGroup) return; + var stackOpts = fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup]; + var stackAx = stackOpts.orientation === 'v' ? ya : xa; + // Allow stacking only on numeric axes + // calc is a little late to be figuring this out, but during supplyDefaults + // we don't know the axis type yet + if(stackAx.type === 'linear' || stackAx.type === 'log') return stackOpts; } -module.exports = createSurfaceTrace; +module.exports = { + calc: calc, + calcMarkerSize: calcMarkerSize, + calcAxisExpansion: calcAxisExpansion, + setFirstScatter: setFirstScatter, + getStackOpts: getStackOpts +}; -},{"../../lib":696,"../../lib/gl_format_color":692,"../../lib/str2rgbarray":719,"gl-surface3d":303,"ndarray":433,"ndarray-fill":423,"ndarray-homography":425,"ndarray-ops":427}],1133:[function(_dereq_,module,exports){ +},{"../../constants/numerical":140,"../../lib":159,"../../plots/cartesian/axes":203,"./arrays_to_calcdata":280,"./calc_selection":283,"./colorscale_calc":284,"./subtypes":305,"fast-isnumeric":10}],283:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; -var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); -var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); -var attributes = _dereq_('./attributes'); - - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - var i, j; - - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - var z = coerce('z'); - if(!z) { - traceOut.visible = false; - return; +module.exports = function calcSelection(cd, trace) { + if(Lib.isArrayOrTypedArray(trace.selectedpoints)) { + Lib.tagSelected(cd, trace); } +}; - var x = coerce('x'); - coerce('y'); - - traceOut._xlength = (Array.isArray(x) && Lib.isArrayOrTypedArray(x[0])) ? z.length : z[0].length; - traceOut._ylength = z.length; - - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); - handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout); - - coerce('text'); - - // Coerce remaining properties - [ - 'lighting.ambient', - 'lighting.diffuse', - 'lighting.specular', - 'lighting.roughness', - 'lighting.fresnel', - 'lightposition.x', - 'lightposition.y', - 'lightposition.z', - 'hidesurface', - 'opacity' - ].forEach(function(x) { coerce(x); }); - - var surfaceColor = coerce('surfacecolor'); +},{"../../lib":159}],284:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - coerce('colorscale'); +'use strict'; - var dims = ['x', 'y', 'z']; - for(i = 0; i < 3; ++i) { +var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; +var calcColorscale = _dereq_('../../components/colorscale/calc'); - var contourDim = 'contours.' + dims[i]; - var show = coerce(contourDim + '.show'); - var highlight = coerce(contourDim + '.highlight'); +var subTypes = _dereq_('./subtypes'); - if(show || highlight) { - for(j = 0; j < 3; ++j) { - coerce(contourDim + '.project.' + dims[j]); - } - } +module.exports = function calcMarkerColorscale(gd, trace) { + if(subTypes.hasLines(trace) && hasColorscale(trace, 'line')) { + calcColorscale(gd, trace, { + vals: trace.line.color, + containerStr: 'line', + cLetter: 'c' + }); + } - if(show) { - coerce(contourDim + '.color'); - coerce(contourDim + '.width'); - coerce(contourDim + '.usecolormap'); + if(subTypes.hasMarkers(trace)) { + if(hasColorscale(trace, 'marker')) { + calcColorscale(gd, trace, { + vals: trace.marker.color, + containerStr: 'marker', + cLetter: 'c' + }); } - - if(highlight) { - coerce(contourDim + '.highlightcolor'); - coerce(contourDim + '.highlightwidth'); + if(hasColorscale(trace, 'marker.line')) { + calcColorscale(gd, trace, { + vals: trace.marker.line.color, + containerStr: 'marker.line', + cLetter: 'c' + }); } } - - // backward compatibility block - if(!surfaceColor) { - mapLegacy(traceIn, 'zmin', 'cmin'); - mapLegacy(traceIn, 'zmax', 'cmax'); - mapLegacy(traceIn, 'zauto', 'cauto'); - } - - // TODO if contours.?.usecolormap are false and hidesurface is true - // the colorbar shouldn't be shown by default - - colorscaleDefaults( - traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'} - ); - - // disable 1D transforms - currently surface does NOT support column data like heatmap does - // you can use mesh3d for this use case, but not surface - traceOut._length = null; }; -function mapLegacy(traceIn, oldAttr, newAttr) { - if(oldAttr in traceIn && !(newAttr in traceIn)) { - traceIn[newAttr] = traceIn[oldAttr]; - } -} - -},{"../../components/colorscale/defaults":580,"../../lib":696,"../../registry":827,"./attributes":1130}],1134:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":51,"../../components/colorscale/helpers":54,"./subtypes":305}],285:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173382,236 +70003,248 @@ 'use strict'; -var Surface = {}; +module.exports = { + PTS_LINESONLY: 20, -Surface.attributes = _dereq_('./attributes'); -Surface.supplyDefaults = _dereq_('./defaults'); -Surface.colorbar = { - min: 'cmin', - max: 'cmax' -}; -Surface.calc = _dereq_('./calc'); -Surface.plot = _dereq_('./convert'); + // fixed parameters of clustering and clipping algorithms -Surface.moduleType = 'trace'; -Surface.name = 'surface'; -Surface.basePlotModule = _dereq_('../../plots/gl3d'); -Surface.categories = ['gl3d', '2dMap', 'noOpacity']; -Surface.meta = { - -}; + // 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, -module.exports = Surface; + eventDataKeys: [] +}; -},{"../../plots/gl3d":787,"./attributes":1130,"./calc":1131,"./convert":1132,"./defaults":1133}],1135:[function(_dereq_,module,exports){ +},{}],286:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var annAttrs = _dereq_('../../components/annotations/attributes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var fontAttrs = _dereq_('../../plots/font_attributes'); -var domainAttrs = _dereq_('../../plots/domain').attributes; +var calc = _dereq_('./calc'); -var attrs = module.exports = overrideAll({ - domain: domainAttrs({name: 'table', trace: true}), +/* + * Scatter stacking & normalization calculations + * runs per subplot, and can handle multiple stacking groups + */ - columnwidth: { - valType: 'number', - arrayOk: true, - dflt: null, - - - }, +module.exports = function crossTraceCalc(gd, plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var subplot = xa._id + ya._id; - columnorder: { - valType: 'data_array', - - - }, + var subplotStackOpts = gd._fullLayout._scatterStackOpts[subplot]; + if(!subplotStackOpts) return; - header: { + var calcTraces = gd.calcdata; - values: { - valType: 'data_array', - - dflt: [], - - }, + var i, j, k, i2, cd, cd0, posj, sumj, norm; + var groupOpts, interpolate, groupnorm, posAttr, valAttr; + var hasAnyBlanks; - format: { - valType: 'data_array', - - dflt: [], - - }, + for(var stackGroup in subplotStackOpts) { + groupOpts = subplotStackOpts[stackGroup]; + var indices = groupOpts.traceIndices; - prefix: { - valType: 'string', - arrayOk: true, - dflt: null, - - - }, + // can get here with no indices if the stack axis is non-numeric + if(!indices.length) continue; - suffix: { - valType: 'string', - arrayOk: true, - dflt: null, - - - }, + 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; + } - height: { - valType: 'number', - dflt: 28, - - - }, + // Collect the complete set of all positions across ALL traces. + // Start with the first trace, then interleave items from later traces + // as needed. + // Fill in mising items as we go. + cd0 = calcTraces[indices[0]]; + var allPositions = new Array(cd0.length); + for(i = 0; i < cd0.length; i++) { + allPositions[i] = cd0[i][posAttr]; + } - align: extendFlat({}, annAttrs.align, {arrayOk: true}), + for(i = 1; i < indices.length; i++) { + cd = calcTraces[indices[i]]; - line: { - width: { - valType: 'number', - arrayOk: true, - dflt: 1, - - }, - color: { - valType: 'color', - arrayOk: true, - dflt: 'grey', - + for(j = k = 0; j < cd.length; j++) { + posj = cd[j][posAttr]; + for(; posj > allPositions[k] && k < allPositions.length; k++) { + // the current trace is missing a position from some previous trace(s) + insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr); + j++; + } + if(posj !== allPositions[k]) { + // previous trace(s) are missing a position from the current trace + for(i2 = 0; i2 < i; i2++) { + insertBlank(calcTraces[indices[i2]], k, posj, i2, hasAnyBlanks, interpolate, posAttr); + } + allPositions.splice(k, 0, posj); + } + k++; } - }, - - fill: { - color: { - valType: 'color', - arrayOk: true, - dflt: 'white', - - + for(; k < allPositions.length; k++) { + insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr); + j++; } - }, - - font: extendFlat({}, fontAttrs({arrayOk: true})) - }, - - cells: { - - values: { - valType: 'data_array', - - dflt: [], - - }, - - format: { - valType: 'data_array', - - dflt: [], - - }, - - prefix: { - valType: 'string', - arrayOk: true, - dflt: null, - - - }, + } - suffix: { - valType: 'string', - arrayOk: true, - dflt: null, - - - }, + var serieslen = allPositions.length; - height: { - valType: 'number', - dflt: 20, - - - }, + // stack (and normalize)! + for(j = 0; j < cd0.length; j++) { + sumj = cd0[j][valAttr] = cd0[j].s; + for(i = 1; i < indices.length; i++) { + cd = calcTraces[indices[i]]; + cd[0].trace._rawLength = cd[0].trace._length; + cd[0].trace._length = serieslen; + sumj += cd[j].s; + cd[j][valAttr] = sumj; + } - align: extendFlat({}, annAttrs.align, {arrayOk: true}), + 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; + } + } + } - line: { - width: { - valType: 'number', - arrayOk: true, - dflt: 1, - - }, - color: { - valType: 'color', - arrayOk: true, - dflt: 'grey', - + // autorange + for(i = 0; i < indices.length; i++) { + cd = calcTraces[indices[i]]; + var trace = cd[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] = cd[j].gap ? 0 : (arrayPad ? ppadRaw[cd[j].i] : ppadRaw); + } } - }, - - fill: { - color: { - valType: 'color', - arrayOk: true, - - dflt: 'white', - + var x = new Array(serieslen); + var y = new Array(serieslen); + for(j = 0; j < serieslen; j++) { + x[j] = cd[j].x; + y[j] = cd[j].y; } - }, + calc.calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); - font: extendFlat({}, fontAttrs({arrayOk: true})) + // while we're here (in a loop over all traces in the stack) + // record the orientation, so hover can find it easily + cd[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); + // Even if we're not interpolating, if one trace has multiple + // values at the same position and this trace only has one value there, + // we just duplicate that one value rather than insert a zero. + // We also make it look like a real point - because it's ambiguous which + // one really is the real one! + if(index && position === calcTrace[index - 1][posAttr]) { + var prevEntry = calcTrace[index - 1]; + newEntry.s = prevEntry.s; + // TODO is it going to cause any problems to have multiple + // calcdata points with the same index? + newEntry.i = prevEntry.i; + newEntry.gap = prevEntry.gap; + } + else if(interpolate) { + newEntry.s = getInterp(calcTrace, index, position, posAttr); + } + if(!index) { + // t and trace need to stay on the first cd entry + calcTrace[0].t = calcTrace[1].t; + calcTrace[0].trace = calcTrace[1].trace; + delete calcTrace[1].t; + delete calcTrace[1].trace; } -}, 'calc', 'from-root'); -attrs.transforms = undefined; +} + +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]); +} -},{"../../components/annotations/attributes":553,"../../lib/extend":685,"../../plot_api/edit_types":727,"../../plots/domain":770,"../../plots/font_attributes":771}],1136:[function(_dereq_,module,exports){ +},{"./calc":282}],287:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var getModuleCalcData = _dereq_('../../plots/get_data').getModuleCalcData; -var tablePlot = _dereq_('./plot'); -var TABLE = 'table'; +// remove opacity for any trace that has a fill or is filled to +module.exports = function crossTraceDefaults(fullData) { + for(var i = 0; i < fullData.length; i++) { + var tracei = fullData[i]; + if(tracei.type !== 'scatter') continue; -exports.name = TABLE; + var filli = tracei.fill; + if(filli === 'none' || filli === 'toself') continue; -exports.plot = function(gd) { - var calcData = getModuleCalcData(gd.calcdata, TABLE)[0]; - if(calcData.length) tablePlot(gd, calcData); -}; + tracei.opacity = undefined; -exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { - var hadTable = (oldFullLayout._has && oldFullLayout._has(TABLE)); - var hasTable = (newFullLayout._has && newFullLayout._has(TABLE)); + if(filli === 'tonexty' || filli === 'tonextx') { + for(var j = i - 1; j >= 0; j--) { + var tracej = fullData[j]; - if(hadTable && !hasTable) { - oldFullLayout._paperdiv.selectAll('.table').remove(); + if((tracej.type === 'scatter') && + (tracej.xaxis === tracei.xaxis) && + (tracej.yaxis === tracei.yaxis)) { + tracej.opacity = undefined; + break; + } + } + } } }; -},{"../../plots/get_data":781,"./plot":1143}],1137:[function(_dereq_,module,exports){ +},{}],288:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173620,272 +70253,87 @@ 'use strict'; -var wrap = _dereq_('../../lib/gup').wrap; - -module.exports = function calc() { - // we don't actually need to include the trace here, since that will be added - // by Plots.doCalcdata, and that's all we actually need later. - return wrap({}); -}; - -},{"../../lib/gup":693}],1138:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; +var Lib = _dereq_('../../lib'); +var Registry = _dereq_('../../registry'); -module.exports = { - cellPad: 8, - columnExtentOffset: 10, - columnTitleOffset: 28, - emptyHeaderHeight: 16, - latexCheck: /^\$.*\$$/, - goldenRatio: 1.618, - lineBreaker: '
', - maxDimensionCount: 60, - overdrag: 45, - releaseTransitionDuration: 120, - releaseTransitionEase: 'cubic-out', - scrollbarCaptureWidth: 18, - scrollbarHideDelay: 1000, - scrollbarHideDuration: 1000, - scrollbarOffset: 5, - scrollbarWidth: 8, - transitionDuration: 100, - transitionEase: 'cubic-out', - uplift: 5, - wrapSpacer: ' ', - wrapSplitCharacter: ' ', - cn: { - // general class names - table: 'table', - tableControlView: 'table-control-view', - scrollBackground: 'scroll-background', - yColumn: 'y-column', - columnBlock: 'column-block', - scrollAreaClip: 'scroll-area-clip', - scrollAreaClipRect: 'scroll-area-clip-rect', - columnBoundary: 'column-boundary', - columnBoundaryClippath: 'column-boundary-clippath', - columnBoundaryRect: 'column-boundary-rect', - columnCells: 'column-cells', - columnCell: 'column-cell', - cellRect: 'cell-rect', - cellText: 'cell-text', - cellTextHolder: 'cell-text-holder', +var attributes = _dereq_('./attributes'); +var constants = _dereq_('./constants'); +var subTypes = _dereq_('./subtypes'); +var handleXYDefaults = _dereq_('./xy_defaults'); +var handleStackDefaults = _dereq_('./stack_defaults'); +var handleMarkerDefaults = _dereq_('./marker_defaults'); +var handleLineDefaults = _dereq_('./line_defaults'); +var handleLineShapeDefaults = _dereq_('./line_shape_defaults'); +var handleTextDefaults = _dereq_('./text_defaults'); +var handleFillColorDefaults = _dereq_('./fillcolor_defaults'); - // scroll related class names - scrollbarKit: 'scrollbar-kit', - scrollbar: 'scrollbar', - scrollbarSlider: 'scrollbar-slider', - scrollbarGlyph: 'scrollbar-glyph', - scrollbarCaptureZone: 'scrollbar-capture-zone' +module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { + function coerce(attr, dflt) { + return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } -}; - -},{}],1139:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; + var len = handleXYDefaults(traceIn, traceOut, layout, coerce); + if(!len) traceOut.visible = false; -var c = _dereq_('./constants'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; -var isNumeric = _dereq_('fast-isnumeric'); + if(!traceOut.visible) return; -// pure functions, don't alter but passes on `gd` and parts of `trace` without deep copying -module.exports = function calc(gd, trace) { - var cellsValues = squareStringMatrix(trace.cells.values); - var slicer = function(a) { - return a.slice(trace.header.values.length, a.length); - }; - var headerValuesIn = squareStringMatrix(trace.header.values); - if(headerValuesIn.length && !headerValuesIn[0].length) { - headerValuesIn[0] = ['']; - headerValuesIn = squareStringMatrix(headerValuesIn); - } - var headerValues = headerValuesIn - .concat(slicer(cellsValues).map(function() { - return emptyStrings((headerValuesIn[0] || ['']).length); - })); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); - var domain = trace.domain; - var groupWidth = Math.floor(gd._fullLayout._size.w * (domain.x[1] - domain.x[0])); - var groupHeight = Math.floor(gd._fullLayout._size.h * (domain.y[1] - domain.y[0])); - var headerRowHeights = trace.header.values.length ? - headerValues[0].map(function() { return trace.header.height; }) : - [c.emptyHeaderHeight]; - var rowHeights = cellsValues.length ? cellsValues[0].map(function() { return trace.cells.height; }) : []; - var headerHeight = headerRowHeights.reduce(sum, 0); - var scrollHeight = groupHeight - headerHeight; - var minimumFillHeight = scrollHeight + c.uplift; - var anchorToRowBlock = makeAnchorToRowBlock(rowHeights, minimumFillHeight); - var anchorToHeaderRowBlock = makeAnchorToRowBlock(headerRowHeights, headerHeight); - var headerRowBlocks = makeRowBlock(anchorToHeaderRowBlock, []); - var rowBlocks = makeRowBlock(anchorToRowBlock, headerRowBlocks); - var uniqueKeys = {}; - var columnOrder = trace._fullInput.columnorder.concat(slicer(cellsValues.map(function(d, i) {return i;}))); - var columnWidths = headerValues.map(function(d, i) { - var value = Array.isArray(trace.columnwidth) ? - trace.columnwidth[Math.min(i, trace.columnwidth.length - 1)] : - trace.columnwidth; - return isNumeric(value) ? Number(value) : 1; - }); - var totalColumnWidths = columnWidths.reduce(sum, 0); - - // fit columns in the available vertical space as there's no vertical scrolling now - columnWidths = columnWidths.map(function(d) { return d / totalColumnWidths * groupWidth; }); - - var maxLineWidth = Math.max(arrayMax(trace.header.line.width), arrayMax(trace.cells.line.width)); - - var calcdata = { - key: trace.index, - translateX: domain.x[0] * gd._fullLayout._size.w, - translateY: gd._fullLayout._size.h * (1 - domain.y[1]), - size: gd._fullLayout._size, - width: groupWidth, - maxLineWidth: maxLineWidth, - height: groupHeight, - columnOrder: columnOrder, // will be mutated on column move, todo use in callback - groupHeight: groupHeight, - rowBlocks: rowBlocks, - headerRowBlocks: headerRowBlocks, - scrollY: 0, // will be mutated on scroll - cells: extendFlat({}, trace.cells, {values: cellsValues}), - headerCells: extendFlat({}, trace.header, {values: headerValues}), - gdColumns: headerValues.map(function(d) {return d[0];}), - gdColumnsOriginalOrder: headerValues.map(function(d) {return d[0];}), - prevPages: [0, 0], - scrollbarState: {scrollbarScrollInProgress: false}, - columns: headerValues.map(function(label, i) { - var foundKey = uniqueKeys[label]; - uniqueKeys[label] = (foundKey || 0) + 1; - var key = label + '__' + uniqueKeys[label]; - return { - key: key, - label: label, - specIndex: i, - xIndex: columnOrder[i], - xScale: xScale, - x: undefined, // initialized below - calcdata: undefined, // initialized below - columnWidth: columnWidths[i] - }; - }) - }; + var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? + 'lines+markers' : 'lines'; + coerce('text'); + coerce('hovertext'); + coerce('mode', defaultMode); - calcdata.columns.forEach(function(col) { - col.calcdata = calcdata; - col.x = xScale(col); - }); + if(subTypes.hasLines(traceOut)) { + handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); + handleLineShapeDefaults(traceIn, traceOut, coerce); + coerce('connectgaps'); + coerce('line.simplify'); + } - return calcdata; -}; + if(subTypes.hasMarkers(traceOut)) { + handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true}); + } -function arrayMax(maybeArray) { - if(Array.isArray(maybeArray)) { - var max = 0; - for(var i = 0; i < maybeArray.length; i++) { - max = Math.max(max, arrayMax(maybeArray[i])); - } - return max; + if(subTypes.hasText(traceOut)) { + handleTextDefaults(traceIn, traceOut, layout, coerce); } - return maybeArray; -} -function sum(a, b) { return a + b; } + var dfltHoverOn = []; -// fill matrix in place to equal lengths -// and ensure it's uniformly 2D -function squareStringMatrix(matrixIn) { - var matrix = matrixIn.slice(); - var minLen = Infinity; - var maxLen = 0; - var i; - for(i = 0; i < matrix.length; i++) { - if(!Array.isArray(matrix[i])) matrix[i] = [matrix[i]]; - minLen = Math.min(minLen, matrix[i].length); - maxLen = Math.max(maxLen, matrix[i].length); + if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) { + coerce('cliponaxis'); + coerce('marker.maxdisplayed'); + dfltHoverOn.push('points'); } - if(minLen !== maxLen) { - for(i = 0; i < matrix.length; i++) { - var padLen = maxLen - matrix[i].length; - if(padLen) matrix[i] = matrix[i].concat(emptyStrings(padLen)); - } + // It's possible for this default to be changed by a later trace. + // We handle that case in some hacky code inside handleStackDefaults. + coerce('fill', stackGroupOpts ? stackGroupOpts.fillDflt : 'none'); + if(traceOut.fill !== 'none') { + handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); + if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } - return matrix; -} - -function emptyStrings(len) { - var padArray = new Array(len); - for(var j = 0; j < len; j++) padArray[j] = ''; - return padArray; -} -function xScale(d) { - return d.calcdata.columns.reduce(function(prev, next) { - return next.xIndex < d.xIndex ? prev + next.columnWidth : prev; - }, 0); -} + var lineColor = (traceOut.line || {}).color; + var markerColor = (traceOut.marker || {}).color; -function makeRowBlock(anchorToRowBlock, auxiliary) { - var blockAnchorKeys = Object.keys(anchorToRowBlock); - return blockAnchorKeys.map(function(k) {return extendFlat({}, anchorToRowBlock[k], {auxiliaryBlocks: auxiliary});}); -} - -function makeAnchorToRowBlock(rowHeights, minimumFillHeight) { - - var anchorToRowBlock = {}; - var currentRowHeight; - var currentAnchor = 0; - var currentBlockHeight = 0; - var currentBlock = makeIdentity(); - var currentFirstRowIndex = 0; - var blockCounter = 0; - for(var i = 0; i < rowHeights.length; i++) { - currentRowHeight = rowHeights[i]; - currentBlock.rows.push({ - rowIndex: i, - rowHeight: currentRowHeight - }); - currentBlockHeight += currentRowHeight; - if(currentBlockHeight >= minimumFillHeight || i === rowHeights.length - 1) { - anchorToRowBlock[currentAnchor] = currentBlock; - currentBlock.key = blockCounter++; - currentBlock.firstRowIndex = currentFirstRowIndex; - currentBlock.lastRowIndex = i; - currentBlock = makeIdentity(); - currentAnchor += currentBlockHeight; - currentFirstRowIndex = i + 1; - currentBlockHeight = 0; - } + 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'}); - return anchorToRowBlock; -} - -function makeIdentity() { - return { - firstRowIndex: null, - lastRowIndex: null, - rows: [] - }; -} + Lib.coerceSelectionMarkerOpacity(traceOut, coerce); +}; -},{"../../lib/extend":685,"./constants":1138,"fast-isnumeric":214}],1140:[function(_dereq_,module,exports){ +},{"../../lib":159,"../../registry":243,"./attributes":281,"./constants":285,"./fillcolor_defaults":290,"./line_defaults":294,"./line_shape_defaults":296,"./marker_defaults":300,"./stack_defaults":303,"./subtypes":305,"./text_defaults":306,"./xy_defaults":307}],289:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173894,174 +70342,132 @@ 'use strict'; -var extendFlat = _dereq_('../../lib/extend').extendFlat; +var Lib = _dereq_('../../lib'); + +/** Fill hover 'pointData' container with 'correct' hover text value + * + * - If trace hoverinfo contains a 'text' flag and hovertext is not set, + * the text elements will be seen in the hover labels. + * + * - If trace hoverinfo contains a 'text' flag and hovertext is set, + * hovertext takes precedence over text + * i.e. the hoverinfo elements will be seen in the hover labels + * + * @param {object} calcPt + * @param {object} trace + * @param {object || array} contOut (mutated here) + */ +module.exports = function fillHoverText(calcPt, trace, contOut) { + var fill = Array.isArray(contOut) ? + function(v) { contOut.push(v); } : + function(v) { contOut.text = v; }; -// pure functions, don't alter but passes on `gd` and parts of `trace` without deep copying + var htx = Lib.extractOption(calcPt, trace, 'htx', 'hovertext'); + if(isValid(htx)) return fill(htx); -exports.splitToPanels = function(d) { - var prevPages = [0, 0]; - var headerPanel = extendFlat({}, d, { - key: 'header', - type: 'header', - page: 0, - prevPages: prevPages, - currentRepaint: [null, null], - dragHandle: true, - values: d.calcdata.headerCells.values[d.specIndex], - rowBlocks: d.calcdata.headerRowBlocks, - calcdata: extendFlat({}, d.calcdata, {cells: d.calcdata.headerCells}) - }); - var revolverPanel1 = extendFlat({}, d, { - key: 'cells1', - type: 'cells', - page: 0, - prevPages: prevPages, - currentRepaint: [null, null], - dragHandle: false, - values: d.calcdata.cells.values[d.specIndex], - rowBlocks: d.calcdata.rowBlocks - }); - var revolverPanel2 = extendFlat({}, d, { - key: 'cells2', - type: 'cells', - page: 1, - prevPages: prevPages, - currentRepaint: [null, null], - dragHandle: false, - values: d.calcdata.cells.values[d.specIndex], - rowBlocks: d.calcdata.rowBlocks - }); - // order due to SVG using painter's algo: - return [revolverPanel1, revolverPanel2, headerPanel]; -}; - -exports.splitToCells = function(d) { - var fromTo = rowFromTo(d); - return (d.values || []).slice(fromTo[0], fromTo[1]).map(function(v, i) { - // By keeping identical key, a DOM node removal, creation and addition is spared, important when visible - // grid has a lot of elements (quadratic with xcol/ycol count). - // But it has to be busted when `svgUtil.convertToTspans` is used as it reshapes cell subtrees asynchronously, - // and by that time the user may have scrolled away, resulting in stale overwrites. The real solution will be - // to turn `svgUtil.convertToTspans` into a cancelable request, in which case no key busting is needed. - var buster = (typeof v === 'string') && v.match(/[<$&> ]/) ? '_keybuster_' + Math.random() : ''; - return { - // keyWithinBlock: /*fromTo[0] + */i, // optimized future version - no busting - // keyWithinBlock: fromTo[0] + i, // initial always-unoptimized version - janky scrolling with 5+ columns - keyWithinBlock: i + buster, // current compromise: regular content is very fast; async content is possible - key: fromTo[0] + i, - column: d, - calcdata: d.calcdata, - page: d.page, - rowBlocks: d.rowBlocks, - value: v - }; - }); + var tx = Lib.extractOption(calcPt, trace, 'tx', 'text'); + if(isValid(tx)) return fill(tx); }; -function rowFromTo(d) { - var rowBlock = d.rowBlocks[d.page]; - // fixme rowBlock truthiness check is due to ugly hack of placing 2nd panel as d.page = -1 - var rowFrom = rowBlock ? rowBlock.rows[0].rowIndex : 0; - var rowTo = rowBlock ? rowFrom + rowBlock.rows.length : 0; - return [rowFrom, rowTo]; +// accept all truthy values and 0 (which gets cast to '0' in the hover labels) +function isValid(v) { + return v || v === 0; } -},{"../../lib/extend":685}],1141:[function(_dereq_,module,exports){ +},{"../../lib":159}],290:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../../lib'); -var attributes = _dereq_('./attributes'); -var handleDomainDefaults = _dereq_('../../plots/domain').defaults; - -function defaultColumnOrder(traceOut, coerce) { - var specifiedColumnOrder = traceOut.columnorder || []; - var commonLength = traceOut.header.values.length; - var truncated = specifiedColumnOrder.slice(0, commonLength); - var sorted = truncated.slice().sort(function(a, b) {return a - b;}); - var oneStepped = truncated.map(function(d) {return sorted.indexOf(d);}); - for(var i = oneStepped.length; i < commonLength; i++) { - oneStepped.push(i); - } - coerce('columnorder', oneStepped); -} - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - - handleDomainDefaults(traceOut, layout, coerce); - coerce('columnwidth'); +'use strict'; - coerce('header.values'); - coerce('header.format'); - coerce('header.align'); +var Color = _dereq_('../../components/color'); +var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; - coerce('header.prefix'); - coerce('header.suffix'); - coerce('header.height'); - coerce('header.line.width'); - coerce('header.line.color'); - coerce('header.fill.color'); - Lib.coerceFont(coerce, 'header.font', Lib.extendFlat({}, layout.font)); +module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce) { + var inheritColorFromMarker = false; - defaultColumnOrder(traceOut, coerce); + if(traceOut.marker) { + // don't try to inherit a color array + var markerColor = traceOut.marker.color; + var markerLineColor = (traceOut.marker.line || {}).color; - coerce('cells.values'); - coerce('cells.format'); - coerce('cells.align'); - coerce('cells.prefix'); - coerce('cells.suffix'); - coerce('cells.height'); - coerce('cells.line.width'); - coerce('cells.line.color'); - coerce('cells.fill.color'); - Lib.coerceFont(coerce, 'cells.font', Lib.extendFlat({}, layout.font)); + if(markerColor && !isArrayOrTypedArray(markerColor)) { + inheritColorFromMarker = markerColor; + } + else if(markerLineColor && !isArrayOrTypedArray(markerLineColor)) { + inheritColorFromMarker = markerLineColor; + } + } - // disable 1D transforms - traceOut._length = null; + coerce('fillcolor', Color.addOpacity( + (traceOut.line || {}).color || + inheritColorFromMarker || + defaultColor, 0.5 + )); }; -},{"../../lib":696,"../../plots/domain":770,"./attributes":1135}],1142:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../lib":159}],291:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var Table = {}; +var Color = _dereq_('../../components/color'); +var subtypes = _dereq_('./subtypes'); -Table.attributes = _dereq_('./attributes'); -Table.supplyDefaults = _dereq_('./defaults'); -Table.calc = _dereq_('./calc'); -Table.plot = _dereq_('./plot'); -Table.moduleType = 'trace'; -Table.name = 'table'; -Table.basePlotModule = _dereq_('./base_plot'); -Table.categories = ['noOpacity']; -Table.meta = { - -}; +module.exports = function getTraceColor(trace, di) { + var lc, tc; + + // TODO: text modes + + if(trace.mode === 'lines') { + lc = trace.line.color; + return (lc && Color.opacity(lc)) ? + lc : trace.fillcolor; + } + else if(trace.mode === 'none') { + return trace.fill ? trace.fillcolor : ''; + } + else { + var mc = di.mcc || (trace.marker || {}).color; + var mlc = di.mlcc || ((trace.marker || {}).line || {}).color; + + tc = (mc && Color.opacity(mc)) ? mc : + (mlc && Color.opacity(mlc) && + (di.mlw || ((trace.marker || {}).line || {}).width)) ? mlc : ''; -module.exports = Table; + if(tc) { + // make sure the points aren't TOO transparent + if(Color.opacity(tc) < 0.3) { + return Color.addOpacity(tc, 0.3); + } + else return tc; + } + else { + lc = (trace.line || {}).color; + return (lc && Color.opacity(lc) && + subtypes.hasLines(trace) && trace.line.width) ? + lc : trace.fillcolor; + } + } +}; -},{"./attributes":1135,"./base_plot":1136,"./calc":1137,"./defaults":1141,"./plot":1143}],1143:[function(_dereq_,module,exports){ +},{"../../components/color":43,"./subtypes":305}],292:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174070,1320 +70476,757 @@ 'use strict'; -var c = _dereq_('./constants'); -var d3 = _dereq_('d3'); -var gup = _dereq_('../../lib/gup'); -var Drawing = _dereq_('../../components/drawing'); -var svgUtil = _dereq_('../../lib/svg_text_utils'); -var raiseToTop = _dereq_('../../lib').raiseToTop; -var cancelEeaseColumn = _dereq_('../../lib').cancelTransition; -var prepareData = _dereq_('./data_preparation_helper'); -var splitData = _dereq_('./data_split_helpers'); +var Lib = _dereq_('../../lib'); +var Fx = _dereq_('../../components/fx'); +var Registry = _dereq_('../../registry'); +var getTraceColor = _dereq_('./get_trace_color'); var Color = _dereq_('../../components/color'); +var fillHoverText = _dereq_('./fill_hover_text'); -module.exports = function plot(gd, wrappedTraceHolders) { - - var table = gd._fullLayout._paper.selectAll('.' + c.cn.table) - .data(wrappedTraceHolders.map(function(wrappedTraceHolder) { - var traceHolder = gup.unwrap(wrappedTraceHolder); - var trace = traceHolder.trace; - return prepareData(gd, trace); - }), gup.keyFun); - - table.exit().remove(); - - table.enter() - .append('g') - .classed(c.cn.table, true) - .attr('overflow', 'visible') - .style('box-sizing', 'content-box') - .style('position', 'absolute') - .style('left', 0) - .style('overflow', 'visible') - .style('shape-rendering', 'crispEdges') - .style('pointer-events', 'all'); - - table - .attr('width', function(d) {return d.width + d.size.l + d.size.r;}) - .attr('height', function(d) {return d.height + d.size.t + d.size.b;}) - .attr('transform', function(d) { - return 'translate(' + d.translateX + ',' + d.translateY + ')'; - }); - - var tableControlView = table.selectAll('.' + c.cn.tableControlView) - .data(gup.repeat, gup.keyFun); - - tableControlView.enter() - .append('g') - .classed(c.cn.tableControlView, true) - .style('box-sizing', 'content-box') - .on('mousemove', function(d) {tableControlView.filter(function(dd) {return d === dd;}).call(renderScrollbarKit, gd);}) - .on('mousewheel', function(d) { - if(d.scrollbarState.wheeling) return; - d.scrollbarState.wheeling = true; - d3.event.stopPropagation(); - d3.event.preventDefault(); - makeDragRow(gd, tableControlView, null, d.scrollY + d3.event.deltaY)(d); - d.scrollbarState.wheeling = false; - }) - .call(renderScrollbarKit, gd, true); - - tableControlView - .attr('transform', function(d) {return 'translate(' + d.size.l + ' ' + d.size.t + ')';}); - - // scrollBackground merely ensures that mouse events are captured even on crazy fast scrollwheeling - // otherwise rendering glitches may occur - var scrollBackground = tableControlView.selectAll('.' + c.cn.scrollBackground) - .data(gup.repeat, gup.keyFun); - - scrollBackground.enter() - .append('rect') - .classed(c.cn.scrollBackground, true) - .attr('fill', 'none'); - - scrollBackground - .attr('width', function(d) {return d.width;}) - .attr('height', function(d) {return d.height;}); - - tableControlView - .each(function(d) {Drawing.setClipUrl(d3.select(this), scrollAreaBottomClipKey(gd, d));}); - - var yColumn = tableControlView.selectAll('.' + c.cn.yColumn) - .data(function(vm) {return vm.columns;}, gup.keyFun); - - yColumn.enter() - .append('g') - .classed(c.cn.yColumn, true); - - yColumn.exit().remove(); - - yColumn - .attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}) - .call(d3.behavior.drag() - .origin(function(d) { - var movedColumn = d3.select(this); - easeColumn(movedColumn, d, -c.uplift); - raiseToTop(this); - d.calcdata.columnDragInProgress = true; - renderScrollbarKit(tableControlView.filter(function(dd) {return d.calcdata.key === dd.key;}), gd); - return d; - }) - .on('drag', function(d) { - var movedColumn = d3.select(this); - var getter = function(dd) {return (d === dd ? d3.event.x : dd.x) + dd.columnWidth / 2;}; - d.x = Math.max(-c.overdrag, Math.min(d.calcdata.width + c.overdrag - d.columnWidth, d3.event.x)); - - var sortableColumns = flatData(yColumn).filter(function(dd) {return dd.calcdata.key === d.calcdata.key;}); - var newOrder = sortableColumns.sort(function(a, b) {return getter(a) - getter(b);}); - newOrder.forEach(function(dd, i) { - dd.xIndex = i; - dd.x = d === dd ? dd.x : dd.xScale(dd); - }); - - yColumn.filter(function(dd) {return d !== dd;}) - .transition() - .ease(c.transitionEase) - .duration(c.transitionDuration) - .attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); - movedColumn - .call(cancelEeaseColumn) - .attr('transform', 'translate(' + d.x + ' -' + c.uplift + ' )'); - }) - .on('dragend', function(d) { - var movedColumn = d3.select(this); - var p = d.calcdata; - d.x = d.xScale(d); - d.calcdata.columnDragInProgress = false; - easeColumn(movedColumn, d, 0); - columnMoved(gd, p, p.columns.map(function(dd) {return dd.xIndex;})); - }) - ); - - yColumn.each(function(d) {Drawing.setClipUrl(d3.select(this), columnBoundaryClipKey(gd, d));}); - - var columnBlock = yColumn.selectAll('.' + c.cn.columnBlock) - .data(splitData.splitToPanels, gup.keyFun); - - columnBlock.enter() - .append('g') - .classed(c.cn.columnBlock, true) - .attr('id', function(d) {return d.key;}); - - columnBlock - .style('cursor', function(d) { - return d.dragHandle ? 'ew-resize' : d.calcdata.scrollbarState.barWiggleRoom ? 'ns-resize' : 'default'; - }); - - var headerColumnBlock = columnBlock.filter(headerBlock); - var cellsColumnBlock = columnBlock.filter(cellsBlock); - - cellsColumnBlock - .call(d3.behavior.drag() - .origin(function(d) { - d3.event.stopPropagation(); - return d; - }) - .on('drag', makeDragRow(gd, tableControlView, -1)) - .on('dragend', function() { - // fixme emit plotly notification - }) - ); - - // initial rendering: header is rendered first, as it may may have async LaTeX (show header first) - // but blocks are _entered_ the way they are due to painter's algo (header on top) - renderColumnCellTree(gd, tableControlView, headerColumnBlock, columnBlock); - renderColumnCellTree(gd, tableControlView, cellsColumnBlock, columnBlock); - - var scrollAreaClip = tableControlView.selectAll('.' + c.cn.scrollAreaClip) - .data(gup.repeat, gup.keyFun); - - scrollAreaClip.enter() - .append('clipPath') - .classed(c.cn.scrollAreaClip, true) - .attr('id', function(d) {return scrollAreaBottomClipKey(gd, d);}); - - var scrollAreaClipRect = scrollAreaClip.selectAll('.' + c.cn.scrollAreaClipRect) - .data(gup.repeat, gup.keyFun); - - scrollAreaClipRect.enter() - .append('rect') - .classed(c.cn.scrollAreaClipRect, true) - .attr('x', -c.overdrag) - .attr('y', -c.uplift) - .attr('fill', 'none'); - - scrollAreaClipRect - .attr('width', function(d) {return d.width + 2 * c.overdrag;}) - .attr('height', function(d) {return d.height + c.uplift;}); - - var columnBoundary = yColumn.selectAll('.' + c.cn.columnBoundary) - .data(gup.repeat, gup.keyFun); - - columnBoundary.enter() - .append('g') - .classed(c.cn.columnBoundary, true); - - var columnBoundaryClippath = yColumn.selectAll('.' + c.cn.columnBoundaryClippath) - .data(gup.repeat, gup.keyFun); - - // SVG spec doesn't mandate wrapping into a and doesn't seem to cause a speed difference - columnBoundaryClippath.enter() - .append('clipPath') - .classed(c.cn.columnBoundaryClippath, true); - - columnBoundaryClippath - .attr('id', function(d) {return columnBoundaryClipKey(gd, d);}); - - var columnBoundaryRect = columnBoundaryClippath.selectAll('.' + c.cn.columnBoundaryRect) - .data(gup.repeat, gup.keyFun); - - columnBoundaryRect.enter() - .append('rect') - .classed(c.cn.columnBoundaryRect, true) - .attr('fill', 'none'); - - columnBoundaryRect - .attr('width', function(d) { return d.columnWidth + 2 * roundHalfWidth(d); }) - .attr('height', function(d) {return d.calcdata.height + 2 * roundHalfWidth(d) + c.uplift;}) - .attr('x', function(d) { return -roundHalfWidth(d); }) - .attr('y', function(d) { return -roundHalfWidth(d); }); - - updateBlockYPosition(null, cellsColumnBlock, tableControlView); -}; - -function roundHalfWidth(d) { - return Math.ceil(d.calcdata.maxLineWidth / 2); -} - -function scrollAreaBottomClipKey(gd, d) { - return 'clip' + gd._fullLayout._uid + '_scrollAreaBottomClip_' + d.key; -} - -function columnBoundaryClipKey(gd, d) { - return 'clip' + gd._fullLayout._uid + '_columnBoundaryClippath_' + d.calcdata.key + '_' + d.specIndex; -} - -function flatData(selection) { - return [].concat.apply([], selection.map(function(g) {return g;})) - .map(function(g) {return g.__data__;}); -} - -function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { - - function calcTotalHeight(d) { - var blocks = d.rowBlocks; - return firstRowAnchor(blocks, blocks.length - 1) + (blocks.length ? rowsHeight(blocks[blocks.length - 1], Infinity) : 1); - } - - var scrollbarKit = tableControlView.selectAll('.' + c.cn.scrollbarKit) - .data(gup.repeat, gup.keyFun); - - scrollbarKit.enter() - .append('g') - .classed(c.cn.scrollbarKit, true) - .style('shape-rendering', 'geometricPrecision'); +module.exports = function hoverPoints(pointData, xval, yval, hovermode) { + var cd = pointData.cd; + var trace = cd[0].trace; + var xa = pointData.xa; + var ya = pointData.ya; + var xpx = xa.c2p(xval); + var ypx = ya.c2p(yval); + var pt = [xpx, ypx]; + var hoveron = trace.hoveron || ''; + var minRad = (trace.mode.indexOf('markers') !== -1) ? 3 : 0.5; - scrollbarKit - .each(function(d) { - var s = d.scrollbarState; - s.totalHeight = calcTotalHeight(d); - s.scrollableAreaHeight = d.groupHeight - headerHeight(d); - s.currentlyVisibleHeight = Math.min(s.totalHeight, s.scrollableAreaHeight); - s.ratio = s.currentlyVisibleHeight / s.totalHeight; - s.barLength = Math.max(s.ratio * s.currentlyVisibleHeight, c.goldenRatio * c.scrollbarWidth); - s.barWiggleRoom = s.currentlyVisibleHeight - s.barLength; - s.wiggleRoom = Math.max(0, s.totalHeight - s.scrollableAreaHeight); - s.topY = s.barWiggleRoom === 0 ? 0 : (d.scrollY / s.wiggleRoom) * s.barWiggleRoom; - s.bottomY = s.topY + s.barLength; - s.dragMultiplier = s.wiggleRoom / s.barWiggleRoom; - }) - .attr('transform', function(d) { - var xPosition = d.width + c.scrollbarWidth / 2 + c.scrollbarOffset; - return 'translate(' + xPosition + ' ' + headerHeight(d) + ')'; - }); + // look for points to hover on first, then take fills only if we + // didn't find a point + if(hoveron.indexOf('points') !== -1) { + var dx = function(di) { + // dx and dy are used in compare modes - here we want to always + // prioritize the closest data point, at least as long as markers are + // the same size or nonexistent, but still try to prioritize small markers too. + var rad = Math.max(3, di.mrc || 0); + var kink = 1 - 1 / rad; + var dxRaw = Math.abs(xa.c2p(di.x) - xpx); + var d = (dxRaw < rad) ? (kink * dxRaw / rad) : (dxRaw - rad + kink); + return d; + }; + var dy = function(di) { + var rad = Math.max(3, di.mrc || 0); + var kink = 1 - 1 / rad; + var dyRaw = Math.abs(ya.c2p(di.y) - ypx); + return (dyRaw < rad) ? (kink * dyRaw / rad) : (dyRaw - rad + kink); + }; + var dxy = function(di) { + // scatter points: d.mrc is the calculated marker radius + // adjust the distance so if you're inside the marker it + // always will show up regardless of point size, but + // prioritize smaller points + var rad = Math.max(minRad, di.mrc || 0); + var dx = xa.c2p(di.x) - xpx; + var dy = ya.c2p(di.y) - ypx; + return Math.max(Math.sqrt(dx * dx + dy * dy) - rad, 1 - minRad / rad); + }; + var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); - var scrollbar = scrollbarKit.selectAll('.' + c.cn.scrollbar) - .data(gup.repeat, gup.keyFun); + Fx.getClosest(cd, distfn, pointData); - scrollbar.enter() - .append('g') - .classed(c.cn.scrollbar, true); + // skip the rest (for this trace) if we didn't find a close point + if(pointData.index !== false) { - var scrollbarSlider = scrollbar.selectAll('.' + c.cn.scrollbarSlider) - .data(gup.repeat, gup.keyFun); + // the closest data point + var di = cd[pointData.index]; + var xc = xa.c2p(di.x, true); + var yc = ya.c2p(di.y, true); + var rad = di.mrc || 1; - scrollbarSlider.enter() - .append('g') - .classed(c.cn.scrollbarSlider, true); + // now we're done using the whole `calcdata` array, replace the + // index with the original index (in case of inserted point from + // stacked area) + pointData.index = di.i; - scrollbarSlider - .attr('transform', function(d) { - return 'translate(0 ' + (d.scrollbarState.topY || 0) + ')'; - }); + var orientation = cd[0].t.orientation; + // TODO: for scatter and bar, option to show (sub)totals and + // raw data? Currently stacked and/or normalized bars just show + // the normalized individual sizes, so that's what I'm doing here + // for now. + var sizeVal = orientation && (di.sNorm || di.s); + var xLabelVal = (orientation === 'h') ? sizeVal : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.y; - var scrollbarGlyph = scrollbarSlider.selectAll('.' + c.cn.scrollbarGlyph) - .data(gup.repeat, gup.keyFun); + Lib.extendFlat(pointData, { + color: getTraceColor(trace, di), - scrollbarGlyph.enter() - .append('line') - .classed(c.cn.scrollbarGlyph, true) - .attr('stroke', 'black') - .attr('stroke-width', c.scrollbarWidth) - .attr('stroke-linecap', 'round') - .attr('y1', c.scrollbarWidth / 2); + x0: xc - rad, + x1: xc + rad, + xLabelVal: xLabelVal, - scrollbarGlyph - .attr('y2', function(d) { - return d.scrollbarState.barLength - c.scrollbarWidth / 2; - }) - .attr('stroke-opacity', function(d) { - return d.columnDragInProgress || !d.scrollbarState.barWiggleRoom || bypassVisibleBar ? 0 : 0.4; - }); + y0: yc - rad, + y1: yc + rad, + yLabelVal: yLabelVal, - // cancel transition: possible pending (also, delayed) transition - scrollbarGlyph - .transition().delay(0).duration(0); - - scrollbarGlyph - .transition().delay(c.scrollbarHideDelay).duration(c.scrollbarHideDuration) - .attr('stroke-opacity', 0); - - var scrollbarCaptureZone = scrollbar.selectAll('.' + c.cn.scrollbarCaptureZone) - .data(gup.repeat, gup.keyFun); - - scrollbarCaptureZone.enter() - .append('line') - .classed(c.cn.scrollbarCaptureZone, true) - .attr('stroke', 'white') - .attr('stroke-opacity', 0.01) // some browser might get rid of a 0 opacity element - .attr('stroke-width', c.scrollbarCaptureWidth) - .attr('stroke-linecap', 'butt') - .attr('y1', 0) - .on('mousedown', function(d) { - var y = d3.event.y; - var bbox = this.getBoundingClientRect(); - var s = d.scrollbarState; - var pixelVal = y - bbox.top; - var inverseScale = d3.scale.linear().domain([0, s.scrollableAreaHeight]).range([0, s.totalHeight]).clamp(true); - if(!(s.topY <= pixelVal && pixelVal <= s.bottomY)) { - makeDragRow(gd, tableControlView, null, inverseScale(pixelVal - s.barLength / 2))(d); - } - }) - .call(d3.behavior.drag() - .origin(function(d) { - d3.event.stopPropagation(); - d.scrollbarState.scrollbarScrollInProgress = true; - return d; - }) - .on('drag', makeDragRow(gd, tableControlView)) - .on('dragend', function() { - // fixme emit Plotly event - }) - ); + spikeDistance: dxy(di), + hovertemplate: trace.hovertemplate + }); - scrollbarCaptureZone - .attr('y2', function(d) { - return d.scrollbarState.scrollableAreaHeight; - }); + fillHoverText(di, trace, pointData); + Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, pointData); - // Remove scroll glyph and capture zone on static plots - // as they don't render properly when converted to PDF - // in the Chrome PDF viewer - // https://github.com/plotly/streambed/issues/11618 - if(gd._context.staticPlot) { - scrollbarGlyph.remove(); - scrollbarCaptureZone.remove(); + return [pointData]; + } } -} - -function renderColumnCellTree(gd, tableControlView, columnBlock, allColumnBlock) { - // fixme this perf hotspot - // this is performance critical code as scrolling calls it on every revolver switch - // it appears sufficiently fast but there are plenty of low-hanging fruits for performance optimization - - var columnCells = renderColumnCells(columnBlock); - - var columnCell = renderColumnCell(columnCells); - - supplyStylingValues(columnCell); - var cellRect = renderCellRect(columnCell); - - sizeAndStyleRect(cellRect); - - var cellTextHolder = renderCellTextHolder(columnCell); - - var cellText = renderCellText(cellTextHolder); - - setFont(cellText); - populateCellText(cellText, tableControlView, allColumnBlock, gd); - - // doing this at the end when text, and text stlying are set - setCellHeightAndPositionY(columnCell); -} - -function renderColumnCells(columnBlock) { - - var columnCells = columnBlock.selectAll('.' + c.cn.columnCells) - .data(gup.repeat, gup.keyFun); - - columnCells.enter() - .append('g') - .classed(c.cn.columnCells, true); - - columnCells.exit() - .remove(); - - return columnCells; -} - -function renderColumnCell(columnCells) { - - var columnCell = columnCells.selectAll('.' + c.cn.columnCell) - .data(splitData.splitToCells, function(d) {return d.keyWithinBlock;}); - - columnCell.enter() - .append('g') - .classed(c.cn.columnCell, true); - - columnCell.exit() - .remove(); - - return columnCell; -} - -function renderCellRect(columnCell) { - - var cellRect = columnCell.selectAll('.' + c.cn.cellRect) - .data(gup.repeat, function(d) {return d.keyWithinBlock;}); - - cellRect.enter() - .append('rect') - .classed(c.cn.cellRect, true); - - return cellRect; -} - -function renderCellText(cellTextHolder) { - - var cellText = cellTextHolder.selectAll('.' + c.cn.cellText) - .data(gup.repeat, function(d) {return d.keyWithinBlock;}); - - cellText.enter() - .append('text') - .classed(c.cn.cellText, true) - .style('cursor', function() {return 'auto';}) - .on('mousedown', function() {d3.event.stopPropagation();}); - - return cellText; -} - -function renderCellTextHolder(columnCell) { - - var cellTextHolder = columnCell.selectAll('.' + c.cn.cellTextHolder) - .data(gup.repeat, function(d) {return d.keyWithinBlock;}); - - cellTextHolder.enter() - .append('g') - .classed(c.cn.cellTextHolder, true) - .style('shape-rendering', 'geometricPrecision'); - - return cellTextHolder; -} - -function supplyStylingValues(columnCell) { - columnCell - .each(function(d, i) { - var spec = d.calcdata.cells.font; - var col = d.column.specIndex; - var font = { - size: gridPick(spec.size, col, i), - color: gridPick(spec.color, col, i), - family: gridPick(spec.family, col, i) - }; - d.rowNumber = d.key; - d.align = gridPick(d.calcdata.cells.align, col, i); - d.cellBorderWidth = gridPick(d.calcdata.cells.line.width, col, i); - d.font = font; - }); -} - -function setFont(cellText) { - cellText - .each(function(d) { - Drawing.font(d3.select(this), d.font); - }); -} - -function sizeAndStyleRect(cellRect) { - cellRect - .attr('width', function(d) {return d.column.columnWidth;}) - .attr('stroke-width', function(d) {return d.cellBorderWidth;}) - .each(function(d) { - var atomicSelection = d3.select(this); - Color.stroke(atomicSelection, gridPick(d.calcdata.cells.line.color, d.column.specIndex, d.rowNumber)); - Color.fill(atomicSelection, gridPick(d.calcdata.cells.fill.color, d.column.specIndex, d.rowNumber)); - }); -} - -function populateCellText(cellText, tableControlView, allColumnBlock, gd) { - cellText - .text(function(d) { - - var col = d.column.specIndex; - var row = d.rowNumber; - - var userSuppliedContent = d.value; - var stringSupplied = (typeof userSuppliedContent === 'string'); - var hasBreaks = stringSupplied && userSuppliedContent.match(/
/i); - var userBrokenText = !stringSupplied || hasBreaks; - d.mayHaveMarkup = stringSupplied && userSuppliedContent.match(/[<&>]/); - - var latex = isLatex(userSuppliedContent); - d.latex = latex; - - var prefix = latex ? '' : gridPick(d.calcdata.cells.prefix, col, row) || ''; - var suffix = latex ? '' : gridPick(d.calcdata.cells.suffix, col, row) || ''; - var format = latex ? null : gridPick(d.calcdata.cells.format, col, row) || null; - - var prefixSuffixedText = prefix + (format ? d3.format(format)(d.value) : d.value) + suffix; - - var hasWrapSplitCharacter; - d.wrappingNeeded = !d.wrapped && !userBrokenText && !latex && (hasWrapSplitCharacter = hasWrapCharacter(prefixSuffixedText)); - d.cellHeightMayIncrease = hasBreaks || latex || d.mayHaveMarkup || (hasWrapSplitCharacter === void(0) ? hasWrapCharacter(prefixSuffixedText) : hasWrapSplitCharacter); - d.needsConvertToTspans = d.mayHaveMarkup || d.wrappingNeeded || d.latex; - - var textToRender; - if(d.wrappingNeeded) { - var hrefPreservedText = c.wrapSplitCharacter === ' ' ? prefixSuffixedText.replace(/ yAvg) !== (y1 >= yAvg)) { + x0 = pts[j - 1][0]; + x1 = pts[j][0]; + if(y1 - y0) { + xCross = x0 + (x1 - x0) * (yAvg - y0) / (y1 - y0); + xmin = Math.min(xmin, xCross); + xmax = Math.max(xmax, xCross); + } + } + } } - }); -} -function isLatex(content) { - return typeof content === 'string' && content.match(c.latexCheck); -} + // constrain xmin/max to the visible plot now too + xmin = Math.max(xmin, 0); + xmax = Math.min(xmax, xa._length); -function hasWrapCharacter(text) {return text.indexOf(c.wrapSplitCharacter) !== -1;} + // get only fill or line color for the hover color + var color = Color.defaultLine; + if(Color.opacity(trace.fillcolor)) color = trace.fillcolor; + else if(Color.opacity((trace.line || {}).color)) { + color = trace.line.color; + } -function columnMoved(gd, calcdata, indices) { - var o = calcdata.gdColumnsOriginalOrder; - calcdata.gdColumns.sort(function(a, b) { - return indices[o.indexOf(a)] - indices[o.indexOf(b)]; - }); + 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: xmin, + x1: xmax, + y0: yAvg, + y1: yAvg, + color: color, + hovertemplate: '%{name}' + }); - calcdata.columnorder = indices; + delete pointData.index; - gd.emit('plotly_restyle'); -} + if(trace.text && !Array.isArray(trace.text)) { + pointData.text = String(trace.text); + } + else pointData.text = trace.name; -function gridPick(spec, col, row) { - if(Array.isArray(spec)) { - var column = spec[Math.min(col, spec.length - 1)]; - if(Array.isArray(column)) { - return column[Math.min(row, column.length - 1)]; - } else { - return column; + return [pointData]; } - } else { - return spec; } -} - -function easeColumn(selection, d, y) { - selection - .transition() - .ease(c.releaseTransitionEase) - .duration(c.releaseTransitionDuration) - .attr('transform', 'translate(' + d.x + ' ' + y + ')'); -} - -function cellsBlock(d) {return d.type === 'cells';} -function headerBlock(d) {return d.type === 'header';} +}; +},{"../../components/color":43,"../../components/fx":82,"../../lib":159,"../../registry":243,"./fill_hover_text":289,"./get_trace_color":291}],293:[function(_dereq_,module,exports){ /** - * Revolver panel and cell contents layouting - */ +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ -function headerHeight(d) { - var headerBlocks = d.rowBlocks.length ? d.rowBlocks[0].auxiliaryBlocks : []; - return headerBlocks.reduce(function(p, n) {return p + rowsHeight(n, Infinity);}, 0); -} -function findPagesAndCacheHeights(blocks, scrollY, scrollHeight) { +'use strict'; - var pages = []; - var pTop = 0; +var Scatter = {}; - for(var blockIndex = 0; blockIndex < blocks.length; blockIndex++) { +var subtypes = _dereq_('./subtypes'); +Scatter.hasLines = subtypes.hasLines; +Scatter.hasMarkers = subtypes.hasMarkers; +Scatter.hasText = subtypes.hasText; +Scatter.isBubble = subtypes.isBubble; - var block = blocks[blockIndex]; - var blockRows = block.rows; - var rowsHeight = 0; - for(var i = 0; i < blockRows.length; i++) { - rowsHeight += blockRows[i].rowHeight; - } +Scatter.attributes = _dereq_('./attributes'); +Scatter.supplyDefaults = _dereq_('./defaults'); +Scatter.crossTraceDefaults = _dereq_('./cross_trace_defaults'); +Scatter.calc = _dereq_('./calc').calc; +Scatter.crossTraceCalc = _dereq_('./cross_trace_calc'); +Scatter.arraysToCalcdata = _dereq_('./arrays_to_calcdata'); +Scatter.plot = _dereq_('./plot'); +Scatter.colorbar = _dereq_('./marker_colorbar'); +Scatter.style = _dereq_('./style').style; +Scatter.styleOnSelect = _dereq_('./style').styleOnSelect; +Scatter.hoverPoints = _dereq_('./hover'); +Scatter.selectPoints = _dereq_('./select'); +Scatter.animatable = true; - // caching allRowsHeight on the block - it's safe as this function is always called from within the code part - // that handles increases to row heights - block.allRowsHeight = rowsHeight; +Scatter.moduleType = 'trace'; +Scatter.name = 'scatter'; +Scatter.basePlotModule = _dereq_('../../plots/cartesian'); +Scatter.categories = [ + 'cartesian', 'svg', 'symbols', 'errorBarsOK', 'showLegend', 'scatter-like', + 'zoomScale' +]; +Scatter.meta = { + +}; - var pBottom = pTop + rowsHeight; - var windowTop = scrollY; - var windowBottom = windowTop + scrollHeight; - if(windowTop < pBottom && windowBottom > pTop) { - pages.push(blockIndex); - } - pTop += rowsHeight; +module.exports = Scatter; - // consider this nice final optimization; put it in `for` condition - caveat, currently the - // block.allRowsHeight relies on being invalidated, so enabling this opt may not be safe - // if(pages.length > 1) break; - } +},{"../../plots/cartesian":215,"./arrays_to_calcdata":280,"./attributes":281,"./calc":282,"./cross_trace_calc":286,"./cross_trace_defaults":287,"./defaults":288,"./hover":292,"./marker_colorbar":299,"./plot":301,"./select":302,"./style":304,"./subtypes":305}],294:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - return pages; -} +'use strict'; -function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) { - var d = flatData(cellsColumnBlock)[0]; - if(d === undefined) return; - var blocks = d.rowBlocks; - var calcdata = d.calcdata; +var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; +var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; +var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); - var bottom = firstRowAnchor(blocks, blocks.length); - var scrollHeight = d.calcdata.groupHeight - headerHeight(d); - var scrollY = calcdata.scrollY = Math.max(0, Math.min(bottom - scrollHeight, calcdata.scrollY)); +module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { + var markerColor = (traceIn.marker || {}).color; - var pages = findPagesAndCacheHeights(blocks, scrollY, scrollHeight); - if(pages.length === 1) { - if(pages[0] === blocks.length - 1) { - pages.unshift(pages[0] - 1); - } else { - pages.push(pages[0] + 1); - } - } + coerce('line.color', defaultColor); - // make phased out page jump by 2 while leaving stationary page intact - if(pages[0] % 2) { - pages.reverse(); + 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); } - cellsColumnBlock - .each(function(d, i) { - // these values will also be needed when a block is translated again due to growing cell height - d.page = pages[i]; - d.scrollY = scrollY; - }); + coerce('line.width'); + if(!(opts || {}).noDash) coerce('line.dash'); +}; - cellsColumnBlock - .attr('transform', function(d) { - var yTranslate = firstRowAnchor(d.rowBlocks, d.page) - d.scrollY; - return 'translate(0 ' + yTranslate + ')'; - }); +},{"../../components/colorscale/defaults":53,"../../components/colorscale/helpers":54,"../../lib":159}],295:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // conditionally rerendering panel 0 and 1 - if(gd) { - conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, d.prevPages, d, 0); - conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, d.prevPages, d, 1); - renderScrollbarKit(tableControlView, gd); - } -} -function makeDragRow(gd, allTableControlView, optionalMultiplier, optionalPosition) { - return function dragRow(eventD) { - // may come from whicever DOM event target: drag, wheel, bar... eventD corresponds to event target - var d = eventD.calcdata ? eventD.calcdata : eventD; - var tableControlView = allTableControlView.filter(function(dd) {return d.key === dd.key;}); - var multiplier = optionalMultiplier || d.scrollbarState.dragMultiplier; - d.scrollY = optionalPosition === void(0) ? d.scrollY + multiplier * d3.event.dy : optionalPosition; - var cellsColumnBlock = tableControlView.selectAll('.' + c.cn.yColumn).selectAll('.' + c.cn.columnBlock).filter(cellsBlock); - updateBlockYPosition(gd, cellsColumnBlock, tableControlView); - }; -} +'use strict'; -function conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, prevPages, d, revolverIndex) { - var shouldComponentUpdate = pages[revolverIndex] !== prevPages[revolverIndex]; - if(shouldComponentUpdate) { - clearTimeout(d.currentRepaint[revolverIndex]); - d.currentRepaint[revolverIndex] = setTimeout(function() { - // setTimeout might lag rendering but yields a smoother scroll, because fast scrolling makes - // some repaints invisible ie. wasteful (DOM work blocks the main thread) - var toRerender = cellsColumnBlock.filter(function(d, i) {return i === revolverIndex && pages[i] !== prevPages[i];}); - renderColumnCellTree(gd, tableControlView, toRerender, cellsColumnBlock); - prevPages[revolverIndex] = pages[revolverIndex]; - }); - } -} +var numConstants = _dereq_('../../constants/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 = _dereq_('../../lib'); +var segmentsIntersect = Lib.segmentsIntersect; +var constrain = Lib.constrain; +var constants = _dereq_('./constants'); -function wrapTextMaker(columnBlock, element, tableControlView, gd) { - return function wrapText() { - var cellTextHolder = d3.select(element.parentNode); - cellTextHolder - .each(function(d) { - var fragments = d.fragments; - cellTextHolder.selectAll('tspan.line').each(function(dd, i) { - fragments[i].width = this.getComputedTextLength(); - }); - // last element is only for measuring the separator character, so it's ignored: - var separatorLength = fragments[fragments.length - 1].width; - var rest = fragments.slice(0, -1); - var currentRow = []; - var currentAddition, currentAdditionLength; - var currentRowLength = 0; - var rowLengthLimit = d.column.columnWidth - 2 * c.cellPad; - d.value = ''; - while(rest.length) { - currentAddition = rest.shift(); - currentAdditionLength = currentAddition.width + separatorLength; - if(currentRowLength + currentAdditionLength > rowLengthLimit) { - d.value += currentRow.join(c.wrapSpacer) + c.lineBreaker; - currentRow = []; - currentRowLength = 0; - } - currentRow.push(currentAddition.text); - currentRowLength += currentAdditionLength; - } - if(currentRowLength) { - d.value += currentRow.join(c.wrapSpacer); - } - d.wrapped = true; - }); - // the pre-wrapped text was rendered only for the text measurements - cellTextHolder.selectAll('tspan.line').remove(); +module.exports = function linePoints(d, opts) { + var xa = opts.xaxis; + var ya = opts.yaxis; + var xLog = xa.type === 'log'; + var yLog = ya.type === 'log'; + var xLen = xa._length; + var yLen = ya._length; + var connectGaps = opts.connectGaps; + var baseTolerance = opts.baseTolerance; + var shape = opts.shape; + var linear = shape === 'linear'; + var segments = []; + var minTolerance = constants.minTolerance; + var pts = new Array(d.length); + var pti = 0; - // resupply text, now wrapped - populateCellText(cellTextHolder.select('.' + c.cn.cellText), tableControlView, columnBlock, gd); - d3.select(element.parentNode.parentNode).call(setCellHeightAndPositionY); - }; -} + var i; -function updateYPositionMaker(columnBlock, element, tableControlView, gd, d) { - return function updateYPosition() { - if(d.settledY) return; - var cellTextHolder = d3.select(element.parentNode); - var l = getBlock(d); - var rowIndex = d.key - l.firstRowIndex; + // pt variables are pixel coordinates [x,y] of one point + // these four are the outputs of clustering on a line + var clusterStartPt, clusterEndPt, clusterHighPt, clusterLowPt; - var declaredRowHeight = l.rows[rowIndex].rowHeight; + // "this" is the next point we're considering adding to the cluster + var thisPt; - var requiredHeight = d.cellHeightMayIncrease ? element.parentNode.getBoundingClientRect().height + 2 * c.cellPad : declaredRowHeight; + // did we encounter the high point first, then a low point, or vice versa? + var clusterHighFirst; - var finalHeight = Math.max(requiredHeight, declaredRowHeight); - var increase = finalHeight - l.rows[rowIndex].rowHeight; + // the first two points in the cluster determine its unit vector + // so the second is always in the "High" direction + var clusterUnitVector; - if(increase) { + // the pixel delta from clusterStartPt + var thisVector; - // current row height increased - l.rows[rowIndex].rowHeight = finalHeight; + // val variables are (signed) pixel distances along the cluster vector + var clusterRefDist, clusterHighVal, clusterLowVal, thisVal; - columnBlock - .selectAll('.' + c.cn.columnCell) - .call(setCellHeightAndPositionY); + // deviation variables are (signed) pixel distances normal to the cluster vector + var clusterMinDeviation, clusterMaxDeviation, thisDeviation; - updateBlockYPosition(null, columnBlock.filter(cellsBlock), 0); + // turn one calcdata point into pixel coordinates + function getPt(index) { + var di = d[index]; + if(!di) return false; + var x = xa.c2p(di.x); + var y = ya.c2p(di.y); - // if d.column.type === 'header', then the scrollbar has to be pushed downward to the scrollable area - // if d.column.type === 'cells', it can still be relevant if total scrolling content height is less than the - // scrollable window, as increases to row heights may need scrollbar updates - renderScrollbarKit(tableControlView, gd, true); + // if non-positive log values, set them VERY far off-screen + // so the line looks essentially straight from the previous point. + if(x === BADNUM) { + if(xLog) x = xa.c2p(di.x, true); + if(x === BADNUM) return false; + // If BOTH were bad log values, make the line follow a constant + // exponent rather than a constant slope + if(yLog && y === BADNUM) { + x *= Math.abs(xa._m * yLen * (xa._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS) / + (ya._m * xLen * (ya._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS))); + } + x *= 1000; } - - cellTextHolder - .attr('transform', function() { - // this code block is only invoked for items where d.cellHeightMayIncrease is truthy - var element = this; - var columnCellElement = element.parentNode; - var box = columnCellElement.getBoundingClientRect(); - var rectBox = d3.select(element.parentNode).select('.' + c.cn.cellRect).node().getBoundingClientRect(); - var currentTransform = element.transform.baseVal.consolidate(); - var yPosition = rectBox.top - box.top + (currentTransform ? currentTransform.matrix.f : c.cellPad); - return 'translate(' + xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width) + ' ' + yPosition + ')'; - }); - - d.settledY = true; - }; -} - -function xPosition(d, optionalWidth) { - switch(d.align) { - case 'left': return c.cellPad; - case 'right': return d.column.columnWidth - (optionalWidth || 0) - c.cellPad; - case 'center': return (d.column.columnWidth - (optionalWidth || 0)) / 2; - default: return c.cellPad; - } -} - -function setCellHeightAndPositionY(columnCell) { - columnCell - .attr('transform', function(d) { - var headerHeight = d.rowBlocks[0].auxiliaryBlocks.reduce(function(p, n) {return p + rowsHeight(n, Infinity);}, 0); - var l = getBlock(d); - var rowAnchor = rowsHeight(l, d.key); - var yOffset = rowAnchor + headerHeight; - return 'translate(0 ' + yOffset + ')'; - }) - .selectAll('.' + c.cn.cellRect) - .attr('height', function(d) {return getRow(getBlock(d), d.key).rowHeight;}); -} - -function firstRowAnchor(blocks, page) { - var total = 0; - for(var i = page - 1; i >= 0; i--) { - total += allRowsHeight(blocks[i]); + if(y === BADNUM) { + if(yLog) y = ya.c2p(di.y, true); + if(y === BADNUM) return false; + y *= 1000; + } + return [x, y]; } - return total; -} -function rowsHeight(rowBlock, key) { - var total = 0; - for(var i = 0; i < rowBlock.rows.length && rowBlock.rows[i].rowIndex < key; i++) { - total += rowBlock.rows[i].rowHeight; + 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; + } } - return total; -} -function allRowsHeight(rowBlock) { - var cached = rowBlock.allRowsHeight; + var latestXFrac, latestYFrac; + // if we're off-screen, increase tolerance over baseTolerance + function getTolerance(pt, nextPt) { + var xFrac = pt[0] / xLen; + var yFrac = pt[1] / yLen; + var offScreenFraction = Math.max(0, -xFrac, xFrac - 1, -yFrac, yFrac - 1); + if(offScreenFraction && (latestXFrac !== undefined) && + crossesViewport(xFrac, yFrac, latestXFrac, latestYFrac) + ) { + offScreenFraction = 0; + } + if(offScreenFraction && nextPt && + crossesViewport(xFrac, yFrac, nextPt[0] / xLen, nextPt[1] / yLen) + ) { + offScreenFraction = 0; + } - if(cached !== void(0)) { - return cached; + return (1 + constants.toleranceGrowth * offScreenFraction) * baseTolerance; } - var total = 0; - for(var i = 0; i < rowBlock.rows.length; i++) { - total += rowBlock.rows[i].rowHeight; + function ptDist(pt1, pt2) { + var dx = pt1[0] - pt2[0]; + var dy = pt1[1] - pt2[1]; + return Math.sqrt(dx * dx + dy * dy); } - rowBlock.allRowsHeight = total; - - return total; -} - -function getBlock(d) {return d.rowBlocks[d.page];} -function getRow(l, i) {return l.rows[i - l.firstRowIndex];} - -},{"../../components/color":570,"../../components/drawing":595,"../../lib":696,"../../lib/gup":693,"../../lib/svg_text_utils":720,"./constants":1138,"./data_preparation_helper":1139,"./data_split_helpers":1140,"d3":148}],1144:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -'use strict'; -var boxAttrs = _dereq_('../box/attributes'); -var extendFlat = _dereq_('../../lib/extend').extendFlat; - -module.exports = { - y: boxAttrs.y, - x: boxAttrs.x, - x0: boxAttrs.x0, - y0: boxAttrs.y0, - name: boxAttrs.name, - orientation: extendFlat({}, boxAttrs.orientation, { - - }), - - bandwidth: { - valType: 'number', - min: 0, - - editType: 'calc', - - }, - - scalegroup: { - valType: 'string', - - dflt: '', - editType: 'calc', - - }, - scalemode: { - valType: 'enumerated', - values: ['width', 'count'], - dflt: 'width', - - editType: 'calc', - - }, - - spanmode: { - valType: 'enumerated', - values: ['soft', 'hard', 'manual'], - dflt: 'soft', - - editType: 'calc', - - }, - span: { - valType: 'info_array', - items: [ - {valType: 'any', editType: 'calc'}, - {valType: 'any', editType: 'calc'} - ], - - editType: 'calc', - - }, + // last bit of filtering: clip paths that are VERY far off-screen + // so we don't get near the browser's hard limit (+/- 2^29 px in Chrome and FF) - line: { - color: { - valType: 'color', - - editType: 'style', - - }, - width: { - valType: 'number', - - min: 0, - dflt: 2, - editType: 'style', - - }, - editType: 'plot' - }, - fillcolor: boxAttrs.fillcolor, + var maxScreensAway = constants.maxScreensAway; - points: extendFlat({}, boxAttrs.boxpoints, { - - }), - jitter: extendFlat({}, boxAttrs.jitter, { - - }), - pointpos: extendFlat({}, boxAttrs.pointpos, { - - }), - marker: boxAttrs.marker, - text: boxAttrs.text, + // find the intersections between the segment from pt1 to pt2 + // and the large rectangle maxScreensAway around the viewport + // if one of pt1 and pt2 is inside and the other outside, there + // will be only one intersection. + // if both are outside there will be 0 or 2 intersections + // (or 1 if it's right at a corner - we'll treat that like 0) + // returns an array of intersection pts + 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; - box: { - visible: { - valType: 'boolean', - dflt: false, - - editType: 'plot', - - }, - width: { - valType: 'number', - min: 0, - max: 1, - dflt: 0.25, - - editType: 'plot', - - }, - fillcolor: { - valType: 'color', - - editType: 'style', - - }, - line: { - color: { - valType: 'color', - - editType: 'style', - - }, - width: { - valType: 'number', - min: 0, - - editType: 'style', - - }, - editType: 'style' - }, - editType: 'plot' - }, + // for linear line shape, edge intersections should be linearly interpolated + // spline uses this too, which isn't precisely correct but is actually pretty + // good, because Catmull-Rom weights far-away points less in creating the curvature + function getLinearEdgeIntersections(pt1, pt2) { + var out = []; + var ptCount = 0; + for(var i = 0; i < 4; i++) { + var edge = edges[i]; + 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 we have 2 intersections, make sure the closest one to pt1 comes first + if(ptCount && ptDist(ptInt, pt1) < ptDist(out[0], pt1)) out.unshift(ptInt); + else out.push(ptInt); + ptCount++; + } + } + return out; + } - meanline: { - visible: { - valType: 'boolean', - dflt: false, - - editType: 'plot', - - }, - color: { - valType: 'color', - - editType: 'style', - - }, - width: { - valType: 'number', - min: 0, - - editType: 'style', - - }, - editType: 'plot' - }, + function onlyConstrainedPoint(pt) { + if(pt[0] < xEdge0 || pt[0] > xEdge1 || pt[1] < yEdge0 || pt[1] > yEdge1) { + return [constrain(pt[0], xEdge0, xEdge1), constrain(pt[1], yEdge0, yEdge1)]; + } + } - side: { - valType: 'enumerated', - values: ['both', 'positive', 'negative'], - dflt: 'both', - - editType: 'plot', - - }, + 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; + } - selected: boxAttrs.selected, - unselected: boxAttrs.unselected, + // for line shapes hv and vh, movement in the two dimensions is decoupled, + // so all we need to do is constrain each dimension independently + function getHVEdgeIntersections(pt1, pt2) { + var out = []; + var ptInt1 = onlyConstrainedPoint(pt1); + var ptInt2 = onlyConstrainedPoint(pt2); + if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out; - hoveron: { - valType: 'flaglist', - flags: ['violins', 'points', 'kde'], - dflt: 'violins+points+kde', - extras: ['all'], - - editType: 'style', - + if(ptInt1) out.push(ptInt1); + if(ptInt2) out.push(ptInt2); + return out; } -}; - -},{"../../lib/extend":685,"../box/attributes":859}],1145:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; + // hvh and vhv we sometimes have to move one of the intersection points + // out BEYOND the clipping rect, by a maximum of a factor of 2, so that + // the midpoint line is drawn in the right place + function getABAEdgeIntersections(dim, limit0, limit1) { + return function(pt1, pt2) { + var ptInt1 = onlyConstrainedPoint(pt1); + var ptInt2 = onlyConstrainedPoint(pt2); -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var boxCalc = _dereq_('../box/calc'); -var helpers = _dereq_('./helpers'); -var BADNUM = _dereq_('../../constants/numerical').BADNUM; + var out = []; + if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out; -module.exports = function calc(gd, trace) { - var cd = boxCalc(gd, trace); + if(ptInt1) out.push(ptInt1); + if(ptInt2) out.push(ptInt2); - if(cd[0].t.empty) return cd; + 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; - var fullLayout = gd._fullLayout; - var valAxis = Axes.getFromId( - gd, - trace[trace.orientation === 'h' ? 'xaxis' : 'yaxis'] - ); + ptToAlter[dim] += midShift; + } - var violinScaleGroupStats = fullLayout._violinScaleGroupStats; - var scaleGroup = trace.scalegroup; - var groupStats = violinScaleGroupStats[scaleGroup]; - if(!groupStats) { - groupStats = violinScaleGroupStats[scaleGroup] = { - maxWidth: 0, - maxCount: 0 + return out; }; } - var spanMin = Infinity; - var spanMax = -Infinity; - - for(var i = 0; i < cd.length; i++) { - var cdi = cd[i]; - var vals = cdi.pts.map(helpers.extractVal); + 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); - var bandwidth = cdi.bandwidth = calcBandwidth(trace, cdi, vals); - var span = cdi.span = calcSpan(trace, cdi, valAxis, bandwidth); + // a segment pt1->pt2 entirely outside the nearby region: + // find the corner it gets closest to touching + 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; - // step that well covers the bandwidth and is multiple of span distance - var dist = span[1] - span[0]; - var n = Math.ceil(dist / (bandwidth / 3)); - var step = dist / n; + if(b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1]; + else return [m > 0 ? xEdge1 : xEdge0, yEdge0]; + } - if(!isFinite(step) || !isFinite(n)) { - Lib.error('Something went wrong with computing the violin span'); - cd[0].t.empty = true; - return cd; + function updateEdge(pt) { + var x = pt[0]; + var y = pt[1]; + var xSame = x === pts[pti - 1][0]; + var ySame = y === pts[pti - 1][1]; + // duplicate point? + if(xSame && ySame) return; + if(pti > 1) { + // backtracking along an edge? + var xSame2 = x === pts[pti - 2][0]; + var ySame2 = y === pts[pti - 2][1]; + if(xSame && (x === xEdge0 || x === xEdge1) && xSame2) { + if(ySame2) pti--; // backtracking exactly - drop prev pt and don't add + else pts[pti - 1] = pt; // not exact: replace the prev pt + } + else if(ySame && (y === yEdge0 || y === yEdge1) && ySame2) { + if(xSame2) pti--; + else pts[pti - 1] = pt; + } + else pts[pti++] = pt; } + else pts[pti++] = pt; + } - var kde = helpers.makeKDE(cdi, trace, vals); - cdi.density = new Array(n); - - for(var k = 0, t = span[0]; t < (span[1] + step / 2); k++, t += step) { - var v = kde(t); - groupStats.maxWidth = Math.max(groupStats.maxWidth, v); - cdi.density[k] = {v: v, t: t}; + function updateEdgesForReentry(pt) { + // if we're outside the nearby region and going back in, + // we may need to loop around a corner point + if(pts[pti - 1][0] !== pt[0] && pts[pti - 1][1] !== pt[1]) { + updateEdge([lastXEdge, lastYEdge]); } - - groupStats.maxCount = Math.max(groupStats.maxCount, vals.length); - - spanMin = Math.min(spanMin, span[0]); - spanMax = Math.max(spanMax, span[1]); + updateEdge(pt); + lastFarPt = null; + lastXEdge = lastYEdge = 0; } - var extremes = Axes.findExtremes(valAxis, [spanMin, spanMax], {padded: true}); - trace._extremes[valAxis._id] = extremes; + function addPt(pt) { + latestXFrac = pt[0] / xLen; + latestYFrac = pt[1] / yLen; + // Are we more than maxScreensAway off-screen any direction? + // if so, clip to this box, but in such a way that on-screen + // drawing is unchanged + xEdge = (pt[0] < xEdge0) ? xEdge0 : (pt[0] > xEdge1) ? xEdge1 : 0; + yEdge = (pt[1] < yEdge0) ? yEdge0 : (pt[1] > yEdge1) ? yEdge1 : 0; + if(xEdge || yEdge) { + // to get fills right - if first point is far, push it toward the + // screen in whichever direction(s) are far + if(!pti) { + pts[pti++] = [xEdge || pt[0], yEdge || pt[1]]; + } + else if(lastFarPt) { + // both this point and the last are outside the nearby region + // check if we're crossing the nearby region + var intersections = getEdgeIntersections(lastFarPt, pt); + if(intersections.length > 1) { + updateEdgesForReentry(intersections[0]); + pts[pti++] = intersections[1]; + } + } + // we're leaving the nearby region - add the point where we left it + else { + edgePt = getEdgeIntersections(pts[pti - 1], pt)[0]; + pts[pti++] = edgePt; + } - cd[0].t.labels.kde = Lib._(gd, 'kde:'); + var lastPt = pts[pti - 1]; + if(xEdge && yEdge && (lastPt[0] !== xEdge || lastPt[1] !== yEdge)) { + // we've gone out beyond a new corner: add the corner too + // so that the next point will take the right winding + if(lastFarPt) { + if(lastXEdge !== xEdge && lastYEdge !== yEdge) { + if(lastXEdge && lastYEdge) { + // we've gone around to an opposite corner - we + // need to add the correct extra corner + // in order to get the right winding + updateEdge(getClosestCorner(lastFarPt, pt)); + } + else { + // we're coming from a far edge - the extra corner + // we need is determined uniquely by the sectors + updateEdge([lastXEdge || xEdge, lastYEdge || yEdge]); + } + } + else if(lastXEdge && lastYEdge) { + updateEdge([lastXEdge, lastYEdge]); + } + } + updateEdge([xEdge, yEdge]); + } + else if((lastXEdge - xEdge) && (lastYEdge - yEdge)) { + // we're coming from an edge or far corner to an edge - again the + // extra corner we need is uniquely determined by the sectors + updateEdge([xEdge || lastXEdge, yEdge || lastYEdge]); + } + lastFarPt = pt; + lastXEdge = xEdge; + lastYEdge = yEdge; + } + else { + if(lastFarPt) { + // this point is in range but the previous wasn't: add its entry pt first + updateEdgesForReentry(getEdgeIntersections(lastFarPt, pt)[0]); + } - return cd; -}; + pts[pti++] = pt; + } + } -// Default to Silveman's rule of thumb -// - https://stats.stackexchange.com/a/6671 -// - https://en.wikipedia.org/wiki/Kernel_density_estimation#A_rule-of-thumb_bandwidth_estimator -// - https://github.com/statsmodels/statsmodels/blob/master/statsmodels/nonparametric/bandwidths.py -function silvermanRule(len, ssd, iqr) { - var a = Math.min(ssd, iqr / 1.349); - return 1.059 * a * Math.pow(len, -0.2); -} + // loop over ALL points in this trace + for(i = 0; i < d.length; i++) { + clusterStartPt = getPt(i); + if(!clusterStartPt) continue; -function calcBandwidth(trace, cdi, vals) { - var span = cdi.max - cdi.min; + pti = 0; + lastFarPt = null; + addPt(clusterStartPt); - // plot single-value violin with bandwidth of 1 - if(!span) return 1; + // loop over one segment of the trace + for(i++; i < d.length; i++) { + clusterHighPt = getPt(i); + if(!clusterHighPt) { + if(connectGaps) continue; + else break; + } - // Limit how small the bandwidth can be. - // - // Silverman's rule of thumb can be "very" small - // when IQR does a poor job at describing the spread - // of the distribution. - // We also want to limit custom bandwidths - // to not blow up kde computations. + // can't decimate if nonlinear line shape + // TODO: we *could* decimate [hv]{2,3} shapes if we restricted clusters to horz or vert again + // but spline would be verrry awkward to decimate + if(!linear || !opts.simplify) { + addPt(clusterHighPt); + continue; + } - if(trace.bandwidth) { - return Math.max(trace.bandwidth, span / 1e4); - } else { - var len = vals.length; - var ssd = Lib.stdev(vals, len - 1, cdi.mean); - return Math.max( - silvermanRule(len, ssd, cdi.q3 - cdi.q1), - span / 100 - ); - } -} + var nextPt = getPt(i + 1); -function calcSpan(trace, cdi, valAxis, bandwidth) { - var spanmode = trace.spanmode; - var spanIn = trace.span || []; - var spanTight = [cdi.min, cdi.max]; - var spanLoose = [cdi.min - 2 * bandwidth, cdi.max + 2 * bandwidth]; - var spanOut; - - function calcSpanItem(index) { - var s = spanIn[index]; - var sc = valAxis.d2c(s, 0, trace[cdi.valLetter + 'calendar']); - return sc === BADNUM ? spanLoose[index] : sc; - } - - if(spanmode === 'soft') { - spanOut = spanLoose; - } else if(spanmode === 'hard') { - spanOut = spanTight; - } else { - spanOut = [calcSpanItem(0), calcSpanItem(1)]; - } + clusterRefDist = ptDist(clusterHighPt, clusterStartPt); - // to reuse the equal-range-item block - var dummyAx = { - type: 'linear', - range: spanOut - }; - Axes.setConvert(dummyAx); - dummyAx.cleanRange(); + if(clusterRefDist < getTolerance(clusterHighPt, nextPt) * minTolerance) continue; - return spanOut; -} + clusterUnitVector = [ + (clusterHighPt[0] - clusterStartPt[0]) / clusterRefDist, + (clusterHighPt[1] - clusterStartPt[1]) / clusterRefDist + ]; -},{"../../constants/numerical":673,"../../lib":696,"../../plots/cartesian/axes":744,"../box/calc":860,"./helpers":1148}],1146:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + clusterLowPt = clusterStartPt; + clusterHighVal = clusterRefDist; + clusterLowVal = clusterMinDeviation = clusterMaxDeviation = 0; + clusterHighFirst = false; + clusterEndPt = clusterHighPt; -'use strict'; + // loop over one cluster of points that collapse onto one line + 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] + ]; + // cross product (or dot with normal to the cluster vector) + thisDeviation = thisVector[0] * clusterUnitVector[1] - thisVector[1] * clusterUnitVector[0]; + clusterMinDeviation = Math.min(clusterMinDeviation, thisDeviation); + clusterMaxDeviation = Math.max(clusterMaxDeviation, thisDeviation); -var setPositionOffset = _dereq_('../box/cross_trace_calc').setPositionOffset; -var orientations = ['v', 'h']; + if(clusterMaxDeviation - clusterMinDeviation > getTolerance(thisPt, nextPt)) break; -module.exports = function crossTraceCalc(gd, plotinfo) { - var calcdata = gd.calcdata; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + clusterEndPt = thisPt; + thisVal = thisVector[0] * clusterUnitVector[0] + thisVector[1] * clusterUnitVector[1]; - for(var i = 0; i < orientations.length; i++) { - var orientation = orientations[i]; - var posAxis = orientation === 'h' ? ya : xa; - var violinList = []; - var minPad = 0; - var maxPad = 0; + if(thisVal > clusterHighVal) { + clusterHighVal = thisVal; + clusterHighPt = thisPt; + clusterHighFirst = false; + } else if(thisVal < clusterLowVal) { + clusterLowVal = thisVal; + clusterLowPt = thisPt; + clusterHighFirst = true; + } + } - for(var j = 0; j < calcdata.length; j++) { - var cd = calcdata[j]; - var t = cd[0].t; - var trace = cd[0].trace; + // insert this cluster into pts + // we've already inserted the start pt, now check if we have high and low pts + if(clusterHighFirst) { + addPt(clusterHighPt); + if(clusterEndPt !== clusterLowPt) addPt(clusterLowPt); + } else { + if(clusterLowPt !== clusterStartPt) addPt(clusterLowPt); + if(clusterEndPt !== clusterHighPt) addPt(clusterHighPt); + } + // and finally insert the end pt + addPt(clusterEndPt); - if(trace.visible === true && trace.type === 'violin' && - !t.empty && - trace.orientation === orientation && - trace.xaxis === xa._id && - trace.yaxis === ya._id - ) { - violinList.push(j); + // have we reached the end of this segment? + if(i >= d.length || !thisPt) break; - if(trace.points !== false) { - minPad = Math.max(minPad, trace.jitter - trace.pointpos - 1); - maxPad = Math.max(maxPad, trace.jitter + trace.pointpos - 1); - } - } + // otherwise we have an out-of-cluster point to insert as next clusterStartPt + addPt(thisPt); + clusterStartPt = thisPt; } - setPositionOffset('violin', gd, violinList, posAxis, [minPad, maxPad]); + // to get fills right - repeat what we did at the start + if(lastFarPt) updateEdge([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]); + + segments.push(pts.slice(0, pti)); } + + return segments; }; -},{"../box/cross_trace_calc":861}],1147:[function(_dereq_,module,exports){ +},{"../../constants/numerical":140,"../../lib":159,"./constants":285}],296:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../../lib'); -var Color = _dereq_('../../components/color'); - -var boxDefaults = _dereq_('../box/defaults'); -var attributes = _dereq_('./attributes'); - -module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { - return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); - } - function coerce2(attr, dflt) { - return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt); - } - - boxDefaults.handleSampleDefaults(traceIn, traceOut, coerce, layout); - if(traceOut.visible === false) return; - - coerce('bandwidth'); - coerce('scalegroup', traceOut.name); - coerce('scalemode'); - coerce('side'); - - var span = coerce('span'); - var spanmodeDflt; - if(Array.isArray(span)) spanmodeDflt = 'manual'; - coerce('spanmode', spanmodeDflt); - var lineColor = coerce('line.color', (traceIn.marker || {}).color || defaultColor); - var lineWidth = coerce('line.width'); - var fillColor = coerce('fillcolor', Color.addOpacity(traceOut.line.color, 0.5)); - - boxDefaults.handlePointsDefaults(traceIn, traceOut, coerce, {prefix: ''}); +'use strict'; - var boxWidth = coerce2('box.width'); - var boxFillColor = coerce2('box.fillcolor', fillColor); - var boxLineColor = coerce2('box.line.color', lineColor); - var boxLineWidth = coerce2('box.line.width', lineWidth); - var boxVisible = coerce('box.visible', Boolean(boxWidth || boxFillColor || boxLineColor || boxLineWidth)); - if(!boxVisible) traceOut.box = {visible: false}; - var meanLineColor = coerce2('meanline.color', lineColor); - var meanLineWidth = coerce2('meanline.width', lineWidth); - var meanLineVisible = coerce('meanline.visible', Boolean(meanLineColor || meanLineWidth)); - if(!meanLineVisible) traceOut.meanline = {visible: false}; +// common to 'scatter' and 'scatterternary' +module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { + var shape = coerce('line.shape'); + if(shape === 'spline') coerce('line.smoothing'); }; -},{"../../components/color":570,"../../lib":696,"../box/defaults":862,"./attributes":1144}],1148:[function(_dereq_,module,exports){ +},{}],297:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175392,261 +71235,151 @@ 'use strict'; -var Lib = _dereq_('../../lib'); - -// Maybe add kernels more down the road, -// but note that the default `spanmode: 'soft'` bounds might have -// to become kernel-dependent -var kernels = { - gaussian: function(v) { - return (1 / Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * v * v); - } -}; +var LINKEDFILLS = {tonextx: 1, tonexty: 1, tonext: 1}; -exports.makeKDE = function(calcItem, trace, vals) { - var len = vals.length; - var kernel = kernels.gaussian; - var bandwidth = calcItem.bandwidth; - var factor = 1 / (len * bandwidth); +module.exports = function linkTraces(gd, plotinfo, cdscatter) { + var trace, i, group, prevtrace, groupIndex; - // don't use Lib.aggNums to skip isNumeric checks - return function(x) { - var sum = 0; - for(var i = 0; i < len; i++) { - sum += kernel((x - vals[i]) / bandwidth); + // first sort traces to keep stacks & filled-together groups together + 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++; } - return factor * sum; - }; -}; - -exports.getPositionOnKdePath = function(calcItem, trace, valuePx) { - var posLetter, valLetter; - if(trace.orientation === 'h') { - posLetter = 'y'; - valLetter = 'x'; - } else { - posLetter = 'x'; - valLetter = 'y'; + if(groupIndex < prevGroupIndex) needsSort = true; + trace._groupIndex = prevGroupIndex = groupIndex; } - var pointOnPath = Lib.findPointOnPath( - calcItem.path, - valuePx, - valLetter, - {pathLength: calcItem.pathLength} - ); - - var posCenterPx = calcItem.posCenterPx; - var posOnPath0 = pointOnPath[posLetter]; - var posOnPath1 = trace.side === 'both' ? - 2 * posCenterPx - posOnPath0 : - posCenterPx; - - return [posOnPath0, posOnPath1]; -}; - -exports.getKdeValue = function(calcItem, trace, valueDist) { - var vals = calcItem.pts.map(exports.extractVal); - var kde = exports.makeKDE(calcItem, trace, vals); - return kde(valueDist) / calcItem.posDensityScale; -}; - -exports.extractVal = function(o) { return o.v; }; - -},{"../../lib":696}],1149:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + 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); + }); + } -'use strict'; + // now link traces to each other + var prevtraces = {}; + for(i = 0; i < cdscatterSorted.length; i++) { + trace = cdscatterSorted[i][0].trace; + group = trace.stackgroup || ''; -var Lib = _dereq_('../../lib'); -var Axes = _dereq_('../../plots/cartesian/axes'); -var boxHoverPoints = _dereq_('../box/hover'); -var helpers = _dereq_('./helpers'); + // Note: The check which ensures all cdscatter here are for the same axis and + // are either cartesian or scatterternary has been removed. This code assumes + // the passed scattertraces have been filtered to the proper plot types and + // the proper subplots. + if(trace.visible === true) { + trace._nexttrace = null; -module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLayer) { - var cd = pointData.cd; - var trace = cd[0].trace; - var hoveron = trace.hoveron; - var hasHoveronViolins = hoveron.indexOf('violins') !== -1; - var hasHoveronKDE = hoveron.indexOf('kde') !== -1; - var closeData = []; - var closePtData; - var violinLineAttrs; - - if(hasHoveronViolins || hasHoveronKDE) { - var closeBoxData = boxHoverPoints.hoverOnBoxes(pointData, xval, yval, hovermode); - - if(hasHoveronViolins) { - closeData = closeData.concat(closeBoxData); - } - - if(hasHoveronKDE && closeBoxData.length > 0) { - var xa = pointData.xa; - var ya = pointData.ya; - var pLetter, vLetter, pAxis, vAxis, vVal; + if(trace.fill in LINKEDFILLS) { + prevtrace = prevtraces[group]; + trace._prevtrace = prevtrace || null; - if(trace.orientation === 'h') { - vVal = xval; - pLetter = 'y'; - pAxis = ya; - vLetter = 'x'; - vAxis = xa; - } else { - vVal = yval; - pLetter = 'x'; - pAxis = xa; - vLetter = 'y'; - vAxis = ya; + if(prevtrace) { + prevtrace._nexttrace = trace; + } } - var di = cd[pointData.index]; + trace._ownfill = (trace.fill && ( + trace.fill.substr(0, 6) === 'tozero' || + trace.fill === 'toself' || + (trace.fill.substr(0, 2) === 'to' && !trace._prevtrace) + )); - if(vVal >= di.span[0] && vVal <= di.span[1]) { - var kdePointData = Lib.extendFlat({}, pointData); - var vValPx = vAxis.c2p(vVal, true); - var kdeVal = helpers.getKdeValue(di, trace, vVal); - var pOnPath = helpers.getPositionOnKdePath(di, trace, vValPx); - var paOffset = pAxis._offset; - var paLength = pAxis._length; - - kdePointData[pLetter + '0'] = pOnPath[0]; - kdePointData[pLetter + '1'] = pOnPath[1]; - kdePointData[vLetter + '0'] = kdePointData[vLetter + '1'] = vValPx; - kdePointData[vLetter + 'Label'] = vLetter + ': ' + Axes.hoverLabelText(vAxis, vVal) + ', ' + cd[0].t.labels.kde + ' ' + kdeVal.toFixed(3); - - // move the spike to the KDE point - kdePointData.spikeDistance = closeBoxData[0].spikeDistance; - var spikePosAttr = pLetter + 'Spike'; - kdePointData[spikePosAttr] = closeBoxData[0][spikePosAttr]; - closeBoxData[0].spikeDistance = undefined; - closeBoxData[0][spikePosAttr] = undefined; - - closeData.push(kdePointData); - - violinLineAttrs = {stroke: pointData.color}; - violinLineAttrs[pLetter + '1'] = Lib.constrain(paOffset + pOnPath[0], paOffset, paOffset + paLength); - violinLineAttrs[pLetter + '2'] = Lib.constrain(paOffset + pOnPath[1], paOffset, paOffset + paLength); - violinLineAttrs[vLetter + '1'] = violinLineAttrs[vLetter + '2'] = vAxis._offset + vValPx; - } + prevtraces[group] = trace; + } else { + trace._prevtrace = trace._nexttrace = trace._ownfill = null; } } - if(hoveron.indexOf('points') !== -1) { - closePtData = boxHoverPoints.hoverOnPoints(pointData, xval, yval); - } - - // update violin line (if any) - var violinLine = hoverLayer.selectAll('.violinline-' + trace.uid) - .data(violinLineAttrs ? [0] : []); - violinLine.enter().append('line') - .classed('violinline-' + trace.uid, true) - .attr('stroke-width', 1.5); - violinLine.exit().remove(); - violinLine.attr(violinLineAttrs); - - // same combine logic as box hoverPoints - if(hovermode === 'closest') { - if(closePtData) return [closePtData]; - return closeData; - } - if(closePtData) { - closeData.push(closePtData); - return closeData; - } - return closeData; + return cdscatterSorted; }; -},{"../../lib":696,"../../plots/cartesian/axes":744,"../box/hover":864,"./helpers":1148}],1150:[function(_dereq_,module,exports){ +},{}],298:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -module.exports = { - attributes: _dereq_('./attributes'), - layoutAttributes: _dereq_('./layout_attributes'), - supplyDefaults: _dereq_('./defaults'), - supplyLayoutDefaults: _dereq_('./layout_defaults'), - calc: _dereq_('./calc'), - crossTraceCalc: _dereq_('./cross_trace_calc'), - plot: _dereq_('./plot'), - style: _dereq_('./style'), - styleOnSelect: _dereq_('../scatter/style').styleOnSelect, - hoverPoints: _dereq_('./hover'), - selectPoints: _dereq_('../box/select'), - - moduleType: 'trace', - name: 'violin', - basePlotModule: _dereq_('../../plots/cartesian'), - categories: ['cartesian', 'svg', 'symbols', 'oriented', 'box-violin', 'showLegend', 'violinLayout', 'zoomScale'], - meta: { - - } -}; +var isNumeric = _dereq_('fast-isnumeric'); -},{"../../plots/cartesian":756,"../box/select":869,"../scatter/style":1066,"./attributes":1144,"./calc":1145,"./cross_trace_calc":1146,"./defaults":1147,"./hover":1149,"./layout_attributes":1151,"./layout_defaults":1152,"./plot":1153,"./style":1154}],1151:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -'use strict'; +// used in the drawing step for 'scatter' and 'scattegeo' and +// in the convert step for 'scatter3d' +module.exports = function makeBubbleSizeFn(trace) { + var marker = trace.marker; + var sizeRef = marker.sizeref || 1; + var sizeMin = marker.sizemin || 0; + + // for bubble charts, allow scaling the provided value linearly + // and by area or diameter. + // Note this only applies to the array-value sizes -var boxLayoutAttrs = _dereq_('../box/layout_attributes'); -var extendFlat = _dereq_('../../lib').extendFlat; + var baseFn = (marker.sizemode === 'area') ? + function(v) { return Math.sqrt(v / sizeRef); } : + function(v) { return v / sizeRef; }; -module.exports = { - violinmode: extendFlat({}, boxLayoutAttrs.boxmode, { - - }), - violingap: extendFlat({}, boxLayoutAttrs.boxgap, { - - }), - violingroupgap: extendFlat({}, boxLayoutAttrs.boxgroupgap, { - - }) + // TODO add support for position/negative bubbles? + // TODO add 'sizeoffset' attribute? + return function(v) { + var baseSize = baseFn(v / 2); + + // don't show non-numeric and negative sizes + return (isNumeric(baseSize) && (baseSize > 0)) ? + Math.max(baseSize, sizeMin) : + 0; + }; }; -},{"../../lib":696,"../box/layout_attributes":866}],1152:[function(_dereq_,module,exports){ +},{"fast-isnumeric":10}],299:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; -var Lib = _dereq_('../../lib'); -var layoutAttributes = _dereq_('./layout_attributes'); -var boxLayoutDefaults = _dereq_('../box/layout_defaults'); +'use strict'; -module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { - function coerce(attr, dflt) { - return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); - } - boxLayoutDefaults._supply(layoutIn, layoutOut, fullData, coerce, 'violin'); +module.exports = { + container: 'marker', + min: 'cmin', + max: 'cmax' }; -},{"../../lib":696,"../box/layout_defaults":867,"./layout_attributes":1151}],1153:[function(_dereq_,module,exports){ +},{}],300:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175655,1383 +71388,994 @@ 'use strict'; -var d3 = _dereq_('d3'); -var Lib = _dereq_('../../lib'); -var Drawing = _dereq_('../../components/drawing'); - -var boxPlot = _dereq_('../box/plot'); -var linePoints = _dereq_('../scatter/line_points'); -var helpers = _dereq_('./helpers'); - -module.exports = function plot(gd, plotinfo, cdViolins, violinLayer) { - var fullLayout = gd._fullLayout; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - - function makePath(pts) { - var segments = linePoints(pts, { - xaxis: xa, - yaxis: ya, - connectGaps: true, - baseTolerance: 0.75, - shape: 'spline', - simplify: true - }); - return Drawing.smoothopen(segments[0], 1); - } - - Lib.makeTraceGroups(violinLayer, cdViolins, 'trace violins').each(function(cd) { - var plotGroup = d3.select(this); - var cd0 = cd[0]; - var t = cd0.t; - var trace = cd0.trace; - if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; - var numViolins = fullLayout._numViolins; - var group = (fullLayout.violinmode === 'group' && numViolins > 1); - var groupFraction = 1 - fullLayout.violingap; - // violin max half width - var bdPos = t.bdPos = t.dPos * groupFraction * (1 - fullLayout.violingroupgap) / (group ? numViolins : 1); - // violin center offset - var bPos = t.bPos = group ? 2 * t.dPos * (-0.5 + (t.num + 0.5) / numViolins) * groupFraction : 0; - // half-width within which to accept hover for this violin - // always split the distance to the closest violin - t.wHover = t.dPos * (group ? groupFraction / numViolins : 1); - - if(trace.visible !== true || t.empty) { - plotGroup.remove(); - return; - } - - var valAxis = plotinfo[t.valLetter + 'axis']; - var posAxis = plotinfo[t.posLetter + 'axis']; - var hasBothSides = trace.side === 'both'; - var hasPositiveSide = hasBothSides || trace.side === 'positive'; - var hasNegativeSide = hasBothSides || trace.side === 'negative'; - var groupStats = fullLayout._violinScaleGroupStats[trace.scalegroup]; - - var violins = plotGroup.selectAll('path.violin').data(Lib.identity); - - violins.enter().append('path') - .style('vector-effect', 'non-scaling-stroke') - .attr('class', 'violin'); - - violins.exit().remove(); - - violins.each(function(d) { - var pathSel = d3.select(this); - var density = d.density; - var len = density.length; - var posCenter = d.pos + bPos; - var posCenterPx = posAxis.c2p(posCenter); - var scale; - - switch(trace.scalemode) { - case 'width': - scale = groupStats.maxWidth / bdPos; - break; - case 'count': - scale = (groupStats.maxWidth / bdPos) * (groupStats.maxCount / d.pts.length); - break; - } - - var pathPos, pathNeg, path; - var i, k, pts, pt; - - if(hasPositiveSide) { - pts = new Array(len); - for(i = 0; i < len; i++) { - pt = pts[i] = {}; - pt[t.posLetter] = posCenter + (density[i].v / scale); - pt[t.valLetter] = density[i].t; - } - pathPos = makePath(pts); - } - - if(hasNegativeSide) { - pts = new Array(len); - for(k = 0, i = len - 1; k < len; k++, i--) { - pt = pts[k] = {}; - pt[t.posLetter] = posCenter - (density[i].v / scale); - pt[t.valLetter] = density[i].t; - } - pathNeg = makePath(pts); - } - - if(hasBothSides) { - path = pathPos + 'L' + pathNeg.substr(1) + 'Z'; - } - else { - var startPt = [posCenterPx, valAxis.c2p(density[0].t)]; - var endPt = [posCenterPx, valAxis.c2p(density[len - 1].t)]; - - if(trace.orientation === 'h') { - startPt.reverse(); - endPt.reverse(); - } - - if(hasPositiveSide) { - path = 'M' + startPt + 'L' + pathPos.substr(1) + 'L' + endPt; - } else { - path = 'M' + endPt + 'L' + pathNeg.substr(1) + 'L' + startPt; - } - } - pathSel.attr('d', path); +var Color = _dereq_('../../components/color'); +var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; +var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); - // save a few things used in getPositionOnKdePath, getKdeValue - // on hover and for meanline draw block below - d.posCenterPx = posCenterPx; - d.posDensityScale = scale * bdPos; - d.path = pathSel.node(); - d.pathLength = d.path.getTotalLength() / (hasBothSides ? 2 : 1); - }); - - var boxAttrs = trace.box; - var boxWidth = boxAttrs.width; - var boxLineWidth = (boxAttrs.line || {}).width; - var bdPosScaled; - var bPosPxOffset; - - if(hasBothSides) { - bdPosScaled = bdPos * boxWidth; - bPosPxOffset = 0; - } else if(hasPositiveSide) { - bdPosScaled = [0, bdPos * boxWidth / 2]; - bPosPxOffset = -boxLineWidth; - } else { - bdPosScaled = [bdPos * boxWidth / 2, 0]; - bPosPxOffset = boxLineWidth; - } +var subTypes = _dereq_('./subtypes'); - // inner box - boxPlot.plotBoxAndWhiskers(plotGroup, {pos: posAxis, val: valAxis}, trace, { - bPos: bPos, - bdPos: bdPosScaled, - bPosPxOffset: bPosPxOffset - }); - - // meanline insider box - boxPlot.plotBoxMean(plotGroup, {pos: posAxis, val: valAxis}, trace, { - bPos: bPos, - bdPos: bdPosScaled, - bPosPxOffset: bPosPxOffset - }); - - var fn; - if(!trace.box.visible && trace.meanline.visible) { - fn = Lib.identity; - } - - // N.B. use different class name than boxPlot.plotBoxMean, - // to avoid selectAll conflict - var meanPaths = plotGroup.selectAll('path.meanline').data(fn || []); - meanPaths.enter().append('path') - .attr('class', 'meanline') - .style('fill', 'none') - .style('vector-effect', 'non-scaling-stroke'); - meanPaths.exit().remove(); - meanPaths.each(function(d) { - var v = valAxis.c2p(d.mean, true); - var p = helpers.getPositionOnKdePath(d, trace, v); - - d3.select(this).attr('d', - trace.orientation === 'h' ? - 'M' + v + ',' + p[0] + 'V' + p[1] : - 'M' + p[0] + ',' + v + 'H' + p[1] - ); - }); +/* + * opts: object of flags to control features not all marker users support + * noLine: caller does not support marker lines + * gradient: caller supports gradients + * noSelect: caller does not support selected/unselected attribute containers + */ +module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { + var isBubble = subTypes.isBubble(traceIn); + var lineColor = (traceIn.line || {}).color; + var defaultMLC; - boxPlot.plotPoints(plotGroup, {x: xa, y: ya}, trace, t); - }); -}; + opts = opts || {}; -},{"../../components/drawing":595,"../../lib":696,"../box/plot":868,"../scatter/line_points":1057,"./helpers":1148,"d3":148}],1154:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + // marker.color inherit from line.color (even if line.color is an array) + if(lineColor) defaultColor = lineColor; -'use strict'; + coerce('marker.symbol'); + coerce('marker.opacity', isBubble ? 0.7 : 1); + coerce('marker.size'); -var d3 = _dereq_('d3'); -var Color = _dereq_('../../components/color'); -var stylePoints = _dereq_('../scatter/style').stylePoints; + coerce('marker.color', defaultColor); + if(hasColorscale(traceIn, 'marker')) { + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'}); + } -module.exports = function style(gd, cd) { - var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.violins'); + if(!opts.noSelect) { + coerce('selected.marker.color'); + coerce('unselected.marker.color'); + coerce('selected.marker.size'); + coerce('unselected.marker.size'); + } - s.style('opacity', function(d) { return d[0].trace.opacity; }); + if(!opts.noLine) { + // if there's a line with a different color than the marker, use + // that line color as the default marker line color + // (except when it's an array) + // mostly this is for transparent markers to behave nicely + if(lineColor && !Array.isArray(lineColor) && (traceOut.marker.color !== lineColor)) { + defaultMLC = lineColor; + } + else if(isBubble) defaultMLC = Color.background; + else defaultMLC = Color.defaultLine; - s.each(function(d) { - var trace = d[0].trace; - var sel = d3.select(this); - var box = trace.box || {}; - var boxLine = box.line || {}; - var meanline = trace.meanline || {}; - var meanLineWidth = meanline.width; - - sel.selectAll('path.violin') - .style('stroke-width', trace.line.width + 'px') - .call(Color.stroke, trace.line.color) - .call(Color.fill, trace.fillcolor); - - sel.selectAll('path.box') - .style('stroke-width', boxLine.width + 'px') - .call(Color.stroke, boxLine.color) - .call(Color.fill, box.fillcolor); - - var meanLineStyle = { - 'stroke-width': meanLineWidth + 'px', - 'stroke-dasharray': (2 * meanLineWidth) + 'px,' + meanLineWidth + 'px' - }; + coerce('marker.line.color', defaultMLC); + if(hasColorscale(traceIn, 'marker.line')) { + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.line.', cLetter: 'c'}); + } - sel.selectAll('path.mean') - .style(meanLineStyle) - .call(Color.stroke, meanline.color); - - sel.selectAll('path.meanline') - .style(meanLineStyle) - .call(Color.stroke, meanline.color); + coerce('marker.line.width', isBubble ? 1 : 0); + } - stylePoints(sel, trace, gd); - }); + 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'); + } + } }; -},{"../../components/color":570,"../scatter/style":1066,"d3":148}],1155:[function(_dereq_,module,exports){ +},{"../../components/color":43,"../../components/colorscale/defaults":53,"../../components/colorscale/helpers":54,"./subtypes":305}],301:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -var Axes = _dereq_('../plots/cartesian/axes'); -var Lib = _dereq_('../lib'); -var PlotSchema = _dereq_('../plot_api/plot_schema'); -var pointsAccessorFunction = _dereq_('./helpers').pointsAccessorFunction; -var BADNUM = _dereq_('../constants/numerical').BADNUM; +var d3 = _dereq_('d3'); -exports.moduleType = 'transform'; +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var ensureSingle = Lib.ensureSingle; +var identity = Lib.identity; +var Drawing = _dereq_('../../components/drawing'); -exports.name = 'aggregate'; +var subTypes = _dereq_('./subtypes'); +var linePoints = _dereq_('./line_points'); +var linkTraces = _dereq_('./link_traces'); +var polygonTester = _dereq_('../../lib/polygon').tester; -var attrs = exports.attributes = { - enabled: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - groups: { - // TODO: groupby should support string or array grouping this way too - // currently groupby only allows a grouping array - valType: 'string', - strict: true, - noBlank: true, - arrayOk: true, - dflt: 'x', - - editType: 'calc', - - }, - aggregations: { - _isLinkedToArray: 'aggregation', - target: { - valType: 'string', - - editType: 'calc', - - }, - func: { - valType: 'enumerated', - values: ['count', 'sum', 'avg', 'median', 'mode', 'rms', 'stddev', 'min', 'max', 'first', 'last', 'change', 'range'], - dflt: 'first', - - editType: 'calc', - - }, - funcmode: { - valType: 'enumerated', - values: ['sample', 'population'], - dflt: 'sample', - - editType: 'calc', - - }, - enabled: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - editType: 'calc' - }, - editType: 'calc' -}; +module.exports = function plot(gd, plotinfo, cdscatter, scatterLayer, transitionOpts, makeOnCompleteCallback) { + var join, onComplete; -var aggAttrs = attrs.aggregations; + // If transition config is provided, then it is only a partial replot and traces not + // updated are removed. + var isFullReplot = !transitionOpts; + var hasTransition = !!transitionOpts && transitionOpts.duration > 0; -/** - * Supply transform attributes defaults - * - * @param {object} transformIn - * object linked to trace.transforms[i] with 'func' set to exports.name - * @param {object} traceOut - * the _fullData trace this transform applies to - * @param {object} layout - * the plot's (not-so-full) layout - * @param {object} traceIn - * the input data trace this transform applies to - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.supplyDefaults = function(transformIn, traceOut) { - var transformOut = {}; - var i; + // Link traces so the z-order of fill layers is correct + var cdscatterSorted = linkTraces(gd, plotinfo, cdscatter); - function coerce(attr, dflt) { - return Lib.coerce(transformIn, transformOut, attrs, attr, dflt); - } + join = scatterLayer.selectAll('g.trace') + .data(cdscatterSorted, function(d) { return d[0].trace.uid; }); - var enabled = coerce('enabled'); + // Append new traces: + join.enter().append('g') + .attr('class', function(d) { + return 'trace scatter trace' + d[0].trace.uid; + }) + .style('stroke-miterlimit', 2); + join.order(); - if(!enabled) return transformOut; + createFills(gd, join, plotinfo); - /* - * Normally _arrayAttrs is calculated during doCalc, but that comes later. - * Anyway this can change due to *count* aggregations (see below) so it's not - * necessarily the same set. - * - * For performance we turn it into an object of truthy values - * we'll use 1 for arrays we haven't aggregated yet, 0 for finished arrays, - * as distinct from undefined which means this array isn't present in the input - * missing arrays can still be aggregate outputs for *count* aggregations. - */ - var arrayAttrArray = PlotSchema.findArrayAttributes(traceOut); - var arrayAttrs = {}; - for(i = 0; i < arrayAttrArray.length; i++) arrayAttrs[arrayAttrArray[i]] = 1; + if(hasTransition) { + if(makeOnCompleteCallback) { + // If it was passed a callback to register completion, make a callback. If + // this is created, then it must be executed on completion, otherwise the + // pos-transition redraw will not execute: + onComplete = makeOnCompleteCallback(); + } - var groups = coerce('groups'); + var transition = d3.transition() + .duration(transitionOpts.duration) + .ease(transitionOpts.easing) + .each('end', function() { + onComplete && onComplete(); + }) + .each('interrupt', function() { + onComplete && onComplete(); + }); - if(!Array.isArray(groups)) { - if(!arrayAttrs[groups]) { - transformOut.enabled = false; - return transformOut; - } - arrayAttrs[groups] = 0; + transition.each(function() { + // Must run the selection again since otherwise enters/updates get grouped together + // and these get executed out of order. Except we need them in order! + scatterLayer.selectAll('g.trace').each(function(d, i) { + plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts); + }); + }); + } else { + join.each(function(d, i) { + plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts); + }); } - var aggregationsIn = transformIn.aggregations || []; - var aggregationsOut = transformOut.aggregations = new Array(aggregationsIn.length); - var aggregationOut; - - function coercei(attr, dflt) { - return Lib.coerce(aggregationsIn[i], aggregationOut, aggAttrs, attr, dflt); + if(isFullReplot) { + join.exit().remove(); } - for(i = 0; i < aggregationsIn.length; i++) { - aggregationOut = {_index: i}; - var target = coercei('target'); - var func = coercei('func'); - var enabledi = coercei('enabled'); + // remove paths that didn't get used + scatterLayer.selectAll('path:not([d])').remove(); +}; - // add this aggregation to the output only if it's the first instance - // of a valid target attribute - or an unused target attribute with "count" - if(enabledi && target && (arrayAttrs[target] || (func === 'count' && arrayAttrs[target] === undefined))) { - if(func === 'stddev') coercei('funcmode'); +function createFills(gd, traceJoin, plotinfo) { + traceJoin.each(function(d) { + var fills = ensureSingle(d3.select(this), 'g', 'fills'); + Drawing.setClipUrl(fills, plotinfo.layerClipId, gd); - arrayAttrs[target] = 0; - aggregationsOut[i] = aggregationOut; - } - else aggregationsOut[i] = {enabled: false, _index: i}; - } + var trace = d[0].trace; - // any array attributes we haven't yet covered, fill them with the default aggregation - for(i = 0; i < arrayAttrArray.length; i++) { - if(arrayAttrs[arrayAttrArray[i]]) { - aggregationsOut.push({ - target: arrayAttrArray[i], - func: aggAttrs.func.dflt, - enabled: true, - _index: -1 - }); - } - } + var fillData = []; + if(trace._ownfill) fillData.push('_ownFill'); + if(trace._nexttrace) fillData.push('_nextFill'); - return transformOut; -}; + var fillJoin = fills.selectAll('g').data(fillData, identity); + fillJoin.enter().append('g'); -exports.calcTransform = function(gd, trace, opts) { - if(!opts.enabled) return; + fillJoin.exit() + .each(function(d) { trace[d] = null; }) + .remove(); - var groups = opts.groups; + fillJoin.order().each(function(d) { + // make a path element inside the fill group, just so + // we can give it its own data later on and the group can + // keep its simple '_*Fill' data + trace[d] = ensureSingle(d3.select(this), 'path', 'js-fill'); + }); + }); +} - var groupArray = Lib.getTargetArray(trace, {target: groups}); - if(!groupArray) return; +function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transitionOpts) { + var i; - var i, vi, groupIndex, newGrouping; + // Since this has been reorganized and we're executing this on individual traces, + // we need to pass it the full list of cdscatter as well as this trace's index (idx) + // since it does an internal n^2 loop over comparisons with other traces: + selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll); - var groupIndices = {}; - var indexToPoints = {}; - var groupings = []; + var hasTransition = !!transitionOpts && transitionOpts.duration > 0; - var originalPointsAccessor = pointsAccessorFunction(trace.transforms, opts); + function transition(selection) { + return hasTransition ? selection.transition() : selection; + } - var len = groupArray.length; - if(trace._length) len = Math.min(len, trace._length); + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - for(i = 0; i < len; i++) { - vi = groupArray[i]; - groupIndex = groupIndices[vi]; - if(groupIndex === undefined) { - groupIndices[vi] = groupings.length; - newGrouping = [i]; - groupings.push(newGrouping); - indexToPoints[groupIndices[vi]] = originalPointsAccessor(i); - } - else { - groupings[groupIndex].push(i); - indexToPoints[groupIndices[vi]] = (indexToPoints[groupIndices[vi]] || []).concat(originalPointsAccessor(i)); - } - } + var trace = cdscatter[0].trace; + var line = trace.line; + var tr = d3.select(element); - opts._indexToPoints = indexToPoints; + var errorBarGroup = ensureSingle(tr, 'g', 'errorbars'); + var lines = ensureSingle(tr, 'g', 'lines'); + var points = ensureSingle(tr, 'g', 'points'); + var text = ensureSingle(tr, 'g', 'text'); - var aggregations = opts.aggregations; + // error bars are at the bottom + Registry.getComponentMethod('errorbars', 'plot')(gd, errorBarGroup, plotinfo, transitionOpts); - for(i = 0; i < aggregations.length; i++) { - aggregateOneArray(gd, trace, groupings, aggregations[i]); - } + if(trace.visible !== true) return; - if(typeof groups === 'string') { - aggregateOneArray(gd, trace, groupings, { - target: groups, - func: 'first', - enabled: true - }); - } + transition(tr).style('opacity', trace.opacity); - trace._length = groupings.length; -}; + // BUILD LINES AND FILLS + var ownFillEl3, tonext; + var ownFillDir = trace.fill.charAt(trace.fill.length - 1); + if(ownFillDir !== 'x' && ownFillDir !== 'y') ownFillDir = ''; -function aggregateOneArray(gd, trace, groupings, aggregation) { - if(!aggregation.enabled) return; + // store node for tweaking by selectPoints + if(!plotinfo.isRangePlot) cdscatter[0].node3 = tr; - var attr = aggregation.target; - var targetNP = Lib.nestedProperty(trace, attr); - var arrayIn = targetNP.get(); - var conversions = Axes.getDataConversions(gd, trace, attr, arrayIn); - var func = getAggregateFunction(aggregation, conversions); + var prevRevpath = ''; + var prevPolygons = []; + var prevtrace = trace._prevtrace; - var arrayOut = new Array(groupings.length); - for(var i = 0; i < groupings.length; i++) { - arrayOut[i] = func(arrayIn, groupings[i]); + if(prevtrace) { + prevRevpath = prevtrace._prevRevpath || ''; + tonext = prevtrace._nextFill; + prevPolygons = prevtrace._polygons; } - targetNP.set(arrayOut); - if(aggregation.func === 'count') { - // count does not depend on an input array, so it's likely not part of _arrayAttrs yet - // but after this transform it most definitely *is* an array attribute. - Lib.pushUnique(trace._arrayAttrs, attr); - } -} + var thispath; + var thisrevpath; + // fullpath is all paths for this curve, joined together straight + // across gaps, for filling + var fullpath = ''; + // revpath is fullpath reversed, for fill-to-next + var revpath = ''; + // functions for converting a point array to a path + var pathfn, revpathbase, revpathfn; + // variables used before and after the data join + var pt0, lastSegment, pt1, thisPolygons; -function getAggregateFunction(opts, conversions) { - var func = opts.func; - var d2c = conversions.d2c; - var c2d = conversions.c2d; + // initialize line join data / method + var segments = []; + var makeUpdate = Lib.noop; - switch(func) { - // count, first, and last don't depend on anything about the data - // point back to pure functions for performance - case 'count': - return count; - case 'first': - return first; - case 'last': - return last; + ownFillEl3 = trace._ownFill; - case 'sum': - // This will produce output in all cases even though it's nonsensical - // for date or category data. - return function(array, indices) { - var total = 0; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) total += vi; - } - return c2d(total); - }; + if(subTypes.hasLines(trace) || trace.fill !== 'none') { - case 'avg': - // Generally meaningless for category data but it still does something. - return function(array, indices) { - var total = 0; - var cnt = 0; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) { - total += vi; - cnt++; - } - } - return cnt ? c2d(total / cnt) : BADNUM; - }; + if(tonext) { + // This tells .style which trace to use for fill information: + tonext.datum(cdscatter); + } - case 'min': - return function(array, indices) { - var out = Infinity; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) out = Math.min(out, vi); + 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(pts) { + var pLast = pts[pts.length - 1]; + if(pts.length > 1 && pts[0][0] === pLast[0] && pts[0][1] === pLast[1]) { + // identical start and end points: treat it as a + // closed curve so we don't get a kink + return Drawing.smoothclosed(pts.slice(1), line.smoothing); } - return (out === Infinity) ? BADNUM : c2d(out); - }; - - case 'max': - return function(array, indices) { - var out = -Infinity; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) out = Math.max(out, vi); + else { + return Drawing.smoothopen(pts, line.smoothing); } - return (out === -Infinity) ? BADNUM : c2d(out); }; - - case 'range': - return function(array, indices) { - var min = Infinity; - var max = -Infinity; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) { - min = Math.min(min, vi); - max = Math.max(max, vi); - } - } - return (max === -Infinity || min === Infinity) ? BADNUM : c2d(max - min); + } + else { + pathfn = revpathbase = function(pts) { + return 'M' + pts.join('L'); }; + } - case 'change': - return function(array, indices) { - var first = d2c(array[indices[0]]); - var last = d2c(array[indices[indices.length - 1]]); - return (first === BADNUM || last === BADNUM) ? BADNUM : c2d(last - first); - }; + revpathfn = function(pts) { + // note: this is destructive (reverses pts in place) so can't use pts after this + return revpathbase(pts.reverse()); + }; - case 'median': - return function(array, indices) { - var sortCalc = []; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) sortCalc.push(vi); - } - if(!sortCalc.length) return BADNUM; - sortCalc.sort(); - var mid = (sortCalc.length - 1) / 2; - return c2d((sortCalc[Math.floor(mid)] + sortCalc[Math.ceil(mid)]) / 2); - }; + segments = linePoints(cdscatter, { + xaxis: xa, + yaxis: ya, + connectGaps: trace.connectgaps, + baseTolerance: Math.max(line.width || 1, 3) / 4, + shape: line.shape, + simplify: line.simplify + }); - case 'mode': - return function(array, indices) { - var counts = {}; - var maxCnt = 0; - var out = BADNUM; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) { - var counti = counts[vi] = (counts[vi] || 0) + 1; - if(counti > maxCnt) { - maxCnt = counti; - out = vi; - } - } - } - return maxCnt ? c2d(out) : BADNUM; - }; + // since we already have the pixel segments here, use them to make + // polygons for hover on fill + // TODO: can we skip this if hoveron!=fills? That would mean we + // need to redraw when you change hoveron... + thisPolygons = trace._polygons = new Array(segments.length); + for(i = 0; i < segments.length; i++) { + trace._polygons[i] = polygonTester(segments[i]); + } - case 'rms': - return function(array, indices) { - var total = 0; - var cnt = 0; - for(var i = 0; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) { - total += vi * vi; - cnt++; - } - } - return cnt ? c2d(Math.sqrt(total / cnt)) : BADNUM; - }; + if(segments.length) { + pt0 = segments[0][0]; + lastSegment = segments[segments.length - 1]; + pt1 = lastSegment[lastSegment.length - 1]; + } - case 'stddev': - return function(array, indices) { - // balance numerical stability with performance: - // so that we call d2c once per element but don't need to - // store them, reference all to the first element - var total = 0; - var total2 = 0; - var cnt = 1; - var v0 = BADNUM; - var i; - for(i = 0; i < indices.length && v0 === BADNUM; i++) { - v0 = d2c(array[indices[i]]); + makeUpdate = function(isEnter) { + return function(pts) { + thispath = pathfn(pts); + thisrevpath = revpathfn(pts); + 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(v0 === BADNUM) return BADNUM; - for(; i < indices.length; i++) { - var vi = d2c(array[indices[i]]); - if(vi !== BADNUM) { - var dv = vi - v0; - total += dv; - total2 += dv * dv; - cnt++; + if(subTypes.hasLines(trace) && pts.length > 1) { + var el = d3.select(this); + + // This makes the coloring work correctly: + 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); } } - - // This is population std dev, if we want sample std dev - // we would need (...) / (cnt - 1) - // Also note there's no c2d here - that means for dates the result - // is a number of milliseconds, and for categories it's a number - // of category differences, which is not generically meaningful but - // as in other cases we don't forbid it. - var norm = (opts.funcmode === 'sample') ? (cnt - 1) : cnt; - // this is debatable: should a count of 1 return sample stddev of - // 0 or undefined? - if(!norm) return 0; - return Math.sqrt((total2 - (total * total / cnt)) / norm); }; + }; } -} -function count(array, indices) { - return indices.length; -} + var lineJoin = lines.selectAll('.js-line').data(segments); -function first(array, indices) { - return array[indices[0]]; -} + transition(lineJoin.exit()) + .style('opacity', 0) + .remove(); -function last(array, indices) { - return array[indices[indices.length - 1]]; -} + lineJoin.each(makeUpdate(false)); -},{"../constants/numerical":673,"../lib":696,"../plot_api/plot_schema":733,"../plots/cartesian/axes":744,"./helpers":1158}],1156:[function(_dereq_,module,exports){ -/** -* Copyright 2012-2018, Plotly, Inc. -* All rights reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ + lineJoin.enter().append('path') + .classed('js-line', true) + .style('vector-effect', 'non-scaling-stroke') + .call(Drawing.lineGroupStyle) + .each(makeUpdate(true)); -'use strict'; + Drawing.setClipUrl(lineJoin, plotinfo.layerClipId, gd); -var Lib = _dereq_('../lib'); -var Registry = _dereq_('../registry'); -var Axes = _dereq_('../plots/cartesian/axes'); -var pointsAccessorFunction = _dereq_('./helpers').pointsAccessorFunction; + function clearFill(selection) { + transition(selection).attr('d', 'M0,0Z'); + } -var filterOps = _dereq_('../constants/filter_ops'); -var COMPARISON_OPS = filterOps.COMPARISON_OPS; -var INTERVAL_OPS = filterOps.INTERVAL_OPS; -var SET_OPS = filterOps.SET_OPS; + if(segments.length) { + if(ownFillEl3) { + ownFillEl3.datum(cdscatter); + if(pt0 && pt1) { + if(ownFillDir) { + if(ownFillDir === 'y') { + pt0[1] = pt1[1] = ya.c2p(0, true); + } + else if(ownFillDir === 'x') { + pt0[0] = pt1[0] = xa.c2p(0, true); + } -exports.moduleType = 'transform'; + // fill to zero: full trace path, plus extension of + // the endpoints to the appropriate axis + // For the sake of animations, wrap the points around so that + // the points on the axes are the first two points. Otherwise + // animations get a little crazy if the number of points changes. + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); + } else { + // fill to self: just join the path to itself + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); + } + } + } + else if(tonext) { + if(trace.fill.substr(0, 6) === 'tonext' && fullpath && prevRevpath) { + // fill to next: full trace path, plus the previous path reversed + if(trace.fill === 'tonext') { + // tonext: for use by concentric shapes, like manually constructed + // contours, we just add the two paths closed on themselves. + // This makes strange results if one path is *not* entirely + // inside the other, but then that is a strange usage. + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); + } + else { + // tonextx/y: for now just connect endpoints with lines. This is + // the correct behavior if the endpoints are at the same value of + // y/x, but if they *aren't*, we should ideally do more complicated + // things depending on whether the new endpoint projects onto the + // existing curve or off the end of it + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); + } + trace._polygons = trace._polygons.concat(prevPolygons); + } + else { + clearFill(tonext); + trace._polygons = null; + } + } + trace._prevRevpath = revpath; + trace._prevPolygons = thisPolygons; + } + else { + if(ownFillEl3) clearFill(ownFillEl3); + else if(tonext) clearFill(tonext); + trace._polygons = trace._prevRevpath = trace._prevPolygons = null; + } -exports.name = 'filter'; -exports.attributes = { - enabled: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - target: { - valType: 'string', - strict: true, - noBlank: true, - arrayOk: true, - dflt: 'x', - - editType: 'calc', - - }, - operation: { - valType: 'enumerated', - values: [] - .concat(COMPARISON_OPS) - .concat(INTERVAL_OPS) - .concat(SET_OPS), - dflt: '=', - - editType: 'calc', - - }, - value: { - valType: 'any', - dflt: 0, - - editType: 'calc', - - }, - preservegaps: { - valType: 'boolean', - dflt: false, - - editType: 'calc', - - }, - editType: 'calc' -}; + function visFilter(d) { + return d.filter(function(v) { return !v.gap && v.vis; }); + } -exports.supplyDefaults = function(transformIn) { - var transformOut = {}; + function visFilterWithGaps(d) { + return d.filter(function(v) { return v.vis; }); + } - function coerce(attr, dflt) { - return Lib.coerce(transformIn, transformOut, exports.attributes, attr, dflt); + function gapFilter(d) { + return d.filter(function(v) { return !v.gap; }); } - var enabled = coerce('enabled'); + function keyFunc(d) { + return d.id; + } - if(enabled) { - coerce('preservegaps'); - coerce('operation'); - coerce('value'); - coerce('target'); + // Returns a function if the trace is keyed, otherwise returns undefined + function getKeyFunc(trace) { + if(trace.ids) { + return keyFunc; + } + } - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); - handleCalendarDefaults(transformIn, transformOut, 'valuecalendar', null); - handleCalendarDefaults(transformIn, transformOut, 'targetcalendar', null); + function hideFilter() { + return false; } - return transformOut; -}; + function makePoints(points, text, cdscatter) { + var join, selection, hasNode; + + var trace = cdscatter[0].trace; + var showMarkers = subTypes.hasMarkers(trace); + var showText = subTypes.hasText(trace); + + var keyFunc = getKeyFunc(trace); + var markerFilter = hideFilter; + var textFilter = hideFilter; + + if(showMarkers || showText) { + var showFilter = identity; + // if we're stacking, "infer zero" gap mode gets markers in the + // gap points - because we've inferred a zero there - but other + // modes (currently "interpolate", later "interrupt" hopefully) + // we don't draw generated markers + var stackGroup = trace.stackgroup; + var isInferZero = stackGroup && ( + gd._fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup].stackgaps === 'infer zero'); + if(trace.marker.maxdisplayed || trace._needsCull) { + showFilter = isInferZero ? visFilterWithGaps : visFilter; + } + else if(stackGroup && !isInferZero) { + showFilter = gapFilter; + } -exports.calcTransform = function(gd, trace, opts) { - if(!opts.enabled) return; + if(showMarkers) markerFilter = showFilter; + if(showText) textFilter = showFilter; + } - var targetArray = Lib.getTargetArray(trace, opts); - if(!targetArray) return; + // marker points - var target = opts.target; + selection = points.selectAll('path.point'); - var len = targetArray.length; - if(trace._length) len = Math.min(len, trace._length); + join = selection.data(markerFilter, keyFunc); - var targetCalendar = opts.targetcalendar; - var arrayAttrs = trace._arrayAttrs; - var preservegaps = opts.preservegaps; + var enter = join.enter().append('path') + .classed('point', true); - // even if you provide targetcalendar, if target is a string and there - // is a calendar attribute matching target it will get used instead. - if(typeof target === 'string') { - var attrTargetCalendar = Lib.nestedProperty(trace, target + 'calendar').get(); - if(attrTargetCalendar) targetCalendar = attrTargetCalendar; - } - - var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray); - var filterFunc = getFilterFunc(opts, d2c, targetCalendar); - var originalArrays = {}; - var indexToPoints = {}; - var index = 0; - - function forAllAttrs(fn, index) { - for(var j = 0; j < arrayAttrs.length; j++) { - var np = Lib.nestedProperty(trace, arrayAttrs[j]); - fn(np, index); + if(hasTransition) { + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya) + .style('opacity', 0) + .transition() + .style('opacity', 1); } - } - - var initFn; - var fillFn; - if(preservegaps) { - initFn = function(np) { - originalArrays[np.astr] = Lib.extendDeep([], np.get()); - np.set(new Array(len)); - }; - fillFn = function(np, index) { - var val = originalArrays[np.astr][index]; - np.get()[index] = val; - }; - } else { - initFn = function(np) { - originalArrays[np.astr] = Lib.extendDeep([], np.get()); - np.set([]); - }; - fillFn = function(np, index) { - var val = originalArrays[np.astr][index]; - np.get().push(val); - }; - } - // copy all original array attribute values, and clear arrays in trace - forAllAttrs(initFn); - - var originalPointsAccessor = pointsAccessorFunction(trace.transforms, opts); + join.order(); - // loop through filter array, fill trace arrays if passed - for(var i = 0; i < len; i++) { - var passed = filterFunc(targetArray[i]); - if(passed) { - forAllAttrs(fillFn, i); - indexToPoints[index++] = originalPointsAccessor(i); + var styleFns; + if(showMarkers) { + styleFns = Drawing.makePointStyleFns(trace); } - else if(preservegaps) index++; - } - - opts._indexToPoints = indexToPoints; - trace._length = index; -}; - -function getFilterFunc(opts, d2c, targetCalendar) { - var operation = opts.operation, - value = opts.value, - hasArrayValue = Array.isArray(value); - function isOperationIn(array) { - return array.indexOf(operation) !== -1; - } + join.each(function(d) { + var el = d3.select(this); + var sel = transition(el); + hasNode = Drawing.translatePoint(d, sel, xa, ya); - var d2cValue = function(v) { return d2c(v, 0, opts.valuecalendar); }, - d2cTarget = function(v) { return d2c(v, 0, targetCalendar); }; + if(hasNode) { + Drawing.singlePointStyle(d, sel, trace, styleFns, gd); - var coercedValue; + if(plotinfo.layerClipId) { + Drawing.hideOutsideRangePoint(d, sel, xa, ya, trace.xcalendar, trace.ycalendar); + } - if(isOperationIn(COMPARISON_OPS)) { - coercedValue = hasArrayValue ? d2cValue(value[0]) : d2cValue(value); - } - else if(isOperationIn(INTERVAL_OPS)) { - coercedValue = hasArrayValue ? - [d2cValue(value[0]), d2cValue(value[1])] : - [d2cValue(value), d2cValue(value)]; - } - else if(isOperationIn(SET_OPS)) { - coercedValue = hasArrayValue ? value.map(d2cValue) : [d2cValue(value)]; - } + if(trace.customdata) { + el.classed('plotly-customdata', d.data !== null && d.data !== undefined); + } + } else { + sel.remove(); + } + }); - switch(operation) { + if(hasTransition) { + join.exit().transition() + .style('opacity', 0) + .remove(); + } else { + join.exit().remove(); + } - case '=': - return function(v) { return d2cTarget(v) === coercedValue; }; + // text points + selection = text.selectAll('g'); + join = selection.data(textFilter, keyFunc); - case '!=': - return function(v) { return d2cTarget(v) !== coercedValue; }; + // each text needs to go in its own 'g' in case + // it gets converted to mathjax + join.enter().append('g').classed('textpoint', true).append('text'); - case '<': - return function(v) { return d2cTarget(v) < coercedValue; }; + join.order(); - case '<=': - return function(v) { return d2cTarget(v) <= coercedValue; }; + join.each(function(d) { + var g = d3.select(this); + var sel = transition(g.select('text')); + hasNode = Drawing.translatePoint(d, sel, xa, ya); - case '>': - return function(v) { return d2cTarget(v) > coercedValue; }; + if(hasNode) { + if(plotinfo.layerClipId) { + Drawing.hideOutsideRangePoint(d, g, xa, ya, trace.xcalendar, trace.ycalendar); + } + } else { + g.remove(); + } + }); - case '>=': - return function(v) { return d2cTarget(v) >= coercedValue; }; + join.selectAll('text') + .call(Drawing.textPointStyle, trace, gd) + .each(function(d) { + // This just *has* to be totally custom becuase of SVG text positioning :( + // It's obviously copied from translatePoint; we just can't use that + var x = xa.c2p(d.x); + var y = ya.c2p(d.y); - case '[]': - return function(v) { - var cv = d2cTarget(v); - return cv >= coercedValue[0] && cv <= coercedValue[1]; - }; + d3.select(this).selectAll('tspan.line').each(function() { + transition(d3.select(this)).attr({x: x, y: y}); + }); + }); - case '()': - return function(v) { - var cv = d2cTarget(v); - return cv > coercedValue[0] && cv < coercedValue[1]; - }; + join.exit().remove(); + } - case '[)': - return function(v) { - var cv = d2cTarget(v); - return cv >= coercedValue[0] && cv < coercedValue[1]; - }; + points.datum(cdscatter); + text.datum(cdscatter); + makePoints(points, text, cdscatter); - case '(]': - return function(v) { - var cv = d2cTarget(v); - return cv > coercedValue[0] && cv <= coercedValue[1]; - }; + // lastly, clip points groups of `cliponaxis !== false` traces + // on `plotinfo._hasClipOnAxisFalse === true` subplots + var hasClipOnAxisFalse = trace.cliponaxis === false; + var clipUrl = hasClipOnAxisFalse ? null : plotinfo.layerClipId; + Drawing.setClipUrl(points, clipUrl, gd); + Drawing.setClipUrl(text, clipUrl, gd); +} - case '][': - return function(v) { - var cv = d2cTarget(v); - return cv <= coercedValue[0] || cv >= coercedValue[1]; - }; +function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var xr = d3.extent(Lib.simpleMap(xa.range, xa.r2c)); + var yr = d3.extent(Lib.simpleMap(ya.range, ya.r2c)); - case ')(': - return function(v) { - var cv = d2cTarget(v); - return cv < coercedValue[0] || cv > coercedValue[1]; - }; + var trace = cdscatter[0].trace; + if(!subTypes.hasMarkers(trace)) return; + // if marker.maxdisplayed is used, select a maximum of + // mnum markers to show, from the set that are in the viewport + var mnum = trace.marker.maxdisplayed; - case '](': - return function(v) { - var cv = d2cTarget(v); - return cv <= coercedValue[0] || cv > coercedValue[1]; - }; + // TODO: remove some as we get away from the viewport? + if(mnum === 0) return; - case ')[': - return function(v) { - var cv = d2cTarget(v); - return cv < coercedValue[0] || cv >= coercedValue[1]; - }; + var cd = cdscatter.filter(function(v) { + return v.x >= xr[0] && v.x <= xr[1] && v.y >= yr[0] && v.y <= yr[1]; + }); + var inc = Math.ceil(cd.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++; + } + }); - case '{}': - return function(v) { - return coercedValue.indexOf(d2cTarget(v)) !== -1; - }; + // if multiple traces use maxdisplayed, stagger which markers we + // display this formula offsets successive traces by 1/3 of the + // increment, adding an extra small amount after each triplet so + // it's not quite periodic + var i0 = Math.round(tnum * inc / 3 + Math.floor(tnum / 3) * inc / 7.1); - case '}{': - return function(v) { - return coercedValue.indexOf(d2cTarget(v)) === -1; - }; - } + // for error bars: save in cd which markers to show + // so we don't have to repeat this + cdscatter.forEach(function(v) { delete v.vis; }); + cd.forEach(function(v, i) { + if(Math.round((i + i0) % inc) === 0) v.vis = true; + }); } -},{"../constants/filter_ops":669,"../lib":696,"../plots/cartesian/axes":744,"../registry":827,"./helpers":1158}],1157:[function(_dereq_,module,exports){ +},{"../../components/drawing":64,"../../lib":159,"../../lib/polygon":171,"../../registry":243,"./line_points":295,"./link_traces":297,"./subtypes":305,"d3":8}],302:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../lib'); -var PlotSchema = _dereq_('../plot_api/plot_schema'); -var Plots = _dereq_('../plots/plots'); -var pointsAccessorFunction = _dereq_('./helpers').pointsAccessorFunction; - -exports.moduleType = 'transform'; -exports.name = 'groupby'; +'use strict'; -exports.attributes = { - enabled: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - groups: { - valType: 'data_array', - dflt: [], - - editType: 'calc', - - }, - nameformat: { - valType: 'string', - - editType: 'calc', - - }, - styles: { - _isLinkedToArray: 'style', - target: { - valType: 'string', - - editType: 'calc', - - }, - value: { - valType: 'any', - - dflt: {}, - editType: 'calc', - - _compareAsJSON: true - }, - editType: 'calc' - }, - editType: 'calc' -}; +var subtypes = _dereq_('./subtypes'); -/** - * Supply transform attributes defaults - * - * @param {object} transformIn - * object linked to trace.transforms[i] with 'type' set to exports.name - * @param {object} traceOut - * the _fullData trace this transform applies to - * @param {object} layout - * the plot's (not-so-full) layout - * @param {object} traceIn - * the input data trace this transform applies to - * - * @return {object} transformOut - * copy of transformIn that contains attribute defaults - */ -exports.supplyDefaults = function(transformIn, traceOut, layout) { +module.exports = function selectPoints(searchInfo, selectionTester) { + var cd = searchInfo.cd; + var xa = searchInfo.xaxis; + var ya = searchInfo.yaxis; + var selection = []; + var trace = cd[0].trace; var i; - var transformOut = {}; - - function coerce(attr, dflt) { - return Lib.coerce(transformIn, transformOut, exports.attributes, attr, dflt); - } - - var enabled = coerce('enabled'); + var di; + var x; + var y; - if(!enabled) return transformOut; - - coerce('groups'); - coerce('nameformat', layout._dataLength > 1 ? '%{group} (%{trace})' : '%{group}'); - - var styleIn = transformIn.styles; - var styleOut = transformOut.styles = []; + var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); + if(hasOnlyLines) return []; - if(styleIn) { - for(i = 0; i < styleIn.length; i++) { - var thisStyle = styleOut[i] = {}; - Lib.coerce(styleIn[i], styleOut[i], exports.attributes.styles, 'target'); - var value = Lib.coerce(styleIn[i], styleOut[i], exports.attributes.styles, 'value'); + if(selectionTester === false) { // clear selection + for(i = 0; i < cd.length; i++) { + cd[i].selected = 0; + } + } + else { + for(i = 0; i < cd.length; i++) { + di = cd[i]; + x = xa.c2p(di.x); + y = ya.c2p(di.y); - // so that you can edit value in place and have Plotly.react notice it, or - // rebuild it every time and have Plotly.react NOT think it changed: - // use _compareAsJSON to say we should diff the _JSON_value - if(Lib.isPlainObject(value)) thisStyle.value = Lib.extendDeep({}, value); - else if(value) delete thisStyle.value; + if((di.i !== null) && selectionTester.contains([x, y], false, i, searchInfo)) { + selection.push({ + pointNumber: di.i, + x: xa.c2d(di.x), + y: ya.c2d(di.y) + }); + di.selected = 1; + } else { + di.selected = 0; + } } } - return transformOut; + return selection; }; - +},{"./subtypes":305}],303:[function(_dereq_,module,exports){ /** - * Apply transform !!! - * - * @param {array} data - * array of transformed traces (is [fullTrace] upon first transform) - * - * @param {object} state - * state object which includes: - * - transform {object} full transform attributes - * - fullTrace {object} full trace object which is being transformed - * - fullData {array} full pre-transform(s) data array - * - layout {object} the plot's (not-so-full) layout - * - * @return {object} newData - * array of transformed traces - */ -exports.transform = function(data, state) { - var newTraces, i, j; - var newData = []; - - for(i = 0; i < data.length; i++) { - newTraces = transformOne(data[i], state); +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - for(j = 0; j < newTraces.length; j++) { - newData.push(newTraces[j]); - } - } +'use strict'; - return newData; -}; +var perStackAttrs = ['orientation', 'groupnorm', 'stackgaps']; -function transformOne(trace, state) { - var i, j, k, attr, srcArray, groupName, newTrace, transforms, arrayLookup; - var groupNameObj; +module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) { + var stackOpts = layout._scatterStackOpts; - var opts = state.transform; - var transformIndex = state.transformIndex; - var groups = trace.transforms[transformIndex].groups; - var originalPointsAccessor = pointsAccessorFunction(trace.transforms, opts); + var stackGroup = coerce('stackgroup'); + if(stackGroup) { + // use independent stacking options per subplot + var subplot = traceOut.xaxis + traceOut.yaxis; + var subplotStackOpts = stackOpts[subplot]; + if(!subplotStackOpts) subplotStackOpts = stackOpts[subplot] = {}; - if(!(Array.isArray(groups)) || groups.length === 0) { - return [trace]; - } + 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; + } + // TODO: how is this going to work with groupby transforms? + // in principle it should be OK I guess, as long as explicit group styles + // don't override explicit base-trace styles? - var groupNames = Lib.filterUnique(groups), - newData = new Array(groupNames.length), - len = groups.length; + var dflts = { + orientation: (traceOut.x && !traceOut.y) ? 'h' : 'v' + }; - var arrayAttrs = PlotSchema.findArrayAttributes(trace); + for(var i = 0; i < perStackAttrs.length; i++) { + var attr = perStackAttrs[i]; + var attrFound = attr + 'Found'; + if(!groupOpts[attrFound]) { + var traceHasAttr = traceIn[attr] !== undefined; + var isOrientation = attr === 'orientation'; + if(traceHasAttr || firstTrace) { + groupOpts[attr] = coerce(attr, dflts[attr]); - var styles = opts.styles || []; - var styleLookup = {}; - for(i = 0; i < styles.length; i++) { - styleLookup[styles[i].target] = styles[i].value; - } + if(isOrientation) { + groupOpts.fillDflt = groupOpts[attr] === 'h' ? + 'tonextx' : 'tonexty'; + } - if(opts.styles) { - groupNameObj = Lib.keyedContainer(opts, 'styles', 'target', 'value.name'); - } + if(traceHasAttr) { + // Note: this will show a value here even if it's invalid + // in which case it will revert to default. + groupOpts[attrFound] = true; - // An index to map group name --> expanded trace index - var indexLookup = {}; - var indexCnts = {}; + // Note: only one trace in the stack will get a _fullData + // entry for a given stack-wide attribute. If no traces + // (or the first trace) specify that attribute, the + // first trace will get it. If the first trace does NOT + // specify it but some later trace does, then it gets + // removed from the first trace and only included in the + // one that specified it. This is mostly important for + // editors (that want to see the full values to know + // what settings are available) and Plotly.react diffing. + // Editors may want to use fullLayout._scatterStackOpts + // directly and make these settings available from all + // traces in the stack... then set the new value into + // the first trace, and clear all later traces. + if(!firstTrace) { + delete groupOpts.traces[0][attr]; - for(i = 0; i < groupNames.length; i++) { - groupName = groupNames[i]; - indexLookup[groupName] = i; - indexCnts[groupName] = 0; - - // Start with a deep extend that just copies array references. - newTrace = newData[i] = Lib.extendDeepNoArrays({}, trace); - newTrace._group = groupName; - // helper function for when we need to push updates back to the input, - // outside of the normal restyle/relayout pathway, like filling in auto values - newTrace.updateStyle = styleUpdater(groupName, transformIndex); - newTrace.transforms[transformIndex]._indexToPoints = {}; - - var suppliedName = null; - if(groupNameObj) { - suppliedName = groupNameObj.get(groupName); + // orientation can affect default fill of previous traces + 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; + } +}; - if(suppliedName || suppliedName === '') { - newTrace.name = suppliedName; - } else { - newTrace.name = Lib.templateString(opts.nameformat, { - trace: trace.name, - group: groupName - }); - } +},{}],304:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - // In order for groups to apply correctly to other transform data (e.g. - // a filter transform), we have to break the connection and clone the - // transforms so that each group writes grouped values into a different - // destination. This function does not break the array reference - // connection between the split transforms it creates. That's handled in - // initialize, which creates a new empty array for each arrayAttr. - transforms = newTrace.transforms; - newTrace.transforms = []; - for(j = 0; j < transforms.length; j++) { - newTrace.transforms[j] = Lib.extendDeepNoArrays({}, transforms[j]); - } - // Initialize empty arrays for the arrayAttrs, to be split in the next step - for(j = 0; j < arrayAttrs.length; j++) { - Lib.nestedProperty(newTrace, arrayAttrs[j]).set([]); - } - } +'use strict'; - // For each array attribute including those nested inside this and other - // transforms (small note that we technically only need to do this for - // transforms that have not yet been applied): - for(k = 0; k < arrayAttrs.length; k++) { - attr = arrayAttrs[k]; +var d3 = _dereq_('d3'); +var Drawing = _dereq_('../../components/drawing'); +var Registry = _dereq_('../../registry'); - // Cache all the arrays to which we'll push: - for(j = 0, arrayLookup = []; j < groupNames.length; j++) { - arrayLookup[j] = Lib.nestedProperty(newData[j], attr).get(); - } +function style(gd, cd) { + var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.scatter'); - // Get the input data: - srcArray = Lib.nestedProperty(trace, attr).get(); + s.style('opacity', function(d) { + return d[0].trace.opacity; + }); - // Send each data point to the appropriate expanded trace: - for(j = 0; j < len; j++) { - // Map group data --> trace index --> array and push data onto it - arrayLookup[indexLookup[groups[j]]].push(srcArray[j]); - } - } + s.selectAll('g.points').each(function(d) { + var sel = d3.select(this); + var trace = d.trace || d[0].trace; + stylePoints(sel, trace, gd); + }); - for(j = 0; j < len; j++) { - newTrace = newData[indexLookup[groups[j]]]; + s.selectAll('g.text').each(function(d) { + var sel = d3.select(this); + var trace = d.trace || d[0].trace; + styleText(sel, trace, gd); + }); - var indexToPoints = newTrace.transforms[transformIndex]._indexToPoints; - indexToPoints[indexCnts[groups[j]]] = originalPointsAccessor(j); - indexCnts[groups[j]]++; - } + s.selectAll('g.trace path.js-line') + .call(Drawing.lineGroupStyle); - for(i = 0; i < groupNames.length; i++) { - groupName = groupNames[i]; - newTrace = newData[i]; + s.selectAll('g.trace path.js-fill') + .call(Drawing.fillGroupStyle); - Plots.clearExpandedTraceDefaultColors(newTrace); + Registry.getComponentMethod('errorbars', 'style')(s); +} - // there's no need to coerce styleLookup[groupName] here - // as another round of supplyDefaults is done on the transformed traces - newTrace = Lib.extendDeepNoArrays(newTrace, styleLookup[groupName] || {}); - } +function stylePoints(sel, trace, gd) { + Drawing.pointStyle(sel.selectAll('path.point'), trace, gd); +} - return newData; +function styleText(sel, trace, gd) { + Drawing.textPointStyle(sel.selectAll('text'), trace, gd); } -function styleUpdater(groupName, transformIndex) { - return function(trace, attr, value) { - Lib.keyedContainer( - trace, - 'transforms[' + transformIndex + '].styles', - 'target', - 'value.' + attr - ).set(String(groupName), value); - }; +function styleOnSelect(gd, cd) { + var s = cd[0].node3; + var trace = cd[0].trace; + + if(trace.selectedpoints) { + Drawing.selectedPointStyle(s.selectAll('path.point'), trace); + Drawing.selectedTextStyle(s.selectAll('text'), trace); + } else { + stylePoints(s, trace, gd); + styleText(s, trace, gd); + } } -},{"../lib":696,"../plot_api/plot_schema":733,"../plots/plots":808,"./helpers":1158}],1158:[function(_dereq_,module,exports){ +module.exports = { + style: style, + stylePoints: stylePoints, + styleText: styleText, + styleOnSelect: styleOnSelect +}; + +},{"../../components/drawing":64,"../../registry":243,"d3":8}],305:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + 'use strict'; -exports.pointsAccessorFunction = function(transforms, opts) { - var tr; - var prevIndexToPoints; - for(var i = 0; i < transforms.length; i++) { - tr = transforms[i]; - if(tr === opts) break; - if(!tr._indexToPoints || tr.enabled === false) continue; - prevIndexToPoints = tr._indexToPoints; +var Lib = _dereq_('../../lib'); + +module.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) { + return Lib.isPlainObject(trace.marker) && + Lib.isArrayOrTypedArray(trace.marker.size); } - var originalPointsAccessor = prevIndexToPoints ? - function(i) {return prevIndexToPoints[i];} : - function(i) {return [i];}; - return originalPointsAccessor; }; -},{}],1159:[function(_dereq_,module,exports){ +},{"../../lib":159}],306:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -'use strict'; - -var Lib = _dereq_('../lib'); -var Axes = _dereq_('../plots/cartesian/axes'); -var pointsAccessorFunction = _dereq_('./helpers').pointsAccessorFunction; - -exports.moduleType = 'transform'; - -exports.name = 'sort'; -exports.attributes = { - enabled: { - valType: 'boolean', - dflt: true, - - editType: 'calc', - - }, - target: { - valType: 'string', - strict: true, - noBlank: true, - arrayOk: true, - dflt: 'x', - - editType: 'calc', - - }, - order: { - valType: 'enumerated', - values: ['ascending', 'descending'], - dflt: 'ascending', - - editType: 'calc', - - }, - editType: 'calc' -}; +'use strict'; -exports.supplyDefaults = function(transformIn) { - var transformOut = {}; +var Lib = _dereq_('../../lib'); - function coerce(attr, dflt) { - return Lib.coerce(transformIn, transformOut, exports.attributes, attr, dflt); - } +/* + * opts: object of flags to control features not all text users support + * noSelect: caller does not support selected/unselected attribute containers + */ +module.exports = function(traceIn, traceOut, layout, coerce, opts) { + opts = opts || {}; - var enabled = coerce('enabled'); + coerce('textposition'); + Lib.coerceFont(coerce, 'textfont', layout.font); - if(enabled) { - coerce('target'); - coerce('order'); + if(!opts.noSelect) { + coerce('selected.textfont.color'); + coerce('unselected.textfont.color'); } - - return transformOut; }; -exports.calcTransform = function(gd, trace, opts) { - if(!opts.enabled) return; - - var targetArray = Lib.getTargetArray(trace, opts); - if(!targetArray) return; +},{"../../lib":159}],307:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ - var target = opts.target; +'use strict'; - var len = targetArray.length; - if(trace._length) len = Math.min(len, trace._length); +var Lib = _dereq_('../../lib'); +var Registry = _dereq_('../../registry'); - var arrayAttrs = trace._arrayAttrs; - var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray); - var indices = getIndices(opts, targetArray, d2c, len); - var originalPointsAccessor = pointsAccessorFunction(trace.transforms, opts); - var indexToPoints = {}; - var i, j; +module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { + var x = coerce('x'); + var y = coerce('y'); + var len; - for(i = 0; i < arrayAttrs.length; i++) { - var np = Lib.nestedProperty(trace, arrayAttrs[i]); - var arrayOld = np.get(); - var arrayNew = new Array(len); + var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); + handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout); - for(j = 0; j < len; j++) { - arrayNew[j] = arrayOld[indices[j]]; + 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; - np.set(arrayNew); + len = Lib.minRowLength(y); + coerce('x0'); + coerce('dx'); } - for(j = 0; j < len; j++) { - indexToPoints[j] = originalPointsAccessor(indices[j]); - } + traceOut._length = len; - opts._indexToPoints = indexToPoints; - trace._length = len; + return len; }; -function getIndices(opts, targetArray, d2c, len) { - var sortedArray = new Array(len); - var indices = new Array(len); - var i; - - for(i = 0; i < len; i++) { - sortedArray[i] = {v: targetArray[i], i: i}; - } - - sortedArray.sort(getSortFunc(opts, d2c)); - - for(i = 0; i < len; i++) { - indices[i] = sortedArray[i].i; - } - - return indices; -} - -function getSortFunc(opts, d2c) { - switch(opts.order) { - case 'ascending': - return function(a, b) { return d2c(a.v) - d2c(b.v); }; - case 'descending': - return function(a, b) { return d2c(b.v) - d2c(a.v); }; - } -} - -},{"../lib":696,"../plots/cartesian/axes":744,"./helpers":1158}]},{},[22])(22) +},{"../../lib":159,"../../registry":243}]},{},[5])(5) }); diff -Nru plotly-3.5.0+dfsg1/PKG-INFO plotly-3.6.1+dfsg1/PKG-INFO --- plotly-3.5.0+dfsg1/PKG-INFO 2019-01-04 13:06:02.000000000 +0000 +++ plotly-3.6.1+dfsg1/PKG-INFO 2019-02-08 23:45:51.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: plotly -Version: 3.5.0 +Version: 3.6.1 Summary: Python plotting library for collaborative, interactive, publication-quality graphs. Home-page: https://plot.ly/python/ Author: Chris P diff -Nru plotly-3.5.0+dfsg1/plotly/basedatatypes.py plotly-3.6.1+dfsg1/plotly/basedatatypes.py --- plotly-3.5.0+dfsg1/plotly/basedatatypes.py 2019-01-03 00:26:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/basedatatypes.py 2019-01-26 13:45:49.000000000 +0000 @@ -2619,7 +2619,19 @@ ------- BaseValidator """ - return self._validators[prop] + + # Handle remapping + # ---------------- + if prop in self._mapped_properties: + prop_path = self._mapped_properties[prop] + plotly_obj = self[prop_path[:-1]] + prop = prop_path[-1] + else: + plotly_obj = self + + # Return validator + # ---------------- + return plotly_obj._validators[prop] @property def parent(self): diff -Nru plotly-3.5.0+dfsg1/plotly/basewidget.py plotly-3.6.1+dfsg1/plotly/basewidget.py --- plotly-3.5.0+dfsg1/plotly/basewidget.py 2018-11-23 14:25:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/basewidget.py 2019-02-08 22:52:55.000000000 +0000 @@ -15,7 +15,8 @@ from .serializers import custom_serializers from .version import __frontend_version__ -@widgets.register() + +@widgets.register class BaseFigureWidget(BaseFigure, widgets.DOMWidget): """ Base class for FigureWidget. The FigureWidget class is code-generated as a diff -Nru plotly-3.5.0+dfsg1/plotly/figure_factory/_annotated_heatmap.py plotly-3.6.1+dfsg1/plotly/figure_factory/_annotated_heatmap.py --- plotly-3.5.0+dfsg1/plotly/figure_factory/_annotated_heatmap.py 2018-12-20 22:30:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/figure_factory/_annotated_heatmap.py 2019-01-26 15:35:47.000000000 +0000 @@ -1,4 +1,4 @@ -from __future__ import absolute_import +from __future__ import absolute_import, division from plotly import exceptions, optional_imports import plotly.colors as clrs @@ -234,8 +234,8 @@ z_min = np.amin(self.z) z_max = np.amax(self.z) else: - z_min = min(min(self.z)) - z_max = max(max(self.z)) + z_min = min([v for row in self.z for v in row]) + z_max = max([v for row in self.z for v in row]) z_mid = (z_max+z_min) / 2 return z_mid diff -Nru plotly-3.5.0+dfsg1/plotly/figure_factory/__init__.py plotly-3.6.1+dfsg1/plotly/figure_factory/__init__.py --- plotly-3.5.0+dfsg1/plotly/figure_factory/__init__.py 2018-06-09 12:07:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/figure_factory/__init__.py 2019-02-05 11:22:17.000000000 +0000 @@ -3,7 +3,11 @@ from plotly import optional_imports # Require that numpy exists for figure_factory -import numpy +np = optional_imports.get_module('numpy') +if np is None: + raise ImportError("""\ +The figure factory module requires the numpy package""") + from plotly.figure_factory._2d_density import create_2d_density from plotly.figure_factory._annotated_heatmap import create_annotated_heatmap @@ -18,6 +22,7 @@ from plotly.figure_factory._scatterplot import create_scatterplotmatrix from plotly.figure_factory._streamline import create_streamline from plotly.figure_factory._table import create_table +from plotly.figure_factory._ternary_contour import create_ternary_contour from plotly.figure_factory._trisurf import create_trisurf from plotly.figure_factory._violin import create_violin if optional_imports.get_module('pandas') is not None: diff -Nru plotly-3.5.0+dfsg1/plotly/figure_factory/_ternary_contour.py plotly-3.6.1+dfsg1/plotly/figure_factory/_ternary_contour.py --- plotly-3.5.0+dfsg1/plotly/figure_factory/_ternary_contour.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/figure_factory/_ternary_contour.py 2019-02-08 22:52:51.000000000 +0000 @@ -0,0 +1,526 @@ +from __future__ import absolute_import +from plotly import optional_imports +from plotly.graph_objs import graph_objs as go + +import numpy as np +interpolate = optional_imports.get_module('scipy.interpolate') + + +def _pl_deep(): + return [[0.0, 'rgb(253, 253, 204)'], + [0.1, 'rgb(201, 235, 177)'], + [0.2, 'rgb(145, 216, 163)'], + [0.3, 'rgb(102, 194, 163)'], + [0.4, 'rgb(81, 168, 162)'], + [0.5, 'rgb(72, 141, 157)'], + [0.6, 'rgb(64, 117, 152)'], + [0.7, 'rgb(61, 90, 146)'], + [0.8, 'rgb(65, 64, 123)'], + [0.9, 'rgb(55, 44, 80)'], + [1.0, 'rgb(39, 26, 44)']] + + +def _transform_barycentric_cartesian(): + """ + Returns the transformation matrix from barycentric to cartesian + coordinates and conversely. + """ + # reference triangle + tri_verts = np.array([[0.5, np.sqrt(3) / 2], [0, 0], [1, 0]]) + M = np.array([tri_verts[:, 0], tri_verts[:, 1], np.ones(3)]) + return M, np.linalg.inv(M) + + +def _contour_trace(x, y, z, tooltip, ncontours=None, colorscale='Viridis', + showscale=False, linewidth=0.5, + linecolor='rgb(150,150,150)', + coloring=None, fontcolor='blue', + fontsize=12): + """ + Contour trace in Cartesian coordinates. + + Parameters + ========== + + x, y : array-like + Cartesian coordinates + z : array-like + Field to be represented as contours. + tooltip : list of str + Annotations to show on hover. + ncontours : int or None + Number of contours to display (determined automatically if None). + colorscale : str o array, optional + Colorscale to use for contours + showscale : bool + If True, a colorbar showing the color scale is displayed. + linewidth : int + Line width of contours + linecolor : color string + Color on contours + coloring : None or 'lines' + How to display contour. Filled contours if None, lines if ``lines``. + colorscale : None or array-like + Colorscale of the contours. + fontcolor : color str + Color of contour labels. + fontsize : int + Font size of contour labels. + """ + + c_dict = dict(type='contour', + x=x, y=y, z=z, + text=tooltip, + hoverinfo='text', + ncontours=ncontours, + colorscale=colorscale, + showscale=showscale, + line=dict(width=linewidth, color=linecolor), + colorbar=dict(thickness=20, ticklen=4) + ) + if coloring == 'lines': + contours = dict(coloring=coloring) + c_dict.update(contours=contours) + return go.Contour(c_dict) + + +def barycentric_ticks(side): + """ + Barycentric coordinates of ticks locations. + + Parameters + ========== + side : 0, 1 or 2 + side j has 0 in the j^th position of barycentric coords of tick + origin. + """ + p = 10 + if side == 0: # where a=0 + return np.array([(0, j/p, 1-j/p) for j in range(p - 2, 0, -2)]) + elif side == 1: # b=0 + return np.array([(i/p, 0, 1-i/p) for i in range(2, p, 2)]) + elif side == 2: # c=0 + return (np.array([(i/p, j/p, 0) + for i in range(p - 2, 0, -2) + for j in range(p - i, -1, -1) if i + j == p])) + else: + raise ValueError('The side can be only 0, 1, 2') + + +def _side_coord_ticks(side, t=0.01): + """ + Cartesian coordinates of ticks loactions for one side (0, 1, 2) + of ternary diagram. + + Parameters + ========== + + side : int, 0, 1 or 2 + Index of side + t : float, default 0.01 + Length of tick + + Returns + ======= + xt, yt : lists + Lists of x, resp y-coords of tick segments + posx, posy : lists + Lists of ticklabel positions + """ + M, invM = _transform_barycentric_cartesian() + baryc = barycentric_ticks(side) + xy1 = np.dot(M, baryc.T) + xs, ys = xy1[:2] + x_ticks, y_ticks, posx, posy = [], [], [], [] + if side == 0: + for i in range(4): + x_ticks.extend([xs[i], xs[i]+t, None]) + y_ticks.extend([ys[i], ys[i]-np.sqrt(3)*t, None]) + posx.extend([xs[i]+t for i in range(4)]) + posy.extend([ys[i]-np.sqrt(3)*t for i in range(4)]) + elif side == 1: + for i in range(4): + x_ticks.extend([xs[i], xs[i]+t, None]) + y_ticks.extend([ys[i], ys[i]+np.sqrt(3)*t, None]) + posx.extend([xs[i]+t for i in range(4)]) + posy.extend([ys[i]+np.sqrt(3)*t for i in range(4)]) + elif side == 2: + for i in range(4): + x_ticks.extend([xs[i], xs[i]-2*t, None]) + y_ticks.extend([ys[i], ys[i], None]) + posx.extend([xs[i]-2*t for i in range(4)]) + posy.extend([ys[i] for i in range(4)]) + else: + raise ValueError('Side can be only 0, 1, 2') + return x_ticks, y_ticks, posx, posy + + +def _cart_coord_ticks(t=0.01): + """ + Cartesian coordinates of ticks loactions. + + Parameters + ========== + + t : float, default 0.01 + Length of tick + + Returns + ======= + xt, yt : lists + Lists of x, resp y-coords of tick segments (all sides concatenated). + posx, posy : lists + Lists of ticklabel positions (all sides concatenated). + """ + x_ticks, y_ticks, posx, posy = [], [], [], [] + for side in range(3): + xt, yt, px, py = _side_coord_ticks(side, t) + x_ticks.extend(xt) + y_ticks.extend(yt) + posx.extend(px) + posy.extend(py) + return x_ticks, y_ticks, posx, posy + + +def _set_ticklabels(annotations, posx, posy, proportions=True): + """ + + Parameters + ========== + + annotations : list + List of annotations previously defined in layout definition + as a dict, not as an instance of go.Layout. + posx, posy: lists + Lists containing ticklabel position coordinates + proportions : bool + True when ticklabels are 0.2, 0.4, ... False when they are + 20%, 40%... + """ + if not isinstance(annotations, list): + raise ValueError('annotations should be a list') + + ticklabel = [0.8, 0.6, 0.4, 0.2] if proportions \ + else ['80%', '60%', '40%', '20%'] + + # Annotations for ticklabels on side 0 + annotations.extend([dict(showarrow=False, + text=str(ticklabel[j]), + x=posx[j], + y=posy[j], + align='center', + xanchor='center', + yanchor='top', + font=dict(size=12)) for j in range(4)]) + + # Annotations for ticklabels on side 1 + annotations.extend([dict(showarrow=False, + text=str(ticklabel[j]), + x=posx[j+4], + y=posy[j+4], + align='center', + xanchor='left', + yanchor='middle', + font=dict(size=12)) for j in range(4)]) + + # Annotations for ticklabels on side 2 + annotations.extend([dict(showarrow=False, + text=str(ticklabel[j]), + x=posx[j+8], + y=posy[j+8], + align='center', + xanchor='right', + yanchor='middle', + font=dict(size=12)) for j in range(4)]) + return annotations + + +def _styling_traces_ternary(x_ticks, y_ticks): + """ + Traces for outer triangle of ternary plot, and corresponding ticks. + + Parameters + ========== + + x_ticks : array_like, 1D + x Cartesian coordinate of ticks + y_ticks : array_like, 1D + y Cartesian coordinate of ticks + """ + side_trace = dict(type='scatter', + x=[0.5, 0, 1, 0.5], + y=[np.sqrt(3)/2, 0, 0, np.sqrt(3)/2], + mode='lines', + line=dict(width=2, color='#444444'), + hoverinfo='none') + + tick_trace = dict(type='scatter', + x=x_ticks, + y=y_ticks, + mode='lines', + line=dict(width=1, color='#444444'), + hoverinfo='none') + + return side_trace, tick_trace + + +def _ternary_layout(title='Ternary contour plot', width=550, height=525, + fontfamily='Balto, sans-serif', colorbar_fontsize=14, + plot_bgcolor='rgb(240,240,240)', + pole_labels=['a', 'b', 'c'], label_fontsize=16): + """ + Layout of ternary contour plot, to be passed to ``go.FigureWidget`` + object. + + Parameters + ========== + title : str or None + Title of ternary plot + width : int + Figure width. + height : int + Figure height. + fontfamily : str + Family of fonts + colorbar_fontsize : int + Font size of colorbar. + plot_bgcolor : + color of figure background + pole_labels : str, default ['a', 'b', 'c'] + Names of the three poles of the triangle. + label_fontsize : int + Font size of pole labels. + """ + return dict(title=title, + font=dict(family=fontfamily, size=colorbar_fontsize), + width=width, height=height, + xaxis=dict(visible=False), + yaxis=dict(visible=False), + plot_bgcolor=plot_bgcolor, + showlegend=False, + # annotations for strings placed at the triangle vertices + annotations=[dict(showarrow=False, + text=pole_labels[0], + x=0.5, + y=np.sqrt(3)/2, + align='center', + xanchor='center', + yanchor='bottom', + font=dict(size=label_fontsize)), + dict(showarrow=False, + text=pole_labels[1], + x=0, + y=0, + align='left', + xanchor='right', + yanchor='top', + font=dict(size=label_fontsize)), + dict(showarrow=False, + text=pole_labels[2], + x=1, + y=0, + align='right', + xanchor='left', + yanchor='top', + font=dict(size=label_fontsize)) + ]) + + +def _tooltip(N, bar_coords, grid_z, xy1, mode='proportions'): + """ + Tooltip annotations to be displayed on hover. + + Parameters + ========== + + N : int + Number of annotations along each axis. + bar_coords : array-like + Barycentric coordinates. + grid_z : array + Values (e.g. elevation values) at barycentric coordinates. + xy1 : array-like + Cartesian coordinates. + mode : str, 'proportions' or 'percents' + Coordinates inside the ternary plot can be displayed either as + proportions (adding up to 1) or as percents (adding up to 100). + """ + if mode == 'proportions' or mode == 'proportion': + tooltip = [ + ['a: %.2f' % round(bar_coords[0][i, j], 2) + + '
b: %.2f' % round(bar_coords[1][i, j], 2) + + '
c: %.2f' % (round(1-round(bar_coords[0][i, j], 2) - + round(bar_coords[1][i, j], 2), 2)) + + '
z: %.2f' % round(grid_z[i, j], 2) + if ~np.isnan(xy1[0][i, j]) else '' for j in range(N)] + for i in range(N)] + elif mode == 'percents' or mode == 'percent': + tooltip = [ + ['a: %d' % int(100*bar_coords[0][i, j] + 0.5) + + '
b: %d' % int(100*bar_coords[1][i, j] + 0.5) + + '
c: %d' % (100-int(100*bar_coords[0][i, j] + 0.5) - + int(100*bar_coords[1][i, j] + 0.5)) + + '
z: %.2f' % round(grid_z[i, j], 2) + if ~np.isnan(xy1[0][i, j]) else '' for j in range(N)] + for i in range(N)] + else: + raise ValueError("""tooltip mode must be either "proportions" or + "percents".""") + return tooltip + + +def _prepare_barycentric_coord(b_coords): + """ + Check ternary coordinates and return the right barycentric coordinates. + """ + if not isinstance(b_coords, (list, np.ndarray)): + raise ValueError('Data should be either an array of shape (n,m), or a list of n m-lists, m=2 or 3') + b_coords = np.asarray(b_coords) + if b_coords.shape[0] not in (2, 3): + raise ValueError('A point should have 2 (a, b) or 3 (a, b, c) barycentric coordinates') + if ((len(b_coords) == 3) and + not np.allclose(b_coords.sum(axis=0), 1, rtol=0.01)): + msg = "The sum of coordinates should be one for all data points" + raise ValueError(msg) + A, B = b_coords[:2] + C = 1 - (A + B) + if np.any(np.stack((A, B, C)) < 0): + raise ValueError('Barycentric coordinates should be positive.') + return A, B, C + + +def _compute_grid(coordinates, values, tooltip_mode): + """ + Compute interpolation of data points on regular grid in Cartesian + coordinates. + + Parameters + ========== + + coordinates : array-like + Barycentric coordinates of data points. + values : 1-d array-like + Data points, field to be represented as contours. + tooltip_mode : str, 'proportions' or 'percents' + Coordinates inside the ternary plot can be displayed either as + proportions (adding up to 1) or as percents (adding up to 100). + """ + A, B, C = _prepare_barycentric_coord(coordinates) + M, invM = _transform_barycentric_cartesian() + cartes_coord_points = np.einsum('ik, kj -> ij', M, np.stack((A, B, C))) + xx, yy = cartes_coord_points[:2] + x_min, x_max = xx.min(), xx.max() + y_min, y_max = yy.min(), yy.max() + # n_interp = max(100, int(np.sqrt(len(values)))) + n_interp = 20 + gr_x = np.linspace(x_min, x_max, n_interp) + gr_y = np.linspace(y_min, y_max, n_interp) + grid_x, grid_y = np.meshgrid(gr_x, gr_y) + grid_z = interpolate.griddata( + cartes_coord_points[:2].T, values, (grid_x, grid_y), method='cubic') + bar_coords = np.einsum('ik, kmn -> imn', invM, + np.stack((grid_x, grid_y, np.ones(grid_x.shape)))) + # invalidate the points outside of the reference triangle + bar_coords[np.where(bar_coords < 0)] = 0 # None + # recompute back cartesian coordinates with invalid positions + xy1 = np.einsum('ik, kmn -> imn', M, bar_coords) + is_nan = np.where(np.isnan(xy1[0])) + grid_z[is_nan] = 0 # None + tooltip = _tooltip(n_interp, bar_coords, grid_z, xy1, tooltip_mode) + return grid_z, gr_x, gr_y, tooltip + + +def create_ternary_contour(coordinates, values, pole_labels=['a', 'b', 'c'], + tooltip_mode='proportions', width=500, height=500, + ncontours=None, + showscale=False, + coloring=None, + colorscale=None, + plot_bgcolor='rgb(240,240,240)', + title=None): + """ + Ternary contour plot. + + Parameters + ---------- + + coordinates : list or ndarray + Barycentric coordinates of shape (2, N) or (3, N) where N is the + number of data points. The sum of the 3 coordinates is expected + to be 1 for all data points. + values : array-like + Data points of field to be represented as contours. + pole_labels : str, default ['a', 'b', 'c'] + Names of the three poles of the triangle. + tooltip_mode : str, 'proportions' or 'percents' + Coordinates inside the ternary plot can be displayed either as + proportions (adding up to 1) or as percents (adding up to 100). + width : int + Figure width. + height : int + Figure height. + ncontours : int or None + Number of contours to display (determined automatically if None). + showscale : bool, default False + If True, a colorbar showing the color scale is displayed. + coloring : None or 'lines' + How to display contour. Filled contours if None, lines if ``lines``. + colorscale : None or array-like + colorscale of the contours. + plot_bgcolor : + color of figure background + title : str or None + Title of ternary plot + + Examples + ======== + + Example 1: ternary contour plot with filled contours + + # Define coordinates + a, b = np.mgrid[0:1:20j, 0:1:20j] + mask = a + b <= 1 + a = a[mask].ravel() + b = b[mask].ravel() + c = 1 - a - b + # Values to be displayed as contours + z = a * b * c + fig = ff.create_ternary_contour(np.stack((a, b, c)), z) + + It is also possible to give only two barycentric coordinates for each + point, since the sum of the three coordinates is one: + + fig = ff.create_ternary_contour(np.stack((a, b)), z) + + Example 2: ternary contour plot with line contours + + fig = ff.create_ternary_contour(np.stack((a, b)), z, coloring='lines') + """ + if interpolate is None: + raise ImportError("""\ +The create_ternary_contour figure factory requires the scipy package""") + + grid_z, gr_x, gr_y, tooltip = _compute_grid(coordinates, values, + tooltip_mode) + + x_ticks, y_ticks, posx, posy = _cart_coord_ticks(t=0.01) + + layout = _ternary_layout(pole_labels=pole_labels, + width=width, height=height, title=title, + plot_bgcolor=plot_bgcolor) + + annotations = _set_ticklabels(layout['annotations'], posx, posy, + proportions=True) + if colorscale is None: + colorscale = _pl_deep() + + contour_trace = _contour_trace(gr_x, gr_y, grid_z, tooltip, + ncontours=ncontours, + showscale=showscale, + colorscale=colorscale, + coloring=coloring) + side_trace, tick_trace = _styling_traces_ternary(x_ticks, y_ticks) + fig = go.Figure(data=[contour_trace, tick_trace, side_trace], + layout=layout) + fig.layout.annotations = annotations + return fig diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_area.py plotly-3.6.1+dfsg1/plotly/graph_objs/_area.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_area.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_area.py 2019-02-08 23:01:06.000000000 +0000 @@ -477,6 +477,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -625,7 +628,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -746,7 +751,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_barpolar.py plotly-3.6.1+dfsg1/plotly/graph_objs/_barpolar.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_barpolar.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_barpolar.py 2019-02-08 23:01:01.000000000 +0000 @@ -226,6 +226,60 @@ def hoverlabel(self, val): self['hoverlabel'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # ids # --- @property @@ -803,6 +857,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -990,6 +1047,26 @@ hoverlabel plotly.graph_objs.barpolar.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -1061,7 +1138,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1106,6 +1185,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, ids=None, idssrc=None, legendgroup=None, @@ -1176,6 +1257,26 @@ hoverlabel plotly.graph_objs.barpolar.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -1247,7 +1348,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1320,6 +1423,9 @@ self._validators['hoverinfo'] = v_barpolar.HoverinfoValidator() self._validators['hoverinfosrc'] = v_barpolar.HoverinfosrcValidator() self._validators['hoverlabel'] = v_barpolar.HoverlabelValidator() + self._validators['hovertemplate'] = v_barpolar.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_barpolar.HovertemplatesrcValidator() self._validators['ids'] = v_barpolar.IdsValidator() self._validators['idssrc'] = v_barpolar.IdssrcValidator() self._validators['legendgroup'] = v_barpolar.LegendgroupValidator() @@ -1371,6 +1477,12 @@ self['hoverinfosrc'] = hoverinfosrc if hoverinfosrc is not None else _v _v = arg.pop('hoverlabel', None) self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('ids', None) self['ids'] = ids if ids is not None else _v _v = arg.pop('idssrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_bar.py plotly-3.6.1+dfsg1/plotly/graph_objs/_bar.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_bar.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_bar.py 2019-02-08 23:01:03.000000000 +0000 @@ -1259,6 +1259,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1794,7 +1797,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2089,7 +2094,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2197,8 +2204,8 @@ self._validators['hoverinfosrc'] = v_bar.HoverinfosrcValidator() self._validators['hoverlabel'] = v_bar.HoverlabelValidator() self._validators['hovertemplate'] = v_bar.HovertemplateValidator() - self._validators['hovertemplatesrc' - ] = v_bar.HovertemplatesrcValidator() + self._validators['hovertemplatesrc'] = v_bar.HovertemplatesrcValidator( + ) self._validators['hovertext'] = v_bar.HovertextValidator() self._validators['hovertextsrc'] = v_bar.HovertextsrcValidator() self._validators['ids'] = v_bar.IdsValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_box.py plotly-3.6.1+dfsg1/plotly/graph_objs/_box.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_box.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_box.py 2019-02-08 23:01:00.000000000 +0000 @@ -726,6 +726,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -844,6 +847,28 @@ def whiskerwidth(self, val): self['whiskerwidth'] = val + # width + # ----- + @property + def width(self): + """ + Sets the width of the box in data coordinate If 0 (default + value) the width is automatically selected based on the + positions of other box traces in the same subplot. + + The 'width' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['width'] + + @width.setter + def width(self, val): + self['width'] = val + # x # - @property @@ -1186,7 +1211,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1217,6 +1244,11 @@ Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es). + width + Sets the width of the box in data coordinate If 0 + (default value) the width is automatically selected + based on the positions of other box traces in the same + subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -1284,6 +1316,7 @@ unselected=None, visible=None, whiskerwidth=None, + width=None, x=None, x0=None, xaxis=None, @@ -1422,7 +1455,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1453,6 +1488,11 @@ Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es). + width + Sets the width of the box in data coordinate If 0 + (default value) the width is automatically selected + based on the positions of other box traces in the same + subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -1548,6 +1588,7 @@ self._validators['unselected'] = v_box.UnselectedValidator() self._validators['visible'] = v_box.VisibleValidator() self._validators['whiskerwidth'] = v_box.WhiskerwidthValidator() + self._validators['width'] = v_box.WidthValidator() self._validators['x'] = v_box.XValidator() self._validators['x0'] = v_box.X0Validator() self._validators['xaxis'] = v_box.XAxisValidator() @@ -1627,6 +1668,8 @@ self['visible'] = visible if visible is not None else _v _v = arg.pop('whiskerwidth', None) self['whiskerwidth'] = whiskerwidth if whiskerwidth is not None else _v + _v = arg.pop('width', None) + self['width'] = width if width is not None else _v _v = arg.pop('x', None) self['x'] = x if x is not None else _v _v = arg.pop('x0', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_candlestick.py plotly-3.6.1+dfsg1/plotly/graph_objs/_candlestick.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_candlestick.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_candlestick.py 2019-02-08 23:00:59.000000000 +0000 @@ -635,6 +635,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -936,7 +939,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1118,7 +1123,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1205,8 +1212,8 @@ self._validators['high'] = v_candlestick.HighValidator() self._validators['highsrc'] = v_candlestick.HighsrcValidator() self._validators['hoverinfo'] = v_candlestick.HoverinfoValidator() - self._validators['hoverinfosrc' - ] = v_candlestick.HoverinfosrcValidator() + self._validators['hoverinfosrc'] = v_candlestick.HoverinfosrcValidator( + ) self._validators['hoverlabel'] = v_candlestick.HoverlabelValidator() self._validators['ids'] = v_candlestick.IdsValidator() self._validators['idssrc'] = v_candlestick.IdssrcValidator() @@ -1228,8 +1235,8 @@ self._validators['uid'] = v_candlestick.UidValidator() self._validators['uirevision'] = v_candlestick.UirevisionValidator() self._validators['visible'] = v_candlestick.VisibleValidator() - self._validators['whiskerwidth' - ] = v_candlestick.WhiskerwidthValidator() + self._validators['whiskerwidth'] = v_candlestick.WhiskerwidthValidator( + ) self._validators['x'] = v_candlestick.XValidator() self._validators['xaxis'] = v_candlestick.XAxisValidator() self._validators['xcalendar'] = v_candlestick.XcalendarValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/carpet/_aaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/carpet/_aaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/carpet/_aaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/carpet/_aaxis.py 2019-02-08 23:00:58.000000000 +0000 @@ -2090,8 +2090,8 @@ self._validators['tickangle'] = v_aaxis.TickangleValidator() self._validators['tickfont'] = v_aaxis.TickfontValidator() self._validators['tickformat'] = v_aaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_aaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_aaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_aaxis.TickformatstopValidator() self._validators['tickmode'] = v_aaxis.TickmodeValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/carpet/_baxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/carpet/_baxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/carpet/_baxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/carpet/_baxis.py 2019-02-08 23:00:57.000000000 +0000 @@ -2090,8 +2090,8 @@ self._validators['tickangle'] = v_baxis.TickangleValidator() self._validators['tickfont'] = v_baxis.TickfontValidator() self._validators['tickformat'] = v_baxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_baxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_baxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_baxis.TickformatstopValidator() self._validators['tickmode'] = v_baxis.TickmodeValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_carpet.py plotly-3.6.1+dfsg1/plotly/graph_objs/_carpet.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_carpet.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_carpet.py 2019-02-08 23:00:56.000000000 +0000 @@ -1120,6 +1120,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1428,7 +1431,9 @@ plotly.graph_objs.carpet.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1620,7 +1625,9 @@ plotly.graph_objs.carpet.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_choropleth.py plotly-3.6.1+dfsg1/plotly/graph_objs/_choropleth.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_choropleth.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_choropleth.py 2019-02-08 23:00:55.000000000 +0000 @@ -463,6 +463,60 @@ def hoverlabel(self, val): self['hoverlabel'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # ids # --- @property @@ -860,6 +914,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1124,6 +1181,26 @@ hoverlabel plotly.graph_objs.choropleth.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -1178,7 +1255,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1236,6 +1315,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, ids=None, idssrc=None, legendgroup=None, @@ -1321,6 +1402,26 @@ hoverlabel plotly.graph_objs.choropleth.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -1375,7 +1476,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1463,6 +1566,10 @@ self._validators['hoverinfo'] = v_choropleth.HoverinfoValidator() self._validators['hoverinfosrc'] = v_choropleth.HoverinfosrcValidator() self._validators['hoverlabel'] = v_choropleth.HoverlabelValidator() + self._validators['hovertemplate' + ] = v_choropleth.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_choropleth.HovertemplatesrcValidator() self._validators['ids'] = v_choropleth.IdsValidator() self._validators['idssrc'] = v_choropleth.IdssrcValidator() self._validators['legendgroup'] = v_choropleth.LegendgroupValidator() @@ -1513,6 +1620,12 @@ self['hoverinfosrc'] = hoverinfosrc if hoverinfosrc is not None else _v _v = arg.pop('hoverlabel', None) self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('ids', None) self['ids'] = ids if ids is not None else _v _v = arg.pop('idssrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_cone.py plotly-3.6.1+dfsg1/plotly/graph_objs/_cone.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_cone.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_cone.py 2019-02-08 23:00:53.000000000 +0000 @@ -981,6 +981,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1421,7 +1424,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1664,7 +1669,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_contourcarpet.py plotly-3.6.1+dfsg1/plotly/graph_objs/_contourcarpet.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_contourcarpet.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_contourcarpet.py 2019-02-08 23:00:49.000000000 +0000 @@ -1195,6 +1195,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1575,7 +1578,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1830,7 +1835,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1920,8 +1927,8 @@ self._validators['atype'] = v_contourcarpet.AtypeValidator() self._validators['autocolorscale' ] = v_contourcarpet.AutocolorscaleValidator() - self._validators['autocontour' - ] = v_contourcarpet.AutocontourValidator() + self._validators['autocontour'] = v_contourcarpet.AutocontourValidator( + ) self._validators['b'] = v_contourcarpet.BValidator() self._validators['b0'] = v_contourcarpet.B0Validator() self._validators['bsrc'] = v_contourcarpet.BsrcValidator() @@ -1942,8 +1949,8 @@ self._validators['hoverlabel'] = v_contourcarpet.HoverlabelValidator() self._validators['ids'] = v_contourcarpet.IdsValidator() self._validators['idssrc'] = v_contourcarpet.IdssrcValidator() - self._validators['legendgroup' - ] = v_contourcarpet.LegendgroupValidator() + self._validators['legendgroup'] = v_contourcarpet.LegendgroupValidator( + ) self._validators['line'] = v_contourcarpet.LineValidator() self._validators['name'] = v_contourcarpet.NameValidator() self._validators['ncontours'] = v_contourcarpet.NcontoursValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_contour.py plotly-3.6.1+dfsg1/plotly/graph_objs/_contour.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_contour.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_contour.py 2019-02-08 23:00:51.000000000 +0000 @@ -1025,6 +1025,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1618,7 +1621,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1889,7 +1894,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2010,8 +2017,8 @@ # Initialize validators # --------------------- - self._validators['autocolorscale' - ] = v_contour.AutocolorscaleValidator() + self._validators['autocolorscale'] = v_contour.AutocolorscaleValidator( + ) self._validators['autocontour'] = v_contour.AutocontourValidator() self._validators['colorbar'] = v_contour.ColorBarValidator() self._validators['colorscale'] = v_contour.ColorscaleValidator() @@ -2033,8 +2040,8 @@ self._validators['ncontours'] = v_contour.NcontoursValidator() self._validators['opacity'] = v_contour.OpacityValidator() self._validators['reversescale'] = v_contour.ReversescaleValidator() - self._validators['selectedpoints' - ] = v_contour.SelectedpointsValidator() + self._validators['selectedpoints'] = v_contour.SelectedpointsValidator( + ) self._validators['showlegend'] = v_contour.ShowlegendValidator() self._validators['showscale'] = v_contour.ShowscaleValidator() self._validators['stream'] = v_contour.StreamValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_figure.py plotly-3.6.1+dfsg1/plotly/graph_objs/_figure.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_figure.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_figure.py 2019-02-08 23:01:13.000000000 +0000 @@ -2,10 +2,10 @@ from plotly.graph_objs import ( Area, Bar, Barpolar, Box, Candlestick, Carpet, Choropleth, Cone, Contour, Contourcarpet, Heatmap, Heatmapgl, Histogram, Histogram2d, - Histogram2dContour, Mesh3d, Ohlc, Parcats, Parcoords, Pie, Pointcloud, - Sankey, Scatter, Scatter3d, Scattercarpet, Scattergeo, Scattergl, - Scattermapbox, Scatterpolar, Scatterpolargl, Scatterternary, Splom, - Streamtube, Surface, Table, Violin + Histogram2dContour, Isosurface, Mesh3d, Ohlc, Parcats, Parcoords, Pie, + Pointcloud, Sankey, Scatter, Scatter3d, Scattercarpet, Scattergeo, + Scattergl, Scattermapbox, Scatterpolar, Scatterpolargl, Scatterternary, + Splom, Streamtube, Surface, Table, Violin ) @@ -30,11 +30,11 @@ 'candlestick', 'carpet', 'choropleth', 'cone', 'contour', 'contourcarpet', 'heatmap', 'heatmapgl', 'histogram', 'histogram2d', - 'histogram2dcontour', 'mesh3d', 'ohlc', - 'parcats', 'parcoords', 'pie', 'pointcloud', - 'sankey', 'scatter', 'scatter3d', - 'scattercarpet', 'scattergeo', 'scattergl', - 'scattermapbox', 'scatterpolar', + 'histogram2dcontour', 'isosurface', 'mesh3d', + 'ohlc', 'parcats', 'parcoords', 'pie', + 'pointcloud', 'sankey', 'scatter', + 'scatter3d', 'scattercarpet', 'scattergeo', + 'scattergl', 'scattermapbox', 'scatterpolar', 'scatterpolargl', 'scatterternary', 'splom', 'streamtube', 'surface', 'table', 'violin'] @@ -96,10 +96,12 @@ multiplied by 100 to show percentages. boxgap Sets the gap (in plot fraction) between boxes - of adjacent location coordinates. + of adjacent location coordinates. Has no effect + on traces that have "width" set. boxgroupgap Sets the gap (in plot fraction) between boxes - of the same location coordinate. + of the same location coordinate. Has no effect + on traces that have "width" set. boxmode Determines how boxes at the same location coordinate are displayed on the graph. If @@ -107,7 +109,8 @@ another centered around the shared location. If "overlay", the boxes are plotted over one another, you might need to set "opacity" to see - them multiple boxes. + them multiple boxes. Has no effect on traces + that have "width" set. calendar Sets the default calendar system to use for interpreting and displaying dates throughout @@ -235,6 +238,17 @@ margin plotly.graph_objs.layout.Margin instance or dict with compatible properties + meta + Assigns extra meta information that can be used + in various `text` attributes. Attributes such + as the graph, axis and colorbar `title.text` + and annotation `text` support `meta`. One can + access `meta` fields using template strings: + `%{meta[i]}` where `i` is the index of the + `meta` item in question. + metasrc + Sets the source reference on plot.ly for meta + . modebar plotly.graph_objs.layout.Modebar instance or dict with compatible properties @@ -348,6 +362,9 @@ instead. Sets the title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. + transition + Sets transition options used during + Plotly.react updates. uirevision Used to allow user interactions with the plot to persist after `Plotly.react` calls that are @@ -381,10 +398,12 @@ elements of layout.updatemenus violingap Sets the gap (in plot fraction) between violins - of adjacent location coordinates. + of adjacent location coordinates. Has no effect + on traces that have "width" set. violingroupgap Sets the gap (in plot fraction) between violins - of the same location coordinate. + of the same location coordinate. Has no effect + on traces that have "width" set. violinmode Determines how violins at the same location coordinate are displayed on the graph. If @@ -392,7 +411,8 @@ another centered around the shared location. If "overlay", the violins are plotted over one another, you might need to set "opacity" to see - them multiple violins. + them multiple violins. Has no effect on traces + that have "width" set. width Sets the plot's width (in px). xaxis @@ -541,7 +561,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -834,7 +856,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -981,6 +1005,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, ids=None, idssrc=None, legendgroup=None, @@ -1050,6 +1076,26 @@ hoverlabel plotly.graph_objs.barpolar.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -1121,7 +1167,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1175,6 +1223,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, ids=ids, idssrc=idssrc, legendgroup=legendgroup, @@ -1241,6 +1291,7 @@ unselected=None, visible=None, whiskerwidth=None, + width=None, x=None, x0=None, xaxis=None, @@ -1378,7 +1429,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1409,6 +1462,11 @@ Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es). + width + Sets the width of the box in data coordinate If 0 + (default value) the width is automatically selected + based on the positions of other box traces in the same + subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -1485,6 +1543,7 @@ unselected=unselected, visible=visible, whiskerwidth=whiskerwidth, + width=width, x=x, x0=x0, xaxis=xaxis, @@ -1632,7 +1691,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1873,7 +1934,9 @@ plotly.graph_objs.carpet.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1983,6 +2046,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, ids=None, idssrc=None, legendgroup=None, @@ -2067,6 +2132,26 @@ hoverlabel plotly.graph_objs.choropleth.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -2121,7 +2206,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2188,6 +2275,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, ids=ids, idssrc=idssrc, legendgroup=legendgroup, @@ -2408,7 +2497,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2698,7 +2789,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3054,7 +3147,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3335,7 +3430,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3634,7 +3731,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3976,7 +4075,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -4284,7 +4385,9 @@ plotly.graph_objs.histogram2d.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -4639,7 +4742,9 @@ plotly.graph_objs.histogram2dcontour.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -4779,6 +4884,304 @@ ) return self.add_trace(new_trace, row=row, col=col) + def add_isosurface( + self, + autocolorscale=None, + caps=None, + cauto=None, + cmax=None, + cmin=None, + colorbar=None, + colorscale=None, + contour=None, + customdata=None, + customdatasrc=None, + flatshading=None, + hoverinfo=None, + hoverinfosrc=None, + hoverlabel=None, + ids=None, + idssrc=None, + isomax=None, + isomin=None, + legendgroup=None, + lighting=None, + lightposition=None, + name=None, + opacity=None, + reversescale=None, + scene=None, + selectedpoints=None, + showlegend=None, + showscale=None, + slices=None, + spaceframe=None, + stream=None, + surface=None, + text=None, + textsrc=None, + uid=None, + uirevision=None, + value=None, + valuesrc=None, + visible=None, + x=None, + xsrc=None, + y=None, + ysrc=None, + z=None, + zsrc=None, + row=None, + col=None, + **kwargs + ): + """ + Add a new Isosurface trace + + Draws isosurfaces between iso-min and iso-max values with + coordinates given by four 1-dimensional arrays containing the + `value`, `x`, `y` and `z` of every vertex of a uniform or non- + uniform 3-D grid. Horizontal or vertical slices, caps as well + as spaceframe between iso-min and iso-max values could also be + drawn using this trace. + + Parameters + ---------- + autocolorscale + Determines whether the colorscale is a default palette + (`autocolorscale: true`) or the palette determined by + `colorscale`. 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. + caps + plotly.graph_objs.isosurface.Caps instance or dict with + compatible properties + cauto + Determines whether or not the color domain is computed + with respect to the input data (here `value`) or the + bounds set in `cmin` and `cmax` Defaults to `false` + when `cmin` and `cmax` are set by the user. + cmax + Sets the upper bound of the color domain. Value should + have the same units as `value` and if set, `cmin` must + be set as well. + cmin + Sets the lower bound of the color domain. Value should + have the same units as `value` and if set, `cmax` must + be set as well. + colorbar + plotly.graph_objs.isosurface.ColorBar instance or dict + with compatible properties + colorscale + Sets the colorscale. 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`cmin` and `cmax`. + Alternatively, `colorscale` may be a palette name + string of the following list: Greys,YlGnBu,Greens,YlOrR + d,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,H + ot,Blackbody,Earth,Electric,Viridis,Cividis. + contour + plotly.graph_objs.isosurface.Contour instance or dict + with compatible properties + customdata + 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 + customdatasrc + Sets the source reference on plot.ly for customdata . + flatshading + Determines whether or not normal smoothing is applied + to the isosurfaces, creating isosurfaces with an + angular, low-poly look via flat reflections. + hoverinfo + 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. + hoverinfosrc + Sets the source reference on plot.ly for hoverinfo . + hoverlabel + plotly.graph_objs.isosurface.Hoverlabel instance or + dict with compatible properties + ids + 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. + idssrc + Sets the source reference on plot.ly for ids . + isomax + Sets the maximum boundary for iso-surface plot. + isomin + Sets the minimum boundary for iso-surface plot. + legendgroup + Sets the legend group for this trace. Traces part of + the same legend group hide/show at the same time when + toggling legend items. + lighting + plotly.graph_objs.isosurface.Lighting instance or dict + with compatible properties + lightposition + plotly.graph_objs.isosurface.Lightposition instance or + dict with compatible properties + name + Sets the trace name. The trace name appear as the + legend item and on hover. + opacity + Sets the opacity of the trace. + reversescale + Reverses the color mapping if true. If true, `cmin` + will correspond to the last color in the array and + `cmax` will correspond to the first color. + scene + Sets a reference between this trace's 3D coordinate + system and a 3D scene. If "scene" (the default value), + the (x,y,z) coordinates refer to `layout.scene`. If + "scene2", the (x,y,z) coordinates refer to + `layout.scene2`, and so on. + selectedpoints + 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. + showlegend + Determines whether or not an item corresponding to this + trace is shown in the legend. + showscale + Determines whether or not a colorbar is displayed for + this trace. + slices + plotly.graph_objs.isosurface.Slices instance or dict + with compatible properties + spaceframe + plotly.graph_objs.isosurface.Spaceframe instance or + dict with compatible properties + stream + plotly.graph_objs.isosurface.Stream instance or dict + with compatible properties + surface + plotly.graph_objs.isosurface.Surface instance or dict + with compatible properties + text + Sets the text elements associated with the vertices. If + trace `hoverinfo` contains a "text" flag and + "hovertext" is not set, these elements will be seen in + the hover labels. + textsrc + Sets the source reference on plot.ly for text . + uid + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. + uirevision + 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. + value + Sets the 4th dimension (value) of the vertices. + valuesrc + Sets the source reference on plot.ly for value . + visible + 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). + x + Sets the X coordinates of the vertices on X axis. + xsrc + Sets the source reference on plot.ly for x . + y + Sets the Y coordinates of the vertices on Y axis. + ysrc + Sets the source reference on plot.ly for y . + z + Sets the Z coordinates of the vertices on Z axis. + zsrc + Sets the source reference on plot.ly for z . + row : int or None (default) + Subplot row index (starting from 1) for the trace to be + added. Only valid if figure was created using + `plotly.tools.make_subplots` + col : int or None (default) + Subplot col index (starting from 1) for the trace to be + added. Only valid if figure was created using + `plotly.tools.make_subplots` + + Returns + ------- + Isosurface + """ + new_trace = Isosurface( + autocolorscale=autocolorscale, + caps=caps, + cauto=cauto, + cmax=cmax, + cmin=cmin, + colorbar=colorbar, + colorscale=colorscale, + contour=contour, + customdata=customdata, + customdatasrc=customdatasrc, + flatshading=flatshading, + hoverinfo=hoverinfo, + hoverinfosrc=hoverinfosrc, + hoverlabel=hoverlabel, + ids=ids, + idssrc=idssrc, + isomax=isomax, + isomin=isomin, + legendgroup=legendgroup, + lighting=lighting, + lightposition=lightposition, + name=name, + opacity=opacity, + reversescale=reversescale, + scene=scene, + selectedpoints=selectedpoints, + showlegend=showlegend, + showscale=showscale, + slices=slices, + spaceframe=spaceframe, + stream=stream, + surface=surface, + text=text, + textsrc=textsrc, + uid=uid, + uirevision=uirevision, + value=value, + valuesrc=valuesrc, + visible=visible, + x=x, + xsrc=xsrc, + y=y, + ysrc=ysrc, + z=z, + zsrc=zsrc, + **kwargs + ) + return self.add_trace(new_trace, row=row, col=col) + def add_mesh3d( self, alphahull=None, @@ -5034,7 +5437,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5295,7 +5700,9 @@ Sets the width of the open/close tick marks relative to the "x" minimal interval. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5479,7 +5886,9 @@ tickfont Sets the font for the `category` labels. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5639,7 +6048,9 @@ tickfont Sets the font for the `dimension` tick values. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5917,7 +6328,9 @@ title's position used to be set by the now deprecated `titleposition` attribute. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -6127,7 +6540,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -6345,7 +6760,9 @@ textfont Sets the font for node labels uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -6709,7 +7126,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7016,7 +7435,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7291,7 +7712,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7394,6 +7817,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -7473,6 +7898,26 @@ hoverlabel plotly.graph_objs.scattergeo.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair or item in `locations`. If a single string, the @@ -7563,7 +8008,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7613,6 +8060,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -7854,7 +8303,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7986,6 +8437,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8055,6 +8508,26 @@ hoverlabel plotly.graph_objs.scattermapbox.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair If a single string, the same string appears over @@ -8136,7 +8609,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -8185,6 +8660,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -8230,6 +8707,8 @@ hoverinfosrc=None, hoverlabel=None, hoveron=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8331,6 +8810,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -8427,7 +8926,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -8480,6 +8981,8 @@ hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, hoveron=hoveron, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -8527,6 +9030,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8627,6 +9132,26 @@ hoverlabel plotly.graph_objs.scatterpolargl.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -8723,7 +9248,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -8774,6 +9301,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -8827,6 +9356,8 @@ hoverinfosrc=None, hoverlabel=None, hoveron=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8936,6 +9467,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (a,b,c) point. If a single string, the same string appears over @@ -9020,7 +9571,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9077,6 +9630,8 @@ hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, hoveron=hoveron, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -9230,7 +9785,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9498,7 +10055,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9789,7 +10348,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9999,7 +10560,9 @@ plotly.graph_objs.table.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -10102,6 +10665,7 @@ uirevision=None, unselected=None, visible=None, + width=None, x=None, x0=None, xaxis=None, @@ -10264,7 +10828,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -10291,6 +10857,11 @@ "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible). + width + Sets the width of the violin in data coordinates. If 0 + (default value) the width is automatically selected + based on the positions of other violin traces in the + same subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -10367,6 +10938,7 @@ uirevision=uirevision, unselected=unselected, visible=visible, + width=width, x=x, x0=x0, xaxis=xaxis, diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_figurewidget.py plotly-3.6.1+dfsg1/plotly/graph_objs/_figurewidget.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_figurewidget.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_figurewidget.py 2019-02-08 23:01:10.000000000 +0000 @@ -2,10 +2,10 @@ from plotly.graph_objs import ( Area, Bar, Barpolar, Box, Candlestick, Carpet, Choropleth, Cone, Contour, Contourcarpet, Heatmap, Heatmapgl, Histogram, Histogram2d, - Histogram2dContour, Mesh3d, Ohlc, Parcats, Parcoords, Pie, Pointcloud, - Sankey, Scatter, Scatter3d, Scattercarpet, Scattergeo, Scattergl, - Scattermapbox, Scatterpolar, Scatterpolargl, Scatterternary, Splom, - Streamtube, Surface, Table, Violin + Histogram2dContour, Isosurface, Mesh3d, Ohlc, Parcats, Parcoords, Pie, + Pointcloud, Sankey, Scatter, Scatter3d, Scattercarpet, Scattergeo, + Scattergl, Scattermapbox, Scatterpolar, Scatterpolargl, Scatterternary, + Splom, Streamtube, Surface, Table, Violin ) @@ -30,11 +30,11 @@ 'candlestick', 'carpet', 'choropleth', 'cone', 'contour', 'contourcarpet', 'heatmap', 'heatmapgl', 'histogram', 'histogram2d', - 'histogram2dcontour', 'mesh3d', 'ohlc', - 'parcats', 'parcoords', 'pie', 'pointcloud', - 'sankey', 'scatter', 'scatter3d', - 'scattercarpet', 'scattergeo', 'scattergl', - 'scattermapbox', 'scatterpolar', + 'histogram2dcontour', 'isosurface', 'mesh3d', + 'ohlc', 'parcats', 'parcoords', 'pie', + 'pointcloud', 'sankey', 'scatter', + 'scatter3d', 'scattercarpet', 'scattergeo', + 'scattergl', 'scattermapbox', 'scatterpolar', 'scatterpolargl', 'scatterternary', 'splom', 'streamtube', 'surface', 'table', 'violin'] @@ -96,10 +96,12 @@ multiplied by 100 to show percentages. boxgap Sets the gap (in plot fraction) between boxes - of adjacent location coordinates. + of adjacent location coordinates. Has no effect + on traces that have "width" set. boxgroupgap Sets the gap (in plot fraction) between boxes - of the same location coordinate. + of the same location coordinate. Has no effect + on traces that have "width" set. boxmode Determines how boxes at the same location coordinate are displayed on the graph. If @@ -107,7 +109,8 @@ another centered around the shared location. If "overlay", the boxes are plotted over one another, you might need to set "opacity" to see - them multiple boxes. + them multiple boxes. Has no effect on traces + that have "width" set. calendar Sets the default calendar system to use for interpreting and displaying dates throughout @@ -235,6 +238,17 @@ margin plotly.graph_objs.layout.Margin instance or dict with compatible properties + meta + Assigns extra meta information that can be used + in various `text` attributes. Attributes such + as the graph, axis and colorbar `title.text` + and annotation `text` support `meta`. One can + access `meta` fields using template strings: + `%{meta[i]}` where `i` is the index of the + `meta` item in question. + metasrc + Sets the source reference on plot.ly for meta + . modebar plotly.graph_objs.layout.Modebar instance or dict with compatible properties @@ -348,6 +362,9 @@ instead. Sets the title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. + transition + Sets transition options used during + Plotly.react updates. uirevision Used to allow user interactions with the plot to persist after `Plotly.react` calls that are @@ -381,10 +398,12 @@ elements of layout.updatemenus violingap Sets the gap (in plot fraction) between violins - of adjacent location coordinates. + of adjacent location coordinates. Has no effect + on traces that have "width" set. violingroupgap Sets the gap (in plot fraction) between violins - of the same location coordinate. + of the same location coordinate. Has no effect + on traces that have "width" set. violinmode Determines how violins at the same location coordinate are displayed on the graph. If @@ -392,7 +411,8 @@ another centered around the shared location. If "overlay", the violins are plotted over one another, you might need to set "opacity" to see - them multiple violins. + them multiple violins. Has no effect on traces + that have "width" set. width Sets the plot's width (in px). xaxis @@ -541,7 +561,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -834,7 +856,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -981,6 +1005,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, ids=None, idssrc=None, legendgroup=None, @@ -1050,6 +1076,26 @@ hoverlabel plotly.graph_objs.barpolar.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -1121,7 +1167,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1175,6 +1223,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, ids=ids, idssrc=idssrc, legendgroup=legendgroup, @@ -1241,6 +1291,7 @@ unselected=None, visible=None, whiskerwidth=None, + width=None, x=None, x0=None, xaxis=None, @@ -1378,7 +1429,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1409,6 +1462,11 @@ Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es). + width + Sets the width of the box in data coordinate If 0 + (default value) the width is automatically selected + based on the positions of other box traces in the same + subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -1485,6 +1543,7 @@ unselected=unselected, visible=visible, whiskerwidth=whiskerwidth, + width=width, x=x, x0=x0, xaxis=xaxis, @@ -1632,7 +1691,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1873,7 +1934,9 @@ plotly.graph_objs.carpet.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1983,6 +2046,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, ids=None, idssrc=None, legendgroup=None, @@ -2067,6 +2132,26 @@ hoverlabel plotly.graph_objs.choropleth.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . ids Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an @@ -2121,7 +2206,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2188,6 +2275,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, ids=ids, idssrc=idssrc, legendgroup=legendgroup, @@ -2408,7 +2497,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2698,7 +2789,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3054,7 +3147,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3335,7 +3430,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3634,7 +3731,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -3976,7 +4075,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -4284,7 +4385,9 @@ plotly.graph_objs.histogram2d.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -4639,7 +4742,9 @@ plotly.graph_objs.histogram2dcontour.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -4779,6 +4884,304 @@ ) return self.add_trace(new_trace, row=row, col=col) + def add_isosurface( + self, + autocolorscale=None, + caps=None, + cauto=None, + cmax=None, + cmin=None, + colorbar=None, + colorscale=None, + contour=None, + customdata=None, + customdatasrc=None, + flatshading=None, + hoverinfo=None, + hoverinfosrc=None, + hoverlabel=None, + ids=None, + idssrc=None, + isomax=None, + isomin=None, + legendgroup=None, + lighting=None, + lightposition=None, + name=None, + opacity=None, + reversescale=None, + scene=None, + selectedpoints=None, + showlegend=None, + showscale=None, + slices=None, + spaceframe=None, + stream=None, + surface=None, + text=None, + textsrc=None, + uid=None, + uirevision=None, + value=None, + valuesrc=None, + visible=None, + x=None, + xsrc=None, + y=None, + ysrc=None, + z=None, + zsrc=None, + row=None, + col=None, + **kwargs + ): + """ + Add a new Isosurface trace + + Draws isosurfaces between iso-min and iso-max values with + coordinates given by four 1-dimensional arrays containing the + `value`, `x`, `y` and `z` of every vertex of a uniform or non- + uniform 3-D grid. Horizontal or vertical slices, caps as well + as spaceframe between iso-min and iso-max values could also be + drawn using this trace. + + Parameters + ---------- + autocolorscale + Determines whether the colorscale is a default palette + (`autocolorscale: true`) or the palette determined by + `colorscale`. 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. + caps + plotly.graph_objs.isosurface.Caps instance or dict with + compatible properties + cauto + Determines whether or not the color domain is computed + with respect to the input data (here `value`) or the + bounds set in `cmin` and `cmax` Defaults to `false` + when `cmin` and `cmax` are set by the user. + cmax + Sets the upper bound of the color domain. Value should + have the same units as `value` and if set, `cmin` must + be set as well. + cmin + Sets the lower bound of the color domain. Value should + have the same units as `value` and if set, `cmax` must + be set as well. + colorbar + plotly.graph_objs.isosurface.ColorBar instance or dict + with compatible properties + colorscale + Sets the colorscale. 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`cmin` and `cmax`. + Alternatively, `colorscale` may be a palette name + string of the following list: Greys,YlGnBu,Greens,YlOrR + d,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,H + ot,Blackbody,Earth,Electric,Viridis,Cividis. + contour + plotly.graph_objs.isosurface.Contour instance or dict + with compatible properties + customdata + 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 + customdatasrc + Sets the source reference on plot.ly for customdata . + flatshading + Determines whether or not normal smoothing is applied + to the isosurfaces, creating isosurfaces with an + angular, low-poly look via flat reflections. + hoverinfo + 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. + hoverinfosrc + Sets the source reference on plot.ly for hoverinfo . + hoverlabel + plotly.graph_objs.isosurface.Hoverlabel instance or + dict with compatible properties + ids + 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. + idssrc + Sets the source reference on plot.ly for ids . + isomax + Sets the maximum boundary for iso-surface plot. + isomin + Sets the minimum boundary for iso-surface plot. + legendgroup + Sets the legend group for this trace. Traces part of + the same legend group hide/show at the same time when + toggling legend items. + lighting + plotly.graph_objs.isosurface.Lighting instance or dict + with compatible properties + lightposition + plotly.graph_objs.isosurface.Lightposition instance or + dict with compatible properties + name + Sets the trace name. The trace name appear as the + legend item and on hover. + opacity + Sets the opacity of the trace. + reversescale + Reverses the color mapping if true. If true, `cmin` + will correspond to the last color in the array and + `cmax` will correspond to the first color. + scene + Sets a reference between this trace's 3D coordinate + system and a 3D scene. If "scene" (the default value), + the (x,y,z) coordinates refer to `layout.scene`. If + "scene2", the (x,y,z) coordinates refer to + `layout.scene2`, and so on. + selectedpoints + 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. + showlegend + Determines whether or not an item corresponding to this + trace is shown in the legend. + showscale + Determines whether or not a colorbar is displayed for + this trace. + slices + plotly.graph_objs.isosurface.Slices instance or dict + with compatible properties + spaceframe + plotly.graph_objs.isosurface.Spaceframe instance or + dict with compatible properties + stream + plotly.graph_objs.isosurface.Stream instance or dict + with compatible properties + surface + plotly.graph_objs.isosurface.Surface instance or dict + with compatible properties + text + Sets the text elements associated with the vertices. If + trace `hoverinfo` contains a "text" flag and + "hovertext" is not set, these elements will be seen in + the hover labels. + textsrc + Sets the source reference on plot.ly for text . + uid + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. + uirevision + 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. + value + Sets the 4th dimension (value) of the vertices. + valuesrc + Sets the source reference on plot.ly for value . + visible + 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). + x + Sets the X coordinates of the vertices on X axis. + xsrc + Sets the source reference on plot.ly for x . + y + Sets the Y coordinates of the vertices on Y axis. + ysrc + Sets the source reference on plot.ly for y . + z + Sets the Z coordinates of the vertices on Z axis. + zsrc + Sets the source reference on plot.ly for z . + row : int or None (default) + Subplot row index (starting from 1) for the trace to be + added. Only valid if figure was created using + `plotly.tools.make_subplots` + col : int or None (default) + Subplot col index (starting from 1) for the trace to be + added. Only valid if figure was created using + `plotly.tools.make_subplots` + + Returns + ------- + Isosurface + """ + new_trace = Isosurface( + autocolorscale=autocolorscale, + caps=caps, + cauto=cauto, + cmax=cmax, + cmin=cmin, + colorbar=colorbar, + colorscale=colorscale, + contour=contour, + customdata=customdata, + customdatasrc=customdatasrc, + flatshading=flatshading, + hoverinfo=hoverinfo, + hoverinfosrc=hoverinfosrc, + hoverlabel=hoverlabel, + ids=ids, + idssrc=idssrc, + isomax=isomax, + isomin=isomin, + legendgroup=legendgroup, + lighting=lighting, + lightposition=lightposition, + name=name, + opacity=opacity, + reversescale=reversescale, + scene=scene, + selectedpoints=selectedpoints, + showlegend=showlegend, + showscale=showscale, + slices=slices, + spaceframe=spaceframe, + stream=stream, + surface=surface, + text=text, + textsrc=textsrc, + uid=uid, + uirevision=uirevision, + value=value, + valuesrc=valuesrc, + visible=visible, + x=x, + xsrc=xsrc, + y=y, + ysrc=ysrc, + z=z, + zsrc=zsrc, + **kwargs + ) + return self.add_trace(new_trace, row=row, col=col) + def add_mesh3d( self, alphahull=None, @@ -5034,7 +5437,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5295,7 +5700,9 @@ Sets the width of the open/close tick marks relative to the "x" minimal interval. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5479,7 +5886,9 @@ tickfont Sets the font for the `category` labels. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5639,7 +6048,9 @@ tickfont Sets the font for the `dimension` tick values. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -5917,7 +6328,9 @@ title's position used to be set by the now deprecated `titleposition` attribute. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -6127,7 +6540,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -6345,7 +6760,9 @@ textfont Sets the font for node labels uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -6709,7 +7126,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7016,7 +7435,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7291,7 +7712,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7394,6 +7817,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -7473,6 +7898,26 @@ hoverlabel plotly.graph_objs.scattergeo.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair or item in `locations`. If a single string, the @@ -7563,7 +8008,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7613,6 +8060,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -7854,7 +8303,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -7986,6 +8437,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8055,6 +8508,26 @@ hoverlabel plotly.graph_objs.scattermapbox.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair If a single string, the same string appears over @@ -8136,7 +8609,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -8185,6 +8660,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -8230,6 +8707,8 @@ hoverinfosrc=None, hoverlabel=None, hoveron=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8331,6 +8810,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -8427,7 +8926,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -8480,6 +8981,8 @@ hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, hoveron=hoveron, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -8527,6 +9030,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8627,6 +9132,26 @@ hoverlabel plotly.graph_objs.scatterpolargl.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -8723,7 +9248,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -8774,6 +9301,8 @@ hoverinfo=hoverinfo, hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -8827,6 +9356,8 @@ hoverinfosrc=None, hoverlabel=None, hoveron=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -8936,6 +9467,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (a,b,c) point. If a single string, the same string appears over @@ -9020,7 +9571,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9077,6 +9630,8 @@ hoverinfosrc=hoverinfosrc, hoverlabel=hoverlabel, hoveron=hoveron, + hovertemplate=hovertemplate, + hovertemplatesrc=hovertemplatesrc, hovertext=hovertext, hovertextsrc=hovertextsrc, ids=ids, @@ -9230,7 +9785,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9498,7 +10055,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9789,7 +10348,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -9999,7 +10560,9 @@ plotly.graph_objs.table.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -10102,6 +10665,7 @@ uirevision=None, unselected=None, visible=None, + width=None, x=None, x0=None, xaxis=None, @@ -10264,7 +10828,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -10291,6 +10857,11 @@ "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible). + width + Sets the width of the violin in data coordinates. If 0 + (default value) the width is automatically selected + based on the positions of other violin traces in the + same subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -10367,6 +10938,7 @@ uirevision=uirevision, unselected=unselected, visible=visible, + width=width, x=x, x0=x0, xaxis=xaxis, diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_heatmapgl.py plotly-3.6.1+dfsg1/plotly/graph_objs/_heatmapgl.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_heatmapgl.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_heatmapgl.py 2019-02-08 23:00:46.000000000 +0000 @@ -771,6 +771,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1268,7 +1271,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1490,7 +1495,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1607,8 +1614,8 @@ self._validators['colorbar'] = v_heatmapgl.ColorBarValidator() self._validators['colorscale'] = v_heatmapgl.ColorscaleValidator() self._validators['customdata'] = v_heatmapgl.CustomdataValidator() - self._validators['customdatasrc' - ] = v_heatmapgl.CustomdatasrcValidator() + self._validators['customdatasrc'] = v_heatmapgl.CustomdatasrcValidator( + ) self._validators['dx'] = v_heatmapgl.DxValidator() self._validators['dy'] = v_heatmapgl.DyValidator() self._validators['hoverinfo'] = v_heatmapgl.HoverinfoValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_heatmap.py plotly-3.6.1+dfsg1/plotly/graph_objs/_heatmap.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_heatmap.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_heatmap.py 2019-02-08 23:00:47.000000000 +0000 @@ -791,6 +791,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1423,7 +1426,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1686,7 +1691,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1813,8 +1820,8 @@ # Initialize validators # --------------------- - self._validators['autocolorscale' - ] = v_heatmap.AutocolorscaleValidator() + self._validators['autocolorscale'] = v_heatmap.AutocolorscaleValidator( + ) self._validators['colorbar'] = v_heatmap.ColorBarValidator() self._validators['colorscale'] = v_heatmap.ColorscaleValidator() self._validators['connectgaps'] = v_heatmap.ConnectgapsValidator() @@ -1831,8 +1838,8 @@ self._validators['name'] = v_heatmap.NameValidator() self._validators['opacity'] = v_heatmap.OpacityValidator() self._validators['reversescale'] = v_heatmap.ReversescaleValidator() - self._validators['selectedpoints' - ] = v_heatmap.SelectedpointsValidator() + self._validators['selectedpoints'] = v_heatmap.SelectedpointsValidator( + ) self._validators['showlegend'] = v_heatmap.ShowlegendValidator() self._validators['showscale'] = v_heatmap.ShowscaleValidator() self._validators['stream'] = v_heatmap.StreamValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_histogram2dcontour.py plotly-3.6.1+dfsg1/plotly/graph_objs/_histogram2dcontour.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_histogram2dcontour.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_histogram2dcontour.py 2019-02-08 23:00:40.000000000 +0000 @@ -1027,6 +1027,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1680,7 +1683,9 @@ plotly.graph_objs.histogram2dcontour.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1968,7 +1973,9 @@ plotly.graph_objs.histogram2dcontour.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_histogram2d.py plotly-3.6.1+dfsg1/plotly/graph_objs/_histogram2d.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_histogram2d.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_histogram2d.py 2019-02-08 23:00:42.000000000 +0000 @@ -855,6 +855,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1552,7 +1555,9 @@ plotly.graph_objs.histogram2d.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1828,7 +1833,9 @@ plotly.graph_objs.histogram2d.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1953,8 +1960,8 @@ self._validators['histfunc'] = v_histogram2d.HistfuncValidator() self._validators['histnorm'] = v_histogram2d.HistnormValidator() self._validators['hoverinfo'] = v_histogram2d.HoverinfoValidator() - self._validators['hoverinfosrc' - ] = v_histogram2d.HoverinfosrcValidator() + self._validators['hoverinfosrc'] = v_histogram2d.HoverinfosrcValidator( + ) self._validators['hoverlabel'] = v_histogram2d.HoverlabelValidator() self._validators['ids'] = v_histogram2d.IdsValidator() self._validators['idssrc'] = v_histogram2d.IdssrcValidator() @@ -1964,8 +1971,8 @@ self._validators['nbinsx'] = v_histogram2d.NbinsxValidator() self._validators['nbinsy'] = v_histogram2d.NbinsyValidator() self._validators['opacity'] = v_histogram2d.OpacityValidator() - self._validators['reversescale' - ] = v_histogram2d.ReversescaleValidator() + self._validators['reversescale'] = v_histogram2d.ReversescaleValidator( + ) self._validators['selectedpoints' ] = v_histogram2d.SelectedpointsValidator() self._validators['showlegend'] = v_histogram2d.ShowlegendValidator() @@ -1988,8 +1995,8 @@ self._validators['ysrc'] = v_histogram2d.YsrcValidator() self._validators['z'] = v_histogram2d.ZValidator() self._validators['zauto'] = v_histogram2d.ZautoValidator() - self._validators['zhoverformat' - ] = v_histogram2d.ZhoverformatValidator() + self._validators['zhoverformat'] = v_histogram2d.ZhoverformatValidator( + ) self._validators['zmax'] = v_histogram2d.ZmaxValidator() self._validators['zmin'] = v_histogram2d.ZminValidator() self._validators['zsmooth'] = v_histogram2d.ZsmoothValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_histogram.py plotly-3.6.1+dfsg1/plotly/graph_objs/_histogram.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_histogram.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_histogram.py 2019-02-08 23:00:44.000000000 +0000 @@ -952,6 +952,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1527,7 +1530,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1790,7 +1795,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1882,8 +1889,8 @@ self._validators['autobiny'] = v_histogram.AutobinyValidator() self._validators['cumulative'] = v_histogram.CumulativeValidator() self._validators['customdata'] = v_histogram.CustomdataValidator() - self._validators['customdatasrc' - ] = v_histogram.CustomdatasrcValidator() + self._validators['customdatasrc'] = v_histogram.CustomdatasrcValidator( + ) self._validators['error_x'] = v_histogram.ErrorXValidator() self._validators['error_y'] = v_histogram.ErrorYValidator() self._validators['histfunc'] = v_histogram.HistfuncValidator() @@ -1891,8 +1898,8 @@ self._validators['hoverinfo'] = v_histogram.HoverinfoValidator() self._validators['hoverinfosrc'] = v_histogram.HoverinfosrcValidator() self._validators['hoverlabel'] = v_histogram.HoverlabelValidator() - self._validators['hovertemplate' - ] = v_histogram.HovertemplateValidator() + self._validators['hovertemplate'] = v_histogram.HovertemplateValidator( + ) self._validators['hovertemplatesrc' ] = v_histogram.HovertemplatesrcValidator() self._validators['ids'] = v_histogram.IdsValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/__init__.py 2018-12-25 12:00:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -40,6 +40,8 @@ from plotly.graph_objs import ohlc from ._mesh3d import Mesh3d from plotly.graph_objs import mesh3d +from ._isosurface import Isosurface +from plotly.graph_objs import isosurface from ._histogram2dcontour import Histogram2dContour from plotly.graph_objs import histogram2dcontour from ._histogram2d import Histogram2d @@ -77,10 +79,13 @@ try: import ipywidgets - from ._figurewidget import FigureWidget + from distutils.version import LooseVersion + if LooseVersion(ipywidgets.__version__) >= LooseVersion('7.0.0'): + from ._figurewidget import FigureWidget + del LooseVersion + del ipywidgets except ImportError: pass - from ._deprecations import ( Data, Annotations, Frames, AngularAxis, Annotation, ColorBar, Contours, ErrorX, ErrorY, ErrorZ, Font, Legend, Line, Margin, Marker, RadialAxis, diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -0,0 +1,3 @@ +from ._z import Z +from ._y import Y +from ._x import X diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/_x.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/_x.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/_x.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,148 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class X(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `caps`. The default fill value of + the `caps` is 1 meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than one would allow + the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # show + # ---- + @property + def show(self): + """ + Sets the fill ratio of the `slices`. The default fill value of + the x `slices` is 1 meaning that they are entirely shaded. On + the other hand Applying a `fill` ratio less than one would + allow the creation of openings parallel to the edges. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.caps' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `caps`. The default fill + value of the `caps` is 1 meaning that they are entirely + shaded. On the other hand Applying a `fill` ratio less + than one would allow the creation of openings parallel + to the edges. + show + Sets the fill ratio of the `slices`. The default fill + value of the x `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + """ + + def __init__(self, arg=None, fill=None, show=None, **kwargs): + """ + Construct a new X object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.caps.X + fill + Sets the fill ratio of the `caps`. The default fill + value of the `caps` is 1 meaning that they are entirely + shaded. On the other hand Applying a `fill` ratio less + than one would allow the creation of openings parallel + to the edges. + show + Sets the fill ratio of the `slices`. The default fill + value of the x `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + + Returns + ------- + X + """ + super(X, self).__init__('x') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.caps.X +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.caps.X""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.caps import (x as v_x) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_x.FillValidator() + self._validators['show'] = v_x.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/_y.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/_y.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/_y.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,148 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Y(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `caps`. The default fill value of + the `caps` is 1 meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than one would allow + the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # show + # ---- + @property + def show(self): + """ + Sets the fill ratio of the `slices`. The default fill value of + the y `slices` is 1 meaning that they are entirely shaded. On + the other hand Applying a `fill` ratio less than one would + allow the creation of openings parallel to the edges. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.caps' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `caps`. The default fill + value of the `caps` is 1 meaning that they are entirely + shaded. On the other hand Applying a `fill` ratio less + than one would allow the creation of openings parallel + to the edges. + show + Sets the fill ratio of the `slices`. The default fill + value of the y `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + """ + + def __init__(self, arg=None, fill=None, show=None, **kwargs): + """ + Construct a new Y object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.caps.Y + fill + Sets the fill ratio of the `caps`. The default fill + value of the `caps` is 1 meaning that they are entirely + shaded. On the other hand Applying a `fill` ratio less + than one would allow the creation of openings parallel + to the edges. + show + Sets the fill ratio of the `slices`. The default fill + value of the y `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + + Returns + ------- + Y + """ + super(Y, self).__init__('y') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.caps.Y +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.caps.Y""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.caps import (y as v_y) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_y.FillValidator() + self._validators['show'] = v_y.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/_z.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/_z.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/caps/_z.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/caps/_z.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,148 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Z(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `caps`. The default fill value of + the `caps` is 1 meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than one would allow + the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # show + # ---- + @property + def show(self): + """ + Sets the fill ratio of the `slices`. The default fill value of + the z `slices` is 1 meaning that they are entirely shaded. On + the other hand Applying a `fill` ratio less than one would + allow the creation of openings parallel to the edges. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.caps' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `caps`. The default fill + value of the `caps` is 1 meaning that they are entirely + shaded. On the other hand Applying a `fill` ratio less + than one would allow the creation of openings parallel + to the edges. + show + Sets the fill ratio of the `slices`. The default fill + value of the z `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + """ + + def __init__(self, arg=None, fill=None, show=None, **kwargs): + """ + Construct a new Z object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.caps.Z + fill + Sets the fill ratio of the `caps`. The default fill + value of the `caps` is 1 meaning that they are entirely + shaded. On the other hand Applying a `fill` ratio less + than one would allow the creation of openings parallel + to the edges. + show + Sets the fill ratio of the `slices`. The default fill + value of the z `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + + Returns + ------- + Z + """ + super(Z, self).__init__('z') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.caps.Z +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.caps.Z""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.caps import (z as v_z) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_z.FillValidator() + self._validators['show'] = v_z.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_caps.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_caps.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_caps.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_caps.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,210 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Caps(BaseTraceHierarchyType): + + # x + # - + @property + def x(self): + """ + The 'x' property is an instance of X + that may be specified as: + - An instance of plotly.graph_objs.isosurface.caps.X + - A dict of string/value properties that will be passed + to the X constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `caps`. The default + fill value of the `caps` is 1 meaning that they + are entirely shaded. On the other hand Applying + a `fill` ratio less than one would allow the + creation of openings parallel to the edges. + show + Sets the fill ratio of the `slices`. The + default fill value of the x `slices` is 1 + meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than + one would allow the creation of openings + parallel to the edges. + + Returns + ------- + plotly.graph_objs.isosurface.caps.X + """ + return self['x'] + + @x.setter + def x(self, val): + self['x'] = val + + # y + # - + @property + def y(self): + """ + The 'y' property is an instance of Y + that may be specified as: + - An instance of plotly.graph_objs.isosurface.caps.Y + - A dict of string/value properties that will be passed + to the Y constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `caps`. The default + fill value of the `caps` is 1 meaning that they + are entirely shaded. On the other hand Applying + a `fill` ratio less than one would allow the + creation of openings parallel to the edges. + show + Sets the fill ratio of the `slices`. The + default fill value of the y `slices` is 1 + meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than + one would allow the creation of openings + parallel to the edges. + + Returns + ------- + plotly.graph_objs.isosurface.caps.Y + """ + return self['y'] + + @y.setter + def y(self, val): + self['y'] = val + + # z + # - + @property + def z(self): + """ + The 'z' property is an instance of Z + that may be specified as: + - An instance of plotly.graph_objs.isosurface.caps.Z + - A dict of string/value properties that will be passed + to the Z constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `caps`. The default + fill value of the `caps` is 1 meaning that they + are entirely shaded. On the other hand Applying + a `fill` ratio less than one would allow the + creation of openings parallel to the edges. + show + Sets the fill ratio of the `slices`. The + default fill value of the z `slices` is 1 + meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than + one would allow the creation of openings + parallel to the edges. + + Returns + ------- + plotly.graph_objs.isosurface.caps.Z + """ + return self['z'] + + @z.setter + def z(self, val): + self['z'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + x + plotly.graph_objs.isosurface.caps.X instance or dict + with compatible properties + y + plotly.graph_objs.isosurface.caps.Y instance or dict + with compatible properties + z + plotly.graph_objs.isosurface.caps.Z instance or dict + with compatible properties + """ + + def __init__(self, arg=None, x=None, y=None, z=None, **kwargs): + """ + Construct a new Caps object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Caps + x + plotly.graph_objs.isosurface.caps.X instance or dict + with compatible properties + y + plotly.graph_objs.isosurface.caps.Y instance or dict + with compatible properties + z + plotly.graph_objs.isosurface.caps.Z instance or dict + with compatible properties + + Returns + ------- + Caps + """ + super(Caps, self).__init__('caps') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Caps +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Caps""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (caps as v_caps) + + # Initialize validators + # --------------------- + self._validators['x'] = v_caps.XValidator() + self._validators['y'] = v_caps.YValidator() + self._validators['z'] = v_caps.ZValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('x', None) + self['x'] = x if x is not None else _v + _v = arg.pop('y', None) + self['y'] = y if y is not None else _v + _v = arg.pop('z', None) + self['z'] = z if z is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -0,0 +1,4 @@ +from ._title import Title +from plotly.graph_objs.isosurface.colorbar import title +from ._tickformatstop import Tickformatstop +from ._tickfont import Tickfont diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickfont.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickfont.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickfont.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickfont.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,228 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Tickfont(BaseTraceHierarchyType): + + # color + # ----- + @property + def color(self): + """ + The 'color' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['color'] + + @color.setter + def color(self, val): + self['color'] = val + + # family + # ------ + @property + def family(self): + """ + 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 plotly service (at https://plot.ly 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". + + The 'family' property is a string and must be specified as: + - A non-empty string + + Returns + ------- + str + """ + return self['family'] + + @family.setter + def family(self, val): + self['family'] = val + + # size + # ---- + @property + def size(self): + """ + The 'size' property is a number and may be specified as: + - An int or float in the interval [1, inf] + + Returns + ------- + int|float + """ + return self['size'] + + @size.setter + def size(self, val): + self['size'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.colorbar' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + color + + family + 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 + plotly service (at https://plot.ly 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". + size + + """ + + def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): + """ + Construct a new Tickfont object + + Sets the color bar's tick label font + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of + plotly.graph_objs.isosurface.colorbar.Tickfont + color + + family + 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 + plotly service (at https://plot.ly 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". + size + + + Returns + ------- + Tickfont + """ + super(Tickfont, self).__init__('tickfont') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.colorbar.Tickfont +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.colorbar.Tickfont""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.colorbar import ( + tickfont as v_tickfont + ) + + # Initialize validators + # --------------------- + self._validators['color'] = v_tickfont.ColorValidator() + self._validators['family'] = v_tickfont.FamilyValidator() + self._validators['size'] = v_tickfont.SizeValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('color', None) + self['color'] = color if color is not None else _v + _v = arg.pop('family', None) + self['family'] = family if family is not None else _v + _v = arg.pop('size', None) + self['size'] = size if size is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickformatstop.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickformatstop.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickformatstop.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/_tickformatstop.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,284 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Tickformatstop(BaseTraceHierarchyType): + + # dtickrange + # ---------- + @property + def dtickrange(self): + """ + 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" + + The 'dtickrange' property is an info array that may be specified as: + + * a list or tuple of 2 elements where: + (0) The 'dtickrange[0]' property accepts values of any type + (1) The 'dtickrange[1]' property accepts values of any type + + Returns + ------- + list + """ + return self['dtickrange'] + + @dtickrange.setter + def dtickrange(self, val): + self['dtickrange'] = val + + # enabled + # ------- + @property + def enabled(self): + """ + Determines whether or not this stop is used. If `false`, this + stop is ignored even within its `dtickrange`. + + The 'enabled' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['enabled'] + + @enabled.setter + def enabled(self, val): + self['enabled'] = val + + # name + # ---- + @property + def name(self): + """ + 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. + + The 'name' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['name'] + + @name.setter + def name(self, val): + self['name'] = val + + # templateitemname + # ---------------- + @property + def templateitemname(self): + """ + 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`. + + The 'templateitemname' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['templateitemname'] + + @templateitemname.setter + def templateitemname(self, val): + self['templateitemname'] = val + + # value + # ----- + @property + def value(self): + """ + string - dtickformat for described zoom level, the same as + "tickformat" + + The 'value' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['value'] + + @value.setter + def value(self, val): + self['value'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.colorbar' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + dtickrange + 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" + enabled + Determines whether or not this stop is used. If + `false`, this stop is ignored even within its + `dtickrange`. + name + 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. + templateitemname + 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`. + value + string - dtickformat for described zoom level, the same + as "tickformat" + """ + + def __init__( + self, + arg=None, + dtickrange=None, + enabled=None, + name=None, + templateitemname=None, + value=None, + **kwargs + ): + """ + Construct a new Tickformatstop object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of + plotly.graph_objs.isosurface.colorbar.Tickformatstop + dtickrange + 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" + enabled + Determines whether or not this stop is used. If + `false`, this stop is ignored even within its + `dtickrange`. + name + 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. + templateitemname + 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`. + value + string - dtickformat for described zoom level, the same + as "tickformat" + + Returns + ------- + Tickformatstop + """ + super(Tickformatstop, self).__init__('tickformatstops') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.colorbar.Tickformatstop +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.colorbar.Tickformatstop""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.colorbar import ( + tickformatstop as v_tickformatstop + ) + + # Initialize validators + # --------------------- + self._validators['dtickrange'] = v_tickformatstop.DtickrangeValidator() + self._validators['enabled'] = v_tickformatstop.EnabledValidator() + self._validators['name'] = v_tickformatstop.NameValidator() + self._validators['templateitemname' + ] = v_tickformatstop.TemplateitemnameValidator() + self._validators['value'] = v_tickformatstop.ValueValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('dtickrange', None) + self['dtickrange'] = dtickrange if dtickrange is not None else _v + _v = arg.pop('enabled', None) + self['enabled'] = enabled if enabled is not None else _v + _v = arg.pop('name', None) + self['name'] = name if name is not None else _v + _v = arg.pop('templateitemname', None) + self['templateitemname' + ] = templateitemname if templateitemname is not None else _v + _v = arg.pop('value', None) + self['value'] = value if value is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/title/_font.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/title/_font.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/title/_font.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/title/_font.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,229 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Font(BaseTraceHierarchyType): + + # color + # ----- + @property + def color(self): + """ + The 'color' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['color'] + + @color.setter + def color(self, val): + self['color'] = val + + # family + # ------ + @property + def family(self): + """ + 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 plotly service (at https://plot.ly 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". + + The 'family' property is a string and must be specified as: + - A non-empty string + + Returns + ------- + str + """ + return self['family'] + + @family.setter + def family(self, val): + self['family'] = val + + # size + # ---- + @property + def size(self): + """ + The 'size' property is a number and may be specified as: + - An int or float in the interval [1, inf] + + Returns + ------- + int|float + """ + return self['size'] + + @size.setter + def size(self, val): + self['size'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.colorbar.title' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + color + + family + 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 + plotly service (at https://plot.ly 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". + size + + """ + + def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): + """ + Construct a new Font object + + Sets this color bar's title font. Note that the title's font + used to be set by the now deprecated `titlefont` attribute. + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of + plotly.graph_objs.isosurface.colorbar.title.Font + color + + family + 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 + plotly service (at https://plot.ly 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". + size + + + Returns + ------- + Font + """ + super(Font, self).__init__('font') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.colorbar.title.Font +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.colorbar.title.Font""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.colorbar.title import ( + font as v_font + ) + + # Initialize validators + # --------------------- + self._validators['color'] = v_font.ColorValidator() + self._validators['family'] = v_font.FamilyValidator() + self._validators['size'] = v_font.SizeValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('color', None) + self['color'] = color if color is not None else _v + _v = arg.pop('family', None) + self['family'] = family if family is not None else _v + _v = arg.pop('size', None) + self['size'] = size if size is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/title/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/title/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/title/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/title/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -0,0 +1 @@ +from ._font import Font diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/_title.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/_title.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/colorbar/_title.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/colorbar/_title.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,202 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Title(BaseTraceHierarchyType): + + # font + # ---- + @property + def font(self): + """ + Sets this color bar's title font. Note that the title's font + used to be set by the now deprecated `titlefont` attribute. + + The 'font' property is an instance of Font + that may be specified as: + - An instance of plotly.graph_objs.isosurface.colorbar.title.Font + - A dict of string/value properties that will be passed + to the Font constructor + + Supported dict properties: + + color + + family + 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 plotly service (at https://plot.ly + 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". + size + + Returns + ------- + plotly.graph_objs.isosurface.colorbar.title.Font + """ + return self['font'] + + @font.setter + def font(self, val): + self['font'] = val + + # side + # ---- + @property + def side(self): + """ + Determines the location of color bar's title with respect to + the color bar. Note that the title's location used to be set by + the now deprecated `titleside` attribute. + + The 'side' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['right', 'top', 'bottom'] + + Returns + ------- + Any + """ + return self['side'] + + @side.setter + def side(self, val): + self['side'] = val + + # text + # ---- + @property + def text(self): + """ + 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. + + The 'text' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['text'] + + @text.setter + def text(self, val): + self['text'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.colorbar' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + font + Sets this color bar's title font. Note that the title's + font used to be set by the now deprecated `titlefont` + attribute. + side + Determines the location of color bar's title with + respect to the color bar. Note that the title's + location used to be set by the now deprecated + `titleside` attribute. + text + 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. + """ + + def __init__(self, arg=None, font=None, side=None, text=None, **kwargs): + """ + Construct a new Title object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of + plotly.graph_objs.isosurface.colorbar.Title + font + Sets this color bar's title font. Note that the title's + font used to be set by the now deprecated `titlefont` + attribute. + side + Determines the location of color bar's title with + respect to the color bar. Note that the title's + location used to be set by the now deprecated + `titleside` attribute. + text + 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. + + Returns + ------- + Title + """ + super(Title, self).__init__('title') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.colorbar.Title +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.colorbar.Title""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.colorbar import (title as v_title) + + # Initialize validators + # --------------------- + self._validators['font'] = v_title.FontValidator() + self._validators['side'] = v_title.SideValidator() + self._validators['text'] = v_title.TextValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('font', None) + self['font'] = font if font is not None else _v + _v = arg.pop('side', None) + self['side'] = side if side is not None else _v + _v = arg.pop('text', None) + self['text'] = text if text is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_colorbar.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_colorbar.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_colorbar.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_colorbar.py 2019-02-08 23:00:39.000000000 +0000 @@ -0,0 +1,1862 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class ColorBar(BaseTraceHierarchyType): + + # bgcolor + # ------- + @property + def bgcolor(self): + """ + Sets the color of padded area. + + The 'bgcolor' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['bgcolor'] + + @bgcolor.setter + def bgcolor(self, val): + self['bgcolor'] = val + + # bordercolor + # ----------- + @property + def bordercolor(self): + """ + Sets the axis line color. + + The 'bordercolor' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['bordercolor'] + + @bordercolor.setter + def bordercolor(self, val): + self['bordercolor'] = val + + # borderwidth + # ----------- + @property + def borderwidth(self): + """ + Sets the width (in px) or the border enclosing this color bar. + + The 'borderwidth' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['borderwidth'] + + @borderwidth.setter + def borderwidth(self, val): + self['borderwidth'] = val + + # dtick + # ----- + @property + def dtick(self): + """ + 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" + + The 'dtick' property accepts values of any type + + Returns + ------- + Any + """ + return self['dtick'] + + @dtick.setter + def dtick(self, val): + self['dtick'] = val + + # exponentformat + # -------------- + @property + def exponentformat(self): + """ + 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. + + The 'exponentformat' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['none', 'e', 'E', 'power', 'SI', 'B'] + + Returns + ------- + Any + """ + return self['exponentformat'] + + @exponentformat.setter + def exponentformat(self, val): + self['exponentformat'] = val + + # len + # --- + @property + def len(self): + """ + 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. + + The 'len' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['len'] + + @len.setter + def len(self, val): + self['len'] = val + + # lenmode + # ------- + @property + def lenmode(self): + """ + 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. + + The 'lenmode' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['fraction', 'pixels'] + + Returns + ------- + Any + """ + return self['lenmode'] + + @lenmode.setter + def lenmode(self, val): + self['lenmode'] = val + + # nticks + # ------ + @property + def nticks(self): + """ + 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". + + The 'nticks' property is a integer and may be specified as: + - An int (or float that will be cast to an int) + in the interval [0, 9223372036854775807] + + Returns + ------- + int + """ + return self['nticks'] + + @nticks.setter + def nticks(self, val): + self['nticks'] = val + + # outlinecolor + # ------------ + @property + def outlinecolor(self): + """ + Sets the axis line color. + + The 'outlinecolor' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['outlinecolor'] + + @outlinecolor.setter + def outlinecolor(self, val): + self['outlinecolor'] = val + + # outlinewidth + # ------------ + @property + def outlinewidth(self): + """ + Sets the width (in px) of the axis line. + + The 'outlinewidth' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['outlinewidth'] + + @outlinewidth.setter + def outlinewidth(self, val): + self['outlinewidth'] = val + + # separatethousands + # ----------------- + @property + def separatethousands(self): + """ + If "true", even 4-digit integers are separated + + The 'separatethousands' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['separatethousands'] + + @separatethousands.setter + def separatethousands(self, val): + self['separatethousands'] = val + + # showexponent + # ------------ + @property + def showexponent(self): + """ + 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. + + The 'showexponent' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['all', 'first', 'last', 'none'] + + Returns + ------- + Any + """ + return self['showexponent'] + + @showexponent.setter + def showexponent(self, val): + self['showexponent'] = val + + # showticklabels + # -------------- + @property + def showticklabels(self): + """ + Determines whether or not the tick labels are drawn. + + The 'showticklabels' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['showticklabels'] + + @showticklabels.setter + def showticklabels(self, val): + self['showticklabels'] = val + + # showtickprefix + # -------------- + @property + def showtickprefix(self): + """ + 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. + + The 'showtickprefix' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['all', 'first', 'last', 'none'] + + Returns + ------- + Any + """ + return self['showtickprefix'] + + @showtickprefix.setter + def showtickprefix(self, val): + self['showtickprefix'] = val + + # showticksuffix + # -------------- + @property + def showticksuffix(self): + """ + Same as `showtickprefix` but for tick suffixes. + + The 'showticksuffix' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['all', 'first', 'last', 'none'] + + Returns + ------- + Any + """ + return self['showticksuffix'] + + @showticksuffix.setter + def showticksuffix(self, val): + self['showticksuffix'] = val + + # thickness + # --------- + @property + def thickness(self): + """ + Sets the thickness of the color bar This measure excludes the + size of the padding, ticks and labels. + + The 'thickness' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['thickness'] + + @thickness.setter + def thickness(self, val): + self['thickness'] = val + + # thicknessmode + # ------------- + @property + def thicknessmode(self): + """ + 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. + + The 'thicknessmode' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['fraction', 'pixels'] + + Returns + ------- + Any + """ + return self['thicknessmode'] + + @thicknessmode.setter + def thicknessmode(self, val): + self['thicknessmode'] = val + + # tick0 + # ----- + @property + def tick0(self): + """ + 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. + + The 'tick0' property accepts values of any type + + Returns + ------- + Any + """ + return self['tick0'] + + @tick0.setter + def tick0(self, val): + self['tick0'] = val + + # tickangle + # --------- + @property + def tickangle(self): + """ + Sets the angle of the tick labels with respect to the + horizontal. For example, a `tickangle` of -90 draws the tick + labels vertically. + + The 'tickangle' property is a angle (in degrees) that may be + specified as a number between -180 and 180. Numeric values outside this + range are converted to the equivalent value + (e.g. 270 is converted to -90). + + Returns + ------- + int|float + """ + return self['tickangle'] + + @tickangle.setter + def tickangle(self, val): + self['tickangle'] = val + + # tickcolor + # --------- + @property + def tickcolor(self): + """ + Sets the tick color. + + The 'tickcolor' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['tickcolor'] + + @tickcolor.setter + def tickcolor(self, val): + self['tickcolor'] = val + + # tickfont + # -------- + @property + def tickfont(self): + """ + Sets the color bar's tick label font + + The 'tickfont' property is an instance of Tickfont + that may be specified as: + - An instance of plotly.graph_objs.isosurface.colorbar.Tickfont + - A dict of string/value properties that will be passed + to the Tickfont constructor + + Supported dict properties: + + color + + family + 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 plotly service (at https://plot.ly + 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". + size + + Returns + ------- + plotly.graph_objs.isosurface.colorbar.Tickfont + """ + return self['tickfont'] + + @tickfont.setter + def tickfont(self, val): + self['tickfont'] = val + + # tickformat + # ---------- + @property + def tickformat(self): + """ + Sets the tick label formatting rule using d3 formatting mini- + languages which are very similar to those in Python. For + numbers, see: https://github.com/d3/d3-format/blob/master/READM + E.md#locale_format And for dates see: + https://github.com/d3/d3-time- + format/blob/master/README.md#locale_format We add one item to + d3's date formatter: "%{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" + + The 'tickformat' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['tickformat'] + + @tickformat.setter + def tickformat(self, val): + self['tickformat'] = val + + # tickformatstops + # --------------- + @property + def tickformatstops(self): + """ + The 'tickformatstops' property is a tuple of instances of + Tickformatstop that may be specified as: + - A list or tuple of instances of plotly.graph_objs.isosurface.colorbar.Tickformatstop + - A list or tuple of dicts of string/value properties that + will be passed to the Tickformatstop constructor + + Supported dict properties: + + dtickrange + 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" + enabled + Determines whether or not this stop is used. If + `false`, this stop is ignored even within its + `dtickrange`. + name + 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. + templateitemname + 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`. + value + string - dtickformat for described zoom level, + the same as "tickformat" + + Returns + ------- + tuple[plotly.graph_objs.isosurface.colorbar.Tickformatstop] + """ + return self['tickformatstops'] + + @tickformatstops.setter + def tickformatstops(self, val): + self['tickformatstops'] = val + + # tickformatstopdefaults + # ---------------------- + @property + def tickformatstopdefaults(self): + """ + When used in a template (as layout.template.data.isosurface.col + orbar.tickformatstopdefaults), sets the default property values + to use for elements of isosurface.colorbar.tickformatstops + + The 'tickformatstopdefaults' property is an instance of Tickformatstop + that may be specified as: + - An instance of plotly.graph_objs.isosurface.colorbar.Tickformatstop + - A dict of string/value properties that will be passed + to the Tickformatstop constructor + + Supported dict properties: + + Returns + ------- + plotly.graph_objs.isosurface.colorbar.Tickformatstop + """ + return self['tickformatstopdefaults'] + + @tickformatstopdefaults.setter + def tickformatstopdefaults(self, val): + self['tickformatstopdefaults'] = val + + # ticklen + # ------- + @property + def ticklen(self): + """ + Sets the tick length (in px). + + The 'ticklen' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['ticklen'] + + @ticklen.setter + def ticklen(self, val): + self['ticklen'] = val + + # tickmode + # -------- + @property + def tickmode(self): + """ + 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). + + The 'tickmode' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['auto', 'linear', 'array'] + + Returns + ------- + Any + """ + return self['tickmode'] + + @tickmode.setter + def tickmode(self, val): + self['tickmode'] = val + + # tickprefix + # ---------- + @property + def tickprefix(self): + """ + Sets a tick label prefix. + + The 'tickprefix' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['tickprefix'] + + @tickprefix.setter + def tickprefix(self, val): + self['tickprefix'] = val + + # ticks + # ----- + @property + def ticks(self): + """ + 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. + + The 'ticks' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['outside', 'inside', ''] + + Returns + ------- + Any + """ + return self['ticks'] + + @ticks.setter + def ticks(self, val): + self['ticks'] = val + + # ticksuffix + # ---------- + @property + def ticksuffix(self): + """ + Sets a tick label suffix. + + The 'ticksuffix' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['ticksuffix'] + + @ticksuffix.setter + def ticksuffix(self, val): + self['ticksuffix'] = val + + # ticktext + # -------- + @property + def ticktext(self): + """ + Sets the text displayed at the ticks position via `tickvals`. + Only has an effect if `tickmode` is set to "array". Used with + `tickvals`. + + The 'ticktext' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['ticktext'] + + @ticktext.setter + def ticktext(self, val): + self['ticktext'] = val + + # ticktextsrc + # ----------- + @property + def ticktextsrc(self): + """ + Sets the source reference on plot.ly for ticktext . + + The 'ticktextsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['ticktextsrc'] + + @ticktextsrc.setter + def ticktextsrc(self, val): + self['ticktextsrc'] = val + + # tickvals + # -------- + @property + def tickvals(self): + """ + Sets the values at which ticks on this axis appear. Only has an + effect if `tickmode` is set to "array". Used with `ticktext`. + + The 'tickvals' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['tickvals'] + + @tickvals.setter + def tickvals(self, val): + self['tickvals'] = val + + # tickvalssrc + # ----------- + @property + def tickvalssrc(self): + """ + Sets the source reference on plot.ly for tickvals . + + The 'tickvalssrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['tickvalssrc'] + + @tickvalssrc.setter + def tickvalssrc(self, val): + self['tickvalssrc'] = val + + # tickwidth + # --------- + @property + def tickwidth(self): + """ + Sets the tick width (in px). + + The 'tickwidth' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['tickwidth'] + + @tickwidth.setter + def tickwidth(self, val): + self['tickwidth'] = val + + # title + # ----- + @property + def title(self): + """ + The 'title' property is an instance of Title + that may be specified as: + - An instance of plotly.graph_objs.isosurface.colorbar.Title + - A dict of string/value properties that will be passed + to the Title constructor + + Supported dict properties: + + font + Sets this color bar's title font. Note that the + title's font used to be set by the now + deprecated `titlefont` attribute. + side + Determines the location of color bar's title + with respect to the color bar. Note that the + title's location used to be set by the now + deprecated `titleside` attribute. + text + 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. + + Returns + ------- + plotly.graph_objs.isosurface.colorbar.Title + """ + return self['title'] + + @title.setter + def title(self, val): + self['title'] = val + + # titlefont + # --------- + @property + def titlefont(self): + """ + Deprecated: Please use isosurface.colorbar.title.font instead. + Sets this color bar's title font. Note that the title's font + used to be set by the now deprecated `titlefont` attribute. + + The 'font' property is an instance of Font + that may be specified as: + - An instance of plotly.graph_objs.isosurface.colorbar.title.Font + - A dict of string/value properties that will be passed + to the Font constructor + + Supported dict properties: + + color + + family + 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 plotly service (at https://plot.ly + 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". + size + + Returns + ------- + + """ + return self['titlefont'] + + @titlefont.setter + def titlefont(self, val): + self['titlefont'] = val + + # titleside + # --------- + @property + def titleside(self): + """ + Deprecated: Please use isosurface.colorbar.title.side instead. + Determines the location of color bar's title with respect to + the color bar. Note that the title's location used to be set by + the now deprecated `titleside` attribute. + + The 'side' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['right', 'top', 'bottom'] + + Returns + ------- + + """ + return self['titleside'] + + @titleside.setter + def titleside(self, val): + self['titleside'] = val + + # x + # - + @property + def x(self): + """ + Sets the x position of the color bar (in plot fraction). + + The 'x' property is a number and may be specified as: + - An int or float in the interval [-2, 3] + + Returns + ------- + int|float + """ + return self['x'] + + @x.setter + def x(self, val): + self['x'] = val + + # xanchor + # ------- + @property + def xanchor(self): + """ + Sets this color bar's horizontal position anchor. This anchor + binds the `x` position to the "left", "center" or "right" of + the color bar. + + The 'xanchor' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['left', 'center', 'right'] + + Returns + ------- + Any + """ + return self['xanchor'] + + @xanchor.setter + def xanchor(self, val): + self['xanchor'] = val + + # xpad + # ---- + @property + def xpad(self): + """ + Sets the amount of padding (in px) along the x direction. + + The 'xpad' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['xpad'] + + @xpad.setter + def xpad(self, val): + self['xpad'] = val + + # y + # - + @property + def y(self): + """ + Sets the y position of the color bar (in plot fraction). + + The 'y' property is a number and may be specified as: + - An int or float in the interval [-2, 3] + + Returns + ------- + int|float + """ + return self['y'] + + @y.setter + def y(self, val): + self['y'] = val + + # yanchor + # ------- + @property + def yanchor(self): + """ + Sets this color bar's vertical position anchor This anchor + binds the `y` position to the "top", "middle" or "bottom" of + the color bar. + + The 'yanchor' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['top', 'middle', 'bottom'] + + Returns + ------- + Any + """ + return self['yanchor'] + + @yanchor.setter + def yanchor(self, val): + self['yanchor'] = val + + # ypad + # ---- + @property + def ypad(self): + """ + Sets the amount of padding (in px) along the y direction. + + The 'ypad' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['ypad'] + + @ypad.setter + def ypad(self, val): + self['ypad'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + bgcolor + Sets the color of padded area. + bordercolor + Sets the axis line color. + borderwidth + Sets the width (in px) or the border enclosing this + color bar. + dtick + 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" + exponentformat + 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. + len + 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. + lenmode + 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. + nticks + 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". + outlinecolor + Sets the axis line color. + outlinewidth + Sets the width (in px) of the axis line. + separatethousands + If "true", even 4-digit integers are separated + showexponent + 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. + showticklabels + Determines whether or not the tick labels are drawn. + showtickprefix + 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. + showticksuffix + Same as `showtickprefix` but for tick suffixes. + thickness + Sets the thickness of the color bar This measure + excludes the size of the padding, ticks and labels. + thicknessmode + 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. + tick0 + 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. + tickangle + Sets the angle of the tick labels with respect to the + horizontal. For example, a `tickangle` of -90 draws the + tick labels vertically. + tickcolor + Sets the tick color. + tickfont + Sets the color bar's tick label font + tickformat + Sets the tick label formatting rule using d3 formatting + mini-languages which are very similar to those in + Python. For numbers, see: https://github.com/d3/d3-form + at/blob/master/README.md#locale_format And for dates + see: https://github.com/d3/d3-time- + format/blob/master/README.md#locale_format We add one + item to d3's date formatter: "%{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" + tickformatstops + plotly.graph_objs.isosurface.colorbar.Tickformatstop + instance or dict with compatible properties + tickformatstopdefaults + When used in a template (as layout.template.data.isosur + face.colorbar.tickformatstopdefaults), sets the default + property values to use for elements of + isosurface.colorbar.tickformatstops + ticklen + Sets the tick length (in px). + tickmode + 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). + tickprefix + Sets a tick label prefix. + ticks + 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. + ticksuffix + Sets a tick label suffix. + ticktext + Sets the text displayed at the ticks position via + `tickvals`. Only has an effect if `tickmode` is set to + "array". Used with `tickvals`. + ticktextsrc + Sets the source reference on plot.ly for ticktext . + tickvals + Sets the values at which ticks on this axis appear. + Only has an effect if `tickmode` is set to "array". + Used with `ticktext`. + tickvalssrc + Sets the source reference on plot.ly for tickvals . + tickwidth + Sets the tick width (in px). + title + plotly.graph_objs.isosurface.colorbar.Title instance or + dict with compatible properties + titlefont + Deprecated: Please use isosurface.colorbar.title.font + instead. Sets this color bar's title font. Note that + the title's font used to be set by the now deprecated + `titlefont` attribute. + titleside + Deprecated: Please use isosurface.colorbar.title.side + instead. Determines the location of color bar's title + with respect to the color bar. Note that the title's + location used to be set by the now deprecated + `titleside` attribute. + x + Sets the x position of the color bar (in plot + fraction). + xanchor + Sets this color bar's horizontal position anchor. This + anchor binds the `x` position to the "left", "center" + or "right" of the color bar. + xpad + Sets the amount of padding (in px) along the x + direction. + y + Sets the y position of the color bar (in plot + fraction). + yanchor + Sets this color bar's vertical position anchor This + anchor binds the `y` position to the "top", "middle" or + "bottom" of the color bar. + ypad + Sets the amount of padding (in px) along the y + direction. + """ + + _mapped_properties = { + 'titlefont': ('title', 'font'), + 'titleside': ('title', 'side') + } + + def __init__( + self, + arg=None, + bgcolor=None, + bordercolor=None, + borderwidth=None, + dtick=None, + exponentformat=None, + len=None, + lenmode=None, + nticks=None, + outlinecolor=None, + outlinewidth=None, + separatethousands=None, + showexponent=None, + showticklabels=None, + showtickprefix=None, + showticksuffix=None, + thickness=None, + thicknessmode=None, + tick0=None, + tickangle=None, + tickcolor=None, + tickfont=None, + tickformat=None, + tickformatstops=None, + tickformatstopdefaults=None, + ticklen=None, + tickmode=None, + tickprefix=None, + ticks=None, + ticksuffix=None, + ticktext=None, + ticktextsrc=None, + tickvals=None, + tickvalssrc=None, + tickwidth=None, + title=None, + titlefont=None, + titleside=None, + x=None, + xanchor=None, + xpad=None, + y=None, + yanchor=None, + ypad=None, + **kwargs + ): + """ + Construct a new ColorBar object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.ColorBar + bgcolor + Sets the color of padded area. + bordercolor + Sets the axis line color. + borderwidth + Sets the width (in px) or the border enclosing this + color bar. + dtick + 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" + exponentformat + 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. + len + 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. + lenmode + 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. + nticks + 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". + outlinecolor + Sets the axis line color. + outlinewidth + Sets the width (in px) of the axis line. + separatethousands + If "true", even 4-digit integers are separated + showexponent + 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. + showticklabels + Determines whether or not the tick labels are drawn. + showtickprefix + 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. + showticksuffix + Same as `showtickprefix` but for tick suffixes. + thickness + Sets the thickness of the color bar This measure + excludes the size of the padding, ticks and labels. + thicknessmode + 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. + tick0 + 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. + tickangle + Sets the angle of the tick labels with respect to the + horizontal. For example, a `tickangle` of -90 draws the + tick labels vertically. + tickcolor + Sets the tick color. + tickfont + Sets the color bar's tick label font + tickformat + Sets the tick label formatting rule using d3 formatting + mini-languages which are very similar to those in + Python. For numbers, see: https://github.com/d3/d3-form + at/blob/master/README.md#locale_format And for dates + see: https://github.com/d3/d3-time- + format/blob/master/README.md#locale_format We add one + item to d3's date formatter: "%{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" + tickformatstops + plotly.graph_objs.isosurface.colorbar.Tickformatstop + instance or dict with compatible properties + tickformatstopdefaults + When used in a template (as layout.template.data.isosur + face.colorbar.tickformatstopdefaults), sets the default + property values to use for elements of + isosurface.colorbar.tickformatstops + ticklen + Sets the tick length (in px). + tickmode + 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). + tickprefix + Sets a tick label prefix. + ticks + 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. + ticksuffix + Sets a tick label suffix. + ticktext + Sets the text displayed at the ticks position via + `tickvals`. Only has an effect if `tickmode` is set to + "array". Used with `tickvals`. + ticktextsrc + Sets the source reference on plot.ly for ticktext . + tickvals + Sets the values at which ticks on this axis appear. + Only has an effect if `tickmode` is set to "array". + Used with `ticktext`. + tickvalssrc + Sets the source reference on plot.ly for tickvals . + tickwidth + Sets the tick width (in px). + title + plotly.graph_objs.isosurface.colorbar.Title instance or + dict with compatible properties + titlefont + Deprecated: Please use isosurface.colorbar.title.font + instead. Sets this color bar's title font. Note that + the title's font used to be set by the now deprecated + `titlefont` attribute. + titleside + Deprecated: Please use isosurface.colorbar.title.side + instead. Determines the location of color bar's title + with respect to the color bar. Note that the title's + location used to be set by the now deprecated + `titleside` attribute. + x + Sets the x position of the color bar (in plot + fraction). + xanchor + Sets this color bar's horizontal position anchor. This + anchor binds the `x` position to the "left", "center" + or "right" of the color bar. + xpad + Sets the amount of padding (in px) along the x + direction. + y + Sets the y position of the color bar (in plot + fraction). + yanchor + Sets this color bar's vertical position anchor This + anchor binds the `y` position to the "top", "middle" or + "bottom" of the color bar. + ypad + Sets the amount of padding (in px) along the y + direction. + + Returns + ------- + ColorBar + """ + super(ColorBar, self).__init__('colorbar') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.ColorBar +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.ColorBar""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (colorbar as v_colorbar) + + # Initialize validators + # --------------------- + self._validators['bgcolor'] = v_colorbar.BgcolorValidator() + self._validators['bordercolor'] = v_colorbar.BordercolorValidator() + self._validators['borderwidth'] = v_colorbar.BorderwidthValidator() + self._validators['dtick'] = v_colorbar.DtickValidator() + self._validators['exponentformat' + ] = v_colorbar.ExponentformatValidator() + self._validators['len'] = v_colorbar.LenValidator() + self._validators['lenmode'] = v_colorbar.LenmodeValidator() + self._validators['nticks'] = v_colorbar.NticksValidator() + self._validators['outlinecolor'] = v_colorbar.OutlinecolorValidator() + self._validators['outlinewidth'] = v_colorbar.OutlinewidthValidator() + self._validators['separatethousands' + ] = v_colorbar.SeparatethousandsValidator() + self._validators['showexponent'] = v_colorbar.ShowexponentValidator() + self._validators['showticklabels' + ] = v_colorbar.ShowticklabelsValidator() + self._validators['showtickprefix' + ] = v_colorbar.ShowtickprefixValidator() + self._validators['showticksuffix' + ] = v_colorbar.ShowticksuffixValidator() + self._validators['thickness'] = v_colorbar.ThicknessValidator() + self._validators['thicknessmode'] = v_colorbar.ThicknessmodeValidator() + self._validators['tick0'] = v_colorbar.Tick0Validator() + self._validators['tickangle'] = v_colorbar.TickangleValidator() + self._validators['tickcolor'] = v_colorbar.TickcolorValidator() + self._validators['tickfont'] = v_colorbar.TickfontValidator() + self._validators['tickformat'] = v_colorbar.TickformatValidator() + self._validators['tickformatstops' + ] = v_colorbar.TickformatstopsValidator() + self._validators['tickformatstopdefaults' + ] = v_colorbar.TickformatstopValidator() + self._validators['ticklen'] = v_colorbar.TicklenValidator() + self._validators['tickmode'] = v_colorbar.TickmodeValidator() + self._validators['tickprefix'] = v_colorbar.TickprefixValidator() + self._validators['ticks'] = v_colorbar.TicksValidator() + self._validators['ticksuffix'] = v_colorbar.TicksuffixValidator() + self._validators['ticktext'] = v_colorbar.TicktextValidator() + self._validators['ticktextsrc'] = v_colorbar.TicktextsrcValidator() + self._validators['tickvals'] = v_colorbar.TickvalsValidator() + self._validators['tickvalssrc'] = v_colorbar.TickvalssrcValidator() + self._validators['tickwidth'] = v_colorbar.TickwidthValidator() + self._validators['title'] = v_colorbar.TitleValidator() + self._validators['x'] = v_colorbar.XValidator() + self._validators['xanchor'] = v_colorbar.XanchorValidator() + self._validators['xpad'] = v_colorbar.XpadValidator() + self._validators['y'] = v_colorbar.YValidator() + self._validators['yanchor'] = v_colorbar.YanchorValidator() + self._validators['ypad'] = v_colorbar.YpadValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('bgcolor', None) + self['bgcolor'] = bgcolor if bgcolor is not None else _v + _v = arg.pop('bordercolor', None) + self['bordercolor'] = bordercolor if bordercolor is not None else _v + _v = arg.pop('borderwidth', None) + self['borderwidth'] = borderwidth if borderwidth is not None else _v + _v = arg.pop('dtick', None) + self['dtick'] = dtick if dtick is not None else _v + _v = arg.pop('exponentformat', None) + self['exponentformat' + ] = exponentformat if exponentformat is not None else _v + _v = arg.pop('len', None) + self['len'] = len if len is not None else _v + _v = arg.pop('lenmode', None) + self['lenmode'] = lenmode if lenmode is not None else _v + _v = arg.pop('nticks', None) + self['nticks'] = nticks if nticks is not None else _v + _v = arg.pop('outlinecolor', None) + self['outlinecolor'] = outlinecolor if outlinecolor is not None else _v + _v = arg.pop('outlinewidth', None) + self['outlinewidth'] = outlinewidth if outlinewidth is not None else _v + _v = arg.pop('separatethousands', None) + self['separatethousands' + ] = separatethousands if separatethousands is not None else _v + _v = arg.pop('showexponent', None) + self['showexponent'] = showexponent if showexponent is not None else _v + _v = arg.pop('showticklabels', None) + self['showticklabels' + ] = showticklabels if showticklabels is not None else _v + _v = arg.pop('showtickprefix', None) + self['showtickprefix' + ] = showtickprefix if showtickprefix is not None else _v + _v = arg.pop('showticksuffix', None) + self['showticksuffix' + ] = showticksuffix if showticksuffix is not None else _v + _v = arg.pop('thickness', None) + self['thickness'] = thickness if thickness is not None else _v + _v = arg.pop('thicknessmode', None) + self['thicknessmode' + ] = thicknessmode if thicknessmode is not None else _v + _v = arg.pop('tick0', None) + self['tick0'] = tick0 if tick0 is not None else _v + _v = arg.pop('tickangle', None) + self['tickangle'] = tickangle if tickangle is not None else _v + _v = arg.pop('tickcolor', None) + self['tickcolor'] = tickcolor if tickcolor is not None else _v + _v = arg.pop('tickfont', None) + self['tickfont'] = tickfont if tickfont is not None else _v + _v = arg.pop('tickformat', None) + self['tickformat'] = tickformat if tickformat is not None else _v + _v = arg.pop('tickformatstops', None) + self['tickformatstops' + ] = tickformatstops if tickformatstops is not None else _v + _v = arg.pop('tickformatstopdefaults', None) + self[ + 'tickformatstopdefaults' + ] = tickformatstopdefaults if tickformatstopdefaults is not None else _v + _v = arg.pop('ticklen', None) + self['ticklen'] = ticklen if ticklen is not None else _v + _v = arg.pop('tickmode', None) + self['tickmode'] = tickmode if tickmode is not None else _v + _v = arg.pop('tickprefix', None) + self['tickprefix'] = tickprefix if tickprefix is not None else _v + _v = arg.pop('ticks', None) + self['ticks'] = ticks if ticks is not None else _v + _v = arg.pop('ticksuffix', None) + self['ticksuffix'] = ticksuffix if ticksuffix is not None else _v + _v = arg.pop('ticktext', None) + self['ticktext'] = ticktext if ticktext is not None else _v + _v = arg.pop('ticktextsrc', None) + self['ticktextsrc'] = ticktextsrc if ticktextsrc is not None else _v + _v = arg.pop('tickvals', None) + self['tickvals'] = tickvals if tickvals is not None else _v + _v = arg.pop('tickvalssrc', None) + self['tickvalssrc'] = tickvalssrc if tickvalssrc is not None else _v + _v = arg.pop('tickwidth', None) + self['tickwidth'] = tickwidth if tickwidth is not None else _v + _v = arg.pop('title', None) + self['title'] = title if title is not None else _v + _v = arg.pop('titlefont', None) + _v = titlefont if titlefont is not None else _v + if _v is not None: + self['titlefont'] = _v + _v = arg.pop('titleside', None) + _v = titleside if titleside is not None else _v + if _v is not None: + self['titleside'] = _v + _v = arg.pop('x', None) + self['x'] = x if x is not None else _v + _v = arg.pop('xanchor', None) + self['xanchor'] = xanchor if xanchor is not None else _v + _v = arg.pop('xpad', None) + self['xpad'] = xpad if xpad is not None else _v + _v = arg.pop('y', None) + self['y'] = y if y is not None else _v + _v = arg.pop('yanchor', None) + self['yanchor'] = yanchor if yanchor is not None else _v + _v = arg.pop('ypad', None) + self['ypad'] = ypad if ypad is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_contour.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_contour.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_contour.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_contour.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,197 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Contour(BaseTraceHierarchyType): + + # color + # ----- + @property + def color(self): + """ + Sets the color of the contour lines. + + The 'color' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + + Returns + ------- + str + """ + return self['color'] + + @color.setter + def color(self, val): + self['color'] = val + + # show + # ---- + @property + def show(self): + """ + Sets whether or not dynamic contours are shown on hover. + Contours are more useful when hovering on caps and slices. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # width + # ----- + @property + def width(self): + """ + Sets the width of the contour lines. + + The 'width' property is a number and may be specified as: + - An int or float in the interval [1, 16] + + Returns + ------- + int|float + """ + return self['width'] + + @width.setter + def width(self, val): + self['width'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + color + Sets the color of the contour lines. + show + Sets whether or not dynamic contours are shown on + hover. Contours are more useful when hovering on caps + and slices. + width + Sets the width of the contour lines. + """ + + def __init__(self, arg=None, color=None, show=None, width=None, **kwargs): + """ + Construct a new Contour object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Contour + color + Sets the color of the contour lines. + show + Sets whether or not dynamic contours are shown on + hover. Contours are more useful when hovering on caps + and slices. + width + Sets the width of the contour lines. + + Returns + ------- + Contour + """ + super(Contour, self).__init__('contour') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Contour +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Contour""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (contour as v_contour) + + # Initialize validators + # --------------------- + self._validators['color'] = v_contour.ColorValidator() + self._validators['show'] = v_contour.ShowValidator() + self._validators['width'] = v_contour.WidthValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('color', None) + self['color'] = color if color is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + _v = arg.pop('width', None) + self['width'] = width if width is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/hoverlabel/_font.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/hoverlabel/_font.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/hoverlabel/_font.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/hoverlabel/_font.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,320 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Font(BaseTraceHierarchyType): + + # color + # ----- + @property + def color(self): + """ + The 'color' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + - A list or array of any of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['color'] + + @color.setter + def color(self, val): + self['color'] = val + + # colorsrc + # -------- + @property + def colorsrc(self): + """ + Sets the source reference on plot.ly for color . + + The 'colorsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['colorsrc'] + + @colorsrc.setter + def colorsrc(self, val): + self['colorsrc'] = val + + # family + # ------ + @property + def family(self): + """ + 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 plotly service (at https://plot.ly 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". + + The 'family' property is a string and must be specified as: + - A non-empty string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['family'] + + @family.setter + def family(self, val): + self['family'] = val + + # familysrc + # --------- + @property + def familysrc(self): + """ + Sets the source reference on plot.ly for family . + + The 'familysrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['familysrc'] + + @familysrc.setter + def familysrc(self, val): + self['familysrc'] = val + + # size + # ---- + @property + def size(self): + """ + The 'size' property is a number and may be specified as: + - An int or float in the interval [1, inf] + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + int|float|numpy.ndarray + """ + return self['size'] + + @size.setter + def size(self, val): + self['size'] = val + + # sizesrc + # ------- + @property + def sizesrc(self): + """ + Sets the source reference on plot.ly for size . + + The 'sizesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['sizesrc'] + + @sizesrc.setter + def sizesrc(self, val): + self['sizesrc'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.hoverlabel' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + color + + colorsrc + Sets the source reference on plot.ly for color . + family + 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 + plotly service (at https://plot.ly 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". + familysrc + Sets the source reference on plot.ly for family . + size + + sizesrc + Sets the source reference on plot.ly for size . + """ + + def __init__( + self, + arg=None, + color=None, + colorsrc=None, + family=None, + familysrc=None, + size=None, + sizesrc=None, + **kwargs + ): + """ + Construct a new Font object + + Sets the font used in hover labels. + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of + plotly.graph_objs.isosurface.hoverlabel.Font + color + + colorsrc + Sets the source reference on plot.ly for color . + family + 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 + plotly service (at https://plot.ly 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". + familysrc + Sets the source reference on plot.ly for family . + size + + sizesrc + Sets the source reference on plot.ly for size . + + Returns + ------- + Font + """ + super(Font, self).__init__('font') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.hoverlabel.Font +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.hoverlabel.Font""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.hoverlabel import (font as v_font) + + # Initialize validators + # --------------------- + self._validators['color'] = v_font.ColorValidator() + self._validators['colorsrc'] = v_font.ColorsrcValidator() + self._validators['family'] = v_font.FamilyValidator() + self._validators['familysrc'] = v_font.FamilysrcValidator() + self._validators['size'] = v_font.SizeValidator() + self._validators['sizesrc'] = v_font.SizesrcValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('color', None) + self['color'] = color if color is not None else _v + _v = arg.pop('colorsrc', None) + self['colorsrc'] = colorsrc if colorsrc is not None else _v + _v = arg.pop('family', None) + self['family'] = family if family is not None else _v + _v = arg.pop('familysrc', None) + self['familysrc'] = familysrc if familysrc is not None else _v + _v = arg.pop('size', None) + self['size'] = size if size is not None else _v + _v = arg.pop('sizesrc', None) + self['sizesrc'] = sizesrc if sizesrc is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/hoverlabel/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/hoverlabel/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/hoverlabel/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/hoverlabel/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -0,0 +1 @@ +from ._font import Font diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_hoverlabel.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_hoverlabel.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_hoverlabel.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_hoverlabel.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,414 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Hoverlabel(BaseTraceHierarchyType): + + # bgcolor + # ------- + @property + def bgcolor(self): + """ + Sets the background color of the hover labels for this trace + + The 'bgcolor' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + - A list or array of any of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['bgcolor'] + + @bgcolor.setter + def bgcolor(self, val): + self['bgcolor'] = val + + # bgcolorsrc + # ---------- + @property + def bgcolorsrc(self): + """ + Sets the source reference on plot.ly for bgcolor . + + The 'bgcolorsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['bgcolorsrc'] + + @bgcolorsrc.setter + def bgcolorsrc(self, val): + self['bgcolorsrc'] = val + + # bordercolor + # ----------- + @property + def bordercolor(self): + """ + Sets the border color of the hover labels for this trace. + + The 'bordercolor' property is a color and may be specified as: + - A hex string (e.g. '#ff0000') + - An rgb/rgba string (e.g. 'rgb(255,0,0)') + - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') + - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') + - A named CSS color: + aliceblue, antiquewhite, aqua, aquamarine, azure, + beige, bisque, black, blanchedalmond, blue, + blueviolet, brown, burlywood, cadetblue, + chartreuse, chocolate, coral, cornflowerblue, + cornsilk, crimson, cyan, darkblue, darkcyan, + darkgoldenrod, darkgray, darkgrey, darkgreen, + darkkhaki, darkmagenta, darkolivegreen, darkorange, + darkorchid, darkred, darksalmon, darkseagreen, + darkslateblue, darkslategray, darkslategrey, + darkturquoise, darkviolet, deeppink, deepskyblue, + dimgray, dimgrey, dodgerblue, firebrick, + floralwhite, forestgreen, fuchsia, gainsboro, + ghostwhite, gold, goldenrod, gray, grey, green, + greenyellow, honeydew, hotpink, indianred, indigo, + ivory, khaki, lavender, lavenderblush, lawngreen, + lemonchiffon, lightblue, lightcoral, lightcyan, + lightgoldenrodyellow, lightgray, lightgrey, + lightgreen, lightpink, lightsalmon, lightseagreen, + lightskyblue, lightslategray, lightslategrey, + lightsteelblue, lightyellow, lime, limegreen, + linen, magenta, maroon, mediumaquamarine, + mediumblue, mediumorchid, mediumpurple, + mediumseagreen, mediumslateblue, mediumspringgreen, + mediumturquoise, mediumvioletred, midnightblue, + mintcream, mistyrose, moccasin, navajowhite, navy, + oldlace, olive, olivedrab, orange, orangered, + orchid, palegoldenrod, palegreen, paleturquoise, + palevioletred, papayawhip, peachpuff, peru, pink, + plum, powderblue, purple, red, rosybrown, + royalblue, saddlebrown, salmon, sandybrown, + seagreen, seashell, sienna, silver, skyblue, + slateblue, slategray, slategrey, snow, springgreen, + steelblue, tan, teal, thistle, tomato, turquoise, + violet, wheat, white, whitesmoke, yellow, + yellowgreen + - A list or array of any of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['bordercolor'] + + @bordercolor.setter + def bordercolor(self, val): + self['bordercolor'] = val + + # bordercolorsrc + # -------------- + @property + def bordercolorsrc(self): + """ + Sets the source reference on plot.ly for bordercolor . + + The 'bordercolorsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['bordercolorsrc'] + + @bordercolorsrc.setter + def bordercolorsrc(self, val): + self['bordercolorsrc'] = val + + # font + # ---- + @property + def font(self): + """ + Sets the font used in hover labels. + + The 'font' property is an instance of Font + that may be specified as: + - An instance of plotly.graph_objs.isosurface.hoverlabel.Font + - A dict of string/value properties that will be passed + to the Font constructor + + Supported dict properties: + + color + + colorsrc + Sets the source reference on plot.ly for color + . + family + 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 plotly service (at https://plot.ly + 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". + familysrc + Sets the source reference on plot.ly for + family . + size + + sizesrc + Sets the source reference on plot.ly for size + . + + Returns + ------- + plotly.graph_objs.isosurface.hoverlabel.Font + """ + return self['font'] + + @font.setter + def font(self, val): + self['font'] = val + + # namelength + # ---------- + @property + def namelength(self): + """ + Sets the length (in number of characters) of the trace name in + the hover labels for this trace. -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. + + The 'namelength' property is a integer and may be specified as: + - An int (or float that will be cast to an int) + in the interval [-1, 9223372036854775807] + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + int|numpy.ndarray + """ + return self['namelength'] + + @namelength.setter + def namelength(self, val): + self['namelength'] = val + + # namelengthsrc + # ------------- + @property + def namelengthsrc(self): + """ + Sets the source reference on plot.ly for namelength . + + The 'namelengthsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['namelengthsrc'] + + @namelengthsrc.setter + def namelengthsrc(self, val): + self['namelengthsrc'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + bgcolor + Sets the background color of the hover labels for this + trace + bgcolorsrc + Sets the source reference on plot.ly for bgcolor . + bordercolor + Sets the border color of the hover labels for this + trace. + bordercolorsrc + Sets the source reference on plot.ly for bordercolor . + font + Sets the font used in hover labels. + namelength + Sets the length (in number of characters) of the trace + name in the hover labels for this trace. -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. + namelengthsrc + Sets the source reference on plot.ly for namelength . + """ + + def __init__( + self, + arg=None, + bgcolor=None, + bgcolorsrc=None, + bordercolor=None, + bordercolorsrc=None, + font=None, + namelength=None, + namelengthsrc=None, + **kwargs + ): + """ + Construct a new Hoverlabel object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Hoverlabel + bgcolor + Sets the background color of the hover labels for this + trace + bgcolorsrc + Sets the source reference on plot.ly for bgcolor . + bordercolor + Sets the border color of the hover labels for this + trace. + bordercolorsrc + Sets the source reference on plot.ly for bordercolor . + font + Sets the font used in hover labels. + namelength + Sets the length (in number of characters) of the trace + name in the hover labels for this trace. -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. + namelengthsrc + Sets the source reference on plot.ly for namelength . + + Returns + ------- + Hoverlabel + """ + super(Hoverlabel, self).__init__('hoverlabel') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Hoverlabel +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Hoverlabel""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (hoverlabel as v_hoverlabel) + + # Initialize validators + # --------------------- + self._validators['bgcolor'] = v_hoverlabel.BgcolorValidator() + self._validators['bgcolorsrc'] = v_hoverlabel.BgcolorsrcValidator() + self._validators['bordercolor'] = v_hoverlabel.BordercolorValidator() + self._validators['bordercolorsrc' + ] = v_hoverlabel.BordercolorsrcValidator() + self._validators['font'] = v_hoverlabel.FontValidator() + self._validators['namelength'] = v_hoverlabel.NamelengthValidator() + self._validators['namelengthsrc' + ] = v_hoverlabel.NamelengthsrcValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('bgcolor', None) + self['bgcolor'] = bgcolor if bgcolor is not None else _v + _v = arg.pop('bgcolorsrc', None) + self['bgcolorsrc'] = bgcolorsrc if bgcolorsrc is not None else _v + _v = arg.pop('bordercolor', None) + self['bordercolor'] = bordercolor if bordercolor is not None else _v + _v = arg.pop('bordercolorsrc', None) + self['bordercolorsrc' + ] = bordercolorsrc if bordercolorsrc is not None else _v + _v = arg.pop('font', None) + self['font'] = font if font is not None else _v + _v = arg.pop('namelength', None) + self['namelength'] = namelength if namelength is not None else _v + _v = arg.pop('namelengthsrc', None) + self['namelengthsrc' + ] = namelengthsrc if namelengthsrc is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -0,0 +1,14 @@ +from ._surface import Surface +from ._stream import Stream +from ._spaceframe import Spaceframe +from ._slices import Slices +from plotly.graph_objs.isosurface import slices +from ._lightposition import Lightposition +from ._lighting import Lighting +from ._hoverlabel import Hoverlabel +from plotly.graph_objs.isosurface import hoverlabel +from ._contour import Contour +from ._colorbar import ColorBar +from plotly.graph_objs.isosurface import colorbar +from ._caps import Caps +from plotly.graph_objs.isosurface import caps diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_lighting.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_lighting.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_lighting.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_lighting.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,303 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Lighting(BaseTraceHierarchyType): + + # ambient + # ------- + @property + def ambient(self): + """ + Ambient light increases overall color visibility but can wash + out the image. + + The 'ambient' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['ambient'] + + @ambient.setter + def ambient(self, val): + self['ambient'] = val + + # diffuse + # ------- + @property + def diffuse(self): + """ + Represents the extent that incident rays are reflected in a + range of angles. + + The 'diffuse' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['diffuse'] + + @diffuse.setter + def diffuse(self, val): + self['diffuse'] = val + + # facenormalsepsilon + # ------------------ + @property + def facenormalsepsilon(self): + """ + Epsilon for face normals calculation avoids math issues arising + from degenerate geometry. + + The 'facenormalsepsilon' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['facenormalsepsilon'] + + @facenormalsepsilon.setter + def facenormalsepsilon(self, val): + self['facenormalsepsilon'] = val + + # fresnel + # ------- + @property + def fresnel(self): + """ + Represents the reflectance as a dependency of the viewing + angle; e.g. paper is reflective when viewing it from the edge + of the paper (almost 90 degrees), causing shine. + + The 'fresnel' property is a number and may be specified as: + - An int or float in the interval [0, 5] + + Returns + ------- + int|float + """ + return self['fresnel'] + + @fresnel.setter + def fresnel(self, val): + self['fresnel'] = val + + # roughness + # --------- + @property + def roughness(self): + """ + Alters specular reflection; the rougher the surface, the wider + and less contrasty the shine. + + The 'roughness' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['roughness'] + + @roughness.setter + def roughness(self, val): + self['roughness'] = val + + # specular + # -------- + @property + def specular(self): + """ + Represents the level that incident rays are reflected in a + single direction, causing shine. + + The 'specular' property is a number and may be specified as: + - An int or float in the interval [0, 2] + + Returns + ------- + int|float + """ + return self['specular'] + + @specular.setter + def specular(self, val): + self['specular'] = val + + # vertexnormalsepsilon + # -------------------- + @property + def vertexnormalsepsilon(self): + """ + Epsilon for vertex normals calculation avoids math issues + arising from degenerate geometry. + + The 'vertexnormalsepsilon' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['vertexnormalsepsilon'] + + @vertexnormalsepsilon.setter + def vertexnormalsepsilon(self, val): + self['vertexnormalsepsilon'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + ambient + Ambient light increases overall color visibility but + can wash out the image. + diffuse + Represents the extent that incident rays are reflected + in a range of angles. + facenormalsepsilon + Epsilon for face normals calculation avoids math issues + arising from degenerate geometry. + fresnel + Represents the reflectance as a dependency of the + viewing angle; e.g. paper is reflective when viewing it + from the edge of the paper (almost 90 degrees), causing + shine. + roughness + Alters specular reflection; the rougher the surface, + the wider and less contrasty the shine. + specular + Represents the level that incident rays are reflected + in a single direction, causing shine. + vertexnormalsepsilon + Epsilon for vertex normals calculation avoids math + issues arising from degenerate geometry. + """ + + def __init__( + self, + arg=None, + ambient=None, + diffuse=None, + facenormalsepsilon=None, + fresnel=None, + roughness=None, + specular=None, + vertexnormalsepsilon=None, + **kwargs + ): + """ + Construct a new Lighting object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Lighting + ambient + Ambient light increases overall color visibility but + can wash out the image. + diffuse + Represents the extent that incident rays are reflected + in a range of angles. + facenormalsepsilon + Epsilon for face normals calculation avoids math issues + arising from degenerate geometry. + fresnel + Represents the reflectance as a dependency of the + viewing angle; e.g. paper is reflective when viewing it + from the edge of the paper (almost 90 degrees), causing + shine. + roughness + Alters specular reflection; the rougher the surface, + the wider and less contrasty the shine. + specular + Represents the level that incident rays are reflected + in a single direction, causing shine. + vertexnormalsepsilon + Epsilon for vertex normals calculation avoids math + issues arising from degenerate geometry. + + Returns + ------- + Lighting + """ + super(Lighting, self).__init__('lighting') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Lighting +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Lighting""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (lighting as v_lighting) + + # Initialize validators + # --------------------- + self._validators['ambient'] = v_lighting.AmbientValidator() + self._validators['diffuse'] = v_lighting.DiffuseValidator() + self._validators['facenormalsepsilon' + ] = v_lighting.FacenormalsepsilonValidator() + self._validators['fresnel'] = v_lighting.FresnelValidator() + self._validators['roughness'] = v_lighting.RoughnessValidator() + self._validators['specular'] = v_lighting.SpecularValidator() + self._validators['vertexnormalsepsilon' + ] = v_lighting.VertexnormalsepsilonValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('ambient', None) + self['ambient'] = ambient if ambient is not None else _v + _v = arg.pop('diffuse', None) + self['diffuse'] = diffuse if diffuse is not None else _v + _v = arg.pop('facenormalsepsilon', None) + self['facenormalsepsilon' + ] = facenormalsepsilon if facenormalsepsilon is not None else _v + _v = arg.pop('fresnel', None) + self['fresnel'] = fresnel if fresnel is not None else _v + _v = arg.pop('roughness', None) + self['roughness'] = roughness if roughness is not None else _v + _v = arg.pop('specular', None) + self['specular'] = specular if specular is not None else _v + _v = arg.pop('vertexnormalsepsilon', None) + self[ + 'vertexnormalsepsilon' + ] = vertexnormalsepsilon if vertexnormalsepsilon is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_lightposition.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_lightposition.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_lightposition.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_lightposition.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,162 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Lightposition(BaseTraceHierarchyType): + + # x + # - + @property + def x(self): + """ + Numeric vector, representing the X coordinate for each vertex. + + The 'x' property is a number and may be specified as: + - An int or float in the interval [-100000, 100000] + + Returns + ------- + int|float + """ + return self['x'] + + @x.setter + def x(self, val): + self['x'] = val + + # y + # - + @property + def y(self): + """ + Numeric vector, representing the Y coordinate for each vertex. + + The 'y' property is a number and may be specified as: + - An int or float in the interval [-100000, 100000] + + Returns + ------- + int|float + """ + return self['y'] + + @y.setter + def y(self, val): + self['y'] = val + + # z + # - + @property + def z(self): + """ + Numeric vector, representing the Z coordinate for each vertex. + + The 'z' property is a number and may be specified as: + - An int or float in the interval [-100000, 100000] + + Returns + ------- + int|float + """ + return self['z'] + + @z.setter + def z(self, val): + self['z'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + x + Numeric vector, representing the X coordinate for each + vertex. + y + Numeric vector, representing the Y coordinate for each + vertex. + z + Numeric vector, representing the Z coordinate for each + vertex. + """ + + def __init__(self, arg=None, x=None, y=None, z=None, **kwargs): + """ + Construct a new Lightposition object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of + plotly.graph_objs.isosurface.Lightposition + x + Numeric vector, representing the X coordinate for each + vertex. + y + Numeric vector, representing the Y coordinate for each + vertex. + z + Numeric vector, representing the Z coordinate for each + vertex. + + Returns + ------- + Lightposition + """ + super(Lightposition, self).__init__('lightposition') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Lightposition +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Lightposition""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import ( + lightposition as v_lightposition + ) + + # Initialize validators + # --------------------- + self._validators['x'] = v_lightposition.XValidator() + self._validators['y'] = v_lightposition.YValidator() + self._validators['z'] = v_lightposition.ZValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('x', None) + self['x'] = x if x is not None else _v + _v = arg.pop('y', None) + self['y'] = y if y is not None else _v + _v = arg.pop('z', None) + self['z'] = z if z is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -0,0 +1,3 @@ +from ._z import Z +from ._y import Y +from ._x import X diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/_x.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/_x.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/_x.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,208 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class X(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `slices`. The default fill value of + the `slices` is 1 meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than one would allow + the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # locations + # --------- + @property + def locations(self): + """ + Specifies the location(s) of slices on the axis. When not + locations specified slices would be created for all points of + the axis x except start and end. + + The 'locations' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['locations'] + + @locations.setter + def locations(self, val): + self['locations'] = val + + # locationssrc + # ------------ + @property + def locationssrc(self): + """ + Sets the source reference on plot.ly for locations . + + The 'locationssrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['locationssrc'] + + @locationssrc.setter + def locationssrc(self, val): + self['locationssrc'] = val + + # show + # ---- + @property + def show(self): + """ + Determines whether or not slice planes about the x dimension + are drawn. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.slices' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `slices`. The default fill + value of the `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + locations + Specifies the location(s) of slices on the axis. When + not locations specified slices would be created for all + points of the axis x except start and end. + locationssrc + Sets the source reference on plot.ly for locations . + show + Determines whether or not slice planes about the x + dimension are drawn. + """ + + def __init__( + self, + arg=None, + fill=None, + locations=None, + locationssrc=None, + show=None, + **kwargs + ): + """ + Construct a new X object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.slices.X + fill + Sets the fill ratio of the `slices`. The default fill + value of the `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + locations + Specifies the location(s) of slices on the axis. When + not locations specified slices would be created for all + points of the axis x except start and end. + locationssrc + Sets the source reference on plot.ly for locations . + show + Determines whether or not slice planes about the x + dimension are drawn. + + Returns + ------- + X + """ + super(X, self).__init__('x') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.slices.X +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.slices.X""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.slices import (x as v_x) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_x.FillValidator() + self._validators['locations'] = v_x.LocationsValidator() + self._validators['locationssrc'] = v_x.LocationssrcValidator() + self._validators['show'] = v_x.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('locations', None) + self['locations'] = locations if locations is not None else _v + _v = arg.pop('locationssrc', None) + self['locationssrc'] = locationssrc if locationssrc is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/_y.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/_y.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/_y.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,208 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Y(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `slices`. The default fill value of + the `slices` is 1 meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than one would allow + the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # locations + # --------- + @property + def locations(self): + """ + Specifies the location(s) of slices on the axis. When not + locations specified slices would be created for all points of + the axis y except start and end. + + The 'locations' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['locations'] + + @locations.setter + def locations(self, val): + self['locations'] = val + + # locationssrc + # ------------ + @property + def locationssrc(self): + """ + Sets the source reference on plot.ly for locations . + + The 'locationssrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['locationssrc'] + + @locationssrc.setter + def locationssrc(self, val): + self['locationssrc'] = val + + # show + # ---- + @property + def show(self): + """ + Determines whether or not slice planes about the y dimension + are drawn. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.slices' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `slices`. The default fill + value of the `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + locations + Specifies the location(s) of slices on the axis. When + not locations specified slices would be created for all + points of the axis y except start and end. + locationssrc + Sets the source reference on plot.ly for locations . + show + Determines whether or not slice planes about the y + dimension are drawn. + """ + + def __init__( + self, + arg=None, + fill=None, + locations=None, + locationssrc=None, + show=None, + **kwargs + ): + """ + Construct a new Y object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.slices.Y + fill + Sets the fill ratio of the `slices`. The default fill + value of the `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + locations + Specifies the location(s) of slices on the axis. When + not locations specified slices would be created for all + points of the axis y except start and end. + locationssrc + Sets the source reference on plot.ly for locations . + show + Determines whether or not slice planes about the y + dimension are drawn. + + Returns + ------- + Y + """ + super(Y, self).__init__('y') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.slices.Y +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.slices.Y""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.slices import (y as v_y) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_y.FillValidator() + self._validators['locations'] = v_y.LocationsValidator() + self._validators['locationssrc'] = v_y.LocationssrcValidator() + self._validators['show'] = v_y.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('locations', None) + self['locations'] = locations if locations is not None else _v + _v = arg.pop('locationssrc', None) + self['locationssrc'] = locationssrc if locationssrc is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/_z.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/_z.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/slices/_z.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/slices/_z.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,208 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Z(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `slices`. The default fill value of + the `slices` is 1 meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than one would allow + the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # locations + # --------- + @property + def locations(self): + """ + Specifies the location(s) of slices on the axis. When not + locations specified slices would be created for all points of + the axis z except start and end. + + The 'locations' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['locations'] + + @locations.setter + def locations(self, val): + self['locations'] = val + + # locationssrc + # ------------ + @property + def locationssrc(self): + """ + Sets the source reference on plot.ly for locations . + + The 'locationssrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['locationssrc'] + + @locationssrc.setter + def locationssrc(self, val): + self['locationssrc'] = val + + # show + # ---- + @property + def show(self): + """ + Determines whether or not slice planes about the z dimension + are drawn. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface.slices' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `slices`. The default fill + value of the `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + locations + Specifies the location(s) of slices on the axis. When + not locations specified slices would be created for all + points of the axis z except start and end. + locationssrc + Sets the source reference on plot.ly for locations . + show + Determines whether or not slice planes about the z + dimension are drawn. + """ + + def __init__( + self, + arg=None, + fill=None, + locations=None, + locationssrc=None, + show=None, + **kwargs + ): + """ + Construct a new Z object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.slices.Z + fill + Sets the fill ratio of the `slices`. The default fill + value of the `slices` is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + locations + Specifies the location(s) of slices on the axis. When + not locations specified slices would be created for all + points of the axis z except start and end. + locationssrc + Sets the source reference on plot.ly for locations . + show + Determines whether or not slice planes about the z + dimension are drawn. + + Returns + ------- + Z + """ + super(Z, self).__init__('z') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.slices.Z +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.slices.Z""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface.slices import (z as v_z) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_z.FillValidator() + self._validators['locations'] = v_z.LocationsValidator() + self._validators['locationssrc'] = v_z.LocationssrcValidator() + self._validators['show'] = v_z.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('locations', None) + self['locations'] = locations if locations is not None else _v + _v = arg.pop('locationssrc', None) + self['locationssrc'] = locationssrc if locationssrc is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_slices.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_slices.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_slices.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_slices.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,225 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Slices(BaseTraceHierarchyType): + + # x + # - + @property + def x(self): + """ + The 'x' property is an instance of X + that may be specified as: + - An instance of plotly.graph_objs.isosurface.slices.X + - A dict of string/value properties that will be passed + to the X constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `slices`. The + default fill value of the `slices` is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + locations + Specifies the location(s) of slices on the + axis. When not locations specified slices would + be created for all points of the axis x except + start and end. + locationssrc + Sets the source reference on plot.ly for + locations . + show + Determines whether or not slice planes about + the x dimension are drawn. + + Returns + ------- + plotly.graph_objs.isosurface.slices.X + """ + return self['x'] + + @x.setter + def x(self, val): + self['x'] = val + + # y + # - + @property + def y(self): + """ + The 'y' property is an instance of Y + that may be specified as: + - An instance of plotly.graph_objs.isosurface.slices.Y + - A dict of string/value properties that will be passed + to the Y constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `slices`. The + default fill value of the `slices` is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + locations + Specifies the location(s) of slices on the + axis. When not locations specified slices would + be created for all points of the axis y except + start and end. + locationssrc + Sets the source reference on plot.ly for + locations . + show + Determines whether or not slice planes about + the y dimension are drawn. + + Returns + ------- + plotly.graph_objs.isosurface.slices.Y + """ + return self['y'] + + @y.setter + def y(self, val): + self['y'] = val + + # z + # - + @property + def z(self): + """ + The 'z' property is an instance of Z + that may be specified as: + - An instance of plotly.graph_objs.isosurface.slices.Z + - A dict of string/value properties that will be passed + to the Z constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `slices`. The + default fill value of the `slices` is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + locations + Specifies the location(s) of slices on the + axis. When not locations specified slices would + be created for all points of the axis z except + start and end. + locationssrc + Sets the source reference on plot.ly for + locations . + show + Determines whether or not slice planes about + the z dimension are drawn. + + Returns + ------- + plotly.graph_objs.isosurface.slices.Z + """ + return self['z'] + + @z.setter + def z(self, val): + self['z'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + x + plotly.graph_objs.isosurface.slices.X instance or dict + with compatible properties + y + plotly.graph_objs.isosurface.slices.Y instance or dict + with compatible properties + z + plotly.graph_objs.isosurface.slices.Z instance or dict + with compatible properties + """ + + def __init__(self, arg=None, x=None, y=None, z=None, **kwargs): + """ + Construct a new Slices object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Slices + x + plotly.graph_objs.isosurface.slices.X instance or dict + with compatible properties + y + plotly.graph_objs.isosurface.slices.Y instance or dict + with compatible properties + z + plotly.graph_objs.isosurface.slices.Z instance or dict + with compatible properties + + Returns + ------- + Slices + """ + super(Slices, self).__init__('slices') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Slices +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Slices""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (slices as v_slices) + + # Initialize validators + # --------------------- + self._validators['x'] = v_slices.XValidator() + self._validators['y'] = v_slices.YValidator() + self._validators['z'] = v_slices.ZValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('x', None) + self['x'] = x if x is not None else _v + _v = arg.pop('y', None) + self['y'] = y if y is not None else _v + _v = arg.pop('z', None) + self['z'] = z if z is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_spaceframe.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_spaceframe.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_spaceframe.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_spaceframe.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,148 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Spaceframe(BaseTraceHierarchyType): + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the `spaceframe` elements. The default + fill value is 0.15 meaning that only 15% of the area of every + faces of tetras would be shaded. Applying a greater `fill` + ratio would allow the creation of stronger elements or could be + sued to have entirely closed areas (in case of using 1). + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # show + # ---- + @property + def show(self): + """ + Displays/hides tetrahedron shapes between minimum and maximum + iso-values. Often useful when either caps or surfaces are + disabled or filled with values less than 1. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + fill + Sets the fill ratio of the `spaceframe` elements. The + default fill value is 0.15 meaning that only 15% of the + area of every faces of tetras would be shaded. Applying + a greater `fill` ratio would allow the creation of + stronger elements or could be sued to have entirely + closed areas (in case of using 1). + show + Displays/hides tetrahedron shapes between minimum and + maximum iso-values. Often useful when either caps or + surfaces are disabled or filled with values less than + 1. + """ + + def __init__(self, arg=None, fill=None, show=None, **kwargs): + """ + Construct a new Spaceframe object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Spaceframe + fill + Sets the fill ratio of the `spaceframe` elements. The + default fill value is 0.15 meaning that only 15% of the + area of every faces of tetras would be shaded. Applying + a greater `fill` ratio would allow the creation of + stronger elements or could be sued to have entirely + closed areas (in case of using 1). + show + Displays/hides tetrahedron shapes between minimum and + maximum iso-values. Often useful when either caps or + surfaces are disabled or filled with values less than + 1. + + Returns + ------- + Spaceframe + """ + super(Spaceframe, self).__init__('spaceframe') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Spaceframe +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Spaceframe""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (spaceframe as v_spaceframe) + + # Initialize validators + # --------------------- + self._validators['fill'] = v_spaceframe.FillValidator() + self._validators['show'] = v_spaceframe.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_stream.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_stream.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_stream.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_stream.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,139 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Stream(BaseTraceHierarchyType): + + # maxpoints + # --------- + @property + def maxpoints(self): + """ + 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. + + The 'maxpoints' property is a number and may be specified as: + - An int or float in the interval [0, 10000] + + Returns + ------- + int|float + """ + return self['maxpoints'] + + @maxpoints.setter + def maxpoints(self, val): + self['maxpoints'] = val + + # token + # ----- + @property + def token(self): + """ + The stream id number links a data trace on a plot with a + stream. See https://plot.ly/settings for more details. + + The 'token' property is a string and must be specified as: + - A non-empty string + + Returns + ------- + str + """ + return self['token'] + + @token.setter + def token(self, val): + self['token'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + maxpoints + 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. + token + The stream id number links a data trace on a plot with + a stream. See https://plot.ly/settings for more + details. + """ + + def __init__(self, arg=None, maxpoints=None, token=None, **kwargs): + """ + Construct a new Stream object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Stream + maxpoints + 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. + token + The stream id number links a data trace on a plot with + a stream. See https://plot.ly/settings for more + details. + + Returns + ------- + Stream + """ + super(Stream, self).__init__('stream') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Stream +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Stream""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (stream as v_stream) + + # Initialize validators + # --------------------- + self._validators['maxpoints'] = v_stream.MaxpointsValidator() + self._validators['token'] = v_stream.TokenValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('maxpoints', None) + self['maxpoints'] = maxpoints if maxpoints is not None else _v + _v = arg.pop('token', None) + self['token'] = token if token is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_surface.py plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_surface.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/isosurface/_surface.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/isosurface/_surface.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,233 @@ +from plotly.basedatatypes import BaseTraceHierarchyType +import copy + + +class Surface(BaseTraceHierarchyType): + + # count + # ----- + @property + def count(self): + """ + Sets the number of iso-surfaces between minimum and maximum + iso-values. By default this value is 2 meaning that only + minimum and maximum surfaces would be drawn. + + The 'count' property is a integer and may be specified as: + - An int (or float that will be cast to an int) + in the interval [1, 9223372036854775807] + + Returns + ------- + int + """ + return self['count'] + + @count.setter + def count(self, val): + self['count'] = val + + # fill + # ---- + @property + def fill(self): + """ + Sets the fill ratio of the iso-surface. The default fill value + of the surface is 1 meaning that they are entirely shaded. On + the other hand Applying a `fill` ratio less than one would + allow the creation of openings parallel to the edges. + + The 'fill' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['fill'] + + @fill.setter + def fill(self, val): + self['fill'] = val + + # pattern + # ------- + @property + def pattern(self): + """ + Sets the surface pattern of the iso-surface 3-D sections. The + default pattern of the surface is `all` meaning that the rest + of surface elements would be shaded. The check options (either + 1 or 2) could be used to draw half of the squares on the + surface. Using various combinations of capital `A`, `B`, `C`, + `D` and `E` may also be used to reduce the number of triangles + on the iso-surfaces and creating other patterns of interest. + + The 'pattern' property is a flaglist and may be specified + as a string containing: + - Any combination of ['A', 'B', 'C', 'D', 'E'] joined with '+' characters + (e.g. 'A+B') + OR exactly one of ['all', 'odd', 'even'] (e.g. 'even') + + Returns + ------- + Any + """ + return self['pattern'] + + @pattern.setter + def pattern(self, val): + self['pattern'] = val + + # show + # ---- + @property + def show(self): + """ + Hides/displays surfaces between minimum and maximum iso-values. + + The 'show' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['show'] + + @show.setter + def show(self, val): + self['show'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'isosurface' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + count + Sets the number of iso-surfaces between minimum and + maximum iso-values. By default this value is 2 meaning + that only minimum and maximum surfaces would be drawn. + fill + Sets the fill ratio of the iso-surface. The default + fill value of the surface is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + pattern + Sets the surface pattern of the iso-surface 3-D + sections. The default pattern of the surface is `all` + meaning that the rest of surface elements would be + shaded. The check options (either 1 or 2) could be used + to draw half of the squares on the surface. Using + various combinations of capital `A`, `B`, `C`, `D` and + `E` may also be used to reduce the number of triangles + on the iso-surfaces and creating other patterns of + interest. + show + Hides/displays surfaces between minimum and maximum + iso-values. + """ + + def __init__( + self, + arg=None, + count=None, + fill=None, + pattern=None, + show=None, + **kwargs + ): + """ + Construct a new Surface object + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.isosurface.Surface + count + Sets the number of iso-surfaces between minimum and + maximum iso-values. By default this value is 2 meaning + that only minimum and maximum surfaces would be drawn. + fill + Sets the fill ratio of the iso-surface. The default + fill value of the surface is 1 meaning that they are + entirely shaded. On the other hand Applying a `fill` + ratio less than one would allow the creation of + openings parallel to the edges. + pattern + Sets the surface pattern of the iso-surface 3-D + sections. The default pattern of the surface is `all` + meaning that the rest of surface elements would be + shaded. The check options (either 1 or 2) could be used + to draw half of the squares on the surface. Using + various combinations of capital `A`, `B`, `C`, `D` and + `E` may also be used to reduce the number of triangles + on the iso-surfaces and creating other patterns of + interest. + show + Hides/displays surfaces between minimum and maximum + iso-values. + + Returns + ------- + Surface + """ + super(Surface, self).__init__('surface') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.isosurface.Surface +constructor must be a dict or +an instance of plotly.graph_objs.isosurface.Surface""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.isosurface import (surface as v_surface) + + # Initialize validators + # --------------------- + self._validators['count'] = v_surface.CountValidator() + self._validators['fill'] = v_surface.FillValidator() + self._validators['pattern'] = v_surface.PatternValidator() + self._validators['show'] = v_surface.ShowValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('count', None) + self['count'] = count if count is not None else _v + _v = arg.pop('fill', None) + self['fill'] = fill if fill is not None else _v + _v = arg.pop('pattern', None) + self['pattern'] = pattern if pattern is not None else _v + _v = arg.pop('show', None) + self['show'] = show if show is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_isosurface.py plotly-3.6.1+dfsg1/plotly/graph_objs/_isosurface.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_isosurface.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_isosurface.py 2019-02-08 23:00:38.000000000 +0000 @@ -0,0 +1,1992 @@ +from plotly.basedatatypes import BaseTraceType +import copy + + +class Isosurface(BaseTraceType): + + # autocolorscale + # -------------- + @property + def autocolorscale(self): + """ + Determines whether the colorscale is a default palette + (`autocolorscale: true`) or the palette determined by + `colorscale`. 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. + + The 'autocolorscale' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['autocolorscale'] + + @autocolorscale.setter + def autocolorscale(self, val): + self['autocolorscale'] = val + + # caps + # ---- + @property + def caps(self): + """ + The 'caps' property is an instance of Caps + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Caps + - A dict of string/value properties that will be passed + to the Caps constructor + + Supported dict properties: + + x + plotly.graph_objs.isosurface.caps.X instance or + dict with compatible properties + y + plotly.graph_objs.isosurface.caps.Y instance or + dict with compatible properties + z + plotly.graph_objs.isosurface.caps.Z instance or + dict with compatible properties + + Returns + ------- + plotly.graph_objs.isosurface.Caps + """ + return self['caps'] + + @caps.setter + def caps(self, val): + self['caps'] = val + + # cauto + # ----- + @property + def cauto(self): + """ + Determines whether or not the color domain is computed with + respect to the input data (here `value`) or the bounds set in + `cmin` and `cmax` Defaults to `false` when `cmin` and `cmax` + are set by the user. + + The 'cauto' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['cauto'] + + @cauto.setter + def cauto(self, val): + self['cauto'] = val + + # cmax + # ---- + @property + def cmax(self): + """ + Sets the upper bound of the color domain. Value should have the + same units as `value` and if set, `cmin` must be set as well. + + The 'cmax' property is a number and may be specified as: + - An int or float + + Returns + ------- + int|float + """ + return self['cmax'] + + @cmax.setter + def cmax(self, val): + self['cmax'] = val + + # cmin + # ---- + @property + def cmin(self): + """ + Sets the lower bound of the color domain. Value should have the + same units as `value` and if set, `cmax` must be set as well. + + The 'cmin' property is a number and may be specified as: + - An int or float + + Returns + ------- + int|float + """ + return self['cmin'] + + @cmin.setter + def cmin(self, val): + self['cmin'] = val + + # colorbar + # -------- + @property + def colorbar(self): + """ + The 'colorbar' property is an instance of ColorBar + that may be specified as: + - An instance of plotly.graph_objs.isosurface.ColorBar + - A dict of string/value properties that will be passed + to the ColorBar constructor + + Supported dict properties: + + bgcolor + Sets the color of padded area. + bordercolor + Sets the axis line color. + borderwidth + Sets the width (in px) or the border enclosing + this color bar. + dtick + 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" + exponentformat + 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. + len + 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. + lenmode + 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. + nticks + 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". + outlinecolor + Sets the axis line color. + outlinewidth + Sets the width (in px) of the axis line. + separatethousands + If "true", even 4-digit integers are separated + showexponent + 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. + showticklabels + Determines whether or not the tick labels are + drawn. + showtickprefix + 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. + showticksuffix + Same as `showtickprefix` but for tick suffixes. + thickness + Sets the thickness of the color bar This + measure excludes the size of the padding, ticks + and labels. + thicknessmode + 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. + tick0 + 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. + tickangle + Sets the angle of the tick labels with respect + to the horizontal. For example, a `tickangle` + of -90 draws the tick labels vertically. + tickcolor + Sets the tick color. + tickfont + Sets the color bar's tick label font + tickformat + Sets the tick label formatting rule using d3 + formatting mini-languages which are very + similar to those in Python. For numbers, see: h + ttps://github.com/d3/d3-format/blob/master/READ + ME.md#locale_format And for dates see: + https://github.com/d3/d3-time- + format/blob/master/README.md#locale_format We + add one item to d3's date formatter: "%{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" + tickformatstops + plotly.graph_objs.isosurface.colorbar.Tickforma + tstop instance or dict with compatible + properties + tickformatstopdefaults + When used in a template (as layout.template.dat + a.isosurface.colorbar.tickformatstopdefaults), + sets the default property values to use for + elements of isosurface.colorbar.tickformatstops + ticklen + Sets the tick length (in px). + tickmode + 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). + tickprefix + Sets a tick label prefix. + ticks + 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. + ticksuffix + Sets a tick label suffix. + ticktext + Sets the text displayed at the ticks position + via `tickvals`. Only has an effect if + `tickmode` is set to "array". Used with + `tickvals`. + ticktextsrc + Sets the source reference on plot.ly for + ticktext . + tickvals + Sets the values at which ticks on this axis + appear. Only has an effect if `tickmode` is set + to "array". Used with `ticktext`. + tickvalssrc + Sets the source reference on plot.ly for + tickvals . + tickwidth + Sets the tick width (in px). + title + plotly.graph_objs.isosurface.colorbar.Title + instance or dict with compatible properties + titlefont + Deprecated: Please use + isosurface.colorbar.title.font instead. Sets + this color bar's title font. Note that the + title's font used to be set by the now + deprecated `titlefont` attribute. + titleside + Deprecated: Please use + isosurface.colorbar.title.side instead. + Determines the location of color bar's title + with respect to the color bar. Note that the + title's location used to be set by the now + deprecated `titleside` attribute. + x + Sets the x position of the color bar (in plot + fraction). + xanchor + Sets this color bar's horizontal position + anchor. This anchor binds the `x` position to + the "left", "center" or "right" of the color + bar. + xpad + Sets the amount of padding (in px) along the x + direction. + y + Sets the y position of the color bar (in plot + fraction). + yanchor + Sets this color bar's vertical position anchor + This anchor binds the `y` position to the + "top", "middle" or "bottom" of the color bar. + ypad + Sets the amount of padding (in px) along the y + direction. + + Returns + ------- + plotly.graph_objs.isosurface.ColorBar + """ + return self['colorbar'] + + @colorbar.setter + def colorbar(self, val): + self['colorbar'] = val + + # colorscale + # ---------- + @property + def colorscale(self): + """ + Sets the colorscale. 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`cmin` and `cmax`. + Alternatively, `colorscale` may be a palette name string of the + following list: Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Bl + ues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,Earth,Electric,Vi + ridis,Cividis. + + The 'colorscale' property is a colorscale and may be + specified as: + - A list of 2-element lists 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. + (e.g. [[0, 'green'], [0.5, 'red'], [1.0, 'rgb(0, 0, 255)']]) + - One of the following named colorscales: + ['Greys', 'YlGnBu', 'Greens', 'YlOrRd', 'Bluered', 'RdBu', + 'Reds', 'Blues', 'Picnic', 'Rainbow', 'Portland', 'Jet', + 'Hot', 'Blackbody', 'Earth', 'Electric', 'Viridis', 'Cividis'] + + Returns + ------- + str + """ + return self['colorscale'] + + @colorscale.setter + def colorscale(self, val): + self['colorscale'] = val + + # contour + # ------- + @property + def contour(self): + """ + The 'contour' property is an instance of Contour + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Contour + - A dict of string/value properties that will be passed + to the Contour constructor + + Supported dict properties: + + color + Sets the color of the contour lines. + show + Sets whether or not dynamic contours are shown + on hover. Contours are more useful when + hovering on caps and slices. + width + Sets the width of the contour lines. + + Returns + ------- + plotly.graph_objs.isosurface.Contour + """ + return self['contour'] + + @contour.setter + def contour(self, val): + self['contour'] = val + + # customdata + # ---------- + @property + def customdata(self): + """ + 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 + + The 'customdata' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['customdata'] + + @customdata.setter + def customdata(self, val): + self['customdata'] = val + + # customdatasrc + # ------------- + @property + def customdatasrc(self): + """ + Sets the source reference on plot.ly for customdata . + + The 'customdatasrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['customdatasrc'] + + @customdatasrc.setter + def customdatasrc(self, val): + self['customdatasrc'] = val + + # flatshading + # ----------- + @property + def flatshading(self): + """ + Determines whether or not normal smoothing is applied to the + isosurfaces, creating isosurfaces with an angular, low-poly + look via flat reflections. + + The 'flatshading' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['flatshading'] + + @flatshading.setter + def flatshading(self, val): + self['flatshading'] = val + + # hoverinfo + # --------- + @property + def hoverinfo(self): + """ + 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. + + The 'hoverinfo' property is a flaglist and may be specified + as a string containing: + - Any combination of ['x', 'y', 'z', 'text', 'name'] joined with '+' characters + (e.g. 'x+y') + OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip') + - A list or array of the above + + Returns + ------- + Any|numpy.ndarray + """ + return self['hoverinfo'] + + @hoverinfo.setter + def hoverinfo(self, val): + self['hoverinfo'] = val + + # hoverinfosrc + # ------------ + @property + def hoverinfosrc(self): + """ + Sets the source reference on plot.ly for hoverinfo . + + The 'hoverinfosrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hoverinfosrc'] + + @hoverinfosrc.setter + def hoverinfosrc(self, val): + self['hoverinfosrc'] = val + + # hoverlabel + # ---------- + @property + def hoverlabel(self): + """ + The 'hoverlabel' property is an instance of Hoverlabel + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Hoverlabel + - A dict of string/value properties that will be passed + to the Hoverlabel constructor + + Supported dict properties: + + bgcolor + Sets the background color of the hover labels + for this trace + bgcolorsrc + Sets the source reference on plot.ly for + bgcolor . + bordercolor + Sets the border color of the hover labels for + this trace. + bordercolorsrc + Sets the source reference on plot.ly for + bordercolor . + font + Sets the font used in hover labels. + namelength + Sets the length (in number of characters) of + the trace name in the hover labels for this + trace. -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. + namelengthsrc + Sets the source reference on plot.ly for + namelength . + + Returns + ------- + plotly.graph_objs.isosurface.Hoverlabel + """ + return self['hoverlabel'] + + @hoverlabel.setter + def hoverlabel(self, val): + self['hoverlabel'] = val + + # ids + # --- + @property + def ids(self): + """ + 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. + + The 'ids' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['ids'] + + @ids.setter + def ids(self, val): + self['ids'] = val + + # idssrc + # ------ + @property + def idssrc(self): + """ + Sets the source reference on plot.ly for ids . + + The 'idssrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['idssrc'] + + @idssrc.setter + def idssrc(self, val): + self['idssrc'] = val + + # isomax + # ------ + @property + def isomax(self): + """ + Sets the maximum boundary for iso-surface plot. + + The 'isomax' property is a number and may be specified as: + - An int or float + + Returns + ------- + int|float + """ + return self['isomax'] + + @isomax.setter + def isomax(self, val): + self['isomax'] = val + + # isomin + # ------ + @property + def isomin(self): + """ + Sets the minimum boundary for iso-surface plot. + + The 'isomin' property is a number and may be specified as: + - An int or float + + Returns + ------- + int|float + """ + return self['isomin'] + + @isomin.setter + def isomin(self, val): + self['isomin'] = val + + # legendgroup + # ----------- + @property + def legendgroup(self): + """ + Sets the legend group for this trace. Traces part of the same + legend group hide/show at the same time when toggling legend + items. + + The 'legendgroup' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['legendgroup'] + + @legendgroup.setter + def legendgroup(self, val): + self['legendgroup'] = val + + # lighting + # -------- + @property + def lighting(self): + """ + The 'lighting' property is an instance of Lighting + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Lighting + - A dict of string/value properties that will be passed + to the Lighting constructor + + Supported dict properties: + + ambient + Ambient light increases overall color + visibility but can wash out the image. + diffuse + Represents the extent that incident rays are + reflected in a range of angles. + facenormalsepsilon + Epsilon for face normals calculation avoids + math issues arising from degenerate geometry. + fresnel + Represents the reflectance as a dependency of + the viewing angle; e.g. paper is reflective + when viewing it from the edge of the paper + (almost 90 degrees), causing shine. + roughness + Alters specular reflection; the rougher the + surface, the wider and less contrasty the + shine. + specular + Represents the level that incident rays are + reflected in a single direction, causing shine. + vertexnormalsepsilon + Epsilon for vertex normals calculation avoids + math issues arising from degenerate geometry. + + Returns + ------- + plotly.graph_objs.isosurface.Lighting + """ + return self['lighting'] + + @lighting.setter + def lighting(self, val): + self['lighting'] = val + + # lightposition + # ------------- + @property + def lightposition(self): + """ + The 'lightposition' property is an instance of Lightposition + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Lightposition + - A dict of string/value properties that will be passed + to the Lightposition constructor + + Supported dict properties: + + x + Numeric vector, representing the X coordinate + for each vertex. + y + Numeric vector, representing the Y coordinate + for each vertex. + z + Numeric vector, representing the Z coordinate + for each vertex. + + Returns + ------- + plotly.graph_objs.isosurface.Lightposition + """ + return self['lightposition'] + + @lightposition.setter + def lightposition(self, val): + self['lightposition'] = val + + # name + # ---- + @property + def name(self): + """ + Sets the trace name. The trace name appear as the legend item + and on hover. + + The 'name' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['name'] + + @name.setter + def name(self, val): + self['name'] = val + + # opacity + # ------- + @property + def opacity(self): + """ + Sets the opacity of the trace. + + The 'opacity' property is a number and may be specified as: + - An int or float in the interval [0, 1] + + Returns + ------- + int|float + """ + return self['opacity'] + + @opacity.setter + def opacity(self, val): + self['opacity'] = val + + # reversescale + # ------------ + @property + def reversescale(self): + """ + Reverses the color mapping if true. If true, `cmin` will + correspond to the last color in the array and `cmax` will + correspond to the first color. + + The 'reversescale' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['reversescale'] + + @reversescale.setter + def reversescale(self, val): + self['reversescale'] = val + + # scene + # ----- + @property + def scene(self): + """ + Sets a reference between this trace's 3D coordinate system and + a 3D scene. If "scene" (the default value), the (x,y,z) + coordinates refer to `layout.scene`. If "scene2", the (x,y,z) + coordinates refer to `layout.scene2`, and so on. + + The 'scene' property is an identifier of a particular + subplot, of type 'scene', that may be specified as the string 'scene' + optionally followed by an integer >= 1 + (e.g. 'scene', 'scene1', 'scene2', 'scene3', etc.) + + Returns + ------- + str + """ + return self['scene'] + + @scene.setter + def scene(self, val): + self['scene'] = val + + # selectedpoints + # -------------- + @property + def selectedpoints(self): + """ + 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. + + The 'selectedpoints' property accepts values of any type + + Returns + ------- + Any + """ + return self['selectedpoints'] + + @selectedpoints.setter + def selectedpoints(self, val): + self['selectedpoints'] = val + + # showlegend + # ---------- + @property + def showlegend(self): + """ + Determines whether or not an item corresponding to this trace + is shown in the legend. + + The 'showlegend' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['showlegend'] + + @showlegend.setter + def showlegend(self, val): + self['showlegend'] = val + + # showscale + # --------- + @property + def showscale(self): + """ + Determines whether or not a colorbar is displayed for this + trace. + + The 'showscale' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['showscale'] + + @showscale.setter + def showscale(self, val): + self['showscale'] = val + + # slices + # ------ + @property + def slices(self): + """ + The 'slices' property is an instance of Slices + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Slices + - A dict of string/value properties that will be passed + to the Slices constructor + + Supported dict properties: + + x + plotly.graph_objs.isosurface.slices.X instance + or dict with compatible properties + y + plotly.graph_objs.isosurface.slices.Y instance + or dict with compatible properties + z + plotly.graph_objs.isosurface.slices.Z instance + or dict with compatible properties + + Returns + ------- + plotly.graph_objs.isosurface.Slices + """ + return self['slices'] + + @slices.setter + def slices(self, val): + self['slices'] = val + + # spaceframe + # ---------- + @property + def spaceframe(self): + """ + The 'spaceframe' property is an instance of Spaceframe + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Spaceframe + - A dict of string/value properties that will be passed + to the Spaceframe constructor + + Supported dict properties: + + fill + Sets the fill ratio of the `spaceframe` + elements. The default fill value is 0.15 + meaning that only 15% of the area of every + faces of tetras would be shaded. Applying a + greater `fill` ratio would allow the creation + of stronger elements or could be sued to have + entirely closed areas (in case of using 1). + show + Displays/hides tetrahedron shapes between + minimum and maximum iso-values. Often useful + when either caps or surfaces are disabled or + filled with values less than 1. + + Returns + ------- + plotly.graph_objs.isosurface.Spaceframe + """ + return self['spaceframe'] + + @spaceframe.setter + def spaceframe(self, val): + self['spaceframe'] = val + + # stream + # ------ + @property + def stream(self): + """ + The 'stream' property is an instance of Stream + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Stream + - A dict of string/value properties that will be passed + to the Stream constructor + + Supported dict properties: + + maxpoints + 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. + token + The stream id number links a data trace on a + plot with a stream. See + https://plot.ly/settings for more details. + + Returns + ------- + plotly.graph_objs.isosurface.Stream + """ + return self['stream'] + + @stream.setter + def stream(self, val): + self['stream'] = val + + # surface + # ------- + @property + def surface(self): + """ + The 'surface' property is an instance of Surface + that may be specified as: + - An instance of plotly.graph_objs.isosurface.Surface + - A dict of string/value properties that will be passed + to the Surface constructor + + Supported dict properties: + + count + Sets the number of iso-surfaces between minimum + and maximum iso-values. By default this value + is 2 meaning that only minimum and maximum + surfaces would be drawn. + fill + Sets the fill ratio of the iso-surface. The + default fill value of the surface is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + pattern + Sets the surface pattern of the iso-surface 3-D + sections. The default pattern of the surface is + `all` meaning that the rest of surface elements + would be shaded. The check options (either 1 or + 2) could be used to draw half of the squares on + the surface. Using various combinations of + capital `A`, `B`, `C`, `D` and `E` may also be + used to reduce the number of triangles on the + iso-surfaces and creating other patterns of + interest. + show + Hides/displays surfaces between minimum and + maximum iso-values. + + Returns + ------- + plotly.graph_objs.isosurface.Surface + """ + return self['surface'] + + @surface.setter + def surface(self, val): + self['surface'] = val + + # text + # ---- + @property + def text(self): + """ + Sets the text elements associated with the vertices. If trace + `hoverinfo` contains a "text" flag and "hovertext" is not set, + these elements will be seen in the hover labels. + + The 'text' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['text'] + + @text.setter + def text(self, val): + self['text'] = val + + # textsrc + # ------- + @property + def textsrc(self): + """ + Sets the source reference on plot.ly for text . + + The 'textsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['textsrc'] + + @textsrc.setter + def textsrc(self, val): + self['textsrc'] = val + + # uid + # --- + @property + def uid(self): + """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + + The 'uid' property is a string and must be specified as: + - A string + - A number that will be converted to a string + + Returns + ------- + str + """ + return self['uid'] + + @uid.setter + def uid(self, val): + self['uid'] = val + + # uirevision + # ---------- + @property + def uirevision(self): + """ + 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. + + The 'uirevision' property accepts values of any type + + Returns + ------- + Any + """ + return self['uirevision'] + + @uirevision.setter + def uirevision(self, val): + self['uirevision'] = val + + # value + # ----- + @property + def value(self): + """ + Sets the 4th dimension (value) of the vertices. + + The 'value' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['value'] + + @value.setter + def value(self, val): + self['value'] = val + + # valuesrc + # -------- + @property + def valuesrc(self): + """ + Sets the source reference on plot.ly for value . + + The 'valuesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['valuesrc'] + + @valuesrc.setter + def valuesrc(self, val): + self['valuesrc'] = val + + # visible + # ------- + @property + def visible(self): + """ + 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). + + The 'visible' property is an enumeration that may be specified as: + - One of the following enumeration values: + [True, False, 'legendonly'] + + Returns + ------- + Any + """ + return self['visible'] + + @visible.setter + def visible(self, val): + self['visible'] = val + + # x + # - + @property + def x(self): + """ + Sets the X coordinates of the vertices on X axis. + + The 'x' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['x'] + + @x.setter + def x(self, val): + self['x'] = val + + # xsrc + # ---- + @property + def xsrc(self): + """ + Sets the source reference on plot.ly for x . + + The 'xsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['xsrc'] + + @xsrc.setter + def xsrc(self, val): + self['xsrc'] = val + + # y + # - + @property + def y(self): + """ + Sets the Y coordinates of the vertices on Y axis. + + The 'y' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['y'] + + @y.setter + def y(self, val): + self['y'] = val + + # ysrc + # ---- + @property + def ysrc(self): + """ + Sets the source reference on plot.ly for y . + + The 'ysrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['ysrc'] + + @ysrc.setter + def ysrc(self, val): + self['ysrc'] = val + + # z + # - + @property + def z(self): + """ + Sets the Z coordinates of the vertices on Z axis. + + The 'z' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['z'] + + @z.setter + def z(self, val): + self['z'] = val + + # zsrc + # ---- + @property + def zsrc(self): + """ + Sets the source reference on plot.ly for z . + + The 'zsrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['zsrc'] + + @zsrc.setter + def zsrc(self, val): + self['zsrc'] = val + + # type + # ---- + @property + def type(self): + return self._props['type'] + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return '' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + autocolorscale + Determines whether the colorscale is a default palette + (`autocolorscale: true`) or the palette determined by + `colorscale`. 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. + caps + plotly.graph_objs.isosurface.Caps instance or dict with + compatible properties + cauto + Determines whether or not the color domain is computed + with respect to the input data (here `value`) or the + bounds set in `cmin` and `cmax` Defaults to `false` + when `cmin` and `cmax` are set by the user. + cmax + Sets the upper bound of the color domain. Value should + have the same units as `value` and if set, `cmin` must + be set as well. + cmin + Sets the lower bound of the color domain. Value should + have the same units as `value` and if set, `cmax` must + be set as well. + colorbar + plotly.graph_objs.isosurface.ColorBar instance or dict + with compatible properties + colorscale + Sets the colorscale. 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`cmin` and `cmax`. + Alternatively, `colorscale` may be a palette name + string of the following list: Greys,YlGnBu,Greens,YlOrR + d,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,H + ot,Blackbody,Earth,Electric,Viridis,Cividis. + contour + plotly.graph_objs.isosurface.Contour instance or dict + with compatible properties + customdata + 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 + customdatasrc + Sets the source reference on plot.ly for customdata . + flatshading + Determines whether or not normal smoothing is applied + to the isosurfaces, creating isosurfaces with an + angular, low-poly look via flat reflections. + hoverinfo + 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. + hoverinfosrc + Sets the source reference on plot.ly for hoverinfo . + hoverlabel + plotly.graph_objs.isosurface.Hoverlabel instance or + dict with compatible properties + ids + 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. + idssrc + Sets the source reference on plot.ly for ids . + isomax + Sets the maximum boundary for iso-surface plot. + isomin + Sets the minimum boundary for iso-surface plot. + legendgroup + Sets the legend group for this trace. Traces part of + the same legend group hide/show at the same time when + toggling legend items. + lighting + plotly.graph_objs.isosurface.Lighting instance or dict + with compatible properties + lightposition + plotly.graph_objs.isosurface.Lightposition instance or + dict with compatible properties + name + Sets the trace name. The trace name appear as the + legend item and on hover. + opacity + Sets the opacity of the trace. + reversescale + Reverses the color mapping if true. If true, `cmin` + will correspond to the last color in the array and + `cmax` will correspond to the first color. + scene + Sets a reference between this trace's 3D coordinate + system and a 3D scene. If "scene" (the default value), + the (x,y,z) coordinates refer to `layout.scene`. If + "scene2", the (x,y,z) coordinates refer to + `layout.scene2`, and so on. + selectedpoints + 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. + showlegend + Determines whether or not an item corresponding to this + trace is shown in the legend. + showscale + Determines whether or not a colorbar is displayed for + this trace. + slices + plotly.graph_objs.isosurface.Slices instance or dict + with compatible properties + spaceframe + plotly.graph_objs.isosurface.Spaceframe instance or + dict with compatible properties + stream + plotly.graph_objs.isosurface.Stream instance or dict + with compatible properties + surface + plotly.graph_objs.isosurface.Surface instance or dict + with compatible properties + text + Sets the text elements associated with the vertices. If + trace `hoverinfo` contains a "text" flag and + "hovertext" is not set, these elements will be seen in + the hover labels. + textsrc + Sets the source reference on plot.ly for text . + uid + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. + uirevision + 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. + value + Sets the 4th dimension (value) of the vertices. + valuesrc + Sets the source reference on plot.ly for value . + visible + 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). + x + Sets the X coordinates of the vertices on X axis. + xsrc + Sets the source reference on plot.ly for x . + y + Sets the Y coordinates of the vertices on Y axis. + ysrc + Sets the source reference on plot.ly for y . + z + Sets the Z coordinates of the vertices on Z axis. + zsrc + Sets the source reference on plot.ly for z . + """ + + def __init__( + self, + arg=None, + autocolorscale=None, + caps=None, + cauto=None, + cmax=None, + cmin=None, + colorbar=None, + colorscale=None, + contour=None, + customdata=None, + customdatasrc=None, + flatshading=None, + hoverinfo=None, + hoverinfosrc=None, + hoverlabel=None, + ids=None, + idssrc=None, + isomax=None, + isomin=None, + legendgroup=None, + lighting=None, + lightposition=None, + name=None, + opacity=None, + reversescale=None, + scene=None, + selectedpoints=None, + showlegend=None, + showscale=None, + slices=None, + spaceframe=None, + stream=None, + surface=None, + text=None, + textsrc=None, + uid=None, + uirevision=None, + value=None, + valuesrc=None, + visible=None, + x=None, + xsrc=None, + y=None, + ysrc=None, + z=None, + zsrc=None, + **kwargs + ): + """ + Construct a new Isosurface object + + Draws isosurfaces between iso-min and iso-max values with + coordinates given by four 1-dimensional arrays containing the + `value`, `x`, `y` and `z` of every vertex of a uniform or non- + uniform 3-D grid. Horizontal or vertical slices, caps as well + as spaceframe between iso-min and iso-max values could also be + drawn using this trace. + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.Isosurface + autocolorscale + Determines whether the colorscale is a default palette + (`autocolorscale: true`) or the palette determined by + `colorscale`. 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. + caps + plotly.graph_objs.isosurface.Caps instance or dict with + compatible properties + cauto + Determines whether or not the color domain is computed + with respect to the input data (here `value`) or the + bounds set in `cmin` and `cmax` Defaults to `false` + when `cmin` and `cmax` are set by the user. + cmax + Sets the upper bound of the color domain. Value should + have the same units as `value` and if set, `cmin` must + be set as well. + cmin + Sets the lower bound of the color domain. Value should + have the same units as `value` and if set, `cmax` must + be set as well. + colorbar + plotly.graph_objs.isosurface.ColorBar instance or dict + with compatible properties + colorscale + Sets the colorscale. 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`cmin` and `cmax`. + Alternatively, `colorscale` may be a palette name + string of the following list: Greys,YlGnBu,Greens,YlOrR + d,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,H + ot,Blackbody,Earth,Electric,Viridis,Cividis. + contour + plotly.graph_objs.isosurface.Contour instance or dict + with compatible properties + customdata + 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 + customdatasrc + Sets the source reference on plot.ly for customdata . + flatshading + Determines whether or not normal smoothing is applied + to the isosurfaces, creating isosurfaces with an + angular, low-poly look via flat reflections. + hoverinfo + 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. + hoverinfosrc + Sets the source reference on plot.ly for hoverinfo . + hoverlabel + plotly.graph_objs.isosurface.Hoverlabel instance or + dict with compatible properties + ids + 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. + idssrc + Sets the source reference on plot.ly for ids . + isomax + Sets the maximum boundary for iso-surface plot. + isomin + Sets the minimum boundary for iso-surface plot. + legendgroup + Sets the legend group for this trace. Traces part of + the same legend group hide/show at the same time when + toggling legend items. + lighting + plotly.graph_objs.isosurface.Lighting instance or dict + with compatible properties + lightposition + plotly.graph_objs.isosurface.Lightposition instance or + dict with compatible properties + name + Sets the trace name. The trace name appear as the + legend item and on hover. + opacity + Sets the opacity of the trace. + reversescale + Reverses the color mapping if true. If true, `cmin` + will correspond to the last color in the array and + `cmax` will correspond to the first color. + scene + Sets a reference between this trace's 3D coordinate + system and a 3D scene. If "scene" (the default value), + the (x,y,z) coordinates refer to `layout.scene`. If + "scene2", the (x,y,z) coordinates refer to + `layout.scene2`, and so on. + selectedpoints + 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. + showlegend + Determines whether or not an item corresponding to this + trace is shown in the legend. + showscale + Determines whether or not a colorbar is displayed for + this trace. + slices + plotly.graph_objs.isosurface.Slices instance or dict + with compatible properties + spaceframe + plotly.graph_objs.isosurface.Spaceframe instance or + dict with compatible properties + stream + plotly.graph_objs.isosurface.Stream instance or dict + with compatible properties + surface + plotly.graph_objs.isosurface.Surface instance or dict + with compatible properties + text + Sets the text elements associated with the vertices. If + trace `hoverinfo` contains a "text" flag and + "hovertext" is not set, these elements will be seen in + the hover labels. + textsrc + Sets the source reference on plot.ly for text . + uid + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. + uirevision + 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. + value + Sets the 4th dimension (value) of the vertices. + valuesrc + Sets the source reference on plot.ly for value . + visible + 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). + x + Sets the X coordinates of the vertices on X axis. + xsrc + Sets the source reference on plot.ly for x . + y + Sets the Y coordinates of the vertices on Y axis. + ysrc + Sets the source reference on plot.ly for y . + z + Sets the Z coordinates of the vertices on Z axis. + zsrc + Sets the source reference on plot.ly for z . + + Returns + ------- + Isosurface + """ + super(Isosurface, self).__init__('isosurface') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.Isosurface +constructor must be a dict or +an instance of plotly.graph_objs.Isosurface""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators import (isosurface as v_isosurface) + + # Initialize validators + # --------------------- + self._validators['autocolorscale' + ] = v_isosurface.AutocolorscaleValidator() + self._validators['caps'] = v_isosurface.CapsValidator() + self._validators['cauto'] = v_isosurface.CautoValidator() + self._validators['cmax'] = v_isosurface.CmaxValidator() + self._validators['cmin'] = v_isosurface.CminValidator() + self._validators['colorbar'] = v_isosurface.ColorBarValidator() + self._validators['colorscale'] = v_isosurface.ColorscaleValidator() + self._validators['contour'] = v_isosurface.ContourValidator() + self._validators['customdata'] = v_isosurface.CustomdataValidator() + self._validators['customdatasrc' + ] = v_isosurface.CustomdatasrcValidator() + self._validators['flatshading'] = v_isosurface.FlatshadingValidator() + self._validators['hoverinfo'] = v_isosurface.HoverinfoValidator() + self._validators['hoverinfosrc'] = v_isosurface.HoverinfosrcValidator() + self._validators['hoverlabel'] = v_isosurface.HoverlabelValidator() + self._validators['ids'] = v_isosurface.IdsValidator() + self._validators['idssrc'] = v_isosurface.IdssrcValidator() + self._validators['isomax'] = v_isosurface.IsomaxValidator() + self._validators['isomin'] = v_isosurface.IsominValidator() + self._validators['legendgroup'] = v_isosurface.LegendgroupValidator() + self._validators['lighting'] = v_isosurface.LightingValidator() + self._validators['lightposition' + ] = v_isosurface.LightpositionValidator() + self._validators['name'] = v_isosurface.NameValidator() + self._validators['opacity'] = v_isosurface.OpacityValidator() + self._validators['reversescale'] = v_isosurface.ReversescaleValidator() + self._validators['scene'] = v_isosurface.SceneValidator() + self._validators['selectedpoints' + ] = v_isosurface.SelectedpointsValidator() + self._validators['showlegend'] = v_isosurface.ShowlegendValidator() + self._validators['showscale'] = v_isosurface.ShowscaleValidator() + self._validators['slices'] = v_isosurface.SlicesValidator() + self._validators['spaceframe'] = v_isosurface.SpaceframeValidator() + self._validators['stream'] = v_isosurface.StreamValidator() + self._validators['surface'] = v_isosurface.SurfaceValidator() + self._validators['text'] = v_isosurface.TextValidator() + self._validators['textsrc'] = v_isosurface.TextsrcValidator() + self._validators['uid'] = v_isosurface.UidValidator() + self._validators['uirevision'] = v_isosurface.UirevisionValidator() + self._validators['value'] = v_isosurface.ValueValidator() + self._validators['valuesrc'] = v_isosurface.ValuesrcValidator() + self._validators['visible'] = v_isosurface.VisibleValidator() + self._validators['x'] = v_isosurface.XValidator() + self._validators['xsrc'] = v_isosurface.XsrcValidator() + self._validators['y'] = v_isosurface.YValidator() + self._validators['ysrc'] = v_isosurface.YsrcValidator() + self._validators['z'] = v_isosurface.ZValidator() + self._validators['zsrc'] = v_isosurface.ZsrcValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('autocolorscale', None) + self['autocolorscale' + ] = autocolorscale if autocolorscale is not None else _v + _v = arg.pop('caps', None) + self['caps'] = caps if caps is not None else _v + _v = arg.pop('cauto', None) + self['cauto'] = cauto if cauto is not None else _v + _v = arg.pop('cmax', None) + self['cmax'] = cmax if cmax is not None else _v + _v = arg.pop('cmin', None) + self['cmin'] = cmin if cmin is not None else _v + _v = arg.pop('colorbar', None) + self['colorbar'] = colorbar if colorbar is not None else _v + _v = arg.pop('colorscale', None) + self['colorscale'] = colorscale if colorscale is not None else _v + _v = arg.pop('contour', None) + self['contour'] = contour if contour is not None else _v + _v = arg.pop('customdata', None) + self['customdata'] = customdata if customdata is not None else _v + _v = arg.pop('customdatasrc', None) + self['customdatasrc' + ] = customdatasrc if customdatasrc is not None else _v + _v = arg.pop('flatshading', None) + self['flatshading'] = flatshading if flatshading is not None else _v + _v = arg.pop('hoverinfo', None) + self['hoverinfo'] = hoverinfo if hoverinfo is not None else _v + _v = arg.pop('hoverinfosrc', None) + self['hoverinfosrc'] = hoverinfosrc if hoverinfosrc is not None else _v + _v = arg.pop('hoverlabel', None) + self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v + _v = arg.pop('ids', None) + self['ids'] = ids if ids is not None else _v + _v = arg.pop('idssrc', None) + self['idssrc'] = idssrc if idssrc is not None else _v + _v = arg.pop('isomax', None) + self['isomax'] = isomax if isomax is not None else _v + _v = arg.pop('isomin', None) + self['isomin'] = isomin if isomin is not None else _v + _v = arg.pop('legendgroup', None) + self['legendgroup'] = legendgroup if legendgroup is not None else _v + _v = arg.pop('lighting', None) + self['lighting'] = lighting if lighting is not None else _v + _v = arg.pop('lightposition', None) + self['lightposition' + ] = lightposition if lightposition is not None else _v + _v = arg.pop('name', None) + self['name'] = name if name is not None else _v + _v = arg.pop('opacity', None) + self['opacity'] = opacity if opacity is not None else _v + _v = arg.pop('reversescale', None) + self['reversescale'] = reversescale if reversescale is not None else _v + _v = arg.pop('scene', None) + self['scene'] = scene if scene is not None else _v + _v = arg.pop('selectedpoints', None) + self['selectedpoints' + ] = selectedpoints if selectedpoints is not None else _v + _v = arg.pop('showlegend', None) + self['showlegend'] = showlegend if showlegend is not None else _v + _v = arg.pop('showscale', None) + self['showscale'] = showscale if showscale is not None else _v + _v = arg.pop('slices', None) + self['slices'] = slices if slices is not None else _v + _v = arg.pop('spaceframe', None) + self['spaceframe'] = spaceframe if spaceframe is not None else _v + _v = arg.pop('stream', None) + self['stream'] = stream if stream is not None else _v + _v = arg.pop('surface', None) + self['surface'] = surface if surface is not None else _v + _v = arg.pop('text', None) + self['text'] = text if text is not None else _v + _v = arg.pop('textsrc', None) + self['textsrc'] = textsrc if textsrc is not None else _v + _v = arg.pop('uid', None) + self['uid'] = uid if uid is not None else _v + _v = arg.pop('uirevision', None) + self['uirevision'] = uirevision if uirevision is not None else _v + _v = arg.pop('value', None) + self['value'] = value if value is not None else _v + _v = arg.pop('valuesrc', None) + self['valuesrc'] = valuesrc if valuesrc is not None else _v + _v = arg.pop('visible', None) + self['visible'] = visible if visible is not None else _v + _v = arg.pop('x', None) + self['x'] = x if x is not None else _v + _v = arg.pop('xsrc', None) + self['xsrc'] = xsrc if xsrc is not None else _v + _v = arg.pop('y', None) + self['y'] = y if y is not None else _v + _v = arg.pop('ysrc', None) + self['ysrc'] = ysrc if ysrc is not None else _v + _v = arg.pop('z', None) + self['z'] = z if z is not None else _v + _v = arg.pop('zsrc', None) + self['zsrc'] = zsrc if zsrc is not None else _v + + # Read-only literals + # ------------------ + from _plotly_utils.basevalidators import LiteralValidator + self._props['type'] = 'isosurface' + self._validators['type'] = LiteralValidator( + plotly_name='type', parent_name='isosurface', val='isosurface' + ) + arg.pop('type', None) + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -4,6 +4,7 @@ from plotly.graph_objs.layout import xaxis from ._updatemenu import Updatemenu from plotly.graph_objs.layout import updatemenu +from ._transition import Transition from ._title import Title from plotly.graph_objs.layout import title from ._ternary import Ternary diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/polar/_angularaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/polar/_angularaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/polar/_angularaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/polar/_angularaxis.py 2019-02-08 22:59:51.000000000 +0000 @@ -1776,8 +1776,8 @@ self._validators['rotation'] = v_angularaxis.RotationValidator() self._validators['separatethousands' ] = v_angularaxis.SeparatethousandsValidator() - self._validators['showexponent' - ] = v_angularaxis.ShowexponentValidator() + self._validators['showexponent'] = v_angularaxis.ShowexponentValidator( + ) self._validators['showgrid'] = v_angularaxis.ShowgridValidator() self._validators['showline'] = v_angularaxis.ShowlineValidator() self._validators['showticklabels' diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/scene/_xaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/scene/_xaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/scene/_xaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/scene/_xaxis.py 2019-02-08 22:59:49.000000000 +0000 @@ -2243,8 +2243,8 @@ # Initialize validators # --------------------- self._validators['autorange'] = v_xaxis.AutorangeValidator() - self._validators['backgroundcolor' - ] = v_xaxis.BackgroundcolorValidator() + self._validators['backgroundcolor'] = v_xaxis.BackgroundcolorValidator( + ) self._validators['calendar'] = v_xaxis.CalendarValidator() self._validators['categoryarray'] = v_xaxis.CategoryarrayValidator() self._validators['categoryarraysrc' @@ -2281,8 +2281,8 @@ self._validators['tickcolor'] = v_xaxis.TickcolorValidator() self._validators['tickfont'] = v_xaxis.TickfontValidator() self._validators['tickformat'] = v_xaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_xaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_xaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_xaxis.TickformatstopValidator() self._validators['ticklen'] = v_xaxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/scene/_yaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/scene/_yaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/scene/_yaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/scene/_yaxis.py 2019-02-08 22:59:47.000000000 +0000 @@ -2243,8 +2243,8 @@ # Initialize validators # --------------------- self._validators['autorange'] = v_yaxis.AutorangeValidator() - self._validators['backgroundcolor' - ] = v_yaxis.BackgroundcolorValidator() + self._validators['backgroundcolor'] = v_yaxis.BackgroundcolorValidator( + ) self._validators['calendar'] = v_yaxis.CalendarValidator() self._validators['categoryarray'] = v_yaxis.CategoryarrayValidator() self._validators['categoryarraysrc' @@ -2281,8 +2281,8 @@ self._validators['tickcolor'] = v_yaxis.TickcolorValidator() self._validators['tickfont'] = v_yaxis.TickfontValidator() self._validators['tickformat'] = v_yaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_yaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_yaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_yaxis.TickformatstopValidator() self._validators['ticklen'] = v_yaxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/scene/_zaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/scene/_zaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/scene/_zaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/scene/_zaxis.py 2019-02-08 22:59:46.000000000 +0000 @@ -2243,8 +2243,8 @@ # Initialize validators # --------------------- self._validators['autorange'] = v_zaxis.AutorangeValidator() - self._validators['backgroundcolor' - ] = v_zaxis.BackgroundcolorValidator() + self._validators['backgroundcolor'] = v_zaxis.BackgroundcolorValidator( + ) self._validators['calendar'] = v_zaxis.CalendarValidator() self._validators['categoryarray'] = v_zaxis.CategoryarrayValidator() self._validators['categoryarraysrc' @@ -2281,8 +2281,8 @@ self._validators['tickcolor'] = v_zaxis.TickcolorValidator() self._validators['tickfont'] = v_zaxis.TickfontValidator() self._validators['tickformat'] = v_zaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_zaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_zaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_zaxis.TickformatstopValidator() self._validators['ticklen'] = v_zaxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/template/data/__init__.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/template/data/__init__.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/template/data/__init__.py 2018-12-25 12:00:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/template/data/__init__.py 2019-02-08 23:01:16.000000000 +0000 @@ -19,6 +19,7 @@ from ._parcats import Parcats from ._ohlc import Ohlc from ._mesh3d import Mesh3d +from ._isosurface import Isosurface from ._histogram import Histogram from ._histogram2d import Histogram2d from ._histogram2dcontour import Histogram2dContour diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/template/data/_isosurface.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/template/data/_isosurface.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/template/data/_isosurface.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/template/data/_isosurface.py 2019-02-08 22:59:45.000000000 +0000 @@ -0,0 +1 @@ +from plotly.graph_objs import Isosurface diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/template/_data.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/template/_data.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/template/_data.py 2018-12-25 11:58:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/template/_data.py 2019-02-08 22:59:45.000000000 +0000 @@ -349,6 +349,29 @@ def histogram(self, val): self['histogram'] = val + # isosurface + # ---------- + @property + def isosurface(self): + """ + The 'isosurface' property is a tuple of instances of + Isosurface that may be specified as: + - A list or tuple of instances of plotly.graph_objs.layout.template.data.Isosurface + - A list or tuple of dicts of string/value properties that + will be passed to the Isosurface constructor + + Supported dict properties: + + Returns + ------- + tuple[plotly.graph_objs.layout.template.data.Isosurface] + """ + return self['isosurface'] + + @isosurface.setter + def isosurface(self, val): + self['isosurface'] = val + # mesh3d # ------ @property @@ -888,6 +911,9 @@ histogram plotly.graph_objs.layout.template.data.Histogram instance or dict with compatible properties + isosurface + plotly.graph_objs.layout.template.data.Isosurface + instance or dict with compatible properties mesh3d plotly.graph_objs.layout.template.data.Mesh3d instance or dict with compatible properties @@ -971,6 +997,7 @@ histogram2dcontour=None, histogram2d=None, histogram=None, + isosurface=None, mesh3d=None, ohlc=None, parcats=None, @@ -1047,6 +1074,9 @@ histogram plotly.graph_objs.layout.template.data.Histogram instance or dict with compatible properties + isosurface + plotly.graph_objs.layout.template.data.Isosurface + instance or dict with compatible properties mesh3d plotly.graph_objs.layout.template.data.Mesh3d instance or dict with compatible properties @@ -1159,6 +1189,7 @@ ] = v_data.Histogram2dContoursValidator() self._validators['histogram2d'] = v_data.Histogram2dsValidator() self._validators['histogram'] = v_data.HistogramsValidator() + self._validators['isosurface'] = v_data.IsosurfacesValidator() self._validators['mesh3d'] = v_data.Mesh3dsValidator() self._validators['ohlc'] = v_data.OhlcsValidator() self._validators['parcats'] = v_data.ParcatssValidator() @@ -1215,6 +1246,8 @@ self['histogram2d'] = histogram2d if histogram2d is not None else _v _v = arg.pop('histogram', None) self['histogram'] = histogram if histogram is not None else _v + _v = arg.pop('isosurface', None) + self['isosurface'] = isosurface if isosurface is not None else _v _v = arg.pop('mesh3d', None) self['mesh3d'] = mesh3d if mesh3d is not None else _v _v = arg.pop('ohlc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_template.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_template.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_template.py 2018-12-25 11:58:57.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_template.py 2019-02-08 22:59:44.000000000 +0000 @@ -64,6 +64,9 @@ histogram plotly.graph_objs.layout.template.data.Histogra m instance or dict with compatible properties + isosurface + plotly.graph_objs.layout.template.data.Isosurfa + ce instance or dict with compatible properties mesh3d plotly.graph_objs.layout.template.data.Mesh3d instance or dict with compatible properties diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/ternary/_aaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/ternary/_aaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/ternary/_aaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/ternary/_aaxis.py 2019-02-08 22:59:44.000000000 +0000 @@ -1603,8 +1603,8 @@ self._validators['tickcolor'] = v_aaxis.TickcolorValidator() self._validators['tickfont'] = v_aaxis.TickfontValidator() self._validators['tickformat'] = v_aaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_aaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_aaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_aaxis.TickformatstopValidator() self._validators['ticklen'] = v_aaxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/ternary/_baxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/ternary/_baxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/ternary/_baxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/ternary/_baxis.py 2019-02-08 22:59:43.000000000 +0000 @@ -1603,8 +1603,8 @@ self._validators['tickcolor'] = v_baxis.TickcolorValidator() self._validators['tickfont'] = v_baxis.TickfontValidator() self._validators['tickformat'] = v_baxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_baxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_baxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_baxis.TickformatstopValidator() self._validators['ticklen'] = v_baxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/ternary/_caxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/ternary/_caxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/ternary/_caxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/ternary/_caxis.py 2019-02-08 22:59:42.000000000 +0000 @@ -1603,8 +1603,8 @@ self._validators['tickcolor'] = v_caxis.TickcolorValidator() self._validators['tickfont'] = v_caxis.TickfontValidator() self._validators['tickformat'] = v_caxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_caxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_caxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_caxis.TickformatstopValidator() self._validators['ticklen'] = v_caxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_transition.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_transition.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_transition.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_transition.py 2019-02-08 22:59:41.000000000 +0000 @@ -0,0 +1,176 @@ +from plotly.basedatatypes import BaseLayoutHierarchyType +import copy + + +class Transition(BaseLayoutHierarchyType): + + # duration + # -------- + @property + def duration(self): + """ + The duration of the transition, in milliseconds. If equal to + zero, updates are synchronous. + + The 'duration' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['duration'] + + @duration.setter + def duration(self, val): + self['duration'] = val + + # easing + # ------ + @property + def easing(self): + """ + The easing function used for the transition + + The 'easing' property is an enumeration that may be specified as: + - One of the following enumeration 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'] + + Returns + ------- + Any + """ + return self['easing'] + + @easing.setter + def easing(self, val): + self['easing'] = val + + # ordering + # -------- + @property + def ordering(self): + """ + Determines whether the figure's layout or traces smoothly + transitions during updates that make both traces and layout + change. + + The 'ordering' property is an enumeration that may be specified as: + - One of the following enumeration values: + ['layout first', 'traces first'] + + Returns + ------- + Any + """ + return self['ordering'] + + @ordering.setter + def ordering(self, val): + self['ordering'] = val + + # property parent name + # -------------------- + @property + def _parent_path_str(self): + return 'layout' + + # Self properties description + # --------------------------- + @property + def _prop_descriptions(self): + return """\ + duration + The duration of the transition, in milliseconds. If + equal to zero, updates are synchronous. + easing + The easing function used for the transition + ordering + Determines whether the figure's layout or traces + smoothly transitions during updates that make both + traces and layout change. + """ + + def __init__( + self, arg=None, duration=None, easing=None, ordering=None, **kwargs + ): + """ + Construct a new Transition object + + Sets transition options used during Plotly.react updates. + + Parameters + ---------- + arg + dict of properties compatible with this constructor or + an instance of plotly.graph_objs.layout.Transition + duration + The duration of the transition, in milliseconds. If + equal to zero, updates are synchronous. + easing + The easing function used for the transition + ordering + Determines whether the figure's layout or traces + smoothly transitions during updates that make both + traces and layout change. + + Returns + ------- + Transition + """ + super(Transition, self).__init__('transition') + + # Validate arg + # ------------ + if arg is None: + arg = {} + elif isinstance(arg, self.__class__): + arg = arg.to_plotly_json() + elif isinstance(arg, dict): + arg = copy.copy(arg) + else: + raise ValueError( + """\ +The first argument to the plotly.graph_objs.layout.Transition +constructor must be a dict or +an instance of plotly.graph_objs.layout.Transition""" + ) + + # Handle skip_invalid + # ------------------- + self._skip_invalid = kwargs.pop('skip_invalid', False) + + # Import validators + # ----------------- + from plotly.validators.layout import (transition as v_transition) + + # Initialize validators + # --------------------- + self._validators['duration'] = v_transition.DurationValidator() + self._validators['easing'] = v_transition.EasingValidator() + self._validators['ordering'] = v_transition.OrderingValidator() + + # Populate data dict with properties + # ---------------------------------- + _v = arg.pop('duration', None) + self['duration'] = duration if duration is not None else _v + _v = arg.pop('easing', None) + self['easing'] = easing if easing is not None else _v + _v = arg.pop('ordering', None) + self['ordering'] = ordering if ordering is not None else _v + + # Process unknown kwargs + # ---------------------- + self._process_kwargs(**dict(arg, **kwargs)) + + # Reset skip_invalid + # ------------------ + self._skip_invalid = False diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/xaxis/_rangeselector.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/xaxis/_rangeselector.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/xaxis/_rangeselector.py 2018-12-25 11:58:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/xaxis/_rangeselector.py 2019-02-08 22:59:41.000000000 +0000 @@ -611,13 +611,13 @@ # Initialize validators # --------------------- - self._validators['activecolor' - ] = v_rangeselector.ActivecolorValidator() + self._validators['activecolor'] = v_rangeselector.ActivecolorValidator( + ) self._validators['bgcolor'] = v_rangeselector.BgcolorValidator() - self._validators['bordercolor' - ] = v_rangeselector.BordercolorValidator() - self._validators['borderwidth' - ] = v_rangeselector.BorderwidthValidator() + self._validators['bordercolor'] = v_rangeselector.BordercolorValidator( + ) + self._validators['borderwidth'] = v_rangeselector.BorderwidthValidator( + ) self._validators['buttons'] = v_rangeselector.ButtonsValidator() self._validators['buttondefaults'] = v_rangeselector.ButtonValidator() self._validators['font'] = v_rangeselector.FontValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/xaxis/_rangeslider.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/xaxis/_rangeslider.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/xaxis/_rangeslider.py 2018-12-25 11:58:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/xaxis/_rangeslider.py 2019-02-08 22:59:41.000000000 +0000 @@ -149,7 +149,7 @@ @property def borderwidth(self): """ - Sets the border color of the range slider. + Sets the border width of the range slider. The 'borderwidth' property is a integer and may be specified as: - An int (or float that will be cast to an int) @@ -292,7 +292,7 @@ bordercolor Sets the border color of the range slider. borderwidth - Sets the border color of the range slider. + Sets the border width of the range slider. range Sets the range of the range slider. If not set, defaults to the full xaxis range. If the axis `type` is @@ -346,7 +346,7 @@ bordercolor Sets the border color of the range slider. borderwidth - Sets the border color of the range slider. + Sets the border width of the range slider. range Sets the range of the range slider. If not set, defaults to the full xaxis range. If the axis `type` is diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_xaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_xaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_xaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_xaxis.py 2019-02-08 22:59:40.000000000 +0000 @@ -935,7 +935,7 @@ bordercolor Sets the border color of the range slider. borderwidth - Sets the border color of the range slider. + Sets the border width of the range slider. range Sets the range of the range slider. If not set, defaults to the full xaxis range. If the axis @@ -3013,8 +3013,8 @@ self._validators['categoryorder'] = v_xaxis.CategoryorderValidator() self._validators['color'] = v_xaxis.ColorValidator() self._validators['constrain'] = v_xaxis.ConstrainValidator() - self._validators['constraintoward' - ] = v_xaxis.ConstraintowardValidator() + self._validators['constraintoward'] = v_xaxis.ConstraintowardValidator( + ) self._validators['dividercolor'] = v_xaxis.DividercolorValidator() self._validators['dividerwidth'] = v_xaxis.DividerwidthValidator() self._validators['domain'] = v_xaxis.DomainValidator() @@ -3058,8 +3058,8 @@ self._validators['tickcolor'] = v_xaxis.TickcolorValidator() self._validators['tickfont'] = v_xaxis.TickfontValidator() self._validators['tickformat'] = v_xaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_xaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_xaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_xaxis.TickformatstopValidator() self._validators['ticklen'] = v_xaxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_yaxis.py plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_yaxis.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/layout/_yaxis.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/layout/_yaxis.py 2019-02-08 22:59:39.000000000 +0000 @@ -2873,8 +2873,8 @@ self._validators['categoryorder'] = v_yaxis.CategoryorderValidator() self._validators['color'] = v_yaxis.ColorValidator() self._validators['constrain'] = v_yaxis.ConstrainValidator() - self._validators['constraintoward' - ] = v_yaxis.ConstraintowardValidator() + self._validators['constraintoward'] = v_yaxis.ConstraintowardValidator( + ) self._validators['dividercolor'] = v_yaxis.DividercolorValidator() self._validators['dividerwidth'] = v_yaxis.DividerwidthValidator() self._validators['domain'] = v_yaxis.DomainValidator() @@ -2916,8 +2916,8 @@ self._validators['tickcolor'] = v_yaxis.TickcolorValidator() self._validators['tickfont'] = v_yaxis.TickfontValidator() self._validators['tickformat'] = v_yaxis.TickformatValidator() - self._validators['tickformatstops' - ] = v_yaxis.TickformatstopsValidator() + self._validators['tickformatstops'] = v_yaxis.TickformatstopsValidator( + ) self._validators['tickformatstopdefaults' ] = v_yaxis.TickformatstopValidator() self._validators['ticklen'] = v_yaxis.TicklenValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_layout.py plotly-3.6.1+dfsg1/plotly/graph_objs/_layout.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_layout.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_layout.py 2019-02-08 22:59:39.000000000 +0000 @@ -505,7 +505,8 @@ def boxgap(self): """ Sets the gap (in plot fraction) between boxes of adjacent - location coordinates. + location coordinates. Has no effect on traces that have "width" + set. The 'boxgap' property is a number and may be specified as: - An int or float in the interval [0, 1] @@ -526,7 +527,8 @@ def boxgroupgap(self): """ Sets the gap (in plot fraction) between boxes of the same - location coordinate. + location coordinate. Has no effect on traces that have "width" + set. The 'boxgroupgap' property is a number and may be specified as: - An int or float in the interval [0, 1] @@ -550,7 +552,8 @@ displayed on the graph. If "group", the boxes are plotted next to one another centered around the shared location. If "overlay", the boxes are plotted over one another, you might - need to set "opacity" to see them multiple boxes. + need to set "opacity" to see them multiple boxes. Has no effect + on traces that have "width" set. The 'boxmode' property is an enumeration that may be specified as: - One of the following enumeration values: @@ -1524,6 +1527,50 @@ def margin(self, val): self['margin'] = val + # meta + # ---- + @property + def meta(self): + """ + Assigns extra meta information that can be used in various + `text` attributes. Attributes such as the graph, axis and + colorbar `title.text` and annotation `text` support `meta`. One + can access `meta` fields using template strings: `%{meta[i]}` + where `i` is the index of the `meta` item in question. + + The 'meta' property is an array that may be specified as a tuple, + list, numpy array, or pandas Series + + Returns + ------- + numpy.ndarray + """ + return self['meta'] + + @meta.setter + def meta(self, val): + self['meta'] = val + + # metasrc + # ------- + @property + def metasrc(self): + """ + Sets the source reference on plot.ly for meta . + + The 'metasrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['metasrc'] + + @metasrc.setter + def metasrc(self, val): + self['metasrc'] = val + # modebar # ------- @property @@ -2628,6 +2675,42 @@ def titlefont(self, val): self['titlefont'] = val + # transition + # ---------- + @property + def transition(self): + """ + Sets transition options used during Plotly.react updates. + + The 'transition' property is an instance of Transition + that may be specified as: + - An instance of plotly.graph_objs.layout.Transition + - A dict of string/value properties that will be passed + to the Transition constructor + + Supported dict properties: + + duration + The duration of the transition, in + milliseconds. If equal to zero, updates are + synchronous. + easing + The easing function used for the transition + ordering + Determines whether the figure's layout or + traces smoothly transitions during updates that + make both traces and layout change. + + Returns + ------- + plotly.graph_objs.layout.Transition + """ + return self['transition'] + + @transition.setter + def transition(self, val): + self['transition'] = val + # uirevision # ---------- @property @@ -2797,7 +2880,8 @@ def violingap(self): """ Sets the gap (in plot fraction) between violins of adjacent - location coordinates. + location coordinates. Has no effect on traces that have "width" + set. The 'violingap' property is a number and may be specified as: - An int or float in the interval [0, 1] @@ -2818,7 +2902,8 @@ def violingroupgap(self): """ Sets the gap (in plot fraction) between violins of the same - location coordinate. + location coordinate. Has no effect on traces that have "width" + set. The 'violingroupgap' property is a number and may be specified as: - An int or float in the interval [0, 1] @@ -2842,7 +2927,8 @@ displayed on the graph. If "group", the violins are plotted next to one another centered around the shared location. If "overlay", the violins are plotted over one another, you might - need to set "opacity" to see them multiple violins. + need to set "opacity" to see them multiple violins. Has no + effect on traces that have "width" set. The 'violinmode' property is an enumeration that may be specified as: - One of the following enumeration values: @@ -3768,17 +3854,20 @@ percentages. boxgap Sets the gap (in plot fraction) between boxes of - adjacent location coordinates. + adjacent location coordinates. Has no effect on traces + that have "width" set. boxgroupgap Sets the gap (in plot fraction) between boxes of the - same location coordinate. + same location coordinate. Has no effect on traces that + have "width" set. boxmode Determines how boxes at the same location coordinate are displayed on the graph. If "group", the boxes are plotted next to one another centered around the shared location. If "overlay", the boxes are plotted over one another, you might need to set "opacity" to see them - multiple boxes. + multiple boxes. Has no effect on traces that have + "width" set. calendar Sets the default calendar system to use for interpreting and displaying dates throughout the plot. @@ -3892,6 +3981,15 @@ margin plotly.graph_objs.layout.Margin instance or dict with compatible properties + meta + Assigns extra meta information that can be used in + various `text` attributes. Attributes such as the + graph, axis and colorbar `title.text` and annotation + `text` support `meta`. One can access `meta` fields + using template strings: `%{meta[i]}` where `i` is the + index of the `meta` item in question. + metasrc + Sets the source reference on plot.ly for meta . modebar plotly.graph_objs.layout.Modebar instance or dict with compatible properties @@ -3993,6 +4091,9 @@ Deprecated: Please use layout.title.font instead. Sets the title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. + transition + Sets transition options used during Plotly.react + updates. uirevision Used to allow user interactions with the plot to persist after `Plotly.react` calls that are unaware of @@ -4022,17 +4123,20 @@ layout.updatemenus violingap Sets the gap (in plot fraction) between violins of - adjacent location coordinates. + adjacent location coordinates. Has no effect on traces + that have "width" set. violingroupgap Sets the gap (in plot fraction) between violins of the - same location coordinate. + same location coordinate. Has no effect on traces that + have "width" set. violinmode Determines how violins at the same location coordinate are displayed on the graph. If "group", the violins are plotted next to one another centered around the shared location. If "overlay", the violins are plotted over one another, you might need to set "opacity" to see - them multiple violins. + them multiple violins. Has no effect on traces that + have "width" set. width Sets the plot's width (in px). xaxis @@ -4083,6 +4187,8 @@ legend=None, mapbox=None, margin=None, + meta=None, + metasrc=None, modebar=None, orientation=None, paper_bgcolor=None, @@ -4104,6 +4210,7 @@ ternary=None, title=None, titlefont=None, + transition=None, uirevision=None, updatemenus=None, updatemenudefaults=None, @@ -4164,17 +4271,20 @@ percentages. boxgap Sets the gap (in plot fraction) between boxes of - adjacent location coordinates. + adjacent location coordinates. Has no effect on traces + that have "width" set. boxgroupgap Sets the gap (in plot fraction) between boxes of the - same location coordinate. + same location coordinate. Has no effect on traces that + have "width" set. boxmode Determines how boxes at the same location coordinate are displayed on the graph. If "group", the boxes are plotted next to one another centered around the shared location. If "overlay", the boxes are plotted over one another, you might need to set "opacity" to see them - multiple boxes. + multiple boxes. Has no effect on traces that have + "width" set. calendar Sets the default calendar system to use for interpreting and displaying dates throughout the plot. @@ -4288,6 +4398,15 @@ margin plotly.graph_objs.layout.Margin instance or dict with compatible properties + meta + Assigns extra meta information that can be used in + various `text` attributes. Attributes such as the + graph, axis and colorbar `title.text` and annotation + `text` support `meta`. One can access `meta` fields + using template strings: `%{meta[i]}` where `i` is the + index of the `meta` item in question. + metasrc + Sets the source reference on plot.ly for meta . modebar plotly.graph_objs.layout.Modebar instance or dict with compatible properties @@ -4389,6 +4508,9 @@ Deprecated: Please use layout.title.font instead. Sets the title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. + transition + Sets transition options used during Plotly.react + updates. uirevision Used to allow user interactions with the plot to persist after `Plotly.react` calls that are unaware of @@ -4418,17 +4540,20 @@ layout.updatemenus violingap Sets the gap (in plot fraction) between violins of - adjacent location coordinates. + adjacent location coordinates. Has no effect on traces + that have "width" set. violingroupgap Sets the gap (in plot fraction) between violins of the - same location coordinate. + same location coordinate. Has no effect on traces that + have "width" set. violinmode Determines how violins at the same location coordinate are displayed on the graph. If "group", the violins are plotted next to one another centered around the shared location. If "overlay", the violins are plotted over one another, you might need to set "opacity" to see - them multiple violins. + them multiple violins. Has no effect on traces that + have "width" set. width Sets the plot's width (in px). xaxis @@ -4507,6 +4632,8 @@ self._validators['legend'] = v_layout.LegendValidator() self._validators['mapbox'] = v_layout.MapboxValidator() self._validators['margin'] = v_layout.MarginValidator() + self._validators['meta'] = v_layout.MetaValidator() + self._validators['metasrc'] = v_layout.MetasrcValidator() self._validators['modebar'] = v_layout.ModebarValidator() self._validators['orientation'] = v_layout.OrientationValidator() self._validators['paper_bgcolor'] = v_layout.PaperBgcolorValidator() @@ -4529,6 +4656,7 @@ self._validators['template'] = v_layout.TemplateValidator() self._validators['ternary'] = v_layout.TernaryValidator() self._validators['title'] = v_layout.TitleValidator() + self._validators['transition'] = v_layout.TransitionValidator() self._validators['uirevision'] = v_layout.UirevisionValidator() self._validators['updatemenus'] = v_layout.UpdatemenusValidator() self._validators['updatemenudefaults'] = v_layout.UpdatemenuValidator() @@ -4616,6 +4744,10 @@ self['mapbox'] = mapbox if mapbox is not None else _v _v = arg.pop('margin', None) self['margin'] = margin if margin is not None else _v + _v = arg.pop('meta', None) + self['meta'] = meta if meta is not None else _v + _v = arg.pop('metasrc', None) + self['metasrc'] = metasrc if metasrc is not None else _v _v = arg.pop('modebar', None) self['modebar'] = modebar if modebar is not None else _v _v = arg.pop('orientation', None) @@ -4668,6 +4800,8 @@ _v = titlefont if titlefont is not None else _v if _v is not None: self['titlefont'] = _v + _v = arg.pop('transition', None) + self['transition'] = transition if transition is not None else _v _v = arg.pop('uirevision', None) self['uirevision'] = uirevision if uirevision is not None else _v _v = arg.pop('updatemenus', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_mesh3d.py plotly-3.6.1+dfsg1/plotly/graph_objs/_mesh3d.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_mesh3d.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_mesh3d.py 2019-02-08 23:00:36.000000000 +0000 @@ -1280,6 +1280,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1789,7 +1792,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2100,7 +2105,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_ohlc.py plotly-3.6.1+dfsg1/plotly/graph_objs/_ohlc.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_ohlc.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_ohlc.py 2019-02-08 23:00:35.000000000 +0000 @@ -653,6 +653,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -936,7 +939,9 @@ Sets the width of the open/close tick marks relative to the "x" minimal interval. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1117,7 +1122,9 @@ Sets the width of the open/close tick marks relative to the "x" minimal interval. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/parcats/_dimension.py plotly-3.6.1+dfsg1/plotly/graph_objs/parcats/_dimension.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/parcats/_dimension.py 2018-12-25 11:59:37.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/parcats/_dimension.py 2019-02-08 23:00:34.000000000 +0000 @@ -382,12 +382,12 @@ # Initialize validators # --------------------- - self._validators['categoryarray' - ] = v_dimension.CategoryarrayValidator() + self._validators['categoryarray'] = v_dimension.CategoryarrayValidator( + ) self._validators['categoryarraysrc' ] = v_dimension.CategoryarraysrcValidator() - self._validators['categoryorder' - ] = v_dimension.CategoryorderValidator() + self._validators['categoryorder'] = v_dimension.CategoryorderValidator( + ) self._validators['displayindex'] = v_dimension.DisplayindexValidator() self._validators['label'] = v_dimension.LabelValidator() self._validators['ticktext'] = v_dimension.TicktextValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_parcats.py plotly-3.6.1+dfsg1/plotly/graph_objs/_parcats.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_parcats.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_parcats.py 2019-02-08 23:00:33.000000000 +0000 @@ -552,6 +552,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -697,7 +700,9 @@ tickfont Sets the font for the `category` labels. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -815,7 +820,9 @@ tickfont Sets the font for the `category` labels. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_parcoords.py plotly-3.6.1+dfsg1/plotly/graph_objs/_parcoords.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_parcoords.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_parcoords.py 2019-02-08 23:00:32.000000000 +0000 @@ -673,6 +673,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -823,7 +826,9 @@ tickfont Sets the font for the `dimension` tick values. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -951,7 +956,9 @@ tickfont Sets the font for the `dimension` tick values. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1009,11 +1016,11 @@ # Initialize validators # --------------------- self._validators['customdata'] = v_parcoords.CustomdataValidator() - self._validators['customdatasrc' - ] = v_parcoords.CustomdatasrcValidator() + self._validators['customdatasrc'] = v_parcoords.CustomdatasrcValidator( + ) self._validators['dimensions'] = v_parcoords.DimensionsValidator() - self._validators['dimensiondefaults' - ] = v_parcoords.DimensionValidator() + self._validators['dimensiondefaults'] = v_parcoords.DimensionValidator( + ) self._validators['domain'] = v_parcoords.DomainValidator() self._validators['hoverinfo'] = v_parcoords.HoverinfoValidator() self._validators['hoverinfosrc'] = v_parcoords.HoverinfosrcValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_pie.py plotly-3.6.1+dfsg1/plotly/graph_objs/_pie.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_pie.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_pie.py 2019-02-08 23:00:30.000000000 +0000 @@ -1136,6 +1136,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1417,7 +1420,9 @@ title's position used to be set by the now deprecated `titleposition` attribute. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1669,7 +1674,9 @@ title's position used to be set by the now deprecated `titleposition` attribute. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1741,8 +1748,8 @@ self._validators['hoverinfosrc'] = v_pie.HoverinfosrcValidator() self._validators['hoverlabel'] = v_pie.HoverlabelValidator() self._validators['hovertemplate'] = v_pie.HovertemplateValidator() - self._validators['hovertemplatesrc' - ] = v_pie.HovertemplatesrcValidator() + self._validators['hovertemplatesrc'] = v_pie.HovertemplatesrcValidator( + ) self._validators['hovertext'] = v_pie.HovertextValidator() self._validators['hovertextsrc'] = v_pie.HovertextsrcValidator() self._validators['ids'] = v_pie.IdsValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_pointcloud.py plotly-3.6.1+dfsg1/plotly/graph_objs/_pointcloud.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_pointcloud.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_pointcloud.py 2019-02-08 23:00:29.000000000 +0000 @@ -480,6 +480,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -894,7 +897,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1078,7 +1083,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_sankey.py plotly-3.6.1+dfsg1/plotly/graph_objs/_sankey.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_sankey.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_sankey.py 2019-02-08 23:00:28.000000000 +0000 @@ -617,6 +617,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -814,7 +817,9 @@ textfont Sets the font for node labels uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -955,7 +960,9 @@ textfont Sets the font for node labels uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/scatter3d/_line.py plotly-3.6.1+dfsg1/plotly/graph_objs/scatter3d/_line.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/scatter3d/_line.py 2018-12-25 11:59:29.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/scatter3d/_line.py 2019-02-08 23:00:24.000000000 +0000 @@ -268,6 +268,28 @@ def reversescale(self, val): self['reversescale'] = val + # showscale + # --------- + @property + def showscale(self): + """ + Determines whether or not a colorbar is displayed for this + trace. Has an effect only if in `line.color`is set to a + numerical array. + + The 'showscale' property must be specified as a bool + (either True, or False) + + Returns + ------- + bool + """ + return self['showscale'] + + @showscale.setter + def showscale(self, val): + self['showscale'] = val + # width # ----- @property @@ -355,6 +377,10 @@ `line.cmin` will correspond to the last color in the array and `line.cmax` will correspond to the first color. + showscale + Determines whether or not a colorbar is displayed for + this trace. Has an effect only if in `line.color`is set + to a numerical array. width Sets the line width (in px). """ @@ -371,6 +397,7 @@ colorsrc=None, dash=None, reversescale=None, + showscale=None, width=None, **kwargs ): @@ -438,6 +465,10 @@ `line.cmin` will correspond to the last color in the array and `line.cmax` will correspond to the first color. + showscale + Determines whether or not a colorbar is displayed for + this trace. Has an effect only if in `line.color`is set + to a numerical array. width Sets the line width (in px). @@ -482,6 +513,7 @@ self._validators['colorsrc'] = v_line.ColorsrcValidator() self._validators['dash'] = v_line.DashValidator() self._validators['reversescale'] = v_line.ReversescaleValidator() + self._validators['showscale'] = v_line.ShowscaleValidator() self._validators['width'] = v_line.WidthValidator() # Populate data dict with properties @@ -505,6 +537,8 @@ self['dash'] = dash if dash is not None else _v _v = arg.pop('reversescale', None) self['reversescale'] = reversescale if reversescale is not None else _v + _v = arg.pop('showscale', None) + self['showscale'] = showscale if showscale is not None else _v _v = arg.pop('width', None) self['width'] = width if width is not None else _v diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scatter3d.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scatter3d.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scatter3d.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scatter3d.py 2019-02-08 23:00:22.000000000 +0000 @@ -592,6 +592,10 @@ numerical array. If true, `line.cmin` will correspond to the last color in the array and `line.cmax` will correspond to the first color. + showscale + Determines whether or not a colorbar is + displayed for this trace. Has an effect only if + in `line.color`is set to a numerical array. width Sets the line width (in px). @@ -1166,6 +1170,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1559,7 +1566,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1780,7 +1789,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1857,8 +1868,8 @@ # --------------------- self._validators['connectgaps'] = v_scatter3d.ConnectgapsValidator() self._validators['customdata'] = v_scatter3d.CustomdataValidator() - self._validators['customdatasrc' - ] = v_scatter3d.CustomdatasrcValidator() + self._validators['customdatasrc'] = v_scatter3d.CustomdatasrcValidator( + ) self._validators['error_x'] = v_scatter3d.ErrorXValidator() self._validators['error_y'] = v_scatter3d.ErrorYValidator() self._validators['error_z'] = v_scatter3d.ErrorZValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scattercarpet.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scattercarpet.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scattercarpet.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scattercarpet.py 2019-02-08 23:00:20.000000000 +0000 @@ -959,6 +959,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1248,7 +1251,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1461,7 +1466,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1536,8 +1543,8 @@ self._validators['b'] = v_scattercarpet.BValidator() self._validators['bsrc'] = v_scattercarpet.BsrcValidator() self._validators['carpet'] = v_scattercarpet.CarpetValidator() - self._validators['connectgaps' - ] = v_scattercarpet.ConnectgapsValidator() + self._validators['connectgaps'] = v_scattercarpet.ConnectgapsValidator( + ) self._validators['customdata'] = v_scattercarpet.CustomdataValidator() self._validators['customdatasrc' ] = v_scattercarpet.CustomdatasrcValidator() @@ -1550,8 +1557,8 @@ self._validators['hoveron'] = v_scattercarpet.HoveronValidator() self._validators['ids'] = v_scattercarpet.IdsValidator() self._validators['idssrc'] = v_scattercarpet.IdssrcValidator() - self._validators['legendgroup' - ] = v_scattercarpet.LegendgroupValidator() + self._validators['legendgroup'] = v_scattercarpet.LegendgroupValidator( + ) self._validators['line'] = v_scattercarpet.LineValidator() self._validators['marker'] = v_scattercarpet.MarkerValidator() self._validators['mode'] = v_scattercarpet.ModeValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scattergeo.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scattergeo.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scattergeo.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scattergeo.py 2019-02-08 23:00:17.000000000 +0000 @@ -273,6 +273,60 @@ def hoverlabel(self, val): self['hoverlabel'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # hovertext # --------- @property @@ -1025,6 +1079,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1177,6 +1234,26 @@ hoverlabel plotly.graph_objs.scattergeo.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair or item in `locations`. If a single string, the @@ -1267,7 +1344,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1308,6 +1387,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -1388,6 +1469,26 @@ hoverlabel plotly.graph_objs.scattergeo.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair or item in `locations`. If a single string, the @@ -1478,7 +1579,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1548,6 +1651,10 @@ self._validators['hoverinfo'] = v_scattergeo.HoverinfoValidator() self._validators['hoverinfosrc'] = v_scattergeo.HoverinfosrcValidator() self._validators['hoverlabel'] = v_scattergeo.HoverlabelValidator() + self._validators['hovertemplate' + ] = v_scattergeo.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_scattergeo.HovertemplatesrcValidator() self._validators['hovertext'] = v_scattergeo.HovertextValidator() self._validators['hovertextsrc'] = v_scattergeo.HovertextsrcValidator() self._validators['ids'] = v_scattergeo.IdsValidator() @@ -1602,6 +1709,12 @@ self['hoverinfosrc'] = hoverinfosrc if hoverinfosrc is not None else _v _v = arg.pop('hoverlabel', None) self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('hovertext', None) self['hovertext'] = hovertext if hovertext is not None else _v _v = arg.pop('hovertextsrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scattergl.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scattergl.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scattergl.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scattergl.py 2019-02-08 23:00:14.000000000 +0000 @@ -1117,6 +1117,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1598,7 +1601,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1866,7 +1871,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1958,8 +1965,8 @@ # --------------------- self._validators['connectgaps'] = v_scattergl.ConnectgapsValidator() self._validators['customdata'] = v_scattergl.CustomdataValidator() - self._validators['customdatasrc' - ] = v_scattergl.CustomdatasrcValidator() + self._validators['customdatasrc'] = v_scattergl.CustomdatasrcValidator( + ) self._validators['dx'] = v_scattergl.DxValidator() self._validators['dy'] = v_scattergl.DyValidator() self._validators['error_x'] = v_scattergl.ErrorXValidator() @@ -1969,8 +1976,8 @@ self._validators['hoverinfo'] = v_scattergl.HoverinfoValidator() self._validators['hoverinfosrc'] = v_scattergl.HoverinfosrcValidator() self._validators['hoverlabel'] = v_scattergl.HoverlabelValidator() - self._validators['hovertemplate' - ] = v_scattergl.HovertemplateValidator() + self._validators['hovertemplate'] = v_scattergl.HovertemplateValidator( + ) self._validators['hovertemplatesrc' ] = v_scattergl.HovertemplatesrcValidator() self._validators['hovertext'] = v_scattergl.HovertextValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scattermapbox.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scattermapbox.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scattermapbox.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scattermapbox.py 2019-02-08 23:00:11.000000000 +0000 @@ -248,6 +248,60 @@ def hoverlabel(self, val): self['hoverlabel'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # hovertext # --------- @property @@ -911,6 +965,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1054,6 +1111,26 @@ hoverlabel plotly.graph_objs.scattermapbox.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair If a single string, the same string appears over @@ -1135,7 +1212,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1175,6 +1254,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -1245,6 +1326,26 @@ hoverlabel plotly.graph_objs.scattermapbox.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (lon,lat) pair If a single string, the same string appears over @@ -1326,7 +1427,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1386,8 +1489,8 @@ # Initialize validators # --------------------- - self._validators['connectgaps' - ] = v_scattermapbox.ConnectgapsValidator() + self._validators['connectgaps'] = v_scattermapbox.ConnectgapsValidator( + ) self._validators['customdata'] = v_scattermapbox.CustomdataValidator() self._validators['customdatasrc' ] = v_scattermapbox.CustomdatasrcValidator() @@ -1397,6 +1500,10 @@ self._validators['hoverinfosrc' ] = v_scattermapbox.HoverinfosrcValidator() self._validators['hoverlabel'] = v_scattermapbox.HoverlabelValidator() + self._validators['hovertemplate' + ] = v_scattermapbox.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_scattermapbox.HovertemplatesrcValidator() self._validators['hovertext'] = v_scattermapbox.HovertextValidator() self._validators['hovertextsrc' ] = v_scattermapbox.HovertextsrcValidator() @@ -1404,8 +1511,8 @@ self._validators['idssrc'] = v_scattermapbox.IdssrcValidator() self._validators['lat'] = v_scattermapbox.LatValidator() self._validators['latsrc'] = v_scattermapbox.LatsrcValidator() - self._validators['legendgroup' - ] = v_scattermapbox.LegendgroupValidator() + self._validators['legendgroup'] = v_scattermapbox.LegendgroupValidator( + ) self._validators['line'] = v_scattermapbox.LineValidator() self._validators['lon'] = v_scattermapbox.LonValidator() self._validators['lonsrc'] = v_scattermapbox.LonsrcValidator() @@ -1448,6 +1555,12 @@ self['hoverinfosrc'] = hoverinfosrc if hoverinfosrc is not None else _v _v = arg.pop('hoverlabel', None) self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('hovertext', None) self['hovertext'] = hovertext if hovertext is not None else _v _v = arg.pop('hovertextsrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scatterpolargl.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scatterpolargl.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scatterpolargl.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scatterpolargl.py 2019-02-08 23:00:06.000000000 +0000 @@ -307,6 +307,60 @@ def hoverlabel(self, val): self['hoverlabel'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # hovertext # --------- @property @@ -1079,6 +1133,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1250,6 +1307,26 @@ hoverlabel plotly.graph_objs.scatterpolargl.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -1346,7 +1423,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1388,6 +1467,8 @@ hoverinfo=None, hoverinfosrc=None, hoverlabel=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -1489,6 +1570,26 @@ hoverlabel plotly.graph_objs.scatterpolargl.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -1585,7 +1686,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1658,6 +1761,10 @@ self._validators['hoverinfosrc' ] = v_scatterpolargl.HoverinfosrcValidator() self._validators['hoverlabel'] = v_scatterpolargl.HoverlabelValidator() + self._validators['hovertemplate' + ] = v_scatterpolargl.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_scatterpolargl.HovertemplatesrcValidator() self._validators['hovertext'] = v_scatterpolargl.HovertextValidator() self._validators['hovertextsrc' ] = v_scatterpolargl.HovertextsrcValidator() @@ -1718,6 +1825,12 @@ self['hoverinfosrc'] = hoverinfosrc if hoverinfosrc is not None else _v _v = arg.pop('hoverlabel', None) self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('hovertext', None) self['hovertext'] = hovertext if hovertext is not None else _v _v = arg.pop('hovertextsrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scatterpolar.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scatterpolar.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scatterpolar.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scatterpolar.py 2019-02-08 23:00:09.000000000 +0000 @@ -344,6 +344,60 @@ def hoveron(self, val): self['hoveron'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # hovertext # --------- @property @@ -1132,6 +1186,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1302,6 +1359,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -1398,7 +1475,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1442,6 +1521,8 @@ hoverinfosrc=None, hoverlabel=None, hoveron=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -1544,6 +1625,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over @@ -1640,7 +1741,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1714,6 +1817,10 @@ ] = v_scatterpolar.HoverinfosrcValidator() self._validators['hoverlabel'] = v_scatterpolar.HoverlabelValidator() self._validators['hoveron'] = v_scatterpolar.HoveronValidator() + self._validators['hovertemplate' + ] = v_scatterpolar.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_scatterpolar.HovertemplatesrcValidator() self._validators['hovertext'] = v_scatterpolar.HovertextValidator() self._validators['hovertextsrc' ] = v_scatterpolar.HovertextsrcValidator() @@ -1777,6 +1884,12 @@ self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v _v = arg.pop('hoveron', None) self['hoveron'] = hoveron if hoveron is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('hovertext', None) self['hovertext'] = hovertext if hovertext is not None else _v _v = arg.pop('hovertextsrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scatter.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scatter.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scatter.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scatter.py 2019-02-08 23:00:25.000000000 +0000 @@ -1391,6 +1391,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1943,7 +1946,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2294,7 +2299,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -2416,8 +2423,8 @@ self._validators['r'] = v_scatter.RValidator() self._validators['rsrc'] = v_scatter.RsrcValidator() self._validators['selected'] = v_scatter.SelectedValidator() - self._validators['selectedpoints' - ] = v_scatter.SelectedpointsValidator() + self._validators['selectedpoints'] = v_scatter.SelectedpointsValidator( + ) self._validators['showlegend'] = v_scatter.ShowlegendValidator() self._validators['stackgaps'] = v_scatter.StackgapsValidator() self._validators['stackgroup'] = v_scatter.StackgroupValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_scatterternary.py plotly-3.6.1+dfsg1/plotly/graph_objs/_scatterternary.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_scatterternary.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_scatterternary.py 2019-02-08 23:00:04.000000000 +0000 @@ -431,6 +431,60 @@ def hoveron(self, val): self['hoveron'] = val + # hovertemplate + # ------------- + @property + def hovertemplate(self): + """ + Template string used for rendering the information that appear + on hover box. Note that this will override `hoverinfo`. + Variables are inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's syntax + %{variable:d3-format}, for example "Price: %{y:$.2f}". See http + s://github.com/d3/d3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The variables available + in `hovertemplate` are the ones emitted as event data described + at this link https://plot.ly/javascript/plotlyjs-events/#event- + data. Additionally, every attributes that can be specified per- + point (the ones that are `arrayOk: true`) are available. + Anything contained in tag `` is displayed in the + secondary box, for example "{fullData.name}". + + The 'hovertemplate' property is a string and must be specified as: + - A string + - A number that will be converted to a string + - A tuple, list, or one-dimensional numpy array of the above + + Returns + ------- + str|numpy.ndarray + """ + return self['hovertemplate'] + + @hovertemplate.setter + def hovertemplate(self, val): + self['hovertemplate'] = val + + # hovertemplatesrc + # ---------------- + @property + def hovertemplatesrc(self): + """ + Sets the source reference on plot.ly for hovertemplate . + + The 'hovertemplatesrc' property must be specified as a string or + as a plotly.grid_objs.Column object + + Returns + ------- + str + """ + return self['hovertemplatesrc'] + + @hovertemplatesrc.setter + def hovertemplatesrc(self, val): + self['hovertemplatesrc'] = val + # hovertext # --------- @property @@ -1099,6 +1153,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1288,6 +1345,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (a,b,c) point. If a single string, the same string appears over @@ -1372,7 +1449,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1420,6 +1499,8 @@ hoverinfosrc=None, hoverlabel=None, hoveron=None, + hovertemplate=None, + hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, @@ -1530,6 +1611,26 @@ regions? If the fill is "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the information that + appear on hover box. Note that this will override + `hoverinfo`. Variables are inserted using %{variable}, + for example "y: %{y}". Numbers are formatted using + d3-format's syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d3-format + /blob/master/README.md#locale_format for details on the + formatting syntax. The variables available in + `hovertemplate` are the ones emitted as event data + described at this link + https://plot.ly/javascript/plotlyjs-events/#event-data. + Additionally, every attributes that can be specified + per-point (the ones that are `arrayOk: true`) are + available. Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for hovertemplate + . hovertext Sets hover text elements associated with each (a,b,c) point. If a single string, the same string appears over @@ -1614,7 +1715,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1693,6 +1796,10 @@ ] = v_scatterternary.HoverinfosrcValidator() self._validators['hoverlabel'] = v_scatterternary.HoverlabelValidator() self._validators['hoveron'] = v_scatterternary.HoveronValidator() + self._validators['hovertemplate' + ] = v_scatterternary.HovertemplateValidator() + self._validators['hovertemplatesrc' + ] = v_scatterternary.HovertemplatesrcValidator() self._validators['hovertext'] = v_scatterternary.HovertextValidator() self._validators['hovertextsrc' ] = v_scatterternary.HovertextsrcValidator() @@ -1759,6 +1866,12 @@ self['hoverlabel'] = hoverlabel if hoverlabel is not None else _v _v = arg.pop('hoveron', None) self['hoveron'] = hoveron if hoveron is not None else _v + _v = arg.pop('hovertemplate', None) + self['hovertemplate' + ] = hovertemplate if hovertemplate is not None else _v + _v = arg.pop('hovertemplatesrc', None) + self['hovertemplatesrc' + ] = hovertemplatesrc if hovertemplatesrc is not None else _v _v = arg.pop('hovertext', None) self['hovertext'] = hovertext if hovertext is not None else _v _v = arg.pop('hovertextsrc', None) diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_splom.py plotly-3.6.1+dfsg1/plotly/graph_objs/_splom.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_splom.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_splom.py 2019-02-08 23:00:01.000000000 +0000 @@ -691,6 +691,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -940,7 +943,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1111,7 +1116,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_streamtube.py plotly-3.6.1+dfsg1/plotly/graph_objs/_streamtube.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_streamtube.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_streamtube.py 2019-02-08 23:00:00.000000000 +0000 @@ -970,6 +970,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1394,7 +1397,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1623,7 +1628,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_surface.py plotly-3.6.1+dfsg1/plotly/graph_objs/_surface.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_surface.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_surface.py 2019-02-08 22:59:58.000000000 +0000 @@ -977,6 +977,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -1377,7 +1380,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1607,7 +1612,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1682,8 +1689,8 @@ # Initialize validators # --------------------- - self._validators['autocolorscale' - ] = v_surface.AutocolorscaleValidator() + self._validators['autocolorscale'] = v_surface.AutocolorscaleValidator( + ) self._validators['cauto'] = v_surface.CautoValidator() self._validators['cmax'] = v_surface.CmaxValidator() self._validators['cmin'] = v_surface.CminValidator() @@ -1705,8 +1712,8 @@ self._validators['opacity'] = v_surface.OpacityValidator() self._validators['reversescale'] = v_surface.ReversescaleValidator() self._validators['scene'] = v_surface.SceneValidator() - self._validators['selectedpoints' - ] = v_surface.SelectedpointsValidator() + self._validators['selectedpoints'] = v_surface.SelectedpointsValidator( + ) self._validators['showlegend'] = v_surface.ShowlegendValidator() self._validators['showscale'] = v_surface.ShowscaleValidator() self._validators['stream'] = v_surface.StreamValidator() diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/table/cells/_fill.py plotly-3.6.1+dfsg1/plotly/graph_objs/table/cells/_fill.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/table/cells/_fill.py 2018-12-25 11:59:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/table/cells/_fill.py 2019-02-08 23:44:06.000000000 +0000 @@ -10,7 +10,7 @@ def color(self): """ Sets the cell fill color. It accepts either a specific color or - an array of colors. + an array of colors or a 2D array of colors. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') @@ -98,7 +98,7 @@ return """\ color Sets the cell fill color. It accepts either a specific - color or an array of colors. + color or an array of colors or a 2D array of colors. colorsrc Sets the source reference on plot.ly for color . """ @@ -114,7 +114,7 @@ an instance of plotly.graph_objs.table.cells.Fill color Sets the cell fill color. It accepts either a specific - color or an array of colors. + color or an array of colors or a 2D array of colors. colorsrc Sets the source reference on plot.ly for color . diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/table/_cells.py plotly-3.6.1+dfsg1/plotly/graph_objs/table/_cells.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/table/_cells.py 2018-12-25 11:59:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/table/_cells.py 2019-02-08 23:44:06.000000000 +0000 @@ -64,7 +64,8 @@ color Sets the cell fill color. It accepts either a - specific color or an array of colors. + specific color or an array of colors or a 2D + array of colors. colorsrc Sets the source reference on plot.ly for color . diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/table/header/_fill.py plotly-3.6.1+dfsg1/plotly/graph_objs/table/header/_fill.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/table/header/_fill.py 2018-12-25 11:59:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/table/header/_fill.py 2019-02-08 23:44:06.000000000 +0000 @@ -10,7 +10,7 @@ def color(self): """ Sets the cell fill color. It accepts either a specific color or - an array of colors. + an array of colors or a 2D array of colors. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') @@ -98,7 +98,7 @@ return """\ color Sets the cell fill color. It accepts either a specific - color or an array of colors. + color or an array of colors or a 2D array of colors. colorsrc Sets the source reference on plot.ly for color . """ @@ -114,7 +114,7 @@ an instance of plotly.graph_objs.table.header.Fill color Sets the cell fill color. It accepts either a specific - color or an array of colors. + color or an array of colors or a 2D array of colors. colorsrc Sets the source reference on plot.ly for color . diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/table/_header.py plotly-3.6.1+dfsg1/plotly/graph_objs/table/_header.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/table/_header.py 2018-12-25 11:59:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/table/_header.py 2019-02-08 23:44:06.000000000 +0000 @@ -64,7 +64,8 @@ color Sets the cell fill color. It accepts either a - specific color or an array of colors. + specific color or an array of colors or a 2D + array of colors. colorsrc Sets the source reference on plot.ly for color . diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_table.py plotly-3.6.1+dfsg1/plotly/graph_objs/_table.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_table.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_table.py 2019-02-08 22:59:56.000000000 +0000 @@ -600,6 +600,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -755,7 +758,9 @@ plotly.graph_objs.table.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -891,7 +896,9 @@ plotly.graph_objs.table.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well diff -Nru plotly-3.5.0+dfsg1/plotly/graph_objs/_violin.py plotly-3.6.1+dfsg1/plotly/graph_objs/_violin.py --- plotly-3.5.0+dfsg1/plotly/graph_objs/_violin.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/graph_objs/_violin.py 2019-02-08 22:59:55.000000000 +0000 @@ -880,6 +880,9 @@ @property def uid(self): """ + Assign an id to this trace, Use this to provide object + constancy between traces during animations and transitions. + The 'uid' property is a string and must be specified as: - A string - A number that will be converted to a string @@ -977,6 +980,28 @@ def visible(self, val): self['visible'] = val + # width + # ----- + @property + def width(self): + """ + Sets the width of the violin in data coordinates. If 0 (default + value) the width is automatically selected based on the + positions of other violin traces in the same subplot. + + The 'width' property is a number and may be specified as: + - An int or float in the interval [0, inf] + + Returns + ------- + int|float + """ + return self['width'] + + @width.setter + def width(self, val): + self['width'] = val + # x # - @property @@ -1302,7 +1327,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1329,6 +1356,11 @@ "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible). + width + Sets the width of the violin in data coordinates. If 0 + (default value) the width is automatically selected + based on the positions of other violin traces in the + same subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -1396,6 +1428,7 @@ uirevision=None, unselected=None, visible=None, + width=None, x=None, x0=None, xaxis=None, @@ -1559,7 +1592,9 @@ textsrc Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide object + constancy between traces during animations and + transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well @@ -1586,6 +1621,11 @@ "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible). + width + Sets the width of the violin in data coordinates. If 0 + (default value) the width is automatically selected + based on the positions of other violin traces in the + same subplot. x Sets the x sample data or coordinates. See overview for more info. @@ -1681,6 +1721,7 @@ self._validators['uirevision'] = v_violin.UirevisionValidator() self._validators['unselected'] = v_violin.UnselectedValidator() self._validators['visible'] = v_violin.VisibleValidator() + self._validators['width'] = v_violin.WidthValidator() self._validators['x'] = v_violin.XValidator() self._validators['x0'] = v_violin.X0Validator() self._validators['xaxis'] = v_violin.XAxisValidator() @@ -1766,6 +1807,8 @@ self['unselected'] = unselected if unselected is not None else _v _v = arg.pop('visible', None) self['visible'] = visible if visible is not None else _v + _v = arg.pop('width', None) + self['width'] = width if width is not None else _v _v = arg.pop('x', None) self['x'] = x if x is not None else _v _v = arg.pop('x0', None) diff -Nru plotly-3.5.0+dfsg1/plotly/grid_objs/grid_objs.py plotly-3.6.1+dfsg1/plotly/grid_objs/grid_objs.py --- plotly-3.5.0+dfsg1/plotly/grid_objs/grid_objs.py 2018-06-09 12:07:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/grid_objs/grid_objs.py 2019-02-05 11:22:17.000000000 +0000 @@ -5,7 +5,10 @@ """ from __future__ import absolute_import -from collections import MutableSequence +try: + from collections.abc import MutableSequence +except ImportError: + from collections import MutableSequence from requests.compat import json as _json diff -Nru plotly-3.5.0+dfsg1/plotly/matplotlylib/mplexporter/exporter.py plotly-3.6.1+dfsg1/plotly/matplotlylib/mplexporter/exporter.py --- plotly-3.5.0+dfsg1/plotly/matplotlylib/mplexporter/exporter.py 2018-07-05 17:46:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/matplotlylib/mplexporter/exporter.py 2019-01-26 01:18:29.000000000 +0000 @@ -10,7 +10,7 @@ import matplotlib from matplotlib import transforms, collections - +from matplotlib.backends.backend_agg import FigureCanvasAgg class Exporter(object): """Matplotlib Exporter @@ -42,6 +42,8 @@ """ # Calling savefig executes the draw() command, putting elements # in the correct place. + if fig.canvas is None: + canvas = FigureCanvasAgg(fig) fig.savefig(io.BytesIO(), format='png', dpi=fig.dpi) if self.close_mpl: import matplotlib.pyplot as plt @@ -157,13 +159,16 @@ # force a large zorder so it appears on top child.set_zorder(1E6 + child.get_zorder()) + # reorder border box to make sure marks are visible + if isinstance(child, matplotlib.patches.FancyBboxPatch): + child.set_zorder(child.get_zorder()-1) + try: # What kind of object... if isinstance(child, matplotlib.patches.Patch): self.draw_patch(ax, child, force_trans=ax.transAxes) elif isinstance(child, matplotlib.text.Text): - if not (child is legend.get_children()[-1] - and child.get_text() == 'None'): + if child.get_text() != 'None': self.draw_text(ax, child, force_trans=ax.transAxes) elif isinstance(child, matplotlib.lines.Line2D): self.draw_line(ax, child, force_trans=ax.transAxes) @@ -181,7 +186,8 @@ ax, line.get_xydata(), force_trans=force_trans) linestyle = utils.get_line_style(line) - if linestyle['dasharray'] in ['None', 'none', None]: + if (linestyle['dasharray'] is None + and linestyle['drawstyle'] == 'default'): linestyle = None markerstyle = utils.get_marker_style(line) if (markerstyle['marker'] in ['None', 'none', None] diff -Nru plotly-3.5.0+dfsg1/plotly/matplotlylib/mplexporter/renderers/base.py plotly-3.6.1+dfsg1/plotly/matplotlylib/mplexporter/renderers/base.py --- plotly-3.5.0+dfsg1/plotly/matplotlylib/mplexporter/renderers/base.py 2018-06-11 12:42:21.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/matplotlylib/mplexporter/renderers/base.py 2019-01-26 01:18:29.000000000 +0000 @@ -1,8 +1,10 @@ import warnings import itertools from contextlib import contextmanager +from distutils.version import LooseVersion import numpy as np +import matplotlib as mpl from matplotlib import transforms from .. import utils @@ -189,8 +191,11 @@ """Build an iterator over the elements of the path collection""" N = max(len(paths), len(offsets)) - if not path_transforms: - path_transforms = [np.eye(3)] + # Before mpl 1.4.0, path_transform can be a false-y value, not a valid + # transformation matrix. + if LooseVersion(mpl.__version__) < LooseVersion('1.4.0'): + if path_transforms is None: + path_transforms = [np.eye(3)] edgecolor = styles['edgecolor'] if np.size(edgecolor) == 0: @@ -260,8 +265,8 @@ # This is a hack: if path_coordinates == "figure": path_coordinates = "points" - style = {"edgecolor": utils.color_to_hex(ec), - "facecolor": utils.color_to_hex(fc), + style = {"edgecolor": utils.export_color(ec), + "facecolor": utils.export_color(fc), "edgewidth": lw, "dasharray": "10,0", "alpha": styles['alpha'], diff -Nru plotly-3.5.0+dfsg1/plotly/matplotlylib/mplexporter/utils.py plotly-3.6.1+dfsg1/plotly/matplotlylib/mplexporter/utils.py --- plotly-3.5.0+dfsg1/plotly/matplotlylib/mplexporter/utils.py 2018-06-11 12:42:21.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/matplotlylib/mplexporter/utils.py 2019-01-26 01:18:29.000000000 +0000 @@ -18,29 +18,33 @@ from matplotlib import ticker -def color_to_hex(color): - """Convert matplotlib color code to hex color code""" +def export_color(color): + """Convert matplotlib color code to hex color or RGBA color""" if color is None or colorConverter.to_rgba(color)[3] == 0: return 'none' - else: + elif colorConverter.to_rgba(color)[3] == 1: rgb = colorConverter.to_rgb(color) return '#{0:02X}{1:02X}{2:02X}'.format(*(int(255 * c) for c in rgb)) + else: + c = colorConverter.to_rgba(color) + return "rgba(" + ", ".join(str(int(np.round(val * 255))) + for val in c[:3])+', '+str(c[3])+")" -def many_to_one(input_dict): +def _many_to_one(input_dict): """Convert a many-to-one mapping to a one-to-one mapping""" return dict((key, val) for keys, val in input_dict.items() for key in keys) -LINESTYLES = many_to_one({('solid', '-', (None, None)): "10,0", - ('dashed', '--'): "6,6", - ('dotted', ':'): "2,2", - ('dashdot', '-.'): "4,4,2,4", - ('', ' ', 'None', 'none'): "none"}) +LINESTYLES = _many_to_one({('solid', '-', (None, None)): 'none', + ('dashed', '--'): "6,6", + ('dotted', ':'): "2,2", + ('dashdot', '-.'): "4,4,2,4", + ('', ' ', 'None', 'none'): None}) -def get_dasharray(obj, i=None): +def get_dasharray(obj): """Get an SVG dash array for the given matplotlib linestyle Parameters @@ -48,7 +52,6 @@ obj : matplotlib object The matplotlib line or path object, which must have a get_linestyle() method which returns a valid matplotlib line code - i : integer (optional) Returns ------- @@ -59,14 +62,11 @@ return ','.join(map(str, obj._dashSeq)) else: ls = obj.get_linestyle() - if i is not None: - ls = ls[i] - - dasharray = LINESTYLES.get(ls, None) - if dasharray is None: - warnings.warn("dash style '{0}' not understood: " - "defaulting to solid.".format(ls)) - dasharray = LINESTYLES['-'] + dasharray = LINESTYLES.get(ls, 'not found') + if dasharray == 'not found': + warnings.warn("line style '{0}' not understood: " + "defaulting to solid line.".format(ls)) + dasharray = LINESTYLES['solid'] return dasharray @@ -121,9 +121,9 @@ style['alpha'] = path.get_alpha() if style['alpha'] is None: style['alpha'] = 1 - style['edgecolor'] = color_to_hex(path.get_edgecolor()) + style['edgecolor'] = export_color(path.get_edgecolor()) if fill: - style['facecolor'] = color_to_hex(path.get_facecolor()) + style['facecolor'] = export_color(path.get_facecolor()) else: style['facecolor'] = 'none' style['edgewidth'] = path.get_linewidth() @@ -138,10 +138,11 @@ style['alpha'] = line.get_alpha() if style['alpha'] is None: style['alpha'] = 1 - style['color'] = color_to_hex(line.get_color()) + style['color'] = export_color(line.get_color()) style['linewidth'] = line.get_linewidth() style['dasharray'] = get_dasharray(line) style['zorder'] = line.get_zorder() + style['drawstyle'] = line.get_drawstyle() return style @@ -152,8 +153,8 @@ if style['alpha'] is None: style['alpha'] = 1 - style['facecolor'] = color_to_hex(line.get_markerfacecolor()) - style['edgecolor'] = color_to_hex(line.get_markeredgecolor()) + style['facecolor'] = export_color(line.get_markerfacecolor()) + style['edgecolor'] = export_color(line.get_markeredgecolor()) style['edgewidth'] = line.get_markeredgewidth() style['marker'] = line.get_marker() @@ -175,9 +176,10 @@ if style['alpha'] is None: style['alpha'] = 1 style['fontsize'] = text.get_size() - style['color'] = color_to_hex(text.get_color()) + style['color'] = export_color(text.get_color()) style['halign'] = text.get_horizontalalignment() # left, center, right style['valign'] = text.get_verticalalignment() # baseline, center, top + style['malign'] = text._multialignment # text alignment when '\n' in text style['rotation'] = text.get_rotation() style['zorder'] = text.get_zorder() return style @@ -213,6 +215,8 @@ formatter = axis.get_major_formatter() if isinstance(formatter, ticker.NullFormatter): props['tickformat'] = "" + elif isinstance(formatter, ticker.FixedFormatter): + props['tickformat'] = list(formatter.seq) elif not any(label.get_visible() for label in axis.get_ticklabels()): props['tickformat'] = "" else: @@ -231,13 +235,16 @@ # Get associated grid props['grid'] = get_grid_style(axis) + # get axis visibility + props['visible'] = axis.get_visible() + return props def get_grid_style(axis): gridlines = axis.get_gridlines() if axis._gridOnMajor and len(gridlines) > 0: - color = color_to_hex(gridlines[0].get_color()) + color = export_color(gridlines[0].get_color()) alpha = gridlines[0].get_alpha() dasharray = get_dasharray(gridlines[0]) return dict(gridOn=True, @@ -245,7 +252,7 @@ dasharray=dasharray, alpha=alpha) else: - return {"gridOn":False} + return {"gridOn": False} def get_figure_properties(fig): @@ -255,12 +262,13 @@ def get_axes_properties(ax): - props = {'axesbg': color_to_hex(ax.patch.get_facecolor()), + props = {'axesbg': export_color(ax.patch.get_facecolor()), 'axesbgalpha': ax.patch.get_alpha(), 'bounds': ax.get_position().bounds, 'dynamic': ax.get_navigate(), 'axison': ax.axison, 'frame_on': ax.get_frame_on(), + 'patch_visible':ax.patch.get_visible(), 'axes': [get_axis_properties(ax.xaxis), get_axis_properties(ax.yaxis)]} @@ -293,7 +301,7 @@ if scale not in ['date', 'linear', 'log']: raise ValueError("Unknown axis scale: " - "{0}".format(axis[axname].get_scale())) + "{0}".format(axis.get_scale())) props[axname + 'scale'] = scale props[axname + 'lim'] = lim @@ -324,7 +332,7 @@ handles, labels = ax.get_legend_handles_labels() visible = legend.get_visible() return {'handles': handles, 'labels': labels, 'visible': visible} - + def image_to_base64(image): """ diff -Nru plotly-3.5.0+dfsg1/plotly/offline/_plotlyjs_version.py plotly-3.6.1+dfsg1/plotly/offline/_plotlyjs_version.py --- plotly-3.5.0+dfsg1/plotly/offline/_plotlyjs_version.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/offline/_plotlyjs_version.py 2019-02-08 23:44:06.000000000 +0000 @@ -1,3 +1,3 @@ # DO NOT EDIT # This file is generated by the updatebundle setup.py command -__plotlyjs_version__ = '1.43.1' +__plotlyjs_version__ = '1.44.3' diff -Nru plotly-3.5.0+dfsg1/plotly/package_data/plot-schema.json plotly-3.6.1+dfsg1/plotly/package_data/plot-schema.json --- plotly-3.5.0+dfsg1/plotly/package_data/plot-schema.json 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/package_data/plot-schema.json 2019-02-08 23:44:06.000000000 +0000 @@ -227,11 +227,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -396,6 +399,7 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "role": "data" }, @@ -404,6 +408,7 @@ "dflt": 0, "role": "info", "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." }, "dx": { @@ -411,11 +416,13 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info." }, "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "role": "data" }, @@ -424,6 +431,7 @@ "dflt": 0, "role": "info", "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." }, "dy": { @@ -431,6 +439,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info." }, "stackgroup": { @@ -526,6 +535,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the line color." }, "width": { @@ -534,6 +544,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "shape": { @@ -618,6 +629,7 @@ "valType": "color", "role": "style", "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." }, "marker": { @@ -922,6 +934,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity." }, "size": { @@ -931,6 +944,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "maxdisplayed": { @@ -1468,6 +1482,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -1476,7 +1491,8 @@ "arrayOk": true, "role": "style", "editType": "style", - "description": "Sets themarker.linecolor. 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 `marker.line.cmin` and `marker.line.cmax` if set." + "description": "Sets themarker.linecolor. 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 `marker.line.cmin` and `marker.line.cmax` if set.", + "anim": true }, "cauto": { "valType": "boolean", @@ -1588,7 +1604,8 @@ "arrayOk": true, "role": "style", "editType": "style", - "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set." + "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set.", + "anim": true }, "cauto": { "valType": "boolean", @@ -2239,11 +2256,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -2408,6 +2428,7 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "role": "data" }, @@ -2416,6 +2437,7 @@ "dflt": 0, "role": "info", "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." }, "dx": { @@ -2423,11 +2445,13 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info." }, "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "role": "data" }, @@ -2436,6 +2460,7 @@ "dflt": 0, "role": "info", "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." }, "dy": { @@ -2443,6 +2468,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info." }, "text": { @@ -2681,6 +2707,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points.", "dflt": 0 }, @@ -3898,11 +3925,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -4177,6 +4207,14 @@ "editType": "calc+clearAxisTypes", "description": "Sets the orientation of the box(es). If *v* (*h*), the distribution is visualized along the vertical (horizontal)." }, + "width": { + "valType": "number", + "min": 0, + "role": "info", + "dflt": 0, + "editType": "calc", + "description": "Sets the width of the box in data coordinate If *0* (default value) the width is automatically selected based on the positions of other box traces in the same subplot." + }, "marker": { "outliercolor": { "valType": "color", @@ -4486,6 +4524,7 @@ "arrayOk": false, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity.", "dflt": 1 }, @@ -4496,6 +4535,7 @@ "arrayOk": false, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "color": { @@ -4503,7 +4543,8 @@ "arrayOk": false, "role": "style", "editType": "style", - "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set." + "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set.", + "anim": true }, "line": { "color": { @@ -4512,6 +4553,7 @@ "role": "style", "editType": "style", "description": "Sets themarker.linecolor. 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 `marker.line.cmin` and `marker.line.cmax` if set.", + "anim": true, "dflt": "#444" }, "width": { @@ -4520,6 +4562,7 @@ "arrayOk": false, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points.", "dflt": 0 }, @@ -4565,6 +4608,7 @@ "valType": "color", "role": "style", "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." }, "selected": { @@ -4747,7 +4791,7 @@ "dflt": "overlay", "role": "info", "editType": "calc", - "description": "Determines how boxes at the same location coordinate are displayed on the graph. If *group*, the boxes are plotted next to one another centered around the shared location. If *overlay*, the boxes are plotted over one another, you might need to set *opacity* to see them multiple boxes." + "description": "Determines how boxes at the same location coordinate are displayed on the graph. If *group*, the boxes are plotted next to one another centered around the shared location. If *overlay*, the boxes are plotted over one another, you might need to set *opacity* to see them multiple boxes. Has no effect on traces that have *width* set." }, "boxgap": { "valType": "number", @@ -4756,7 +4800,7 @@ "dflt": 0.3, "role": "style", "editType": "calc", - "description": "Sets the gap (in plot fraction) between boxes of adjacent location coordinates." + "description": "Sets the gap (in plot fraction) between boxes of adjacent location coordinates. Has no effect on traces that have *width* set." }, "boxgroupgap": { "valType": "number", @@ -4765,7 +4809,7 @@ "dflt": 0.3, "role": "style", "editType": "calc", - "description": "Sets the gap (in plot fraction) between boxes of the same location coordinate." + "description": "Sets the gap (in plot fraction) between boxes of the same location coordinate. Has no effect on traces that have *width* set." } } }, @@ -4819,11 +4863,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -4984,6 +5031,7 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "impliedEdits": { "xtype": "array" @@ -4995,6 +5043,7 @@ "dflt": 0, "role": "info", "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.", "impliedEdits": { "xtype": "scaled" @@ -5005,6 +5054,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info.", "impliedEdits": { "xtype": "scaled" @@ -5013,6 +5063,7 @@ "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "impliedEdits": { "ytype": "array" @@ -5024,6 +5075,7 @@ "dflt": 0, "role": "info", "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.", "impliedEdits": { "ytype": "scaled" @@ -5034,6 +5086,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info.", "impliedEdits": { "ytype": "scaled" @@ -5826,11 +5879,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -6174,6 +6230,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points.", "dflt": 0 }, @@ -7344,11 +7401,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -8388,11 +8448,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -8848,6 +8911,7 @@ "valType": "color", "role": "style", "editType": "style+colorbars", + "anim": true, "description": "Sets the color of the contour level. Has no effect if `contours.coloring` is set to *lines*." }, "width": { @@ -8856,6 +8920,7 @@ "dflt": 2, "role": "style", "editType": "style+colorbars", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -9598,11 +9663,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -10405,11 +10473,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -10580,6 +10651,7 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "impliedEdits": { "xtype": "array" @@ -10591,6 +10663,7 @@ "dflt": 0, "role": "info", "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.", "impliedEdits": { "xtype": "scaled" @@ -10601,6 +10674,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info.", "impliedEdits": { "xtype": "scaled" @@ -10609,6 +10683,7 @@ "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "impliedEdits": { "ytype": "array" @@ -10620,6 +10695,7 @@ "dflt": 0, "role": "info", "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.", "impliedEdits": { "ytype": "scaled" @@ -10630,6 +10706,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info.", "impliedEdits": { "ytype": "scaled" @@ -10846,6 +10923,7 @@ "valType": "color", "role": "style", "editType": "style+colorbars", + "anim": true, "description": "Sets the color of the contour level. Has no effect if `contours.coloring` is set to *lines*." }, "width": { @@ -10854,6 +10932,7 @@ "dflt": 2, "role": "style", "editType": "style+colorbars", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -11596,11 +11675,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -11804,6 +11886,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the line color." }, "width": { @@ -11812,6 +11895,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -11882,6 +11966,7 @@ "valType": "color", "role": "style", "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." }, "marker": { @@ -12186,6 +12271,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity." }, "maxdisplayed": { @@ -12203,6 +12289,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -12238,6 +12325,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -13112,6 +13200,14 @@ "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*." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "none", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "subplot": { "valType": "subplotid", "role": "info", @@ -13172,6 +13268,12 @@ "role": "info", "description": "Sets the source reference on plot.ly for hoverinfo .", "editType": "none" + }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" } } }, @@ -13219,11 +13321,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -13500,6 +13605,7 @@ "valType": "color", "role": "style", "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." }, "points": { @@ -13531,6 +13637,14 @@ "editType": "calc", "description": "Sets the position of the sample points in relation to the violins. If *0*, the sample points are places over the center of the violins. Positive (negative) values correspond to positions to the right (left) for vertical violins and above (below) for horizontal violins." }, + "width": { + "valType": "number", + "min": 0, + "role": "info", + "dflt": 0, + "editType": "calc", + "description": "Sets the width of the violin in data coordinates. If *0* (default value) the width is automatically selected based on the positions of other violin traces in the same subplot." + }, "marker": { "outliercolor": { "valType": "color", @@ -13840,6 +13954,7 @@ "arrayOk": false, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity.", "dflt": 1 }, @@ -13850,6 +13965,7 @@ "arrayOk": false, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "color": { @@ -13857,7 +13973,8 @@ "arrayOk": false, "role": "style", "editType": "style", - "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set." + "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set.", + "anim": true }, "line": { "color": { @@ -13866,6 +13983,7 @@ "role": "style", "editType": "style", "description": "Sets themarker.linecolor. 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 `marker.line.cmin` and `marker.line.cmax` if set.", + "anim": true, "dflt": "#444" }, "width": { @@ -13874,6 +13992,7 @@ "arrayOk": false, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points.", "dflt": 0 }, @@ -13981,7 +14100,7 @@ ], "dflt": "both", "role": "info", - "editType": "plot", + "editType": "calc", "description": "Determines on which side of the position value the density function making up one half of a violin is plotted. Useful when comparing two violin traces under *overlay* mode, where one trace has `side` set to *positive* and the other to *negative*." }, "selected": { @@ -14118,7 +14237,7 @@ "dflt": "overlay", "role": "info", "editType": "calc", - "description": "Determines how violins at the same location coordinate are displayed on the graph. If *group*, the violins are plotted next to one another centered around the shared location. If *overlay*, the violins are plotted over one another, you might need to set *opacity* to see them multiple violins." + "description": "Determines how violins at the same location coordinate are displayed on the graph. If *group*, the violins are plotted next to one another centered around the shared location. If *overlay*, the violins are plotted over one another, you might need to set *opacity* to see them multiple violins. Has no effect on traces that have *width* set." }, "violingap": { "valType": "number", @@ -14127,7 +14246,7 @@ "dflt": 0.3, "role": "style", "editType": "calc", - "description": "Sets the gap (in plot fraction) between violins of adjacent location coordinates." + "description": "Sets the gap (in plot fraction) between violins of adjacent location coordinates. Has no effect on traces that have *width* set." }, "violingroupgap": { "valType": "number", @@ -14136,7 +14255,7 @@ "dflt": 0.3, "role": "style", "editType": "calc", - "description": "Sets the gap (in plot fraction) between violins of the same location coordinate." + "description": "Sets the gap (in plot fraction) between violins of the same location coordinate. Has no effect on traces that have *width* set." } } }, @@ -14191,11 +14310,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -14340,12 +14462,14 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "role": "data" }, "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "role": "data" }, @@ -14510,6 +14634,7 @@ "dflt": 2, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -14587,6 +14712,13 @@ "editType": "calc", "description": "Reverses the color mapping if true. Has an effect only if in `line.color`is set to a numerical array. If true, `line.cmin` will correspond to the last color in the array and `line.cmax` will correspond to the first color." }, + "showscale": { + "valType": "boolean", + "role": "info", + "dflt": false, + "editType": "calc", + "description": "Determines whether or not a colorbar is displayed for this trace. Has an effect only if in `line.color`is set to a numerical array." + }, "editType": "calc", "role": "object", "colorsrc": { @@ -14622,6 +14754,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -14657,6 +14790,7 @@ "arrayOk": false, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker opacity. Note that the marker opacity for scatter3d traces must be a scalar value for performance reasons. To set a blending opacity value (i.e. which is not transparent), set *marker.color* to an rgba color and use its alpha channel." }, "colorbar": { @@ -15160,6 +15294,7 @@ "arrayOk": false, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "color": { @@ -15918,11 +16053,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -16864,46 +17002,1356 @@ "highlight": { "valType": "boolean", "role": "info", - "dflt": true, - "description": "Determines whether or not contour lines about the z dimension are highlighted on hover.", + "dflt": true, + "description": "Determines whether or not contour lines about the z dimension are highlighted on hover.", + "editType": "calc" + }, + "highlightcolor": { + "valType": "color", + "role": "style", + "dflt": "#444", + "description": "Sets the color of the highlighted contour lines.", + "editType": "calc" + }, + "highlightwidth": { + "valType": "number", + "role": "style", + "min": 1, + "max": 16, + "dflt": 2, + "description": "Sets the width of the highlighted contour lines.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "editType": "calc", + "role": "object" + }, + "hidesurface": { + "valType": "boolean", + "role": "info", + "dflt": false, + "description": "Determines whether or not a surface is drawn. For example, set `hidesurface` to *false* `contours.x.show` to *true* and `contours.y.show` to *true* to draw a wire frame plot.", + "editType": "calc" + }, + "lightposition": { + "x": { + "valType": "number", + "role": "style", + "min": -100000, + "max": 100000, + "dflt": 10, + "description": "Numeric vector, representing the X coordinate for each vertex.", + "editType": "calc" + }, + "y": { + "valType": "number", + "role": "style", + "min": -100000, + "max": 100000, + "dflt": 10000, + "description": "Numeric vector, representing the Y coordinate for each vertex.", + "editType": "calc" + }, + "z": { + "valType": "number", + "role": "style", + "min": -100000, + "max": 100000, + "dflt": 0, + "description": "Numeric vector, representing the Z coordinate for each vertex.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "lighting": { + "ambient": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 0.8, + "description": "Ambient light increases overall color visibility but can wash out the image.", + "editType": "calc" + }, + "diffuse": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 0.8, + "description": "Represents the extent that incident rays are reflected in a range of angles.", + "editType": "calc" + }, + "specular": { + "valType": "number", + "role": "style", + "min": 0, + "max": 2, + "dflt": 0.05, + "description": "Represents the level that incident rays are reflected in a single direction, causing shine.", + "editType": "calc" + }, + "roughness": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 0.5, + "description": "Alters specular reflection; the rougher the surface, the wider and less contrasty the shine.", + "editType": "calc" + }, + "fresnel": { + "valType": "number", + "role": "style", + "min": 0, + "max": 5, + "dflt": 0.2, + "description": "Represents the reflectance as a dependency of the viewing angle; e.g. paper is reflective when viewing it from the edge of the paper (almost 90 degrees), causing shine.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "opacity": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the opacity of the surface.", + "editType": "calc" + }, + "_deprecated": { + "zauto": { + "description": "Obsolete. Use `cauto` instead.", + "editType": "calc" + }, + "zmin": { + "description": "Obsolete. Use `cmin` instead.", + "editType": "calc" + }, + "zmax": { + "description": "Obsolete. Use `cmax` instead.", + "editType": "calc" + } + }, + "hoverinfo": { + "valType": "flaglist", + "role": "info", + "flags": [ + "x", + "y", + "z", + "text", + "name" + ], + "extras": [ + "all", + "none", + "skip" + ], + "arrayOk": true, + "dflt": "all", + "editType": "calc", + "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." + }, + "xcalendar": { + "valType": "enumerated", + "values": [ + "gregorian", + "chinese", + "coptic", + "discworld", + "ethiopian", + "hebrew", + "islamic", + "julian", + "mayan", + "nanakshahi", + "nepali", + "persian", + "jalali", + "taiwan", + "thai", + "ummalqura" + ], + "role": "info", + "editType": "calc", + "dflt": "gregorian", + "description": "Sets the calendar system to use with `x` date data." + }, + "ycalendar": { + "valType": "enumerated", + "values": [ + "gregorian", + "chinese", + "coptic", + "discworld", + "ethiopian", + "hebrew", + "islamic", + "julian", + "mayan", + "nanakshahi", + "nepali", + "persian", + "jalali", + "taiwan", + "thai", + "ummalqura" + ], + "role": "info", + "editType": "calc", + "dflt": "gregorian", + "description": "Sets the calendar system to use with `y` date data." + }, + "zcalendar": { + "valType": "enumerated", + "values": [ + "gregorian", + "chinese", + "coptic", + "discworld", + "ethiopian", + "hebrew", + "islamic", + "julian", + "mayan", + "nanakshahi", + "nepali", + "persian", + "jalali", + "taiwan", + "thai", + "ummalqura" + ], + "role": "info", + "editType": "calc", + "dflt": "gregorian", + "description": "Sets the calendar system to use with `z` date data." + }, + "scene": { + "valType": "subplotid", + "role": "info", + "dflt": "scene", + "editType": "calc+clearAxisTypes", + "description": "Sets a reference between this trace's 3D coordinate system and a 3D scene. If *scene* (the default value), the (x,y,z) coordinates refer to `layout.scene`. If *scene2*, the (x,y,z) coordinates refer to `layout.scene2`, and so on." + }, + "idssrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for ids .", + "editType": "none" + }, + "customdatasrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for customdata .", + "editType": "none" + }, + "zsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for z .", + "editType": "none" + }, + "xsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for x .", + "editType": "none" + }, + "ysrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for y .", + "editType": "none" + }, + "textsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for text .", + "editType": "none" + }, + "surfacecolorsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for surfacecolor .", + "editType": "none" + }, + "hoverinfosrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hoverinfo .", + "editType": "none" + } + } + }, + "isosurface": { + "meta": { + "description": "Draws isosurfaces between iso-min and iso-max values with coordinates given by four 1-dimensional arrays containing the `value`, `x`, `y` and `z` of every vertex of a uniform or non-uniform 3-D grid. Horizontal or vertical slices, caps as well as spaceframe between iso-min and iso-max values could also be drawn using this trace." + }, + "attributes": { + "type": "isosurface", + "visible": { + "valType": "enumerated", + "values": [ + true, + false, + "legendonly" + ], + "role": "info", + "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)." + }, + "showlegend": { + "valType": "boolean", + "role": "info", + "dflt": true, + "editType": "style", + "description": "Determines whether or not an item corresponding to this trace is shown in the legend." + }, + "legendgroup": { + "valType": "string", + "role": "info", + "dflt": "", + "editType": "style", + "description": "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items." + }, + "opacity": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "editType": "style", + "description": "Sets the opacity of the trace." + }, + "name": { + "valType": "string", + "role": "info", + "editType": "style", + "description": "Sets the trace name. The trace name appear as the legend item and on hover." + }, + "uid": { + "valType": "string", + "role": "info", + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." + }, + "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.", + "role": "data" + }, + "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", + "role": "data" + }, + "selectedpoints": { + "valType": "any", + "role": "info", + "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." + }, + "hoverlabel": { + "bgcolor": { + "valType": "color", + "role": "style", + "arrayOk": true, + "editType": "none", + "description": "Sets the background color of the hover labels for this trace" + }, + "bordercolor": { + "valType": "color", + "role": "style", + "arrayOk": true, + "editType": "none", + "description": "Sets the border color of the hover labels for this trace." + }, + "font": { + "family": { + "valType": "string", + "role": "style", + "noBlank": true, + "strict": true, + "editType": "none", + "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 plotly service (at https://plot.ly 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*.", + "arrayOk": true + }, + "size": { + "valType": "number", + "role": "style", + "min": 1, + "editType": "none", + "arrayOk": true + }, + "color": { + "valType": "color", + "role": "style", + "editType": "none", + "arrayOk": true + }, + "editType": "none", + "description": "Sets the font used in hover labels.", + "role": "object", + "familysrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for family .", + "editType": "none" + }, + "sizesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for size .", + "editType": "none" + }, + "colorsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for color .", + "editType": "none" + } + }, + "namelength": { + "valType": "integer", + "min": -1, + "arrayOk": true, + "role": "style", + "editType": "none", + "description": "Sets the length (in number of characters) of the trace name in the hover labels for this trace. -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." + }, + "editType": "calc", + "role": "object", + "bgcolorsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for bgcolor .", + "editType": "none" + }, + "bordercolorsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for bordercolor .", + "editType": "none" + }, + "namelengthsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for namelength .", + "editType": "none" + } + }, + "stream": { + "token": { + "valType": "string", + "noBlank": true, + "strict": true, + "role": "info", + "editType": "calc", + "description": "The stream id number links a data trace on a plot with a stream. See https://plot.ly/settings for more details." + }, + "maxpoints": { + "valType": "number", + "min": 0, + "max": 10000, + "dflt": 500, + "role": "info", + "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." + }, + "editType": "calc", + "role": "object" + }, + "uirevision": { + "valType": "any", + "role": "info", + "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." + }, + "x": { + "valType": "data_array", + "role": "data", + "description": "Sets the X coordinates of the vertices on X axis.", + "editType": "calc+clearAxisTypes" + }, + "y": { + "valType": "data_array", + "role": "data", + "description": "Sets the Y coordinates of the vertices on Y axis.", + "editType": "calc+clearAxisTypes" + }, + "z": { + "valType": "data_array", + "role": "data", + "description": "Sets the Z coordinates of the vertices on Z axis.", + "editType": "calc+clearAxisTypes" + }, + "value": { + "valType": "data_array", + "role": "data", + "description": "Sets the 4th dimension (value) of the vertices.", + "editType": "calc+clearAxisTypes" + }, + "isomin": { + "valType": "number", + "role": "info", + "description": "Sets the minimum boundary for iso-surface plot.", + "editType": "calc" + }, + "isomax": { + "valType": "number", + "role": "info", + "description": "Sets the maximum boundary for iso-surface plot.", + "editType": "calc" + }, + "surface": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": true, + "description": "Hides/displays surfaces between minimum and maximum iso-values.", + "editType": "calc" + }, + "count": { + "valType": "integer", + "role": "info", + "dflt": 2, + "min": 1, + "description": "Sets the number of iso-surfaces between minimum and maximum iso-values. By default this value is 2 meaning that only minimum and maximum surfaces would be drawn.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the iso-surface. The default fill value of the surface is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "pattern": { + "valType": "flaglist", + "flags": [ + "A", + "B", + "C", + "D", + "E" + ], + "extras": [ + "all", + "odd", + "even" + ], + "dflt": "all", + "role": "style", + "description": "Sets the surface pattern of the iso-surface 3-D sections. The default pattern of the surface is `all` meaning that the rest of surface elements would be shaded. The check options (either 1 or 2) could be used to draw half of the squares on the surface. Using various combinations of capital `A`, `B`, `C`, `D` and `E` may also be used to reduce the number of triangles on the iso-surfaces and creating other patterns of interest.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "spaceframe": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": false, + "description": "Displays/hides tetrahedron shapes between minimum and maximum iso-values. Often useful when either caps or surfaces are disabled or filled with values less than 1.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 0.15, + "description": "Sets the fill ratio of the `spaceframe` elements. The default fill value is 0.15 meaning that only 15% of the area of every faces of tetras would be shaded. Applying a greater `fill` ratio would allow the creation of stronger elements or could be sued to have entirely closed areas (in case of using 1).", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "slices": { + "x": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": false, + "description": "Determines whether or not slice planes about the x dimension are drawn.", + "editType": "calc" + }, + "locations": { + "valType": "data_array", + "dflt": [], + "role": "data", + "description": "Specifies the location(s) of slices on the axis. When not locations specified slices would be created for all points of the axis x except start and end.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the `slices`. The default fill value of the `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "editType": "calc", + "role": "object", + "locationssrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for locations .", + "editType": "none" + } + }, + "y": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": false, + "description": "Determines whether or not slice planes about the y dimension are drawn.", + "editType": "calc" + }, + "locations": { + "valType": "data_array", + "dflt": [], + "role": "data", + "description": "Specifies the location(s) of slices on the axis. When not locations specified slices would be created for all points of the axis y except start and end.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the `slices`. The default fill value of the `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "editType": "calc", + "role": "object", + "locationssrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for locations .", + "editType": "none" + } + }, + "z": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": false, + "description": "Determines whether or not slice planes about the z dimension are drawn.", + "editType": "calc" + }, + "locations": { + "valType": "data_array", + "dflt": [], + "role": "data", + "description": "Specifies the location(s) of slices on the axis. When not locations specified slices would be created for all points of the axis z except start and end.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the `slices`. The default fill value of the `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "editType": "calc", + "role": "object", + "locationssrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for locations .", + "editType": "none" + } + }, + "editType": "calc", + "role": "object" + }, + "caps": { + "x": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": true, + "description": "Sets the fill ratio of the `slices`. The default fill value of the x `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the `caps`. The default fill value of the `caps` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "y": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": true, + "description": "Sets the fill ratio of the `slices`. The default fill value of the y `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the `caps`. The default fill value of the `caps` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "z": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": true, + "description": "Sets the fill ratio of the `slices`. The default fill value of the z `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "fill": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1, + "description": "Sets the fill ratio of the `caps`. The default fill value of the `caps` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "editType": "calc", + "role": "object" + }, + "text": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "description": "Sets the text elements associated with the vertices. If trace `hoverinfo` contains a *text* flag and *hovertext* is not set, these elements will be seen in the hover labels.", + "editType": "calc" + }, + "cauto": { + "valType": "boolean", + "role": "info", + "dflt": true, + "editType": "calc", + "impliedEdits": {}, + "description": "Determines whether or not the color domain is computed with respect to the input data (here `value`) or the bounds set in `cmin` and `cmax` Defaults to `false` when `cmin` and `cmax` are set by the user." + }, + "cmin": { + "valType": "number", + "role": "info", + "dflt": null, + "editType": "calc", + "impliedEdits": { + "cauto": false + }, + "description": "Sets the lower bound of the color domain. Value should have the same units as `value` and if set, `cmax` must be set as well." + }, + "cmax": { + "valType": "number", + "role": "info", + "dflt": null, + "editType": "calc", + "impliedEdits": { + "cauto": false + }, + "description": "Sets the upper bound of the color domain. Value should have the same units as `value` and if set, `cmin` must be set as well." + }, + "colorscale": { + "valType": "colorscale", + "role": "style", + "editType": "calc", + "dflt": null, + "impliedEdits": { + "autocolorscale": false + }, + "description": "Sets the colorscale. 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`cmin` and `cmax`. Alternatively, `colorscale` may be a palette name string of the following list: Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,Earth,Electric,Viridis,Cividis." + }, + "autocolorscale": { + "valType": "boolean", + "role": "style", + "dflt": true, + "editType": "calc", + "impliedEdits": {}, + "description": "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `colorscale`. 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." + }, + "reversescale": { + "valType": "boolean", + "role": "style", + "dflt": false, + "editType": "calc", + "description": "Reverses the color mapping if true. If true, `cmin` will correspond to the last color in the array and `cmax` will correspond to the first color." + }, + "showscale": { + "valType": "boolean", + "role": "info", + "dflt": true, + "editType": "calc", + "description": "Determines whether or not a colorbar is displayed for this trace." + }, + "colorbar": { + "thicknessmode": { + "valType": "enumerated", + "values": [ + "fraction", + "pixels" + ], + "role": "style", + "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.", + "editType": "calc" + }, + "thickness": { + "valType": "number", + "role": "style", + "min": 0, + "dflt": 30, + "description": "Sets the thickness of the color bar This measure excludes the size of the padding, ticks and labels.", + "editType": "calc" + }, + "lenmode": { + "valType": "enumerated", + "values": [ + "fraction", + "pixels" + ], + "role": "info", + "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.", + "editType": "calc" + }, + "len": { + "valType": "number", + "min": 0, + "dflt": 1, + "role": "style", + "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.", + "editType": "calc" + }, + "x": { + "valType": "number", + "dflt": 1.02, + "min": -2, + "max": 3, + "role": "style", + "description": "Sets the x position of the color bar (in plot fraction).", + "editType": "calc" + }, + "xanchor": { + "valType": "enumerated", + "values": [ + "left", + "center", + "right" + ], + "dflt": "left", + "role": "style", + "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.", + "editType": "calc" + }, + "xpad": { + "valType": "number", + "role": "style", + "min": 0, + "dflt": 10, + "description": "Sets the amount of padding (in px) along the x direction.", + "editType": "calc" + }, + "y": { + "valType": "number", + "role": "style", + "dflt": 0.5, + "min": -2, + "max": 3, + "description": "Sets the y position of the color bar (in plot fraction).", + "editType": "calc" + }, + "yanchor": { + "valType": "enumerated", + "values": [ + "top", + "middle", + "bottom" + ], + "role": "style", + "dflt": "middle", + "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.", + "editType": "calc" + }, + "ypad": { + "valType": "number", + "role": "style", + "min": 0, + "dflt": 10, + "description": "Sets the amount of padding (in px) along the y direction.", + "editType": "calc" + }, + "outlinecolor": { + "valType": "color", + "dflt": "#444", + "role": "style", + "editType": "calc", + "description": "Sets the axis line color." + }, + "outlinewidth": { + "valType": "number", + "min": 0, + "dflt": 1, + "role": "style", + "editType": "calc", + "description": "Sets the width (in px) of the axis line." + }, + "bordercolor": { + "valType": "color", + "dflt": "#444", + "role": "style", + "editType": "calc", + "description": "Sets the axis line color." + }, + "borderwidth": { + "valType": "number", + "role": "style", + "min": 0, + "dflt": 0, + "description": "Sets the width (in px) or the border enclosing this color bar.", + "editType": "calc" + }, + "bgcolor": { + "valType": "color", + "role": "style", + "dflt": "rgba(0,0,0,0)", + "description": "Sets the color of padded area.", + "editType": "calc" + }, + "tickmode": { + "valType": "enumerated", + "values": [ + "auto", + "linear", + "array" + ], + "role": "info", + "editType": "calc", + "impliedEdits": {}, + "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)." + }, + "nticks": { + "valType": "integer", + "min": 0, + "dflt": 0, + "role": "style", + "editType": "calc", + "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*." + }, + "tick0": { + "valType": "any", + "role": "style", + "editType": "calc", + "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." + }, + "dtick": { + "valType": "any", + "role": "style", + "editType": "calc", + "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*" + }, + "tickvals": { + "valType": "data_array", + "editType": "calc", + "description": "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.", + "role": "data" + }, + "ticktext": { + "valType": "data_array", + "editType": "calc", + "description": "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.", + "role": "data" + }, + "ticks": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "" + ], + "role": "style", + "editType": "calc", + "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.", + "dflt": "" + }, + "ticklen": { + "valType": "number", + "min": 0, + "dflt": 5, + "role": "style", + "editType": "calc", + "description": "Sets the tick length (in px)." + }, + "tickwidth": { + "valType": "number", + "min": 0, + "dflt": 1, + "role": "style", + "editType": "calc", + "description": "Sets the tick width (in px)." + }, + "tickcolor": { + "valType": "color", + "dflt": "#444", + "role": "style", + "editType": "calc", + "description": "Sets the tick color." + }, + "showticklabels": { + "valType": "boolean", + "dflt": true, + "role": "style", + "editType": "calc", + "description": "Determines whether or not the tick labels are drawn." + }, + "tickfont": { + "family": { + "valType": "string", + "role": "style", + "noBlank": true, + "strict": true, + "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 plotly service (at https://plot.ly 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*.", + "editType": "calc" + }, + "size": { + "valType": "number", + "role": "style", + "min": 1, + "editType": "calc" + }, + "color": { + "valType": "color", + "role": "style", + "editType": "calc" + }, + "description": "Sets the color bar's tick label font", + "editType": "calc", + "role": "object" + }, + "tickangle": { + "valType": "angle", + "dflt": "auto", + "role": "style", + "editType": "calc", + "description": "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically." + }, + "tickformat": { + "valType": "string", + "dflt": "", + "role": "style", + "editType": "calc", + "description": "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/blob/master/README.md#locale_format And for dates see: https://github.com/d3/d3-time-format/blob/master/README.md#locale_format We add one item to d3's date formatter: *%{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*" + }, + "tickformatstops": { + "items": { + "tickformatstop": { + "enabled": { + "valType": "boolean", + "role": "info", + "dflt": true, + "editType": "calc", + "description": "Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`." + }, + "dtickrange": { + "valType": "info_array", + "role": "info", + "items": [ + { + "valType": "any", + "editType": "calc" + }, + { + "valType": "any", + "editType": "calc" + } + ], + "editType": "calc", + "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*" + }, + "value": { + "valType": "string", + "dflt": "", + "role": "style", + "editType": "calc", + "description": "string - dtickformat for described zoom level, the same as *tickformat*" + }, + "editType": "calc", + "name": { + "valType": "string", + "role": "style", + "editType": "calc", + "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." + }, + "templateitemname": { + "valType": "string", + "role": "info", + "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`." + }, + "role": "object" + } + }, + "role": "object" + }, + "tickprefix": { + "valType": "string", + "dflt": "", + "role": "style", + "editType": "calc", + "description": "Sets a tick label prefix." + }, + "showtickprefix": { + "valType": "enumerated", + "values": [ + "all", + "first", + "last", + "none" + ], + "dflt": "all", + "role": "style", + "editType": "calc", + "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." + }, + "ticksuffix": { + "valType": "string", + "dflt": "", + "role": "style", + "editType": "calc", + "description": "Sets a tick label suffix." + }, + "showticksuffix": { + "valType": "enumerated", + "values": [ + "all", + "first", + "last", + "none" + ], + "dflt": "all", + "role": "style", + "editType": "calc", + "description": "Same as `showtickprefix` but for tick suffixes." + }, + "separatethousands": { + "valType": "boolean", + "dflt": false, + "role": "style", + "editType": "calc", + "description": "If \"true\", even 4-digit integers are separated" + }, + "exponentformat": { + "valType": "enumerated", + "values": [ + "none", + "e", + "E", + "power", + "SI", + "B" + ], + "dflt": "B", + "role": "style", + "editType": "calc", + "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." + }, + "showexponent": { + "valType": "enumerated", + "values": [ + "all", + "first", + "last", + "none" + ], + "dflt": "all", + "role": "style", + "editType": "calc", + "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." + }, + "title": { + "text": { + "valType": "string", + "role": "info", + "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.", + "editType": "calc" + }, + "font": { + "family": { + "valType": "string", + "role": "style", + "noBlank": true, + "strict": true, + "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 plotly service (at https://plot.ly 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*.", + "editType": "calc" + }, + "size": { + "valType": "number", + "role": "style", + "min": 1, + "editType": "calc" + }, + "color": { + "valType": "color", + "role": "style", + "editType": "calc" + }, + "description": "Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute.", + "editType": "calc", + "role": "object" + }, + "side": { + "valType": "enumerated", + "values": [ + "right", + "top", + "bottom" + ], + "role": "style", + "dflt": "top", + "description": "Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, + "_deprecated": { + "title": { + "valType": "string", + "role": "info", + "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.", "editType": "calc" }, - "highlightcolor": { - "valType": "color", - "role": "style", - "dflt": "#444", - "description": "Sets the color of the highlighted contour lines.", + "titlefont": { + "family": { + "valType": "string", + "role": "style", + "noBlank": true, + "strict": true, + "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 plotly service (at https://plot.ly 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*.", + "editType": "calc" + }, + "size": { + "valType": "number", + "role": "style", + "min": 1, + "editType": "calc" + }, + "color": { + "valType": "color", + "role": "style", + "editType": "calc" + }, + "description": "Deprecated in favor of color bar's `title.font`.", "editType": "calc" }, - "highlightwidth": { - "valType": "number", + "titleside": { + "valType": "enumerated", + "values": [ + "right", + "top", + "bottom" + ], "role": "style", - "min": 1, - "max": 16, - "dflt": 2, - "description": "Sets the width of the highlighted contour lines.", + "dflt": "top", + "description": "Deprecated in favor of color bar's `title.side`.", "editType": "calc" - }, - "editType": "calc", - "role": "object" + } }, "editType": "calc", - "role": "object" + "role": "object", + "tickvalssrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for tickvals .", + "editType": "none" + }, + "ticktextsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for ticktext .", + "editType": "none" + } }, - "hidesurface": { + "flatshading": { "valType": "boolean", - "role": "info", + "role": "style", "dflt": false, - "description": "Determines whether or not a surface is drawn. For example, set `hidesurface` to *false* `contours.x.show` to *true* and `contours.y.show` to *true* to draw a wire frame plot.", + "description": "Determines whether or not normal smoothing is applied to the isosurfaces, creating isosurfaces with an angular, low-poly look via flat reflections.", "editType": "calc" }, + "contour": { + "show": { + "valType": "boolean", + "role": "info", + "dflt": false, + "description": "Sets whether or not dynamic contours are shown on hover. Contours are more useful when hovering on caps and slices.", + "editType": "calc" + }, + "color": { + "valType": "color", + "role": "style", + "dflt": "#444", + "description": "Sets the color of the contour lines.", + "editType": "calc" + }, + "width": { + "valType": "number", + "role": "style", + "min": 1, + "max": 16, + "dflt": 2, + "description": "Sets the width of the contour lines.", + "editType": "calc" + }, + "editType": "calc", + "role": "object" + }, "lightposition": { "x": { "valType": "number", "role": "style", "min": -100000, "max": 100000, - "dflt": 10, + "dflt": 100000, "description": "Numeric vector, representing the X coordinate for each vertex.", "editType": "calc" }, @@ -16912,7 +18360,7 @@ "role": "style", "min": -100000, "max": 100000, - "dflt": 10000, + "dflt": 100000, "description": "Numeric vector, representing the Y coordinate for each vertex.", "editType": "calc" }, @@ -16929,6 +18377,25 @@ "role": "object" }, "lighting": { + "vertexnormalsepsilon": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 1e-12, + "editType": "calc", + "description": "Epsilon for vertex normals calculation avoids math issues arising from degenerate geometry." + }, + "facenormalsepsilon": { + "valType": "number", + "role": "style", + "min": 0, + "max": 1, + "dflt": 0.000001, + "editType": "calc", + "description": "Epsilon for face normals calculation avoids math issues arising from degenerate geometry." + }, + "editType": "calc", "ambient": { "valType": "number", "role": "style", @@ -16974,32 +18441,8 @@ "description": "Represents the reflectance as a dependency of the viewing angle; e.g. paper is reflective when viewing it from the edge of the paper (almost 90 degrees), causing shine.", "editType": "calc" }, - "editType": "calc", "role": "object" }, - "opacity": { - "valType": "number", - "role": "style", - "min": 0, - "max": 1, - "dflt": 1, - "description": "Sets the opacity of the surface.", - "editType": "calc" - }, - "_deprecated": { - "zauto": { - "description": "Obsolete. Use `cauto` instead.", - "editType": "calc" - }, - "zmin": { - "description": "Obsolete. Use `cmin` instead.", - "editType": "calc" - }, - "zmax": { - "description": "Obsolete. Use `cmax` instead.", - "editType": "calc" - } - }, "hoverinfo": { "valType": "flaglist", "role": "info", @@ -17020,81 +18463,6 @@ "editType": "calc", "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." }, - "xcalendar": { - "valType": "enumerated", - "values": [ - "gregorian", - "chinese", - "coptic", - "discworld", - "ethiopian", - "hebrew", - "islamic", - "julian", - "mayan", - "nanakshahi", - "nepali", - "persian", - "jalali", - "taiwan", - "thai", - "ummalqura" - ], - "role": "info", - "editType": "calc", - "dflt": "gregorian", - "description": "Sets the calendar system to use with `x` date data." - }, - "ycalendar": { - "valType": "enumerated", - "values": [ - "gregorian", - "chinese", - "coptic", - "discworld", - "ethiopian", - "hebrew", - "islamic", - "julian", - "mayan", - "nanakshahi", - "nepali", - "persian", - "jalali", - "taiwan", - "thai", - "ummalqura" - ], - "role": "info", - "editType": "calc", - "dflt": "gregorian", - "description": "Sets the calendar system to use with `y` date data." - }, - "zcalendar": { - "valType": "enumerated", - "values": [ - "gregorian", - "chinese", - "coptic", - "discworld", - "ethiopian", - "hebrew", - "islamic", - "julian", - "mayan", - "nanakshahi", - "nepali", - "persian", - "jalali", - "taiwan", - "thai", - "ummalqura" - ], - "role": "info", - "editType": "calc", - "dflt": "gregorian", - "description": "Sets the calendar system to use with `z` date data." - }, "scene": { "valType": "subplotid", "role": "info", @@ -17114,12 +18482,6 @@ "description": "Sets the source reference on plot.ly for customdata .", "editType": "none" }, - "zsrc": { - "valType": "string", - "role": "info", - "description": "Sets the source reference on plot.ly for z .", - "editType": "none" - }, "xsrc": { "valType": "string", "role": "info", @@ -17132,16 +18494,22 @@ "description": "Sets the source reference on plot.ly for y .", "editType": "none" }, - "textsrc": { + "zsrc": { "valType": "string", "role": "info", - "description": "Sets the source reference on plot.ly for text .", + "description": "Sets the source reference on plot.ly for z .", "editType": "none" }, - "surfacecolorsrc": { + "valuesrc": { "valType": "string", "role": "info", - "description": "Sets the source reference on plot.ly for surfacecolor .", + "description": "Sets the source reference on plot.ly for value .", + "editType": "none" + }, + "textsrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for text .", "editType": "none" }, "hoverinfosrc": { @@ -17193,11 +18561,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -18334,11 +19705,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -19340,11 +20714,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -20375,11 +21752,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -20651,6 +22031,7 @@ "valType": "color", "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line color." }, "width": { @@ -20659,6 +22040,7 @@ "dflt": 2, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -20988,6 +22370,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker opacity." }, "size": { @@ -20997,6 +22380,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -21526,6 +22910,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "color": { @@ -21749,6 +23134,7 @@ "valType": "color", "role": "style", "editType": "calc", + "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." }, "selected": { @@ -21849,6 +23235,14 @@ "editType": "calc", "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." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "calc", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "geo": { "valType": "subplotid", "role": "info", @@ -21909,6 +23303,12 @@ "role": "info", "description": "Sets the source reference on plot.ly for hoverinfo .", "editType": "none" + }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" } } }, @@ -21962,11 +23362,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -22155,6 +23558,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points.", "dflt": 1 }, @@ -22243,6 +23647,14 @@ "editType": "calc", "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." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "none", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "zauto": { "valType": "boolean", "role": "info", @@ -22839,6 +24251,12 @@ "role": "info", "description": "Sets the source reference on plot.ly for hoverinfo .", "editType": "none" + }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" } } }, @@ -22884,11 +24302,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -23053,6 +24474,7 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "role": "data" }, @@ -23061,6 +24483,7 @@ "dflt": 0, "role": "info", "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." }, "dx": { @@ -23068,11 +24491,13 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info." }, "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "role": "data" }, @@ -23081,6 +24506,7 @@ "dflt": 0, "role": "info", "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." }, "dy": { @@ -23088,6 +24514,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info." }, "text": { @@ -23189,6 +24616,7 @@ "valType": "color", "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line color." }, "width": { @@ -23197,6 +24625,7 @@ "dflt": 2, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line width (in px)." }, "shape": { @@ -23600,6 +25029,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -23635,6 +25065,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker opacity." }, "colorbar": { @@ -24198,6 +25629,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -24269,6 +25701,7 @@ "valType": "color", "role": "style", "editType": "calc", + "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." }, "selected": { @@ -24754,11 +26187,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -25359,6 +26795,7 @@ "arrayOk": true, "role": "style", "editType": "markerSize", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -25394,6 +26831,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity." }, "colorbar": { @@ -25957,6 +27395,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -26193,11 +27632,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -26352,12 +27794,14 @@ "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "role": "data" }, "y": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "role": "data" }, @@ -26584,11 +28028,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -26759,6 +28206,7 @@ "x": { "valType": "data_array", "editType": "calc", + "anim": true, "description": "Sets the x coordinates.", "impliedEdits": { "xtype": "array" @@ -26770,6 +28218,7 @@ "dflt": 0, "role": "info", "editType": "calc", + "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.", "impliedEdits": { "xtype": "scaled" @@ -26780,6 +28229,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info.", "impliedEdits": { "xtype": "scaled" @@ -26788,6 +28238,7 @@ "y": { "valType": "data_array", "editType": "calc", + "anim": true, "description": "Sets the y coordinates.", "impliedEdits": { "ytype": "array" @@ -26799,6 +28250,7 @@ "dflt": 0, "role": "info", "editType": "calc", + "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.", "impliedEdits": { "ytype": "scaled" @@ -26809,6 +28261,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info.", "impliedEdits": { "ytype": "scaled" @@ -27509,11 +28962,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -28532,7 +29988,9 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "stream": { "token": { @@ -29475,11 +30933,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -29669,6 +31130,7 @@ "valType": "color", "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line color." }, "width": { @@ -29677,6 +31139,7 @@ "dflt": 2, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line width (in px)." }, "editType": "calc", @@ -29705,6 +31168,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker opacity." }, "size": { @@ -29714,6 +31178,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -30345,6 +31810,7 @@ "valType": "color", "role": "style", "editType": "calc", + "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." }, "textfont": { @@ -30468,6 +31934,14 @@ "editType": "calc", "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." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "calc", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "subplot": { "valType": "subplotid", "role": "info", @@ -30516,6 +31990,12 @@ "role": "info", "description": "Sets the source reference on plot.ly for hoverinfo .", "editType": "none" + }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" } } }, @@ -30569,11 +32049,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -31328,11 +32811,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -31653,7 +33139,7 @@ "arrayOk": true, "dflt": "white", "role": "style", - "description": "Sets the cell fill color. It accepts either a specific color or an array of colors.", + "description": "Sets the cell fill color. It accepts either a specific color or an array of colors or a 2D array of colors.", "editType": "calc" }, "editType": "calc", @@ -31830,7 +33316,7 @@ "arrayOk": true, "role": "style", "dflt": "white", - "description": "Sets the cell fill color. It accepts either a specific color or an array of colors.", + "description": "Sets the cell fill color. It accepts either a specific color or an array of colors or a 2D array of colors.", "editType": "calc" }, "editType": "calc", @@ -32003,11 +33489,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -33503,11 +34992,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -33695,6 +35187,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the line color." }, "width": { @@ -33703,6 +35196,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -33766,6 +35260,7 @@ "valType": "color", "role": "style", "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." }, "marker": { @@ -34070,6 +35565,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity." }, "maxdisplayed": { @@ -34087,6 +35583,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -34122,6 +35619,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -35104,11 +36602,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -35275,6 +36776,7 @@ "a": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the x coordinates.", "impliedEdits": { "xtype": "array" @@ -35286,6 +36788,7 @@ "dflt": 0, "role": "info", "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.", "impliedEdits": { "xtype": "scaled" @@ -35296,6 +36799,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the x coordinate step. See `x0` for more info.", "impliedEdits": { "xtype": "scaled" @@ -35304,6 +36808,7 @@ "b": { "valType": "data_array", "editType": "calc+clearAxisTypes", + "anim": true, "description": "Sets the y coordinates.", "impliedEdits": { "ytype": "array" @@ -35315,6 +36820,7 @@ "dflt": 0, "role": "info", "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.", "impliedEdits": { "ytype": "scaled" @@ -35325,6 +36831,7 @@ "dflt": 1, "role": "info", "editType": "calc", + "anim": true, "description": "Sets the y coordinate step. See `y0` for more info.", "impliedEdits": { "ytype": "scaled" @@ -35526,6 +37033,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the color of the contour level. Has no if `contours.coloring` is set to *lines*." }, "width": { @@ -35534,6 +37042,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -36225,11 +37734,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -36339,6 +37851,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "[object Object] Note that this style setting can also be set per direction via `increasing.line.width` and `decreasing.line.width`." }, "dash": { @@ -36365,6 +37878,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the line color.", "dflt": "#3D9970" }, @@ -36374,6 +37888,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -36403,6 +37918,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the line color.", "dflt": "#FF4136" }, @@ -36412,6 +37928,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -36693,11 +38210,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -36836,6 +38356,7 @@ "valType": "color", "role": "style", "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." }, "editType": "style", @@ -36865,6 +38386,7 @@ "valType": "color", "role": "style", "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." }, "editType": "style", @@ -37087,7 +38609,7 @@ "dflt": "overlay", "role": "info", "editType": "calc", - "description": "Determines how boxes at the same location coordinate are displayed on the graph. If *group*, the boxes are plotted next to one another centered around the shared location. If *overlay*, the boxes are plotted over one another, you might need to set *opacity* to see them multiple boxes." + "description": "Determines how boxes at the same location coordinate are displayed on the graph. If *group*, the boxes are plotted next to one another centered around the shared location. If *overlay*, the boxes are plotted over one another, you might need to set *opacity* to see them multiple boxes. Has no effect on traces that have *width* set." }, "boxgap": { "valType": "number", @@ -37096,7 +38618,7 @@ "dflt": 0.3, "role": "style", "editType": "calc", - "description": "Sets the gap (in plot fraction) between boxes of adjacent location coordinates." + "description": "Sets the gap (in plot fraction) between boxes of adjacent location coordinates. Has no effect on traces that have *width* set." }, "boxgroupgap": { "valType": "number", @@ -37105,7 +38627,7 @@ "dflt": 0.3, "role": "style", "editType": "calc", - "description": "Sets the gap (in plot fraction) between boxes of the same location coordinate." + "description": "Sets the gap (in plot fraction) between boxes of the same location coordinate. Has no effect on traces that have *width* set." } } }, @@ -37160,11 +38682,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -37392,6 +38917,7 @@ "valType": "color", "role": "style", "editType": "style", + "anim": true, "description": "Sets the line color." }, "width": { @@ -37400,6 +38926,7 @@ "dflt": 2, "role": "style", "editType": "style", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -37749,6 +39276,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the marker opacity." }, "size": { @@ -37758,6 +39286,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "maxdisplayed": { @@ -38295,6 +39824,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -38303,7 +39833,8 @@ "arrayOk": true, "role": "style", "editType": "style", - "description": "Sets themarker.linecolor. 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 `marker.line.cmin` and `marker.line.cmax` if set." + "description": "Sets themarker.linecolor. 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 `marker.line.cmin` and `marker.line.cmax` if set.", + "anim": true }, "cauto": { "valType": "boolean", @@ -38415,7 +39946,8 @@ "arrayOk": true, "role": "style", "editType": "style", - "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set." + "description": "Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set.", + "anim": true }, "cauto": { "valType": "boolean", @@ -38590,6 +40122,7 @@ "valType": "color", "role": "style", "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." }, "hoverinfo": { @@ -38621,6 +40154,14 @@ "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*." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "none", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "selected": { "marker": { "opacity": { @@ -38753,6 +40294,12 @@ "role": "info", "description": "Sets the source reference on plot.ly for hoverinfo .", "editType": "none" + }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" } } }, @@ -38807,11 +40354,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -39034,11 +40584,20 @@ "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." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "none", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "line": { "color": { "valType": "color", "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line color." }, "width": { @@ -39047,6 +40606,7 @@ "dflt": 2, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the line width (in px)." }, "shape": { @@ -39457,6 +41017,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker size (in px)." }, "sizeref": { @@ -39492,6 +41053,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the marker opacity." }, "colorbar": { @@ -40055,6 +41617,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points." }, "editType": "calc", @@ -40119,6 +41682,7 @@ "valType": "color", "role": "style", "editType": "calc", + "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." }, "textposition": { @@ -40325,6 +41889,12 @@ "description": "Sets the source reference on plot.ly for hovertext .", "editType": "none" }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" + }, "textpositionsrc": { "valType": "string", "role": "info", @@ -40390,11 +41960,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -40628,6 +42201,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Sets the width (in px) of the lines bounding the marker points.", "dflt": 0 }, @@ -41311,6 +42885,14 @@ "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." }, + "hovertemplate": { + "valType": "string", + "role": "info", + "dflt": "", + "arrayOk": true, + "editType": "none", + "description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". See https://github.com/d3/d3-format/blob/master/README.md#locale_format for details on the formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plot.ly/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\"." + }, "selected": { "marker": { "opacity": { @@ -41435,6 +43017,12 @@ "role": "info", "description": "Sets the source reference on plot.ly for hoverinfo .", "editType": "none" + }, + "hovertemplatesrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for hovertemplate .", + "editType": "none" } }, "layoutAttributes": { @@ -41508,11 +43096,14 @@ "uid": { "valType": "string", "role": "info", - "editType": "plot" + "editType": "plot", + "anim": true, + "description": "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions." }, "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.", "role": "data" }, @@ -41692,7 +43283,8 @@ "arrayOk": true, "role": "style", "editType": "style", - "description": "Area traces are deprecated! Please switch to the *barpolar* trace type. Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set." + "description": "Area traces are deprecated! Please switch to the *barpolar* trace type. Sets themarkercolor. 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 `marker.cmin` and `marker.cmax` if set.", + "anim": true }, "size": { "valType": "number", @@ -41701,6 +43293,7 @@ "arrayOk": true, "role": "style", "editType": "calc", + "anim": true, "description": "Area traces are deprecated! Please switch to the *barpolar* trace type. Sets the marker size (in px)." }, "symbol": { @@ -42004,6 +43597,7 @@ "arrayOk": true, "role": "style", "editType": "style", + "anim": true, "description": "Area traces are deprecated! Please switch to the *barpolar* trace type. Sets the marker opacity." }, "editType": "calc", @@ -42513,6 +44107,81 @@ "editType": "modebar", "role": "object" }, + "meta": { + "valType": "data_array", + "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` and annotation `text` support `meta`. One can access `meta` fields using template strings: `%{meta[i]}` where `i` is the index of the `meta` item in question.", + "role": "data" + }, + "transition": { + "duration": { + "valType": "number", + "role": "info", + "min": 0, + "dflt": 500, + "editType": "none", + "description": "The duration of the transition, in milliseconds. If equal to zero, updates are synchronous." + }, + "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" + ], + "role": "info", + "editType": "none", + "description": "The easing function used for the transition" + }, + "ordering": { + "valType": "enumerated", + "values": [ + "layout first", + "traces first" + ], + "dflt": "layout first", + "role": "info", + "editType": "none", + "description": "Determines whether the figure's layout or traces smoothly transitions during updates that make both traces and layout change." + }, + "description": "Sets transition options used during Plotly.react updates.", + "editType": "none", + "role": "object" + }, "_deprecated": { "title": { "valType": "string", @@ -42968,20 +44637,23 @@ "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." }, "fixedrange": { @@ -43633,7 +45305,7 @@ "min": 0, "role": "style", "editType": "plot", - "description": "Sets the border color of the range slider." + "description": "Sets the border width of the range slider." }, "autorange": { "valType": "boolean", @@ -44038,20 +45710,23 @@ "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." }, "fixedrange": { @@ -46460,6 +48135,7 @@ "impliedEdits": { "autorange": false }, + "anim": false, "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." }, "tickmode": { @@ -47058,6 +48734,7 @@ "impliedEdits": { "autorange": false }, + "anim": false, "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." }, "tickmode": { @@ -47656,6 +49333,7 @@ "impliedEdits": { "autorange": false }, + "anim": false, "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." }, "tickmode": { @@ -49443,6 +51121,7 @@ "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." }, "categoryorder": { @@ -51281,6 +52960,7 @@ "valType": "color", "role": "style", "editType": "arraydraw", + "anim": true, "description": "Sets the line color." }, "width": { @@ -51289,6 +52969,7 @@ "dflt": 2, "role": "style", "editType": "calc+arraydraw", + "anim": true, "description": "Sets the line width (in px)." }, "dash": { @@ -52161,6 +53842,12 @@ } }, "role": "object" + }, + "metasrc": { + "valType": "string", + "role": "info", + "description": "Sets the source reference on plot.ly for meta .", + "editType": "none" } } }, @@ -52547,6 +54234,7 @@ "role": "info", "min": 0, "dflt": 500, + "editType": "none", "description": "The duration of the transition, in milliseconds. If equal to zero, updates are synchronous." }, "easing": { @@ -52591,9 +54279,269 @@ "bounce-in-out" ], "role": "info", + "editType": "none", "description": "The easing function used for the transition" }, + "ordering": { + "valType": "enumerated", + "values": [ + "layout first", + "traces first" + ], + "dflt": "layout first", + "role": "info", + "editType": "none", + "description": "Determines whether the figure's layout or traces smoothly transitions during updates that make both traces and layout change." + }, + "role": "object" + } + }, + "config": { + "staticPlot": { + "valType": "boolean", + "dflt": false, + "description": "Determines whether the graphs are interactive or not. If *false*, no interactivity, for export or image generation." + }, + "plotlyServerURL": { + "valType": "string", + "dflt": "https://plot.ly", + "description": "Sets base URL for the 'Edit in Chart Studio' (aka sendDataToCloud) mode bar button and the showLink/sendData on-graph link" + }, + "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." + }, + "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)." + }, + "annotationTail": { + "valType": "boolean", + "dflt": false, + "description": "Has only an effect for annotations with arrows. Enables changing the length and direction of the arrow." + }, + "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." + }, "role": "object" + }, + "autosizable": { + "valType": "boolean", + "dflt": false, + "description": "Determines whether the graphs are plotted with respect to layout.autosize:true and infer its container size." + }, + "responsive": { + "valType": "boolean", + "dflt": false, + "description": "Determines whether to change the layout size when window is resized. In v2, this option will be removed and will always be true." + }, + "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*)." + }, + "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." + }, + "scrollZoom": { + "valType": "flaglist", + "flags": [ + "cartesian", + "gl3d", + "geo", + "mapbox" + ], + "extras": [ + true, + false + ], + "dflt": "gl3d+geo+mapbox", + "description": "Determines whether mouse wheel or two-finger scroll zooms is enable. Turned on by default for gl3d, geo and mapbox 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." + }, + "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." + }, + "showAxisDragHandles": { + "valType": "boolean", + "dflt": true, + "description": "Set to *false* to omit cartesian axis pan/zoom drag handles." + }, + "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." + }, + "showTips": { + "valType": "boolean", + "dflt": true, + "description": "Determines whether or not tips are shown while interacting with the resulting graphs." + }, + "showLink": { + "valType": "boolean", + "dflt": false, + "description": "Determines whether a link to plot.ly is displayed at the bottom right corner of resulting graphs. Use with `sendData` and `linkText`." + }, + "linkText": { + "valType": "string", + "dflt": "Edit chart", + "noBlank": true, + "description": "Sets the text appearing in the `showLink` link." + }, + "sendData": { + "valType": "boolean", + "dflt": true, + "description": "If *showLink* is true, does it contain data just link to a plot.ly file?" + }, + "showSources": { + "valType": "any", + "dflt": false, + "description": "Adds a source-displaying function to show sources on the resulting graphs." + }, + "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." + }, + "showSendToCloud": { + "valType": "boolean", + "dflt": false, + "description": "Should we include a ModeBar button, labeled \"Edit in Chart Studio\", that sends this chart to 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`) 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\"." + }, + "modeBarButtonsToRemove": { + "valType": "any", + "dflt": [], + "description": "Remove mode bar buttons by name. See ./components/modebar/buttons.js for the list of names." + }, + "modeBarButtonsToAdd": { + "valType": "any", + "dflt": [], + "description": "Add mode bar button using config objects See ./components/modebar/buttons.js for list of arguments." + }, + "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." + }, + "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" + }, + "displaylogo": { + "valType": "boolean", + "dflt": true, + "description": "Determines whether or not the plotly logo is displayed on the end of the mode bar." + }, + "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." + }, + "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." + }, + "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." + }, + "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." + }, + "logging": { + "valType": "boolean", + "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" + }, + "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" + }, + "locale": { + "valType": "string", + "dflt": "en-US", + "description": "Which localization should we use? Should be a string like 'en' or 'en-US'." + }, + "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." } } } \ No newline at end of file diff -Nru plotly-3.5.0+dfsg1/plotly/package_data/templates/plotly_dark.json plotly-3.6.1+dfsg1/plotly/package_data/templates/plotly_dark.json --- plotly-3.5.0+dfsg1/plotly/package_data/templates/plotly_dark.json 2019-01-03 11:03:24.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/package_data/templates/plotly_dark.json 2019-01-26 01:18:29.000000000 +0000 @@ -1 +1 @@ -{"layout": {"colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa"], "font": {"color": "#f2f5fa"}, "hovermode": "closest", "paper_bgcolor": "rgb(17,17,17)", "plot_bgcolor": "rgb(17,17,17)", "polar": {"bgcolor": "rgb(17,17,17)", "angularaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "radialaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "ternary": {"bgcolor": "rgb(17,17,17)", "aaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "baxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "caxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "colorscale": {"sequential": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "sequentialminus": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]]}, "xaxis": {"gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "zerolinecolor": "#283442", "automargin": true, "zerolinewidth": 2}, "yaxis": {"gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "zerolinecolor": "#283442", "automargin": true, "zerolinewidth": 2}, "scene": {"xaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3", "gridwidth": 2}, "yaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3", "gridwidth": 2}, "zaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3", "gridwidth": 2}}, "shapedefaults": {"fillcolor": "#f2f5fa", "line": {"width": 0}, "opacity": 0.4}, "annotationdefaults": {"arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "subunitcolor": "#506784", "showland": true, "showlakes": true, "lakecolor": "rgb(17,17,17)"}, "title": {"x": 0.05}, "updatemenudefaults": {"bgcolor": "#506784", "borderwidth": 0}, "sliderdefaults": {"bgcolor": "#C8D4E3", "borderwidth": 1, "bordercolor": "rgb(17,17,17)", "tickwidth": 0}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "scatter": [{"marker": {"line": {"color": "#283442"}}, "type": "scatter"}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "bar": [{"type": "bar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "histogram": [{"type": "histogram", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergl": [{"marker": {"line": {"color": "#283442"}}, "type": "scattergl"}], "scatter3d": [{"type": "scatter3d", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "carpet": [{"aaxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "baxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "#506784"}, "line": {"color": "rgb(17,17,17)"}}, "header": {"fill": {"color": "#2a3f5f"}, "line": {"color": "rgb(17,17,17)"}}, "type": "table"}]}} \ No newline at end of file +{"layout": {"colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa", "#FECB52", "#FFA15A", "#FF6692", "#B6E880"], "font": {"color": "#f2f5fa"}, "hovermode": "closest", "paper_bgcolor": "rgb(17,17,17)", "plot_bgcolor": "rgb(17,17,17)", "polar": {"bgcolor": "rgb(17,17,17)", "angularaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "radialaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "ternary": {"bgcolor": "rgb(17,17,17)", "aaxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "baxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}, "caxis": {"gridcolor": "#506784", "linecolor": "#506784", "ticks": ""}}, "colorscale": {"sequential": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "sequentialminus": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]]}, "xaxis": {"gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "zerolinecolor": "#283442", "automargin": true, "zerolinewidth": 2}, "yaxis": {"gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "zerolinecolor": "#283442", "automargin": true, "zerolinewidth": 2}, "scene": {"xaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3", "gridwidth": 2}, "yaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3", "gridwidth": 2}, "zaxis": {"backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3", "gridwidth": 2}}, "shapedefaults": {"fillcolor": "#f2f5fa", "line": {"width": 0}, "opacity": 0.4}, "annotationdefaults": {"arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "subunitcolor": "#506784", "showland": true, "showlakes": true, "lakecolor": "rgb(17,17,17)"}, "title": {"x": 0.05}, "updatemenudefaults": {"bgcolor": "#506784", "borderwidth": 0}, "sliderdefaults": {"bgcolor": "#C8D4E3", "borderwidth": 1, "bordercolor": "rgb(17,17,17)", "tickwidth": 0}, "mapbox": {"style": "dark"}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "scatter": [{"marker": {"line": {"color": "#283442"}}, "type": "scatter"}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "bar": [{"type": "bar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "histogram": [{"type": "histogram", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergl": [{"marker": {"line": {"color": "#283442"}}, "type": "scattergl"}], "scatter3d": [{"type": "scatter3d", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "carpet": [{"aaxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "baxis": {"endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "#506784"}, "line": {"color": "rgb(17,17,17)"}}, "header": {"fill": {"color": "#2a3f5f"}, "line": {"color": "rgb(17,17,17)"}}, "type": "table"}]}} \ No newline at end of file diff -Nru plotly-3.5.0+dfsg1/plotly/package_data/templates/plotly.json plotly-3.6.1+dfsg1/plotly/package_data/templates/plotly.json --- plotly-3.5.0+dfsg1/plotly/package_data/templates/plotly.json 2019-01-03 11:03:24.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/package_data/templates/plotly.json 2019-01-26 01:18:29.000000000 +0000 @@ -1 +1 @@ -{"layout": {"colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa"], "font": {"color": "#2a3f5f"}, "hovermode": "closest", "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": {"bgcolor": "#E5ECF6", "angularaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "radialaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "ternary": {"bgcolor": "#E5ECF6", "aaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "baxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "caxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "colorscale": {"sequential": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "sequentialminus": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]]}, "xaxis": {"gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2}, "yaxis": {"gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2}, "scene": {"xaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2}, "yaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2}, "zaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2}}, "shapedefaults": {"fillcolor": "#506784", "line": {"width": 0}, "opacity": 0.4}, "annotationdefaults": {"arrowcolor": "#506784", "arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "white", "landcolor": "#E5ECF6", "subunitcolor": "white", "showland": true, "showlakes": true, "lakecolor": "white"}, "title": {"x": 0.05}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "scatter": [{"type": "scatter", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "bar": [{"type": "bar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "histogram": [{"type": "histogram", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergl": [{"type": "scattergl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatter3d": [{"type": "scatter3d", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}} \ No newline at end of file +{"layout": {"colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa", "#FECB52", "#FFA15A", "#FF6692", "#B6E880"], "font": {"color": "#2a3f5f"}, "hovermode": "closest", "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": {"bgcolor": "#E5ECF6", "angularaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "radialaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "ternary": {"bgcolor": "#E5ECF6", "aaxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "baxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}, "caxis": {"gridcolor": "white", "linecolor": "white", "ticks": ""}}, "colorscale": {"sequential": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "sequentialminus": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]]}, "xaxis": {"gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2}, "yaxis": {"gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2}, "scene": {"xaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2}, "yaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2}, "zaxis": {"backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2}}, "shapedefaults": {"fillcolor": "#506784", "line": {"width": 0}, "opacity": 0.4}, "annotationdefaults": {"arrowcolor": "#506784", "arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "white", "landcolor": "#E5ECF6", "subunitcolor": "white", "showland": true, "showlakes": true, "lakecolor": "white"}, "title": {"x": 0.05}, "mapbox": {"style": "light"}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "scatter": [{"type": "scatter", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "bar": [{"type": "bar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "histogram": [{"type": "histogram", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergl": [{"type": "scattergl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatter3d": [{"type": "scatter3d", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}} \ No newline at end of file diff -Nru plotly-3.5.0+dfsg1/plotly/package_data/templates/plotly_white.json plotly-3.6.1+dfsg1/plotly/package_data/templates/plotly_white.json --- plotly-3.5.0+dfsg1/plotly/package_data/templates/plotly_white.json 2019-01-03 11:03:24.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/package_data/templates/plotly_white.json 2019-01-26 01:18:29.000000000 +0000 @@ -1 +1 @@ -{"layout": {"colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa"], "font": {"color": "#2a3f5f"}, "hovermode": "closest", "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": {"bgcolor": "white", "angularaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": ""}, "radialaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": ""}}, "ternary": {"bgcolor": "white", "aaxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}, "baxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}, "caxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}}, "colorscale": {"sequential": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "sequentialminus": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]]}, "xaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "zerolinecolor": "#EBF0F8", "automargin": true, "zerolinewidth": 2}, "yaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "zerolinecolor": "#EBF0F8", "automargin": true, "zerolinewidth": 2}, "scene": {"xaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8", "gridwidth": 2}, "yaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8", "gridwidth": 2}, "zaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8", "gridwidth": 2}}, "shapedefaults": {"fillcolor": "#506784", "line": {"width": 0}, "opacity": 0.4}, "annotationdefaults": {"arrowcolor": "#506784", "arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "white", "landcolor": "white", "subunitcolor": "#C8D4E3", "showland": true, "showlakes": true, "lakecolor": "white"}, "title": {"x": 0.05}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "scatter": [{"type": "scatter", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "bar": [{"type": "bar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "histogram": [{"type": "histogram", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergl": [{"type": "scattergl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatter3d": [{"type": "scatter3d", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}} \ No newline at end of file +{"layout": {"colorway": ["#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa", "#FECB52", "#FFA15A", "#FF6692", "#B6E880"], "font": {"color": "#2a3f5f"}, "hovermode": "closest", "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": {"bgcolor": "white", "angularaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": ""}, "radialaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": ""}}, "ternary": {"bgcolor": "white", "aaxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}, "baxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}, "caxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": ""}}, "colorscale": {"sequential": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "sequentialminus": [[0.0, "#0508b8"], [0.0893854748603352, "#1910d8"], [0.1787709497206704, "#3c19f0"], [0.2681564245810056, "#6b1cfb"], [0.3575418994413408, "#981cfd"], [0.44692737430167595, "#bf1cfd"], [0.5363128491620112, "#dd2bfd"], [0.6256983240223464, "#f246fe"], [0.7150837988826816, "#fc67fd"], [0.8044692737430168, "#fe88fc"], [0.8938547486033519, "#fea5fd"], [0.9832402234636871, "#febefe"], [1.0, "#fec3fe"]], "diverging": [[0, "#8e0152"], [0.1, "#c51b7d"], [0.2, "#de77ae"], [0.3, "#f1b6da"], [0.4, "#fde0ef"], [0.5, "#f7f7f7"], [0.6, "#e6f5d0"], [0.7, "#b8e186"], [0.8, "#7fbc41"], [0.9, "#4d9221"], [1, "#276419"]]}, "xaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "zerolinecolor": "#EBF0F8", "automargin": true, "zerolinewidth": 2}, "yaxis": {"gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "zerolinecolor": "#EBF0F8", "automargin": true, "zerolinewidth": 2}, "scene": {"xaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8", "gridwidth": 2}, "yaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8", "gridwidth": 2}, "zaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8", "gridwidth": 2}}, "shapedefaults": {"fillcolor": "#506784", "line": {"width": 0}, "opacity": 0.4}, "annotationdefaults": {"arrowcolor": "#506784", "arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "white", "landcolor": "white", "subunitcolor": "#C8D4E3", "showland": true, "showlakes": true, "lakecolor": "white"}, "title": {"x": 0.05}, "mapbox": {"style": "light"}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 0, "ticks": ""}, "autocolorscale": true}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 0, "ticks": ""}}], "scatter": [{"type": "scatter", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "bar": [{"type": "bar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "histogram": [{"type": "histogram", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattergl": [{"type": "scattergl", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatter3d": [{"type": "scatter3d", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 0, "ticks": ""}}}], "carpet": [{"aaxis": {"endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f"}, "baxis": {"endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "#EBF0F8"}, "line": {"color": "white"}}, "header": {"fill": {"color": "#C8D4E3"}, "line": {"color": "white"}}, "type": "table"}]}} \ No newline at end of file diff -Nru plotly-3.5.0+dfsg1/plotly/plotly/plotly.py plotly-3.6.1+dfsg1/plotly/plotly/plotly.py --- plotly-3.5.0+dfsg1/plotly/plotly/plotly.py 2018-12-29 12:13:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/plotly/plotly.py 2019-01-24 15:01:08.000000000 +0000 @@ -256,7 +256,7 @@ """Replot a matplotlib figure with plotly in IPython. This function: - 1. converts the mpl figure into JSON (run help(plolty.tools.mpl_to_plotly)) + 1. converts the mpl figure into JSON (run help(plotly.tools.mpl_to_plotly)) 2. makes a request to Plotly to save this figure in your account 3. displays the image in your IPython output cell @@ -288,7 +288,7 @@ """Replot a matplotlib figure with plotly. This function: - 1. converts the mpl figure into JSON (run help(plolty.tools.mpl_to_plotly)) + 1. converts the mpl figure into JSON (run help(plotly.tools.mpl_to_plotly)) 2. makes a request to Plotly to save this figure in your account 3. opens your figure in a browser tab OR returns the unique figure url diff -Nru plotly-3.5.0+dfsg1/plotly/validators/area/_ids.py plotly-3.6.1+dfsg1/plotly/validators/area/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/area/_ids.py 2018-12-25 11:58:50.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/area/_ids.py 2019-02-08 22:59:35.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/area/marker/_color.py plotly-3.6.1+dfsg1/plotly/validators/area/marker/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/area/marker/_color.py 2018-12-25 11:58:50.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/area/marker/_color.py 2019-02-08 22:59:35.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/area/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/area/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/area/marker/_opacity.py 2018-12-25 11:58:50.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/area/marker/_opacity.py 2019-02-08 22:59:35.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/area/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/area/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/area/marker/_size.py 2018-12-25 11:58:50.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/area/marker/_size.py 2019-02-08 22:59:35.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/area/_uid.py plotly-3.6.1+dfsg1/plotly/validators/area/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/area/_uid.py 2018-12-25 11:58:49.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/area/_uid.py 2019-02-08 22:59:33.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_area.py plotly-3.6.1+dfsg1/plotly/validators/_area.py --- plotly-3.5.0+dfsg1/plotly/validators/_area.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_area.py 2019-02-08 22:59:33.000000000 +0000 @@ -78,7 +78,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_dx.py plotly-3.6.1+dfsg1/plotly/validators/bar/_dx.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_dx.py 2018-12-25 11:58:49.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_dx.py 2019-02-08 22:59:33.000000000 +0000 @@ -7,6 +7,7 @@ super(DxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_dy.py plotly-3.6.1+dfsg1/plotly/validators/bar/_dy.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_dy.py 2018-12-25 11:58:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_dy.py 2019-02-08 22:59:33.000000000 +0000 @@ -7,6 +7,7 @@ super(DyValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_ids.py plotly-3.6.1+dfsg1/plotly/validators/bar/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_ids.py 2018-12-25 11:58:47.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_ids.py 2019-02-08 22:59:32.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/bar/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/marker/line/_width.py 2018-12-25 11:58:45.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/marker/line/_width.py 2019-02-08 22:59:29.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_uid.py plotly-3.6.1+dfsg1/plotly/validators/bar/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_uid.py 2018-12-25 11:58:44.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_uid.py 2019-02-08 22:59:28.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_x0.py plotly-3.6.1+dfsg1/plotly/validators/bar/_x0.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_x0.py 2018-12-25 11:58:44.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_x0.py 2019-02-08 22:59:28.000000000 +0000 @@ -7,6 +7,7 @@ super(X0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_x.py plotly-3.6.1+dfsg1/plotly/validators/bar/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_x.py 2018-12-25 11:58:44.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_x.py 2019-02-08 22:59:28.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_y0.py plotly-3.6.1+dfsg1/plotly/validators/bar/_y0.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_y0.py 2018-12-25 11:58:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_y0.py 2019-02-08 22:59:26.000000000 +0000 @@ -7,6 +7,7 @@ super(Y0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/bar/_y.py plotly-3.6.1+dfsg1/plotly/validators/bar/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/bar/_y.py 2018-12-25 11:58:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/bar/_y.py 2019-02-08 22:59:26.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/barpolar/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/barpolar/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/barpolar/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/barpolar/_hovertemplate.py 2019-02-08 22:59:25.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, plotly_name='hovertemplate', parent_name='barpolar', **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/barpolar/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/barpolar/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/barpolar/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/barpolar/_hovertemplatesrc.py 2019-02-08 22:59:25.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, plotly_name='hovertemplatesrc', parent_name='barpolar', **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/barpolar/_ids.py plotly-3.6.1+dfsg1/plotly/validators/barpolar/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/barpolar/_ids.py 2018-12-25 11:58:41.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/barpolar/_ids.py 2019-02-08 22:59:25.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/barpolar/__init__.py plotly-3.6.1+dfsg1/plotly/validators/barpolar/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/barpolar/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/barpolar/__init__.py 2019-02-08 23:01:15.000000000 +0000 @@ -26,6 +26,8 @@ from ._legendgroup import LegendgroupValidator from ._idssrc import IdssrcValidator from ._ids import IdsValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator from ._hoverinfo import HoverinfoValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/barpolar/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/barpolar/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/barpolar/marker/line/_width.py 2018-12-25 11:58:40.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/barpolar/marker/line/_width.py 2019-02-08 22:59:22.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/barpolar/_uid.py plotly-3.6.1+dfsg1/plotly/validators/barpolar/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/barpolar/_uid.py 2018-12-25 11:58:39.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/barpolar/_uid.py 2019-02-08 22:59:21.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_barpolar.py plotly-3.6.1+dfsg1/plotly/validators/_barpolar.py --- plotly-3.5.0+dfsg1/plotly/validators/_barpolar.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_barpolar.py 2019-02-08 22:59:21.000000000 +0000 @@ -45,6 +45,28 @@ hoverlabel plotly.graph_objs.barpolar.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . ids Assigns id labels to each datum. These ids for object constancy of data points during @@ -125,7 +147,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_bar.py plotly-3.6.1+dfsg1/plotly/validators/_bar.py --- plotly-3.5.0+dfsg1/plotly/validators/_bar.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_bar.py 2019-02-08 22:59:25.000000000 +0000 @@ -190,7 +190,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/box/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/box/_fillcolor.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/_fillcolor.py 2019-02-08 22:59:21.000000000 +0000 @@ -7,6 +7,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/_ids.py plotly-3.6.1+dfsg1/plotly/validators/box/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/box/_ids.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/_ids.py 2019-02-08 22:59:21.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/__init__.py plotly-3.6.1+dfsg1/plotly/validators/box/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/box/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/__init__.py 2019-02-08 23:01:15.000000000 +0000 @@ -8,6 +8,7 @@ from ._xaxis import XAxisValidator from ._x0 import X0Validator from ._x import XValidator +from ._width import WidthValidator from ._whiskerwidth import WhiskerwidthValidator from ._visible import VisibleValidator from ._unselected import UnselectedValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/marker/_color.py plotly-3.6.1+dfsg1/plotly/validators/box/marker/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/box/marker/_color.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/marker/_color.py 2019-02-08 22:59:20.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/marker/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/box/marker/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/box/marker/line/_color.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/marker/line/_color.py 2019-02-08 22:59:20.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/box/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/box/marker/line/_width.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/marker/line/_width.py 2019-02-08 22:59:20.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/box/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/box/marker/_opacity.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/marker/_opacity.py 2019-02-08 22:59:20.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/box/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/box/marker/_size.py 2018-12-25 11:58:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/marker/_size.py 2019-02-08 22:59:20.000000000 +0000 @@ -7,6 +7,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/_uid.py plotly-3.6.1+dfsg1/plotly/validators/box/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/box/_uid.py 2018-12-25 11:58:36.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/_uid.py 2019-02-08 22:59:18.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/box/_width.py plotly-3.6.1+dfsg1/plotly/validators/box/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/box/_width.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/box/_width.py 2019-02-08 22:59:18.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class WidthValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__(self, plotly_name='width', parent_name='box', **kwargs): + super(WidthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_box.py plotly-3.6.1+dfsg1/plotly/validators/_box.py --- plotly-3.5.0+dfsg1/plotly/validators/_box.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_box.py 2019-02-08 22:59:15.000000000 +0000 @@ -133,7 +133,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in @@ -168,6 +170,11 @@ Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es). + width + Sets the width of the box in data coordinate If + 0 (default value) the width is automatically + selected based on the positions of other box + traces in the same subplot. x Sets the x sample data or coordinates. See overview for more info. diff -Nru plotly-3.5.0+dfsg1/plotly/validators/candlestick/decreasing/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/candlestick/decreasing/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/candlestick/decreasing/_fillcolor.py 2018-12-25 11:58:34.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/candlestick/decreasing/_fillcolor.py 2019-02-08 22:59:15.000000000 +0000 @@ -12,6 +12,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/candlestick/_ids.py plotly-3.6.1+dfsg1/plotly/validators/candlestick/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/candlestick/_ids.py 2018-12-25 11:58:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/candlestick/_ids.py 2019-02-08 22:59:14.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/candlestick/increasing/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/candlestick/increasing/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/candlestick/increasing/_fillcolor.py 2018-12-25 11:58:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/candlestick/increasing/_fillcolor.py 2019-02-08 22:59:14.000000000 +0000 @@ -12,6 +12,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/candlestick/_uid.py plotly-3.6.1+dfsg1/plotly/validators/candlestick/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/candlestick/_uid.py 2018-12-25 11:58:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/candlestick/_uid.py 2019-02-08 22:59:14.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_candlestick.py plotly-3.6.1+dfsg1/plotly/validators/_candlestick.py --- plotly-3.5.0+dfsg1/plotly/validators/_candlestick.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_candlestick.py 2019-02-08 22:59:12.000000000 +0000 @@ -100,7 +100,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/carpet/_ids.py plotly-3.6.1+dfsg1/plotly/validators/carpet/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/carpet/_ids.py 2018-12-25 11:58:27.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/carpet/_ids.py 2019-02-08 22:59:07.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/carpet/_uid.py plotly-3.6.1+dfsg1/plotly/validators/carpet/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/carpet/_uid.py 2018-12-25 11:58:27.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/carpet/_uid.py 2019-02-08 22:59:07.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_carpet.py plotly-3.6.1+dfsg1/plotly/validators/_carpet.py --- plotly-3.5.0+dfsg1/plotly/validators/_carpet.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_carpet.py 2019-02-08 22:59:07.000000000 +0000 @@ -110,7 +110,9 @@ plotly.graph_objs.carpet.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/choropleth/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/choropleth/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/choropleth/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/choropleth/_hovertemplate.py 2019-02-08 22:59:04.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, plotly_name='hovertemplate', parent_name='choropleth', **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/choropleth/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/choropleth/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/choropleth/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/choropleth/_hovertemplatesrc.py 2019-02-08 22:59:04.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='hovertemplatesrc', + parent_name='choropleth', + **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/choropleth/_ids.py plotly-3.6.1+dfsg1/plotly/validators/choropleth/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/choropleth/_ids.py 2018-12-25 11:58:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/choropleth/_ids.py 2019-02-08 22:59:04.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/choropleth/__init__.py plotly-3.6.1+dfsg1/plotly/validators/choropleth/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/choropleth/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/choropleth/__init__.py 2019-02-08 23:01:15.000000000 +0000 @@ -24,6 +24,8 @@ from ._legendgroup import LegendgroupValidator from ._idssrc import IdssrcValidator from ._ids import IdsValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator from ._hoverinfo import HoverinfoValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/choropleth/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/choropleth/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/choropleth/marker/line/_width.py 2018-12-25 11:58:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/choropleth/marker/line/_width.py 2019-02-08 22:59:04.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/choropleth/_uid.py plotly-3.6.1+dfsg1/plotly/validators/choropleth/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/choropleth/_uid.py 2018-12-25 11:58:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/choropleth/_uid.py 2019-02-08 22:59:03.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_choropleth.py plotly-3.6.1+dfsg1/plotly/validators/_choropleth.py --- plotly-3.5.0+dfsg1/plotly/validators/_choropleth.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_choropleth.py 2019-02-08 22:59:03.000000000 +0000 @@ -63,6 +63,28 @@ hoverlabel plotly.graph_objs.choropleth.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . ids Assigns id labels to each datum. These ids for object constancy of data points during @@ -124,7 +146,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/cone/_ids.py plotly-3.6.1+dfsg1/plotly/validators/cone/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/cone/_ids.py 2018-12-25 11:58:22.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/cone/_ids.py 2019-02-08 22:58:59.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/cone/_uid.py plotly-3.6.1+dfsg1/plotly/validators/cone/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/cone/_uid.py 2018-12-25 11:58:21.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/cone/_uid.py 2019-02-08 22:58:59.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_cone.py plotly-3.6.1+dfsg1/plotly/validators/_cone.py --- plotly-3.5.0+dfsg1/plotly/validators/_cone.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_cone.py 2019-02-08 22:58:58.000000000 +0000 @@ -159,7 +159,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_dx.py plotly-3.6.1+dfsg1/plotly/validators/contour/_dx.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_dx.py 2018-12-25 11:58:18.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_dx.py 2019-02-08 22:58:54.000000000 +0000 @@ -7,6 +7,7 @@ super(DxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_dy.py plotly-3.6.1+dfsg1/plotly/validators/contour/_dy.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_dy.py 2018-12-25 11:58:18.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_dy.py 2019-02-08 22:58:54.000000000 +0000 @@ -7,6 +7,7 @@ super(DyValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_ids.py plotly-3.6.1+dfsg1/plotly/validators/contour/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_ids.py 2018-12-25 11:58:18.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_ids.py 2019-02-08 22:58:54.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/contour/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/line/_color.py 2018-12-25 11:58:18.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/line/_color.py 2019-02-08 22:58:54.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style+colorbars'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/contour/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/line/_width.py 2018-12-25 11:58:18.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/line/_width.py 2019-02-08 22:58:53.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style+colorbars'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_uid.py plotly-3.6.1+dfsg1/plotly/validators/contour/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_uid.py 2018-12-25 11:58:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_uid.py 2019-02-08 22:58:53.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_x0.py plotly-3.6.1+dfsg1/plotly/validators/contour/_x0.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_x0.py 2018-12-25 11:58:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_x0.py 2019-02-08 22:58:53.000000000 +0000 @@ -7,6 +7,7 @@ super(X0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_x.py plotly-3.6.1+dfsg1/plotly/validators/contour/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_x.py 2018-12-25 11:58:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_x.py 2019-02-08 22:58:53.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_y0.py plotly-3.6.1+dfsg1/plotly/validators/contour/_y0.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_y0.py 2018-12-25 11:58:16.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_y0.py 2019-02-08 22:58:52.000000000 +0000 @@ -7,6 +7,7 @@ super(Y0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contour/_y.py plotly-3.6.1+dfsg1/plotly/validators/contour/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/contour/_y.py 2018-12-25 11:58:16.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contour/_y.py 2019-02-08 22:58:52.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_a0.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_a0.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_a0.py 2018-12-25 11:58:15.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_a0.py 2019-02-08 22:58:50.000000000 +0000 @@ -9,6 +9,7 @@ super(A0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_a.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_a.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_a.py 2018-12-25 11:58:15.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_a.py 2019-02-08 22:58:50.000000000 +0000 @@ -7,6 +7,7 @@ super(AValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_b0.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_b0.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_b0.py 2018-12-25 11:58:15.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_b0.py 2019-02-08 22:58:50.000000000 +0000 @@ -9,6 +9,7 @@ super(B0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_b.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_b.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_b.py 2018-12-25 11:58:15.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_b.py 2019-02-08 22:58:50.000000000 +0000 @@ -7,6 +7,7 @@ super(BValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_da.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_da.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_da.py 2018-12-25 11:58:12.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_da.py 2019-02-08 22:58:46.000000000 +0000 @@ -9,6 +9,7 @@ super(DaValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_db.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_db.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_db.py 2018-12-25 11:58:12.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_db.py 2019-02-08 22:58:46.000000000 +0000 @@ -9,6 +9,7 @@ super(DbValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_ids.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_ids.py 2018-12-25 11:58:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_ids.py 2019-02-08 22:58:45.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/line/_color.py 2018-12-25 11:58:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/line/_color.py 2019-02-08 22:58:45.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/line/_width.py 2018-12-25 11:58:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/line/_width.py 2019-02-08 22:58:45.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_uid.py plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/contourcarpet/_uid.py 2018-12-25 11:58:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/contourcarpet/_uid.py 2019-02-08 22:58:44.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_contourcarpet.py plotly-3.6.1+dfsg1/plotly/validators/_contourcarpet.py --- plotly-3.5.0+dfsg1/plotly/validators/_contourcarpet.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_contourcarpet.py 2019-02-08 22:58:44.000000000 +0000 @@ -165,7 +165,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_contour.py plotly-3.6.1+dfsg1/plotly/validators/_contour.py --- plotly-3.5.0+dfsg1/plotly/validators/_contour.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_contour.py 2019-02-08 22:58:50.000000000 +0000 @@ -137,7 +137,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_data.py plotly-3.6.1+dfsg1/plotly/validators/_data.py --- plotly-3.5.0+dfsg1/plotly/validators/_data.py 2018-12-25 11:58:52.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_data.py 2019-02-08 22:59:38.000000000 +0000 @@ -22,6 +22,7 @@ 'histogram': 'Histogram', 'histogram2d': 'Histogram2d', 'histogram2dcontour': 'Histogram2dContour', + 'isosurface': 'Isosurface', 'mesh3d': 'Mesh3d', 'ohlc': 'Ohlc', 'parcats': 'Parcats', diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_dx.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_dx.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_dx.py 2018-12-25 11:58:09.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_dx.py 2019-02-08 22:58:42.000000000 +0000 @@ -7,6 +7,7 @@ super(DxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_dy.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_dy.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_dy.py 2018-12-25 11:58:09.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_dy.py 2019-02-08 22:58:42.000000000 +0000 @@ -7,6 +7,7 @@ super(DyValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_ids.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_ids.py 2018-12-25 11:58:09.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_ids.py 2019-02-08 22:58:41.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_uid.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_uid.py 2018-12-25 11:58:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_uid.py 2019-02-08 22:58:41.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_x0.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_x0.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_x0.py 2018-12-25 11:58:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_x0.py 2019-02-08 22:58:41.000000000 +0000 @@ -7,6 +7,7 @@ super(X0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_x.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_x.py 2018-12-25 11:58:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_x.py 2019-02-08 22:58:41.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_y0.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_y0.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_y0.py 2018-12-25 11:58:07.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_y0.py 2019-02-08 22:58:40.000000000 +0000 @@ -7,6 +7,7 @@ super(Y0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmap/_y.py plotly-3.6.1+dfsg1/plotly/validators/heatmap/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmap/_y.py 2018-12-25 11:58:07.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmap/_y.py 2019-02-08 22:58:40.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_dx.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_dx.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_dx.py 2018-12-25 11:58:04.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_dx.py 2019-02-08 22:58:36.000000000 +0000 @@ -7,6 +7,7 @@ super(DxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_dy.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_dy.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_dy.py 2018-12-25 11:58:04.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_dy.py 2019-02-08 22:58:36.000000000 +0000 @@ -7,6 +7,7 @@ super(DyValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_ids.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_ids.py 2018-12-25 11:58:04.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_ids.py 2019-02-08 22:58:36.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_uid.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_uid.py 2018-12-25 11:58:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_uid.py 2019-02-08 22:58:35.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_x0.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_x0.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_x0.py 2018-12-25 11:58:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_x0.py 2019-02-08 22:58:35.000000000 +0000 @@ -7,6 +7,7 @@ super(X0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_x.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_x.py 2018-12-25 11:58:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_x.py 2019-02-08 22:58:35.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'xtype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_y0.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_y0.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_y0.py 2018-12-25 11:58:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_y0.py 2019-02-08 22:58:35.000000000 +0000 @@ -7,6 +7,7 @@ super(Y0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'scaled'}), role=kwargs.pop('role', 'info'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_y.py plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/heatmapgl/_y.py 2018-12-25 11:58:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/heatmapgl/_y.py 2019-02-08 22:58:35.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), implied_edits=kwargs.pop('implied_edits', {'ytype': 'array'}), role=kwargs.pop('role', 'data'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_heatmapgl.py plotly-3.6.1+dfsg1/plotly/validators/_heatmapgl.py --- plotly-3.5.0+dfsg1/plotly/validators/_heatmapgl.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_heatmapgl.py 2019-02-08 22:58:35.000000000 +0000 @@ -110,7 +110,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_heatmap.py plotly-3.6.1+dfsg1/plotly/validators/_heatmap.py --- plotly-3.5.0+dfsg1/plotly/validators/_heatmap.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_heatmap.py 2019-02-08 22:58:38.000000000 +0000 @@ -113,7 +113,9 @@ transpose Transposes the z data. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram/_ids.py plotly-3.6.1+dfsg1/plotly/validators/histogram/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram/_ids.py 2018-12-25 11:58:02.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram/_ids.py 2019-02-08 22:58:33.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/histogram/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram/marker/line/_width.py 2018-12-25 11:58:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram/marker/line/_width.py 2019-02-08 22:58:31.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram/_uid.py plotly-3.6.1+dfsg1/plotly/validators/histogram/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram/_uid.py 2018-12-25 11:57:59.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram/_uid.py 2019-02-08 22:58:30.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram2d/_ids.py plotly-3.6.1+dfsg1/plotly/validators/histogram2d/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram2d/_ids.py 2018-12-25 11:57:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram2d/_ids.py 2019-02-08 22:58:24.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram2d/_uid.py plotly-3.6.1+dfsg1/plotly/validators/histogram2d/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram2d/_uid.py 2018-12-25 11:57:54.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram2d/_uid.py 2019-02-08 22:58:24.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/_ids.py plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/_ids.py 2018-12-25 11:57:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/_ids.py 2019-02-08 22:58:16.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/line/_color.py 2018-12-25 11:57:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/line/_color.py 2019-02-08 22:58:16.000000000 +0000 @@ -12,6 +12,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style+colorbars'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/line/_width.py 2018-12-25 11:57:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/line/_width.py 2019-02-08 22:58:16.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style+colorbars'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/_uid.py plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/histogram2dcontour/_uid.py 2018-12-25 11:57:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/histogram2dcontour/_uid.py 2019-02-08 22:58:16.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_histogram2dcontour.py plotly-3.6.1+dfsg1/plotly/validators/_histogram2dcontour.py --- plotly-3.5.0+dfsg1/plotly/validators/_histogram2dcontour.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_histogram2dcontour.py 2019-02-08 22:58:13.000000000 +0000 @@ -173,7 +173,9 @@ plotly.graph_objs.histogram2dcontour.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_histogram2d.py plotly-3.6.1+dfsg1/plotly/validators/_histogram2d.py --- plotly-3.5.0+dfsg1/plotly/validators/_histogram2d.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_histogram2d.py 2019-02-08 22:58:21.000000000 +0000 @@ -150,7 +150,9 @@ plotly.graph_objs.histogram2d.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_histogram.py plotly-3.6.1+dfsg1/plotly/validators/_histogram.py --- plotly-3.5.0+dfsg1/plotly/validators/_histogram.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_histogram.py 2019-02-08 22:58:27.000000000 +0000 @@ -167,7 +167,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/__init__.py plotly-3.6.1+dfsg1/plotly/validators/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/__init__.py 2018-12-25 12:00:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -19,6 +19,7 @@ from ._parcats import ParcatsValidator from ._ohlc import OhlcValidator from ._mesh3d import Mesh3dValidator +from ._isosurface import IsosurfaceValidator from ._histogram2dcontour import Histogram2dContourValidator from ._histogram2d import Histogram2dValidator from ._histogram import HistogramValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_autocolorscale.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_autocolorscale.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_autocolorscale.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_autocolorscale.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class AutocolorscaleValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='autocolorscale', parent_name='isosurface', **kwargs + ): + super(AutocolorscaleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {}), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._z import ZValidator +from ._y import YValidator +from ._x import XValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/x/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/x/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/x/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/x/_fill.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.caps.x', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/x/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/x/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/x/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/x/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,2 @@ +from ._show import ShowValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/x/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/x/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/x/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/x/_show.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.caps.x', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/_x.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/_x.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,31 @@ +import _plotly_utils.basevalidators + + +class XValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='x', parent_name='isosurface.caps', **kwargs + ): + super(XValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'X'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `caps`. The default + fill value of the `caps` is 1 meaning that they + are entirely shaded. On the other hand Applying + a `fill` ratio less than one would allow the + creation of openings parallel to the edges. + show + Sets the fill ratio of the `slices`. The + default fill value of the x `slices` is 1 + meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than + one would allow the creation of openings + parallel to the edges. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/y/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/y/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/y/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/y/_fill.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.caps.y', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/y/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/y/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/y/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/y/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,2 @@ +from ._show import ShowValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/y/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/y/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/y/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/y/_show.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.caps.y', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/_y.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/_y.py 2019-02-08 22:58:13.000000000 +0000 @@ -0,0 +1,31 @@ +import _plotly_utils.basevalidators + + +class YValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='y', parent_name='isosurface.caps', **kwargs + ): + super(YValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Y'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `caps`. The default + fill value of the `caps` is 1 meaning that they + are entirely shaded. On the other hand Applying + a `fill` ratio less than one would allow the + creation of openings parallel to the edges. + show + Sets the fill ratio of the `slices`. The + default fill value of the y `slices` is 1 + meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than + one would allow the creation of openings + parallel to the edges. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/z/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/z/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/z/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/z/_fill.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.caps.z', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/z/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/z/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/z/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/z/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,2 @@ +from ._show import ShowValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/z/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/z/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/z/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/z/_show.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.caps.z', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/_z.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/_z.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/caps/_z.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/caps/_z.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,31 @@ +import _plotly_utils.basevalidators + + +class ZValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='z', parent_name='isosurface.caps', **kwargs + ): + super(ZValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Z'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `caps`. The default + fill value of the `caps` is 1 meaning that they + are entirely shaded. On the other hand Applying + a `fill` ratio less than one would allow the + creation of openings parallel to the edges. + show + Sets the fill ratio of the `slices`. The + default fill value of the z `slices` is 1 + meaning that they are entirely shaded. On the + other hand Applying a `fill` ratio less than + one would allow the creation of openings + parallel to the edges. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_caps.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_caps.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_caps.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_caps.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,25 @@ +import _plotly_utils.basevalidators + + +class CapsValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__(self, plotly_name='caps', parent_name='isosurface', **kwargs): + super(CapsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Caps'), + data_docs=kwargs.pop( + 'data_docs', """ + x + plotly.graph_objs.isosurface.caps.X instance or + dict with compatible properties + y + plotly.graph_objs.isosurface.caps.Y instance or + dict with compatible properties + z + plotly.graph_objs.isosurface.caps.Z instance or + dict with compatible properties +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_cauto.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_cauto.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_cauto.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_cauto.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class CautoValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='cauto', parent_name='isosurface', **kwargs + ): + super(CautoValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {}), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_cmax.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_cmax.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_cmax.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_cmax.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class CmaxValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__(self, plotly_name='cmax', parent_name='isosurface', **kwargs): + super(CmaxValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {'cauto': False}), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_cmin.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_cmin.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_cmin.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_cmin.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class CminValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__(self, plotly_name='cmin', parent_name='isosurface', **kwargs): + super(CminValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {'cauto': False}), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_bgcolor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_bgcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_bgcolor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_bgcolor.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class BgcolorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='bgcolor', + parent_name='isosurface.colorbar', + **kwargs + ): + super(BgcolorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_bordercolor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_bordercolor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_bordercolor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_bordercolor.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='bordercolor', + parent_name='isosurface.colorbar', + **kwargs + ): + super(BordercolorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_borderwidth.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_borderwidth.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_borderwidth.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_borderwidth.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class BorderwidthValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='borderwidth', + parent_name='isosurface.colorbar', + **kwargs + ): + super(BorderwidthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_dtick.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_dtick.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_dtick.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_dtick.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class DtickValidator(_plotly_utils.basevalidators.AnyValidator): + + def __init__( + self, plotly_name='dtick', parent_name='isosurface.colorbar', **kwargs + ): + super(DtickValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {'tickmode': 'linear'}), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_exponentformat.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_exponentformat.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_exponentformat.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_exponentformat.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,23 @@ +import _plotly_utils.basevalidators + + +class ExponentformatValidator( + _plotly_utils.basevalidators.EnumeratedValidator +): + + def __init__( + self, + plotly_name='exponentformat', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ExponentformatValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop( + 'values', ['none', 'e', 'E', 'power', 'SI', 'B'] + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,41 @@ +from ._ypad import YpadValidator +from ._yanchor import YanchorValidator +from ._y import YValidator +from ._xpad import XpadValidator +from ._xanchor import XanchorValidator +from ._x import XValidator +from ._title import TitleValidator +from ._tickwidth import TickwidthValidator +from ._tickvalssrc import TickvalssrcValidator +from ._tickvals import TickvalsValidator +from ._ticktextsrc import TicktextsrcValidator +from ._ticktext import TicktextValidator +from ._ticksuffix import TicksuffixValidator +from ._ticks import TicksValidator +from ._tickprefix import TickprefixValidator +from ._tickmode import TickmodeValidator +from ._ticklen import TicklenValidator +from ._tickformatstopdefaults import TickformatstopValidator +from ._tickformatstops import TickformatstopsValidator +from ._tickformat import TickformatValidator +from ._tickfont import TickfontValidator +from ._tickcolor import TickcolorValidator +from ._tickangle import TickangleValidator +from ._tick0 import Tick0Validator +from ._thicknessmode import ThicknessmodeValidator +from ._thickness import ThicknessValidator +from ._showticksuffix import ShowticksuffixValidator +from ._showtickprefix import ShowtickprefixValidator +from ._showticklabels import ShowticklabelsValidator +from ._showexponent import ShowexponentValidator +from ._separatethousands import SeparatethousandsValidator +from ._outlinewidth import OutlinewidthValidator +from ._outlinecolor import OutlinecolorValidator +from ._nticks import NticksValidator +from ._lenmode import LenmodeValidator +from ._len import LenValidator +from ._exponentformat import ExponentformatValidator +from ._dtick import DtickValidator +from ._borderwidth import BorderwidthValidator +from ._bordercolor import BordercolorValidator +from ._bgcolor import BgcolorValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_lenmode.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_lenmode.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_lenmode.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_lenmode.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class LenmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='lenmode', + parent_name='isosurface.colorbar', + **kwargs + ): + super(LenmodeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + values=kwargs.pop('values', ['fraction', 'pixels']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_len.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_len.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_len.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_len.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class LenValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='len', parent_name='isosurface.colorbar', **kwargs + ): + super(LenValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_nticks.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_nticks.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_nticks.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_nticks.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class NticksValidator(_plotly_utils.basevalidators.IntegerValidator): + + def __init__( + self, + plotly_name='nticks', + parent_name='isosurface.colorbar', + **kwargs + ): + super(NticksValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_outlinecolor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_outlinecolor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_outlinecolor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_outlinecolor.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class OutlinecolorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='outlinecolor', + parent_name='isosurface.colorbar', + **kwargs + ): + super(OutlinecolorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_outlinewidth.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_outlinewidth.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_outlinewidth.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_outlinewidth.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class OutlinewidthValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='outlinewidth', + parent_name='isosurface.colorbar', + **kwargs + ): + super(OutlinewidthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_separatethousands.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_separatethousands.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_separatethousands.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_separatethousands.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class SeparatethousandsValidator( + _plotly_utils.basevalidators.BooleanValidator +): + + def __init__( + self, + plotly_name='separatethousands', + parent_name='isosurface.colorbar', + **kwargs + ): + super(SeparatethousandsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showexponent.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showexponent.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showexponent.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showexponent.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class ShowexponentValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='showexponent', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ShowexponentValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['all', 'first', 'last', 'none']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showticklabels.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showticklabels.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showticklabels.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showticklabels.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ShowticklabelsValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, + plotly_name='showticklabels', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ShowticklabelsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showtickprefix.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showtickprefix.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showtickprefix.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showtickprefix.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,21 @@ +import _plotly_utils.basevalidators + + +class ShowtickprefixValidator( + _plotly_utils.basevalidators.EnumeratedValidator +): + + def __init__( + self, + plotly_name='showtickprefix', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ShowtickprefixValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['all', 'first', 'last', 'none']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showticksuffix.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showticksuffix.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_showticksuffix.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_showticksuffix.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,21 @@ +import _plotly_utils.basevalidators + + +class ShowticksuffixValidator( + _plotly_utils.basevalidators.EnumeratedValidator +): + + def __init__( + self, + plotly_name='showticksuffix', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ShowticksuffixValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['all', 'first', 'last', 'none']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_thicknessmode.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_thicknessmode.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_thicknessmode.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_thicknessmode.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class ThicknessmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='thicknessmode', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ThicknessmodeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['fraction', 'pixels']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_thickness.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_thickness.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_thickness.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_thickness.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class ThicknessValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='thickness', + parent_name='isosurface.colorbar', + **kwargs + ): + super(ThicknessValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tick0.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tick0.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tick0.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tick0.py 2019-02-08 22:58:12.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class Tick0Validator(_plotly_utils.basevalidators.AnyValidator): + + def __init__( + self, plotly_name='tick0', parent_name='isosurface.colorbar', **kwargs + ): + super(Tick0Validator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {'tickmode': 'linear'}), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickangle.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickangle.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickangle.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickangle.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TickangleValidator(_plotly_utils.basevalidators.AngleValidator): + + def __init__( + self, + plotly_name='tickangle', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickangleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickcolor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickcolor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickcolor.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TickcolorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='tickcolor', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickcolorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_color.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_color.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_color.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ColorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='color', + parent_name='isosurface.colorbar.tickfont', + **kwargs + ): + super(ColorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_family.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_family.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_family.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_family.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class FamilyValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='family', + parent_name='isosurface.colorbar.tickfont', + **kwargs + ): + super(FamilyValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + no_blank=kwargs.pop('no_blank', True), + role=kwargs.pop('role', 'style'), + strict=kwargs.pop('strict', True), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._size import SizeValidator +from ._family import FamilyValidator +from ._color import ColorValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_size.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_size.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickfont/_size.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class SizeValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='size', + parent_name='isosurface.colorbar.tickfont', + **kwargs + ): + super(SizeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 1), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickfont.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickfont.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickfont.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickfont.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,41 @@ +import _plotly_utils.basevalidators + + +class TickfontValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, + plotly_name='tickfont', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickfontValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Tickfont'), + data_docs=kwargs.pop( + 'data_docs', """ + color + + family + 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 plotly service (at https://plot.ly + 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". + size + +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickformat.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickformat.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickformat.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickformat.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TickformatValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='tickformat', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickformatValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_dtickrange.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_dtickrange.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_dtickrange.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_dtickrange.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,29 @@ +import _plotly_utils.basevalidators + + +class DtickrangeValidator(_plotly_utils.basevalidators.InfoArrayValidator): + + def __init__( + self, + plotly_name='dtickrange', + parent_name='isosurface.colorbar.tickformatstop', + **kwargs + ): + super(DtickrangeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + items=kwargs.pop( + 'items', [ + { + 'valType': 'any', + 'editType': 'calc' + }, { + 'valType': 'any', + 'editType': 'calc' + } + ] + ), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_enabled.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_enabled.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_enabled.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_enabled.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class EnabledValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, + plotly_name='enabled', + parent_name='isosurface.colorbar.tickformatstop', + **kwargs + ): + super(EnabledValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,5 @@ +from ._value import ValueValidator +from ._templateitemname import TemplateitemnameValidator +from ._name import NameValidator +from ._enabled import EnabledValidator +from ._dtickrange import DtickrangeValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_name.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_name.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_name.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_name.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class NameValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='name', + parent_name='isosurface.colorbar.tickformatstop', + **kwargs + ): + super(NameValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_templateitemname.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_templateitemname.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_templateitemname.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_templateitemname.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='templateitemname', + parent_name='isosurface.colorbar.tickformatstop', + **kwargs + ): + super(TemplateitemnameValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_value.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_value.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_value.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/tickformatstop/_value.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ValueValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='value', + parent_name='isosurface.colorbar.tickformatstop', + **kwargs + ): + super(ValueValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstopdefaults.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstopdefaults.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstopdefaults.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstopdefaults.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class TickformatstopValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, + plotly_name='tickformatstopdefaults', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickformatstopValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Tickformatstop'), + data_docs=kwargs.pop('data_docs', """ +"""), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstops.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstops.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstops.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickformatstops.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,56 @@ +import _plotly_utils.basevalidators + + +class TickformatstopsValidator( + _plotly_utils.basevalidators.CompoundArrayValidator +): + + def __init__( + self, + plotly_name='tickformatstops', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickformatstopsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Tickformatstop'), + data_docs=kwargs.pop( + 'data_docs', """ + dtickrange + 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" + enabled + Determines whether or not this stop is used. If + `false`, this stop is ignored even within its + `dtickrange`. + name + 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. + templateitemname + 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`. + value + string - dtickformat for described zoom level, + the same as "tickformat" +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticklen.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticklen.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticklen.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticklen.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class TicklenValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='ticklen', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TicklenValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickmode.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickmode.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickmode.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickmode.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class TickmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='tickmode', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickmodeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop('implied_edits', {}), + role=kwargs.pop('role', 'info'), + values=kwargs.pop('values', ['auto', 'linear', 'array']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickprefix.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickprefix.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickprefix.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickprefix.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TickprefixValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='tickprefix', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickprefixValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticks.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticks.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticks.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticks.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class TicksValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, plotly_name='ticks', parent_name='isosurface.colorbar', **kwargs + ): + super(TicksValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['outside', 'inside', '']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticksuffix.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticksuffix.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticksuffix.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticksuffix.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TicksuffixValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='ticksuffix', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TicksuffixValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticktext.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticktext.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticktext.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticktext.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TicktextValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, + plotly_name='ticktext', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TicktextValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticktextsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticktextsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ticktextsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ticktextsrc.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='ticktextsrc', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TicktextsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickvals.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickvals.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickvals.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickvals.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, + plotly_name='tickvals', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickvalsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickvalssrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickvalssrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickvalssrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickvalssrc.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TickvalssrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='tickvalssrc', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickvalssrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickwidth.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickwidth.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_tickwidth.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_tickwidth.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class TickwidthValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='tickwidth', + parent_name='isosurface.colorbar', + **kwargs + ): + super(TickwidthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/_color.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/_color.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/_color.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ColorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='color', + parent_name='isosurface.colorbar.title.font', + **kwargs + ): + super(ColorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/_family.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/_family.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/_family.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/_family.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class FamilyValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='family', + parent_name='isosurface.colorbar.title.font', + **kwargs + ): + super(FamilyValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + no_blank=kwargs.pop('no_blank', True), + role=kwargs.pop('role', 'style'), + strict=kwargs.pop('strict', True), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._size import SizeValidator +from ._family import FamilyValidator +from ._color import ColorValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/_size.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/font/_size.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/font/_size.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class SizeValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='size', + parent_name='isosurface.colorbar.title.font', + **kwargs + ): + super(SizeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 1), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/_font.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/_font.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/_font.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/_font.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,41 @@ +import _plotly_utils.basevalidators + + +class FontValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, + plotly_name='font', + parent_name='isosurface.colorbar.title', + **kwargs + ): + super(FontValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Font'), + data_docs=kwargs.pop( + 'data_docs', """ + color + + family + 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 plotly service (at https://plot.ly + 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". + size + +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._text import TextValidator +from ._side import SideValidator +from ._font import FontValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/_side.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/_side.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/_side.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/_side.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class SideValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='side', + parent_name='isosurface.colorbar.title', + **kwargs + ): + super(SideValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['right', 'top', 'bottom']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/_text.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/_text.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/title/_text.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/title/_text.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class TextValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='text', + parent_name='isosurface.colorbar.title', + **kwargs + ): + super(TextValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_title.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_title.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_title.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_title.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,33 @@ +import _plotly_utils.basevalidators + + +class TitleValidator(_plotly_utils.basevalidators.TitleValidator): + + def __init__( + self, plotly_name='title', parent_name='isosurface.colorbar', **kwargs + ): + super(TitleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Title'), + data_docs=kwargs.pop( + 'data_docs', """ + font + Sets this color bar's title font. Note that the + title's font used to be set by the now + deprecated `titlefont` attribute. + side + Determines the location of color bar's title + with respect to the color bar. Note that the + title's location used to be set by the now + deprecated `titleside` attribute. + text + 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. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_xanchor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_xanchor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_xanchor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_xanchor.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class XanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='xanchor', + parent_name='isosurface.colorbar', + **kwargs + ): + super(XanchorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['left', 'center', 'right']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_xpad.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_xpad.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_xpad.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_xpad.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class XpadValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='xpad', parent_name='isosurface.colorbar', **kwargs + ): + super(XpadValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_x.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_x.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class XValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='x', parent_name='isosurface.colorbar', **kwargs + ): + super(XValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 3), + min=kwargs.pop('min', -2), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_yanchor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_yanchor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_yanchor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_yanchor.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class YanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='yanchor', + parent_name='isosurface.colorbar', + **kwargs + ): + super(YanchorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + values=kwargs.pop('values', ['top', 'middle', 'bottom']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ypad.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ypad.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_ypad.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_ypad.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class YpadValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='ypad', parent_name='isosurface.colorbar', **kwargs + ): + super(YpadValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_y.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/colorbar/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/colorbar/_y.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class YValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='y', parent_name='isosurface.colorbar', **kwargs + ): + super(YValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 3), + min=kwargs.pop('min', -2), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_colorbar.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_colorbar.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_colorbar.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_colorbar.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,227 @@ +import _plotly_utils.basevalidators + + +class ColorBarValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='colorbar', parent_name='isosurface', **kwargs + ): + super(ColorBarValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'ColorBar'), + data_docs=kwargs.pop( + 'data_docs', """ + bgcolor + Sets the color of padded area. + bordercolor + Sets the axis line color. + borderwidth + Sets the width (in px) or the border enclosing + this color bar. + dtick + 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" + exponentformat + 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. + len + 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. + lenmode + 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. + nticks + 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". + outlinecolor + Sets the axis line color. + outlinewidth + Sets the width (in px) of the axis line. + separatethousands + If "true", even 4-digit integers are separated + showexponent + 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. + showticklabels + Determines whether or not the tick labels are + drawn. + showtickprefix + 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. + showticksuffix + Same as `showtickprefix` but for tick suffixes. + thickness + Sets the thickness of the color bar This + measure excludes the size of the padding, ticks + and labels. + thicknessmode + 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. + tick0 + 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. + tickangle + Sets the angle of the tick labels with respect + to the horizontal. For example, a `tickangle` + of -90 draws the tick labels vertically. + tickcolor + Sets the tick color. + tickfont + Sets the color bar's tick label font + tickformat + Sets the tick label formatting rule using d3 + formatting mini-languages which are very + similar to those in Python. For numbers, see: h + ttps://github.com/d3/d3-format/blob/master/READ + ME.md#locale_format And for dates see: + https://github.com/d3/d3-time- + format/blob/master/README.md#locale_format We + add one item to d3's date formatter: "%{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" + tickformatstops + plotly.graph_objs.isosurface.colorbar.Tickforma + tstop instance or dict with compatible + properties + tickformatstopdefaults + When used in a template (as layout.template.dat + a.isosurface.colorbar.tickformatstopdefaults), + sets the default property values to use for + elements of isosurface.colorbar.tickformatstops + ticklen + Sets the tick length (in px). + tickmode + 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). + tickprefix + Sets a tick label prefix. + ticks + 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. + ticksuffix + Sets a tick label suffix. + ticktext + Sets the text displayed at the ticks position + via `tickvals`. Only has an effect if + `tickmode` is set to "array". Used with + `tickvals`. + ticktextsrc + Sets the source reference on plot.ly for + ticktext . + tickvals + Sets the values at which ticks on this axis + appear. Only has an effect if `tickmode` is set + to "array". Used with `ticktext`. + tickvalssrc + Sets the source reference on plot.ly for + tickvals . + tickwidth + Sets the tick width (in px). + title + plotly.graph_objs.isosurface.colorbar.Title + instance or dict with compatible properties + titlefont + Deprecated: Please use + isosurface.colorbar.title.font instead. Sets + this color bar's title font. Note that the + title's font used to be set by the now + deprecated `titlefont` attribute. + titleside + Deprecated: Please use + isosurface.colorbar.title.side instead. + Determines the location of color bar's title + with respect to the color bar. Note that the + title's location used to be set by the now + deprecated `titleside` attribute. + x + Sets the x position of the color bar (in plot + fraction). + xanchor + Sets this color bar's horizontal position + anchor. This anchor binds the `x` position to + the "left", "center" or "right" of the color + bar. + xpad + Sets the amount of padding (in px) along the x + direction. + y + Sets the y position of the color bar (in plot + fraction). + yanchor + Sets this color bar's vertical position anchor + This anchor binds the `y` position to the + "top", "middle" or "bottom" of the color bar. + ypad + Sets the amount of padding (in px) along the y + direction. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_colorscale.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_colorscale.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_colorscale.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_colorscale.py 2019-02-08 22:58:11.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ColorscaleValidator(_plotly_utils.basevalidators.ColorscaleValidator): + + def __init__( + self, plotly_name='colorscale', parent_name='isosurface', **kwargs + ): + super(ColorscaleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + implied_edits=kwargs.pop( + 'implied_edits', {'autocolorscale': False} + ), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/_color.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/_color.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/_color.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ColorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, plotly_name='color', parent_name='isosurface.contour', **kwargs + ): + super(ColorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._width import WidthValidator +from ._show import ShowValidator +from ._color import ColorValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/_show.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.contour', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/_width.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/contour/_width.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/contour/_width.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class WidthValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='width', parent_name='isosurface.contour', **kwargs + ): + super(WidthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 16), + min=kwargs.pop('min', 1), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_contour.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_contour.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_contour.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_contour.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,26 @@ +import _plotly_utils.basevalidators + + +class ContourValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='contour', parent_name='isosurface', **kwargs + ): + super(ContourValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Contour'), + data_docs=kwargs.pop( + 'data_docs', """ + color + Sets the color of the contour lines. + show + Sets whether or not dynamic contours are shown + on hover. Contours are more useful when + hovering on caps and slices. + width + Sets the width of the contour lines. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_customdata.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_customdata.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_customdata.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_customdata.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class CustomdataValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, plotly_name='customdata', parent_name='isosurface', **kwargs + ): + super(CustomdataValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_customdatasrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_customdatasrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_customdatasrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_customdatasrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class CustomdatasrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, plotly_name='customdatasrc', parent_name='isosurface', **kwargs + ): + super(CustomdatasrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_flatshading.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_flatshading.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_flatshading.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_flatshading.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class FlatshadingValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='flatshading', parent_name='isosurface', **kwargs + ): + super(FlatshadingValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_hoverinfo.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_hoverinfo.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_hoverinfo.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_hoverinfo.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HoverinfoValidator(_plotly_utils.basevalidators.FlaglistValidator): + + def __init__( + self, plotly_name='hoverinfo', parent_name='isosurface', **kwargs + ): + super(HoverinfoValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'calc'), + extras=kwargs.pop('extras', ['all', 'none', 'skip']), + flags=kwargs.pop('flags', ['x', 'y', 'z', 'text', 'name']), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_hoverinfosrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_hoverinfosrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_hoverinfosrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_hoverinfosrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, plotly_name='hoverinfosrc', parent_name='isosurface', **kwargs + ): + super(HoverinfosrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolor.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class BgcolorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='bgcolor', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(BgcolorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolorsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolorsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolorsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bgcolorsrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class BgcolorsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='bgcolorsrc', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(BgcolorsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolor.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolor.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolor.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolor.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='bordercolor', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(BordercolorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolorsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolorsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolorsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_bordercolorsrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class BordercolorsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='bordercolorsrc', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(BordercolorsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_color.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_color.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_color.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class ColorValidator(_plotly_utils.basevalidators.ColorValidator): + + def __init__( + self, + plotly_name='color', + parent_name='isosurface.hoverlabel.font', + **kwargs + ): + super(ColorValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_colorsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_colorsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_colorsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_colorsrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='colorsrc', + parent_name='isosurface.hoverlabel.font', + **kwargs + ): + super(ColorsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_family.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_family.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_family.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_family.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,21 @@ +import _plotly_utils.basevalidators + + +class FamilyValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='family', + parent_name='isosurface.hoverlabel.font', + **kwargs + ): + super(FamilyValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + no_blank=kwargs.pop('no_blank', True), + role=kwargs.pop('role', 'style'), + strict=kwargs.pop('strict', True), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_familysrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_familysrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_familysrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_familysrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class FamilysrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='familysrc', + parent_name='isosurface.hoverlabel.font', + **kwargs + ): + super(FamilysrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,6 @@ +from ._sizesrc import SizesrcValidator +from ._size import SizeValidator +from ._familysrc import FamilysrcValidator +from ._family import FamilyValidator +from ._colorsrc import ColorsrcValidator +from ._color import ColorValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_size.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_size.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_size.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class SizeValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='size', + parent_name='isosurface.hoverlabel.font', + **kwargs + ): + super(SizeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + min=kwargs.pop('min', 1), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_sizesrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_sizesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/font/_sizesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/font/_sizesrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='sizesrc', + parent_name='isosurface.hoverlabel.font', + **kwargs + ): + super(SizesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_font.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_font.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_font.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_font.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,50 @@ +import _plotly_utils.basevalidators + + +class FontValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, + plotly_name='font', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(FontValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Font'), + data_docs=kwargs.pop( + 'data_docs', """ + color + + colorsrc + Sets the source reference on plot.ly for color + . + family + 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 plotly service (at https://plot.ly + 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". + familysrc + Sets the source reference on plot.ly for + family . + size + + sizesrc + Sets the source reference on plot.ly for size + . +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,7 @@ +from ._namelengthsrc import NamelengthsrcValidator +from ._namelength import NamelengthValidator +from ._font import FontValidator +from ._bordercolorsrc import BordercolorsrcValidator +from ._bordercolor import BordercolorValidator +from ._bgcolorsrc import BgcolorsrcValidator +from ._bgcolor import BgcolorValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_namelength.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_namelength.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_namelength.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_namelength.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class NamelengthValidator(_plotly_utils.basevalidators.IntegerValidator): + + def __init__( + self, + plotly_name='namelength', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(NamelengthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + min=kwargs.pop('min', -1), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_namelengthsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_namelengthsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/hoverlabel/_namelengthsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/hoverlabel/_namelengthsrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class NamelengthsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='namelengthsrc', + parent_name='isosurface.hoverlabel', + **kwargs + ): + super(NamelengthsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_hoverlabel.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_hoverlabel.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_hoverlabel.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_hoverlabel.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,44 @@ +import _plotly_utils.basevalidators + + +class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='hoverlabel', parent_name='isosurface', **kwargs + ): + super(HoverlabelValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Hoverlabel'), + data_docs=kwargs.pop( + 'data_docs', """ + bgcolor + Sets the background color of the hover labels + for this trace + bgcolorsrc + Sets the source reference on plot.ly for + bgcolor . + bordercolor + Sets the border color of the hover labels for + this trace. + bordercolorsrc + Sets the source reference on plot.ly for + bordercolor . + font + Sets the font used in hover labels. + namelength + Sets the length (in number of characters) of + the trace name in the hover labels for this + trace. -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. + namelengthsrc + Sets the source reference on plot.ly for + namelength . +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_ids.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_ids.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_ids.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__(self, plotly_name='ids', parent_name='isosurface', **kwargs): + super(IdsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + anim=kwargs.pop('anim', True), + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_idssrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_idssrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_idssrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_idssrc.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class IdssrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, plotly_name='idssrc', parent_name='isosurface', **kwargs + ): + super(IdssrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,45 @@ +from ._zsrc import ZsrcValidator +from ._z import ZValidator +from ._ysrc import YsrcValidator +from ._y import YValidator +from ._xsrc import XsrcValidator +from ._x import XValidator +from ._visible import VisibleValidator +from ._valuesrc import ValuesrcValidator +from ._value import ValueValidator +from ._uirevision import UirevisionValidator +from ._uid import UidValidator +from ._textsrc import TextsrcValidator +from ._text import TextValidator +from ._surface import SurfaceValidator +from ._stream import StreamValidator +from ._spaceframe import SpaceframeValidator +from ._slices import SlicesValidator +from ._showscale import ShowscaleValidator +from ._showlegend import ShowlegendValidator +from ._selectedpoints import SelectedpointsValidator +from ._scene import SceneValidator +from ._reversescale import ReversescaleValidator +from ._opacity import OpacityValidator +from ._name import NameValidator +from ._lightposition import LightpositionValidator +from ._lighting import LightingValidator +from ._legendgroup import LegendgroupValidator +from ._isomin import IsominValidator +from ._isomax import IsomaxValidator +from ._idssrc import IdssrcValidator +from ._ids import IdsValidator +from ._hoverlabel import HoverlabelValidator +from ._hoverinfosrc import HoverinfosrcValidator +from ._hoverinfo import HoverinfoValidator +from ._flatshading import FlatshadingValidator +from ._customdatasrc import CustomdatasrcValidator +from ._customdata import CustomdataValidator +from ._contour import ContourValidator +from ._colorscale import ColorscaleValidator +from ._colorbar import ColorBarValidator +from ._cmin import CminValidator +from ._cmax import CmaxValidator +from ._cauto import CautoValidator +from ._caps import CapsValidator +from ._autocolorscale import AutocolorscaleValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_isomax.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_isomax.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_isomax.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_isomax.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class IsomaxValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='isomax', parent_name='isosurface', **kwargs + ): + super(IsomaxValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_isomin.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_isomin.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_isomin.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_isomin.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class IsominValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='isomin', parent_name='isosurface', **kwargs + ): + super(IsominValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_legendgroup.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_legendgroup.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_legendgroup.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_legendgroup.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class LegendgroupValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, plotly_name='legendgroup', parent_name='isosurface', **kwargs + ): + super(LegendgroupValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'style'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_ambient.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_ambient.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_ambient.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_ambient.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class AmbientValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='ambient', + parent_name='isosurface.lighting', + **kwargs + ): + super(AmbientValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_diffuse.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_diffuse.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_diffuse.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_diffuse.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class DiffuseValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='diffuse', + parent_name='isosurface.lighting', + **kwargs + ): + super(DiffuseValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_facenormalsepsilon.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_facenormalsepsilon.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_facenormalsepsilon.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_facenormalsepsilon.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,22 @@ +import _plotly_utils.basevalidators + + +class FacenormalsepsilonValidator( + _plotly_utils.basevalidators.NumberValidator +): + + def __init__( + self, + plotly_name='facenormalsepsilon', + parent_name='isosurface.lighting', + **kwargs + ): + super(FacenormalsepsilonValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_fresnel.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_fresnel.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_fresnel.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_fresnel.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class FresnelValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='fresnel', + parent_name='isosurface.lighting', + **kwargs + ): + super(FresnelValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 5), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,7 @@ +from ._vertexnormalsepsilon import VertexnormalsepsilonValidator +from ._specular import SpecularValidator +from ._roughness import RoughnessValidator +from ._fresnel import FresnelValidator +from ._facenormalsepsilon import FacenormalsepsilonValidator +from ._diffuse import DiffuseValidator +from ._ambient import AmbientValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_roughness.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_roughness.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_roughness.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_roughness.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class RoughnessValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='roughness', + parent_name='isosurface.lighting', + **kwargs + ): + super(RoughnessValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_specular.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_specular.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_specular.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_specular.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class SpecularValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='specular', + parent_name='isosurface.lighting', + **kwargs + ): + super(SpecularValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 2), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_vertexnormalsepsilon.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_vertexnormalsepsilon.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lighting/_vertexnormalsepsilon.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lighting/_vertexnormalsepsilon.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,22 @@ +import _plotly_utils.basevalidators + + +class VertexnormalsepsilonValidator( + _plotly_utils.basevalidators.NumberValidator +): + + def __init__( + self, + plotly_name='vertexnormalsepsilon', + parent_name='isosurface.lighting', + **kwargs + ): + super(VertexnormalsepsilonValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_lighting.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_lighting.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_lighting.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_lighting.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,42 @@ +import _plotly_utils.basevalidators + + +class LightingValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='lighting', parent_name='isosurface', **kwargs + ): + super(LightingValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Lighting'), + data_docs=kwargs.pop( + 'data_docs', """ + ambient + Ambient light increases overall color + visibility but can wash out the image. + diffuse + Represents the extent that incident rays are + reflected in a range of angles. + facenormalsepsilon + Epsilon for face normals calculation avoids + math issues arising from degenerate geometry. + fresnel + Represents the reflectance as a dependency of + the viewing angle; e.g. paper is reflective + when viewing it from the edge of the paper + (almost 90 degrees), causing shine. + roughness + Alters specular reflection; the rougher the + surface, the wider and less contrasty the + shine. + specular + Represents the level that incident rays are + reflected in a single direction, causing shine. + vertexnormalsepsilon + Epsilon for vertex normals calculation avoids + math issues arising from degenerate geometry. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._z import ZValidator +from ._y import YValidator +from ._x import XValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/_x.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/_x.py 2019-02-08 22:58:10.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class XValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='x', + parent_name='isosurface.lightposition', + **kwargs + ): + super(XValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 100000), + min=kwargs.pop('min', -100000), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/_y.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/_y.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class YValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='y', + parent_name='isosurface.lightposition', + **kwargs + ): + super(YValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 100000), + min=kwargs.pop('min', -100000), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/_z.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/_z.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/lightposition/_z.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/lightposition/_z.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class ZValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='z', + parent_name='isosurface.lightposition', + **kwargs + ): + super(ZValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 100000), + min=kwargs.pop('min', -100000), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_lightposition.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_lightposition.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_lightposition.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_lightposition.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,27 @@ +import _plotly_utils.basevalidators + + +class LightpositionValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='lightposition', parent_name='isosurface', **kwargs + ): + super(LightpositionValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Lightposition'), + data_docs=kwargs.pop( + 'data_docs', """ + x + Numeric vector, representing the X coordinate + for each vertex. + y + Numeric vector, representing the Y coordinate + for each vertex. + z + Numeric vector, representing the Z coordinate + for each vertex. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_name.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_name.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_name.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_name.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class NameValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__(self, plotly_name='name', parent_name='isosurface', **kwargs): + super(NameValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'style'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_opacity.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_opacity.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class OpacityValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='opacity', parent_name='isosurface', **kwargs + ): + super(OpacityValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'style'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_reversescale.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_reversescale.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_reversescale.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_reversescale.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ReversescaleValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='reversescale', parent_name='isosurface', **kwargs + ): + super(ReversescaleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_scene.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_scene.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_scene.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_scene.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class SceneValidator(_plotly_utils.basevalidators.SubplotidValidator): + + def __init__( + self, plotly_name='scene', parent_name='isosurface', **kwargs + ): + super(SceneValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + dflt=kwargs.pop('dflt', 'scene'), + edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_selectedpoints.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_selectedpoints.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_selectedpoints.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_selectedpoints.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class SelectedpointsValidator(_plotly_utils.basevalidators.AnyValidator): + + def __init__( + self, plotly_name='selectedpoints', parent_name='isosurface', **kwargs + ): + super(SelectedpointsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_showlegend.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_showlegend.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_showlegend.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_showlegend.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowlegendValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='showlegend', parent_name='isosurface', **kwargs + ): + super(ShowlegendValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'style'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_showscale.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_showscale.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_showscale.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_showscale.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowscaleValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='showscale', parent_name='isosurface', **kwargs + ): + super(ShowscaleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,3 @@ +from ._z import ZValidator +from ._y import YValidator +from ._x import XValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_fill.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.slices.x', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,4 @@ +from ._show import ShowValidator +from ._locationssrc import LocationssrcValidator +from ._locations import LocationsValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_locations.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_locations.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_locations.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_locations.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class LocationsValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, + plotly_name='locations', + parent_name='isosurface.slices.x', + **kwargs + ): + super(LocationsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_locationssrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_locationssrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_locationssrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_locationssrc.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class LocationssrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='locationssrc', + parent_name='isosurface.slices.x', + **kwargs + ): + super(LocationssrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/x/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/x/_show.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.slices.x', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/_x.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/_x.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,36 @@ +import _plotly_utils.basevalidators + + +class XValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='x', parent_name='isosurface.slices', **kwargs + ): + super(XValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'X'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `slices`. The + default fill value of the `slices` is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + locations + Specifies the location(s) of slices on the + axis. When not locations specified slices would + be created for all points of the axis x except + start and end. + locationssrc + Sets the source reference on plot.ly for + locations . + show + Determines whether or not slice planes about + the x dimension are drawn. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_fill.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.slices.y', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,4 @@ +from ._show import ShowValidator +from ._locationssrc import LocationssrcValidator +from ._locations import LocationsValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_locations.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_locations.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_locations.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_locations.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class LocationsValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, + plotly_name='locations', + parent_name='isosurface.slices.y', + **kwargs + ): + super(LocationsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_locationssrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_locationssrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_locationssrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_locationssrc.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class LocationssrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='locationssrc', + parent_name='isosurface.slices.y', + **kwargs + ): + super(LocationssrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/y/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/y/_show.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.slices.y', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/_y.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/_y.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,36 @@ +import _plotly_utils.basevalidators + + +class YValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='y', parent_name='isosurface.slices', **kwargs + ): + super(YValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Y'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `slices`. The + default fill value of the `slices` is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + locations + Specifies the location(s) of slices on the + axis. When not locations specified slices would + be created for all points of the axis y except + start and end. + locationssrc + Sets the source reference on plot.ly for + locations . + show + Determines whether or not slice planes about + the y dimension are drawn. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_fill.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.slices.z', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,4 @@ +from ._show import ShowValidator +from ._locationssrc import LocationssrcValidator +from ._locations import LocationsValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_locations.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_locations.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_locations.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_locations.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class LocationsValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, + plotly_name='locations', + parent_name='isosurface.slices.z', + **kwargs + ): + super(LocationsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_locationssrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_locationssrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_locationssrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_locationssrc.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class LocationssrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='locationssrc', + parent_name='isosurface.slices.z', + **kwargs + ): + super(LocationssrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/z/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/z/_show.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.slices.z', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/_z.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/_z.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/slices/_z.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/slices/_z.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,36 @@ +import _plotly_utils.basevalidators + + +class ZValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='z', parent_name='isosurface.slices', **kwargs + ): + super(ZValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Z'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `slices`. The + default fill value of the `slices` is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + locations + Specifies the location(s) of slices on the + axis. When not locations specified slices would + be created for all points of the axis z except + start and end. + locationssrc + Sets the source reference on plot.ly for + locations . + show + Determines whether or not slice planes about + the z dimension are drawn. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_slices.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_slices.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_slices.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_slices.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,27 @@ +import _plotly_utils.basevalidators + + +class SlicesValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='slices', parent_name='isosurface', **kwargs + ): + super(SlicesValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Slices'), + data_docs=kwargs.pop( + 'data_docs', """ + x + plotly.graph_objs.isosurface.slices.X instance + or dict with compatible properties + y + plotly.graph_objs.isosurface.slices.Y instance + or dict with compatible properties + z + plotly.graph_objs.isosurface.slices.Z instance + or dict with compatible properties +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/spaceframe/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/spaceframe/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/spaceframe/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/spaceframe/_fill.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='fill', + parent_name='isosurface.spaceframe', + **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/spaceframe/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/spaceframe/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/spaceframe/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/spaceframe/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,2 @@ +from ._show import ShowValidator +from ._fill import FillValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/spaceframe/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/spaceframe/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/spaceframe/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/spaceframe/_show.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, + plotly_name='show', + parent_name='isosurface.spaceframe', + **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_spaceframe.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_spaceframe.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_spaceframe.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_spaceframe.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,31 @@ +import _plotly_utils.basevalidators + + +class SpaceframeValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='spaceframe', parent_name='isosurface', **kwargs + ): + super(SpaceframeValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Spaceframe'), + data_docs=kwargs.pop( + 'data_docs', """ + fill + Sets the fill ratio of the `spaceframe` + elements. The default fill value is 0.15 + meaning that only 15% of the area of every + faces of tetras would be shaded. Applying a + greater `fill` ratio would allow the creation + of stronger elements or could be sued to have + entirely closed areas (in case of using 1). + show + Displays/hides tetrahedron shapes between + minimum and maximum iso-values. Often useful + when either caps or surfaces are disabled or + filled with values less than 1. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/stream/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/stream/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/stream/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/stream/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,2 @@ +from ._token import TokenValidator +from ._maxpoints import MaxpointsValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/stream/_maxpoints.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/stream/_maxpoints.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/stream/_maxpoints.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/stream/_maxpoints.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class MaxpointsValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='maxpoints', + parent_name='isosurface.stream', + **kwargs + ): + super(MaxpointsValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 10000), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/stream/_token.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/stream/_token.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/stream/_token.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/stream/_token.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class TokenValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, plotly_name='token', parent_name='isosurface.stream', **kwargs + ): + super(TokenValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + no_blank=kwargs.pop('no_blank', True), + role=kwargs.pop('role', 'info'), + strict=kwargs.pop('strict', True), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_stream.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_stream.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_stream.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_stream.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,27 @@ +import _plotly_utils.basevalidators + + +class StreamValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='stream', parent_name='isosurface', **kwargs + ): + super(StreamValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Stream'), + data_docs=kwargs.pop( + 'data_docs', """ + maxpoints + 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. + token + The stream id number links a data trace on a + plot with a stream. See + https://plot.ly/settings for more details. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_count.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_count.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_count.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_count.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class CountValidator(_plotly_utils.basevalidators.IntegerValidator): + + def __init__( + self, plotly_name='count', parent_name='isosurface.surface', **kwargs + ): + super(CountValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 1), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_fill.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_fill.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_fill.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,17 @@ +import _plotly_utils.basevalidators + + +class FillValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, plotly_name='fill', parent_name='isosurface.surface', **kwargs + ): + super(FillValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + max=kwargs.pop('max', 1), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/__init__.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -0,0 +1,4 @@ +from ._show import ShowValidator +from ._pattern import PatternValidator +from ._fill import FillValidator +from ._count import CountValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_pattern.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_pattern.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_pattern.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_pattern.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,20 @@ +import _plotly_utils.basevalidators + + +class PatternValidator(_plotly_utils.basevalidators.FlaglistValidator): + + def __init__( + self, + plotly_name='pattern', + parent_name='isosurface.surface', + **kwargs + ): + super(PatternValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + extras=kwargs.pop('extras', ['all', 'odd', 'even']), + flags=kwargs.pop('flags', ['A', 'B', 'C', 'D', 'E']), + role=kwargs.pop('role', 'style'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_show.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_show.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/surface/_show.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/surface/_show.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='show', parent_name='isosurface.surface', **kwargs + ): + super(ShowValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_surface.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_surface.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_surface.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_surface.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,44 @@ +import _plotly_utils.basevalidators + + +class SurfaceValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='surface', parent_name='isosurface', **kwargs + ): + super(SurfaceValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Surface'), + data_docs=kwargs.pop( + 'data_docs', """ + count + Sets the number of iso-surfaces between minimum + and maximum iso-values. By default this value + is 2 meaning that only minimum and maximum + surfaces would be drawn. + fill + Sets the fill ratio of the iso-surface. The + default fill value of the surface is 1 meaning + that they are entirely shaded. On the other + hand Applying a `fill` ratio less than one + would allow the creation of openings parallel + to the edges. + pattern + Sets the surface pattern of the iso-surface 3-D + sections. The default pattern of the surface is + `all` meaning that the rest of surface elements + would be shaded. The check options (either 1 or + 2) could be used to draw half of the squares on + the surface. Using various combinations of + capital `A`, `B`, `C`, `D` and `E` may also be + used to reduce the number of triangles on the + iso-surfaces and creating other patterns of + interest. + show + Hides/displays surfaces between minimum and + maximum iso-values. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_text.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_text.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_text.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_text.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class TextValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__(self, plotly_name='text', parent_name='isosurface', **kwargs): + super(TextValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_textsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_textsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_textsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_textsrc.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class TextsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, plotly_name='textsrc', parent_name='isosurface', **kwargs + ): + super(TextsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_uid.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_uid.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_uid.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class UidValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__(self, plotly_name='uid', parent_name='isosurface', **kwargs): + super(UidValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + anim=kwargs.pop('anim', True), + edit_type=kwargs.pop('edit_type', 'plot'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_uirevision.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_uirevision.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_uirevision.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_uirevision.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class UirevisionValidator(_plotly_utils.basevalidators.AnyValidator): + + def __init__( + self, plotly_name='uirevision', parent_name='isosurface', **kwargs + ): + super(UirevisionValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_value.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_value.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_value.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_value.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ValueValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__( + self, plotly_name='value', parent_name='isosurface', **kwargs + ): + super(ValueValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_valuesrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_valuesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_valuesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_valuesrc.py 2019-02-08 22:58:09.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ValuesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, plotly_name='valuesrc', parent_name='isosurface', **kwargs + ): + super(ValuesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_visible.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_visible.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_visible.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_visible.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class VisibleValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, plotly_name='visible', parent_name='isosurface', **kwargs + ): + super(VisibleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + values=kwargs.pop('values', [True, False, 'legendonly']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_x.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_x.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_x.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class XValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__(self, plotly_name='x', parent_name='isosurface', **kwargs): + super(XValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_xsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_xsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_xsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_xsrc.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class XsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__(self, plotly_name='xsrc', parent_name='isosurface', **kwargs): + super(XsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_y.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_y.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_y.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class YValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__(self, plotly_name='y', parent_name='isosurface', **kwargs): + super(YValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_ysrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_ysrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_ysrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_ysrc.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class YsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__(self, plotly_name='ysrc', parent_name='isosurface', **kwargs): + super(YsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_z.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_z.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_z.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_z.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class ZValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__(self, plotly_name='z', parent_name='isosurface', **kwargs): + super(ZValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/isosurface/_zsrc.py plotly-3.6.1+dfsg1/plotly/validators/isosurface/_zsrc.py --- plotly-3.5.0+dfsg1/plotly/validators/isosurface/_zsrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/isosurface/_zsrc.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class ZsrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__(self, plotly_name='zsrc', parent_name='isosurface', **kwargs): + super(ZsrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_isosurface.py plotly-3.6.1+dfsg1/plotly/validators/_isosurface.py --- plotly-3.5.0+dfsg1/plotly/validators/_isosurface.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_isosurface.py 2019-02-08 22:58:08.000000000 +0000 @@ -0,0 +1,211 @@ +import _plotly_utils.basevalidators + + +class IsosurfaceValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__(self, plotly_name='isosurface', parent_name='', **kwargs): + super(IsosurfaceValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Isosurface'), + data_docs=kwargs.pop( + 'data_docs', """ + autocolorscale + Determines whether the colorscale is a default + palette (`autocolorscale: true`) or the palette + determined by `colorscale`. 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. + caps + plotly.graph_objs.isosurface.Caps instance or + dict with compatible properties + cauto + Determines whether or not the color domain is + computed with respect to the input data (here + `value`) or the bounds set in `cmin` and `cmax` + Defaults to `false` when `cmin` and `cmax` are + set by the user. + cmax + Sets the upper bound of the color domain. Value + should have the same units as `value` and if + set, `cmin` must be set as well. + cmin + Sets the lower bound of the color domain. Value + should have the same units as `value` and if + set, `cmax` must be set as well. + colorbar + plotly.graph_objs.isosurface.ColorBar instance + or dict with compatible properties + colorscale + Sets the colorscale. 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`cmin` and + `cmax`. Alternatively, `colorscale` may be a + palette name string of the following list: Grey + s,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Blues, + Picnic,Rainbow,Portland,Jet,Hot,Blackbody,Earth + ,Electric,Viridis,Cividis. + contour + plotly.graph_objs.isosurface.Contour instance + or dict with compatible properties + customdata + 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 + customdatasrc + Sets the source reference on plot.ly for + customdata . + flatshading + Determines whether or not normal smoothing is + applied to the isosurfaces, creating + isosurfaces with an angular, low-poly look via + flat reflections. + hoverinfo + 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. + hoverinfosrc + Sets the source reference on plot.ly for + hoverinfo . + hoverlabel + plotly.graph_objs.isosurface.Hoverlabel + instance or dict with compatible properties + ids + 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. + idssrc + Sets the source reference on plot.ly for ids . + isomax + Sets the maximum boundary for iso-surface plot. + isomin + Sets the minimum boundary for iso-surface plot. + legendgroup + Sets the legend group for this trace. Traces + part of the same legend group hide/show at the + same time when toggling legend items. + lighting + plotly.graph_objs.isosurface.Lighting instance + or dict with compatible properties + lightposition + plotly.graph_objs.isosurface.Lightposition + instance or dict with compatible properties + name + Sets the trace name. The trace name appear as + the legend item and on hover. + opacity + Sets the opacity of the trace. + reversescale + Reverses the color mapping if true. If true, + `cmin` will correspond to the last color in the + array and `cmax` will correspond to the first + color. + scene + Sets a reference between this trace's 3D + coordinate system and a 3D scene. If "scene" + (the default value), the (x,y,z) coordinates + refer to `layout.scene`. If "scene2", the + (x,y,z) coordinates refer to `layout.scene2`, + and so on. + selectedpoints + 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. + showlegend + Determines whether or not an item corresponding + to this trace is shown in the legend. + showscale + Determines whether or not a colorbar is + displayed for this trace. + slices + plotly.graph_objs.isosurface.Slices instance or + dict with compatible properties + spaceframe + plotly.graph_objs.isosurface.Spaceframe + instance or dict with compatible properties + stream + plotly.graph_objs.isosurface.Stream instance or + dict with compatible properties + surface + plotly.graph_objs.isosurface.Surface instance + or dict with compatible properties + text + Sets the text elements associated with the + vertices. If trace `hoverinfo` contains a + "text" flag and "hovertext" is not set, these + elements will be seen in the hover labels. + textsrc + Sets the source reference on plot.ly for text + . + uid + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. + uirevision + 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. + value + Sets the 4th dimension (value) of the vertices. + valuesrc + Sets the source reference on plot.ly for value + . + visible + 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). + x + Sets the X coordinates of the vertices on X + axis. + xsrc + Sets the source reference on plot.ly for x . + y + Sets the Y coordinates of the vertices on Y + axis. + ysrc + Sets the source reference on plot.ly for y . + z + Sets the Z coordinates of the vertices on Z + axis. + zsrc + Sets the source reference on plot.ly for z . +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/angularaxis/_domain.py plotly-3.6.1+dfsg1/plotly/validators/layout/angularaxis/_domain.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/angularaxis/_domain.py 2018-12-25 11:56:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/angularaxis/_domain.py 2019-02-08 22:56:03.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/geo/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/layout/geo/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/geo/domain/_x.py 2018-12-25 11:56:04.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/geo/domain/_x.py 2019-02-08 22:55:58.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/geo/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/layout/geo/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/geo/domain/_y.py 2018-12-25 11:56:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/geo/domain/_y.py 2019-02-08 22:55:58.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/grid/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/layout/grid/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/grid/domain/_x.py 2018-12-25 11:56:01.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/grid/domain/_x.py 2019-02-08 22:55:55.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/grid/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/layout/grid/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/grid/domain/_y.py 2018-12-25 11:56:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/grid/domain/_y.py 2019-02-08 22:55:55.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/__init__.py plotly-3.6.1+dfsg1/plotly/validators/layout/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/__init__.py 2019-02-08 23:01:15.000000000 +0000 @@ -7,6 +7,7 @@ from ._updatemenudefaults import UpdatemenuValidator from ._updatemenus import UpdatemenusValidator from ._uirevision import UirevisionValidator +from ._transition import TransitionValidator from ._title import TitleValidator from ._ternary import TernaryValidator from ._template import TemplateValidator @@ -27,6 +28,8 @@ from ._paper_bgcolor import PaperBgcolorValidator from ._orientation import OrientationValidator from ._modebar import ModebarValidator +from ._metasrc import MetasrcValidator +from ._meta import MetaValidator from ._margin import MarginValidator from ._mapbox import MapboxValidator from ._legend import LegendValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/mapbox/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/layout/mapbox/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/mapbox/domain/_x.py 2018-12-25 11:55:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/mapbox/domain/_x.py 2019-02-08 22:55:53.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/mapbox/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/layout/mapbox/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/mapbox/domain/_y.py 2018-12-25 11:55:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/mapbox/domain/_y.py 2019-02-08 22:55:53.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/_meta.py plotly-3.6.1+dfsg1/plotly/validators/layout/_meta.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/_meta.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/_meta.py 2019-02-08 22:55:51.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class MetaValidator(_plotly_utils.basevalidators.DataArrayValidator): + + def __init__(self, plotly_name='meta', parent_name='layout', **kwargs): + super(MetaValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'plot'), + role=kwargs.pop('role', 'data'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/_metasrc.py plotly-3.6.1+dfsg1/plotly/validators/layout/_metasrc.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/_metasrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/_metasrc.py 2019-02-08 22:55:51.000000000 +0000 @@ -0,0 +1,13 @@ +import _plotly_utils.basevalidators + + +class MetasrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__(self, plotly_name='metasrc', parent_name='layout', **kwargs): + super(MetasrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/polar/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/layout/polar/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/polar/domain/_x.py 2018-12-25 11:55:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/polar/domain/_x.py 2019-02-08 22:55:50.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/polar/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/layout/polar/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/polar/domain/_y.py 2018-12-25 11:55:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/polar/domain/_y.py 2019-02-08 22:55:49.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/polar/radialaxis/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/polar/radialaxis/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/polar/radialaxis/_range.py 2018-12-25 11:55:52.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/polar/radialaxis/_range.py 2019-02-08 22:55:47.000000000 +0000 @@ -12,6 +12,7 @@ super(RangeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), implied_edits=kwargs.pop('implied_edits', {'autorange': False}), items=kwargs.pop( @@ -22,7 +23,8 @@ 'impliedEdits': { '^autorange': False } - }, { + }, + { 'valType': 'any', 'editType': 'plot', 'impliedEdits': { diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/radialaxis/_domain.py plotly-3.6.1+dfsg1/plotly/validators/layout/radialaxis/_domain.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/radialaxis/_domain.py 2018-12-25 11:55:51.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/radialaxis/_domain.py 2019-02-08 22:55:46.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/scene/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/layout/scene/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/scene/domain/_x.py 2018-12-25 11:55:49.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/scene/domain/_x.py 2019-02-08 22:55:44.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/scene/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/layout/scene/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/scene/domain/_y.py 2018-12-25 11:55:49.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/scene/domain/_y.py 2019-02-08 22:55:43.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/scene/xaxis/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/scene/xaxis/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/scene/xaxis/_range.py 2018-12-25 11:55:46.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/scene/xaxis/_range.py 2019-02-08 22:55:41.000000000 +0000 @@ -9,6 +9,7 @@ super(RangeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', False), edit_type=kwargs.pop('edit_type', 'plot'), implied_edits=kwargs.pop('implied_edits', {'autorange': False}), items=kwargs.pop( @@ -19,7 +20,8 @@ 'impliedEdits': { '^autorange': False } - }, { + }, + { 'valType': 'any', 'editType': 'plot', 'impliedEdits': { diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/scene/yaxis/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/scene/yaxis/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/scene/yaxis/_range.py 2018-12-25 11:55:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/scene/yaxis/_range.py 2019-02-08 22:55:38.000000000 +0000 @@ -9,6 +9,7 @@ super(RangeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', False), edit_type=kwargs.pop('edit_type', 'plot'), implied_edits=kwargs.pop('implied_edits', {'autorange': False}), items=kwargs.pop( @@ -19,7 +20,8 @@ 'impliedEdits': { '^autorange': False } - }, { + }, + { 'valType': 'any', 'editType': 'plot', 'impliedEdits': { diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/scene/zaxis/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/scene/zaxis/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/scene/zaxis/_range.py 2018-12-25 11:55:39.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/scene/zaxis/_range.py 2019-02-08 22:55:34.000000000 +0000 @@ -9,6 +9,7 @@ super(RangeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', False), edit_type=kwargs.pop('edit_type', 'plot'), implied_edits=kwargs.pop('implied_edits', {'autorange': False}), items=kwargs.pop( @@ -19,7 +20,8 @@ 'impliedEdits': { '^autorange': False } - }, { + }, + { 'valType': 'any', 'editType': 'plot', 'impliedEdits': { diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/shape/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/layout/shape/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/shape/line/_color.py 2018-12-25 11:55:37.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/shape/line/_color.py 2019-02-08 22:55:32.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'arraydraw'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/shape/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/layout/shape/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/shape/line/_width.py 2018-12-25 11:55:37.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/shape/line/_width.py 2019-02-08 22:55:32.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+arraydraw'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/template/data/__init__.py plotly-3.6.1+dfsg1/plotly/validators/layout/template/data/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/template/data/__init__.py 2018-12-25 12:00:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/template/data/__init__.py 2019-02-08 23:01:15.000000000 +0000 @@ -19,6 +19,7 @@ from ._parcats import ParcatssValidator from ._ohlc import OhlcsValidator from ._mesh3d import Mesh3dsValidator +from ._isosurface import IsosurfacesValidator from ._histogram import HistogramsValidator from ._histogram2d import Histogram2dsValidator from ._histogram2dcontour import Histogram2dContoursValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/template/data/_isosurface.py plotly-3.6.1+dfsg1/plotly/validators/layout/template/data/_isosurface.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/template/data/_isosurface.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/template/data/_isosurface.py 2019-02-08 22:55:29.000000000 +0000 @@ -0,0 +1,21 @@ +import _plotly_utils.basevalidators + + +class IsosurfacesValidator( + _plotly_utils.basevalidators.CompoundArrayValidator +): + + def __init__( + self, + plotly_name='isosurface', + parent_name='layout.template.data', + **kwargs + ): + super(IsosurfacesValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Isosurface'), + data_docs=kwargs.pop('data_docs', """ +"""), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/template/_data.py plotly-3.6.1+dfsg1/plotly/validators/layout/template/_data.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/template/_data.py 2018-12-25 11:55:34.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/template/_data.py 2019-02-08 22:55:29.000000000 +0000 @@ -59,6 +59,9 @@ histogram plotly.graph_objs.layout.template.data.Histogra m instance or dict with compatible properties + isosurface + plotly.graph_objs.layout.template.data.Isosurfa + ce instance or dict with compatible properties mesh3d plotly.graph_objs.layout.template.data.Mesh3d instance or dict with compatible properties diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/ternary/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/layout/ternary/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/ternary/domain/_x.py 2018-12-25 11:55:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/ternary/domain/_x.py 2019-02-08 22:55:25.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/ternary/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/layout/ternary/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/ternary/domain/_y.py 2018-12-25 11:55:29.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/ternary/domain/_y.py 2019-02-08 22:55:24.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/transition/_duration.py plotly-3.6.1+dfsg1/plotly/validators/layout/transition/_duration.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/transition/_duration.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/transition/_duration.py 2019-02-08 22:55:23.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class DurationValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__( + self, + plotly_name='duration', + parent_name='layout.transition', + **kwargs + ): + super(DurationValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/transition/_easing.py plotly-3.6.1+dfsg1/plotly/validators/layout/transition/_easing.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/transition/_easing.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/transition/_easing.py 2019-02-08 22:55:23.000000000 +0000 @@ -0,0 +1,28 @@ +import _plotly_utils.basevalidators + + +class EasingValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, plotly_name='easing', parent_name='layout.transition', **kwargs + ): + super(EasingValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + values=kwargs.pop( + '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' + ] + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/transition/__init__.py plotly-3.6.1+dfsg1/plotly/validators/layout/transition/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/transition/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/transition/__init__.py 2019-02-08 23:01:15.000000000 +0000 @@ -0,0 +1,3 @@ +from ._ordering import OrderingValidator +from ._easing import EasingValidator +from ._duration import DurationValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/transition/_ordering.py plotly-3.6.1+dfsg1/plotly/validators/layout/transition/_ordering.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/transition/_ordering.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/transition/_ordering.py 2019-02-08 22:55:22.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class OrderingValidator(_plotly_utils.basevalidators.EnumeratedValidator): + + def __init__( + self, + plotly_name='ordering', + parent_name='layout.transition', + **kwargs + ): + super(OrderingValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + values=kwargs.pop('values', ['layout first', 'traces first']), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/_transition.py plotly-3.6.1+dfsg1/plotly/validators/layout/_transition.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/_transition.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/_transition.py 2019-02-08 22:55:22.000000000 +0000 @@ -0,0 +1,28 @@ +import _plotly_utils.basevalidators + + +class TransitionValidator(_plotly_utils.basevalidators.CompoundValidator): + + def __init__( + self, plotly_name='transition', parent_name='layout', **kwargs + ): + super(TransitionValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + data_class_str=kwargs.pop('data_class_str', 'Transition'), + data_docs=kwargs.pop( + 'data_docs', """ + duration + The duration of the transition, in + milliseconds. If equal to zero, updates are + synchronous. + easing + The easing function used for the transition + ordering + Determines whether the figure's layout or + traces smoothly transitions during updates that + make both traces and layout change. +""" + ), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/_domain.py plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/_domain.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/_domain.py 2018-12-25 11:55:26.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/_domain.py 2019-02-08 22:55:20.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/_range.py 2018-12-25 11:55:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/_range.py 2019-02-08 22:55:19.000000000 +0000 @@ -9,6 +9,7 @@ super(RangeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'axrange'), implied_edits=kwargs.pop('implied_edits', {'autorange': False}), items=kwargs.pop( @@ -18,13 +19,16 @@ 'editType': 'axrange', 'impliedEdits': { '^autorange': False - } - }, { + }, + 'anim': True + }, + { 'valType': 'any', 'editType': 'axrange', 'impliedEdits': { '^autorange': False - } + }, + 'anim': True } ] ), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/rangeslider/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/rangeslider/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/rangeslider/_range.py 2018-12-25 11:55:24.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/rangeslider/_range.py 2019-02-08 22:55:17.000000000 +0000 @@ -22,7 +22,8 @@ 'impliedEdits': { '^autorange': False } - }, { + }, + { 'valType': 'any', 'editType': 'calc', 'impliedEdits': { diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/_rangeslider.py plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/_rangeslider.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/xaxis/_rangeslider.py 2018-12-25 11:55:23.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/xaxis/_rangeslider.py 2019-02-08 22:55:17.000000000 +0000 @@ -22,7 +22,7 @@ bordercolor Sets the border color of the range slider. borderwidth - Sets the border color of the range slider. + Sets the border width of the range slider. range Sets the range of the range slider. If not set, defaults to the full xaxis range. If the axis diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/yaxis/_domain.py plotly-3.6.1+dfsg1/plotly/validators/layout/yaxis/_domain.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/yaxis/_domain.py 2018-12-25 11:55:20.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/yaxis/_domain.py 2019-02-08 22:55:14.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'plot' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/layout/yaxis/_range.py plotly-3.6.1+dfsg1/plotly/validators/layout/yaxis/_range.py --- plotly-3.5.0+dfsg1/plotly/validators/layout/yaxis/_range.py 2018-12-25 11:55:19.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/layout/yaxis/_range.py 2019-02-08 22:55:13.000000000 +0000 @@ -9,6 +9,7 @@ super(RangeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'axrange'), implied_edits=kwargs.pop('implied_edits', {'autorange': False}), items=kwargs.pop( @@ -18,13 +19,16 @@ 'editType': 'axrange', 'impliedEdits': { '^autorange': False - } - }, { + }, + 'anim': True + }, + { 'valType': 'any', 'editType': 'axrange', 'impliedEdits': { '^autorange': False - } + }, + 'anim': True } ] ), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_layout.py plotly-3.6.1+dfsg1/plotly/validators/_layout.py --- plotly-3.5.0+dfsg1/plotly/validators/_layout.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_layout.py 2019-02-08 22:55:10.000000000 +0000 @@ -54,10 +54,12 @@ multiplied by 100 to show percentages. boxgap Sets the gap (in plot fraction) between boxes - of adjacent location coordinates. + of adjacent location coordinates. Has no effect + on traces that have "width" set. boxgroupgap Sets the gap (in plot fraction) between boxes - of the same location coordinate. + of the same location coordinate. Has no effect + on traces that have "width" set. boxmode Determines how boxes at the same location coordinate are displayed on the graph. If @@ -65,7 +67,8 @@ another centered around the shared location. If "overlay", the boxes are plotted over one another, you might need to set "opacity" to see - them multiple boxes. + them multiple boxes. Has no effect on traces + that have "width" set. calendar Sets the default calendar system to use for interpreting and displaying dates throughout @@ -193,6 +196,17 @@ margin plotly.graph_objs.layout.Margin instance or dict with compatible properties + meta + Assigns extra meta information that can be used + in various `text` attributes. Attributes such + as the graph, axis and colorbar `title.text` + and annotation `text` support `meta`. One can + access `meta` fields using template strings: + `%{meta[i]}` where `i` is the index of the + `meta` item in question. + metasrc + Sets the source reference on plot.ly for meta + . modebar plotly.graph_objs.layout.Modebar instance or dict with compatible properties @@ -306,6 +320,9 @@ instead. Sets the title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. + transition + Sets transition options used during + Plotly.react updates. uirevision Used to allow user interactions with the plot to persist after `Plotly.react` calls that are @@ -339,10 +356,12 @@ elements of layout.updatemenus violingap Sets the gap (in plot fraction) between violins - of adjacent location coordinates. + of adjacent location coordinates. Has no effect + on traces that have "width" set. violingroupgap Sets the gap (in plot fraction) between violins - of the same location coordinate. + of the same location coordinate. Has no effect + on traces that have "width" set. violinmode Determines how violins at the same location coordinate are displayed on the graph. If @@ -350,7 +369,8 @@ another centered around the shared location. If "overlay", the violins are plotted over one another, you might need to set "opacity" to see - them multiple violins. + them multiple violins. Has no effect on traces + that have "width" set. width Sets the plot's width (in px). xaxis diff -Nru plotly-3.5.0+dfsg1/plotly/validators/mesh3d/_ids.py plotly-3.6.1+dfsg1/plotly/validators/mesh3d/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/mesh3d/_ids.py 2018-12-25 11:57:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/mesh3d/_ids.py 2019-02-08 22:58:05.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/mesh3d/_uid.py plotly-3.6.1+dfsg1/plotly/validators/mesh3d/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/mesh3d/_uid.py 2018-12-25 11:57:42.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/mesh3d/_uid.py 2019-02-08 22:58:05.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_mesh3d.py plotly-3.6.1+dfsg1/plotly/validators/_mesh3d.py --- plotly-3.5.0+dfsg1/plotly/validators/_mesh3d.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_mesh3d.py 2019-02-08 22:58:01.000000000 +0000 @@ -217,7 +217,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/decreasing/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/decreasing/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/decreasing/line/_color.py 2018-12-25 11:57:39.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/decreasing/line/_color.py 2019-02-08 22:58:01.000000000 +0000 @@ -12,6 +12,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/decreasing/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/decreasing/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/decreasing/line/_width.py 2018-12-25 11:57:39.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/decreasing/line/_width.py 2019-02-08 22:58:01.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/_ids.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/_ids.py 2018-12-25 11:57:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/_ids.py 2019-02-08 22:58:00.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/increasing/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/increasing/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/increasing/line/_color.py 2018-12-25 11:57:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/increasing/line/_color.py 2019-02-08 22:58:00.000000000 +0000 @@ -12,6 +12,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/increasing/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/increasing/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/increasing/line/_width.py 2018-12-25 11:57:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/increasing/line/_width.py 2019-02-08 22:58:00.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/line/_width.py 2018-12-25 11:57:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/line/_width.py 2019-02-08 22:58:00.000000000 +0000 @@ -7,6 +7,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/ohlc/_uid.py plotly-3.6.1+dfsg1/plotly/validators/ohlc/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/ohlc/_uid.py 2018-12-25 11:57:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/ohlc/_uid.py 2019-02-08 22:57:59.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_ohlc.py plotly-3.6.1+dfsg1/plotly/validators/_ohlc.py --- plotly-3.5.0+dfsg1/plotly/validators/_ohlc.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_ohlc.py 2019-02-08 22:57:58.000000000 +0000 @@ -103,7 +103,9 @@ Sets the width of the open/close tick marks relative to the "x" minimal interval. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcats/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/parcats/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/parcats/domain/_x.py 2018-12-25 11:57:36.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcats/domain/_x.py 2019-02-08 22:57:57.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcats/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/parcats/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/parcats/domain/_y.py 2018-12-25 11:57:36.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcats/domain/_y.py 2019-02-08 22:57:57.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcats/_uid.py plotly-3.6.1+dfsg1/plotly/validators/parcats/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/parcats/_uid.py 2018-12-25 11:57:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcats/_uid.py 2019-02-08 22:57:54.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_parcats.py plotly-3.6.1+dfsg1/plotly/validators/_parcats.py --- plotly-3.5.0+dfsg1/plotly/validators/_parcats.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_parcats.py 2019-02-08 22:57:54.000000000 +0000 @@ -71,7 +71,9 @@ tickfont Sets the font for the `category` labels. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcoords/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/parcoords/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/parcoords/domain/_x.py 2018-12-25 11:57:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcoords/domain/_x.py 2019-02-08 22:57:53.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcoords/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/parcoords/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/parcoords/domain/_y.py 2018-12-25 11:57:32.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcoords/domain/_y.py 2019-02-08 22:57:53.000000000 +0000 @@ -17,7 +17,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcoords/_ids.py plotly-3.6.1+dfsg1/plotly/validators/parcoords/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/parcoords/_ids.py 2018-12-25 11:57:32.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcoords/_ids.py 2019-02-08 22:57:52.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/parcoords/_uid.py plotly-3.6.1+dfsg1/plotly/validators/parcoords/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/parcoords/_uid.py 2018-12-25 11:57:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/parcoords/_uid.py 2019-02-08 22:57:49.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_parcoords.py plotly-3.6.1+dfsg1/plotly/validators/_parcoords.py --- plotly-3.5.0+dfsg1/plotly/validators/_parcoords.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_parcoords.py 2019-02-08 22:57:49.000000000 +0000 @@ -81,7 +81,9 @@ tickfont Sets the font for the `dimension` tick values. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pie/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/pie/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/pie/domain/_x.py 2018-12-25 11:57:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pie/domain/_x.py 2019-02-08 22:57:49.000000000 +0000 @@ -15,7 +15,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pie/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/pie/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/pie/domain/_y.py 2018-12-25 11:57:29.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pie/domain/_y.py 2019-02-08 22:57:49.000000000 +0000 @@ -15,7 +15,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pie/_ids.py plotly-3.6.1+dfsg1/plotly/validators/pie/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/pie/_ids.py 2018-12-25 11:57:28.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pie/_ids.py 2019-02-08 22:57:48.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pie/_uid.py plotly-3.6.1+dfsg1/plotly/validators/pie/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/pie/_uid.py 2018-12-25 11:57:27.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pie/_uid.py 2019-02-08 22:57:46.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_pie.py plotly-3.6.1+dfsg1/plotly/validators/_pie.py --- plotly-3.5.0+dfsg1/plotly/validators/_pie.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_pie.py 2019-02-08 22:57:46.000000000 +0000 @@ -185,7 +185,9 @@ by the now deprecated `titleposition` attribute. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_ids.py plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_ids.py 2018-12-25 11:57:27.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_ids.py 2019-02-08 22:57:46.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_uid.py plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_uid.py 2018-12-25 11:57:26.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_uid.py 2019-02-08 22:57:45.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_x.py plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_x.py 2018-12-25 11:57:26.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_x.py 2019-02-08 22:57:45.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_y.py plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/pointcloud/_y.py 2018-12-25 11:57:26.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/pointcloud/_y.py 2019-02-08 22:57:45.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_pointcloud.py plotly-3.6.1+dfsg1/plotly/validators/_pointcloud.py --- plotly-3.5.0+dfsg1/plotly/validators/_pointcloud.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_pointcloud.py 2019-02-08 22:57:45.000000000 +0000 @@ -92,7 +92,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/sankey/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/sankey/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/sankey/domain/_x.py 2018-12-25 11:57:26.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/sankey/domain/_x.py 2019-02-08 22:57:45.000000000 +0000 @@ -15,7 +15,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/sankey/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/sankey/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/sankey/domain/_y.py 2018-12-25 11:57:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/sankey/domain/_y.py 2019-02-08 22:57:44.000000000 +0000 @@ -15,7 +15,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/sankey/_ids.py plotly-3.6.1+dfsg1/plotly/validators/sankey/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/sankey/_ids.py 2018-12-25 11:57:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/sankey/_ids.py 2019-02-08 22:57:43.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/sankey/_uid.py plotly-3.6.1+dfsg1/plotly/validators/sankey/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/sankey/_uid.py 2018-12-25 11:57:23.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/sankey/_uid.py 2019-02-08 22:57:42.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_sankey.py plotly-3.6.1+dfsg1/plotly/validators/_sankey.py --- plotly-3.5.0+dfsg1/plotly/validators/_sankey.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_sankey.py 2019-02-08 22:57:42.000000000 +0000 @@ -83,7 +83,9 @@ textfont Sets the font for node labels uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_dx.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_dx.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_dx.py 2018-12-25 11:57:23.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_dx.py 2019-02-08 22:57:41.000000000 +0000 @@ -7,6 +7,7 @@ super(DxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_dy.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_dy.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_dy.py 2018-12-25 11:57:23.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_dy.py 2019-02-08 22:57:41.000000000 +0000 @@ -7,6 +7,7 @@ super(DyValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_fillcolor.py 2018-12-25 11:57:22.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_fillcolor.py 2019-02-08 22:57:40.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_ids.py 2018-12-25 11:57:22.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_ids.py 2019-02-08 22:57:39.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatter/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/line/_color.py 2018-12-25 11:57:22.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/line/_color.py 2019-02-08 22:57:39.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatter/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/line/_width.py 2018-12-25 11:57:21.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/line/_width.py 2019-02-08 22:57:39.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/_color.py 2018-12-25 11:57:21.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/_color.py 2019-02-08 22:57:38.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/line/_color.py 2018-12-25 11:57:20.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/line/_color.py 2019-02-08 22:57:36.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/line/_width.py 2018-12-25 11:57:19.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/line/_width.py 2019-02-08 22:57:36.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/_opacity.py 2018-12-25 11:57:19.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/_opacity.py 2019-02-08 22:57:36.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/marker/_size.py 2018-12-25 11:57:19.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/marker/_size.py 2019-02-08 22:57:36.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_uid.py 2018-12-25 11:57:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_uid.py 2019-02-08 22:57:33.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_x0.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_x0.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_x0.py 2018-12-25 11:57:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_x0.py 2019-02-08 22:57:33.000000000 +0000 @@ -7,6 +7,7 @@ super(X0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_x.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_x.py 2018-12-25 11:57:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_x.py 2019-02-08 22:57:33.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_y0.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_y0.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_y0.py 2018-12-25 11:57:16.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_y0.py 2019-02-08 22:57:31.000000000 +0000 @@ -7,6 +7,7 @@ super(Y0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter/_y.py plotly-3.6.1+dfsg1/plotly/validators/scatter/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter/_y.py 2018-12-25 11:57:16.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter/_y.py 2019-02-08 22:57:31.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_ids.py 2018-12-25 11:57:13.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_ids.py 2019-02-08 22:57:27.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/line/__init__.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/line/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/line/__init__.py 2018-12-25 12:00:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/line/__init__.py 2019-02-08 23:01:14.000000000 +0000 @@ -1,4 +1,5 @@ from ._width import WidthValidator +from ._showscale import ShowscaleValidator from ._reversescale import ReversescaleValidator from ._dash import DashValidator from ._colorsrc import ColorsrcValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/line/_showscale.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/line/_showscale.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/line/_showscale.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/line/_showscale.py 2019-02-08 22:57:27.000000000 +0000 @@ -0,0 +1,15 @@ +import _plotly_utils.basevalidators + + +class ShowscaleValidator(_plotly_utils.basevalidators.BooleanValidator): + + def __init__( + self, plotly_name='showscale', parent_name='scatter3d.line', **kwargs + ): + super(ShowscaleValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/line/_width.py 2018-12-25 11:57:13.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/line/_width.py 2019-02-08 22:57:27.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_line.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_line.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_line.py 2018-12-25 11:57:13.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_line.py 2019-02-08 22:57:27.000000000 +0000 @@ -73,6 +73,10 @@ numerical array. If true, `line.cmin` will correspond to the last color in the array and `line.cmax` will correspond to the first color. + showscale + Determines whether or not a colorbar is + displayed for this trace. Has an effect only if + in `line.color`is set to a numerical array. width Sets the line width (in px). """ diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/marker/line/_width.py 2018-12-25 11:57:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/marker/line/_width.py 2019-02-08 22:57:24.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/marker/_opacity.py 2018-12-25 11:57:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/marker/_opacity.py 2019-02-08 22:57:24.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'calc'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/marker/_size.py 2018-12-25 11:57:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/marker/_size.py 2019-02-08 22:57:24.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_uid.py 2018-12-25 11:57:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_uid.py 2019-02-08 22:57:23.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_x.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_x.py 2018-12-25 11:57:09.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_x.py 2019-02-08 22:57:23.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_y.py plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/scatter3d/_y.py 2018-12-25 11:57:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatter3d/_y.py 2019-02-08 22:57:21.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scatter3d.py plotly-3.6.1+dfsg1/plotly/validators/_scatter3d.py --- plotly-3.5.0+dfsg1/plotly/validators/_scatter3d.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scatter3d.py 2019-02-08 22:57:19.000000000 +0000 @@ -138,7 +138,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/_fillcolor.py 2018-12-25 11:57:06.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/_fillcolor.py 2019-02-08 22:57:19.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/_ids.py 2018-12-25 11:57:05.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/_ids.py 2019-02-08 22:57:18.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/line/_color.py 2018-12-25 11:57:05.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/line/_color.py 2019-02-08 22:57:18.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/line/_width.py 2018-12-25 11:57:05.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/line/_width.py 2019-02-08 22:57:18.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/marker/line/_width.py 2018-12-25 11:57:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/marker/line/_width.py 2019-02-08 22:57:15.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/marker/_opacity.py 2018-12-25 11:57:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/marker/_opacity.py 2019-02-08 22:57:15.000000000 +0000 @@ -12,6 +12,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/marker/_size.py 2018-12-25 11:57:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/marker/_size.py 2019-02-08 22:57:15.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scattercarpet/_uid.py 2018-12-25 11:57:01.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattercarpet/_uid.py 2019-02-08 22:57:12.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scattercarpet.py plotly-3.6.1+dfsg1/plotly/validators/_scattercarpet.py --- plotly-3.5.0+dfsg1/plotly/validators/_scattercarpet.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scattercarpet.py 2019-02-08 22:57:11.000000000 +0000 @@ -147,7 +147,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_fillcolor.py 2018-12-25 11:57:01.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_fillcolor.py 2019-02-08 22:57:11.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_hovertemplate.py 2019-02-08 22:57:11.000000000 +0000 @@ -0,0 +1,16 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, plotly_name='hovertemplate', parent_name='scattergeo', **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_hovertemplatesrc.py 2019-02-08 22:57:10.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='hovertemplatesrc', + parent_name='scattergeo', + **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_ids.py 2018-12-25 11:57:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_ids.py 2019-02-08 22:57:10.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/__init__.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -28,6 +28,8 @@ from ._ids import IdsValidator from ._hovertextsrc import HovertextsrcValidator from ._hovertext import HovertextValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator from ._hoverinfo import HoverinfoValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/line/_color.py 2018-12-25 11:57:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/line/_color.py 2019-02-08 22:57:10.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/line/_width.py 2018-12-25 11:57:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/line/_width.py 2019-02-08 22:57:10.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/marker/line/_width.py 2018-12-25 11:56:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/marker/line/_width.py 2019-02-08 22:57:07.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/marker/_opacity.py 2018-12-25 11:56:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/marker/_opacity.py 2019-02-08 22:57:07.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/marker/_size.py 2018-12-25 11:56:58.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/marker/_size.py 2019-02-08 22:57:07.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergeo/_uid.py 2018-12-25 11:56:56.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergeo/_uid.py 2019-02-08 22:57:04.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scattergeo.py plotly-3.6.1+dfsg1/plotly/validators/_scattergeo.py --- plotly-3.5.0+dfsg1/plotly/validators/_scattergeo.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scattergeo.py 2019-02-08 22:57:04.000000000 +0000 @@ -53,6 +53,28 @@ hoverlabel plotly.graph_objs.scattergeo.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . hovertext Sets hover text elements associated with each (lon,lat) pair or item in `locations`. If a @@ -156,7 +178,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_dx.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_dx.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_dx.py 2018-12-25 11:56:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_dx.py 2019-02-08 22:57:04.000000000 +0000 @@ -7,6 +7,7 @@ super(DxValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_dy.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_dy.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_dy.py 2018-12-25 11:56:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_dy.py 2019-02-08 22:57:04.000000000 +0000 @@ -7,6 +7,7 @@ super(DyValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_fillcolor.py 2018-12-25 11:56:54.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_fillcolor.py 2019-02-08 22:57:03.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_ids.py 2018-12-25 11:56:54.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_ids.py 2019-02-08 22:57:02.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/line/_color.py 2018-12-25 11:56:54.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/line/_color.py 2019-02-08 22:57:02.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/line/_width.py 2018-12-25 11:56:54.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/line/_width.py 2019-02-08 22:57:02.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/marker/line/_width.py 2018-12-25 11:56:52.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/marker/line/_width.py 2019-02-08 22:57:00.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/marker/_opacity.py 2018-12-25 11:56:52.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/marker/_opacity.py 2019-02-08 22:57:00.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/marker/_size.py 2018-12-25 11:56:52.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/marker/_size.py 2019-02-08 22:57:00.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_uid.py 2018-12-25 11:56:50.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_uid.py 2019-02-08 22:56:57.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_x0.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_x0.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_x0.py 2018-12-25 11:56:49.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_x0.py 2019-02-08 22:56:56.000000000 +0000 @@ -7,6 +7,7 @@ super(X0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_x.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_x.py 2018-12-25 11:56:49.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_x.py 2019-02-08 22:56:56.000000000 +0000 @@ -7,6 +7,7 @@ super(XValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_y0.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_y0.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_y0.py 2018-12-25 11:56:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_y0.py 2019-02-08 22:56:55.000000000 +0000 @@ -7,6 +7,7 @@ super(Y0Validator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattergl/_y.py plotly-3.6.1+dfsg1/plotly/validators/scattergl/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/scattergl/_y.py 2018-12-25 11:56:48.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattergl/_y.py 2019-02-08 22:56:55.000000000 +0000 @@ -7,6 +7,7 @@ super(YValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc+clearAxisTypes'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scattergl.py plotly-3.6.1+dfsg1/plotly/validators/_scattergl.py --- plotly-3.5.0+dfsg1/plotly/validators/_scattergl.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scattergl.py 2019-02-08 22:56:54.000000000 +0000 @@ -174,7 +174,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_fillcolor.py 2018-12-25 11:56:47.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_fillcolor.py 2019-02-08 22:56:54.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_hovertemplate.py 2019-02-08 22:56:53.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='hovertemplate', + parent_name='scattermapbox', + **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'calc'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_hovertemplatesrc.py 2019-02-08 22:56:53.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='hovertemplatesrc', + parent_name='scattermapbox', + **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_ids.py 2018-12-25 11:56:47.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_ids.py 2019-02-08 22:56:53.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/__init__.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -25,6 +25,8 @@ from ._ids import IdsValidator from ._hovertextsrc import HovertextsrcValidator from ._hovertext import HovertextValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator from ._hoverinfo import HoverinfoValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/line/_color.py 2018-12-25 11:56:47.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/line/_color.py 2019-02-08 22:56:53.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/line/_width.py 2018-12-25 11:56:47.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/line/_width.py 2019-02-08 22:56:53.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/marker/_opacity.py 2018-12-25 11:56:45.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/marker/_opacity.py 2019-02-08 22:56:51.000000000 +0000 @@ -12,6 +12,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/marker/_size.py 2018-12-25 11:56:45.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/marker/_size.py 2019-02-08 22:56:51.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scattermapbox/_uid.py 2018-12-25 11:56:44.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scattermapbox/_uid.py 2019-02-08 22:56:49.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scattermapbox.py plotly-3.6.1+dfsg1/plotly/validators/_scattermapbox.py --- plotly-3.5.0+dfsg1/plotly/validators/_scattermapbox.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scattermapbox.py 2019-02-08 22:56:49.000000000 +0000 @@ -46,6 +46,28 @@ hoverlabel plotly.graph_objs.scattermapbox.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . hovertext Sets hover text elements associated with each (lon,lat) pair If a single string, the same @@ -138,7 +160,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_fillcolor.py 2018-12-25 11:56:44.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_fillcolor.py 2019-02-08 22:56:49.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_hovertemplate.py 2019-02-08 22:56:49.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='hovertemplate', + parent_name='scatterpolar', + **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_hovertemplatesrc.py 2019-02-08 22:56:49.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='hovertemplatesrc', + parent_name='scatterpolar', + **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_ids.py 2018-12-25 11:56:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_ids.py 2019-02-08 22:56:48.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/__init__.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -29,6 +29,8 @@ from ._ids import IdsValidator from ._hovertextsrc import HovertextsrcValidator from ._hovertext import HovertextValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoveron import HoveronValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/line/_color.py 2018-12-25 11:56:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/line/_color.py 2019-02-08 22:56:48.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/line/_width.py 2018-12-25 11:56:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/line/_width.py 2019-02-08 22:56:48.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/_color.py 2018-12-25 11:56:43.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/_color.py 2019-02-08 22:56:48.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/line/_color.py 2018-12-25 11:56:41.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/line/_color.py 2019-02-08 22:56:45.000000000 +0000 @@ -12,6 +12,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/line/_width.py 2018-12-25 11:56:41.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/line/_width.py 2019-02-08 22:56:45.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/_opacity.py 2018-12-25 11:56:41.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/_opacity.py 2019-02-08 22:56:45.000000000 +0000 @@ -12,6 +12,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/marker/_size.py 2018-12-25 11:56:41.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/marker/_size.py 2019-02-08 22:56:45.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolar/_uid.py 2018-12-25 11:56:39.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolar/_uid.py 2019-02-08 22:56:42.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_fillcolor.py 2018-12-25 11:56:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_fillcolor.py 2019-02-08 22:56:42.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_hovertemplate.py 2019-02-08 22:56:41.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='hovertemplate', + parent_name='scatterpolargl', + **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_hovertemplatesrc.py 2019-02-08 22:56:41.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='hovertemplatesrc', + parent_name='scatterpolargl', + **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_ids.py 2018-12-25 11:56:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_ids.py 2019-02-08 22:56:41.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/__init__.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -29,6 +29,8 @@ from ._ids import IdsValidator from ._hovertextsrc import HovertextsrcValidator from ._hovertext import HovertextValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator from ._hoverinfo import HoverinfoValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/line/_color.py 2018-12-25 11:56:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/line/_color.py 2019-02-08 22:56:41.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/line/_width.py 2018-12-25 11:56:38.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/line/_width.py 2019-02-08 22:56:41.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/marker/line/_width.py 2018-12-25 11:56:36.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/marker/line/_width.py 2019-02-08 22:56:38.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/marker/_opacity.py 2018-12-25 11:56:36.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/marker/_opacity.py 2019-02-08 22:56:38.000000000 +0000 @@ -12,6 +12,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/marker/_size.py 2018-12-25 11:56:36.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/marker/_size.py 2019-02-08 22:56:38.000000000 +0000 @@ -12,6 +12,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterpolargl/_uid.py 2018-12-25 11:56:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterpolargl/_uid.py 2019-02-08 22:56:35.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scatterpolargl.py plotly-3.6.1+dfsg1/plotly/validators/_scatterpolargl.py --- plotly-3.5.0+dfsg1/plotly/validators/_scatterpolargl.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scatterpolargl.py 2019-02-08 22:56:35.000000000 +0000 @@ -72,6 +72,28 @@ hoverlabel plotly.graph_objs.scatterpolargl.Hoverlabel instance or dict with compatible properties + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string @@ -178,7 +200,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scatterpolar.py plotly-3.6.1+dfsg1/plotly/validators/_scatterpolar.py --- plotly-3.5.0+dfsg1/plotly/validators/_scatterpolar.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scatterpolar.py 2019-02-08 22:56:42.000000000 +0000 @@ -71,6 +71,28 @@ "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . hovertext Sets hover text elements associated with each (x,y) pair. If a single string, the same string @@ -177,7 +199,9 @@ Sets the unit of input "theta" values. Has an effect only when on "linear" angular axes. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scatter.py plotly-3.6.1+dfsg1/plotly/validators/_scatter.py --- plotly-3.5.0+dfsg1/plotly/validators/_scatter.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scatter.py 2019-02-08 22:57:30.000000000 +0000 @@ -258,7 +258,9 @@ tsrc Sets the source reference on plot.ly for t . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_fillcolor.py 2018-12-25 11:56:33.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_fillcolor.py 2019-02-08 22:56:34.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_hovertemplate.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_hovertemplate.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_hovertemplate.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_hovertemplate.py 2019-02-08 22:56:34.000000000 +0000 @@ -0,0 +1,19 @@ +import _plotly_utils.basevalidators + + +class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): + + def __init__( + self, + plotly_name='hovertemplate', + parent_name='scatterternary', + **kwargs + ): + super(HovertemplateValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + array_ok=kwargs.pop('array_ok', True), + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_hovertemplatesrc.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_hovertemplatesrc.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_hovertemplatesrc.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_hovertemplatesrc.py 2019-02-08 22:56:34.000000000 +0000 @@ -0,0 +1,18 @@ +import _plotly_utils.basevalidators + + +class HovertemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator): + + def __init__( + self, + plotly_name='hovertemplatesrc', + parent_name='scatterternary', + **kwargs + ): + super(HovertemplatesrcValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'none'), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_ids.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_ids.py 2018-12-25 11:56:32.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_ids.py 2019-02-08 22:56:34.000000000 +0000 @@ -9,6 +9,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/__init__.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -23,6 +23,8 @@ from ._ids import IdsValidator from ._hovertextsrc import HovertextsrcValidator from ._hovertext import HovertextValidator +from ._hovertemplatesrc import HovertemplatesrcValidator +from ._hovertemplate import HovertemplateValidator from ._hoveron import HoveronValidator from ._hoverlabel import HoverlabelValidator from ._hoverinfosrc import HoverinfosrcValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/line/_color.py 2018-12-25 11:56:32.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/line/_color.py 2019-02-08 22:56:34.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/line/_width.py 2018-12-25 11:56:32.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/line/_width.py 2019-02-08 22:56:33.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/marker/line/_width.py 2018-12-25 11:56:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/marker/line/_width.py 2019-02-08 22:56:31.000000000 +0000 @@ -12,6 +12,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/marker/_opacity.py 2018-12-25 11:56:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/marker/_opacity.py 2019-02-08 22:56:30.000000000 +0000 @@ -12,6 +12,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/marker/_size.py 2018-12-25 11:56:30.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/marker/_size.py 2019-02-08 22:56:30.000000000 +0000 @@ -12,6 +12,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_uid.py plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/scatterternary/_uid.py 2018-12-25 11:56:28.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/scatterternary/_uid.py 2019-02-08 22:56:28.000000000 +0000 @@ -9,6 +9,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_scatterternary.py plotly-3.6.1+dfsg1/plotly/validators/_scatterternary.py --- plotly-3.5.0+dfsg1/plotly/validators/_scatterternary.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_scatterternary.py 2019-02-08 22:56:27.000000000 +0000 @@ -92,6 +92,28 @@ "toself" or "tonext" and there are no markers or text, then the default is "fills", otherwise it is "points". + hovertemplate + Template string used for rendering the + information that appear on hover box. Note that + this will override `hoverinfo`. Variables are + inserted using %{variable}, for example "y: + %{y}". Numbers are formatted using d3-format's + syntax %{variable:d3-format}, for example + "Price: %{y:$.2f}". See https://github.com/d3/d + 3-format/blob/master/README.md#locale_format + for details on the formatting syntax. The + variables available in `hovertemplate` are the + ones emitted as event data described at this + link https://plot.ly/javascript/plotlyjs- + events/#event-data. Additionally, every + attributes that can be specified per-point (the + ones that are `arrayOk: true`) are available. + Anything contained in tag `` is + displayed in the secondary box, for example + "{fullData.name}". + hovertemplatesrc + Sets the source reference on plot.ly for + hovertemplate . hovertext Sets hover text elements associated with each (a,b,c) point. If a single string, the same @@ -184,7 +206,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/splom/_ids.py plotly-3.6.1+dfsg1/plotly/validators/splom/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/splom/_ids.py 2018-12-25 11:56:27.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/splom/_ids.py 2019-02-08 22:56:27.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/splom/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/splom/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/splom/marker/line/_width.py 2018-12-25 11:56:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/splom/marker/line/_width.py 2019-02-08 22:56:24.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/splom/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/splom/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/splom/marker/_opacity.py 2018-12-25 11:56:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/splom/marker/_opacity.py 2019-02-08 22:56:24.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/splom/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/splom/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/splom/marker/_size.py 2018-12-25 11:56:25.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/splom/marker/_size.py 2019-02-08 22:56:24.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', True), edit_type=kwargs.pop('edit_type', 'markerSize'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/splom/_uid.py plotly-3.6.1+dfsg1/plotly/validators/splom/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/splom/_uid.py 2018-12-25 11:56:23.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/splom/_uid.py 2019-02-08 22:56:22.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_splom.py plotly-3.6.1+dfsg1/plotly/validators/_splom.py --- plotly-3.5.0+dfsg1/plotly/validators/_splom.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_splom.py 2019-02-08 22:56:22.000000000 +0000 @@ -96,7 +96,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/streamtube/_ids.py plotly-3.6.1+dfsg1/plotly/validators/streamtube/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/streamtube/_ids.py 2018-12-25 11:56:21.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/streamtube/_ids.py 2019-02-08 22:56:18.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/streamtube/_uid.py plotly-3.6.1+dfsg1/plotly/validators/streamtube/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/streamtube/_uid.py 2018-12-25 11:56:20.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/streamtube/_uid.py 2019-02-08 22:56:18.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_streamtube.py plotly-3.6.1+dfsg1/plotly/validators/_streamtube.py --- plotly-3.5.0+dfsg1/plotly/validators/_streamtube.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_streamtube.py 2019-02-08 22:56:18.000000000 +0000 @@ -142,7 +142,9 @@ u Sets the x components of the vector field. uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/surface/_ids.py plotly-3.6.1+dfsg1/plotly/validators/surface/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/surface/_ids.py 2018-12-25 11:56:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/surface/_ids.py 2019-02-08 22:56:14.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/surface/_uid.py plotly-3.6.1+dfsg1/plotly/validators/surface/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/surface/_uid.py 2018-12-25 11:56:17.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/surface/_uid.py 2019-02-08 22:56:13.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_surface.py plotly-3.6.1+dfsg1/plotly/validators/_surface.py --- plotly-3.5.0+dfsg1/plotly/validators/_surface.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_surface.py 2019-02-08 22:56:09.000000000 +0000 @@ -145,7 +145,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/table/cells/_fill.py plotly-3.6.1+dfsg1/plotly/validators/table/cells/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/table/cells/_fill.py 2018-12-25 11:56:13.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/table/cells/_fill.py 2019-02-08 23:44:06.000000000 +0000 @@ -14,7 +14,8 @@ 'data_docs', """ color Sets the cell fill color. It accepts either a - specific color or an array of colors. + specific color or an array of colors or a 2D + array of colors. colorsrc Sets the source reference on plot.ly for color . diff -Nru plotly-3.5.0+dfsg1/plotly/validators/table/domain/_x.py plotly-3.6.1+dfsg1/plotly/validators/table/domain/_x.py --- plotly-3.5.0+dfsg1/plotly/validators/table/domain/_x.py 2018-12-25 11:56:12.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/table/domain/_x.py 2019-02-08 22:56:09.000000000 +0000 @@ -15,7 +15,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/table/domain/_y.py plotly-3.6.1+dfsg1/plotly/validators/table/domain/_y.py --- plotly-3.5.0+dfsg1/plotly/validators/table/domain/_y.py 2018-12-25 11:56:12.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/table/domain/_y.py 2019-02-08 22:56:08.000000000 +0000 @@ -15,7 +15,8 @@ 'min': 0, 'max': 1, 'editType': 'calc' - }, { + }, + { 'valType': 'number', 'min': 0, 'max': 1, diff -Nru plotly-3.5.0+dfsg1/plotly/validators/table/header/_fill.py plotly-3.6.1+dfsg1/plotly/validators/table/header/_fill.py --- plotly-3.5.0+dfsg1/plotly/validators/table/header/_fill.py 2018-12-25 11:56:12.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/table/header/_fill.py 2019-02-08 23:44:06.000000000 +0000 @@ -14,7 +14,8 @@ 'data_docs', """ color Sets the cell fill color. It accepts either a - specific color or an array of colors. + specific color or an array of colors or a 2D + array of colors. colorsrc Sets the source reference on plot.ly for color . diff -Nru plotly-3.5.0+dfsg1/plotly/validators/table/_ids.py plotly-3.6.1+dfsg1/plotly/validators/table/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/table/_ids.py 2018-12-25 11:56:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/table/_ids.py 2019-02-08 22:56:07.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/table/_uid.py plotly-3.6.1+dfsg1/plotly/validators/table/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/table/_uid.py 2018-12-25 11:56:11.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/table/_uid.py 2019-02-08 22:56:07.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_table.py plotly-3.6.1+dfsg1/plotly/validators/_table.py --- plotly-3.5.0+dfsg1/plotly/validators/_table.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_table.py 2019-02-08 22:56:07.000000000 +0000 @@ -88,7 +88,9 @@ plotly.graph_objs.table.Stream instance or dict with compatible properties uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/_fillcolor.py plotly-3.6.1+dfsg1/plotly/validators/violin/_fillcolor.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/_fillcolor.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/_fillcolor.py 2019-02-08 22:56:06.000000000 +0000 @@ -9,6 +9,7 @@ super(FillcolorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/_ids.py plotly-3.6.1+dfsg1/plotly/validators/violin/_ids.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/_ids.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/_ids.py 2019-02-08 22:56:06.000000000 +0000 @@ -7,6 +7,7 @@ super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'data'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/__init__.py plotly-3.6.1+dfsg1/plotly/validators/violin/__init__.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/__init__.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/__init__.py 2019-02-08 23:01:13.000000000 +0000 @@ -6,6 +6,7 @@ from ._xaxis import XAxisValidator from ._x0 import X0Validator from ._x import XValidator +from ._width import WidthValidator from ._visible import VisibleValidator from ._unselected import UnselectedValidator from ._uirevision import UirevisionValidator diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/marker/_color.py plotly-3.6.1+dfsg1/plotly/validators/violin/marker/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/marker/_color.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/marker/_color.py 2019-02-08 22:56:06.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/marker/line/_color.py plotly-3.6.1+dfsg1/plotly/validators/violin/marker/line/_color.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/marker/line/_color.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/marker/line/_color.py 2019-02-08 22:56:06.000000000 +0000 @@ -9,6 +9,7 @@ super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), role=kwargs.pop('role', 'style'), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/marker/line/_width.py plotly-3.6.1+dfsg1/plotly/validators/violin/marker/line/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/marker/line/_width.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/marker/line/_width.py 2019-02-08 22:56:06.000000000 +0000 @@ -9,6 +9,7 @@ super(WidthValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/marker/_opacity.py plotly-3.6.1+dfsg1/plotly/validators/violin/marker/_opacity.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/marker/_opacity.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/marker/_opacity.py 2019-02-08 22:56:06.000000000 +0000 @@ -9,6 +9,7 @@ super(OpacityValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'style'), max=kwargs.pop('max', 1), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/marker/_size.py plotly-3.6.1+dfsg1/plotly/validators/violin/marker/_size.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/marker/_size.py 2018-12-25 11:56:10.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/marker/_size.py 2019-02-08 22:56:06.000000000 +0000 @@ -9,6 +9,7 @@ super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), array_ok=kwargs.pop('array_ok', False), edit_type=kwargs.pop('edit_type', 'calc'), min=kwargs.pop('min', 0), diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/_side.py plotly-3.6.1+dfsg1/plotly/validators/violin/_side.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/_side.py 2018-12-25 11:56:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/_side.py 2019-02-08 22:56:04.000000000 +0000 @@ -7,7 +7,7 @@ super(SideValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, - edit_type=kwargs.pop('edit_type', 'plot'), + edit_type=kwargs.pop('edit_type', 'calc'), role=kwargs.pop('role', 'info'), values=kwargs.pop('values', ['both', 'positive', 'negative']), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/_uid.py plotly-3.6.1+dfsg1/plotly/validators/violin/_uid.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/_uid.py 2018-12-25 11:56:08.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/_uid.py 2019-02-08 22:56:03.000000000 +0000 @@ -7,6 +7,7 @@ super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, + anim=kwargs.pop('anim', True), edit_type=kwargs.pop('edit_type', 'plot'), role=kwargs.pop('role', 'info'), **kwargs diff -Nru plotly-3.5.0+dfsg1/plotly/validators/violin/_width.py plotly-3.6.1+dfsg1/plotly/validators/violin/_width.py --- plotly-3.5.0+dfsg1/plotly/validators/violin/_width.py 1970-01-01 00:00:00.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/violin/_width.py 2019-02-08 22:56:03.000000000 +0000 @@ -0,0 +1,14 @@ +import _plotly_utils.basevalidators + + +class WidthValidator(_plotly_utils.basevalidators.NumberValidator): + + def __init__(self, plotly_name='width', parent_name='violin', **kwargs): + super(WidthValidator, self).__init__( + plotly_name=plotly_name, + parent_name=parent_name, + edit_type=kwargs.pop('edit_type', 'calc'), + min=kwargs.pop('min', 0), + role=kwargs.pop('role', 'info'), + **kwargs + ) diff -Nru plotly-3.5.0+dfsg1/plotly/validators/_violin.py plotly-3.6.1+dfsg1/plotly/validators/_violin.py --- plotly-3.5.0+dfsg1/plotly/validators/_violin.py 2018-12-27 11:35:03.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/validators/_violin.py 2019-02-08 22:56:03.000000000 +0000 @@ -166,7 +166,9 @@ Sets the source reference on plot.ly for text . uid - + Assign an id to this trace, Use this to provide + object constancy between traces during + animations and transitions. uirevision Controls persistence of some user-driven changes to the trace: `constraintrange` in @@ -197,6 +199,11 @@ visible. If "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible). + width + Sets the width of the violin in data + coordinates. If 0 (default value) the width is + automatically selected based on the positions + of other violin traces in the same subplot. x Sets the x sample data or coordinates. See overview for more info. diff -Nru plotly-3.5.0+dfsg1/plotly/version.py plotly-3.6.1+dfsg1/plotly/version.py --- plotly-3.5.0+dfsg1/plotly/version.py 2019-01-04 13:04:56.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly/version.py 2019-02-08 23:44:06.000000000 +0000 @@ -1,5 +1,5 @@ -__version__ = '3.5.0' -__frontend_version__ = '^0.6.0' +__version__ = '3.6.1' +__frontend_version__ = '^0.7.1' def stable_semver(): diff -Nru plotly-3.5.0+dfsg1/plotly.egg-info/PKG-INFO plotly-3.6.1+dfsg1/plotly.egg-info/PKG-INFO --- plotly-3.5.0+dfsg1/plotly.egg-info/PKG-INFO 2019-01-04 13:05:56.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly.egg-info/PKG-INFO 2019-02-08 23:45:44.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: plotly -Version: 3.5.0 +Version: 3.6.1 Summary: Python plotting library for collaborative, interactive, publication-quality graphs. Home-page: https://plot.ly/python/ Author: Chris P diff -Nru plotly-3.5.0+dfsg1/plotly.egg-info/SOURCES.txt plotly-3.6.1+dfsg1/plotly.egg-info/SOURCES.txt --- plotly-3.5.0+dfsg1/plotly.egg-info/SOURCES.txt 2019-01-04 13:05:57.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly.egg-info/SOURCES.txt 2019-02-08 23:45:45.000000000 +0000 @@ -63,6 +63,7 @@ plotly/figure_factory/_scatterplot.py plotly/figure_factory/_streamline.py plotly/figure_factory/_table.py +plotly/figure_factory/_ternary_contour.py plotly/figure_factory/_trisurf.py plotly/figure_factory/_violin.py plotly/figure_factory/utils.py @@ -86,6 +87,7 @@ plotly/graph_objs/_histogram.py plotly/graph_objs/_histogram2d.py plotly/graph_objs/_histogram2dcontour.py +plotly/graph_objs/_isosurface.py plotly/graph_objs/_layout.py plotly/graph_objs/_mesh3d.py plotly/graph_objs/_ohlc.py @@ -366,6 +368,33 @@ plotly/graph_objs/histogram2dcontour/contours/_labelfont.py plotly/graph_objs/histogram2dcontour/hoverlabel/__init__.py plotly/graph_objs/histogram2dcontour/hoverlabel/_font.py +plotly/graph_objs/isosurface/__init__.py +plotly/graph_objs/isosurface/_caps.py +plotly/graph_objs/isosurface/_colorbar.py +plotly/graph_objs/isosurface/_contour.py +plotly/graph_objs/isosurface/_hoverlabel.py +plotly/graph_objs/isosurface/_lighting.py +plotly/graph_objs/isosurface/_lightposition.py +plotly/graph_objs/isosurface/_slices.py +plotly/graph_objs/isosurface/_spaceframe.py +plotly/graph_objs/isosurface/_stream.py +plotly/graph_objs/isosurface/_surface.py +plotly/graph_objs/isosurface/caps/__init__.py +plotly/graph_objs/isosurface/caps/_x.py +plotly/graph_objs/isosurface/caps/_y.py +plotly/graph_objs/isosurface/caps/_z.py +plotly/graph_objs/isosurface/colorbar/__init__.py +plotly/graph_objs/isosurface/colorbar/_tickfont.py +plotly/graph_objs/isosurface/colorbar/_tickformatstop.py +plotly/graph_objs/isosurface/colorbar/_title.py +plotly/graph_objs/isosurface/colorbar/title/__init__.py +plotly/graph_objs/isosurface/colorbar/title/_font.py +plotly/graph_objs/isosurface/hoverlabel/__init__.py +plotly/graph_objs/isosurface/hoverlabel/_font.py +plotly/graph_objs/isosurface/slices/__init__.py +plotly/graph_objs/isosurface/slices/_x.py +plotly/graph_objs/isosurface/slices/_y.py +plotly/graph_objs/isosurface/slices/_z.py plotly/graph_objs/layout/__init__.py plotly/graph_objs/layout/_angularaxis.py plotly/graph_objs/layout/_annotation.py @@ -387,6 +416,7 @@ plotly/graph_objs/layout/_template.py plotly/graph_objs/layout/_ternary.py plotly/graph_objs/layout/_title.py +plotly/graph_objs/layout/_transition.py plotly/graph_objs/layout/_updatemenu.py plotly/graph_objs/layout/_xaxis.py plotly/graph_objs/layout/_yaxis.py @@ -497,6 +527,7 @@ plotly/graph_objs/layout/template/data/_histogram.py plotly/graph_objs/layout/template/data/_histogram2d.py plotly/graph_objs/layout/template/data/_histogram2dcontour.py +plotly/graph_objs/layout/template/data/_isosurface.py plotly/graph_objs/layout/template/data/_mesh3d.py plotly/graph_objs/layout/template/data/_ohlc.py plotly/graph_objs/layout/template/data/_parcats.py @@ -1065,6 +1096,7 @@ plotly/validators/_histogram.py plotly/validators/_histogram2d.py plotly/validators/_histogram2dcontour.py +plotly/validators/_isosurface.py plotly/validators/_layout.py plotly/validators/_mesh3d.py plotly/validators/_ohlc.py @@ -1375,6 +1407,8 @@ plotly/validators/barpolar/_hoverinfo.py plotly/validators/barpolar/_hoverinfosrc.py plotly/validators/barpolar/_hoverlabel.py +plotly/validators/barpolar/_hovertemplate.py +plotly/validators/barpolar/_hovertemplatesrc.py plotly/validators/barpolar/_ids.py plotly/validators/barpolar/_idssrc.py plotly/validators/barpolar/_legendgroup.py @@ -1555,6 +1589,7 @@ plotly/validators/box/_unselected.py plotly/validators/box/_visible.py plotly/validators/box/_whiskerwidth.py +plotly/validators/box/_width.py plotly/validators/box/_x.py plotly/validators/box/_x0.py plotly/validators/box/_xaxis.py @@ -1892,6 +1927,8 @@ plotly/validators/choropleth/_hoverinfo.py plotly/validators/choropleth/_hoverinfosrc.py plotly/validators/choropleth/_hoverlabel.py +plotly/validators/choropleth/_hovertemplate.py +plotly/validators/choropleth/_hovertemplatesrc.py plotly/validators/choropleth/_ids.py plotly/validators/choropleth/_idssrc.py plotly/validators/choropleth/_legendgroup.py @@ -3201,6 +3238,186 @@ plotly/validators/histogram2dcontour/ybins/_end.py plotly/validators/histogram2dcontour/ybins/_size.py plotly/validators/histogram2dcontour/ybins/_start.py +plotly/validators/isosurface/__init__.py +plotly/validators/isosurface/_autocolorscale.py +plotly/validators/isosurface/_caps.py +plotly/validators/isosurface/_cauto.py +plotly/validators/isosurface/_cmax.py +plotly/validators/isosurface/_cmin.py +plotly/validators/isosurface/_colorbar.py +plotly/validators/isosurface/_colorscale.py +plotly/validators/isosurface/_contour.py +plotly/validators/isosurface/_customdata.py +plotly/validators/isosurface/_customdatasrc.py +plotly/validators/isosurface/_flatshading.py +plotly/validators/isosurface/_hoverinfo.py +plotly/validators/isosurface/_hoverinfosrc.py +plotly/validators/isosurface/_hoverlabel.py +plotly/validators/isosurface/_ids.py +plotly/validators/isosurface/_idssrc.py +plotly/validators/isosurface/_isomax.py +plotly/validators/isosurface/_isomin.py +plotly/validators/isosurface/_legendgroup.py +plotly/validators/isosurface/_lighting.py +plotly/validators/isosurface/_lightposition.py +plotly/validators/isosurface/_name.py +plotly/validators/isosurface/_opacity.py +plotly/validators/isosurface/_reversescale.py +plotly/validators/isosurface/_scene.py +plotly/validators/isosurface/_selectedpoints.py +plotly/validators/isosurface/_showlegend.py +plotly/validators/isosurface/_showscale.py +plotly/validators/isosurface/_slices.py +plotly/validators/isosurface/_spaceframe.py +plotly/validators/isosurface/_stream.py +plotly/validators/isosurface/_surface.py +plotly/validators/isosurface/_text.py +plotly/validators/isosurface/_textsrc.py +plotly/validators/isosurface/_uid.py +plotly/validators/isosurface/_uirevision.py +plotly/validators/isosurface/_value.py +plotly/validators/isosurface/_valuesrc.py +plotly/validators/isosurface/_visible.py +plotly/validators/isosurface/_x.py +plotly/validators/isosurface/_xsrc.py +plotly/validators/isosurface/_y.py +plotly/validators/isosurface/_ysrc.py +plotly/validators/isosurface/_z.py +plotly/validators/isosurface/_zsrc.py +plotly/validators/isosurface/caps/__init__.py +plotly/validators/isosurface/caps/_x.py +plotly/validators/isosurface/caps/_y.py +plotly/validators/isosurface/caps/_z.py +plotly/validators/isosurface/caps/x/__init__.py +plotly/validators/isosurface/caps/x/_fill.py +plotly/validators/isosurface/caps/x/_show.py +plotly/validators/isosurface/caps/y/__init__.py +plotly/validators/isosurface/caps/y/_fill.py +plotly/validators/isosurface/caps/y/_show.py +plotly/validators/isosurface/caps/z/__init__.py +plotly/validators/isosurface/caps/z/_fill.py +plotly/validators/isosurface/caps/z/_show.py +plotly/validators/isosurface/colorbar/__init__.py +plotly/validators/isosurface/colorbar/_bgcolor.py +plotly/validators/isosurface/colorbar/_bordercolor.py +plotly/validators/isosurface/colorbar/_borderwidth.py +plotly/validators/isosurface/colorbar/_dtick.py +plotly/validators/isosurface/colorbar/_exponentformat.py +plotly/validators/isosurface/colorbar/_len.py +plotly/validators/isosurface/colorbar/_lenmode.py +plotly/validators/isosurface/colorbar/_nticks.py +plotly/validators/isosurface/colorbar/_outlinecolor.py +plotly/validators/isosurface/colorbar/_outlinewidth.py +plotly/validators/isosurface/colorbar/_separatethousands.py +plotly/validators/isosurface/colorbar/_showexponent.py +plotly/validators/isosurface/colorbar/_showticklabels.py +plotly/validators/isosurface/colorbar/_showtickprefix.py +plotly/validators/isosurface/colorbar/_showticksuffix.py +plotly/validators/isosurface/colorbar/_thickness.py +plotly/validators/isosurface/colorbar/_thicknessmode.py +plotly/validators/isosurface/colorbar/_tick0.py +plotly/validators/isosurface/colorbar/_tickangle.py +plotly/validators/isosurface/colorbar/_tickcolor.py +plotly/validators/isosurface/colorbar/_tickfont.py +plotly/validators/isosurface/colorbar/_tickformat.py +plotly/validators/isosurface/colorbar/_tickformatstopdefaults.py +plotly/validators/isosurface/colorbar/_tickformatstops.py +plotly/validators/isosurface/colorbar/_ticklen.py +plotly/validators/isosurface/colorbar/_tickmode.py +plotly/validators/isosurface/colorbar/_tickprefix.py +plotly/validators/isosurface/colorbar/_ticks.py +plotly/validators/isosurface/colorbar/_ticksuffix.py +plotly/validators/isosurface/colorbar/_ticktext.py +plotly/validators/isosurface/colorbar/_ticktextsrc.py +plotly/validators/isosurface/colorbar/_tickvals.py +plotly/validators/isosurface/colorbar/_tickvalssrc.py +plotly/validators/isosurface/colorbar/_tickwidth.py +plotly/validators/isosurface/colorbar/_title.py +plotly/validators/isosurface/colorbar/_x.py +plotly/validators/isosurface/colorbar/_xanchor.py +plotly/validators/isosurface/colorbar/_xpad.py +plotly/validators/isosurface/colorbar/_y.py +plotly/validators/isosurface/colorbar/_yanchor.py +plotly/validators/isosurface/colorbar/_ypad.py +plotly/validators/isosurface/colorbar/tickfont/__init__.py +plotly/validators/isosurface/colorbar/tickfont/_color.py +plotly/validators/isosurface/colorbar/tickfont/_family.py +plotly/validators/isosurface/colorbar/tickfont/_size.py +plotly/validators/isosurface/colorbar/tickformatstop/__init__.py +plotly/validators/isosurface/colorbar/tickformatstop/_dtickrange.py +plotly/validators/isosurface/colorbar/tickformatstop/_enabled.py +plotly/validators/isosurface/colorbar/tickformatstop/_name.py +plotly/validators/isosurface/colorbar/tickformatstop/_templateitemname.py +plotly/validators/isosurface/colorbar/tickformatstop/_value.py +plotly/validators/isosurface/colorbar/title/__init__.py +plotly/validators/isosurface/colorbar/title/_font.py +plotly/validators/isosurface/colorbar/title/_side.py +plotly/validators/isosurface/colorbar/title/_text.py +plotly/validators/isosurface/colorbar/title/font/__init__.py +plotly/validators/isosurface/colorbar/title/font/_color.py +plotly/validators/isosurface/colorbar/title/font/_family.py +plotly/validators/isosurface/colorbar/title/font/_size.py +plotly/validators/isosurface/contour/__init__.py +plotly/validators/isosurface/contour/_color.py +plotly/validators/isosurface/contour/_show.py +plotly/validators/isosurface/contour/_width.py +plotly/validators/isosurface/hoverlabel/__init__.py +plotly/validators/isosurface/hoverlabel/_bgcolor.py +plotly/validators/isosurface/hoverlabel/_bgcolorsrc.py +plotly/validators/isosurface/hoverlabel/_bordercolor.py +plotly/validators/isosurface/hoverlabel/_bordercolorsrc.py +plotly/validators/isosurface/hoverlabel/_font.py +plotly/validators/isosurface/hoverlabel/_namelength.py +plotly/validators/isosurface/hoverlabel/_namelengthsrc.py +plotly/validators/isosurface/hoverlabel/font/__init__.py +plotly/validators/isosurface/hoverlabel/font/_color.py +plotly/validators/isosurface/hoverlabel/font/_colorsrc.py +plotly/validators/isosurface/hoverlabel/font/_family.py +plotly/validators/isosurface/hoverlabel/font/_familysrc.py +plotly/validators/isosurface/hoverlabel/font/_size.py +plotly/validators/isosurface/hoverlabel/font/_sizesrc.py +plotly/validators/isosurface/lighting/__init__.py +plotly/validators/isosurface/lighting/_ambient.py +plotly/validators/isosurface/lighting/_diffuse.py +plotly/validators/isosurface/lighting/_facenormalsepsilon.py +plotly/validators/isosurface/lighting/_fresnel.py +plotly/validators/isosurface/lighting/_roughness.py +plotly/validators/isosurface/lighting/_specular.py +plotly/validators/isosurface/lighting/_vertexnormalsepsilon.py +plotly/validators/isosurface/lightposition/__init__.py +plotly/validators/isosurface/lightposition/_x.py +plotly/validators/isosurface/lightposition/_y.py +plotly/validators/isosurface/lightposition/_z.py +plotly/validators/isosurface/slices/__init__.py +plotly/validators/isosurface/slices/_x.py +plotly/validators/isosurface/slices/_y.py +plotly/validators/isosurface/slices/_z.py +plotly/validators/isosurface/slices/x/__init__.py +plotly/validators/isosurface/slices/x/_fill.py +plotly/validators/isosurface/slices/x/_locations.py +plotly/validators/isosurface/slices/x/_locationssrc.py +plotly/validators/isosurface/slices/x/_show.py +plotly/validators/isosurface/slices/y/__init__.py +plotly/validators/isosurface/slices/y/_fill.py +plotly/validators/isosurface/slices/y/_locations.py +plotly/validators/isosurface/slices/y/_locationssrc.py +plotly/validators/isosurface/slices/y/_show.py +plotly/validators/isosurface/slices/z/__init__.py +plotly/validators/isosurface/slices/z/_fill.py +plotly/validators/isosurface/slices/z/_locations.py +plotly/validators/isosurface/slices/z/_locationssrc.py +plotly/validators/isosurface/slices/z/_show.py +plotly/validators/isosurface/spaceframe/__init__.py +plotly/validators/isosurface/spaceframe/_fill.py +plotly/validators/isosurface/spaceframe/_show.py +plotly/validators/isosurface/stream/__init__.py +plotly/validators/isosurface/stream/_maxpoints.py +plotly/validators/isosurface/stream/_token.py +plotly/validators/isosurface/surface/__init__.py +plotly/validators/isosurface/surface/_count.py +plotly/validators/isosurface/surface/_fill.py +plotly/validators/isosurface/surface/_pattern.py +plotly/validators/isosurface/surface/_show.py plotly/validators/layout/__init__.py plotly/validators/layout/_angularaxis.py plotly/validators/layout/_annotationdefaults.py @@ -3237,6 +3454,8 @@ plotly/validators/layout/_legend.py plotly/validators/layout/_mapbox.py plotly/validators/layout/_margin.py +plotly/validators/layout/_meta.py +plotly/validators/layout/_metasrc.py plotly/validators/layout/_modebar.py plotly/validators/layout/_orientation.py plotly/validators/layout/_paper_bgcolor.py @@ -3257,6 +3476,7 @@ plotly/validators/layout/_template.py plotly/validators/layout/_ternary.py plotly/validators/layout/_title.py +plotly/validators/layout/_transition.py plotly/validators/layout/_uirevision.py plotly/validators/layout/_updatemenudefaults.py plotly/validators/layout/_updatemenus.py @@ -4078,6 +4298,7 @@ plotly/validators/layout/template/data/_histogram.py plotly/validators/layout/template/data/_histogram2d.py plotly/validators/layout/template/data/_histogram2dcontour.py +plotly/validators/layout/template/data/_isosurface.py plotly/validators/layout/template/data/_mesh3d.py plotly/validators/layout/template/data/_ohlc.py plotly/validators/layout/template/data/_parcats.py @@ -4296,6 +4517,10 @@ plotly/validators/layout/title/pad/_l.py plotly/validators/layout/title/pad/_r.py plotly/validators/layout/title/pad/_t.py +plotly/validators/layout/transition/__init__.py +plotly/validators/layout/transition/_duration.py +plotly/validators/layout/transition/_easing.py +plotly/validators/layout/transition/_ordering.py plotly/validators/layout/updatemenu/__init__.py plotly/validators/layout/updatemenu/_active.py plotly/validators/layout/updatemenu/_bgcolor.py @@ -5658,6 +5883,7 @@ plotly/validators/scatter3d/line/_colorsrc.py plotly/validators/scatter3d/line/_dash.py plotly/validators/scatter3d/line/_reversescale.py +plotly/validators/scatter3d/line/_showscale.py plotly/validators/scatter3d/line/_width.py plotly/validators/scatter3d/marker/__init__.py plotly/validators/scatter3d/marker/_autocolorscale.py @@ -5970,6 +6196,8 @@ plotly/validators/scattergeo/_hoverinfo.py plotly/validators/scattergeo/_hoverinfosrc.py plotly/validators/scattergeo/_hoverlabel.py +plotly/validators/scattergeo/_hovertemplate.py +plotly/validators/scattergeo/_hovertemplatesrc.py plotly/validators/scattergeo/_hovertext.py plotly/validators/scattergeo/_hovertextsrc.py plotly/validators/scattergeo/_ids.py @@ -6373,6 +6601,8 @@ plotly/validators/scattermapbox/_hoverinfo.py plotly/validators/scattermapbox/_hoverinfosrc.py plotly/validators/scattermapbox/_hoverlabel.py +plotly/validators/scattermapbox/_hovertemplate.py +plotly/validators/scattermapbox/_hovertemplatesrc.py plotly/validators/scattermapbox/_hovertext.py plotly/validators/scattermapbox/_hovertextsrc.py plotly/validators/scattermapbox/_ids.py @@ -6530,6 +6760,8 @@ plotly/validators/scatterpolar/_hoverinfosrc.py plotly/validators/scatterpolar/_hoverlabel.py plotly/validators/scatterpolar/_hoveron.py +plotly/validators/scatterpolar/_hovertemplate.py +plotly/validators/scatterpolar/_hovertemplatesrc.py plotly/validators/scatterpolar/_hovertext.py plotly/validators/scatterpolar/_hovertextsrc.py plotly/validators/scatterpolar/_ids.py @@ -6720,6 +6952,8 @@ plotly/validators/scatterpolargl/_hoverinfo.py plotly/validators/scatterpolargl/_hoverinfosrc.py plotly/validators/scatterpolargl/_hoverlabel.py +plotly/validators/scatterpolargl/_hovertemplate.py +plotly/validators/scatterpolargl/_hovertemplatesrc.py plotly/validators/scatterpolargl/_hovertext.py plotly/validators/scatterpolargl/_hovertextsrc.py plotly/validators/scatterpolargl/_ids.py @@ -6908,6 +7142,8 @@ plotly/validators/scatterternary/_hoverinfosrc.py plotly/validators/scatterternary/_hoverlabel.py plotly/validators/scatterternary/_hoveron.py +plotly/validators/scatterternary/_hovertemplate.py +plotly/validators/scatterternary/_hovertemplatesrc.py plotly/validators/scatterternary/_hovertext.py plotly/validators/scatterternary/_hovertextsrc.py plotly/validators/scatterternary/_ids.py @@ -7703,6 +7939,7 @@ plotly/validators/violin/_uirevision.py plotly/validators/violin/_unselected.py plotly/validators/violin/_visible.py +plotly/validators/violin/_width.py plotly/validators/violin/_x.py plotly/validators/violin/_x0.py plotly/validators/violin/_xaxis.py diff -Nru plotly-3.5.0+dfsg1/plotly.egg-info/top_level.txt plotly-3.6.1+dfsg1/plotly.egg-info/top_level.txt --- plotly-3.5.0+dfsg1/plotly.egg-info/top_level.txt 2019-01-04 13:05:56.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotly.egg-info/top_level.txt 2019-02-08 23:45:44.000000000 +0000 @@ -82,6 +82,12 @@ plotly/graph_objs/histogram2dcontour/colorbar/title plotly/graph_objs/histogram2dcontour/contours plotly/graph_objs/histogram2dcontour/hoverlabel +plotly/graph_objs/isosurface +plotly/graph_objs/isosurface/caps +plotly/graph_objs/isosurface/colorbar +plotly/graph_objs/isosurface/colorbar/title +plotly/graph_objs/isosurface/hoverlabel +plotly/graph_objs/isosurface/slices plotly/graph_objs/layout plotly/graph_objs/layout/annotation plotly/graph_objs/layout/annotation/hoverlabel @@ -275,7 +281,6 @@ plotly/validators/bar/marker/colorbar/tickformatstop plotly/validators/bar/marker/colorbar/title plotly/validators/bar/marker/colorbar/title/font -plotly/validators/bar/marker/colorbar/titlefont plotly/validators/bar/marker/line plotly/validators/bar/outsidetextfont plotly/validators/bar/selected @@ -456,6 +461,28 @@ plotly/validators/histogram2dcontour/stream plotly/validators/histogram2dcontour/xbins plotly/validators/histogram2dcontour/ybins +plotly/validators/isosurface +plotly/validators/isosurface/caps +plotly/validators/isosurface/caps/x +plotly/validators/isosurface/caps/y +plotly/validators/isosurface/caps/z +plotly/validators/isosurface/colorbar +plotly/validators/isosurface/colorbar/tickfont +plotly/validators/isosurface/colorbar/tickformatstop +plotly/validators/isosurface/colorbar/title +plotly/validators/isosurface/colorbar/title/font +plotly/validators/isosurface/contour +plotly/validators/isosurface/hoverlabel +plotly/validators/isosurface/hoverlabel/font +plotly/validators/isosurface/lighting +plotly/validators/isosurface/lightposition +plotly/validators/isosurface/slices +plotly/validators/isosurface/slices/x +plotly/validators/isosurface/slices/y +plotly/validators/isosurface/slices/z +plotly/validators/isosurface/spaceframe +plotly/validators/isosurface/stream +plotly/validators/isosurface/surface plotly/validators/layout plotly/validators/layout/angularaxis plotly/validators/layout/annotation @@ -499,7 +526,6 @@ plotly/validators/layout/polar/radialaxis/tickformatstop plotly/validators/layout/polar/radialaxis/title plotly/validators/layout/polar/radialaxis/title/font -plotly/validators/layout/polar/radialaxis/titlefont plotly/validators/layout/radialaxis plotly/validators/layout/scene plotly/validators/layout/scene/annotation @@ -517,19 +543,16 @@ plotly/validators/layout/scene/xaxis/tickformatstop plotly/validators/layout/scene/xaxis/title plotly/validators/layout/scene/xaxis/title/font -plotly/validators/layout/scene/xaxis/titlefont plotly/validators/layout/scene/yaxis plotly/validators/layout/scene/yaxis/tickfont plotly/validators/layout/scene/yaxis/tickformatstop plotly/validators/layout/scene/yaxis/title plotly/validators/layout/scene/yaxis/title/font -plotly/validators/layout/scene/yaxis/titlefont plotly/validators/layout/scene/zaxis plotly/validators/layout/scene/zaxis/tickfont plotly/validators/layout/scene/zaxis/tickformatstop plotly/validators/layout/scene/zaxis/title plotly/validators/layout/scene/zaxis/title/font -plotly/validators/layout/scene/zaxis/titlefont plotly/validators/layout/shape plotly/validators/layout/shape/line plotly/validators/layout/slider @@ -547,24 +570,21 @@ plotly/validators/layout/ternary/aaxis/tickformatstop plotly/validators/layout/ternary/aaxis/title plotly/validators/layout/ternary/aaxis/title/font -plotly/validators/layout/ternary/aaxis/titlefont plotly/validators/layout/ternary/baxis plotly/validators/layout/ternary/baxis/tickfont plotly/validators/layout/ternary/baxis/tickformatstop plotly/validators/layout/ternary/baxis/title plotly/validators/layout/ternary/baxis/title/font -plotly/validators/layout/ternary/baxis/titlefont plotly/validators/layout/ternary/caxis plotly/validators/layout/ternary/caxis/tickfont plotly/validators/layout/ternary/caxis/tickformatstop plotly/validators/layout/ternary/caxis/title plotly/validators/layout/ternary/caxis/title/font -plotly/validators/layout/ternary/caxis/titlefont plotly/validators/layout/ternary/domain plotly/validators/layout/title plotly/validators/layout/title/font plotly/validators/layout/title/pad -plotly/validators/layout/titlefont +plotly/validators/layout/transition plotly/validators/layout/updatemenu plotly/validators/layout/updatemenu/button plotly/validators/layout/updatemenu/font @@ -579,13 +599,11 @@ plotly/validators/layout/xaxis/tickformatstop plotly/validators/layout/xaxis/title plotly/validators/layout/xaxis/title/font -plotly/validators/layout/xaxis/titlefont plotly/validators/layout/yaxis plotly/validators/layout/yaxis/tickfont plotly/validators/layout/yaxis/tickformatstop plotly/validators/layout/yaxis/title plotly/validators/layout/yaxis/title/font -plotly/validators/layout/yaxis/titlefont plotly/validators/mesh3d plotly/validators/mesh3d/colorbar plotly/validators/mesh3d/colorbar/tickfont diff -Nru plotly-3.5.0+dfsg1/_plotly_utils/basevalidators.py plotly-3.6.1+dfsg1/_plotly_utils/basevalidators.py --- plotly-3.5.0+dfsg1/_plotly_utils/basevalidators.py 2018-12-29 11:33:07.000000000 +0000 +++ plotly-3.6.1+dfsg1/_plotly_utils/basevalidators.py 2019-02-08 22:52:55.000000000 +0000 @@ -43,12 +43,23 @@ # Utility functions # ----------------- def to_scalar_or_list(v): + # Handle the case where 'v' is a non-native scalar-like type, + # such as numpy.float32. Without this case, the object might be + # considered numpy-convertable and therefore promoted to a + # 0-dimensional array, but we instead want it converted to a + # Python native scalar type ('float' in the example above). + # We explicitly check if is has the 'item' method, which conventionally + # converts these types to native scalars. + if np and np.isscalar(v) and hasattr(v, 'item'): + return v.item() if isinstance(v, (list, tuple)): return [to_scalar_or_list(e) for e in v] elif np and isinstance(v, np.ndarray): return [to_scalar_or_list(e) for e in v] elif pd and isinstance(v, (pd.Series, pd.Index)): return [to_scalar_or_list(e) for e in v] + elif is_numpy_convertable(v): + return to_scalar_or_list(np.array(v)) else: return v @@ -101,16 +112,19 @@ else: # DatetimeIndex v = v.to_pydatetime() - if not isinstance(v, np.ndarray): - # v is not homogenous array - v_list = [to_scalar_or_list(e) for e in v] + # v has its own logic on how to convert itself into a numpy array + if is_numpy_convertable(v): + return copy_to_readonly_numpy_array(np.array(v), kind=kind, force_numeric=force_numeric) + else: + # v is not homogenous array + v_list = [to_scalar_or_list(e) for e in v] - # Lookup dtype for requested kind, if any - dtype = kind_default_dtypes.get(first_kind, None) + # Lookup dtype for requested kind, if any + dtype = kind_default_dtypes.get(first_kind, None) - # construct new array from list - new_v = np.array(v_list, order='C', dtype=dtype) + # construct new array from list + new_v = np.array(v_list, order='C', dtype=dtype) elif v.dtype.kind in numeric_kinds: # v is a homogenous numeric array if kind and v.dtype.kind not in kind: @@ -148,12 +162,29 @@ return new_v +def is_numpy_convertable(v): + """ + Return whether a value is meaningfully convertable to a numpy array + via 'numpy.array' + """ + return hasattr(v, '__array__') or hasattr(v, '__array_interface__') + + def is_homogeneous_array(v): """ Return whether a value is considered to be a homogeneous array - """ - return ((np and isinstance(v, np.ndarray)) or - (pd and isinstance(v, (pd.Series, pd.Index)))) + """ + if ((np and isinstance(v, np.ndarray) or + (pd and isinstance(v, (pd.Series, pd.Index))))): + return True + if is_numpy_convertable(v): + v_numpy = np.array(v) + # v is essentially a scalar and so shouldn't count as an array + if v_numpy.shape == (): + return False + else: + return True + return False def is_simple_array(v): @@ -1097,13 +1128,12 @@ # Pass None through pass elif self.array_ok and is_homogeneous_array(v): - - v_array = copy_to_readonly_numpy_array(v) + v = copy_to_readonly_numpy_array(v) if (self.numbers_allowed() and - v_array.dtype.kind in ['u', 'i', 'f']): + v.dtype.kind in ['u', 'i', 'f']): # Numbers are allowed and we have an array of numbers. # All good - v = v_array + pass else: validated_v = [ self.validate_coerce(e, should_raise=False) diff -Nru plotly-3.5.0+dfsg1/plotlywidget/static/index.js plotly-3.6.1+dfsg1/plotlywidget/static/index.js --- plotly-3.5.0+dfsg1/plotlywidget/static/index.js 2019-01-04 13:05:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotlywidget/static/index.js 2019-02-08 23:45:43.000000000 +0000 @@ -100,7 +100,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -264,7 +264,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -304,7 +304,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -338,7 +338,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -349,7 +349,7 @@ /* eslint-disable no-console */ -var config = __webpack_require__(36); +var dfltConfig = __webpack_require__(36).dfltConfig; var loggers = module.exports = {}; @@ -360,7 +360,7 @@ */ loggers.log = function() { - if(config.logging > 1) { + if(dfltConfig.logging > 1) { var messages = ['LOG:']; for(var i = 0; i < arguments.length; i++) { @@ -372,7 +372,7 @@ }; loggers.warn = function() { - if(config.logging > 0) { + if(dfltConfig.logging > 0) { var messages = ['WARN:']; for(var i = 0; i < arguments.length; i++) { @@ -384,7 +384,7 @@ }; loggers.error = function() { - if(config.logging > 0) { + if(dfltConfig.logging > 0) { var messages = ['ERROR:']; for(var i = 0; i < arguments.length; i++) { @@ -9992,7 +9992,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -10062,7 +10062,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -10096,11 +10096,11 @@ throw 'bad property string'; } - var j = 0, - propParts = propStr.split('.'), - indexed, - indices, - i; + var j = 0; + var propParts = propStr.split('.'); + var indexed; + var indices; + var i; // check for parts of the nesting hierarchy that are numbers (ie array elements) while(j < propParts.length) { @@ -10139,12 +10139,12 @@ function npGet(cont, parts) { return function() { - var curCont = cont, - curPart, - allSame, - out, - i, - j; + var curCont = cont; + var curPart; + var allSame; + var out; + var i; + var j; for(i = 0; i < parts.length - 1; i++) { curPart = parts[i]; @@ -10195,12 +10195,12 @@ function npSet(cont, parts, propStr) { return function(val) { - var curCont = cont, - propPart = '', - containerLevels = [[cont, propPart]], - toDelete = isDeletable(val, propStr), - curPart, - i; + 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]; @@ -10259,13 +10259,13 @@ // handle special -1 array index function setArrayAll(containerArray, innerParts, val, propStr) { - var arrayVal = isArrayOrTypedArray(val), - allSet = true, - thisVal = val, - thisPropStr = propStr.replace('-1', 0), - deleteThis = arrayVal ? false : isDeletable(val, thisPropStr), - firstPart = innerParts[0], - i; + 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); @@ -10314,7 +10314,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -10375,8 +10375,8 @@ * */ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { - var target = inputs[0], - length = inputs.length; + var target = inputs[0]; + var length = inputs.length; var input, key, src, copy, copyIsArray, clone, allPrimitives; @@ -11664,7 +11664,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -11724,11 +11724,14 @@ uid: { valType: 'string', - editType: 'plot' + editType: 'plot', + anim: true, + }, ids: { valType: 'data_array', editType: 'calc', + anim: true, }, customdata: { @@ -11800,7 +11803,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -11870,7 +11873,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -12079,7 +12082,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -12114,7 +12117,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -12146,6 +12149,7 @@ exports.traceLayoutAttributes = {}; exports.localeRegistry = {}; exports.apiMethodRegistry = {}; +exports.collectableSubplotTypes = null; /** * Top-level register routine, exported as Plotly.register @@ -12187,6 +12191,8 @@ * */ exports.register = function register(_modules) { + exports.collectableSubplotTypes = null; + if(!_modules) { throw new Error('No argument passed to Plotly.register.'); } else if(_modules && !Array.isArray(_modules)) { @@ -12561,7 +12567,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -12582,7 +12588,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -12606,9 +12612,8 @@ */ module.exports = function pushUnique(array, item) { if(item instanceof RegExp) { - var itemStr = item.toString(), - i; - for(i = 0; i < array.length; i++) { + var itemStr = item.toString(); + for(var i = 0; i < array.length; i++) { if(array[i] instanceof RegExp && array[i].toString() === itemStr) { return array; } @@ -12627,7 +12632,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -12646,7 +12651,7 @@ /* 19 */ /***/ (function(module, exports) { -module.exports = {"name":"plotlywidget","version":"0.6.0","description":"The plotly.py ipywidgets library","author":"The plotly.py team","license":"MIT","main":"src/index.js","repository":{"type":"git","url":"https://github.com/plotly/plotly.py"},"keywords":["jupyter","widgets","ipython","ipywidgets","plotly"],"files":["src/**/*.js","dist/*.js"],"scripts":{"clean":"rimraf dist/ && rimraf ../plotlywidget/static","prepublish":"webpack","test":"echo \"Error: no test specified\" && exit 1"},"devDependencies":{"webpack":"^3.10.0","rimraf":"^2.6.1","ify-loader":"^1.1.0"},"dependencies":{"plotly.js":"1.43.1","@jupyter-widgets/base":"^1.0.0","lodash":"^4.17.4"},"jupyterlab":{"extension":"src/jupyterlab-plugin"}} +module.exports = {"name":"plotlywidget","version":"0.7.1","description":"The plotly.py ipywidgets library","author":"The plotly.py team","license":"MIT","main":"src/index.js","repository":{"type":"git","url":"https://github.com/plotly/plotly.py"},"keywords":["jupyter","widgets","ipython","ipywidgets","plotly"],"files":["src/**/*.js","dist/*.js"],"scripts":{"clean":"rimraf dist/ && rimraf ../plotlywidget/static","prepublish":"webpack","test":"echo \"Error: no test specified\" && exit 1"},"devDependencies":{"webpack":"^3.10.0","rimraf":"^2.6.1","ify-loader":"^1.1.0"},"dependencies":{"plotly.js":"1.44.3","@jupyter-widgets/base":"^1.0.0","lodash":"^4.17.4"},"jupyterlab":{"extension":"src/jupyterlab-plugin"}} /***/ }), /* 20 */ @@ -31610,8 +31615,8 @@ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var require;var require;/** -* plotly.js v1.43.1 -* Copyright 2012-2018, Plotly, Inc. +* plotly.js v1.44.3 +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ @@ -31650,6 +31655,7 @@ "X .cursor-ne-resize": "cursor:ne-resize;", "X .cursor-grab": "cursor:-webkit-grab;cursor:grab;", "X .modebar": "position:absolute;top:2px;right:2px;z-index:1001;", + "X .ease-bg": "-webkit-transition:background-color 0.3s ease 0s;-moz-transition:background-color 0.3s ease 0s;-ms-transition:background-color 0.3s ease 0s;-o-transition:background-color 0.3s ease 0s;transition:background-color 0.3s ease 0s;", "X .modebar--hover>:not(.watermark)": "opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;", "X:hover .modebar--hover .modebar-group": "opacity:1;", "X .modebar-group": "float:left;display:inline-block;box-sizing:border-box;margin-left:8px;position:relative;vertical-align:middle;white-space:nowrap;", @@ -31682,7 +31688,7 @@ Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":692}],2:[function(_dereq_,module,exports){ +},{"../src/lib":694}],2:[function(_dereq_,module,exports){ 'use strict'; module.exports = { @@ -31814,7 +31820,7 @@ },{}],3:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31825,9 +31831,9 @@ module.exports = _dereq_('../src/transforms/aggregate'); -},{"../src/transforms/aggregate":1152}],4:[function(_dereq_,module,exports){ +},{"../src/transforms/aggregate":1159}],4:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31838,9 +31844,9 @@ module.exports = _dereq_('../src/traces/bar'); -},{"../src/traces/bar":840}],5:[function(_dereq_,module,exports){ +},{"../src/traces/bar":842}],5:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31851,9 +31857,9 @@ module.exports = _dereq_('../src/traces/barpolar'); -},{"../src/traces/barpolar":852}],6:[function(_dereq_,module,exports){ +},{"../src/traces/barpolar":854}],6:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31864,9 +31870,9 @@ module.exports = _dereq_('../src/traces/box'); -},{"../src/traces/box":862}],7:[function(_dereq_,module,exports){ +},{"../src/traces/box":864}],7:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31877,9 +31883,9 @@ module.exports = _dereq_('../src/components/calendars'); -},{"../src/components/calendars":567}],8:[function(_dereq_,module,exports){ +},{"../src/components/calendars":569}],8:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31890,9 +31896,9 @@ module.exports = _dereq_('../src/traces/candlestick'); -},{"../src/traces/candlestick":871}],9:[function(_dereq_,module,exports){ +},{"../src/traces/candlestick":873}],9:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31903,9 +31909,9 @@ module.exports = _dereq_('../src/traces/carpet'); -},{"../src/traces/carpet":890}],10:[function(_dereq_,module,exports){ +},{"../src/traces/carpet":892}],10:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31916,9 +31922,9 @@ module.exports = _dereq_('../src/traces/choropleth'); -},{"../src/traces/choropleth":904}],11:[function(_dereq_,module,exports){ +},{"../src/traces/choropleth":906}],11:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31929,9 +31935,9 @@ module.exports = _dereq_('../src/traces/cone'); -},{"../src/traces/cone":912}],12:[function(_dereq_,module,exports){ +},{"../src/traces/cone":914}],12:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31942,9 +31948,9 @@ module.exports = _dereq_('../src/traces/contour'); -},{"../src/traces/contour":927}],13:[function(_dereq_,module,exports){ +},{"../src/traces/contour":929}],13:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31955,9 +31961,9 @@ module.exports = _dereq_('../src/traces/contourcarpet'); -},{"../src/traces/contourcarpet":938}],14:[function(_dereq_,module,exports){ +},{"../src/traces/contourcarpet":940}],14:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31968,9 +31974,9 @@ module.exports = _dereq_('../src/core'); -},{"../src/core":671}],15:[function(_dereq_,module,exports){ +},{"../src/core":673}],15:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31981,9 +31987,9 @@ module.exports = _dereq_('../src/transforms/filter'); -},{"../src/transforms/filter":1153}],16:[function(_dereq_,module,exports){ +},{"../src/transforms/filter":1160}],16:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -31994,9 +32000,9 @@ module.exports = _dereq_('../src/transforms/groupby'); -},{"../src/transforms/groupby":1154}],17:[function(_dereq_,module,exports){ +},{"../src/transforms/groupby":1161}],17:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32007,9 +32013,9 @@ module.exports = _dereq_('../src/traces/heatmap'); -},{"../src/traces/heatmap":950}],18:[function(_dereq_,module,exports){ +},{"../src/traces/heatmap":952}],18:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32020,9 +32026,9 @@ module.exports = _dereq_('../src/traces/heatmapgl'); -},{"../src/traces/heatmapgl":959}],19:[function(_dereq_,module,exports){ +},{"../src/traces/heatmapgl":961}],19:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32033,9 +32039,9 @@ module.exports = _dereq_('../src/traces/histogram'); -},{"../src/traces/histogram":971}],20:[function(_dereq_,module,exports){ +},{"../src/traces/histogram":973}],20:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32046,9 +32052,9 @@ module.exports = _dereq_('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":978}],21:[function(_dereq_,module,exports){ +},{"../src/traces/histogram2d":980}],21:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32059,9 +32065,9 @@ module.exports = _dereq_('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":982}],22:[function(_dereq_,module,exports){ +},{"../src/traces/histogram2dcontour":984}],22:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32087,6 +32093,7 @@ _dereq_('./scatter3d'), _dereq_('./surface'), + _dereq_('./isosurface'), _dereq_('./mesh3d'), _dereq_('./cone'), _dereq_('./streamtube'), @@ -32143,9 +32150,22 @@ module.exports = Plotly; -},{"./aggregate":3,"./bar":4,"./barpolar":5,"./box":6,"./calendars":7,"./candlestick":8,"./carpet":9,"./choropleth":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./filter":15,"./groupby":16,"./heatmap":17,"./heatmapgl":18,"./histogram":19,"./histogram2d":20,"./histogram2dcontour":21,"./mesh3d":23,"./ohlc":24,"./parcats":25,"./parcoords":26,"./pie":27,"./pointcloud":28,"./sankey":29,"./scatter3d":30,"./scattercarpet":31,"./scattergeo":32,"./scattergl":33,"./scattermapbox":34,"./scatterpolar":35,"./scatterpolargl":36,"./scatterternary":37,"./sort":38,"./splom":39,"./streamtube":40,"./surface":41,"./table":42,"./violin":43}],23:[function(_dereq_,module,exports){ +},{"./aggregate":3,"./bar":4,"./barpolar":5,"./box":6,"./calendars":7,"./candlestick":8,"./carpet":9,"./choropleth":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./filter":15,"./groupby":16,"./heatmap":17,"./heatmapgl":18,"./histogram":19,"./histogram2d":20,"./histogram2dcontour":21,"./isosurface":23,"./mesh3d":24,"./ohlc":25,"./parcats":26,"./parcoords":27,"./pie":28,"./pointcloud":29,"./sankey":30,"./scatter3d":31,"./scattercarpet":32,"./scattergeo":33,"./scattergl":34,"./scattermapbox":35,"./scatterpolar":36,"./scatterpolargl":37,"./scatterternary":38,"./sort":39,"./splom":40,"./streamtube":41,"./surface":42,"./table":43,"./violin":44}],23:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +module.exports = _dereq_('../src/traces/isosurface'); + +},{"../src/traces/isosurface":989}],24:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32156,9 +32176,9 @@ module.exports = _dereq_('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":987}],24:[function(_dereq_,module,exports){ +},{"../src/traces/mesh3d":994}],25:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32169,9 +32189,9 @@ module.exports = _dereq_('../src/traces/ohlc'); -},{"../src/traces/ohlc":992}],25:[function(_dereq_,module,exports){ +},{"../src/traces/ohlc":999}],26:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32182,9 +32202,9 @@ module.exports = _dereq_('../src/traces/parcats'); -},{"../src/traces/parcats":1001}],26:[function(_dereq_,module,exports){ +},{"../src/traces/parcats":1008}],27:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32195,9 +32215,9 @@ module.exports = _dereq_('../src/traces/parcoords'); -},{"../src/traces/parcoords":1010}],27:[function(_dereq_,module,exports){ +},{"../src/traces/parcoords":1017}],28:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32208,9 +32228,9 @@ module.exports = _dereq_('../src/traces/pie'); -},{"../src/traces/pie":1021}],28:[function(_dereq_,module,exports){ +},{"../src/traces/pie":1028}],29:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32221,9 +32241,9 @@ module.exports = _dereq_('../src/traces/pointcloud'); -},{"../src/traces/pointcloud":1030}],29:[function(_dereq_,module,exports){ +},{"../src/traces/pointcloud":1037}],30:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32234,9 +32254,9 @@ module.exports = _dereq_('../src/traces/sankey'); -},{"../src/traces/sankey":1036}],30:[function(_dereq_,module,exports){ +},{"../src/traces/sankey":1043}],31:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32247,9 +32267,9 @@ module.exports = _dereq_('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":1072}],31:[function(_dereq_,module,exports){ +},{"../src/traces/scatter3d":1079}],32:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32260,9 +32280,9 @@ module.exports = _dereq_('../src/traces/scattercarpet'); -},{"../src/traces/scattercarpet":1078}],32:[function(_dereq_,module,exports){ +},{"../src/traces/scattercarpet":1085}],33:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32273,9 +32293,9 @@ module.exports = _dereq_('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":1085}],33:[function(_dereq_,module,exports){ +},{"../src/traces/scattergeo":1092}],34:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32286,9 +32306,9 @@ module.exports = _dereq_('../src/traces/scattergl'); -},{"../src/traces/scattergl":1093}],34:[function(_dereq_,module,exports){ +},{"../src/traces/scattergl":1100}],35:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32299,9 +32319,9 @@ module.exports = _dereq_('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":1099}],35:[function(_dereq_,module,exports){ +},{"../src/traces/scattermapbox":1106}],36:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32312,9 +32332,9 @@ module.exports = _dereq_('../src/traces/scatterpolar'); -},{"../src/traces/scatterpolar":1106}],36:[function(_dereq_,module,exports){ +},{"../src/traces/scatterpolar":1113}],37:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32325,9 +32345,9 @@ module.exports = _dereq_('../src/traces/scatterpolargl'); -},{"../src/traces/scatterpolargl":1110}],37:[function(_dereq_,module,exports){ +},{"../src/traces/scatterpolargl":1117}],38:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32338,9 +32358,9 @@ module.exports = _dereq_('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":1116}],38:[function(_dereq_,module,exports){ +},{"../src/traces/scatterternary":1123}],39:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32351,9 +32371,9 @@ module.exports = _dereq_('../src/transforms/sort'); -},{"../src/transforms/sort":1156}],39:[function(_dereq_,module,exports){ +},{"../src/transforms/sort":1163}],40:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32364,9 +32384,9 @@ module.exports = _dereq_('../src/traces/splom'); -},{"../src/traces/splom":1121}],40:[function(_dereq_,module,exports){ +},{"../src/traces/splom":1128}],41:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32377,9 +32397,9 @@ module.exports = _dereq_('../src/traces/streamtube'); -},{"../src/traces/streamtube":1126}],41:[function(_dereq_,module,exports){ +},{"../src/traces/streamtube":1133}],42:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32390,9 +32410,9 @@ module.exports = _dereq_('../src/traces/surface'); -},{"../src/traces/surface":1131}],42:[function(_dereq_,module,exports){ +},{"../src/traces/surface":1138}],43:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32403,9 +32423,9 @@ module.exports = _dereq_('../src/traces/table'); -},{"../src/traces/table":1139}],43:[function(_dereq_,module,exports){ +},{"../src/traces/table":1146}],44:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -32416,7 +32436,7 @@ module.exports = _dereq_('../src/traces/violin'); -},{"../src/traces/violin":1147}],44:[function(_dereq_,module,exports){ +},{"../src/traces/violin":1154}],45:[function(_dereq_,module,exports){ 'use strict' module.exports = createCamera @@ -32654,7 +32674,7 @@ return camera } -},{"3d-view":45,"has-passive-events":394,"mouse-change":418,"mouse-event-offset":419,"mouse-wheel":421,"right-now":480}],45:[function(_dereq_,module,exports){ +},{"3d-view":46,"has-passive-events":397,"mouse-change":421,"mouse-event-offset":422,"mouse-wheel":424,"right-now":482}],46:[function(_dereq_,module,exports){ 'use strict' module.exports = createViewController @@ -32777,7 +32797,7 @@ matrix: matrix }, mode) } -},{"matrix-camera-controller":416,"orbit-camera-controller":439,"turntable-camera-controller":518}],46:[function(_dereq_,module,exports){ +},{"matrix-camera-controller":419,"orbit-camera-controller":442,"turntable-camera-controller":520}],47:[function(_dereq_,module,exports){ // https://github.com/d3/d3-sankey Version 0.5.1. Copyright 2018 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-array'), _dereq_('d3-collection'), _dereq_('d3-interpolate')) : @@ -33100,7 +33120,7 @@ }))); -},{"d3-array":140,"d3-collection":141,"d3-interpolate":145}],47:[function(_dereq_,module,exports){ +},{"d3-array":141,"d3-collection":142,"d3-interpolate":146}],48:[function(_dereq_,module,exports){ 'use strict' var weakMap = typeof WeakMap === 'undefined' ? _dereq_('weak-map') : WeakMap @@ -33131,7 +33151,7 @@ module.exports = createABigTriangle -},{"gl-buffer":230,"gl-vao":310,"weak-map":528}],48:[function(_dereq_,module,exports){ +},{"gl-buffer":231,"gl-vao":313,"weak-map":530}],49:[function(_dereq_,module,exports){ module.exports = absolutize @@ -33200,7 +33220,7 @@ }) } -},{}],49:[function(_dereq_,module,exports){ +},{}],50:[function(_dereq_,module,exports){ var padLeft = _dereq_('pad-left') module.exports = addLineNumbers @@ -33218,7 +33238,7 @@ }).join('\n') } -},{"pad-left":440}],50:[function(_dereq_,module,exports){ +},{"pad-left":443}],51:[function(_dereq_,module,exports){ 'use strict' module.exports = affineHull @@ -33270,7 +33290,7 @@ } return index } -},{"robust-orientation":486}],51:[function(_dereq_,module,exports){ +},{"robust-orientation":488}],52:[function(_dereq_,module,exports){ 'use strict' module.exports = alphaComplex @@ -33287,7 +33307,7 @@ return circumradius(simplex) * alpha < 1 }) } -},{"circumradius":102,"delaunay-triangulate":150}],52:[function(_dereq_,module,exports){ +},{"circumradius":103,"delaunay-triangulate":151}],53:[function(_dereq_,module,exports){ module.exports = alphaShape var ac = _dereq_('alpha-complex') @@ -33296,7 +33316,7 @@ function alphaShape(alpha, points) { return bnd(ac(alpha, points)) } -},{"alpha-complex":51,"simplicial-complex-boundary":493}],53:[function(_dereq_,module,exports){ +},{"alpha-complex":52,"simplicial-complex-boundary":495}],54:[function(_dereq_,module,exports){ 'use strict' module.exports = normalize; @@ -33324,7 +33344,7 @@ return bounds; } -},{}],54:[function(_dereq_,module,exports){ +},{}],55:[function(_dereq_,module,exports){ 'use strict' var getBounds = _dereq_('array-bounds') @@ -33366,7 +33386,7 @@ return arr; } -},{"array-bounds":53}],55:[function(_dereq_,module,exports){ +},{"array-bounds":54}],56:[function(_dereq_,module,exports){ module.exports = function newArray(start, end) { var n0 = typeof start === 'number', @@ -33391,7 +33411,7 @@ a[i] = c return a } -},{}],56:[function(_dereq_,module,exports){ +},{}],57:[function(_dereq_,module,exports){ (function (global){ 'use strict'; @@ -33885,7 +33905,7 @@ }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"util/":59}],57:[function(_dereq_,module,exports){ +},{"util/":60}],58:[function(_dereq_,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -33910,14 +33930,14 @@ } } -},{}],58:[function(_dereq_,module,exports){ +},{}],59:[function(_dereq_,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],59:[function(_dereq_,module,exports){ +},{}],60:[function(_dereq_,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -34507,12 +34527,12 @@ } }).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":58,"_process":465,"inherits":57}],60:[function(_dereq_,module,exports){ +},{"./support/isBuffer":59,"_process":468,"inherits":58}],61:[function(_dereq_,module,exports){ module.exports = function _atob(str) { return atob(str) } -},{}],61:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ 'use strict' module.exports = barycentric @@ -34560,7 +34580,7 @@ } return y } -},{"robust-linear-solve":485}],62:[function(_dereq_,module,exports){ +},{"robust-linear-solve":487}],63:[function(_dereq_,module,exports){ 'use strict' exports.byteLength = byteLength @@ -34713,7 +34733,7 @@ return parts.join('') } -},{}],63:[function(_dereq_,module,exports){ +},{}],64:[function(_dereq_,module,exports){ 'use strict' var rationalize = _dereq_('./lib/rationalize') @@ -34726,7 +34746,7 @@ a[1].mul(b[1])) } -},{"./lib/rationalize":73}],64:[function(_dereq_,module,exports){ +},{"./lib/rationalize":74}],65:[function(_dereq_,module,exports){ 'use strict' module.exports = cmp @@ -34735,7 +34755,7 @@ return a[0].mul(b[1]).cmp(b[0].mul(a[1])) } -},{}],65:[function(_dereq_,module,exports){ +},{}],66:[function(_dereq_,module,exports){ 'use strict' var rationalize = _dereq_('./lib/rationalize') @@ -34746,7 +34766,7 @@ return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) } -},{"./lib/rationalize":73}],66:[function(_dereq_,module,exports){ +},{"./lib/rationalize":74}],67:[function(_dereq_,module,exports){ 'use strict' var isRat = _dereq_('./is-rat') @@ -34808,7 +34828,7 @@ return rationalize(a, b) } -},{"./div":65,"./is-rat":67,"./lib/is-bn":71,"./lib/num-to-bn":72,"./lib/rationalize":73,"./lib/str-to-bn":74}],67:[function(_dereq_,module,exports){ +},{"./div":66,"./is-rat":68,"./lib/is-bn":72,"./lib/num-to-bn":73,"./lib/rationalize":74,"./lib/str-to-bn":75}],68:[function(_dereq_,module,exports){ 'use strict' var isBN = _dereq_('./lib/is-bn') @@ -34819,7 +34839,7 @@ return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) } -},{"./lib/is-bn":71}],68:[function(_dereq_,module,exports){ +},{"./lib/is-bn":72}],69:[function(_dereq_,module,exports){ 'use strict' var BN = _dereq_('bn.js') @@ -34830,7 +34850,7 @@ return x.cmp(new BN(0)) } -},{"bn.js":82}],69:[function(_dereq_,module,exports){ +},{"bn.js":83}],70:[function(_dereq_,module,exports){ 'use strict' var sign = _dereq_('./bn-sign') @@ -34855,7 +34875,7 @@ return sign(b) * out } -},{"./bn-sign":68}],70:[function(_dereq_,module,exports){ +},{"./bn-sign":69}],71:[function(_dereq_,module,exports){ 'use strict' var db = _dereq_('double-bits') @@ -34876,7 +34896,7 @@ return h + 32 } -},{"bit-twiddle":80,"double-bits":152}],71:[function(_dereq_,module,exports){ +},{"bit-twiddle":81,"double-bits":153}],72:[function(_dereq_,module,exports){ 'use strict' var BN = _dereq_('bn.js') @@ -34889,7 +34909,7 @@ return x && typeof x === 'object' && Boolean(x.words) } -},{"bn.js":82}],72:[function(_dereq_,module,exports){ +},{"bn.js":83}],73:[function(_dereq_,module,exports){ 'use strict' var BN = _dereq_('bn.js') @@ -34906,7 +34926,7 @@ } } -},{"bn.js":82,"double-bits":152}],73:[function(_dereq_,module,exports){ +},{"bn.js":83,"double-bits":153}],74:[function(_dereq_,module,exports){ 'use strict' var num2bn = _dereq_('./num-to-bn') @@ -34934,7 +34954,7 @@ return [ numer, denom ] } -},{"./bn-sign":68,"./num-to-bn":72}],74:[function(_dereq_,module,exports){ +},{"./bn-sign":69,"./num-to-bn":73}],75:[function(_dereq_,module,exports){ 'use strict' var BN = _dereq_('bn.js') @@ -34945,7 +34965,7 @@ return new BN(x) } -},{"bn.js":82}],75:[function(_dereq_,module,exports){ +},{"bn.js":83}],76:[function(_dereq_,module,exports){ 'use strict' var rationalize = _dereq_('./lib/rationalize') @@ -34956,7 +34976,7 @@ return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) } -},{"./lib/rationalize":73}],76:[function(_dereq_,module,exports){ +},{"./lib/rationalize":74}],77:[function(_dereq_,module,exports){ 'use strict' var bnsign = _dereq_('./lib/bn-sign') @@ -34967,7 +34987,7 @@ return bnsign(x[0]) * bnsign(x[1]) } -},{"./lib/bn-sign":68}],77:[function(_dereq_,module,exports){ +},{"./lib/bn-sign":69}],78:[function(_dereq_,module,exports){ 'use strict' var rationalize = _dereq_('./lib/rationalize') @@ -34978,7 +34998,7 @@ return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) } -},{"./lib/rationalize":73}],78:[function(_dereq_,module,exports){ +},{"./lib/rationalize":74}],79:[function(_dereq_,module,exports){ 'use strict' var bn2num = _dereq_('./lib/bn-to-num') @@ -35016,7 +35036,7 @@ } } -},{"./lib/bn-to-num":69,"./lib/ctz":70}],79:[function(_dereq_,module,exports){ +},{"./lib/bn-to-num":70,"./lib/ctz":71}],80:[function(_dereq_,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, useNdarray, earlyOut) { @@ -35078,7 +35098,7 @@ eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],80:[function(_dereq_,module,exports){ +},{}],81:[function(_dereq_,module,exports){ /** * Bit twiddling hacks for JavaScript. * @@ -35284,7 +35304,7 @@ } -},{}],81:[function(_dereq_,module,exports){ +},{}],82:[function(_dereq_,module,exports){ 'use strict' var clamp = _dereq_('clamp') @@ -35422,7 +35442,7 @@ } } -},{"clamp":103}],82:[function(_dereq_,module,exports){ +},{"clamp":104}],83:[function(_dereq_,module,exports){ (function (module, exports) { 'use strict'; @@ -38851,7 +38871,7 @@ }; })(typeof module === 'undefined' || module, this); -},{"buffer":91}],83:[function(_dereq_,module,exports){ +},{"buffer":92}],84:[function(_dereq_,module,exports){ 'use strict' module.exports = boundary @@ -38887,7 +38907,7 @@ return result } -},{}],84:[function(_dereq_,module,exports){ +},{}],85:[function(_dereq_,module,exports){ 'use strict' module.exports = boxIntersectWrapper @@ -39026,7 +39046,7 @@ throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":86,"./lib/sweep":90,"typedarray-pool":521}],85:[function(_dereq_,module,exports){ +},{"./lib/intersect":87,"./lib/sweep":91,"typedarray-pool":523}],86:[function(_dereq_,module,exports){ 'use strict' var DIMENSION = 'd' @@ -39171,7 +39191,7 @@ exports.partial = bruteForcePlanner(false) exports.full = bruteForcePlanner(true) -},{}],86:[function(_dereq_,module,exports){ +},{}],87:[function(_dereq_,module,exports){ 'use strict' module.exports = boxIntersectIter @@ -39666,7 +39686,7 @@ } } } -},{"./brute":85,"./median":87,"./partition":88,"./sweep":90,"bit-twiddle":80,"typedarray-pool":521}],87:[function(_dereq_,module,exports){ +},{"./brute":86,"./median":88,"./partition":89,"./sweep":91,"bit-twiddle":81,"typedarray-pool":523}],88:[function(_dereq_,module,exports){ 'use strict' module.exports = findMedian @@ -39809,7 +39829,7 @@ start, mid, boxes, ids, boxes[elemSize*mid+axis]) } -},{"./partition":88}],88:[function(_dereq_,module,exports){ +},{"./partition":89}],89:[function(_dereq_,module,exports){ 'use strict' module.exports = genPartition @@ -39830,7 +39850,7 @@ .replace('$', predicate)) return Function.apply(void 0, fargs) } -},{}],89:[function(_dereq_,module,exports){ +},{}],90:[function(_dereq_,module,exports){ 'use strict'; //This code is extracted from ndarray-sort @@ -40067,7 +40087,7 @@ quickSort(less, great, data); } } -},{}],90:[function(_dereq_,module,exports){ +},{}],91:[function(_dereq_,module,exports){ 'use strict' module.exports = { @@ -40502,9 +40522,9 @@ } } } -},{"./sort":89,"bit-twiddle":80,"typedarray-pool":521}],91:[function(_dereq_,module,exports){ +},{"./sort":90,"bit-twiddle":81,"typedarray-pool":523}],92:[function(_dereq_,module,exports){ -},{}],92:[function(_dereq_,module,exports){ +},{}],93:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -41029,7 +41049,7 @@ }; } -},{}],93:[function(_dereq_,module,exports){ +},{}],94:[function(_dereq_,module,exports){ /*! * The buffer module from node.js, for the browser. * @@ -42808,7 +42828,7 @@ return obj !== obj // eslint-disable-line no-self-compare } -},{"base64-js":62,"ieee754":395}],94:[function(_dereq_,module,exports){ +},{"base64-js":63,"ieee754":398}],95:[function(_dereq_,module,exports){ 'use strict' var monotoneTriangulate = _dereq_('./lib/monotone') @@ -42892,7 +42912,7 @@ } } -},{"./lib/delaunay":95,"./lib/filter":96,"./lib/monotone":97,"./lib/triangulation":98}],95:[function(_dereq_,module,exports){ +},{"./lib/delaunay":96,"./lib/filter":97,"./lib/monotone":98,"./lib/triangulation":99}],96:[function(_dereq_,module,exports){ 'use strict' var inCircle = _dereq_('robust-in-sphere')[4] @@ -43009,7 +43029,7 @@ } } -},{"binary-search-bounds":99,"robust-in-sphere":484}],96:[function(_dereq_,module,exports){ +},{"binary-search-bounds":100,"robust-in-sphere":486}],97:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -43191,7 +43211,7 @@ return result } -},{"binary-search-bounds":99}],97:[function(_dereq_,module,exports){ +},{"binary-search-bounds":100}],98:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -43380,7 +43400,7 @@ return cells } -},{"binary-search-bounds":99,"robust-orientation":486}],98:[function(_dereq_,module,exports){ +},{"binary-search-bounds":100,"robust-orientation":488}],99:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -43486,7 +43506,7 @@ return new Triangulation(stars, edges) } -},{"binary-search-bounds":99}],99:[function(_dereq_,module,exports){ +},{"binary-search-bounds":100}],100:[function(_dereq_,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, earlyOut) { @@ -43539,7 +43559,7 @@ eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],100:[function(_dereq_,module,exports){ +},{}],101:[function(_dereq_,module,exports){ 'use strict' module.exports = orientation @@ -43558,7 +43578,7 @@ return p } -},{}],101:[function(_dereq_,module,exports){ +},{}],102:[function(_dereq_,module,exports){ "use strict" var dup = _dereq_("dup") @@ -43627,7 +43647,7 @@ circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":155,"robust-linear-solve":485}],102:[function(_dereq_,module,exports){ +},{"dup":156,"robust-linear-solve":487}],103:[function(_dereq_,module,exports){ module.exports = circumradius var circumcenter = _dereq_('circumcenter') @@ -43643,7 +43663,7 @@ } return Math.sqrt(avgDist / points.length) } -},{"circumcenter":101}],103:[function(_dereq_,module,exports){ +},{"circumcenter":102}],104:[function(_dereq_,module,exports){ module.exports = clamp function clamp(value, min, max) { @@ -43652,7 +43672,7 @@ : (value < max ? max : value > min ? min : value) } -},{}],104:[function(_dereq_,module,exports){ +},{}],105:[function(_dereq_,module,exports){ 'use strict' module.exports = cleanPSLG @@ -44035,7 +44055,7 @@ return modified } -},{"./lib/rat-seg-intersect":105,"big-rat":66,"big-rat/cmp":64,"big-rat/to-float":78,"box-intersect":84,"nextafter":434,"rat-vec":469,"robust-segment-intersect":489,"union-find":522}],105:[function(_dereq_,module,exports){ +},{"./lib/rat-seg-intersect":106,"big-rat":67,"big-rat/cmp":65,"big-rat/to-float":79,"box-intersect":85,"nextafter":437,"rat-vec":472,"robust-segment-intersect":491,"union-find":524}],106:[function(_dereq_,module,exports){ 'use strict' module.exports = solveIntersection @@ -44079,7 +44099,7 @@ return r } -},{"big-rat/div":65,"big-rat/mul":75,"big-rat/sign":76,"big-rat/sub":77,"rat-vec/add":468,"rat-vec/muls":470,"rat-vec/sub":471}],106:[function(_dereq_,module,exports){ +},{"big-rat/div":66,"big-rat/mul":76,"big-rat/sign":77,"big-rat/sub":78,"rat-vec/add":471,"rat-vec/muls":473,"rat-vec/sub":474}],107:[function(_dereq_,module,exports){ /** @module color-id */ 'use strict' @@ -44128,7 +44148,7 @@ return [r/255, g/255, b/255, a/255] } -},{"clamp":103}],107:[function(_dereq_,module,exports){ +},{"clamp":104}],108:[function(_dereq_,module,exports){ 'use strict' module.exports = { @@ -44282,7 +44302,7 @@ "yellowgreen": [154, 205, 50] }; -},{}],108:[function(_dereq_,module,exports){ +},{}],109:[function(_dereq_,module,exports){ /** @module color-normalize */ 'use strict' @@ -44355,7 +44375,7 @@ return false } -},{"clamp":103,"color-rgba":110,"dtype":154}],109:[function(_dereq_,module,exports){ +},{"clamp":104,"color-rgba":111,"dtype":155}],110:[function(_dereq_,module,exports){ (function (global){ /** * @module color-parse @@ -44533,7 +44553,7 @@ } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"color-name":107,"defined":149,"is-plain-obj":405}],110:[function(_dereq_,module,exports){ +},{"color-name":108,"defined":150,"is-plain-obj":408}],111:[function(_dereq_,module,exports){ /** @module color-rgba */ 'use strict' @@ -44564,7 +44584,7 @@ return values } -},{"clamp":103,"color-parse":109,"color-space/hsl":111}],111:[function(_dereq_,module,exports){ +},{"clamp":104,"color-parse":110,"color-space/hsl":112}],112:[function(_dereq_,module,exports){ /** * @module color-space/hsl */ @@ -44673,7 +44693,7 @@ return [h, s * 100, l * 100]; }; -},{"./rgb":112}],112:[function(_dereq_,module,exports){ +},{"./rgb":113}],113:[function(_dereq_,module,exports){ /** * RGB space. * @@ -44689,7 +44709,7 @@ alias: ['RGB'] }; -},{}],113:[function(_dereq_,module,exports){ +},{}],114:[function(_dereq_,module,exports){ module.exports={ "jet":[{"index":0,"rgb":[0,0,131]},{"index":0.125,"rgb":[0,60,170]},{"index":0.375,"rgb":[5,255,255]},{"index":0.625,"rgb":[255,255,0]},{"index":0.875,"rgb":[250,0,0]},{"index":1,"rgb":[128,0,0]}], @@ -44782,7 +44802,7 @@ "cubehelix": [{"index":0,"rgb":[0,0,0]},{"index":0.07,"rgb":[22,5,59]},{"index":0.13,"rgb":[60,4,105]},{"index":0.2,"rgb":[109,1,135]},{"index":0.27,"rgb":[161,0,147]},{"index":0.33,"rgb":[210,2,142]},{"index":0.4,"rgb":[251,11,123]},{"index":0.47,"rgb":[255,29,97]},{"index":0.53,"rgb":[255,54,69]},{"index":0.6,"rgb":[255,85,46]},{"index":0.67,"rgb":[255,120,34]},{"index":0.73,"rgb":[255,157,37]},{"index":0.8,"rgb":[241,191,57]},{"index":0.87,"rgb":[224,220,93]},{"index":0.93,"rgb":[218,241,142]},{"index":1,"rgb":[227,253,198]}] }; -},{}],114:[function(_dereq_,module,exports){ +},{}],115:[function(_dereq_,module,exports){ /* * Ben Postlethwaite * January 2013 @@ -44931,7 +44951,7 @@ return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScale":113,"lerp":408}],115:[function(_dereq_,module,exports){ +},{"./colorScale":114,"lerp":411}],116:[function(_dereq_,module,exports){ "use strict" module.exports = compareAngle @@ -45017,7 +45037,7 @@ } } } -},{"robust-orientation":486,"robust-product":487,"robust-sum":491,"signum":492,"two-sum":520}],116:[function(_dereq_,module,exports){ +},{"robust-orientation":488,"robust-product":489,"robust-sum":493,"signum":494,"two-sum":522}],117:[function(_dereq_,module,exports){ module.exports = compareCells var min = Math.min @@ -45073,7 +45093,7 @@ } } -},{}],117:[function(_dereq_,module,exports){ +},{}],118:[function(_dereq_,module,exports){ 'use strict' var compareCells = _dereq_('compare-cell') @@ -45085,7 +45105,7 @@ return compareCells(a, b) || parity(a) - parity(b) } -},{"cell-orientation":100,"compare-cell":116}],118:[function(_dereq_,module,exports){ +},{"cell-orientation":101,"compare-cell":117}],119:[function(_dereq_,module,exports){ "use strict" var convexHull1d = _dereq_('./lib/ch1d') @@ -45111,7 +45131,7 @@ } return convexHullnd(points, d) } -},{"./lib/ch1d":119,"./lib/ch2d":120,"./lib/chnd":121}],119:[function(_dereq_,module,exports){ +},{"./lib/ch1d":120,"./lib/ch2d":121,"./lib/chnd":122}],120:[function(_dereq_,module,exports){ "use strict" module.exports = convexHull1d @@ -45135,7 +45155,7 @@ return [[lo]] } } -},{}],120:[function(_dereq_,module,exports){ +},{}],121:[function(_dereq_,module,exports){ 'use strict' module.exports = convexHull2D @@ -45158,7 +45178,7 @@ return edges } -},{"monotone-convex-hull-2d":417}],121:[function(_dereq_,module,exports){ +},{"monotone-convex-hull-2d":420}],122:[function(_dereq_,module,exports){ 'use strict' module.exports = convexHullnD @@ -45219,7 +45239,7 @@ return invPermute(nhull, ah) } } -},{"affine-hull":50,"incremental-convex-hull":396}],122:[function(_dereq_,module,exports){ +},{"affine-hull":51,"incremental-convex-hull":399}],123:[function(_dereq_,module,exports){ module.exports = { AFG: 'afghan', ALA: '\\b\\wland', @@ -45478,7 +45498,7 @@ ZWE: 'zimbabwe|^(?!.*northern).*rhodesia' } -},{}],123:[function(_dereq_,module,exports){ +},{}],124:[function(_dereq_,module,exports){ module.exports=[ "xx-small", "x-small", @@ -45491,7 +45511,7 @@ "smaller" ] -},{}],124:[function(_dereq_,module,exports){ +},{}],125:[function(_dereq_,module,exports){ module.exports=[ "normal", "condensed", @@ -45504,14 +45524,14 @@ "ultra-expanded" ] -},{}],125:[function(_dereq_,module,exports){ +},{}],126:[function(_dereq_,module,exports){ module.exports=[ "normal", "italic", "oblique" ] -},{}],126:[function(_dereq_,module,exports){ +},{}],127:[function(_dereq_,module,exports){ module.exports=[ "normal", "bold", @@ -45528,7 +45548,7 @@ "900" ] -},{}],127:[function(_dereq_,module,exports){ +},{}],128:[function(_dereq_,module,exports){ 'use strict' module.exports = { @@ -45536,7 +45556,7 @@ stringify: _dereq_('./stringify') } -},{"./parse":129,"./stringify":130}],128:[function(_dereq_,module,exports){ +},{"./parse":130,"./stringify":131}],129:[function(_dereq_,module,exports){ 'use strict' var sizes = _dereq_('css-font-size-keywords') @@ -45549,7 +45569,7 @@ } } -},{"css-font-size-keywords":123}],129:[function(_dereq_,module,exports){ +},{"css-font-size-keywords":124}],130:[function(_dereq_,module,exports){ 'use strict' var unquote = _dereq_('unquote') @@ -45658,7 +45678,7 @@ return value } -},{"./lib/util":128,"css-font-stretch-keywords":124,"css-font-style-keywords":125,"css-font-weight-keywords":126,"css-global-keywords":131,"css-system-font-keywords":132,"string-split-by":505,"unquote":524}],130:[function(_dereq_,module,exports){ +},{"./lib/util":129,"css-font-stretch-keywords":125,"css-font-style-keywords":126,"css-font-weight-keywords":127,"css-global-keywords":132,"css-system-font-keywords":133,"string-split-by":507,"unquote":526}],131:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -45762,14 +45782,14 @@ return o } -},{"./lib/util":128,"css-font-stretch-keywords":124,"css-font-style-keywords":125,"css-font-weight-keywords":126,"css-global-keywords":131,"css-system-font-keywords":132,"pick-by-alias":448}],131:[function(_dereq_,module,exports){ +},{"./lib/util":129,"css-font-stretch-keywords":125,"css-font-style-keywords":126,"css-font-weight-keywords":127,"css-global-keywords":132,"css-system-font-keywords":133,"pick-by-alias":451}],132:[function(_dereq_,module,exports){ module.exports=[ "inherit", "initial", "unset" ] -},{}],132:[function(_dereq_,module,exports){ +},{}],133:[function(_dereq_,module,exports){ module.exports=[ "caption", "icon", @@ -45779,7 +45799,7 @@ "status-bar" ] -},{}],133:[function(_dereq_,module,exports){ +},{}],134:[function(_dereq_,module,exports){ "use strict" function dcubicHermite(p0, v0, p1, v1, t, f) { @@ -45819,7 +45839,7 @@ module.exports = cubicHermite module.exports.derivative = dcubicHermite -},{}],134:[function(_dereq_,module,exports){ +},{}],135:[function(_dereq_,module,exports){ "use strict" var createThunk = _dereq_("./lib/thunk.js") @@ -45930,7 +45950,7 @@ module.exports = compileCwise -},{"./lib/thunk.js":136}],135:[function(_dereq_,module,exports){ +},{"./lib/thunk.js":137}],136:[function(_dereq_,module,exports){ "use strict" var uniq = _dereq_("uniq") @@ -46290,7 +46310,7 @@ } module.exports = generateCWiseOp -},{"uniq":523}],136:[function(_dereq_,module,exports){ +},{"uniq":525}],137:[function(_dereq_,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -46378,9 +46398,9 @@ module.exports = createThunk -},{"./compile.js":135}],137:[function(_dereq_,module,exports){ +},{"./compile.js":136}],138:[function(_dereq_,module,exports){ module.exports = _dereq_("cwise-compiler") -},{"cwise-compiler":134}],138:[function(_dereq_,module,exports){ +},{"cwise-compiler":135}],139:[function(_dereq_,module,exports){ 'use strict'; var copy = _dereq_('es5-ext/object/copy') @@ -46414,7 +46434,7 @@ return map(props, function (desc, name) { return define(name, desc, options); }); }; -},{"es5-ext/object/copy":174,"es5-ext/object/map":183,"es5-ext/object/normalize-options":184,"es5-ext/object/valid-callable":188,"es5-ext/object/valid-value":190}],139:[function(_dereq_,module,exports){ +},{"es5-ext/object/copy":175,"es5-ext/object/map":184,"es5-ext/object/normalize-options":185,"es5-ext/object/valid-callable":189,"es5-ext/object/valid-value":191}],140:[function(_dereq_,module,exports){ 'use strict'; var assign = _dereq_('es5-ext/object/assign') @@ -46479,7 +46499,7 @@ return !options ? desc : assign(normalizeOpts(options), desc); }; -},{"es5-ext/object/assign":171,"es5-ext/object/is-callable":177,"es5-ext/object/normalize-options":184,"es5-ext/string/#/contains":191}],140:[function(_dereq_,module,exports){ +},{"es5-ext/object/assign":172,"es5-ext/object/is-callable":178,"es5-ext/object/normalize-options":185,"es5-ext/string/#/contains":192}],141:[function(_dereq_,module,exports){ // https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -47071,7 +47091,7 @@ }))); -},{}],141:[function(_dereq_,module,exports){ +},{}],142:[function(_dereq_,module,exports){ // https://d3js.org/d3-collection/ Version 1.0.4. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -47290,7 +47310,7 @@ }))); -},{}],142:[function(_dereq_,module,exports){ +},{}],143:[function(_dereq_,module,exports){ // https://d3js.org/d3-color/ v1.2.3 Copyright 2018 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -47841,7 +47861,7 @@ }))); -},{}],143:[function(_dereq_,module,exports){ +},{}],144:[function(_dereq_,module,exports){ // https://d3js.org/d3-dispatch/ Version 1.0.3. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -47938,7 +47958,7 @@ }))); -},{}],144:[function(_dereq_,module,exports){ +},{}],145:[function(_dereq_,module,exports){ // https://d3js.org/d3-force/ Version 1.1.0. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-quadtree'), _dereq_('d3-collection'), _dereq_('d3-dispatch'), _dereq_('d3-timer')) : @@ -48600,7 +48620,7 @@ }))); -},{"d3-collection":141,"d3-dispatch":143,"d3-quadtree":146,"d3-timer":147}],145:[function(_dereq_,module,exports){ +},{"d3-collection":142,"d3-dispatch":144,"d3-quadtree":147,"d3-timer":148}],146:[function(_dereq_,module,exports){ // https://d3js.org/d3-interpolate/ v1.3.2 Copyright 2018 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-color')) : @@ -49174,7 +49194,7 @@ }))); -},{"d3-color":142}],146:[function(_dereq_,module,exports){ +},{"d3-color":143}],147:[function(_dereq_,module,exports){ // https://d3js.org/d3-quadtree/ Version 1.0.3. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -49611,7 +49631,7 @@ }))); -},{}],147:[function(_dereq_,module,exports){ +},{}],148:[function(_dereq_,module,exports){ // https://d3js.org/d3-timer/ Version 1.0.7. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -49762,7 +49782,7 @@ }))); -},{}],148:[function(_dereq_,module,exports){ +},{}],149:[function(_dereq_,module,exports){ !function() { var d3 = { version: "3.5.17" @@ -59317,14 +59337,14 @@ }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); -},{}],149:[function(_dereq_,module,exports){ +},{}],150:[function(_dereq_,module,exports){ module.exports = function () { for (var i = 0; i < arguments.length; i++) { if (arguments[i] !== undefined) return arguments[i]; } }; -},{}],150:[function(_dereq_,module,exports){ +},{}],151:[function(_dereq_,module,exports){ "use strict" var ch = _dereq_("incremental-convex-hull") @@ -59484,7 +59504,7 @@ return hull } -},{"incremental-convex-hull":396,"uniq":523}],151:[function(_dereq_,module,exports){ +},{"incremental-convex-hull":399,"uniq":525}],152:[function(_dereq_,module,exports){ 'use strict' @@ -59554,7 +59574,7 @@ return pairs } -},{}],152:[function(_dereq_,module,exports){ +},{}],153:[function(_dereq_,module,exports){ (function (Buffer){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { @@ -59658,7 +59678,7 @@ return !(hi & 0x7ff00000) } }).call(this,_dereq_("buffer").Buffer) -},{"buffer":93}],153:[function(_dereq_,module,exports){ +},{"buffer":94}],154:[function(_dereq_,module,exports){ var abs = _dereq_('abs-svg-path') var normalize = _dereq_('normalize-svg-path') @@ -59684,7 +59704,7 @@ context.closePath() } -},{"abs-svg-path":48,"normalize-svg-path":435}],154:[function(_dereq_,module,exports){ +},{"abs-svg-path":49,"normalize-svg-path":438}],155:[function(_dereq_,module,exports){ module.exports = function(dtype) { switch (dtype) { case 'int8': @@ -59710,7 +59730,7 @@ } } -},{}],155:[function(_dereq_,module,exports){ +},{}],156:[function(_dereq_,module,exports){ "use strict" function dupe_array(count, value, i) { @@ -59760,7 +59780,7 @@ } module.exports = dupe -},{}],156:[function(_dereq_,module,exports){ +},{}],157:[function(_dereq_,module,exports){ 'use strict'; module.exports = earcut; @@ -60412,7 +60432,7 @@ return result; }; -},{}],157:[function(_dereq_,module,exports){ +},{}],158:[function(_dereq_,module,exports){ "use strict" module.exports = edgeToAdjacency @@ -60446,7 +60466,7 @@ } return adj } -},{"uniq":523}],158:[function(_dereq_,module,exports){ +},{"uniq":525}],159:[function(_dereq_,module,exports){ // Inspired by Google Closure: // http://closure-library.googlecode.com/svn/docs/ // closure_goog_array_array.js.html#goog.array.clear @@ -60460,14 +60480,14 @@ return this; }; -},{"../../object/valid-value":190}],159:[function(_dereq_,module,exports){ +},{"../../object/valid-value":191}],160:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() ? Array.from : _dereq_("./shim"); -},{"./is-implemented":160,"./shim":161}],160:[function(_dereq_,module,exports){ +},{"./is-implemented":161,"./shim":162}],161:[function(_dereq_,module,exports){ "use strict"; module.exports = function () { @@ -60478,7 +60498,7 @@ return Boolean(result && (result !== arr) && (result[1] === "dwa")); }; -},{}],161:[function(_dereq_,module,exports){ +},{}],162:[function(_dereq_,module,exports){ "use strict"; var iteratorSymbol = _dereq_("es6-symbol").iterator @@ -60599,7 +60619,7 @@ return arr; }; -},{"../../function/is-arguments":162,"../../function/is-function":163,"../../number/to-pos-integer":169,"../../object/is-value":179,"../../object/valid-callable":188,"../../object/valid-value":190,"../../string/is-string":194,"es6-symbol":204}],162:[function(_dereq_,module,exports){ +},{"../../function/is-arguments":163,"../../function/is-function":164,"../../number/to-pos-integer":170,"../../object/is-value":180,"../../object/valid-callable":189,"../../object/valid-value":191,"../../string/is-string":195,"es6-symbol":205}],163:[function(_dereq_,module,exports){ "use strict"; var objToString = Object.prototype.toString @@ -60613,7 +60633,7 @@ return objToString.call(value) === id; }; -},{}],163:[function(_dereq_,module,exports){ +},{}],164:[function(_dereq_,module,exports){ "use strict"; var objToString = Object.prototype.toString, id = objToString.call(_dereq_("./noop")); @@ -60622,20 +60642,20 @@ return typeof value === "function" && objToString.call(value) === id; }; -},{"./noop":164}],164:[function(_dereq_,module,exports){ +},{"./noop":165}],165:[function(_dereq_,module,exports){ "use strict"; // eslint-disable-next-line no-empty-function module.exports = function () {}; -},{}],165:[function(_dereq_,module,exports){ +},{}],166:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() ? Math.sign : _dereq_("./shim"); -},{"./is-implemented":166,"./shim":167}],166:[function(_dereq_,module,exports){ +},{"./is-implemented":167,"./shim":168}],167:[function(_dereq_,module,exports){ "use strict"; module.exports = function () { @@ -60644,7 +60664,7 @@ return (sign(10) === 1) && (sign(-20) === -1); }; -},{}],167:[function(_dereq_,module,exports){ +},{}],168:[function(_dereq_,module,exports){ "use strict"; module.exports = function (value) { @@ -60653,7 +60673,7 @@ return value > 0 ? 1 : -1; }; -},{}],168:[function(_dereq_,module,exports){ +},{}],169:[function(_dereq_,module,exports){ "use strict"; var sign = _dereq_("../math/sign") @@ -60667,7 +60687,7 @@ return sign(value) * floor(abs(value)); }; -},{"../math/sign":165}],169:[function(_dereq_,module,exports){ +},{"../math/sign":166}],170:[function(_dereq_,module,exports){ "use strict"; var toInteger = _dereq_("./to-integer") @@ -60678,7 +60698,7 @@ return max(0, toInteger(value)); }; -},{"./to-integer":168}],170:[function(_dereq_,module,exports){ +},{"./to-integer":169}],171:[function(_dereq_,module,exports){ // Internal method, used by iteration functions. // Calls a function for each key-value pair found in object // Optionally takes compareFn to iterate object in specific order @@ -60710,14 +60730,14 @@ }; }; -},{"./valid-callable":188,"./valid-value":190}],171:[function(_dereq_,module,exports){ +},{"./valid-callable":189,"./valid-value":191}],172:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() ? Object.assign : _dereq_("./shim"); -},{"./is-implemented":172,"./shim":173}],172:[function(_dereq_,module,exports){ +},{"./is-implemented":173,"./shim":174}],173:[function(_dereq_,module,exports){ "use strict"; module.exports = function () { @@ -60728,7 +60748,7 @@ return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy"; }; -},{}],173:[function(_dereq_,module,exports){ +},{}],174:[function(_dereq_,module,exports){ "use strict"; var keys = _dereq_("../keys") @@ -60753,7 +60773,7 @@ return dest; }; -},{"../keys":180,"../valid-value":190}],174:[function(_dereq_,module,exports){ +},{"../keys":181,"../valid-value":191}],175:[function(_dereq_,module,exports){ "use strict"; var aFrom = _dereq_("../array/from") @@ -60774,7 +60794,7 @@ return result; }; -},{"../array/from":159,"./assign":171,"./valid-value":190}],175:[function(_dereq_,module,exports){ +},{"../array/from":160,"./assign":172,"./valid-value":191}],176:[function(_dereq_,module,exports){ // Workaround for http://code.google.com/p/v8/issues/detail?id=2804 "use strict"; @@ -60824,12 +60844,12 @@ }; }()); -},{"./set-prototype-of/is-implemented":186,"./set-prototype-of/shim":187}],176:[function(_dereq_,module,exports){ +},{"./set-prototype-of/is-implemented":187,"./set-prototype-of/shim":188}],177:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./_iterate")("forEach"); -},{"./_iterate":170}],177:[function(_dereq_,module,exports){ +},{"./_iterate":171}],178:[function(_dereq_,module,exports){ // Deprecated "use strict"; @@ -60838,7 +60858,7 @@ return typeof obj === "function"; }; -},{}],178:[function(_dereq_,module,exports){ +},{}],179:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("./is-value"); @@ -60849,7 +60869,7 @@ return (isValue(value) && map[typeof value]) || false; }; -},{"./is-value":179}],179:[function(_dereq_,module,exports){ +},{"./is-value":180}],180:[function(_dereq_,module,exports){ "use strict"; var _undefined = _dereq_("../function/noop")(); // Support ES3 engines @@ -60858,12 +60878,12 @@ return (val !== _undefined) && (val !== null); }; -},{"../function/noop":164}],180:[function(_dereq_,module,exports){ +},{"../function/noop":165}],181:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() ? Object.keys : _dereq_("./shim"); -},{"./is-implemented":181,"./shim":182}],181:[function(_dereq_,module,exports){ +},{"./is-implemented":182,"./shim":183}],182:[function(_dereq_,module,exports){ "use strict"; module.exports = function () { @@ -60875,7 +60895,7 @@ } }; -},{}],182:[function(_dereq_,module,exports){ +},{}],183:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../is-value"); @@ -60884,7 +60904,7 @@ module.exports = function (object) { return keys(isValue(object) ? Object(object) : object); }; -},{"../is-value":179}],183:[function(_dereq_,module,exports){ +},{"../is-value":180}],184:[function(_dereq_,module,exports){ "use strict"; var callable = _dereq_("./valid-callable") @@ -60900,7 +60920,7 @@ return result; }; -},{"./for-each":176,"./valid-callable":188}],184:[function(_dereq_,module,exports){ +},{"./for-each":177,"./valid-callable":189}],185:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("./is-value"); @@ -60922,14 +60942,14 @@ return result; }; -},{"./is-value":179}],185:[function(_dereq_,module,exports){ +},{"./is-value":180}],186:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() ? Object.setPrototypeOf : _dereq_("./shim"); -},{"./is-implemented":186,"./shim":187}],186:[function(_dereq_,module,exports){ +},{"./is-implemented":187,"./shim":188}],187:[function(_dereq_,module,exports){ "use strict"; var create = Object.create, getPrototypeOf = Object.getPrototypeOf, plainObject = {}; @@ -60940,7 +60960,7 @@ return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject; }; -},{}],187:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ /* eslint no-proto: "off" */ // Big thanks to @WebReflection for sorting this out @@ -61028,7 +61048,7 @@ _dereq_("../create"); -},{"../create":175,"../is-object":178,"../valid-value":190}],188:[function(_dereq_,module,exports){ +},{"../create":176,"../is-object":179,"../valid-value":191}],189:[function(_dereq_,module,exports){ "use strict"; module.exports = function (fn) { @@ -61036,7 +61056,7 @@ return fn; }; -},{}],189:[function(_dereq_,module,exports){ +},{}],190:[function(_dereq_,module,exports){ "use strict"; var isObject = _dereq_("./is-object"); @@ -61046,7 +61066,7 @@ return value; }; -},{"./is-object":178}],190:[function(_dereq_,module,exports){ +},{"./is-object":179}],191:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("./is-value"); @@ -61056,14 +61076,14 @@ return value; }; -},{"./is-value":179}],191:[function(_dereq_,module,exports){ +},{"./is-value":180}],192:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() ? String.prototype.contains : _dereq_("./shim"); -},{"./is-implemented":192,"./shim":193}],192:[function(_dereq_,module,exports){ +},{"./is-implemented":193,"./shim":194}],193:[function(_dereq_,module,exports){ "use strict"; var str = "razdwatrzy"; @@ -61073,7 +61093,7 @@ return (str.contains("dwa") === true) && (str.contains("foo") === false); }; -},{}],193:[function(_dereq_,module,exports){ +},{}],194:[function(_dereq_,module,exports){ "use strict"; var indexOf = String.prototype.indexOf; @@ -61082,7 +61102,7 @@ return indexOf.call(this, searchString, arguments[1]) > -1; }; -},{}],194:[function(_dereq_,module,exports){ +},{}],195:[function(_dereq_,module,exports){ "use strict"; var objToString = Object.prototype.toString, id = objToString.call(""); @@ -61097,7 +61117,7 @@ ); }; -},{}],195:[function(_dereq_,module,exports){ +},{}],196:[function(_dereq_,module,exports){ "use strict"; var generated = Object.create(null), random = Math.random; @@ -61112,7 +61132,7 @@ return str; }; -},{}],196:[function(_dereq_,module,exports){ +},{}],197:[function(_dereq_,module,exports){ "use strict"; var setPrototypeOf = _dereq_("es5-ext/object/set-prototype-of") @@ -61146,7 +61166,7 @@ }); defineProperty(ArrayIterator.prototype, Symbol.toStringTag, d("c", "Array Iterator")); -},{"./":199,"d":139,"es5-ext/object/set-prototype-of":185,"es5-ext/string/#/contains":191,"es6-symbol":204}],197:[function(_dereq_,module,exports){ +},{"./":200,"d":140,"es5-ext/object/set-prototype-of":186,"es5-ext/string/#/contains":192,"es6-symbol":205}],198:[function(_dereq_,module,exports){ "use strict"; var isArguments = _dereq_("es5-ext/function/is-arguments") @@ -61195,7 +61215,7 @@ } }; -},{"./get":198,"es5-ext/function/is-arguments":162,"es5-ext/object/valid-callable":188,"es5-ext/string/is-string":194}],198:[function(_dereq_,module,exports){ +},{"./get":199,"es5-ext/function/is-arguments":163,"es5-ext/object/valid-callable":189,"es5-ext/string/is-string":195}],199:[function(_dereq_,module,exports){ "use strict"; var isArguments = _dereq_("es5-ext/function/is-arguments") @@ -61212,7 +61232,7 @@ return new ArrayIterator(obj); }; -},{"./array":196,"./string":201,"./valid-iterable":202,"es5-ext/function/is-arguments":162,"es5-ext/string/is-string":194,"es6-symbol":204}],199:[function(_dereq_,module,exports){ +},{"./array":197,"./string":202,"./valid-iterable":203,"es5-ext/function/is-arguments":163,"es5-ext/string/is-string":195,"es6-symbol":205}],200:[function(_dereq_,module,exports){ "use strict"; var clear = _dereq_("es5-ext/array/#/clear") @@ -61320,7 +61340,7 @@ }) ); -},{"d":139,"d/auto-bind":138,"es5-ext/array/#/clear":158,"es5-ext/object/assign":171,"es5-ext/object/valid-callable":188,"es5-ext/object/valid-value":190,"es6-symbol":204}],200:[function(_dereq_,module,exports){ +},{"d":140,"d/auto-bind":139,"es5-ext/array/#/clear":159,"es5-ext/object/assign":172,"es5-ext/object/valid-callable":189,"es5-ext/object/valid-value":191,"es6-symbol":205}],201:[function(_dereq_,module,exports){ "use strict"; var isArguments = _dereq_("es5-ext/function/is-arguments") @@ -61338,7 +61358,7 @@ return typeof value[iteratorSymbol] === "function"; }; -},{"es5-ext/function/is-arguments":162,"es5-ext/object/is-value":179,"es5-ext/string/is-string":194,"es6-symbol":204}],201:[function(_dereq_,module,exports){ +},{"es5-ext/function/is-arguments":163,"es5-ext/object/is-value":180,"es5-ext/string/is-string":195,"es6-symbol":205}],202:[function(_dereq_,module,exports){ // Thanks @mathiasbynens // http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols @@ -61379,7 +61399,7 @@ }); defineProperty(StringIterator.prototype, Symbol.toStringTag, d("c", "String Iterator")); -},{"./":199,"d":139,"es5-ext/object/set-prototype-of":185,"es6-symbol":204}],202:[function(_dereq_,module,exports){ +},{"./":200,"d":140,"es5-ext/object/set-prototype-of":186,"es6-symbol":205}],203:[function(_dereq_,module,exports){ "use strict"; var isIterable = _dereq_("./is-iterable"); @@ -61389,7 +61409,7 @@ return value; }; -},{"./is-iterable":200}],203:[function(_dereq_,module,exports){ +},{"./is-iterable":201}],204:[function(_dereq_,module,exports){ (function (process,global){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. @@ -62546,12 +62566,12 @@ }))); }).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":465}],204:[function(_dereq_,module,exports){ +},{"_process":468}],205:[function(_dereq_,module,exports){ 'use strict'; module.exports = _dereq_('./is-implemented')() ? Symbol : _dereq_('./polyfill'); -},{"./is-implemented":205,"./polyfill":207}],205:[function(_dereq_,module,exports){ +},{"./is-implemented":206,"./polyfill":208}],206:[function(_dereq_,module,exports){ 'use strict'; var validTypes = { object: true, symbol: true }; @@ -62570,7 +62590,7 @@ return true; }; -},{}],206:[function(_dereq_,module,exports){ +},{}],207:[function(_dereq_,module,exports){ 'use strict'; module.exports = function (x) { @@ -62581,7 +62601,7 @@ return (x[x.constructor.toStringTag] === 'Symbol'); }; -},{}],207:[function(_dereq_,module,exports){ +},{}],208:[function(_dereq_,module,exports){ // ES2015 Symbol polyfill for environments that do not (or partially) support it 'use strict'; @@ -62701,7 +62721,7 @@ defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive])); -},{"./validate-symbol":208,"d":139}],208:[function(_dereq_,module,exports){ +},{"./validate-symbol":209,"d":140}],209:[function(_dereq_,module,exports){ 'use strict'; var isSymbol = _dereq_('./is-symbol'); @@ -62711,12 +62731,12 @@ return value; }; -},{"./is-symbol":206}],209:[function(_dereq_,module,exports){ +},{"./is-symbol":207}],210:[function(_dereq_,module,exports){ 'use strict'; module.exports = _dereq_('./is-implemented')() ? WeakMap : _dereq_('./polyfill'); -},{"./is-implemented":210,"./polyfill":212}],210:[function(_dereq_,module,exports){ +},{"./is-implemented":211,"./polyfill":213}],211:[function(_dereq_,module,exports){ 'use strict'; module.exports = function () { @@ -62738,7 +62758,7 @@ return true; }; -},{}],211:[function(_dereq_,module,exports){ +},{}],212:[function(_dereq_,module,exports){ // Exports true if environment provides native `WeakMap` implementation, whatever that is. 'use strict'; @@ -62748,7 +62768,7 @@ return (Object.prototype.toString.call(new WeakMap()) === '[object WeakMap]'); }()); -},{}],212:[function(_dereq_,module,exports){ +},{}],213:[function(_dereq_,module,exports){ 'use strict'; var setPrototypeOf = _dereq_('es5-ext/object/set-prototype-of') @@ -62816,7 +62836,7 @@ }); defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d('c', 'WeakMap')); -},{"./is-native-implemented":211,"d":139,"es5-ext/object/set-prototype-of":185,"es5-ext/object/valid-object":189,"es5-ext/object/valid-value":190,"es5-ext/string/random-uniq":195,"es6-iterator/for-of":197,"es6-iterator/get":198,"es6-symbol":204}],213:[function(_dereq_,module,exports){ +},{"./is-native-implemented":212,"d":140,"es5-ext/object/set-prototype-of":186,"es5-ext/object/valid-object":190,"es5-ext/object/valid-value":191,"es5-ext/string/random-uniq":196,"es6-iterator/for-of":198,"es6-iterator/get":199,"es6-symbol":205}],214:[function(_dereq_,module,exports){ "use strict" module.exports = extractPlanes @@ -62833,7 +62853,7 @@ [ zf*M[12] - M[8], zf*M[13] - M[9], zf*M[14] - M[10], zf*M[15] - M[11] ] ] } -},{}],214:[function(_dereq_,module,exports){ +},{}],215:[function(_dereq_,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -62859,7 +62879,7 @@ return n - n < 1; }; -},{"is-string-blank":406}],215:[function(_dereq_,module,exports){ +},{"is-string-blank":409}],216:[function(_dereq_,module,exports){ 'use strict' module.exports = createFilteredVector @@ -63152,7 +63172,7 @@ } } -},{"binary-search-bounds":79,"cubic-hermite":133}],216:[function(_dereq_,module,exports){ +},{"binary-search-bounds":80,"cubic-hermite":134}],217:[function(_dereq_,module,exports){ /*eslint new-cap:0*/ var dtype = _dereq_('dtype') @@ -63212,7 +63232,7 @@ return output } -},{"dtype":154}],217:[function(_dereq_,module,exports){ +},{"dtype":155}],218:[function(_dereq_,module,exports){ 'use strict' var stringifyFont = _dereq_('css-font/stringify') @@ -63271,7 +63291,7 @@ return canvas } -},{"css-font/stringify":130}],218:[function(_dereq_,module,exports){ +},{"css-font/stringify":131}],219:[function(_dereq_,module,exports){ 'use strict' module.exports = measure @@ -63458,7 +63478,7 @@ } } -},{}],219:[function(_dereq_,module,exports){ +},{}],220:[function(_dereq_,module,exports){ "use strict" module.exports = createRBTree @@ -64455,7 +64475,7 @@ function createRBTree(compare) { return new RedBlackTree(compare || defaultCompare, null) } -},{}],220:[function(_dereq_,module,exports){ +},{}],221:[function(_dereq_,module,exports){ // transliterated from the python snippet here: // http://en.wikipedia.org/wiki/Lanczos_approximation @@ -64524,7 +64544,7 @@ module.exports.log = lngamma; -},{}],221:[function(_dereq_,module,exports){ +},{}],222:[function(_dereq_,module,exports){ module.exports = getCanvasContext function getCanvasContext (type, opts) { if (typeof type !== 'string') { @@ -64564,7 +64584,7 @@ return (gl || null) // ensure null on fail } -},{}],222:[function(_dereq_,module,exports){ +},{}],223:[function(_dereq_,module,exports){ 'use strict' module.exports = createAxes @@ -65168,7 +65188,7 @@ return axes } -},{"./lib/background.js":223,"./lib/cube.js":224,"./lib/lines.js":225,"./lib/text.js":227,"./lib/ticks.js":228}],223:[function(_dereq_,module,exports){ +},{"./lib/background.js":224,"./lib/cube.js":225,"./lib/lines.js":226,"./lib/text.js":228,"./lib/ticks.js":229}],224:[function(_dereq_,module,exports){ 'use strict' module.exports = createBackgroundCube @@ -65281,7 +65301,7 @@ return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":226,"gl-buffer":230,"gl-vao":310}],224:[function(_dereq_,module,exports){ +},{"./shaders":227,"gl-buffer":231,"gl-vao":313}],225:[function(_dereq_,module,exports){ "use strict" module.exports = getCubeEdges @@ -65520,7 +65540,7 @@ //Return result return CUBE_RESULT } -},{"bit-twiddle":80,"gl-mat4/multiply":256,"robust-orientation":486,"split-polygon":503}],225:[function(_dereq_,module,exports){ +},{"bit-twiddle":81,"gl-mat4/multiply":258,"robust-orientation":488,"split-polygon":505}],226:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -65730,7 +65750,7 @@ return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":226,"gl-buffer":230,"gl-vao":310}],226:[function(_dereq_,module,exports){ +},{"./shaders":227,"gl-buffer":231,"gl-vao":313}],227:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -65761,7 +65781,7 @@ ]) } -},{"gl-shader":288,"glslify":392}],227:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],228:[function(_dereq_,module,exports){ (function (process){ "use strict" @@ -65983,7 +66003,7 @@ } }).call(this,_dereq_('_process')) -},{"./shaders":226,"_process":465,"gl-buffer":230,"gl-vao":310,"vectorize-text":526}],228:[function(_dereq_,module,exports){ +},{"./shaders":227,"_process":468,"gl-buffer":231,"gl-vao":313,"vectorize-text":528}],229:[function(_dereq_,module,exports){ 'use strict' exports.create = defaultTicks @@ -66064,7 +66084,7 @@ } return true } -},{}],229:[function(_dereq_,module,exports){ +},{}],230:[function(_dereq_,module,exports){ "use strict" module.exports = axesProperties @@ -66206,7 +66226,7 @@ return ranges } -},{"./lib/cube.js":224,"extract-frustum-planes":213,"gl-mat4/multiply":256,"gl-mat4/transpose":264,"gl-vec4/transformMat4":381,"split-polygon":503}],230:[function(_dereq_,module,exports){ +},{"./lib/cube.js":225,"extract-frustum-planes":214,"gl-mat4/multiply":258,"gl-mat4/transpose":266,"gl-vec4/transformMat4":384,"split-polygon":505}],231:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -66360,7 +66380,7 @@ module.exports = createBuffer -},{"ndarray":433,"ndarray-ops":427,"typedarray-pool":521}],231:[function(_dereq_,module,exports){ +},{"ndarray":436,"ndarray-ops":430,"typedarray-pool":523}],232:[function(_dereq_,module,exports){ "use strict"; var V = _dereq_('gl-vec3'); @@ -66632,7 +66652,7 @@ module.exports.createConeMesh = _dereq_('./lib/conemesh'); -},{"./lib/conemesh":233,"gl-vec3":329,"gl-vec4":365}],232:[function(_dereq_,module,exports){ +},{"./lib/conemesh":234,"gl-vec3":332,"gl-vec4":368}],233:[function(_dereq_,module,exports){ 'use strict' var barycentric = _dereq_('barycentric') @@ -66730,7 +66750,7 @@ } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":61,"polytope-closest-point/lib/closest_point_2d.js":464}],233:[function(_dereq_,module,exports){ +},{"barycentric":62,"polytope-closest-point/lib/closest_point_2d.js":467}],234:[function(_dereq_,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -67765,7 +67785,7 @@ module.exports = createSimplicialMesh -},{"./closest-point":232,"./shaders":234,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":288,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"normals":436,"simplicial-complex-contour":494,"typedarray-pool":521}],234:[function(_dereq_,module,exports){ +},{"./closest-point":233,"./shaders":235,"colormap":115,"gl-buffer":231,"gl-mat4/invert":256,"gl-mat4/multiply":258,"gl-shader":290,"gl-texture2d":308,"gl-vao":313,"ndarray":436,"normals":439,"simplicial-complex-contour":496,"typedarray-pool":523}],235:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float vectorScale;\nuniform float coneScale;\n\nuniform float coneOffset;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n f_color = color; //vec4(position.w, color.r, 0, 0);\n f_normal = normal;\n f_data = conePosition.xyz;\n f_position = position.xyz;\n f_eyeDirection = eyePosition - conePosition.xyz;\n f_lightDirection = lightPosition - conePosition.xyz;\n f_uv = uv;\n}\n"]) @@ -67794,7 +67814,7 @@ ] } -},{"glslify":392}],235:[function(_dereq_,module,exports){ +},{"glslify":395}],236:[function(_dereq_,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -68094,14 +68114,14 @@ 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],236:[function(_dereq_,module,exports){ +},{}],237:[function(_dereq_,module,exports){ var gl10 = _dereq_('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":235}],237:[function(_dereq_,module,exports){ +},{"./1.0/numbers":236}],238:[function(_dereq_,module,exports){ 'use strict' module.exports = createErrorBars @@ -68128,16 +68148,17 @@ this.lineCount = [0,0,0] this.lineOffset = [0,0,0] this.opacity = 1 + this.hasAlpha = false } var proto = ErrorBars.prototype proto.isOpaque = function() { - return this.opacity >= 1 + return !this.hasAlpha } proto.isTransparent = function() { - return this.opacity < 1 + return this.hasAlpha } proto.drawTransparent = proto.draw = function(cameraParams) { @@ -68220,8 +68241,13 @@ this.capSize = [this.capSize, this.capSize, this.capSize] } } + + this.hasAlpha = false // default to no transparent draw if('opacity' in options) { - this.opacity = options.opacity + this.opacity = +options.opacity + if(this.opacity < 1) { + this.hasAlpha = true; + } } var color = options.color || [[0,0,0],[0,0,0],[0,0,0]] @@ -68261,7 +68287,11 @@ } if(c.length === 3) { c = [c[0], c[1], c[2], 1] + } else if(c.length === 4) { + c = [c[0], c[1], c[2], c[3]] + if(!this.hasAlpha && c[3] < 1) this.hasAlpha = true } + if(isNaN(e[0][j]) || isNaN(e[1][j])) { continue } @@ -68339,14 +68369,14 @@ return result } -},{"./shaders/index":238,"gl-buffer":230,"gl-vao":310}],238:[function(_dereq_,module,exports){ +},{"./shaders/index":239,"gl-buffer":231,"gl-vao":313}],239:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') var vertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]) -var fragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], fragPosition)) discard;\n\n gl_FragColor = opacity * fragColor;\n}"]) +var fragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if (\n outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||\n fragColor.a * opacity == 0.\n ) discard;\n\n gl_FragColor = opacity * fragColor;\n}"]) module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ @@ -68356,7 +68386,7 @@ ]) } -},{"gl-shader":288,"glslify":392}],239:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],240:[function(_dereq_,module,exports){ 'use strict' var createTexture = _dereq_('gl-texture2d') @@ -68823,7 +68853,7 @@ WEBGL_draw_buffers) } -},{"gl-texture2d":305}],240:[function(_dereq_,module,exports){ +},{"gl-texture2d":308}],241:[function(_dereq_,module,exports){ var sprintf = _dereq_('sprintf-js').sprintf; var glConstants = _dereq_('gl-constants/lookup'); @@ -68878,345 +68908,345 @@ } -},{"add-line-numbers":49,"gl-constants/lookup":236,"glsl-shader-name":384,"sprintf-js":504}],241:[function(_dereq_,module,exports){ -'use strict' - -module.exports = createHeatmap2D - -var bsearch = _dereq_('binary-search-bounds') -var iota = _dereq_('iota-array') -var pool = _dereq_('typedarray-pool') -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') - -var shaders = _dereq_('./lib/shaders') - -function GLHeatmap2D ( - plot, - shader, - pickShader, - positionBuffer, - weightBuffer, - colorBuffer, - idBuffer) { - this.plot = plot - this.shader = shader - this.pickShader = pickShader - this.positionBuffer = positionBuffer - this.weightBuffer = weightBuffer - this.colorBuffer = colorBuffer - this.idBuffer = idBuffer - this.xData = [] - this.yData = [] - this.shape = [0, 0] - this.bounds = [Infinity, Infinity, -Infinity, -Infinity] - this.pickOffset = 0 -} - -var proto = GLHeatmap2D.prototype - -var WEIGHTS = [ - 0, 0, - 1, 0, - 0, 1, - 1, 0, - 1, 1, - 0, 1 -] - -proto.draw = (function () { - var MATRIX = [ - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - ] - - return function () { - var plot = this.plot - var shader = this.shader - var bounds = this.bounds - var numVertices = this.numVertices - - if (numVertices <= 0) { - return - } - - var gl = plot.gl - var dataBox = plot.dataBox - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - - MATRIX[0] = 2.0 * boundX / dataX - MATRIX[4] = 2.0 * boundY / dataY - MATRIX[6] = 2.0 * (bounds[0] - dataBox[0]) / dataX - 1.0 - MATRIX[7] = 2.0 * (bounds[1] - dataBox[1]) / dataY - 1.0 - - shader.bind() - - var uniforms = shader.uniforms - uniforms.viewTransform = MATRIX - - uniforms.shape = this.shape - - var attributes = shader.attributes - this.positionBuffer.bind() - attributes.position.pointer() - - this.weightBuffer.bind() - attributes.weight.pointer(gl.UNSIGNED_BYTE, false) - - this.colorBuffer.bind() - attributes.color.pointer(gl.UNSIGNED_BYTE, true) - - gl.drawArrays(gl.TRIANGLES, 0, numVertices) - } -})() - -proto.drawPick = (function () { - var MATRIX = [ - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - ] - - var PICK_VECTOR = [0, 0, 0, 0] - - return function (pickOffset) { - var plot = this.plot - var shader = this.pickShader - var bounds = this.bounds - var numVertices = this.numVertices - - if (numVertices <= 0) { - return - } - - var gl = plot.gl - var dataBox = plot.dataBox - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - - MATRIX[0] = 2.0 * boundX / dataX - MATRIX[4] = 2.0 * boundY / dataY - MATRIX[6] = 2.0 * (bounds[0] - dataBox[0]) / dataX - 1.0 - MATRIX[7] = 2.0 * (bounds[1] - dataBox[1]) / dataY - 1.0 - - for (var i = 0; i < 4; ++i) { - PICK_VECTOR[i] = (pickOffset >> (i * 8)) & 0xff - } - - this.pickOffset = pickOffset - - shader.bind() - - var uniforms = shader.uniforms - uniforms.viewTransform = MATRIX - uniforms.pickOffset = PICK_VECTOR - uniforms.shape = this.shape - - var attributes = shader.attributes - this.positionBuffer.bind() - attributes.position.pointer() - - this.weightBuffer.bind() - attributes.weight.pointer(gl.UNSIGNED_BYTE, false) - - this.idBuffer.bind() - attributes.pickId.pointer(gl.UNSIGNED_BYTE, false) - - gl.drawArrays(gl.TRIANGLES, 0, numVertices) - - return pickOffset + this.shape[0] * this.shape[1] - } -})() - -proto.pick = function (x, y, value) { - var pickOffset = this.pickOffset - var pointCount = this.shape[0] * this.shape[1] - if (value < pickOffset || value >= pickOffset + pointCount) { - return null - } - var pointId = value - pickOffset - var xData = this.xData - var yData = this.yData - return { - object: this, - pointId: pointId, - dataCoord: [ - xData[pointId % this.shape[0]], - yData[(pointId / this.shape[0]) | 0]] - } -} - -proto.update = function (options) { - options = options || {} - - var shape = options.shape || [0, 0] - - var x = options.x || iota(shape[0]) - var y = options.y || iota(shape[1]) - var z = options.z || new Float32Array(shape[0] * shape[1]) - - this.xData = x - this.yData = y - - var colorLevels = options.colorLevels || [0] - var colorValues = options.colorValues || [0, 0, 0, 1] - var colorCount = colorLevels.length - - var bounds = this.bounds - var lox = bounds[0] = x[0] - var loy = bounds[1] = y[0] - var hix = bounds[2] = x[x.length - 1] - var hiy = bounds[3] = y[y.length - 1] - - var xs = 1.0 / (hix - lox) - var ys = 1.0 / (hiy - loy) - - var numX = shape[0] - var numY = shape[1] - - this.shape = [numX, numY] - - var numVerts = (numX - 1) * (numY - 1) * (WEIGHTS.length >>> 1) - - this.numVertices = numVerts - - var colors = pool.mallocUint8(numVerts * 4) - var positions = pool.mallocFloat32(numVerts * 2) - var weights = pool.mallocUint8 (numVerts * 2) - var ids = pool.mallocUint32(numVerts) - - var ptr = 0 - - for (var j = 0; j < numY - 1; ++j) { - var yc0 = ys * (y[j] - loy) - var yc1 = ys * (y[j + 1] - loy) - for (var i = 0; i < numX - 1; ++i) { - var xc0 = xs * (x[i] - lox) - var xc1 = xs * (x[i + 1] - lox) - - for (var dd = 0; dd < WEIGHTS.length; dd += 2) { - var dx = WEIGHTS[dd] - var dy = WEIGHTS[dd + 1] - var offset = (j + dy) * numX + (i + dx) - var zc = z[offset] - var colorIdx = bsearch.le(colorLevels, zc) - var r, g, b, a - if (colorIdx < 0) { - r = colorValues[0] - g = colorValues[1] - b = colorValues[2] - a = colorValues[3] - } else if (colorIdx === colorCount - 1) { - r = colorValues[4 * colorCount - 4] - g = colorValues[4 * colorCount - 3] - b = colorValues[4 * colorCount - 2] - a = colorValues[4 * colorCount - 1] - } else { - var t = (zc - colorLevels[colorIdx]) / - (colorLevels[colorIdx + 1] - colorLevels[colorIdx]) - var ti = 1.0 - t - var i0 = 4 * colorIdx - var i1 = 4 * (colorIdx + 1) - r = ti * colorValues[i0] + t * colorValues[i1] - g = ti * colorValues[i0 + 1] + t * colorValues[i1 + 1] - b = ti * colorValues[i0 + 2] + t * colorValues[i1 + 2] - a = ti * colorValues[i0 + 3] + t * colorValues[i1 + 3] - } - - colors[4 * ptr] = 255 * r - colors[4 * ptr + 1] = 255 * g - colors[4 * ptr + 2] = 255 * b - colors[4 * ptr + 3] = 255 * a - - positions[2*ptr] = xc0*.5 + xc1*.5; - positions[2*ptr+1] = yc0*.5 + yc1*.5; - - weights[2*ptr] = dx; - weights[2*ptr+1] = dy; - - ids[ptr] = j * numX + i - - ptr += 1 - } - } - } - - this.positionBuffer.update(positions) - this.weightBuffer.update(weights) - this.colorBuffer.update(colors) - this.idBuffer.update(ids) - - pool.free(positions) - pool.free(colors) - pool.free(weights) - pool.free(ids) -} - -proto.dispose = function () { - this.shader.dispose() - this.pickShader.dispose() - this.positionBuffer.dispose() - this.weightBuffer.dispose() - this.colorBuffer.dispose() - this.idBuffer.dispose() - this.plot.removeObject(this) -} - -function createHeatmap2D (plot, options) { - var gl = plot.gl - - var shader = createShader(gl, shaders.vertex, shaders.fragment) - var pickShader = createShader(gl, shaders.pickVertex, shaders.pickFragment) - - var positionBuffer = createBuffer(gl) - var weightBuffer = createBuffer(gl) - var colorBuffer = createBuffer(gl) - var idBuffer = createBuffer(gl) - - var heatmap = new GLHeatmap2D( - plot, - shader, - pickShader, - positionBuffer, - weightBuffer, - colorBuffer, - idBuffer) - - heatmap.update(options) - plot.addObject(heatmap) - - return heatmap -} +},{"add-line-numbers":50,"gl-constants/lookup":237,"glsl-shader-name":387,"sprintf-js":506}],242:[function(_dereq_,module,exports){ +'use strict' -},{"./lib/shaders":242,"binary-search-bounds":243,"gl-buffer":230,"gl-shader":288,"iota-array":399,"typedarray-pool":521}],242:[function(_dereq_,module,exports){ -'use strict' - -var glslify = _dereq_('glslify') - -module.exports = { - fragment: glslify(["precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n"]), - vertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]), - pickFragment: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nuniform vec2 shape;\nuniform vec4 pickOffset;\n\nvoid main() {\n vec2 d = step(.5, vWeight);\n vec4 id = fragId + pickOffset;\n id.x += d.x + d.y*shape.x;\n\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n gl_FragColor = id/255.;\n}\n"]), - pickVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) -} +module.exports = createHeatmap2D + +var bsearch = _dereq_('binary-search-bounds') +var iota = _dereq_('iota-array') +var pool = _dereq_('typedarray-pool') +var createShader = _dereq_('gl-shader') +var createBuffer = _dereq_('gl-buffer') + +var shaders = _dereq_('./lib/shaders') + +function GLHeatmap2D ( + plot, + shader, + pickShader, + positionBuffer, + weightBuffer, + colorBuffer, + idBuffer) { + this.plot = plot + this.shader = shader + this.pickShader = pickShader + this.positionBuffer = positionBuffer + this.weightBuffer = weightBuffer + this.colorBuffer = colorBuffer + this.idBuffer = idBuffer + this.xData = [] + this.yData = [] + this.shape = [0, 0] + this.bounds = [Infinity, Infinity, -Infinity, -Infinity] + this.pickOffset = 0 +} + +var proto = GLHeatmap2D.prototype + +var WEIGHTS = [ + 0, 0, + 1, 0, + 0, 1, + 1, 0, + 1, 1, + 0, 1 +] + +proto.draw = (function () { + var MATRIX = [ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + ] + + return function () { + var plot = this.plot + var shader = this.shader + var bounds = this.bounds + var numVertices = this.numVertices + + if (numVertices <= 0) { + return + } + + var gl = plot.gl + var dataBox = plot.dataBox + + var boundX = bounds[2] - bounds[0] + var boundY = bounds[3] - bounds[1] + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] + + MATRIX[0] = 2.0 * boundX / dataX + MATRIX[4] = 2.0 * boundY / dataY + MATRIX[6] = 2.0 * (bounds[0] - dataBox[0]) / dataX - 1.0 + MATRIX[7] = 2.0 * (bounds[1] - dataBox[1]) / dataY - 1.0 + + shader.bind() + + var uniforms = shader.uniforms + uniforms.viewTransform = MATRIX + + uniforms.shape = this.shape + + var attributes = shader.attributes + this.positionBuffer.bind() + attributes.position.pointer() + + this.weightBuffer.bind() + attributes.weight.pointer(gl.UNSIGNED_BYTE, false) + + this.colorBuffer.bind() + attributes.color.pointer(gl.UNSIGNED_BYTE, true) + + gl.drawArrays(gl.TRIANGLES, 0, numVertices) + } +})() + +proto.drawPick = (function () { + var MATRIX = [ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + ] + + var PICK_VECTOR = [0, 0, 0, 0] + + return function (pickOffset) { + var plot = this.plot + var shader = this.pickShader + var bounds = this.bounds + var numVertices = this.numVertices + + if (numVertices <= 0) { + return + } + + var gl = plot.gl + var dataBox = plot.dataBox + + var boundX = bounds[2] - bounds[0] + var boundY = bounds[3] - bounds[1] + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] + + MATRIX[0] = 2.0 * boundX / dataX + MATRIX[4] = 2.0 * boundY / dataY + MATRIX[6] = 2.0 * (bounds[0] - dataBox[0]) / dataX - 1.0 + MATRIX[7] = 2.0 * (bounds[1] - dataBox[1]) / dataY - 1.0 + + for (var i = 0; i < 4; ++i) { + PICK_VECTOR[i] = (pickOffset >> (i * 8)) & 0xff + } + + this.pickOffset = pickOffset + + shader.bind() + + var uniforms = shader.uniforms + uniforms.viewTransform = MATRIX + uniforms.pickOffset = PICK_VECTOR + uniforms.shape = this.shape + + var attributes = shader.attributes + this.positionBuffer.bind() + attributes.position.pointer() + + this.weightBuffer.bind() + attributes.weight.pointer(gl.UNSIGNED_BYTE, false) + + this.idBuffer.bind() + attributes.pickId.pointer(gl.UNSIGNED_BYTE, false) + + gl.drawArrays(gl.TRIANGLES, 0, numVertices) + + return pickOffset + this.shape[0] * this.shape[1] + } +})() + +proto.pick = function (x, y, value) { + var pickOffset = this.pickOffset + var pointCount = this.shape[0] * this.shape[1] + if (value < pickOffset || value >= pickOffset + pointCount) { + return null + } + var pointId = value - pickOffset + var xData = this.xData + var yData = this.yData + return { + object: this, + pointId: pointId, + dataCoord: [ + xData[pointId % this.shape[0]], + yData[(pointId / this.shape[0]) | 0]] + } +} + +proto.update = function (options) { + options = options || {} + + var shape = options.shape || [0, 0] + + var x = options.x || iota(shape[0]) + var y = options.y || iota(shape[1]) + var z = options.z || new Float32Array(shape[0] * shape[1]) + + this.xData = x + this.yData = y + + var colorLevels = options.colorLevels || [0] + var colorValues = options.colorValues || [0, 0, 0, 1] + var colorCount = colorLevels.length + + var bounds = this.bounds + var lox = bounds[0] = x[0] + var loy = bounds[1] = y[0] + var hix = bounds[2] = x[x.length - 1] + var hiy = bounds[3] = y[y.length - 1] + + var xs = 1.0 / (hix - lox) + var ys = 1.0 / (hiy - loy) + + var numX = shape[0] + var numY = shape[1] + + this.shape = [numX, numY] + + var numVerts = (numX - 1) * (numY - 1) * (WEIGHTS.length >>> 1) + + this.numVertices = numVerts + + var colors = pool.mallocUint8(numVerts * 4) + var positions = pool.mallocFloat32(numVerts * 2) + var weights = pool.mallocUint8 (numVerts * 2) + var ids = pool.mallocUint32(numVerts) + + var ptr = 0 + + for (var j = 0; j < numY - 1; ++j) { + var yc0 = ys * (y[j] - loy) + var yc1 = ys * (y[j + 1] - loy) + for (var i = 0; i < numX - 1; ++i) { + var xc0 = xs * (x[i] - lox) + var xc1 = xs * (x[i + 1] - lox) + + for (var dd = 0; dd < WEIGHTS.length; dd += 2) { + var dx = WEIGHTS[dd] + var dy = WEIGHTS[dd + 1] + var offset = (j + dy) * numX + (i + dx) + var zc = z[offset] + var colorIdx = bsearch.le(colorLevels, zc) + var r, g, b, a + if (colorIdx < 0) { + r = colorValues[0] + g = colorValues[1] + b = colorValues[2] + a = colorValues[3] + } else if (colorIdx === colorCount - 1) { + r = colorValues[4 * colorCount - 4] + g = colorValues[4 * colorCount - 3] + b = colorValues[4 * colorCount - 2] + a = colorValues[4 * colorCount - 1] + } else { + var t = (zc - colorLevels[colorIdx]) / + (colorLevels[colorIdx + 1] - colorLevels[colorIdx]) + var ti = 1.0 - t + var i0 = 4 * colorIdx + var i1 = 4 * (colorIdx + 1) + r = ti * colorValues[i0] + t * colorValues[i1] + g = ti * colorValues[i0 + 1] + t * colorValues[i1 + 1] + b = ti * colorValues[i0 + 2] + t * colorValues[i1 + 2] + a = ti * colorValues[i0 + 3] + t * colorValues[i1 + 3] + } + + colors[4 * ptr] = 255 * r + colors[4 * ptr + 1] = 255 * g + colors[4 * ptr + 2] = 255 * b + colors[4 * ptr + 3] = 255 * a + + positions[2*ptr] = xc0*.5 + xc1*.5; + positions[2*ptr+1] = yc0*.5 + yc1*.5; + + weights[2*ptr] = dx; + weights[2*ptr+1] = dy; + + ids[ptr] = j * numX + i + + ptr += 1 + } + } + } + + this.positionBuffer.update(positions) + this.weightBuffer.update(weights) + this.colorBuffer.update(colors) + this.idBuffer.update(ids) + + pool.free(positions) + pool.free(colors) + pool.free(weights) + pool.free(ids) +} + +proto.dispose = function () { + this.shader.dispose() + this.pickShader.dispose() + this.positionBuffer.dispose() + this.weightBuffer.dispose() + this.colorBuffer.dispose() + this.idBuffer.dispose() + this.plot.removeObject(this) +} + +function createHeatmap2D (plot, options) { + var gl = plot.gl + + var shader = createShader(gl, shaders.vertex, shaders.fragment) + var pickShader = createShader(gl, shaders.pickVertex, shaders.pickFragment) + + var positionBuffer = createBuffer(gl) + var weightBuffer = createBuffer(gl) + var colorBuffer = createBuffer(gl) + var idBuffer = createBuffer(gl) + + var heatmap = new GLHeatmap2D( + plot, + shader, + pickShader, + positionBuffer, + weightBuffer, + colorBuffer, + idBuffer) + + heatmap.update(options) + plot.addObject(heatmap) + + return heatmap +} -},{"glslify":392}],243:[function(_dereq_,module,exports){ -arguments[4][99][0].apply(exports,arguments) -},{"dup":99}],244:[function(_dereq_,module,exports){ +},{"./lib/shaders":243,"binary-search-bounds":244,"gl-buffer":231,"gl-shader":290,"iota-array":402,"typedarray-pool":523}],243:[function(_dereq_,module,exports){ +'use strict' + +var glslify = _dereq_('glslify') + +module.exports = { + fragment: glslify(["precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n"]), + vertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]), + pickFragment: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nuniform vec2 shape;\nuniform vec4 pickOffset;\n\nvoid main() {\n vec2 d = step(.5, vWeight);\n vec4 id = fragId + pickOffset;\n id.x += d.x + d.y*shape.x;\n\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n gl_FragColor = id/255.;\n}\n"]), + pickVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) +} + +},{"glslify":395}],244:[function(_dereq_,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],245:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') var vertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n vec4 startPoint = project(position);\n vec4 endPoint = project(nextPosition);\n\n vec2 A = startPoint.xy / startPoint.w;\n vec2 B = endPoint.xy / endPoint.w;\n\n float clipAngle = atan(\n (B.y - A.y) * screenShape.y,\n (B.x - A.x) * screenShape.x\n );\n\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(\n sin(clipAngle),\n -cos(clipAngle)\n ) / screenShape;\n\n gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n"]) -var forwardFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n"]) -var pickFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1604150559(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, encode_float_1604150559(pixelArcLength).xyz);\n}"]) +var forwardFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (\n outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||\n fragColor.a * opacity == 0.\n ) discard;\n\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n"]) +var pickFrag = glslify(["precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1540259130(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, encode_float_1540259130(pixelArcLength).xyz);\n}"]) var ATTRIBUTES = [ {name: 'position', type: 'vec3'}, @@ -69234,7 +69264,7 @@ return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":288,"glslify":392}],245:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],246:[function(_dereq_,module,exports){ 'use strict' module.exports = createLinePlot @@ -69298,6 +69328,7 @@ this.texture = texture this.dashScale = 1 this.opacity = 1 + this.hasAlpha = false this.dirty = true this.pixelRatio = 1 } @@ -69305,11 +69336,11 @@ var proto = LinePlot.prototype proto.isTransparent = function () { - return this.opacity < 1 + return this.hasAlpha } proto.isOpaque = function () { - return this.opacity >= 1 + return !this.hasAlpha } proto.pickSlots = 1 @@ -69370,8 +69401,13 @@ if ('dashScale' in options) { this.dashScale = options.dashScale } + + this.hasAlpha = false // default to no transparent draw if ('opacity' in options) { this.opacity = +options.opacity + if(this.opacity < 1) { + this.hasAlpha = true; + } } // Recalculate buffer data @@ -69440,6 +69476,8 @@ bcolor = [bcolor[0], bcolor[1], bcolor[2], 1] } + if(!this.hasAlpha && acolor[3] < 1) this.hasAlpha = true + var w0 if (Array.isArray(lineWidth)) { w0 = (lineWidth.length > i - 1) ? lineWidth[i - 1] : // using index value @@ -69616,7 +69654,9 @@ return linePlot } -},{"./lib/shaders":244,"binary-search-bounds":79,"gl-buffer":230,"gl-texture2d":305,"gl-vao":310,"glsl-read-float":383,"ndarray":433}],246:[function(_dereq_,module,exports){ +},{"./lib/shaders":245,"binary-search-bounds":247,"gl-buffer":231,"gl-texture2d":308,"gl-vao":313,"glsl-read-float":386,"ndarray":436}],247:[function(_dereq_,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],248:[function(_dereq_,module,exports){ module.exports = invert /** @@ -69645,7 +69685,7 @@ return out } -},{}],247:[function(_dereq_,module,exports){ +},{}],249:[function(_dereq_,module,exports){ module.exports = invert /** @@ -69684,7 +69724,7 @@ return out } -},{}],248:[function(_dereq_,module,exports){ +},{}],250:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -69713,7 +69753,7 @@ out[15] = a[15]; return out; }; -},{}],249:[function(_dereq_,module,exports){ +},{}],251:[function(_dereq_,module,exports){ module.exports = create; /** @@ -69741,7 +69781,7 @@ out[15] = 1; return out; }; -},{}],250:[function(_dereq_,module,exports){ +},{}],252:[function(_dereq_,module,exports){ module.exports = determinant; /** @@ -69772,7 +69812,7 @@ // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],251:[function(_dereq_,module,exports){ +},{}],253:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -69820,7 +69860,7 @@ return out; }; -},{}],252:[function(_dereq_,module,exports){ +},{}],254:[function(_dereq_,module,exports){ module.exports = fromRotationTranslation; /** @@ -69874,7 +69914,7 @@ return out; }; -},{}],253:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ module.exports = identity; /** @@ -69902,7 +69942,7 @@ out[15] = 1; return out; }; -},{}],254:[function(_dereq_,module,exports){ +},{}],256:[function(_dereq_,module,exports){ module.exports = invert; /** @@ -69958,7 +69998,7 @@ return out; }; -},{}],255:[function(_dereq_,module,exports){ +},{}],257:[function(_dereq_,module,exports){ var identity = _dereq_('./identity'); module.exports = lookAt; @@ -70049,7 +70089,7 @@ return out; }; -},{"./identity":253}],256:[function(_dereq_,module,exports){ +},{"./identity":255}],258:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -70092,7 +70132,7 @@ out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],257:[function(_dereq_,module,exports){ +},{}],259:[function(_dereq_,module,exports){ module.exports = perspective; /** @@ -70126,7 +70166,7 @@ out[15] = 0; return out; }; -},{}],258:[function(_dereq_,module,exports){ +},{}],260:[function(_dereq_,module,exports){ module.exports = rotate; /** @@ -70191,7 +70231,7 @@ } return out; }; -},{}],259:[function(_dereq_,module,exports){ +},{}],261:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -70236,7 +70276,7 @@ out[11] = a23 * c - a13 * s; return out; }; -},{}],260:[function(_dereq_,module,exports){ +},{}],262:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -70281,7 +70321,7 @@ out[11] = a03 * s + a23 * c; return out; }; -},{}],261:[function(_dereq_,module,exports){ +},{}],263:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -70326,7 +70366,7 @@ out[7] = a13 * c - a03 * s; return out; }; -},{}],262:[function(_dereq_,module,exports){ +},{}],264:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -70358,7 +70398,7 @@ out[15] = a[15]; return out; }; -},{}],263:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ module.exports = translate; /** @@ -70397,7 +70437,7 @@ return out; }; -},{}],264:[function(_dereq_,module,exports){ +},{}],266:[function(_dereq_,module,exports){ module.exports = transpose; /** @@ -70447,7 +70487,7 @@ return out; }; -},{}],265:[function(_dereq_,module,exports){ +},{}],267:[function(_dereq_,module,exports){ 'use strict' module.exports = invert @@ -70478,13 +70518,13 @@ } return out } -},{"gl-mat2/invert":246,"gl-mat3/invert":247,"gl-mat4/invert":254}],266:[function(_dereq_,module,exports){ -arguments[4][232][0].apply(exports,arguments) -},{"barycentric":61,"dup":232,"polytope-closest-point/lib/closest_point_2d.js":464}],267:[function(_dereq_,module,exports){ +},{"gl-mat2/invert":248,"gl-mat3/invert":249,"gl-mat4/invert":256}],268:[function(_dereq_,module,exports){ +arguments[4][233][0].apply(exports,arguments) +},{"barycentric":62,"dup":233,"polytope-closest-point/lib/closest_point_2d.js":467}],269:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') -var triVertSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}\n"]) -var triFragSrc = glslify(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nvec3 normals(vec3 pos) {\n vec3 fdx = dFdx(pos);\n vec3 fdy = dFdy(pos);\n return normalize(cross(fdx, fdy));\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n vec3 normal = normals(f_data);\n\n if (dot(N, normal) < 0.0) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]) +var triVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection\n , inverseModel;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal,0) * inverseModel).xyz);\n\n f_color = color;\n f_data = position;\n f_uv = uv;\n}\n"]) +var triFragSrc = glslify(["#extension GL_OES_standard_derivatives : enable\n\nprecision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\n //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d\n\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]) var edgeVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}"]) var edgeFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]) var pointVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}"]) @@ -70549,7 +70589,7 @@ ] } -},{"glslify":392}],268:[function(_dereq_,module,exports){ +},{"glslify":395}],270:[function(_dereq_,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -70576,7 +70616,7 @@ var pointPickShader = shaders.pointPickShader var contourShader = shaders.contourShader -var identityMatrix = [ +var IDENTITY = [ 1,0,0,0, 0,1,0,0, 0,0,1,0, @@ -70673,9 +70713,9 @@ this.opacity = 1.0 - this._model = identityMatrix - this._view = identityMatrix - this._projection = identityMatrix + this._model = IDENTITY + this._view = IDENTITY + this._projection = IDENTITY this._resolution = [1,1] } @@ -71065,7 +71105,7 @@ } for(var j=0; j<3; ++j) { - var v = cell[j] + var v = cell[2 - j] var p = positions[v] tPos.push(p[0], p[1], p[2]) @@ -71147,9 +71187,9 @@ proto.drawTransparent = proto.draw = function(params) { params = params || {} var gl = this.gl - var model = params.model || identityMatrix - var view = params.view || identityMatrix - var projection = params.projection || identityMatrix + var model = params.model || IDENTITY + var view = params.view || IDENTITY + var projection = params.projection || IDENTITY var clipBounds = [[-1e6,-1e6,-1e6],[1e6,1e6,1e6]] for(var i=0; i<3; ++i) { @@ -71161,6 +71201,7 @@ model: model, view: view, projection: projection, + inverseModel: IDENTITY.slice(), clipBounds: clipBounds, @@ -71180,6 +71221,10 @@ texture: 0 } + uniforms.inverseModel = invert(uniforms.inverseModel, uniforms.model) + + gl.disable(gl.CULL_FACE) + this.texture.bind(0) var invCameraMatrix = new Array(16) @@ -71250,9 +71295,9 @@ var gl = this.gl - var model = params.model || identityMatrix - var view = params.view || identityMatrix - var projection = params.projection || identityMatrix + var model = params.model || IDENTITY + var view = params.view || IDENTITY + var projection = params.projection || IDENTITY var clipBounds = [[-1e6,-1e6,-1e6],[1e6,1e6,1e6]] for(var i=0; i<3; ++i) { @@ -71578,7 +71623,7 @@ module.exports = createSimplicialMesh -},{"./lib/closest-point":266,"./lib/shaders":267,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":288,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"normals":436,"simplicial-complex-contour":494,"typedarray-pool":521}],269:[function(_dereq_,module,exports){ +},{"./lib/closest-point":268,"./lib/shaders":269,"colormap":115,"gl-buffer":231,"gl-mat4/invert":256,"gl-mat4/multiply":258,"gl-shader":290,"gl-texture2d":308,"gl-vao":313,"ndarray":436,"normals":439,"simplicial-complex-contour":496,"typedarray-pool":523}],271:[function(_dereq_,module,exports){ 'use strict' module.exports = createBoxes @@ -71641,7 +71686,7 @@ return new Boxes(plot, vbo, shader) } -},{"./shaders":272,"gl-buffer":230,"gl-shader":288}],270:[function(_dereq_,module,exports){ +},{"./shaders":274,"gl-buffer":231,"gl-shader":290}],272:[function(_dereq_,module,exports){ 'use strict' module.exports = createGrid @@ -71888,7 +71933,7 @@ return grid } -},{"./shaders":272,"binary-search-bounds":274,"gl-buffer":230,"gl-shader":288}],271:[function(_dereq_,module,exports){ +},{"./shaders":274,"binary-search-bounds":276,"gl-buffer":231,"gl-shader":290}],273:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -71953,7 +71998,7 @@ return lines } -},{"./shaders":272,"gl-buffer":230,"gl-shader":288}],272:[function(_dereq_,module,exports){ +},{"./shaders":274,"gl-buffer":231,"gl-shader":290}],274:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -71971,7 +72016,7 @@ tickVert: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"]) } -},{"glslify":392}],273:[function(_dereq_,module,exports){ +},{"glslify":395}],275:[function(_dereq_,module,exports){ 'use strict' module.exports = createTextElements @@ -72249,9 +72294,9 @@ return text } -},{"./shaders":272,"binary-search-bounds":274,"gl-buffer":230,"gl-shader":288,"text-cache":512}],274:[function(_dereq_,module,exports){ -arguments[4][99][0].apply(exports,arguments) -},{"dup":99}],275:[function(_dereq_,module,exports){ +},{"./shaders":274,"binary-search-bounds":276,"gl-buffer":231,"gl-shader":290,"text-cache":514}],276:[function(_dereq_,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],277:[function(_dereq_,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -72834,7 +72879,7 @@ return plot } -},{"./lib/box":269,"./lib/grid":270,"./lib/line":271,"./lib/text":273,"gl-select-static":287}],276:[function(_dereq_,module,exports){ +},{"./lib/box":271,"./lib/grid":272,"./lib/line":273,"./lib/text":275,"gl-select-static":289}],278:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -72845,7 +72890,7 @@ return createShader(gl, vertSrc, fragSrc, null, [ { name: 'position', type: 'vec2'}]) } -},{"gl-shader":288,"glslify":392}],277:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],279:[function(_dereq_,module,exports){ 'use strict' module.exports = createScene @@ -73612,235 +73657,235 @@ return scene } -},{"./lib/shader":276,"3d-view-controls":44,"a-big-triangle":47,"gl-axes3d":222,"gl-axes3d/properties":229,"gl-fbo":239,"gl-mat4/perspective":257,"gl-select-static":287,"gl-spikes3d":297,"is-mobile":403,"mouse-change":418}],278:[function(_dereq_,module,exports){ -var glslify = _dereq_('glslify') - -exports.pointVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]) -exports.pointFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\nuniform float pointCloud;\n\nvoid main() {\n float radius;\n vec4 baseColor;\n if(pointCloud != 0.0) { // pointCloud is truthy\n if(centerFraction == 1.0) {\n gl_FragColor = color;\n } else {\n gl_FragColor = mix(borderColor, color, centerFraction);\n }\n } else {\n radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]) -exports.pickVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]) -exports.pickFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"]) +},{"./lib/shader":278,"3d-view-controls":45,"a-big-triangle":48,"gl-axes3d":223,"gl-axes3d/properties":230,"gl-fbo":240,"gl-mat4/perspective":259,"gl-select-static":289,"gl-spikes3d":299,"is-mobile":406,"mouse-change":421}],280:[function(_dereq_,module,exports){ +var glslify = _dereq_('glslify') -},{"glslify":392}],279:[function(_dereq_,module,exports){ -'use strict' - -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') - -var pool = _dereq_('typedarray-pool') - -var SHADERS = _dereq_('./lib/shader') - -module.exports = createPointcloud2D - -function Pointcloud2D(plot, offsetBuffer, pickBuffer, shader, pickShader) { - this.plot = plot - this.offsetBuffer = offsetBuffer - this.pickBuffer = pickBuffer - this.shader = shader - this.pickShader = pickShader - this.sizeMin = 0.5 - this.sizeMinCap = 2 - this.sizeMax = 20 - this.areaRatio = 1.0 - this.pointCount = 0 - this.color = [1, 0, 0, 1] - this.borderColor = [0, 0, 0, 1] - this.blend = false - this.pickOffset = 0 - this.points = null -} - -var proto = Pointcloud2D.prototype - -proto.dispose = function() { - this.shader.dispose() - this.pickShader.dispose() - this.offsetBuffer.dispose() - this.pickBuffer.dispose() - this.plot.removeObject(this) -} - -proto.update = function(options) { - - var i - - options = options || {} - - function dflt(opt, value) { - if(opt in options) { - return options[opt] - } - return value - } - - this.sizeMin = dflt('sizeMin', 0.5) - // this.sizeMinCap = dflt('sizeMinCap', 2) - this.sizeMax = dflt('sizeMax', 20) - this.color = dflt('color', [1, 0, 0, 1]).slice() - this.areaRatio = dflt('areaRatio', 1) - this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() - this.blend = dflt('blend', false) - - //Update point data - - // Attempt straight-through processing (STP) to avoid allocation and copy - // TODO eventually abstract out STP logic, maybe into `pool` or a layer above - var pointCount = options.positions.length >>> 1 - var dataStraightThrough = options.positions instanceof Float32Array - var idStraightThrough = options.idToIndex instanceof Int32Array && options.idToIndex.length >= pointCount // permit larger to help reuse - - var data = options.positions - var packed = dataStraightThrough ? data : pool.mallocFloat32(data.length) - var packedId = idStraightThrough ? options.idToIndex : pool.mallocInt32(pointCount) - - if(!dataStraightThrough) { - packed.set(data) - } - - if(!idStraightThrough) { - packed.set(data) - for(i = 0; i < pointCount; i++) { - packedId[i] = i - } - } - - this.points = data - - this.offsetBuffer.update(packed) - this.pickBuffer.update(packedId) - - if(!dataStraightThrough) { - pool.free(packed) - } - - if(!idStraightThrough) { - pool.free(packedId) - } - - this.pointCount = pointCount - this.pickOffset = 0 -} - -function count(points, dataBox) { - var visiblePointCountEstimate = 0 - var length = points.length >>> 1 - var i - for(i = 0; i < length; i++) { - var x = points[i * 2] - var y = points[i * 2 + 1] - if(x >= dataBox[0] && x <= dataBox[2] && y >= dataBox[1] && y <= dataBox[3]) - visiblePointCountEstimate++ - } - return visiblePointCountEstimate -} - -proto.unifiedDraw = (function() { - var MATRIX = [1, 0, 0, - 0, 1, 0, - 0, 0, 1] - var PICK_VEC4 = [0, 0, 0, 0] -return function(pickOffset) { - var pick = pickOffset !== void(0) - - var shader = pick ? this.pickShader : this.shader - var gl = this.plot.gl - var dataBox = this.plot.dataBox - - if(this.pointCount === 0) { - return pickOffset - } - - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - - var visiblePointCountEstimate = count(this.points, dataBox) - var basicPointSize = this.plot.pickPixelRatio * Math.max(Math.min(this.sizeMinCap, this.sizeMin), Math.min(this.sizeMax, this.sizeMax / Math.pow(visiblePointCountEstimate, 0.33333))) - - MATRIX[0] = 2.0 / dataX - MATRIX[4] = 2.0 / dataY - MATRIX[6] = -2.0 * dataBox[0] / dataX - 1.0 - MATRIX[7] = -2.0 * dataBox[1] / dataY - 1.0 - - this.offsetBuffer.bind() - - shader.bind() - shader.attributes.position.pointer() - shader.uniforms.matrix = MATRIX - shader.uniforms.color = this.color - shader.uniforms.borderColor = this.borderColor - shader.uniforms.pointCloud = basicPointSize < 5 - shader.uniforms.pointSize = basicPointSize - shader.uniforms.centerFraction = Math.min(1, Math.max(0, Math.sqrt(1 - this.areaRatio))) - - if(pick) { - - PICK_VEC4[0] = ( pickOffset & 0xff) - PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) - PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) - PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) - - this.pickBuffer.bind() - shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) - shader.uniforms.pickOffset = PICK_VEC4 - this.pickOffset = pickOffset - } - - // Worth switching these off, but we can't make assumptions about other - // renderers, so let's restore it after each draw - var blend = gl.getParameter(gl.BLEND) - var dither = gl.getParameter(gl.DITHER) - - if(blend && !this.blend) - gl.disable(gl.BLEND) - if(dither) - gl.disable(gl.DITHER) - - gl.drawArrays(gl.POINTS, 0, this.pointCount) - - if(blend && !this.blend) - gl.enable(gl.BLEND) - if(dither) - gl.enable(gl.DITHER) - - return pickOffset + this.pointCount -} -})() - -proto.draw = proto.unifiedDraw -proto.drawPick = proto.unifiedDraw - -proto.pick = function(x, y, value) { - var pickOffset = this.pickOffset - var pointCount = this.pointCount - if(value < pickOffset || value >= pickOffset + pointCount) { - return null - } - var pointId = value - pickOffset - var points = this.points - return { - object: this, - pointId: pointId, - dataCoord: [points[2 * pointId], points[2 * pointId + 1] ] - } -} - -function createPointcloud2D(plot, options) { - var gl = plot.gl - var buffer = createBuffer(gl) - var pickBuffer = createBuffer(gl) - var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) - var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) - - var result = new Pointcloud2D(plot, buffer, pickBuffer, shader, pickShader) - result.update(options) - - //Register with plot - plot.addObject(result) - - return result -} +exports.pointVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]) +exports.pointFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\nuniform float pointCloud;\n\nvoid main() {\n float radius;\n vec4 baseColor;\n if(pointCloud != 0.0) { // pointCloud is truthy\n if(centerFraction == 1.0) {\n gl_FragColor = color;\n } else {\n gl_FragColor = mix(borderColor, color, centerFraction);\n }\n } else {\n radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]) +exports.pickVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]) +exports.pickFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"]) + +},{"glslify":395}],281:[function(_dereq_,module,exports){ +'use strict' + +var createShader = _dereq_('gl-shader') +var createBuffer = _dereq_('gl-buffer') + +var pool = _dereq_('typedarray-pool') + +var SHADERS = _dereq_('./lib/shader') + +module.exports = createPointcloud2D + +function Pointcloud2D(plot, offsetBuffer, pickBuffer, shader, pickShader) { + this.plot = plot + this.offsetBuffer = offsetBuffer + this.pickBuffer = pickBuffer + this.shader = shader + this.pickShader = pickShader + this.sizeMin = 0.5 + this.sizeMinCap = 2 + this.sizeMax = 20 + this.areaRatio = 1.0 + this.pointCount = 0 + this.color = [1, 0, 0, 1] + this.borderColor = [0, 0, 0, 1] + this.blend = false + this.pickOffset = 0 + this.points = null +} + +var proto = Pointcloud2D.prototype + +proto.dispose = function() { + this.shader.dispose() + this.pickShader.dispose() + this.offsetBuffer.dispose() + this.pickBuffer.dispose() + this.plot.removeObject(this) +} + +proto.update = function(options) { + + var i + + options = options || {} + + function dflt(opt, value) { + if(opt in options) { + return options[opt] + } + return value + } + + this.sizeMin = dflt('sizeMin', 0.5) + // this.sizeMinCap = dflt('sizeMinCap', 2) + this.sizeMax = dflt('sizeMax', 20) + this.color = dflt('color', [1, 0, 0, 1]).slice() + this.areaRatio = dflt('areaRatio', 1) + this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() + this.blend = dflt('blend', false) + + //Update point data + + // Attempt straight-through processing (STP) to avoid allocation and copy + // TODO eventually abstract out STP logic, maybe into `pool` or a layer above + var pointCount = options.positions.length >>> 1 + var dataStraightThrough = options.positions instanceof Float32Array + var idStraightThrough = options.idToIndex instanceof Int32Array && options.idToIndex.length >= pointCount // permit larger to help reuse + + var data = options.positions + var packed = dataStraightThrough ? data : pool.mallocFloat32(data.length) + var packedId = idStraightThrough ? options.idToIndex : pool.mallocInt32(pointCount) + + if(!dataStraightThrough) { + packed.set(data) + } + + if(!idStraightThrough) { + packed.set(data) + for(i = 0; i < pointCount; i++) { + packedId[i] = i + } + } + + this.points = data + + this.offsetBuffer.update(packed) + this.pickBuffer.update(packedId) + + if(!dataStraightThrough) { + pool.free(packed) + } + + if(!idStraightThrough) { + pool.free(packedId) + } + + this.pointCount = pointCount + this.pickOffset = 0 +} + +function count(points, dataBox) { + var visiblePointCountEstimate = 0 + var length = points.length >>> 1 + var i + for(i = 0; i < length; i++) { + var x = points[i * 2] + var y = points[i * 2 + 1] + if(x >= dataBox[0] && x <= dataBox[2] && y >= dataBox[1] && y <= dataBox[3]) + visiblePointCountEstimate++ + } + return visiblePointCountEstimate +} + +proto.unifiedDraw = (function() { + var MATRIX = [1, 0, 0, + 0, 1, 0, + 0, 0, 1] + var PICK_VEC4 = [0, 0, 0, 0] +return function(pickOffset) { + var pick = pickOffset !== void(0) + + var shader = pick ? this.pickShader : this.shader + var gl = this.plot.gl + var dataBox = this.plot.dataBox + + if(this.pointCount === 0) { + return pickOffset + } + + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] -},{"./lib/shader":278,"gl-buffer":230,"gl-shader":288,"typedarray-pool":521}],280:[function(_dereq_,module,exports){ + var visiblePointCountEstimate = count(this.points, dataBox) + var basicPointSize = this.plot.pickPixelRatio * Math.max(Math.min(this.sizeMinCap, this.sizeMin), Math.min(this.sizeMax, this.sizeMax / Math.pow(visiblePointCountEstimate, 0.33333))) + + MATRIX[0] = 2.0 / dataX + MATRIX[4] = 2.0 / dataY + MATRIX[6] = -2.0 * dataBox[0] / dataX - 1.0 + MATRIX[7] = -2.0 * dataBox[1] / dataY - 1.0 + + this.offsetBuffer.bind() + + shader.bind() + shader.attributes.position.pointer() + shader.uniforms.matrix = MATRIX + shader.uniforms.color = this.color + shader.uniforms.borderColor = this.borderColor + shader.uniforms.pointCloud = basicPointSize < 5 + shader.uniforms.pointSize = basicPointSize + shader.uniforms.centerFraction = Math.min(1, Math.max(0, Math.sqrt(1 - this.areaRatio))) + + if(pick) { + + PICK_VEC4[0] = ( pickOffset & 0xff) + PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) + PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) + PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) + + this.pickBuffer.bind() + shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) + shader.uniforms.pickOffset = PICK_VEC4 + this.pickOffset = pickOffset + } + + // Worth switching these off, but we can't make assumptions about other + // renderers, so let's restore it after each draw + var blend = gl.getParameter(gl.BLEND) + var dither = gl.getParameter(gl.DITHER) + + if(blend && !this.blend) + gl.disable(gl.BLEND) + if(dither) + gl.disable(gl.DITHER) + + gl.drawArrays(gl.POINTS, 0, this.pointCount) + + if(blend && !this.blend) + gl.enable(gl.BLEND) + if(dither) + gl.enable(gl.DITHER) + + return pickOffset + this.pointCount +} +})() + +proto.draw = proto.unifiedDraw +proto.drawPick = proto.unifiedDraw + +proto.pick = function(x, y, value) { + var pickOffset = this.pickOffset + var pointCount = this.pointCount + if(value < pickOffset || value >= pickOffset + pointCount) { + return null + } + var pointId = value - pickOffset + var points = this.points + return { + object: this, + pointId: pointId, + dataCoord: [points[2 * pointId], points[2 * pointId + 1] ] + } +} + +function createPointcloud2D(plot, options) { + var gl = plot.gl + var buffer = createBuffer(gl) + var pickBuffer = createBuffer(gl) + var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) + var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) + + var result = new Pointcloud2D(plot, buffer, pickBuffer, shader, pickShader) + result.update(options) + + //Register with plot + plot.addObject(result) + + return result +} + +},{"./lib/shader":280,"gl-buffer":231,"gl-shader":290,"typedarray-pool":523}],282:[function(_dereq_,module,exports){ module.exports = slerp /** @@ -73893,14 +73938,14 @@ return out } -},{}],281:[function(_dereq_,module,exports){ +},{}],283:[function(_dereq_,module,exports){ 'use strict'; module.exports = function(a){ return (!a && a !== 0) ? '' : a.toString(); } -},{}],282:[function(_dereq_,module,exports){ +},{}],284:[function(_dereq_,module,exports){ "use strict" var vectorizeText = _dereq_("vectorize-text") @@ -73953,14 +73998,14 @@ //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":526}],283:[function(_dereq_,module,exports){ +},{"vectorize-text":528}],285:[function(_dereq_,module,exports){ var createShaderWrapper = _dereq_('gl-shader') var glslify = _dereq_('glslify') var perspectiveVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}"]) var orthographicVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n\n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}"]) var projectionVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n"]) -var drawFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\n\n gl_FragColor = interpColor * opacity;\n}\n"]) +var drawFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (\n outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||\n interpColor.a * opacity == 0.\n ) discard;\n gl_FragColor = interpColor * opacity;\n}\n"]) var pickFragSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\n\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n}"]) var ATTRIBUTES = [ @@ -74030,7 +74075,7 @@ return createShader(gl, pickProject) } -},{"gl-shader":288,"glslify":392}],284:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],286:[function(_dereq_,module,exports){ 'use strict' var isAllBlank = _dereq_('is-string-blank') @@ -74067,24 +74112,14 @@ return transformMat4(x, x, p) } -function clampVec(v) { - var result = new Array(3) - for(var i=0; i<3; ++i) { - result[i] = Math.min(Math.max(v[i], -1e8), 1e8) - } - return result -} - function ScatterPlotPickResult(index, position) { this.index = index this.dataCoordinate = this.position = position } -var MAX_OPACITY = 1 - function fixOpacity(a) { - if(a === true) return MAX_OPACITY - if(a > MAX_OPACITY) return MAX_OPACITY + if(a === true) return 1 + if(a > 1) return 1 return a } @@ -74118,11 +74153,13 @@ this.vertexCount = 0 this.lineVertexCount = 0 - this.opacity = MAX_OPACITY + this.opacity = 1 + this.hasAlpha = false this.lineWidth = 0 this.projectScale = [2.0/3.0, 2.0/3.0, 2.0/3.0] - this.projectOpacity = [MAX_OPACITY, MAX_OPACITY, MAX_OPACITY] + this.projectOpacity = [1, 1, 1] + this.projectHasAlpha = false this.pickId = 0 this.pickPerspectiveShader = pickPerspectiveShader @@ -74159,11 +74196,11 @@ } proto.isTransparent = function() { - if(this.opacity < MAX_OPACITY) { + if(this.hasAlpha) { return true } for(var i=0; i<3; ++i) { - if(this.axesProject[i] && this.projectOpacity[i] < MAX_OPACITY) { + if(this.axesProject[i] && this.projectHasAlpha) { return true } } @@ -74171,11 +74208,11 @@ } proto.isOpaque = function() { - if(this.opacity >= MAX_OPACITY) { + if(!this.hasAlpha) { return true } for(var i=0; i<3; ++i) { - if(this.axesProject[i] && this.projectOpacity[i] >= MAX_OPACITY) { + if(this.axesProject[i] && !this.projectHasAlpha) { return true } } @@ -74344,13 +74381,11 @@ function drawFull(shader, pshader, points, camera, transparent, forceDraw) { var gl = points.gl - - - if(transparent === (points.projectOpacity < MAX_OPACITY) || forceDraw) { + if(transparent === points.projectHasAlpha || forceDraw) { drawProject(pshader, points, camera) } - if(transparent === (points.opacity < MAX_OPACITY) || forceDraw) { + if(transparent === points.hasAlpha || forceDraw) { shader.bind() var uniforms = shader.uniforms @@ -74501,6 +74536,8 @@ this.projectScale = [s,s,s] } } + + this.projectHasAlpha = false // default to no transparent draw if('projectOpacity' in options) { if(Array.isArray(options.projectOpacity)) { this.projectOpacity = options.projectOpacity.slice() @@ -74510,10 +74547,18 @@ } for(var i=0; i<3; ++i) { this.projectOpacity[i] = fixOpacity(this.projectOpacity[i]); + if(this.projectOpacity[i] < 1) { + this.projectHasAlpha = true; + } } } + + this.hasAlpha = false // default to no transparent draw if('opacity' in options) { this.opacity = fixOpacity(options.opacity) + if(this.opacity < 1) { + this.hasAlpha = true; + } } //Set dirty flag @@ -74647,6 +74692,7 @@ for(var j=0; j<4; ++j) { color[j] = c[j] } + if(!this.hasAlpha && c[3] < 1) this.hasAlpha = true } } else { color[0] = color[1] = color[2] = 0 @@ -74677,6 +74723,7 @@ for(var j=0; j<4; ++j) { lineColor[j] = c[j] } + if(!this.hasAlpha && c[3] < 1) this.hasAlpha = true } } else { lineColor[0] = lineColor[1] = lineColor[2] = 0 @@ -74900,141 +74947,141 @@ return pointCloud } -},{"./lib/get-simple-string":281,"./lib/glyphs":282,"./lib/shaders":283,"gl-buffer":230,"gl-mat4/multiply":256,"gl-vao":310,"is-string-blank":406,"typedarray-pool":521}],285:[function(_dereq_,module,exports){ -'use strict' - -var glslify = _dereq_('glslify') - -exports.boxVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]) -exports.boxFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"]) +},{"./lib/get-simple-string":283,"./lib/glyphs":284,"./lib/shaders":285,"gl-buffer":231,"gl-mat4/multiply":258,"gl-vao":313,"is-string-blank":409,"typedarray-pool":523}],287:[function(_dereq_,module,exports){ +'use strict' -},{"glslify":392}],286:[function(_dereq_,module,exports){ -'use strict' - -var createShader = _dereq_('gl-shader') -var createBuffer = _dereq_('gl-buffer') - -var SHADERS = _dereq_('./lib/shaders') - -module.exports = createSelectBox - -function SelectBox(plot, boxBuffer, boxShader) { - this.plot = plot - this.boxBuffer = boxBuffer - this.boxShader = boxShader - - this.enabled = true - - this.selectBox = [Infinity,Infinity,-Infinity,-Infinity] - - this.borderColor = [0,0,0,1] - this.innerFill = false - this.innerColor = [0,0,0,0.25] - this.outerFill = true - this.outerColor = [0,0,0,0.5] - this.borderWidth = 10 -} - -var proto = SelectBox.prototype - -proto.draw = function() { - if(!this.enabled) { - return - } - - var plot = this.plot - var selectBox = this.selectBox - var lineWidth = this.borderWidth - - var innerFill = this.innerFill - var innerColor = this.innerColor - var outerFill = this.outerFill - var outerColor = this.outerColor - var borderColor = this.borderColor - - var boxes = plot.box - var screenBox = plot.screenBox - var dataBox = plot.dataBox - var viewBox = plot.viewBox - var pixelRatio = plot.pixelRatio - - //Map select box into pixel coordinates - var loX = (selectBox[0]-dataBox[0])*(viewBox[2]-viewBox[0])/(dataBox[2]-dataBox[0])+viewBox[0] - var loY = (selectBox[1]-dataBox[1])*(viewBox[3]-viewBox[1])/(dataBox[3]-dataBox[1])+viewBox[1] - var hiX = (selectBox[2]-dataBox[0])*(viewBox[2]-viewBox[0])/(dataBox[2]-dataBox[0])+viewBox[0] - var hiY = (selectBox[3]-dataBox[1])*(viewBox[3]-viewBox[1])/(dataBox[3]-dataBox[1])+viewBox[1] - - loX = Math.max(loX, viewBox[0]) - loY = Math.max(loY, viewBox[1]) - hiX = Math.min(hiX, viewBox[2]) - hiY = Math.min(hiY, viewBox[3]) - - if(hiX < loX || hiY < loY) { - return - } - - boxes.bind() - - //Draw box - var screenWidth = screenBox[2] - screenBox[0] - var screenHeight = screenBox[3] - screenBox[1] - - if(this.outerFill) { - boxes.drawBox(0, 0, screenWidth, loY, outerColor) - boxes.drawBox(0, loY, loX, hiY, outerColor) - boxes.drawBox(0, hiY, screenWidth, screenHeight, outerColor) - boxes.drawBox(hiX, loY, screenWidth, hiY, outerColor) - } - - if(this.innerFill) { - boxes.drawBox(loX, loY, hiX, hiY, innerColor) - } - - //Draw border - if(lineWidth > 0) { - - //Draw border - var w = lineWidth * pixelRatio - boxes.drawBox(loX-w, loY-w, hiX+w, loY+w, borderColor) - boxes.drawBox(loX-w, hiY-w, hiX+w, hiY+w, borderColor) - boxes.drawBox(loX-w, loY-w, loX+w, hiY+w, borderColor) - boxes.drawBox(hiX-w, loY-w, hiX+w, hiY+w, borderColor) - } -} - -proto.update = function(options) { - options = options || {} - - this.innerFill = !!options.innerFill - this.outerFill = !!options.outerFill - this.innerColor = (options.innerColor || [0,0,0,0.5]).slice() - this.outerColor = (options.outerColor || [0,0,0,0.5]).slice() - this.borderColor = (options.borderColor || [0,0,0,1]).slice() - this.borderWidth = options.borderWidth || 0 - this.selectBox = (options.selectBox || this.selectBox).slice() -} - -proto.dispose = function() { - this.boxBuffer.dispose() - this.boxShader.dispose() - this.plot.removeOverlay(this) -} - -function createSelectBox(plot, options) { - var gl = plot.gl - var buffer = createBuffer(gl, [ - 0, 0, - 0, 1, - 1, 0, - 1, 1 ]) - var shader = createShader(gl, SHADERS.boxVertex, SHADERS.boxFragment) - var selectBox = new SelectBox(plot, buffer, shader) - selectBox.update(options) - plot.addOverlay(selectBox) - return selectBox -} +var glslify = _dereq_('glslify') + +exports.boxVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]) +exports.boxFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"]) + +},{"glslify":395}],288:[function(_dereq_,module,exports){ +'use strict' + +var createShader = _dereq_('gl-shader') +var createBuffer = _dereq_('gl-buffer') + +var SHADERS = _dereq_('./lib/shaders') + +module.exports = createSelectBox + +function SelectBox(plot, boxBuffer, boxShader) { + this.plot = plot + this.boxBuffer = boxBuffer + this.boxShader = boxShader + + this.enabled = true + + this.selectBox = [Infinity,Infinity,-Infinity,-Infinity] + + this.borderColor = [0,0,0,1] + this.innerFill = false + this.innerColor = [0,0,0,0.25] + this.outerFill = true + this.outerColor = [0,0,0,0.5] + this.borderWidth = 10 +} + +var proto = SelectBox.prototype + +proto.draw = function() { + if(!this.enabled) { + return + } + + var plot = this.plot + var selectBox = this.selectBox + var lineWidth = this.borderWidth + + var innerFill = this.innerFill + var innerColor = this.innerColor + var outerFill = this.outerFill + var outerColor = this.outerColor + var borderColor = this.borderColor + + var boxes = plot.box + var screenBox = plot.screenBox + var dataBox = plot.dataBox + var viewBox = plot.viewBox + var pixelRatio = plot.pixelRatio + + //Map select box into pixel coordinates + var loX = (selectBox[0]-dataBox[0])*(viewBox[2]-viewBox[0])/(dataBox[2]-dataBox[0])+viewBox[0] + var loY = (selectBox[1]-dataBox[1])*(viewBox[3]-viewBox[1])/(dataBox[3]-dataBox[1])+viewBox[1] + var hiX = (selectBox[2]-dataBox[0])*(viewBox[2]-viewBox[0])/(dataBox[2]-dataBox[0])+viewBox[0] + var hiY = (selectBox[3]-dataBox[1])*(viewBox[3]-viewBox[1])/(dataBox[3]-dataBox[1])+viewBox[1] + + loX = Math.max(loX, viewBox[0]) + loY = Math.max(loY, viewBox[1]) + hiX = Math.min(hiX, viewBox[2]) + hiY = Math.min(hiY, viewBox[3]) + + if(hiX < loX || hiY < loY) { + return + } + + boxes.bind() + + //Draw box + var screenWidth = screenBox[2] - screenBox[0] + var screenHeight = screenBox[3] - screenBox[1] + + if(this.outerFill) { + boxes.drawBox(0, 0, screenWidth, loY, outerColor) + boxes.drawBox(0, loY, loX, hiY, outerColor) + boxes.drawBox(0, hiY, screenWidth, screenHeight, outerColor) + boxes.drawBox(hiX, loY, screenWidth, hiY, outerColor) + } + + if(this.innerFill) { + boxes.drawBox(loX, loY, hiX, hiY, innerColor) + } + + //Draw border + if(lineWidth > 0) { + + //Draw border + var w = lineWidth * pixelRatio + boxes.drawBox(loX-w, loY-w, hiX+w, loY+w, borderColor) + boxes.drawBox(loX-w, hiY-w, hiX+w, hiY+w, borderColor) + boxes.drawBox(loX-w, loY-w, loX+w, hiY+w, borderColor) + boxes.drawBox(hiX-w, loY-w, hiX+w, hiY+w, borderColor) + } +} + +proto.update = function(options) { + options = options || {} + + this.innerFill = !!options.innerFill + this.outerFill = !!options.outerFill + this.innerColor = (options.innerColor || [0,0,0,0.5]).slice() + this.outerColor = (options.outerColor || [0,0,0,0.5]).slice() + this.borderColor = (options.borderColor || [0,0,0,1]).slice() + this.borderWidth = options.borderWidth || 0 + this.selectBox = (options.selectBox || this.selectBox).slice() +} + +proto.dispose = function() { + this.boxBuffer.dispose() + this.boxShader.dispose() + this.plot.removeOverlay(this) +} + +function createSelectBox(plot, options) { + var gl = plot.gl + var buffer = createBuffer(gl, [ + 0, 0, + 0, 1, + 1, 0, + 1, 1 ]) + var shader = createShader(gl, SHADERS.boxVertex, SHADERS.boxFragment) + var selectBox = new SelectBox(plot, buffer, shader) + selectBox.update(options) + plot.addOverlay(selectBox) + return selectBox +} -},{"./lib/shaders":285,"gl-buffer":230,"gl-shader":288}],287:[function(_dereq_,module,exports){ +},{"./lib/shaders":287,"gl-buffer":231,"gl-shader":290}],289:[function(_dereq_,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -75189,7 +75236,7 @@ return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":80,"cwise/lib/wrapper":137,"gl-fbo":239,"ndarray":433,"typedarray-pool":521}],288:[function(_dereq_,module,exports){ +},{"bit-twiddle":81,"cwise/lib/wrapper":138,"gl-fbo":240,"ndarray":436,"typedarray-pool":523}],290:[function(_dereq_,module,exports){ 'use strict' var createUniformWrapper = _dereq_('./lib/create-uniforms') @@ -75455,7 +75502,7 @@ module.exports = createShader -},{"./lib/GLError":289,"./lib/create-attributes":290,"./lib/create-uniforms":291,"./lib/reflect":292,"./lib/runtime-reflect":293,"./lib/shader-cache":294}],289:[function(_dereq_,module,exports){ +},{"./lib/GLError":291,"./lib/create-attributes":292,"./lib/create-uniforms":293,"./lib/reflect":294,"./lib/runtime-reflect":295,"./lib/shader-cache":296}],291:[function(_dereq_,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -75470,7 +75517,7 @@ GLError.prototype.constructor = GLError module.exports = GLError -},{}],290:[function(_dereq_,module,exports){ +},{}],292:[function(_dereq_,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -75735,7 +75782,7 @@ return obj } -},{"./GLError":289}],291:[function(_dereq_,module,exports){ +},{"./GLError":291}],293:[function(_dereq_,module,exports){ 'use strict' var coallesceUniforms = _dereq_('./reflect') @@ -75928,7 +75975,7 @@ } } -},{"./GLError":289,"./reflect":292}],292:[function(_dereq_,module,exports){ +},{"./GLError":291,"./reflect":294}],294:[function(_dereq_,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -75986,7 +76033,7 @@ } return obj } -},{}],293:[function(_dereq_,module,exports){ +},{}],295:[function(_dereq_,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -76066,7 +76113,7 @@ return result } -},{}],294:[function(_dereq_,module,exports){ +},{}],296:[function(_dereq_,module,exports){ 'use strict' exports.shader = getShaderReference @@ -76204,7 +76251,7 @@ return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":289,"gl-format-compiler-error":240,"weakmap-shim":531}],295:[function(_dereq_,module,exports){ +},{"./GLError":291,"gl-format-compiler-error":241,"weakmap-shim":533}],297:[function(_dereq_,module,exports){ 'use strict' module.exports = createSpikes2D @@ -76292,7 +76339,7 @@ return spikes } -},{}],296:[function(_dereq_,module,exports){ +},{}],298:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -76309,7 +76356,7 @@ ]) } -},{"gl-shader":288,"glslify":392}],297:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],299:[function(_dereq_,module,exports){ 'use strict' var createBuffer = _dereq_('gl-buffer') @@ -76505,9 +76552,9 @@ return spikes } -},{"./shaders/index":296,"gl-buffer":230,"gl-vao":310}],298:[function(_dereq_,module,exports){ -arguments[4][232][0].apply(exports,arguments) -},{"barycentric":61,"dup":232,"polytope-closest-point/lib/closest_point_2d.js":464}],299:[function(_dereq_,module,exports){ +},{"./shaders/index":298,"gl-buffer":231,"gl-vao":313}],300:[function(_dereq_,module,exports){ +arguments[4][233][0].apply(exports,arguments) +},{"barycentric":62,"dup":233,"polytope-closest-point/lib/closest_point_2d.js":467}],301:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float tubeScale;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n gl_Position = projection * view * tubePosition;\n f_color = color;\n f_normal = normal;\n f_data = tubePosition.xyz;\n f_position = position.xyz;\n f_eyeDirection = eyePosition - tubePosition.xyz;\n f_lightDirection = lightPosition - tubePosition.xyz;\n f_uv = uv;\n}\n"]) @@ -76536,7 +76583,7 @@ ] } -},{"glslify":392}],300:[function(_dereq_,module,exports){ +},{"glslify":395}],302:[function(_dereq_,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -77564,7 +77611,7 @@ module.exports = createSimplicialMesh -},{"./closest-point":298,"./shaders":299,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":288,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"normals":436,"simplicial-complex-contour":494,"typedarray-pool":521}],301:[function(_dereq_,module,exports){ +},{"./closest-point":300,"./shaders":301,"colormap":115,"gl-buffer":231,"gl-mat4/invert":256,"gl-mat4/multiply":258,"gl-shader":290,"gl-texture2d":308,"gl-vao":313,"ndarray":436,"normals":439,"simplicial-complex-contour":496,"typedarray-pool":523}],303:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -78052,7 +78099,7 @@ module.exports.createTubeMesh = _dereq_('./lib/tubemesh'); -},{"./lib/tubemesh":300,"gl-vec3":329,"gl-vec4":365}],302:[function(_dereq_,module,exports){ +},{"./lib/tubemesh":302,"gl-vec3":332,"gl-vec4":368}],304:[function(_dereq_,module,exports){ var createShader = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -78102,7 +78149,9 @@ return shader } -},{"gl-shader":288,"glslify":392}],303:[function(_dereq_,module,exports){ +},{"gl-shader":290,"glslify":395}],305:[function(_dereq_,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],306:[function(_dereq_,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -79461,7 +79510,7 @@ return surface } -},{"./lib/shaders":302,"binary-search-bounds":79,"bit-twiddle":80,"colormap":114,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-texture2d":305,"gl-vao":310,"ndarray":433,"ndarray-gradient":424,"ndarray-ops":427,"ndarray-pack":428,"surface-nets":507,"typedarray-pool":521}],304:[function(_dereq_,module,exports){ +},{"./lib/shaders":304,"binary-search-bounds":305,"bit-twiddle":81,"colormap":115,"gl-buffer":231,"gl-mat4/invert":256,"gl-mat4/multiply":258,"gl-texture2d":308,"gl-vao":313,"ndarray":436,"ndarray-gradient":427,"ndarray-ops":430,"ndarray-pack":431,"surface-nets":509,"typedarray-pool":523}],307:[function(_dereq_,module,exports){ 'use strict' var Font = _dereq_('css-font') @@ -80189,7 +80238,7 @@ module.exports = GlText -},{"bit-twiddle":80,"color-normalize":108,"css-font":127,"detect-kerning":151,"es6-weak-map":209,"flatten-vertex-data":216,"font-atlas":217,"font-measure":218,"gl-util/context":306,"is-plain-obj":405,"object-assign":437,"parse-rect":442,"parse-unit":444,"pick-by-alias":448,"regl":478,"to-px":515,"typedarray-pool":521}],305:[function(_dereq_,module,exports){ +},{"bit-twiddle":81,"color-normalize":109,"css-font":128,"detect-kerning":152,"es6-weak-map":210,"flatten-vertex-data":217,"font-atlas":218,"font-measure":219,"gl-util/context":309,"is-plain-obj":408,"object-assign":440,"parse-rect":445,"parse-unit":447,"pick-by-alias":451,"regl":480,"to-px":517,"typedarray-pool":523}],308:[function(_dereq_,module,exports){ 'use strict' var ndarray = _dereq_('ndarray') @@ -80752,7 +80801,7 @@ throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":433,"ndarray-ops":427,"typedarray-pool":521}],306:[function(_dereq_,module,exports){ +},{"ndarray":436,"ndarray-ops":430,"typedarray-pool":523}],309:[function(_dereq_,module,exports){ /** @module gl-util/context */ 'use strict' @@ -80869,7 +80918,7 @@ typeof e.drawElements === 'function' } -},{"pick-by-alias":448}],307:[function(_dereq_,module,exports){ +},{"pick-by-alias":451}],310:[function(_dereq_,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -80924,7 +80973,7 @@ } module.exports = doBind -},{}],308:[function(_dereq_,module,exports){ +},{}],311:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -80964,7 +81013,7 @@ } module.exports = createVAOEmulated -},{"./do-bind.js":307}],309:[function(_dereq_,module,exports){ +},{"./do-bind.js":310}],312:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -81052,7 +81101,7 @@ } module.exports = createVAONative -},{"./do-bind.js":307}],310:[function(_dereq_,module,exports){ +},{"./do-bind.js":310}],313:[function(_dereq_,module,exports){ "use strict" var createVAONative = _dereq_("./lib/vao-native.js") @@ -81081,7 +81130,7 @@ module.exports = createVAO -},{"./lib/vao-emulated.js":308,"./lib/vao-native.js":309}],311:[function(_dereq_,module,exports){ +},{"./lib/vao-emulated.js":311,"./lib/vao-native.js":312}],314:[function(_dereq_,module,exports){ module.exports = add; /** @@ -81098,7 +81147,7 @@ out[2] = a[2] + b[2] return out } -},{}],312:[function(_dereq_,module,exports){ +},{}],315:[function(_dereq_,module,exports){ module.exports = angle var fromValues = _dereq_('./fromValues') @@ -81127,7 +81176,7 @@ } } -},{"./dot":322,"./fromValues":328,"./normalize":339}],313:[function(_dereq_,module,exports){ +},{"./dot":325,"./fromValues":331,"./normalize":342}],316:[function(_dereq_,module,exports){ module.exports = ceil /** @@ -81144,7 +81193,7 @@ return out } -},{}],314:[function(_dereq_,module,exports){ +},{}],317:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -81160,7 +81209,7 @@ out[2] = a[2] return out } -},{}],315:[function(_dereq_,module,exports){ +},{}],318:[function(_dereq_,module,exports){ module.exports = copy; /** @@ -81176,7 +81225,7 @@ out[2] = a[2] return out } -},{}],316:[function(_dereq_,module,exports){ +},{}],319:[function(_dereq_,module,exports){ module.exports = create; /** @@ -81191,7 +81240,7 @@ out[2] = 0 return out } -},{}],317:[function(_dereq_,module,exports){ +},{}],320:[function(_dereq_,module,exports){ module.exports = cross; /** @@ -81211,10 +81260,10 @@ out[2] = ax * by - ay * bx return out } -},{}],318:[function(_dereq_,module,exports){ +},{}],321:[function(_dereq_,module,exports){ module.exports = _dereq_('./distance') -},{"./distance":319}],319:[function(_dereq_,module,exports){ +},{"./distance":322}],322:[function(_dereq_,module,exports){ module.exports = distance; /** @@ -81230,10 +81279,10 @@ z = b[2] - a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],320:[function(_dereq_,module,exports){ +},{}],323:[function(_dereq_,module,exports){ module.exports = _dereq_('./divide') -},{"./divide":321}],321:[function(_dereq_,module,exports){ +},{"./divide":324}],324:[function(_dereq_,module,exports){ module.exports = divide; /** @@ -81250,7 +81299,7 @@ out[2] = a[2] / b[2] return out } -},{}],322:[function(_dereq_,module,exports){ +},{}],325:[function(_dereq_,module,exports){ module.exports = dot; /** @@ -81263,10 +81312,10 @@ function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } -},{}],323:[function(_dereq_,module,exports){ +},{}],326:[function(_dereq_,module,exports){ module.exports = 0.000001 -},{}],324:[function(_dereq_,module,exports){ +},{}],327:[function(_dereq_,module,exports){ module.exports = equals var EPSILON = _dereq_('./epsilon') @@ -81290,7 +81339,7 @@ Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))) } -},{"./epsilon":323}],325:[function(_dereq_,module,exports){ +},{"./epsilon":326}],328:[function(_dereq_,module,exports){ module.exports = exactEquals /** @@ -81304,7 +81353,7 @@ return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] } -},{}],326:[function(_dereq_,module,exports){ +},{}],329:[function(_dereq_,module,exports){ module.exports = floor /** @@ -81321,7 +81370,7 @@ return out } -},{}],327:[function(_dereq_,module,exports){ +},{}],330:[function(_dereq_,module,exports){ module.exports = forEach; var vec = _dereq_('./create')() @@ -81366,7 +81415,7 @@ return a } -},{"./create":316}],328:[function(_dereq_,module,exports){ +},{"./create":319}],331:[function(_dereq_,module,exports){ module.exports = fromValues; /** @@ -81384,7 +81433,7 @@ out[2] = z return out } -},{}],329:[function(_dereq_,module,exports){ +},{}],332:[function(_dereq_,module,exports){ module.exports = { EPSILON: _dereq_('./epsilon') , create: _dereq_('./create') @@ -81433,7 +81482,7 @@ , forEach: _dereq_('./forEach') } -},{"./add":311,"./angle":312,"./ceil":313,"./clone":314,"./copy":315,"./create":316,"./cross":317,"./dist":318,"./distance":319,"./div":320,"./divide":321,"./dot":322,"./epsilon":323,"./equals":324,"./exactEquals":325,"./floor":326,"./forEach":327,"./fromValues":328,"./inverse":330,"./len":331,"./length":332,"./lerp":333,"./max":334,"./min":335,"./mul":336,"./multiply":337,"./negate":338,"./normalize":339,"./random":340,"./rotateX":341,"./rotateY":342,"./rotateZ":343,"./round":344,"./scale":345,"./scaleAndAdd":346,"./set":347,"./sqrDist":348,"./sqrLen":349,"./squaredDistance":350,"./squaredLength":351,"./sub":352,"./subtract":353,"./transformMat3":354,"./transformMat4":355,"./transformQuat":356}],330:[function(_dereq_,module,exports){ +},{"./add":314,"./angle":315,"./ceil":316,"./clone":317,"./copy":318,"./create":319,"./cross":320,"./dist":321,"./distance":322,"./div":323,"./divide":324,"./dot":325,"./epsilon":326,"./equals":327,"./exactEquals":328,"./floor":329,"./forEach":330,"./fromValues":331,"./inverse":333,"./len":334,"./length":335,"./lerp":336,"./max":337,"./min":338,"./mul":339,"./multiply":340,"./negate":341,"./normalize":342,"./random":343,"./rotateX":344,"./rotateY":345,"./rotateZ":346,"./round":347,"./scale":348,"./scaleAndAdd":349,"./set":350,"./sqrDist":351,"./sqrLen":352,"./squaredDistance":353,"./squaredLength":354,"./sub":355,"./subtract":356,"./transformMat3":357,"./transformMat4":358,"./transformQuat":359}],333:[function(_dereq_,module,exports){ module.exports = inverse; /** @@ -81449,10 +81498,10 @@ out[2] = 1.0 / a[2] return out } -},{}],331:[function(_dereq_,module,exports){ +},{}],334:[function(_dereq_,module,exports){ module.exports = _dereq_('./length') -},{"./length":332}],332:[function(_dereq_,module,exports){ +},{"./length":335}],335:[function(_dereq_,module,exports){ module.exports = length; /** @@ -81467,7 +81516,7 @@ z = a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],333:[function(_dereq_,module,exports){ +},{}],336:[function(_dereq_,module,exports){ module.exports = lerp; /** @@ -81488,7 +81537,7 @@ out[2] = az + t * (b[2] - az) return out } -},{}],334:[function(_dereq_,module,exports){ +},{}],337:[function(_dereq_,module,exports){ module.exports = max; /** @@ -81505,7 +81554,7 @@ out[2] = Math.max(a[2], b[2]) return out } -},{}],335:[function(_dereq_,module,exports){ +},{}],338:[function(_dereq_,module,exports){ module.exports = min; /** @@ -81522,10 +81571,10 @@ out[2] = Math.min(a[2], b[2]) return out } -},{}],336:[function(_dereq_,module,exports){ +},{}],339:[function(_dereq_,module,exports){ module.exports = _dereq_('./multiply') -},{"./multiply":337}],337:[function(_dereq_,module,exports){ +},{"./multiply":340}],340:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -81542,7 +81591,7 @@ out[2] = a[2] * b[2] return out } -},{}],338:[function(_dereq_,module,exports){ +},{}],341:[function(_dereq_,module,exports){ module.exports = negate; /** @@ -81558,7 +81607,7 @@ out[2] = -a[2] return out } -},{}],339:[function(_dereq_,module,exports){ +},{}],342:[function(_dereq_,module,exports){ module.exports = normalize; /** @@ -81582,7 +81631,7 @@ } return out } -},{}],340:[function(_dereq_,module,exports){ +},{}],343:[function(_dereq_,module,exports){ module.exports = random; /** @@ -81604,7 +81653,7 @@ out[2] = z * scale return out } -},{}],341:[function(_dereq_,module,exports){ +},{}],344:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -81634,7 +81683,7 @@ return out } -},{}],342:[function(_dereq_,module,exports){ +},{}],345:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -81664,7 +81713,7 @@ return out } -},{}],343:[function(_dereq_,module,exports){ +},{}],346:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -81694,7 +81743,7 @@ return out } -},{}],344:[function(_dereq_,module,exports){ +},{}],347:[function(_dereq_,module,exports){ module.exports = round /** @@ -81711,7 +81760,7 @@ return out } -},{}],345:[function(_dereq_,module,exports){ +},{}],348:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -81728,7 +81777,7 @@ out[2] = a[2] * b return out } -},{}],346:[function(_dereq_,module,exports){ +},{}],349:[function(_dereq_,module,exports){ module.exports = scaleAndAdd; /** @@ -81746,7 +81795,7 @@ out[2] = a[2] + (b[2] * scale) return out } -},{}],347:[function(_dereq_,module,exports){ +},{}],350:[function(_dereq_,module,exports){ module.exports = set; /** @@ -81764,13 +81813,13 @@ out[2] = z return out } -},{}],348:[function(_dereq_,module,exports){ +},{}],351:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredDistance') -},{"./squaredDistance":350}],349:[function(_dereq_,module,exports){ +},{"./squaredDistance":353}],352:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredLength') -},{"./squaredLength":351}],350:[function(_dereq_,module,exports){ +},{"./squaredLength":354}],353:[function(_dereq_,module,exports){ module.exports = squaredDistance; /** @@ -81786,7 +81835,7 @@ z = b[2] - a[2] return x*x + y*y + z*z } -},{}],351:[function(_dereq_,module,exports){ +},{}],354:[function(_dereq_,module,exports){ module.exports = squaredLength; /** @@ -81801,10 +81850,10 @@ z = a[2] return x*x + y*y + z*z } -},{}],352:[function(_dereq_,module,exports){ +},{}],355:[function(_dereq_,module,exports){ module.exports = _dereq_('./subtract') -},{"./subtract":353}],353:[function(_dereq_,module,exports){ +},{"./subtract":356}],356:[function(_dereq_,module,exports){ module.exports = subtract; /** @@ -81821,7 +81870,7 @@ out[2] = a[2] - b[2] return out } -},{}],354:[function(_dereq_,module,exports){ +},{}],357:[function(_dereq_,module,exports){ module.exports = transformMat3; /** @@ -81839,7 +81888,7 @@ out[2] = x * m[2] + y * m[5] + z * m[8] return out } -},{}],355:[function(_dereq_,module,exports){ +},{}],358:[function(_dereq_,module,exports){ module.exports = transformMat4; /** @@ -81860,7 +81909,7 @@ out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w return out } -},{}],356:[function(_dereq_,module,exports){ +},{}],359:[function(_dereq_,module,exports){ module.exports = transformQuat; /** @@ -81889,7 +81938,7 @@ out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx return out } -},{}],357:[function(_dereq_,module,exports){ +},{}],360:[function(_dereq_,module,exports){ module.exports = add /** @@ -81908,7 +81957,7 @@ return out } -},{}],358:[function(_dereq_,module,exports){ +},{}],361:[function(_dereq_,module,exports){ module.exports = clone /** @@ -81926,7 +81975,7 @@ return out } -},{}],359:[function(_dereq_,module,exports){ +},{}],362:[function(_dereq_,module,exports){ module.exports = copy /** @@ -81944,7 +81993,7 @@ return out } -},{}],360:[function(_dereq_,module,exports){ +},{}],363:[function(_dereq_,module,exports){ module.exports = create /** @@ -81961,7 +82010,7 @@ return out } -},{}],361:[function(_dereq_,module,exports){ +},{}],364:[function(_dereq_,module,exports){ module.exports = distance /** @@ -81979,7 +82028,7 @@ return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],362:[function(_dereq_,module,exports){ +},{}],365:[function(_dereq_,module,exports){ module.exports = divide /** @@ -81998,7 +82047,7 @@ return out } -},{}],363:[function(_dereq_,module,exports){ +},{}],366:[function(_dereq_,module,exports){ module.exports = dot /** @@ -82012,7 +82061,7 @@ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] } -},{}],364:[function(_dereq_,module,exports){ +},{}],367:[function(_dereq_,module,exports){ module.exports = fromValues /** @@ -82033,7 +82082,7 @@ return out } -},{}],365:[function(_dereq_,module,exports){ +},{}],368:[function(_dereq_,module,exports){ module.exports = { create: _dereq_('./create'), clone: _dereq_('./clone'), @@ -82062,7 +82111,7 @@ transformQuat: _dereq_('./transformQuat') } -},{"./add":357,"./clone":358,"./copy":359,"./create":360,"./distance":361,"./divide":362,"./dot":363,"./fromValues":364,"./inverse":366,"./length":367,"./lerp":368,"./max":369,"./min":370,"./multiply":371,"./negate":372,"./normalize":373,"./random":374,"./scale":375,"./scaleAndAdd":376,"./set":377,"./squaredDistance":378,"./squaredLength":379,"./subtract":380,"./transformMat4":381,"./transformQuat":382}],366:[function(_dereq_,module,exports){ +},{"./add":360,"./clone":361,"./copy":362,"./create":363,"./distance":364,"./divide":365,"./dot":366,"./fromValues":367,"./inverse":369,"./length":370,"./lerp":371,"./max":372,"./min":373,"./multiply":374,"./negate":375,"./normalize":376,"./random":377,"./scale":378,"./scaleAndAdd":379,"./set":380,"./squaredDistance":381,"./squaredLength":382,"./subtract":383,"./transformMat4":384,"./transformQuat":385}],369:[function(_dereq_,module,exports){ module.exports = inverse /** @@ -82080,7 +82129,7 @@ return out } -},{}],367:[function(_dereq_,module,exports){ +},{}],370:[function(_dereq_,module,exports){ module.exports = length /** @@ -82097,7 +82146,7 @@ return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],368:[function(_dereq_,module,exports){ +},{}],371:[function(_dereq_,module,exports){ module.exports = lerp /** @@ -82121,7 +82170,7 @@ return out } -},{}],369:[function(_dereq_,module,exports){ +},{}],372:[function(_dereq_,module,exports){ module.exports = max /** @@ -82140,7 +82189,7 @@ return out } -},{}],370:[function(_dereq_,module,exports){ +},{}],373:[function(_dereq_,module,exports){ module.exports = min /** @@ -82159,7 +82208,7 @@ return out } -},{}],371:[function(_dereq_,module,exports){ +},{}],374:[function(_dereq_,module,exports){ module.exports = multiply /** @@ -82178,7 +82227,7 @@ return out } -},{}],372:[function(_dereq_,module,exports){ +},{}],375:[function(_dereq_,module,exports){ module.exports = negate /** @@ -82196,7 +82245,7 @@ return out } -},{}],373:[function(_dereq_,module,exports){ +},{}],376:[function(_dereq_,module,exports){ module.exports = normalize /** @@ -82222,7 +82271,7 @@ return out } -},{}],374:[function(_dereq_,module,exports){ +},{}],377:[function(_dereq_,module,exports){ var vecNormalize = _dereq_('./normalize') var vecScale = _dereq_('./scale') @@ -82248,7 +82297,7 @@ return out } -},{"./normalize":373,"./scale":375}],375:[function(_dereq_,module,exports){ +},{"./normalize":376,"./scale":378}],378:[function(_dereq_,module,exports){ module.exports = scale /** @@ -82267,7 +82316,7 @@ return out } -},{}],376:[function(_dereq_,module,exports){ +},{}],379:[function(_dereq_,module,exports){ module.exports = scaleAndAdd /** @@ -82287,7 +82336,7 @@ return out } -},{}],377:[function(_dereq_,module,exports){ +},{}],380:[function(_dereq_,module,exports){ module.exports = set /** @@ -82308,7 +82357,7 @@ return out } -},{}],378:[function(_dereq_,module,exports){ +},{}],381:[function(_dereq_,module,exports){ module.exports = squaredDistance /** @@ -82326,7 +82375,7 @@ return x * x + y * y + z * z + w * w } -},{}],379:[function(_dereq_,module,exports){ +},{}],382:[function(_dereq_,module,exports){ module.exports = squaredLength /** @@ -82343,7 +82392,7 @@ return x * x + y * y + z * z + w * w } -},{}],380:[function(_dereq_,module,exports){ +},{}],383:[function(_dereq_,module,exports){ module.exports = subtract /** @@ -82362,7 +82411,7 @@ return out } -},{}],381:[function(_dereq_,module,exports){ +},{}],384:[function(_dereq_,module,exports){ module.exports = transformMat4 /** @@ -82382,7 +82431,7 @@ return out } -},{}],382:[function(_dereq_,module,exports){ +},{}],385:[function(_dereq_,module,exports){ module.exports = transformQuat /** @@ -82411,7 +82460,7 @@ return out } -},{}],383:[function(_dereq_,module,exports){ +},{}],386:[function(_dereq_,module,exports){ module.exports = decodeFloat var UINT8_VIEW = new Uint8Array(4) @@ -82425,7 +82474,7 @@ return FLOAT_VIEW[0] } -},{}],384:[function(_dereq_,module,exports){ +},{}],387:[function(_dereq_,module,exports){ var tokenize = _dereq_('glsl-tokenizer') var atob = _dereq_('atob-lite') @@ -82450,7 +82499,7 @@ } } -},{"atob-lite":60,"glsl-tokenizer":391}],385:[function(_dereq_,module,exports){ +},{"atob-lite":61,"glsl-tokenizer":394}],388:[function(_dereq_,module,exports){ module.exports = tokenize var literals100 = _dereq_('./lib/literals') @@ -82814,7 +82863,7 @@ } } -},{"./lib/builtins":387,"./lib/builtins-300es":386,"./lib/literals":389,"./lib/literals-300es":388,"./lib/operators":390}],386:[function(_dereq_,module,exports){ +},{"./lib/builtins":390,"./lib/builtins-300es":389,"./lib/literals":392,"./lib/literals-300es":391,"./lib/operators":393}],389:[function(_dereq_,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = _dereq_('./builtins') @@ -82885,7 +82934,7 @@ , 'textureProjGradOffset' ]) -},{"./builtins":387}],387:[function(_dereq_,module,exports){ +},{"./builtins":390}],390:[function(_dereq_,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -83037,7 +83086,7 @@ , 'textureCubeGradEXT' ] -},{}],388:[function(_dereq_,module,exports){ +},{}],391:[function(_dereq_,module,exports){ var v100 = _dereq_('./literals') module.exports = v100.slice().concat([ @@ -83127,7 +83176,7 @@ , 'usampler2DMSArray' ]) -},{"./literals":389}],389:[function(_dereq_,module,exports){ +},{"./literals":392}],392:[function(_dereq_,module,exports){ module.exports = [ // current 'precision' @@ -83222,7 +83271,7 @@ , 'using' ] -},{}],390:[function(_dereq_,module,exports){ +},{}],393:[function(_dereq_,module,exports){ module.exports = [ '<<=' , '>>=' @@ -83271,7 +83320,7 @@ , '}' ] -},{}],391:[function(_dereq_,module,exports){ +},{}],394:[function(_dereq_,module,exports){ var tokenize = _dereq_('./index') module.exports = tokenizeString @@ -83286,7 +83335,7 @@ return tokens } -},{"./index":385}],392:[function(_dereq_,module,exports){ +},{"./index":388}],395:[function(_dereq_,module,exports){ module.exports = function(strings) { if (typeof strings === 'string') strings = [strings] var exprs = [].slice.call(arguments,1) @@ -83298,7 +83347,7 @@ return parts.join('') } -},{}],393:[function(_dereq_,module,exports){ +},{}],396:[function(_dereq_,module,exports){ (function (global){ 'use strict' @@ -83315,7 +83364,7 @@ module.exports = hasHover }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":400}],394:[function(_dereq_,module,exports){ +},{"is-browser":403}],397:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -83341,7 +83390,7 @@ module.exports = isBrowser && detect() -},{"is-browser":400}],395:[function(_dereq_,module,exports){ +},{"is-browser":403}],398:[function(_dereq_,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -83427,7 +83476,7 @@ buffer[offset + i - d] |= s * 128 } -},{}],396:[function(_dereq_,module,exports){ +},{}],399:[function(_dereq_,module,exports){ "use strict" //High level idea: @@ -83874,7 +83923,7 @@ //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":486,"simplicial-complex":496}],397:[function(_dereq_,module,exports){ +},{"robust-orientation":488,"simplicial-complex":498}],400:[function(_dereq_,module,exports){ "use strict" var bounds = _dereq_("binary-search-bounds") @@ -84241,7 +84290,7 @@ return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":79}],398:[function(_dereq_,module,exports){ +},{"binary-search-bounds":80}],401:[function(_dereq_,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -84253,7 +84302,7 @@ } module.exports = invertPermutation -},{}],399:[function(_dereq_,module,exports){ +},{}],402:[function(_dereq_,module,exports){ "use strict" function iota(n) { @@ -84265,9 +84314,9 @@ } module.exports = iota -},{}],400:[function(_dereq_,module,exports){ +},{}],403:[function(_dereq_,module,exports){ module.exports = true; -},{}],401:[function(_dereq_,module,exports){ +},{}],404:[function(_dereq_,module,exports){ /*! * Determine if an object is a Buffer * @@ -84290,12 +84339,12 @@ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],402:[function(_dereq_,module,exports){ +},{}],405:[function(_dereq_,module,exports){ 'use strict'; module.exports = typeof navigator !== 'undefined' && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion)); -},{}],403:[function(_dereq_,module,exports){ +},{}],406:[function(_dereq_,module,exports){ 'use strict' module.exports = isMobile; @@ -84319,14 +84368,14 @@ : mobileRE.test(ua); } -},{}],404:[function(_dereq_,module,exports){ +},{}],407:[function(_dereq_,module,exports){ 'use strict'; module.exports = function (x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); }; -},{}],405:[function(_dereq_,module,exports){ +},{}],408:[function(_dereq_,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -84335,7 +84384,7 @@ return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],406:[function(_dereq_,module,exports){ +},{}],409:[function(_dereq_,module,exports){ 'use strict'; /** @@ -84372,7 +84421,7 @@ return true; } -},{}],407:[function(_dereq_,module,exports){ +},{}],410:[function(_dereq_,module,exports){ 'use strict' module.exports = function isPath(str) { @@ -84386,12 +84435,12 @@ return false } -},{}],408:[function(_dereq_,module,exports){ +},{}],411:[function(_dereq_,module,exports){ function lerp(v0, v1, t) { return v0*(1-t)+v1*t } module.exports = lerp -},{}],409:[function(_dereq_,module,exports){ +},{}],412:[function(_dereq_,module,exports){ (function (global){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : @@ -84434,7 +84483,7 @@ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],410:[function(_dereq_,module,exports){ +},{}],413:[function(_dereq_,module,exports){ 'use strict' module.exports = createTable @@ -84500,7 +84549,7 @@ } return result } -},{"convex-hull":118}],411:[function(_dereq_,module,exports){ +},{"convex-hull":119}],414:[function(_dereq_,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -84680,7 +84729,7 @@ out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":412,"gl-mat4/clone":248,"gl-mat4/create":249,"gl-mat4/determinant":250,"gl-mat4/invert":254,"gl-mat4/transpose":264,"gl-vec3/cross":317,"gl-vec3/dot":322,"gl-vec3/length":332,"gl-vec3/normalize":339}],412:[function(_dereq_,module,exports){ +},{"./normalize":415,"gl-mat4/clone":250,"gl-mat4/create":251,"gl-mat4/determinant":252,"gl-mat4/invert":256,"gl-mat4/transpose":266,"gl-vec3/cross":320,"gl-vec3/dot":325,"gl-vec3/length":335,"gl-vec3/normalize":342}],415:[function(_dereq_,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -84691,7 +84740,7 @@ out[i] = mat[i] * scale return true } -},{}],413:[function(_dereq_,module,exports){ +},{}],416:[function(_dereq_,module,exports){ var lerp = _dereq_('gl-vec3/lerp') var recompose = _dereq_('mat4-recompose') @@ -84744,7 +84793,7 @@ function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":250,"gl-vec3/lerp":333,"mat4-decompose":411,"mat4-recompose":414,"quat-slerp":466}],414:[function(_dereq_,module,exports){ +},{"gl-mat4/determinant":252,"gl-vec3/lerp":336,"mat4-decompose":414,"mat4-recompose":417,"quat-slerp":469}],417:[function(_dereq_,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -84805,13 +84854,13 @@ mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":249,"gl-mat4/fromRotationTranslation":252,"gl-mat4/identity":253,"gl-mat4/multiply":256,"gl-mat4/scale":262,"gl-mat4/translate":263}],415:[function(_dereq_,module,exports){ +},{"gl-mat4/create":251,"gl-mat4/fromRotationTranslation":254,"gl-mat4/identity":255,"gl-mat4/multiply":258,"gl-mat4/scale":264,"gl-mat4/translate":265}],418:[function(_dereq_,module,exports){ 'use strict'; module.exports = Math.log2 || function (x) { return Math.log(x) * Math.LOG2E; }; -},{}],416:[function(_dereq_,module,exports){ +},{}],419:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -85011,7 +85060,7 @@ return new MatrixCameraController(matrix) } -},{"binary-search-bounds":79,"gl-mat4/invert":254,"gl-mat4/lookAt":255,"gl-mat4/rotateX":259,"gl-mat4/rotateY":260,"gl-mat4/rotateZ":261,"gl-mat4/scale":262,"gl-mat4/translate":263,"gl-vec3/normalize":339,"mat4-interpolate":413}],417:[function(_dereq_,module,exports){ +},{"binary-search-bounds":80,"gl-mat4/invert":256,"gl-mat4/lookAt":257,"gl-mat4/rotateX":261,"gl-mat4/rotateY":262,"gl-mat4/rotateZ":263,"gl-mat4/scale":264,"gl-mat4/translate":265,"gl-vec3/normalize":342,"mat4-interpolate":416}],420:[function(_dereq_,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -85093,7 +85142,7 @@ //Return result return result } -},{"robust-orientation":486}],418:[function(_dereq_,module,exports){ +},{"robust-orientation":488}],421:[function(_dereq_,module,exports){ 'use strict' module.exports = mouseListen @@ -85300,7 +85349,7 @@ return result } -},{"mouse-event":420}],419:[function(_dereq_,module,exports){ +},{"mouse-event":423}],422:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -85327,7 +85376,7 @@ } } -},{}],420:[function(_dereq_,module,exports){ +},{}],423:[function(_dereq_,module,exports){ 'use strict' function mouseButtons(ev) { @@ -85389,7 +85438,7 @@ } exports.y = mouseRelativeY -},{}],421:[function(_dereq_,module,exports){ +},{}],424:[function(_dereq_,module,exports){ 'use strict' var toPX = _dereq_('to-px') @@ -85431,7 +85480,7 @@ return listener } -},{"to-px":515}],422:[function(_dereq_,module,exports){ +},{"to-px":517}],425:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -85847,7 +85896,7 @@ order, typesig) } -},{"typedarray-pool":521}],423:[function(_dereq_,module,exports){ +},{"typedarray-pool":523}],426:[function(_dereq_,module,exports){ "use strict" @@ -85859,7 +85908,7 @@ return array } -},{"cwise/lib/wrapper":137}],424:[function(_dereq_,module,exports){ +},{"cwise/lib/wrapper":138}],427:[function(_dereq_,module,exports){ 'use strict' module.exports = gradient @@ -86157,7 +86206,7 @@ var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":134,"dup":155}],425:[function(_dereq_,module,exports){ +},{"cwise-compiler":135,"dup":156}],428:[function(_dereq_,module,exports){ 'use strict' var warp = _dereq_('ndarray-warp') @@ -86187,7 +86236,7 @@ }) return dest } -},{"gl-matrix-invert":265,"ndarray-warp":432}],426:[function(_dereq_,module,exports){ +},{"gl-matrix-invert":267,"ndarray-warp":435}],429:[function(_dereq_,module,exports){ "use strict" function interp1d(arr, x) { @@ -86298,7 +86347,7 @@ module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],427:[function(_dereq_,module,exports){ +},{}],430:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("cwise-compiler") @@ -86761,7 +86810,7 @@ -},{"cwise-compiler":134}],428:[function(_dereq_,module,exports){ +},{"cwise-compiler":135}],431:[function(_dereq_,module,exports){ "use strict" var ndarray = _dereq_("ndarray") @@ -86784,10 +86833,10 @@ return result } -},{"./doConvert.js":429,"ndarray":433}],429:[function(_dereq_,module,exports){ +},{"./doConvert.js":432,"ndarray":436}],432:[function(_dereq_,module,exports){ module.exports=_dereq_('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":134}],430:[function(_dereq_,module,exports){ +},{"cwise-compiler":135}],433:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -87516,7 +87565,7 @@ } module.exports = compileSort -},{"typedarray-pool":521}],431:[function(_dereq_,module,exports){ +},{"typedarray-pool":523}],434:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("./lib/compile_sort.js") @@ -87536,7 +87585,7 @@ } module.exports = sort -},{"./lib/compile_sort.js":430}],432:[function(_dereq_,module,exports){ +},{"./lib/compile_sort.js":433}],435:[function(_dereq_,module,exports){ 'use strict' var interp = _dereq_('ndarray-linear-interpolate') @@ -87568,7 +87617,7 @@ return dest } -},{"cwise/lib/wrapper":137,"ndarray-linear-interpolate":426}],433:[function(_dereq_,module,exports){ +},{"cwise/lib/wrapper":138,"ndarray-linear-interpolate":429}],436:[function(_dereq_,module,exports){ var iota = _dereq_("iota-array") var isBuffer = _dereq_("is-buffer") @@ -87913,7 +87962,7 @@ module.exports = wrappedNDArrayCtor -},{"iota-array":399,"is-buffer":401}],434:[function(_dereq_,module,exports){ +},{"iota-array":402,"is-buffer":404}],437:[function(_dereq_,module,exports){ "use strict" var doubleBits = _dereq_("double-bits") @@ -87956,7 +88005,7 @@ } return doubleBits.pack(lo, hi) } -},{"double-bits":152}],435:[function(_dereq_,module,exports){ +},{"double-bits":153}],438:[function(_dereq_,module,exports){ var π = Math.PI var _120 = radians(120) @@ -88158,7 +88207,7 @@ return degress * (π / 180) } -},{}],436:[function(_dereq_,module,exports){ +},{}],439:[function(_dereq_,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -88283,7 +88332,7 @@ -},{}],437:[function(_dereq_,module,exports){ +},{}],440:[function(_dereq_,module,exports){ /* object-assign (c) Sindre Sorhus @@ -88375,7 +88424,7 @@ return to; }; -},{}],438:[function(_dereq_,module,exports){ +},{}],441:[function(_dereq_,module,exports){ 'use strict' module.exports = quatFromFrame @@ -88417,7 +88466,7 @@ } return out } -},{}],439:[function(_dereq_,module,exports){ +},{}],442:[function(_dereq_,module,exports){ 'use strict' module.exports = createOrbitController @@ -88811,7 +88860,7 @@ return result } -},{"./lib/quatFromFrame":438,"filtered-vector":215,"gl-mat4/fromQuat":251,"gl-mat4/invert":254,"gl-mat4/lookAt":255}],440:[function(_dereq_,module,exports){ +},{"./lib/quatFromFrame":441,"filtered-vector":216,"gl-mat4/fromQuat":253,"gl-mat4/invert":256,"gl-mat4/lookAt":257}],443:[function(_dereq_,module,exports){ /*! * pad-left * @@ -88827,7 +88876,7 @@ ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":479}],441:[function(_dereq_,module,exports){ +},{"repeat-string":481}],444:[function(_dereq_,module,exports){ 'use strict' /** @@ -88964,7 +89013,7 @@ module.exports = parenthesis -},{}],442:[function(_dereq_,module,exports){ +},{}],445:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -89051,7 +89100,7 @@ return rect } -},{"pick-by-alias":448}],443:[function(_dereq_,module,exports){ +},{"pick-by-alias":451}],446:[function(_dereq_,module,exports){ module.exports = parse @@ -89110,7 +89159,7 @@ return numbers ? numbers.map(Number) : [] } -},{}],444:[function(_dereq_,module,exports){ +},{}],447:[function(_dereq_,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -89121,7 +89170,7 @@ out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],445:[function(_dereq_,module,exports){ +},{}],448:[function(_dereq_,module,exports){ (function (process){ // Generated by CoffeeScript 1.12.2 (function() { @@ -89161,7 +89210,7 @@ }).call(this,_dereq_('_process')) -},{"_process":465}],446:[function(_dereq_,module,exports){ +},{"_process":468}],449:[function(_dereq_,module,exports){ "use strict" module.exports = permutationSign @@ -89213,7 +89262,7 @@ return sgn } } -},{"typedarray-pool":521}],447:[function(_dereq_,module,exports){ +},{"typedarray-pool":523}],450:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -89300,7 +89349,7 @@ exports.rank = rank exports.unrank = unrank -},{"invert-permutation":398,"typedarray-pool":521}],448:[function(_dereq_,module,exports){ +},{"invert-permutation":401,"typedarray-pool":523}],451:[function(_dereq_,module,exports){ 'use strict' @@ -89379,7 +89428,7 @@ return arg } -},{}],449:[function(_dereq_,module,exports){ +},{}],452:[function(_dereq_,module,exports){ "use strict" module.exports = planarDual @@ -89510,7 +89559,7 @@ //Combine paths and loops together return cycles } -},{"compare-angle":115}],450:[function(_dereq_,module,exports){ +},{"compare-angle":116}],453:[function(_dereq_,module,exports){ 'use strict' module.exports = trimLeaves @@ -89566,7 +89615,7 @@ return [ nedges, npositions ] } -},{"edges-to-adjacency-list":157}],451:[function(_dereq_,module,exports){ +},{"edges-to-adjacency-list":158}],454:[function(_dereq_,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -89771,13 +89820,13 @@ return result } -},{"./lib/trim-leaves":450,"edges-to-adjacency-list":157,"planar-dual":449,"point-in-big-polygon":455,"robust-sum":491,"two-product":519,"uniq":523}],452:[function(_dereq_,module,exports){ +},{"./lib/trim-leaves":453,"edges-to-adjacency-list":158,"planar-dual":452,"point-in-big-polygon":458,"robust-sum":493,"two-product":521,"uniq":525}],455:[function(_dereq_,module,exports){ 'use strict' module.exports = _dereq_('./quad') -},{"./quad":454}],453:[function(_dereq_,module,exports){ -arguments[4][99][0].apply(exports,arguments) -},{"dup":99}],454:[function(_dereq_,module,exports){ +},{"./quad":457}],456:[function(_dereq_,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],457:[function(_dereq_,module,exports){ /** * @module point-cluster/quad * @@ -90126,7 +90175,7 @@ return result } -},{"array-bounds":53,"binary-search-bounds":453,"clamp":103,"defined":149,"dtype":154,"flatten-vertex-data":216,"is-obj":404,"math-log2":415,"parse-rect":442,"pick-by-alias":448}],455:[function(_dereq_,module,exports){ +},{"array-bounds":54,"binary-search-bounds":456,"clamp":104,"defined":150,"dtype":155,"flatten-vertex-data":217,"is-obj":407,"math-log2":418,"parse-rect":445,"pick-by-alias":451}],458:[function(_dereq_,module,exports){ module.exports = preprocessPolygon var orient = _dereq_('robust-orientation')[3] @@ -90278,7 +90327,7 @@ testSlab) } } -},{"binary-search-bounds":79,"interval-tree-1d":397,"robust-orientation":486,"slab-decomposition":502}],456:[function(_dereq_,module,exports){ +},{"binary-search-bounds":80,"interval-tree-1d":400,"robust-orientation":488,"slab-decomposition":504}],459:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -90406,7 +90455,7 @@ module.exports = PolyBool; -},{"./lib/build-log":457,"./lib/epsilon":458,"./lib/geojson":459,"./lib/intersecter":460,"./lib/segment-chainer":462,"./lib/segment-selector":463}],457:[function(_dereq_,module,exports){ +},{"./lib/build-log":460,"./lib/epsilon":461,"./lib/geojson":462,"./lib/intersecter":463,"./lib/segment-chainer":465,"./lib/segment-selector":466}],460:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -90521,7 +90570,7 @@ module.exports = BuildLog; -},{}],458:[function(_dereq_,module,exports){ +},{}],461:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -90693,7 +90742,7 @@ module.exports = Epsilon; -},{}],459:[function(_dereq_,module,exports){ +},{}],462:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -90883,7 +90932,7 @@ module.exports = GeoJSON; -},{}],460:[function(_dereq_,module,exports){ +},{}],463:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -91390,7 +91439,7 @@ module.exports = Intersecter; -},{"./linked-list":461}],461:[function(_dereq_,module,exports){ +},{"./linked-list":464}],464:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -91473,7 +91522,7 @@ module.exports = LinkedList; -},{}],462:[function(_dereq_,module,exports){ +},{}],465:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -91727,7 +91776,7 @@ module.exports = SegmentChainer; -},{}],463:[function(_dereq_,module,exports){ +},{}],466:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -91895,7 +91944,7 @@ module.exports = SegmentSelector; -},{}],464:[function(_dereq_,module,exports){ +},{}],467:[function(_dereq_,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -92093,7 +92142,7 @@ module.exports = closestPoint2d; -},{}],465:[function(_dereq_,module,exports){ +},{}],468:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -92279,9 +92328,9 @@ }; process.umask = function() { return 0; }; -},{}],466:[function(_dereq_,module,exports){ +},{}],469:[function(_dereq_,module,exports){ module.exports = _dereq_('gl-quat/slerp') -},{"gl-quat/slerp":280}],467:[function(_dereq_,module,exports){ +},{"gl-quat/slerp":282}],470:[function(_dereq_,module,exports){ (function (global){ var now = _dereq_('performance-now') , root = typeof window === 'undefined' ? global : window @@ -92360,7 +92409,7 @@ } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"performance-now":445}],468:[function(_dereq_,module,exports){ +},{"performance-now":448}],471:[function(_dereq_,module,exports){ 'use strict' var bnadd = _dereq_('big-rat/add') @@ -92376,7 +92425,7 @@ return r } -},{"big-rat/add":63}],469:[function(_dereq_,module,exports){ +},{"big-rat/add":64}],472:[function(_dereq_,module,exports){ 'use strict' module.exports = float2rat @@ -92391,7 +92440,7 @@ return result } -},{"big-rat":66}],470:[function(_dereq_,module,exports){ +},{"big-rat":67}],473:[function(_dereq_,module,exports){ 'use strict' var rat = _dereq_('big-rat') @@ -92409,7 +92458,7 @@ return r } -},{"big-rat":66,"big-rat/mul":75}],471:[function(_dereq_,module,exports){ +},{"big-rat":67,"big-rat/mul":76}],474:[function(_dereq_,module,exports){ 'use strict' var bnsub = _dereq_('big-rat/sub') @@ -92425,7 +92474,7 @@ return r } -},{"big-rat/sub":77}],472:[function(_dereq_,module,exports){ +},{"big-rat/sub":78}],475:[function(_dereq_,module,exports){ 'use strict' var compareCell = _dereq_('compare-cell') @@ -92458,518 +92507,81 @@ return cells } -},{"cell-orientation":100,"compare-cell":116,"compare-oriented-cell":117}],473:[function(_dereq_,module,exports){ -'use strict' - -var getBounds = _dereq_('array-bounds') -var rgba = _dereq_('color-normalize') -var updateDiff = _dereq_('update-diff') -var pick = _dereq_('pick-by-alias') -var extend = _dereq_('object-assign') -var flatten = _dereq_('flatten-vertex-data') -var ref = _dereq_('to-float32'); -var float32 = ref.float32; -var fract32 = ref.fract32; - -module.exports = Error2D - -var WEIGHTS = [ - //direction, lineWidth shift, capSize shift - - // x-error bar - [1, 0, 0, 1, 0, 0], - [1, 0, 0, -1, 0, 0], - [-1, 0, 0, -1, 0, 0], - - [-1, 0, 0, -1, 0, 0], - [-1, 0, 0, 1, 0, 0], - [1, 0, 0, 1, 0, 0], - - // x-error right cap - [1, 0, -1, 0, 0, 1], - [1, 0, -1, 0, 0, -1], - [1, 0, 1, 0, 0, -1], - - [1, 0, 1, 0, 0, -1], - [1, 0, 1, 0, 0, 1], - [1, 0, -1, 0, 0, 1], - - // x-error left cap - [-1, 0, -1, 0, 0, 1], - [-1, 0, -1, 0, 0, -1], - [-1, 0, 1, 0, 0, -1], - - [-1, 0, 1, 0, 0, -1], - [-1, 0, 1, 0, 0, 1], - [-1, 0, -1, 0, 0, 1], - - // y-error bar - [0, 1, 1, 0, 0, 0], - [0, 1, -1, 0, 0, 0], - [0, -1, -1, 0, 0, 0], - - [0, -1, -1, 0, 0, 0], - [0, 1, 1, 0, 0, 0], - [0, -1, 1, 0, 0, 0], - - // y-error top cap - [0, 1, 0, -1, 1, 0], - [0, 1, 0, -1, -1, 0], - [0, 1, 0, 1, -1, 0], - - [0, 1, 0, 1, 1, 0], - [0, 1, 0, -1, 1, 0], - [0, 1, 0, 1, -1, 0], - - // y-error bottom cap - [0, -1, 0, -1, 1, 0], - [0, -1, 0, -1, -1, 0], - [0, -1, 0, 1, -1, 0], - - [0, -1, 0, 1, 1, 0], - [0, -1, 0, -1, 1, 0], - [0, -1, 0, 1, -1, 0] -] - - -function Error2D (regl, options) { - if (typeof regl === 'function') { - if (!options) { options = {} } - options.regl = regl - } - else { - options = regl - } - if (options.length) { options.positions = options } - regl = options.regl - - if (!regl.hasExtension('ANGLE_instanced_arrays')) { - throw Error('regl-error2d: `ANGLE_instanced_arrays` extension should be enabled'); - } - - // persistent variables - var gl = regl._gl, drawErrors, positionBuffer, positionFractBuffer, colorBuffer, errorBuffer, meshBuffer, - defaults = { - color: 'black', - capSize: 5, - lineWidth: 1, - opacity: 1, - viewport: null, - range: null, - offset: 0, - count: 0, - bounds: null, - positions: [], - errors: [] - }, groups = [] - - //color per-point - colorBuffer = regl.buffer({ - usage: 'dynamic', - type: 'uint8', - data: new Uint8Array(0) - }) - //xy-position per-point - positionBuffer = regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array(0) - }) - //xy-position float32-fraction - positionFractBuffer = regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array(0) - }) - //4 errors per-point - errorBuffer = regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array(0) - }) - //error bar mesh - meshBuffer = regl.buffer({ - usage: 'static', - type: 'float', - data: WEIGHTS - }) - - update(options) - - //drawing method - drawErrors = regl({ - vert: "\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t", - - frag: "\n\t\tprecision mediump float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t", - - uniforms: { - range: regl.prop('range'), - lineWidth: regl.prop('lineWidth'), - capSize: regl.prop('capSize'), - opacity: regl.prop('opacity'), - scale: regl.prop('scale'), - translate: regl.prop('translate'), - scaleFract: regl.prop('scaleFract'), - translateFract: regl.prop('translateFract'), - viewport: function (ctx, prop) { return [prop.viewport.x, prop.viewport.y, ctx.viewportWidth, ctx.viewportHeight]; } - }, - - attributes: { - //dynamic attributes - color: { - buffer: colorBuffer, - offset: function (ctx, prop) { return prop.offset * 4; }, - divisor: 1, - }, - position: { - buffer: positionBuffer, - offset: function (ctx, prop) { return prop.offset * 8; }, - divisor: 1 - }, - positionFract: { - buffer: positionFractBuffer, - offset: function (ctx, prop) { return prop.offset * 8; }, - divisor: 1 - }, - error: { - buffer: errorBuffer, - offset: function (ctx, prop) { return prop.offset * 16; }, - divisor: 1 - }, - - //static attributes - direction: { - buffer: meshBuffer, - stride: 24, - offset: 0 - }, - lineOffset: { - buffer: meshBuffer, - stride: 24, - offset: 8 - }, - capOffset: { - buffer: meshBuffer, - stride: 24, - offset: 16 - } - }, - - primitive: 'triangles', - - blend: { - enable: true, - color: [0,0,0,0], - equation: { - rgb: 'add', - alpha: 'add' - }, - func: { - srcRGB: 'src alpha', - dstRGB: 'one minus src alpha', - srcAlpha: 'one minus dst alpha', - dstAlpha: 'one' - } - }, - - depth: { - enable: false - }, - - scissor: { - enable: true, - box: regl.prop('viewport') - }, - viewport: regl.prop('viewport'), - stencil: false, - - instances: regl.prop('count'), - count: WEIGHTS.length - }) - - //expose API - extend(error2d, { - update: update, - draw: draw, - destroy: destroy, - regl: regl, - gl: gl, - canvas: gl.canvas, - groups: groups - }) - - return error2d - - function error2d (opts) { - //update - if (opts) { - update(opts) - } - - //destroy - else if (opts === null) { - destroy() - } - - draw() - } - - - //main draw method - function draw (options) { - if (typeof options === 'number') { return drawGroup(options) } - - //make options a batch - if (options && !Array.isArray(options)) { options = [options] } - - - regl._refresh() - - //render multiple polylines via regl batch - groups.forEach(function (s, i) { - if (!s) { return } - - if (options) { - if (!options[i]) { s.draw = false } - else { s.draw = true } - } - - //ignore draw flag for one pass - if (!s.draw) { - s.draw = true; - return - } - - drawGroup(i) - }) - } - - //draw single error group by id - function drawGroup (s) { - if (typeof s === 'number') { s = groups[s] } - if (s == null) { return } - - if (!(s && s.count && s.color && s.opacity && s.positions && s.positions.length > 1)) { return } - - s.scaleRatio = [ - s.scale[0] * s.viewport.width, - s.scale[1] * s.viewport.height - ] - - drawErrors(s) - - if (s.after) { s.after(s) } - } - - function update (options) { - if (!options) { return } - - //direct points argument - if (options.length != null) { - if (typeof options[0] === 'number') { options = [{positions: options}] } - } - - //make options a batch - else if (!Array.isArray(options)) { options = [options] } - - //global count of points - var pointCount = 0, errorCount = 0 - - error2d.groups = groups = options.map(function (options, i) { - var group = groups[i] - - if (!options) { return group } - else if (typeof options === 'function') { options = {after: options} } - else if (typeof options[0] === 'number') { options = {positions: options} } - - //copy options to avoid mutation & handle aliases - options = pick(options, { - color: 'color colors fill', - capSize: 'capSize cap capsize cap-size', - lineWidth: 'lineWidth line-width width line thickness', - opacity: 'opacity alpha', - range: 'range dataBox', - viewport: 'viewport viewBox', - errors: 'errors error', - positions: 'positions position data points' - }) - - if (!group) { - groups[i] = group = { - id: i, - scale: null, - translate: null, - scaleFract: null, - translateFract: null, - draw: true - } - options = extend({}, defaults, options) - } - - updateDiff(group, options, [{ - lineWidth: function (v) { return +v * .5; }, - capSize: function (v) { return +v * .5; }, - opacity: parseFloat, - errors: function (errors) { - errors = flatten(errors) - - errorCount += errors.length - return errors - }, - positions: function (positions, state) { - positions = flatten(positions, 'float64') - state.count = Math.floor(positions.length / 2) - state.bounds = getBounds(positions, 2) - state.offset = pointCount - - pointCount += state.count - - return positions - } - }, { - color: function (colors, state) { - var count = state.count - - if (!colors) { colors = 'transparent' } - - // 'black' or [0,0,0,0] case - if (!Array.isArray(colors) || typeof colors[0] === 'number') { - var color = colors - colors = Array(count) - for (var i = 0; i < count; i++) { - colors[i] = color - } - } - - if (colors.length < count) { throw Error('Not enough colors') } - - var colorData = new Uint8Array(count * 4) - - //convert colors to float arrays - for (var i$1 = 0; i$1 < count; i$1++) { - var c = rgba(colors[i$1], 'uint8') - colorData.set(c, i$1 * 4) - } - - return colorData - }, - - range: function (range, state, options) { - var bounds = state.bounds - if (!range) { range = bounds } - - state.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])] - state.translate = [-range[0], -range[1]] - - state.scaleFract = fract32(state.scale) - state.translateFract = fract32(state.translate) - - return range - }, - - viewport: function (vp) { - var viewport - - if (Array.isArray(vp)) { - viewport = { - x: vp[0], - y: vp[1], - width: vp[2] - vp[0], - height: vp[3] - vp[1] - } - } - else if (vp) { - viewport = { - x: vp.x || vp.left || 0, - y: vp.y || vp.top || 0 - } - - if (vp.right) { viewport.width = vp.right - viewport.x } - else { viewport.width = vp.w || vp.width || 0 } - - if (vp.bottom) { viewport.height = vp.bottom - viewport.y } - else { viewport.height = vp.h || vp.height || 0 } - } - else { - viewport = { - x: 0, y: 0, - width: gl.drawingBufferWidth, - height: gl.drawingBufferHeight - } - } - - return viewport - } - }]) - - return group - }) - - if (pointCount || errorCount) { - var len = groups.reduce(function (acc, group, i) { - return acc + (group ? group.count : 0) - }, 0) - - var positionData = new Float64Array(len * 2) - var colorData = new Uint8Array(len * 4) - var errorData = new Float32Array(len * 4) - - groups.forEach(function (group, i) { - if (!group) { return } - var positions = group.positions; - var count = group.count; - var offset = group.offset; - var color = group.color; - var errors = group.errors; - if (!count) { return } - - colorData.set(color, offset * 4) - errorData.set(errors, offset * 4) - positionData.set(positions, offset * 2) - }) - - positionBuffer(float32(positionData)) - positionFractBuffer(fract32(positionData)) - colorBuffer(colorData) - errorBuffer(errorData) - } - - } - - function destroy () { - positionBuffer.destroy() - positionFractBuffer.destroy() - colorBuffer.destroy() - errorBuffer.destroy() - meshBuffer.destroy() - } -} -},{"array-bounds":53,"color-normalize":108,"flatten-vertex-data":216,"object-assign":437,"pick-by-alias":448,"to-float32":514,"update-diff":525}],474:[function(_dereq_,module,exports){ +},{"cell-orientation":101,"compare-cell":117,"compare-oriented-cell":118}],476:[function(_dereq_,module,exports){ 'use strict' - -var rgba = _dereq_('color-normalize') var getBounds = _dereq_('array-bounds') -var extend = _dereq_('object-assign') -var glslify = _dereq_('glslify') +var rgba = _dereq_('color-normalize') +var updateDiff = _dereq_('update-diff') var pick = _dereq_('pick-by-alias') +var extend = _dereq_('object-assign') var flatten = _dereq_('flatten-vertex-data') -var triangulate = _dereq_('earcut') -var normalize = _dereq_('array-normalize') var ref = _dereq_('to-float32'); var float32 = ref.float32; var fract32 = ref.fract32; -var WeakMap = _dereq_('es6-weak-map') -var parseRect = _dereq_('parse-rect') +module.exports = Error2D -module.exports = Line2D +var WEIGHTS = [ + //direction, lineWidth shift, capSize shift + // x-error bar + [1, 0, 0, 1, 0, 0], + [1, 0, 0, -1, 0, 0], + [-1, 0, 0, -1, 0, 0], + + [-1, 0, 0, -1, 0, 0], + [-1, 0, 0, 1, 0, 0], + [1, 0, 0, 1, 0, 0], + + // x-error right cap + [1, 0, -1, 0, 0, 1], + [1, 0, -1, 0, 0, -1], + [1, 0, 1, 0, 0, -1], + + [1, 0, 1, 0, 0, -1], + [1, 0, 1, 0, 0, 1], + [1, 0, -1, 0, 0, 1], + + // x-error left cap + [-1, 0, -1, 0, 0, 1], + [-1, 0, -1, 0, 0, -1], + [-1, 0, 1, 0, 0, -1], + + [-1, 0, 1, 0, 0, -1], + [-1, 0, 1, 0, 0, 1], + [-1, 0, -1, 0, 0, 1], + + // y-error bar + [0, 1, 1, 0, 0, 0], + [0, 1, -1, 0, 0, 0], + [0, -1, -1, 0, 0, 0], + + [0, -1, -1, 0, 0, 0], + [0, 1, 1, 0, 0, 0], + [0, -1, 1, 0, 0, 0], + + // y-error top cap + [0, 1, 0, -1, 1, 0], + [0, 1, 0, -1, -1, 0], + [0, 1, 0, 1, -1, 0], + + [0, 1, 0, 1, 1, 0], + [0, 1, 0, -1, 1, 0], + [0, 1, 0, 1, -1, 0], + + // y-error bottom cap + [0, -1, 0, -1, 1, 0], + [0, -1, 0, -1, -1, 0], + [0, -1, 0, 1, -1, 0], + + [0, -1, 0, 1, 1, 0], + [0, -1, 0, -1, 1, 0], + [0, -1, 0, 1, -1, 0] +] -/** @constructor */ -function Line2D (regl, options) { - if (!(this instanceof Line2D)) { return new Line2D(regl, options) } +function Error2D (regl, options) { if (typeof regl === 'function') { if (!options) { options = {} } options.regl = regl @@ -92985,63 +92597,115 @@ } // persistent variables - this.gl = regl._gl - this.regl = regl - - // list of options for lines - this.passes = [] - - // cached shaders instance - this.shaders = Line2D.shaders.has(regl) ? Line2D.shaders.get(regl) : Line2D.shaders.set(regl, Line2D.createShaders(regl)).get(regl) - - - // init defaults - this.update(options) -} - - -Line2D.dashMult = 2 -Line2D.maxPatternLength = 256 -Line2D.precisionThreshold = 3e6 -Line2D.maxPoints = 1e4 -Line2D.maxLines = 2048 - - -// cache of created draw calls per-regl instance -Line2D.shaders = new WeakMap() - - -// create static shaders once -Line2D.createShaders = function (regl) { - var offsetBuffer = regl.buffer({ + var gl = regl._gl, drawErrors, positionBuffer, positionFractBuffer, colorBuffer, errorBuffer, meshBuffer, + defaults = { + color: 'black', + capSize: 5, + lineWidth: 1, + opacity: 1, + viewport: null, + range: null, + offset: 0, + count: 0, + bounds: null, + positions: [], + errors: [] + }, groups = [] + + //color per-point + colorBuffer = regl.buffer({ + usage: 'dynamic', + type: 'uint8', + data: new Uint8Array(0) + }) + //xy-position per-point + positionBuffer = regl.buffer({ + usage: 'dynamic', + type: 'float', + data: new Uint8Array(0) + }) + //xy-position float32-fraction + positionFractBuffer = regl.buffer({ + usage: 'dynamic', + type: 'float', + data: new Uint8Array(0) + }) + //4 errors per-point + errorBuffer = regl.buffer({ + usage: 'dynamic', + type: 'float', + data: new Uint8Array(0) + }) + //error bar mesh + meshBuffer = regl.buffer({ usage: 'static', type: 'float', - data: [0,1, 0,0, 1,1, 1,0] + data: WEIGHTS }) - var shaderOptions = { - primitive: 'triangle strip', - instances: regl.prop('count'), - count: 4, - offset: 0, + update(options) + + //drawing method + drawErrors = regl({ + vert: "\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t", + + frag: "\n\t\tprecision mediump float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t", uniforms: { - miterMode: function (ctx, prop) { return prop.join === 'round' ? 2 : 1; }, - miterLimit: regl.prop('miterLimit'), + range: regl.prop('range'), + lineWidth: regl.prop('lineWidth'), + capSize: regl.prop('capSize'), + opacity: regl.prop('opacity'), scale: regl.prop('scale'), + translate: regl.prop('translate'), scaleFract: regl.prop('scaleFract'), translateFract: regl.prop('translateFract'), - translate: regl.prop('translate'), - thickness: regl.prop('thickness'), - dashPattern: regl.prop('dashTexture'), - opacity: regl.prop('opacity'), - pixelRatio: regl.context('pixelRatio'), - id: regl.prop('id'), - dashSize: regl.prop('dashLength'), - viewport: function (c, p) { return [p.viewport.x, p.viewport.y, c.viewportWidth, c.viewportHeight]; }, - depth: regl.prop('depth') + viewport: function (ctx, prop) { return [prop.viewport.x, prop.viewport.y, ctx.viewportWidth, ctx.viewportHeight]; } + }, + + attributes: { + //dynamic attributes + color: { + buffer: colorBuffer, + offset: function (ctx, prop) { return prop.offset * 4; }, + divisor: 1, + }, + position: { + buffer: positionBuffer, + offset: function (ctx, prop) { return prop.offset * 8; }, + divisor: 1 + }, + positionFract: { + buffer: positionFractBuffer, + offset: function (ctx, prop) { return prop.offset * 8; }, + divisor: 1 + }, + error: { + buffer: errorBuffer, + offset: function (ctx, prop) { return prop.offset * 16; }, + divisor: 1 + }, + + //static attributes + direction: { + buffer: meshBuffer, + stride: 24, + offset: 0 + }, + lineOffset: { + buffer: meshBuffer, + stride: 24, + offset: 8 + }, + capOffset: { + buffer: meshBuffer, + stride: 24, + offset: 16 + } }, + primitive: 'triangles', + blend: { enable: true, color: [0,0,0,0], @@ -93056,84 +92720,470 @@ dstAlpha: 'one' } }, + depth: { - enable: function (c, p) { - return !p.overlay - } + enable: false }, - stencil: {enable: false}, + scissor: { enable: true, box: regl.prop('viewport') }, - viewport: regl.prop('viewport') - } + viewport: regl.prop('viewport'), + stencil: false, + + instances: regl.prop('count'), + count: WEIGHTS.length + }) + //expose API + extend(error2d, { + update: update, + draw: draw, + destroy: destroy, + regl: regl, + gl: gl, + canvas: gl.canvas, + groups: groups + }) - // simplified rectangular line shader - var drawRectLine = regl(extend({ - vert: glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;\nattribute vec4 color;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {\n\t// the order is important\n\treturn position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n}\n\nvoid main() {\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineOffset = lineTop * 2. - 1.;\n\n\tvec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);\n\ttangent = normalize(diff * scale * viewport.zw);\n\tvec2 normal = vec2(-tangent.y, tangent.x);\n\n\tvec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart\n\t\t+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd\n\n\t\t+ thickness * normal * .5 * lineOffset / viewport.zw;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]), - frag: glslify(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\n\nuniform float dashSize, pixelRatio, thickness, opacity, id;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvoid main() {\n\tfloat alpha = 1.;\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]), + return error2d - attributes: { - // if point is at the end of segment - lineEnd: { - buffer: offsetBuffer, - divisor: 0, - stride: 8, - offset: 0 - }, - // if point is at the top of segment - lineTop: { - buffer: offsetBuffer, - divisor: 0, - stride: 8, - offset: 4 - }, - // beginning of line coordinate - aCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 8, - divisor: 1 - }, - // end of line coordinate - bCoord: { - buffer: regl.prop('positionBuffer'), - stride: 8, - offset: 16, - divisor: 1 - }, - aCoordFract: { - buffer: regl.prop('positionFractBuffer'), - stride: 8, - offset: 8, - divisor: 1 - }, - bCoordFract: { - buffer: regl.prop('positionFractBuffer'), - stride: 8, - offset: 16, - divisor: 1 - }, - color: { - buffer: regl.prop('colorBuffer'), - stride: 4, - offset: 0, - divisor: 1 - } + function error2d (opts) { + //update + if (opts) { + update(opts) } - }, shaderOptions)) - // create regl draw - var drawMiterLine + //destroy + else if (opts === null) { + destroy() + } - try { - drawMiterLine = regl(extend({ - // culling removes polygon creasing - cull: { - enable: true, - face: 'back' + draw() + } + + + //main draw method + function draw (options) { + if (typeof options === 'number') { return drawGroup(options) } + + //make options a batch + if (options && !Array.isArray(options)) { options = [options] } + + + regl._refresh() + + //render multiple polylines via regl batch + groups.forEach(function (s, i) { + if (!s) { return } + + if (options) { + if (!options[i]) { s.draw = false } + else { s.draw = true } + } + + //ignore draw flag for one pass + if (!s.draw) { + s.draw = true; + return + } + + drawGroup(i) + }) + } + + //draw single error group by id + function drawGroup (s) { + if (typeof s === 'number') { s = groups[s] } + if (s == null) { return } + + if (!(s && s.count && s.color && s.opacity && s.positions && s.positions.length > 1)) { return } + + s.scaleRatio = [ + s.scale[0] * s.viewport.width, + s.scale[1] * s.viewport.height + ] + + drawErrors(s) + + if (s.after) { s.after(s) } + } + + function update (options) { + if (!options) { return } + + //direct points argument + if (options.length != null) { + if (typeof options[0] === 'number') { options = [{positions: options}] } + } + + //make options a batch + else if (!Array.isArray(options)) { options = [options] } + + //global count of points + var pointCount = 0, errorCount = 0 + + error2d.groups = groups = options.map(function (options, i) { + var group = groups[i] + + if (!options) { return group } + else if (typeof options === 'function') { options = {after: options} } + else if (typeof options[0] === 'number') { options = {positions: options} } + + //copy options to avoid mutation & handle aliases + options = pick(options, { + color: 'color colors fill', + capSize: 'capSize cap capsize cap-size', + lineWidth: 'lineWidth line-width width line thickness', + opacity: 'opacity alpha', + range: 'range dataBox', + viewport: 'viewport viewBox', + errors: 'errors error', + positions: 'positions position data points' + }) + + if (!group) { + groups[i] = group = { + id: i, + scale: null, + translate: null, + scaleFract: null, + translateFract: null, + draw: true + } + options = extend({}, defaults, options) + } + + updateDiff(group, options, [{ + lineWidth: function (v) { return +v * .5; }, + capSize: function (v) { return +v * .5; }, + opacity: parseFloat, + errors: function (errors) { + errors = flatten(errors) + + errorCount += errors.length + return errors + }, + positions: function (positions, state) { + positions = flatten(positions, 'float64') + state.count = Math.floor(positions.length / 2) + state.bounds = getBounds(positions, 2) + state.offset = pointCount + + pointCount += state.count + + return positions + } + }, { + color: function (colors, state) { + var count = state.count + + if (!colors) { colors = 'transparent' } + + // 'black' or [0,0,0,0] case + if (!Array.isArray(colors) || typeof colors[0] === 'number') { + var color = colors + colors = Array(count) + for (var i = 0; i < count; i++) { + colors[i] = color + } + } + + if (colors.length < count) { throw Error('Not enough colors') } + + var colorData = new Uint8Array(count * 4) + + //convert colors to float arrays + for (var i$1 = 0; i$1 < count; i$1++) { + var c = rgba(colors[i$1], 'uint8') + colorData.set(c, i$1 * 4) + } + + return colorData + }, + + range: function (range, state, options) { + var bounds = state.bounds + if (!range) { range = bounds } + + state.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])] + state.translate = [-range[0], -range[1]] + + state.scaleFract = fract32(state.scale) + state.translateFract = fract32(state.translate) + + return range + }, + + viewport: function (vp) { + var viewport + + if (Array.isArray(vp)) { + viewport = { + x: vp[0], + y: vp[1], + width: vp[2] - vp[0], + height: vp[3] - vp[1] + } + } + else if (vp) { + viewport = { + x: vp.x || vp.left || 0, + y: vp.y || vp.top || 0 + } + + if (vp.right) { viewport.width = vp.right - viewport.x } + else { viewport.width = vp.w || vp.width || 0 } + + if (vp.bottom) { viewport.height = vp.bottom - viewport.y } + else { viewport.height = vp.h || vp.height || 0 } + } + else { + viewport = { + x: 0, y: 0, + width: gl.drawingBufferWidth, + height: gl.drawingBufferHeight + } + } + + return viewport + } + }]) + + return group + }) + + if (pointCount || errorCount) { + var len = groups.reduce(function (acc, group, i) { + return acc + (group ? group.count : 0) + }, 0) + + var positionData = new Float64Array(len * 2) + var colorData = new Uint8Array(len * 4) + var errorData = new Float32Array(len * 4) + + groups.forEach(function (group, i) { + if (!group) { return } + var positions = group.positions; + var count = group.count; + var offset = group.offset; + var color = group.color; + var errors = group.errors; + if (!count) { return } + + colorData.set(color, offset * 4) + errorData.set(errors, offset * 4) + positionData.set(positions, offset * 2) + }) + + positionBuffer(float32(positionData)) + positionFractBuffer(fract32(positionData)) + colorBuffer(colorData) + errorBuffer(errorData) + } + + } + + function destroy () { + positionBuffer.destroy() + positionFractBuffer.destroy() + colorBuffer.destroy() + errorBuffer.destroy() + meshBuffer.destroy() + } +} + +},{"array-bounds":54,"color-normalize":109,"flatten-vertex-data":217,"object-assign":440,"pick-by-alias":451,"to-float32":516,"update-diff":527}],477:[function(_dereq_,module,exports){ +'use strict' + + +var rgba = _dereq_('color-normalize') +var getBounds = _dereq_('array-bounds') +var extend = _dereq_('object-assign') +var glslify = _dereq_('glslify') +var pick = _dereq_('pick-by-alias') +var flatten = _dereq_('flatten-vertex-data') +var triangulate = _dereq_('earcut') +var normalize = _dereq_('array-normalize') +var ref = _dereq_('to-float32'); +var float32 = ref.float32; +var fract32 = ref.fract32; +var WeakMap = _dereq_('es6-weak-map') +var parseRect = _dereq_('parse-rect') + + +module.exports = Line2D + + +/** @constructor */ +function Line2D (regl, options) { + if (!(this instanceof Line2D)) { return new Line2D(regl, options) } + + if (typeof regl === 'function') { + if (!options) { options = {} } + options.regl = regl + } + else { + options = regl + } + if (options.length) { options.positions = options } + regl = options.regl + + if (!regl.hasExtension('ANGLE_instanced_arrays')) { + throw Error('regl-error2d: `ANGLE_instanced_arrays` extension should be enabled'); + } + + // persistent variables + this.gl = regl._gl + this.regl = regl + + // list of options for lines + this.passes = [] + + // cached shaders instance + this.shaders = Line2D.shaders.has(regl) ? Line2D.shaders.get(regl) : Line2D.shaders.set(regl, Line2D.createShaders(regl)).get(regl) + + + // init defaults + this.update(options) +} + + +Line2D.dashMult = 2 +Line2D.maxPatternLength = 256 +Line2D.precisionThreshold = 3e6 +Line2D.maxPoints = 1e4 +Line2D.maxLines = 2048 + + +// cache of created draw calls per-regl instance +Line2D.shaders = new WeakMap() + + +// create static shaders once +Line2D.createShaders = function (regl) { + var offsetBuffer = regl.buffer({ + usage: 'static', + type: 'float', + data: [0,1, 0,0, 1,1, 1,0] + }) + + var shaderOptions = { + primitive: 'triangle strip', + instances: regl.prop('count'), + count: 4, + offset: 0, + + uniforms: { + miterMode: function (ctx, prop) { return prop.join === 'round' ? 2 : 1; }, + miterLimit: regl.prop('miterLimit'), + scale: regl.prop('scale'), + scaleFract: regl.prop('scaleFract'), + translateFract: regl.prop('translateFract'), + translate: regl.prop('translate'), + thickness: regl.prop('thickness'), + dashPattern: regl.prop('dashTexture'), + opacity: regl.prop('opacity'), + pixelRatio: regl.context('pixelRatio'), + id: regl.prop('id'), + dashSize: regl.prop('dashLength'), + viewport: function (c, p) { return [p.viewport.x, p.viewport.y, c.viewportWidth, c.viewportHeight]; }, + depth: regl.prop('depth') + }, + + blend: { + enable: true, + color: [0,0,0,0], + equation: { + rgb: 'add', + alpha: 'add' + }, + func: { + srcRGB: 'src alpha', + dstRGB: 'one minus src alpha', + srcAlpha: 'one minus dst alpha', + dstAlpha: 'one' + } + }, + depth: { + enable: function (c, p) { + return !p.overlay + } + }, + stencil: {enable: false}, + scissor: { + enable: true, + box: regl.prop('viewport') + }, + viewport: regl.prop('viewport') + } + + + // simplified rectangular line shader + var drawRectLine = regl(extend({ + vert: glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;\nattribute vec4 color;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {\n\t// the order is important\n\treturn position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n}\n\nvoid main() {\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineOffset = lineTop * 2. - 1.;\n\n\tvec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);\n\ttangent = normalize(diff * scale * viewport.zw);\n\tvec2 normal = vec2(-tangent.y, tangent.x);\n\n\tvec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart\n\t\t+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd\n\n\t\t+ thickness * normal * .5 * lineOffset / viewport.zw;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]), + frag: glslify(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\n\nuniform float dashSize, pixelRatio, thickness, opacity, id;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvoid main() {\n\tfloat alpha = 1.;\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]), + + attributes: { + // if point is at the end of segment + lineEnd: { + buffer: offsetBuffer, + divisor: 0, + stride: 8, + offset: 0 + }, + // if point is at the top of segment + lineTop: { + buffer: offsetBuffer, + divisor: 0, + stride: 8, + offset: 4 + }, + // beginning of line coordinate + aCoord: { + buffer: regl.prop('positionBuffer'), + stride: 8, + offset: 8, + divisor: 1 + }, + // end of line coordinate + bCoord: { + buffer: regl.prop('positionBuffer'), + stride: 8, + offset: 16, + divisor: 1 + }, + aCoordFract: { + buffer: regl.prop('positionFractBuffer'), + stride: 8, + offset: 8, + divisor: 1 + }, + bCoordFract: { + buffer: regl.prop('positionFractBuffer'), + stride: 8, + offset: 16, + divisor: 1 + }, + color: { + buffer: regl.prop('colorBuffer'), + stride: 4, + offset: 0, + divisor: 1 + } + } + }, shaderOptions)) + + // create regl draw + var drawMiterLine + + try { + drawMiterLine = regl(extend({ + // culling removes polygon creasing + cull: { + enable: true, + face: 'back' }, vert: glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, nextCoord, prevCoord;\nattribute vec4 aColor, bColor;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, translate;\nuniform float thickness, pixelRatio, id, depth;\nuniform vec4 viewport;\nuniform float miterLimit, miterMode;\n\nvarying vec4 fragColor;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 tangent;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nconst float REVERSE_THRESHOLD = -.875;\nconst float MIN_DIFF = 1e-6;\n\n// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead\n// TODO: precalculate dot products, normalize things beforehead etc.\n// TODO: refactor to rectangular algorithm\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nbool isNaN( float val ){\n return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true;\n}\n\nvoid main() {\n\tvec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord;\n\n vec2 adjustedScale;\n adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x;\n adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y;\n\n vec2 scaleRatio = adjustedScale * viewport.zw;\n\tvec2 normalWidth = thickness / scaleRatio;\n\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineBot = 1. - lineTop;\n\n\tfragColor = (lineStart * aColor + lineEnd * bColor) / 255.;\n\n\tif (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return;\n\n\tif (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord);\n\tif (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord);\n\n\tvec2 prevDiff = aCoord - prevCoord;\n\tvec2 currDiff = bCoord - aCoord;\n\tvec2 nextDiff = nextCoord - bCoord;\n\n\tvec2 prevTangent = normalize(prevDiff * scaleRatio);\n\tvec2 currTangent = normalize(currDiff * scaleRatio);\n\tvec2 nextTangent = normalize(nextDiff * scaleRatio);\n\n\tvec2 prevNormal = vec2(-prevTangent.y, prevTangent.x);\n\tvec2 currNormal = vec2(-currTangent.y, currTangent.x);\n\tvec2 nextNormal = vec2(-nextTangent.y, nextTangent.x);\n\n\tvec2 startJoinDirection = normalize(prevTangent - currTangent);\n\tvec2 endJoinDirection = normalize(currTangent - nextTangent);\n\n\t// collapsed/unidirectional segment cases\n\t// FIXME: there should be more elegant solution\n\tvec2 prevTanDiff = abs(prevTangent - currTangent);\n\tvec2 nextTanDiff = abs(nextTangent - currTangent);\n\tif (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) {\n\t\tstartJoinDirection = currNormal;\n\t}\n\tif (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) {\n\t\tendJoinDirection = currNormal;\n\t}\n\tif (aCoord == bCoord) {\n\t\tendJoinDirection = startJoinDirection;\n\t\tcurrNormal = prevNormal;\n\t\tcurrTangent = prevTangent;\n\t}\n\n\ttangent = currTangent;\n\n\t//calculate join shifts relative to normals\n\tfloat startJoinShift = dot(currNormal, startJoinDirection);\n\tfloat endJoinShift = dot(currNormal, endJoinDirection);\n\n\tfloat startMiterRatio = abs(1. / startJoinShift);\n\tfloat endMiterRatio = abs(1. / endJoinShift);\n\n\tvec2 startJoin = startJoinDirection * startMiterRatio;\n\tvec2 endJoin = endJoinDirection * endMiterRatio;\n\n\tvec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin;\n\tstartTopJoin = sign(startJoinShift) * startJoin * .5;\n\tstartBotJoin = -startTopJoin;\n\n\tendTopJoin = sign(endJoinShift) * endJoin * .5;\n\tendBotJoin = -endTopJoin;\n\n\tvec2 aTopCoord = aCoord + normalWidth * startTopJoin;\n\tvec2 bTopCoord = bCoord + normalWidth * endTopJoin;\n\tvec2 aBotCoord = aCoord + normalWidth * startBotJoin;\n\tvec2 bBotCoord = bCoord + normalWidth * endBotJoin;\n\n\t//miter anti-clipping\n\tfloat baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x)));\n\tfloat abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x)));\n\n\t//prevent close to reverse direction switch\n\tbool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) < length(normalWidth * currNormal);\n\tbool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) < length(normalWidth * currNormal);\n\n\tif (prevReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.);\n\t\taBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\taTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]), @@ -93673,7 +93723,7 @@ return this } -},{"array-bounds":53,"array-normalize":54,"color-normalize":108,"earcut":156,"es6-weak-map":209,"flatten-vertex-data":216,"glslify":392,"object-assign":437,"parse-rect":442,"pick-by-alias":448,"to-float32":514}],475:[function(_dereq_,module,exports){ +},{"array-bounds":54,"array-normalize":55,"color-normalize":109,"earcut":157,"es6-weak-map":210,"flatten-vertex-data":217,"glslify":395,"object-assign":440,"parse-rect":445,"pick-by-alias":451,"to-float32":516}],478:[function(_dereq_,module,exports){ 'use strict'; function _slicedToArray(arr, i) { @@ -94643,434 +94693,433 @@ module.exports = reglScatter2d; -},{"array-bounds":53,"color-id":106,"color-normalize":108,"flatten-vertex-data":216,"glslify":476,"is-iexplorer":402,"object-assign":437,"parse-rect":442,"pick-by-alias":448,"point-cluster":452,"to-float32":514,"update-diff":525}],476:[function(_dereq_,module,exports){ -arguments[4][392][0].apply(exports,arguments) -},{"dup":392}],477:[function(_dereq_,module,exports){ -'use strict' - - -var createScatter = _dereq_('regl-scatter2d') -var pick = _dereq_('pick-by-alias') -var getBounds = _dereq_('array-bounds') -var raf = _dereq_('raf') -var arrRange = _dereq_('array-range') -var rect = _dereq_('parse-rect') -var flatten = _dereq_('flatten-vertex-data') - - -module.exports = SPLOM - - -// @constructor -function SPLOM (regl, options) { - if (!(this instanceof SPLOM)) { return new SPLOM(regl, options) } - - // render passes - this.traces = [] - - // passes for scatter, combined across traces - this.passes = {} - - this.regl = regl - - // main scatter drawing instance - this.scatter = createScatter(regl) - - this.canvas = this.scatter.canvas -} - - -// update & draw passes once per frame +},{"array-bounds":54,"color-id":107,"color-normalize":109,"flatten-vertex-data":217,"glslify":395,"is-iexplorer":405,"object-assign":440,"parse-rect":445,"pick-by-alias":451,"point-cluster":455,"to-float32":516,"update-diff":527}],479:[function(_dereq_,module,exports){ +'use strict' + + +var createScatter = _dereq_('regl-scatter2d') +var pick = _dereq_('pick-by-alias') +var getBounds = _dereq_('array-bounds') +var raf = _dereq_('raf') +var arrRange = _dereq_('array-range') +var rect = _dereq_('parse-rect') +var flatten = _dereq_('flatten-vertex-data') + + +module.exports = SPLOM + + +// @constructor +function SPLOM (regl, options) { + if (!(this instanceof SPLOM)) { return new SPLOM(regl, options) } + + // render passes + this.traces = [] + + // passes for scatter, combined across traces + this.passes = {} + + this.regl = regl + + // main scatter drawing instance + this.scatter = createScatter(regl) + + this.canvas = this.scatter.canvas +} + + +// update & draw passes once per frame SPLOM.prototype.render = function () { var this$1 = this; var ref; var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (args.length) { - (ref = this).update.apply(ref, args) - } - - if (this.regl.attributes.preserveDrawingBuffer) { return this.draw() } - - // make sure draw is not called more often than once a frame - if (this.dirty) { - if (this.planned == null) { - this.planned = raf(function () { - this$1.draw() - this$1.dirty = true - this$1.planned = null - }) - } - } - else { - this.draw() - this.dirty = true - raf(function () { - this$1.dirty = false - }) - } - - return this -} - - -// update passes + while ( len-- ) args[ len ] = arguments[ len ]; + if (args.length) { + (ref = this).update.apply(ref, args) + } + + if (this.regl.attributes.preserveDrawingBuffer) { return this.draw() } + + // make sure draw is not called more often than once a frame + if (this.dirty) { + if (this.planned == null) { + this.planned = raf(function () { + this$1.draw() + this$1.dirty = true + this$1.planned = null + }) + } + } + else { + this.draw() + this.dirty = true + raf(function () { + this$1.dirty = false + }) + } + + return this +} + + +// update passes SPLOM.prototype.update = function () { var this$1 = this; var ref; var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (!args.length) { return } - - for (var i = 0; i < args.length; i++) { - this$1.updateItem(i, args[i]) - } - - // remove nulled passes - this.traces = this.traces.filter(Boolean) - - // FIXME: update passes independently - var passes = [] - var offset = 0 - for (var i$1 = 0; i$1 < this.traces.length; i$1++) { - var trace = this$1.traces[i$1] - var tracePasses = this$1.traces[i$1].passes - for (var j = 0; j < tracePasses.length; j++) { - passes.push(this$1.passes[tracePasses[j]]) - } - // save offset of passes - trace.passOffset = offset - offset += trace.passes.length - } - - (ref = this.scatter).update.apply(ref, passes) - - return this -} - - -// update trace by index, not supposed to be called directly + while ( len-- ) args[ len ] = arguments[ len ]; + if (!args.length) { return } + + for (var i = 0; i < args.length; i++) { + this$1.updateItem(i, args[i]) + } + + // remove nulled passes + this.traces = this.traces.filter(Boolean) + + // FIXME: update passes independently + var passes = [] + var offset = 0 + for (var i$1 = 0; i$1 < this.traces.length; i$1++) { + var trace = this$1.traces[i$1] + var tracePasses = this$1.traces[i$1].passes + for (var j = 0; j < tracePasses.length; j++) { + passes.push(this$1.passes[tracePasses[j]]) + } + // save offset of passes + trace.passOffset = offset + offset += trace.passes.length + } + + (ref = this.scatter).update.apply(ref, passes) + + return this +} + + +// update trace by index, not supposed to be called directly SPLOM.prototype.updateItem = function (i, options) { var this$1 = this; - + var ref = this; - var regl = ref.regl; - - // remove pass if null - if (options === null) { - this.traces[i] = null - return this - } - - if (!options) { return this } - - var o = pick(options, { - data: 'data items columns rows values dimensions samples x', - snap: 'snap cluster', - size: 'sizes size radius', - color: 'colors color fill fill-color fillColor', - opacity: 'opacity alpha transparency opaque', - borderSize: 'borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline', - borderColor: 'borderColors borderColor bordercolor stroke stroke-color strokeColor', - marker: 'markers marker shape', - range: 'range ranges databox dataBox', - viewport: 'viewport viewBox viewbox', - domain: 'domain domains area areas', - padding: 'pad padding paddings pads margin margins', - transpose: 'transpose transposed', - diagonal: 'diagonal diag showDiagonal', - upper: 'upper up top upperhalf upperHalf showupperhalf showUpper showUpperHalf', - lower: 'lower low bottom lowerhalf lowerHalf showlowerhalf showLowerHalf showLower' - }) - - // we provide regl buffer per-trace, since trace data can be changed - var trace = (this.traces[i] || (this.traces[i] = { - id: i, - buffer: regl.buffer({ - usage: 'dynamic', - type: 'float', - data: new Uint8Array() - }), - color: 'black', - marker: null, - size: 12, - borderColor: 'transparent', - borderSize: 1, - viewport: rect([regl._gl.drawingBufferWidth, regl._gl.drawingBufferHeight]), - padding: [0, 0, 0, 0], - opacity: 1, - diagonal: true, - upper: true, - lower: true - })) - - - // save styles - if (o.color != null) { - trace.color = o.color - } - if (o.size != null) { - trace.size = o.size - } - if (o.marker != null) { - trace.marker = o.marker - } - if (o.borderColor != null) { - trace.borderColor = o.borderColor - } - if (o.borderSize != null) { - trace.borderSize = o.borderSize - } - if (o.opacity != null) { - trace.opacity = o.opacity - } - if (o.viewport) { - trace.viewport = rect(o.viewport) - } - if (o.diagonal != null) { trace.diagonal = o.diagonal } - if (o.upper != null) { trace.upper = o.upper } - if (o.lower != null) { trace.lower = o.lower } - - // put flattened data into buffer - if (o.data) { - trace.buffer(flatten(o.data)) - trace.columns = o.data.length - trace.count = o.data[0].length - - // detect bounds per-column - trace.bounds = [] - - for (var i$1 = 0; i$1 < trace.columns; i$1++) { - trace.bounds[i$1] = getBounds(o.data[i$1], 1) - } - } - - // add proper range updating markers - var multirange - if (o.range) { - trace.range = o.range - multirange = trace.range && typeof trace.range[0] !== 'number' - } - - if (o.domain) { - trace.domain = o.domain - } - var multipadding = false - if (o.padding != null) { - // multiple paddings - if (Array.isArray(o.padding) && o.padding.length === trace.columns && typeof o.padding[o.padding.length - 1] === 'number') { - trace.padding = o.padding.map(getPad) - multipadding = true - } - // single padding - else { - trace.padding = getPad(o.padding) - } - } - - // create passes - var m = trace.columns - var n = trace.count - - var w = trace.viewport.width - var h = trace.viewport.height - var left = trace.viewport.x - var top = trace.viewport.y - var iw = w / m - var ih = h / m - - trace.passes = [] - - for (var i$2 = 0; i$2 < m; i$2++) { - for (var j = 0; j < m; j++) { - if (!trace.diagonal && j === i$2) { continue } - if (!trace.upper && i$2 > j) { continue } - if (!trace.lower && i$2 < j) { continue } - - var key = passId(trace.id, i$2, j) - - var pass = this$1.passes[key] || (this$1.passes[key] = {}) - - if (o.data) { - if (o.transpose) { - pass.positions = { - x: {buffer: trace.buffer, offset: j, count: n, stride: m}, - y: {buffer: trace.buffer, offset: i$2, count: n, stride: m} - } - } - else { - pass.positions = { - x: {buffer: trace.buffer, offset: j * n, count: n}, - y: {buffer: trace.buffer, offset: i$2 * n, count: n} - } - } - - pass.bounds = getBox(trace.bounds, i$2, j) - } - - if (o.domain || o.viewport || o.data) { - var pad = multipadding ? getBox(trace.padding, i$2, j) : trace.padding - if (trace.domain) { + var regl = ref.regl; + + // remove pass if null + if (options === null) { + this.traces[i] = null + return this + } + + if (!options) { return this } + + var o = pick(options, { + data: 'data items columns rows values dimensions samples x', + snap: 'snap cluster', + size: 'sizes size radius', + color: 'colors color fill fill-color fillColor', + opacity: 'opacity alpha transparency opaque', + borderSize: 'borderSizes borderSize border-size bordersize borderWidth borderWidths border-width borderwidth stroke-width strokeWidth strokewidth outline', + borderColor: 'borderColors borderColor bordercolor stroke stroke-color strokeColor', + marker: 'markers marker shape', + range: 'range ranges databox dataBox', + viewport: 'viewport viewBox viewbox', + domain: 'domain domains area areas', + padding: 'pad padding paddings pads margin margins', + transpose: 'transpose transposed', + diagonal: 'diagonal diag showDiagonal', + upper: 'upper up top upperhalf upperHalf showupperhalf showUpper showUpperHalf', + lower: 'lower low bottom lowerhalf lowerHalf showlowerhalf showLowerHalf showLower' + }) + + // we provide regl buffer per-trace, since trace data can be changed + var trace = (this.traces[i] || (this.traces[i] = { + id: i, + buffer: regl.buffer({ + usage: 'dynamic', + type: 'float', + data: new Uint8Array() + }), + color: 'black', + marker: null, + size: 12, + borderColor: 'transparent', + borderSize: 1, + viewport: rect([regl._gl.drawingBufferWidth, regl._gl.drawingBufferHeight]), + padding: [0, 0, 0, 0], + opacity: 1, + diagonal: true, + upper: true, + lower: true + })) + + + // save styles + if (o.color != null) { + trace.color = o.color + } + if (o.size != null) { + trace.size = o.size + } + if (o.marker != null) { + trace.marker = o.marker + } + if (o.borderColor != null) { + trace.borderColor = o.borderColor + } + if (o.borderSize != null) { + trace.borderSize = o.borderSize + } + if (o.opacity != null) { + trace.opacity = o.opacity + } + if (o.viewport) { + trace.viewport = rect(o.viewport) + } + if (o.diagonal != null) { trace.diagonal = o.diagonal } + if (o.upper != null) { trace.upper = o.upper } + if (o.lower != null) { trace.lower = o.lower } + + // put flattened data into buffer + if (o.data) { + trace.buffer(flatten(o.data)) + trace.columns = o.data.length + trace.count = o.data[0].length + + // detect bounds per-column + trace.bounds = [] + + for (var i$1 = 0; i$1 < trace.columns; i$1++) { + trace.bounds[i$1] = getBounds(o.data[i$1], 1) + } + } + + // add proper range updating markers + var multirange + if (o.range) { + trace.range = o.range + multirange = trace.range && typeof trace.range[0] !== 'number' + } + + if (o.domain) { + trace.domain = o.domain + } + var multipadding = false + if (o.padding != null) { + // multiple paddings + if (Array.isArray(o.padding) && o.padding.length === trace.columns && typeof o.padding[o.padding.length - 1] === 'number') { + trace.padding = o.padding.map(getPad) + multipadding = true + } + // single padding + else { + trace.padding = getPad(o.padding) + } + } + + // create passes + var m = trace.columns + var n = trace.count + + var w = trace.viewport.width + var h = trace.viewport.height + var left = trace.viewport.x + var top = trace.viewport.y + var iw = w / m + var ih = h / m + + trace.passes = [] + + for (var i$2 = 0; i$2 < m; i$2++) { + for (var j = 0; j < m; j++) { + if (!trace.diagonal && j === i$2) { continue } + if (!trace.upper && i$2 > j) { continue } + if (!trace.lower && i$2 < j) { continue } + + var key = passId(trace.id, i$2, j) + + var pass = this$1.passes[key] || (this$1.passes[key] = {}) + + if (o.data) { + if (o.transpose) { + pass.positions = { + x: {buffer: trace.buffer, offset: j, count: n, stride: m}, + y: {buffer: trace.buffer, offset: i$2, count: n, stride: m} + } + } + else { + pass.positions = { + x: {buffer: trace.buffer, offset: j * n, count: n}, + y: {buffer: trace.buffer, offset: i$2 * n, count: n} + } + } + + pass.bounds = getBox(trace.bounds, i$2, j) + } + + if (o.domain || o.viewport || o.data) { + var pad = multipadding ? getBox(trace.padding, i$2, j) : trace.padding + if (trace.domain) { var ref$1 = getBox(trace.domain, i$2, j); var lox = ref$1[0]; var loy = ref$1[1]; var hix = ref$1[2]; - var hiy = ref$1[3]; - - pass.viewport = [ - left + lox * w + pad[0], - top + loy * h + pad[1], - left + hix * w - pad[2], - top + hiy * h - pad[3] - ] - } - // consider auto-domain equipartial - else { - pass.viewport = [ - left + j * iw + iw * pad[0], - top + i$2 * ih + ih * pad[1], - left + (j + 1) * iw - iw * pad[2], - top + (i$2 + 1) * ih - ih * pad[3] - ] - } - } - - if (o.color) { pass.color = trace.color } - if (o.size) { pass.size = trace.size } - if (o.marker) { pass.marker = trace.marker } - if (o.borderSize) { pass.borderSize = trace.borderSize } - if (o.borderColor) { pass.borderColor = trace.borderColor } - if (o.opacity) { pass.opacity = trace.opacity } - - if (o.range) { - pass.range = multirange ? getBox(trace.range, i$2, j) : trace.range || pass.bounds - } - - trace.passes.push(key) - } - } - - return this -} - - -// draw all or passed passes + var hiy = ref$1[3]; + + pass.viewport = [ + left + lox * w + pad[0], + top + loy * h + pad[1], + left + hix * w - pad[2], + top + hiy * h - pad[3] + ] + } + // consider auto-domain equipartial + else { + pass.viewport = [ + left + j * iw + iw * pad[0], + top + i$2 * ih + ih * pad[1], + left + (j + 1) * iw - iw * pad[2], + top + (i$2 + 1) * ih - ih * pad[3] + ] + } + } + + if (o.color) { pass.color = trace.color } + if (o.size) { pass.size = trace.size } + if (o.marker) { pass.marker = trace.marker } + if (o.borderSize) { pass.borderSize = trace.borderSize } + if (o.borderColor) { pass.borderColor = trace.borderColor } + if (o.opacity) { pass.opacity = trace.opacity } + + if (o.range) { + pass.range = multirange ? getBox(trace.range, i$2, j) : trace.range || pass.bounds + } + + trace.passes.push(key) + } + } + + return this +} + + +// draw all or passed passes SPLOM.prototype.draw = function () { var this$1 = this; var ref$2; var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - if (!args.length) { - this.scatter.draw() - } - else { - var idx = [] - for (var i = 0; i < args.length; i++) { - // draw(0, 2, 5) - draw traces - if (typeof args[i] === 'number' ) { + while ( len-- ) args[ len ] = arguments[ len ]; + if (!args.length) { + this.scatter.draw() + } + else { + var idx = [] + for (var i = 0; i < args.length; i++) { + // draw(0, 2, 5) - draw traces + if (typeof args[i] === 'number' ) { var ref = this$1.traces[args[i]]; var passes = ref.passes; - var passOffset = ref.passOffset; - idx.push.apply(idx, arrRange(passOffset, passOffset + passes.length)) - } - // draw([0, 1, 2 ...], [3, 4, 5]) - draw points - else if (args[i].length) { - var els = args[i] + var passOffset = ref.passOffset; + idx.push.apply(idx, arrRange(passOffset, passOffset + passes.length)) + } + // draw([0, 1, 2 ...], [3, 4, 5]) - draw points + else if (args[i].length) { + var els = args[i] var ref$1 = this$1.traces[i]; var passes$1 = ref$1.passes; - var passOffset$1 = ref$1.passOffset; - passes$1 = passes$1.map(function (passId, i) { - idx[passOffset$1 + i] = els - }) - } - } - (ref$2 = this.scatter).draw.apply(ref$2, idx) - } - - return this -} - - -// dispose resources -SPLOM.prototype.destroy = function () { - this.traces.forEach(function (trace) { - if (trace.buffer && trace.buffer.destroy) { trace.buffer.destroy() } - }) - this.traces = null - this.passes = null - - this.scatter.destroy() - - return this -} - - -// return pass corresponding to trace i- j- square -function passId (trace, i, j) { - var id = (trace.id != null ? trace.id : trace) - var n = i - var m = j - var key = id << 16 | (n & 0xff) << 8 | m & 0xff - - return key -} - - -// return bounding box corresponding to a pass -function getBox (items, i, j) { - var ilox, iloy, ihix, ihiy, jlox, jloy, jhix, jhiy - var iitem = items[i], jitem = items[j] - - if (iitem.length > 2) { - ilox = iitem[0] - ihix = iitem[2] - iloy = iitem[1] - ihiy = iitem[3] - } - else if (iitem.length) { - ilox = iloy = iitem[0] - ihix = ihiy = iitem[1] - } - else { - ilox = iitem.x - iloy = iitem.y - ihix = iitem.x + iitem.width - ihiy = iitem.y + iitem.height - } - - if (jitem.length > 2) { - jlox = jitem[0] - jhix = jitem[2] - jloy = jitem[1] - jhiy = jitem[3] - } - else if (jitem.length) { - jlox = jloy = jitem[0] - jhix = jhiy = jitem[1] - } - else { - jlox = jitem.x - jloy = jitem.y - jhix = jitem.x + jitem.width - jhiy = jitem.y + jitem.height - } - - return [ jlox, iloy, jhix, ihiy ] -} - - -function getPad (arg) { - if (typeof arg === 'number') { return [arg, arg, arg, arg] } - else if (arg.length === 2) { return [arg[0], arg[1], arg[0], arg[1]] } - else { - var box = rect(arg) - return [box.x, box.y, box.x + box.width, box.y + box.height] - } -} -},{"array-bounds":53,"array-range":55,"flatten-vertex-data":216,"parse-rect":442,"pick-by-alias":448,"raf":467,"regl-scatter2d":475}],478:[function(_dereq_,module,exports){ + var passOffset$1 = ref$1.passOffset; + passes$1 = passes$1.map(function (passId, i) { + idx[passOffset$1 + i] = els + }) + } + } + (ref$2 = this.scatter).draw.apply(ref$2, idx) + } + + return this +} + + +// dispose resources +SPLOM.prototype.destroy = function () { + this.traces.forEach(function (trace) { + if (trace.buffer && trace.buffer.destroy) { trace.buffer.destroy() } + }) + this.traces = null + this.passes = null + + this.scatter.destroy() + + return this +} + + +// return pass corresponding to trace i- j- square +function passId (trace, i, j) { + var id = (trace.id != null ? trace.id : trace) + var n = i + var m = j + var key = id << 16 | (n & 0xff) << 8 | m & 0xff + + return key +} + + +// return bounding box corresponding to a pass +function getBox (items, i, j) { + var ilox, iloy, ihix, ihiy, jlox, jloy, jhix, jhiy + var iitem = items[i], jitem = items[j] + + if (iitem.length > 2) { + ilox = iitem[0] + ihix = iitem[2] + iloy = iitem[1] + ihiy = iitem[3] + } + else if (iitem.length) { + ilox = iloy = iitem[0] + ihix = ihiy = iitem[1] + } + else { + ilox = iitem.x + iloy = iitem.y + ihix = iitem.x + iitem.width + ihiy = iitem.y + iitem.height + } + + if (jitem.length > 2) { + jlox = jitem[0] + jhix = jitem[2] + jloy = jitem[1] + jhiy = jitem[3] + } + else if (jitem.length) { + jlox = jloy = jitem[0] + jhix = jhiy = jitem[1] + } + else { + jlox = jitem.x + jloy = jitem.y + jhix = jitem.x + jitem.width + jhiy = jitem.y + jitem.height + } + + return [ jlox, iloy, jhix, ihiy ] +} + + +function getPad (arg) { + if (typeof arg === 'number') { return [arg, arg, arg, arg] } + else if (arg.length === 2) { return [arg[0], arg[1], arg[0], arg[1]] } + else { + var box = rect(arg) + return [box.x, box.y, box.x + box.width, box.y + box.height] + } +} + +},{"array-bounds":54,"array-range":56,"flatten-vertex-data":217,"parse-rect":445,"pick-by-alias":451,"raf":470,"regl-scatter2d":478}],480:[function(_dereq_,module,exports){ (function(aa,ia){"object"===typeof exports&&"undefined"!==typeof module?module.exports=ia():"function"===typeof define&&define.amd?define(ia):aa.createREGL=ia()})(this,function(){function aa(a,b){this.id=Ab++;this.type=a;this.data=b}function ia(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1 * @@ -95294,7 +95343,7 @@ return res; } -},{}],480:[function(_dereq_,module,exports){ +},{}],482:[function(_dereq_,module,exports){ (function (global){ module.exports = global.performance && @@ -95305,7 +95354,7 @@ } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],481:[function(_dereq_,module,exports){ +},{}],483:[function(_dereq_,module,exports){ "use strict" module.exports = compressExpansion @@ -95340,7 +95389,7 @@ e.length = top return e } -},{}],482:[function(_dereq_,module,exports){ +},{}],484:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -95444,7 +95493,7 @@ } generateDispatch() -},{"robust-compress":481,"robust-scale":488,"robust-sum":491,"two-product":519}],483:[function(_dereq_,module,exports){ +},{"robust-compress":483,"robust-scale":490,"robust-sum":493,"two-product":521}],485:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -95459,7 +95508,7 @@ } return r } -},{"robust-sum":491,"two-product":519}],484:[function(_dereq_,module,exports){ +},{"robust-sum":493,"two-product":521}],486:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -95627,7 +95676,7 @@ } generateInSphereTest() -},{"robust-scale":488,"robust-subtract":490,"robust-sum":491,"two-product":519}],485:[function(_dereq_,module,exports){ +},{"robust-scale":490,"robust-subtract":492,"robust-sum":493,"two-product":521}],487:[function(_dereq_,module,exports){ "use strict" var determinant = _dereq_("robust-determinant") @@ -95699,7 +95748,7 @@ } generateDispatch() -},{"robust-determinant":482}],486:[function(_dereq_,module,exports){ +},{"robust-determinant":484}],488:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -95890,7 +95939,7 @@ } generateOrientationProc() -},{"robust-scale":488,"robust-subtract":490,"robust-sum":491,"two-product":519}],487:[function(_dereq_,module,exports){ +},{"robust-scale":490,"robust-subtract":492,"robust-sum":493,"two-product":521}],489:[function(_dereq_,module,exports){ "use strict" var robustSum = _dereq_("robust-sum") @@ -95920,7 +95969,7 @@ } return r } -},{"robust-scale":488,"robust-sum":491}],488:[function(_dereq_,module,exports){ +},{"robust-scale":490,"robust-sum":493}],490:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -95971,7 +96020,7 @@ g.length = count return g } -},{"two-product":519,"two-sum":520}],489:[function(_dereq_,module,exports){ +},{"two-product":521,"two-sum":522}],491:[function(_dereq_,module,exports){ "use strict" module.exports = segmentsIntersect @@ -96019,7 +96068,7 @@ return true } -},{"robust-orientation":486}],490:[function(_dereq_,module,exports){ +},{"robust-orientation":488}],492:[function(_dereq_,module,exports){ "use strict" module.exports = robustSubtract @@ -96176,7 +96225,7 @@ g.length = count return g } -},{}],491:[function(_dereq_,module,exports){ +},{}],493:[function(_dereq_,module,exports){ "use strict" module.exports = linearExpansionSum @@ -96333,7 +96382,7 @@ g.length = count return g } -},{}],492:[function(_dereq_,module,exports){ +},{}],494:[function(_dereq_,module,exports){ "use strict" module.exports = function signum(x) { @@ -96341,7 +96390,7 @@ if(x > 0) { return 1 } return 0.0 } -},{}],493:[function(_dereq_,module,exports){ +},{}],495:[function(_dereq_,module,exports){ 'use strict' module.exports = boundary @@ -96353,7 +96402,7 @@ return reduce(bnd(cells)) } -},{"boundary-cells":83,"reduce-simplicial-complex":472}],494:[function(_dereq_,module,exports){ +},{"boundary-cells":84,"reduce-simplicial-complex":475}],496:[function(_dereq_,module,exports){ 'use strict' module.exports = extractContour @@ -96516,7 +96565,7 @@ vertexWeights: uweights } } -},{"./lib/codegen":495,"ndarray":433,"ndarray-sort":431,"typedarray-pool":521}],495:[function(_dereq_,module,exports){ +},{"./lib/codegen":497,"ndarray":436,"ndarray-sort":434,"typedarray-pool":523}],497:[function(_dereq_,module,exports){ 'use strict' module.exports = getPolygonizer @@ -96613,7 +96662,7 @@ } return alg } -},{"marching-simplex-table":410,"typedarray-pool":521}],496:[function(_dereq_,module,exports){ +},{"marching-simplex-table":413,"typedarray-pool":523}],498:[function(_dereq_,module,exports){ "use strict"; "use restrict"; var bits = _dereq_("bit-twiddle") @@ -96957,11 +97006,11 @@ } exports.connectedComponents = connectedComponents -},{"bit-twiddle":80,"union-find":522}],497:[function(_dereq_,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"dup":80}],498:[function(_dereq_,module,exports){ -arguments[4][496][0].apply(exports,arguments) -},{"bit-twiddle":497,"dup":496,"union-find":499}],499:[function(_dereq_,module,exports){ +},{"bit-twiddle":81,"union-find":524}],499:[function(_dereq_,module,exports){ +arguments[4][81][0].apply(exports,arguments) +},{"dup":81}],500:[function(_dereq_,module,exports){ +arguments[4][498][0].apply(exports,arguments) +},{"bit-twiddle":499,"dup":498,"union-find":501}],501:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -97018,7 +97067,7 @@ } -},{}],500:[function(_dereq_,module,exports){ +},{}],502:[function(_dereq_,module,exports){ "use strict" module.exports = simplifyPolygon @@ -97290,7 +97339,7 @@ edges: ncells } } -},{"robust-orientation":486,"simplicial-complex":498}],501:[function(_dereq_,module,exports){ +},{"robust-orientation":488,"simplicial-complex":500}],503:[function(_dereq_,module,exports){ "use strict" module.exports = orderSegments @@ -97386,7 +97435,7 @@ } return ar[0] - br[0] } -},{"robust-orientation":486}],502:[function(_dereq_,module,exports){ +},{"robust-orientation":488}],504:[function(_dereq_,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -97617,7 +97666,7 @@ } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":501,"binary-search-bounds":79,"functional-red-black-tree":219,"robust-orientation":486}],503:[function(_dereq_,module,exports){ +},{"./lib/order-segments":503,"binary-search-bounds":80,"functional-red-black-tree":220,"robust-orientation":488}],505:[function(_dereq_,module,exports){ "use strict" var robustDot = _dereq_("robust-dot-product") @@ -97709,7 +97758,7 @@ } return neg } -},{"robust-dot-product":483,"robust-sum":491}],504:[function(_dereq_,module,exports){ +},{"robust-dot-product":485,"robust-sum":493}],506:[function(_dereq_,module,exports){ /* global window, exports, define */ !function() { @@ -97726,11 +97775,11 @@ not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, - sign: /^[\+\-]/ + sign: /^[+-]/ } function sprintf(key) { @@ -97743,42 +97792,42 @@ } function sprintf_format(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign + var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign for (i = 0; i < tree_length; i++) { if (typeof parse_tree[i] === 'string') { output += parse_tree[i] } - else if (Array.isArray(parse_tree[i])) { - match = parse_tree[i] // convenience purposes only - if (match[2]) { // keyword argument + else if (typeof parse_tree[i] === 'object') { + ph = parse_tree[i] // convenience purposes only + if (ph.keys) { // keyword argument arg = argv[cursor] - for (k = 0; k < match[2].length; k++) { - if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) + for (k = 0; k < ph.keys.length; k++) { + if (arg == undefined) { + throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1])) } - arg = arg[match[2][k]] + arg = arg[ph.keys[k]] } } - else if (match[1]) { // positional argument (explicit) - arg = argv[match[1]] + else if (ph.param_no) { // positional argument (explicit) + arg = argv[ph.param_no] } else { // positional argument (implicit) arg = argv[cursor++] } - if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) { + if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) { arg = arg() } - if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) { + if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) { throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) } - if (re.number.test(match[8])) { + if (re.number.test(ph.type)) { is_positive = arg >= 0 } - switch (match[8]) { + switch (ph.type) { case 'b': arg = parseInt(arg, 10).toString(2) break @@ -97790,38 +97839,38 @@ arg = parseInt(arg, 10) break case 'j': - arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) + arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0) break case 'e': - arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() + arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential() break case 'f': - arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) + arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg) break case 'g': - arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg) + arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg) break case 'o': arg = (parseInt(arg, 10) >>> 0).toString(8) break case 's': arg = String(arg) - arg = (match[7] ? arg.substring(0, match[7]) : arg) + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) break case 't': arg = String(!!arg) - arg = (match[7] ? arg.substring(0, match[7]) : arg) + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) break case 'T': arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() - arg = (match[7] ? arg.substring(0, match[7]) : arg) + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) break case 'u': arg = parseInt(arg, 10) >>> 0 break case 'v': arg = arg.valueOf() - arg = (match[7] ? arg.substring(0, match[7]) : arg) + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) break case 'x': arg = (parseInt(arg, 10) >>> 0).toString(16) @@ -97830,21 +97879,21 @@ arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() break } - if (re.json.test(match[8])) { + if (re.json.test(ph.type)) { output += arg } else { - if (re.number.test(match[8]) && (!is_positive || match[3])) { + if (re.number.test(ph.type) && (!is_positive || ph.sign)) { sign = is_positive ? '+' : '-' arg = arg.toString().replace(re.sign, '') } else { sign = '' } - pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' - pad_length = match[6] - (sign + arg).length - pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' - output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) + pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ' + pad_length = ph.width - (sign + arg).length + pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' + output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) } } } @@ -97895,7 +97944,20 @@ if (arg_names === 3) { throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') } - parse_tree.push(match) + + parse_tree.push( + { + placeholder: match[0], + param_no: match[1], + keys: match[2], + sign: match[3], + pad_char: match[4], + align: match[5], + width: match[6], + precision: match[7], + type: match[8] + } + ) } else { throw new SyntaxError('[sprintf] unexpected placeholder') @@ -97927,9 +97989,9 @@ } } /* eslint-enable quote-props */ -}() +}(); // eslint-disable-line -},{}],505:[function(_dereq_,module,exports){ +},{}],507:[function(_dereq_,module,exports){ 'use strict' var paren = _dereq_('parenthesis') @@ -97987,7 +98049,7 @@ return parts } -},{"parenthesis":441}],506:[function(_dereq_,module,exports){ +},{"parenthesis":444}],508:[function(_dereq_,module,exports){ "use strict" module.exports = stronglyConnectedComponents @@ -98103,7 +98165,7 @@ return {components: components, adjacencyList: sccAdjList} } -},{}],507:[function(_dereq_,module,exports){ +},{}],509:[function(_dereq_,module,exports){ "use strict" module.exports = surfaceNets @@ -98311,7 +98373,7 @@ } return proc(array,level) } -},{"ndarray-extract-contour":422,"triangulate-hypercube":517,"zero-crossings":550}],508:[function(_dereq_,module,exports){ +},{"ndarray-extract-contour":425,"triangulate-hypercube":519,"zero-crossings":552}],510:[function(_dereq_,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -98505,7 +98567,7 @@ exports.default = arcToBezier; module.exports = exports.default; -},{}],509:[function(_dereq_,module,exports){ +},{}],511:[function(_dereq_,module,exports){ 'use strict' var parse = _dereq_('parse-svg-path') @@ -98550,7 +98612,7 @@ return bounds } -},{"abs-svg-path":48,"assert":56,"is-svg-path":407,"normalize-svg-path":510,"parse-svg-path":443}],510:[function(_dereq_,module,exports){ +},{"abs-svg-path":49,"assert":57,"is-svg-path":410,"normalize-svg-path":512,"parse-svg-path":446}],512:[function(_dereq_,module,exports){ 'use strict' module.exports = normalize @@ -98674,7 +98736,7 @@ ] } -},{"svg-arc-to-cubic-bezier":508}],511:[function(_dereq_,module,exports){ +},{"svg-arc-to-cubic-bezier":510}],513:[function(_dereq_,module,exports){ 'use strict' var pathBounds = _dereq_('svg-path-bounds') @@ -98777,7 +98839,7 @@ return path2DSupported = idata && idata.data && idata.data[3] === 255 } -},{"bitmap-sdf":81,"draw-svg-path":153,"is-svg-path":407,"parse-svg-path":443,"svg-path-bounds":509}],512:[function(_dereq_,module,exports){ +},{"bitmap-sdf":82,"draw-svg-path":154,"is-svg-path":410,"parse-svg-path":446,"svg-path-bounds":511}],514:[function(_dereq_,module,exports){ (function (process){ 'use strict' @@ -98874,7 +98936,7 @@ } }).call(this,_dereq_('_process')) -},{"_process":465,"vectorize-text":526}],513:[function(_dereq_,module,exports){ +},{"_process":468,"vectorize-text":528}],515:[function(_dereq_,module,exports){ // TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -100071,7 +100133,7 @@ })(Math); -},{}],514:[function(_dereq_,module,exports){ +},{}],516:[function(_dereq_,module,exports){ /* @module to-float32 */ 'use strict' @@ -100082,32 +100144,37 @@ module.exports.fract32 = module.exports.fract = fract32 +var narr = new Float32Array(1) + // return fractional part of float32 array function fract32 (arr) { - if (typeof arr === 'number') { - return float32(arr - float32(arr)) + if (arr.length) { + var fract = float32(arr) + for (var i = 0, l = fract.length; i < l; i++) { + fract[i] = arr[i] - fract[i] + } + return fract } - var fract = float32(arr) - for (var i = 0, l = fract.length; i < l; i++) { - fract[i] = arr[i] - fract[i] - } - return fract + // number + return float32(arr - float32(arr)) } // make sure data is float32 array function float32 (arr) { - if (arr instanceof Float32Array) return arr - if (typeof arr === 'number') { - return (new Float32Array([arr]))[0] + if (arr.length) { + if (arr instanceof Float32Array) return arr + var float = new Float32Array(arr) + float.set(arr) + return float } - var float = new Float32Array(arr) - float.set(arr) - return float + // number + narr[0] = arr + return narr[0] } -},{}],515:[function(_dereq_,module,exports){ +},{}],517:[function(_dereq_,module,exports){ 'use strict' var parseUnit = _dereq_('parse-unit') @@ -100168,7 +100235,7 @@ } return 1 } -},{"parse-unit":444}],516:[function(_dereq_,module,exports){ +},{"parse-unit":447}],518:[function(_dereq_,module,exports){ // https://github.com/topojson/topojson-client Version 2.1.0. Copyright 2016 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -100688,7 +100755,7 @@ }))); -},{}],517:[function(_dereq_,module,exports){ +},{}],519:[function(_dereq_,module,exports){ "use strict" module.exports = triangulateCube @@ -100722,7 +100789,7 @@ } return result } -},{"gamma":220,"permutation-parity":446,"permutation-rank":447}],518:[function(_dereq_,module,exports){ +},{"gamma":221,"permutation-parity":449,"permutation-rank":450}],520:[function(_dereq_,module,exports){ 'use strict' module.exports = createTurntableController @@ -101295,7 +101362,7 @@ theta, phi) } -},{"filtered-vector":215,"gl-mat4/invert":254,"gl-mat4/rotate":258,"gl-vec3/cross":317,"gl-vec3/dot":322,"gl-vec3/normalize":339}],519:[function(_dereq_,module,exports){ +},{"filtered-vector":216,"gl-mat4/invert":256,"gl-mat4/rotate":260,"gl-vec3/cross":320,"gl-vec3/dot":325,"gl-vec3/normalize":342}],521:[function(_dereq_,module,exports){ "use strict" module.exports = twoProduct @@ -101329,7 +101396,7 @@ return [ y, x ] } -},{}],520:[function(_dereq_,module,exports){ +},{}],522:[function(_dereq_,module,exports){ "use strict" module.exports = fastTwoSum @@ -101347,7 +101414,7 @@ } return [ar+br, x] } -},{}],521:[function(_dereq_,module,exports){ +},{}],523:[function(_dereq_,module,exports){ (function (global,Buffer){ 'use strict' @@ -101564,7 +101631,7 @@ } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_("buffer").Buffer) -},{"bit-twiddle":80,"buffer":93,"dup":155}],522:[function(_dereq_,module,exports){ +},{"bit-twiddle":81,"buffer":94,"dup":156}],524:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -101627,7 +101694,7 @@ ++ranks[xr]; } } -},{}],523:[function(_dereq_,module,exports){ +},{}],525:[function(_dereq_,module,exports){ "use strict" function unique_pred(list, compare) { @@ -101686,7 +101753,7 @@ module.exports = unique -},{}],524:[function(_dereq_,module,exports){ +},{}],526:[function(_dereq_,module,exports){ var reg = /[\'\"]/ module.exports = function unquote(str) { @@ -101702,7 +101769,7 @@ return str } -},{}],525:[function(_dereq_,module,exports){ +},{}],527:[function(_dereq_,module,exports){ /** * @module update-diff */ @@ -101735,7 +101802,7 @@ return obj } -},{}],526:[function(_dereq_,module,exports){ +},{}],528:[function(_dereq_,module,exports){ "use strict" module.exports = createText @@ -101762,9 +101829,7 @@ options) } -},{"./lib/vtext":527}],527:[function(_dereq_,module,exports){ -"use strict" - +},{"./lib/vtext":529}],529:[function(_dereq_,module,exports){ module.exports = vectorizeText module.exports.processPixels = processPixels @@ -101964,92 +102029,91 @@ var i, j, xPos, yPos, zPos var nDone = 0 - for(i = 0; i < numberOfLines; ++i) { - - var txt = allTexts[i] + '\n' - xPos = 0 - yPos = i * lineHeight - zPos = fontSize - - var buffer = "" - function writeBuffer() { - if(buffer !== "") { - var delta = context.measureText(buffer).width + var buffer = "" + function writeBuffer() { + if(buffer !== "") { + var delta = context.measureText(buffer).width - context.fillText(buffer, offsetX + xPos, offsetY + yPos) - xPos += delta - } + context.fillText(buffer, offsetX + xPos, offsetY + yPos) + xPos += delta } + } - function changeStyle(oldStyle, newStyle) { - - function getTextFontSize() { - return "" + Math.round(zPos) + "px "; - } + function getTextFontSize() { + return "" + Math.round(zPos) + "px "; + } - var ctxFont = "" + context.font; + function changeStyle(oldStyle, newStyle) { + var ctxFont = "" + context.font; - if(styletags.subscripts === true) { - var oldIndex_Sub = oldStyle.indexOf(CHR_sub0); - var newIndex_Sub = newStyle.indexOf(CHR_sub0); + if(styletags.subscripts === true) { + var oldIndex_Sub = oldStyle.indexOf(CHR_sub0); + var newIndex_Sub = newStyle.indexOf(CHR_sub0); - var oldSub = (oldIndex_Sub > -1) ? parseInt(oldStyle[1 + oldIndex_Sub]) : 0; - var newSub = (newIndex_Sub > -1) ? parseInt(newStyle[1 + newIndex_Sub]) : 0; + var oldSub = (oldIndex_Sub > -1) ? parseInt(oldStyle[1 + oldIndex_Sub]) : 0; + var newSub = (newIndex_Sub > -1) ? parseInt(newStyle[1 + newIndex_Sub]) : 0; - if(oldSub !== newSub) { - ctxFont = ctxFont.replace(getTextFontSize(), "?px ") - zPos *= Math.pow(0.75, (newSub - oldSub)) - ctxFont = ctxFont.replace("?px ", getTextFontSize()) - } - yPos += 0.25 * lineHeight * (newSub - oldSub); + if(oldSub !== newSub) { + ctxFont = ctxFont.replace(getTextFontSize(), "?px ") + zPos *= Math.pow(0.75, (newSub - oldSub)) + ctxFont = ctxFont.replace("?px ", getTextFontSize()) } + yPos += 0.25 * lineHeight * (newSub - oldSub); + } - if(styletags.superscripts === true) { - var oldIndex_Super = oldStyle.indexOf(CHR_super0); - var newIndex_Super = newStyle.indexOf(CHR_super0); + if(styletags.superscripts === true) { + var oldIndex_Super = oldStyle.indexOf(CHR_super0); + var newIndex_Super = newStyle.indexOf(CHR_super0); - var oldSuper = (oldIndex_Super > -1) ? parseInt(oldStyle[1 + oldIndex_Super]) : 0; - var newSuper = (newIndex_Super > -1) ? parseInt(newStyle[1 + newIndex_Super]) : 0; + var oldSuper = (oldIndex_Super > -1) ? parseInt(oldStyle[1 + oldIndex_Super]) : 0; + var newSuper = (newIndex_Super > -1) ? parseInt(newStyle[1 + newIndex_Super]) : 0; - if(oldSuper !== newSuper) { - ctxFont = ctxFont.replace(getTextFontSize(), "?px ") - zPos *= Math.pow(0.75, (newSuper - oldSuper)) - ctxFont = ctxFont.replace("?px ", getTextFontSize()) - } - yPos -= 0.25 * lineHeight * (newSuper - oldSuper); + if(oldSuper !== newSuper) { + ctxFont = ctxFont.replace(getTextFontSize(), "?px ") + zPos *= Math.pow(0.75, (newSuper - oldSuper)) + ctxFont = ctxFont.replace("?px ", getTextFontSize()) } + yPos -= 0.25 * lineHeight * (newSuper - oldSuper); + } - if(styletags.bolds === true) { - var wasBold = (oldStyle.indexOf(CHR_bold) > -1) - var is_Bold = (newStyle.indexOf(CHR_bold) > -1) + if(styletags.bolds === true) { + var wasBold = (oldStyle.indexOf(CHR_bold) > -1) + var is_Bold = (newStyle.indexOf(CHR_bold) > -1) - if(!wasBold && is_Bold) { - if(wasItalic) { - ctxFont = ctxFont.replace("italic ", "italic bold ") - } else { - ctxFont = "bold " + ctxFont - } - } - if(wasBold && !is_Bold) { - ctxFont = ctxFont.replace("bold ", '') + if(!wasBold && is_Bold) { + if(wasItalic) { + ctxFont = ctxFont.replace("italic ", "italic bold ") + } else { + ctxFont = "bold " + ctxFont } } + if(wasBold && !is_Bold) { + ctxFont = ctxFont.replace("bold ", '') + } + } - if(styletags.italics === true) { - var wasItalic = (oldStyle.indexOf(CHR_italic) > -1) - var is_Italic = (newStyle.indexOf(CHR_italic) > -1) + if(styletags.italics === true) { + var wasItalic = (oldStyle.indexOf(CHR_italic) > -1) + var is_Italic = (newStyle.indexOf(CHR_italic) > -1) - if(!wasItalic && is_Italic) { - ctxFont = "italic " + ctxFont - } - if(wasItalic && !is_Italic) { - ctxFont = ctxFont.replace("italic ", '') - } + if(!wasItalic && is_Italic) { + ctxFont = "italic " + ctxFont + } + if(wasItalic && !is_Italic) { + ctxFont = ctxFont.replace("italic ", '') } - - context.font = ctxFont } + context.font = ctxFont + } + for(i = 0; i < numberOfLines; ++i) { + var txt = allTexts[i] + '\n' + xPos = 0 + yPos = i * lineHeight + zPos = fontSize + + buffer = "" + for(j = 0; j < txt.length; ++j) { var style = (j + nDone < allStyles.length) ? allStyles[j + nDone] : allStyles[allStyles.length - 1] if(activeStyle === style) { @@ -102163,7 +102227,6 @@ } function vectorizeText(str, canvas, context, options) { - var size = 64 var lineSpacing = 1.25 var styletags = { @@ -102221,7 +102284,7 @@ return processPixels(pixels, options, size) } -},{"cdt2d":94,"clean-pslg":104,"ndarray":433,"planar-graph-to-polyline":451,"simplify-planar-graph":500,"surface-nets":507}],528:[function(_dereq_,module,exports){ +},{"cdt2d":95,"clean-pslg":105,"ndarray":436,"planar-graph-to-polyline":454,"simplify-planar-graph":502,"surface-nets":509}],530:[function(_dereq_,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -102908,7 +102971,7 @@ } })(); -},{}],529:[function(_dereq_,module,exports){ +},{}],531:[function(_dereq_,module,exports){ var hiddenStore = _dereq_('./hidden-store.js'); module.exports = createStore; @@ -102929,7 +102992,7 @@ }; } -},{"./hidden-store.js":530}],530:[function(_dereq_,module,exports){ +},{"./hidden-store.js":532}],532:[function(_dereq_,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -102947,7 +103010,7 @@ return store; } -},{}],531:[function(_dereq_,module,exports){ +},{}],533:[function(_dereq_,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -102978,14 +103041,14 @@ } } -},{"./create-store.js":529}],532:[function(_dereq_,module,exports){ +},{"./create-store.js":531}],534:[function(_dereq_,module,exports){ var getContext = _dereq_('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":221}],533:[function(_dereq_,module,exports){ +},{"get-canvas-context":222}],535:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103718,7 +103781,7 @@ } -},{"../main":547,"object-assign":437}],534:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],536:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103902,7 +103965,7 @@ main.calendars.coptic = CopticCalendar; -},{"../main":547,"object-assign":437}],535:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],537:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104130,7 +104193,7 @@ main.calendars.discworld = DiscworldCalendar; -},{"../main":547,"object-assign":437}],536:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],538:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104314,7 +104377,7 @@ main.calendars.ethiopian = EthiopianCalendar; -},{"../main":547,"object-assign":437}],537:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],539:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104588,7 +104651,7 @@ main.calendars.hebrew = HebrewCalendar; -},{"../main":547,"object-assign":437}],538:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],540:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104769,7 +104832,7 @@ main.calendars.islamic = IslamicCalendar; -},{"../main":547,"object-assign":437}],539:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],541:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104952,7 +105015,7 @@ main.calendars.julian = JulianCalendar; -},{"../main":547,"object-assign":437}],540:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],542:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -105247,7 +105310,7 @@ main.calendars.mayan = MayanCalendar; -},{"../main":547,"object-assign":437}],541:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],543:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -105427,7 +105490,7 @@ main.calendars.nanakshahi = NanakshahiCalendar; -},{"../main":547,"object-assign":437}],542:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],544:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -105850,7 +105913,7 @@ main.calendars.nepali = NepaliCalendar; -},{"../main":547,"object-assign":437}],543:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],545:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -106040,7 +106103,7 @@ main.calendars.jalali = PersianCalendar; -},{"../main":547,"object-assign":437}],544:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],546:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -106226,7 +106289,7 @@ main.calendars.taiwan = TaiwanCalendar; -},{"../main":547,"object-assign":437}],545:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],547:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -106412,7 +106475,7 @@ main.calendars.thai = ThaiCalendar; -},{"../main":547,"object-assign":437}],546:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],548:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -106777,7 +106840,7 @@ 79990]; -},{"../main":547,"object-assign":437}],547:[function(_dereq_,module,exports){ +},{"../main":549,"object-assign":440}],549:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -107682,7 +107745,7 @@ _exports.calendars.gregorian = GregorianCalendar; -},{"object-assign":437}],548:[function(_dereq_,module,exports){ +},{"object-assign":440}],550:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -108184,7 +108247,7 @@ }); -},{"./main":547,"object-assign":437}],549:[function(_dereq_,module,exports){ +},{"./main":549,"object-assign":440}],551:[function(_dereq_,module,exports){ module.exports = _dereq_('cwise-compiler')({ args: ['array', { offset: [1], @@ -108236,7 +108299,7 @@ funcName: 'zeroCrossings' }) -},{"cwise-compiler":134}],550:[function(_dereq_,module,exports){ +},{"cwise-compiler":135}],552:[function(_dereq_,module,exports){ "use strict" module.exports = findZeroCrossings @@ -108249,9 +108312,9 @@ core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":549}],551:[function(_dereq_,module,exports){ +},{"./lib/zc-core":551}],553:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -108320,9 +108383,9 @@ } ]; -},{}],552:[function(_dereq_,module,exports){ +},{}],554:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -108675,9 +108738,9 @@ } }); -},{"../../plot_api/plot_template":730,"../../plots/cartesian/constants":746,"../../plots/font_attributes":767,"./arrow_paths":551}],553:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":732,"../../plots/cartesian/constants":748,"../../plots/font_attributes":769,"./arrow_paths":553}],555:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -108764,9 +108827,9 @@ ann._extremes[axId] = extremes; } -},{"../../lib":692,"../../plots/cartesian/axes":740,"./draw":558}],554:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"./draw":560}],556:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -108849,11 +108912,11 @@ * } */ function getToggleSets(gd, hoverData) { - var annotations = gd._fullLayout.annotations, - onSet = [], - offSet = [], - explicitOffSet = [], - hoverLen = (hoverData || []).length; + var annotations = gd._fullLayout.annotations; + var onSet = []; + var offSet = []; + var explicitOffSet = []; + var hoverLen = (hoverData || []).length; var i, j, anni, showMode, pointj, xa, ya, toggleType; @@ -108903,9 +108966,9 @@ return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":692,"../../plot_api/plot_template":730,"../../registry":823}],555:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"../../registry":825}],557:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -108983,9 +109046,9 @@ coerce('captureevents', !!hoverText); }; -},{"../../lib":692,"../color":569}],556:[function(_dereq_,module,exports){ +},{"../../lib":694,"../color":571}],558:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -109014,19 +109077,19 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { ax = ax || {}; - var toLog = (newType === 'log') && (ax.type === 'linear'), - fromLog = (newType === 'linear') && (ax.type === 'log'); + var toLog = (newType === 'log') && (ax.type === 'linear'); + var fromLog = (newType === 'linear') && (ax.type === 'log'); if(!(toLog || fromLog)) return; - var annotations = gd._fullLayout.annotations, - axLetter = ax._id.charAt(0), - ann, - attrPrefix; + var annotations = gd._fullLayout.annotations; + var axLetter = ax._id.charAt(0); + var ann; + var attrPrefix; function convert(attr) { - var currentVal = ann[attr], - newVal = null; + var currentVal = ann[attr]; + var newVal = null; if(toLog) newVal = toLogRange(currentVal, ax.range); else newVal = Math.pow(10, currentVal); @@ -109046,9 +109109,9 @@ } }; -},{"../../lib/to_log_range":718,"fast-isnumeric":214}],557:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":720,"fast-isnumeric":215}],559:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -109088,9 +109151,10 @@ var showArrow = annOut.showarrow; // positioning - var axLetters = ['x', 'y'], - arrowPosDflt = [-10, -30], - gdMock = {_fullLayout: fullLayout}; + var axLetters = ['x', 'y']; + var arrowPosDflt = [-10, -30]; + var gdMock = {_fullLayout: fullLayout}; + for(var i = 0; i < 2; i++) { var axLetter = axLetters[i]; @@ -109106,9 +109170,9 @@ Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); if(showArrow) { - var arrowPosAttr = 'a' + axLetter, - // axref, ayref - aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var arrowPosAttr = 'a' + axLetter; + // axref, ayref + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -109152,9 +109216,9 @@ } } -},{"../../lib":692,"../../plots/array_container_defaults":736,"../../plots/cartesian/axes":740,"./attributes":552,"./common_defaults":555}],558:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"../../plots/cartesian/axes":742,"./attributes":554,"./common_defaults":557}],560:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -109272,8 +109336,8 @@ // calculated pixel positions // x & y each will get text, head, and tail as appropriate - var annPosPx = {x: {}, y: {}}, - textangle = +options.textangle || 0; + var annPosPx = {x: {}, y: {}}; + var textangle = +options.textangle || 0; // create the components // made a single group to contain all, so opacity can work right @@ -109340,9 +109404,9 @@ }); } - var borderwidth = options.borderwidth, - borderpad = options.borderpad, - borderfull = borderwidth + borderpad; + var borderwidth = options.borderwidth; + var borderpad = options.borderpad; + var borderfull = borderwidth + borderpad; var annTextBG = annTextGroupInner.append('rect') .attr('class', 'bg') @@ -109364,9 +109428,13 @@ var font = options.font; + var text = fullLayout.meta ? + Lib.templateString(options.text, {meta: fullLayout.meta}) : + options.text; + var annText = annTextGroupInner.append('text') .classed('annotation-text', true) - .text(options.text); + .text(text); function textLayout(s) { s.call(Drawing.font, font) @@ -109425,24 +109493,24 @@ var letters = ['x', 'y']; for(var i = 0; i < letters.length; i++) { - var axLetter = letters[i], - axRef = options[axLetter + 'ref'] || axLetter, - tailRef = options['a' + axLetter + 'ref'], - ax = {x: xa, y: ya}[axLetter], - dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, - // note that these two can be either positive or negative - annSizeFromWidth = outerWidth * Math.cos(dimAngle), - annSizeFromHeight = outerHeight * Math.sin(dimAngle), - // but this one is the positive total size - annSize = Math.abs(annSizeFromWidth) + Math.abs(annSizeFromHeight), - anchor = options[axLetter + 'anchor'], - overallShift = options[axLetter + 'shift'] * (axLetter === 'x' ? 1 : -1), - posPx = annPosPx[axLetter], - basePx, - textPadShift, - alignPosition, - autoAlignFraction, - textShift; + var axLetter = letters[i]; + var axRef = options[axLetter + 'ref'] || axLetter; + var tailRef = options['a' + axLetter + 'ref']; + var ax = {x: xa, y: ya}[axLetter]; + var dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180; + // note that these two can be either positive or negative + var annSizeFromWidth = outerWidth * Math.cos(dimAngle); + var annSizeFromHeight = outerHeight * Math.sin(dimAngle); + // but this one is the positive total size + 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; /* * calculate the *primary* pixel position @@ -109508,8 +109576,8 @@ posPx.head = Lib.constrain(posPx.head, 1, maxPx - 1); } if(tailRef === 'pixel') { - var shiftPlus = -Math.max(posPx.tail - 3, posPx.text), - shiftMinus = Math.min(posPx.tail + 3, posPx.text) - maxPx; + 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; @@ -109606,32 +109674,32 @@ .selectAll('.annotation-arrow-g') .remove(); - var headX = annPosPx.x.head, - headY = annPosPx.y.head, - tailX = annPosPx.x.tail + dx, - tailY = annPosPx.y.tail + dy, - textX = annPosPx.x.text + dx, - textY = annPosPx.y.text + dy, - - // find the edge of the text box, where we'll start the arrow: - // create transform matrix to rotate the text box corners - transform = Lib.rotationXYMatrix(textangle, textX, textY), - applyTransform = Lib.apply2DTransform(transform), - applyTransform2 = Lib.apply2DTransform2(transform), - - // calculate and transform bounding box - width = +annTextBG.attr('width'), - height = +annTextBG.attr('height'), - xLeft = textX - 0.5 * width, - xRight = xLeft + width, - yTop = textY - 0.5 * height, - yBottom = yTop + height, - edges = [ - [xLeft, yTop, xLeft, yBottom], - [xLeft, yBottom, xRight, yBottom], - [xRight, yBottom, xRight, yTop], - [xRight, yTop, xLeft, yTop] - ].map(applyTransform2); + 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; + + // find the edge of the text box, where we'll start the arrow: + // create transform matrix to rotate the text box corners + var transform = Lib.rotationXYMatrix(textangle, textX, textY); + var applyTransform = Lib.apply2DTransform(transform); + var applyTransform2 = Lib.apply2DTransform2(transform); + + // calculate and transform bounding box + 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); // Remove the line if it ends inside the box. Use ray // casting for rotated boxes: see which edges intersect a @@ -109655,9 +109723,9 @@ } }); - var strokewidth = options.arrowwidth, - arrowColor = options.arrowcolor, - arrowSide = options.arrowside; + var strokewidth = options.arrowwidth; + var arrowColor = options.arrowcolor; + var arrowSide = options.arrowside; var arrowGroup = annGroup.append('g') .style({opacity: Color.opacity(arrowColor)}) @@ -109712,9 +109780,9 @@ } }, moveFn: function(dx, dy) { - var annxy0 = applyTransform(annx0, anny0), - xcenter = annxy0[0] + dx, - ycenter = annxy0[1] + dy; + var annxy0 = applyTransform(annx0, anny0); + var xcenter = annxy0[0] + dx; + var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); modifyItem('x', xa ? @@ -109784,9 +109852,8 @@ xUpdate = xa.p2r(xa.r2p(options.x) + dx); } else { - var widthFraction = options._xsize / gs.w, - xLeft = options.x + (options._xshift - options.xshift) / gs.w - - widthFraction / 2; + var widthFraction = options._xsize / gs.w; + var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; xUpdate = dragElement.align(xLeft + dx / gs.w, widthFraction, 0, 1, options.xanchor); @@ -109795,9 +109862,8 @@ if(ya) { yUpdate = ya.p2r(ya.r2p(options.y) + dy); } else { - var heightFraction = options._ysize / gs.h, - yBottom = options.y - (options._yshift + options.yshift) / gs.h - - heightFraction / 2; + var heightFraction = options._ysize / gs.h; + var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; yUpdate = dragElement.align(yBottom - dy / gs.h, heightFraction, 0, 1, options.yanchor); @@ -109835,6 +109901,7 @@ .call(textLayout) .on('edit', function(_text) { options.text = _text; + this.call(textLayout); modifyItem('text', _text); @@ -109852,9 +109919,9 @@ else annText.call(textLayout); } -},{"../../lib":692,"../../lib/setcursor":712,"../../lib/svg_text_utils":716,"../../plot_api/plot_template":730,"../../plots/cartesian/axes":740,"../../plots/plots":804,"../../registry":823,"../color":569,"../dragelement":587,"../drawing":590,"../fx":608,"./draw_arrow_head":559,"d3":148}],559:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/setcursor":714,"../../lib/svg_text_utils":718,"../../plot_api/plot_template":732,"../../plots/cartesian/axes":742,"../../plots/plots":806,"../../registry":825,"../color":571,"../dragelement":589,"../drawing":592,"../fx":610,"./draw_arrow_head":561,"d3":149}],561:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -109924,8 +109991,8 @@ hideLine(); return; } - var backOffX = backOff * Math.cos(startRot), - backOffY = backOff * Math.sin(startRot); + var backOffX = backOff * Math.cos(startRot); + var backOffY = backOff * Math.sin(startRot); end.x += backOffX; end.y += backOffY; @@ -109938,8 +110005,8 @@ hideLine(); return; } - var startBackOffX = startBackOff * Math.cos(startRot), - startbackOffY = startBackOff * Math.sin(startRot); + var startBackOffX = startBackOff * Math.cos(startRot); + var startbackOffY = startBackOff * Math.sin(startRot); start.x -= startBackOffX; start.y -= startbackOffY; @@ -109948,12 +110015,12 @@ } } else if(el.nodeName === 'path') { - var pathlen = el.getTotalLength(), - // using dash to hide the backOff region of the path. - // if we ever allow dash for the arrow we'll have to - // do better than this hack... maybe just manually - // combine the two - dashArray = ''; + var pathlen = el.getTotalLength(); + // using dash to hide the backOff region of the path. + // if we ever allow dash for the arrow we'll have to + // do better than this hack... maybe just manually + // combine the two + var dashArray = ''; if(pathlen < backOff + startBackOff) { hideLine(); @@ -110006,9 +110073,9 @@ if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":569,"./arrow_paths":551,"d3":148}],560:[function(_dereq_,module,exports){ +},{"../color":571,"./arrow_paths":553,"d3":149}],562:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110040,9 +110107,9 @@ convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":751,"./attributes":552,"./calc_autorange":553,"./click":554,"./convert_coords":556,"./defaults":557,"./draw":558}],561:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":753,"./attributes":554,"./calc_autorange":555,"./click":556,"./convert_coords":558,"./defaults":559,"./draw":560}],563:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110128,9 +110195,9 @@ // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":723,"../../plot_api/plot_template":730,"../annotations/attributes":552}],562:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":725,"../../plot_api/plot_template":732,"../annotations/attributes":554}],564:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110193,9 +110260,9 @@ }; } -},{"../../lib":692,"../../plots/cartesian/axes":740}],563:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742}],565:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110269,9 +110336,9 @@ } } -},{"../../lib":692,"../../plots/array_container_defaults":736,"../../plots/cartesian/axes":740,"../annotations/common_defaults":555,"./attributes":561}],564:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"../../plots/cartesian/axes":742,"../annotations/common_defaults":557,"./attributes":563}],566:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110321,9 +110388,9 @@ } }; -},{"../../plots/gl3d/project":792,"../annotations/draw":558}],565:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":794,"../annotations/draw":560}],567:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110369,9 +110436,9 @@ } } -},{"../../lib":692,"../../registry":823,"./attributes":561,"./convert":562,"./defaults":563,"./draw":564}],566:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"./attributes":563,"./convert":564,"./defaults":565,"./draw":566}],568:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110402,9 +110469,9 @@ _dereq_('world-calendars/dist/calendars/thai'); _dereq_('world-calendars/dist/calendars/ummalqura'); -},{"world-calendars/dist/calendars/chinese":533,"world-calendars/dist/calendars/coptic":534,"world-calendars/dist/calendars/discworld":535,"world-calendars/dist/calendars/ethiopian":536,"world-calendars/dist/calendars/hebrew":537,"world-calendars/dist/calendars/islamic":538,"world-calendars/dist/calendars/julian":539,"world-calendars/dist/calendars/mayan":540,"world-calendars/dist/calendars/nanakshahi":541,"world-calendars/dist/calendars/nepali":542,"world-calendars/dist/calendars/persian":543,"world-calendars/dist/calendars/taiwan":544,"world-calendars/dist/calendars/thai":545,"world-calendars/dist/calendars/ummalqura":546,"world-calendars/dist/main":547,"world-calendars/dist/plus":548}],567:[function(_dereq_,module,exports){ +},{"world-calendars/dist/calendars/chinese":535,"world-calendars/dist/calendars/coptic":536,"world-calendars/dist/calendars/discworld":537,"world-calendars/dist/calendars/ethiopian":538,"world-calendars/dist/calendars/hebrew":539,"world-calendars/dist/calendars/islamic":540,"world-calendars/dist/calendars/julian":541,"world-calendars/dist/calendars/mayan":542,"world-calendars/dist/calendars/nanakshahi":543,"world-calendars/dist/calendars/nepali":544,"world-calendars/dist/calendars/persian":545,"world-calendars/dist/calendars/taiwan":546,"world-calendars/dist/calendars/thai":547,"world-calendars/dist/calendars/ummalqura":548,"world-calendars/dist/main":549,"world-calendars/dist/plus":550}],569:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110531,10 +110598,11 @@ }; function worldCalFmt(fmt, x, calendar) { - var dateJD = Math.floor((x + 0.05) / ONEDAY) + EPOCHJD, - cDate = getCal(calendar).fromJD(dateJD), - i = 0, - modifier, directive, directiveLen, directiveObj, replacementPart; + var dateJD = Math.floor((x + 0.05) / ONEDAY) + EPOCHJD; + var cDate = getCal(calendar).fromJD(dateJD); + var i = 0; + var modifier, directive, directiveLen, directiveObj, replacementPart; + while((i = fmt.indexOf('%', i)) !== -1) { modifier = fmt.charAt(i + 1); if(modifier === '0' || modifier === '-' || modifier === '_') { @@ -110676,9 +110744,9 @@ worldCalFmt: worldCalFmt }; -},{"../../constants/numerical":669,"../../lib":692,"./calendars":566}],568:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"./calendars":568}],570:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110716,9 +110784,9 @@ // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],569:[function(_dereq_,module,exports){ +},{}],571:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -110766,17 +110834,17 @@ var fc = tinycolor(front).toRgb(); if(fc.a === 1) return tinycolor(front).toRgbString(); - var bc = tinycolor(back || background).toRgb(), - bcflat = bc.a === 1 ? bc : { - r: 255 * (1 - bc.a) + bc.r * bc.a, - g: 255 * (1 - bc.a) + bc.g * bc.a, - b: 255 * (1 - bc.a) + bc.b * bc.a - }, - fcflat = { - r: bcflat.r * (1 - fc.a) + fc.r * fc.a, - g: bcflat.g * (1 - fc.a) + fc.g * fc.a, - b: bcflat.b * (1 - fc.a) + fc.b * fc.a - }; + var bc = tinycolor(back || background).toRgb(); + var bcflat = bc.a === 1 ? bc : { + r: 255 * (1 - bc.a) + bc.r * bc.a, + g: 255 * (1 - bc.a) + bc.g * bc.a, + b: 255 * (1 - bc.a) + bc.b * bc.a + }; + var fcflat = { + r: bcflat.r * (1 - fc.a) + fc.r * fc.a, + g: bcflat.g * (1 - fc.a) + fc.g * fc.a, + b: bcflat.b * (1 - fc.a) + fc.b * fc.a + }; return tinycolor(fcflat).toRgbString(); }; @@ -110818,11 +110886,8 @@ color.clean = function(container) { if(!container || typeof container !== 'object') return; - var keys = Object.keys(container), - i, - j, - key, - val; + var keys = Object.keys(container); + var i, j, key, val; for(i = 0; i < keys.length; i++) { key = keys[i]; @@ -110861,8 +110926,8 @@ var match = valTrim.match(/^rgba?\s*\(([^()]*)\)$/); if(!match) return val; - var parts = match[1].trim().split(/\s*[\s,]\s*/), - rgba = valTrim.charAt(3) === 'a' && parts.length === 4; + 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++) { @@ -110887,9 +110952,9 @@ return 'rgb(' + rgbStr + ')'; } -},{"./attributes":568,"fast-isnumeric":214,"tinycolor2":513}],570:[function(_dereq_,module,exports){ +},{"./attributes":570,"fast-isnumeric":215,"tinycolor2":515}],572:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -111066,9 +111131,9 @@ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/cartesian/layout_attributes":753,"../../plots/font_attributes":767}],571:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/cartesian/layout_attributes":755,"../../plots/font_attributes":769}],573:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -111110,26 +111175,33 @@ var trace = cd[0].trace; var cbId = 'cb' + trace.uid; - var containerName = moduleOpts.container; - var container = containerName ? trace[containerName] : trace; + moduleOpts = Array.isArray(moduleOpts) ? moduleOpts : [moduleOpts]; - gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); - if(!container || !container.showscale) return; + for(var i = 0; i < moduleOpts.length; i++) { + var containerName = moduleOpts[i].container; - var cb = cd[0].t.cb = drawColorbar(gd, cbId); + var container = containerName ? trace[containerName] : trace; + + gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); + if(!container || !container.showscale) continue; + + var cb = cd[0].t.cb = drawColorbar(gd, cbId); - var scl = container.reversescale ? - flipScale(container.colorscale) : - container.colorscale; + var scl = container.reversescale ? + flipScale(container.colorscale) : + container.colorscale; - cb.fillgradient(scl) - .zrange([container[moduleOpts.min], container[moduleOpts.max]]) - .options(container.colorbar)(); + cb.fillgradient(scl) + .zrange([container[moduleOpts[i].min], container[moduleOpts[i].max]]) + .options(container.colorbar)(); + + return; + } }; -},{"../colorscale/helpers":580,"./draw":574}],572:[function(_dereq_,module,exports){ +},{"../colorscale/helpers":582,"./draw":576}],574:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -111155,9 +111227,9 @@ } }; -},{}],573:[function(_dereq_,module,exports){ +},{}],575:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -111176,10 +111248,9 @@ var attributes = _dereq_('./attributes'); - module.exports = function colorbarDefaults(containerIn, containerOut, layout) { - var colorbarOut = Template.newContainer(containerOut, 'colorbar'), - colorbarIn = containerIn.colorbar || {}; + var colorbarOut = Template.newContainer(containerOut, 'colorbar'); + var colorbarIn = containerIn.colorbar || {}; function coerce(attr, dflt) { return Lib.coerce(colorbarIn, colorbarOut, attributes, attr, dflt); @@ -111222,9 +111293,9 @@ coerce('title.side'); }; -},{"../../lib":692,"../../plot_api/plot_template":730,"../../plots/cartesian/tick_label_defaults":760,"../../plots/cartesian/tick_mark_defaults":761,"../../plots/cartesian/tick_value_defaults":762,"./attributes":570}],574:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"../../plots/cartesian/tick_label_defaults":762,"../../plots/cartesian/tick_mark_defaults":763,"../../plots/cartesian/tick_value_defaults":764,"./attributes":572}],576:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -111289,8 +111360,8 @@ opts.zrange = null; function component() { - var fullLayout = gd._fullLayout, - gs = fullLayout._size; + var fullLayout = gd._fullLayout; + var gs = fullLayout._size; if((typeof opts.fillcolor !== 'function') && (typeof opts.line.color !== 'function') && !opts.fillgradient) { @@ -111308,10 +111379,10 @@ var l; var i; - var l0 = opts.levels.end + opts.levels.size / 100, - ls = opts.levels.size, - zr0 = (1.001 * zrange[0] - 0.001 * zrange[1]), - zr1 = (1.001 * zrange[1] - 0.001 * zrange[0]); + var l0 = opts.levels.end + opts.levels.size / 100; + var ls = opts.levels.size; + var zr0 = (1.001 * zrange[0] - 0.001 * zrange[1]); + var zr1 = (1.001 * zrange[1] - 0.001 * zrange[0]); for(i = 0; i < 1e5; i++) { l = opts.levels.start + i * ls; if(ls > 0 ? (l >= l0) : (l <= l0)) break; @@ -111359,72 +111430,70 @@ // when the colorbar itself is pushing the margins. // but then the fractional size is calculated based on the // actual graph size, so that the axes will size correctly. - var plotHeight = gs.h, - plotWidth = gs.w, - thickPx = Math.round(opts.thickness * - (opts.thicknessmode === 'fraction' ? plotWidth : 1)), - thickFrac = thickPx / gs.w, - lenPx = Math.round(opts.len * - (opts.lenmode === 'fraction' ? plotHeight : 1)), - lenFrac = lenPx / gs.h, - xpadFrac = opts.xpad / gs.w, - yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2, - ypadFrac = opts.ypad / gs.h, - - // x positioning: do it initially just for left anchor, - // then fix at the end (since we don't know the width yet) - xLeft = Math.round(opts.x * gs.w + opts.xpad), - // for dragging... this is getting a little muddled... - xLeftFrac = opts.x - thickFrac * - ({middle: 0.5, right: 1}[opts.xanchor]||0), - - // y positioning we can do correctly from the start - yBottomFrac = opts.y + lenFrac * - (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5), - yBottomPx = Math.round(gs.h * (1 - yBottomFrac)), - yTopPx = yBottomPx - lenPx, - titleEl, - 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, - tickfont: opts.tickfont, - tickangle: opts.tickangle, - tickformat: opts.tickformat, - exponentformat: opts.exponentformat, - 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: 'right', - position: 1 - }, - cbAxisOut = { - type: 'linear', - _id: 'y' + id - }, - axisOptions = { - letter: 'y', - font: fullLayout.font, - noHover: true, - noTickson: true, - calendar: fullLayout.calendar // not really necessary (yet?) - }; + var plotHeight = gs.h; + var plotWidth = gs.w; + var thickPx = Math.round(opts.thickness * (opts.thicknessmode === 'fraction' ? plotWidth : 1)); + var thickFrac = thickPx / gs.w; + var lenPx = Math.round(opts.len * (opts.lenmode === 'fraction' ? plotHeight : 1)); + var lenFrac = lenPx / gs.h; + var xpadFrac = opts.xpad / gs.w; + var yExtraPx = (opts.borderwidth + opts.outlinewidth) / 2; + var ypadFrac = opts.ypad / gs.h; + + // x positioning: do it initially just for left anchor, + // then fix at the end (since we don't know the width yet) + var xLeft = Math.round(opts.x * gs.w + opts.xpad); + // for dragging... this is getting a little muddled... + var xLeftFrac = opts.x - thickFrac * ({middle: 0.5, right: 1}[opts.xanchor]||0); + + // y positioning we can do correctly from the start + var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5); + var yBottomPx = Math.round(gs.h * (1 - yBottomFrac)); + var yTopPx = yBottomPx - lenPx; + + var titleEl; + + 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, + tickfont: opts.tickfont, + tickangle: opts.tickangle, + tickformat: opts.tickformat, + exponentformat: opts.exponentformat, + 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: 'right', + position: 1 + }; + var cbAxisOut = { + type: 'linear', + _id: 'y' + id + }; + var axisOptions = { + letter: 'y', + font: fullLayout.font, + noHover: true, + noTickson: true, + calendar: fullLayout.calendar // not really necessary (yet?) + }; // Coerce w.r.t. Axes layoutAttributes: // re-use axes.js logic without updating _fullData @@ -111455,10 +111524,8 @@ cbAxisOut.tick0 = opts.levels.start; var dtick = opts.levels.size; // expand if too many contours, so we don't get too many ticks - var autoNtick = Lib.constrain( - (yBottomPx - yTopPx) / 50, 4, 15) + 1, - dtFactor = (zrange[1] - zrange[0]) / - ((opts.nticks || autoNtick) * dtick); + var autoNtick = Lib.constrain((yBottomPx - yTopPx) / 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)); @@ -111514,9 +111581,9 @@ // draw the title so we know how much room it needs // when we squish the axis. This one only applies to // top or bottom titles, not right side. - var x = gs.l + (opts.x + xpadFrac) * gs.w, - fontSize = cbAxisOut.title.font.size, - y; + var x = gs.l + (opts.x + xpadFrac) * gs.w; + var fontSize = cbAxisOut.title.font.size; + var y; if(opts.title.side === 'top') { y = (1 - (yBottomFrac + lenFrac - ypadFrac)) * gs.h + @@ -111534,14 +111601,13 @@ function drawAxis() { if(['top', 'bottom'].indexOf(opts.title.side) !== -1) { // squish the axis top to make room for the title - var titleGroup = container.select('.cbtitle'), - titleText = titleGroup.select('text'), - titleTrans = - [-opts.outlinewidth / 2, opts.outlinewidth / 2], - mathJaxNode = titleGroup - .select('.h' + cbAxisOut._id + 'title-math-group') - .node(), - lineSize = 15.6; + var titleGroup = container.select('.cbtitle'); + var titleText = titleGroup.select('text'); + var titleTrans = [-opts.outlinewidth / 2, opts.outlinewidth / 2]; + var mathJaxNode = titleGroup + .select('.h' + cbAxisOut._id + 'title-math-group') + .node(); + var lineSize = 15.6; if(titleText.node()) { lineSize = parseInt(titleText.node().style.fontSize, 10) * LINE_SPACING; @@ -111685,11 +111751,11 @@ }, function() { if(['top', 'bottom'].indexOf(opts.title.side) === -1) { - var fontSize = cbAxisOut.title.font.size, - y = cbAxisOut._offset + cbAxisOut._length / 2, - x = gs.l + (cbAxisOut.position || 0) * gs.w + ((cbAxisOut.side === 'right') ? - 10 + fontSize * ((cbAxisOut.showticklabels ? 1 : 0.5)) : - -10 - fontSize * ((cbAxisOut.showticklabels ? 0.5 : 0))); + var fontSize = cbAxisOut.title.font.size; + var y = cbAxisOut._offset + cbAxisOut._length / 2; + var x = gs.l + (cbAxisOut.position || 0) * gs.w + ((cbAxisOut.side === 'right') ? + 10 + fontSize * ((cbAxisOut.showticklabels ? 1 : 0.5)) : + -10 - fontSize * ((cbAxisOut.showticklabels ? 0.5 : 0))); // the 'h' + is a hack to get around the fact that // convertToTspans rotates any 'y...' class by 90 degrees. @@ -111742,8 +111808,8 @@ if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { var mathJaxNode = titleCont .select('.h' + cbAxisOut._id + 'title-math-group') - .node(), - titleWidth; + .node(); + var titleWidth; if(mathJaxNode && ['top', 'bottom'].indexOf(opts.title.side) !== -1) { titleWidth = Drawing.bBox(mathJaxNode).width; @@ -111761,8 +111827,8 @@ } var outerwidth = 2 * opts.xpad + innerWidth + - opts.borderwidth + opts.outlinewidth / 2, - outerheight = yBottomPx - yTopPx; + opts.borderwidth + opts.outlinewidth / 2; + var outerheight = yBottomPx - yTopPx; container.select('.cbbg').attr({ x: xLeft - opts.xpad - @@ -111877,11 +111943,9 @@ } function getTrace() { - var idNum = id.substr(2), - i, - trace; - for(i = 0; i < gd._fullData.length; i++) { - trace = gd._fullData[i]; + var idNum = id.substr(2); + for(var i = 0; i < gd._fullData.length; i++) { + var trace = gd._fullData[i]; if(trace.uid === idNum) return trace; } } @@ -111927,9 +111991,9 @@ return component; }; -},{"../../constants/alignment":664,"../../lib":692,"../../lib/extend":682,"../../lib/setcursor":712,"../../lib/svg_text_utils":716,"../../plots/cartesian/axes":740,"../../plots/cartesian/axis_defaults":742,"../../plots/cartesian/layout_attributes":753,"../../plots/cartesian/position_defaults":756,"../../plots/plots":804,"../../registry":823,"../color":569,"../dragelement":587,"../drawing":590,"../titles":657,"./attributes":570,"./constants":572,"d3":148,"tinycolor2":513}],575:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../lib":694,"../../lib/extend":684,"../../lib/setcursor":714,"../../lib/svg_text_utils":718,"../../plots/cartesian/axes":742,"../../plots/cartesian/axis_defaults":744,"../../plots/cartesian/layout_attributes":755,"../../plots/cartesian/position_defaults":758,"../../plots/plots":806,"../../registry":825,"../color":571,"../dragelement":589,"../drawing":592,"../titles":659,"./attributes":572,"./constants":574,"d3":149,"tinycolor2":515}],577:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -111946,9 +112010,9 @@ return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":692}],576:[function(_dereq_,module,exports){ +},{"../../lib":694}],578:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112003,6 +112067,8 @@ * most of these attributes already require a recalc, but the ones that do not * have editType *style* or *plot* unless you override (presumably with *calc*) * + * - anim {boolean) (dflt: undefined): is 'color' animatable? + * * @return {object} */ module.exports = function colorScaleAttrs(context, opts) { @@ -112052,6 +112118,10 @@ editType: editTypeOverride || 'style', }; + + if(opts.anim) { + attrs.color.anim = true; + } } attrs[auto] = { @@ -112121,9 +112191,9 @@ return attrs; }; -},{"./scales.js":584}],577:[function(_dereq_,module,exports){ +},{"./scales.js":586}],579:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112177,9 +112247,9 @@ } }; -},{"../../lib":692}],578:[function(_dereq_,module,exports){ +},{"../../lib":694}],580:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112249,9 +112319,9 @@ } }; -},{"../../lib":692,"./helpers":580}],579:[function(_dereq_,module,exports){ +},{"../../lib":694,"./helpers":582}],581:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112312,9 +112382,9 @@ } }; -},{"../../lib":692,"../colorbar/defaults":573,"../colorbar/has_colorbar":575,"./scales":584,"fast-isnumeric":214}],580:[function(_dereq_,module,exports){ +},{"../../lib":694,"../colorbar/defaults":575,"../colorbar/has_colorbar":577,"./scales":586,"fast-isnumeric":215}],582:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112429,10 +112499,10 @@ function makeColorScaleFunc(specs, opts) { opts = opts || {}; - var domain = specs.domain, - range = specs.range, - N = range.length, - _range = new Array(N); + 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(); @@ -112444,9 +112514,9 @@ .range(_range) .clamp(true); - var noNumericCheck = opts.noNumericCheck, - returnArray = opts.returnArray, - sclFunc; + var noNumericCheck = opts.noNumericCheck; + var returnArray = opts.returnArray; + var sclFunc; if(noNumericCheck && returnArray) { sclFunc = _sclFunc; @@ -112498,9 +112568,9 @@ makeColorScaleFunc: makeColorScaleFunc }; -},{"../../lib":692,"../color":569,"./scales":584,"d3":148,"fast-isnumeric":214,"tinycolor2":513}],581:[function(_dereq_,module,exports){ +},{"../../lib":694,"../color":571,"./scales":586,"d3":149,"fast-isnumeric":215,"tinycolor2":515}],583:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112538,9 +112608,9 @@ makeColorScaleFunc: helpers.makeColorScaleFunc }; -},{"./attributes":576,"./calc":577,"./cross_trace_defaults":578,"./defaults":579,"./helpers":580,"./layout_attributes":582,"./layout_defaults":583,"./scales":584}],582:[function(_dereq_,module,exports){ +},{"./attributes":578,"./calc":579,"./cross_trace_defaults":580,"./defaults":581,"./helpers":582,"./layout_attributes":584,"./layout_defaults":585,"./scales":586}],584:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112578,9 +112648,9 @@ } }; -},{"./scales":584}],583:[function(_dereq_,module,exports){ +},{"./scales":586}],585:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112605,9 +112675,9 @@ coerce('diverging'); }; -},{"../../lib":692,"../../plot_api/plot_template":730,"./layout_attributes":582}],584:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"./layout_attributes":584}],586:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112809,9 +112879,9 @@ isValid: isValidScale }; -},{"tinycolor2":513}],585:[function(_dereq_,module,exports){ +},{"tinycolor2":515}],587:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112827,9 +112897,9 @@ // based on where you are, and return the fraction corresponding to // that position on the object module.exports = function align(v, dv, v0, v1, anchor) { - var vmin = (v - v0) / (v1 - v0), - vmax = vmin + dv / (v1 - v0), - vc = (vmin + vmax) / 2; + var vmin = (v - v0) / (v1 - v0); + var vmax = vmin + dv / (v1 - v0); + var vc = (vmin + vmax) / 2; // explicitly specified anchor if(anchor === 'left' || anchor === 'bottom') return vmin; @@ -112842,9 +112912,9 @@ return vc; }; -},{}],586:[function(_dereq_,module,exports){ +},{}],588:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -112880,9 +112950,9 @@ return cursorset[y][x]; }; -},{"../../lib":692}],587:[function(_dereq_,module,exports){ +},{"../../lib":694}],589:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -113181,9 +113251,9 @@ ); } -},{"../../constants/interactions":668,"../../lib":692,"../../plots/cartesian/constants":746,"../../registry":823,"./align":585,"./cursor":586,"./unhover":588,"has-hover":393,"has-passive-events":394,"mouse-event-offset":419}],588:[function(_dereq_,module,exports){ +},{"../../constants/interactions":670,"../../lib":694,"../../plots/cartesian/constants":748,"../../registry":825,"./align":587,"./cursor":588,"./unhover":590,"has-hover":396,"has-passive-events":397,"mouse-event-offset":422}],590:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -113239,9 +113309,9 @@ } }; -},{"../../lib/events":681,"../../lib/get_graph_div":688,"../../lib/throttle":717,"../fx/constants":602}],589:[function(_dereq_,module,exports){ +},{"../../lib/events":683,"../../lib/get_graph_div":690,"../../lib/throttle":719,"../fx/constants":604}],591:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -113264,9 +113334,9 @@ }; -},{}],590:[function(_dereq_,module,exports){ +},{}],592:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -113400,9 +113470,9 @@ drawing.singleLineStyle = function(d, s, lw, lc, ld) { s.style('fill', 'none'); - var line = (((d || [])[0] || {}).trace || {}).line || {}, - lw1 = lw || line.width||0, - dash = ld || line.dash || ''; + var line = (((d || [])[0] || {}).trace || {}).line || {}; + var lw1 = lw || line.width||0; + var dash = ld || line.dash || ''; Color.stroke(s, lc || line.color); drawing.dashLine(s, dash, lw1); @@ -113411,9 +113481,9 @@ drawing.lineGroupStyle = function(s, lw, lc, ld) { s.style('fill', 'none') .each(function(d) { - var line = (((d || [])[0] || {}).trace || {}).line || {}, - lw1 = lw || line.width||0, - dash = ld || line.dash || ''; + var line = (((d || [])[0] || {}).trace || {}).line || {}; + var lw1 = lw || line.width||0; + var dash = ld || line.dash || ''; d3.select(this) .call(Color.stroke, lc || line.color) @@ -113502,9 +113572,10 @@ drawing.symbolNoFill[symDef.n] = true; } }); -var MAXSYMBOL = drawing.symbolNames.length, - // add a dot in the middle of the symbol - DOTPATH = 'M0,0.5L0.5,0L0,-0.5L-0.5,0Z'; + +var MAXSYMBOL = drawing.symbolNames.length; +// add a dot in the middle of the symbol +var DOTPATH = 'M0,0.5L0.5,0L0,-0.5L-0.5,0Z'; drawing.symbolNumber = function(v) { if(typeof v === 'string') { @@ -114008,8 +114079,9 @@ var CatmullRomExp = 0.5; drawing.smoothopen = function(pts, smoothness) { if(pts.length < 3) { return 'M' + pts.join('L');} - var path = 'M' + pts[0], - tangents = [], i; + 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)); } @@ -114023,11 +114095,10 @@ drawing.smoothclosed = function(pts, smoothness) { if(pts.length < 3) { return 'M' + pts.join('L') + 'Z'; } - var path = 'M' + pts[0], - pLast = pts.length - 1, - tangents = [makeTangent(pts[pLast], - pts[0], pts[1], smoothness)], - i; + 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)); } @@ -114043,16 +114114,16 @@ }; function makeTangent(prevpt, thispt, nextpt, smoothness) { - var d1x = prevpt[0] - thispt[0], - d1y = prevpt[1] - thispt[1], - d2x = nextpt[0] - thispt[0], - d2y = nextpt[1] - thispt[1], - d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2), - d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2), - numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness, - numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness, - denom1 = 3 * d2a * (d1a + d2a), - denom2 = 3 * d1a * (d1a + d2a); + 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 [ [ d3.round(thispt[0] + (denom1 && numx / denom1), 2), @@ -114298,9 +114369,9 @@ drawing.getTranslate = function(element) { // Note the separator [^\d] between x and y in this regex // We generally use ',' but IE will convert it to ' ' - var re = /.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/, - getter = element.attr ? 'attr' : 'getAttribute', - transform = element[getter]('transform') || ''; + var re = /.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var transform = element[getter]('transform') || ''; var translate = transform.replace(re, function(match, p1, p2) { return [p1, p2].join(' '); @@ -114314,11 +114385,10 @@ }; drawing.setTranslate = function(element, x, y) { - - var re = /(\btranslate\(.*?\);?)/, - getter = element.attr ? 'attr' : 'getAttribute', - setter = element.attr ? 'attr' : 'setAttribute', - transform = element[getter]('transform') || ''; + var re = /(\btranslate\(.*?\);?)/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var setter = element.attr ? 'attr' : 'setAttribute'; + var transform = element[getter]('transform') || ''; x = x || 0; y = y || 0; @@ -114333,10 +114403,9 @@ }; drawing.getScale = function(element) { - - var re = /.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/, - getter = element.attr ? 'attr' : 'getAttribute', - transform = element[getter]('transform') || ''; + var re = /.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var transform = element[getter]('transform') || ''; var translate = transform.replace(re, function(match, p1, p2) { return [p1, p2].join(' '); @@ -114350,11 +114419,10 @@ }; drawing.setScale = function(element, x, y) { - - var re = /(\bscale\(.*?\);?)/, - getter = element.attr ? 'attr' : 'getAttribute', - setter = element.attr ? 'attr' : 'setAttribute', - transform = element[getter]('transform') || ''; + var re = /(\bscale\(.*?\);?)/; + var getter = element.attr ? 'attr' : 'getAttribute'; + var setter = element.attr ? 'attr' : 'setAttribute'; + var transform = element[getter]('transform') || ''; x = x || 1; y = y || 1; @@ -114424,9 +114492,9 @@ }); }; -},{"../../constants/alignment":664,"../../constants/interactions":668,"../../constants/xmlns_namespaces":670,"../../lib":692,"../../lib/svg_text_utils":716,"../../registry":823,"../../traces/scatter/make_bubble_size_func":1057,"../../traces/scatter/subtypes":1064,"../color":569,"../colorscale":581,"./symbol_defs":591,"d3":148,"fast-isnumeric":214,"tinycolor2":513}],591:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../constants/interactions":670,"../../constants/xmlns_namespaces":672,"../../lib":694,"../../lib/svg_text_utils":718,"../../registry":825,"../../traces/scatter/make_bubble_size_func":1064,"../../traces/scatter/subtypes":1071,"../color":571,"../colorscale":583,"./symbol_defs":593,"d3":149,"fast-isnumeric":215,"tinycolor2":515}],593:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -114472,8 +114540,8 @@ cross: { n: 3, f: function(r) { - var rc = d3.round(r * 0.4, 2), - rc2 = d3.round(r * 1.2, 2); + var rc = d3.round(r * 0.4, 2); + var rc2 = d3.round(r * 1.2, 2); return 'M' + rc2 + ',' + rc + 'H' + rc + 'V' + rc2 + 'H-' + rc + 'V' + rc + 'H-' + rc2 + 'V-' + rc + 'H-' + rc + 'V-' + rc2 + 'H' + rc + 'V-' + rc + 'H' + rc2 + 'Z'; @@ -114482,90 +114550,90 @@ x: { n: 4, f: function(r) { - var rx = d3.round(r * 0.8 / Math.sqrt(2), 2), - ne = 'l' + rx + ',' + rx, - se = 'l' + rx + ',-' + rx, - sw = 'l-' + rx + ',-' + rx, - nw = 'l-' + rx + ',' + rx; + var rx = d3.round(r * 0.8 / Math.sqrt(2), 2); + var ne = 'l' + rx + ',' + rx; + var se = 'l' + rx + ',-' + rx; + var sw = 'l-' + rx + ',-' + rx; + var nw = 'l-' + rx + ',' + rx; return 'M0,' + rx + ne + se + sw + se + sw + nw + sw + nw + ne + nw + ne + 'Z'; } }, 'triangle-up': { n: 5, f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); return 'M-' + rt + ',' + r2 + 'H' + rt + 'L0,-' + rs + 'Z'; } }, 'triangle-down': { n: 6, f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); return 'M-' + rt + ',-' + r2 + 'H' + rt + 'L0,' + rs + 'Z'; } }, 'triangle-left': { n: 7, f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); return 'M' + r2 + ',-' + rt + 'V' + rt + 'L-' + rs + ',0Z'; } }, 'triangle-right': { n: 8, f: function(r) { - var rt = d3.round(r * 2 / Math.sqrt(3), 2), - r2 = d3.round(r / 2, 2), - rs = d3.round(r, 2); + var rt = d3.round(r * 2 / Math.sqrt(3), 2); + var r2 = d3.round(r / 2, 2); + var rs = d3.round(r, 2); return 'M-' + r2 + ',-' + rt + 'V' + rt + 'L' + rs + ',0Z'; } }, 'triangle-ne': { n: 9, f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); return 'M-' + r2 + ',-' + r1 + 'H' + r1 + 'V' + r2 + 'Z'; } }, 'triangle-se': { n: 10, f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); return 'M' + r1 + ',-' + r2 + 'V' + r1 + 'H-' + r2 + 'Z'; } }, 'triangle-sw': { n: 11, f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); return 'M' + r2 + ',' + r1 + 'H-' + r1 + 'V-' + r2 + 'Z'; } }, 'triangle-nw': { n: 12, f: function(r) { - var r1 = d3.round(r * 0.6, 2), - r2 = d3.round(r * 1.2, 2); + var r1 = d3.round(r * 0.6, 2); + var r2 = d3.round(r * 1.2, 2); return 'M-' + r1 + ',' + r2 + 'V-' + r1 + 'H' + r2 + 'Z'; } }, pentagon: { n: 13, f: function(r) { - var x1 = d3.round(r * 0.951, 2), - x2 = d3.round(r * 0.588, 2), - y0 = d3.round(-r, 2), - y1 = d3.round(r * -0.309, 2), - y2 = d3.round(r * 0.809, 2); + var x1 = d3.round(r * 0.951, 2); + var x2 = d3.round(r * 0.588, 2); + var y0 = d3.round(-r, 2); + var y1 = d3.round(r * -0.309, 2); + var y2 = d3.round(r * 0.809, 2); return 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2 + 'H-' + x2 + 'L-' + x1 + ',' + y1 + 'L0,' + y0 + 'Z'; } @@ -114573,9 +114641,9 @@ hexagon: { n: 14, f: function(r) { - var y0 = d3.round(r, 2), - y1 = d3.round(r / 2, 2), - x = d3.round(r * Math.sqrt(3) / 2, 2); + var y0 = d3.round(r, 2); + var y1 = d3.round(r / 2, 2); + var x = d3.round(r * Math.sqrt(3) / 2, 2); return 'M' + x + ',-' + y1 + 'V' + y1 + 'L0,' + y0 + 'L-' + x + ',' + y1 + 'V-' + y1 + 'L0,-' + y0 + 'Z'; } @@ -114583,9 +114651,9 @@ hexagon2: { n: 15, f: function(r) { - var x0 = d3.round(r, 2), - x1 = d3.round(r / 2, 2), - y = d3.round(r * Math.sqrt(3) / 2, 2); + var x0 = d3.round(r, 2); + var x1 = d3.round(r / 2, 2); + var y = d3.round(r * Math.sqrt(3) / 2, 2); return 'M-' + x1 + ',' + y + 'H' + x1 + 'L' + x0 + ',0L' + x1 + ',-' + y + 'H-' + x1 + 'L-' + x0 + ',0Z'; } @@ -114593,8 +114661,8 @@ octagon: { n: 16, f: function(r) { - var a = d3.round(r * 0.924, 2), - b = d3.round(r * 0.383, 2); + var a = d3.round(r * 0.924, 2); + var b = d3.round(r * 0.383, 2); return 'M-' + b + ',-' + a + 'H' + b + 'L' + a + ',-' + b + 'V' + b + 'L' + b + ',' + a + 'H-' + b + 'L-' + a + ',' + b + 'V-' + b + 'Z'; } @@ -114602,16 +114670,16 @@ star: { n: 17, f: function(r) { - var rs = r * 1.4, - x1 = d3.round(rs * 0.225, 2), - x2 = d3.round(rs * 0.951, 2), - x3 = d3.round(rs * 0.363, 2), - x4 = d3.round(rs * 0.588, 2), - y0 = d3.round(-rs, 2), - y1 = d3.round(rs * -0.309, 2), - y3 = d3.round(rs * 0.118, 2), - y4 = d3.round(rs * 0.809, 2), - y5 = d3.round(rs * 0.382, 2); + var rs = r * 1.4; + var x1 = d3.round(rs * 0.225, 2); + var x2 = d3.round(rs * 0.951, 2); + var x3 = d3.round(rs * 0.363, 2); + var x4 = d3.round(rs * 0.588, 2); + var y0 = d3.round(-rs, 2); + var y1 = d3.round(rs * -0.309, 2); + var y3 = d3.round(rs * 0.118, 2); + var y4 = d3.round(rs * 0.809, 2); + var y5 = d3.round(rs * 0.382, 2); return 'M' + x1 + ',' + y1 + 'H' + x2 + 'L' + x3 + ',' + y3 + 'L' + x4 + ',' + y4 + 'L0,' + y5 + 'L-' + x4 + ',' + y4 + 'L-' + x3 + ',' + y3 + 'L-' + x2 + ',' + y1 + 'H-' + x1 + @@ -114621,9 +114689,9 @@ hexagram: { n: 18, f: function(r) { - var y = d3.round(r * 0.66, 2), - x1 = d3.round(r * 0.38, 2), - x2 = d3.round(r * 0.76, 2); + var y = d3.round(r * 0.66, 2); + var x1 = d3.round(r * 0.38, 2); + var x2 = d3.round(r * 0.76, 2); return 'M-' + x2 + ',0l-' + x1 + ',-' + y + 'h' + x2 + 'l' + x1 + ',-' + y + 'l' + x1 + ',' + y + 'h' + x2 + 'l-' + x1 + ',' + y + 'l' + x1 + ',' + y + 'h-' + x2 + @@ -114633,11 +114701,11 @@ 'star-triangle-up': { n: 19, f: function(r) { - var x = d3.round(r * Math.sqrt(3) * 0.8, 2), - y1 = d3.round(r * 0.8, 2), - y2 = d3.round(r * 1.6, 2), - rc = d3.round(r * 4, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + var x = d3.round(r * Math.sqrt(3) * 0.8, 2); + var y1 = d3.round(r * 0.8, 2); + var y2 = d3.round(r * 1.6, 2); + var rc = d3.round(r * 4, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; return 'M-' + x + ',' + y1 + aPart + x + ',' + y1 + aPart + '0,-' + y2 + aPart + '-' + x + ',' + y1 + 'Z'; } @@ -114645,11 +114713,11 @@ 'star-triangle-down': { n: 20, f: function(r) { - var x = d3.round(r * Math.sqrt(3) * 0.8, 2), - y1 = d3.round(r * 0.8, 2), - y2 = d3.round(r * 1.6, 2), - rc = d3.round(r * 4, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + var x = d3.round(r * Math.sqrt(3) * 0.8, 2); + var y1 = d3.round(r * 0.8, 2); + var y2 = d3.round(r * 1.6, 2); + var rc = d3.round(r * 4, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; return 'M' + x + ',-' + y1 + aPart + '-' + x + ',-' + y1 + aPart + '0,' + y2 + aPart + x + ',-' + y1 + 'Z'; } @@ -114657,9 +114725,9 @@ 'star-square': { n: 21, f: function(r) { - var rp = d3.round(r * 1.1, 2), - rc = d3.round(r * 2, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + var rp = d3.round(r * 1.1, 2); + var rc = d3.round(r * 2, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; return 'M-' + rp + ',-' + rp + aPart + '-' + rp + ',' + rp + aPart + rp + ',' + rp + aPart + rp + ',-' + rp + aPart + '-' + rp + ',-' + rp + 'Z'; @@ -114668,9 +114736,9 @@ 'star-diamond': { n: 22, f: function(r) { - var rp = d3.round(r * 1.4, 2), - rc = d3.round(r * 1.9, 2), - aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; + var rp = d3.round(r * 1.4, 2); + var rc = d3.round(r * 1.9, 2); + var aPart = 'A ' + rc + ',' + rc + ' 0 0 1 '; return 'M-' + rp + ',0' + aPart + '0,' + rp + aPart + rp + ',0' + aPart + '0,-' + rp + aPart + '-' + rp + ',0' + 'Z'; @@ -114679,16 +114747,16 @@ 'diamond-tall': { n: 23, f: function(r) { - var x = d3.round(r * 0.7, 2), - y = d3.round(r * 1.4, 2); + var x = d3.round(r * 0.7, 2); + var y = d3.round(r * 1.4, 2); return 'M0,' + y + 'L' + x + ',0L0,-' + y + 'L-' + x + ',0Z'; } }, 'diamond-wide': { n: 24, f: function(r) { - var x = d3.round(r * 1.4, 2), - y = d3.round(r * 0.7, 2); + var x = d3.round(r * 1.4, 2); + var y = d3.round(r * 0.7, 2); return 'M0,' + y + 'L' + x + ',0L0,-' + y + 'L-' + x + ',0Z'; } }, @@ -114722,8 +114790,8 @@ 'circle-x': { n: 28, f: function(r) { - var rs = d3.round(r, 2), - rc = d3.round(r / Math.sqrt(2), 2); + var rs = d3.round(r, 2); + var rc = d3.round(r / Math.sqrt(2), 2); return 'M' + rc + ',' + rc + 'L-' + rc + ',-' + rc + 'M' + rc + ',-' + rc + 'L-' + rc + ',' + rc + 'M' + rs + ',0A' + rs + ',' + rs + ' 0 1,1 0,-' + rs + @@ -114766,8 +114834,8 @@ 'diamond-x': { n: 32, f: function(r) { - var rd = d3.round(r * 1.3, 2), - r2 = d3.round(r * 0.65, 2); + var rd = d3.round(r * 1.3, 2); + var r2 = d3.round(r * 0.65, 2); return 'M' + rd + ',0L0,' + rd + 'L-' + rd + ',0L0,-' + rd + 'Z' + 'M-' + r2 + ',-' + r2 + 'L' + r2 + ',' + r2 + 'M-' + r2 + ',' + r2 + 'L' + r2 + ',-' + r2; @@ -114812,8 +114880,8 @@ hash: { n: 36, f: function(r) { - var r1 = d3.round(r / 2, 2), - r2 = d3.round(r, 2); + var r1 = d3.round(r / 2, 2); + var r2 = d3.round(r, 2); return 'M' + r1 + ',' + r2 + 'V-' + r2 + 'm-' + r2 + ',0V' + r2 + 'M' + r2 + ',' + r1 + 'H-' + r2 + @@ -114825,9 +114893,9 @@ 'y-up': { n: 37, f: function(r) { - var x = d3.round(r * 1.2, 2), - y0 = d3.round(r * 1.6, 2), - y1 = d3.round(r * 0.8, 2); + var x = d3.round(r * 1.2, 2); + var y0 = d3.round(r * 1.6, 2); + var y1 = d3.round(r * 0.8, 2); return 'M-' + x + ',' + y1 + 'L0,0M' + x + ',' + y1 + 'L0,0M0,-' + y0 + 'L0,0'; }, needLine: true, @@ -114837,9 +114905,9 @@ 'y-down': { n: 38, f: function(r) { - var x = d3.round(r * 1.2, 2), - y0 = d3.round(r * 1.6, 2), - y1 = d3.round(r * 0.8, 2); + var x = d3.round(r * 1.2, 2); + var y0 = d3.round(r * 1.6, 2); + var y1 = d3.round(r * 0.8, 2); return 'M-' + x + ',-' + y1 + 'L0,0M' + x + ',-' + y1 + 'L0,0M0,' + y0 + 'L0,0'; }, needLine: true, @@ -114849,9 +114917,9 @@ 'y-left': { n: 39, f: function(r) { - var y = d3.round(r * 1.2, 2), - x0 = d3.round(r * 1.6, 2), - x1 = d3.round(r * 0.8, 2); + var y = d3.round(r * 1.2, 2); + var x0 = d3.round(r * 1.6, 2); + var x1 = d3.round(r * 0.8, 2); return 'M' + x1 + ',' + y + 'L0,0M' + x1 + ',-' + y + 'L0,0M-' + x0 + ',0L0,0'; }, needLine: true, @@ -114861,9 +114929,9 @@ 'y-right': { n: 40, f: function(r) { - var y = d3.round(r * 1.2, 2), - x0 = d3.round(r * 1.6, 2), - x1 = d3.round(r * 0.8, 2); + var y = d3.round(r * 1.2, 2); + var x0 = d3.round(r * 1.6, 2); + var x1 = d3.round(r * 0.8, 2); return 'M-' + x1 + ',' + y + 'L0,0M-' + x1 + ',-' + y + 'L0,0M' + x0 + ',0L0,0'; }, needLine: true, @@ -114912,9 +114980,9 @@ } }; -},{"d3":148}],592:[function(_dereq_,module,exports){ +},{"d3":149}],594:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115027,26 +115095,25 @@ } }; -},{}],593:[function(_dereq_,module,exports){ +},{}],595:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var isNumeric = _dereq_('fast-isnumeric'); var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); +var Lib = _dereq_('../../lib'); var makeComputeError = _dereq_('./compute_error'); - module.exports = function calc(gd) { var calcdata = gd.calcdata; @@ -115064,9 +115131,9 @@ }; function calcOneAxis(calcTrace, trace, axis, coord) { - var opts = trace['error_' + coord] || {}, - isVisible = (opts.visible && ['linear', 'log'].indexOf(axis.type) !== -1), - vals = []; + var opts = trace['error_' + coord] || {}; + var isVisible = (opts.visible && ['linear', 'log'].indexOf(axis.type) !== -1); + var vals = []; if(!isVisible) return; @@ -115097,21 +115164,26 @@ var errors = computeError(calcCoord, iIn); if(isNumeric(errors[0]) && isNumeric(errors[1])) { - var shoe = calcPt[coord + 's'] = calcCoord - errors[0], - hat = calcPt[coord + 'h'] = calcCoord + errors[1]; + var shoe = calcPt[coord + 's'] = calcCoord - errors[0]; + var hat = calcPt[coord + 'h'] = calcCoord + errors[1]; vals.push(shoe, hat); } } - var extremes = Axes.findExtremes(axis, vals, {padded: true}); var axId = axis._id; - trace._extremes[axId].min = trace._extremes[axId].min.concat(extremes.min); - trace._extremes[axId].max = trace._extremes[axId].max.concat(extremes.max); + 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); } -},{"../../plots/cartesian/axes":740,"../../registry":823,"./compute_error":594,"fast-isnumeric":214}],594:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../../registry":825,"./compute_error":596,"fast-isnumeric":215}],596:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115138,8 +115210,8 @@ * - error[1] : " " " " positive " */ module.exports = function makeComputeError(opts) { - var type = opts.type, - symmetric = opts.symmetric; + var type = opts.type; + var symmetric = opts.symmetric; if(type === 'data') { var array = opts.array || []; @@ -115166,8 +115238,8 @@ } } else { - var computeErrorValue = makeComputeErrorValue(type, opts.value), - computeErrorValueMinus = makeComputeErrorValue(type, opts.valueminus); + var computeErrorValue = makeComputeErrorValue(type, opts.value); + var computeErrorValueMinus = makeComputeErrorValue(type, opts.valueminus); if(symmetric || opts.valueminus === undefined) { return function computeError(dataPt) { @@ -115213,9 +115285,9 @@ } } -},{}],595:[function(_dereq_,module,exports){ +},{}],597:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115252,8 +115324,8 @@ if(visible === false) return; - var type = coerce('type', 'array' in containerIn ? 'data' : 'percent'), - symmetric = true; + var type = coerce('type', 'array' in containerIn ? 'data' : 'percent'); + var symmetric = true; if(type !== 'sqrt') { symmetric = coerce('symmetric', @@ -115289,9 +115361,9 @@ } }; -},{"../../lib":692,"../../plot_api/plot_template":730,"../../registry":823,"./attributes":592,"fast-isnumeric":214}],596:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"../../registry":825,"./attributes":594,"fast-isnumeric":215}],598:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115358,9 +115430,9 @@ } } -},{"../../lib":692,"../../plot_api/edit_types":723,"./attributes":592,"./calc":593,"./compute_error":594,"./defaults":595,"./plot":597,"./style":598}],597:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/edit_types":725,"./attributes":594,"./calc":595,"./compute_error":596,"./defaults":597,"./plot":599,"./style":600}],599:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115385,13 +115457,13 @@ var hasAnimation = transitionOpts && transitionOpts.duration > 0; traces.each(function(d) { - var trace = d[0].trace, - // || {} is in case the trace (specifically scatterternary) - // doesn't support error bars at all, but does go through - // the scatter.plot mechanics, which calls ErrorBars.plot - // internally - xObj = trace.error_x || {}, - yObj = trace.error_y || {}; + var trace = d[0].trace; + // || {} is in case the trace (specifically scatterternary) + // doesn't support error bars at all, but does go through + // the scatter.plot mechanics, which calls ErrorBars.plot + // internally + var xObj = trace.error_x || {}; + var yObj = trace.error_y || {}; var keyFunc; @@ -115532,9 +115604,9 @@ return out; } -},{"../../traces/scatter/subtypes":1064,"../drawing":590,"d3":148,"fast-isnumeric":214}],598:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":1071,"../drawing":592,"d3":149,"fast-isnumeric":215}],600:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115551,9 +115623,9 @@ module.exports = function style(traces) { traces.each(function(d) { - var trace = d[0].trace, - yObj = trace.error_y || {}, - xObj = trace.error_x || {}; + var trace = d[0].trace; + var yObj = trace.error_y || {}; + var xObj = trace.error_x || {}; var s = d3.select(this); @@ -115569,9 +115641,9 @@ }); }; -},{"../color":569,"d3":148}],599:[function(_dereq_,module,exports){ +},{"../color":571,"d3":149}],601:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115615,9 +115687,9 @@ } }; -},{"../../plots/font_attributes":767}],600:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":769}],602:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115673,9 +115745,9 @@ } } -},{"../../lib":692,"../../registry":823}],601:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],603:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115711,9 +115783,9 @@ } }; -},{"../../registry":823,"./hover":605}],602:[function(_dereq_,module,exports){ +},{"../../registry":825,"./hover":607}],604:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115743,9 +115815,9 @@ HOVERID: '-hover' }; -},{}],603:[function(_dereq_,module,exports){ +},{}],605:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115766,9 +115838,9 @@ handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":692,"./attributes":599,"./hoverlabel_defaults":606}],604:[function(_dereq_,module,exports){ +},{"../../lib":694,"./attributes":601,"./hoverlabel_defaults":608}],606:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -115864,8 +115936,8 @@ exports.quadrature = function quadrature(dx, dy) { return function(di) { - var x = dx(di), - y = dy(di); + var x = dx(di); + var y = dy(di); return Math.sqrt(x * x + y * y); }; }; @@ -116009,9 +116081,9 @@ } } -},{"../../lib":692}],605:[function(_dereq_,module,exports){ +},{"../../lib":694}],607:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -116210,9 +116282,8 @@ }); - var container3 = d3.select(opts.container), - outerContainer3 = opts.outerContainer ? - d3.select(opts.outerContainer) : container3; + var container3 = d3.select(opts.container); + var outerContainer3 = opts.outerContainer ? d3.select(opts.outerContainer) : container3; var fullOpts = { hovermode: 'closest', @@ -116342,12 +116413,14 @@ // user specified an array of points to highlight hovermode = 'array'; for(itemnum = 0; itemnum < evt.length; itemnum++) { - cd = gd.calcdata[evt[itemnum].curveNumber||0]; - trace = cd[0].trace; - if(cd[0].trace.hoverinfo !== 'skip') { - searchData.push(cd); - if(trace.orientation === 'h') { - hasOneHorizontalTrace = true; + cd = gd.calcdata[evt[itemnum].curveNumber || 0]; + if(cd) { + trace = cd[0].trace; + if(cd[0].trace.hoverinfo !== 'skip') { + searchData.push(cd); + if(trace.orientation === 'h') { + hasOneHorizontalTrace = true; + } } } } @@ -116630,11 +116703,11 @@ outerContainer: fullLayout._paperdiv, event: evt }; - var oldspikepoints = gd._spikepoints, - newspikepoints = { - vLinePoint: spikePoints.vLinePoint, - hLinePoint: spikePoints.hLinePoint - }; + var oldspikepoints = gd._spikepoints; + var newspikepoints = { + vLinePoint: spikePoints.vLinePoint, + hLinePoint: spikePoints.hLinePoint + }; gd._spikepoints = newspikepoints; // Now if it is not restricted by spikedistance option, set the points to draw the spikelines @@ -116936,15 +117009,10 @@ if(d.nameOverride !== undefined) d.name = d.nameOverride; if(d.name) { - // strip out our pseudo-html elements from d.name (if it exists at all) - name = svgTextUtils.plainText(d.name || ''); - - var nameLength = Math.round(d.nameLength); - - if(nameLength > -1 && name.length > nameLength) { - if(nameLength > 3) name = name.substr(0, nameLength - 3) + '...'; - else name = name.substr(0, nameLength); - } + name = svgTextUtils.plainText(d.name || '', { + len: d.nameLength, + allowedTags: ['br', 'sub', 'sup', 'b', 'i', 'em'] + }); } if(d.zLabel !== undefined) { @@ -116973,8 +117041,9 @@ if(d.extraText !== undefined) text += (text ? '
' : '') + d.extraText; // if 'text' is empty at this point, + // and hovertemplate is not defined, // put 'name' in main label and don't show secondary label - if(text === '') { + if(text === '' && !d.hovertemplate) { // if 'name' is also empty, remove entire label if(name === '') g.remove(); text = name; @@ -117006,6 +117075,7 @@ var tx2 = g.select('text.name'); var tx2width = 0; + var tx2height = 0; // secondary label for non-empty 'name' if(name && name !== text) { @@ -117017,18 +117087,20 @@ .attr('data-notex', 1) .call(svgTextUtils.positionText, 0, 0) .call(svgTextUtils.convertToTspans, gd); - tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; - } - else { + + var t2bb = tx2.node().getBoundingClientRect(); + 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 - }); + g.select('path').style({ + fill: numsColor, + stroke: contrastColor + }); + var tbb = tx.node().getBoundingClientRect(); var htx = d.xa._offset + (d.x0 + d.x1) / 2; var hty = d.ya._offset + (d.y0 + d.y1) / 2; @@ -117039,7 +117111,7 @@ d.ty0 = outerTop - tbb.top; d.bx = tbb.width + 2 * HOVERTEXTPAD; - d.by = tbb.height + 2 * HOVERTEXTPAD; + d.by = Math.max(tbb.height + 2 * HOVERTEXTPAD, tx2height); d.anchor = 'start'; d.txwidth = tbb.width; d.tx2width = tx2width; @@ -117093,7 +117165,6 @@ // information then. function hoverAvoidOverlaps(hoverData, ax, fullLayout) { var nummoves = 0; - var axSign = 1; // make groups of touching points @@ -117339,7 +117410,7 @@ fill('fontColor', 'htc', 'hoverlabel.font.color'); fill('nameLength', 'hnl', 'hoverlabel.namelength'); - d.posref = hovermode === 'y' ? + 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); @@ -117597,9 +117668,9 @@ return false; } -},{"../../lib":692,"../../lib/events":681,"../../lib/override_cursor":703,"../../lib/svg_text_utils":716,"../../plots/cartesian/axes":740,"../../registry":823,"../color":569,"../dragelement":587,"../drawing":590,"./constants":602,"./helpers":604,"d3":148,"fast-isnumeric":214,"tinycolor2":513}],606:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/events":683,"../../lib/override_cursor":705,"../../lib/svg_text_utils":718,"../../plots/cartesian/axes":742,"../../registry":825,"../color":571,"../dragelement":589,"../drawing":592,"./constants":604,"./helpers":606,"d3":149,"fast-isnumeric":215,"tinycolor2":515}],608:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -117619,9 +117690,9 @@ Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":692}],607:[function(_dereq_,module,exports){ +},{"../../lib":694}],609:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -117661,9 +117732,9 @@ return hovertemplate; }; -},{}],608:[function(_dereq_,module,exports){ +},{}],610:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -117741,9 +117812,9 @@ return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":692,"../dragelement":587,"./attributes":599,"./calc":600,"./click":601,"./constants":602,"./defaults":603,"./helpers":604,"./hover":605,"./layout_attributes":609,"./layout_defaults":610,"./layout_global_defaults":611,"d3":148}],609:[function(_dereq_,module,exports){ +},{"../../lib":694,"../dragelement":589,"./attributes":601,"./calc":602,"./click":603,"./constants":604,"./defaults":605,"./helpers":606,"./hover":607,"./layout_attributes":611,"./layout_defaults":612,"./layout_global_defaults":613,"d3":149}],611:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -117836,9 +117907,9 @@ } }; -},{"../../plots/font_attributes":767,"./constants":602}],610:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":769,"./constants":604}],612:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -117909,9 +117980,9 @@ return out; } -},{"../../lib":692,"./layout_attributes":609}],611:[function(_dereq_,module,exports){ +},{"../../lib":694,"./layout_attributes":611}],613:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -117932,9 +118003,9 @@ handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":692,"./hoverlabel_defaults":606,"./layout_attributes":609}],612:[function(_dereq_,module,exports){ +},{"../../lib":694,"./hoverlabel_defaults":608,"./layout_attributes":611}],614:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118317,9 +118388,9 @@ contentDefaults: contentDefaults }; -},{"../../lib":692,"../../lib/regex":708,"../../plot_api/plot_template":730,"../../plots/cartesian/constants":746,"../../plots/domain":766}],613:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/regex":710,"../../plot_api/plot_template":732,"../../plots/cartesian/constants":748,"../../plots/domain":768}],615:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118452,9 +118523,9 @@ editType: 'arraydraw' }); -},{"../../plot_api/plot_template":730,"../../plots/cartesian/constants":746}],614:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":732,"../../plots/cartesian/constants":748}],616:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118488,25 +118559,25 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { ax = ax || {}; - var toLog = (newType === 'log') && (ax.type === 'linear'), - fromLog = (newType === 'linear') && (ax.type === 'log'); + var toLog = (newType === 'log') && (ax.type === 'linear'); + var fromLog = (newType === 'linear') && (ax.type === 'log'); if(!(toLog || fromLog)) return; - var images = gd._fullLayout.images, - axLetter = ax._id.charAt(0), - image, - attrPrefix; + var images = gd._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], - currentSize = image['size' + axLetter], - newPos = null, - newSize = null; + var currentPos = image[axLetter]; + var currentSize = image['size' + axLetter]; + var newPos = null; + var newSize = null; if(toLog) { newPos = toLogRange(currentPos, ax.range); @@ -118535,9 +118606,9 @@ } }; -},{"../../lib/to_log_range":718,"fast-isnumeric":214}],615:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":720,"fast-isnumeric":215}],617:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118582,13 +118653,18 @@ coerce('sizing'); coerce('opacity'); - var gdMock = { _fullLayout: fullLayout }, - axLetters = ['x', 'y']; + var gdMock = { _fullLayout: fullLayout }; + var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref - var axLetter = axLetters[i], - axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axLetter = axLetters[i]; + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + + if(axRef !== 'paper') { + var ax = Axes.getFromId(gdMock, axRef); + ax._imgIndices.push(imageOut._index); + } Axes.coercePosition(imageOut, gdMock, coerce, axRef, axLetter, 0); } @@ -118596,9 +118672,9 @@ return imageOut; } -},{"../../lib":692,"../../plots/array_container_defaults":736,"../../plots/cartesian/axes":740,"./attributes":613}],616:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"../../plots/cartesian/axes":742,"./attributes":615}],618:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118613,12 +118689,12 @@ var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, - imageDataAbove = [], - imageDataSubplot = {}, - imageDataBelow = [], - subplot, - i; + var fullLayout = gd._fullLayout; + var imageDataAbove = []; + var imageDataSubplot = {}; + var imageDataBelow = []; + var subplot; + var i; // Sort into top, subplot, and bottom layers for(i = 0; i < fullLayout.images.length; i++) { @@ -118723,23 +118799,22 @@ var thisImage = d3.select(this); // Axes if specified - var xa = Axes.getFromId(gd, d.xref), - ya = Axes.getFromId(gd, d.yref); + var xa = Axes.getFromId(gd, d.xref); + var ya = Axes.getFromId(gd, d.yref); - var size = fullLayout._size, - width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w, - height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var size = fullLayout._size; + var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; + var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; // Offsets for anchor positioning - var xOffset = width * anchors.x[d.xanchor].offset, - yOffset = height * anchors.y[d.yanchor].offset; + 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; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset, - yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; - + var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; + var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -118763,9 +118838,9 @@ // Set proper clipping on images - var xId = xa ? xa._id : '', - yId = ya ? ya._id : '', - clipAxes = xId + yId; + var xId = xa ? xa._id : ''; + var yId = ya ? ya._id : ''; + var clipAxes = xId + yId; Drawing.setClipUrl( thisImage, @@ -118775,9 +118850,9 @@ } var imagesBelow = fullLayout._imageLowerLayer.selectAll('image') - .data(imageDataBelow), - imagesAbove = fullLayout._imageUpperLayer.selectAll('image') - .data(imageDataAbove); + .data(imageDataBelow); + var imagesAbove = fullLayout._imageUpperLayer.selectAll('image') + .data(imageDataAbove); imagesBelow.enter().append('image'); imagesAbove.enter().append('image'); @@ -118818,9 +118893,9 @@ } }; -},{"../../constants/xmlns_namespaces":670,"../../plots/cartesian/axes":740,"../drawing":590,"d3":148}],617:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":672,"../../plots/cartesian/axes":742,"../drawing":592,"d3":149}],619:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118842,9 +118917,9 @@ convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":751,"./attributes":613,"./convert_coords":614,"./defaults":615,"./draw":616}],618:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":753,"./attributes":615,"./convert_coords":616,"./defaults":617,"./draw":618}],620:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118958,9 +119033,9 @@ editType: 'legend' }; -},{"../../plots/font_attributes":767,"../color/attributes":568}],619:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":769,"../color/attributes":570}],621:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -118977,9 +119052,9 @@ textOffsetX: 40 }; -},{}],620:[function(_dereq_,module,exports){ +},{}],622:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -119091,9 +119166,9 @@ Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":692,"../../plot_api/plot_template":730,"../../plots/layout_attributes":795,"../../registry":823,"./attributes":618,"./helpers":624}],621:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"../../plots/layout_attributes":797,"../../registry":825,"./attributes":620,"./helpers":626}],623:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -119202,20 +119277,20 @@ traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style, gd) - .style('opacity', function(d) { - var trace = d[0].trace; - if(Registry.traceIs(trace, 'pie')) { - 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, gd, maxLength) - .call(setupTraceToggle, gd); - }); + traces.style('opacity', function(d) { + var trace = d[0].trace; + if(Registry.traceIs(trace, 'pie')) { + 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, gd, maxLength) + .call(setupTraceToggle, gd); + }) + .call(style, gd); Lib.syncOrAsync([Plots.previousPromises, function() { @@ -119225,10 +119300,10 @@ } // Position and size the legend - var lxMin = 0, - lxMax = fullLayout.width, - lyMin = 0, - lyMax = fullLayout.height; + var lxMin = 0; + var lxMax = fullLayout.width; + var lyMin = 0; + var lyMax = fullLayout.height; computeLegendDimensions(gd, groups, traces); @@ -119243,9 +119318,9 @@ // Scroll section must be executed after repositionLegend. // It requires the legend width, height, x and y to position the scrollbox // and these values are mutated in repositionLegend. - var gs = fullLayout._size, - lx = gs.l + gs.w * opts.x, - ly = gs.t + gs.h * (1 - opts.y); + var gs = fullLayout._size; + var lx = gs.l + gs.w * opts.x; + var ly = gs.t + gs.h * (1 - opts.y); if(Lib.isRightAnchor(opts)) { lx -= opts._width; @@ -119262,8 +119337,8 @@ } // Make sure the legend left and right sides are visible - var legendWidth = opts._width, - legendWidthMax = gs.w; + var legendWidth = opts._width; + var legendWidthMax = gs.w; if(legendWidth > legendWidthMax) { lx = gs.l; @@ -119278,8 +119353,8 @@ // Make sure the legend top and bottom are visible // (legends with a scroll bar are not allowed to stretch beyond the extended // margins) - var legendHeight = opts._height, - legendHeightMax = gs.h; + var legendHeight = opts._height; + var legendHeightMax = gs.h; if(legendHeight > legendHeightMax) { ly = gs.t; @@ -119422,8 +119497,8 @@ y0 = transform.y; }, moveFn: function(dx, dy) { - var newX = x0 + dx, - newY = y0 + dy; + var newX = x0 + dx; + var newY = y0 + dy; Drawing.setTranslate(legend, newX, newY); @@ -119562,8 +119637,8 @@ } function setupTraceToggle(g, gd) { - var newMouseDownTime, - numClicks = 1; + var newMouseDownTime; + var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { s.style('cursor', 'pointer') @@ -119616,8 +119691,7 @@ width = mathjaxBB.width; Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); - } - else { + } else { var text = g.select('.legendtext'); var textLines = svgTextUtils.lineCount(text); var textNode = text.node(); @@ -119629,12 +119703,10 @@ // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); svgTextUtils.positionText(text, constants.textOffsetX, textY); - legendItem.lineHeight = lineHeight; } - height = Math.max(height, 16) + 3; - - legendItem.height = height; + legendItem.lineHeight = lineHeight; + legendItem.height = Math.max(height, 16) + 3; legendItem.width = width; } @@ -119657,9 +119729,9 @@ } traces.each(function(d) { - var legendItem = d[0], - textHeight = legendItem.height, - textWidth = legendItem.width; + var legendItem = d[0]; + var textHeight = legendItem.height; + var textWidth = legendItem.width; Drawing.setTranslate(this, borderwidth, @@ -119679,8 +119751,8 @@ extraWidth = 40; } else if(isGrouped) { - var groupXOffsets = [opts._width], - groupData = groups.data(); + var groupXOffsets = [opts._width]; + var groupData = groups.data(); for(var i = 0, n = groupData.length; i < n; i++) { var textWidths = groupData[i].map(function(legendItemArray) { @@ -119699,13 +119771,13 @@ }); groups.each(function() { - var group = d3.select(this), - groupTraces = group.selectAll('g.traces'), - groupHeight = 0; + var group = d3.select(this); + var groupTraces = group.selectAll('g.traces'); + var groupHeight = 0; groupTraces.each(function(d) { - var legendItem = d[0], - textHeight = legendItem.height; + var legendItem = d[0]; + var textHeight = legendItem.height; Drawing.setTranslate(this, 0, @@ -119721,13 +119793,12 @@ opts._width += borderwidth * 2; } else { - var rowHeight = 0, - maxTraceHeight = 0, - maxTraceWidth = 0, - offsetX = 0, - fullTracesWidth = 0, - traceGap = opts.tracegroupgap || 5, - oneRowLegend; + var rowHeight = 0; + var maxTraceHeight = 0; + var maxTraceWidth = 0; + var offsetX = 0; + var fullTracesWidth = 0; + var traceGap = opts.tracegroupgap || 5; // calculate largest width for traces and use for width of all legend items traces.each(function(d) { @@ -119736,15 +119807,16 @@ }); // check if legend fits in one row - oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap; + var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap; + traces.each(function(d) { - var legendItem = d[0], - traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth; + var legendItem = d[0]; + var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth; if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) { offsetX = 0; - rowHeight = rowHeight + maxTraceHeight; - opts._height = opts._height + maxTraceHeight; + rowHeight += maxTraceHeight; + opts._height += maxTraceHeight; // reset for next row maxTraceHeight = 0; } @@ -119754,16 +119826,20 @@ (5 + borderwidth + legendItem.height / 2) + rowHeight); opts._width += traceGap + traceWidth; - opts._height = Math.max(opts._height, legendItem.height); // keep track of tallest trace in group offsetX += traceGap + traceWidth; maxTraceHeight = Math.max(legendItem.height, maxTraceHeight); }); + if(oneRowLegend) { + opts._height = maxTraceHeight; + } else { + opts._height += maxTraceHeight; + } + opts._width += borderwidth * 2; opts._height += 10 + borderwidth * 2; - } // make sure we're only getting full pixels @@ -119789,8 +119865,8 @@ } function expandMargin(gd) { - var fullLayout = gd._fullLayout, - opts = fullLayout.legend; + var fullLayout = gd._fullLayout; + var opts = fullLayout.legend; var xanchor = 'left'; if(Lib.isRightAnchor(opts)) { @@ -119820,8 +119896,8 @@ } function expandHorizontalMargin(gd) { - var fullLayout = gd._fullLayout, - opts = fullLayout.legend; + var fullLayout = gd._fullLayout; + var opts = fullLayout.legend; var xanchor = 'left'; if(Lib.isRightAnchor(opts)) { @@ -119842,9 +119918,9 @@ }); } -},{"../../constants/alignment":664,"../../constants/interactions":668,"../../lib":692,"../../lib/events":681,"../../lib/svg_text_utils":716,"../../plots/plots":804,"../../registry":823,"../color":569,"../dragelement":587,"../drawing":590,"./constants":619,"./get_legend_data":622,"./handle_click":623,"./helpers":624,"./style":626,"d3":148}],622:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../constants/interactions":670,"../../lib":694,"../../lib/events":683,"../../lib/svg_text_utils":718,"../../plots/plots":806,"../../registry":825,"../color":571,"../dragelement":589,"../drawing":592,"./constants":621,"./get_legend_data":624,"./handle_click":625,"./helpers":626,"./style":628,"d3":149}],624:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -119859,12 +119935,11 @@ module.exports = function getLegendData(calcdata, opts) { - var lgroupToTraces = {}, - lgroups = [], - hasOneNonBlankGroup = false, - slicesShown = {}, - lgroupi = 0; - + var lgroupToTraces = {}; + var lgroups = []; + var hasOneNonBlankGroup = false; + var slicesShown = {}; + var lgroupi = 0; var i, j; function addOneItem(legendGroup, legendItem) { @@ -119920,9 +119995,9 @@ if(!lgroups.length) return []; // rearrange lgroupToTraces into a d3-friendly array of arrays - var lgroupsLength = lgroups.length, - ltraces, - legendData; + var lgroupsLength = lgroups.length; + var ltraces; + var legendData; if(hasOneNonBlankGroup && helpers.isGrouped(opts)) { legendData = new Array(lgroupsLength); @@ -119948,9 +120023,9 @@ return legendData; }; -},{"../../registry":823,"./helpers":624}],623:[function(_dereq_,module,exports){ +},{"../../registry":825,"./helpers":626}],625:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -120044,8 +120119,8 @@ } if(Registry.traceIs(fullTrace, 'pie')) { - var thisLabel = legendItem.label, - thisLabelIndex = hiddenSlices.indexOf(thisLabel); + var thisLabel = legendItem.label; + var thisLabelIndex = hiddenSlices.indexOf(thisLabel); if(numClicks === 1) { if(thisLabelIndex === -1) hiddenSlices.push(thisLabel); @@ -120172,9 +120247,9 @@ } }; -},{"../../lib":692,"../../registry":823}],624:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],626:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -120196,9 +120271,9 @@ return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],625:[function(_dereq_,module,exports){ +},{}],627:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -120220,9 +120295,9 @@ style: _dereq_('./style') }; -},{"./attributes":618,"./defaults":620,"./draw":621,"./style":626}],626:[function(_dereq_,module,exports){ +},{"./attributes":620,"./defaults":622,"./draw":623,"./style":628}],628:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -120254,7 +120329,7 @@ var height = d[0].height; if(valign === 'middle' || !lineHeight || !height) { - layers.attr('transform', null); // this here is a fun d3 trick to unset DOM attributes + layers.attr('transform', null); } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); @@ -120465,20 +120540,22 @@ } function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); + var trace = d[0].trace; + var marker = trace.marker || {}; + var markerLine = marker.line || {}; + + var barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); barpath.enter().append('path').classed('legendbar', true) .attr('d', 'M6,6H-6V-6H6Z') .attr('transform', 'translate(20,0)'); barpath.exit().remove(); + barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var p = d3.select(this); + var d0 = d[0]; + var w = (d0.mlw + 1 || markerLine.width + 1) - 1; p.style('stroke-width', w + 'px') .call(Color.fill, d0.mc || marker.color); @@ -120490,18 +120567,20 @@ } function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box-violin') && trace.visible ? [d] : []); + var trace = d[0].trace; + + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box-violin') && trace.visible ? [d] : []); pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') .attr('transform', 'translate(20,0)'); pts.exit().remove(); + pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var w = trace.line.width; + var p = d3.select(this); p.style('stroke-width', w + 'px') .call(Color.fill, trace.fillcolor); @@ -120513,10 +120592,11 @@ } function styleCandles(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendcandle') - .data(trace.type === 'candlestick' && trace.visible ? [d, d] : []); + var trace = d[0].trace; + + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendcandle') + .data(trace.type === 'candlestick' && trace.visible ? [d, d] : []); pts.enter().append('path').classed('legendcandle', true) .attr('d', function(_, i) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing @@ -120525,10 +120605,11 @@ .attr('transform', 'translate(20,0)') .style('stroke-miterlimit', 1); pts.exit().remove(); + pts.each(function(_, i) { var container = trace[i ? 'increasing' : 'decreasing']; - var w = container.line.width, - p = d3.select(this); + var w = container.line.width; + var p = d3.select(this); p.style('stroke-width', w + 'px') .call(Color.fill, container.fillcolor); @@ -120540,10 +120621,11 @@ } function styleOHLC(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendohlc') - .data(trace.type === 'ohlc' && trace.visible ? [d, d] : []); + var trace = d[0].trace; + + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendohlc') + .data(trace.type === 'ohlc' && trace.visible ? [d, d] : []); pts.enter().append('path').classed('legendohlc', true) .attr('d', function(_, i) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing @@ -120552,10 +120634,11 @@ .attr('transform', 'translate(20,0)') .style('stroke-miterlimit', 1); pts.exit().remove(); + pts.each(function(_, i) { var container = trace[i ? 'increasing' : 'decreasing']; - var w = container.line.width, - p = d3.select(this); + var w = container.line.width; + var p = d3.select(this); p.style('fill', 'none') .call(Drawing.dashLine, container.line.dash, w); @@ -120567,10 +120650,11 @@ } function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + var trace = d[0].trace; + + var pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); pts.enter().append('path').classed('legendpie', true) .attr('d', 'M6,6H-6V-6H6Z') .attr('transform', 'translate(20,0)'); @@ -120580,9 +120664,9 @@ } }; -},{"../../lib":692,"../../registry":823,"../../traces/pie/style_one":1026,"../../traces/scatter/subtypes":1064,"../color":569,"../drawing":590,"d3":148}],627:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"../../traces/pie/style_one":1033,"../../traces/scatter/subtypes":1071,"../color":571,"../drawing":592,"d3":149}],629:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -120780,10 +120864,9 @@ var ax, i; if(astr === 'zoom') { - var mag = (val === 'in') ? 0.5 : 2, - r0 = (1 + mag) / 2, - r1 = (1 - mag) / 2; - + var mag = (val === 'in') ? 0.5 : 2; + var r0 = (1 + mag) / 2; + var r1 = (1 - mag) / 2; var axName; for(i = 0; i < axList.length; i++) { @@ -120927,9 +121010,9 @@ var aobj = {}; for(var i = 0; i < sceneIds.length; i++) { - var sceneId = sceneIds[i], - key = sceneId + '.camera', - scene = fullLayout[sceneId]._scene; + var sceneId = sceneIds[i]; + var key = sceneId + '.camera'; + var scene = fullLayout[sceneId]._scene; if(attr === 'resetDefault') { aobj[key] = null; @@ -121194,9 +121277,9 @@ Registry.call('_guiRelayout', gd, aObj); } -},{"../../../build/ploticon":2,"../../lib":692,"../../plots/cartesian/axis_ids":743,"../../plots/plots":804,"../../registry":823}],628:[function(_dereq_,module,exports){ +},{"../../../build/ploticon":2,"../../lib":694,"../../plots/cartesian/axis_ids":745,"../../plots/plots":806,"../../registry":825}],630:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -121208,9 +121291,9 @@ exports.manage = _dereq_('./manage'); -},{"./manage":629}],629:[function(_dereq_,module,exports){ +},{"./manage":631}],631:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -121236,9 +121319,9 @@ * */ module.exports = function manageModeBar(gd) { - var fullLayout = gd._fullLayout, - context = gd._context, - modeBar = fullLayout._modeBar; + var fullLayout = gd._fullLayout; + var context = gd._context; + var modeBar = fullLayout._modeBar; if(!context.displayModeBar && !context.watermark) { if(modeBar) { @@ -121469,9 +121552,9 @@ return customButtons; } -},{"../../plots/cartesian/axis_ids":743,"../../registry":823,"../../traces/scatter/subtypes":1064,"./buttons":627,"./modebar":630}],630:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":745,"../../registry":825,"../../traces/scatter/subtypes":1071,"./buttons":629,"./modebar":632}],632:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -121517,28 +121600,29 @@ proto.update = function(graphInfo, buttons) { this.graphInfo = graphInfo; - var context = this.graphInfo._context, - fullLayout = this.graphInfo._fullLayout, - modeBarId = 'modebar-' + fullLayout._uid; + var context = this.graphInfo._context; + var fullLayout = this.graphInfo._fullLayout; + var modeBarId = 'modebar-' + fullLayout._uid; this.element.setAttribute('id', modeBarId); this._uid = modeBarId; - if(context.displayModeBar === 'hover') { - this.element.className = 'modebar modebar--hover'; - } - else this.element.className = 'modebar'; + 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, '#' + modeBarId, 'background-color: ' + fullLayout.modebar.bgcolor); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId + ' .modebar-btn .icon path', 'fill: ' + fullLayout.modebar.color); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId + ' .modebar-btn:hover .icon path', 'fill: ' + fullLayout.modebar.activecolor); - Lib.addRelatedStyleRule(modeBarId, '#' + modeBarId + ' .modebar-btn.active .icon path', 'fill: ' + fullLayout.modebar.activecolor); + Lib.addRelatedStyleRule(modeBarId, bgSelector + '#' + modeBarId, '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); // if buttons or logo have changed, redraw modebar interior var needsNewButtons = !this.hasButtons(buttons); @@ -121559,7 +121643,7 @@ } if(fullLayout.modebar.orientation === 'v') { - this.element.prepend(logoGroup); + this.element.insertBefore(logoGroup, this.element.childNodes[0]); } else { this.element.appendChild(logoGroup); } @@ -121607,7 +121691,6 @@ proto.createGroup = function() { var group = document.createElement('div'); group.className = 'modebar-group'; - return group; }; @@ -121617,8 +121700,8 @@ * @Return {HTMLelement} */ proto.createButton = function(config) { - var _this = this, - button = document.createElement('a'); + var _this = this; + var button = document.createElement('a'); button.setAttribute('rel', 'tooltip'); button.className = 'modebar-btn'; @@ -121676,10 +121759,10 @@ */ proto.createIcon = function(thisIcon) { var iconHeight = isNumeric(thisIcon.height) ? - Number(thisIcon.height) : - thisIcon.ascent - thisIcon.descent, - svgNS = 'http://www.w3.org/2000/svg', - icon; + 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'); @@ -121717,16 +121800,16 @@ * @Return {HTMLelement} */ proto.updateActiveButton = function(buttonClicked) { - var fullLayout = this.graphInfo._fullLayout, - dataAttrClicked = (buttonClicked !== undefined) ? - buttonClicked.getAttribute('data-attr') : - null; + var fullLayout = this.graphInfo._fullLayout; + var dataAttrClicked = (buttonClicked !== undefined) ? + buttonClicked.getAttribute('data-attr') : + null; this.buttonElements.forEach(function(button) { - var thisval = button.getAttribute('data-val') || true, - dataAttr = button.getAttribute('data-attr'), - isToggleButton = (button.getAttribute('data-toggle') === 'true'), - button3 = d3.select(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); // Use 'data-toggle' and 'buttonClicked' to toggle buttons // that have no one-to-one equivalent in fullLayout @@ -121773,8 +121856,8 @@ * @return {HTMLDivElement} The logo image wrapped in a group */ proto.getLogo = function() { - var group = this.createGroup(), - a = document.createElement('a'); + var group = this.createGroup(); + var a = document.createElement('a'); a.href = 'https://plot.ly/'; a.target = '_blank'; @@ -121820,9 +121903,9 @@ module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":692,"d3":148,"fast-isnumeric":214}],631:[function(_dereq_,module,exports){ +},{"../../../build/ploticon":2,"../../lib":694,"d3":149,"fast-isnumeric":215}],633:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -121956,9 +122039,9 @@ editType: 'plot' }; -},{"../../plot_api/plot_template":730,"../../plots/font_attributes":767,"../color/attributes":568}],632:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":732,"../../plots/font_attributes":769,"../color/attributes":570}],634:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -121985,9 +122068,9 @@ darkAmount: 10 }; -},{}],633:[function(_dereq_,module,exports){ +},{}],635:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122078,9 +122161,9 @@ return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":692,"../../plot_api/plot_template":730,"../../plots/array_container_defaults":736,"../color":569,"./attributes":631,"./constants":632}],634:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"../../plots/array_container_defaults":738,"../color":571,"./attributes":633,"./constants":634}],636:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122125,9 +122208,9 @@ }); selectors.each(function(d) { - var selector = d3.select(this), - axisLayout = d, - selectorLayout = axisLayout.rangeselector; + var selector = d3.select(this); + var axisLayout = d; + var selectorLayout = axisLayout.rangeselector; var buttons = selector.selectAll('g.button') .data(Lib.filterVisible(selectorLayout.buttons)); @@ -122334,9 +122417,9 @@ selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); } -},{"../../constants/alignment":664,"../../lib":692,"../../lib/svg_text_utils":716,"../../plots/cartesian/axis_ids":743,"../../plots/plots":804,"../../registry":823,"../color":569,"../drawing":590,"./constants":632,"./get_update_object":635,"d3":148}],635:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../lib":694,"../../lib/svg_text_utils":718,"../../plots/cartesian/axis_ids":745,"../../plots/plots":806,"../../registry":825,"../color":571,"../drawing":592,"./constants":634,"./get_update_object":637,"d3":149}],637:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122368,10 +122451,8 @@ function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; var base = new Date(axisLayout.r2l(currentRange[1])); - - var step = buttonLayout.step, - count = buttonLayout.count; - + var step = buttonLayout.step; + var count = buttonLayout.count; var range0; switch(buttonLayout.stepmode) { @@ -122391,9 +122472,9 @@ return [range0, range1]; } -},{"d3":148}],636:[function(_dereq_,module,exports){ +},{"d3":149}],638:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122418,9 +122499,9 @@ draw: _dereq_('./draw') }; -},{"./attributes":631,"./defaults":633,"./draw":634}],637:[function(_dereq_,module,exports){ +},{"./attributes":633,"./defaults":635,"./draw":636}],639:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122492,9 +122573,9 @@ editType: 'calc' }; -},{"../color/attributes":568}],638:[function(_dereq_,module,exports){ +},{"../color/attributes":570}],640:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122526,9 +122607,9 @@ } }; -},{"../../plots/cartesian/autorange":739,"../../plots/cartesian/axis_ids":743,"./constants":639}],639:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":741,"../../plots/cartesian/axis_ids":745,"./constants":641}],641:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122582,9 +122663,9 @@ extraPad: 15 }; -},{}],640:[function(_dereq_,module,exports){ +},{}],642:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122668,9 +122749,9 @@ containerOut._input = containerIn; }; -},{"../../lib":692,"../../plot_api/plot_template":730,"../../plots/cartesian/axis_ids":743,"./attributes":637,"./oppaxis_attributes":644}],641:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plot_api/plot_template":732,"../../plots/cartesian/axis_ids":745,"./attributes":639,"./oppaxis_attributes":646}],643:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -122798,9 +122879,9 @@ // update data <--> pixel coordinate conversion methods - var range0 = axisOpts.r2l(opts.range[0]), - range1 = axisOpts.r2l(opts.range[1]), - dist = range1 - range0; + var range0 = axisOpts.r2l(opts.range[0]); + var range1 = axisOpts.r2l(opts.range[1]); + var dist = range1 - range0; opts.p2d = function(v) { return (v / opts._width) * dist + range0; @@ -122813,9 +122894,9 @@ opts._rl = [range0, range1]; if(oppAxisRangeOpts.rangemode !== 'match') { - var range0OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[0]), - range1OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[1]), - distOppAxis = range1OppAxis - range0OppAxis; + var range0OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[0]); + var range1OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[1]); + var distOppAxis = range1OppAxis - range0OppAxis; opts.d2pOppAxis = function(v) { return (v - range0OppAxis) / distOppAxis * opts._height; @@ -122856,17 +122937,17 @@ }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { - var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(), - grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(), - grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); + var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); + var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); rangeSlider.on('mousedown', function() { - var event = d3.event, - target = event.target, - startX = event.clientX, - offsetX = startX - rangeSlider.node().getBoundingClientRect().left, - minVal = opts.d2p(axisOpts._rl[0]), - maxVal = opts.d2p(axisOpts._rl[1]); + var event = d3.event; + var target = event.target; + var startX = event.clientX; + 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(); @@ -122930,8 +123011,8 @@ return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } - var dataMin = clamp(opts.p2d(opts._pixelMin)), - dataMax = clamp(opts.p2d(opts._pixelMax)); + var dataMin = clamp(opts.p2d(opts._pixelMin)); + var dataMax = clamp(opts.p2d(opts._pixelMax)); window.requestAnimationFrame(function() { Registry.call('_guiRelayout', gd, axisOpts._name + '.range', [dataMin, dataMax]); @@ -122953,8 +123034,8 @@ return Lib.constrain(v, -hw2, opts._width + hw2); } - var pixelMin = clamp(opts.d2p(axisOpts._rl[0])), - pixelMax = clamp(opts.d2p(axisOpts._rl[1])); + var pixelMin = clamp(opts.d2p(axisOpts._rl[0])); + var pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select('rect.' + constants.slideBoxClassName) .attr('x', pixelMin) @@ -122968,8 +123049,8 @@ .attr('width', opts._width - pixelMax); if(oppAxisRangeOpts.rangemode !== 'match') { - var pixelMinOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[1])), - pixelMaxOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[0])); + 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) @@ -122991,8 +123072,8 @@ // https://github.com/plotly/plotly.js/pull/1409 var offset = 0.5; - var xMin = Math.round(clampHandle(pixelMin - hw2)) - offset, - xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; + var xMin = Math.round(clampHandle(pixelMin - hw2)) - offset; + var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) .attr('transform', 'translate(' + xMin + ',' + offset + ')'); @@ -123011,8 +123092,8 @@ }); var borderCorrect = (opts.borderwidth % 2) === 0 ? - opts.borderwidth : - opts.borderwidth - 1; + opts.borderwidth : + opts.borderwidth - 1; var offsetShift = -opts._offsetShift; var lw = Drawing.crispRound(gd, opts.borderwidth); @@ -123057,12 +123138,12 @@ var mainplotinfo; rangePlots.each(function(id, i) { - var plotgroup = d3.select(this), - isMainPlot = (i === 0); + var plotgroup = d3.select(this); + var isMainPlot = (i === 0); - var oppAxisOpts = axisIDs.getFromId(gd, id, 'y'), - oppAxisName = oppAxisOpts._name, - oppAxisRangeOpts = opts[oppAxisName]; + var oppAxisOpts = axisIDs.getFromId(gd, id, 'y'); + var oppAxisName = oppAxisOpts._name; + var oppAxisRangeOpts = opts[oppAxisName]; var mockFigure = { data: [], @@ -123119,8 +123200,8 @@ var out = []; for(var i = 0; i < calcData.length; i++) { - var calcTrace = calcData[i], - trace = calcTrace[0].trace; + var calcTrace = calcData[i]; + var trace = calcTrace[0].trace; if(trace.xaxis + trace.yaxis === subplotId) { out.push(calcTrace); @@ -123249,9 +123330,9 @@ grabAreaMax.attr('height', opts._height); } -},{"../../lib":692,"../../lib/setcursor":712,"../../plots/cartesian":752,"../../plots/cartesian/axis_ids":743,"../../plots/plots":804,"../../registry":823,"../color":569,"../dragelement":587,"../drawing":590,"../titles":657,"./constants":639,"d3":148}],642:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/setcursor":714,"../../plots/cartesian":754,"../../plots/cartesian/axis_ids":745,"../../plots/plots":806,"../../registry":825,"../color":571,"../dragelement":589,"../drawing":592,"../titles":659,"./constants":641,"d3":149}],644:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123319,9 +123400,9 @@ }; }; -},{"../../plots/cartesian/axis_ids":743,"./constants":639}],643:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":745,"./constants":641}],645:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123358,9 +123439,9 @@ autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":692,"./attributes":637,"./calc_autorange":638,"./defaults":640,"./draw":641,"./helpers":642,"./oppaxis_attributes":644}],644:[function(_dereq_,module,exports){ +},{"../../lib":694,"./attributes":639,"./calc_autorange":640,"./defaults":642,"./draw":643,"./helpers":644,"./oppaxis_attributes":646}],646:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123396,9 +123477,9 @@ editType: 'calc' }; -},{}],645:[function(_dereq_,module,exports){ +},{}],647:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123532,9 +123613,9 @@ editType: 'arraydraw' }); -},{"../../lib/extend":682,"../../plot_api/plot_template":730,"../../traces/scatter/attributes":1040,"../annotations/attributes":552,"../drawing/attributes":589}],646:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../../plot_api/plot_template":732,"../../traces/scatter/attributes":1047,"../annotations/attributes":554,"../drawing/attributes":591}],648:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123551,8 +123632,8 @@ module.exports = function calcAutorange(gd) { - var fullLayout = gd._fullLayout, - shapeList = Lib.filterVisible(fullLayout.shapes); + var fullLayout = gd._fullLayout; + var shapeList = Lib.filterVisible(fullLayout.shapes); if(!shapeList.length || !gd._fullData.length) return; @@ -123563,8 +123644,8 @@ var ax, bounds; if(shape.xref !== 'paper') { - var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0, - vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; + var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; + var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); bounds = shapeBounds(ax, vx0, vx1, shape.path, constants.paramIsX); @@ -123574,8 +123655,8 @@ } if(shape.yref !== 'paper') { - var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0, - vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; + var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; + var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); bounds = shapeBounds(ax, vy0, vy1, shape.path, constants.paramIsY); @@ -123595,17 +123676,17 @@ } function calcPaddingOptions(lineWidth, sizeMode, v0, v1, path, isYAxis) { - var ppad = lineWidth / 2, - axisDirectionReverted = isYAxis; + var ppad = lineWidth / 2; + var axisDirectionReverted = isYAxis; if(sizeMode === 'pixel') { var coords = path ? - helpers.extractPathCoords(path, isYAxis ? constants.paramIsY : constants.paramIsX) : - [v0, v1]; - var maxValue = Lib.aggNums(Math.max, null, coords), - minValue = Lib.aggNums(Math.min, null, coords), - beforePad = minValue < 0 ? Math.abs(minValue) + ppad : ppad, - afterPad = maxValue > 0 ? maxValue + ppad : ppad; + helpers.extractPathCoords(path, isYAxis ? constants.paramIsY : constants.paramIsX) : + [v0, v1]; + 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: ppad, @@ -123623,14 +123704,14 @@ if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; - var min = Infinity, - max = -Infinity, - segments = path.match(constants.segmentRE), - i, - segment, - drawnParam, - params, - val; + var min = Infinity; + var max = -Infinity; + var segments = path.match(constants.segmentRE); + var i; + var segment; + var drawnParam; + var params; + var val; if(ax.type === 'date') convertVal = helpers.decodeDate(convertVal); @@ -123649,9 +123730,9 @@ if(max >= min) return [min, max]; } -},{"../../lib":692,"../../plots/cartesian/axes":740,"./constants":647,"./helpers":650}],647:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"./constants":649,"./helpers":652}],649:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123713,9 +123794,9 @@ } }; -},{}],648:[function(_dereq_,module,exports){ +},{}],650:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123756,21 +123837,21 @@ coerce('line.width'); coerce('line.dash'); - var dfltType = shapeIn.path ? 'path' : 'rect', - shapeType = coerce('type', dfltType), - xSizeMode = coerce('xsizemode'), - ySizeMode = coerce('ysizemode'); + var dfltType = shapeIn.path ? 'path' : 'rect'; + var shapeType = coerce('type', dfltType); + var xSizeMode = coerce('xsizemode'); + var ySizeMode = coerce('ysizemode'); // positioning var axLetters = ['x', 'y']; for(var i = 0; i < 2; i++) { - var axLetter = axLetters[i], - attrAnchor = axLetter + 'anchor', - sizeMode = axLetter === 'x' ? xSizeMode : ySizeMode, - gdMock = {_fullLayout: fullLayout}, - ax, - pos2r, - r2pos; + var axLetter = axLetters[i]; + var attrAnchor = axLetter + 'anchor'; + var sizeMode = axLetter === 'x' ? xSizeMode : ySizeMode; + var gdMock = {_fullLayout: fullLayout}; + var ax; + var pos2r; + var r2pos; // xref, yref var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); @@ -123787,17 +123868,17 @@ // Coerce x0, x1, y0, y1 if(shapeType !== 'path') { - var dflt0 = 0.25, - dflt1 = 0.75; + var dflt0 = 0.25; + var dflt1 = 0.75; // hack until V2.0 when log has regular range behavior - make it look like other // ranges to send to coerce, then put it back after // this is all to give reasonable default position behavior on log axes, which is // a pretty unimportant edge case so we could just ignore this. - var attr0 = axLetter + '0', - attr1 = axLetter + '1', - in0 = shapeIn[attr0], - in1 = shapeIn[attr1]; + 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); @@ -123838,9 +123919,9 @@ } } -},{"../../lib":692,"../../plots/array_container_defaults":736,"../../plots/cartesian/axes":740,"./attributes":645,"./helpers":650}],649:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"../../plots/cartesian/axes":742,"./attributes":647,"./helpers":652}],651:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -123935,12 +124016,11 @@ function drawShape(shapeLayer) { var attrs = { - 'data-index': index, - 'fill-rule': 'evenodd', - d: getPathString(gd, options) - }, - lineColor = options.line.width ? - options.line.color : 'rgba(0,0,0,0)'; + 'data-index': index, + 'fill-rule': 'evenodd', + d: getPathString(gd, options) + }; + var lineColor = options.line.width ? options.line.color : 'rgba(0,0,0,0)'; var path = shapeLayer.append('path') .attr(attrs) @@ -123985,22 +124065,22 @@ var pathIn; // setup conversion functions - var xa = Axes.getFromId(gd, shapeOptions.xref), - ya = Axes.getFromId(gd, shapeOptions.yref), - x2p = helpers.getDataToPixel(gd, xa), - y2p = helpers.getDataToPixel(gd, ya, true), - p2x = helpers.getPixelToData(gd, xa), - p2y = helpers.getPixelToData(gd, ya, true); + var xa = Axes.getFromId(gd, shapeOptions.xref); + var ya = Axes.getFromId(gd, shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa); + var y2p = helpers.getDataToPixel(gd, ya, true); + var p2x = helpers.getPixelToData(gd, xa); + var p2y = helpers.getPixelToData(gd, ya, true); var sensoryElement = obtainSensoryElement(); var dragOptions = { - element: sensoryElement.node(), - gd: gd, - prepFn: startDrag, - doneFn: endDrag, - clickFn: abortDrag - }, - dragMode; + element: sensoryElement.node(), + gd: gd, + prepFn: startDrag, + doneFn: endDrag, + clickFn: abortDrag + }; + var dragMode; dragElement.init(dragOptions); @@ -124011,8 +124091,8 @@ } function createLineDragHandles() { - var minSensoryWidth = 10, - sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth); + var minSensoryWidth = 10; + var sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth); // Helper shapes group // Note that by setting the `data-index` attr, it is ensured that @@ -124073,13 +124153,13 @@ // choose 'move' or 'resize' // based on initial position of cursor within the drag element - var w = dragBBox.right - dragBBox.left, - h = dragBBox.bottom - dragBBox.top, - x = evt.clientX - dragBBox.left, - y = evt.clientY - dragBBox.top, - cursor = (!isPath && w > MINWIDTH && h > MINHEIGHT && !evt.shiftKey) ? - dragElement.getCursor(x / w, 1 - y / h) : - 'move'; + 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); @@ -124157,9 +124237,9 @@ function moveShape(dx, dy) { if(shapeOptions.type === 'path') { - var noOp = function(coord) { return coord; }, - moveX = noOp, - moveY = noOp; + var noOp = function(coord) { return coord; }; + var moveX = noOp; + var moveY = noOp; if(xPixelSized) { modifyItem('xanchor', shapeOptions.xanchor = p2x(xAnchor + dx)); @@ -124200,9 +124280,9 @@ function resizeShape(dx, dy) { if(isPath) { // TODO: implement path resize, don't forget to update dragMode code - var noOp = function(coord) { return coord; }, - moveX = noOp, - moveY = noOp; + var noOp = function(coord) { return coord; }; + var moveX = noOp; + var moveY = noOp; if(xPixelSized) { modifyItem('xanchor', shapeOptions.xanchor = p2x(xAnchor + dx)); @@ -124234,10 +124314,10 @@ } } else { - var newN = (~dragMode.indexOf('n')) ? n0 + dy : n0, - newS = (~dragMode.indexOf('s')) ? s0 + dy : s0, - newW = (~dragMode.indexOf('w')) ? w0 + dx : w0, - newE = (~dragMode.indexOf('e')) ? e0 + dx : e0; + var newN = (~dragMode.indexOf('n')) ? n0 + dy : n0; + var newS = (~dragMode.indexOf('s')) ? s0 + dy : s0; + var newW = (~dragMode.indexOf('w')) ? w0 + dx : w0; + var newE = (~dragMode.indexOf('e')) ? e0 + dx : e0; // Do things in opposing direction for y-axis. // Hint: for data-sized shapes the reversal of axis direction is done in p2y. @@ -124326,10 +124406,10 @@ } function deactivateClipPathTemporarily(shapePath, shapeOptions, gd) { - var xref = shapeOptions.xref, - yref = shapeOptions.yref, - xa = Axes.getFromId(gd, xref), - ya = Axes.getFromId(gd, yref); + var xref = shapeOptions.xref; + var yref = shapeOptions.yref; + var xa = Axes.getFromId(gd, xref); + var ya = Axes.getFromId(gd, yref); var clipAxes = ''; if(xref !== 'paper' && !xa.autorange) clipAxes += xref; @@ -124344,12 +124424,12 @@ } function getPathString(gd, options) { - var type = options.type, - xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - gs = gd._fullLayout._size, - x2r, x2p, y2r, y2p, - x0, x1, y0, y1; + var type = options.type; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); + var gs = gd._fullLayout._size; + var x2r, x2p, y2r, y2p; + var x0, x1, y0, y1; if(xa) { x2r = helpers.shapePositionToRange(xa); @@ -124395,33 +124475,33 @@ if(type === 'line') return 'M' + x0 + ',' + y0 + 'L' + x1 + ',' + y1; if(type === 'rect') return 'M' + x0 + ',' + y0 + 'H' + x1 + 'V' + y1 + 'H' + x0 + 'Z'; + // circle - var cx = (x0 + x1) / 2, - cy = (y0 + y1) / 2, - rx = Math.abs(cx - x0), - ry = Math.abs(cy - y0), - rArc = 'A' + rx + ',' + ry, - rightPt = (cx + rx) + ',' + cy, - topPt = cx + ',' + (cy - ry); + var cx = (x0 + x1) / 2; + var cy = (y0 + y1) / 2; + var rx = Math.abs(cx - x0); + var ry = Math.abs(cy - y0); + 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, - xSizemode = options.xsizemode, - ySizemode = options.ysizemode, - xAnchor = options.xanchor, - yAnchor = options.yanchor; - + 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, - segmentType = segment.charAt(0), - xParams = constants.paramIsX[segmentType], - yParams = constants.paramIsY[segmentType], - nParams = constants.numParams[segmentType]; + 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]) { @@ -124449,11 +124529,11 @@ function movePath(pathIn, moveX, moveY) { return pathIn.replace(constants.segmentRE, function(segment) { - var paramNumber = 0, - segmentType = segment.charAt(0), - xParams = constants.paramIsX[segmentType], - yParams = constants.paramIsY[segmentType], - nParams = constants.numParams[segmentType]; + 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; @@ -124470,9 +124550,9 @@ }); } -},{"../../lib":692,"../../lib/setcursor":712,"../../plot_api/plot_template":730,"../../plots/cartesian/axes":740,"../../registry":823,"../color":569,"../dragelement":587,"../drawing":590,"./constants":647,"./helpers":650}],650:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/setcursor":714,"../../plot_api/plot_template":732,"../../plots/cartesian/axes":742,"../../registry":825,"../color":571,"../dragelement":589,"../drawing":592,"./constants":649,"./helpers":652}],652:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -124532,8 +124612,8 @@ }; exports.getDataToPixel = function(gd, axis, isVertical) { - var gs = gd._fullLayout._size, - dataToPixel; + var gs = gd._fullLayout._size; + var dataToPixel; if(axis) { var d2r = exports.shapePositionToRange(axis); @@ -124555,8 +124635,8 @@ }; exports.getPixelToData = function(gd, axis, isVertical) { - var gs = gd._fullLayout._size, - pixelToData; + var gs = gd._fullLayout._size; + var pixelToData; if(axis) { var r2d = exports.rangeToShapePosition(axis); @@ -124595,9 +124675,9 @@ return strokeWidthIsOdd ? posValAsInt + 0.5 : posValAsInt; }; -},{"../../lib":692,"./constants":647}],651:[function(_dereq_,module,exports){ +},{"../../lib":694,"./constants":649}],653:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -124622,9 +124702,9 @@ drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":751,"./attributes":645,"./calc_autorange":646,"./defaults":648,"./draw":649}],652:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":753,"./attributes":647,"./calc_autorange":648,"./defaults":650,"./draw":651}],654:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -124865,9 +124945,9 @@ } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plot_api/plot_template":730,"../../plots/animation_attributes":735,"../../plots/font_attributes":767,"../../plots/pad_attributes":803,"./constants":653}],653:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plot_api/plot_template":732,"../../plots/animation_attributes":737,"../../plots/font_attributes":769,"../../plots/pad_attributes":805,"./constants":655}],655:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -124959,9 +125039,9 @@ currentValueInset: 0, }; -},{}],654:[function(_dereq_,module,exports){ +},{}],656:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -125076,9 +125156,9 @@ } } -},{"../../lib":692,"../../plots/array_container_defaults":736,"./attributes":652,"./constants":653}],655:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"./attributes":654,"./constants":655}],657:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -125103,8 +125183,8 @@ var FROM_BR = alignmentConstants.FROM_BR; module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout, gd); + var fullLayout = gd._fullLayout; + var sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -125182,8 +125262,8 @@ // This really only just filters by visibility: function makeSliderData(fullLayout, gd) { - var contOpts = fullLayout[constants.name], - sliderData = []; + var contOpts = fullLayout[constants.name]; + var sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; @@ -125706,9 +125786,9 @@ ); } -},{"../../constants/alignment":664,"../../lib":692,"../../lib/svg_text_utils":716,"../../plot_api/plot_template":730,"../../plots/plots":804,"../color":569,"../drawing":590,"./constants":653,"d3":148}],656:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../lib":694,"../../lib/svg_text_utils":718,"../../plot_api/plot_template":732,"../../plots/plots":806,"../color":571,"../drawing":592,"./constants":655,"d3":149}],658:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -125729,9 +125809,9 @@ draw: _dereq_('./draw') }; -},{"./attributes":652,"./constants":653,"./defaults":654,"./draw":655}],657:[function(_dereq_,module,exports){ +},{"./attributes":654,"./constants":655,"./defaults":656,"./draw":657}],659:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -125829,6 +125909,10 @@ if(!editable) txt = ''; } + if(fullLayout.meta) { + txt = Lib.templateString(txt, {meta: fullLayout.meta}); + } + var elShouldExist = txt || editable; if(!group) { @@ -125990,9 +126074,9 @@ return group; } -},{"../../constants/interactions":668,"../../lib":692,"../../lib/svg_text_utils":716,"../../plots/plots":804,"../../registry":823,"../color":569,"../drawing":590,"d3":148,"fast-isnumeric":214}],658:[function(_dereq_,module,exports){ +},{"../../constants/interactions":670,"../../lib":694,"../../lib/svg_text_utils":718,"../../plots/plots":806,"../../registry":825,"../color":571,"../drawing":592,"d3":149,"fast-isnumeric":215}],660:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -126148,9 +126232,9 @@ } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plot_api/plot_template":730,"../../plots/font_attributes":767,"../../plots/pad_attributes":803,"../color/attributes":568}],659:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plot_api/plot_template":732,"../../plots/font_attributes":769,"../../plots/pad_attributes":805,"../color/attributes":570}],661:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -126229,9 +126313,9 @@ } }; -},{}],660:[function(_dereq_,module,exports){ +},{}],662:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -126312,9 +126396,9 @@ } } -},{"../../lib":692,"../../plots/array_container_defaults":736,"./attributes":658,"./constants":659}],661:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"./attributes":660,"./constants":661}],663:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -126339,8 +126423,8 @@ var ScrollBox = _dereq_('./scrollbox'); module.exports = function draw(gd) { - var fullLayout = gd._fullLayout, - menuData = Lib.filterVisible(fullLayout[constants.name]); + var fullLayout = gd._fullLayout; + var menuData = Lib.filterVisible(fullLayout[constants.name]); /* Update menu data is bound to the header-group. * The items in the header group are always present. @@ -126414,8 +126498,8 @@ } // setup scrollbox - var scrollBoxId = 'updatemenus' + fullLayout._uid, - scrollBox = new ScrollBox(gd, gButton, scrollBoxId); + var scrollBoxId = 'updatemenus' + fullLayout._uid; + var scrollBox = new ScrollBox(gd, gButton, scrollBoxId); // remove exiting header, remove dropped buttons and reset margins if(headerGroups.enter().size()) { @@ -126671,9 +126755,9 @@ var isVertical = (direction === 'up' || direction === 'down'); var dims = menuOpts._dims; - var active = menuOpts.active, - translateX, translateY, - i; + var active = menuOpts.active; + var translateX, translateY; + var i; if(isVertical) { translateY = 0; for(i = 0; i < active; i++) { @@ -126705,8 +126789,8 @@ } function hideScrollBox(scrollBox) { - var hasHBar = !!scrollBox.hbar, - hasVBar = !!scrollBox.vbar; + var hasHBar = !!scrollBox.hbar; + var hasVBar = !!scrollBox.vbar; if(hasHBar) { scrollBox.hbar @@ -126961,11 +127045,11 @@ .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":664,"../../lib":692,"../../lib/svg_text_utils":716,"../../plot_api/plot_template":730,"../../plots/plots":804,"../color":569,"../drawing":590,"./constants":659,"./scrollbox":663,"d3":148}],662:[function(_dereq_,module,exports){ -arguments[4][656][0].apply(exports,arguments) -},{"./attributes":658,"./constants":659,"./defaults":660,"./draw":661,"dup":656}],663:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../lib":694,"../../lib/svg_text_utils":718,"../../plot_api/plot_template":732,"../../plots/plots":806,"../color":571,"../drawing":592,"./constants":661,"./scrollbox":665,"d3":149}],664:[function(_dereq_,module,exports){ +arguments[4][658][0].apply(exports,arguments) +},{"./attributes":660,"./constants":661,"./defaults":662,"./draw":663,"dup":658}],665:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127045,26 +127129,26 @@ * @param {number} [translateY=0] Vertical offset (in pixels) */ ScrollBox.prototype.enable = function enable(position, translateX, translateY) { - var fullLayout = this.gd._fullLayout, - fullWidth = fullLayout.width, - fullHeight = fullLayout.height; + var fullLayout = this.gd._fullLayout; + var fullWidth = fullLayout.width; + var fullHeight = fullLayout.height; // compute position of scrollbox this.position = position; - var l = this.position.l, - w = this.position.w, - t = this.position.t, - h = this.position.h, - direction = this.position.direction, - isDown = (direction === 'down'), - isLeft = (direction === 'left'), - isRight = (direction === 'right'), - isUp = (direction === 'up'), - boxW = w, - boxH = h, - boxL, boxR, - boxT, boxB; + 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'; @@ -127115,12 +127199,12 @@ }; // compute position of horizontal scroll bar - var needsHorizontalScrollBar = (w > boxW), - hbarW = ScrollBox.barLength + 2 * ScrollBox.barPad, - hbarH = ScrollBox.barWidth + 2 * ScrollBox.barPad, - // draw horizontal scrollbar on the bottom side - hbarL = l, - hbarT = t + h; + var needsHorizontalScrollBar = (w > boxW); + var hbarW = ScrollBox.barLength + 2 * ScrollBox.barPad; + var hbarH = ScrollBox.barWidth + 2 * ScrollBox.barPad; + // draw horizontal scrollbar on the bottom side + var hbarL = l; + var hbarT = t + h; if(hbarT + hbarH > fullHeight) hbarT = fullHeight - hbarH; @@ -127156,12 +127240,12 @@ } // compute position of vertical scroll bar - var needsVerticalScrollBar = (h > boxH), - vbarW = ScrollBox.barWidth + 2 * ScrollBox.barPad, - vbarH = ScrollBox.barLength + 2 * ScrollBox.barPad, - // draw vertical scrollbar on the right side - vbarL = l + w, - vbarT = t; + var needsVerticalScrollBar = (h > boxH); + var vbarW = ScrollBox.barWidth + 2 * ScrollBox.barPad; + var vbarH = ScrollBox.barLength + 2 * ScrollBox.barPad; + // draw vertical scrollbar on the right side + var vbarL = l + w; + var vbarT = t; if(vbarL + vbarW > fullWidth) vbarL = fullWidth - vbarW; @@ -127197,11 +127281,11 @@ } // setup a clip path (if scroll bars are needed) - var clipId = this.id, - clipL = boxL - 0.5, - clipR = (needsVerticalScrollBar) ? boxR + vbarW + 0.5 : boxR + 0.5, - clipT = boxT - 0.5, - clipB = (needsHorizontalScrollBar) ? boxB + hbarH + 0.5 : boxB + 0.5; + 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] : []); @@ -127320,8 +127404,8 @@ * @method */ ScrollBox.prototype._onBoxDrag = function onBarDrag() { - var translateX = this.translateX, - translateY = this.translateY; + var translateX = this.translateX; + var translateY = this.translateY; if(this.hbar) { translateX -= d3.event.dx; @@ -127340,8 +127424,8 @@ * @method */ ScrollBox.prototype._onBoxWheel = function onBarWheel() { - var translateX = this.translateX, - translateY = this.translateY; + var translateX = this.translateX; + var translateY = this.translateY; if(this.hbar) { translateX += d3.event.deltaY; @@ -127360,14 +127444,14 @@ * @method */ ScrollBox.prototype._onBarDrag = function onBarDrag() { - var translateX = this.translateX, - translateY = this.translateY; + var translateX = this.translateX; + var translateY = this.translateY; if(this.hbar) { - var xMin = translateX + this._hbarXMin, - xMax = xMin + this._hbarTranslateMax, - x = Lib.constrain(d3.event.x, xMin, xMax), - xf = (x - xMin) / (xMax - xMin); + var xMin = translateX + this._hbarXMin; + var xMax = xMin + this._hbarTranslateMax; + var x = Lib.constrain(d3.event.x, xMin, xMax); + var xf = (x - xMin) / (xMax - xMin); var translateXMax = this.position.w - this._box.w; @@ -127375,10 +127459,10 @@ } if(this.vbar) { - var yMin = translateY + this._vbarYMin, - yMax = yMin + this._vbarTranslateMax, - y = Lib.constrain(d3.event.y, yMin, yMax), - yf = (y - yMin) / (yMax - yMin); + var yMin = translateY + this._vbarYMin; + var yMax = yMin + this._vbarTranslateMax; + var y = Lib.constrain(d3.event.y, yMin, yMax); + var yf = (y - yMin) / (yMax - yMin); var translateYMax = this.position.h - this._box.h; @@ -127397,8 +127481,8 @@ */ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) { // store translateX and translateY (needed by mouse event handlers) - var translateXMax = this.position.w - this._box.w, - translateYMax = this.position.h - this._box.h; + 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); @@ -127434,9 +127518,9 @@ } }; -},{"../../lib":692,"../color":569,"../drawing":590,"d3":148}],664:[function(_dereq_,module,exports){ +},{"../../lib":694,"../color":571,"../drawing":592,"d3":149}],666:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127499,9 +127583,9 @@ } }; -},{}],665:[function(_dereq_,module,exports){ +},{}],667:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127537,9 +127621,9 @@ } }; -},{}],666:[function(_dereq_,module,exports){ +},{}],668:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127558,9 +127642,9 @@ longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],667:[function(_dereq_,module,exports){ +},{}],669:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127581,9 +127665,9 @@ x: '❌' }; -},{}],668:[function(_dereq_,module,exports){ +},{}],670:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127608,9 +127692,9 @@ DESELECTDIM: 0.2 }; -},{}],669:[function(_dereq_,module,exports){ +},{}],671:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127673,9 +127757,9 @@ MINUS_SIGN: '\u2212' }; -},{}],670:[function(_dereq_,module,exports){ +},{}],672:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127697,9 +127781,9 @@ 'xmlns:xlink': exports.xlink }; -},{}],671:[function(_dereq_,module,exports){ +},{}],673:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127709,7 +127793,7 @@ 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.43.1'; +exports.version = '1.44.3'; // inject promise polyfill _dereq_('es6-promise').polyfill(); @@ -127777,9 +127861,9 @@ // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":560,"./components/annotations3d":565,"./components/colorscale":581,"./components/errorbars":596,"./components/fx":608,"./components/grid":612,"./components/images":617,"./components/legend":625,"./components/rangeselector":636,"./components/rangeslider":643,"./components/shapes":651,"./components/sliders":656,"./components/updatemenus":662,"./fonts/mathjax_config":672,"./lib/queue":707,"./locale-en":721,"./locale-en-us":720,"./plot_api":725,"./plot_api/plot_schema":729,"./plots/plots":804,"./registry":823,"./snapshot":828,"./traces/scatter":1052,"d3":148,"es6-promise":203}],672:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":562,"./components/annotations3d":567,"./components/colorscale":583,"./components/errorbars":598,"./components/fx":610,"./components/grid":614,"./components/images":619,"./components/legend":627,"./components/rangeselector":638,"./components/rangeslider":645,"./components/shapes":653,"./components/sliders":658,"./components/updatemenus":664,"./fonts/mathjax_config":674,"./lib/queue":709,"./locale-en":723,"./locale-en-us":722,"./plot_api":727,"./plot_api/plot_schema":731,"./plots/plots":806,"./registry":825,"./snapshot":830,"./traces/scatter":1059,"d3":149,"es6-promise":204}],674:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127808,9 +127892,9 @@ } }; -},{}],673:[function(_dereq_,module,exports){ +},{}],675:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -127872,9 +127956,9 @@ ); }; -},{}],674:[function(_dereq_,module,exports){ +},{}],676:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -128113,9 +128197,9 @@ pathAnnulus: pathAnnulus }; -},{"./mod":699}],675:[function(_dereq_,module,exports){ +},{"./mod":701}],677:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -128272,9 +128356,9 @@ return 0; } -},{}],676:[function(_dereq_,module,exports){ +},{}],678:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -128305,9 +128389,9 @@ return BADNUM; }; -},{"../constants/numerical":669,"fast-isnumeric":214}],677:[function(_dereq_,module,exports){ +},{"../constants/numerical":671,"fast-isnumeric":215}],679:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -128333,9 +128417,9 @@ } }; -},{}],678:[function(_dereq_,module,exports){ +},{}],680:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -128356,9 +128440,9 @@ } }; -},{}],679:[function(_dereq_,module,exports){ +},{}],681:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -128541,8 +128625,8 @@ propOut.set(v); return; } - var vParts = v.split('+'), - i = 0; + var vParts = v.split('+'); + var i = 0; while(i < vParts.length) { var vi = vParts[i]; if(opts.flags.indexOf(vi) === -1 || vParts.indexOf(vi) < i) { @@ -128721,9 +128805,9 @@ * returns false if there is no user input. */ exports.coerce2 = function(containerIn, containerOut, attributes, attribute, dflt) { - var propIn = nestedProperty(containerIn, attribute), - propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt), - valIn = propIn.get(); + var propIn = nestedProperty(containerIn, attribute); + var propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt); + var valIn = propIn.get(); return (valIn !== undefined && valIn !== null) ? propOut : false; }; @@ -128816,9 +128900,9 @@ return valObjectDef.validateFunction(value, opts); } - var failed = {}, - out = failed, - propMock = { set: function(v) { out = v; } }; + var failed = {}; + var out = failed; + var propMock = { set: function(v) { out = v; } }; // 'failed' just something mutable that won't be === anything else @@ -128827,9 +128911,9 @@ } exports.validate = validate; -},{"../components/colorscale/scales":584,"../constants/interactions":668,"../plots/attributes":737,"./array":675,"./mod":699,"./nested_property":700,"./regex":708,"fast-isnumeric":214,"tinycolor2":513}],680:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":586,"../constants/interactions":670,"../plots/attributes":739,"./array":677,"./mod":701,"./nested_property":702,"./regex":710,"fast-isnumeric":215,"tinycolor2":515}],682:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129000,12 +129084,12 @@ var match = s.match(isChinese ? DATETIME_REGEXP_CN : DATETIME_REGEXP); if(!match) return BADNUM; - var y = match[1], - m = match[3] || '1', - d = Number(match[5] || 1), - H = Number(match[7] || 0), - M = Number(match[9] || 0), - S = Number(match[11] || 0); + 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) { // disallow 2-digit years for world calendars @@ -129082,18 +129166,17 @@ if(!r) r = 0; - var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10), - msRounded = Math.round(ms - msecTenths / 10), - dateStr, h, m, s, msec10, d; + var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10); + var msRounded = Math.round(ms - msecTenths / 10); + var dateStr, h, m, s, msec10, d; if(isWorldCalendar(calendar)) { - var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD, - timeMs = Math.floor(mod(ms, ONEDAY)); + var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD; + var timeMs = Math.floor(mod(ms, ONEDAY)); try { dateStr = Registry.getComponentMethod('calendars', 'getCal')(calendar) .fromJD(dateJD).formatDate('yyyy-mm-dd'); - } - catch(e) { + } catch(e) { // invalid date in this calendar - fall back to Gyyyy-mm-dd dateStr = utcFormat('G%Y-%m-%d')(new Date(msRounded)); } @@ -129103,8 +129186,7 @@ // it manually (after the '-' if there is one) if(dateStr.charAt(0) === '-') { while(dateStr.length < 11) dateStr = '-0' + dateStr.substr(1); - } - else { + } else { while(dateStr.length < 10) dateStr = '0' + dateStr; } @@ -129141,13 +129223,13 @@ exports.ms2DateTimeLocal = function(ms) { if(!(ms >= MIN_MS + ONEDAY && ms <= MAX_MS - ONEDAY)) return BADNUM; - var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10), - d = new Date(Math.round(ms - msecTenths / 10)), - dateStr = d3.time.format('%Y-%m-%d')(d), - h = d.getHours(), - m = d.getMinutes(), - s = d.getSeconds(), - msec10 = d.getUTCMilliseconds() * 10 + msecTenths; + var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10); + var d = new Date(Math.round(ms - msecTenths / 10)); + var dateStr = d3.time.format('%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); }; @@ -129211,10 +129293,10 @@ function modDateFormat(fmt, x, formatter, calendar) { fmt = fmt.replace(fracMatch, function(match) { - var digits = Math.min(+(match.charAt(1)) || 6, 6), - fracSecs = ((x / 1000 % 1) + 2) - .toFixed(digits) - .substr(2).replace(/0+$/, '') || '0'; + var digits = Math.min(+(match.charAt(1)) || 6, 6); + var fracSecs = ((x / 1000 % 1) + 2) + .toFixed(digits) + .substr(2).replace(/0+$/, '') || '0'; return fracSecs; }); @@ -129346,16 +129428,15 @@ if(calendar) { try { - var dateJD = Math.round(ms / ONEDAY) + EPOCHJD, - calInstance = Registry.getComponentMethod('calendars', 'getCal')(calendar), - cDate = calInstance.fromJD(dateJD); + var dateJD = Math.round(ms / 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) { + } catch(e) { Loggers.error('invalid ms ' + ms + ' in calendar ' + calendar); // then keep going in gregorian even though the result will be 'Invalid' } @@ -129372,12 +129453,12 @@ * calendar (string) the calendar to test against */ exports.findExactDates = function(data, calendar) { - var exactYears = 0, - exactMonths = 0, - exactDays = 0, - blankCount = 0, - d, - di; + var exactYears = 0; + var exactMonths = 0; + var exactDays = 0; + var blankCount = 0; + var d; + var di; var calInstance = ( isWorldCalendar(calendar) && @@ -129430,9 +129511,9 @@ }; }; -},{"../constants/numerical":669,"../registry":823,"./loggers":696,"./mod":699,"d3":148,"fast-isnumeric":214}],681:[function(_dereq_,module,exports){ +},{"../constants/numerical":671,"../registry":825,"./loggers":698,"./mod":701,"d3":149,"fast-isnumeric":215}],683:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129604,9 +129685,9 @@ module.exports = Events; -},{"events":92}],682:[function(_dereq_,module,exports){ +},{"events":93}],684:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129667,8 +129748,8 @@ * */ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { - var target = inputs[0], - length = inputs.length; + var target = inputs[0]; + var length = inputs.length; var input, key, src, copy, copyIsArray, clone, allPrimitives; @@ -129720,9 +129801,9 @@ return target; } -},{"./is_plain_object.js":693}],683:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":695}],685:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129755,9 +129836,9 @@ * @return {array} new filtered array */ module.exports = function filterUnique(array) { - var seen = {}, - out = [], - j = 0; + var seen = {}; + var out = []; + var j = 0; for(var i = 0; i < array.length; i++) { var item = array[i]; @@ -129771,9 +129852,9 @@ return out; }; -},{}],684:[function(_dereq_,module,exports){ +},{}],686:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129818,9 +129899,9 @@ ); } -},{}],685:[function(_dereq_,module,exports){ +},{}],687:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129871,8 +129952,8 @@ function countryNameToISO3(countryName) { for(var i = 0; i < countryIds.length; i++) { - var iso3 = countryIds[i], - regex = new RegExp(countryRegex[iso3]); + var iso3 = countryIds[i]; + var regex = new RegExp(countryRegex[iso3]); if(regex.test(countryName.trim().toLowerCase())) return iso3; } @@ -129882,9 +129963,9 @@ return false; } -},{"../lib":692,"country-regex":122}],686:[function(_dereq_,module,exports){ +},{"../lib":694,"country-regex":123}],688:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -129999,9 +130080,9 @@ }; }; -},{"../constants/numerical":669}],687:[function(_dereq_,module,exports){ +},{"../constants/numerical":671}],689:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130018,18 +130099,18 @@ */ exports.segmentsIntersect = segmentsIntersect; function segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { - var a = x2 - x1, - b = x3 - x1, - c = x4 - x3, - d = y2 - y1, - e = y3 - y1, - f = y4 - y3, - det = a * f - c * d; + var a = x2 - x1; + var b = x3 - x1; + var c = x4 - x3; + var d = y2 - y1; + var e = y3 - y1; + var f = y4 - y3; + var det = a * f - c * d; // parallel lines? intersection is undefined // ignore the case where they are colinear if(det === 0) return null; - var t = (b * f - c * e) / det, - u = (b * d - a * e) / det; + var t = (b * f - c * e) / det; + var u = (b * d - a * e) / det; // segments do not intersect? if(u < 0 || u > 1 || t < 0 || t > 1) return null; @@ -130047,15 +130128,15 @@ var y12 = y2 - y1; var x34 = x4 - x3; var y34 = y4 - y3; - var l2_12 = x12 * x12 + y12 * y12; - var l2_34 = x34 * x34 + y34 * y34; + var ll12 = x12 * x12 + y12 * y12; + var ll34 = x34 * x34 + y34 * y34; // calculate distance squared, then take the sqrt at the very end var dist2 = Math.min( - perpDistance2(x12, y12, l2_12, x3 - x1, y3 - y1), - perpDistance2(x12, y12, l2_12, x4 - x1, y4 - y1), - perpDistance2(x34, y34, l2_34, x1 - x3, y1 - y3), - perpDistance2(x34, y34, l2_34, x2 - x3, y2 - y3) + perpDistance2(x12, y12, ll12, x3 - x1, y3 - y1), + perpDistance2(x12, y12, ll12, x4 - x1, y4 - y1), + perpDistance2(x34, y34, ll34, x1 - x3, y1 - y3), + perpDistance2(x34, y34, ll34, x2 - x3, y2 - y3) ); return Math.sqrt(dist2); @@ -130065,15 +130146,15 @@ * distance squared from segment ab to point c * [xab, yab] is the vector b-a * [xac, yac] is the vector c-a - * l2_ab is the length squared of (b-a), just to simplify calculation + * llab is the length squared of (b-a), just to simplify calculation */ -function perpDistance2(xab, yab, l2_ab, xac, yac) { - var fc_ab = (xac * xab + yac * yab); - if(fc_ab < 0) { +function perpDistance2(xab, yab, llab, xac, yac) { + var fcAB = (xac * xab + yac * yab); + if(fcAB < 0) { // point c is closer to point a return xac * xac + yac * yac; } - else if(fc_ab > l2_ab) { + else if(fcAB > llab) { // point c is closer to point b var xbc = xac - xab; var ybc = yac - yab; @@ -130082,7 +130163,7 @@ else { // perpendicular distance is the shortest var crossProduct = xac * yab - yac * xab; - return crossProduct * crossProduct / l2_ab; + return crossProduct * crossProduct / llab; } } @@ -130245,9 +130326,9 @@ return pt; }; -},{"./mod":699}],688:[function(_dereq_,module,exports){ +},{"./mod":701}],690:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130283,9 +130364,9 @@ return gd; // otherwise assume that gd is a DOM element }; -},{}],689:[function(_dereq_,module,exports){ +},{}],691:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130368,9 +130449,13 @@ return colorOut; } -function parseColorScale(colorscale, alpha) { +function parseColorScale(cont, alpha) { if(alpha === undefined) alpha = 1; + var colorscale = cont.reversescale ? + Colorscale.flipScale(cont.colorscale) : + cont.colorscale; + return colorscale.map(function(elem) { var index = elem[0]; var color = tinycolor(elem[1]); @@ -130387,9 +130472,9 @@ parseColorScale: parseColorScale }; -},{"../components/color/attributes":568,"../components/colorscale":581,"./array":675,"color-normalize":108,"fast-isnumeric":214,"tinycolor2":513}],690:[function(_dereq_,module,exports){ +},{"../components/color/attributes":570,"../components/colorscale":583,"./array":677,"color-normalize":109,"fast-isnumeric":215,"tinycolor2":515}],692:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130423,9 +130508,9 @@ unwrap: function(d) {return d[0];} }; -},{"./identity":691}],691:[function(_dereq_,module,exports){ +},{"./identity":693}],693:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130439,9 +130524,9 @@ module.exports = function identity(d) { return d; }; -},{}],692:[function(_dereq_,module,exports){ +},{}],694:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -130642,10 +130727,10 @@ if(!part1) part1 = 'x'; if(!part2) part2 = 'y'; for(var i = 0; i < attrList.length; i++) { - var attr = attrList[i], - xp = lib.nestedProperty(cont, attr.replace('?', part1)), - yp = lib.nestedProperty(cont, attr.replace('?', part2)), - temp = xp.get(); + var attr = attrList[i]; + var xp = lib.nestedProperty(cont, attr.replace('?', part1)); + var yp = lib.nestedProperty(cont, attr.replace('?', part2)); + var temp = xp.get(); xp.set(yp.get()); yp.set(temp); } @@ -130694,8 +130779,8 @@ * x1, x2: optional extra args */ lib.simpleMap = function(array, func, x1, x2) { - var len = array.length, - out = new Array(len); + var len = array.length; + var out = new Array(len); for(var i = 0; i < len; i++) out[i] = func(array[i], x1, x2); return out; }; @@ -130783,15 +130868,15 @@ FWHM = Math.round(FWHM) || 0; // only makes sense for integers if(FWHM < 2) return arrayIn; - var alen = arrayIn.length, - alen2 = 2 * alen, - wlen = 2 * FWHM - 1, - w = new Array(wlen), - arrayOut = new Array(alen), - i, - j, - k, - v; + 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; // first make the window array for(i = 0; i < wlen; i++) { @@ -130869,10 +130954,10 @@ */ if(!containerIn) return; - var hasAny = false, - hasAll = true, - i, - val; + var hasAny = false; + var hasAll = true; + var i; + var val; for(i = 0; i < attrList.length; i++) { val = containerIn[attrList[i]]; @@ -131076,11 +131161,10 @@ lib.minExtend = function(obj1, obj2) { var objOut = {}; if(typeof obj2 !== 'object') obj2 = {}; - var arrayLen = 3, - keys = Object.keys(obj1), - i, - k, - v; + var arrayLen = 3; + var keys = Object.keys(obj1); + var i, k, v; + for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; @@ -131146,8 +131230,8 @@ * to a stylesheet uniquely identified by a uid */ lib.addRelatedStyleRule = function(uid, selector, styleString) { - var id = 'plotly.js-style-' + uid, - style = document.getElementById(id); + var id = 'plotly.js-style-' + uid; + var style = document.getElementById(id); if(!style) { style = document.createElement('style'); style.setAttribute('id', id); @@ -131170,8 +131254,8 @@ * to remove from the page a stylesheet identified by a given uid */ lib.deleteRelatedStyleRule = function(uid) { - var id = 'plotly.js-style-' + uid, - style = document.getElementById(id); + var id = 'plotly.js-style-' + uid; + var style = document.getElementById(id); if(style) lib.removeElement(style); }; @@ -131262,9 +131346,9 @@ * @return {Object} the constructed object with a full nested path */ lib.objectFromPath = function(path, value) { - var keys = path.split('.'), - tmpObj, - obj = tmpObj = {}; + var keys = path.split('.'); + var tmpObj; + var obj = tmpObj = {}; for(var i = 0; i < keys.length; i++) { var key = keys[i]; @@ -131419,13 +131503,13 @@ value = String(value); } - var thousandsRe = /(\d+)(\d{3})/, - decimalSep = separators.charAt(0), - thouSep = separators.charAt(1); - - var x = value.split('.'), - x1 = x[0], - x2 = x.length > 1 ? decimalSep + x[1] : ''; + var thousandsRe = /(\d+)(\d{3})/; + var decimalSep = separators.charAt(0); + var thouSep = separators.charAt(1); + + var x = value.split('.'); + var x1 = x[0]; + var x2 = x.length > 1 ? decimalSep + x[1] : ''; // Years are ignored for thousands separators if(thouSep && (x.length > 1 || x1.length > 4 || separatethousands)) { @@ -131569,9 +131653,9 @@ return randSeed / 4294967296; }; -},{"../constants/numerical":669,"./anchor_utils":673,"./angles":674,"./array":675,"./clean_number":676,"./clear_responsive":678,"./coerce":679,"./dates":680,"./extend":682,"./filter_unique":683,"./filter_visible":684,"./geometry2d":687,"./get_graph_div":688,"./identity":691,"./is_plain_object":693,"./keyed_container":694,"./localize":695,"./loggers":696,"./make_trace_groups":697,"./matrix":698,"./mod":699,"./nested_property":700,"./noop":701,"./notifier":702,"./push_unique":706,"./regex":708,"./relative_attr":709,"./relink_private":710,"./search":711,"./stats":714,"./throttle":717,"./to_log_range":718,"d3":148,"fast-isnumeric":214}],693:[function(_dereq_,module,exports){ +},{"../constants/numerical":671,"./anchor_utils":675,"./angles":676,"./array":677,"./clean_number":678,"./clear_responsive":680,"./coerce":681,"./dates":682,"./extend":684,"./filter_unique":685,"./filter_visible":686,"./geometry2d":689,"./get_graph_div":690,"./identity":693,"./is_plain_object":695,"./keyed_container":696,"./localize":697,"./loggers":698,"./make_trace_groups":699,"./matrix":700,"./mod":701,"./nested_property":702,"./noop":703,"./notifier":704,"./push_unique":708,"./regex":710,"./relative_attr":711,"./relink_private":712,"./search":713,"./stats":716,"./throttle":719,"./to_log_range":720,"d3":149,"fast-isnumeric":215}],695:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131598,9 +131682,9 @@ ); }; -},{}],694:[function(_dereq_,module,exports){ +},{}],696:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131791,9 +131875,9 @@ return obj; }; -},{"./nested_property":700}],695:[function(_dereq_,module,exports){ +},{"./nested_property":702}],697:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131847,9 +131931,9 @@ return s; }; -},{"../registry":823}],696:[function(_dereq_,module,exports){ +},{"../registry":825}],698:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131860,7 +131944,7 @@ /* eslint-disable no-console */ -var config = _dereq_('../plot_api/plot_config'); +var dfltConfig = _dereq_('../plot_api/plot_config').dfltConfig; var loggers = module.exports = {}; @@ -131871,7 +131955,7 @@ */ loggers.log = function() { - if(config.logging > 1) { + if(dfltConfig.logging > 1) { var messages = ['LOG:']; for(var i = 0; i < arguments.length; i++) { @@ -131883,7 +131967,7 @@ }; loggers.warn = function() { - if(config.logging > 0) { + if(dfltConfig.logging > 0) { var messages = ['WARN:']; for(var i = 0; i < arguments.length; i++) { @@ -131895,7 +131979,7 @@ }; loggers.error = function() { - if(config.logging > 0) { + if(dfltConfig.logging > 0) { var messages = ['ERROR:']; for(var i = 0; i < arguments.length; i++) { @@ -131933,9 +132017,9 @@ } } -},{"../plot_api/plot_config":728}],697:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":730}],699:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131970,9 +132054,9 @@ return traces; }; -},{}],698:[function(_dereq_,module,exports){ +},{}],700:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -131995,10 +132079,9 @@ * transposing-a-2d-array-in-javascript */ exports.transposeRagged = function(z) { - var maxlen = 0, - zlen = z.length, - i, - j; + var maxlen = 0; + var zlen = z.length; + var i, j; // Maximum row length: for(i = 0; i < zlen; i++) maxlen = Math.max(maxlen, z[i].length); @@ -132015,9 +132098,9 @@ exports.dot = function(x, y) { if(!(x.length && y.length) || x.length !== y.length) return null; - var len = x.length, - out, - i; + var len = x.length; + var out; + var i; if(x[0].length) { // mat-vec or mat-mat @@ -132080,9 +132163,9 @@ }; }; -},{}],699:[function(_dereq_,module,exports){ +},{}],701:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132115,9 +132198,9 @@ modHalf: modHalf }; -},{}],700:[function(_dereq_,module,exports){ +},{}],702:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132151,11 +132234,11 @@ throw 'bad property string'; } - var j = 0, - propParts = propStr.split('.'), - indexed, - indices, - i; + var j = 0; + var propParts = propStr.split('.'); + var indexed; + var indices; + var i; // check for parts of the nesting hierarchy that are numbers (ie array elements) while(j < propParts.length) { @@ -132194,12 +132277,12 @@ function npGet(cont, parts) { return function() { - var curCont = cont, - curPart, - allSame, - out, - i, - j; + var curCont = cont; + var curPart; + var allSame; + var out; + var i; + var j; for(i = 0; i < parts.length - 1; i++) { curPart = parts[i]; @@ -132250,12 +132333,12 @@ function npSet(cont, parts, propStr) { return function(val) { - var curCont = cont, - propPart = '', - containerLevels = [[cont, propPart]], - toDelete = isDeletable(val, propStr), - curPart, - i; + 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]; @@ -132314,13 +132397,13 @@ // handle special -1 array index function setArrayAll(containerArray, innerParts, val, propStr) { - var arrayVal = isArrayOrTypedArray(val), - allSet = true, - thisVal = val, - thisPropStr = propStr.replace('-1', 0), - deleteThis = arrayVal ? false : isDeletable(val, thisPropStr), - firstPart = innerParts[0], - i; + 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); @@ -132362,9 +132445,9 @@ }; } -},{"./array":675,"fast-isnumeric":214}],701:[function(_dereq_,module,exports){ +},{"./array":677,"fast-isnumeric":215}],703:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132378,9 +132461,9 @@ module.exports = function noop() {}; -},{}],702:[function(_dereq_,module,exports){ +},{}],704:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132460,9 +132543,9 @@ }); }; -},{"d3":148,"fast-isnumeric":214}],703:[function(_dereq_,module,exports){ +},{"d3":149,"fast-isnumeric":215}],705:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132509,9 +132592,9 @@ } }; -},{"./setcursor":712}],704:[function(_dereq_,module,exports){ +},{"./setcursor":714}],706:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132543,12 +132626,12 @@ * returns boolean: is pt inside the polygon (including on its edges) */ polygon.tester = function tester(ptsIn) { - var pts = ptsIn.slice(), - xmin = pts[0][0], - xmax = xmin, - ymin = pts[0][1], - ymax = ymin, - i; + var pts = ptsIn.slice(); + var xmin = pts[0][0]; + var xmax = xmin; + var ymin = pts[0][1]; + var ymax = ymin; + var i; pts.push(pts[0]); for(i = 1; i < pts.length; i++) { @@ -132561,8 +132644,8 @@ // do we have a rectangle? Handle this here, so we can use the same // tester for the rectangular case without sacrificing speed - var isRect = false, - rectFirstEdgeTest; + var isRect = false; + var rectFirstEdgeTest; if(pts.length === 5) { if(pts[0][0] === pts[1][0]) { // vert, horz, vert, horz @@ -132584,8 +132667,8 @@ } function rectContains(pt, omitFirstEdge) { - var x = pt[0], - y = pt[1]; + var x = pt[0]; + var y = pt[1]; if(x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { // pt is outside the bounding box of polygon @@ -132597,23 +132680,23 @@ } function contains(pt, omitFirstEdge) { - var x = pt[0], - y = pt[1]; + var x = pt[0]; + var y = pt[1]; if(x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { // pt is outside the bounding box of polygon return false; } - var imax = pts.length, - x1 = pts[0][0], - y1 = pts[0][1], - crossings = 0, - i, - x0, - y0, - xmini, - ycross; + var imax = pts.length; + var x1 = pts[0][0]; + var y1 = pts[0][1]; + var crossings = 0; + var i; + var x0; + var y0; + var xmini; + var ycross; for(i = 1; i < imax; i++) { // find all crossings of a vertical line upward from pt with @@ -132695,14 +132778,14 @@ * @returns boolean: true means this segment is bent, false means straight */ var isBent = polygon.isSegmentBent = function isBent(pts, start, end, tolerance) { - var startPt = pts[start], - segment = [pts[end][0] - startPt[0], pts[end][1] - startPt[1]], - segmentSquared = dot(segment, segment), - segmentLen = Math.sqrt(segmentSquared), - unitPerp = [-segment[1] / segmentLen, segment[0] / segmentLen], - i, - part, - partParallel; + 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]]; @@ -132728,14 +132811,14 @@ * filtered is the resulting filtered Array of [x, y] pairs */ polygon.filter = function filter(pts, tolerance) { - var ptsFiltered = [pts[0]], - doneRawIndex = 0, - doneFilteredIndex = 0; + var ptsFiltered = [pts[0]]; + var doneRawIndex = 0; + var doneFilteredIndex = 0; function addPt(pt) { pts.push(pt); - var prevFilterLen = ptsFiltered.length, - iLast = doneRawIndex; + var prevFilterLen = ptsFiltered.length; + var iLast = doneRawIndex; ptsFiltered.splice(doneFilteredIndex + 1); for(var i = iLast + 1; i < pts.length; i++) { @@ -132762,10 +132845,10 @@ }; }; -},{"../constants/numerical":669,"./matrix":698}],705:[function(_dereq_,module,exports){ +},{"../constants/numerical":671,"./matrix":700}],707:[function(_dereq_,module,exports){ (function (global){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132834,9 +132917,9 @@ }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./show_no_webgl_msg":713,"regl":478}],706:[function(_dereq_,module,exports){ +},{"./show_no_webgl_msg":715,"regl":480}],708:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -132860,9 +132943,8 @@ */ module.exports = function pushUnique(array, item) { if(item instanceof RegExp) { - var itemStr = item.toString(), - i; - for(i = 0; i < array.length; i++) { + var itemStr = item.toString(); + for(var i = 0; i < array.length; i++) { if(array[i] instanceof RegExp && array[i].toString() === itemStr) { return array; } @@ -132874,21 +132956,19 @@ return array; }; -},{}],707:[function(_dereq_,module,exports){ +},{}],709:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var Lib = _dereq_('../lib'); -var config = _dereq_('../plot_api/plot_config'); - +var dfltConfig = _dereq_('../plot_api/plot_config').dfltConfig; /** * Copy arg array *without* removing `undefined` values from objects. @@ -132968,7 +133048,7 @@ queueObj.redo.args.push(redoArgs); } - if(gd.undoQueue.queue.length > config.queueLength) { + if(gd.undoQueue.queue.length > dfltConfig.queueLength) { gd.undoQueue.queue.shift(); gd.undoQueue.index--; } @@ -133085,9 +133165,9 @@ module.exports = queue; -},{"../lib":692,"../plot_api/plot_config":728}],708:[function(_dereq_,module,exports){ +},{"../lib":694,"../plot_api/plot_config":730}],710:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133115,9 +133195,9 @@ return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],709:[function(_dereq_,module,exports){ +},{}],711:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133168,9 +133248,9 @@ return baseAttr + relativeAttr; }; -},{}],710:[function(_dereq_,module,exports){ +},{}],712:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133231,9 +133311,9 @@ } }; -},{"./array":675,"./is_plain_object":693}],711:[function(_dereq_,module,exports){ +},{"./array":677,"./is_plain_object":695}],713:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133309,10 +133389,10 @@ var vals = valsIn.slice(); // otherwise we sort the original array... vals.sort(exports.sorterAsc); - var l = vals.length - 1, - minDiff = (vals[l] - vals[0]) || 1, - errDiff = minDiff / (l || 1) / 10000, - v2 = [vals[0]]; + var l = vals.length - 1; + var minDiff = (vals[l] - vals[0]) || 1; + var errDiff = minDiff / (l || 1) / 10000; + var v2 = [vals[0]]; for(var i = 0; i < l; i++) { // make sure values aren't just off by a rounding error @@ -133333,13 +133413,13 @@ * binary search is probably overkill here... */ exports.roundUp = function(val, arrayIn, reverse) { - var low = 0, - high = arrayIn.length - 1, - mid, - c = 0, - dlow = reverse ? 0 : 1, - dhigh = reverse ? 1 : 0, - rounded = reverse ? Math.ceil : Math.floor; + 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; // c is just to avoid infinite loops if there's an error while(low < high && c++ < 100) { mid = rounded((low + high) / 2); @@ -133419,9 +133499,9 @@ return ind; }; -},{"./identity":691,"./loggers":696,"fast-isnumeric":214}],712:[function(_dereq_,module,exports){ +},{"./identity":693,"./loggers":698,"fast-isnumeric":215}],714:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133442,9 +133522,9 @@ if(csr) el3.classed('cursor-' + csr, true); }; -},{}],713:[function(_dereq_,module,exports){ +},{}],715:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133506,9 +133586,9 @@ return false; }; -},{"../components/color":569}],714:[function(_dereq_,module,exports){ +},{"../components/color":571}],716:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133607,9 +133687,9 @@ return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":675,"fast-isnumeric":214}],715:[function(_dereq_,module,exports){ +},{"./array":677,"fast-isnumeric":215}],717:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133628,9 +133708,9 @@ module.exports = str2RgbaArray; -},{"color-normalize":108}],716:[function(_dereq_,module,exports){ +},{"color-normalize":109}],718:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -133747,13 +133827,13 @@ var fill = _context.node().style.fill || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); - var newSvgW = getSize(newSvg, 'width'), - newSvgH = getSize(newSvg, 'height'), - newX = +_context.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], - // font baseline is about 1/4 fontSize below centerline - textHeight = fontSize || getSize(_context, 'height'), - dy = -textHeight / 4; + var newSvgW = getSize(newSvg, 'width'); + var newSvgH = getSize(newSvg, 'height'); + var newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start']; + // font baseline is about 1/4 fontSize below centerline + var textHeight = fontSize || getSize(_context, 'height'); + var dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ @@ -133765,7 +133845,7 @@ else if(svgClass[0] === 'l') { newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } - else if(svgClass[0] === 'a') { + else if(svgClass[0] === 'a' && svgClass.indexOf('atitle') !== 0) { newSvg.attr({x: 0, y: dy}); } else { @@ -133895,8 +133975,6 @@ */ var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; -var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; @@ -133946,10 +134024,66 @@ var COLORMATCH = /(^|;)\s*color:/; -exports.plainText = function(_str) { - // strip out our pseudo-html so we have a readable - // version to put into text fields - return (_str || '').replace(STRIP_TAGS, ' '); +/** + * Strip string of tags + * + * @param {string} _str : input string + * @param {object} opts : + * - maxLen {number} max length of output string + * - allowedTags {array} list of pseudo-html tags to NOT strip + * @return {string} + */ +exports.plainText = function(_str, opts) { + opts = opts || {}; + + var len = (opts.len !== undefined && opts.len !== -1) ? opts.len : Infinity; + var allowedTags = opts.allowedTags !== undefined ? 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) { + // N.B. tags do not count towards string length + 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(''); }; /* @@ -134243,13 +134377,13 @@ }; function alignHTMLWith(_base, container, options) { - var alignH = options.horizontalAlign, - alignV = options.verticalAlign || 'top', - bRect = _base.node().getBoundingClientRect(), - cRect = container.node().getBoundingClientRect(), - thisRect, - getTop, - getLeft; + 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; }; @@ -134307,8 +134441,8 @@ appendEditable(); context.style({opacity: 0}); // also hide any mathjax svg - var svgClass = handlerElement.attr('class'), - mathjaxClass; + var svgClass = handlerElement.attr('class'); + var mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { @@ -134356,8 +134490,8 @@ gd._editing = false; context.text(this.textContent) .style({opacity: 1}); - var svgClass = d3.select(this).attr('class'), - mathjaxClass; + var svgClass = d3.select(this).attr('class'); + var mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { @@ -134403,9 +134537,9 @@ return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":664,"../constants/xmlns_namespaces":670,"../lib":692,"d3":148}],717:[function(_dereq_,module,exports){ +},{"../constants/alignment":666,"../constants/xmlns_namespaces":672,"../lib":694,"d3":149}],719:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134507,9 +134641,9 @@ } } -},{}],718:[function(_dereq_,module,exports){ +},{}],720:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134535,16 +134669,15 @@ return newVal; }; -},{"fast-isnumeric":214}],719:[function(_dereq_,module,exports){ +},{"fast-isnumeric":215}],721:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var topojsonUtils = module.exports = {}; @@ -134552,7 +134685,6 @@ var locationmodeToLayer = _dereq_('../plots/geo/constants').locationmodeToLayer; var topojsonFeature = _dereq_('topojson-client').feature; - topojsonUtils.getTopojsonName = function(geoLayout) { return [ geoLayout.scope.replace(/ /g, '-'), '_', @@ -134565,15 +134697,15 @@ }; topojsonUtils.getTopojsonFeatures = function(trace, topojson) { - var layer = locationmodeToLayer[trace.locationmode], - obj = topojson.objects[layer]; + var layer = locationmodeToLayer[trace.locationmode]; + var obj = topojson.objects[layer]; return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":769,"topojson-client":516}],720:[function(_dereq_,module,exports){ +},{"../plots/geo/constants":771,"topojson-client":518}],722:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134593,9 +134725,9 @@ } }; -},{}],721:[function(_dereq_,module,exports){ +},{}],723:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134636,9 +134768,9 @@ } }; -},{}],722:[function(_dereq_,module,exports){ +},{}],724:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134664,11 +134796,11 @@ * or the whole object) */ module.exports = function containerArrayMatch(astr) { - var rootContainers = Registry.layoutArrayContainers, - regexpContainers = Registry.layoutArrayRegexes, - rootPart = astr.split('[')[0], - arrayStr, - match; + var rootContainers = Registry.layoutArrayContainers; + var regexpContainers = Registry.layoutArrayRegexes; + var rootPart = astr.split('[')[0]; + var arrayStr; + var match; // look for regexp matches first, because they may be nested inside root matches // eg updatemenus[i].buttons is nested inside updatemenus @@ -134694,9 +134826,9 @@ return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":823}],723:[function(_dereq_,module,exports){ +},{"../registry":825}],725:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134820,9 +134952,9 @@ } } -},{"../lib":692}],724:[function(_dereq_,module,exports){ +},{"../lib":694}],726:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -134944,11 +135076,11 @@ var cameraposition = scene.cameraposition; if(Array.isArray(cameraposition) && cameraposition[0].length === 4) { - var rotation = cameraposition[0], - center = cameraposition[1], - radius = cameraposition[2], - mat = m4FromQuat([], rotation), - eye = []; + 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]; @@ -135045,8 +135177,8 @@ }; function cleanAxRef(container, attr) { - var valIn = container[attr], - axLetter = attr.charAt(0); + var valIn = container[attr]; + var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { container[attr] = cleanId(valIn, axLetter); } @@ -135112,9 +135244,10 @@ // error_y.opacity is obsolete - merge into color if(trace.error_y && 'opacity' in trace.error_y) { - var dc = Color.defaults, - yeColor = trace.error_y.color || - (Registry.traceIs(trace, 'bar') ? Color.defaultLine : dc[tracei % dc.length]); + var dc = Color.defaults; + var yeColor = trace.error_y.color || (Registry.traceIs(trace, 'bar') ? + Color.defaultLine : + dc[tracei % dc.length]); trace.error_y.color = Color.addOpacity( Color.rgb(yeColor), Color.opacity(yeColor) * trace.error_y.opacity); @@ -135140,11 +135273,11 @@ } // scl->scale, reversescl->reversescale - if('scl' in trace) { + if('scl' in trace && !('colorscale' in trace)) { trace.colorscale = trace.scl; delete trace.scl; } - if('reversescl' in trace) { + if('reversescl' in trace && !('reversescale' in trace)) { trace.reversescale = trace.reversescl; delete trace.reversescl; } @@ -135340,8 +135473,8 @@ // textposition - support partial attributes (ie just 'top') // and incorrect use of middle / center etc. function cleanTextPosition(textposition) { - var posY = 'middle', - posX = 'center'; + var posY = 'middle'; + var posX = 'center'; if(typeof textposition === 'string') { if(textposition.indexOf('top') !== -1) posY = 'top'; @@ -135370,9 +135503,10 @@ else trace.transpose = true; } if(trace.error_x && trace.error_y) { - var errorY = trace.error_y, - copyYstyle = ('copy_ystyle' in errorY) ? errorY.copy_ystyle : - !(errorY.color || errorY.thickness || errorY.width); + 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']); @@ -135424,10 +135558,10 @@ * */ exports.manageArrayContainers = function(np, newVal, undoit) { - var obj = np.obj, - parts = np.parts, - pLength = parts.length, - pLast = parts[pLength - 1]; + var obj = np.obj; + var parts = np.parts; + var pLength = parts.length; + var pLast = parts[pLength - 1]; var pLastIsNumber = isNumeric(pLast); @@ -135435,8 +135569,8 @@ if(pLastIsNumber && newVal === null) { // Clear item in array container when new value is null - var contPath = parts.slice(0, pLength - 1).join('.'), - cont = Lib.nestedProperty(obj, contPath).get(); + var contPath = parts.slice(0, pLength - 1).join('.'); + var cont = Lib.nestedProperty(obj, contPath).get(); cont.splice(pLast, 1); // Note that nested property clears null / undefined at end of @@ -135525,9 +135659,9 @@ } }; -},{"../components/color":569,"../lib":692,"../plots/cartesian/axis_ids":743,"../plots/plots":804,"../registry":823,"fast-isnumeric":214,"gl-mat4/fromQuat":251}],725:[function(_dereq_,module,exports){ +},{"../components/color":571,"../lib":694,"../plots/cartesian/axis_ids":745,"../plots/plots":806,"../registry":825,"fast-isnumeric":215,"gl-mat4/fromQuat":253}],727:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -135568,9 +135702,9 @@ exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":825,"./plot_api":727,"./template_api":732,"./to_image":733,"./validate":734}],726:[function(_dereq_,module,exports){ +},{"../snapshot/download":827,"./plot_api":729,"./template_api":734,"./to_image":735,"./validate":736}],728:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -135645,14 +135779,13 @@ * `false` would mean the parent should replot. */ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, edits, flags, _nestedProperty) { - var componentType = np.astr, - supplyComponentDefaults = Registry.getComponentMethod(componentType, 'supplyLayoutDefaults'), - draw = Registry.getComponentMethod(componentType, 'draw'), - drawOne = Registry.getComponentMethod(componentType, 'drawOne'), - replotLater = flags.replot || flags.recalc || (supplyComponentDefaults === noop) || - (draw === noop), - layout = gd.layout, - fullLayout = gd._fullLayout; + var componentType = np.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 = gd.layout; + var fullLayout = gd._fullLayout; if(edits['']) { if(Object.keys(edits).length > 1) { @@ -135676,26 +135809,26 @@ return true; } - var componentNums = Object.keys(edits).map(Number).sort(sorterAsc), - componentArrayIn = np.get(), - componentArray = componentArrayIn || [], - // componentArrayFull is used just to keep splices in line between - // full and input arrays, so private keys can be copied over after - // redoing supplyDefaults - // TODO: this assumes componentArray is in gd.layout - which will not be - // true after we extend this to restyle - componentArrayFull = _nestedProperty(fullLayout, componentType).get(); - - var deletes = [], - firstIndexChange = -1, - maxIndex = componentArray.length, - i, - j, - componentNum, - objEdits, - objKeys, - objVal, - adding, prefix; + var componentNums = Object.keys(edits).map(Number).sort(sorterAsc); + var componentArrayIn = np.get(); + var componentArray = componentArrayIn || []; + // componentArrayFull is used just to keep splices in line between + // full and input arrays, so private keys can be copied over after + // redoing supplyDefaults + // TODO: this assumes componentArray is in gd.layout - which will not be + // true after we extend this to restyle + 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; // first make the add and edit changes for(i = 0; i < componentNums.length; i++) { @@ -135787,9 +135920,9 @@ return true; }; -},{"../lib/is_plain_object":693,"../lib/loggers":696,"../lib/noop":701,"../lib/search":711,"../registry":823,"./container_array_match":722}],727:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":695,"../lib/loggers":698,"../lib/noop":703,"../lib/search":713,"../registry":825,"./container_array_match":724}],729:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -135823,7 +135956,7 @@ var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var svgTextUtils = _dereq_('../lib/svg_text_utils'); -var defaultConfig = _dereq_('./plot_config'); +var dfltConfig = _dereq_('./plot_config').dfltConfig; var manageArrays = _dereq_('./manage_arrays'); var helpers = _dereq_('./helpers'); var subroutines = _dereq_('./subroutines'); @@ -136195,7 +136328,7 @@ } exports.setPlotConfig = function setPlotConfig(obj) { - return Lib.extendFlat(defaultConfig, obj); + return Lib.extendFlat(dfltConfig, obj); }; function setBackground(gd, bgColor) { @@ -136213,7 +136346,7 @@ function setPlotContext(gd, config) { if(!gd._context) { - gd._context = Lib.extendDeep({}, defaultConfig); + gd._context = Lib.extendDeep({}, dfltConfig); // stash href, used to make robust clipPath URLs var base = d3.select('base'); @@ -136297,6 +136430,25 @@ // Check if gd has a specified widht/height to begin with context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0; context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0; + + // fill context._scrollZoom helper to help manage scrollZoom flaglist + var szIn = context.scrollZoom; + var szOut = context._scrollZoom = {}; + if(szIn === true) { + szOut.cartesian = 1; + szOut.gl3d = 1; + szOut.geo = 1; + szOut.mapbox = 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; + } } function plotLegacyPolar(gd, data, layout) { @@ -136436,10 +136588,10 @@ * @param {Number} maxIndex The maximum index allowable (arr.length - 1) */ function positivifyIndices(indices, maxIndex) { - var parentLength = maxIndex + 1, - positiveIndices = [], - i, - index; + var parentLength = maxIndex + 1; + var positiveIndices = []; + var i; + var index; for(i = 0; i < indices.length; i++) { index = indices[i]; @@ -136627,8 +136779,8 @@ */ function getExtendProperties(gd, update, indices, maxPoints) { - var maxPointsIsObject = Lib.isPlainObject(maxPoints), - updateProps = []; + var maxPointsIsObject = Lib.isPlainObject(maxPoints); + var updateProps = []; var trace, target, prop, insert, maxp; // allow scalar index to represent a single trace position @@ -136881,13 +137033,13 @@ exports.addTraces = function addTraces(gd, traces, newIndices) { gd = Lib.getGraphDiv(gd); - var currentIndices = [], - undoFunc = exports.deleteTraces, - redoFunc = addTraces, - undoArgs = [gd, currentIndices], - redoArgs = [gd, traces], // no newIndices here - i, - promise; + var currentIndices = []; + var undoFunc = exports.deleteTraces; + var redoFunc = addTraces; + var undoArgs = [gd, currentIndices]; + var redoArgs = [gd, traces]; // no newIndices here + var i; + var promise; // all validation is done elsewhere to remove clutter here checkAddTracesArgs(gd, traces, newIndices); @@ -136958,13 +137110,13 @@ exports.deleteTraces = function deleteTraces(gd, indices) { gd = Lib.getGraphDiv(gd); - var traces = [], - undoFunc = exports.addTraces, - redoFunc = deleteTraces, - undoArgs = [gd, traces, indices], - redoArgs = [gd, indices], - i, - deletedTrace; + var traces = []; + var undoFunc = exports.addTraces; + var redoFunc = deleteTraces; + var undoArgs = [gd, traces, indices]; + var redoArgs = [gd, indices]; + var i; + var deletedTrace; // make sure indices are defined if(typeof indices === 'undefined') { @@ -137024,13 +137176,13 @@ exports.moveTraces = function moveTraces(gd, currentIndices, newIndices) { gd = Lib.getGraphDiv(gd); - var newData = [], - movingTraceMap = [], - undoFunc = moveTraces, - redoFunc = moveTraces, - undoArgs = [gd, newIndices, currentIndices], - redoArgs = [gd, currentIndices, newIndices], - i; + var newData = []; + var movingTraceMap = []; + var undoFunc = moveTraces; + var redoFunc = moveTraces; + var undoArgs = [gd, newIndices, currentIndices]; + var redoArgs = [gd, currentIndices, newIndices]; + var i; // to reduce complexity here, check args elsewhere // this throws errors where appropriate @@ -137275,9 +137427,9 @@ // copies of the change (and previous values of anything affected) // for the undo / redo queue - var redoit = {}, - undoit = {}, - axlist; + var redoit = {}; + var undoit = {}; + var axlist; // make a new empty vals array for undoit function a0() { return traces.map(function() { return undefined; }); } @@ -137354,13 +137506,13 @@ throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously'); } - var vi = aobj[ai], - cont, - contFull, - param, - oldVal, - newVal, - valObject; + var vi = aobj[ai]; + var cont; + var contFull; + var param; + var oldVal; + var newVal; + var valObject; // Backward compatibility shim for turning histogram autobin on, // or freezing previous autobinned values. @@ -137439,8 +137591,8 @@ } else if(ai === 'type' && (newVal === 'pie') !== (oldVal === 'pie')) { - var labelsTo = 'x', - valuesTo = 'y'; + var labelsTo = 'x'; + var valuesTo = 'y'; if((newVal === 'bar' || oldVal === 'bar') && cont.orientation === 'h') { labelsTo = 'y'; valuesTo = 'x'; @@ -137773,9 +137925,9 @@ 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), - axisAttr = (scene.indexOf('scene') !== -1) ? (scene + '.') : '', - newkey = keys[i].replace('allaxes', axisAttr + axes[j]._name); + 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]]; } @@ -137789,8 +137941,8 @@ // copies of the change (and previous values of anything affected) // for the undo / redo queue - var redoit = {}, - undoit = {}; + var redoit = {}; + var undoit = {}; // for attrs that interact (like scales & autoscales), save the // old vals before making the change @@ -137911,9 +138063,9 @@ // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn, - toLog = parentFull.type === 'linear' && vi === 'log', - fromLog = parentFull.type === 'log' && vi === 'linear'; + var ax = parentIn; + var toLog = parentFull.type === 'linear' && vi === 'log'; + var fromLog = parentFull.type === 'log' && vi === 'linear'; if(toLog || fromLog) { if(!ax || !ax.range) { @@ -137925,8 +138077,8 @@ else if(!parentFull.autorange) { // toggling log without autorange: need to also recalculate ranges // because log axes use linearized values for range endpoints - var r0 = ax.range[0], - r1 = ax.range[1]; + var r0 = ax.range[0]; + var r1 = ax.range[1]; if(toLog) { // if both limits are negative, autorange if(r0 <= 0 && r1 <= 0) { @@ -137974,8 +138126,8 @@ nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(AX_NAME_PATTERN)) { - var fullProp = nestedProperty(fullLayout, ai).get(), - newType = (vi || {}).type; + var fullProp = nestedProperty(fullLayout, ai).get(); + var newType = (vi || {}).type; // This can potentially cause strange behavior if the autotype is not // numeric (linear, because we don't auto-log) but the previous type @@ -138157,8 +138309,8 @@ var seq = []; if(restyleFlags.fullReplot && relayoutFlags.layoutReplot) { - var data = gd.data, - layout = gd.layout; + var data = gd.data; + var layout = gd.layout; // clear existing data/layout on gd // so that Plotly.plot doesn't try to extend them @@ -138509,9 +138661,11 @@ var newFullData = gd._fullData; var newFullLayout = gd._fullLayout; var immutable = newFullLayout.datarevision === undefined; + var transition = newFullLayout.transition; - var restyleFlags = diffData(gd, oldFullData, newFullData, immutable); - var relayoutFlags = diffLayout(gd, oldFullLayout, newFullLayout, immutable); + var relayoutFlags = diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition); + var newDataRevision = relayoutFlags.newDataRevision; + var restyleFlags = diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision); // TODO: how to translate this part of relayout to Plotly.react? // // Setting width or height to null must reset the graph's width / height @@ -138541,7 +138695,19 @@ seq.push(addFrames); } - if(restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) { + // Transition pathway, + // only used when 'transition' is set by user and + // when at least one animatable attribute has changed, + // N.B. config changed aren't animatable + if(newFullLayout.transition && !configChanged && (restyleFlags.anim || relayoutFlags.anim)) { + Plots.doCalcdata(gd); + subroutines.doAutoRangeAndConstraints(gd); + + seq.push(function() { + return Plots.transitionFromReact(gd, restyleFlags, relayoutFlags, oldFullLayout); + }); + } + else if(restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) { gd._fullLayout._skipDefaults = true; seq.push(exports.plot); } @@ -138594,8 +138760,10 @@ }; -function diffData(gd, oldFullData, newFullData, immutable) { - if(oldFullData.length !== newFullData.length) { +function diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision) { + var sameTraceLength = oldFullData.length === newFullData.length; + + if(!transition && !sameTraceLength) { return { fullReplot: true, calc: true @@ -138604,6 +138772,9 @@ var flags = editTypes.traceFlags(); flags.arrays = {}; + flags.nChanges = 0; + flags.nChangesAnim = 0; + var i, trace; function getTraceValObject(parts) { @@ -138614,31 +138785,41 @@ getValObject: getTraceValObject, flags: flags, immutable: immutable, + transition: transition, + newDataRevision: newDataRevision, gd: gd }; - var seenUIDs = {}; for(i = 0; i < oldFullData.length; i++) { - trace = newFullData[i]._fullInput; - if(Plots.hasMakesDataTransform(trace)) trace = newFullData[i]; - if(seenUIDs[trace.uid]) continue; - seenUIDs[trace.uid] = 1; + 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); + 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(gd, oldFullLayout, newFullLayout, immutable) { +function diffLayout(gd, 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); @@ -138648,6 +138829,7 @@ getValObject: getLayoutValObject, flags: flags, immutable: immutable, + transition: transition, gd: gd }; @@ -138657,11 +138839,15 @@ 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; + var valObject, key, astr; var getValObject = opts.getValObject; var flags = opts.flags; @@ -138676,6 +138862,30 @@ return; } editTypes.update(flags, valObject); + + if(editType !== 'none') { + flags.nChanges++; + } + + // track animatable changes + if(opts.transition && valObject.anim) { + flags.nChangesAnim++; + } + + // track cartesian axes with altered ranges + if(AX_RANGE_RE.test(astr) || AX_AUTORANGE_RE.test(astr)) { + flags.rangesAltered[outerparts[0]] = 1; + } + + // clear _inputDomain on cartesian axes with altered domains + if(AX_DOMAIN_RE.test(astr)) { + nestedProperty(newContainer, '_inputDomain').set(null); + } + + // track datarevision changes + if(key === 'datarevision') { + flags.newDataRevision = 1; + } } function valObjectCanBeDataArray(valObject) { @@ -138684,10 +138894,12 @@ for(key in oldContainer) { // short-circuit based on previous calls or previous keys that already maximized the pathway - if(flags.calc) return; + 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; @@ -138703,7 +138915,6 @@ if(key === 'range' && newContainer.autorange) continue; if((key === 'zmin' || key === 'zmax') && newContainer.type === 'contourcarpet') continue; - var parts = outerparts.concat(key); valObject = getValObject(parts); // in case type changed, we may not even *have* a valObject. @@ -138774,6 +138985,11 @@ if(immutable) { flags.calc = true; } + + // look for animatable attributes when the data changed + if(immutable || opts.newDataRevision) { + changed(); + } } else if(wasArray !== nowArray) { flags.calc = true; @@ -139348,10 +139564,10 @@ } } - var undoFunc = Plots.modifyFrames, - redoFunc = Plots.modifyFrames, - undoArgs = [gd, revops], - redoArgs = [gd, ops]; + var undoFunc = Plots.modifyFrames; + var redoFunc = Plots.modifyFrames; + var undoArgs = [gd, revops]; + var redoArgs = [gd, ops]; if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); @@ -139395,10 +139611,10 @@ revops.unshift({type: 'insert', index: idx, value: _frames[idx]}); } - var undoFunc = Plots.modifyFrames, - redoFunc = Plots.modifyFrames, - undoArgs = [gd, revops], - redoArgs = [gd, ops]; + var undoFunc = Plots.modifyFrames; + var redoFunc = Plots.modifyFrames; + var undoArgs = [gd, revops]; + var redoArgs = [gd, ops]; if(Queue) Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs); @@ -139555,9 +139771,9 @@ gd.emit('plotly_framework'); } -},{"../components/color":569,"../components/colorbar/connect":571,"../components/drawing":590,"../constants/xmlns_namespaces":670,"../lib":692,"../lib/events":681,"../lib/queue":707,"../lib/svg_text_utils":716,"../plots/cartesian/axes":740,"../plots/cartesian/constants":746,"../plots/cartesian/graph_interact":750,"../plots/plots":804,"../plots/polar/legacy":812,"../registry":823,"./edit_types":723,"./helpers":724,"./manage_arrays":726,"./plot_config":728,"./plot_schema":729,"./subroutines":731,"d3":148,"fast-isnumeric":214,"has-hover":393}],728:[function(_dereq_,module,exports){ +},{"../components/color":571,"../components/colorbar/connect":573,"../components/drawing":592,"../constants/xmlns_namespaces":672,"../lib":694,"../lib/events":683,"../lib/queue":709,"../lib/svg_text_utils":718,"../plots/cartesian/axes":742,"../plots/cartesian/constants":748,"../plots/cartesian/graph_interact":752,"../plots/plots":806,"../plots/polar/legacy":814,"../registry":825,"./edit_types":725,"./helpers":726,"./manage_arrays":728,"./plot_config":730,"./plot_schema":731,"./subroutines":733,"d3":149,"fast-isnumeric":215,"has-hover":396}],730:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -139572,219 +139788,286 @@ * * The defaults are the appropriate settings for plotly.js, * so we get the right experience without any config argument. + * + * N.B. the config options are not coerced using Lib.coerce so keys + * like `valType` and `values` are only set for documentation purposes + * at the moment. */ -module.exports = { - - // no interactivity, for export or image generation - staticPlot: false, +var configAttributes = { + staticPlot: { + valType: 'boolean', + dflt: false, + + }, - // base URL for the 'Edit in Chart Studio' (aka sendDataToCloud) mode bar button - // and the showLink/sendData on-graph link - plotlyServerURL: 'https://plot.ly', + plotlyServerURL: { + valType: 'string', + dflt: 'https://plot.ly', + + }, - /* - * we can edit titles, move annotations, etc - sets all pieces of `edits` - * unless a separate `edits` config item overrides individual parts - */ - editable: false, + editable: { + valType: 'boolean', + dflt: false, + + }, edits: { - /* - * annotationPosition: the main anchor of the annotation, which is the - * text (if no arrow) or the arrow (which drags the whole thing leaving - * the arrow length & direction unchanged) - */ - annotationPosition: false, - // just for annotations with arrows, change the length and direction of the arrow - annotationTail: false, - annotationText: false, - axisTitleText: false, - colorbarPosition: false, - colorbarTitleText: false, - legendPosition: false, - // edit the trace name fields from the legend - legendText: false, - shapePosition: false, - // the global `layout.title` - titleText: false + annotationPosition: { + valType: 'boolean', + dflt: false, + + }, + annotationTail: { + valType: 'boolean', + dflt: false, + + }, + annotationText: { + valType: 'boolean', + dflt: false, + + }, + axisTitleText: { + valType: 'boolean', + dflt: false, + + }, + colorbarPosition: { + valType: 'boolean', + dflt: false, + + }, + colorbarTitleText: { + valType: 'boolean', + dflt: false, + + }, + legendPosition: { + valType: 'boolean', + dflt: false, + + }, + legendText: { + valType: 'boolean', + dflt: false, + + }, + shapePosition: { + valType: 'boolean', + dflt: false, + + }, + titleText: { + valType: 'boolean', + dflt: false, + + } }, - /* - * DO autosize once regardless of layout.autosize - * (use default width or height values otherwise) - */ - autosizable: false, - - /* - * responsive: determines whether to change the layout size when window is resized. - * In v2, this option will be removed and will always be true. - */ - responsive: false, - - // set the length of the undo/redo queue - queueLength: 0, - - // if we DO autosize, do we fill the container or the screen? - fillFrame: false, - - // if we DO autosize, set the frame margins in percents of plot size - frameMargins: 0, - - // mousewheel or two-finger scroll zooms the plot - scrollZoom: false, - - // double click interaction (false, 'reset', 'autosize' or 'reset+autosize') - doubleClick: 'reset+autosize', - - // new users see some hints about interactivity - showTips: true, - - // enable axis pan/zoom drag handles - showAxisDragHandles: true, - - /* - * enable direct range entry at the pan/zoom drag points - * (drag handles must be enabled above) - */ - showAxisRangeEntryBoxes: true, - - /* - * Add a text link to open this plot in plotly? - * This link shows up in the bottom right corner of the plot, and works - * identically to the newer ModeBar button controlled by `showSendToCloud` - * unless `sendData: false` is used. - */ - showLink: false, + autosizable: { + valType: 'boolean', + dflt: false, + + }, + responsive: { + valType: 'boolean', + dflt: false, + + }, + fillFrame: { + valType: 'boolean', + dflt: false, + + }, + frameMargins: { + valType: 'number', + dflt: 0, + min: 0, + max: 0.5, + + }, - /* - * If we show a text link (`showLink: true`), does it contain data or just - * a reference to a plotly cloud file? This option should only be used on - * plot.ly or another plotly server, and is not supported by the newer - * ModeBar button `showSendToCloud`. - */ - sendData: true, + scrollZoom: { + valType: 'flaglist', + flags: ['cartesian', 'gl3d', 'geo', 'mapbox'], + extras: [true, false], + dflt: 'gl3d+geo+mapbox', + + }, + doubleClick: { + valType: 'enumerated', + values: [false, 'reset', 'autosize', 'reset+autosize'], + dflt: 'reset+autosize', + + }, - /* - * Should we include a ModeBar button, labeled "Edit in Chart Studio", - * that sends this chart to 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`) send your data - * to an external server. However that server doesn't persist your data - * until you arrive at the Chart Studio and explicitly click "Save". - */ - showSendToCloud: false, + showAxisDragHandles: { + valType: 'boolean', + dflt: true, + + }, + showAxisRangeEntryBoxes: { + valType: 'boolean', + dflt: true, + + }, - // text appearing in the sendData link - linkText: 'Edit chart', + showTips: { + valType: 'boolean', + dflt: true, + + }, - // false or function adding source(s) to linkText - showSources: false, + showLink: { + valType: 'boolean', + dflt: false, + + }, + linkText: { + valType: 'string', + dflt: 'Edit chart', + noBlank: true, + + }, + sendData: { + valType: 'boolean', + dflt: true, + + }, + showSources: { + valType: 'any', + dflt: false, + + }, - // display the mode bar (true, false, or 'hover') - displayModeBar: 'hover', + displayModeBar: { + valType: 'enumerated', + values: ['hover', true, false], + dflt: 'hover', + + }, + showSendToCloud: { + valType: 'boolean', + dflt: false, + + }, + modeBarButtonsToRemove: { + valType: 'any', + dflt: [], + + }, + modeBarButtonsToAdd: { + valType: 'any', + dflt: [], + + }, + modeBarButtons: { + valType: 'any', + dflt: false, + + }, + toImageButtonOptions: { + valType: 'any', + dflt: {}, + + }, + displaylogo: { + valType: 'boolean', + dflt: true, + + }, + watermark: { + valType: 'boolean', + dflt: false, + + }, - /* - * remove mode bar button by name - * (see ../components/modebar/buttons.js for the list of names) - */ - modeBarButtonsToRemove: [], + plotGlPixelRatio: { + valType: 'number', + dflt: 2, + min: 1, + max: 4, + + }, - /* - * add mode bar button using config objects - * (see ./components/modebar/buttons.js for list of arguments) - */ - modeBarButtonsToAdd: [], + setBackground: { + valType: 'any', + dflt: 'transparent', + + }, - /* - * 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) - */ - modeBarButtons: false, - - // statically override options for toImage modebar button - // allowed keys are format, filename, width, height, scale - // see ../components/modebar/buttons.js - toImageButtonOptions: {}, + topojsonURL: { + valType: 'string', + noBlank: true, + dflt: 'https://cdn.plot.ly/', + + }, - // add the plotly logo on the end of the mode bar - displaylogo: true, + mapboxAccessToken: { + valType: 'string', + dflt: null, + + }, - // watermark the images with the company's logo - watermark: false, + logging: { + valType: 'boolean', + dflt: 1, + + }, - // increase the pixel ratio for Gl plot images - plotGlPixelRatio: 2, + queueLength: { + valType: 'integer', + min: 0, + dflt: 0, + + }, - /* - * background setting function - * 'transparent' sets the background `layout.paper_color` - * 'opaque' blends bg color with white ensuring an opaque background - * or any other custom function of gd - */ - setBackground: 'transparent', + globalTransforms: { + valType: 'any', + dflt: [], + + }, - // URL to topojson files used in geo charts - topojsonURL: 'https://cdn.plot.ly/', + locale: { + valType: 'string', + dflt: 'en-US', + + }, - /* - * 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. - */ - mapboxAccessToken: null, + locales: { + valType: 'any', + dflt: {}, + + } +}; - /* - * Turn all console logging on or off (errors will be thrown) - * This should ONLY be set via Plotly.setPlotConfig - * 0: no logs - * 1: warnings and errors, but not informational messages - * 2: verbose logs - */ - logging: 1, +var dfltConfig = {}; - /* - * Set global transform to be applied to all traces with no - * specification needed - */ - globalTransforms: [], +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]); + } + } +} - /* - * Which localization should we use? - * Should be a string like 'en' or 'en-US'. - */ - locale: 'en-US', +crawl(configAttributes, dfltConfig); - /* - * 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. - */ - locales: {} +module.exports = { + configAttributes: configAttributes, + dfltConfig: dfltConfig }; -},{}],729:[function(_dereq_,module,exports){ +},{}],731:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -139801,6 +140084,7 @@ var baseLayoutAttributes = _dereq_('../plots/layout_attributes'); var frameAttributes = _dereq_('../plots/frame_attributes'); var animationAttributes = _dereq_('../plots/animation_attributes'); +var configAttributes = _dereq_('./plot_config').configAttributes; // polar attributes are not part of the Registry yet var polarAreaAttrs = _dereq_('../plots/polar/legacy/area_attributes'); @@ -139832,7 +140116,7 @@ * - transforms * - frames * - animations - * - config (coming soon ...) + * - config */ exports.get = function() { var traces = {}; @@ -139866,7 +140150,9 @@ transforms: transforms, frames: getFramesAttributes(), - animation: formatAttributes(animationAttributes) + animation: formatAttributes(animationAttributes), + + config: formatAttributes(configAttributes) }; }; @@ -140455,8 +140741,8 @@ } function handleBasePlotModule(layoutAttributes, _module, astr) { - var np = Lib.nestedProperty(layoutAttributes, astr), - attrs = extendDeepAll({}, _module.layoutAttributes); + var np = Lib.nestedProperty(layoutAttributes, astr); + var attrs = extendDeepAll({}, _module.layoutAttributes); attrs[IS_SUBPLOT_OBJ] = true; np.set(attrs); @@ -140468,9 +140754,9 @@ np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":692,"../plots/animation_attributes":735,"../plots/attributes":737,"../plots/frame_attributes":768,"../plots/layout_attributes":795,"../plots/polar/legacy/area_attributes":810,"../plots/polar/legacy/axis_attributes":811,"../registry":823,"./edit_types":723}],730:[function(_dereq_,module,exports){ +},{"../lib":694,"../plots/animation_attributes":737,"../plots/attributes":739,"../plots/frame_attributes":770,"../plots/layout_attributes":797,"../plots/polar/legacy/area_attributes":812,"../plots/polar/legacy/axis_attributes":813,"../registry":825,"./edit_types":725,"./plot_config":730}],732:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -140782,9 +141068,9 @@ }; }; -},{"../lib":692,"../plots/attributes":737}],731:[function(_dereq_,module,exports){ +},{"../lib":694,"../plots/attributes":739}],733:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -140822,8 +141108,8 @@ function overlappingDomain(xDomain, yDomain, domains) { for(var i = 0; i < domains.length; i++) { - var existingX = domains[i][0], - existingY = domains[i][1]; + var existingX = domains[i][0]; + var existingY = domains[i][1]; if(existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) { continue; @@ -141317,8 +141603,8 @@ var cdi0 = gd.calcdata[i][0]; if((cdi0.t || {}).cb) { - var trace = cdi0.trace, - cb = cdi0.t.cb; + var trace = cdi0.trace; + var cb = cdi0.t.cb; if(Registry.traceIs(trace, 'contour')) { cb.line({ @@ -141520,9 +141806,9 @@ Registry.getComponentMethod('updatemenus', 'draw')(gd); }; -},{"../components/color":569,"../components/drawing":590,"../components/modebar":628,"../components/titles":657,"../constants/alignment":664,"../lib":692,"../lib/clear_gl_canvases":677,"../plots/cartesian/autorange":739,"../plots/cartesian/axes":740,"../plots/cartesian/constraints":748,"../plots/plots":804,"../registry":823,"d3":148}],732:[function(_dereq_,module,exports){ +},{"../components/color":571,"../components/drawing":592,"../components/modebar":630,"../components/titles":659,"../constants/alignment":666,"../lib":694,"../lib/clear_gl_canvases":679,"../plots/cartesian/autorange":741,"../plots/cartesian/axes":742,"../plots/cartesian/constraints":750,"../plots/plots":806,"../registry":825,"d3":149}],734:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -141538,7 +141824,7 @@ var Plots = _dereq_('../plots/plots'); var plotAttributes = _dereq_('../plots/attributes'); var Template = _dereq_('./plot_template'); -var dfltConfig = _dereq_('./plot_config'); +var dfltConfig = _dereq_('./plot_config').dfltConfig; /** * Plotly.makeTemplate: create a template off an existing figure to reuse @@ -141547,13 +141833,14 @@ * Note: separated from the rest of templates because otherwise we get circular * references due to PlotSchema. * - * @param {object|DOM element} figure: The figure to base the template on + * @param {object|DOM element|string} figure: The figure to base the template on * should contain a trace array `figure.data` * and a layout object `figure.layout` * @returns {object} template: the extracted template - can then be used as * `layout.template` in another figure. */ exports.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 || []; @@ -141994,9 +142281,9 @@ return opts; } -},{"../lib":692,"../plots/attributes":737,"../plots/plots":804,"./plot_config":728,"./plot_schema":729,"./plot_template":730}],733:[function(_dereq_,module,exports){ +},{"../lib":694,"../plots/attributes":739,"../plots/plots":806,"./plot_config":730,"./plot_schema":731,"./plot_template":732}],735:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -142185,9 +142472,9 @@ module.exports = toImage; -},{"../lib":692,"../snapshot/helpers":827,"../snapshot/svgtoimg":829,"../snapshot/tosvg":831,"./plot_api":727}],734:[function(_dereq_,module,exports){ +},{"../lib":694,"../snapshot/helpers":829,"../snapshot/svgtoimg":831,"../snapshot/tosvg":833,"./plot_api":729}],736:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -142199,7 +142486,7 @@ var Lib = _dereq_('../lib'); var Plots = _dereq_('../plots/plots'); var PlotSchema = _dereq_('./plot_schema'); -var dfltConfig = _dereq_('./plot_config'); +var dfltConfig = _dereq_('./plot_config').dfltConfig; var isPlainObject = Lib.isPlainObject; var isArray = Array.isArray; @@ -142261,21 +142548,21 @@ Plots.supplyDefaults(gd); - var dataOut = gd._fullData, - len = dataIn.length; + var dataOut = gd._fullData; + var len = dataIn.length; for(var i = 0; i < len; i++) { - var traceIn = dataIn[i], - base = ['data', i]; + var traceIn = dataIn[i]; + var base = ['data', i]; if(!isPlainObject(traceIn)) { errorList.push(format('object', base)); continue; } - var traceOut = dataOut[i], - traceType = traceOut.type, - traceSchema = schema.traces[traceType].attributes; + var traceOut = dataOut[i]; + var traceType = traceOut.type; + var traceSchema = schema.traces[traceType].attributes; // PlotSchema does something fancy with trace 'type', reset it here // to make the trace schema compatible with Lib.validate. @@ -142290,8 +142577,8 @@ crawl(traceIn, traceOut, traceSchema, errorList, base); - var transformsIn = traceIn.transforms, - transformsOut = traceOut.transforms; + var transformsIn = traceIn.transforms; + var transformsOut = traceOut.transforms; if(transformsIn) { if(!isArray(transformsIn)) { @@ -142301,8 +142588,8 @@ base.push('transforms'); for(var j = 0; j < transformsIn.length; j++) { - var path = ['transforms', j], - transformType = transformsIn[j].type; + var path = ['transforms', j]; + var transformType = transformsIn[j].type; if(!isPlainObject(transformsIn[j])) { errorList.push(format('object', base, path)); @@ -142324,8 +142611,8 @@ } } - var layoutOut = gd._fullLayout, - layoutSchema = fillLayoutSchema(schema, dataOut); + var layoutOut = gd._fullLayout; + var layoutSchema = fillLayoutSchema(schema, dataOut); crawl(layoutIn, layoutOut, layoutSchema, errorList, 'layout'); @@ -142347,8 +142634,8 @@ var p = path.slice(); p.push(k); - var valIn = objIn[k], - valOut = objOut[k]; + var valIn = objIn[k]; + var valOut = objOut[k]; var nestedSchema = getNestedSchema(schema, k); var isInfoArray = (nestedSchema || {}).valType === 'info_array'; @@ -142408,8 +142695,8 @@ } } else if(nestedSchema.items && !isInfoArray && isArray(valIn)) { - var _nestedSchema = items[Object.keys(items)[0]], - indexList = []; + var _nestedSchema = items[Object.keys(items)[0]]; + var indexList = []; var j, _p; @@ -142580,9 +142867,9 @@ } function isInSchema(schema, key) { - var parts = splitKey(key), - keyMinusId = parts.keyMinusId, - id = parts.id; + var parts = splitKey(key); + var keyMinusId = parts.keyMinusId; + var id = parts.id; if((keyMinusId in schema) && schema[keyMinusId]._isSubplotObj && id) { return true; @@ -142631,9 +142918,9 @@ return astr; } -},{"../lib":692,"../plots/plots":804,"./plot_config":728,"./plot_schema":729}],735:[function(_dereq_,module,exports){ +},{"../lib":694,"../plots/plots":806,"./plot_config":730,"./plot_schema":731}],737:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -142684,6 +142971,7 @@ min: 0, dflt: 500, + editType: 'none', }, easing: { @@ -142728,14 +143016,23 @@ 'bounce-in-out' ], + editType: 'none', }, + ordering: { + valType: 'enumerated', + values: ['layout first', 'traces first'], + dflt: 'layout first', + + editType: 'none', + + } } }; -},{}],736:[function(_dereq_,module,exports){ +},{}],738:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -142829,9 +143126,9 @@ return contOut; }; -},{"../lib":692,"../plot_api/plot_template":730}],737:[function(_dereq_,module,exports){ +},{"../lib":694,"../plot_api/plot_template":732}],739:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -142891,11 +143188,14 @@ uid: { valType: 'string', - editType: 'plot' + editType: 'plot', + anim: true, + }, ids: { valType: 'data_array', editType: 'calc', + anim: true, }, customdata: { @@ -142960,9 +143260,9 @@ } }; -},{"../components/fx/attributes":599}],738:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":601}],740:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -142989,9 +143289,9 @@ } }; -},{}],739:[function(_dereq_,module,exports){ +},{}],741:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -143282,7 +143582,7 @@ * - ax.d2l * @param {array} data: * array of numbers (i.e. already run though ax.d2c) - * @param {object} options: + * @param {object} opts: * available keys are: * vpad: (number or number array) pad values (data value +-vpad) * ppad: (number or number array) pad pixels (pixel location +-ppad) @@ -143300,17 +143600,18 @@ * - val {number} * - pad {number} * - extrappad {number} + * - opts {object}: a ref to the passed "options" object */ -function findExtremes(ax, data, options) { - if(!options) options = {}; +function findExtremes(ax, data, opts) { + if(!opts) opts = {}; if(!ax._m) ax.setScale(); var minArray = []; var maxArray = []; var len = data.length; - var extrapad = options.padded || false; - var tozero = options.tozero && (ax.type === 'linear' || ax.type === '-'); + var extrapad = opts.padded || false; + var tozero = opts.tozero && (ax.type === 'linear' || ax.type === '-'); var isLog = ax.type === 'log'; var hasArrayOption = false; var i, v, di, dmin, dmax, ppadiplus, ppadiminus, vmin, vmax; @@ -143327,11 +143628,11 @@ } var ppadplus = makePadAccessor((ax._m > 0 ? - options.ppadplus : options.ppadminus) || options.ppad || 0); + opts.ppadplus : opts.ppadminus) || opts.ppad || 0); var ppadminus = makePadAccessor((ax._m > 0 ? - options.ppadminus : options.ppadplus) || options.ppad || 0); - var vpadplus = makePadAccessor(options.vpadplus || options.vpad); - var vpadminus = makePadAccessor(options.vpadminus || options.vpad); + opts.ppadminus : opts.ppadplus) || opts.ppad || 0); + var vpadplus = makePadAccessor(opts.vpadplus || opts.vpad); + var vpadminus = makePadAccessor(opts.vpadminus || opts.vpad); if(!hasArrayOption) { // with no arrays other than `data` we don't need to consider @@ -143395,7 +143696,11 @@ for(i = 0; i < iMax; i++) addItem(i); for(i = len - 1; i >= iMax; i--) addItem(i); - return {min: minArray, max: maxArray}; + return { + min: minArray, + max: maxArray, + opts: opts + }; } function collapseMinArray(array, newVal, newPad, opts) { @@ -143477,9 +143782,9 @@ function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":669,"../../lib":692,"../../registry":823,"fast-isnumeric":214}],740:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../registry":825,"fast-isnumeric":215}],742:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -143612,6 +143917,39 @@ return cleanPos(pos); }; +axes.redrawComponents = function(gd, axIds) { + axIds = axIds ? axIds : axes.listIds(gd); + + var fullLayout = gd._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(gd, ind); + stash[ind] = 1; + // once is enough for images (which doesn't use the `i` arg anyway) + if(shortCircuit) return; + } + } + } + } + + // annotations and shapes 'draw' method is slow, + // use the finer-grained 'drawOne' method instead + _redrawOneComp('annotations', 'drawOne', '_annIndices'); + _redrawOneComp('shapes', 'drawOne', '_shapeIndices'); + _redrawOneComp('images', 'draw', '_imgIndices', true); +}; + var getDataConversions = axes.getDataConversions = function(gd, trace, target, targetArray) { var ax; @@ -144255,9 +144593,9 @@ // not necessarily *all* the information in tick0 though, if it's really odd // minimal string length for tick0: 'd' is 10, 'M' is 16, 'S' is 19 // take off a leading minus (year < 0) and i (intercalary month) so length is consistent - var tick0ms = ax.r2l(ax.tick0), - tick0str = ax.l2r(tick0ms).replace(/(^-|i)/g, ''), - tick0len = tick0str.length; + var tick0ms = ax.r2l(ax.tick0); + var tick0str = ax.l2r(tick0ms).replace(/(^-|i)/g, ''); + var tick0len = tick0str.length; if(String(dtick).charAt(0) === 'M') { // any tick0 more specific than a year: alway show the full date @@ -144315,8 +144653,8 @@ if(isNumeric(dtick)) return x + axSign * dtick; // everything else is a string, one character plus a number - var tType = dtick.charAt(0), - dtSigned = axSign * Number(dtick.substr(1)); + var tType = dtick.charAt(0); + var dtSigned = axSign * Number(dtick.substr(1)); // Dates: months (or years - see Lib.incrementMonth) if(tType === 'M') return Lib.incrementMonth(x, dtSigned, calendar); @@ -144327,9 +144665,9 @@ // log10 of 2,5,10, or all digits (logs just have to be // close enough to round) else if(tType === 'D') { - var tickset = (dtick === 'D2') ? roundLog2 : roundLog1, - x2 = x + axSign * 0.01, - frac = Lib.roundUp(Lib.mod(x2, 1), tickset, axrev); + 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; @@ -144392,8 +144730,8 @@ (Math.pow(10, r0) - tick0) / dtNum) * dtNum + tick0) / Math.LN10; } else if(tType === 'D') { - var tickset = (dtick === 'D2') ? roundLog2 : roundLog1, - frac = Lib.roundUp(Lib.mod(r0, 1), tickset, axrev); + var tickset = (dtick === 'D2') ? roundLog2 : roundLog1; + var frac = Lib.roundUp(Lib.mod(r0, 1), tickset, axrev); return Math.floor(r0) + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; @@ -145387,27 +145725,53 @@ var hasRangeSlider = Registry.getComponentMethod('rangeslider', 'isVisible')(ax); function doAutoMargins() { - var push, rangeSliderPush; + var s = ax.side.charAt(0); + var push; + var rangeSliderPush; if(hasRangeSlider) { rangeSliderPush = Registry.getComponentMethod('rangeslider', 'autoMarginOpts')(gd, ax); } Plots.autoMargin(gd, rangeSliderAutoMarginID(ax), rangeSliderPush); - var s = ax.side.charAt(0); if(ax.automargin && (!hasRangeSlider || s !== 'b')) { push = {x: 0, y: 0, r: 0, l: 0, t: 0, b: 0}; - if(axLetter === 'x') { - push.y = (ax.anchor === 'free' ? ax.position : - ax._anchorAxis.domain[s === 't' ? 1 : 0]); - push[s] += ax._boundingBox.height; - } else { - push.x = (ax.anchor === 'free' ? ax.position : - ax._anchorAxis.domain[s === 'r' ? 1 : 0]); - push[s] += ax._boundingBox.width; + var bbox = ax._boundingBox; + var counterAx = mainPlotinfo[counterLetter + 'axis']; + var anchorAxDomainIndex; + var offset; + + switch(axLetter + s) { + case 'xb': + anchorAxDomainIndex = 0; + offset = bbox.top - counterAx._length - counterAx._offset; + push[s] = bbox.height; + break; + case 'xt': + anchorAxDomainIndex = 1; + offset = counterAx._offset - bbox.bottom; + push[s] = bbox.height; + break; + case 'yl': + anchorAxDomainIndex = 0; + offset = counterAx._offset - bbox.right; + push[s] = bbox.width; + break; + case 'yr': + anchorAxDomainIndex = 1; + offset = bbox.left - counterAx._length - counterAx._offset; + push[s] = bbox.width; + break; } + push[counterLetter] = ax.anchor === 'free' ? + ax.position : + ax._anchorAxis.domain[anchorAxDomainIndex]; + + if(push[s] > 0) { + push[s] += offset; + } if(ax.title.text !== fullLayout._dfltTitle[axLetter]) { push[s] += ax.title.font.size; } @@ -146294,14 +146658,13 @@ }; function makeAxisGroups(gd, traces) { - var groups = [], - i, - j; + var groups = []; + var i, j; for(i = 0; i < traces.length; i++) { - var groupsi = [], - xi = gd._fullData[traces[i]].xaxis, - yi = gd._fullData[traces[i]].yaxis; + var groupsi = []; + var xi = gd._fullData[traces[i]].xaxis; + var yi = gd._fullData[traces[i]].yaxis; if(!xi || !yi) continue; // not a 2D cartesian trace? for(j = 0; j < groups.length; j++) { @@ -146315,8 +146678,8 @@ continue; } - var group0 = groups[groupsi[0]], - groupj; + var group0 = groups[groupsi[0]]; + var groupj; if(groupsi.length > 1) { for(j = 1; j < groupsi.length; j++) { @@ -146433,9 +146796,9 @@ return ax._id === 'angularaxis'; } -},{"../../components/color":569,"../../components/drawing":590,"../../components/titles":657,"../../constants/alignment":664,"../../constants/numerical":669,"../../lib":692,"../../lib/svg_text_utils":716,"../../plots/plots":804,"../../registry":823,"./autorange":739,"./axis_autotype":741,"./axis_ids":743,"./clean_ticks":745,"./layout_attributes":753,"./set_convert":759,"d3":148,"fast-isnumeric":214}],741:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../../components/titles":659,"../../constants/alignment":666,"../../constants/numerical":671,"../../lib":694,"../../lib/svg_text_utils":718,"../../plots/plots":806,"../../registry":825,"./autorange":741,"./axis_autotype":743,"./axis_ids":745,"./clean_ticks":747,"./layout_attributes":755,"./set_convert":761,"d3":149,"fast-isnumeric":215}],743:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -146528,9 +146891,9 @@ return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":669,"../../lib":692,"fast-isnumeric":214}],742:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"fast-isnumeric":215}],744:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -146643,9 +147006,9 @@ return containerOut; }; -},{"../../lib":692,"../../registry":823,"./category_order_defaults":744,"./layout_attributes":753,"./line_grid_defaults":755,"./set_convert":759,"./tick_label_defaults":760,"./tick_mark_defaults":761,"./tick_value_defaults":762}],743:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"./category_order_defaults":746,"./layout_attributes":755,"./line_grid_defaults":757,"./set_convert":761,"./tick_label_defaults":762,"./tick_mark_defaults":763,"./tick_value_defaults":764}],745:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -146761,9 +147124,9 @@ return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -},{"../../registry":823,"./constants":746}],744:[function(_dereq_,module,exports){ +},{"../../registry":825,"./constants":748}],746:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -146855,9 +147218,9 @@ } }; -},{}],745:[function(_dereq_,module,exports){ +},{}],747:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -146944,9 +147307,9 @@ return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":669,"../../lib":692,"fast-isnumeric":214}],746:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"fast-isnumeric":215}],748:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -147026,9 +147389,9 @@ } }; -},{"../../lib/regex":708}],747:[function(_dereq_,module,exports){ +},{"../../lib/regex":710}],749:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -147180,9 +147543,9 @@ thisGroup[scaleanchor] = 1; } -},{"../../lib":692,"./axis_ids":743}],748:[function(_dereq_,module,exports){ +},{"../../lib":694,"./axis_ids":745}],750:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -147391,9 +147754,9 @@ ax.setScale(); } -},{"../../constants/alignment":664,"../../constants/numerical":669,"./autorange":739,"./axis_ids":743,"./scale_zoom":757}],749:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666,"../../constants/numerical":671,"./autorange":741,"./axis_ids":745,"./scale_zoom":759}],751:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -147636,12 +147999,12 @@ } } else if(numClicks === 1 && singleEnd) { - var ax = ns ? ya0 : xa0, - end = (ns === 's' || ew === 'w') ? 0 : 1, - attrStr = ax._name + '.range[' + end + ']', - initialText = getEndText(ax, end), - hAlign = 'left', - vAlign = 'middle'; + var ax = ns ? ya0 : xa0; + var end = (ns === '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; @@ -147710,10 +148073,10 @@ return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)), - y1 = Math.max(0, Math.min(ph, dy0 + y0)), - dx = Math.abs(x1 - x0), - dy = Math.abs(y1 - y0); + var x1 = Math.max(0, Math.min(pw, dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var dx = Math.abs(x1 - x0); + var dy = Math.abs(y1 - y0); box.l = Math.min(x0, x1); box.r = Math.max(x0, x1); @@ -147811,7 +148174,7 @@ // deactivate mousewheel scrolling on embedded graphs // devs can override this with layout._enablescrollzoom, // but _ ensures this setting won't leave their page - if(!gd._context.scrollZoom && !gd._fullLayout._enablescrollzoom) { + if(!gd._context._scrollZoom.cartesian && !gd._fullLayout._enablescrollzoom) { return; } @@ -147824,17 +148187,8 @@ return; } - var pc = gd.querySelector('.plotly'); - recomputeAxisLists(); - // if the plot has scrollbars (more than a tiny excess) - // disable scrollzoom too. - if(pc.scrollHeight - pc.clientHeight > 10 || - pc.scrollWidth - pc.clientWidth > 10) { - return; - } - clearTimeout(redrawTimer); var wheelDelta = -e.deltaY; @@ -147844,18 +148198,17 @@ return; } - var zoom = Math.exp(-Math.min(Math.max(wheelDelta, -20), 20) / 200), - gbb = mainplot.draglayer.select('.nsewdrag') - .node().getBoundingClientRect(), - xfrac = (e.clientX - gbb.left) / gbb.width, - yfrac = (gbb.bottom - e.clientY) / gbb.height, - i; + 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, zoom) { if(ax.fixedrange) return; - var axRange = Lib.simpleMap(ax.range, ax.r2l), - v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; + var axRange = Lib.simpleMap(ax.range, ax.r2l); + var v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); } ax.range = axRange.map(doZoom); } @@ -147885,7 +148238,7 @@ // viewbox redraw at first updateSubplots(scrollViewBox); - ticksAndAnnotations(ns, ew); + ticksAndAnnotations(); // then replot after a delay to make sure // no more scrolling is coming @@ -147917,7 +148270,7 @@ if(xActive) dragAxList(xaxes, dx); if(yActive) dragAxList(yaxes, dy); updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); - ticksAndAnnotations(yActive, xActive); + ticksAndAnnotations(); return; } @@ -147927,9 +148280,9 @@ // TODO: this makes (generally non-fatal) errors when you get // near floating point limits function dz(axArray, end, d) { - var otherEnd = 1 - end, - movedAx, - newLinearizedEnd; + var otherEnd = 1 - end; + var movedAx; + var newLinearizedEnd; for(var i = 0; i < axArray.length; i++) { var axi = axArray[i]; if(axi.fixedrange) continue; @@ -147989,14 +148342,14 @@ } updateSubplots([x0, y0, pw - dx, ph - dy]); - ticksAndAnnotations(yActive, xActive); + ticksAndAnnotations(); } // Draw ticks and annotations (and other components) when ranges change. // Also records the ranges that have changed for use by update at the end. - function ticksAndAnnotations(ns, ew) { - var activeAxIds = [], - i; + function ticksAndAnnotations() { + var activeAxIds = []; + var i; function pushActiveAxIds(axList) { for(i = 0; i < axList.length; i++) { @@ -148022,33 +148375,15 @@ updates[ax._name + '.range[1]'] = ax.range[1]; } - function redrawObjs(objArray, method, shortCircuit) { - for(i = 0; i < objArray.length; i++) { - var obji = objArray[i]; - - if((ew && activeAxIds.indexOf(obji.xref) !== -1) || - (ns && activeAxIds.indexOf(obji.yref) !== -1)) { - method(gd, i); - // once is enough for images (which doesn't use the `i` arg anyway) - if(shortCircuit) return; - } - } - } - - // annotations and shapes 'draw' method is slow, - // use the finer-grained 'drawOne' method instead - - redrawObjs(gd._fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); - redrawObjs(gd._fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); - redrawObjs(gd._fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); + Axes.redrawComponents(gd, activeAxIds); } function doubleClick() { if(gd._transitioningWithDuration) return; - var doubleClickConfig = gd._context.doubleClick, - axList = (xActive ? xaxes : []).concat(yActive ? yaxes : []), - attrs = {}; + var doubleClickConfig = gd._context.doubleClick; + var axList = (xActive ? xaxes : []).concat(yActive ? yaxes : []); + var attrs = {}; var ax, i, rangeInitial; @@ -148298,9 +148633,9 @@ } function getEndText(ax, end) { - var initialVal = ax.range[end], - diff = Math.abs(initialVal - ax.range[1 - end]), - dig; + var initialVal = ax.range[end]; + var diff = Math.abs(initialVal - ax.range[1 - end]); + var dig; // TODO: this should basically be ax.r2d but we're doing extra // rounding here... can we clean up at all? @@ -148585,9 +148920,9 @@ attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":569,"../../components/dragelement":587,"../../components/drawing":590,"../../components/fx":608,"../../constants/alignment":664,"../../lib":692,"../../lib/clear_gl_canvases":677,"../../lib/setcursor":712,"../../lib/svg_text_utils":716,"../../plot_api/subroutines":731,"../../registry":823,"../plots":804,"./axes":740,"./axis_ids":743,"./constants":746,"./scale_zoom":757,"./select":758,"d3":148,"has-passive-events":394,"tinycolor2":513}],750:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/dragelement":589,"../../components/drawing":592,"../../components/fx":610,"../../constants/alignment":666,"../../lib":694,"../../lib/clear_gl_canvases":679,"../../lib/setcursor":714,"../../lib/svg_text_utils":718,"../../plot_api/subroutines":733,"../../registry":825,"../plots":806,"./axes":742,"./axis_ids":745,"./constants":748,"./scale_zoom":759,"./select":760,"d3":149,"has-passive-events":397,"tinycolor2":515}],752:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -148621,8 +148956,8 @@ // sort overlays last, then by x axis number, then y axis number if((fullLayout._plots[a].mainplot && true) === (fullLayout._plots[b].mainplot && true)) { - var aParts = a.split('y'), - bParts = b.split('y'); + 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)); @@ -148753,9 +149088,9 @@ setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":587,"../../components/fx":608,"../../lib/setcursor":712,"./constants":746,"./dragbox":749,"d3":148}],751:[function(_dereq_,module,exports){ +},{"../../components/dragelement":589,"../../components/fx":610,"../../lib/setcursor":714,"./constants":748,"./dragbox":751,"d3":149}],753:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -148828,9 +149163,9 @@ }; }; -},{"../../lib":692,"../../registry":823}],752:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],754:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -149451,9 +149786,9 @@ exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":590,"../../constants/xmlns_namespaces":670,"../../lib":692,"../../registry":823,"../get_data":777,"../plots":804,"./attributes":738,"./axis_ids":743,"./constants":746,"./graph_interact":750,"./layout_attributes":753,"./layout_defaults":754,"./transition_axes":763,"d3":148}],753:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../constants/xmlns_namespaces":672,"../../lib":694,"../../registry":825,"../get_data":779,"../plots":806,"./attributes":740,"./axis_ids":745,"./constants":748,"./graph_interact":752,"./layout_attributes":755,"./layout_defaults":756,"./transition_axes":765,"d3":149}],755:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -149535,11 +149870,12 @@ valType: 'info_array', items: [ - {valType: 'any', editType: 'axrange', impliedEdits: {'^autorange': false}}, - {valType: 'any', editType: 'axrange', impliedEdits: {'^autorange': false}} + {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, }, fixedrange: { @@ -150027,9 +150363,9 @@ } }; -},{"../../components/color/attributes":568,"../../components/drawing/attributes":589,"../../lib/extend":682,"../../plot_api/plot_template":730,"../font_attributes":767,"./constants":746}],754:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../components/drawing/attributes":591,"../../lib/extend":684,"../../plot_api/plot_template":732,"../font_attributes":769,"./constants":748}],756:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -150132,12 +150468,12 @@ // plot_bgcolor only makes sense if there's a (2D) plot! // TODO: bgcolor for each subplot, to inherit from the main one - var plot_bgcolor = Color.background; + var plotBgColor = Color.background; if(xIds.length && yIds.length) { - plot_bgcolor = Lib.coerce(layoutIn, layoutOut, basePlotLayoutAttributes, 'plot_bgcolor'); + plotBgColor = Lib.coerce(layoutIn, layoutOut, basePlotLayoutAttributes, 'plot_bgcolor'); } - var bgColor = Color.combine(plot_bgcolor, layoutOut.paper_bgcolor); + var bgColor = Color.combine(plotBgColor, layoutOut.paper_bgcolor); var axName, axLetter, axLayoutIn, axLayoutOut; @@ -150186,6 +150522,7 @@ axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; }); axLayoutOut._annIndices = []; axLayoutOut._shapeIndices = []; + axLayoutOut._imgIndices = []; axLayoutOut._subplotsWith = []; axLayoutOut._counterAxes = []; @@ -150213,12 +150550,12 @@ handleTypeDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions); handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut); - var spikecolor = coerce2('spikecolor'), - spikethickness = coerce2('spikethickness'), - spikedash = coerce2('spikedash'), - spikemode = coerce2('spikemode'), - spikesnap = coerce2('spikesnap'), - showSpikes = coerce('showspikes', !!spikecolor || !!spikethickness || !!spikedash || !!spikemode || !!spikesnap); + var spikecolor = coerce2('spikecolor'); + var spikethickness = coerce2('spikethickness'); + var spikedash = coerce2('spikedash'); + var spikemode = coerce2('spikemode'); + var spikesnap = coerce2('spikesnap'); + var showSpikes = coerce('showspikes', !!spikecolor || !!spikethickness || !!spikedash || !!spikemode || !!spikesnap); if(!showSpikes) { delete axLayoutOut.spikecolor; @@ -150296,9 +150633,9 @@ } }; -},{"../../components/color":569,"../../lib":692,"../../plot_api/plot_template":730,"../../registry":823,"../layout_attributes":795,"./axis_defaults":742,"./axis_ids":743,"./constraint_defaults":747,"./layout_attributes":753,"./position_defaults":756,"./type_defaults":764}],755:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../plot_api/plot_template":732,"../../registry":825,"../layout_attributes":797,"./axis_defaults":744,"./axis_ids":745,"./constraint_defaults":749,"./layout_attributes":755,"./position_defaults":758,"./type_defaults":766}],757:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -150361,9 +150698,9 @@ } }; -},{"../../components/color/attributes":568,"../../lib":692,"tinycolor2":513}],756:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../lib":694,"tinycolor2":515}],758:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -150436,7 +150773,11 @@ // in the axes popover to hide domain for the overlaying axis. // perhaps I should make a private version _domain that all axes get??? var domain = coerce('domain', dfltDomain); - if(domain[0] > domain[1] - 0.01) containerOut.domain = dfltDomain; + + // according to https://www.npmjs.com/package/canvas-size + // the minimum value of max canvas width across browsers and devices is 4096 + // which applied in the calculation below: + if(domain[0] > domain[1] - 1 / 4096) containerOut.domain = dfltDomain; Lib.noneOrAll(containerIn.domain, containerOut.domain, dfltDomain); } @@ -150445,9 +150786,9 @@ return containerOut; }; -},{"../../lib":692,"fast-isnumeric":214}],757:[function(_dereq_,module,exports){ +},{"../../lib":694,"fast-isnumeric":215}],759:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -150473,9 +150814,9 @@ ]; }; -},{"../../constants/alignment":664}],758:[function(_dereq_,module,exports){ +},{"../../constants/alignment":666}],760:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -150602,8 +150943,8 @@ x1 = Math.max(0, Math.min(pw, dx0 + x0)); y1 = Math.max(0, Math.min(ph, dy0 + y0)); - var dx = Math.abs(x1 - x0), - dy = Math.abs(y1 - y0); + var dx = Math.abs(x1 - x0); + var dy = Math.abs(y1 - y0); if(mode === 'select') { var direction = fullLayout.selectdirection; @@ -150679,7 +151020,9 @@ function() { selection = []; - var thisSelection, traceSelections = [], traceSelection; + var thisSelection; + var traceSelections = []; + var traceSelection; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; @@ -151263,9 +151606,9 @@ selectOnClick: selectOnClick }; -},{"../../components/color":569,"../../components/fx":608,"../../components/fx/helpers":604,"../../lib/clear_gl_canvases":677,"../../lib/polygon":704,"../../lib/throttle":717,"../../plot_api/subroutines":731,"../../registry":823,"./axis_ids":743,"./constants":746,"polybooljs":456}],759:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx":610,"../../components/fx/helpers":606,"../../lib/clear_gl_canvases":679,"../../lib/polygon":706,"../../lib/throttle":719,"../../plot_api/subroutines":733,"../../registry":825,"./axis_ids":745,"./constants":748,"polybooljs":459}],761:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -151337,8 +151680,8 @@ else if(v <= 0 && clip && ax.range && ax.range.length === 2) { // clip NaN (ie past negative infinity) to LOG_CLIP axis // length past the negative edge - var r0 = ax.range[0], - r1 = ax.range[1]; + var r0 = ax.range[0]; + var r1 = ax.range[1]; return 0.5 * (r0 + r1 - 2 * LOG_CLIP * Math.abs(r0 - r1)); } @@ -151622,15 +151965,15 @@ // find the range value at the specified (linear) fraction of the axis ax.fraction2r = function(v) { - var rl0 = ax.r2l(ax.range[0]), - rl1 = ax.r2l(ax.range[1]); + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); return ax.l2r(rl0 + v * (rl1 - rl0)); }; // find the fraction of the range at the specified range value ax.r2fraction = function(v) { - var rl0 = ax.r2l(ax.range[0]), - rl1 = ax.r2l(ax.range[1]); + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); return (ax.r2l(v) - rl0) / (rl1 - rl0); }; @@ -151723,12 +152066,12 @@ // issue if we transform the drawn layer *and* use the new axis range to // draw the data. This allows us to construct setConvert using the pre- // interaction values of the range: - var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range', - calendar = ax.calendar; + var rangeAttr = (usePrivateRange && ax._r) ? '_r' : 'range'; + var calendar = ax.calendar; ax.cleanRange(rangeAttr); - var rl0 = ax.r2l(ax[rangeAttr][0], calendar), - rl1 = ax.r2l(ax[rangeAttr][1], calendar); + var rl0 = ax.r2l(ax[rangeAttr][0], calendar); + var rl1 = ax.r2l(ax[rangeAttr][1], calendar); if(axLetter === 'y') { ax._offset = gs.t + (1 - ax.domain[1]) * gs.h; @@ -151856,9 +152199,9 @@ delete ax._forceTick0; }; -},{"../../constants/numerical":669,"../../lib":692,"./axis_ids":743,"./constants":746,"d3":148,"fast-isnumeric":214}],760:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"./axis_ids":745,"./constants":748,"d3":149,"fast-isnumeric":215}],762:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -151930,15 +152273,13 @@ * */ function getShowAttrDflt(containerIn) { - var showAttrsAll = ['showexponent', - 'showtickprefix', - 'showticksuffix'], - showAttrs = showAttrsAll.filter(function(a) { - return containerIn[a] !== undefined; - }), - sameVal = function(a) { - return containerIn[a] === containerIn[showAttrs[0]]; - }; + var showAttrsAll = ['showexponent', 'showtickprefix', 'showticksuffix']; + var showAttrs = showAttrsAll.filter(function(a) { + return containerIn[a] !== undefined; + }); + var sameVal = function(a) { + return containerIn[a] === containerIn[showAttrs[0]]; + }; if(showAttrs.every(sameVal) || showAttrs.length === 1) { return containerIn[showAttrs[0]]; @@ -151957,9 +152298,9 @@ } } -},{"../../lib":692,"../array_container_defaults":736,"./layout_attributes":753}],761:[function(_dereq_,module,exports){ +},{"../../lib":694,"../array_container_defaults":738,"./layout_attributes":755}],763:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -151978,10 +152319,10 @@ * options: inherits outerTicks from axes.handleAxisDefaults */ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, options) { - var tickLen = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'ticklen'), - tickWidth = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickwidth'), - tickColor = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickcolor', containerOut.color), - showTicks = coerce('ticks', (options.outerTicks || tickLen || tickWidth || tickColor) ? 'outside' : ''); + var tickLen = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'ticklen'); + var tickWidth = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickwidth'); + var tickColor = Lib.coerce2(containerIn, containerOut, layoutAttributes, 'tickcolor', containerOut.color); + var showTicks = coerce('ticks', (options.outerTicks || tickLen || tickWidth || tickColor) ? 'outside' : ''); if(!showTicks) { delete containerOut.ticklen; @@ -151990,9 +152331,9 @@ } }; -},{"../../lib":692,"./layout_attributes":753}],762:[function(_dereq_,module,exports){ +},{"../../lib":694,"./layout_attributes":755}],764:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152032,9 +152373,9 @@ } }; -},{"./clean_ticks":745}],763:[function(_dereq_,module,exports){ +},{"./clean_ticks":747}],765:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152048,147 +152389,43 @@ var Registry = _dereq_('../../registry'); var Drawing = _dereq_('../../components/drawing'); var Axes = _dereq_('./axes'); -var axisRegex = _dereq_('./constants').attrRegex; -module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCompleteCallback) { +/** + * transitionAxes + * + * transition axes from one set of ranges to another, using a svg + * transformations, similar to during panning. + * + * @param {DOM element | object} gd + * @param {array} edits : array of 'edits', each item with + * - plotinfo {object} subplot object + * - xr0 {array} initial x-range + * - xr1 {array} end x-range + * - yr0 {array} initial y-range + * - yr1 {array} end y-range + * @param {object} transitionOpts + * @param {function} makeOnCompleteCallback + */ +module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnCompleteCallback) { var fullLayout = gd._fullLayout; - var axes = []; - - function computeUpdates(layout) { - var ai, attrList, match, axis, update; - var updates = {}; - - for(ai in layout) { - attrList = ai.split('.'); - match = attrList[0].match(axisRegex); - if(match) { - var axisLetter = ai.charAt(0); - var axisName = attrList[0]; - axis = fullLayout[axisName]; - update = {}; - - if(Array.isArray(layout[ai])) { - update.to = layout[ai].slice(0); - } else { - if(Array.isArray(layout[ai].range)) { - update.to = layout[ai].range.slice(0); - } - } - if(!update.to) continue; - - update.axisName = axisName; - update.length = axis._length; - - axes.push(axisLetter); - - updates[axisLetter] = update; - } - } - - return updates; - } - - function computeAffectedSubplots(fullLayout, updatedAxisIds, updates) { - var plotName; - var plotinfos = fullLayout._plots; - var affectedSubplots = []; - var toX, toY; - - for(plotName in plotinfos) { - var plotinfo = plotinfos[plotName]; - - if(affectedSubplots.indexOf(plotinfo) !== -1) continue; - - var x = plotinfo.xaxis._id; - var y = plotinfo.yaxis._id; - var fromX = plotinfo.xaxis.range; - var fromY = plotinfo.yaxis.range; - - // Store the initial range at the beginning of this transition: - plotinfo.xaxis._r = plotinfo.xaxis.range.slice(); - plotinfo.yaxis._r = plotinfo.yaxis.range.slice(); - - if(updates[x]) { - toX = updates[x].to; - } else { - toX = fromX; - } - if(updates[y]) { - toY = updates[y].to; - } else { - toY = fromY; - } - - if(fromX[0] === toX[0] && fromX[1] === toX[1] && fromY[0] === toY[0] && fromY[1] === toY[1]) continue; - - if(updatedAxisIds.indexOf(x) !== -1 || updatedAxisIds.indexOf(y) !== -1) { - affectedSubplots.push(plotinfo); - } - } - - return affectedSubplots; - } - - var updates = computeUpdates(newLayout); - var updatedAxisIds = Object.keys(updates); - var affectedSubplots = computeAffectedSubplots(fullLayout, updatedAxisIds, updates); - - function updateLayoutObjs() { - function redrawObjs(objArray, method, shortCircuit) { - for(var i = 0; i < objArray.length; i++) { - method(gd, i); - - // once is enough for images (which doesn't use the `i` arg anyway) - if(shortCircuit) return; - } - } - - redrawObjs(fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); - redrawObjs(fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); - redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); - } - - if(!affectedSubplots.length) { - updateLayoutObjs(); - return false; - } - - function ticksAndAnnotations(xa, ya) { - var activeAxIds = [xa._id, ya._id]; - var i; - - Axes.drawOne(gd, xa, {skipTitle: true}); - Axes.drawOne(gd, ya, {skipTitle: true}); - - function redrawObjs(objArray, method, shortCircuit) { - for(i = 0; i < objArray.length; i++) { - var obji = objArray[i]; - - if((activeAxIds.indexOf(obji.xref) !== -1) || - (activeAxIds.indexOf(obji.yref) !== -1)) { - method(gd, i); - } - - // once is enough for images (which doesn't use the `i` arg anyway) - if(shortCircuit) return; - } - } - redrawObjs(fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); - redrawObjs(fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); - redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); + // special case for redraw:false Plotly.animate that relies on this + // to update axis-referenced layout components + if(edits.length === 0) { + Axes.redrawComponents(gd); + return; } function unsetSubplotTransform(subplot) { - var xa2 = subplot.xaxis; - var ya2 = subplot.yaxis; + var xa = subplot.xaxis; + var ya = 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.setTranslate, xa._offset, ya._offset) .call(Drawing.setScale, 1, 1); var traceGroups = subplot.plot.selectAll('.scatterlayer .trace'); @@ -152204,79 +152441,71 @@ .call(Drawing.hideOutsideRangePoints, subplot); } - function updateSubplot(subplot, progress) { - var axis, r0, r1; - var xUpdate = updates[subplot.xaxis._id]; - var yUpdate = updates[subplot.yaxis._id]; - - var viewBox = []; + function updateSubplot(edit, progress) { + var plotinfo = edit.plotinfo; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - if(xUpdate) { - axis = gd._fullLayout[xUpdate.axisName]; - r0 = axis._r; - r1 = xUpdate.to; - viewBox[0] = (r0[0] * (1 - progress) + progress * r1[0] - r0[0]) / (r0[1] - r0[0]) * subplot.xaxis._length; - var dx1 = r0[1] - r0[0]; - var dx2 = r1[1] - r1[0]; + var xr0 = edit.xr0; + var xr1 = edit.xr1; + var xlen = xa._length; + var yr0 = edit.yr0; + var yr1 = edit.yr1; + var ylen = ya._length; - axis.range[0] = r0[0] * (1 - progress) + progress * r1[0]; - axis.range[1] = r0[1] * (1 - progress) + progress * r1[1]; + var editX = !!xr1; + var editY = !!yr1; + var viewBox = []; - viewBox[2] = subplot.xaxis._length * ((1 - progress) + progress * dx2 / dx1); + if(editX) { + 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); + xa.range[0] = xr0[0] * (1 - progress) + progress * xr1[0]; + xa.range[1] = xr0[1] * (1 - progress) + progress * xr1[1]; } else { viewBox[0] = 0; - viewBox[2] = subplot.xaxis._length; + viewBox[2] = xlen; } - if(yUpdate) { - axis = gd._fullLayout[yUpdate.axisName]; - r0 = axis._r; - r1 = yUpdate.to; - viewBox[1] = (r0[1] * (1 - progress) + progress * r1[1] - r0[1]) / (r0[0] - r0[1]) * subplot.yaxis._length; - var dy1 = r0[1] - r0[0]; - var dy2 = r1[1] - r1[0]; - - axis.range[0] = r0[0] * (1 - progress) + progress * r1[0]; - axis.range[1] = r0[1] * (1 - progress) + progress * r1[1]; - - viewBox[3] = subplot.yaxis._length * ((1 - progress) + progress * dy2 / dy1); + if(editY) { + 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); + ya.range[0] = yr0[0] * (1 - progress) + progress * yr1[0]; + ya.range[1] = yr0[1] * (1 - progress) + progress * yr1[1]; } else { viewBox[1] = 0; - viewBox[3] = subplot.yaxis._length; + viewBox[3] = ylen; } - ticksAndAnnotations(subplot.xaxis, subplot.yaxis); - - var xa2 = subplot.xaxis; - var ya2 = subplot.yaxis; - - var editX = !!xUpdate; - var editY = !!yUpdate; - - var xScaleFactor = editX ? xa2._length / viewBox[2] : 1, - yScaleFactor = editY ? ya2._length / viewBox[3] : 1; - - var clipDx = editX ? viewBox[0] : 0, - clipDy = editY ? viewBox[1] : 0; - - var fracDx = editX ? (viewBox[0] / viewBox[2] * xa2._length) : 0, - fracDy = editY ? (viewBox[1] / viewBox[3] * ya2._length) : 0; + Axes.drawOne(gd, xa, {skipTitle: true}); + Axes.drawOne(gd, ya, {skipTitle: true}); + Axes.redrawComponents(gd, [xa._id, ya._id]); - var plotDx = xa2._offset - fracDx, - plotDy = ya2._offset - fracDy; + 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 = xa._offset - fracDx; + var plotDy = ya._offset - fracDy; - subplot.clipRect + plotinfo.clipRect .call(Drawing.setTranslate, clipDx, clipDy) .call(Drawing.setScale, 1 / xScaleFactor, 1 / yScaleFactor); - subplot.plot + plotinfo.plot .call(Drawing.setTranslate, plotDx, plotDy) .call(Drawing.setScale, xScaleFactor, yScaleFactor); // apply an inverse scale to individual points to counteract // the scale of the trace group. - Drawing.setPointGroupScale(subplot.zoomScalePts, 1 / xScaleFactor, 1 / yScaleFactor); - Drawing.setTextPointsScale(subplot.zoomScaleTxt, 1 / xScaleFactor, 1 / yScaleFactor); + Drawing.setPointGroupScale(plotinfo.zoomScalePts, 1 / xScaleFactor, 1 / yScaleFactor); + Drawing.setTextPointsScale(plotinfo.zoomScaleTxt, 1 / xScaleFactor, 1 / yScaleFactor); } var onComplete; @@ -152288,38 +152517,35 @@ function transitionComplete() { var aobj = {}; - for(var i = 0; i < updatedAxisIds.length; i++) { - var axi = gd._fullLayout[updates[updatedAxisIds[i]].axisName]; - var to = updates[updatedAxisIds[i]].to; - aobj[axi._name + '.range[0]'] = to[0]; - aobj[axi._name + '.range[1]'] = to[1]; - axi.range = to.slice(); + for(var i = 0; i < edits.length; i++) { + var edit = edits[i]; + if(edit.xr1) aobj[edit.plotinfo.xaxis._name + '.range'] = edit.xr1.slice(); + if(edit.yr1) aobj[edit.plotinfo.yaxis._name + '.range'] = edit.yr1.slice(); } // Signal that this transition has completed: onComplete && onComplete(); return Registry.call('relayout', gd, aobj).then(function() { - for(var i = 0; i < affectedSubplots.length; i++) { - unsetSubplotTransform(affectedSubplots[i]); + for(var i = 0; i < edits.length; i++) { + unsetSubplotTransform(edits[i].plotinfo); } }); } function transitionInterrupt() { var aobj = {}; - for(var i = 0; i < updatedAxisIds.length; i++) { - var axi = gd._fullLayout[updatedAxisIds[i] + 'axis']; - aobj[axi._name + '.range[0]'] = axi.range[0]; - aobj[axi._name + '.range[1]'] = axi.range[1]; - axi.range = axi._r.slice(); + for(var i = 0; i < edits.length; i++) { + var edit = edits[i]; + if(edit.xr0) aobj[edit.plotinfo.xaxis._name + '.range'] = edit.xr0.slice(); + if(edit.yr0) aobj[edit.plotinfo.yaxis._name + '.range'] = edit.yr0.slice(); } return Registry.call('relayout', gd, aobj).then(function() { - for(var i = 0; i < affectedSubplots.length; i++) { - unsetSubplotTransform(affectedSubplots[i]); + for(var i = 0; i < edits.length; i++) { + unsetSubplotTransform(edits[i].plotinfo); } }); } @@ -152339,8 +152565,8 @@ var tInterp = Math.min(1, (t2 - t1) / transitionOpts.duration); var progress = easeFn(tInterp); - for(var i = 0; i < affectedSubplots.length; i++) { - updateSubplot(affectedSubplots[i], progress); + for(var i = 0; i < edits.length; i++) { + updateSubplot(edits[i], progress); } if(t2 - t1 > transitionOpts.duration) { @@ -152357,9 +152583,9 @@ return Promise.resolve(); }; -},{"../../components/drawing":590,"../../registry":823,"./axes":740,"./constants":746,"d3":148}],764:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../registry":825,"./axes":742,"d3":149}],766:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152495,9 +152721,9 @@ ); } -},{"../../registry":823,"./axis_autotype":741}],765:[function(_dereq_,module,exports){ +},{"../../registry":825,"./axis_autotype":743}],767:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -152919,9 +153145,9 @@ }); } -},{"../lib":692,"../registry":823}],766:[function(_dereq_,module,exports){ +},{"../lib":694,"../registry":825}],768:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153027,9 +153253,9 @@ coerce('domain.y', dfltY); }; -},{"../lib/extend":682}],767:[function(_dereq_,module,exports){ +},{"../lib/extend":684}],769:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153092,9 +153318,9 @@ return attrs; }; -},{}],768:[function(_dereq_,module,exports){ +},{}],770:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153138,9 +153364,9 @@ } }; -},{}],769:[function(_dereq_,module,exports){ +},{}],771:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153313,9 +153539,9 @@ frame: 'frame' }; -},{}],770:[function(_dereq_,module,exports){ +},{}],772:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -153736,6 +153962,9 @@ bgRect.node().onmousedown = null; bgRect.call(createGeoZoom(_this, geoLayout)); bgRect.on('dblclick.zoom', zoomReset); + if(!gd._context._scrollZoom.geo) { + bgRect.on('wheel.zoom', null); + } } else if(dragMode === 'select' || dragMode === 'lasso') { bgRect.on('.zoom', null); @@ -154023,9 +154252,9 @@ }; } -},{"../../components/color":569,"../../components/dragelement":587,"../../components/drawing":590,"../../components/fx":608,"../../lib":692,"../../lib/topojson_utils":719,"../../registry":823,"../cartesian/axes":740,"../cartesian/select":758,"../plots":804,"./constants":769,"./projections":775,"./zoom":776,"d3":148,"topojson-client":516}],771:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/dragelement":589,"../../components/drawing":592,"../../components/fx":610,"../../lib":694,"../../lib/topojson_utils":721,"../../registry":825,"../cartesian/axes":742,"../cartesian/select":760,"../plots":806,"./constants":771,"./projections":777,"./zoom":778,"d3":149,"topojson-client":518}],773:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -154115,9 +154344,9 @@ } }; -},{"../../lib":692,"../../plots/get_data":777,"./geo":770,"./layout/attributes":772,"./layout/defaults":773,"./layout/layout_attributes":774}],772:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/get_data":779,"./geo":772,"./layout/attributes":774,"./layout/defaults":775,"./layout/layout_attributes":776}],774:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -154137,9 +154366,9 @@ } }; -},{}],773:[function(_dereq_,module,exports){ +},{}],775:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -154301,9 +154530,9 @@ coerce('bgcolor'); } -},{"../../subplot_defaults":818,"../constants":769,"./layout_attributes":774}],774:[function(_dereq_,module,exports){ +},{"../../subplot_defaults":820,"../constants":771,"./layout_attributes":776}],776:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -154576,9 +154805,9 @@ }; -},{"../../../components/color/attributes":568,"../../../plot_api/edit_types":723,"../../domain":766,"../constants":769}],775:[function(_dereq_,module,exports){ +},{"../../../components/color/attributes":570,"../../../plot_api/edit_types":725,"../../domain":768,"../constants":771}],777:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -154658,7 +154887,7 @@ d3_geo_projectPoints.push([ x, y ]); }, lineEnd: function() { - if (d3_geo_projectPoints.length) d3_geo_projectLines.push(d3_geo_projectPoints), + if (d3_geo_projectPoints.length) d3_geo_projectLines.push(d3_geo_projectPoints), d3_geo_projectPoints = []; }, result: function() { @@ -154785,7 +155014,7 @@ }; var projection = d3.geo.projection(forward), stream_ = projection.stream; projection.stream = function(stream) { - var rotate = projection.rotate(), rotateStream = stream_(stream), sphereStream = (projection.rotate([ 0, 0 ]), + var rotate = projection.rotate(), rotateStream = stream_(stream), sphereStream = (projection.rotate([ 0, 0 ]), stream_(stream)); projection.rotate(rotate); rotateStream.sphere = function() { @@ -155022,9 +155251,9 @@ module.exports = addProjectionsToD3; -},{}],776:[function(_dereq_,module,exports){ +},{}],778:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -155078,11 +155307,14 @@ var fullLayout = gd._fullLayout; var fullOpts = fullLayout[id]; + var preGUI = {}; var eventData = {}; function set(propStr, val) { - var fullNp = Lib.nestedProperty(fullOpts, propStr); + preGUI[id + '.' + propStr] = Lib.nestedProperty(userOpts, propStr).get(); + Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, preGUI); + var fullNp = Lib.nestedProperty(fullOpts, propStr); if(fullNp.get() !== val) { fullNp.set(val); Lib.nestedProperty(userOpts, propStr).set(val); @@ -155092,7 +155324,6 @@ cb(set); set('projection.scale', projection.scale() / geo.fitScale); - Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, eventData); gd.emit('plotly_relayout', eventData); } @@ -155215,22 +155446,22 @@ // zoom for clipped projections // inspired by https://www.jasondavies.com/maps/d3.geo.zoom.js function zoomClipped(geo, projection) { - var view = {r: projection.rotate(), k: projection.scale()}, - zoom = initZoom(geo, projection), - event = d3_eventDispatch(zoom, 'zoomstart', 'zoom', 'zoomend'), - zooming = 0, - zoomOn = zoom.on; + var view = {r: projection.rotate(), k: projection.scale()}; + var zoom = initZoom(geo, projection); + var event = d3eventDispatch(zoom, 'zoomstart', 'zoom', 'zoomend'); + var zooming = 0; + var zoomOn = zoom.on; var zoomPoint; zoom.on('zoomstart', function() { d3.select(this).style(zoomstartStyle); - var mouse0 = d3.mouse(this), - rotate0 = projection.rotate(), - lastRotate = rotate0, - translate0 = projection.translate(), - q = quaternionFromEuler(rotate0); + var mouse0 = d3.mouse(this); + var rotate0 = projection.rotate(); + var lastRotate = rotate0; + var translate0 = projection.translate(); + var q = quaternionFromEuler(rotate0); zoomPoint = position(projection, mouse0); @@ -155257,10 +155488,10 @@ .translate(translate0); // calculate the new params - var point1 = position(projection, mouse1), - between = rotateBetween(zoomPoint, point1), - newEuler = eulerFromQuaternion(multiply(q, between)), - rotateAngles = view.r = unRoll(newEuler, zoomPoint, lastRotate); + var point1 = position(projection, mouse1); + var between = rotateBetween(zoomPoint, point1); + var newEuler = eulerFromQuaternion(multiply(q, between)); + var rotateAngles = view.r = unRoll(newEuler, zoomPoint, lastRotate); if(!isFinite(rotateAngles[0]) || !isFinite(rotateAngles[1]) || !isFinite(rotateAngles[2])) { @@ -155316,12 +155547,15 @@ } function quaternionFromEuler(euler) { - var lambda = 0.5 * euler[0] * radians, - phi = 0.5 * euler[1] * radians, - gamma = 0.5 * euler[2] * radians, - sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda), - sinPhi = Math.sin(phi), cosPhi = Math.cos(phi), - sinGamma = Math.sin(gamma), cosGamma = Math.cos(gamma); + var lambda = 0.5 * euler[0] * radians; + var phi = 0.5 * euler[1] * radians; + var gamma = 0.5 * euler[2] * radians; + var sinLambda = Math.sin(lambda); + var cosLambda = Math.cos(lambda); + var sinPhi = Math.sin(phi); + var cosPhi = Math.cos(phi); + var sinGamma = Math.sin(gamma); + var cosGamma = Math.cos(gamma); return [ cosLambda * cosPhi * cosGamma + sinLambda * sinPhi * sinGamma, sinLambda * cosPhi * cosGamma - cosLambda * sinPhi * sinGamma, @@ -155331,8 +155565,14 @@ } function multiply(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; return [ a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3, a0 * b1 + a1 * b0 + a2 * b3 - a3 * b2, @@ -155343,10 +155583,10 @@ function rotateBetween(a, b) { if(!a || !b) return; - var axis = cross(a, b), - norm = Math.sqrt(dot(axis, axis)), - halfgamma = 0.5 * Math.acos(Math.max(-1, Math.min(1, dot(a, b)))), - k = Math.sin(halfgamma) / norm; + var axis = cross(a, b); + var norm = Math.sqrt(dot(axis, axis)); + var halfgamma = 0.5 * Math.acos(Math.max(-1, Math.min(1, dot(a, b)))); + var k = Math.sin(halfgamma) / norm; return norm && [Math.cos(halfgamma), axis[2] * k, -axis[1] * k, axis[0] * k]; } @@ -155366,20 +155606,20 @@ ptRotated = rotateCartesian(ptRotated, 1, rotateAngles[1]); ptRotated = rotateCartesian(ptRotated, 0, rotateAngles[2] - lastRotate[2]); - var x = pt[0], - y = pt[1], - z = pt[2], - f = ptRotated[0], - g = ptRotated[1], - h = ptRotated[2], - - // the following essentially solves: - // ptRotated = rotateCartesian(rotateCartesian(pt, 2, newYaw), 1, newPitch) - // for newYaw and newPitch, as best it can - theta = Math.atan2(y, x) * degrees, - a = Math.sqrt(x * x + y * y), - b, - newYaw1; + var x = pt[0]; + var y = pt[1]; + var z = pt[2]; + var f = ptRotated[0]; + var g = ptRotated[1]; + var h = ptRotated[2]; + + // the following essentially solves: + // ptRotated = rotateCartesian(rotateCartesian(pt, 2, newYaw), 1, newPitch) + // for newYaw and newPitch, as best it can + var theta = Math.atan2(y, x) * degrees; + var a = Math.sqrt(x * x + y * y); + var b; + var newYaw1; if(Math.abs(g) > a) { newYaw1 = (g > 0 ? 90 : -90) - theta; @@ -155389,21 +155629,21 @@ b = Math.sqrt(a * a - g * g); } - var newYaw2 = 180 - newYaw1 - 2 * theta, - newPitch1 = (Math.atan2(h, f) - Math.atan2(z, b)) * degrees, - newPitch2 = (Math.atan2(h, f) - Math.atan2(z, -b)) * degrees; + var newYaw2 = 180 - newYaw1 - 2 * theta; + var newPitch1 = (Math.atan2(h, f) - Math.atan2(z, b)) * degrees; + var newPitch2 = (Math.atan2(h, f) - Math.atan2(z, -b)) * degrees; // which is closest to lastRotate[0,1]: newYaw/Pitch or newYaw2/Pitch2? - var dist1 = angleDistance(lastRotate[0], lastRotate[1], newYaw1, newPitch1), - dist2 = angleDistance(lastRotate[0], lastRotate[1], newYaw2, newPitch2); + var dist1 = angleDistance(lastRotate[0], lastRotate[1], newYaw1, newPitch1); + var dist2 = angleDistance(lastRotate[0], lastRotate[1], newYaw2, newPitch2); if(dist1 <= dist2) return [newYaw1, newPitch1, lastRotate[2]]; else return [newYaw2, newPitch2, lastRotate[2]]; } function angleDistance(yaw0, pitch0, yaw1, pitch1) { - var dYaw = angleMod(yaw1 - yaw0), - dPitch = angleMod(pitch1 - pitch0); + var dYaw = angleMod(yaw1 - yaw0); + var dPitch = angleMod(pitch1 - pitch0); return Math.sqrt(dYaw * dYaw + dPitch * dPitch); } @@ -155416,12 +155656,12 @@ // axis is 0 (x), 1 (y), or 2 (z) // angle is in degrees function rotateCartesian(vector, axis, angle) { - var angleRads = angle * radians, - vectorOut = vector.slice(), - ax1 = (axis === 0) ? 1 : 0, - ax2 = (axis === 2) ? 1 : 2, - cosa = Math.cos(angleRads), - sina = Math.sin(angleRads); + var angleRads = angle * radians; + var vectorOut = vector.slice(); + var ax1 = (axis === 0) ? 1 : 0; + var ax2 = (axis === 2) ? 1 : 2; + var cosa = Math.cos(angleRads); + var sina = Math.sin(angleRads); vectorOut[ax1] = vector[ax1] * cosa - vector[ax2] * sina; vectorOut[ax2] = vector[ax2] * cosa + vector[ax1] * sina; @@ -155437,9 +155677,9 @@ } function cartesian(spherical) { - var lambda = spherical[0] * radians, - phi = spherical[1] * radians, - cosPhi = Math.cos(phi); + var lambda = spherical[0] * radians; + var phi = spherical[1] * radians; + var cosPhi = Math.cos(phi); return [ cosPhi * Math.cos(lambda), cosPhi * Math.sin(lambda), @@ -155465,10 +155705,10 @@ // events have a target component (such as a brush), a target element (such as // the svg:g element containing the brush) and the standard arguments `d` (the // target element's data) and `i` (the selection index of the target element). -function d3_eventDispatch(target) { - var i = 0, - n = arguments.length, - argumentz = []; +function d3eventDispatch(target) { + var i = 0; + var n = arguments.length; + var argumentz = []; while(++i < n) argumentz.push(arguments[i]); @@ -155500,9 +155740,9 @@ return dispatch; } -},{"../../lib":692,"../../registry":823,"d3":148}],777:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"d3":149}],779:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -155628,9 +155868,9 @@ return subplotData; }; -},{"../registry":823,"./cartesian/constants":746}],778:[function(_dereq_,module,exports){ +},{"../registry":825,"./cartesian/constants":748}],780:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -155664,9 +155904,9 @@ function createCamera(scene) { - var element = scene.mouseContainer, - plot = scene.glplot, - result = new Camera2D(element, plot); + var element = scene.mouseContainer; + var plot = scene.glplot; + var result = new Camera2D(element, plot); function unSetAutoRange() { scene.xaxis.autorange = false; @@ -155712,11 +155952,11 @@ }, hasPassive ? {passive: false} : false); function handleInteraction(buttons, x, y) { - var dataBox = scene.calcDataBox(), - viewBox = plot.viewBox; + var dataBox = scene.calcDataBox(); + var viewBox = plot.viewBox; - var lastX = result.lastPos[0], - lastY = result.lastPos[1]; + var lastX = result.lastPos[0]; + var lastY = result.lastPos[1]; var MINDRAG = cartesianConstants.MINDRAG * plot.pixelRatio; var MINZOOM = cartesianConstants.MINZOOM * plot.pixelRatio; @@ -155730,8 +155970,8 @@ y = (viewBox[3] - viewBox[1]) - y; function updateRange(i0, start, end) { - var range0 = Math.min(start, end), - range1 = Math.max(start, end); + var range0 = Math.min(start, end); + var range1 = Math.max(start, end); if(range0 !== range1) { dataBox[i0] = range0; @@ -155896,11 +156136,11 @@ result.wheelListener = mouseWheel(element, function(dx, dy) { if(!scene.scrollZoom) return false; - var dataBox = scene.calcDataBox(), - viewBox = plot.viewBox; + var dataBox = scene.calcDataBox(); + var viewBox = plot.viewBox; - var lastX = result.lastPos[0], - lastY = result.lastPos[1]; + var lastX = result.lastPos[0]; + var lastY = result.lastPos[1]; var scale = Math.exp(5.0 * dy / (viewBox[3] - viewBox[1])); @@ -155930,9 +156170,9 @@ return result; } -},{"../cartesian/constants":746,"has-passive-events":394,"mouse-change":418,"mouse-event-offset":419,"mouse-wheel":421}],779:[function(_dereq_,module,exports){ +},{"../cartesian/constants":748,"has-passive-events":397,"mouse-change":421,"mouse-event-offset":422,"mouse-wheel":424}],781:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -156140,9 +156380,9 @@ }; proto.getLabelPad = function(axisName, ax) { - var offsetBase = 1.5, - fontSize = ax.title.font.size, - showticklabels = ax.showticklabels; + var offsetBase = 1.5; + var fontSize = ax.title.font.size; + var showticklabels = ax.showticklabels; if(axisName === 'xaxis') { return (ax.side === 'top') ? @@ -156175,9 +156415,9 @@ module.exports = createAxes2D; -},{"../../lib/str2rgbarray":715,"../cartesian/axes":740}],780:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":717,"../cartesian/axes":742}],782:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -156236,9 +156476,9 @@ var subplotIds = fullLayout._subplots.gl2d; for(var i = 0; i < subplotIds.length; i++) { - var subplotId = subplotIds[i], - subplotObj = fullLayout._plots[subplotId], - fullSubplotData = getSubplotData(fullData, 'gl2d', subplotId); + var subplotId = subplotIds[i]; + var subplotObj = fullLayout._plots[subplotId]; + var fullSubplotData = getSubplotData(fullData, 'gl2d', subplotId); // ref. to corresp. Scene instance var scene = subplotObj._scene2d; @@ -156267,8 +156507,8 @@ var oldSceneKeys = oldFullLayout._subplots.gl2d || []; for(var i = 0; i < oldSceneKeys.length; i++) { - var id = oldSceneKeys[i], - oldSubplot = oldFullLayout._plots[id]; + var id = oldSceneKeys[i]; + var oldSubplot = oldFullLayout._plots[id]; // old subplot wasn't gl2d; nothing to do if(!oldSubplot._scene2d) continue; @@ -156296,8 +156536,8 @@ var subplotIds = fullLayout._subplots.gl2d; for(var i = 0; i < subplotIds.length; i++) { - var subplot = fullLayout._plots[subplotIds[i]], - scene = subplot._scene2d; + var subplot = fullLayout._plots[subplotIds[i]]; + var scene = subplot._scene2d; var imageData = scene.toImage('png'); var image = fullLayout._glimages.append('svg:image'); @@ -156326,9 +156566,9 @@ } }; -},{"../../components/fx/layout_attributes":609,"../../constants/xmlns_namespaces":670,"../../plot_api/edit_types":723,"../cartesian":752,"../cartesian/attributes":738,"../cartesian/constants":746,"../get_data":777,"../layout_attributes":795,"./scene2d":781}],781:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":611,"../../constants/xmlns_namespaces":672,"../../plot_api/edit_types":725,"../cartesian":754,"../cartesian/attributes":740,"../cartesian/constants":748,"../get_data":779,"../layout_attributes":797,"./scene2d":783}],783:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -156367,7 +156607,7 @@ this.pixelRatio = options.plotGlPixelRatio || window.devicePixelRatio; this.id = options.id; this.staticPlot = !!options.staticPlot; - this.scrollZoom = this.graphDiv._context.scrollZoom; + this.scrollZoom = this.graphDiv._context._scrollZoom.cartesian; this.fullData = null; this.updateRefs(fullLayout); @@ -156522,9 +156762,9 @@ // grab context and yank out pixels - var gl = this.glplot.gl, - w = gl.drawingBufferWidth, - h = gl.drawingBufferHeight; + var gl = this.glplot.gl; + var w = gl.drawingBufferWidth; + var h = gl.drawingBufferHeight; // force redraw gl.clearColor(1, 1, 1, 0); @@ -156578,13 +156818,13 @@ proto.updateSize = function(canvas) { if(!canvas) canvas = this.canvas; - var pixelRatio = this.pixelRatio, - fullLayout = this.fullLayout; + var pixelRatio = this.pixelRatio; + var fullLayout = this.fullLayout; - var width = fullLayout.width, - height = fullLayout.height, - pixelWidth = Math.ceil(pixelRatio * width) |0, - pixelHeight = Math.ceil(pixelRatio * height) |0; + var width = fullLayout.width; + var height = fullLayout.height; + var pixelWidth = Math.ceil(pixelRatio * width) |0; + var pixelHeight = Math.ceil(pixelRatio * height) |0; // check for resize if(canvas.width !== pixelWidth || canvas.height !== pixelHeight) { @@ -156616,8 +156856,8 @@ function compareTicks(a, b) { for(var i = 0; i < 2; ++i) { - var aticks = a[i], - bticks = b[i]; + var aticks = a[i]; + var bticks = b[i]; if(aticks.length !== bticks.length) return true; @@ -156686,8 +156926,8 @@ }; proto.handleAnnotations = function() { - var gd = this.graphDiv, - annotations = this.fullLayout.annotations; + var gd = this.graphDiv; + var annotations = this.fullLayout.annotations; for(var i = 0; i < annotations.length; i++) { var ann = annotations[i]; @@ -156732,8 +156972,8 @@ this.updateTraces(fullData, calcData); this.updateFx(fullLayout.dragmode); - var width = fullLayout.width, - height = fullLayout.height; + var width = fullLayout.width; + var height = fullLayout.height; this.updateSize(this.canvas); @@ -156750,9 +156990,9 @@ cleanAxisConstraints(mockGraphDiv, this.xaxis); cleanAxisConstraints(mockGraphDiv, this.yaxis); - var size = fullLayout._size, - domainX = this.xaxis.domain, - domainY = this.yaxis.domain; + var size = fullLayout._size; + var domainX = this.xaxis.domain; + var domainY = this.yaxis.domain; options.viewBox = [ size.l + domainX[0] * size.w, @@ -156791,21 +157031,21 @@ }; proto.calcDataBox = function() { - var xaxis = this.xaxis, - yaxis = this.yaxis, - xrange = xaxis.range, - yrange = yaxis.range, - xr2l = xaxis.r2l, - yr2l = yaxis.r2l; + var xaxis = this.xaxis; + var yaxis = this.yaxis; + var xrange = xaxis.range; + var yrange = yaxis.range; + var xr2l = xaxis.r2l; + var yr2l = yaxis.r2l; return [xr2l(xrange[0]), yr2l(yrange[0]), xr2l(xrange[1]), yr2l(yrange[1])]; }; proto.setRanges = function(dataBox) { - var xaxis = this.xaxis, - yaxis = this.yaxis, - xl2r = xaxis.l2r, - yl2r = yaxis.l2r; + var xaxis = this.xaxis; + var yaxis = this.yaxis; + var xl2r = xaxis.l2r; + var yl2r = yaxis.l2r; xaxis.range = [xl2r(dataBox[0]), xl2r(dataBox[2])]; yaxis.range = [yl2r(dataBox[1]), yl2r(dataBox[3])]; @@ -156818,16 +157058,16 @@ this.fullData = fullData; // remove empty traces - trace_id_loop: + traceIdLoop: for(i = 0; i < traceIds.length; i++) { - var oldUid = traceIds[i], - oldTrace = this.traces[oldUid]; + var oldUid = traceIds[i]; + var oldTrace = this.traces[oldUid]; for(j = 0; j < fullData.length; j++) { fullTrace = fullData[j]; if(fullTrace.uid === oldUid && fullTrace.type === oldTrace.type) { - continue trace_id_loop; + continue traceIdLoop; } } @@ -156838,8 +157078,8 @@ // update / create trace objects for(i = 0; i < fullData.length; i++) { fullTrace = fullData[i]; - var calcTrace = calcData[i], - traceObj = this.traces[fullTrace.uid]; + var calcTrace = calcData[i]; + var traceObj = this.traces[fullTrace.uid]; if(traceObj) traceObj.update(fullTrace, calcTrace); else { @@ -156908,11 +157148,11 @@ requestAnimationFrame(this.redraw); - var glplot = this.glplot, - camera = this.camera, - mouseListener = camera.mouseListener, - mouseUp = this.lastButtonState === 1 && mouseListener.buttons === 0, - fullLayout = this.fullLayout; + var glplot = this.glplot; + var camera = this.camera; + var mouseListener = camera.mouseListener; + var mouseUp = this.lastButtonState === 1 && mouseListener.buttons === 0; + var fullLayout = this.fullLayout; this.lastButtonState = mouseListener.buttons; @@ -156946,9 +157186,9 @@ else if(!camera.panning && this.isMouseOver) { this.selectBox.enabled = false; - var size = fullLayout._size, - domainX = this.xaxis.domain, - domainY = this.yaxis.domain; + var size = fullLayout._size; + var domainX = this.xaxis.domain; + var domainY = this.yaxis.domain; result = glplot.pick( (x / glplot.pixelRatio) + size.l + domainX[0] * size.w, @@ -157051,9 +157291,9 @@ return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/fx":608,"../../lib/show_no_webgl_msg":713,"../../plots/cartesian/axes":740,"../../registry":823,"../cartesian/autorange":739,"../cartesian/constants":746,"../cartesian/constraints":748,"./camera":778,"./convert":779,"gl-plot2d":275,"gl-select-box":286,"gl-spikes2d":295,"webgl-context":532}],782:[function(_dereq_,module,exports){ +},{"../../components/fx":610,"../../lib/show_no_webgl_msg":715,"../../plots/cartesian/axes":742,"../../registry":825,"../cartesian/autorange":741,"../cartesian/constants":748,"../cartesian/constraints":750,"./camera":780,"./convert":781,"gl-plot2d":277,"gl-select-box":288,"gl-spikes2d":297,"webgl-context":534}],784:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157102,6 +157342,7 @@ var camera = { keyBindingMode: 'rotate', + enableWheel: true, view: view, element: element, delay: options.delay || 16, @@ -157235,7 +157476,9 @@ return false; }); - var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}; + var lastX = 0; + var lastY = 0; + var lastMods = {shift: false, control: false, alt: false, meta: false}; camera.mouseListener = mouseChange(element, handleInteraction); // enable simple touch interactions @@ -157309,7 +157552,9 @@ } camera.wheelListener = mouseWheel(element, function(dx, dy) { + // TODO remove now that we can disable scroll via scrollZoom? if(camera.keyBindingMode === false) return; + if(!camera.enableWheel) return; var flipX = camera.flipX ? 1 : -1; var flipY = camera.flipY ? 1 : -1; @@ -157325,9 +157570,9 @@ return camera; } -},{"3d-view":45,"has-passive-events":394,"mouse-change":418,"mouse-event-offset":419,"mouse-wheel":421,"right-now":480}],783:[function(_dereq_,module,exports){ +},{"3d-view":46,"has-passive-events":397,"mouse-change":421,"mouse-event-offset":422,"mouse-wheel":424,"right-now":482}],785:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157373,10 +157618,10 @@ var sceneIds = fullLayout._subplots[GL3D]; for(var i = 0; i < sceneIds.length; i++) { - var sceneId = sceneIds[i], - fullSceneData = getSubplotData(fullData, GL3D, sceneId), - sceneLayout = fullLayout[sceneId], - scene = sceneLayout._scene; + var sceneId = sceneIds[i]; + var fullSceneData = getSubplotData(fullData, GL3D, sceneId); + var sceneLayout = fullLayout[sceneId]; + var scene = sceneLayout._scene; if(!scene) { scene = new Scene({ @@ -157467,9 +157712,9 @@ } }; -},{"../../components/fx/layout_attributes":609,"../../constants/xmlns_namespaces":670,"../../lib":692,"../../plot_api/edit_types":723,"../get_data":777,"./layout/attributes":784,"./layout/defaults":788,"./layout/layout_attributes":789,"./scene":793}],784:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":611,"../../constants/xmlns_namespaces":672,"../../lib":694,"../../plot_api/edit_types":725,"../get_data":779,"./layout/attributes":786,"./layout/defaults":790,"./layout/layout_attributes":791,"./scene":795}],786:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157489,9 +157734,9 @@ } }; -},{}],785:[function(_dereq_,module,exports){ +},{}],787:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157559,7 +157804,13 @@ }), autorange: axesAttrs.autorange, rangemode: axesAttrs.rangemode, - range: axesAttrs.range, + range: extendFlat({}, axesAttrs.range, { + items: [ + {valType: 'any', editType: 'plot', impliedEdits: {'^autorange': false}}, + {valType: 'any', editType: 'plot', impliedEdits: {'^autorange': false}} + ], + anim: false + }), // ticks tickmode: axesAttrs.tickmode, nticks: axesAttrs.nticks, @@ -157602,9 +157853,9 @@ } }, 'plot', 'from-root'); -},{"../../../components/color":569,"../../../lib/extend":682,"../../../plot_api/edit_types":723,"../../cartesian/layout_attributes":753}],786:[function(_dereq_,module,exports){ +},{"../../../components/color":571,"../../../lib/extend":684,"../../../plot_api/edit_types":725,"../../cartesian/layout_attributes":755}],788:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157677,19 +157928,19 @@ } }; -},{"../../../lib":692,"../../../plot_api/plot_template":730,"../../cartesian/axis_defaults":742,"../../cartesian/type_defaults":764,"./axis_attributes":785,"tinycolor2":513}],787:[function(_dereq_,module,exports){ +},{"../../../lib":694,"../../../plot_api/plot_template":732,"../../cartesian/axis_defaults":744,"../../cartesian/type_defaults":766,"./axis_attributes":787,"tinycolor2":515}],789:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var str2RgbaArray = _dereq_('../../../lib/str2rgbarray'); +var Lib = _dereq_('../../../lib'); var AXES_NAMES = ['xaxis', 'yaxis', 'zaxis']; @@ -157746,7 +157997,7 @@ var proto = AxesOptions.prototype; -proto.merge = function(sceneLayout) { +proto.merge = function(fullLayout, sceneLayout) { var opts = this; for(var i = 0; i < 3; ++i) { var axes = sceneLayout[AXES_NAMES[i]]; @@ -157763,7 +158014,10 @@ } // Axes labels - opts.labels[i] = axes.title.text; + opts.labels[i] = fullLayout.meta ? + Lib.templateString(axes.title.text, {meta: fullLayout.meta}) : + axes.title.text; + if('font' in axes.title) { if(axes.title.font.color) opts.labelColor[i] = str2RgbaArray(axes.title.font.color); if(axes.title.font.family) opts.labelFont[i] = axes.title.font.family; @@ -157831,17 +158085,17 @@ }; -function createAxesOptions(plotlyOptions) { +function createAxesOptions(fullLayout, sceneLayout) { var result = new AxesOptions(); - result.merge(plotlyOptions); + result.merge(fullLayout, sceneLayout); return result; } module.exports = createAxesOptions; -},{"../../../lib/str2rgbarray":715}],788:[function(_dereq_,module,exports){ +},{"../../../lib":694,"../../../lib/str2rgbarray":717}],790:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -157900,8 +158154,8 @@ * attributes like aspectratio can be written back dynamically. */ - var bgcolor = coerce('bgcolor'), - bgColorCombined = Color.combine(bgcolor, opts.paper_bgcolor); + var bgcolor = coerce('bgcolor'); + var bgColorCombined = Color.combine(bgcolor, opts.paper_bgcolor); var cameraKeys = ['up', 'center', 'eye']; @@ -157970,10 +158224,12 @@ var y = sceneLayoutIn.camera.up.y; var z = sceneLayoutIn.camera.up.z; - if(!x || !y || !z) { - dragmode = 'turntable'; - } else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) { - dragmode = 'turntable'; + if(z !== 0) { + if(!x || !y || !z) { + dragmode = 'turntable'; + } else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) { + dragmode = 'turntable'; + } } } else { dragmode = 'turntable'; @@ -157985,9 +158241,9 @@ coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":569,"../../../lib":692,"../../../registry":823,"../../get_data":777,"../../subplot_defaults":818,"./axis_defaults":786,"./layout_attributes":789}],789:[function(_dereq_,module,exports){ +},{"../../../components/color":571,"../../../lib":694,"../../../registry":825,"../../get_data":779,"../../subplot_defaults":820,"./axis_defaults":788,"./layout_attributes":791}],791:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -158125,9 +158381,9 @@ } }; -},{"../../../lib":692,"../../../lib/extend":682,"../../domain":766,"./axis_attributes":785}],790:[function(_dereq_,module,exports){ +},{"../../../lib":694,"../../../lib/extend":684,"../../domain":768,"./axis_attributes":787}],792:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -158177,9 +158433,9 @@ module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":715}],791:[function(_dereq_,module,exports){ +},{"../../../lib/str2rgbarray":717}],793:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -158278,9 +158534,9 @@ scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":692,"../../cartesian/axes":740}],792:[function(_dereq_,module,exports){ +},{"../../../lib":694,"../../cartesian/axes":742}],794:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -158312,9 +158568,9 @@ module.exports = project; -},{}],793:[function(_dereq_,module,exports){ +},{}],795:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -158352,7 +158608,8 @@ // update size of svg container var svgContainer = scene.svgContainer; var clientRect = scene.container.getBoundingClientRect(); - var width = clientRect.width, height = clientRect.height; + var width = clientRect.width; + var height = clientRect.height; svgContainer.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); svgContainer.setAttributeNS(null, 'width', width); svgContainer.setAttributeNS(null, 'height', height); @@ -158402,9 +158659,9 @@ } var tx; + var vectorTx = []; if(trace.type === 'cone' || trace.type === 'streamtube') { - var vectorTx = []; if(isHoverinfoAll || hoverinfoParts.indexOf('u') !== -1) { vectorTx.push('u: ' + formatter('xaxis', selection.traceCoordinate[3])); } @@ -158424,6 +158681,12 @@ vectorTx.push(selection.textLabel); } tx = vectorTx.join('
'); + } else if(trace.type === 'isosurface') { + vectorTx.push('value: ' + Axes.tickText(scene.mockAxis, scene.mockAxis.d2l(selection.traceCoordinate[3]), 'hover').text); + if(selection.textLabel) { + vectorTx.push(selection.textLabel); + } + tx = vectorTx.join('
'); } else { tx = selection.textLabel; } @@ -158541,8 +158804,15 @@ scene.graphDiv.emit('plotly_relayout', update); }; - scene.glplot.canvas.addEventListener('mouseup', relayoutCallback.bind(null, scene)); - scene.glplot.canvas.addEventListener('wheel', relayoutCallback.bind(null, scene), passiveSupported ? {passive: false} : false); + scene.glplot.canvas.addEventListener('mouseup', function() { + relayoutCallback(scene); + }); + + scene.glplot.canvas.addEventListener('wheel', function() { + if(gd._context._scrollZoom.gl3d) { + relayoutCallback(scene); + } + }, passiveSupported ? {passive: false} : false); if(!scene.staticMode) { scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { @@ -158578,6 +158848,8 @@ // List of scene objects scene.traces = {}; + scene.make4thDimension(); + return true; } @@ -158619,7 +158891,7 @@ /* * Move this to calc step? Why does it work here? */ - this.axesOptions = createAxesOptions(fullLayout[this.id]); + this.axesOptions = createAxesOptions(fullLayout, fullLayout[this.id]); this.spikeOptions = createSpikeOptions(fullLayout[this.id]); this.container = sceneContainer; this.staticMode = !!options.staticPlot; @@ -158699,7 +158971,6 @@ } proto.plot = function(sceneData, fullLayout, layout) { - // Save parameters this.plotArgs = [sceneData, fullLayout, layout]; @@ -158720,12 +158991,13 @@ this.fullSceneLayout = fullSceneLayout; this.glplotLayout = fullSceneLayout; - this.axesOptions.merge(fullSceneLayout); + this.axesOptions.merge(fullLayout, fullSceneLayout); this.spikeOptions.merge(fullSceneLayout); // Update camera and camera mode this.setCamera(fullSceneLayout.camera); this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode); + this.camera.enableWheel = this.graphDiv._context._scrollZoom.gl3d; // Update scene this.glplot.update({}); @@ -158789,11 +159061,11 @@ // Remove empty traces var traceIds = Object.keys(this.traces); - trace_id_loop: + traceIdLoop: for(i = 0; i < traceIds.length; ++i) { for(j = 0; j < sceneData.length; ++j) { if(sceneData[j].uid === traceIds[i] && sceneData[j].visible === true) { - continue trace_id_loop; + continue traceIdLoop; } } trace = this.traces[traceIds[i]]; @@ -158807,9 +159079,9 @@ }); // Update ranges (needs to be called *after* objects are added due to updates) - var sceneBounds = [[0, 0, 0], [0, 0, 0]], - axisDataRange = [], - axisTypeRatios = {}; + var sceneBounds = [[0, 0, 0], [0, 0, 0]]; + var axisDataRange = []; + var axisTypeRatios = {}; for(i = 0; i < 3; ++i) { axis = fullSceneLayout[axisProperties[i]]; @@ -158956,8 +159228,8 @@ // Update frame position for multi plots - var domain = fullSceneLayout.domain || null, - size = fullLayout._size || null; + var domain = fullSceneLayout.domain || null; + var size = fullLayout._size || null; if(domain && size) { var containerStyle = this.container.style; @@ -159016,19 +159288,21 @@ // save camera to user layout (i.e. gd.layout) proto.saveCamera = function saveCamera(layout) { + var fullLayout = this.fullLayout; var cameraData = this.getCamera(); var cameraNestedProp = Lib.nestedProperty(layout, this.id + '.camera'); var cameraDataLastSave = cameraNestedProp.get(); var hasChanged = false; function same(x, y, i, j) { - var vectors = ['up', 'center', 'eye'], - components = ['x', 'y', 'z']; + var vectors = ['up', 'center', 'eye']; + var components = ['x', 'y', 'z']; return y[vectors[i]] && (x[vectors[i]][components[j]] === y[vectors[i]][components[j]]); } - if(cameraDataLastSave === undefined) hasChanged = true; - else { + if(cameraDataLastSave === undefined) { + hasChanged = true; + } else { for(var i = 0; i < 3; i++) { for(var j = 0; j < 3; j++) { if(!same(cameraData, cameraDataLastSave, i, j)) { @@ -159040,12 +159314,14 @@ } if(hasChanged) { + var preGUI = {}; + preGUI[this.id + '.camera'] = cameraDataLastSave; + Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, preGUI); + cameraNestedProp.set(cameraData); - var fullLayout = this.fullLayout; var cameraFullNP = Lib.nestedProperty(fullLayout, this.id + '.camera'); cameraFullNP.set(cameraData); - Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, cameraData); } return hasChanged; @@ -159086,7 +159362,6 @@ fullCamera.up = zUp; Lib.nestedProperty(layout, attr).set(zUp); } else { - // none rotation modes [pan or zoom] camera.keyBindingMode = dragmode; } @@ -159159,11 +159434,26 @@ } }; +proto.make4thDimension = function() { + + var _this = this; + var gd = _this.graphDiv; + var fullLayout = gd._fullLayout; + + // mock axis for hover formatting + _this.mockAxis = { + type: 'linear', + showexponent: 'all', + exponentformat: 'B' + }; + Axes.setConvert(_this.mockAxis, fullLayout); +}; + module.exports = Scene; -},{"../../components/fx":608,"../../lib":692,"../../lib/show_no_webgl_msg":713,"../../lib/str2rgbarray":715,"../../plots/cartesian/axes":740,"../../registry":823,"./camera":782,"./layout/convert":787,"./layout/spikes":790,"./layout/tick_marks":791,"./project":792,"gl-plot3d":277,"has-passive-events":394,"webgl-context":532}],794:[function(_dereq_,module,exports){ +},{"../../components/fx":610,"../../lib":694,"../../lib/show_no_webgl_msg":715,"../../lib/str2rgbarray":717,"../../plots/cartesian/axes":742,"../../registry":825,"./camera":784,"./layout/convert":789,"./layout/spikes":792,"./layout/tick_marks":793,"./project":794,"gl-plot3d":279,"has-passive-events":397,"webgl-context":534}],796:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -159182,9 +159472,9 @@ return result; }; -},{}],795:[function(_dereq_,module,exports){ +},{}],797:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -159194,6 +159484,7 @@ 'use strict'; var fontAttrs = _dereq_('./font_attributes'); +var animationAttrs = _dereq_('./animation_attributes'); var colorAttrs = _dereq_('../components/color/attributes'); var colorscaleAttrs = _dereq_('../components/colorscale/layout_attributes'); var padAttrs = _dereq_('./pad_attributes'); @@ -159459,6 +159750,18 @@ }, editType: 'modebar' }, + + meta: { + valType: 'data_array', + editType: 'plot', + + }, + + transition: extendFlat({}, animationAttrs.transition, { + + editType: 'none' + }), + _deprecated: { title: { valType: 'string', @@ -159473,9 +159776,9 @@ } }; -},{"../components/color/attributes":568,"../components/colorscale/layout_attributes":582,"../lib/extend":682,"./font_attributes":767,"./pad_attributes":803}],796:[function(_dereq_,module,exports){ +},{"../components/color/attributes":570,"../components/colorscale/layout_attributes":584,"../lib/extend":684,"./animation_attributes":737,"./font_attributes":769,"./pad_attributes":805}],798:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -159516,9 +159819,9 @@ } }; -},{}],797:[function(_dereq_,module,exports){ +},{}],799:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -159542,17 +159845,17 @@ * - offset */ module.exports = function convertTextOpts(textposition, iconSize) { - var parts = textposition.split(' '), - vPos = parts[0], - hPos = parts[1]; + var parts = textposition.split(' '); + var vPos = parts[0]; + var hPos = parts[1]; // ballpack values - var factor = Lib.isArrayOrTypedArray(iconSize) ? Lib.mean(iconSize) : iconSize, - xInc = 0.5 + (factor / 100), - yInc = 1.5 + (factor / 100); + var factor = Lib.isArrayOrTypedArray(iconSize) ? Lib.mean(iconSize) : iconSize; + var xInc = 0.5 + (factor / 100); + var yInc = 1.5 + (factor / 100); - var anchorVals = ['', ''], - offset = [0, 0]; + var anchorVals = ['', '']; + var offset = [0, 0]; switch(vPos) { case 'top': @@ -159589,9 +159892,9 @@ return { anchor: anchor, offset: offset }; }; -},{"../../lib":692}],798:[function(_dereq_,module,exports){ +},{"../../lib":694}],800:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -159650,10 +159953,10 @@ mapboxgl.accessToken = accessToken; for(var i = 0; i < mapboxIds.length; i++) { - var id = mapboxIds[i], - subplotCalcData = getSubplotCalcData(calcData, MAPBOX, id), - opts = fullLayout[id], - mapbox = opts._subplot; + var id = mapboxIds[i]; + var subplotCalcData = getSubplotCalcData(calcData, MAPBOX, id); + var opts = fullLayout[id]; + var mapbox = opts._subplot; if(!mapbox) { mapbox = createMapbox({ @@ -159698,9 +160001,9 @@ var size = fullLayout._size; for(var i = 0; i < subplotIds.length; i++) { - var opts = fullLayout[subplotIds[i]], - domain = opts.domain, - mapbox = opts._subplot; + var opts = fullLayout[subplotIds[i]]; + var domain = opts.domain; + var mapbox = opts._subplot; var imageData = mapbox.toImage('png'); var image = fullLayout._glimages.append('svg:image'); @@ -159720,8 +160023,8 @@ }; function findAccessToken(gd, mapboxIds) { - var fullLayout = gd._fullLayout, - context = gd._context; + var fullLayout = gd._fullLayout; + var context = gd._context; // special case for Mapbox Atlas users if(context.mapboxAccessToken === '') return ''; @@ -159749,9 +160052,9 @@ } }; -},{"../../constants/xmlns_namespaces":670,"../../lib":692,"../../plots/get_data":777,"./constants":796,"./layout_attributes":800,"./layout_defaults":801,"./mapbox":802,"mapbox-gl":409}],799:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":672,"../../lib":694,"../../plots/get_data":779,"./constants":798,"./layout_attributes":802,"./layout_defaults":803,"./mapbox":804,"mapbox-gl":412}],801:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -159886,8 +160189,8 @@ } function convertOpts(opts) { - var layout = {}, - paint = {}; + var layout = {}; + var paint = {}; switch(opts.type) { @@ -159918,8 +160221,8 @@ break; case 'symbol': - var symbol = opts.symbol, - textOpts = convertTextOpts(symbol.textposition, symbol.iconsize); + var symbol = opts.symbol; + var textOpts = convertTextOpts(symbol.textposition, symbol.iconsize); Lib.extendFlat(layout, { 'icon-image': symbol.icon + '-15', @@ -159969,9 +160272,9 @@ return mapboxLayer; }; -},{"../../lib":692,"./convert_text_opts":797}],800:[function(_dereq_,module,exports){ +},{"../../lib":694,"./convert_text_opts":799}],802:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -160166,9 +160469,9 @@ }; -},{"../../components/color":569,"../../lib":692,"../../plot_api/edit_types":723,"../../plot_api/plot_template":730,"../../traces/scatter/attributes":1040,"../domain":766,"../font_attributes":767}],801:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../plot_api/edit_types":725,"../../plot_api/plot_template":732,"../../traces/scatter/attributes":1047,"../domain":768,"../font_attributes":769}],803:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -160255,9 +160558,9 @@ } } -},{"../../lib":692,"../array_container_defaults":736,"../subplot_defaults":818,"./layout_attributes":800}],802:[function(_dereq_,module,exports){ +},{"../../lib":694,"../array_container_defaults":738,"../subplot_defaults":820,"./layout_attributes":802}],804:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -160290,9 +160593,6 @@ // unique id for this Mapbox instance this.uid = fullLayout._uid + '-' + this.id; - // full mapbox options (N.B. needs to be updated on every updates) - this.opts = fullLayout[this.id]; - // create framework on instantiation for a smoother first plot call this.div = null; this.xaxis = null; @@ -160315,9 +160615,7 @@ proto.plot = function(calcData, fullLayout, promises) { var self = this; - - // feed in new mapbox options - var opts = self.opts = fullLayout[this.id]; + var opts = fullLayout[self.id]; // remove map and create a new map if access token has change if(self.map && (opts.accesstoken !== self.accessToken)) { @@ -160346,7 +160644,7 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) { var self = this; var gd = self.gd; - var opts = self.opts; + var opts = fullLayout[self.id]; // store style id and URL or object var styleObj = self.styleObj = getStyleObj(opts.style); @@ -160405,14 +160703,16 @@ // duplicate 'plotly_relayout' events. if(eventData.originalEvent || wheeling) { - var view = self.getView(); + var optsNow = gd._fullLayout[self.id]; + Registry.call('_storeDirectGUIEdit', gd.layout, gd._fullLayout._preGUI, self.getViewEdits(optsNow)); - opts._input.center = opts.center = view.center; - opts._input.zoom = opts.zoom = view.zoom; - opts._input.bearing = opts.bearing = view.bearing; - opts._input.pitch = opts.pitch = view.pitch; + var viewNow = self.getView(); + optsNow._input.center = optsNow.center = viewNow.center; + optsNow._input.zoom = optsNow.zoom = viewNow.zoom; + optsNow._input.bearing = optsNow.bearing = viewNow.bearing; + optsNow._input.pitch = optsNow.pitch = viewNow.pitch; - emitRelayoutFromView(view); + gd.emit('plotly_relayout', self.getViewEdits(viewNow)); } wheeling = false; }); @@ -160444,34 +160744,24 @@ map.on('zoomstart', unhover); map.on('dblclick', function() { - gd.emit('plotly_doubleclick', null); + var optsNow = gd._fullLayout[self.id]; + Registry.call('_storeDirectGUIEdit', gd.layout, gd._fullLayout._preGUI, self.getViewEdits(optsNow)); var viewInitial = self.viewInitial; - map.setCenter(convertCenter(viewInitial.center)); map.setZoom(viewInitial.zoom); map.setBearing(viewInitial.bearing); map.setPitch(viewInitial.pitch); var viewNow = self.getView(); + optsNow._input.center = optsNow.center = viewNow.center; + optsNow._input.zoom = optsNow.zoom = viewNow.zoom; + optsNow._input.bearing = optsNow.bearing = viewNow.bearing; + optsNow._input.pitch = optsNow.pitch = viewNow.pitch; - opts._input.center = opts.center = viewNow.center; - opts._input.zoom = opts.zoom = viewNow.zoom; - opts._input.bearing = opts.bearing = viewNow.bearing; - opts._input.pitch = opts.pitch = viewNow.pitch; - - emitRelayoutFromView(viewNow); - }); - - function emitRelayoutFromView(view) { - var id = self.id; - var evtData = {}; - for(var k in view) { - evtData[id + '.' + k] = view[k]; - } - Registry.call('_storeDirectGUIEdit', gd.layout, gd._fullLayout._preGUI, evtData); - gd.emit('plotly_relayout', evtData); - } + gd.emit('plotly_doubleclick', null); + gd.emit('plotly_relayout', self.getViewEdits(viewNow)); + }); // define event handlers on map creation, to keep one ref per map, // so that map.on / map.off in updateFx works as expected @@ -160506,10 +160796,11 @@ proto.updateMap = function(calcData, fullLayout, resolve, reject) { var self = this; var map = self.map; + var opts = fullLayout[this.id]; self.rejectOnError(reject); - var styleObj = getStyleObj(self.opts.style); + var styleObj = getStyleObj(opts.style); if(self.styleObj.id !== styleObj.id) { self.styleObj = styleObj; @@ -160528,6 +160819,12 @@ self.updateLayout(fullLayout); self.resolveOnRender(resolve); } + + if(this.gd._context._scrollZoom.mapbox) { + map.scrollZoom.enable(); + } else { + map.scrollZoom.disable(); + } }; proto.updateData = function(calcData) { @@ -160550,13 +160847,13 @@ // remove empty trace objects var ids = Object.keys(traceHash); - id_loop: + idLoop: for(i = 0; i < ids.length; i++) { var id = ids[i]; for(j = 0; j < calcData.length; j++) { trace = calcData[j][0].trace; - if(id === trace.uid) continue id_loop; + if(id === trace.uid) continue idLoop; } traceObj = traceHash[id]; @@ -160567,14 +160864,14 @@ proto.updateLayout = function(fullLayout) { var map = this.map; - var opts = this.opts; + var opts = fullLayout[this.id]; map.setCenter(convertCenter(opts.center)); map.setZoom(opts.zoom); map.setBearing(opts.bearing); map.setPitch(opts.pitch); - this.updateLayers(); + this.updateLayers(fullLayout); this.updateFramework(fullLayout); this.updateFx(fullLayout); this.map.resize(); @@ -160721,8 +161018,8 @@ this.yaxis._length = size.h * (domain.y[1] - domain.y[0]); }; -proto.updateLayers = function() { - var opts = this.opts; +proto.updateLayers = function(fullLayout) { + var opts = fullLayout[this.id]; var layers = opts.layers; var layerList = this.layerList; var i; @@ -160777,7 +161074,6 @@ // get map's current view values in plotly.js notation proto.getView = function() { var map = this.map; - var mapCenter = map.getCenter(); var center = { lon: mapCenter.lng, lat: mapCenter.lat }; @@ -160789,6 +161085,19 @@ }; }; +proto.getViewEdits = function(cont) { + var id = this.id; + var keys = ['center', 'zoom', 'bearing', 'pitch']; + var obj = {}; + + for(var i = 0; i < keys.length; i++) { + var k = keys[i]; + obj[id + '.' + k] = cont[k]; + } + + return obj; +}; + function getStyleObj(val) { var styleValues = layoutAttributes.style.values; var styleDflt = layoutAttributes.style.dflt; @@ -160821,9 +161130,9 @@ return [center.lon, center.lat]; } -},{"../../components/dragelement":587,"../../components/fx":608,"../../lib":692,"../../registry":823,"../cartesian/select":758,"./constants":796,"./layers":799,"./layout_attributes":800,"mapbox-gl":409}],803:[function(_dereq_,module,exports){ +},{"../../components/dragelement":589,"../../components/fx":610,"../../lib":694,"../../registry":825,"../cartesian/select":760,"./constants":798,"./layers":801,"./layout_attributes":802,"mapbox-gl":412}],805:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -160876,9 +161185,9 @@ }; }; -},{}],804:[function(_dereq_,module,exports){ +},{}],806:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -161050,9 +161359,9 @@ linkContainer.attr(attrs); - var toolspan = linkContainer.select('.js-link-to-tool'), - spacespan = linkContainer.select('.js-link-spacer'), - sourcespan = linkContainer.select('.js-sourcelinks'); + var toolspan = linkContainer.select('.js-link-to-tool'); + var spacespan = linkContainer.select('.js-link-spacer'); + var sourcespan = linkContainer.select('.js-sourcelinks'); if(gd._context.showSources) gd._context.showSources(gd); @@ -161220,8 +161529,8 @@ if(oldFullLayout._initialAutoSizeIsDone) { // coerce the updated layout while preserving width and height - var oldWidth = oldFullLayout.width, - oldHeight = oldFullLayout.height; + var oldWidth = oldFullLayout.width; + var oldHeight = oldFullLayout.height; plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj); @@ -161234,10 +161543,10 @@ // coerce the updated layout and autosize if needed plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj); - var missingWidthOrHeight = (!newLayout.width || !newLayout.height), - autosize = newFullLayout.autosize, - autosizable = context.autosizable, - initialAutoSize = missingWidthOrHeight && (autosize || autosizable); + var missingWidthOrHeight = (!newLayout.width || !newLayout.height); + var autosize = newFullLayout.autosize; + var autosizable = context.autosizable; + var initialAutoSize = missingWidthOrHeight && (autosize || autosizable); if(initialAutoSize) plots.plotAutoSize(gd, newLayout, newFullLayout); else if(missingWidthOrHeight) plots.sanitizeMargins(newFullLayout); @@ -161392,7 +161701,7 @@ plots.supplyDefaultsUpdateCalc = function(oldCalcdata, newFullData) { for(var i = 0; i < newFullData.length; i++) { var newTrace = newFullData[i]; - var cd0 = oldCalcdata[i][0]; + var cd0 = (oldCalcdata[i] || [])[0]; if(cd0 && cd0.trace) { var oldTrace = cd0.trace; if(oldTrace._hasCalcTransform) { @@ -161442,7 +161751,10 @@ } for(i = 0; i < len; i++) { - if(tryUid(newData[i].uid, i)) continue; + 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); } @@ -161458,8 +161770,8 @@ * Single-trace subplots (which have no `id`) such as pie, table, etc * do not need to be collected because we just draw all visible traces. */ -var collectableSubplotTypes; function emptySubplotLists() { + var collectableSubplotTypes = Registry.collectableSubplotTypes; var out = {}; var i, j; @@ -161642,8 +161954,8 @@ oldLoop: for(i = 0; i < oldFullData.length; i++) { - var oldTrace = oldFullData[i], - oldUid = oldTrace.uid; + var oldTrace = oldFullData[i]; + var oldUid = oldTrace.uid; for(j = 0; j < newFullData.length; j++) { var newTrace = newFullData[j]; @@ -162196,15 +162508,15 @@ if(!Array.isArray(traceIn.transforms) && globalTransforms.length === 0) return; - var containerIn = traceIn.transforms || [], - transformList = globalTransforms.concat(containerIn), - containerOut = traceOut.transforms = []; + 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], - type = transformIn.type, - _module = transformsRegistry[type], - transformOut; + var transformIn = transformList[i]; + var type = transformIn.type; + var _module = transformsRegistry[type]; + var transformOut; /* * Supply defaults may run twice. First pass runs all supply defaults steps @@ -162215,8 +162527,8 @@ * function it could not have generated any new traces and the second stage * is unnecessary. We detect this case with the following variables. */ - var isFirstStage = !(transformIn._module && transformIn._module === _module), - doLaterStages = _module && typeof _module.transform === 'function'; + var isFirstStage = !(transformIn._module && transformIn._module === _module); + var doLaterStages = _module && typeof _module.transform === 'function'; if(!_module) Lib.warn('Unrecognized transform type ' + type + '.'); @@ -162236,12 +162548,12 @@ }; function applyTransforms(fullTrace, fullData, layout, fullLayout) { - var container = fullTrace.transforms, - dataOut = [fullTrace]; + var container = fullTrace.transforms; + var dataOut = [fullTrace]; for(var i = 0; i < container.length; i++) { - var transform = container[i], - _module = transformsRegistry[transform.type]; + var transform = container[i]; + var _module = transformsRegistry[transform.type]; if(_module && _module.transform) { dataOut = _module.transform(dataOut, { @@ -162334,6 +162646,15 @@ coerce('modebar.activecolor', Color.addOpacity(modebarDefaultColor, 0.7)); coerce('modebar.uirevision', uirevision); + coerce('meta'); + + // do not include defaults in fullLayout when users do not set transition + if(Lib.isPlainObject(layoutIn.transition)) { + coerce('transition.duration'); + coerce('transition.easing'); + coerce('transition.ordering'); + } + Registry.getComponentMethod( 'calendars', 'handleDefaults' @@ -162346,10 +162667,10 @@ }; plots.plotAutoSize = function plotAutoSize(gd, layout, fullLayout) { - var context = gd._context || {}, - frameMargins = context.frameMargins, - newWidth, - newHeight; + var context = gd._context || {}; + var frameMargins = context.frameMargins; + var newWidth; + var newHeight; var isPlotDiv = Lib.isPlotDiv(gd); @@ -162382,15 +162703,15 @@ } } - var minWidth = plots.layoutAttributes.width.min, - minHeight = plots.layoutAttributes.height.min; + 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), - heightHasChanged = !layout.height && - (Math.abs(fullLayout.height - newHeight) > 1); + (Math.abs(fullLayout.width - newWidth) > 1); + var heightHasChanged = !layout.height && + (Math.abs(fullLayout.height - newHeight) > 1); if(heightHasChanged || widthHasChanged) { if(widthHasChanged) fullLayout.width = newWidth; @@ -162582,12 +162903,12 @@ // polar doesn't do margins... if(!fullLayout || !fullLayout.margin) return; - var width = fullLayout.width, - height = fullLayout.height, - margin = fullLayout.margin, - plotWidth = width - (margin.l + margin.r), - plotHeight = height - (margin.t + margin.b), - correction; + 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 margin.l + margin.r = 0 then plotWidth > 0 // as width >= 10 by supplyDefaults @@ -162728,23 +163049,23 @@ for(var k1 in pushMargin) { - var pushleft = pushMargin[k1].l || {}, - pushbottom = pushMargin[k1].b || {}, - fl = pushleft.val, - pl = pushleft.size, - fb = pushbottom.val, - pb = pushbottom.size; + 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; for(var k2 in pushMargin) { if(isNumeric(pl) && pushMargin[k2].r) { - var fr = pushMargin[k2].r.val, - pr = pushMargin[k2].r.size; + var fr = pushMargin[k2].r.val; + var pr = pushMargin[k2].r.size; if(fr > fl) { var newl = (pl * fr + - (pr - fullLayout.width) * fl) / (fr - fl), - newr = (pr * (1 - fl) + - (pl - fullLayout.width) * (1 - fr)) / (fr - fl); + (pr - fullLayout.width) * fl) / (fr - fl); + var newr = (pr * (1 - fl) + + (pl - fullLayout.width) * (1 - fr)) / (fr - fl); if(newl >= 0 && newr >= 0 && newl + newr > ml + mr) { ml = newl; mr = newr; @@ -162753,14 +163074,14 @@ } if(isNumeric(pb) && pushMargin[k2].t) { - var ft = pushMargin[k2].t.val, - pt = pushMargin[k2].t.size; + var ft = pushMargin[k2].t.val; + var pt = pushMargin[k2].t.size; if(ft > fb) { var newb = (pb * ft + - (pt - fullLayout.height) * fb) / (ft - fb), - newt = (pt * (1 - fb) + - (pb - fullLayout.height) * (1 - ft)) / (ft - fb); + (pt - fullLayout.height) * fb) / (ft - fb); + var newt = (pt * (1 - fb) + + (pb - fullLayout.height) * (1 - ft)) / (ft - fb); if(newb >= 0 && newt >= 0 && newb + newt > mb + mt) { mb = newb; mt = newt; @@ -162822,16 +163143,17 @@ plots.supplyDefaults(gd); } - var data = (useDefaults) ? gd._fullData : gd.data, - layout = (useDefaults) ? gd._fullLayout : gd.layout, - frames = (gd._transitionData || {})._frames; + var data = (useDefaults) ? gd._fullData : gd.data; + var layout = (useDefaults) ? gd._fullLayout : gd.layout; + var frames = (gd._transitionData || {})._frames; function stripObj(d) { if(typeof d === 'function') { return null; } if(Lib.isPlainObject(d)) { - var o = {}, v, src; + var o = {}; + var v, src; for(v in d) { // remove private elements and functions // _ is for private, [ is a mistake ie [object Object] @@ -163164,10 +163486,9 @@ }; /** - * Transition to a set of new data and layout properties + * Transition to a set of new data and layout properties from Plotly.animate * * @param {DOM element} gd - * the DOM element of the graph container div * @param {Object[]} data * an array of data objects following the normal Plotly data definition format * @param {Object} layout @@ -163180,17 +163501,15 @@ * options for the transition */ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) { - var i, traceIdx; - - var dataLength = Array.isArray(data) ? data.length : 0; - var traceIndices = traces.slice(0, dataLength); - + var opts = {redraw: frameOpts.redraw}; var transitionedTraces = []; + var axEdits = []; - function prepareTransitions() { - var i; + opts.prepareFn = function() { + var dataLength = Array.isArray(data) ? data.length : 0; + var traceIndices = traces.slice(0, dataLength); - for(i = 0; i < traceIndices.length; i++) { + for(var i = 0; i < traceIndices.length; i++) { var traceIdx = traceIndices[i]; var trace = gd._fullData[traceIdx]; var module = trace._module; @@ -163236,8 +163555,213 @@ plots.supplyDefaults(gd); plots.doCalcdata(gd); + var newLayout = Lib.expandObjectPaths(layout); + + if(newLayout) { + var subplots = gd._fullLayout._plots; + + for(var k in subplots) { + var plotinfo = subplots[k]; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var xr0 = xa.range.slice(); + var yr0 = ya.range.slice(); + + var xr1; + if(Array.isArray(newLayout[xa._name + '.range'])) { + xr1 = newLayout[xa._name + '.range'].slice(); + } else if(Array.isArray((newLayout[xa._name] || {}).range)) { + xr1 = newLayout[xa._name].range.slice(); + } + + var yr1; + if(Array.isArray(newLayout[ya._name + '.range'])) { + yr1 = newLayout[ya._name + '.range'].slice(); + } else if(Array.isArray((newLayout[ya._name] || {}).range)) { + yr1 = newLayout[ya._name].range.slice(); + } + + var editX; + if(xr0 && xr1 && (xr0[0] !== xr1[0] || xr0[1] !== xr1[1])) { + editX = {xr0: xr0, xr1: xr1}; + } + + var editY; + if(yr0 && yr1 && (yr0[0] !== yr1[0] || yr0[1] !== yr1[1])) { + editY = {yr0: yr0, yr1: yr1}; + } + + if(editX || editY) { + axEdits.push(Lib.extendFlat({plotinfo: plotinfo}, editX, editY)); + } + } + } + return Promise.resolve(); - } + }; + + opts.runFn = function(makeCallback) { + var traceTransitionOpts; + var basePlotModules = gd._fullLayout._basePlotModules; + var hasAxisTransition = axEdits.length; + var i; + + if(layout) { + for(i = 0; i < basePlotModules.length; i++) { + if(basePlotModules[i].transitionAxes) { + basePlotModules[i].transitionAxes(gd, axEdits, transitionOpts, makeCallback); + } + } + } + + // Here handle the exception that we refuse to animate scales and axes at the same + // time. In other words, if there's an axis transition, then set the data transition + // to instantaneous. + if(hasAxisTransition) { + traceTransitionOpts = Lib.extendFlat({}, transitionOpts); + traceTransitionOpts.duration = 0; + // This means do not transition traces, + // this happens on layout-only (e.g. axis range) animations + transitionedTraces = null; + } else { + traceTransitionOpts = transitionOpts; + } + + for(i = 0; i < basePlotModules.length; i++) { + // Note that we pass a callback to *create* the callback that must be invoked on completion. + // This is since not all traces know about transitions, so it greatly simplifies matters if + // the trace is responsible for creating a callback, if needed, and then executing it when + // the time is right. + basePlotModules[i].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback); + } + }; + + return _transition(gd, transitionOpts, opts); +}; + +/** + * Transition to a set of new data and layout properties from Plotly.react + * + * @param {DOM element} gd + * @param {object} restyleFlags + * - anim {'all'|'some'} + * @param {object} relayoutFlags + * - anim {'all'|'some'} + * @param {object} oldFullLayout : old (pre Plotly.react) fullLayout + */ +plots.transitionFromReact = function(gd, restyleFlags, relayoutFlags, oldFullLayout) { + var fullLayout = gd._fullLayout; + var transitionOpts = fullLayout.transition; + var opts = {}; + var axEdits = []; + + opts.prepareFn = function() { + var subplots = fullLayout._plots; + + // no need to redraw at end of transition, + // if all changes are animatable + 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 xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var xr0 = oldFullLayout[xa._name].range.slice(); + var yr0 = oldFullLayout[ya._name].range.slice(); + var xr1 = xa.range.slice(); + var yr1 = ya.range.slice(); + + xa.setScale(); + ya.setScale(); + + var editX; + if(xr0[0] !== xr1[0] || xr0[1] !== xr1[1]) { + editX = {xr0: xr0, xr1: xr1}; + } + + var editY; + if(yr0[0] !== yr1[0] || yr0[1] !== yr1[1]) { + editY = {yr0: yr0, yr1: yr1}; + } + + if(editX || editY) { + axEdits.push(Lib.extendFlat({plotinfo: plotinfo}, editX, editY)); + } + } + + return Promise.resolve(); + }; + + opts.runFn = function(makeCallback) { + var fullData = gd._fullData; + var fullLayout = gd._fullLayout; + var basePlotModules = fullLayout._basePlotModules; + + var axisTransitionOpts; + var traceTransitionOpts; + var transitionedTraces; + + var allTraceIndices = []; + for(var i = 0; i < fullData.length; i++) { + allTraceIndices.push(i); + } + + function transitionAxes() { + for(var j = 0; j < basePlotModules.length; j++) { + if(basePlotModules[j].transitionAxes) { + basePlotModules[j].transitionAxes(gd, axEdits, axisTransitionOpts, makeCallback); + } + } + } + + function transitionTraces() { + for(var j = 0; j < basePlotModules.length; j++) { + basePlotModules[j].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback); + } + } + + if(axEdits.length && restyleFlags.anim) { + if(transitionOpts.ordering === 'traces first') { + axisTransitionOpts = Lib.extendFlat({}, transitionOpts, {duration: 0}); + transitionedTraces = allTraceIndices; + traceTransitionOpts = transitionOpts; + transitionTraces(); + setTimeout(transitionAxes, transitionOpts.duration); + } else { + axisTransitionOpts = transitionOpts; + transitionedTraces = null; + traceTransitionOpts = Lib.extendFlat({}, transitionOpts, {duration: 0}); + transitionAxes(); + transitionTraces(); + } + } else if(axEdits.length) { + axisTransitionOpts = transitionOpts; + transitionAxes(); + } else if(restyleFlags.anim) { + transitionedTraces = allTraceIndices; + traceTransitionOpts = transitionOpts; + transitionTraces(); + } + }; + + return _transition(gd, transitionOpts, opts); +}; + +/** + * trace/layout transition wrapper that works + * for transitions initiated by Plotly.animate and Plotly.react. + * + * @param {DOM element} gd + * @param {object} transitionOpts + * @param {object} opts + * - redraw {boolean} + * - prepareFn {function} *should return a Promise* + * - runFn {function} ran inside executeTransitions + */ +function _transition(gd, transitionOpts, opts) { + var aborted = false; function executeCallbacks(list) { var p = Promise.resolve(); @@ -163255,8 +163779,6 @@ } } - var aborted = false; - function executeTransitions() { gd.emit('plotly_transitioning', []); @@ -163271,7 +163793,6 @@ gd._transitioningWithDuration = true; } - // If another transition is triggered, this callback will be executed simply because it's // in the interruptCallbacks queue. If this transition completes, it will instead flush // that queue and forget about this callback. @@ -163279,7 +163800,7 @@ aborted = true; }); - if(frameOpts.redraw) { + if(opts.redraw) { gd._transitionData._interruptCallbacks.push(function() { return Registry.call('redraw', gd); }); @@ -163305,44 +163826,10 @@ }; } - var traceTransitionOpts; - var j; - var basePlotModules = gd._fullLayout._basePlotModules; - var hasAxisTransition = false; - - if(layout) { - for(j = 0; j < basePlotModules.length; j++) { - if(basePlotModules[j].transitionAxes) { - var newLayout = Lib.expandObjectPaths(layout); - hasAxisTransition = basePlotModules[j].transitionAxes(gd, newLayout, transitionOpts, makeCallback) || hasAxisTransition; - } - } - } - - // Here handle the exception that we refuse to animate scales and axes at the same - // time. In other words, if there's an axis transition, then set the data transition - // to instantaneous. - if(hasAxisTransition) { - traceTransitionOpts = Lib.extendFlat({}, transitionOpts); - traceTransitionOpts.duration = 0; - // This means do not transition traces, - // this happens on layout-only (e.g. axis range) animations - transitionedTraces = null; - } else { - traceTransitionOpts = transitionOpts; - } - - for(j = 0; j < basePlotModules.length; j++) { - // Note that we pass a callback to *create* the callback that must be invoked on completion. - // This is since not all traces know about transitions, so it greatly simplifies matters if - // the trace is responsible for creating a callback, if needed, and then executing it when - // the time is right. - basePlotModules[j].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback); - } + opts.runFn(makeCallback); // If nothing else creates a callback, then this will trigger the completion in the next tick: setTimeout(makeCallback()); - }); } @@ -163355,7 +163842,7 @@ flushCallbacks(gd._transitionData._interruptCallbacks); return Promise.resolve().then(function() { - if(frameOpts.redraw) { + if(opts.redraw) { return Registry.call('redraw', gd); } }).then(function() { @@ -163381,15 +163868,13 @@ return executeCallbacks(gd._transitionData._interruptCallbacks); } - for(i = 0; i < traceIndices.length; i++) { - traceIdx = traceIndices[i]; - var contFull = gd._fullData[traceIdx]; - var module = contFull._module; - - if(!module) continue; - } - - var seq = [plots.previousPromises, interruptPreviousTransitions, prepareTransitions, plots.rehover, executeTransitions]; + var seq = [ + plots.previousPromises, + interruptPreviousTransitions, + opts.prepareFn, + plots.rehover, + executeTransitions + ]; var transitionStarting = Lib.syncOrAsync(seq, gd); @@ -163397,10 +163882,8 @@ transitionStarting = Promise.resolve(); } - return transitionStarting.then(function() { - return gd; - }); -}; + return transitionStarting.then(function() { return gd; }); +} plots.doCalcdata = function(gd, traces) { var axList = axisIDs.list(gd); @@ -163624,8 +164107,8 @@ // build up moduleName -> calcData hash for(i = 0; i < subplotCalcData.length; i++) { - var calcTraces = subplotCalcData[i], - trace = calcTraces[0].trace; + var calcTraces = subplotCalcData[i]; + var trace = calcTraces[0].trace; // skip over visible === false traces // as they don't have `_module` ref @@ -163640,8 +164123,8 @@ // removed from the DOM. for(var moduleNameOld in traceHashOld) { if(!traceHash[moduleNameOld]) { - var fakeCalcTrace = traceHashOld[moduleNameOld][0], - fakeTrace = fakeCalcTrace[0].trace; + var fakeCalcTrace = traceHashOld[moduleNameOld][0]; + var fakeTrace = fakeCalcTrace[0].trace; fakeTrace.visible = false; traceHash[moduleNameOld] = [fakeCalcTrace]; @@ -163660,9 +164143,9 @@ subplot.traceHash = traceHash; }; -},{"../components/color":569,"../constants/numerical":669,"../lib":692,"../plot_api/plot_schema":729,"../plot_api/plot_template":730,"../plots/cartesian/axis_ids":743,"../registry":823,"./animation_attributes":735,"./attributes":737,"./command":765,"./font_attributes":767,"./frame_attributes":768,"./layout_attributes":795,"d3":148,"fast-isnumeric":214}],805:[function(_dereq_,module,exports){ +},{"../components/color":571,"../constants/numerical":671,"../lib":694,"../plot_api/plot_schema":731,"../plot_api/plot_template":732,"../plots/cartesian/axis_ids":745,"../registry":825,"./animation_attributes":737,"./attributes":739,"./command":767,"./font_attributes":769,"./frame_attributes":770,"./layout_attributes":797,"d3":149,"fast-isnumeric":215}],807:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -163705,9 +164188,9 @@ OFFEDGE: 20 }; -},{}],806:[function(_dereq_,module,exports){ +},{}],808:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164000,9 +164483,9 @@ pathPolygonAnnulus: pathPolygonAnnulus }; -},{"../../lib":692,"../../lib/polygon":704}],807:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/polygon":706}],809:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164089,9 +164572,9 @@ toSVG: _dereq_('../cartesian').toSVG }; -},{"../../lib":692,"../cartesian":752,"../get_data":777,"./constants":805,"./layout_attributes":808,"./layout_defaults":809,"./polar":816}],808:[function(_dereq_,module,exports){ +},{"../../lib":694,"../cartesian":754,"../get_data":779,"./constants":807,"./layout_attributes":810,"./layout_defaults":811,"./polar":818}],810:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164372,9 +164855,9 @@ editType: 'calc' }; -},{"../../components/color/attributes":568,"../../lib":692,"../../plot_api/edit_types":723,"../cartesian/layout_attributes":753,"../domain":766}],809:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../lib":694,"../../plot_api/edit_types":725,"../cartesian/layout_attributes":755,"../domain":768}],811:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164605,9 +165088,9 @@ }); }; -},{"../../components/color":569,"../../lib":692,"../../plot_api/plot_template":730,"../cartesian/axis_autotype":741,"../cartesian/category_order_defaults":744,"../cartesian/line_grid_defaults":755,"../cartesian/tick_label_defaults":760,"../cartesian/tick_mark_defaults":761,"../cartesian/tick_value_defaults":762,"../get_data":777,"../subplot_defaults":818,"./constants":805,"./layout_attributes":808,"./set_convert":817}],810:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../plot_api/plot_template":732,"../cartesian/axis_autotype":743,"../cartesian/category_order_defaults":746,"../cartesian/line_grid_defaults":757,"../cartesian/tick_label_defaults":762,"../cartesian/tick_mark_defaults":763,"../cartesian/tick_value_defaults":764,"../get_data":779,"../subplot_defaults":820,"./constants":807,"./layout_attributes":810,"./set_convert":819}],812:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164649,9 +165132,9 @@ } }; -},{"../../../lib/extend":682,"../../../traces/scatter/attributes":1040}],811:[function(_dereq_,module,exports){ +},{"../../../lib/extend":684,"../../../traces/scatter/attributes":1047}],813:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164771,9 +165254,9 @@ } }, 'plot', 'nested'); -},{"../../../lib/extend":682,"../../../plot_api/edit_types":723,"../../cartesian/layout_attributes":753}],812:[function(_dereq_,module,exports){ +},{"../../../lib/extend":684,"../../../plot_api/edit_types":725,"../../cartesian/layout_attributes":755}],814:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -164786,9 +165269,9 @@ Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":813,"./micropolar_manager":814}],813:[function(_dereq_,module,exports){ +},{"./micropolar":815,"./micropolar_manager":816}],815:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -166206,9 +166689,9 @@ return exports; }; -},{"../../../constants/alignment":664,"../../../lib":692,"d3":148}],814:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":666,"../../../lib":694,"d3":149}],816:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -166277,24 +166760,24 @@ }; manager.fillLayout = function(_gd) { - var container = d3.select(_gd).selectAll('.plot-container'), - paperDiv = container.selectAll('.svg-container'), - paper = _gd.framework && _gd.framework.svg && _gd.framework.svg(), - dflts = { - width: 800, - height: 600, - paper_bgcolor: Color.background, - _container: container, - _paperdiv: paperDiv, - _paper: paper - }; + var container = d3.select(_gd).selectAll('.plot-container'); + var paperDiv = container.selectAll('.svg-container'); + var paper = _gd.framework && _gd.framework.svg && _gd.framework.svg(); + var dflts = { + width: 800, + height: 600, + paper_bgcolor: Color.background, + _container: container, + _paperdiv: paperDiv, + _paper: paper + }; _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":569,"../../../lib":692,"./micropolar":813,"./undo_manager":815,"d3":148}],815:[function(_dereq_,module,exports){ +},{"../../../components/color":571,"../../../lib":694,"./micropolar":815,"./undo_manager":817,"d3":149}],817:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -166306,10 +166789,10 @@ // Modified from https://github.com/ArthurClemens/Javascript-Undo-Manager // Copyright (c) 2010-2013 Arthur Clemens, arthur@visiblearea.com module.exports = function UndoManager() { - var undoCommands = [], - index = -1, - isExecuting = false, - callback; + var undoCommands = []; + var index = -1; + var isExecuting = false; + var callback; function execute(command, action) { if(!command) return this; @@ -166358,9 +166841,9 @@ }; }; -},{}],816:[function(_dereq_,module,exports){ +},{}],818:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -167790,9 +168273,9 @@ return sign(Math.sin(v)); } -},{"../../components/color":569,"../../components/dragelement":587,"../../components/drawing":590,"../../components/fx":608,"../../components/titles":657,"../../constants/alignment":664,"../../lib":692,"../../lib/clear_gl_canvases":677,"../../lib/setcursor":712,"../../plot_api/subroutines":731,"../../plots/cartesian/axes":740,"../../registry":823,"../cartesian/autorange":739,"../cartesian/dragbox":749,"../cartesian/select":758,"../cartesian/set_convert":759,"../plots":804,"./constants":805,"./helpers":806,"./set_convert":817,"d3":148,"tinycolor2":513}],817:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/dragelement":589,"../../components/drawing":592,"../../components/fx":610,"../../components/titles":659,"../../constants/alignment":666,"../../lib":694,"../../lib/clear_gl_canvases":679,"../../lib/setcursor":714,"../../plot_api/subroutines":733,"../../plots/cartesian/axes":742,"../../registry":825,"../cartesian/autorange":741,"../cartesian/dragbox":751,"../cartesian/select":760,"../cartesian/set_convert":761,"../plots":806,"./constants":807,"./helpers":808,"./set_convert":819,"d3":149,"tinycolor2":515}],819:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -167982,9 +168465,9 @@ }; } -},{"../../lib":692,"../cartesian/set_convert":759}],818:[function(_dereq_,module,exports){ +},{"../../lib":694,"../cartesian/set_convert":761}],820:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -168067,9 +168550,9 @@ } }; -},{"../lib":692,"../plot_api/plot_template":730,"./domain":766}],819:[function(_dereq_,module,exports){ +},{"../lib":694,"../plot_api/plot_template":732,"./domain":768}],821:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -168112,9 +168595,9 @@ var ternaryIds = fullLayout._subplots[TERNARY]; for(var i = 0; i < ternaryIds.length; i++) { - var ternaryId = ternaryIds[i], - ternaryCalcData = getSubplotCalcData(calcData, TERNARY, ternaryId), - ternary = fullLayout[ternaryId]._subplot; + var ternaryId = ternaryIds[i]; + var ternaryCalcData = getSubplotCalcData(calcData, TERNARY, ternaryId); + var ternary = fullLayout[ternaryId]._subplot; // If ternary is not instantiated, create one! if(!ternary) { @@ -168151,9 +168634,9 @@ } }; -},{"../../lib":692,"../../plots/get_data":777,"./layout_attributes":820,"./layout_defaults":821,"./ternary":822}],820:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/get_data":779,"./layout_attributes":822,"./layout_defaults":823,"./ternary":824}],822:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -168254,9 +168737,9 @@ }; -},{"../../components/color/attributes":568,"../../lib/extend":682,"../../plot_api/edit_types":723,"../cartesian/layout_attributes":753,"../domain":766}],821:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../lib/extend":684,"../../plot_api/edit_types":725,"../cartesian/layout_attributes":755,"../domain":768}],823:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -168309,9 +168792,9 @@ // if the min values contradict each other, set them all to default (0) // and delete *all* the inputs so the user doesn't get confused later by // changing one and having them all change. - var aaxis = ternaryLayoutOut.aaxis, - baxis = ternaryLayoutOut.baxis, - caxis = ternaryLayoutOut.caxis; + var aaxis = ternaryLayoutOut.aaxis; + var baxis = ternaryLayoutOut.baxis; + var caxis = ternaryLayoutOut.caxis; if(aaxis.min + baxis.min + caxis.min >= sum) { aaxis.min = 0; baxis.min = 0; @@ -168338,9 +168821,9 @@ // inherit from global font color in case that was provided. var dfltFontColor = (dfltColor !== axAttrs.color.dflt) ? dfltColor : options.font.color; - var axName = containerOut._name, - letterUpper = axName.charAt(0).toUpperCase(), - dfltTitle = 'Component ' + letterUpper; + var axName = containerOut._name; + var letterUpper = axName.charAt(0).toUpperCase(); + var dfltTitle = 'Component ' + letterUpper; var title = coerce('title.text', dfltTitle); containerOut._hovertitle = title === dfltTitle ? title : letterUpper; @@ -168386,9 +168869,9 @@ coerce('layer'); } -},{"../../components/color":569,"../../lib":692,"../../plot_api/plot_template":730,"../cartesian/line_grid_defaults":755,"../cartesian/tick_label_defaults":760,"../cartesian/tick_mark_defaults":761,"../cartesian/tick_value_defaults":762,"../subplot_defaults":818,"./layout_attributes":820}],822:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../plot_api/plot_template":732,"../cartesian/line_grid_defaults":757,"../cartesian/tick_label_defaults":762,"../cartesian/tick_mark_defaults":763,"../cartesian/tick_value_defaults":764,"../subplot_defaults":820,"./layout_attributes":822}],824:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -168555,31 +169038,31 @@ toplevel.order(); }; -var w_over_h = Math.sqrt(4 / 3); +var whRatio = Math.sqrt(4 / 3); proto.adjustLayout = function(ternaryLayout, graphSize) { - var _this = this, - domain = ternaryLayout.domain, - xDomainCenter = (domain.x[0] + domain.x[1]) / 2, - yDomainCenter = (domain.y[0] + domain.y[1]) / 2, - xDomain = domain.x[1] - domain.x[0], - yDomain = domain.y[1] - domain.y[0], - wmax = xDomain * graphSize.w, - hmax = yDomain * graphSize.h, - sum = ternaryLayout.sum, - amin = ternaryLayout.aaxis.min, - bmin = ternaryLayout.baxis.min, - cmin = ternaryLayout.caxis.min; + var _this = this; + var domain = ternaryLayout.domain; + var xDomainCenter = (domain.x[0] + domain.x[1]) / 2; + var yDomainCenter = (domain.y[0] + domain.y[1]) / 2; + var xDomain = domain.x[1] - domain.x[0]; + var yDomain = domain.y[1] - domain.y[0]; + var wmax = xDomain * graphSize.w; + var hmax = yDomain * graphSize.h; + var sum = ternaryLayout.sum; + var amin = ternaryLayout.aaxis.min; + var bmin = ternaryLayout.baxis.min; + var cmin = ternaryLayout.caxis.min; var x0, y0, w, h, xDomainFinal, yDomainFinal; - if(wmax > w_over_h * hmax) { + if(wmax > whRatio * hmax) { h = hmax; - w = h * w_over_h; + w = h * whRatio; } else { w = wmax; - h = w / w_over_h; + h = w / whRatio; } xDomainFinal = xDomain * w / wmax; @@ -168642,7 +169125,7 @@ // tickangle = 'auto' means 0 anyway for a y axis, need to coerce to 0 here // so we can shift by 30. tickangle: (+ternaryLayout.aaxis.tickangle || 0) - 30, - domain: [yDomain0, yDomain0 + yDomainFinal * w_over_h], + domain: [yDomain0, yDomain0 + yDomainFinal * whRatio], anchor: 'free', position: 0, _id: 'y', @@ -168671,7 +169154,7 @@ range: [sum - amin - bmin, cmin], side: 'right', tickangle: (+ternaryLayout.caxis.tickangle || 0) + 30, - domain: [yDomain0, yDomain0 + yDomainFinal * w_over_h], + domain: [yDomain0, yDomain0 + yDomainFinal * whRatio], anchor: 'free', position: 0, _id: 'y', @@ -168883,10 +169366,10 @@ var SHOWZOOMOUTTIP = true; proto.initInteractions = function() { - var _this = this, - dragger = _this.layers.plotbg.select('path').node(), - gd = _this.graphDiv, - zoomContainer = gd._fullLayout._zoomlayer; + var _this = this; + var dragger = _this.layers.plotbg.select('path').node(); + var gd = _this.graphDiv; + var zoomContainer = gd._fullLayout._zoomlayer; // use plotbg for the main interactions var dragOptions = { @@ -168999,17 +169482,17 @@ function getCFrac(x, y) { return ((x - (_this.h - y) / Math.sqrt(3)) / _this.w); } function zoomMove(dx0, dy0) { - var x1 = x0 + dx0, - y1 = y0 + dy0, - afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))), - bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))), - cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))), - xLeft = ((afrac / 2) + cfrac) * _this.w, - xRight = (1 - (afrac / 2) - bfrac) * _this.w, - xCenter = (xLeft + xRight) / 2, - xSpan = xRight - xLeft, - yBottom = (1 - afrac) * _this.h, - yTop = yBottom - xSpan / w_over_h; + var x1 = x0 + dx0; + var y1 = y0 + dy0; + var afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))); + var bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))); + var cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))); + var xLeft = ((afrac / 2) + cfrac) * _this.w; + var xRight = (1 - (afrac / 2) - bfrac) * _this.w; + var xCenter = (xLeft + xRight) / 2; + var xSpan = xRight - xLeft; + var yBottom = (1 - afrac) * _this.h; + var yTop = yBottom - xSpan / whRatio; if(xSpan < constants.MINZOOM) { mins = mins0; @@ -169066,19 +169549,19 @@ } function plotDrag(dx, dy) { - var dxScaled = dx / _this.xaxis._m, - dyScaled = dy / _this.yaxis._m; + var dxScaled = dx / _this.xaxis._m; + var dyScaled = dy / _this.yaxis._m; mins = { a: mins0.a - dyScaled, b: mins0.b + (dxScaled + dyScaled) / 2, c: mins0.c - (dxScaled - dyScaled) / 2 }; - var minsorted = [mins.a, mins.b, mins.c].sort(), - minindices = { - a: minsorted.indexOf(mins.a), - b: minsorted.indexOf(mins.b), - c: minsorted.indexOf(mins.c) - }; + var minsorted = [mins.a, mins.b, mins.c].sort(); + var minindices = { + a: minsorted.indexOf(mins.a), + b: minsorted.indexOf(mins.b), + c: minsorted.indexOf(mins.c) + }; if(minsorted[0] < 0) { if(minsorted[1] + minsorted[0] / 2 < 0) { minsorted[2] += minsorted[0] + minsorted[1]; @@ -169148,9 +169631,9 @@ .remove(); } -},{"../../components/color":569,"../../components/dragelement":587,"../../components/drawing":590,"../../components/fx":608,"../../components/titles":657,"../../lib":692,"../../lib/extend":682,"../../registry":823,"../cartesian/axes":740,"../cartesian/constants":746,"../cartesian/select":758,"../cartesian/set_convert":759,"../plots":804,"d3":148,"tinycolor2":513}],823:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/dragelement":589,"../../components/drawing":592,"../../components/fx":610,"../../components/titles":659,"../../lib":694,"../../lib/extend":684,"../../registry":825,"../cartesian/axes":742,"../cartesian/constants":748,"../cartesian/select":760,"../cartesian/set_convert":761,"../plots":806,"d3":149,"tinycolor2":515}],825:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169182,6 +169665,7 @@ exports.traceLayoutAttributes = {}; exports.localeRegistry = {}; exports.apiMethodRegistry = {}; +exports.collectableSubplotTypes = null; /** * Top-level register routine, exported as Plotly.register @@ -169223,6 +169707,8 @@ * */ exports.register = function register(_modules) { + exports.collectableSubplotTypes = null; + if(!_modules) { throw new Error('No argument passed to Plotly.register.'); } else if(_modules && !Array.isArray(_modules)) { @@ -169590,9 +170076,9 @@ return traceType; } -},{"./lib/extend":682,"./lib/is_plain_object":693,"./lib/loggers":696,"./lib/noop":701,"./lib/push_unique":706,"./plots/attributes":737,"./plots/layout_attributes":795}],824:[function(_dereq_,module,exports){ +},{"./lib/extend":684,"./lib/is_plain_object":695,"./lib/loggers":698,"./lib/noop":703,"./lib/push_unique":708,"./plots/attributes":739,"./plots/layout_attributes":797}],826:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169764,9 +170250,9 @@ return plotTile; }; -},{"../lib":692}],825:[function(_dereq_,module,exports){ +},{"../lib":694}],827:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169832,9 +170318,9 @@ module.exports = downloadImage; -},{"../lib":692,"../plot_api/to_image":733,"./filesaver":826}],826:[function(_dereq_,module,exports){ +},{"../lib":694,"../plot_api/to_image":735,"./filesaver":828}],828:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169904,9 +170390,9 @@ module.exports = fileSaver; -},{}],827:[function(_dereq_,module,exports){ +},{}],829:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169941,9 +170427,9 @@ }; }; -},{}],828:[function(_dereq_,module,exports){ +},{}],830:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -169967,9 +170453,9 @@ module.exports = Snapshot; -},{"./cloneplot":824,"./download":825,"./helpers":827,"./svgtoimg":829,"./toimage":830,"./tosvg":831}],829:[function(_dereq_,module,exports){ +},{"./cloneplot":826,"./download":827,"./helpers":829,"./svgtoimg":831,"./toimage":832,"./tosvg":833}],831:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170083,9 +170569,9 @@ module.exports = svgToImg; -},{"../lib":692,"events":92}],830:[function(_dereq_,module,exports){ +},{"../lib":694,"events":93}],832:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170162,9 +170648,9 @@ module.exports = toImage; -},{"../lib":692,"../registry":823,"./cloneplot":824,"./helpers":827,"./svgtoimg":829,"./tosvg":831,"events":92}],831:[function(_dereq_,module,exports){ +},{"../lib":694,"../registry":825,"./cloneplot":826,"./helpers":829,"./svgtoimg":831,"./tosvg":833,"events":93}],833:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170344,9 +170830,9 @@ return s; }; -},{"../components/color":569,"../components/drawing":590,"../constants/xmlns_namespaces":670,"../lib":692,"d3":148}],832:[function(_dereq_,module,exports){ +},{"../components/color":571,"../components/drawing":592,"../constants/xmlns_namespaces":672,"../lib":694,"d3":149}],834:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170379,9 +170865,9 @@ } }; -},{"../../lib":692}],833:[function(_dereq_,module,exports){ +},{"../../lib":694}],835:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170554,9 +171040,9 @@ } }; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../components/fx/hovertemplate_attributes":607,"../../lib/extend":682,"../../plots/font_attributes":767,"../scatter/attributes":1040,"./constants.js":835}],834:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plots/font_attributes":769,"../scatter/attributes":1047,"./constants.js":837}],836:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170619,9 +171105,9 @@ return cd; }; -},{"../../components/colorscale/calc":577,"../../components/colorscale/helpers":580,"../../plots/cartesian/axes":740,"../scatter/calc_selection":1042,"./arrays_to_calcdata":832}],835:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../components/colorscale/helpers":582,"../../plots/cartesian/axes":742,"../scatter/calc_selection":1049,"./arrays_to_calcdata":834}],837:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -170635,16 +171121,15 @@ eventDataKeys: [] }; -},{}],836:[function(_dereq_,module,exports){ +},{}],838:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var isNumeric = _dereq_('fast-isnumeric'); @@ -170663,15 +171148,15 @@ */ function crossTraceCalc(gd, plotinfo) { - var xa = plotinfo.xaxis, - ya = plotinfo.yaxis; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - var fullTraces = gd._fullData, - calcTraces = gd.calcdata, - calcTracesHorizontal = [], - calcTracesVertical = [], - i; - for(i = 0; i < fullTraces.length; i++) { + var fullTraces = gd._fullData; + var calcTraces = gd.calcdata; + var calcTracesHorizontal = []; + var calcTracesVertical = []; + + for(var i = 0; i < fullTraces.length; i++) { var fullTrace = fullTraces[i]; if( fullTrace.visible === true && @@ -170681,8 +171166,7 @@ ) { if(fullTrace.orientation === 'h') { calcTracesHorizontal.push(calcTraces[i]); - } - else { + } else { calcTracesVertical.push(calcTraces[i]); } } @@ -170695,19 +171179,18 @@ function setGroupPositions(gd, pa, sa, calcTraces) { if(!calcTraces.length) return; - var barmode = gd._fullLayout.barmode, - overlay = (barmode === 'overlay'), - group = (barmode === 'group'), - excluded, - included, - i, calcTrace, fullTrace; + var barmode = gd._fullLayout.barmode; + var overlay = (barmode === 'overlay'); + var group = (barmode === 'group'); + var excluded; + var included; + var i, calcTrace, fullTrace; initBase(gd, pa, sa, calcTraces); if(overlay) { setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces); - } - else if(group) { + } else if(group) { // exclude from the group those traces for which the user set an offset excluded = []; included = []; @@ -170725,8 +171208,7 @@ if(excluded.length) { setGroupPositionsInOverlayMode(gd, pa, sa, excluded); } - } - else { + } else { // exclude from the stack those traces for which the user set a base excluded = []; included = []; @@ -170793,19 +171275,15 @@ } } - function setGroupPositionsInOverlayMode(gd, pa, sa, calcTraces) { - var barnorm = gd._fullLayout.barnorm, - separateNegativeValues = false, - dontMergeOverlappingData = !barnorm; + var barnorm = gd._fullLayout.barnorm; + var separateNegativeValues = false; + var dontMergeOverlappingData = !barnorm; // update position axis and set bar offsets and widths for(var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; - - var sieve = new Sieve( - [calcTrace], separateNegativeValues, dontMergeOverlappingData - ); + var sieve = new Sieve([calcTrace], separateNegativeValues, dontMergeOverlappingData); // set bar offsets and widths, and update position axis setOffsetAndWidth(gd, pa, sieve); @@ -170818,22 +171296,18 @@ if(barnorm) { sieveBars(gd, sa, sieve); normalizeBars(gd, sa, sieve); - } - else { + } else { setBaseAndTop(gd, sa, sieve); } } } - function setGroupPositionsInGroupMode(gd, pa, sa, calcTraces) { - var fullLayout = gd._fullLayout, - barnorm = fullLayout.barnorm, - separateNegativeValues = false, - dontMergeOverlappingData = !barnorm, - sieve = new Sieve( - calcTraces, separateNegativeValues, dontMergeOverlappingData - ); + var fullLayout = gd._fullLayout; + var barnorm = fullLayout.barnorm; + var separateNegativeValues = false; + var dontMergeOverlappingData = !barnorm; + var sieve = new Sieve(calcTraces, separateNegativeValues, dontMergeOverlappingData); // set bar offsets and widths, and update position axis setOffsetAndWidthInGroupMode(gd, pa, sieve); @@ -170842,24 +171316,20 @@ if(barnorm) { sieveBars(gd, sa, sieve); normalizeBars(gd, sa, sieve); - } - else { + } else { setBaseAndTop(gd, sa, sieve); } } - function setGroupPositionsInStackOrRelativeMode(gd, pa, sa, calcTraces) { - var fullLayout = gd._fullLayout, - barmode = fullLayout.barmode, - stack = (barmode === 'stack'), - relative = (barmode === 'relative'), - barnorm = gd._fullLayout.barnorm, - separateNegativeValues = relative, - dontMergeOverlappingData = !(barnorm || stack || relative), - sieve = new Sieve( - calcTraces, separateNegativeValues, dontMergeOverlappingData - ); + var fullLayout = gd._fullLayout; + var barmode = fullLayout.barmode; + var stack = barmode === 'stack'; + var relative = barmode === 'relative'; + var barnorm = fullLayout.barnorm; + var separateNegativeValues = relative; + var dontMergeOverlappingData = !(barnorm || stack || relative); + var sieve = new Sieve(calcTraces, separateNegativeValues, dontMergeOverlappingData); // set bar offsets and widths, and update position axis setOffsetAndWidth(gd, pa, sieve); @@ -170874,10 +171344,10 @@ for(var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; - if(bar.s === BADNUM) continue; - - var isOutmostBar = ((bar.b + bar.s) === sieve.get(bar.p, bar.s)); - if(isOutmostBar) bar._outmost = true; + if(bar.s !== BADNUM) { + var isOutmostBar = ((bar.b + bar.s) === sieve.get(bar.p, bar.s)); + if(isOutmostBar) bar._outmost = true; + } } } @@ -170886,30 +171356,26 @@ if(barnorm) normalizeBars(gd, sa, sieve); } - function setOffsetAndWidth(gd, pa, sieve) { - var fullLayout = gd._fullLayout, - bargap = fullLayout.bargap, - bargroupgap = fullLayout.bargroupgap || 0, - minDiff = sieve.minDiff, - calcTraces = sieve.traces, - i, calcTrace, calcTrace0, - t; + var fullLayout = gd._fullLayout; + var bargap = fullLayout.bargap; + var bargroupgap = fullLayout.bargroupgap || 0; + var minDiff = sieve.minDiff; + var calcTraces = sieve.traces; // set bar offsets and widths - var barGroupWidth = minDiff * (1 - bargap), - barWidthPlusGap = barGroupWidth, - barWidth = barWidthPlusGap * (1 - bargroupgap); + var barGroupWidth = minDiff * (1 - bargap); + var barWidthPlusGap = barGroupWidth; + var barWidth = barWidthPlusGap * (1 - bargroupgap); // computer bar group center and bar offset var offsetFromCenter = -barWidth / 2; - for(i = 0; i < calcTraces.length; i++) { - calcTrace = calcTraces[i]; - calcTrace0 = calcTrace[0]; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var t = calcTrace[0].t; // store bar width and offset for this trace - t = calcTrace0.t; t.barwidth = barWidth; t.poffset = offsetFromCenter; t.bargroupwidth = barGroupWidth; @@ -170929,38 +171395,34 @@ updatePositionAxis(gd, pa, sieve); } - function setOffsetAndWidthInGroupMode(gd, pa, sieve) { - var fullLayout = gd._fullLayout, - bargap = fullLayout.bargap, - bargroupgap = fullLayout.bargroupgap || 0, - positions = sieve.positions, - distinctPositions = sieve.distinctPositions, - minDiff = sieve.minDiff, - calcTraces = sieve.traces, - i, calcTrace, calcTrace0, - t; + var fullLayout = gd._fullLayout; + var bargap = fullLayout.bargap; + var bargroupgap = fullLayout.bargroupgap || 0; + var positions = sieve.positions; + var distinctPositions = sieve.distinctPositions; + var minDiff = sieve.minDiff; + var calcTraces = sieve.traces; // if there aren't any overlapping positions, // let them have full width even if mode is group var overlap = (positions.length !== distinctPositions.length); - var nTraces = calcTraces.length, - barGroupWidth = minDiff * (1 - bargap), - barWidthPlusGap = (overlap) ? barGroupWidth / nTraces : barGroupWidth, - barWidth = barWidthPlusGap * (1 - bargroupgap); - - for(i = 0; i < nTraces; i++) { - calcTrace = calcTraces[i]; - calcTrace0 = calcTrace[0]; + var nTraces = calcTraces.length; + var barGroupWidth = minDiff * (1 - bargap); + var barWidthPlusGap = (overlap) ? barGroupWidth / nTraces : barGroupWidth; + var barWidth = barWidthPlusGap * (1 - bargroupgap); + + for(var i = 0; i < nTraces; i++) { + var calcTrace = calcTraces[i]; + var t = calcTrace[0].t; // computer bar group center and bar offset - var offsetFromCenter = (overlap) ? - ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 : - -barWidth / 2; + var offsetFromCenter = overlap ? + ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 : + -barWidth / 2; // store bar width and offset for this trace - t = calcTrace0.t; t.barwidth = barWidth; t.poffset = offsetFromCenter; t.bargroupwidth = barGroupWidth; @@ -170980,22 +171442,18 @@ updatePositionAxis(gd, pa, sieve, overlap); } - function applyAttributes(sieve) { - var calcTraces = sieve.traces, - i, calcTrace, calcTrace0, fullTrace, - j, - t; + var calcTraces = sieve.traces; + var i, j; for(i = 0; i < calcTraces.length; i++) { - calcTrace = calcTraces[i]; - calcTrace0 = calcTrace[0]; - fullTrace = calcTrace0.trace; - t = calcTrace0.t; - - var offset = fullTrace._offset || fullTrace.offset, - initialPoffset = t.poffset, - newPoffset; + 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)) { // if offset is an array, then clone it into t.poffset. @@ -171015,8 +171473,7 @@ } t.poffset = newPoffset; - } - else if(offset !== undefined) { + } else if(offset !== undefined) { t.poffset = offset; } @@ -171051,8 +171508,7 @@ } t.poffset = newPoffset; } - } - else if(width !== undefined) { + } else if(width !== undefined) { t.barwidth = width; // if user didn't set offset, @@ -171064,234 +171520,217 @@ } } - function setBarCenterAndWidth(gd, pa, sieve) { - var calcTraces = sieve.traces, - pLetter = getAxisLetter(pa); + var calcTraces = sieve.traces; + var pLetter = getAxisLetter(pa); for(var i = 0; i < calcTraces.length; i++) { - var calcTrace = calcTraces[i], - t = calcTrace[0].t, - poffset = t.poffset, - poffsetIsArray = Array.isArray(poffset), - barwidth = t.barwidth, - barwidthIsArray = Array.isArray(barwidth); + var calcTrace = calcTraces[i]; + var t = calcTrace[0].t; + var poffset = t.poffset; + var poffsetIsArray = Array.isArray(poffset); + var barwidth = t.barwidth; + var barwidthIsArray = Array.isArray(barwidth); for(var j = 0; j < calcTrace.length; j++) { var calcBar = calcTrace[j]; // store the actual bar width and position, for use by hover - var width = calcBar.w = (barwidthIsArray) ? barwidth[j] : barwidth; - calcBar[pLetter] = calcBar.p + - ((poffsetIsArray) ? poffset[j] : poffset) + - width / 2; - - + var width = calcBar.w = barwidthIsArray ? barwidth[j] : barwidth; + calcBar[pLetter] = calcBar.p + (poffsetIsArray ? poffset[j] : poffset) + width / 2; } } } - function updatePositionAxis(gd, pa, sieve, allowMinDtick) { - var calcTraces = sieve.traces, - distinctPositions = sieve.distinctPositions, - distinctPositions0 = distinctPositions[0], - minDiff = sieve.minDiff, - vpad = minDiff / 2; - - Axes.minDtick(pa, minDiff, distinctPositions0, allowMinDtick); - - // If the user set the bar width or the offset, - // then bars can be shifted away from their positions - // and widths can be larger than minDiff. - // - // Here, we compute pMin and pMax to expand the position axis, - // so that all bars are fully within the axis range. - var pMin = Math.min.apply(Math, distinctPositions) - vpad, - pMax = Math.max.apply(Math, distinctPositions) + vpad; - - for(var i = 0; i < calcTraces.length; i++) { - var calcTrace = calcTraces[i], - calcTrace0 = calcTrace[0], - fullTrace = calcTrace0.trace; + var calcTraces = sieve.traces; + var minDiff = sieve.minDiff; + var vpad = minDiff / 2; - if(fullTrace.width === undefined && fullTrace.offset === undefined) { - continue; - } + Axes.minDtick(pa, sieve.minDiff, sieve.distinctPositions[0], allowMinDtick); - var t = calcTrace0.t, - poffset = t.poffset, - barwidth = t.barwidth, - poffsetIsArray = Array.isArray(poffset), - barwidthIsArray = Array.isArray(barwidth); + 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(var j = 0; j < calcTrace.length; j++) { - var calcBar = calcTrace[j], - calcBarOffset = (poffsetIsArray) ? poffset[j] : poffset, - calcBarWidth = (barwidthIsArray) ? barwidth[j] : barwidth, - p = calcBar.p, - l = p + calcBarOffset, + 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 = Array.isArray(poffset); + var barwidthIsArray = Array.isArray(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; - - pMin = Math.min(pMin, l); - pMax = Math.max(pMax, r); + pts.push(l, r); + } } - } - - var extremes = Axes.findExtremes(pa, [pMin, pMax], {padded: false}); - putExtremes(calcTraces, pa, extremes); -} -function expandRange(range, newValue) { - if(isNumeric(range[0])) range[0] = Math.min(range[0], newValue); - else range[0] = newValue; - - if(isNumeric(range[1])) range[1] = Math.max(range[1], newValue); - else range[1] = newValue; + fullTrace._extremes[pa._id] = Axes.findExtremes(pa, pts, {padded: false}); + } } +// store these bar bases and tops in calcdata +// and make sure the size axis includes zero, +// along with the bases and tops of each bar. function setBaseAndTop(gd, sa, sieve) { - // store these bar bases and tops in calcdata - // and make sure the size axis includes zero, - // along with the bases and tops of each bar. - var traces = sieve.traces, - sLetter = getAxisLetter(sa), - sRange = [null, null]; + var calcTraces = sieve.traces; + var sLetter = getAxisLetter(sa); - for(var i = 0; i < traces.length; i++) { - var trace = traces[i]; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var fullTrace = calcTrace[0].trace; + var pts = []; + var allBarBaseAboveZero = true; - for(var j = 0; j < trace.length; j++) { - var bar = trace[j], - barBase = bar.b, - barTop = barBase + bar.s; + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; + var barBase = bar.b; + var barTop = barBase + bar.s; bar[sLetter] = barTop; + pts.push(barTop); + if(bar.hasB) pts.push(barBase); - if(isNumeric(sa.c2l(barTop))) expandRange(sRange, barTop); - if(bar.hasB && isNumeric(sa.c2l(barBase))) expandRange(sRange, barBase); + if(!bar.hasB || !(bar.b > 0 && bar.s > 0)) { + allBarBaseAboveZero = false; + } } - } - var extremes = Axes.findExtremes(sa, sRange, {tozero: true, padded: true}); - putExtremes(traces, sa, extremes); + fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, { + tozero: !allBarBaseAboveZero, + padded: true + }); + } } - function stackBars(gd, sa, sieve) { - var fullLayout = gd._fullLayout, - barnorm = fullLayout.barnorm, - sLetter = getAxisLetter(sa), - traces = sieve.traces, - i, trace, - j, bar; - - var sRange = [null, null]; - - for(i = 0; i < traces.length; i++) { - trace = traces[i]; + var fullLayout = gd._fullLayout; + var barnorm = fullLayout.barnorm; + var sLetter = getAxisLetter(sa); + var calcTraces = sieve.traces; - for(j = 0; j < trace.length; j++) { - bar = trace[j]; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var fullTrace = calcTrace[0].trace; + var pts = []; - if(bar.s === BADNUM) continue; + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; - // stack current bar and get previous sum - var barBase = sieve.put(bar.p, bar.b + bar.s), - barTop = barBase + bar.b + bar.s; + if(bar.s !== BADNUM) { + // stack current bar and get previous sum + var barBase = sieve.put(bar.p, bar.b + bar.s); + var barTop = barBase + bar.b + bar.s; - // store the bar base and top in each calcdata item - bar.b = barBase; - bar[sLetter] = barTop; + // store the bar base and top in each calcdata item + bar.b = barBase; + bar[sLetter] = barTop; - if(!barnorm) { - if(isNumeric(sa.c2l(barTop))) expandRange(sRange, barTop); - if(bar.hasB && isNumeric(sa.c2l(barBase))) expandRange(sRange, barBase); + if(!barnorm) { + pts.push(barTop); + if(bar.hasB) pts.push(barBase); + } } } - } - // if barnorm is set, let normalizeBars update the axis range - if(!barnorm) { - var extremes = Axes.findExtremes(sa, sRange, {tozero: true, padded: true}); - putExtremes(traces, sa, extremes); + // if barnorm is set, let normalizeBars update the axis range + if(!barnorm) { + fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, { + // N.B. we don't stack base with 'base', + // so set tozero:true always! + tozero: true, + padded: true + }); + } } } - function sieveBars(gd, sa, sieve) { - var traces = sieve.traces; + var calcTraces = sieve.traces; - for(var i = 0; i < traces.length; i++) { - var trace = traces[i]; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; - for(var j = 0; j < trace.length; j++) { - var bar = trace[j]; + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; if(bar.s !== BADNUM) sieve.put(bar.p, bar.b + bar.s); } } } - +// Note: +// +// normalizeBars requires that either sieveBars or stackBars has been +// previously invoked. function normalizeBars(gd, sa, sieve) { - // Note: - // - // normalizeBars requires that either sieveBars or stackBars has been - // previously invoked. + var fullLayout = gd._fullLayout; + var calcTraces = sieve.traces; + var sLetter = getAxisLetter(sa); + var sTop = fullLayout.barnorm === 'fraction' ? 1 : 100; + var sTiny = sTop / 1e9; // in case of rounding error in sum + var sMin = sa.l2c(sa.c2l(0)); + var sMax = fullLayout.barmode === 'stack' ? sTop : sMin; - var traces = sieve.traces, - sLetter = getAxisLetter(sa), - sTop = (gd._fullLayout.barnorm === 'fraction') ? 1 : 100, - sTiny = sTop / 1e9, // in case of rounding error in sum - sMin = sa.l2c(sa.c2l(0)), - sMax = (gd._fullLayout.barmode === 'stack') ? sTop : sMin, - sRange = [sMin, sMax], - padded = false; - - function maybeExpand(newValue) { - if(isNumeric(sa.c2l(newValue)) && - ((newValue < sMin - sTiny) || (newValue > sMax + sTiny) || !isNumeric(sMin)) - ) { - padded = true; - expandRange(sRange, newValue); - } + function needsPadding(v) { + return ( + isNumeric(sa.c2l(v)) && + ((v < sMin - sTiny) || (v > sMax + sTiny) || !isNumeric(sMin)) + ); } - for(var i = 0; i < traces.length; i++) { - var trace = traces[i]; - - for(var j = 0; j < trace.length; j++) { - var bar = trace[j]; - - if(bar.s === BADNUM) continue; + for(var i = 0; i < calcTraces.length; i++) { + var calcTrace = calcTraces[i]; + var fullTrace = calcTrace[0].trace; + var pts = []; + var allBarBaseAboveZero = true; + var padded = false; - var scale = Math.abs(sTop / sieve.get(bar.p, bar.s)); - bar.b *= scale; - bar.s *= scale; + for(var j = 0; j < calcTrace.length; j++) { + var bar = calcTrace[j]; - var barBase = bar.b, - barTop = barBase + bar.s; - bar[sLetter] = barTop; + if(bar.s !== BADNUM) { + var scale = Math.abs(sTop / sieve.get(bar.p, bar.s)); + bar.b *= scale; + bar.s *= scale; - maybeExpand(barTop); - if(bar.hasB) maybeExpand(barBase); - } - } + var barBase = bar.b; + var barTop = barBase + bar.s; - // update range of size axis - var extremes = Axes.findExtremes(sa, sRange, {tozero: true, padded: padded}); - putExtremes(traces, sa, extremes); -} + bar[sLetter] = barTop; + pts.push(barTop); + padded = padded || needsPadding(barTop); + if(bar.hasB) { + pts.push(barBase); + padded = padded || needsPadding(barBase); + } -function getAxisLetter(ax) { - return ax._id.charAt(0); -} + if(!bar.hasB || !(bar.b > 0 && bar.s > 0)) { + allBarBaseAboveZero = false; + } + } + } -function putExtremes(cd, ax, extremes) { - for(var i = 0; i < cd.length; i++) { - cd[i][0].trace._extremes[ax._id] = extremes; + fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, { + tozero: !allBarBaseAboveZero, + padded: padded + }); } } @@ -171301,12 +171740,13 @@ // run once per trace group (subplot & direction) and // the same mapping is attached to all calcdata traces function collectExtents(calcTraces, pa) { - var posLetter = pa._id.charAt(0); + var pLetter = getAxisLetter(pa); var extents = {}; + var i, j, cd; + var pMin = Infinity; var pMax = -Infinity; - var i, j, cd; for(i = 0; i < calcTraces.length; i++) { cd = calcTraces[i]; for(j = 0; j < cd.length; j++) { @@ -171326,20 +171766,19 @@ return String(Math.round(roundFactor * (p - pMin))); }; - var poffset, poffsetIsArray; - for(i = 0; i < calcTraces.length; i++) { cd = calcTraces[i]; cd[0].t.extents = extents; - poffset = cd[0].t.poffset; - poffsetIsArray = Array.isArray(poffset); + + var poffset = cd[0].t.poffset; + var poffsetIsArray = Array.isArray(poffset); for(j = 0; j < cd.length; j++) { var di = cd[j]; - var p0 = di[posLetter] - di.w / 2; + var p0 = di[pLetter] - di.w / 2; if(isNumeric(p0)) { - var p1 = di[posLetter] + di.w / 2; + var p1 = di[pLetter] + di.w / 2; var pVal = round(di.p); if(extents[pVal]) { extents[pVal] = [Math.min(p0, extents[pVal][0]), Math.max(p1, extents[pVal][1])]; @@ -171348,7 +171787,7 @@ } } - di.p0 = di.p + ((poffsetIsArray) ? poffset[j] : poffset); + di.p0 = di.p + (poffsetIsArray ? poffset[j] : poffset); di.p1 = di.p0 + di.w; di.s0 = di.b; di.s1 = di.s0 + di.s; @@ -171356,14 +171795,18 @@ } } +function getAxisLetter(ax) { + return ax._id.charAt(0); +} + module.exports = { crossTraceCalc: crossTraceCalc, setGroupPositions: setGroupPositions }; -},{"../../constants/numerical":669,"../../lib":692,"../../plots/cartesian/axes":740,"../../registry":823,"./sieve.js":845,"fast-isnumeric":214}],837:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../plots/cartesian/axes":742,"../../registry":825,"./sieve.js":847,"fast-isnumeric":215}],839:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171405,9 +171848,9 @@ var textPosition = coerce('textposition'); - var hasBoth = Array.isArray(textPosition) || textPosition === 'auto', - hasInside = hasBoth || textPosition === 'inside', - hasOutside = hasBoth || textPosition === 'outside'; + var hasBoth = Array.isArray(textPosition) || textPosition === 'auto'; + var hasInside = hasBoth || textPosition === 'inside'; + var hasOutside = hasBoth || textPosition === 'outside'; if(hasInside || hasOutside) { var textFont = coerceFont(coerce, 'textfont', layout.font); @@ -171434,17 +171877,19 @@ handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); + var lineColor = (traceOut.marker.line || {}).color; + // override defaultColor for error bars with defaultLine var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/color":569,"../../lib":692,"../../registry":823,"../bar/style_defaults":847,"../scatter/xy_defaults":1066,"./attributes":833}],838:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../registry":825,"../bar/style_defaults":849,"../scatter/xy_defaults":1073,"./attributes":835}],840:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171459,8 +171904,7 @@ exports.coerceString = function(attributeDefinition, value, defaultValue) { if(typeof value === 'string') { if(value || !attributeDefinition.noBlank) return value; - } - else if(typeof value === 'number') { + } else if(typeof value === 'number') { if(!attributeDefinition.strict) return String(value); } @@ -171473,9 +171917,9 @@ if(isNumeric(value)) { value = +value; - var min = attributeDefinition.min, - max = attributeDefinition.max, - isOutOfBounds = (min !== undefined && value < min) || + var min = attributeDefinition.min; + var max = attributeDefinition.max; + var isOutOfBounds = (min !== undefined && value < min) || (max !== undefined && value > max); if(!isOutOfBounds) return value; @@ -171511,9 +171955,9 @@ return value; }; -},{"fast-isnumeric":214,"tinycolor2":513}],839:[function(_dereq_,module,exports){ +},{"fast-isnumeric":215,"tinycolor2":515}],841:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171669,9 +172113,9 @@ getTraceColor: getTraceColor }; -},{"../../components/color":569,"../../components/fx":608,"../../registry":823,"../scatter/fill_hover_text":1048}],840:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx":610,"../../registry":825,"../scatter/fill_hover_text":1055}],842:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171707,9 +172151,9 @@ module.exports = Bar; -},{"../../plots/cartesian":752,"../scatter/marker_colorbar":1058,"./arrays_to_calcdata":832,"./attributes":833,"./calc":834,"./cross_trace_calc":836,"./defaults":837,"./hover":839,"./layout_attributes":841,"./layout_defaults":842,"./plot":843,"./select":844,"./style":846}],841:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../scatter/marker_colorbar":1065,"./arrays_to_calcdata":834,"./attributes":835,"./calc":836,"./cross_trace_calc":838,"./defaults":839,"./hover":841,"./layout_attributes":843,"./layout_defaults":844,"./plot":845,"./select":846,"./style":848}],843:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171755,9 +172199,9 @@ } }; -},{}],842:[function(_dereq_,module,exports){ +},{}],844:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171779,10 +172223,10 @@ return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } - var hasBars = false, - shouldBeGapless = false, - gappedAnyway = false, - usedSubplots = {}; + var hasBars = false; + var shouldBeGapless = false; + var gappedAnyway = false; + var usedSubplots = {}; for(var i = 0; i < fullData.length; i++) { var trace = fullData[i]; @@ -171813,9 +172257,9 @@ coerce('bargroupgap'); }; -},{"../../lib":692,"../../plots/cartesian/axes":740,"../../registry":823,"./layout_attributes":841}],843:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../../registry":825,"./layout_attributes":843}],845:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -171835,9 +172279,9 @@ var Drawing = _dereq_('../../components/drawing'); var Registry = _dereq_('../../registry'); -var attributes = _dereq_('./attributes'), - attributeText = attributes.text, - attributeTextPosition = attributes.textposition; +var attributes = _dereq_('./attributes'); +var attributeText = attributes.text; +var attributeTextPosition = attributes.textposition; var helpers = _dereq_('./helpers'); var style = _dereq_('./style'); @@ -171900,8 +172344,8 @@ } var lw = (di.mlw + 1 || trace.marker.line.width + 1 || - (di.trace ? di.trace.marker.line.width : 0) + 1) - 1, - offset = d3.round((lw / 2) % 1, 2); + (di.trace ? di.trace.marker.line.width : 0) + 1) - 1; + var offset = d3.round((lw / 2) % 1, 2); function roundWithLine(v) { // if there are explicit gaps, don't round, @@ -171927,9 +172371,8 @@ // pixelation. if the bars ARE fully opaque and have // no line, expand to a full pixel to make sure we // can see them - var op = Color.opacity(di.mc || trace.marker.color), - fixpx = (op < 1 || lw > 0.01) ? - roundWithLine : expandToVisible; + var op = Color.opacity(di.mc || trace.marker.color); + var fixpx = (op < 1 || lw > 0.01) ? roundWithLine : expandToVisible; x0 = fixpx(x0, x1); x1 = fixpx(x1, x0); y0 = fixpx(y0, y1); @@ -171980,8 +172423,8 @@ } // get trace attributes - var trace = calcTrace[0].trace, - orientation = trace.orientation; + var trace = calcTrace[0].trace; + var orientation = trace.orientation; var text = getText(trace, i); textPosition = getTextPosition(trace, i); @@ -171997,21 +172440,21 @@ var outsideTextFont = style.getOutsideTextFont(trace, i, layoutFont); // compute text position - var barmode = gd._fullLayout.barmode, - inStackMode = (barmode === 'stack'), - inRelativeMode = (barmode === 'relative'), - inStackOrRelativeMode = inStackMode || inRelativeMode, - - calcBar = calcTrace[i], - isOutmostBar = !inStackOrRelativeMode || calcBar._outmost, - - barWidth = Math.abs(x1 - x0) - 2 * TEXTPAD, // padding excluded - barHeight = Math.abs(y1 - y0) - 2 * TEXTPAD, // padding excluded - - textSelection, - textBB, - textWidth, - textHeight; + var barmode = gd._fullLayout.barmode; + var inStackMode = (barmode === 'stack'); + var inRelativeMode = (barmode === 'relative'); + var inStackOrRelativeMode = inStackMode || inRelativeMode; + + var calcBar = calcTrace[i]; + var isOutmostBar = !inStackOrRelativeMode || calcBar._outmost; + + var barWidth = Math.abs(x1 - x0) - 2 * TEXTPAD; // padding excluded + var barHeight = Math.abs(y1 - y0) - 2 * TEXTPAD; // padding excluded + + var textSelection; + var textBB; + var textWidth; + var textHeight; if(textPosition === 'outside') { if(!isOutmostBar && !calcBar.hasB) textPosition = 'inside'; @@ -172027,14 +172470,13 @@ textWidth = textBB.width, textHeight = textBB.height; - var textHasSize = (textWidth > 0 && textHeight > 0), - fitsInside = - (textWidth <= barWidth && textHeight <= barHeight), - fitsInsideIfRotated = - (textWidth <= barHeight && textHeight <= barWidth), - fitsInsideIfShrunk = (orientation === 'h') ? - (barWidth >= textWidth * (barHeight / textHeight)) : - (barHeight >= textHeight * (barWidth / textWidth)); + var textHasSize = (textWidth > 0 && textHeight > 0); + var fitsInside = (textWidth <= barWidth && textHeight <= barHeight); + var fitsInsideIfRotated = (textWidth <= barHeight && textHeight <= barWidth); + var fitsInsideIfShrunk = (orientation === 'h') ? + (barWidth >= textWidth * (barHeight / textHeight)) : + (barHeight >= textHeight * (barWidth / textWidth)); + if(textHasSize && (fitsInside || fitsInsideIfRotated || fitsInsideIfShrunk)) { textPosition = 'inside'; @@ -172081,16 +172523,16 @@ function getTransformToMoveInsideBar(x0, x1, y0, y1, textBB, orientation, constrained) { // compute text and target positions - var textWidth = textBB.width, - textHeight = textBB.height, - textX = (textBB.left + textBB.right) / 2, - textY = (textBB.top + textBB.bottom) / 2, - barWidth = Math.abs(x1 - x0), - barHeight = Math.abs(y1 - y0), - targetWidth, - targetHeight, - targetX, - targetY; + var textWidth = textBB.width; + var textHeight = textBB.height; + var textX = (textBB.left + textBB.right) / 2; + var textY = (textBB.top + textBB.bottom) / 2; + var barWidth = Math.abs(x1 - x0); + var barHeight = Math.abs(y1 - y0); + var targetWidth; + var targetHeight; + var targetX; + var targetY; // apply text padding var textpad; @@ -172166,9 +172608,9 @@ function getTransformToMoveOutsideBar(x0, x1, y0, y1, textBB, orientation, constrained) { var barWidth = (orientation === 'h') ? - Math.abs(y1 - y0) : - Math.abs(x1 - x0), - textpad; + Math.abs(y1 - y0) : + Math.abs(x1 - x0); + var textpad; // Keep the padding so the text doesn't sit right against // the bars, but don't factor it into barWidth @@ -172185,12 +172627,12 @@ } // compute text and target positions - var textX = (textBB.left + textBB.right) / 2, - textY = (textBB.top + textBB.bottom) / 2, - targetWidth, - targetHeight, - targetX, - targetY; + var textX = (textBB.left + textBB.right) / 2; + var textY = (textBB.top + textBB.bottom) / 2; + var targetWidth; + var targetHeight; + var targetX; + var targetY; targetWidth = scale * textBB.width; targetHeight = scale * textBB.height; @@ -172222,9 +172664,9 @@ } function getTransform(textX, textY, targetX, targetY, scale, rotate) { - var transformScale, - transformRotate, - transformTranslate; + var transformScale; + var transformRotate; + var transformTranslate; if(scale < 1) transformScale = 'scale(' + scale + ') '; else { @@ -172236,8 +172678,8 @@ 'rotate(' + rotate + ' ' + textX + ' ' + textY + ') ' : ''; // Note that scaling also affects the center of the text box - var translateX = (targetX - scale * textX), - translateY = (targetY - scale * textY); + var translateX = (targetX - scale * textX); + var translateY = (targetY - scale * textY); transformTranslate = 'translate(' + translateX + ' ' + translateY + ')'; return transformTranslate + transformScale + transformRotate; @@ -172253,9 +172695,9 @@ return helpers.coerceEnumerated(attributeTextPosition, value); } -},{"../../components/color":569,"../../components/drawing":590,"../../lib":692,"../../lib/svg_text_utils":716,"../../registry":823,"./attributes":833,"./helpers":838,"./style":846,"d3":148,"fast-isnumeric":214}],844:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../../lib":694,"../../lib/svg_text_utils":718,"../../registry":825,"./attributes":835,"./helpers":840,"./style":848,"d3":149,"fast-isnumeric":215}],846:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172296,9 +172738,9 @@ return selection; }; -},{}],845:[function(_dereq_,module,exports){ +},{}],847:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172364,8 +172806,8 @@ * @returns {number} Previous bin value */ Sieve.prototype.put = function put(position, value) { - var label = this.getLabel(position, value), - oldValue = this.bins[label] || 0; + var label = this.getLabel(position, value); + var oldValue = this.bins[label] || 0; this.bins[label] = oldValue + value; @@ -172398,16 +172840,16 @@ * true; otherwise prefixed with '^') */ Sieve.prototype.getLabel = function getLabel(position, value) { - var prefix = (value < 0 && this.separateNegativeValues) ? 'v' : '^', - label = (this.dontMergeOverlappingData) ? - position : - Math.round(position / this.binWidth); + var prefix = (value < 0 && this.separateNegativeValues) ? 'v' : '^'; + var label = (this.dontMergeOverlappingData) ? + position : + Math.round(position / this.binWidth); return prefix + label; }; -},{"../../constants/numerical":669,"../../lib":692}],846:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694}],848:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172423,10 +172865,10 @@ var Lib = _dereq_('../../lib'); var Registry = _dereq_('../../registry'); -var attributes = _dereq_('./attributes'), - attributeTextFont = attributes.textfont, - attributeInsideTextFont = attributes.insidetextfont, - attributeOutsideTextFont = attributes.outsidetextfont; +var attributes = _dereq_('./attributes'); +var attributeTextFont = attributes.textfont; +var attributeInsideTextFont = attributes.insidetextfont; +var attributeOutsideTextFont = attributes.outsidetextfont; var helpers = _dereq_('./helpers'); function style(gd, cd) { @@ -172553,9 +172995,9 @@ function getFontValue(attributeDefinition, attributeValue, index, defaultValue) { attributeValue = attributeValue || {}; - var familyValue = helpers.getValue(attributeValue.family, index), - sizeValue = helpers.getValue(attributeValue.size, index), - colorValue = helpers.getValue(attributeValue.color, index); + var familyValue = helpers.getValue(attributeValue.family, index); + var sizeValue = helpers.getValue(attributeValue.size, index); + var colorValue = helpers.getValue(attributeValue.color, index); return { family: helpers.coerceString( @@ -172579,9 +173021,9 @@ getBarColor: getBarColor }; -},{"../../components/color":569,"../../components/drawing":590,"../../lib":692,"../../registry":823,"./attributes":833,"./helpers":838,"d3":148}],847:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../../lib":694,"../../registry":825,"./attributes":835,"./helpers":840,"d3":149}],849:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172617,9 +173059,9 @@ coerce('unselected.marker.color'); }; -},{"../../components/color":569,"../../components/colorscale/defaults":579,"../../components/colorscale/helpers":580}],848:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/colorscale/defaults":581,"../../components/colorscale/helpers":582}],850:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172628,6 +173070,7 @@ 'use strict'; +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); var extendFlat = _dereq_('../../lib/extend').extendFlat; var scatterPolarAttrs = _dereq_('../scatterpolar/attributes'); var barAttrs = _dereq_('../bar/attributes'); @@ -172674,6 +173117,7 @@ marker: barAttrs.marker, hoverinfo: scatterPolarAttrs.hoverinfo, + hovertemplate: hovertemplateAttrs(), selected: barAttrs.selected, unselected: barAttrs.unselected @@ -172682,9 +173126,9 @@ // error_y }; -},{"../../lib/extend":682,"../bar/attributes":833,"../scatterpolar/attributes":1102}],849:[function(_dereq_,module,exports){ +},{"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../bar/attributes":835,"../scatterpolar/attributes":1109}],851:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172793,9 +173237,9 @@ crossTraceCalc: crossTraceCalc }; -},{"../../components/colorscale/calc":577,"../../components/colorscale/helpers":580,"../../lib":692,"../../registry":823,"../bar/arrays_to_calcdata":832,"../bar/cross_trace_calc":836,"../scatter/calc_selection":1042}],850:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../components/colorscale/helpers":582,"../../lib":694,"../../registry":825,"../bar/arrays_to_calcdata":834,"../bar/cross_trace_calc":838,"../scatter/calc_selection":1049}],852:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172829,6 +173273,7 @@ coerce('width'); coerce('text'); + coerce('hovertemplate'); // coerce('hovertext'); // var textPosition = coerce('textposition'); @@ -172851,9 +173296,9 @@ Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":692,"../bar/style_defaults":847,"../scatterpolar/defaults":1104,"./attributes":848}],851:[function(_dereq_,module,exports){ +},{"../../lib":694,"../bar/style_defaults":849,"../scatterpolar/defaults":1111,"./attributes":850}],853:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172915,6 +173360,7 @@ var _cdi = Lib.extendFlat({}, cdi, {r: cdi.s, theta: cdi.p}); fillHoverText(cdi, trace, pointData); makeHoverPointText(_cdi, trace, subplot, pointData); + pointData.hovertemplate = trace.hovertemplate; pointData.color = getTraceColor(trace, cdi); pointData.xLabelVal = pointData.yLabelVal = undefined; @@ -172925,9 +173371,9 @@ return [pointData]; }; -},{"../../components/fx":608,"../../lib":692,"../../plots/polar/helpers":806,"../bar/hover":839,"../scatter/fill_hover_text":1048,"../scatterpolar/hover":1105}],852:[function(_dereq_,module,exports){ +},{"../../components/fx":610,"../../lib":694,"../../plots/polar/helpers":808,"../bar/hover":841,"../scatter/fill_hover_text":1055,"../scatterpolar/hover":1112}],854:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172963,9 +173409,9 @@ } }; -},{"../../plots/polar":807,"../bar/select":844,"../bar/style":846,"../scatter/marker_colorbar":1058,"./attributes":848,"./calc":849,"./defaults":850,"./hover":851,"./layout_attributes":853,"./layout_defaults":854,"./plot":855}],853:[function(_dereq_,module,exports){ +},{"../../plots/polar":809,"../bar/select":846,"../bar/style":848,"../scatter/marker_colorbar":1065,"./attributes":850,"./calc":851,"./defaults":852,"./hover":853,"./layout_attributes":855,"./layout_defaults":856,"./plot":857}],855:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -172994,9 +173440,9 @@ } }; -},{}],854:[function(_dereq_,module,exports){ +},{}],856:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173029,9 +173475,9 @@ } }; -},{"../../lib":692,"./layout_attributes":853}],855:[function(_dereq_,module,exports){ +},{"../../lib":694,"./layout_attributes":855}],857:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173137,9 +173583,9 @@ }; } -},{"../../components/drawing":590,"../../lib":692,"../../plots/polar/helpers":806,"d3":148,"fast-isnumeric":214}],856:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"../../plots/polar/helpers":808,"d3":149,"fast-isnumeric":215}],858:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173250,6 +173696,16 @@ editType: 'calc+clearAxisTypes', }, + + width: { + valType: 'number', + min: 0, + + dflt: 0, + editType: 'calc', + + }, + marker: { outliercolor: { valType: 'color', @@ -173318,7 +173774,6 @@ marker: scatterAttrs.unselected.marker, editType: 'style' }, - hoveron: { valType: 'flaglist', flags: ['boxes', 'points'], @@ -173329,9 +173784,9 @@ } }; -},{"../../components/color/attributes":568,"../../lib/extend":682,"../scatter/attributes":1040}],857:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../lib/extend":684,"../scatter/attributes":1047}],859:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173396,6 +173851,11 @@ } } + var cdi; + var ptFilterFn = (trace.boxpoints || trace.points) === 'all' ? + Lib.identity : + function(pt) { return (pt.v < cdi.lf || pt.v > cdi.uf); }; + // build calcdata trace items, one item per distinct position for(i = 0; i < pLen; i++) { if(ptsPerBin[i].length > 0) { @@ -173403,10 +173863,9 @@ var boxVals = pts.map(extractVal); var bvLen = boxVals.length; - var cdi = { - pos: posDistinct[i], - pts: pts - }; + cdi = {}; + cdi.pos = posDistinct[i]; + cdi.pts = pts; cdi.min = boxVals[0]; cdi.max = boxVals[bvLen - 1]; @@ -173442,13 +173901,14 @@ cdi.lo = 4 * cdi.q1 - 3 * cdi.q3; cdi.uo = 4 * cdi.q3 - 3 * cdi.q1; - // lower and upper notches ~95% Confidence Intervals for median var iqr = cdi.q3 - cdi.q1; var mci = 1.57 * iqr / Math.sqrt(bvLen); cdi.ln = cdi.med - mci; cdi.un = cdi.med + mci; + cdi.pts2 = pts.filter(ptFilterFn); + cd.push(cdi); } } @@ -173568,9 +174028,9 @@ function extractVal(o) { return o.v; } -},{"../../lib":692,"../../plots/cartesian/axes":740,"fast-isnumeric":214}],858:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"fast-isnumeric":215}],860:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173593,8 +174053,6 @@ var orientation = orientations[i]; var posAxis = orientation === 'h' ? ya : xa; var boxList = []; - var minPad = 0; - var maxPad = 0; // make list of boxes / candlesticks // For backward compatibility, candlesticks are treated as if they *are* box traces here @@ -173611,72 +174069,173 @@ trace.yaxis === ya._id ) { boxList.push(j); - - if(trace.boxpoints) { - minPad = Math.max(minPad, trace.jitter - trace.pointpos - 1); - maxPad = Math.max(maxPad, trace.jitter + trace.pointpos - 1); - } } } - setPositionOffset('box', gd, boxList, posAxis, [minPad, maxPad]); + setPositionOffset('box', gd, boxList, posAxis); } } -function setPositionOffset(traceType, gd, boxList, posAxis, pad) { +function setPositionOffset(traceType, gd, boxList, posAxis) { var calcdata = gd.calcdata; var fullLayout = gd._fullLayout; - var pointList = []; + var axId = posAxis._id; + var axLetter = axId.charAt(0); // N.B. reused in violin var numKey = traceType === 'violin' ? '_numViolins' : '_numBoxes'; var i, j, calcTrace; + var pointList = []; + var shownPts = 0; // make list of box points for(i = 0; i < boxList.length; i++) { calcTrace = calcdata[boxList[i]]; for(j = 0; j < calcTrace.length; j++) { pointList.push(calcTrace[j].pos); + shownPts += (calcTrace[j].pts2 || []).length; } } if(!pointList.length) return; // box plots - update dPos based on multiple traces - // and then use for posAxis autorange var boxdv = Lib.distinctVals(pointList); - var dPos = boxdv.minDiff / 2; - - // if there's no duplication of x points, - // disable 'group' mode by setting counter to 1 - if(pointList.length === boxdv.vals.length) { - fullLayout[numKey] = 1; - } + var dPos0 = boxdv.minDiff / 2; // check for forced minimum dtick Axes.minDtick(posAxis, boxdv.minDiff, boxdv.vals[0], true); - var gap = fullLayout[traceType + 'gap']; - var groupgap = fullLayout[traceType + 'groupgap']; - var padfactor = (1 - gap) * (1 - groupgap) * dPos / fullLayout[numKey]; - - // autoscale the x axis - including space for points if they're off the side - // TODO: this will overdo it if the outermost boxes don't have - // their points as far out as the other boxes - var extremes = Axes.findExtremes(posAxis, boxdv.vals, { - vpadminus: dPos + pad[0] * padfactor, - vpadplus: dPos + pad[1] * padfactor - }); + var num = fullLayout[numKey]; + var group = (fullLayout[traceType + 'mode'] === 'group' && num > 1); + var groupFraction = 1 - fullLayout[traceType + 'gap']; + var groupGapFraction = 1 - fullLayout[traceType + 'groupgap']; for(i = 0; i < boxList.length; i++) { calcTrace = calcdata[boxList[i]]; - // set the width of all boxes - calcTrace[0].t.dPos = dPos; - // link extremes to all boxes - calcTrace[0].trace._extremes[posAxis._id] = extremes; - } + var trace = calcTrace[0].trace; + var t = calcTrace[0].t; + var width = trace.width; + var side = trace.side; + + // position coordinate delta + var dPos; + // box half width; + var bdPos; + // box center offset + var bPos; + // half-width within which to accept hover for this box/violin + // always split the distance to the closest box/violin + var wHover; + + if(width) { + dPos = bdPos = wHover = width / 2; + bPos = 0; + } else { + dPos = dPos0; + bdPos = dPos * groupFraction * groupGapFraction / (group ? num : 1); + bPos = group ? 2 * dPos * (-0.5 + (t.num + 0.5) / num) * groupFraction : 0; + wHover = dPos * (group ? groupFraction / num : 1); + } + t.dPos = dPos; + t.bPos = bPos; + t.bdPos = bdPos; + t.wHover = wHover; + + // box/violin-only value-space push value + var pushplus; + var pushminus; + // edge of box/violin + var edge = bPos + bdPos; + var edgeplus; + var edgeminus; + + if(side === 'positive') { + pushplus = dPos * (width ? 1 : 0.5); + edgeplus = edge; + pushminus = edgeplus = bPos; + } else if(side === 'negative') { + pushplus = edgeplus = bPos; + pushminus = dPos * (width ? 1 : 0.5); + edgeminus = edge; + } else { + pushplus = pushminus = dPos; + edgeplus = edgeminus = edge; + } + + // value-space padding + var vpadplus; + var vpadminus; + // pixel-space padding + var ppadplus; + var ppadminus; + // do we add 5% of both sides (for points beyond box/violin) + var padded = false; + // does this trace show points? + var hasPts = (trace.boxpoints || trace.points) && (shownPts > 0); + + if(hasPts) { + var pointpos = trace.pointpos; + var jitter = trace.jitter; + var ms = trace.marker.size / 2; + + var pp = 0; + if((pointpos + jitter) >= 0) { + pp = edge * (pointpos + jitter); + if(pp > pushplus) { + // (++) beyond plus-value, use pp + padded = true; + ppadplus = ms; + vpadplus = pp; + } else if(pp > edgeplus) { + // (+), use push-value (it's bigger), but add px-pad + ppadplus = ms; + vpadplus = pushplus; + } + } + if(pp <= pushplus) { + // (->) fallback to push value + vpadplus = pushplus; + } + + var pm = 0; + if((pointpos - jitter) <= 0) { + pm = -edge * (pointpos - jitter); + if(pm > pushminus) { + // (--) beyond plus-value, use pp + padded = true; + ppadminus = ms; + vpadminus = pm; + } else if(pm > edgeminus) { + // (-), use push-value (it's bigger), but add px-pad + ppadminus = ms; + vpadminus = pushminus; + } + } + if(pm <= pushminus) { + // (<-) fallback to push value + vpadminus = pushminus; + } + } else { + vpadplus = pushplus; + vpadminus = pushminus; + } + + // calcdata[i][j] are in ascending order + var firstPos = calcTrace[0].pos; + var lastPos = calcTrace[calcTrace.length - 1].pos; + + trace._extremes[axId] = Axes.findExtremes(posAxis, [firstPos, lastPos], { + padded: padded, + vpadminus: vpadminus, + vpadplus: vpadplus, + // N.B. SVG px-space positive/negative + ppadminus: {x: ppadminus, y: ppadplus}[axLetter], + ppadplus: {x: ppadplus, y: ppadminus}[axLetter], + }); + } } module.exports = { @@ -173684,9 +174243,9 @@ setPositionOffset: setPositionOffset }; -},{"../../lib":692,"../../plots/cartesian/axes":740}],859:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742}],861:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173715,6 +174274,7 @@ coerce('whiskerwidth'); coerce('boxmean'); + coerce('width'); var notched = coerce('notched', traceIn.notchwidth !== undefined); if(notched) coerce('notchwidth'); @@ -173801,9 +174361,9 @@ handlePointsDefaults: handlePointsDefaults }; -},{"../../components/color":569,"../../lib":692,"../../registry":823,"./attributes":856}],860:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../registry":825,"./attributes":858}],862:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -173827,9 +174387,9 @@ return out; }; -},{}],861:[function(_dereq_,module,exports){ +},{}],863:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174070,15 +174630,25 @@ name: trace.name, x0: xc - rad, x1: xc + rad, - xLabelVal: pt.x, y0: yc - rad, y1: yc + rad, - yLabelVal: pt.y, spikeDistance: pointData.distance }); - var pLetter = trace.orientation === 'h' ? 'y' : 'x'; - var pa = trace.orientation === 'h' ? ya : xa; + + var pa; + if(trace.orientation === 'h') { + pa = ya; + closePtData.xLabelVal = pt.x; + closePtData.yLabelVal = di.pos; + } else { + pa = xa; + closePtData.xLabelVal = di.pos; + closePtData.yLabelVal = pt.y; + } + + var pLetter = pa._id.charAt(0); closePtData[pLetter + 'Spike'] = pa.c2p(di.pos, true); + fillHoverText(pt, trace, closePtData); return closePtData; @@ -174090,9 +174660,9 @@ hoverOnPoints: hoverOnPoints }; -},{"../../components/color":569,"../../components/fx":608,"../../lib":692,"../../plots/cartesian/axes":740,"../scatter/fill_hover_text":1048}],862:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx":610,"../../lib":694,"../../plots/cartesian/axes":742,"../scatter/fill_hover_text":1055}],864:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174126,9 +174696,9 @@ module.exports = Box; -},{"../../plots/cartesian":752,"./attributes":856,"./calc":857,"./cross_trace_calc":858,"./defaults":859,"./event_data":860,"./hover":861,"./layout_attributes":863,"./layout_defaults":864,"./plot":865,"./select":866,"./style":867}],863:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"./attributes":858,"./calc":859,"./cross_trace_calc":860,"./defaults":861,"./event_data":862,"./hover":863,"./layout_attributes":865,"./layout_defaults":866,"./plot":867,"./select":868,"./style":869}],865:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174167,9 +174737,9 @@ } }; -},{}],864:[function(_dereq_,module,exports){ +},{}],866:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174210,9 +174780,9 @@ _supply: _supply }; -},{"../../lib":692,"../../registry":823,"./layout_attributes":863}],865:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"./layout_attributes":865}],867:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174231,12 +174801,8 @@ var JITTERSPREAD = 0.01; // fraction of IQR to count as "dense" function plot(gd, plotinfo, cdbox, boxLayer) { - var fullLayout = gd._fullLayout; var xa = plotinfo.xaxis; var ya = plotinfo.yaxis; - var numBoxes = fullLayout._numBoxes; - var groupFraction = (1 - fullLayout.boxgap); - var group = (fullLayout.boxmode === 'group' && numBoxes > 1); Lib.makeTraceGroups(boxLayer, cdbox, 'trace boxes').each(function(cd) { var plotGroup = d3.select(this); @@ -174244,12 +174810,9 @@ var t = cd0.t; var trace = cd0.trace; if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; - // box half width - var bdPos = t.dPos * groupFraction * (1 - fullLayout.boxgroupgap) / (group ? numBoxes : 1); - // box center offset - var bPos = group ? 2 * t.dPos * (-0.5 + (t.num + 0.5) / numBoxes) * groupFraction : 0; + // whisker width - var wdPos = bdPos * trace.whiskerwidth; + t.wdPos = t.bdPos * trace.whiskerwidth; if(trace.visible !== true || t.empty) { plotGroup.remove(); @@ -174266,14 +174829,6 @@ valAxis = ya; } - // save the box size and box position for use by hover - t.bPos = bPos; - t.bdPos = bdPos; - t.wdPos = wdPos; - // half-width within which to accept hover for this box - // always split the distance to the closest box - t.wHover = t.dPos * (group ? groupFraction / numBoxes : 1); - plotBoxAndWhiskers(plotGroup, {pos: posAxis, val: valAxis}, trace, t); plotPoints(plotGroup, {x: xa, y: ya}, trace, t); plotBoxMean(plotGroup, {pos: posAxis, val: valAxis}, trace, t); @@ -174313,6 +174868,8 @@ paths.exit().remove(); paths.each(function(d) { + if(d.empty) return 'M0,0Z'; + var pos = d.pos; var posc = posAxis.c2p(pos + bPos, true) + bPosPxOffset; var pos0 = posAxis.c2p(pos + bPos - bdPos0, true) + bPosPxOffset; @@ -174403,10 +174960,7 @@ var paths = gPoints.selectAll('path') .data(function(d) { var i; - - var pts = mode === 'all' ? - d.pts : - d.pts.filter(function(pt) { return (pt.v < d.lf || pt.v > d.uf); }); + var pts = d.pts2; // normally use IQR, but if this is 0 or too small, use max-min var typicalSpread = Math.max((d.max - d.min) / 10, d.q3 - d.q1); @@ -174550,9 +175104,9 @@ plotBoxMean: plotBoxMean }; -},{"../../components/drawing":590,"../../lib":692,"d3":148}],866:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"d3":149}],868:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174599,9 +175153,9 @@ return selection; }; -},{}],867:[function(_dereq_,module,exports){ +},{}],869:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174634,14 +175188,15 @@ if(trace.type === 'candlestick') { allBoxes.each(function(boxData) { + if(boxData.empty) return; + var thisBox = d3.select(this); var container = trace[boxData.dir]; // dir = 'increasing' or 'decreasing' styleBox(thisBox, container.line.width, container.line.color, container.fillcolor); // TODO: custom selection style for candlesticks thisBox.style('opacity', trace.selectedpoints && !boxData.selected ? 0.3 : 1); }); - } - else { + } else { styleBox(allBoxes, lineWidth, trace.line.color, trace.fillcolor); el.selectAll('path.mean') .style({ @@ -174673,9 +175228,9 @@ styleOnSelect: styleOnSelect }; -},{"../../components/color":569,"../../components/drawing":590,"d3":148}],868:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"d3":149}],870:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174726,9 +175281,9 @@ hoverlabel: OHLCattrs.hoverlabel, }; -},{"../../lib":692,"../box/attributes":856,"../ohlc/attributes":988}],869:[function(_dereq_,module,exports){ +},{"../../lib":694,"../box/attributes":858,"../ohlc/attributes":995}],871:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174776,9 +175331,9 @@ }; } -},{"../../lib":692,"../../plots/cartesian/axes":740,"../ohlc/calc":989}],870:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../ohlc/calc":996}],872:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174821,9 +175376,9 @@ coerce(direction + '.fillcolor', Color.addOpacity(lineColor, 0.5)); } -},{"../../components/color":569,"../../lib":692,"../ohlc/ohlc_defaults":993,"./attributes":868}],871:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../ohlc/ohlc_defaults":1000,"./attributes":870}],873:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174854,9 +175409,9 @@ selectPoints: _dereq_('../ohlc/select') }; -},{"../../plots/cartesian":752,"../box/cross_trace_calc":858,"../box/layout_attributes":863,"../box/layout_defaults":864,"../box/plot":865,"../box/style":867,"../ohlc/hover":991,"../ohlc/select":995,"./attributes":868,"./calc":869,"./defaults":870}],872:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../box/cross_trace_calc":860,"../box/layout_attributes":865,"../box/layout_defaults":866,"../box/plot":867,"../box/style":869,"../ohlc/hover":998,"../ohlc/select":1002,"./attributes":870,"./calc":871,"./defaults":872}],874:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174918,9 +175473,9 @@ }); } -},{"../../plot_api/plot_template":730,"./axis_defaults":877}],873:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":732,"./axis_defaults":879}],875:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -174965,9 +175520,9 @@ return [min, max]; } -},{"../../lib":692}],874:[function(_dereq_,module,exports){ +},{"../../lib":694}],876:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175064,9 +175619,9 @@ transforms: undefined }; -},{"../../components/color/attributes":568,"../../plots/font_attributes":767,"./axis_attributes":876}],875:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../plots/font_attributes":769,"./axis_attributes":878}],877:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175171,9 +175726,9 @@ return segments; }; -},{"../../lib":692}],876:[function(_dereq_,module,exports){ +},{"../../lib":694}],878:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175578,9 +176133,9 @@ editType: 'calc' }; -},{"../../components/color/attributes":568,"../../plot_api/edit_types":723,"../../plots/cartesian/layout_attributes":753,"../../plots/font_attributes":767}],877:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../plot_api/edit_types":725,"../../plots/cartesian/layout_attributes":755,"../../plots/font_attributes":769}],879:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175613,9 +176168,9 @@ * bgColor: the plot background color, to calculate default gridline colors */ module.exports = function handleAxisDefaults(containerIn, containerOut, options) { - var letter = options.letter, - font = options.font || {}, - attributes = carpetAttrs[letter + 'axis']; + var letter = options.letter; + var font = options.font || {}; + var attributes = carpetAttrs[letter + 'axis']; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); @@ -175793,18 +176348,18 @@ // only autotype if type is '-' if(ax.type !== '-') return; - var id = ax._id, - axLetter = id.charAt(0); + var id = ax._id; + var axLetter = id.charAt(0); - var calAttr = axLetter + 'calendar', - calendar = ax[calAttr]; + var calAttr = axLetter + 'calendar'; + var calendar = ax[calAttr]; ax.type = autoType(data, calendar); } -},{"../../components/color":569,"../../lib":692,"../../plots/cartesian/axis_autotype":741,"../../plots/cartesian/category_order_defaults":744,"../../plots/cartesian/set_convert":759,"../../plots/cartesian/tick_label_defaults":760,"../../plots/cartesian/tick_value_defaults":762,"../../registry":823,"./attributes":874}],878:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../plots/cartesian/axis_autotype":743,"../../plots/cartesian/category_order_defaults":746,"../../plots/cartesian/set_convert":761,"../../plots/cartesian/tick_label_defaults":762,"../../plots/cartesian/tick_value_defaults":764,"../../registry":825,"./attributes":876}],880:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175912,9 +176467,9 @@ return [t]; }; -},{"../../lib":692,"../../plots/cartesian/axes":740,"../heatmap/clean_2d_array":944,"../heatmap/convert_column_xyz":946,"./array_minmax":873,"./calc_clippath":879,"./calc_gridlines":880,"./calc_labels":881,"./cheater_basis":883,"./set_convert":896,"./smooth_fill_2d_array":897}],879:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../heatmap/clean_2d_array":946,"../heatmap/convert_column_xyz":948,"./array_minmax":875,"./calc_clippath":881,"./calc_gridlines":882,"./calc_labels":883,"./cheater_basis":885,"./set_convert":898,"./smooth_fill_2d_array":899}],881:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -175964,9 +176519,9 @@ return segments; }; -},{}],880:[function(_dereq_,module,exports){ +},{}],882:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176307,9 +176862,9 @@ } }; -},{"../../lib/extend":682,"../../plots/cartesian/axes":740}],881:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../../plots/cartesian/axes":742}],883:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176368,9 +176923,9 @@ } }; -},{"../../lib/extend":682,"../../plots/cartesian/axes":740}],882:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../../plots/cartesian/axes":742}],884:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176391,16 +176946,17 @@ */ var CatmullRomExp = 0.5; module.exports = function makeControlPoints(p0, p1, p2, smoothness) { - var d1x = p0[0] - p1[0], - d1y = p0[1] - p1[1], - d2x = p2[0] - p1[0], - d2y = p2[1] - p1[1], - d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2), - d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2), - numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness, - numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness, - denom1 = d2a * (d1a + d2a) * 3, - denom2 = d1a * (d1a + d2a) * 3; + var d1x = p0[0] - p1[0]; + var d1y = p0[1] - p1[1]; + var d2x = p2[0] - p1[0]; + var d2y = p2[1] - p1[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 = d2a * (d1a + d2a) * 3; + var denom2 = d1a * (d1a + d2a) * 3; + return [[ p1[0] + (denom1 && numx / denom1), p1[1] + (denom1 && numy / denom1) @@ -176410,9 +176966,9 @@ ]]; }; -},{}],883:[function(_dereq_,module,exports){ +},{}],885:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176478,9 +177034,9 @@ return data; }; -},{"../../lib":692}],884:[function(_dereq_,module,exports){ +},{"../../lib":694}],886:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176830,9 +177386,9 @@ return [xe, ye]; }; -},{"../../lib":692,"./catmull_rom":882}],885:[function(_dereq_,module,exports){ +},{"../../lib":694,"./catmull_rom":884}],887:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176846,9 +177402,9 @@ RELATIVE_CULL_TOLERANCE: 1e-6 }; -},{}],886:[function(_dereq_,module,exports){ +},{}],888:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -176998,9 +177554,9 @@ } }; -},{}],887:[function(_dereq_,module,exports){ +},{}],889:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177126,9 +177682,9 @@ }; -},{}],888:[function(_dereq_,module,exports){ +},{}],890:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177277,9 +177833,9 @@ }; -},{}],889:[function(_dereq_,module,exports){ +},{}],891:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177336,9 +177892,9 @@ } }; -},{"../../components/color/attributes":568,"../../lib":692,"./ab_defaults":872,"./attributes":874,"./xy_defaults":898}],890:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../lib":694,"./ab_defaults":874,"./attributes":876,"./xy_defaults":900}],892:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177367,9 +177923,9 @@ module.exports = Carpet; -},{"../../plots/cartesian":752,"./attributes":874,"./calc":878,"./defaults":889,"./plot":895}],891:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"./attributes":876,"./calc":880,"./defaults":891,"./plot":897}],893:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177403,9 +177959,9 @@ return firstAxis; }; -},{}],892:[function(_dereq_,module,exports){ +},{}],894:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177418,7 +177974,8 @@ // Prevent d3 errors that would result otherwise: if(xp.length === 0) return ''; - var i, path = []; + var i; + var path = []; var stride = isBicubic ? 3 : 1; for(i = 0; i < xp.length; i += stride) { path.push(xp[i] + ',' + yp[i]); @@ -177434,9 +177991,9 @@ return path.join(isBicubic ? '' : 'L'); }; -},{}],893:[function(_dereq_,module,exports){ +},{}],895:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177471,9 +178028,9 @@ return out; }; -},{"../../lib":692}],894:[function(_dereq_,module,exports){ +},{"../../lib":694}],896:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177513,9 +178070,9 @@ }; }; -},{}],895:[function(_dereq_,module,exports){ +},{}],897:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -177758,9 +178315,9 @@ titleJoin.exit().remove(); } -},{"../../components/drawing":590,"../../constants/alignment":664,"../../lib":692,"../../lib/svg_text_utils":716,"./makepath":892,"./map_1d_array":893,"./orient_text":894,"d3":148}],896:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../constants/alignment":666,"../../lib":694,"../../lib/svg_text_utils":718,"./makepath":894,"./map_1d_array":895,"./orient_text":896,"d3":149}],898:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178041,9 +178598,9 @@ }; }; -},{"../../lib/search":711,"./compute_control_points":884,"./constants":885,"./create_i_derivative_evaluator":886,"./create_j_derivative_evaluator":887,"./create_spline_evaluator":888}],897:[function(_dereq_,module,exports){ +},{"../../lib/search":713,"./compute_control_points":886,"./constants":887,"./create_i_derivative_evaluator":888,"./create_j_derivative_evaluator":889,"./create_spline_evaluator":890}],899:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178264,9 +178821,9 @@ return data; }; -},{"../../lib":692}],898:[function(_dereq_,module,exports){ +},{"../../lib":694}],900:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178299,9 +178856,9 @@ return true; }; -},{"../../lib":692}],899:[function(_dereq_,module,exports){ +},{"../../lib":694}],901:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178310,6 +178867,7 @@ 'use strict'; +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); var scatterGeoAttrs = _dereq_('../scattergeo/attributes'); var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); @@ -178371,7 +178929,8 @@ hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { editType: 'calc', flags: ['location', 'z', 'text', 'name'] - }) + }), + hovertemplate: hovertemplateAttrs(), }, colorscaleAttrs('', { @@ -178381,9 +178940,9 @@ {colorbar: colorbarAttrs} ); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plots/attributes":737,"../scattergeo/attributes":1080}],900:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plots/attributes":739,"../scattergeo/attributes":1087}],902:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178424,9 +178983,9 @@ return calcTrace; }; -},{"../../components/colorscale/calc":577,"../../constants/numerical":669,"../scatter/arrays_to_calcdata":1039,"../scatter/calc_selection":1042,"fast-isnumeric":214}],901:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../constants/numerical":671,"../scatter/arrays_to_calcdata":1046,"../scatter/calc_selection":1049,"fast-isnumeric":215}],903:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178457,6 +179016,7 @@ coerce('locationmode'); coerce('text'); + coerce('hovertemplate'); coerce('marker.line.color'); coerce('marker.line.width'); @@ -178469,9 +179029,9 @@ Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":579,"../../lib":692,"./attributes":899}],902:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"./attributes":901}],904:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178488,9 +179048,9 @@ return out; }; -},{}],903:[function(_dereq_,module,exports){ +},{}],905:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178538,6 +179098,7 @@ pointData.index = pt.index; pointData.location = pt.loc; pointData.z = pt.z; + pointData.hovertemplate = pt.hovertemplate; makeHoverInfo(pointData, trace, pt, geo.mockAxis); @@ -178545,6 +179106,10 @@ }; function makeHoverInfo(pointData, trace, pt, axis) { + if(trace.hovertemplate) { + return; + } + var hoverinfo = pt.hi || trace.hoverinfo; var parts = (hoverinfo === 'all') ? @@ -178578,9 +179143,9 @@ pointData.extraText = text.join('
'); } -},{"../../plots/cartesian/axes":740,"../scatter/fill_hover_text":1048,"./attributes":899}],904:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":742,"../scatter/fill_hover_text":1055,"./attributes":901}],906:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178613,9 +179178,9 @@ module.exports = Choropleth; -},{"../../plots/geo":771,"../heatmap/colorbar":945,"./attributes":899,"./calc":900,"./defaults":901,"./event_data":902,"./hover":903,"./plot":905,"./select":906,"./style":907}],905:[function(_dereq_,module,exports){ +},{"../../plots/geo":773,"../heatmap/colorbar":947,"./attributes":901,"./calc":902,"./defaults":903,"./event_data":904,"./hover":905,"./plot":907,"./select":908,"./style":909}],907:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178781,9 +179346,9 @@ return polygons; } -},{"../../lib":692,"../../lib/geo_location_utils":685,"../../lib/polygon":704,"../../lib/topojson_utils":719,"./style":907,"d3":148}],906:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/geo_location_utils":687,"../../lib/polygon":706,"../../lib/topojson_utils":721,"./style":909,"d3":149}],908:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178830,9 +179395,9 @@ return selection; }; -},{}],907:[function(_dereq_,module,exports){ +},{}],909:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -178888,9 +179453,9 @@ styleOnSelect: styleOnSelect }; -},{"../../components/color":569,"../../components/colorscale":581,"../../components/drawing":590,"d3":148}],908:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/colorscale":583,"../../components/drawing":592,"d3":149}],910:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179042,9 +179607,9 @@ module.exports = attrs; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plots/attributes":737,"../mesh3d/attributes":983}],909:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plots/attributes":739,"../mesh3d/attributes":990}],911:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179086,9 +179651,9 @@ }); }; -},{"../../components/colorscale/calc":577}],910:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579}],912:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179169,7 +179734,7 @@ trace._len ); - coneOpts.colormap = parseColorScale(trace.colorscale); + coneOpts.colormap = parseColorScale(trace); coneOpts.vertexIntensityBounds = [trace.cmin / trace._normMax, trace.cmax / trace._normMax]; coneOpts.coneOffset = anchor2coneOffset[trace.anchor]; @@ -179231,9 +179796,9 @@ module.exports = createConeTrace; -},{"../../lib":692,"../../lib/gl_format_color":689,"../../plots/gl3d/zip3":794,"gl-cone3d":231}],911:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/gl_format_color":691,"../../plots/gl3d/zip3":796,"gl-cone3d":232}],913:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179291,9 +179856,9 @@ traceOut._length = null; }; -},{"../../components/colorscale/defaults":579,"../../lib":692,"./attributes":908}],912:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"./attributes":910}],914:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179322,9 +179887,9 @@ } }; -},{"../../plots/gl3d":783,"./attributes":908,"./calc":909,"./convert":910,"./defaults":911}],913:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":785,"./attributes":910,"./calc":911,"./convert":912,"./defaults":913}],915:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179501,9 +180066,9 @@ { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../components/drawing/attributes":589,"../../constants/filter_ops":665,"../../lib/extend":682,"../../plots/font_attributes":767,"../heatmap/attributes":942,"../scatter/attributes":1040}],914:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../components/drawing/attributes":591,"../../constants/filter_ops":667,"../../lib/extend":684,"../../plots/font_attributes":769,"../heatmap/attributes":944,"../scatter/attributes":1047}],916:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179525,9 +180090,9 @@ return cd; }; -},{"../heatmap/calc":943,"./set_contours":932}],915:[function(_dereq_,module,exports){ +},{"../heatmap/calc":945,"./set_contours":934}],917:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179592,9 +180157,9 @@ } }; -},{}],916:[function(_dereq_,module,exports){ +},{}],918:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179643,9 +180208,9 @@ .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":574,"./end_plus":924,"./make_color_map":929}],917:[function(_dereq_,module,exports){ +},{"../../components/colorbar/draw":576,"./end_plus":926,"./make_color_map":931}],919:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179721,9 +180286,9 @@ } }; -},{}],918:[function(_dereq_,module,exports){ +},{}],920:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179816,9 +180381,9 @@ } } -},{"../../components/color":569,"../../constants/filter_ops":665,"./label_defaults":928,"fast-isnumeric":214}],919:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../constants/filter_ops":667,"./label_defaults":930,"fast-isnumeric":215}],921:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179895,9 +180460,9 @@ }; } -},{"../../constants/filter_ops":665,"fast-isnumeric":214}],920:[function(_dereq_,module,exports){ +},{"../../constants/filter_ops":667,"fast-isnumeric":215}],922:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -179924,9 +180489,9 @@ if(autoContour || !contourSize) coerce('ncontours'); }; -},{}],921:[function(_dereq_,module,exports){ +},{}],923:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180012,9 +180577,9 @@ }); } -},{"../../lib":692}],922:[function(_dereq_,module,exports){ +},{"../../lib":694}],924:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180061,9 +180626,9 @@ } }; -},{"../../lib":692,"../heatmap/xyz_defaults":956,"./attributes":913,"./constraint_defaults":918,"./contours_defaults":920,"./style_defaults":934}],923:[function(_dereq_,module,exports){ +},{"../../lib":694,"../heatmap/xyz_defaults":958,"./attributes":915,"./constraint_defaults":920,"./contours_defaults":922,"./style_defaults":936}],925:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180125,9 +180690,9 @@ return pathinfo; }; -},{"../../lib":692,"./constraint_mapping":919,"./end_plus":924}],924:[function(_dereq_,module,exports){ +},{"../../lib":694,"./constraint_mapping":921,"./end_plus":926}],926:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180145,9 +180710,9 @@ return contours.end + contours.size / 1e6; }; -},{}],925:[function(_dereq_,module,exports){ +},{}],927:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180195,8 +180760,8 @@ // distance in index units - uses the 3rd and 4th items in points function ptDist(pt1, pt2) { - var dx = pt1[2] - pt2[2], - dy = pt1[3] - pt2[3]; + var dx = pt1[2] - pt2[2]; + var dy = pt1[3] - pt2[3]; return Math.sqrt(dx * dx + dy * dy); } @@ -180238,8 +180803,8 @@ locStr = loc.join(','); var atEdge = (marchStep[0] && (loc[0] < 0 || loc[0] > n - 2)) || - (marchStep[1] && (loc[1] < 0 || loc[1] > m - 2)), - closedLoop = (locStr === startLocStr) && (marchStep.join(',') === startStepStr); + (marchStep[1] && (loc[1] < 0 || loc[1] > m - 2)); + var closedLoop = (locStr === startLocStr) && (marchStep.join(',') === startStepStr); // have we completed a loop, or reached an edge? if((closedLoop) || (edgeflag && atEdge)) break; @@ -180388,8 +180953,8 @@ // special function to get the marching step of the // first point in the path (leading to loc) function startStep(mi, edgeflag, loc) { - var dx = 0, - dy = 0; + var dx = 0; + var dy = 0; if(mi > 20 && edgeflag) { // these saddles start at +/- x if(mi === 208 || mi === 1114) { @@ -180424,11 +180989,11 @@ * points into a path, because those routines require length-2 points. */ function getInterpPx(pi, loc, step) { - var locx = loc[0] + Math.max(step[0], 0), - locy = loc[1] + Math.max(step[1], 0), - zxy = pi.z[locy][locx], - xa = pi.xaxis, - ya = pi.yaxis; + var locx = loc[0] + Math.max(step[0], 0); + var locy = loc[1] + Math.max(step[1], 0); + var zxy = pi.z[locy][locx]; + var xa = pi.xaxis; + var ya = pi.yaxis; if(step[1]) { var dx = (pi.level - zxy) / (pi.z[locy][locx + 1] - zxy); @@ -180445,9 +181010,9 @@ } } -},{"../../lib":692,"./constants":917}],926:[function(_dereq_,module,exports){ +},{"../../lib":694,"./constants":919}],928:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180481,9 +181046,9 @@ return hoverData; }; -},{"../../components/color":569,"../heatmap/hover":949}],927:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../heatmap/hover":951}],929:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180513,9 +181078,9 @@ module.exports = Contour; -},{"../../plots/cartesian":752,"./attributes":913,"./calc":914,"./colorbar":916,"./defaults":922,"./hover":926,"./plot":931,"./style":933}],928:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"./attributes":915,"./calc":916,"./colorbar":918,"./defaults":924,"./hover":928,"./plot":933,"./style":935}],930:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180543,9 +181108,9 @@ if(opts.hasHover !== false) coerce('zhoverformat'); }; -},{"../../lib":692}],929:[function(_dereq_,module,exports){ +},{"../../lib":694}],931:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180560,12 +181125,12 @@ var endPlus = _dereq_('./end_plus'); module.exports = function makeColorMap(trace) { - var contours = trace.contours, - start = contours.start, - end = endPlus(contours), - cs = contours.size || 1, - nc = Math.floor((end - start) / cs) + 1, - extra = contours.coloring === 'lines' ? 0 : 1; + var contours = trace.contours; + var start = contours.start; + var end = endPlus(contours); + var cs = contours.size || 1; + var nc = Math.floor((end - start) / cs) + 1; + var extra = contours.coloring === 'lines' ? 0 : 1; if(!isFinite(cs)) { cs = 1; @@ -180597,10 +181162,14 @@ // do the contours extend beyond the colorscale? // if so, extend the colorscale with constants - var zRange = d3.extent([trace.zmin, trace.zmax, contours.start, - contours.start + cs * (nc - 1)]), - zmin = zRange[trace.zmin < trace.zmax ? 0 : 1], - zmax = zRange[trace.zmin < trace.zmax ? 1 : 0]; + var zRange = d3.extent([ + trace.zmin, + trace.zmax, + contours.start, + contours.start + cs * (nc - 1) + ]); + var zmin = zRange[trace.zmin < trace.zmax ? 0 : 1]; + var zmax = zRange[trace.zmin < trace.zmax ? 1 : 0]; if(zmin !== trace.zmin) { domain.splice(0, 0, zmin); @@ -180629,9 +181198,9 @@ }); }; -},{"../../components/colorscale":581,"./end_plus":924,"d3":148}],930:[function(_dereq_,module,exports){ +},{"../../components/colorscale":583,"./end_plus":926,"d3":149}],932:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180647,19 +181216,19 @@ // at every intersection, rather than just following a path // TODO: shorten the inner loop to only the relevant levels module.exports = function makeCrossings(pathinfo) { - var z = pathinfo[0].z, - m = z.length, - n = z[0].length, // we already made sure z isn't ragged in interp2d - twoWide = m === 2 || n === 2, - xi, - yi, - startIndices, - ystartIndices, - label, - corners, - mi, - pi, - i; + var z = pathinfo[0].z; + var m = z.length; + var n = z[0].length; // we already made sure z isn't ragged in interp2d + var twoWide = m === 2 || n === 2; + var xi; + var yi; + var startIndices; + var ystartIndices; + var label; + var corners; + var mi; + var pi; + var i; for(yi = 0; yi < m - 1; yi++) { ystartIndices = []; @@ -180721,9 +181290,9 @@ return (mi === 15) ? 0 : mi; } -},{"./constants":917}],931:[function(_dereq_,module,exports){ +},{"./constants":919}],933:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -180780,16 +181349,16 @@ makeCrossings(pathinfo); findAllPaths(pathinfo); - var leftedge = xa.c2p(x[0], true), - rightedge = xa.c2p(x[x.length - 1], true), - bottomedge = ya.c2p(y[0], true), - topedge = ya.c2p(y[y.length - 1], true), - perimeter = [ - [leftedge, topedge], - [rightedge, topedge], - [rightedge, bottomedge], - [leftedge, bottomedge] - ]; + var leftedge = xa.c2p(x[0], true); + var rightedge = xa.c2p(x[x.length - 1], true); + var bottomedge = ya.c2p(y[0], true); + var topedge = ya.c2p(y[y.length - 1], true); + var perimeter = [ + [leftedge, topedge], + [rightedge, topedge], + [rightedge, bottomedge], + [leftedge, bottomedge] + ]; var fillPathinfo = pathinfo; if(contours.type === 'constraint') { @@ -180853,16 +181422,16 @@ } function joinAllPaths(pi, perimeter) { - var fullpath = initFullPath(pi, perimeter), - i = 0, - startsleft = pi.edgepaths.map(function(v, i) { return i; }), - newloop = true, - endpt, - newendpt, - cnt, - nexti, - possiblei, - addpath; + var fullpath = initFullPath(pi, perimeter); + var i = 0; + var startsleft = pi.edgepaths.map(function(v, i) { return i; }); + var newloop = true; + var endpt; + var newendpt; + var cnt; + var nexti; + var possiblei; + var addpath; function istop(pt) { return Math.abs(pt[1] - perimeter[0][1]) < 0.01; } function isbottom(pt) { return Math.abs(pt[1] - perimeter[2][1]) < 0.01; } @@ -181388,13 +181957,13 @@ } function makeClipMask(cd0) { - var empties = cd0.trace._emptypoints, - z = [], - m = cd0.z.length, - n = cd0.z[0].length, - i, - row = [], - emptyPoint; + var empties = cd0.trace._emptypoints; + var z = []; + var m = cd0.z.length; + var n = cd0.z[0].length; + var i; + var row = []; + var emptyPoint; for(i = 0; i < n; i++) row.push(1); for(i = 0; i < m; i++) z.push(row.slice()); @@ -181407,9 +181976,9 @@ return z; } -},{"../../components/drawing":590,"../../lib":692,"../../lib/svg_text_utils":716,"../../plots/cartesian/axes":740,"../../plots/cartesian/set_convert":759,"../heatmap/plot":953,"./close_boundaries":915,"./constants":917,"./convert_to_constraints":921,"./empty_pathinfo":923,"./find_all_paths":925,"./make_crossings":930,"d3":148}],932:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"../../lib/svg_text_utils":718,"../../plots/cartesian/axes":742,"../../plots/cartesian/set_convert":761,"../heatmap/plot":955,"./close_boundaries":917,"./constants":919,"./convert_to_constraints":923,"./empty_pathinfo":925,"./find_all_paths":927,"./make_crossings":932,"d3":149}],934:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181465,9 +182034,9 @@ } else if(contours.type !== 'constraint') { // sanity checks on manually-supplied start/end/size - var start = contours.start, - end = contours.end, - inputContours = trace._input.contours; + var start = contours.start; + var end = contours.end; + var inputContours = trace._input.contours; if(start > end) { contours.start = inputContours.start = end; @@ -181511,9 +182080,9 @@ return dummyAx; } -},{"../../lib":692,"../../plots/cartesian/axes":740}],933:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742}],935:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181593,9 +182162,9 @@ heatmapStyle(gd); }; -},{"../../components/drawing":590,"../heatmap/style":954,"./make_color_map":929,"d3":148}],934:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../heatmap/style":956,"./make_color_map":931,"d3":149}],936:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181638,9 +182207,9 @@ handleLabelDefaults(coerce, layout, lineColor, opts); }; -},{"../../components/colorscale/defaults":579,"./label_defaults":928}],935:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"./label_defaults":930}],937:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181729,9 +182298,9 @@ { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../contour/attributes":913,"../heatmap/attributes":942,"../scatter/attributes":1040}],936:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../contour/attributes":915,"../heatmap/attributes":944,"../scatter/attributes":1047}],938:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181818,11 +182387,11 @@ interp2d(z, trace._emptypoints); // create arrays of brick boundaries, to be used by autorange and heatmap.plot - var xlen = Lib.maxRowLength(z), - xIn = trace.xtype === 'scaled' ? '' : a, - xArray = makeBoundArray(trace, xIn, a0, da, xlen, aax), - yIn = trace.ytype === 'scaled' ? '' : b, - yArray = makeBoundArray(trace, yIn, b0, db, z.length, bax); + var xlen = Lib.maxRowLength(z); + var xIn = trace.xtype === 'scaled' ? '' : a; + var xArray = makeBoundArray(trace, xIn, a0, da, xlen, aax); + var yIn = trace.ytype === 'scaled' ? '' : b; + var yArray = makeBoundArray(trace, yIn, b0, db, z.length, bax); var cd0 = { a: xArray, @@ -181842,9 +182411,9 @@ return [cd0]; } -},{"../../components/colorscale/calc":577,"../../lib":692,"../carpet/lookup_carpetid":891,"../contour/set_contours":932,"../heatmap/clean_2d_array":944,"../heatmap/convert_column_xyz":946,"../heatmap/find_empties":948,"../heatmap/interp2d":951,"../heatmap/make_bound_array":952,"./defaults":937}],937:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../lib":694,"../carpet/lookup_carpetid":893,"../contour/set_contours":934,"../heatmap/clean_2d_array":946,"../heatmap/convert_column_xyz":948,"../heatmap/find_empties":950,"../heatmap/interp2d":953,"../heatmap/make_bound_array":954,"./defaults":939}],939:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181912,9 +182481,9 @@ } }; -},{"../../lib":692,"../contour/constraint_defaults":918,"../contour/contours_defaults":920,"../contour/style_defaults":934,"../heatmap/xyz_defaults":956,"./attributes":935}],938:[function(_dereq_,module,exports){ +},{"../../lib":694,"../contour/constraint_defaults":920,"../contour/contours_defaults":922,"../contour/style_defaults":936,"../heatmap/xyz_defaults":958,"./attributes":937}],940:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -181943,9 +182512,9 @@ module.exports = ContourCarpet; -},{"../../plots/cartesian":752,"../contour/colorbar":916,"../contour/style":933,"./attributes":935,"./calc":936,"./defaults":937,"./plot":941}],939:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../contour/colorbar":918,"../contour/style":935,"./attributes":937,"./calc":938,"./defaults":939,"./plot":943}],941:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182077,9 +182646,9 @@ return fullpath; }; -},{"../../components/drawing":590,"../../lib":692,"../carpet/axis_aligned_line":875}],940:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"../carpet/axis_aligned_line":877}],942:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182114,9 +182683,9 @@ } }; -},{}],941:[function(_dereq_,module,exports){ +},{}],943:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182448,9 +183017,9 @@ }); } -},{"../../components/drawing":590,"../../lib":692,"../carpet/lookup_carpetid":891,"../carpet/makepath":892,"../carpet/map_1d_array":893,"../contour/close_boundaries":915,"../contour/constants":917,"../contour/convert_to_constraints":921,"../contour/empty_pathinfo":923,"../contour/find_all_paths":925,"../contour/make_crossings":930,"../contour/plot":931,"./join_all_paths":939,"./map_pathinfo":940,"d3":148}],942:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"../carpet/lookup_carpetid":893,"../carpet/makepath":894,"../carpet/map_1d_array":895,"../contour/close_boundaries":917,"../contour/constants":919,"../contour/convert_to_constraints":923,"../contour/empty_pathinfo":925,"../contour/find_all_paths":927,"../contour/make_crossings":932,"../contour/plot":933,"./join_all_paths":941,"./map_pathinfo":942,"d3":149}],944:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182551,9 +183120,9 @@ { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../scatter/attributes":1040}],943:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../scatter/attributes":1047}],945:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182579,21 +183148,21 @@ module.exports = function calc(gd, trace) { // prepare the raw data // run makeCalcdata on x and y even for heatmaps, in case of category mappings - var xa = Axes.getFromId(gd, trace.xaxis || 'x'), - ya = Axes.getFromId(gd, trace.yaxis || 'y'), - isContour = Registry.traceIs(trace, 'contour'), - isHist = Registry.traceIs(trace, 'histogram'), - isGL2D = Registry.traceIs(trace, 'gl2d'), - zsmooth = isContour ? 'best' : trace.zsmooth, - x, - x0, - dx, - y, - y0, - dy, - z, - i, - binned; + var xa = Axes.getFromId(gd, trace.xaxis || 'x'); + var ya = Axes.getFromId(gd, 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; + var x0; + var dx; + var y; + var y0; + var dy; + var z; + var i; + var binned; // cancel minimum tick spacings (only applies to bars and boxes) xa._minDtick = 0; @@ -182646,8 +183215,8 @@ } else if(!isHist) { if(x.length) { - var avgdx = (x[x.length - 1] - x[0]) / (x.length - 1), - maxErrX = Math.abs(avgdx / 100); + var avgdx = (x[x.length - 1] - x[0]) / (x.length - 1); + var maxErrX = Math.abs(avgdx / 100); for(i = 0; i < x.length - 1; i++) { if(Math.abs(x[i + 1] - x[i] - avgdx) > maxErrX) { noZsmooth('x scale is not linear'); @@ -182656,8 +183225,8 @@ } } if(y.length && zsmooth === 'fast') { - var avgdy = (y[y.length - 1] - y[0]) / (y.length - 1), - maxErrY = Math.abs(avgdy / 100); + var avgdy = (y[y.length - 1] - y[0]) / (y.length - 1); + var maxErrY = Math.abs(avgdy / 100); for(i = 0; i < y.length - 1; i++) { if(Math.abs(y[i + 1] - y[i] - avgdy) > maxErrY) { noZsmooth('y scale is not linear'); @@ -182719,9 +183288,9 @@ return [cd0]; }; -},{"../../components/colorscale/calc":577,"../../lib":692,"../../plots/cartesian/axes":740,"../../registry":823,"../histogram2d/calc":974,"./clean_2d_array":944,"./convert_column_xyz":946,"./find_empties":948,"./interp2d":951,"./make_bound_array":952}],944:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../lib":694,"../../plots/cartesian/axes":742,"../../registry":825,"../histogram2d/calc":976,"./clean_2d_array":946,"./convert_column_xyz":948,"./find_empties":950,"./interp2d":953,"./make_bound_array":954}],946:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182764,9 +183333,9 @@ return zNew; }; -},{"fast-isnumeric":214}],945:[function(_dereq_,module,exports){ +},{"fast-isnumeric":215}],947:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182780,9 +183349,9 @@ max: 'zmax' }; -},{}],946:[function(_dereq_,module,exports){ +},{}],948:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182842,9 +183411,9 @@ if(hasColumnText) trace._text = text; }; -},{"../../constants/numerical":669,"../../lib":692}],947:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694}],949:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182882,9 +183451,9 @@ colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":579,"../../lib":692,"./attributes":942,"./style_defaults":955,"./xyz_defaults":956}],948:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"./attributes":944,"./style_defaults":957,"./xyz_defaults":958}],950:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -182903,21 +183472,21 @@ * neighbors, and add a fractional neighborCount */ module.exports = function findEmpties(z) { - var empties = [], - neighborHash = {}, - noNeighborList = [], - nextRow = z[0], - row = [], - blank = [0, 0, 0], - rowLength = maxRowLength(z), - prevRow, - i, - j, - thisPt, - p, - neighborCount, - newNeighborHash, - foundNewNeighbors; + 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; @@ -182988,9 +183557,9 @@ return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"../../lib":692}],949:[function(_dereq_,module,exports){ +},{"../../lib":694}],951:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183060,10 +183629,10 @@ ny = Math.max(0, Math.min(y2.length - 2, Lib.findBin(yval, y2))); } - var x0 = xa.c2p(x[nx]), - x1 = xa.c2p(x[nx + 1]), - y0 = ya.c2p(y[ny]), - y1 = ya.c2p(y[ny + 1]); + var x0 = xa.c2p(x[nx]); + var x1 = xa.c2p(x[nx + 1]); + var y0 = ya.c2p(y[ny]); + var y1 = ya.c2p(y[ny + 1]); if(contour) { x1 = x0; @@ -183117,9 +183686,9 @@ })]; }; -},{"../../components/fx":608,"../../lib":692,"../../plots/cartesian/axes":740}],950:[function(_dereq_,module,exports){ +},{"../../components/fx":610,"../../lib":694,"../../plots/cartesian/axes":742}],952:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183149,9 +183718,9 @@ module.exports = Heatmap; -},{"../../plots/cartesian":752,"./attributes":942,"./calc":943,"./colorbar":945,"./defaults":947,"./hover":949,"./plot":953,"./style":954}],951:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"./attributes":944,"./calc":945,"./colorbar":947,"./defaults":949,"./hover":951,"./plot":955,"./style":956}],953:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183214,20 +183783,20 @@ }; function iterateInterp2d(z, emptyPoints, overshoot) { - var maxFractionalChange = 0, - thisPt, - i, - j, - p, - q, - neighborShift, - neighborRow, - neighborVal, - neighborCount, - neighborSum, - initialVal, - minNeighbor, - maxNeighbor; + 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]; @@ -183284,9 +183853,9 @@ return maxFractionalChange; } -},{"../../lib":692}],952:[function(_dereq_,module,exports){ +},{"../../lib":694}],954:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183299,13 +183868,13 @@ var isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray; module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { - var arrayOut = [], - isContour = Registry.traceIs(trace, 'contour'), - isHist = Registry.traceIs(trace, 'histogram'), - isGL2D = Registry.traceIs(trace, 'gl2d'), - v0, - dv, - i; + var arrayOut = []; + var isContour = Registry.traceIs(trace, 'contour'); + var isHist = Registry.traceIs(trace, 'histogram'); + var isGL2D = Registry.traceIs(trace, 'gl2d'); + var v0; + var dv; + var i; var isArrayOfTwoItemsOrMore = isArrayOrTypedArray(arrayIn) && arrayIn.length > 1; @@ -183332,8 +183901,8 @@ } if(len < numbricks) { - var lastPt = arrayOut[arrayOut.length - 1], - delta = lastPt - arrayOut[arrayOut.length - 2]; + var lastPt = arrayOut[arrayOut.length - 1]; + var delta = lastPt - arrayOut[arrayOut.length - 2]; for(i = len; i < numbricks; i++) { lastPt += delta; @@ -183372,9 +183941,9 @@ return arrayOut; }; -},{"../../lib":692,"../../registry":823}],953:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],955:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183485,8 +184054,8 @@ bottom = Math.min((1 + extra) * ya._length, bottom); } - var imageWidth = Math.round(right - left), - imageHeight = Math.round(bottom - top); + var imageWidth = Math.round(right - left); + var imageHeight = Math.round(bottom - top); // setup image nodes @@ -183577,12 +184146,12 @@ var z00 = r0[xinterp.bin0]; if(z00 === undefined) return setColor(undefined, 1); - var z01 = r0[xinterp.bin1], - z10 = r1[xinterp.bin0], - z11 = r1[xinterp.bin1], - dx = (z01 - z00) || 0, - dy = (z10 - z00) || 0, - dxy; + var z01 = r0[xinterp.bin1]; + var z10 = r1[xinterp.bin0]; + var z11 = r1[xinterp.bin1]; + var dx = (z01 - z00) || 0; + var dy = (z10 - z00) || 0; + var dxy; // the bilinear interpolation term needs different calculations // for all the different permutations of missing data @@ -183604,13 +184173,12 @@ } if(zsmooth) { // best or fast, works fastest with imageData - var pxIndex = 0, - pixels; + var pxIndex = 0; + var pixels; try { pixels = new Uint8Array(imageWidth * imageHeight * 4); - } - catch(e) { + } catch(e) { pixels = new Array(imageWidth * imageHeight * 4); } @@ -183658,10 +184226,9 @@ var imageData = context.createImageData(imageWidth, imageHeight); try { imageData.data.set(pixels); - } - catch(e) { - var pxArray = imageData.data, - dlen = pxArray.length; + } catch(e) { + var pxArray = imageData.data; + var dlen = pxArray.length; for(j = 0; j < dlen; j ++) { pxArray[j] = pixels[j]; } @@ -183787,9 +184354,9 @@ pixels[pxIndex + 3] = Math.round(c[3] * 255); } -},{"../../components/colorscale":581,"../../constants/xmlns_namespaces":670,"../../lib":692,"../../registry":823,"d3":148,"tinycolor2":513}],954:[function(_dereq_,module,exports){ +},{"../../components/colorscale":583,"../../constants/xmlns_namespaces":672,"../../lib":694,"../../registry":825,"d3":149,"tinycolor2":515}],956:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183808,9 +184375,9 @@ }); }; -},{"d3":148}],955:[function(_dereq_,module,exports){ +},{"d3":149}],957:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183831,9 +184398,9 @@ coerce('zhoverformat'); }; -},{}],956:[function(_dereq_,module,exports){ +},{}],958:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183898,10 +184465,10 @@ } function isValidZ(z) { - var allRowsAreArrays = true, - oneRowIsFilled = false, - hasOneNumber = false, - zi; + var allRowsAreArrays = true; + var oneRowIsFilled = false; + var hasOneNumber = false; + var zi; /* * Without this step: @@ -183929,9 +184496,9 @@ return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../lib":692,"../../registry":823,"fast-isnumeric":214}],957:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"fast-isnumeric":215}],959:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -183972,9 +184539,9 @@ module.exports = overrideAll(attrs, 'calc', 'nested'); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plot_api/edit_types":723,"../heatmap/attributes":942}],958:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plot_api/edit_types":725,"../heatmap/attributes":944}],960:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184021,12 +184588,12 @@ var proto = Heatmap.prototype; proto.handlePick = function(pickResult) { - var options = this.options, - shape = options.shape, - index = pickResult.pointId, - xIndex = index % shape[0], - yIndex = Math.floor(index / shape[0]), - zIndex = index; + var options = this.options; + var shape = options.shape; + var index = pickResult.pointId; + var xIndex = index % shape[0]; + var yIndex = Math.floor(index / shape[0]); + var zIndex = index; return { trace: this, @@ -184054,8 +184621,8 @@ var z = calcPt.z; this.options.z = [].concat.apply([], z); - var rowLen = z[0].length, - colLen = z.length; + var rowLen = z[0].length; + var colLen = z.length; this.options.shape = [rowLen, colLen]; this.options.x = calcPt.x; @@ -184081,13 +184648,13 @@ }; function convertColorscale(fullTrace) { - var scl = fullTrace.colorscale, - zmin = fullTrace.zmin, - zmax = fullTrace.zmax; - - var N = scl.length, - domain = new Array(N), - range = new Array(4 * N); + var scl = fullTrace.colorscale; + var zmin = fullTrace.zmin; + var zmax = fullTrace.zmax; + + var N = scl.length; + var domain = new Array(N); + var range = new Array(4 * N); for(var i = 0; i < N; i++) { var si = scl[i]; @@ -184114,9 +184681,9 @@ module.exports = createHeatmap; -},{"../../lib/str2rgbarray":715,"../../plots/cartesian/axes":740,"gl-heatmap2d":241}],959:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":717,"../../plots/cartesian/axes":742,"gl-heatmap2d":242}],961:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184145,9 +184712,9 @@ module.exports = HeatmapGl; -},{"../../plots/gl2d":780,"../heatmap/calc":943,"../heatmap/colorbar":945,"../heatmap/defaults":947,"./attributes":957,"./convert":958}],960:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":782,"../heatmap/calc":945,"../heatmap/colorbar":947,"../heatmap/defaults":949,"./attributes":959,"./convert":960}],962:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184269,9 +184836,9 @@ } }; -},{"../../components/fx/hovertemplate_attributes":607,"../bar/attributes":833,"./bin_attributes":962,"./constants":966}],961:[function(_dereq_,module,exports){ +},{"../../components/fx/hovertemplate_attributes":609,"../bar/attributes":835,"./bin_attributes":964,"./constants":968}],963:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184283,8 +184850,8 @@ module.exports = function doAvg(size, counts) { - var nMax = size.length, - total = 0; + var nMax = size.length; + var total = 0; for(var i = 0; i < nMax; i++) { if(counts[i]) { size[i] /= counts[i]; @@ -184295,9 +184862,9 @@ return total; }; -},{}],962:[function(_dereq_,module,exports){ +},{}],964:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184330,9 +184897,9 @@ }; }; -},{}],963:[function(_dereq_,module,exports){ +},{}],965:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184406,9 +184973,9 @@ } }; -},{"fast-isnumeric":214}],964:[function(_dereq_,module,exports){ +},{"fast-isnumeric":215}],966:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -184584,9 +185151,9 @@ return parts; } -},{"../../constants/numerical":669,"../../plots/cartesian/axes":740}],965:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../plots/cartesian/axes":742}],967:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185117,9 +185684,9 @@ } } -},{"../../lib":692,"../../plots/cartesian/axes":740,"../bar/arrays_to_calcdata":832,"./average":961,"./bin_functions":963,"./bin_label_vals":964,"./norm_functions":972,"fast-isnumeric":214}],966:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../bar/arrays_to_calcdata":834,"./average":963,"./bin_functions":965,"./bin_label_vals":966,"./norm_functions":974,"fast-isnumeric":215}],968:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185133,9 +185700,9 @@ eventDataKeys: ['binNumber'] }; -},{}],967:[function(_dereq_,module,exports){ +},{}],969:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185247,9 +185814,9 @@ } }; -},{"../../lib":692,"./attributes":960}],968:[function(_dereq_,module,exports){ +},{"../../lib":694,"./attributes":962}],970:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185312,17 +185879,19 @@ handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); + Lib.coerceSelectionMarkerOpacity(traceOut, coerce); + + var lineColor = (traceOut.marker.line || {}).color; + // override defaultColor for error bars with defaultLine var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); - - Lib.coerceSelectionMarkerOpacity(traceOut, coerce); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":569,"../../lib":692,"../../registry":823,"../bar/style_defaults":847,"./attributes":960}],969:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../../registry":825,"../bar/style_defaults":849,"./attributes":962}],971:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185366,9 +185935,9 @@ return out; }; -},{}],970:[function(_dereq_,module,exports){ +},{}],972:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185401,9 +185970,9 @@ return pts; }; -},{"../../plots/cartesian/axes":740,"../bar/hover":839}],971:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":742,"../bar/hover":841}],973:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185455,9 +186024,9 @@ module.exports = Histogram; -},{"../../plots/cartesian":752,"../bar/cross_trace_calc":836,"../bar/layout_attributes":841,"../bar/layout_defaults":842,"../bar/plot":843,"../bar/select":844,"../bar/style":846,"../scatter/marker_colorbar":1058,"./attributes":960,"./calc":965,"./cross_trace_defaults":967,"./defaults":968,"./event_data":969,"./hover":970}],972:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../bar/cross_trace_calc":838,"../bar/layout_attributes":843,"../bar/layout_defaults":844,"../bar/plot":845,"../bar/select":846,"../bar/style":848,"../scatter/marker_colorbar":1065,"./attributes":962,"./calc":967,"./cross_trace_defaults":969,"./defaults":970,"./event_data":971,"./hover":972}],974:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185470,8 +186039,8 @@ module.exports = { percent: function(size, total) { - var nMax = size.length, - norm = 100 / total; + var nMax = size.length; + var norm = 100 / total; for(var n = 0; n < nMax; n++) size[n] *= norm; }, probability: function(size, total) { @@ -185490,9 +186059,9 @@ } }; -},{}],973:[function(_dereq_,module,exports){ +},{}],975:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185549,9 +186118,9 @@ { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../heatmap/attributes":942,"../histogram/attributes":960,"../histogram/bin_attributes":962}],974:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../heatmap/attributes":944,"../histogram/attributes":962,"../histogram/bin_attributes":964}],976:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185631,10 +186200,10 @@ } // decrease end a little in case of rounding errors - var binSpec = trace.xbins, - binStart = xr2c(binSpec.start), - binEnd = xr2c(binSpec.end) + - (binStart - Axes.tickIncrement(binStart, binSpec.size, false, xcalendar)) / 1e6; + var binSpec = trace.xbins; + var binStart = xr2c(binSpec.start); + var binEnd = xr2c(binSpec.end) + + (binStart - Axes.tickIncrement(binStart, binSpec.size, false, xcalendar)) / 1e6; for(i = binStart; i < binEnd; i = Axes.tickIncrement(i, binSpec.size, false, xcalendar)) { onecol.push(sizeinit); @@ -185814,9 +186383,9 @@ return out; } -},{"../../lib":692,"../../plots/cartesian/axes":740,"../histogram/average":961,"../histogram/bin_functions":963,"../histogram/bin_label_vals":964,"../histogram/norm_functions":972}],975:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../histogram/average":963,"../histogram/bin_functions":965,"../histogram/bin_label_vals":966,"../histogram/norm_functions":974}],977:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185909,9 +186478,9 @@ } } -},{"../../constants/numerical":669,"../../lib":692,"../../plots/cartesian/axis_ids":743,"./attributes":973,"fast-isnumeric":214}],976:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../plots/cartesian/axis_ids":745,"./attributes":975,"fast-isnumeric":215}],978:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185943,9 +186512,9 @@ ); }; -},{"../../components/colorscale/defaults":579,"../../lib":692,"../heatmap/style_defaults":955,"./attributes":973,"./sample_defaults":979}],977:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"../heatmap/style_defaults":957,"./attributes":975,"./sample_defaults":981}],979:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -185977,9 +186546,9 @@ return pts; }; -},{"../../plots/cartesian/axes":740,"../heatmap/hover":949}],978:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":742,"../heatmap/hover":951}],980:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186013,9 +186582,9 @@ module.exports = Histogram2D; -},{"../../plots/cartesian":752,"../heatmap/calc":943,"../heatmap/colorbar":945,"../heatmap/plot":953,"../heatmap/style":954,"../histogram/event_data":969,"./attributes":973,"./cross_trace_defaults":975,"./defaults":976,"./hover":977}],979:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../heatmap/calc":945,"../heatmap/colorbar":947,"../heatmap/plot":955,"../heatmap/style":956,"../histogram/event_data":971,"./attributes":975,"./cross_trace_defaults":977,"./defaults":978,"./hover":979}],981:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186058,9 +186627,9 @@ coerce('autobiny'); }; -},{"../../lib":692,"../../registry":823}],980:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],982:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186104,9 +186673,9 @@ { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../contour/attributes":913,"../histogram2d/attributes":973}],981:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../contour/attributes":915,"../histogram2d/attributes":975}],983:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186140,9 +186709,9 @@ handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":692,"../contour/contours_defaults":920,"../contour/style_defaults":934,"../histogram2d/sample_defaults":979,"./attributes":980}],982:[function(_dereq_,module,exports){ +},{"../../lib":694,"../contour/contours_defaults":922,"../contour/style_defaults":936,"../histogram2d/sample_defaults":981,"./attributes":982}],984:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186175,9 +186744,9 @@ module.exports = Histogram2dContour; -},{"../../plots/cartesian":752,"../contour/calc":914,"../contour/colorbar":916,"../contour/hover":926,"../contour/plot":931,"../contour/style":933,"../histogram2d/cross_trace_defaults":975,"./attributes":980,"./defaults":981}],983:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../contour/calc":916,"../contour/colorbar":918,"../contour/hover":928,"../contour/plot":933,"../contour/style":935,"../histogram2d/cross_trace_defaults":977,"./attributes":982,"./defaults":983}],985:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186189,115 +186758,171 @@ var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); var surfaceAtts = _dereq_('../surface/attributes'); +var meshAttrs = _dereq_('../mesh3d/attributes'); var baseAttrs = _dereq_('../../plots/attributes'); var extendFlat = _dereq_('../../lib/extend').extendFlat; +var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -module.exports = extendFlat({ +function makeSliceAttr(axLetter) { + return { + show: { + valType: 'boolean', + + dflt: false, + + }, + locations: { + valType: 'data_array', + dflt: [], + + + }, + fill: { + valType: 'number', + + min: 0, + max: 1, + dflt: 1, + + } + }; +} + +function makeCapAttr(axLetter) { + return { + show: { + valType: 'boolean', + + dflt: true, + + }, + fill: { + valType: 'number', + + min: 0, + max: 1, + dflt: 1, + + } + }; +} + +var attrs = module.exports = overrideAll(extendFlat({ x: { valType: 'data_array', - editType: 'calc+clearAxisTypes', + }, y: { valType: 'data_array', - editType: 'calc+clearAxisTypes', + }, z: { valType: 'data_array', - editType: 'calc+clearAxisTypes', - }, - - i: { - valType: 'data_array', - editType: 'calc', }, - j: { + value: { valType: 'data_array', - editType: 'calc', - - }, - k: { - valType: 'data_array', - editType: 'calc', - }, - - text: { - valType: 'string', + isomin: { + valType: 'number', - dflt: '', - arrayOk: true, - editType: 'calc', }, - - delaunayaxis: { - valType: 'enumerated', + isomax: { + valType: 'number', - values: [ 'x', 'y', 'z' ], - dflt: 'z', - editType: 'calc', }, - alphahull: { - valType: 'number', - - dflt: -1, - editType: 'calc', - + surface: { + show: { + valType: 'boolean', + + dflt: true, + + }, + count: { + valType: 'integer', + + dflt: 2, + min: 1, + + }, + fill: { + valType: 'number', + + min: 0, + max: 1, + dflt: 1, + + }, + pattern: { + valType: 'flaglist', + flags: ['A', 'B', 'C', 'D', 'E'], + extras: ['all', 'odd', 'even'], + dflt: 'all', + + + } }, - intensity: { - valType: 'data_array', - editType: 'calc', - + spaceframe: { + show: { + valType: 'boolean', + + dflt: false, + + }, + fill: { + valType: 'number', + + min: 0, + max: 1, + dflt: 0.15, + + } }, - // Color field - color: { - valType: 'color', - - editType: 'calc', - + slices: { + x: makeSliceAttr('x'), + y: makeSliceAttr('y'), + z: makeSliceAttr('z') }, - vertexcolor: { - valType: 'data_array', - - editType: 'calc', - + + caps: { + x: makeCapAttr('x'), + y: makeCapAttr('y'), + z: makeCapAttr('z') }, - facecolor: { - valType: 'data_array', + + text: { + valType: 'string', - editType: 'calc', + dflt: '', + arrayOk: true, }, - transforms: undefined }, colorscaleAttrs('', { - colorAttr: '`intensity`', + colorAttr: '`value`', showScaleDflt: true, editTypeOverride: 'calc' }), { colorbar: colorbarAttrs, - opacity: surfaceAtts.opacity, - // Flat shaded mode flatshading: { valType: 'boolean', dflt: false, - editType: 'calc', }, @@ -186306,44 +186931,25 @@ }), color: surfaceAtts.contours.x.color, - width: surfaceAtts.contours.x.width, - editType: 'calc' + width: surfaceAtts.contours.x.width }, lightposition: { x: extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), y: extendFlat({}, surfaceAtts.lightposition.y, {dflt: 1e5}), - z: extendFlat({}, surfaceAtts.lightposition.z, {dflt: 0}), - editType: 'calc' + z: extendFlat({}, surfaceAtts.lightposition.z, {dflt: 0}) }, - lighting: extendFlat({ - vertexnormalsepsilon: { - valType: 'number', - - min: 0.00, - max: 1, - dflt: 1e-12, // otherwise finely tessellated things eg. the brain will have no specular light reflection - editType: 'calc', - - }, - facenormalsepsilon: { - valType: 'number', - - min: 0.00, - max: 1, - dflt: 1e-6, // even the brain model doesn't appear to need finer than this - editType: 'calc', - - }, - editType: 'calc' - }, surfaceAtts.lighting), + lighting: meshAttrs.lighting, - hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {editType: 'calc'}) -}); + hoverinfo: extendFlat({}, baseAttrs.hoverinfo) +}), 'calc', 'nested'); + +attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; +attrs.transforms = undefined; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plots/attributes":737,"../surface/attributes":1127}],984:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739,"../mesh3d/attributes":990,"../surface/attributes":1134}],986:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186355,18 +186961,34 @@ var colorscaleCalc = _dereq_('../../components/colorscale/calc'); module.exports = function calc(gd, trace) { - if(trace.intensity) { - colorscaleCalc(gd, trace, { - vals: trace.intensity, - containerStr: '', - cLetter: 'c' - }); + + trace._len = Math.min(trace.x.length, trace.y.length, trace.z.length, trace.value.length); + + var min = Infinity; + var max = -Infinity; + var len = trace.value.length; + for(var i = 0; i < len; i++) { + var v = trace.value[i]; + min = Math.min(min, v); + max = Math.max(max, v); } + + trace._minValues = min; + trace._maxValues = max; + + trace._vMin = (trace.isomin === undefined || trace.isomin === null) ? min : trace.isomin; + trace._vMax = (trace.isomax === undefined || trace.isomin === null) ? max : trace.isomax; + + colorscaleCalc(gd, trace, { + vals: [trace._vMin, trace._vMax], + containerStr: '', + cLetter: 'c' + }); }; -},{"../../components/colorscale/calc":577}],985:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579}],987:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186377,34 +186999,67 @@ 'use strict'; var createMesh = _dereq_('gl-mesh3d'); -var triangulate = _dereq_('delaunay-triangulate'); -var alphaShape = _dereq_('alpha-shape'); -var convexHull = _dereq_('convex-hull'); var parseColorScale = _dereq_('../../lib/gl_format_color').parseColorScale; var str2RgbaArray = _dereq_('../../lib/str2rgbarray'); var zip3 = _dereq_('../../plots/gl3d/zip3'); +var Lib = _dereq_('../../lib'); -function Mesh3DTrace(scene, mesh, uid) { +function distinctVals(col) { + return Lib.distinctVals(col).vals; +} + +function IsosurfaceTrace(scene, mesh, uid) { this.scene = scene; this.uid = uid; this.mesh = mesh; this.name = ''; - this.color = '#fff'; this.data = null; this.showContour = false; } -var proto = Mesh3DTrace.prototype; - -proto.handlePick = function(selection) { - if(selection.object === this.mesh) { - var selectIndex = selection.index = selection.data.index; +var proto = IsosurfaceTrace.prototype; - selection.traceCoordinate = [ - this.data.x[selectIndex], - this.data.y[selectIndex], - this.data.z[selectIndex] +function findNearestOnAxis(w, arr) { + for(var q = arr.length - 1; q > 0; q--) { + var min = Math.min(arr[q], arr[q - 1]); + var max = Math.max(arr[q], arr[q - 1]); + if(max > min && min < w && w <= max) { + return { + id: q, + distRatio: (max - w) / (max - min) + }; + } + } + return { + id: 0, + distRatio: 0 + }; +} + +proto.handlePick = function(selection) { + if(selection.object === this.mesh) { + + var rawId = selection.data.index; + + var x = this.data._x[rawId]; + var y = this.data._y[rawId]; + var z = this.data._z[rawId]; + + var height = this.data._Ys.length; + var depth = this.data._Zs.length; + + var i = findNearestOnAxis(x, this.data._Xs).id; + var j = findNearestOnAxis(y, this.data._Ys).id; + var k = findNearestOnAxis(z, this.data._Zs).id; + + var selectIndex = selection.index = k + depth * j + depth * height * i; + + selection.traceCoordinate = [ + this.data._x[selectIndex], + this.data._y[selectIndex], + this.data._z[selectIndex], + this.data.value[selectIndex] ]; var text = this.data.text; @@ -186418,15 +187073,11 @@ } }; -function parseColorArray(colors) { - return colors.map(str2RgbaArray); -} - proto.update = function(data) { - var scene = this.scene, - layout = scene.fullSceneLayout; + var scene = this.scene; + var layout = scene.fullSceneLayout; - this.data = data; + this.data = generateIsosurfaceMesh(data); // Unpack position data function toDataCoords(axis, coord, scale, calendar) { @@ -186436,25 +187087,1361 @@ } var positions = zip3( + toDataCoords(layout.xaxis, data._x, scene.dataScale[0], data.xcalendar), + toDataCoords(layout.yaxis, data._y, scene.dataScale[1], data.ycalendar), + toDataCoords(layout.zaxis, data._z, scene.dataScale[2], data.zcalendar)); + + var cells = zip3(data._i, data._j, data._k); + + var config = { + positions: positions, + cells: cells, + lightPosition: [data.lightposition.x, data.lightposition.y, data.lightposition.z], + ambient: data.lighting.ambient, + diffuse: data.lighting.diffuse, + specular: data.lighting.specular, + roughness: data.lighting.roughness, + fresnel: data.lighting.fresnel, + vertexNormalsEpsilon: data.lighting.vertexnormalsepsilon, + faceNormalsEpsilon: data.lighting.facenormalsepsilon, + opacity: 1, // Note: no need to create transparent surfaces + contourEnable: data.contour.show, + contourColor: str2RgbaArray(data.contour.color).slice(0, 3), + contourWidth: data.contour.width, + useFacetNormals: data.flatshading + }; + + config.vertexIntensity = data._intensity; + config.vertexIntensityBounds = [data.cmin, data.cmax]; + config.colormap = parseColorScale(data); + + // Update mesh + this.mesh.update(config); +}; + +proto.dispose = function() { + this.scene.glplot.remove(this.mesh); + this.mesh.dispose(); +}; + +function generateIsosurfaceMesh(data) { + + data._i = []; + data._j = []; + data._k = []; + + var showSurface = data.surface.show; + var showSpaceframe = data.spaceframe.show; + + var surfaceFill = data.surface.fill; + var spaceframeFill = data.spaceframe.fill; + + var drawingSurface = false; + var drawingSpaceframe = false; + var drawingEdge = false; + + var numFaces = 0; + var numVertices; + var beginVertextLength; + + var Xs = distinctVals(data.x.slice(0, data._len)); + var Ys = distinctVals(data.y.slice(0, data._len)); + var Zs = distinctVals(data.z.slice(0, data._len)); + + var width = Xs.length; + var height = Ys.length; + var depth = Zs.length; + + function getIndex(i, j, k) { + return k + depth * j + depth * height * i; + } + + var minValues = data._minValues; + var maxValues = data._maxValues; + + var vMin = data._vMin; + var vMax = data._vMax; + + var allXs; + var allYs; + var allZs; + var allVs; + + function findVertexId(x, y, z) { + // could be used to find the vertex id of previously generated vertex within the group + + var len = allVs.length; + for(var f = beginVertextLength; f < len; f++) { + if( + x === allXs[f] && + y === allYs[f] && + z === allZs[f] + ) { + return f; + } + } + return -1; + } + + function beginGroup() { + beginVertextLength = numVertices; + } + + function emptyVertices() { + allXs = []; + allYs = []; + allZs = []; + allVs = []; + numVertices = 0; + + beginGroup(); + } + + function addVertex(x, y, z, v) { + allXs.push(x); + allYs.push(y); + allZs.push(z); + allVs.push(v); + numVertices++; + + return numVertices - 1; + } + + function addFace(a, b, c) { + data._i.push(a); + data._j.push(b); + data._k.push(c); + numFaces++; + + return numFaces - 1; + } + + function getCenter(A, B, C) { + var M = []; + for(var i = 0; i < A.length; i++) { + M[i] = (A[i] + B[i] + C[i]) / 3.0; + } + return M; + } + + function getBetween(A, B, r) { + var M = []; + for(var i = 0; i < A.length; i++) { + M[i] = A[i] * (1 - r) + r * B[i]; + } + return M; + } + + var activeFill; + function setFill(fill) { + activeFill = fill; + } + + function createOpenTri(xyzv, abc) { + var A = xyzv[0]; + var B = xyzv[1]; + var C = xyzv[2]; + var G = getCenter(A, B, C); + + var r = Math.sqrt(1 - activeFill); + var p1 = getBetween(G, A, r); + var p2 = getBetween(G, B, r); + var p3 = getBetween(G, C, r); + + var a = abc[0]; + var b = abc[1]; + var c = abc[2]; + + return { + xyzv: [ + [A, B, p2], [p2, p1, A], + [B, C, p3], [p3, p2, B], + [C, A, p1], [p1, p3, C] + ], + abc: [ + [a, b, -1], [-1, -1, a], + [b, c, -1], [-1, -1, b], + [c, a, -1], [-1, -1, c] + ] + }; + } + + function styleIncludes(style, char) { + if(style === 'all' || style === null) return true; + return (style.indexOf(char) > -1); + } + + function mapValue(style, value) { + if(style === null) return value; + return style; + } + + function drawTri(style, xyzv, abc) { + + beginGroup(); + + var allXYZVs = [xyzv]; + var allABCs = [abc]; + if(activeFill >= 1) { + allXYZVs = [xyzv]; + allABCs = [abc]; + } else if(activeFill > 0) { + var openTri = createOpenTri(xyzv, abc); + allXYZVs = openTri.xyzv; + allABCs = openTri.abc; + } + + for(var f = 0; f < allXYZVs.length; f++) { + + xyzv = allXYZVs[f]; + abc = allABCs[f]; + + var pnts = []; + for(var i = 0; i < 3; i++) { + + var x = xyzv[i][0]; + var y = xyzv[i][1]; + var z = xyzv[i][2]; + var v = xyzv[i][3]; + + var id = (abc[i] > -1) ? abc[i] : findVertexId(x, y, z); + if(id > -1) { + pnts[i] = id; + } else { + pnts[i] = addVertex(x, y, z, mapValue(style, v)); + } + } + + addFace(pnts[0], pnts[1], pnts[2]); + } + } + + function drawQuad(style, xyzv, abcd) { + var makeTri = function(i, j, k) { + drawTri(style, [xyzv[i], xyzv[j], xyzv[k]], [abcd[i], abcd[j], abcd[k]]); + }; + + makeTri(0, 1, 2); + makeTri(2, 3, 0); + } + + function drawTetra(style, xyzv, abcd) { + var makeTri = function(i, j, k) { + drawTri(style, [xyzv[i], xyzv[j], xyzv[k]], [abcd[i], abcd[j], abcd[k]]); + }; + + makeTri(0, 1, 2); + makeTri(3, 0, 1); + makeTri(2, 3, 0); + makeTri(1, 2, 3); + } + + function calcIntersection(pointOut, pointIn, min, max) { + var value = pointOut[3]; + + if(value < min) value = min; + if(value > max) value = max; + + var ratio = (pointOut[3] - value) / (pointOut[3] - pointIn[3]); + + var result = []; + for(var s = 0; s < 4; s++) { + result[s] = (1 - ratio) * pointOut[s] + ratio * pointIn[s]; + } + return result; + } + + function inRange(value, min, max) { + return ( + value >= min && + value <= max + ); + } + + function almostInFinalRange(value) { + var vErr = 0.01 * (vMax - vMin); + return ( + value >= vMin - vErr && + value <= vMax + vErr + ); + } + + function getXYZV(indecies) { + var xyzv = []; + for(var q = 0; q < 4; q++) { + var index = indecies[q]; + xyzv.push( + [ + data.x[index], + data.y[index], + data.z[index], + data.value[index] + ] + ); + } + + return xyzv; + } + + function tryCreateTri(style, xyzv, abc, min, max, isSecondPass) { + + abc = [-1, -1, -1]; // Note: for the moment we had to override indices + // for planar surfaces (i.e. caps and slices) due to group shading + // bug of gl-mesh3d. But don't worry this would run faster! + + var tryDrawTri = function(style, xyzv, abc) { + if( // we check here if the points are in `real` iso-min/max range + almostInFinalRange(xyzv[0][3]) && + almostInFinalRange(xyzv[1][3]) && + almostInFinalRange(xyzv[2][3]) + ) { + drawTri(style, xyzv, abc); + } else if(!isSecondPass) { + tryCreateTri(style, xyzv, abc, vMin, vMax, true); // i.e. second pass + } + }; + + var ok = [ + inRange(xyzv[0][3], min, max), + inRange(xyzv[1][3], min, max), + inRange(xyzv[2][3], min, max) + ]; + + var interpolated = false; + + if(!ok[0] && !ok[1] && !ok[2]) { + return interpolated; + } + + if(ok[0] && ok[1] && ok[2]) { + if(!drawingEdge) { + tryDrawTri(style, xyzv, abc); + } + return interpolated; + } + + [ + [0, 1, 2], + [2, 0, 1], + [1, 2, 0] + ].forEach(function(e) { + if(ok[e[0]] && ok[e[1]] && !ok[e[2]]) { + var A = xyzv[e[0]]; + var B = xyzv[e[1]]; + var C = xyzv[e[2]]; + + var p1 = calcIntersection(C, A, min, max); + var p2 = calcIntersection(C, B, min, max); + + tryDrawTri(style, [p2, p1, A], [-1, -1, abc[e[0]]]); + tryDrawTri(style, [A, B, p2], [abc[e[0]], abc[e[1]], -1]); + + interpolated = true; + } + }); + if(interpolated) return interpolated; + + [ + [0, 1, 2], + [1, 2, 0], + [2, 0, 1] + ].forEach(function(e) { + if(ok[e[0]] && !ok[e[1]] && !ok[e[2]]) { + var A = xyzv[e[0]]; + var B = xyzv[e[1]]; + var C = xyzv[e[2]]; + + var p1 = calcIntersection(B, A, min, max); + var p2 = calcIntersection(C, A, min, max); + + tryDrawTri(style, [p2, p1, A], [-1, -1, abc[e[0]]]); + + interpolated = true; + } + }); + return interpolated; + } + + function tryCreateTetra(style, abcd, min, max) { + + var xyzv = getXYZV(abcd); + + var ok = [ + inRange(xyzv[0][3], min, max), + inRange(xyzv[1][3], min, max), + inRange(xyzv[2][3], min, max), + inRange(xyzv[3][3], min, max) + ]; + + var interpolated = false; + + if(!ok[0] && !ok[1] && !ok[2] && !ok[3]) { + return interpolated; + } + + if(ok[0] && ok[1] && ok[2] && ok[3]) { + if(drawingSpaceframe) { + drawTetra(style, xyzv, abcd); + } + return interpolated; + } + + [ + [0, 1, 2, 3], + [3, 0, 1, 2], + [2, 3, 0, 1], + [1, 2, 3, 0] + ].forEach(function(e) { + if(ok[e[0]] && ok[e[1]] && ok[e[2]] && !ok[e[3]]) { + var A = xyzv[e[0]]; + var B = xyzv[e[1]]; + var C = xyzv[e[2]]; + var D = xyzv[e[3]]; + + if(drawingSpaceframe) { + drawTri(style, [A, B, C], [abcd[e[0]], abcd[e[1]], abcd[e[2]]]); + } else { + var p1 = calcIntersection(D, A, min, max); + var p2 = calcIntersection(D, B, min, max); + var p3 = calcIntersection(D, C, min, max); + + drawTri(null, [p1, p2, p3], [-1, -1, -1]); + } + + interpolated = true; + } + }); + if(interpolated) return interpolated; + + [ + [0, 1, 2, 3], + [1, 2, 3, 0], + [2, 3, 0, 1], + [3, 0, 1, 2], + [0, 2, 3, 1], + [1, 3, 2, 0] + ].forEach(function(e) { + if(ok[e[0]] && ok[e[1]] && !ok[e[2]] && !ok[e[3]]) { + var A = xyzv[e[0]]; + var B = xyzv[e[1]]; + var C = xyzv[e[2]]; + var D = xyzv[e[3]]; + + var p1 = calcIntersection(C, A, min, max); + var p2 = calcIntersection(C, B, min, max); + var p3 = calcIntersection(D, B, min, max); + var p4 = calcIntersection(D, A, min, max); + + if(drawingSpaceframe) { + drawTri(style, [A, p4, p1], [abcd[e[0]], -1, -1]); + drawTri(style, [B, p2, p3], [abcd[e[1]], -1, -1]); + } else { + drawQuad(null, [p1, p2, p3, p4], [-1, -1, -1, -1]); + } + + interpolated = true; + } + }); + if(interpolated) return interpolated; + + [ + [0, 1, 2, 3], + [1, 2, 3, 0], + [2, 3, 0, 1], + [3, 0, 1, 2] + ].forEach(function(e) { + if(ok[e[0]] && !ok[e[1]] && !ok[e[2]] && !ok[e[3]]) { + var A = xyzv[e[0]]; + var B = xyzv[e[1]]; + var C = xyzv[e[2]]; + var D = xyzv[e[3]]; + + var p1 = calcIntersection(B, A, min, max); + var p2 = calcIntersection(C, A, min, max); + var p3 = calcIntersection(D, A, min, max); + + if(drawingSpaceframe) { + drawTri(style, [A, p1, p2], [abcd[e[0]], -1, -1]); + drawTri(style, [A, p2, p3], [abcd[e[0]], -1, -1]); + drawTri(style, [A, p3, p1], [abcd[e[0]], -1, -1]); + } else { + drawTri(null, [p1, p2, p3], [-1, -1, -1]); + } + + interpolated = true; + } + }); + return interpolated; + } + + function addCube(style, p000, p001, p010, p011, p100, p101, p110, p111, min, max) { + + if(drawingSurface) { + if(styleIncludes(style, 'A')) { + tryCreateTetra(null, [p000, p001, p010, p100], min, max); + } + if(styleIncludes(style, 'B')) { + tryCreateTetra(null, [p001, p010, p011, p111], min, max); + } + if(styleIncludes(style, 'C')) { + tryCreateTetra(null, [p001, p100, p101, p111], min, max); + } + if(styleIncludes(style, 'D')) { + tryCreateTetra(null, [p010, p100, p110, p111], min, max); + } + if(styleIncludes(style, 'E')) { + tryCreateTetra(null, [p001, p010, p100, p111], min, max); + } + } + + if(drawingSpaceframe) { + tryCreateTetra(style, [p001, p010, p100, p111], min, max); + } + } + + function addRect(style, a, b, c, d, min, max) { + tryCreateTri(style, getXYZV([a, b, c]), [a, b, c], min, max); + tryCreateTri(style, getXYZV([c, d, a]), [c, d, a], min, max); + } + + function begin2dCell(style, p00, p01, p10, p11, min, max, isEven) { + // used to create caps and/or slices on exact axis points + if(isEven) { + addRect(style, p00, p01, p11, p10, min, max); + } else { + addRect(style, p01, p11, p10, p00, min, max); + } + } + + function beginSection(style, i, j, k, min, max, distRatios) { + // used to create slices between axis points + + var A, B, C, D; + + var makeSection = function() { + tryCreateTri(style, [A, B, C], [-1, -1, -1], min, max); + tryCreateTri(style, [C, D, A], [-1, -1, -1], min, max); + }; + + var rX = distRatios[0]; + var rY = distRatios[1]; + var rZ = distRatios[2]; + + if(rX) { + A = getBetween(getXYZV([getIndex(i, j - 0, k - 0)])[0], getXYZV([getIndex(i - 1, j - 0, k - 0)])[0], rX); + B = getBetween(getXYZV([getIndex(i, j - 0, k - 1)])[0], getXYZV([getIndex(i - 1, j - 0, k - 1)])[0], rX); + C = getBetween(getXYZV([getIndex(i, j - 1, k - 1)])[0], getXYZV([getIndex(i - 1, j - 1, k - 1)])[0], rX); + D = getBetween(getXYZV([getIndex(i, j - 1, k - 0)])[0], getXYZV([getIndex(i - 1, j - 1, k - 0)])[0], rX); + makeSection(); + } + + if(rY) { + A = getBetween(getXYZV([getIndex(i - 0, j, k - 0)])[0], getXYZV([getIndex(i - 0, j - 1, k - 0)])[0], rY); + B = getBetween(getXYZV([getIndex(i - 0, j, k - 1)])[0], getXYZV([getIndex(i - 0, j - 1, k - 1)])[0], rY); + C = getBetween(getXYZV([getIndex(i - 1, j, k - 1)])[0], getXYZV([getIndex(i - 1, j - 1, k - 1)])[0], rY); + D = getBetween(getXYZV([getIndex(i - 1, j, k - 0)])[0], getXYZV([getIndex(i - 1, j - 1, k - 0)])[0], rY); + makeSection(); + } + + if(rZ) { + A = getBetween(getXYZV([getIndex(i - 0, j - 0, k)])[0], getXYZV([getIndex(i - 0, j - 0, k - 1)])[0], rZ); + B = getBetween(getXYZV([getIndex(i - 0, j - 1, k)])[0], getXYZV([getIndex(i - 0, j - 1, k - 1)])[0], rZ); + C = getBetween(getXYZV([getIndex(i - 1, j - 1, k)])[0], getXYZV([getIndex(i - 1, j - 1, k - 1)])[0], rZ); + D = getBetween(getXYZV([getIndex(i - 1, j - 0, k)])[0], getXYZV([getIndex(i - 1, j - 0, k - 1)])[0], rZ); + makeSection(); + } + } + + function begin3dCell(style, p000, p001, p010, p011, p100, p101, p110, p111, min, max, isEven) { + // used to create spaceframe and/or iso-surfaces + var cellStyle = style; + if(isEven) { + if(drawingSurface && style === 'even') cellStyle = null; + addCube(cellStyle, p000, p001, p010, p011, p100, p101, p110, p111, min, max); + } else { + if(drawingSurface && style === 'odd') cellStyle = null; + addCube(cellStyle, p111, p110, p101, p100, p011, p010, p001, p000, min, max); + } + } + + function draw2dX(style, items, min, max) { + for(var q = 0; q < items.length; q++) { + var i = items[q]; + for(var k = 1; k < depth; k++) { + for(var j = 1; j < height; j++) { + begin2dCell(style, + getIndex(i, j - 1, k - 1), + getIndex(i, j - 1, k), + getIndex(i, j, k - 1), + getIndex(i, j, k), + min, + max, + (i + j + k) % 2 + ); + } + } + } + } + + function draw2dY(style, items, min, max) { + for(var q = 0; q < items.length; q++) { + var j = items[q]; + for(var i = 1; i < width; i++) { + for(var k = 1; k < depth; k++) { + begin2dCell(style, + getIndex(i - 1, j, k - 1), + getIndex(i, j, k - 1), + getIndex(i - 1, j, k), + getIndex(i, j, k), + min, + max, + (i + j + k) % 2 + ); + } + } + } + } + + function draw2dZ(style, items, min, max) { + for(var q = 0; q < items.length; q++) { + var k = items[q]; + for(var j = 1; j < height; j++) { + for(var i = 1; i < width; i++) { + begin2dCell(style, + getIndex(i - 1, j - 1, k), + getIndex(i - 1, j, k), + getIndex(i, j - 1, k), + getIndex(i, j, k), + min, + max, + (i + j + k) % 2 + ); + } + } + } + } + + function draw3d(style, min, max) { + for(var k = 1; k < depth; k++) { + for(var j = 1; j < height; j++) { + for(var i = 1; i < width; i++) { + begin3dCell(style, + getIndex(i - 1, j - 1, k - 1), + getIndex(i - 1, j - 1, k), + getIndex(i - 1, j, k - 1), + getIndex(i - 1, j, k), + getIndex(i, j - 1, k - 1), + getIndex(i, j - 1, k), + getIndex(i, j, k - 1), + getIndex(i, j, k), + min, + max, + (i + j + k) % 2 + ); + } + } + } + } + + function drawSpaceframe(style, min, max) { + drawingSpaceframe = true; + draw3d(style, min, max); + drawingSpaceframe = false; + } + + function drawSurface(style, min, max) { + drawingSurface = true; + draw3d(style, min, max); + drawingSurface = false; + } + + function drawSectionX(style, items, min, max, distRatios) { + for(var q = 0; q < items.length; q++) { + var i = items[q]; + for(var k = 1; k < depth; k++) { + for(var j = 1; j < height; j++) { + beginSection(style, i, j, k, min, max, distRatios[q]); + } + } + } + } + + function drawSectionY(style, items, min, max, distRatios) { + for(var q = 0; q < items.length; q++) { + var j = items[q]; + for(var i = 1; i < width; i++) { + for(var k = 1; k < depth; k++) { + beginSection(style, i, j, k, min, max, distRatios[q]); + } + } + } + } + + function drawSectionZ(style, items, min, max, distRatios) { + for(var q = 0; q < items.length; q++) { + var k = items[q]; + for(var j = 1; j < height; j++) { + for(var i = 1; i < width; i++) { + beginSection(style, i, j, k, min, max, distRatios[q]); + } + } + } + } + + function createRange(a, b) { + var range = []; + for(var q = a; q < b; q++) { + range.push(q); + } + return range; + } + + function insertGridPoints() { + for(var i = 0; i < width; i++) { + for(var j = 0; j < height; j++) { + for(var k = 0; k < depth; k++) { + var index = getIndex(i, j, k); + addVertex( + data.x[index], + data.y[index], + data.z[index], + data.value[index] + ); + } + } + } + } + + function drawAll() { + + emptyVertices(); + + // insert grid points + insertGridPoints(); + + var activeStyle = null; + + // draw spaceframes + if(showSpaceframe && spaceframeFill) { + setFill(spaceframeFill); + + drawSpaceframe(activeStyle, vMin, vMax); + } + + // draw iso-surfaces + if(showSurface && surfaceFill) { + setFill(surfaceFill); + + var surfacePattern = data.surface.pattern; + var surfaceCount = data.surface.count; + for(var q = 0; q < surfaceCount; q++) { + var ratio = (surfaceCount === 1) ? 0.5 : q / (surfaceCount - 1); + var level = (1 - ratio) * vMin + ratio * vMax; + + var d1 = Math.abs(level - minValues); + var d2 = Math.abs(level - maxValues); + var ranges = (d1 > d2) ? + [minValues, level] : + [level, maxValues]; + + drawSurface(surfacePattern, ranges[0], ranges[1]); + } + } + + var setupMinMax = [ + [ Math.min(vMin, maxValues), Math.max(vMin, maxValues) ], + [ Math.min(minValues, vMax), Math.max(minValues, vMax) ] + ]; + + ['x', 'y', 'z'].forEach(function(e) { + for(var s = 0; s < setupMinMax.length; s++) { + + drawingEdge = (s === 0) ? false : true; + + var activeMin = setupMinMax[s][0]; + var activeMax = setupMinMax[s][1]; + + // draw slices + var slice = data.slices[e]; + if(slice.show && slice.fill) { + setFill(slice.fill); + + var exactIndices = []; + var ceilIndices = []; + var distRatios = []; + if(slice.locations.length) { + + for(var q = 0; q < slice.locations.length; q++) { + + var near = findNearestOnAxis( + slice.locations[q], + (e === 'x') ? Xs : + (e === 'y') ? Ys : Zs + ); + + if(near.distRatio === 0) { + exactIndices.push(near.id); + } else if(near.id > 0) { + ceilIndices.push(near.id); + if(e === 'x') { + distRatios.push([near.distRatio, 0, 0]); + } else if(e === 'y') { + distRatios.push([0, near.distRatio, 0]); + } else { + distRatios.push([0, 0, near.distRatio]); + } + } + } + } else { + if(e === 'x') { + exactIndices = createRange(1, width - 1); + } else if(e === 'y') { + exactIndices = createRange(1, height - 1); + } else { + exactIndices = createRange(1, depth - 1); + } + } + + if(ceilIndices.length > 0) { + if(e === 'x') { + drawSectionX(activeStyle, ceilIndices, activeMin, activeMax, distRatios); + } else if(e === 'y') { + drawSectionY(activeStyle, ceilIndices, activeMin, activeMax, distRatios); + } else { + drawSectionZ(activeStyle, ceilIndices, activeMin, activeMax, distRatios); + } + } + + if(exactIndices.length > 0) { + if(e === 'x') { + draw2dX(activeStyle, exactIndices, activeMin, activeMax); + } else if(e === 'y') { + draw2dY(activeStyle, exactIndices, activeMin, activeMax); + } else { + draw2dZ(activeStyle, exactIndices, activeMin, activeMax); + } + } + } + + // draw caps + var cap = data.caps[e]; + if(cap.show && cap.fill) { + setFill(cap.fill); + if(e === 'x') { + draw2dX(activeStyle, [0, width - 1], activeMin, activeMax); + } else if(e === 'y') { + draw2dY(activeStyle, [0, height - 1], activeMin, activeMax); + } else { + draw2dZ(activeStyle, [0, depth - 1], activeMin, activeMax); + } + } + } + }); + + // remove vertices arrays (i.e. grid points) in case no face was created. + if(numFaces === 0) { + emptyVertices(); + } + + data._x = allXs; + data._y = allYs; + data._z = allZs; + data._intensity = allVs; + + data._Xs = Xs; + data._Ys = Ys; + data._Zs = Zs; + } + + drawAll(); + + return data; +} + +function createIsosurfaceTrace(scene, data) { + + var gl = scene.glplot.gl; + var mesh = createMesh({gl: gl}); + var result = new IsosurfaceTrace(scene, mesh, data.uid); + + mesh._trace = result; + result.update(data); + scene.glplot.add(mesh); + return result; +} + +module.exports = createIsosurfaceTrace; + +},{"../../lib":694,"../../lib/gl_format_color":691,"../../lib/str2rgbarray":717,"../../plots/gl3d/zip3":796,"gl-mesh3d":270}],988:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +var Registry = _dereq_('../../registry'); +var Lib = _dereq_('../../lib'); +var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); +var attributes = _dereq_('./attributes'); + +module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { + function coerce(attr, dflt) { + return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); + } + + var isomin = coerce('isomin'); + var isomax = coerce('isomax'); + + if(isomax !== undefined && isomax !== null && + isomin !== undefined && isomin !== null && + isomin > isomax) { + // applying default values in this case: + traceOut.isomin = null; + traceOut.isomax = null; + } + + var x = coerce('x'); + var y = coerce('y'); + var z = coerce('z'); + var value = coerce('value'); + + if( + !x || !x.length || + !y || !y.length || + !z || !z.length || + !value || !value.length + ) { + traceOut.visible = false; + return; + } + + var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); + handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout); + + ['x', 'y', 'z'].forEach(function(dim) { + + var capDim = 'caps.' + dim; + var showCap = coerce(capDim + '.show'); + if(showCap) { + coerce(capDim + '.fill'); + } + + var sliceDim = 'slices.' + dim; + var showSlice = coerce(sliceDim + '.show'); + if(showSlice) { + coerce(sliceDim + '.fill'); + coerce(sliceDim + '.locations'); + } + }); + + var showSpaceframe = coerce('spaceframe.show'); + if(showSpaceframe) { + coerce('spaceframe.fill'); + } + + var showSurface = coerce('surface.show'); + if(showSurface) { + coerce('surface.count'); + coerce('surface.fill'); + coerce('surface.pattern'); + } + + var showContour = coerce('contour.show'); + if(showContour) { + coerce('contour.color'); + coerce('contour.width'); + } + + // Coerce remaining properties + [ + 'text', + 'lighting.ambient', + 'lighting.diffuse', + 'lighting.specular', + 'lighting.roughness', + 'lighting.fresnel', + 'lighting.vertexnormalsepsilon', + 'lighting.facenormalsepsilon', + 'lightposition.x', + 'lightposition.y', + 'lightposition.z', + 'flatshading', + ].forEach(function(x) { coerce(x); }); + + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); + + // disable 1D transforms (for now) + traceOut._length = null; +}; + +},{"../../components/colorscale/defaults":581,"../../lib":694,"../../registry":825,"./attributes":985}],989:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +var Isosurface = {}; + +Isosurface.attributes = _dereq_('./attributes'); +Isosurface.supplyDefaults = _dereq_('./defaults'); +Isosurface.calc = _dereq_('./calc'); +Isosurface.colorbar = { + min: 'cmin', + max: 'cmax' +}; +Isosurface.plot = _dereq_('./convert'); + +Isosurface.moduleType = 'trace'; +Isosurface.name = 'isosurface', +Isosurface.basePlotModule = _dereq_('../../plots/gl3d'); +Isosurface.categories = ['gl3d']; +Isosurface.meta = { + +}; + +module.exports = Isosurface; + +},{"../../plots/gl3d":785,"./attributes":985,"./calc":986,"./convert":987,"./defaults":988}],990:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var colorscaleAttrs = _dereq_('../../components/colorscale/attributes'); +var colorbarAttrs = _dereq_('../../components/colorbar/attributes'); +var surfaceAtts = _dereq_('../surface/attributes'); +var baseAttrs = _dereq_('../../plots/attributes'); + +var extendFlat = _dereq_('../../lib/extend').extendFlat; + +module.exports = extendFlat({ + x: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + + }, + y: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + + }, + z: { + valType: 'data_array', + editType: 'calc+clearAxisTypes', + + }, + + i: { + valType: 'data_array', + editType: 'calc', + + }, + j: { + valType: 'data_array', + editType: 'calc', + + + }, + k: { + valType: 'data_array', + editType: 'calc', + + + }, + + text: { + valType: 'string', + + dflt: '', + arrayOk: true, + editType: 'calc', + + }, + + delaunayaxis: { + valType: 'enumerated', + + values: [ 'x', 'y', 'z' ], + dflt: 'z', + editType: 'calc', + + }, + + alphahull: { + valType: 'number', + + dflt: -1, + editType: 'calc', + + }, + + intensity: { + valType: 'data_array', + editType: 'calc', + + }, + + // Color field + color: { + valType: 'color', + + editType: 'calc', + + }, + vertexcolor: { + valType: 'data_array', + + editType: 'calc', + + }, + facecolor: { + valType: 'data_array', + + editType: 'calc', + + }, + transforms: undefined +}, + +colorscaleAttrs('', { + colorAttr: '`intensity`', + showScaleDflt: true, + editTypeOverride: 'calc' +}), { + + colorbar: colorbarAttrs, + + opacity: surfaceAtts.opacity, + + // Flat shaded mode + flatshading: { + valType: 'boolean', + + dflt: false, + editType: 'calc', + + }, + + contour: { + show: extendFlat({}, surfaceAtts.contours.x.show, { + + }), + color: surfaceAtts.contours.x.color, + width: surfaceAtts.contours.x.width, + editType: 'calc' + }, + + lightposition: { + x: extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), + y: extendFlat({}, surfaceAtts.lightposition.y, {dflt: 1e5}), + z: extendFlat({}, surfaceAtts.lightposition.z, {dflt: 0}), + editType: 'calc' + }, + lighting: extendFlat({ + vertexnormalsepsilon: { + valType: 'number', + + min: 0.00, + max: 1, + dflt: 1e-12, // otherwise finely tessellated things eg. the brain will have no specular light reflection + editType: 'calc', + + }, + facenormalsepsilon: { + valType: 'number', + + min: 0.00, + max: 1, + dflt: 1e-6, // even the brain model doesn't appear to need finer than this + editType: 'calc', + + }, + editType: 'calc' + }, surfaceAtts.lighting), + + hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {editType: 'calc'}) +}); + +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plots/attributes":739,"../surface/attributes":1134}],991:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var colorscaleCalc = _dereq_('../../components/colorscale/calc'); + +module.exports = function calc(gd, trace) { + if(trace.intensity) { + colorscaleCalc(gd, trace, { + vals: trace.intensity, + containerStr: '', + cLetter: 'c' + }); + } +}; + +},{"../../components/colorscale/calc":579}],992:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +var createMesh = _dereq_('gl-mesh3d'); +var triangulate = _dereq_('delaunay-triangulate'); +var alphaShape = _dereq_('alpha-shape'); +var convexHull = _dereq_('convex-hull'); + +var parseColorScale = _dereq_('../../lib/gl_format_color').parseColorScale; +var str2RgbaArray = _dereq_('../../lib/str2rgbarray'); +var zip3 = _dereq_('../../plots/gl3d/zip3'); + +function Mesh3DTrace(scene, mesh, uid) { + this.scene = scene; + this.uid = uid; + this.mesh = mesh; + this.name = ''; + this.color = '#fff'; + this.data = null; + this.showContour = false; +} + +var proto = Mesh3DTrace.prototype; + +proto.handlePick = function(selection) { + if(selection.object === this.mesh) { + var selectIndex = selection.index = selection.data.index; + + selection.traceCoordinate = [ + this.data.x[selectIndex], + this.data.y[selectIndex], + this.data.z[selectIndex] + ]; + + var text = this.data.text; + if(Array.isArray(text) && text[selectIndex] !== undefined) { + selection.textLabel = text[selectIndex]; + } else if(text) { + selection.textLabel = text; + } + + return true; + } +}; + +function parseColorArray(colors) { + var b = []; + var len = colors.length; + for(var i = 0; i < len; i++) { + b[i] = str2RgbaArray(colors[i]); + } + return b; +} + +// Unpack position data +function toDataCoords(axis, coord, scale, calendar) { + var b = []; + var len = coord.length; + for(var i = 0; i < len; i++) { + b[i] = axis.d2l(coord[i], 0, calendar) * scale; + } + return b; +} + +// Round indices if passed as floats +function toRoundIndex(a) { + var b = []; + var len = a.length; + for(var i = 0; i < len; i++) { + b[i] = Math.round(a[i]); + } + return b; +} + +function delaunayCells(delaunayaxis, positions) { + var d = ['x', 'y', 'z'].indexOf(delaunayaxis); + var b = []; + var len = positions.length; + for(var i = 0; i < len; i++) { + b[i] = [positions[i][(d + 1) % 3], positions[i][(d + 2) % 3]]; + } + return triangulate(b); +} + +// Validate indices +function hasValidIndices(list, numVertices) { + var len = list.length; + for(var i = 0; i < len; i++) { + if(list[i] <= -0.5 || list[i] >= numVertices - 0.5) { // Note: the indices would be rounded -0.49 is valid. + return false; + } + } + return true; +} + +proto.update = function(data) { + var scene = this.scene; + var layout = scene.fullSceneLayout; + + this.data = data; + + var numVertices = data.x.length; + + var positions = zip3( toDataCoords(layout.xaxis, data.x, scene.dataScale[0], data.xcalendar), toDataCoords(layout.yaxis, data.y, scene.dataScale[1], data.ycalendar), - toDataCoords(layout.zaxis, data.z, scene.dataScale[2], data.zcalendar)); + toDataCoords(layout.zaxis, data.z, scene.dataScale[2], data.zcalendar) + ); var cells; if(data.i && data.j && data.k) { - cells = zip3(data.i, data.j, data.k); - } - else if(data.alphahull === 0) { + + if( + data.i.length !== data.j.length || + data.j.length !== data.k.length || + !hasValidIndices(data.i, numVertices) || + !hasValidIndices(data.j, numVertices) || + !hasValidIndices(data.k, numVertices) + ) { + return; + } + cells = zip3( + toRoundIndex(data.i), + toRoundIndex(data.j), + toRoundIndex(data.k) + ); + } else if(data.alphahull === 0) { cells = convexHull(positions); - } - else if(data.alphahull > 0) { + } else if(data.alphahull > 0) { cells = alphaShape(data.alphahull, positions); - } - else { - var d = ['x', 'y', 'z'].indexOf(data.delaunayaxis); - cells = triangulate(positions.map(function(c) { - return [c[(d + 1) % 3], c[(d + 2) % 3]]; - })); + } else { + cells = delaunayCells(data.delaunayaxis, positions); } var config = { @@ -186479,17 +188466,14 @@ this.color = '#fff'; config.vertexIntensity = data.intensity; config.vertexIntensityBounds = [data.cmin, data.cmax]; - config.colormap = parseColorScale(data.colorscale); - } - else if(data.vertexcolor) { + config.colormap = parseColorScale(data); + } else if(data.vertexcolor) { this.color = data.vertexcolor[0]; config.vertexColors = parseColorArray(data.vertexcolor); - } - else if(data.facecolor) { + } else if(data.facecolor) { this.color = data.facecolor[0]; config.cellColors = parseColorArray(data.facecolor); - } - else { + } else { this.color = data.color; config.meshColor = str2RgbaArray(data.color); } @@ -186515,9 +188499,9 @@ module.exports = createMesh3DTrace; -},{"../../lib/gl_format_color":689,"../../lib/str2rgbarray":715,"../../plots/gl3d/zip3":794,"alpha-shape":52,"convex-hull":118,"delaunay-triangulate":150,"gl-mesh3d":268}],986:[function(_dereq_,module,exports){ +},{"../../lib/gl_format_color":691,"../../lib/str2rgbarray":717,"../../plots/gl3d/zip3":796,"alpha-shape":53,"convex-hull":119,"delaunay-triangulate":151,"gl-mesh3d":270}],993:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186552,18 +188536,20 @@ } var coords = readComponents(['x', 'y', 'z']); - var indices = readComponents(['i', 'j', 'k']); - if(!coords) { traceOut.visible = false; return; } - if(indices) { - // otherwise, convert all face indices to ints - indices.forEach(function(index) { - for(var i = 0; i < index.length; ++i) index[i] |= 0; - }); + readComponents(['i', 'j', 'k']); + // three indices should be all provided or not + if( + (traceOut.i && (!traceOut.j || !traceOut.k)) || + (traceOut.j && (!traceOut.k || !traceOut.i)) || + (traceOut.k && (!traceOut.i || !traceOut.j)) + ) { + traceOut.visible = false; + return; } var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); @@ -186611,9 +188597,9 @@ traceOut._length = null; }; -},{"../../components/colorscale/defaults":579,"../../lib":692,"../../registry":823,"./attributes":983}],987:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"../../registry":825,"./attributes":990}],994:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186644,9 +188630,9 @@ module.exports = Mesh3D; -},{"../../plots/gl3d":783,"./attributes":983,"./calc":984,"./convert":985,"./defaults":986}],988:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":785,"./attributes":990,"./calc":991,"./convert":992,"./defaults":993}],995:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186754,9 +188740,9 @@ }), }; -},{"../../components/drawing/attributes":589,"../../components/fx/attributes":599,"../../lib":692,"../scatter/attributes":1040}],989:[function(_dereq_,module,exports){ +},{"../../components/drawing/attributes":591,"../../components/fx/attributes":601,"../../lib":694,"../scatter/attributes":1047}],996:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186846,6 +188832,8 @@ if(hasTextArray) pt.tx = trace.text[i]; cd.push(pt); + } else { + cd.push({empty: true}); } } @@ -186877,8 +188865,8 @@ var minDiff = trace._minDiff; if(!minDiff) { - var fullData = gd._fullData, - ohlcTracesOnThisXaxis = []; + var fullData = gd._fullData; + var ohlcTracesOnThisXaxis = []; minDiff = Infinity; @@ -186919,9 +188907,9 @@ calcCommon: calcCommon }; -},{"../../constants/numerical":669,"../../lib":692,"../../plots/cartesian/axes":740}],990:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../plots/cartesian/axes":742}],997:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -186964,9 +188952,9 @@ coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":692,"./attributes":988,"./ohlc_defaults":993}],991:[function(_dereq_,module,exports){ +},{"../../lib":694,"./attributes":995,"./ohlc_defaults":1000}],998:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187028,7 +189016,9 @@ } function dy(di) { - return Fx.inbox(di[minAttr] - yval, di[maxAttr] - yval, hoverPseudoDistance); + var min = di[minAttr]; + var max = di[maxAttr]; + return min === max || Fx.inbox(min - yval, max - yval, hoverPseudoDistance); } function dxy(di) { return (dx(di) + dy(di)) / 2; } @@ -187166,9 +189156,9 @@ hoverOnPoints: hoverOnPoints }; -},{"../../components/color":569,"../../components/fx":608,"../../lib":692,"../../plots/cartesian/axes":740,"../scatter/fill_hover_text":1048}],992:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx":610,"../../lib":694,"../../plots/cartesian/axes":742,"../scatter/fill_hover_text":1055}],999:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187195,9 +189185,9 @@ selectPoints: _dereq_('./select') }; -},{"../../plots/cartesian":752,"./attributes":988,"./calc":989,"./defaults":990,"./hover":991,"./plot":994,"./select":995,"./style":996}],993:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"./attributes":995,"./calc":996,"./defaults":997,"./hover":998,"./plot":1001,"./select":1002,"./style":1003}],1000:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187230,9 +189220,9 @@ return len; }; -},{"../../lib":692,"../../registry":823}],994:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],1001:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187270,6 +189260,8 @@ paths.exit().remove(); paths.attr('d', function(d) { + if(d.empty) return 'M0,0Z'; + var x = xa.c2p(d.pos, true); var xo = xa.c2p(d.pos - tickLen, true); var xc = xa.c2p(d.pos + tickLen, true); @@ -187286,9 +189278,9 @@ }); }; -},{"../../lib":692,"d3":148}],995:[function(_dereq_,module,exports){ +},{"../../lib":694,"d3":149}],1002:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187331,9 +189323,9 @@ return selection; }; -},{}],996:[function(_dereq_,module,exports){ +},{}],1003:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187357,6 +189349,8 @@ var trace = d[0].trace; d3.select(this).selectAll('path').each(function(di) { + if(di.empty) return; + var dirLine = trace[di.dir].line; d3.select(this) .style('fill', 'none') @@ -187368,9 +189362,9 @@ }); }; -},{"../../components/color":569,"../../components/drawing":590,"d3":148}],997:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"d3":149}],1004:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187528,9 +189522,9 @@ showlegend: undefined }; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plots/attributes":737,"../../plots/domain":766,"../../plots/font_attributes":767,"../scatter/attributes":1040}],998:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plots/attributes":739,"../../plots/domain":768,"../../plots/font_attributes":769,"../scatter/attributes":1047}],1005:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187564,9 +189558,9 @@ } }; -},{"../../plots/get_data":777,"./plot":1003}],999:[function(_dereq_,module,exports){ +},{"../../plots/get_data":779,"./plot":1010}],1006:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -187964,9 +189958,9 @@ } // Initialize Variables - var uniqueValueCounts = {}, - uniqueValueInds = {}, - inds = []; + var uniqueValueCounts = {}; + var uniqueValueInds = {}; + var inds = []; // Initialize uniqueValueCounts and uniqueValues.forEach(function(uniqueVal, valInd) { @@ -188075,9 +190069,9 @@ return true; } -},{"../../components/colorscale/calc":577,"../../components/colorscale/helpers":580,"../../components/drawing":590,"../../lib":692,"../../lib/filter_unique.js":683,"../../lib/gup":690}],1000:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../components/colorscale/helpers":582,"../../components/drawing":592,"../../lib":694,"../../lib/filter_unique.js":685,"../../lib/gup":692}],1007:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -188196,9 +190190,9 @@ Lib.coerceFont(coerce, 'tickfont', categoryfontDefault); }; -},{"../../components/colorscale/defaults":579,"../../components/colorscale/helpers":580,"../../lib":692,"../../plots/array_container_defaults":736,"../../plots/domain":766,"../parcoords/merge_length":1012,"./attributes":997}],1001:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../components/colorscale/helpers":582,"../../lib":694,"../../plots/array_container_defaults":738,"../../plots/domain":768,"../parcoords/merge_length":1019,"./attributes":1004}],1008:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -188229,9 +190223,9 @@ module.exports = Parcats; -},{"./attributes":997,"./base_plot":998,"./calc":999,"./defaults":1000,"./plot":1003}],1002:[function(_dereq_,module,exports){ +},{"./attributes":1004,"./base_plot":1005,"./calc":1006,"./defaults":1007,"./plot":1010}],1009:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -188596,8 +190590,8 @@ /** True if a category view model is in the right-most display dimension * @param {CategoryViewModel} d */ function catInRightDim(d) { - var numDims = d.parcatsViewModel.dimensions.length, - leftDimInd = d.parcatsViewModel.dimensions[numDims - 1].model.dimensionInd; + var numDims = d.parcatsViewModel.dimensions.length; + var leftDimInd = d.parcatsViewModel.dimensions[numDims - 1].model.dimensionInd; return d.model.dimensionInd === leftDimInd; } @@ -189290,9 +191284,9 @@ return; } - var dragDimInd = d.dragDimensionDisplayInd, - prevDimInd = dragDimInd - 1, - nextDimInd = dragDimInd + 1; + var dragDimInd = d.dragDimensionDisplayInd; + var prevDimInd = dragDimInd - 1; + var nextDimInd = dragDimInd + 1; var dragDimension = d.parcatsViewModel .dimensions[dragDimInd]; @@ -189688,14 +191682,14 @@ var margin = layout.margin || {l: 80, r: 80, t: 100, b: 80}; // Compute pixel position/extents - var trace = parcatsModel.trace, - domain = trace.domain, - figureWidth = layout.width, - figureHeight = layout.height, - traceWidth = Math.floor(figureWidth * (domain.x[1] - domain.x[0])), - traceHeight = Math.floor(figureHeight * (domain.y[1] - domain.y[0])), - traceX = domain.x[0] * figureWidth + margin.l, - traceY = layout.height - domain.y[1] * layout.height + margin.t; + var trace = parcatsModel.trace; + var domain = trace.domain; + var figureWidth = layout.width; + var figureHeight = layout.height; + var traceWidth = Math.floor(figureWidth * (domain.x[1] - domain.x[0])); + var traceHeight = Math.floor(figureHeight * (domain.y[1] - domain.y[0])); + var traceX = domain.x[0] * figureWidth + margin.l; + var traceY = layout.height - domain.y[1] * layout.height + margin.t; // Handle path shape // ----------------- @@ -189765,10 +191759,10 @@ function buildSvgPath(leftXPositions, pathYs, dimWidths, pathHeight, curvature) { // Compute the x midpoint of each path segment - var xRefPoints1 = [], - xRefPoints2 = [], - refInterpolator, - d; + var xRefPoints1 = []; + var xRefPoints2 = []; + var refInterpolator; + var d; for(d = 0; d < dimWidths.length - 1; d++) { refInterpolator = d3.interpolateNumber(dimWidths[d] + leftXPositions[d], leftXPositions[d + 1]); @@ -189913,12 +191907,11 @@ }); // Create path models - var pathViewModels = new Array(pathModels.length), - totalCount = dimensionViewModels[0].model.count, - totalHeight = dimensionViewModels[0].categories - .map(function(c) { - return c.height;}).reduce( - function(v1, v2) {return v1 + v2;}); + var pathViewModels = new Array(pathModels.length); + var totalCount = dimensionViewModels[0].model.count; + var totalHeight = dimensionViewModels[0].categories + .map(function(c) { return c.height; }) + .reduce(function(v1, v2) { return v1 + v2; }); for(var pathNumber = 0; pathNumber < pathModels.length; pathNumber++) { @@ -190039,15 +192032,15 @@ function createDimensionViewModel(parcatsViewModel, dimensionModel) { // Compute dimension x position - var categoryLabelPad = 40, - dimWidth = 16, - numDimensions = parcatsViewModel.model.dimensions.length, - displayInd = dimensionModel.displayInd; + var categoryLabelPad = 40; + var dimWidth = 16; + var numDimensions = parcatsViewModel.model.dimensions.length; + var displayInd = dimensionModel.displayInd; // Compute x coordinate values - var dimDx, - dimX0, - dimX; + var dimDx; + var dimX0; + var dimX; if(numDimensions > 1) { dimDx = (parcatsViewModel.width - 2 * categoryLabelPad - dimWidth) / (numDimensions - 1); @@ -190058,17 +192051,17 @@ dimX = dimX0 + dimDx * displayInd; // Compute categories - var categories = [], - maxCats = parcatsViewModel.model.maxCats, - numCats = dimensionModel.categories.length, - catSpacing = 8, - totalCount = dimensionModel.count, - totalHeight = parcatsViewModel.height - catSpacing * (maxCats - 1), - nextCatHeight, - nextCatModel, - nextCat, - catInd, - catDisplayInd; + var categories = []; + var maxCats = parcatsViewModel.model.maxCats; + var numCats = dimensionModel.categories.length; + var catSpacing = 8; + var totalCount = dimensionModel.count; + var totalHeight = parcatsViewModel.height - catSpacing * (maxCats - 1); + var nextCatHeight; + var nextCatModel; + var nextCat; + var catInd; + var catDisplayInd; // Compute starting Y offset var nextCatY = (maxCats - numCats) * catSpacing / 2.0; @@ -190314,9 +192307,9 @@ * The parent trace's view model */ -},{"../../components/drawing":590,"../../components/fx":608,"../../lib":692,"../../lib/svg_text_utils":716,"../../plot_api/plot_api":727,"d3":148,"tinycolor2":513}],1003:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../components/fx":610,"../../lib":694,"../../lib/svg_text_utils":718,"../../plot_api/plot_api":729,"d3":149,"tinycolor2":515}],1010:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -190335,9 +192328,9 @@ * @param {Array.} parcatsModels */ module.exports = function plot(graphDiv, parcatsModels, transitionOpts, makeOnCompleteCallback) { - var fullLayout = graphDiv._fullLayout, - svg = fullLayout._paper, - size = fullLayout._size; + var fullLayout = graphDiv._fullLayout; + var svg = fullLayout._paper; + var size = fullLayout._size; parcats( graphDiv, @@ -190358,9 +192351,9 @@ ); }; -},{"./parcats":1002}],1004:[function(_dereq_,module,exports){ +},{"./parcats":1009}],1011:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -190473,9 +192466,9 @@ }) }; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plot_api/plot_template":730,"../../plots/cartesian/layout_attributes":753,"../../plots/domain":766,"../../plots/font_attributes":767}],1005:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plot_api/plot_template":732,"../../plots/cartesian/layout_attributes":755,"../../plots/domain":768,"../../plots/font_attributes":769}],1012:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191005,9 +192998,9 @@ cleanRanges: cleanRanges }; -},{"../../lib":692,"../../lib/gup":690,"./constants":1008,"d3":148}],1006:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/gup":692,"./constants":1015,"d3":149}],1013:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191074,9 +193067,9 @@ }, 60); }; -},{"../../constants/xmlns_namespaces":670,"../../plots/get_data":777,"./plot":1014,"d3":148}],1007:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":672,"../../plots/get_data":779,"./plot":1021,"d3":149}],1014:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191117,9 +193110,9 @@ return out; } -},{"../../components/colorscale/calc":577,"../../components/colorscale/helpers":580,"../../lib":692,"../../lib/gup":690}],1008:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../components/colorscale/helpers":582,"../../lib":694,"../../lib/gup":692}],1015:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191178,9 +193171,9 @@ } }; -},{}],1009:[function(_dereq_,module,exports){ +},{}],1016:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191284,9 +193277,9 @@ Lib.coerceFont(coerce, 'rangefont', fontDflt); }; -},{"../../components/colorscale/defaults":579,"../../components/colorscale/helpers":580,"../../lib":692,"../../plots/array_container_defaults":736,"../../plots/domain":766,"./attributes":1004,"./axisbrush":1005,"./constants":1008,"./merge_length":1012}],1010:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../components/colorscale/helpers":582,"../../lib":694,"../../plots/array_container_defaults":738,"../../plots/domain":768,"./attributes":1011,"./axisbrush":1012,"./constants":1015,"./merge_length":1019}],1017:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191317,9 +193310,9 @@ module.exports = Parcoords; -},{"./attributes":1004,"./base_plot":1006,"./calc":1007,"./defaults":1009,"./plot":1014}],1011:[function(_dereq_,module,exports){ +},{"./attributes":1011,"./base_plot":1013,"./calc":1014,"./defaults":1016,"./plot":1021}],1018:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191770,7 +193763,10 @@ var panelCount = panels.length; var I; - var leftmost, rightmost, lowestX = Infinity, highestX = -Infinity; + var leftmost; + var rightmost; + var lowestX = Infinity; + var highestX = -Infinity; for(I = 0; I < panelCount; I++) { if(panels[I].dim2.canvasX > highestX) { @@ -191849,9 +193845,9 @@ }; }; -},{"../../lib":692,"glslify":392}],1012:[function(_dereq_,module,exports){ +},{"../../lib":694,"glslify":395}],1019:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -191887,9 +193883,9 @@ return len; }; -},{}],1013:[function(_dereq_,module,exports){ +},{}],1020:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -192020,17 +194016,17 @@ } function model(layout, d, i) { - var cd0 = unwrap(d), - trace = cd0.trace, - lineColor = cd0.lineColor, - line = trace.line, - cscale = line.reversescale ? Colorscale.flipScale(cd0.cscale) : cd0.cscale, - domain = trace.domain, - dimensions = trace.dimensions, - width = layout.width, - labelFont = trace.labelfont, - tickFont = trace.tickfont, - rangeFont = trace.rangefont; + var cd0 = unwrap(d); + var trace = cd0.trace; + var lineColor = cd0.lineColor; + var line = trace.line; + var cscale = line.reversescale ? Colorscale.flipScale(cd0.cscale) : cd0.cscale; + var domain = trace.domain; + var dimensions = trace.dimensions; + var width = layout.width; + var labelFont = trace.labelfont; + var tickFont = trace.tickfont; + var rangeFont = trace.rangefont; var lines = Lib.extendDeepNoArrays({}, line, { color: lineColor.map(d3.scale.linear().domain(dimensionExtent({ @@ -192546,9 +194542,9 @@ brush.ensureAxisBrush(axisOverlays); }; -},{"../../components/colorscale":581,"../../components/drawing":590,"../../lib":692,"../../lib/gup":690,"./axisbrush":1005,"./constants":1008,"./lines":1011,"d3":148}],1014:[function(_dereq_,module,exports){ +},{"../../components/colorscale":583,"../../components/drawing":592,"../../lib":694,"../../lib/gup":692,"./axisbrush":1012,"./constants":1015,"./lines":1018,"d3":149}],1021:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -192708,9 +194704,9 @@ }); }; -},{"../../lib/prepare_regl":705,"./parcoords":1013}],1015:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":707,"./parcoords":1020}],1022:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -192960,9 +194956,9 @@ } }; -},{"../../components/color/attributes":568,"../../components/fx/hovertemplate_attributes":607,"../../lib/extend":682,"../../plots/attributes":737,"../../plots/domain":766,"../../plots/font_attributes":767}],1016:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plots/attributes":739,"../../plots/domain":768,"../../plots/font_attributes":769}],1023:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -192992,9 +194988,9 @@ } }; -},{"../../plots/get_data":777,"../../registry":823}],1017:[function(_dereq_,module,exports){ +},{"../../plots/get_data":779,"../../registry":825}],1024:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193183,9 +195179,9 @@ return pieColors; } -},{"../../components/color":569,"../../lib":692,"./helpers":1020,"fast-isnumeric":214,"tinycolor2":513}],1018:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"./helpers":1027,"fast-isnumeric":215,"tinycolor2":515}],1025:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193240,10 +195236,10 @@ coerce('hovertemplate'); if(textInfo && textInfo !== 'none') { - var textPosition = coerce('textposition'), - hasBoth = Array.isArray(textPosition) || textPosition === 'auto', - hasInside = hasBoth || textPosition === 'inside', - hasOutside = hasBoth || textPosition === 'outside'; + var textPosition = coerce('textposition'); + 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); @@ -193277,9 +195273,9 @@ coerce('pull'); }; -},{"../../lib":692,"../../plots/domain":766,"./attributes":1015}],1019:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/domain":768,"./attributes":1022}],1026:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193322,9 +195318,9 @@ return out; }; -},{"../../components/fx/helpers":604}],1020:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":606}],1027:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193364,9 +195360,9 @@ else if(item) return item; }; -},{"../../lib":692}],1021:[function(_dereq_,module,exports){ +},{"../../lib":694}],1028:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193400,9 +195396,9 @@ module.exports = Pie; -},{"./attributes":1015,"./base_plot":1016,"./calc":1017,"./defaults":1018,"./layout_attributes":1022,"./layout_defaults":1023,"./plot":1024,"./style":1025,"./style_one":1026}],1022:[function(_dereq_,module,exports){ +},{"./attributes":1022,"./base_plot":1023,"./calc":1024,"./defaults":1025,"./layout_attributes":1029,"./layout_defaults":1030,"./plot":1031,"./style":1032,"./style_one":1033}],1029:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193436,9 +195432,9 @@ } }; -},{}],1023:[function(_dereq_,module,exports){ +},{}],1030:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193460,9 +195456,9 @@ coerce('extendpiecolors'); }; -},{"../../lib":692,"./layout_attributes":1022}],1024:[function(_dereq_,module,exports){ +},{"../../lib":694,"./layout_attributes":1029}],1031:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -193797,7 +195793,11 @@ s.attr('data-notex', 1); }); - titleText.text(trace.title.text) + var txt = fullLayout.meta ? + Lib.templateString(trace.title.text, {meta: fullLayout.meta}) : + trace.title.text; + + titleText.text(txt) .attr({ 'class': 'titletext', transform: '', @@ -193930,6 +195930,8 @@ } function prerenderTitles(cdpie, gd) { + var fullLayout = gd._fullLayout; + var cd0, trace; // Determine the width and height of the title for each pie. for(var i = 0; i < cdpie.length; i++) { @@ -193937,9 +195939,13 @@ trace = cd0.trace; if(trace.title.text) { + var txt = fullLayout.meta ? + Lib.templateString(trace.title.text, {meta: fullLayout.meta}) : + trace.title.text; + var dummyTitle = Drawing.tester.append('text') .attr('data-notex', 1) - .text(trace.title.text) + .text(txt) .call(Drawing.font, trace.title.font) .call(svgTextUtils.convertToTspans, gd); var bBox = Drawing.bBox(dummyTitle.node(), true); @@ -193957,19 +195963,19 @@ var textAspect = textBB.width / textBB.height; var halfAngle = Math.PI * Math.min(pt.v / cd0.vTotal, 0.5); var ring = 1 - cd0.trace.hole; - var rInscribed = getInscribedRadiusFraction(pt, cd0), + var rInscribed = getInscribedRadiusFraction(pt, cd0); - // max size text can be inserted inside without rotating it - // this inscribes the text rectangle in a circle, which is then inscribed - // in the slice, so it will be an underestimate, which some day we may want - // to improve so this case can get more use - transform = { - scale: rInscribed * cd0.r * 2 / textDiameter, - - // and the center position and rotation in this case - rCenter: 1 - rInscribed, - rotate: 0 - }; + // max size text can be inserted inside without rotating it + // this inscribes the text rectangle in a circle, which is then inscribed + // in the slice, so it will be an underestimate, which some day we may want + // to improve so this case can get more use + var transform = { + scale: rInscribed * cd0.r * 2 / textDiameter, + + // and the center position and rotation in this case + rCenter: 1 - rInscribed, + rotate: 0 + }; if(transform.scale >= 1) return transform; @@ -194047,7 +196053,10 @@ } function positionTitleOutside(cd0, plotSize) { - var scaleX = 1, scaleY = 1, maxWidth, maxPull; + var scaleX = 1; + var scaleY = 1; + var maxWidth, maxPull; + var trace = cd0.trace; // position of the baseline point of the text box in the plot, before scaling. // we anchored the text in the middle, so the baseline is on the bottom middle @@ -194107,7 +196116,8 @@ } function getMaxPull(trace) { - var maxPull = trace.pull, j; + var maxPull = trace.pull; + var j; if(Array.isArray(maxPull)) { maxPull = 0; for(j = 0; j < trace.pull.length; j++) { @@ -194326,9 +196336,9 @@ } } -},{"../../components/color":569,"../../components/drawing":590,"../../components/fx":608,"../../lib":692,"../../lib/svg_text_utils":716,"./event_data":1019,"./helpers":1020,"d3":148}],1025:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../../components/fx":610,"../../lib":694,"../../lib/svg_text_utils":718,"./event_data":1026,"./helpers":1027,"d3":149}],1032:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194355,9 +196365,9 @@ }); }; -},{"./style_one":1026,"d3":148}],1026:[function(_dereq_,module,exports){ +},{"./style_one":1033,"d3":149}],1033:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194379,9 +196389,9 @@ .call(Color.stroke, lineColor); }; -},{"../../components/color":569,"./helpers":1020}],1027:[function(_dereq_,module,exports){ +},{"../../components/color":571,"./helpers":1027}],1034:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194482,9 +196492,9 @@ transforms: undefined }; -},{"../scatter/attributes":1040}],1028:[function(_dereq_,module,exports){ +},{"../scatter/attributes":1047}],1035:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194571,10 +196581,10 @@ var userBounds = options.xbounds && options.ybounds; var index = options.indices; - var len, - idToIndex, - positions, - bounds = this.bounds; + var len; + var idToIndex; + var positions; + var bounds = this.bounds; var xx, yy, i; @@ -194652,9 +196662,9 @@ this.pointcloudOptions.positions = positions; - var markerColor = str2RGBArray(options.marker.color), - borderColor = str2RGBArray(options.marker.border.color), - opacity = options.opacity * options.marker.opacity; + var markerColor = str2RGBArray(options.marker.color); + var borderColor = str2RGBArray(options.marker.border.color); + var opacity = options.opacity * options.marker.opacity; markerColor[3] *= opacity; this.pointcloudOptions.color = markerColor; @@ -194699,9 +196709,9 @@ module.exports = createPointcloud; -},{"../../lib/str2rgbarray":715,"../../plots/cartesian/autorange":739,"../scatter/get_trace_color":1050,"gl-pointcloud2d":279}],1029:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":717,"../../plots/cartesian/autorange":741,"../scatter/get_trace_color":1057,"gl-pointcloud2d":281}],1036:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194747,9 +196757,9 @@ traceOut._length = null; }; -},{"../../lib":692,"./attributes":1027}],1030:[function(_dereq_,module,exports){ +},{"../../lib":694,"./attributes":1034}],1037:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194777,9 +196787,9 @@ module.exports = pointcloud; -},{"../../plots/gl2d":780,"../scatter3d/calc":1068,"./attributes":1027,"./convert":1028,"./defaults":1029}],1031:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":782,"../scatter3d/calc":1075,"./attributes":1034,"./convert":1035,"./defaults":1036}],1038:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -194967,9 +196977,9 @@ }, 'calc', 'nested'); attrs.transforms = undefined; -},{"../../components/color/attributes":568,"../../components/fx/attributes":599,"../../components/fx/hovertemplate_attributes":607,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/attributes":737,"../../plots/domain":766,"../../plots/font_attributes":767}],1032:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":570,"../../components/fx/attributes":601,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739,"../../plots/domain":768,"../../plots/font_attributes":769}],1039:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195005,9 +197015,9 @@ } }; -},{"../../components/fx/layout_attributes":609,"../../plot_api/edit_types":723,"../../plots/get_data":777,"./plot":1037}],1033:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":611,"../../plot_api/edit_types":725,"../../plots/get_data":779,"./plot":1044}],1040:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195062,9 +197072,9 @@ }); }; -},{"../../lib":692,"../../lib/gup":690,"strongly-connected-components":506}],1034:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/gup":692,"strongly-connected-components":508}],1041:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195097,9 +197107,9 @@ } }; -},{}],1035:[function(_dereq_,module,exports){ +},{}],1042:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195124,7 +197134,9 @@ var hoverlabelDefault = Lib.extendDeep(layout.hoverlabel, traceIn.hoverlabel); // node attributes - var nodeIn = traceIn.node, nodeOut = Template.newContainer(traceOut, 'node'); + var nodeIn = traceIn.node; + var nodeOut = Template.newContainer(traceOut, 'node'); + function coerceNode(attr, dflt) { return Lib.coerce(nodeIn, nodeOut, attributes.node, attr, dflt); } @@ -195146,7 +197158,9 @@ })); // link attributes - var linkIn = traceIn.link, linkOut = Template.newContainer(traceOut, 'link'); + var linkIn = traceIn.link; + var linkOut = Template.newContainer(traceOut, 'link'); + function coerceLink(attr, dflt) { return Lib.coerce(linkIn, linkOut, attributes.link, attr, dflt); } @@ -195180,9 +197194,9 @@ traceOut._length = null; }; -},{"../../components/color":569,"../../components/fx/hoverlabel_defaults":606,"../../lib":692,"../../plot_api/plot_template":730,"../../plots/domain":766,"./attributes":1031,"tinycolor2":513}],1036:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx/hoverlabel_defaults":608,"../../lib":694,"../../plot_api/plot_template":732,"../../plots/domain":768,"./attributes":1038,"tinycolor2":515}],1043:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195208,9 +197222,9 @@ module.exports = Plot; -},{"./attributes":1031,"./base_plot":1032,"./calc":1033,"./defaults":1035,"./plot":1037}],1037:[function(_dereq_,module,exports){ +},{"./attributes":1038,"./base_plot":1039,"./calc":1040,"./defaults":1042,"./plot":1044}],1044:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195522,9 +197536,9 @@ ); }; -},{"../../components/color":569,"../../components/fx":608,"../../lib":692,"./constants":1034,"./render":1038,"d3":148}],1038:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx":610,"../../lib":694,"./constants":1041,"./render":1045,"d3":149}],1045:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -195551,7 +197565,8 @@ // basic data utilities function persistOriginalPlace(nodes) { - var i, distinctLayerPositions = []; + var i; + var distinctLayerPositions = []; for(i = 0; i < nodes.length; i++) { nodes[i].originalX = nodes[i].x; nodes[i].originalY = nodes[i].y; @@ -195677,7 +197692,8 @@ Lib.warn('node.pad was reduced to ', sankey.nodePadding(), ' to fit within the figure.'); } - var node, sankeyNodes = sankey.nodes(); + var node; + var sankeyNodes = sankey.nodes(); for(var n = 0; n < sankeyNodes.length; n++) { node = sankeyNodes[n]; node.width = width; @@ -195744,11 +197760,11 @@ } function nodeModel(uniqueKeys, d, n) { - var tc = tinycolor(n.color), - zoneThicknessPad = c.nodePadAcross, - zoneLengthPad = d.nodePad / 2, - visibleThickness = n.dx, - visibleLength = Math.max(0.5, n.dy); + var tc = tinycolor(n.color); + var zoneThicknessPad = c.nodePadAcross; + var zoneLengthPad = d.nodePad / 2; + var visibleThickness = n.dx; + var visibleLength = Math.max(0.5, n.dy); var basicKey = n.label; var foundKey = uniqueKeys[basicKey]; @@ -196195,9 +198211,9 @@ .style('fill', nodeTextColor); }; -},{"../../components/color":569,"../../components/drawing":590,"../../lib":692,"../../lib/gup":690,"./constants":1034,"@plotly/d3-sankey":46,"d3":148,"d3-force":144,"tinycolor2":513}],1039:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../../lib":694,"../../lib/gup":692,"./constants":1041,"@plotly/d3-sankey":47,"d3":149,"d3-force":145,"tinycolor2":515}],1046:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -196247,9 +198263,9 @@ } }; -},{"../../lib":692}],1040:[function(_dereq_,module,exports){ +},{"../../lib":694}],1047:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -196272,6 +198288,7 @@ x: { valType: 'data_array', editType: 'calc+clearAxisTypes', + anim: true, }, x0: { @@ -196279,6 +198296,7 @@ dflt: 0, editType: 'calc+clearAxisTypes', + anim: true, }, dx: { @@ -196286,11 +198304,13 @@ dflt: 1, editType: 'calc', + anim: true, }, y: { valType: 'data_array', editType: 'calc+clearAxisTypes', + anim: true, }, y0: { @@ -196298,6 +198318,7 @@ dflt: 0, editType: 'calc+clearAxisTypes', + anim: true, }, dy: { @@ -196305,6 +198326,7 @@ dflt: 1, editType: 'calc', + anim: true, }, @@ -196378,6 +198400,7 @@ valType: 'color', editType: 'style', + anim: true, }, width: { @@ -196386,6 +198409,7 @@ dflt: 2, editType: 'style', + anim: true, }, shape: { @@ -196442,6 +198466,7 @@ valType: 'color', editType: 'style', + anim: true, }, marker: extendFlat({ @@ -196461,6 +198486,7 @@ arrayOk: true, editType: 'style', + anim: true, }, size: { @@ -196470,6 +198496,7 @@ arrayOk: true, editType: 'calc', + anim: true, }, maxdisplayed: { @@ -196513,11 +198540,12 @@ arrayOk: true, editType: 'style', + anim: true, }, editType: 'calc' }, - colorAttributes('marker.line') + colorAttributes('marker.line', {anim: true}) ), gradient: { type: { @@ -196540,7 +198568,7 @@ }, editType: 'calc' }, - colorAttributes('marker') + colorAttributes('marker', {anim: true}) ), selected: { marker: { @@ -196647,9 +198675,9 @@ } }; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../components/drawing":590,"../../components/drawing/attributes":589,"../../components/fx/hovertemplate_attributes":607,"../../lib/extend":682,"../../plots/font_attributes":767,"./constants":1044}],1041:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../components/drawing":592,"../../components/drawing/attributes":591,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plots/font_attributes":769,"./constants":1051}],1048:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -196937,9 +198965,9 @@ getStackOpts: getStackOpts }; -},{"../../constants/numerical":669,"../../lib":692,"../../plots/cartesian/axes":740,"./arrays_to_calcdata":1039,"./calc_selection":1042,"./colorscale_calc":1043,"./subtypes":1064,"fast-isnumeric":214}],1042:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../plots/cartesian/axes":742,"./arrays_to_calcdata":1046,"./calc_selection":1049,"./colorscale_calc":1050,"./subtypes":1071,"fast-isnumeric":215}],1049:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -196956,9 +198984,9 @@ } }; -},{"../../lib":692}],1043:[function(_dereq_,module,exports){ +},{"../../lib":694}],1050:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -196999,9 +199027,9 @@ } }; -},{"../../components/colorscale/calc":577,"../../components/colorscale/helpers":580,"./subtypes":1064}],1044:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579,"../../components/colorscale/helpers":582,"./subtypes":1071}],1051:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197028,9 +199056,9 @@ eventDataKeys: [] }; -},{}],1045:[function(_dereq_,module,exports){ +},{}],1052:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197211,9 +199239,9 @@ return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":1041}],1046:[function(_dereq_,module,exports){ +},{"./calc":1048}],1053:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197250,9 +199278,9 @@ } }; -},{}],1047:[function(_dereq_,module,exports){ +},{}],1054:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197324,21 +199352,24 @@ if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } + 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, defaultColor, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'y'}); Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":692,"../../registry":823,"./attributes":1040,"./constants":1044,"./fillcolor_defaults":1049,"./line_defaults":1053,"./line_shape_defaults":1055,"./marker_defaults":1059,"./stack_defaults":1062,"./subtypes":1064,"./text_defaults":1065,"./xy_defaults":1066}],1048:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"./attributes":1047,"./constants":1051,"./fillcolor_defaults":1056,"./line_defaults":1060,"./line_shape_defaults":1062,"./marker_defaults":1066,"./stack_defaults":1069,"./subtypes":1071,"./text_defaults":1072,"./xy_defaults":1073}],1055:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197379,9 +199410,9 @@ return v || v === 0; } -},{"../../lib":692}],1049:[function(_dereq_,module,exports){ +},{"../../lib":694}],1056:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197399,8 +199430,8 @@ if(traceOut.marker) { // don't try to inherit a color array - var markerColor = traceOut.marker.color, - markerLineColor = (traceOut.marker.line || {}).color; + var markerColor = traceOut.marker.color; + var markerLineColor = (traceOut.marker.line || {}).color; if(markerColor && !isArrayOrTypedArray(markerColor)) { inheritColorFromMarker = markerColor; @@ -197417,9 +199448,9 @@ )); }; -},{"../../components/color":569,"../../lib":692}],1050:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694}],1057:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197447,8 +199478,8 @@ return trace.fill ? trace.fillcolor : ''; } else { - var mc = di.mcc || (trace.marker || {}).color, - mlc = di.mlcc || ((trace.marker || {}).line || {}).color; + var mc = di.mcc || (trace.marker || {}).color; + var mlc = di.mlcc || ((trace.marker || {}).line || {}).color; tc = (mc && Color.opacity(mc)) ? mc : (mlc && Color.opacity(mlc) && @@ -197470,9 +199501,9 @@ } }; -},{"../../components/color":569,"./subtypes":1064}],1051:[function(_dereq_,module,exports){ +},{"../../components/color":571,"./subtypes":1071}],1058:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197667,9 +199698,9 @@ } }; -},{"../../components/color":569,"../../components/fx":608,"../../lib":692,"../../registry":823,"./fill_hover_text":1048,"./get_trace_color":1050}],1052:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/fx":610,"../../lib":694,"../../registry":825,"./fill_hover_text":1055,"./get_trace_color":1057}],1059:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197714,9 +199745,9 @@ module.exports = Scatter; -},{"../../plots/cartesian":752,"./arrays_to_calcdata":1039,"./attributes":1040,"./calc":1041,"./cross_trace_calc":1045,"./cross_trace_defaults":1046,"./defaults":1047,"./hover":1051,"./marker_colorbar":1058,"./plot":1060,"./select":1061,"./style":1063,"./subtypes":1064}],1053:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"./arrays_to_calcdata":1046,"./attributes":1047,"./calc":1048,"./cross_trace_calc":1052,"./cross_trace_defaults":1053,"./defaults":1054,"./hover":1058,"./marker_colorbar":1065,"./plot":1067,"./select":1068,"./style":1070,"./subtypes":1071}],1060:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -197735,7 +199766,7 @@ coerce('line.color', defaultColor); if(hasColorscale(traceIn, 'line')) { - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c', noScale: true}); + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c'}); } else { var lineColorDflt = (isArrayOrTypedArray(markerColor) ? false : markerColor) || defaultColor; coerce('line.color', lineColorDflt); @@ -197745,9 +199776,9 @@ if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":579,"../../components/colorscale/helpers":580,"../../lib":692}],1054:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../components/colorscale/helpers":582,"../../lib":694}],1061:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198210,9 +200241,9 @@ return segments; }; -},{"../../constants/numerical":669,"../../lib":692,"./constants":1044}],1055:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"./constants":1051}],1062:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198229,9 +200260,9 @@ if(shape === 'spline') coerce('line.smoothing'); }; -},{}],1056:[function(_dereq_,module,exports){ +},{}],1063:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198322,9 +200353,9 @@ return cdscatterSorted; }; -},{}],1057:[function(_dereq_,module,exports){ +},{}],1064:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198340,17 +200371,17 @@ // used in the drawing step for 'scatter' and 'scattegeo' and // in the convert step for 'scatter3d' module.exports = function makeBubbleSizeFn(trace) { - var marker = trace.marker, - sizeRef = marker.sizeref || 1, - sizeMin = marker.sizemin || 0; + var marker = trace.marker; + var sizeRef = marker.sizeref || 1; + var sizeMin = marker.sizemin || 0; // for bubble charts, allow scaling the provided value linearly // and by area or diameter. // Note this only applies to the array-value sizes var baseFn = (marker.sizemode === 'area') ? - function(v) { return Math.sqrt(v / sizeRef); } : - function(v) { return v / sizeRef; }; + function(v) { return Math.sqrt(v / sizeRef); } : + function(v) { return v / sizeRef; }; // TODO add support for position/negative bubbles? // TODO add 'sizeoffset' attribute? @@ -198364,9 +200395,9 @@ }; }; -},{"fast-isnumeric":214}],1058:[function(_dereq_,module,exports){ +},{"fast-isnumeric":215}],1065:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198382,9 +200413,9 @@ max: 'cmax' }; -},{}],1059:[function(_dereq_,module,exports){ +},{}],1066:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198406,9 +200437,9 @@ * noSelect: caller does not support selected/unselected attribute containers */ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { - var isBubble = subTypes.isBubble(traceIn), - lineColor = (traceIn.line || {}).color, - defaultMLC; + var isBubble = subTypes.isBubble(traceIn); + var lineColor = (traceIn.line || {}).color; + var defaultMLC; opts = opts || {}; @@ -198464,9 +200495,9 @@ } }; -},{"../../components/color":569,"../../components/colorscale/defaults":579,"../../components/colorscale/helpers":580,"./subtypes":1064}],1060:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/colorscale/defaults":581,"../../components/colorscale/helpers":582,"./subtypes":1071}],1067:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -198594,8 +200625,8 @@ return hasTransition ? selection.transition() : selection; } - var xa = plotinfo.xaxis, - ya = plotinfo.yaxis; + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; var trace = cdscatter[0].trace; var line = trace.line; @@ -198631,21 +200662,21 @@ prevPolygons = prevtrace._polygons; } - var thispath, - thisrevpath, - // fullpath is all paths for this curve, joined together straight - // across gaps, for filling - fullpath = '', - // revpath is fullpath reversed, for fill-to-next - revpath = '', - // functions for converting a point array to a path - pathfn, revpathbase, revpathfn, - // variables used before and after the data join - pt0, lastSegment, pt1, thisPolygons; + var thispath; + var thisrevpath; + // fullpath is all paths for this curve, joined together straight + // across gaps, for filling + var fullpath = ''; + // revpath is fullpath reversed, for fill-to-next + var revpath = ''; + // functions for converting a point array to a path + var pathfn, revpathbase, revpathfn; + // variables used before and after the data join + var pt0, lastSegment, pt1, thisPolygons; // initialize line join data / method - var segments = [], - makeUpdate = Lib.noop; + var segments = []; + var makeUpdate = Lib.noop; ownFillEl3 = trace._ownFill; @@ -198995,10 +201026,10 @@ } function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { - var xa = plotinfo.xaxis, - ya = plotinfo.yaxis, - xr = d3.extent(Lib.simpleMap(xa.range, xa.r2c)), - yr = d3.extent(Lib.simpleMap(ya.range, ya.r2c)); + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + var xr = d3.extent(Lib.simpleMap(xa.range, xa.r2c)); + var yr = d3.extent(Lib.simpleMap(ya.range, ya.r2c)); var trace = cdscatter[0].trace; if(!subTypes.hasMarkers(trace)) return; @@ -199010,10 +201041,10 @@ if(mnum === 0) return; var cd = cdscatter.filter(function(v) { - return v.x >= xr[0] && v.x <= xr[1] && v.y >= yr[0] && v.y <= yr[1]; - }), - inc = Math.ceil(cd.length / mnum), - tnum = 0; + return v.x >= xr[0] && v.x <= xr[1] && v.y >= yr[0] && v.y <= yr[1]; + }); + var inc = Math.ceil(cd.length / mnum); + var tnum = 0; cdscatterAll.forEach(function(cdj, j) { var tracei = cdj[0].trace; if(subTypes.hasMarkers(tracei) && @@ -199036,9 +201067,9 @@ }); } -},{"../../components/drawing":590,"../../lib":692,"../../lib/polygon":704,"../../registry":823,"./line_points":1054,"./link_traces":1056,"./subtypes":1064,"d3":148}],1061:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"../../lib/polygon":706,"../../registry":825,"./line_points":1061,"./link_traces":1063,"./subtypes":1071,"d3":149}],1068:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199051,15 +201082,15 @@ var subtypes = _dereq_('./subtypes'); module.exports = function selectPoints(searchInfo, selectionTester) { - var cd = searchInfo.cd, - xa = searchInfo.xaxis, - ya = searchInfo.yaxis, - selection = [], - trace = cd[0].trace, - i, - di, - x, - y; + var cd = searchInfo.cd; + var xa = searchInfo.xaxis; + var ya = searchInfo.yaxis; + var selection = []; + var trace = cd[0].trace; + var i; + var di; + var x; + var y; var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); if(hasOnlyLines) return []; @@ -199091,9 +201122,9 @@ return selection; }; -},{"./subtypes":1064}],1062:[function(_dereq_,module,exports){ +},{"./subtypes":1071}],1069:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199197,9 +201228,9 @@ } }; -},{}],1063:[function(_dereq_,module,exports){ +},{}],1070:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199269,9 +201300,9 @@ styleOnSelect: styleOnSelect }; -},{"../../components/drawing":590,"../../registry":823,"d3":148}],1064:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../registry":825,"d3":149}],1071:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199308,9 +201339,9 @@ } }; -},{"../../lib":692}],1065:[function(_dereq_,module,exports){ +},{"../../lib":694}],1072:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199338,9 +201369,9 @@ } }; -},{"../../lib":692}],1066:[function(_dereq_,module,exports){ +},{"../../lib":694}],1073:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199382,9 +201413,9 @@ return len; }; -},{"../../lib":692,"../../registry":823}],1067:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825}],1074:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199416,9 +201447,6 @@ } }, colorAttributes('line')); -// not yet implemented -delete lineAttrs.showscale; -delete lineAttrs.colorbar; function makeProjectionAttr(axLetter) { return { @@ -199525,9 +201553,9 @@ attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; -},{"../../components/colorscale/attributes":576,"../../constants/gl3d_dashes":666,"../../constants/gl3d_markers":667,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/attributes":737,"../scatter/attributes":1040}],1068:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":578,"../../constants/gl3d_dashes":668,"../../constants/gl3d_markers":669,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739,"../scatter/attributes":1047}],1075:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199553,9 +201581,9 @@ return cd; }; -},{"../scatter/arrays_to_calcdata":1039,"../scatter/colorscale_calc":1043}],1069:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":1046,"../scatter/colorscale_calc":1050}],1076:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199577,8 +201605,8 @@ if(axis.type === 'log') { var point = axis.c2l(data[i]); - var min = data[i] - errors[0], - max = data[i] + errors[1]; + var min = data[i] - errors[0]; + var max = data[i] + errors[1]; result[i] = [ (axis.c2l(min, true) - point) * scaleFactor, @@ -199640,9 +201668,9 @@ module.exports = calculateErrors; -},{"../../registry":823}],1070:[function(_dereq_,module,exports){ +},{"../../registry":825}],1077:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -199757,9 +201785,9 @@ } function calculateErrorParams(errors) { - var capSize = [0.0, 0.0, 0.0], - color = [[0, 0, 0], [0, 0, 0], [0, 0, 0]], - lineWidth = [1.0, 1.0, 1.0]; + var capSize = [0.0, 0.0, 0.0]; + var color = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; + var lineWidth = [1.0, 1.0, 1.0]; for(var i = 0; i < 3; i++) { var e = errors[i]; @@ -199849,23 +201877,24 @@ function convertPlotlyOptions(scene, data) { - var params, i, - points = [], - sceneLayout = scene.fullSceneLayout, - scaleFactor = scene.dataScale, - xaxis = sceneLayout.xaxis, - yaxis = sceneLayout.yaxis, - zaxis = sceneLayout.zaxis, - marker = data.marker, - line = data.line, - xc, x = data.x || [], - yc, y = data.y || [], - zc, z = data.z || [], - len = x.length, - xcalendar = data.xcalendar, - ycalendar = data.ycalendar, - zcalendar = data.zcalendar, - text; + var points = []; + var sceneLayout = scene.fullSceneLayout; + var scaleFactor = scene.dataScale; + var xaxis = sceneLayout.xaxis; + var yaxis = sceneLayout.yaxis; + var zaxis = sceneLayout.zaxis; + var marker = data.marker; + var line = data.line; + var x = data.x || []; + var y = data.y || []; + var z = data.z || []; + var len = x.length; + var xcalendar = data.xcalendar; + var ycalendar = data.ycalendar; + var zcalendar = data.zcalendar; + var xc, yc, zc; + var params, i; + var text; // Convert points for(i = 0; i < len; i++) { @@ -199956,12 +201985,12 @@ } proto.update = function(data) { - var gl = this.scene.glplot.gl, - lineOptions, - scatterOptions, - errorOptions, - textOptions, - dashPattern = DASH_PATTERNS.solid; + var gl = this.scene.glplot.gl; + var lineOptions; + var scatterOptions; + var errorOptions; + var textOptions; + var dashPattern = DASH_PATTERNS.solid; // Save data this.data = data; @@ -200149,9 +202178,9 @@ module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":666,"../../constants/gl3d_markers":667,"../../lib":692,"../../lib/gl_format_color":689,"../../lib/str2rgbarray":715,"../scatter/make_bubble_size_func":1057,"./calc_errors":1069,"delaunay-triangulate":150,"gl-error3d":237,"gl-line3d":245,"gl-mesh3d":268,"gl-scatter3d":284}],1071:[function(_dereq_,module,exports){ +},{"../../constants/gl3d_dashes":668,"../../constants/gl3d_markers":669,"../../lib":694,"../../lib/gl_format_color":691,"../../lib/str2rgbarray":717,"../scatter/make_bubble_size_func":1064,"./calc_errors":1076,"delaunay-triangulate":151,"gl-error3d":238,"gl-line3d":246,"gl-mesh3d":270,"gl-scatter3d":286}],1078:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200200,8 +202229,8 @@ handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true}); } - var lineColor = (traceOut.line || {}).color, - markerColor = (traceOut.marker || {}).color; + var lineColor = (traceOut.line || {}).color; + var markerColor = (traceOut.marker || {}).color; if(coerce('surfaceaxis') >= 0) coerce('surfacecolor', lineColor || markerColor); var dims = ['x', 'y', 'z']; @@ -200214,16 +202243,16 @@ } var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'z'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y', inherit: 'z'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'z'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'z'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y', inherit: 'z'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'z'}); }; function handleXYZDefaults(traceIn, traceOut, coerce, layout) { - var len = 0, - x = coerce('x'), - y = coerce('y'), - z = coerce('z'); + var len = 0; + var x = coerce('x'); + var y = coerce('y'); + var z = coerce('z'); var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout); @@ -200237,9 +202266,9 @@ return len; } -},{"../../lib":692,"../../registry":823,"../scatter/line_defaults":1053,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"./attributes":1067}],1072:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"../scatter/line_defaults":1060,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"./attributes":1074}],1079:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200254,7 +202283,17 @@ Scatter3D.attributes = _dereq_('./attributes'); Scatter3D.markerSymbols = _dereq_('../../constants/gl3d_markers'); Scatter3D.supplyDefaults = _dereq_('./defaults'); -Scatter3D.colorbar = _dereq_('../scatter/marker_colorbar'); +Scatter3D.colorbar = [ + { + container: 'marker', + min: 'cmin', + max: 'cmax' + }, { + container: 'line', + min: 'cmin', + max: 'cmax' + } +]; Scatter3D.calc = _dereq_('./calc'); Scatter3D.moduleType = 'trace'; @@ -200268,9 +202307,9 @@ module.exports = Scatter3D; -},{"../../constants/gl3d_markers":667,"../../plots/gl3d":783,"../scatter/marker_colorbar":1058,"./attributes":1067,"./calc":1068,"./convert":1070,"./defaults":1071}],1073:[function(_dereq_,module,exports){ +},{"../../constants/gl3d_markers":669,"../../plots/gl3d":785,"./attributes":1074,"./calc":1075,"./convert":1077,"./defaults":1078}],1080:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200286,9 +202325,9 @@ var extendFlat = _dereq_('../../lib/extend').extendFlat; -var scatterMarkerAttrs = scatterAttrs.marker, - scatterLineAttrs = scatterAttrs.line, - scatterMarkerLineAttrs = scatterMarkerAttrs.line; +var scatterMarkerAttrs = scatterAttrs.marker; +var scatterLineAttrs = scatterAttrs.line; +var scatterMarkerLineAttrs = scatterMarkerAttrs.line; module.exports = { carpet: { @@ -200359,9 +202398,9 @@ hoveron: scatterAttrs.hoveron, }; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plots/attributes":737,"../scatter/attributes":1040}],1074:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plots/attributes":739,"../scatter/attributes":1047}],1081:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200419,9 +202458,9 @@ return cd; }; -},{"../carpet/lookup_carpetid":891,"../scatter/arrays_to_calcdata":1039,"../scatter/calc":1041,"../scatter/calc_selection":1042,"../scatter/colorscale_calc":1043,"fast-isnumeric":214}],1075:[function(_dereq_,module,exports){ +},{"../carpet/lookup_carpetid":893,"../scatter/arrays_to_calcdata":1046,"../scatter/calc":1048,"../scatter/calc_selection":1049,"../scatter/colorscale_calc":1050,"fast-isnumeric":215}],1082:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200505,9 +202544,9 @@ Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":692,"../scatter/constants":1044,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/line_shape_defaults":1055,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"./attributes":1073}],1076:[function(_dereq_,module,exports){ +},{"../../lib":694,"../scatter/constants":1051,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/line_shape_defaults":1062,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"./attributes":1080}],1083:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200525,9 +202564,9 @@ return out; }; -},{}],1077:[function(_dereq_,module,exports){ +},{}],1084:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200556,10 +202595,10 @@ // so easy and anyway we lost the information we would have needed to do // this inside scatterHover. if(newPointData.index === undefined) { - var yFracUp = 1 - (newPointData.y0 / pointData.ya._length), - xLen = pointData.xa._length, - xMin = xLen * yFracUp / 2, - xMax = xLen - xMin; + var yFracUp = 1 - (newPointData.y0 / pointData.ya._length); + var xLen = pointData.xa._length; + var xMin = xLen * yFracUp / 2; + var xMax = xLen - xMin; newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin); newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin); return scatterPointData; @@ -200611,9 +202650,9 @@ return scatterPointData; }; -},{"../scatter/hover":1051}],1078:[function(_dereq_,module,exports){ +},{"../scatter/hover":1058}],1085:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200646,9 +202685,9 @@ module.exports = ScatterCarpet; -},{"../../plots/cartesian":752,"../scatter/marker_colorbar":1058,"../scatter/select":1061,"../scatter/style":1063,"./attributes":1073,"./calc":1074,"./defaults":1075,"./event_data":1076,"./hover":1077,"./plot":1079}],1079:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../scatter/marker_colorbar":1065,"../scatter/select":1068,"../scatter/style":1070,"./attributes":1080,"./calc":1081,"./defaults":1082,"./event_data":1083,"./hover":1084,"./plot":1086}],1086:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200686,13 +202725,13 @@ // separately to all scattercarpet traces, but that would require // lots of reorganization of scatter traces that is otherwise not // necessary. That makes this a potential optimization. - Drawing.setClipUrl(node, carpet._clipPathId, gd); + Drawing.setClipUrl(node, data[i][0].carpet._clipPathId, gd); } }; -},{"../../components/drawing":590,"../../plots/cartesian/axes":740,"../scatter/plot":1060}],1080:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../plots/cartesian/axes":742,"../scatter/plot":1067}],1087:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200701,6 +202740,7 @@ 'use strict'; +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); var scatterAttrs = _dereq_('../scatter/attributes'); var plotAttrs = _dereq_('../../plots/attributes'); var colorAttributes = _dereq_('../../components/colorscale/attributes'); @@ -200709,9 +202749,9 @@ var extendFlat = _dereq_('../../lib/extend').extendFlat; var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll; -var scatterMarkerAttrs = scatterAttrs.marker, - scatterLineAttrs = scatterAttrs.line, - scatterMarkerLineAttrs = scatterMarkerAttrs.line; +var scatterMarkerAttrs = scatterAttrs.marker; +var scatterLineAttrs = scatterAttrs.line; +var scatterMarkerLineAttrs = scatterMarkerAttrs.line; module.exports = overrideAll({ lon: { @@ -200786,12 +202826,13 @@ hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'location', 'text', 'name'] - }) + }), + hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":576,"../../components/drawing/attributes":589,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/attributes":737,"../scatter/attributes":1040}],1081:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":578,"../../components/drawing/attributes":591,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739,"../scatter/attributes":1047}],1088:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200846,9 +202887,9 @@ return calcTrace; }; -},{"../../constants/numerical":669,"../../lib":692,"../scatter/arrays_to_calcdata":1039,"../scatter/calc_selection":1042,"../scatter/colorscale_calc":1043,"fast-isnumeric":214}],1082:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../scatter/arrays_to_calcdata":1046,"../scatter/calc_selection":1049,"../scatter/colorscale_calc":1050,"fast-isnumeric":215}],1089:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200882,6 +202923,7 @@ coerce('text'); coerce('hovertext'); + coerce('hovertemplate'); coerce('mode'); if(subTypes.hasLines(traceOut)) { @@ -200906,8 +202948,8 @@ }; function handleLonLatLocDefaults(traceIn, traceOut, coerce) { - var len = 0, - locations = coerce('locations'); + var len = 0; + var locations = coerce('locations'); var lon, lat; @@ -200925,9 +202967,9 @@ return len; } -},{"../../lib":692,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"./attributes":1080}],1083:[function(_dereq_,module,exports){ +},{"../../lib":694,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"./attributes":1087}],1090:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -200946,9 +202988,9 @@ return out; }; -},{}],1084:[function(_dereq_,module,exports){ +},{}],1091:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201015,11 +203057,16 @@ pointData.color = getTraceColor(trace, di); pointData.extraText = getExtraText(trace, di, geo.mockAxis, cd[0].t.labels); + pointData.hovertemplate = trace.hovertemplate; return [pointData]; }; function getExtraText(trace, pt, axis, labels) { + if(trace.hovertemplate) { + return; + } + var hoverinfo = pt.hi || trace.hoverinfo; var parts = hoverinfo === 'all' ? @@ -201053,9 +203100,9 @@ return text.join('
'); } -},{"../../components/fx":608,"../../constants/numerical":669,"../../plots/cartesian/axes":740,"../scatter/fill_hover_text":1048,"../scatter/get_trace_color":1050,"./attributes":1080}],1085:[function(_dereq_,module,exports){ +},{"../../components/fx":610,"../../constants/numerical":671,"../../plots/cartesian/axes":742,"../scatter/fill_hover_text":1055,"../scatter/get_trace_color":1057,"./attributes":1087}],1092:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201089,9 +203136,9 @@ module.exports = ScatterGeo; -},{"../../plots/geo":771,"../scatter/marker_colorbar":1058,"../scatter/style":1063,"./attributes":1080,"./calc":1081,"./defaults":1082,"./event_data":1083,"./hover":1084,"./plot":1086,"./select":1087,"./style":1088}],1086:[function(_dereq_,module,exports){ +},{"../../plots/geo":773,"../scatter/marker_colorbar":1065,"../scatter/style":1070,"./attributes":1087,"./calc":1088,"./defaults":1089,"./event_data":1090,"./hover":1091,"./plot":1093,"./select":1094,"./style":1095}],1093:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201183,9 +203230,9 @@ } } -},{"../../constants/numerical":669,"../../lib":692,"../../lib/geo_location_utils":685,"../../lib/geojson_utils":686,"../../lib/topojson_utils":719,"../scatter/subtypes":1064,"./style":1088,"d3":148}],1087:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../lib/geo_location_utils":687,"../../lib/geojson_utils":688,"../../lib/topojson_utils":721,"../scatter/subtypes":1071,"./style":1095,"d3":149}],1094:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201240,9 +203287,9 @@ return selection; }; -},{"../../constants/numerical":669,"../scatter/subtypes":1064}],1088:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../scatter/subtypes":1071}],1095:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201289,9 +203336,9 @@ }); } -},{"../../components/color":569,"../../components/drawing":590,"../scatter/style":1063,"d3":148}],1089:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../scatter/style":1070,"d3":149}],1096:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201386,9 +203433,9 @@ attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = 'calc+clearAxisTypes'; attrs.hovertemplate = scatterAttrs.hovertemplate; -},{"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/attributes":737,"../scatter/attributes":1040,"./constants":1090}],1090:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739,"../scatter/attributes":1047,"./constants":1097}],1097:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -201419,9 +203466,9 @@ } }; -},{}],1091:[function(_dereq_,module,exports){ +},{}],1098:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -202034,9 +204081,9 @@ textPosition: convertTextPosition }; -},{"../../components/drawing":590,"../../constants/interactions":668,"../../lib":692,"../../lib/gl_format_color":689,"../../plots/cartesian/axis_ids":743,"../../registry":823,"../scatter/make_bubble_size_func":1057,"../scatter/subtypes":1064,"./constants":1090,"color-normalize":108,"fast-isnumeric":214,"svg-path-sdf":511}],1092:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../constants/interactions":670,"../../lib":694,"../../lib/gl_format_color":691,"../../plots/cartesian/axis_ids":745,"../../registry":825,"../scatter/make_bubble_size_func":1064,"../scatter/subtypes":1071,"./constants":1097,"color-normalize":109,"fast-isnumeric":215,"svg-path-sdf":513}],1099:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -202092,21 +204139,24 @@ handleTextDefaults(traceIn, traceOut, layout, coerce); } + var lineColor = (traceOut.line || {}).color; + var markerColor = (traceOut.marker || {}).color; + coerce('fill'); if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults'); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'y'}); - errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y'}); + errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'y'}); Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":692,"../../registry":823,"../scatter/constants":1044,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"../scatter/xy_defaults":1066,"./attributes":1089}],1093:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../registry":825,"../scatter/constants":1051,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"../scatter/xy_defaults":1073,"./attributes":1096}],1100:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -202611,7 +204661,8 @@ pos = srcPos.slice(); for(i = Math.floor(nextPos.length / 2); i--;) { - var xx = nextPos[i * 2], yy = nextPos[i * 2 + 1]; + var xx = nextPos[i * 2]; + var yy = nextPos[i * 2 + 1]; if(isNaN(xx) || isNaN(yy)) continue; pos.push(xx, yy); } @@ -203091,9 +205142,9 @@ } }; -},{"../../components/color":569,"../../constants/interactions":668,"../../constants/numerical":669,"../../lib":692,"../../lib/prepare_regl":705,"../../plots/cartesian":752,"../../plots/cartesian/autorange":739,"../../plots/cartesian/axis_ids":743,"../../registry":823,"../scatter/calc":1041,"../scatter/colorscale_calc":1043,"../scatter/cross_trace_defaults":1046,"../scatter/fill_hover_text":1048,"../scatter/get_trace_color":1050,"../scatter/link_traces":1056,"../scatter/marker_colorbar":1058,"../scatter/subtypes":1064,"./attributes":1089,"./constants":1090,"./convert":1091,"./defaults":1092,"array-range":55,"gl-text":304,"point-cluster":452,"regl-error2d":473,"regl-line2d":474,"regl-scatter2d":475}],1094:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../constants/interactions":670,"../../constants/numerical":671,"../../lib":694,"../../lib/prepare_regl":707,"../../plots/cartesian":754,"../../plots/cartesian/autorange":741,"../../plots/cartesian/axis_ids":745,"../../registry":825,"../scatter/calc":1048,"../scatter/colorscale_calc":1050,"../scatter/cross_trace_defaults":1053,"../scatter/fill_hover_text":1055,"../scatter/get_trace_color":1057,"../scatter/link_traces":1063,"../scatter/marker_colorbar":1065,"../scatter/subtypes":1071,"./attributes":1096,"./constants":1097,"./convert":1098,"./defaults":1099,"array-range":56,"gl-text":307,"point-cluster":455,"regl-error2d":476,"regl-line2d":477,"regl-scatter2d":478}],1101:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203102,6 +205153,7 @@ 'use strict'; +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); var scatterGeoAttrs = _dereq_('../scattergeo/attributes'); var scatterAttrs = _dereq_('../scatter/attributes'); var mapboxAttrs = _dereq_('../../plots/mapbox/layout_attributes'); @@ -203184,12 +205236,13 @@ hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { flags: ['lon', 'lat', 'text', 'name'] - }) + }), + hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorbar/attributes":570,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/attributes":737,"../../plots/mapbox/layout_attributes":800,"../scatter/attributes":1040,"../scattergeo/attributes":1080}],1095:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739,"../../plots/mapbox/layout_attributes":802,"../scatter/attributes":1047,"../scattergeo/attributes":1087}],1102:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203299,8 +205352,8 @@ } if(hasText) { - var iconSize = (trace.marker || {}).size, - textOpts = convertTextOpts(trace.textposition, iconSize); + var iconSize = (trace.marker || {}).size; + var textOpts = convertTextOpts(trace.textposition, iconSize); // all data-driven below !! @@ -203424,17 +205477,17 @@ function makeSymbolGeoJSON(calcTrace) { var trace = calcTrace[0].trace; - var marker = trace.marker || {}, - symbol = marker.symbol, - text = trace.text; + var marker = trace.marker || {}; + var symbol = marker.symbol; + var text = trace.text; var fillSymbol = (symbol !== 'circle') ? - getFillFunc(symbol) : - blankFillFunc; + getFillFunc(symbol) : + blankFillFunc; var fillText = subTypes.hasText(trace) ? - getFillFunc(text) : - blankFillFunc; + getFillFunc(text) : + blankFillFunc; var features = []; @@ -203481,9 +205534,9 @@ return lonlat[0] === BADNUM; } -},{"../../components/colorscale":581,"../../components/drawing":590,"../../constants/numerical":669,"../../lib":692,"../../lib/geojson_utils":686,"../../plots/mapbox/convert_text_opts":797,"../scatter/make_bubble_size_func":1057,"../scatter/subtypes":1064,"fast-isnumeric":214}],1096:[function(_dereq_,module,exports){ +},{"../../components/colorscale":583,"../../components/drawing":592,"../../constants/numerical":671,"../../lib":694,"../../lib/geojson_utils":688,"../../plots/mapbox/convert_text_opts":799,"../scatter/make_bubble_size_func":1064,"../scatter/subtypes":1071,"fast-isnumeric":215}],1103:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203514,6 +205567,7 @@ coerce('text'); coerce('hovertext'); + coerce('hovertemplate'); coerce('mode'); if(subTypes.hasLines(traceOut)) { @@ -203553,9 +205607,9 @@ return len; } -},{"../../lib":692,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"./attributes":1094}],1097:[function(_dereq_,module,exports){ +},{"../../lib":694,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"./attributes":1101}],1104:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203573,9 +205627,9 @@ return out; }; -},{}],1098:[function(_dereq_,module,exports){ +},{}],1105:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203642,11 +205696,16 @@ pointData.color = getTraceColor(trace, di); pointData.extraText = getExtraText(trace, di, cd[0].t.labels); + pointData.hovertemplate = trace.hovertemplate; return [pointData]; }; function getExtraText(trace, di, labels) { + if(trace.hovertemplate) { + return; + } + var hoverinfo = di.hi || trace.hoverinfo; var parts = hoverinfo.split('+'); var isAll = parts.indexOf('all') !== -1; @@ -203676,9 +205735,9 @@ return text.join('
'); } -},{"../../components/fx":608,"../../constants/numerical":669,"../../lib":692,"../scatter/fill_hover_text":1048,"../scatter/get_trace_color":1050}],1099:[function(_dereq_,module,exports){ +},{"../../components/fx":610,"../../constants/numerical":671,"../../lib":694,"../scatter/fill_hover_text":1055,"../scatter/get_trace_color":1057}],1106:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203717,9 +205776,9 @@ module.exports = ScatterMapbox; -},{"../../plots/mapbox":798,"../scatter/marker_colorbar":1058,"../scattergeo/calc":1081,"./attributes":1094,"./defaults":1096,"./event_data":1097,"./hover":1098,"./plot":1100,"./select":1101}],1100:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":800,"../scatter/marker_colorbar":1065,"../scattergeo/calc":1088,"./attributes":1101,"./defaults":1103,"./event_data":1104,"./hover":1105,"./plot":1107,"./select":1108}],1107:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203829,9 +205888,9 @@ return scatterMapbox; }; -},{"./convert":1095}],1101:[function(_dereq_,module,exports){ +},{"./convert":1102}],1108:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203884,9 +205943,9 @@ return selection; }; -},{"../../constants/numerical":669,"../../lib":692,"../scatter/subtypes":1064}],1102:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../scatter/subtypes":1071}],1109:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -203895,6 +205954,7 @@ 'use strict'; +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); var extendFlat = _dereq_('../../lib/extend').extendFlat; var scatterAttrs = _dereq_('../scatter/attributes'); var plotAttrs = _dereq_('../../plots/attributes'); @@ -203990,14 +206050,15 @@ flags: ['r', 'theta', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, + hovertemplate: hovertemplateAttrs(), selected: scatterAttrs.selected, unselected: scatterAttrs.unselected }; -},{"../../lib/extend":682,"../../plots/attributes":737,"../scatter/attributes":1040}],1103:[function(_dereq_,module,exports){ +},{"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plots/attributes":739,"../scatter/attributes":1047}],1110:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204050,9 +206111,9 @@ return cd; }; -},{"../../constants/numerical":669,"../../plots/cartesian/axes":740,"../scatter/arrays_to_calcdata":1039,"../scatter/calc":1041,"../scatter/calc_selection":1042,"../scatter/colorscale_calc":1043,"fast-isnumeric":214}],1104:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../plots/cartesian/axes":742,"../scatter/arrays_to_calcdata":1046,"../scatter/calc":1048,"../scatter/calc_selection":1049,"../scatter/colorscale_calc":1050,"fast-isnumeric":215}],1111:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204088,6 +206149,7 @@ coerce('mode', len < PTS_LINESONLY ? 'lines+markers' : 'lines'); coerce('text'); coerce('hovertext'); + if(traceOut.hoveron !== 'fills') coerce('hovertemplate'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -204155,9 +206217,9 @@ supplyDefaults: supplyDefaults }; -},{"../../lib":692,"../scatter/constants":1044,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/line_shape_defaults":1055,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"./attributes":1102}],1105:[function(_dereq_,module,exports){ +},{"../../lib":694,"../scatter/constants":1051,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/line_shape_defaults":1062,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"./attributes":1109}],1112:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204190,41 +206252,44 @@ newPointData.xLabelVal = undefined; newPointData.yLabelVal = undefined; makeHoverPointText(cdi, trace, subplot, newPointData); - + newPointData.hovertemplate = trace.hovertemplate; return scatterPointData; } function makeHoverPointText(cdi, trace, subplot, pointData) { + var radialAxis = subplot.radialAxis; var angularAxis = subplot.angularAxis; - var hoverinfo = cdi.hi || trace.hoverinfo; - var parts = hoverinfo.split('+'); - var text = []; - radialAxis._hovertitle = 'r'; angularAxis._hovertitle = 'θ'; + var hoverinfo = cdi.hi || trace.hoverinfo; + var text = []; function textPart(ax, val) { text.push(ax._hovertitle + ': ' + Axes.tickText(ax, val, 'hover').text); } - if(parts.indexOf('all') !== -1) parts = ['r', 'theta', 'text']; - if(parts.indexOf('r') !== -1) { - textPart(radialAxis, radialAxis.c2l(cdi.r)); - } - if(parts.indexOf('theta') !== -1) { - var theta = cdi.theta; - textPart( - angularAxis, - angularAxis.thetaunit === 'degrees' ? Lib.rad2deg(theta) : theta - ); - } - if(parts.indexOf('text') !== -1 && pointData.text) { - text.push(pointData.text); - delete pointData.text; - } + if(!trace.hovertemplate) { + var parts = hoverinfo.split('+'); - pointData.extraText = text.join('
'); + if(parts.indexOf('all') !== -1) parts = ['r', 'theta', 'text']; + if(parts.indexOf('r') !== -1) { + textPart(radialAxis, radialAxis.c2l(cdi.r)); + } + if(parts.indexOf('theta') !== -1) { + var theta = cdi.theta; + textPart( + angularAxis, + angularAxis.thetaunit === 'degrees' ? Lib.rad2deg(theta) : theta + ); + } + if(parts.indexOf('text') !== -1 && pointData.text) { + text.push(pointData.text); + delete pointData.text; + } + + pointData.extraText = text.join('
'); + } } module.exports = { @@ -204232,9 +206297,9 @@ makeHoverPointText: makeHoverPointText }; -},{"../../lib":692,"../../plots/cartesian/axes":740,"../scatter/hover":1051}],1106:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../scatter/hover":1058}],1113:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204264,9 +206329,9 @@ } }; -},{"../../plots/polar":807,"../scatter/marker_colorbar":1058,"../scatter/select":1061,"../scatter/style":1063,"./attributes":1102,"./calc":1103,"./defaults":1104,"./hover":1105,"./plot":1107}],1107:[function(_dereq_,module,exports){ +},{"../../plots/polar":809,"../scatter/marker_colorbar":1065,"../scatter/select":1068,"../scatter/style":1070,"./attributes":1109,"./calc":1110,"./defaults":1111,"./hover":1112,"./plot":1114}],1114:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204314,9 +206379,9 @@ scatterPlot(gd, plotinfo, moduleCalcData, mlayer); }; -},{"../../constants/numerical":669,"../scatter/plot":1060}],1108:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../scatter/plot":1067}],1115:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204340,6 +206405,7 @@ text: scatterPolarAttrs.text, hovertext: scatterPolarAttrs.hovertext, + hovertemplate: scatterPolarAttrs.hovertemplate, line: scatterGlAttrs.line, connectgaps: scatterGlAttrs.connectgaps, @@ -204360,9 +206426,9 @@ unselected: scatterPolarAttrs.unselected }; -},{"../scattergl/attributes":1089,"../scatterpolar/attributes":1102}],1109:[function(_dereq_,module,exports){ +},{"../scattergl/attributes":1096,"../scatterpolar/attributes":1109}],1116:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204398,6 +206464,7 @@ coerce('mode', len < PTS_LINESONLY ? 'lines+markers' : 'lines'); coerce('text'); coerce('hovertext'); + if(traceOut.hoveron !== 'fills') coerce('hovertemplate'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -204420,9 +206487,9 @@ Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":692,"../scatter/constants":1044,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"../scatterpolar/defaults":1104,"./attributes":1108}],1110:[function(_dereq_,module,exports){ +},{"../../lib":694,"../scatter/constants":1051,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"../scatterpolar/defaults":1111,"./attributes":1115}],1117:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204647,9 +206714,9 @@ } }; -},{"../../lib":692,"../../plots/cartesian/axes":740,"../../plots/polar":807,"../scatter/calc":1041,"../scatter/colorscale_calc":1043,"../scatter/marker_colorbar":1058,"../scattergl":1093,"../scattergl/constants":1090,"../scattergl/convert":1091,"../scatterpolar/hover":1105,"./attributes":1108,"./defaults":1109,"fast-isnumeric":214,"point-cluster":452}],1111:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../../plots/polar":809,"../scatter/calc":1048,"../scatter/colorscale_calc":1050,"../scatter/marker_colorbar":1065,"../scattergl":1100,"../scattergl/constants":1097,"../scattergl/convert":1098,"../scatterpolar/hover":1112,"./attributes":1115,"./defaults":1116,"fast-isnumeric":215,"point-cluster":455}],1118:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204658,6 +206725,7 @@ 'use strict'; +var hovertemplateAttrs = _dereq_('../../components/fx/hovertemplate_attributes'); var scatterAttrs = _dereq_('../scatter/attributes'); var plotAttrs = _dereq_('../../plots/attributes'); var colorAttributes = _dereq_('../../components/colorscale/attributes'); @@ -204666,9 +206734,9 @@ var extendFlat = _dereq_('../../lib/extend').extendFlat; -var scatterMarkerAttrs = scatterAttrs.marker, - scatterLineAttrs = scatterAttrs.line, - scatterMarkerLineAttrs = scatterMarkerAttrs.line; +var scatterMarkerAttrs = scatterAttrs.marker; +var scatterLineAttrs = scatterAttrs.line; +var scatterMarkerLineAttrs = scatterMarkerAttrs.line; module.exports = { a: { @@ -204748,11 +206816,12 @@ flags: ['a', 'b', 'c', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, + hovertemplate: hovertemplateAttrs(), }; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../components/drawing/attributes":589,"../../lib/extend":682,"../../plots/attributes":737,"../scatter/attributes":1040}],1112:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../components/drawing/attributes":591,"../../components/fx/hovertemplate_attributes":609,"../../lib/extend":684,"../../plots/attributes":739,"../scatter/attributes":1047}],1119:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204832,9 +206901,9 @@ return cd; }; -},{"../scatter/arrays_to_calcdata":1039,"../scatter/calc":1041,"../scatter/calc_selection":1042,"../scatter/colorscale_calc":1043,"fast-isnumeric":214}],1113:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":1046,"../scatter/calc":1048,"../scatter/calc_selection":1049,"../scatter/colorscale_calc":1050,"fast-isnumeric":215}],1120:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204862,10 +206931,10 @@ return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } - var a = coerce('a'), - b = coerce('b'), - c = coerce('c'), - len; + var a = coerce('a'); + var b = coerce('b'); + var c = coerce('c'); + var len; // allow any one array to be missing, len is the minimum length of those // present. Note that after coerce data_array's are either Arrays (which @@ -204896,6 +206965,7 @@ coerce('text'); coerce('hovertext'); + if(traceOut.hoveron !== 'fills') coerce('hovertemplate'); var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; coerce('mode', defaultMode); @@ -204936,9 +207006,9 @@ Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":692,"../scatter/constants":1044,"../scatter/fillcolor_defaults":1049,"../scatter/line_defaults":1053,"../scatter/line_shape_defaults":1055,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"../scatter/text_defaults":1065,"./attributes":1111}],1114:[function(_dereq_,module,exports){ +},{"../../lib":694,"../scatter/constants":1051,"../scatter/fillcolor_defaults":1056,"../scatter/line_defaults":1060,"../scatter/line_shape_defaults":1062,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"../scatter/text_defaults":1072,"./attributes":1118}],1121:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -204968,9 +207038,9 @@ return out; }; -},{}],1115:[function(_dereq_,module,exports){ +},{}],1122:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -205001,10 +207071,10 @@ // so easy and anyway we lost the information we would have needed to do // this inside scatterHover. if(newPointData.index === undefined) { - var yFracUp = 1 - (newPointData.y0 / pointData.ya._length), - xLen = pointData.xa._length, - xMin = xLen * yFracUp / 2, - xMax = xLen - xMin; + var yFracUp = 1 - (newPointData.y0 / pointData.ya._length); + var xLen = pointData.xa._length; + var xMin = xLen * yFracUp / 2; + var xMax = xLen - xMin; newPointData.x0 = Math.max(Math.min(newPointData.x0, xMax), xMin); newPointData.x1 = Math.max(Math.min(newPointData.x1, xMax), xMin); return scatterPointData; @@ -205023,26 +207093,25 @@ var trace = newPointData.trace; var ternary = newPointData.subplot; var hoverinfo = cdi.hi || trace.hoverinfo; - var parts = hoverinfo.split('+'); var text = []; - function textPart(ax, val) { text.push(ax._hovertitle + ': ' + Axes.tickText(ax, val, 'hover').text); } - - if(parts.indexOf('all') !== -1) parts = ['a', 'b', 'c']; - if(parts.indexOf('a') !== -1) textPart(ternary.aaxis, cdi.a); - if(parts.indexOf('b') !== -1) textPart(ternary.baxis, cdi.b); - if(parts.indexOf('c') !== -1) textPart(ternary.caxis, cdi.c); - + if(!trace.hovertemplate) { + var parts = hoverinfo.split('+'); + if(parts.indexOf('all') !== -1) parts = ['a', 'b', 'c']; + if(parts.indexOf('a') !== -1) textPart(ternary.aaxis, cdi.a); + if(parts.indexOf('b') !== -1) textPart(ternary.baxis, cdi.b); + if(parts.indexOf('c') !== -1) textPart(ternary.caxis, cdi.c); + } newPointData.extraText = text.join('
'); - + newPointData.hovertemplate = trace.hovertemplate; return scatterPointData; }; -},{"../../plots/cartesian/axes":740,"../scatter/hover":1051}],1116:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":742,"../scatter/hover":1058}],1123:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -205075,9 +207144,9 @@ module.exports = ScatterTernary; -},{"../../plots/ternary":819,"../scatter/marker_colorbar":1058,"../scatter/select":1061,"../scatter/style":1063,"./attributes":1111,"./calc":1112,"./defaults":1113,"./event_data":1114,"./hover":1115,"./plot":1117}],1117:[function(_dereq_,module,exports){ +},{"../../plots/ternary":821,"../scatter/marker_colorbar":1065,"../scatter/select":1068,"../scatter/style":1070,"./attributes":1118,"./calc":1119,"./defaults":1120,"./event_data":1121,"./hover":1122,"./plot":1124}],1124:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -205108,9 +207177,9 @@ scatterPlot(gd, plotinfo, moduleCalcData, scatterLayer); }; -},{"../scatter/plot":1060}],1118:[function(_dereq_,module,exports){ +},{"../scatter/plot":1067}],1125:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -205260,9 +207329,9 @@ opacity: scatterGlAttrs.opacity }; -},{"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plot_api/plot_template":730,"../../plots/cartesian/constants":746,"../scatter/attributes":1040,"../scattergl/attributes":1089}],1119:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plot_api/plot_template":732,"../../plots/cartesian/constants":748,"../scatter/attributes":1047,"../scattergl/attributes":1096}],1126:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -205503,9 +207572,9 @@ toSVG: Cartesian.toSVG }; -},{"../../lib/prepare_regl":705,"../../plots/cartesian":752,"../../plots/cartesian/axes":740,"../../plots/cartesian/axis_ids":743,"../../plots/get_data":777,"../../registry":823,"regl-line2d":474}],1120:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":707,"../../plots/cartesian":754,"../../plots/cartesian/axes":742,"../../plots/cartesian/axis_ids":745,"../../plots/get_data":779,"../../registry":825,"regl-line2d":477}],1127:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -205673,9 +207742,9 @@ } } -},{"../../lib":692,"../../plots/array_container_defaults":736,"../parcoords/merge_length":1012,"../scatter/marker_defaults":1059,"../scatter/subtypes":1064,"./attributes":1118}],1121:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/array_container_defaults":738,"../parcoords/merge_length":1019,"../scatter/marker_defaults":1066,"../scatter/subtypes":1071,"./attributes":1125}],1128:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206153,9 +208222,9 @@ // register it here Registry.register(Grid); -},{"../../components/grid":612,"../../constants/numerical":669,"../../lib":692,"../../plots/cartesian/axis_ids":743,"../../registry":823,"../scatter/calc":1041,"../scatter/colorscale_calc":1043,"../scatter/marker_colorbar":1058,"../scatter/subtypes":1064,"../scattergl":1093,"../scattergl/constants":1090,"../scattergl/convert":1091,"./attributes":1118,"./base_plot":1119,"./defaults":1120,"array-range":55,"regl-splom":477}],1122:[function(_dereq_,module,exports){ +},{"../../components/grid":614,"../../constants/numerical":671,"../../lib":694,"../../plots/cartesian/axis_ids":745,"../../registry":825,"../scatter/calc":1048,"../scatter/colorscale_calc":1050,"../scatter/marker_colorbar":1065,"../scatter/subtypes":1071,"../scattergl":1100,"../scattergl/constants":1097,"../scattergl/convert":1098,"./attributes":1125,"./base_plot":1126,"./defaults":1127,"array-range":56,"regl-splom":479}],1129:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206293,9 +208362,9 @@ module.exports = attrs; -},{"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plots/attributes":737,"../mesh3d/attributes":983}],1123:[function(_dereq_,module,exports){ +},{"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plots/attributes":739,"../mesh3d/attributes":990}],1130:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206387,9 +208456,9 @@ trace._zbnds = [zMin, zMax]; }; -},{"../../components/colorscale/calc":577}],1124:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579}],1131:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206543,7 +208612,7 @@ tubeOpts.startingPositions = startingPositions; } - tubeOpts.colormap = parseColorScale(trace.colorscale); + tubeOpts.colormap = parseColorScale(trace); tubeOpts.tubeSize = trace.sizeref; tubeOpts.maxLength = trace.maxdisplayed; @@ -206615,9 +208684,9 @@ module.exports = createStreamtubeTrace; -},{"../../lib":692,"../../lib/gl_format_color":689,"../../plots/gl3d/zip3":794,"gl-streamtube3d":301}],1125:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/gl_format_color":691,"../../plots/gl3d/zip3":796,"gl-streamtube3d":303}],1132:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206678,9 +208747,9 @@ traceOut._length = null; }; -},{"../../components/colorscale/defaults":579,"../../lib":692,"./attributes":1122}],1126:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"./attributes":1129}],1133:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206728,9 +208797,9 @@ } }; -},{"../../plots/gl3d":783,"./attributes":1122,"./calc":1123,"./convert":1124,"./defaults":1125}],1127:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":785,"./attributes":1129,"./calc":1130,"./convert":1131,"./defaults":1132}],1134:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206957,9 +209026,9 @@ attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/color":569,"../../components/colorbar/attributes":570,"../../components/colorscale/attributes":576,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/attributes":737}],1128:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/colorbar/attributes":572,"../../components/colorscale/attributes":578,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/attributes":739}],1135:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -206989,9 +209058,9 @@ } }; -},{"../../components/colorscale/calc":577}],1129:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":579}],1136:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -207109,8 +209178,8 @@ }; function isColormapCircular(colormap) { - var first = colormap[0].rgb, - last = colormap[colormap.length - 1].rgb; + var first = colormap[0].rgb; + var last = colormap[colormap.length - 1].rgb; return ( first[0] === last[0] && @@ -207352,15 +209421,15 @@ }; proto.update = function(data) { - var scene = this.scene, - sceneLayout = scene.fullSceneLayout, - surface = this.surface, - alpha = data.opacity, - colormap = parseColorScale(data.colorscale, alpha), - scaleFactor = scene.dataScale, - xlen = data.z[0].length, - ylen = data._ylength, - contourLevels = scene.contourLevels; + var scene = this.scene; + var sceneLayout = scene.fullSceneLayout; + var surface = this.surface; + var alpha = data.opacity; + var colormap = parseColorScale(data, alpha); + var scaleFactor = scene.dataScale; + var xlen = data.z[0].length; + var ylen = data._ylength; + var contourLevels = scene.contourLevels; // Save data this.data = data; @@ -207601,16 +209670,15 @@ module.exports = createSurfaceTrace; -},{"../../lib":692,"../../lib/gl_format_color":689,"../../lib/str2rgbarray":715,"gl-surface3d":303,"ndarray":433,"ndarray-fill":423,"ndarray-homography":425}],1130:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../lib/gl_format_color":691,"../../lib/str2rgbarray":717,"gl-surface3d":306,"ndarray":436,"ndarray-fill":426,"ndarray-homography":428}],1137:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ - 'use strict'; var Registry = _dereq_('../../registry'); @@ -207619,7 +209687,6 @@ var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); var attributes = _dereq_('./attributes'); - module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { var i, j; @@ -207627,15 +209694,18 @@ return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } + var x = coerce('x'); + var y = coerce('y'); + var z = coerce('z'); - if(!z) { + if(!z || !z.length || + (x ? (x.length < 1) : false) || + (y ? (y.length < 1) : false) + ) { traceOut.visible = false; return; } - var x = coerce('x'); - coerce('y'); - traceOut._xlength = (Array.isArray(x) && Lib.isArrayOrTypedArray(x[0])) ? z.length : z[0].length; traceOut._ylength = z.length; @@ -207662,8 +209732,6 @@ var surfaceColor = coerce('surfacecolor'); - coerce('colorscale'); - var dims = ['x', 'y', 'z']; for(i = 0; i < 3; ++i) { @@ -207714,9 +209782,9 @@ } } -},{"../../components/colorscale/defaults":579,"../../lib":692,"../../registry":823,"./attributes":1127}],1131:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":581,"../../lib":694,"../../registry":825,"./attributes":1134}],1138:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -207747,9 +209815,9 @@ module.exports = Surface; -},{"../../plots/gl3d":783,"./attributes":1127,"./calc":1128,"./convert":1129,"./defaults":1130}],1132:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":785,"./attributes":1134,"./calc":1135,"./convert":1136,"./defaults":1137}],1139:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -207921,9 +209989,9 @@ }, 'calc', 'from-root'); attrs.transforms = undefined; -},{"../../components/annotations/attributes":552,"../../lib/extend":682,"../../plot_api/edit_types":723,"../../plots/domain":766,"../../plots/font_attributes":767}],1133:[function(_dereq_,module,exports){ +},{"../../components/annotations/attributes":554,"../../lib/extend":684,"../../plot_api/edit_types":725,"../../plots/domain":768,"../../plots/font_attributes":769}],1140:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -207953,9 +210021,9 @@ } }; -},{"../../plots/get_data":777,"./plot":1140}],1134:[function(_dereq_,module,exports){ +},{"../../plots/get_data":779,"./plot":1147}],1141:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -207972,9 +210040,9 @@ return wrap({}); }; -},{"../../lib/gup":690}],1135:[function(_dereq_,module,exports){ +},{"../../lib/gup":692}],1142:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -208032,9 +210100,9 @@ } }; -},{}],1136:[function(_dereq_,module,exports){ +},{}],1143:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -208228,9 +210296,9 @@ }; } -},{"../../lib/extend":682,"./constants":1135,"fast-isnumeric":214}],1137:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"./constants":1142,"fast-isnumeric":215}],1144:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -208311,9 +210379,9 @@ return [rowFrom, rowTo]; } -},{"../../lib/extend":682}],1138:[function(_dereq_,module,exports){ +},{"../../lib/extend":684}],1145:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -208376,9 +210444,9 @@ traceOut._length = null; }; -},{"../../lib":692,"../../plots/domain":766,"./attributes":1132}],1139:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/domain":768,"./attributes":1139}],1146:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -208404,9 +210472,9 @@ module.exports = Table; -},{"./attributes":1132,"./base_plot":1133,"./calc":1134,"./defaults":1138,"./plot":1140}],1140:[function(_dereq_,module,exports){ +},{"./attributes":1139,"./base_plot":1140,"./calc":1141,"./defaults":1145,"./plot":1147}],1147:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209310,9 +211378,9 @@ function getBlock(d) {return d.rowBlocks[d.page];} function getRow(l, i) {return l.rows[i - l.firstRowIndex];} -},{"../../components/color":569,"../../components/drawing":590,"../../lib":692,"../../lib/gup":690,"../../lib/svg_text_utils":716,"./constants":1135,"./data_preparation_helper":1136,"./data_split_helpers":1137,"d3":148}],1141:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../components/drawing":592,"../../lib":694,"../../lib/gup":692,"../../lib/svg_text_utils":718,"./constants":1142,"./data_preparation_helper":1143,"./data_split_helpers":1144,"d3":149}],1148:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209405,6 +211473,11 @@ pointpos: extendFlat({}, boxAttrs.pointpos, { }), + + width: extendFlat({}, boxAttrs.width, { + + }), + marker: boxAttrs.marker, text: boxAttrs.text, @@ -209479,7 +211552,7 @@ values: ['both', 'positive', 'negative'], dflt: 'both', - editType: 'plot', + editType: 'calc', }, @@ -209497,9 +211570,9 @@ } }; -},{"../../lib/extend":682,"../box/attributes":856}],1142:[function(_dereq_,module,exports){ +},{"../../lib/extend":684,"../box/attributes":858}],1149:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209525,18 +211598,10 @@ trace[trace.orientation === 'h' ? 'xaxis' : 'yaxis'] ); - var violinScaleGroupStats = fullLayout._violinScaleGroupStats; - var scaleGroup = trace.scalegroup; - var groupStats = violinScaleGroupStats[scaleGroup]; - if(!groupStats) { - groupStats = violinScaleGroupStats[scaleGroup] = { - maxWidth: 0, - maxCount: 0 - }; - } - var spanMin = Infinity; var spanMax = -Infinity; + var maxKDE = 0; + var maxCount = 0; for(var i = 0; i < cd.length; i++) { var cdi = cd[i]; @@ -209561,12 +211626,11 @@ for(var k = 0, t = span[0]; t < (span[1] + step / 2); k++, t += step) { var v = kde(t); - groupStats.maxWidth = Math.max(groupStats.maxWidth, v); cdi.density[k] = {v: v, t: t}; + maxKDE = Math.max(maxKDE, v); } - groupStats.maxCount = Math.max(groupStats.maxCount, vals.length); - + maxCount = Math.max(maxCount, vals.length); spanMin = Math.min(spanMin, span[0]); spanMax = Math.max(spanMax, span[1]); } @@ -209574,6 +211638,24 @@ var extremes = Axes.findExtremes(valAxis, [spanMin, spanMax], {padded: true}); trace._extremes[valAxis._id] = extremes; + if(trace.width) { + cd[0].t.maxKDE = maxKDE; + } else { + var violinScaleGroupStats = fullLayout._violinScaleGroupStats; + var scaleGroup = trace.scalegroup; + var groupStats = violinScaleGroupStats[scaleGroup]; + + if(groupStats) { + groupStats.maxKDE = Math.max(groupStats.maxKDE, maxKDE); + groupStats.maxCount = Math.max(groupStats.maxCount, maxCount); + } else { + violinScaleGroupStats[scaleGroup] = { + maxKDE: maxKDE, + maxCount: maxCount + }; + } + } + cd[0].t.labels.kde = Lib._(gd, 'kde:'); return cd; @@ -209648,9 +211730,9 @@ return spanOut; } -},{"../../constants/numerical":669,"../../lib":692,"../../plots/cartesian/axes":740,"../box/calc":857,"./helpers":1145}],1143:[function(_dereq_,module,exports){ +},{"../../constants/numerical":671,"../../lib":694,"../../plots/cartesian/axes":742,"../box/calc":859,"./helpers":1152}],1150:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209671,8 +211753,6 @@ var orientation = orientations[i]; var posAxis = orientation === 'h' ? ya : xa; var violinList = []; - var minPad = 0; - var maxPad = 0; for(var j = 0; j < calcdata.length; j++) { var cd = calcdata[j]; @@ -209686,21 +211766,16 @@ trace.yaxis === ya._id ) { violinList.push(j); - - if(trace.points !== false) { - minPad = Math.max(minPad, trace.jitter - trace.pointpos - 1); - maxPad = Math.max(maxPad, trace.jitter + trace.pointpos - 1); - } } } - setPositionOffset('violin', gd, violinList, posAxis, [minPad, maxPad]); + setPositionOffset('violin', gd, violinList, posAxis); } }; -},{"../box/cross_trace_calc":858}],1144:[function(_dereq_,module,exports){ +},{"../box/cross_trace_calc":860}],1151:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209727,10 +211802,14 @@ if(traceOut.visible === false) return; coerce('bandwidth'); - coerce('scalegroup', traceOut.name); - coerce('scalemode'); coerce('side'); + var width = coerce('width'); + if(!width) { + coerce('scalegroup', traceOut.name); + coerce('scalemode'); + } + var span = coerce('span'); var spanmodeDflt; if(Array.isArray(span)) spanmodeDflt = 'manual'; @@ -209755,9 +211834,9 @@ if(!meanLineVisible) traceOut.meanline = {visible: false}; }; -},{"../../components/color":569,"../../lib":692,"../box/defaults":859,"./attributes":1141}],1145:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../../lib":694,"../box/defaults":861,"./attributes":1148}],1152:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209828,9 +211907,9 @@ exports.extractVal = function(o) { return o.v; }; -},{"../../lib":692}],1146:[function(_dereq_,module,exports){ +},{"../../lib":694}],1153:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209937,9 +212016,9 @@ return closeData; }; -},{"../../lib":692,"../../plots/cartesian/axes":740,"../box/hover":861,"./helpers":1145}],1147:[function(_dereq_,module,exports){ +},{"../../lib":694,"../../plots/cartesian/axes":742,"../box/hover":863,"./helpers":1152}],1154:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209970,9 +212049,9 @@ } }; -},{"../../plots/cartesian":752,"../box/select":866,"../scatter/style":1063,"./attributes":1141,"./calc":1142,"./cross_trace_calc":1143,"./defaults":1144,"./hover":1146,"./layout_attributes":1148,"./layout_defaults":1149,"./plot":1150,"./style":1151}],1148:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":754,"../box/select":868,"../scatter/style":1070,"./attributes":1148,"./calc":1149,"./cross_trace_calc":1150,"./defaults":1151,"./hover":1153,"./layout_attributes":1155,"./layout_defaults":1156,"./plot":1157,"./style":1158}],1155:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -209996,9 +212075,9 @@ }) }; -},{"../../lib":692,"../box/layout_attributes":863}],1149:[function(_dereq_,module,exports){ +},{"../../lib":694,"../box/layout_attributes":865}],1156:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -210018,9 +212097,9 @@ boxLayoutDefaults._supply(layoutIn, layoutOut, fullData, coerce, 'violin'); }; -},{"../../lib":692,"../box/layout_defaults":864,"./layout_attributes":1148}],1150:[function(_dereq_,module,exports){ +},{"../../lib":694,"../box/layout_defaults":866,"./layout_attributes":1155}],1157:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -210060,28 +212139,19 @@ var t = cd0.t; var trace = cd0.trace; if(!plotinfo.isRangePlot) cd0.node3 = plotGroup; - var numViolins = fullLayout._numViolins; - var group = (fullLayout.violinmode === 'group' && numViolins > 1); - var groupFraction = 1 - fullLayout.violingap; - // violin max half width - var bdPos = t.bdPos = t.dPos * groupFraction * (1 - fullLayout.violingroupgap) / (group ? numViolins : 1); - // violin center offset - var bPos = t.bPos = group ? 2 * t.dPos * (-0.5 + (t.num + 0.5) / numViolins) * groupFraction : 0; - // half-width within which to accept hover for this violin - // always split the distance to the closest violin - t.wHover = t.dPos * (group ? groupFraction / numViolins : 1); if(trace.visible !== true || t.empty) { plotGroup.remove(); return; } + var bPos = t.bPos; + var bdPos = t.bdPos; var valAxis = plotinfo[t.valLetter + 'axis']; var posAxis = plotinfo[t.posLetter + 'axis']; var hasBothSides = trace.side === 'both'; var hasPositiveSide = hasBothSides || trace.side === 'positive'; var hasNegativeSide = hasBothSides || trace.side === 'negative'; - var groupStats = fullLayout._violinScaleGroupStats[trace.scalegroup]; var violins = plotGroup.selectAll('path.violin').data(Lib.identity); @@ -210097,15 +212167,15 @@ var len = density.length; var posCenter = d.pos + bPos; var posCenterPx = posAxis.c2p(posCenter); - var scale; - switch(trace.scalemode) { - case 'width': - scale = groupStats.maxWidth / bdPos; - break; - case 'count': - scale = (groupStats.maxWidth / bdPos) * (groupStats.maxCount / d.pts.length); - break; + var scale; + if(trace.width) { + scale = t.maxKDE / bdPos; + } else { + var groupStats = fullLayout._violinScaleGroupStats[trace.scalegroup]; + scale = trace.scalemode === 'count' ? + (groupStats.maxKDE / bdPos) * (groupStats.maxCount / d.pts.length) : + groupStats.maxKDE / bdPos; } var pathPos, pathNeg, path; @@ -210218,9 +212288,9 @@ }); }; -},{"../../components/drawing":590,"../../lib":692,"../box/plot":865,"../scatter/line_points":1054,"./helpers":1145,"d3":148}],1151:[function(_dereq_,module,exports){ +},{"../../components/drawing":592,"../../lib":694,"../box/plot":867,"../scatter/line_points":1061,"./helpers":1152,"d3":149}],1158:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -210273,9 +212343,9 @@ }); }; -},{"../../components/color":569,"../scatter/style":1063,"d3":148}],1152:[function(_dereq_,module,exports){ +},{"../../components/color":571,"../scatter/style":1070,"d3":149}],1159:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -210699,9 +212769,9 @@ return array[indices[indices.length - 1]]; } -},{"../constants/numerical":669,"../lib":692,"../plot_api/plot_schema":729,"../plots/cartesian/axes":740,"./helpers":1155}],1153:[function(_dereq_,module,exports){ +},{"../constants/numerical":671,"../lib":694,"../plot_api/plot_schema":731,"../plots/cartesian/axes":742,"./helpers":1162}],1160:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -210870,16 +212940,16 @@ }; function getFilterFunc(opts, d2c, targetCalendar) { - var operation = opts.operation, - value = opts.value, - hasArrayValue = Array.isArray(value); + var operation = opts.operation; + var value = opts.value; + var hasArrayValue = Array.isArray(value); function isOperationIn(array) { return array.indexOf(operation) !== -1; } - var d2cValue = function(v) { return d2c(v, 0, opts.valuecalendar); }, - d2cTarget = function(v) { return d2c(v, 0, targetCalendar); }; + var d2cValue = function(v) { return d2c(v, 0, opts.valuecalendar); }; + var d2cTarget = function(v) { return d2c(v, 0, targetCalendar); }; var coercedValue; @@ -210975,9 +213045,9 @@ } } -},{"../constants/filter_ops":665,"../lib":692,"../plots/cartesian/axes":740,"../registry":823,"./helpers":1155}],1154:[function(_dereq_,module,exports){ +},{"../constants/filter_ops":667,"../lib":694,"../plots/cartesian/axes":742,"../registry":825,"./helpers":1162}],1161:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -211132,9 +213202,9 @@ return [trace]; } - var groupNames = Lib.filterUnique(groups), - newData = new Array(groupNames.length), - len = groups.length; + var groupNames = Lib.filterUnique(groups); + var newData = new Array(groupNames.length); + var len = groups.length; var arrayAttrs = PlotSchema.findArrayAttributes(trace); @@ -211237,9 +213307,9 @@ return newData; } -},{"../lib":692,"../plot_api/plot_schema":729,"../plots/plots":804,"./helpers":1155}],1155:[function(_dereq_,module,exports){ +},{"../lib":694,"../plot_api/plot_schema":731,"../plots/plots":806,"./helpers":1162}],1162:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -211263,9 +213333,9 @@ return originalPointsAccessor; }; -},{}],1156:[function(_dereq_,module,exports){ +},{}],1163:[function(_dereq_,module,exports){ /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -211393,7 +213463,7 @@ } } -},{"../lib":692,"../plots/cartesian/axes":740,"./helpers":1155}]},{},[22])(22) +},{"../lib":694,"../plots/cartesian/axes":742,"./helpers":1162}]},{},[22])(22) }); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9))) @@ -211404,7 +213474,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -211467,7 +213537,7 @@ lib.MIN_MS = datesModule.MIN_MS; lib.MAX_MS = datesModule.MAX_MS; -var searchModule = __webpack_require__(41); +var searchModule = __webpack_require__(42); lib.findBin = searchModule.findBin; lib.sorterAsc = searchModule.sorterAsc; lib.sorterDes = searchModule.sorterDes; @@ -211476,7 +213546,7 @@ lib.sort = searchModule.sort; lib.findIndexOfMin = searchModule.findIndexOfMin; -var statsModule = __webpack_require__(42); +var statsModule = __webpack_require__(43); lib.aggNums = statsModule.aggNums; lib.len = statsModule.len; lib.mean = statsModule.mean; @@ -211485,7 +213555,7 @@ lib.stdev = statsModule.stdev; lib.interp = statsModule.interp; -var matrixModule = __webpack_require__(43); +var matrixModule = __webpack_require__(44); lib.init2dArray = matrixModule.init2dArray; lib.transposeRagged = matrixModule.transposeRagged; lib.dot = matrixModule.dot; @@ -211495,7 +213565,7 @@ lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; -var anglesModule = __webpack_require__(44); +var anglesModule = __webpack_require__(45); lib.deg2rad = anglesModule.deg2rad; lib.rad2deg = anglesModule.rad2deg; lib.angleDelta = anglesModule.angleDelta; @@ -211507,7 +213577,7 @@ lib.pathSector = anglesModule.pathSector; lib.pathAnnulus = anglesModule.pathAnnulus; -var anchorUtils = __webpack_require__(45); +var anchorUtils = __webpack_require__(46); lib.isLeftAnchor = anchorUtils.isLeftAnchor; lib.isCenterAnchor = anchorUtils.isCenterAnchor; lib.isRightAnchor = anchorUtils.isRightAnchor; @@ -211515,7 +213585,7 @@ lib.isMiddleAnchor = anchorUtils.isMiddleAnchor; lib.isBottomAnchor = anchorUtils.isBottomAnchor; -var geom2dModule = __webpack_require__(46); +var geom2dModule = __webpack_require__(47); lib.segmentsIntersect = geom2dModule.segmentsIntersect; lib.segmentDistance = geom2dModule.segmentDistance; lib.getTextLocation = geom2dModule.getTextLocation; @@ -211537,26 +213607,26 @@ var regexModule = __webpack_require__(14); lib.counterRegex = regexModule.counter; -var throttleModule = __webpack_require__(47); +var throttleModule = __webpack_require__(48); lib.throttle = throttleModule.throttle; lib.throttleDone = throttleModule.done; lib.clearThrottle = throttleModule.clear; -lib.getGraphDiv = __webpack_require__(48); +lib.getGraphDiv = __webpack_require__(49); -lib.clearResponsive = __webpack_require__(49); +lib.clearResponsive = __webpack_require__(50); -lib.makeTraceGroups = __webpack_require__(50); +lib.makeTraceGroups = __webpack_require__(51); -lib._ = __webpack_require__(51); +lib._ = __webpack_require__(52); -lib.notifier = __webpack_require__(52); +lib.notifier = __webpack_require__(53); -lib.filterUnique = __webpack_require__(53); -lib.filterVisible = __webpack_require__(54); +lib.filterUnique = __webpack_require__(54); +lib.filterVisible = __webpack_require__(55); lib.pushUnique = __webpack_require__(17); -lib.cleanNumber = __webpack_require__(55); +lib.cleanNumber = __webpack_require__(56); lib.ensureNumber = function num(v) { if(!isNumeric(v)) return BADNUM; @@ -211605,10 +213675,10 @@ if(!part1) part1 = 'x'; if(!part2) part2 = 'y'; for(var i = 0; i < attrList.length; i++) { - var attr = attrList[i], - xp = lib.nestedProperty(cont, attr.replace('?', part1)), - yp = lib.nestedProperty(cont, attr.replace('?', part2)), - temp = xp.get(); + var attr = attrList[i]; + var xp = lib.nestedProperty(cont, attr.replace('?', part1)); + var yp = lib.nestedProperty(cont, attr.replace('?', part2)); + var temp = xp.get(); xp.set(yp.get()); yp.set(temp); } @@ -211657,8 +213727,8 @@ * x1, x2: optional extra args */ lib.simpleMap = function(array, func, x1, x2) { - var len = array.length, - out = new Array(len); + var len = array.length; + var out = new Array(len); for(var i = 0; i < len; i++) out[i] = func(array[i], x1, x2); return out; }; @@ -211746,15 +213816,15 @@ FWHM = Math.round(FWHM) || 0; // only makes sense for integers if(FWHM < 2) return arrayIn; - var alen = arrayIn.length, - alen2 = 2 * alen, - wlen = 2 * FWHM - 1, - w = new Array(wlen), - arrayOut = new Array(alen), - i, - j, - k, - v; + 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; // first make the window array for(i = 0; i < wlen; i++) { @@ -211832,10 +213902,10 @@ */ if(!containerIn) return; - var hasAny = false, - hasAll = true, - i, - val; + var hasAny = false; + var hasAll = true; + var i; + var val; for(i = 0; i < attrList.length; i++) { val = containerIn[attrList[i]]; @@ -212039,11 +214109,10 @@ lib.minExtend = function(obj1, obj2) { var objOut = {}; if(typeof obj2 !== 'object') obj2 = {}; - var arrayLen = 3, - keys = Object.keys(obj1), - i, - k, - v; + var arrayLen = 3; + var keys = Object.keys(obj1); + var i, k, v; + for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; @@ -212109,8 +214178,8 @@ * to a stylesheet uniquely identified by a uid */ lib.addRelatedStyleRule = function(uid, selector, styleString) { - var id = 'plotly.js-style-' + uid, - style = document.getElementById(id); + var id = 'plotly.js-style-' + uid; + var style = document.getElementById(id); if(!style) { style = document.createElement('style'); style.setAttribute('id', id); @@ -212133,8 +214202,8 @@ * to remove from the page a stylesheet identified by a given uid */ lib.deleteRelatedStyleRule = function(uid) { - var id = 'plotly.js-style-' + uid, - style = document.getElementById(id); + var id = 'plotly.js-style-' + uid; + var style = document.getElementById(id); if(style) lib.removeElement(style); }; @@ -212225,9 +214294,9 @@ * @return {Object} the constructed object with a full nested path */ lib.objectFromPath = function(path, value) { - var keys = path.split('.'), - tmpObj, - obj = tmpObj = {}; + var keys = path.split('.'); + var tmpObj; + var obj = tmpObj = {}; for(var i = 0; i < keys.length; i++) { var key = keys[i]; @@ -212382,13 +214451,13 @@ value = String(value); } - var thousandsRe = /(\d+)(\d{3})/, - decimalSep = separators.charAt(0), - thouSep = separators.charAt(1); - - var x = value.split('.'), - x1 = x[0], - x2 = x.length > 1 ? decimalSep + x[1] : ''; + var thousandsRe = /(\d+)(\d{3})/; + var decimalSep = separators.charAt(0); + var thouSep = separators.charAt(1); + + var x = value.split('.'); + var x1 = x[0]; + var x2 = x.length > 1 ? decimalSep + x[1] : ''; // Years are ignored for thousands separators if(thouSep && (x.length > 1 || x1.length > 4 || separatethousands)) { @@ -212581,7 +214650,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -212779,7 +214848,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -212837,7 +214906,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -212870,7 +214939,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -212938,7 +215007,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -213121,8 +215190,8 @@ propOut.set(v); return; } - var vParts = v.split('+'), - i = 0; + var vParts = v.split('+'); + var i = 0; while(i < vParts.length) { var vi = vParts[i]; if(opts.flags.indexOf(vi) === -1 || vParts.indexOf(vi) < i) { @@ -213301,9 +215370,9 @@ * returns false if there is no user input. */ exports.coerce2 = function(containerIn, containerOut, attributes, attribute, dflt) { - var propIn = nestedProperty(containerIn, attribute), - propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt), - valIn = propIn.get(); + var propIn = nestedProperty(containerIn, attribute); + var propOut = exports.coerce(containerIn, containerOut, attributes, attribute, dflt); + var valIn = propIn.get(); return (valIn !== undefined && valIn !== null) ? propOut : false; }; @@ -213396,9 +215465,9 @@ return valObjectDef.validateFunction(value, opts); } - var failed = {}, - out = failed, - propMock = { set: function(v) { out = v; } }; + var failed = {}; + var out = failed; + var propMock = { set: function(v) { out = v; } }; // 'failed' just something mutable that won't be === anything else @@ -213414,7 +215483,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -213465,7 +215534,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -213497,7 +215566,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -213668,12 +215737,12 @@ var match = s.match(isChinese ? DATETIME_REGEXP_CN : DATETIME_REGEXP); if(!match) return BADNUM; - var y = match[1], - m = match[3] || '1', - d = Number(match[5] || 1), - H = Number(match[7] || 0), - M = Number(match[9] || 0), - S = Number(match[11] || 0); + 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) { // disallow 2-digit years for world calendars @@ -213750,18 +215819,17 @@ if(!r) r = 0; - var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10), - msRounded = Math.round(ms - msecTenths / 10), - dateStr, h, m, s, msec10, d; + var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10); + var msRounded = Math.round(ms - msecTenths / 10); + var dateStr, h, m, s, msec10, d; if(isWorldCalendar(calendar)) { - var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD, - timeMs = Math.floor(mod(ms, ONEDAY)); + var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD; + var timeMs = Math.floor(mod(ms, ONEDAY)); try { dateStr = Registry.getComponentMethod('calendars', 'getCal')(calendar) .fromJD(dateJD).formatDate('yyyy-mm-dd'); - } - catch(e) { + } catch(e) { // invalid date in this calendar - fall back to Gyyyy-mm-dd dateStr = utcFormat('G%Y-%m-%d')(new Date(msRounded)); } @@ -213771,8 +215839,7 @@ // it manually (after the '-' if there is one) if(dateStr.charAt(0) === '-') { while(dateStr.length < 11) dateStr = '-0' + dateStr.substr(1); - } - else { + } else { while(dateStr.length < 10) dateStr = '0' + dateStr; } @@ -213809,13 +215876,13 @@ exports.ms2DateTimeLocal = function(ms) { if(!(ms >= MIN_MS + ONEDAY && ms <= MAX_MS - ONEDAY)) return BADNUM; - var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10), - d = new Date(Math.round(ms - msecTenths / 10)), - dateStr = d3.time.format('%Y-%m-%d')(d), - h = d.getHours(), - m = d.getMinutes(), - s = d.getSeconds(), - msec10 = d.getUTCMilliseconds() * 10 + msecTenths; + var msecTenths = Math.floor(mod(ms + 0.05, 1) * 10); + var d = new Date(Math.round(ms - msecTenths / 10)); + var dateStr = d3.time.format('%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); }; @@ -213879,10 +215946,10 @@ function modDateFormat(fmt, x, formatter, calendar) { fmt = fmt.replace(fracMatch, function(match) { - var digits = Math.min(+(match.charAt(1)) || 6, 6), - fracSecs = ((x / 1000 % 1) + 2) - .toFixed(digits) - .substr(2).replace(/0+$/, '') || '0'; + var digits = Math.min(+(match.charAt(1)) || 6, 6); + var fracSecs = ((x / 1000 % 1) + 2) + .toFixed(digits) + .substr(2).replace(/0+$/, '') || '0'; return fracSecs; }); @@ -214014,16 +216081,15 @@ if(calendar) { try { - var dateJD = Math.round(ms / ONEDAY) + EPOCHJD, - calInstance = Registry.getComponentMethod('calendars', 'getCal')(calendar), - cDate = calInstance.fromJD(dateJD); + var dateJD = Math.round(ms / 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) { + } catch(e) { Loggers.error('invalid ms ' + ms + ' in calendar ' + calendar); // then keep going in gregorian even though the result will be 'Invalid' } @@ -214040,12 +216106,12 @@ * calendar (string) the calendar to test against */ exports.findExactDates = function(data, calendar) { - var exactYears = 0, - exactMonths = 0, - exactDays = 0, - blankCount = 0, - d, - di; + var exactYears = 0; + var exactMonths = 0; + var exactDays = 0; + var blankCount = 0; + var d; + var di; var calInstance = ( isWorldCalendar(calendar) && @@ -214105,7 +216171,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -214120,214 +216186,281 @@ * * The defaults are the appropriate settings for plotly.js, * so we get the right experience without any config argument. + * + * N.B. the config options are not coerced using Lib.coerce so keys + * like `valType` and `values` are only set for documentation purposes + * at the moment. */ -module.exports = { - - // no interactivity, for export or image generation - staticPlot: false, +var configAttributes = { + staticPlot: { + valType: 'boolean', + dflt: false, + + }, - // base URL for the 'Edit in Chart Studio' (aka sendDataToCloud) mode bar button - // and the showLink/sendData on-graph link - plotlyServerURL: 'https://plot.ly', + plotlyServerURL: { + valType: 'string', + dflt: 'https://plot.ly', + + }, - /* - * we can edit titles, move annotations, etc - sets all pieces of `edits` - * unless a separate `edits` config item overrides individual parts - */ - editable: false, + editable: { + valType: 'boolean', + dflt: false, + + }, edits: { - /* - * annotationPosition: the main anchor of the annotation, which is the - * text (if no arrow) or the arrow (which drags the whole thing leaving - * the arrow length & direction unchanged) - */ - annotationPosition: false, - // just for annotations with arrows, change the length and direction of the arrow - annotationTail: false, - annotationText: false, - axisTitleText: false, - colorbarPosition: false, - colorbarTitleText: false, - legendPosition: false, - // edit the trace name fields from the legend - legendText: false, - shapePosition: false, - // the global `layout.title` - titleText: false + annotationPosition: { + valType: 'boolean', + dflt: false, + + }, + annotationTail: { + valType: 'boolean', + dflt: false, + + }, + annotationText: { + valType: 'boolean', + dflt: false, + + }, + axisTitleText: { + valType: 'boolean', + dflt: false, + + }, + colorbarPosition: { + valType: 'boolean', + dflt: false, + + }, + colorbarTitleText: { + valType: 'boolean', + dflt: false, + + }, + legendPosition: { + valType: 'boolean', + dflt: false, + + }, + legendText: { + valType: 'boolean', + dflt: false, + + }, + shapePosition: { + valType: 'boolean', + dflt: false, + + }, + titleText: { + valType: 'boolean', + dflt: false, + + } }, - /* - * DO autosize once regardless of layout.autosize - * (use default width or height values otherwise) - */ - autosizable: false, - - /* - * responsive: determines whether to change the layout size when window is resized. - * In v2, this option will be removed and will always be true. - */ - responsive: false, - - // set the length of the undo/redo queue - queueLength: 0, - - // if we DO autosize, do we fill the container or the screen? - fillFrame: false, - - // if we DO autosize, set the frame margins in percents of plot size - frameMargins: 0, - - // mousewheel or two-finger scroll zooms the plot - scrollZoom: false, - - // double click interaction (false, 'reset', 'autosize' or 'reset+autosize') - doubleClick: 'reset+autosize', - - // new users see some hints about interactivity - showTips: true, - - // enable axis pan/zoom drag handles - showAxisDragHandles: true, - - /* - * enable direct range entry at the pan/zoom drag points - * (drag handles must be enabled above) - */ - showAxisRangeEntryBoxes: true, - - /* - * Add a text link to open this plot in plotly? - * This link shows up in the bottom right corner of the plot, and works - * identically to the newer ModeBar button controlled by `showSendToCloud` - * unless `sendData: false` is used. - */ - showLink: false, + autosizable: { + valType: 'boolean', + dflt: false, + + }, + responsive: { + valType: 'boolean', + dflt: false, + + }, + fillFrame: { + valType: 'boolean', + dflt: false, + + }, + frameMargins: { + valType: 'number', + dflt: 0, + min: 0, + max: 0.5, + + }, - /* - * If we show a text link (`showLink: true`), does it contain data or just - * a reference to a plotly cloud file? This option should only be used on - * plot.ly or another plotly server, and is not supported by the newer - * ModeBar button `showSendToCloud`. - */ - sendData: true, + scrollZoom: { + valType: 'flaglist', + flags: ['cartesian', 'gl3d', 'geo', 'mapbox'], + extras: [true, false], + dflt: 'gl3d+geo+mapbox', + + }, + doubleClick: { + valType: 'enumerated', + values: [false, 'reset', 'autosize', 'reset+autosize'], + dflt: 'reset+autosize', + + }, - /* - * Should we include a ModeBar button, labeled "Edit in Chart Studio", - * that sends this chart to 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`) send your data - * to an external server. However that server doesn't persist your data - * until you arrive at the Chart Studio and explicitly click "Save". - */ - showSendToCloud: false, + showAxisDragHandles: { + valType: 'boolean', + dflt: true, + + }, + showAxisRangeEntryBoxes: { + valType: 'boolean', + dflt: true, + + }, - // text appearing in the sendData link - linkText: 'Edit chart', + showTips: { + valType: 'boolean', + dflt: true, + + }, - // false or function adding source(s) to linkText - showSources: false, + showLink: { + valType: 'boolean', + dflt: false, + + }, + linkText: { + valType: 'string', + dflt: 'Edit chart', + noBlank: true, + + }, + sendData: { + valType: 'boolean', + dflt: true, + + }, + showSources: { + valType: 'any', + dflt: false, + + }, - // display the mode bar (true, false, or 'hover') - displayModeBar: 'hover', + displayModeBar: { + valType: 'enumerated', + values: ['hover', true, false], + dflt: 'hover', + + }, + showSendToCloud: { + valType: 'boolean', + dflt: false, + + }, + modeBarButtonsToRemove: { + valType: 'any', + dflt: [], + + }, + modeBarButtonsToAdd: { + valType: 'any', + dflt: [], + + }, + modeBarButtons: { + valType: 'any', + dflt: false, + + }, + toImageButtonOptions: { + valType: 'any', + dflt: {}, + + }, + displaylogo: { + valType: 'boolean', + dflt: true, + + }, + watermark: { + valType: 'boolean', + dflt: false, + + }, - /* - * remove mode bar button by name - * (see ../components/modebar/buttons.js for the list of names) - */ - modeBarButtonsToRemove: [], + plotGlPixelRatio: { + valType: 'number', + dflt: 2, + min: 1, + max: 4, + + }, - /* - * add mode bar button using config objects - * (see ./components/modebar/buttons.js for list of arguments) - */ - modeBarButtonsToAdd: [], + setBackground: { + valType: 'any', + dflt: 'transparent', + + }, - /* - * 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) - */ - modeBarButtons: false, - - // statically override options for toImage modebar button - // allowed keys are format, filename, width, height, scale - // see ../components/modebar/buttons.js - toImageButtonOptions: {}, + topojsonURL: { + valType: 'string', + noBlank: true, + dflt: 'https://cdn.plot.ly/', + + }, - // add the plotly logo on the end of the mode bar - displaylogo: true, + mapboxAccessToken: { + valType: 'string', + dflt: null, + + }, - // watermark the images with the company's logo - watermark: false, + logging: { + valType: 'boolean', + dflt: 1, + + }, - // increase the pixel ratio for Gl plot images - plotGlPixelRatio: 2, + queueLength: { + valType: 'integer', + min: 0, + dflt: 0, + + }, - /* - * background setting function - * 'transparent' sets the background `layout.paper_color` - * 'opaque' blends bg color with white ensuring an opaque background - * or any other custom function of gd - */ - setBackground: 'transparent', + globalTransforms: { + valType: 'any', + dflt: [], + + }, - // URL to topojson files used in geo charts - topojsonURL: 'https://cdn.plot.ly/', + locale: { + valType: 'string', + dflt: 'en-US', + + }, - /* - * 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. - */ - mapboxAccessToken: null, + locales: { + valType: 'any', + dflt: {}, + + } +}; - /* - * Turn all console logging on or off (errors will be thrown) - * This should ONLY be set via Plotly.setPlotConfig - * 0: no logs - * 1: warnings and errors, but not informational messages - * 2: verbose logs - */ - logging: 1, +var dfltConfig = {}; - /* - * Set global transform to be applied to all traces with no - * specification needed - */ - globalTransforms: [], +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]); + } + } +} - /* - * Which localization should we use? - * Should be a string like 'en' or 'en-US'. - */ - locale: 'en-US', +crawl(configAttributes, dfltConfig); - /* - * 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. - */ - locales: {} +module.exports = { + configAttributes: configAttributes, + dfltConfig: dfltConfig }; @@ -214337,7 +216470,7 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -214347,9 +216480,10 @@ var fontAttrs = __webpack_require__(12); -var colorAttrs = __webpack_require__(38); -var colorscaleAttrs = __webpack_require__(39); -var padAttrs = __webpack_require__(40); +var animationAttrs = __webpack_require__(38); +var colorAttrs = __webpack_require__(39); +var colorscaleAttrs = __webpack_require__(40); +var padAttrs = __webpack_require__(41); var extendFlat = __webpack_require__(8).extendFlat; var globalFont = fontAttrs({ @@ -214612,6 +216746,18 @@ }, editType: 'modebar' }, + + meta: { + valType: 'data_array', + editType: 'plot', + + }, + + transition: extendFlat({}, animationAttrs.transition, { + + editType: 'none' + }), + _deprecated: { title: { valType: 'string', @@ -214633,7 +216779,124 @@ "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + + +module.exports = { + mode: { + valType: 'enumerated', + dflt: 'afterall', + + values: ['immediate', 'next', 'afterall'], + + }, + direction: { + valType: 'enumerated', + + values: ['forward', 'reverse'], + dflt: 'forward', + + }, + fromcurrent: { + valType: 'boolean', + dflt: false, + + + }, + frame: { + duration: { + valType: 'number', + + min: 0, + dflt: 500, + + }, + redraw: { + valType: 'boolean', + + dflt: true, + + }, + }, + transition: { + duration: { + valType: 'number', + + min: 0, + dflt: 500, + editType: 'none', + + }, + 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', + + }, + ordering: { + valType: 'enumerated', + values: ['layout first', 'traces first'], + dflt: 'layout first', + + editType: 'none', + + } + } +}; + + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -214673,12 +216936,12 @@ /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -214718,12 +216981,12 @@ /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -214778,12 +217041,12 @@ /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -214859,10 +217122,10 @@ var vals = valsIn.slice(); // otherwise we sort the original array... vals.sort(exports.sorterAsc); - var l = vals.length - 1, - minDiff = (vals[l] - vals[0]) || 1, - errDiff = minDiff / (l || 1) / 10000, - v2 = [vals[0]]; + var l = vals.length - 1; + var minDiff = (vals[l] - vals[0]) || 1; + var errDiff = minDiff / (l || 1) / 10000; + var v2 = [vals[0]]; for(var i = 0; i < l; i++) { // make sure values aren't just off by a rounding error @@ -214883,13 +217146,13 @@ * binary search is probably overkill here... */ exports.roundUp = function(val, arrayIn, reverse) { - var low = 0, - high = arrayIn.length - 1, - mid, - c = 0, - dlow = reverse ? 0 : 1, - dhigh = reverse ? 1 : 0, - rounded = reverse ? Math.ceil : Math.floor; + 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; // c is just to avoid infinite loops if there's an error while(low < high && c++ < 100) { mid = rounded((low + high) / 2); @@ -214971,12 +217234,12 @@ /***/ }), -/* 42 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215077,12 +217340,12 @@ /***/ }), -/* 43 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215105,10 +217368,9 @@ * transposing-a-2d-array-in-javascript */ exports.transposeRagged = function(z) { - var maxlen = 0, - zlen = z.length, - i, - j; + var maxlen = 0; + var zlen = z.length; + var i, j; // Maximum row length: for(i = 0; i < zlen; i++) maxlen = Math.max(maxlen, z[i].length); @@ -215125,9 +217387,9 @@ exports.dot = function(x, y) { if(!(x.length && y.length) || x.length !== y.length) return null; - var len = x.length, - out, - i; + var len = x.length; + var out; + var i; if(x[0].length) { // mat-vec or mat-mat @@ -215192,12 +217454,12 @@ /***/ }), -/* 44 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215438,12 +217700,12 @@ /***/ }), -/* 45 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215507,12 +217769,12 @@ /***/ }), -/* 46 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215529,18 +217791,18 @@ */ exports.segmentsIntersect = segmentsIntersect; function segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { - var a = x2 - x1, - b = x3 - x1, - c = x4 - x3, - d = y2 - y1, - e = y3 - y1, - f = y4 - y3, - det = a * f - c * d; + var a = x2 - x1; + var b = x3 - x1; + var c = x4 - x3; + var d = y2 - y1; + var e = y3 - y1; + var f = y4 - y3; + var det = a * f - c * d; // parallel lines? intersection is undefined // ignore the case where they are colinear if(det === 0) return null; - var t = (b * f - c * e) / det, - u = (b * d - a * e) / det; + var t = (b * f - c * e) / det; + var u = (b * d - a * e) / det; // segments do not intersect? if(u < 0 || u > 1 || t < 0 || t > 1) return null; @@ -215558,15 +217820,15 @@ var y12 = y2 - y1; var x34 = x4 - x3; var y34 = y4 - y3; - var l2_12 = x12 * x12 + y12 * y12; - var l2_34 = x34 * x34 + y34 * y34; + var ll12 = x12 * x12 + y12 * y12; + var ll34 = x34 * x34 + y34 * y34; // calculate distance squared, then take the sqrt at the very end var dist2 = Math.min( - perpDistance2(x12, y12, l2_12, x3 - x1, y3 - y1), - perpDistance2(x12, y12, l2_12, x4 - x1, y4 - y1), - perpDistance2(x34, y34, l2_34, x1 - x3, y1 - y3), - perpDistance2(x34, y34, l2_34, x2 - x3, y2 - y3) + perpDistance2(x12, y12, ll12, x3 - x1, y3 - y1), + perpDistance2(x12, y12, ll12, x4 - x1, y4 - y1), + perpDistance2(x34, y34, ll34, x1 - x3, y1 - y3), + perpDistance2(x34, y34, ll34, x2 - x3, y2 - y3) ); return Math.sqrt(dist2); @@ -215576,15 +217838,15 @@ * distance squared from segment ab to point c * [xab, yab] is the vector b-a * [xac, yac] is the vector c-a - * l2_ab is the length squared of (b-a), just to simplify calculation + * llab is the length squared of (b-a), just to simplify calculation */ -function perpDistance2(xab, yab, l2_ab, xac, yac) { - var fc_ab = (xac * xab + yac * yab); - if(fc_ab < 0) { +function perpDistance2(xab, yab, llab, xac, yac) { + var fcAB = (xac * xab + yac * yab); + if(fcAB < 0) { // point c is closer to point a return xac * xac + yac * yac; } - else if(fc_ab > l2_ab) { + else if(fcAB > llab) { // point c is closer to point b var xbc = xac - xab; var ybc = yac - yab; @@ -215593,7 +217855,7 @@ else { // perpendicular distance is the shortest var crossProduct = xac * yab - yac * xab; - return crossProduct * crossProduct / l2_ab; + return crossProduct * crossProduct / llab; } } @@ -215758,12 +218020,12 @@ /***/ }), -/* 47 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215867,12 +218129,12 @@ /***/ }), -/* 48 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215910,12 +218172,12 @@ /***/ }), -/* 49 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215938,12 +218200,12 @@ /***/ }), -/* 50 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -215980,12 +218242,12 @@ /***/ }), -/* 51 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -216041,12 +218303,12 @@ /***/ }), -/* 52 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -216128,12 +218390,12 @@ /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -216166,9 +218428,9 @@ * @return {array} new filtered array */ module.exports = function filterUnique(array) { - var seen = {}, - out = [], - j = 0; + var seen = {}; + var out = []; + var j = 0; for(var i = 0; i < array.length; i++) { var item = array[i]; @@ -216184,12 +218446,12 @@ /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the @@ -216236,12 +218498,12 @@ /***/ }), -/* 55 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** -* Copyright 2012-2018, Plotly, Inc. +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the diff -Nru plotly-3.5.0+dfsg1/plotlywidget/static/index.js.map plotly-3.6.1+dfsg1/plotlywidget/static/index.js.map --- plotly-3.5.0+dfsg1/plotlywidget/static/index.js.map 2019-01-04 13:05:55.000000000 +0000 +++ plotly-3.6.1+dfsg1/plotlywidget/static/index.js.map 2019-02-08 23:45:43.000000000 +0000 @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap a26b7660c39c5b24119a","webpack:///./node_modules/fast-isnumeric/index.js","webpack:///./node_modules/plotly.js/src/lib/array.js","webpack:///./node_modules/plotly.js/src/lib/mod.js","webpack:///./node_modules/plotly.js/src/lib/is_plain_object.js","webpack:///./node_modules/plotly.js/src/lib/loggers.js","webpack:///./node_modules/d3/d3.js","webpack:///./node_modules/plotly.js/src/constants/numerical.js","webpack:///./node_modules/plotly.js/src/lib/nested_property.js","webpack:///./node_modules/plotly.js/src/lib/extend.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/tinycolor2/tinycolor.js","webpack:///./node_modules/plotly.js/src/plots/attributes.js","webpack:///./node_modules/plotly.js/src/plots/font_attributes.js","webpack:///./node_modules/plotly.js/src/components/colorscale/scales.js","webpack:///./node_modules/plotly.js/src/lib/regex.js","webpack:///./node_modules/plotly.js/src/registry.js","webpack:///./node_modules/plotly.js/src/lib/noop.js","webpack:///./node_modules/plotly.js/src/lib/push_unique.js","webpack:///./node_modules/plotly.js/src/lib/identity.js","webpack:///./package.json","webpack:///./src/index.js","webpack:///./src/Figure.js","webpack:///external \"@jupyter-widgets/base\"","webpack:///./node_modules/lodash/lodash.js","webpack:///(webpack)/buildin/module.js","webpack:///./node_modules/plotly.js/dist/plotly.js","webpack:///./node_modules/plotly.js/src/lib/index.js","webpack:///./node_modules/is-string-blank/index.js","webpack:///./node_modules/plotly.js/src/lib/keyed_container.js","webpack:///./node_modules/plotly.js/src/lib/relative_attr.js","webpack:///./node_modules/plotly.js/src/lib/to_log_range.js","webpack:///./node_modules/plotly.js/src/lib/relink_private.js","webpack:///./node_modules/plotly.js/src/lib/coerce.js","webpack:///./node_modules/plotly.js/src/components/fx/attributes.js","webpack:///./node_modules/plotly.js/src/constants/interactions.js","webpack:///./node_modules/plotly.js/src/lib/dates.js","webpack:///./node_modules/plotly.js/src/plot_api/plot_config.js","webpack:///./node_modules/plotly.js/src/plots/layout_attributes.js","webpack:///./node_modules/plotly.js/src/components/color/attributes.js","webpack:///./node_modules/plotly.js/src/components/colorscale/layout_attributes.js","webpack:///./node_modules/plotly.js/src/plots/pad_attributes.js","webpack:///./node_modules/plotly.js/src/lib/search.js","webpack:///./node_modules/plotly.js/src/lib/stats.js","webpack:///./node_modules/plotly.js/src/lib/matrix.js","webpack:///./node_modules/plotly.js/src/lib/angles.js","webpack:///./node_modules/plotly.js/src/lib/anchor_utils.js","webpack:///./node_modules/plotly.js/src/lib/geometry2d.js","webpack:///./node_modules/plotly.js/src/lib/throttle.js","webpack:///./node_modules/plotly.js/src/lib/get_graph_div.js","webpack:///./node_modules/plotly.js/src/lib/clear_responsive.js","webpack:///./node_modules/plotly.js/src/lib/make_trace_groups.js","webpack:///./node_modules/plotly.js/src/lib/localize.js","webpack:///./node_modules/plotly.js/src/lib/notifier.js","webpack:///./node_modules/plotly.js/src/lib/filter_unique.js","webpack:///./node_modules/plotly.js/src/lib/filter_visible.js","webpack:///./node_modules/plotly.js/src/lib/clean_number.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK,oBAAoB,cAAc,GAAG;AAC1C;;AAEA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;;;;;AC5JA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE;AACtE,KAAK;AACL,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,SAAS;AAC/F,4DAA4D,SAAS;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA,wEAAwE;AACxE,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,EAAE;AACpD,sBAAsB;AACtB;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA,OAAO;AACP,oBAAoB,UAAU;AAC9B;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C,4EAA4E,UAAU;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sCAAsC,OAAO;AAC7C,gEAAgE,OAAO;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C,wDAAwD,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,OAAO;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,wCAAwC;AAC9F;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iFAAiF;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,SAAS,gBAAgB;AACzB;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sEAAsE,6BAA6B;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO;AAChE;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,gEAAgE,QAAQ;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,6DAA6D,OAAO;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO;AACrD,WAAW;AACX;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2CAA2C,QAAQ;AACnD,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B,oEAAoE,OAAO;AAC3E;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,4CAA4C;AAC5C;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,+BAA+B,iCAAiC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,gCAAgC,QAAQ;AACxC,yBAAyB,8BAA8B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,OAAO;AACP,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,8BAA8B,8BAA8B;AAC5D;AACA,+CAA+C;AAC/C,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,6BAA6B;AAC7B,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,wBAAwB,OAAO;AAC/B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,eAAe,QAAQ;AACvB,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,8BAA8B;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,8BAA8B;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO,2DAA2D,iBAAiB,OAAO;AACnJ;AACA,yDAAyD,OAAO,2DAA2D,iBAAiB,OAAO;AACnJ;AACA,mDAAmD,OAAO,mDAAmD,iBAAiB,OAAO;AACrI;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA,iBAAiB,OAAO;AACxB,0BAA0B,OAAO;AACjC;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,iBAAiB,OAAO;AACxB,2BAA2B,OAAO;AAClC,uDAAuD,OAAO;AAC9D,0EAA0E,OAAO;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB,0BAA0B,OAAO;AACjC,0BAA0B,OAAO,yBAAyB,iBAAiB,OAAO;AAClF;AACA,iBAAiB,OAAO;AACxB;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,MAAM;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,gCAAgC,SAAS;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,oBAAoB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,8EAA8E,OAAO;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,8BAA8B,OAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM,qBAAqB,OAAO;AAClD;AACA,SAAS;AACT;AACA,gBAAgB,QAAQ,sBAAsB,OAAO;AACrD;AACA,mBAAmB,cAAc;AACjC,8BAA8B,kBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,qBAAqB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA,+CAA+C,SAAS;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA,wDAAwD,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA,wDAAwD,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb,WAAW;AACX,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,0BAA0B;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAAA;AAAA;AAAA;AAAA,qGAA2E,4EAA4E;AACvJ,CAAC,G;;;;;;;ACj1SD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO,KAAK,GAAG,KAAK;AACpC;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,uBAAuB,EAAE;AAClD,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;;;;;;;;ACpPA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,4CAA4C;AAC5C;AACA;;AAEA,kBAAkB,YAAY;AAC9B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;ACjHA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;ACpBA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,8BAA8B;AACpD,sBAAsB,8BAA8B;AACpD,sBAAsB,8BAA8B;;AAEpD;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,mBAAmB,OAAO;AACzD,+BAA+B,mBAAmB,OAAO;AACzD,+BAA+B,mBAAmB,OAAO;AACzD;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD,wCAAwC;AACxC,wCAAwC;AACxC;;AAEA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,sDAAsD;AACtD,wCAAwC;AACxC,wCAAwC;AACxC;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,yCAAyC;AAC5D,mBAAmB,yCAAyC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wCAAwC;AAC3D,mBAAmB,yCAAyC;AAC5D,mBAAmB,yCAAyC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uCAAuC;AAC1D,mBAAmB,wCAAwC;AAC3D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+DAA+D,WAAW;AAC1E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2DAA2D,wBAAwB;;AAEnF;AACA;AACA,2CAA2C,wBAAwB;AACnE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8EAA8E,4BAA4B,gBAAgB;AAC1H,8EAA8E,2BAA2B,gBAAgB;AACzH,qDAAqD,oDAAoD,gBAAgB;AACzH,qDAAqD,oDAAoD,gBAAgB;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA,oDAAoD,0BAA0B;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA,KAAK,kBAAkB,YAAY,kBAAkB;AACrD;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,4BAA4B,YAAY;;AAExC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE;AACjE,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE;AACjE,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE;AACjF,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE;AACjF;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,UAAU,OAAO,UAAU,OAAO,SAAS;AACnF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAwB,kBAAkB;AAAA;AAC1C;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;;;;;AC1qCD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;;;;;;;AChIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA,aAAa,cAAc;AAC3B;AACA,aAAa,OAAO;AACpB;AACA,aAAa,gBAAgB;AAC7B;AACA;AACA,YAAY,OAAO,+BAA+B,oBAAoB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,kBAAkB,gBAAgB;AAClC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;ACzMA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,iBAAiB;AAC5B;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iCAAiC;AAC5C;AACA;AACA;AACA,YAAY,OAAO;AACnB,kBAAkB,MAAM;AACxB;AACA,YAAY,OAAO;AACnB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA,YAAY,OAAO;AACnB,iBAAiB,SAAS;AAC1B,qBAAqB,SAAS;AAC9B,kBAAkB,OAAO;AACzB,sBAAsB,SAAS;AAC/B;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA,YAAY,OAAO;AACnB,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,YAAY,IAAI;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;ACvbA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;;;;;;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,IAAI;AACf;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,UAAU;;;;;;;ACbjD,kBAAkB,2KAA2K,yDAAyD,iHAAiH,oIAAoI,oBAAoB,4DAA4D,iBAAiB,yEAAyE,eAAe,qC;;;;;;ACApqB;AACA;AACA;;;;;;;ACFA;AACA;;AAEA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,eAAe;AACrC;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,eAAe;AACrC;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,eAAe;AACrC;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;;;AAGA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,8BAA8B;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,8BAA8B;AACpD;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,eAAe;AACrC;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;;;AAGA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,eAAe;AACrC;AACA,sBAAsB,eAAe;AACrC;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,QAAQ;AAC9B;AACA,sBAAsB,QAAQ;AAC9B;AACA,sBAAsB,QAAQ;AAC9B;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,eAAe;AACrC;AACA,sBAAsB,eAAe;AACrC;AACA;;AAEA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,eAAe;AACrC;AACA,sBAAsB,eAAe;AACrC;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,OAAO;AAC7B;AACA,sBAAsB,oCAAoC;AAC1D;;AAEA;AACA,qBAAqB,YAAY;AACjC,sBAAsB,OAAO;AAC7B;AACA;AACA,sBAAsB,YAAY;AAClC;AACA,sBAAsB,sBAAsB;AAC5C;AACA,sBAAsB,cAAc;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qCAAqC;AACpD,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,qBAAqB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,eAAe;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,gBAAgB;AACnC;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,mBAAmB,0BAA0B;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA,gBAAgB;AAChB,wCAAwC;AACxC,kBAAkB;AAClB,wCAAwC;AACxC,2BAA2B;AAC3B,wCAAwC;AACxC,8BAA8B;AAC9B,wCAAwC;AACxC,4BAA4B;AAC5B,wCAAwC;AACxC,yBAAyB;AACzB,wCAAwC;AACxC,0BAA0B;AAC1B,wCAAwC;AACxC,wBAAwB;AACxB,wCAAwC;AACxC,yBAAyB;AACzB,wCAAwC;AACxC,mCAAmC;AACnC,wCAAwC;AACxC,kCAAkC;AAClC,wCAAwC;AACxC,yBAAyB;AACzB,wCAAwC;AACxC,0BAA0B;AAC1B,wCAAwC;AACxC,wBAAwB;AACxB,wCAAwC;AACxC,6BAA6B;AAC7B,wCAAwC;AACxC,6BAA6B;AAC7B,wCAAwC;AACxC,gCAAgC;AAChC;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC,MAAM,kBAAkB;AACxD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA,qBAAqB,YAAY,2CAA2C;;AAE5E;AACA;AACA,aAAa;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,+BAA+B,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,eAAe;AAC1C;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,iDAAiD;;;AAGjD;AACA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,qBAAqB;AACxC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,eAAe;AAClC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,gBAAgB;AACnC;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;;AAEA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,uBAAuB,cAAc;AACrC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,cAAc;AACrC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,iBAAiB,KAAK;AACtB,gCAAgC,kBAAkB;AAClD,cAAc,MAAM;AACpB;AACA,iBAAiB,KAAK;AACtB,gCAAgC,UAAU;AAC1C,cAAc,MAAM,aAAa;AACjC;AACA,iBAAiB,MAAM;AACvB,gCAAgC,iBAAiB;AACjD,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,OAAO;AAClB;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA,kBAAkB,MAAM,QAAQ,IAAI,IAAI;AACxC,+BAA+B,aAAa;AAC5C,eAAe,MAAM,QAAQ,IAAI,IAAI;AACrC;AACA,kBAAkB,MAAM,QAAQ,IAAI,IAAI;AACxC,+BAA+B,aAAa;AAC5C,eAAe,MAAM,QAAQ,GAAG,MAAM,QAAQ,GAAG,MAAM,QAAQ;AAC/D;AACA,kBAAkB,MAAM,QAAQ,IAAI,IAAI;AACxC,+BAA+B,qBAAqB;AACpD,eAAe,MAAM,QAAQ,GAAG,MAAM,QAAQ,GAAG,MAAM,QAAQ;AAC/D;AACA;AACA;AACA;AACA;AACA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,0BAA0B;;AAEjD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO,GAAG,OAAO,GAAG,OAAO;AAC7C;AACA,eAAe,OAAO,GAAG,OAAO,GAAG,OAAO;AAC1C;AACA,kBAAkB,OAAO,GAAG,OAAO,GAAG,OAAO;AAC7C;AACA,eAAe,OAAO,GAAG,OAAO,GAAG,OAAO;AAC1C;AACA;;AAEA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,8BAA8B;AACzC;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO,OAAO,GAAG,OAAO;AACzC;AACA,cAAc,OAAO,OAAO,GAAG,OAAO;AACtC;AACA,iBAAiB,OAAO,OAAO,GAAG,OAAO;AACzC;AACA,cAAc,OAAO,OAAO,IAAI;AAChC;AACA;AACA;;AAEA,gBAAgB,qBAAqB;AACrC;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA,qBAAqB,OAAO,OAAO,GAAG,OAAO;AAC7C,uBAAuB;AACvB;AACA,gBAAgB,OAAO,OAAO,GAAG,OAAO;AACxC;AACA,qBAAqB,OAAO,OAAO,GAAG,OAAO;AAC7C,uBAAuB;AACvB;AACA,gBAAgB,OAAO,OAAO,GAAG,OAAO;AACxC;AACA,qBAAqB,OAAO,OAAO,GAAG,OAAO;AAC7C,uBAAuB,OAAO,OAAO,GAAG,OAAO;AAC/C;AACA,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2CAA2C,oBAAoB;AAC/D;AACA;;AAEA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,0DAA0D;;AAE1D,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;AC1wDA,gD;;;;;;sDCAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C;AAC3C;AACA,2DAA2D;;AAE3D;AACA,+CAA+C;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB,yBAAyB;AACzB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,MAAM,aAAa,OAAO;;AAEpD;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2CAA2C,GAAG;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf,cAAc;AACd,cAAc;AACd,gBAAgB;AAChB,eAAe;AACf;;AAEA;AACA;AACA,UAAU;AACV,SAAS;AACT,SAAS;AACT,WAAW;AACX,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,EAAE;AACf,aAAa,MAAM;AACnB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,eAAe,SAAS;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,MAAM;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,aAAa,SAAS;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,EAAE;AACf,aAAa,QAAQ;AACrB;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,EAAE;AACf,aAAa,QAAQ;AACrB;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,aAAa;AAC1B,aAAa,SAAS;AACtB,aAAa,EAAE;AACf,aAAa,QAAQ;AACrB;AACA,aAAa,SAAS;AACtB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,MAAM;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,SAAS;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,MAAM;AACnB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,MAAM;AACnB,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,EAAE;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,SAAS;AACtB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,EAAE;AACf,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,eAAe,SAAS;AACxB;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA,mBAAmB,gCAAgC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,6BAA6B;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,QAAQ;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,QAAQ;AACvB;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA,oCAAoC,6BAA6B,EAAE;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,aAAa;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,aAAa;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,EAAE;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,eAAe,QAAQ;AACvB;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,6BAA6B;AAC5C,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,gBAAgB;AAChB,OAAO;;AAEP;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,mBAAmB;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,gBAAgB,QAAQ;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,gBAAgB,QAAQ;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,eAAe,OAAO,WAAW;AACjC,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO,WAAW;AACjC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO,WAAW;AACjC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,+CAA+C;AACpF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,eAAe,MAAM;AACrB;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,oEAAoE;AACpE;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,eAAe,MAAM;AACrB;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,eAAe,MAAM;AACrB;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C;AAC1C,wCAAwC;AACxC,+DAA+D;AAC/D,iEAAiE;AACjE;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,KAAK;AACpB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,SAAS,GAAG,SAAS,KAAK,SAAS;AAC3D,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,uBAAuB,iBAAiB,GAAG,iBAAiB;AAC5D;AACA,mCAAmC,iBAAiB;AACpD,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,oCAAoC;AAC9C,UAAU,qCAAqC;AAC/C,UAAU;AACV;AACA;AACA,4CAA4C,kBAAkB,EAAE;AAChE;AACA;AACA;AACA,gCAAgC,qCAAqC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,qCAAqC;AAC/C,UAAU,qCAAqC;AAC/C,UAAU;AACV;AACA;AACA,uCAAuC,kBAAkB,EAAE;AAC3D;AACA;AACA;AACA,2BAA2B,oCAAoC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,UAAU,qCAAqC;AAC/C,UAAU,qCAAqC;AAC/C,UAAU;AACV;AACA;AACA,uCAAuC,2BAA2B,EAAE;AACpE;AACA;AACA;AACA,2BAA2B,kCAAkC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,UAAU,oCAAoC;AAC9C,UAAU,qCAAqC;AAC/C,UAAU;AACV;AACA;AACA,2CAA2C,4BAA4B,EAAE;AACzE;AACA;AACA;AACA,+BAA+B,mCAAmC;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS,KAAK,SAAS,GAAG,SAAS;AAC7D,eAAe,SAAS;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,uBAAuB,iBAAiB,GAAG,iBAAiB;AAC5D,sBAAsB,iBAAiB,GAAG,iBAAiB;AAC3D;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,KAAK;AACpB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,qBAAqB,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AAClE;AACA,4BAA4B,SAAS,GAAG,SAAS;AACjD;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,qBAAqB,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB;AAC9E;AACA,8BAA8B,iBAAiB;AAC/C;AACA,eAAe,iBAAiB,GAAG,iBAAiB;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,qBAAqB;AACpC,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C;AACA,iCAAiC,SAAS,eAAe,YAAY,EAAE;AACvE;AACA;AACA;AACA,iCAAiC,SAAS;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C;AACA,qCAAqC,SAAS,eAAe,YAAY,EAAE;AAC3E;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,oCAAoC;AAC9C,UAAU,qCAAqC;AAC/C,UAAU;AACV;AACA;AACA,4CAA4C,kBAAkB,EAAE;AAChE;AACA;AACA;AACA,gCAAgC,qCAAqC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,qCAAqC;AAC/C,UAAU,qCAAqC;AAC/C,UAAU;AACV;AACA;AACA,uCAAuC,kBAAkB,EAAE;AAC3D;AACA;AACA;AACA,2BAA2B,oCAAoC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS,KAAK,SAAS,GAAG,SAAS;AACtD,eAAe,SAAS,GAAG,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,uBAAuB,iBAAiB,GAAG,iBAAiB;AAC5D,sBAAsB,iBAAiB,GAAG,iBAAiB;AAC3D;AACA;AACA,eAAe,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB;AACxE;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS,GAAG,SAAS,GAAG,SAAS;AACnD,eAAe,SAAS,GAAG,SAAS;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,uBAAuB,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB;AAChF;AACA;AACA,eAAe,iBAAiB,GAAG,iBAAiB;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,KAAK;AACpB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS,KAAK,SAAS,GAAG,SAAS;AACpD,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA,uBAAuB,iBAAiB,GAAG,iBAAiB;AAC5D,sBAAsB,iBAAiB,GAAG,iBAAiB;AAC3D;AACA;AACA,eAAe,iBAAiB,GAAG,iBAAiB;AACpD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,cAAc,OAAO,QAAQ,SAAS,GAAG,SAAS,GAAG;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,UAAU,+BAA+B;AACzC,UAAU,+BAA+B;AACzC,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB,QAAQ,OAAO,SAAS,EAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,8BAA8B;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,UAAU,8BAA8B;AACxC,UAAU;AACV;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,cAAc;AACd;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,gBAAgB,OAAO;AACvB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,+CAA+C;AACzD,UAAU;AACV;AACA;AACA;AACA,uBAAuB,oCAAoC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,UAAU,8CAA8C;AACxD,UAAU;AACV;AACA;AACA,oCAAoC,kBAAkB,EAAE;AACxD;AACA;AACA;AACA,wBAAwB,4BAA4B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA,UAAU,+CAA+C;AACzD,UAAU,gDAAgD;AAC1D,UAAU;AACV;AACA;AACA,kCAAkC,mBAAmB,EAAE;AACvD;AACA;AACA;AACA,sBAAsB,2BAA2B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oBAAoB;AACnC,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,sBAAsB;AACrC;AACA,eAAe,KAAK;AACpB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,UAAU,4BAA4B;AACtC,UAAU;AACV;AACA;AACA;AACA;AACA,QAAQ;AACR,cAAc,OAAO,4BAA4B,QAAQ,8BAA8B;AACvF;AACA;AACA,cAAc,UAAU,4BAA4B,YAAY,8BAA8B;AAC9F;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA,UAAU,mBAAmB;AAC7B,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,qCAAqC;AACpD;AACA,eAAe,SAAS;AACxB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,8BAA8B;AACxC,UAAU,8BAA8B;AACxC,UAAU,8BAA8B;AACxC,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,gDAAgD;AAC1D,UAAU,+CAA+C;AACzD,UAAU;AACV;AACA;AACA,uCAAuC,iBAAiB,EAAE;AAC1D;AACA;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,cAAc,iBAAiB,EAAE;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA,QAAQ,IAAI;AACZ,cAAc,8BAA8B;AAC5C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,UAAU,+CAA+C;AACzD,UAAU;AACV;AACA;AACA,oCAAoC,kBAAkB,EAAE;AACxD;AACA;AACA;AACA,wBAAwB,4BAA4B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oBAAoB;AACnC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,gBAAgB,OAAO;AACvB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,mCAAmC;AAC7C,UAAU;AACV;AACA;AACA;AACA,sBAAsB,oCAAoC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,yBAAyB;AACxC;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,UAAU,8BAA8B;AACxC,UAAU,8BAA8B;AACxC,UAAU,8BAA8B;AACxC,UAAU;AACV;AACA;AACA,qCAAqC,eAAe,EAAE;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,oBAAoB,iCAAiC;AACrD,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,eAAe,KAAK;AACpB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,KAAK;AACpB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO,YAAY;AAClC,eAAe,QAAQ;AACvB;AACA,eAAe,OAAO;AACtB;AACA,eAAe,QAAQ;AACvB;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,kDAAkD,kBAAkB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,KAAK;AACpB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA,qBAAqB;AACrB,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,yBAAyB;AACxC;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,qBAAqB;AACpC,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO,YAAY;AAClC,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,oBAAoB;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA,qBAAqB;AACrB;AACA,6BAA6B,mBAAmB,cAAc,EAAE,EAAE;AAClE;AACA;AACA,6BAA6B,mBAAmB,cAAc,EAAE,EAAE;AAClE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA,qBAAqB;AACrB,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,iCAAiC,kBAAkB,EAAE;AACrD;AACA;AACA;AACA;AACA;AACA,kDAAkD,kBAAkB,EAAE;AACtE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA,qBAAqB;AACrB,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA,qBAAqB;AACrB;AACA,0BAA0B,SAAS;AACnC;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,MAAM;AACvB;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B,cAAc;AACd;AACA,iBAAiB,SAAS;AAC1B,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,cAAc;AACd;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS,GAAG,SAAS,GAAG,SAAS;AAClD,cAAc;AACd;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS,GAAG,SAAS,GAAG,SAAS;AAClD,cAAc;AACd;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,qBAAqB;AACpC,iBAAiB,MAAM;AACvB;AACA;AACA,qBAAqB,QAAQ,OAAO,SAAS,EAAE;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,mBAAmB,SAAS,GAAG,SAAS,GAAG,SAAS;AACpD,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,uBAAuB,OAAO,SAAS,EAAE,GAAG,OAAO,iBAAiB,EAAE;AACtE,cAAc,OAAO,iBAAiB;AACtC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA,qBAAqB,4BAA4B;AACjD,qBAAqB,6BAA6B;AAClD,qBAAqB;AACrB;AACA;AACA,qCAAqC,mBAAmB,EAAE;AAC1D;AACA;AACA;AACA,yBAAyB,2BAA2B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA,qBAAqB,4BAA4B;AACjD,qBAAqB,6BAA6B;AAClD,qBAAqB;AACrB;AACA;AACA,yCAAyC,mBAAmB,EAAE;AAC9D;AACA;AACA;AACA,6BAA6B,4BAA4B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA,qBAAqB,QAAQ,OAAO,SAAS,EAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA,qBAAqB,OAAO,SAAS;AACrC,6BAA6B,gBAAgB,SAAS,GAAG;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA,8BAA8B,gBAAgB,SAAS,GAAG;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,QAAQ;AACR,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,KAAK;AACpB,iBAAiB,EAAE;AACnB;AACA;AACA,qBAAqB,QAAQ,OAAO,oBAAoB,EAAE;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA,QAAQ;AACR,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,qBAAqB,+BAA+B;AACpD,qBAAqB;AACrB;AACA;AACA,uCAAuC,cAAc,EAAE;AACvD,cAAc,2BAA2B;AACzC;AACA;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,gBAAgB,SAAS,GAAG,SAAS;AACrC;AACA;AACA;AACA,gBAAgB,SAAS,GAAG,SAAS;AACrC;AACA;AACA;AACA,cAAc,QAAQ,iBAAiB,GAAG,iBAAiB;AAC3D;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,UAAU;AACzB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,oBAAoB;AACpB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,KAAK;;AAEL;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,qBAAqB;AACpC,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,qBAAqB;AACpC,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,cAAc;AACd;AACA;AACA,gCAAgC;AAChC,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA,qBAAqB,QAAQ,OAAO,+BAA+B,EAAE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,EAAE;AACjB,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB,QAAQ,OAAO,SAAS,EAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,EAAE;AACjB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO,WAAW;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,oBAAoB,yBAAyB;AAC7C;AACA,QAAQ,IAAI;AACZ,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA,qBAAqB,QAAQ,OAAO,SAAS,EAAE;AAC/C;AACA;AACA;AACA;AACA,cAAc,QAAQ,QAAQ,EAAE;AAChC;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ,QAAQ,EAAE;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA,qBAAqB,QAAQ,OAAO,SAAS,EAAE;AAC/C;AACA,iDAAiD,cAAc,EAAE;AACjE;AACA;AACA;AACA,iDAAiD,sBAAsB,EAAE;AACzE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO,WAAW;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC,KAAK;AACvC;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,cAAc;AAC7B,eAAe,gBAAgB;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO,YAAY;AAClC,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB;AACA,eAAe,OAAO;AACtB;AACA,gBAAgB,OAAO;AACvB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC,qBAAqB,UAAU;AAC/B;AACA;AACA,sEAAsE,2BAA2B,EAAE;AACnG,iBAAiB,8BAA8B;AAC/C;AACA;AACA;AACA,4DAA4D;AAC5D,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD,iBAAiB,oBAAoB;AACrC;AACA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA,qDAAqD,2BAA2B,EAAE;AAClF,wCAAwC,aAAa,eAAe,EAAE;AACtE,iBAAiB,8BAA8B;AAC/C;AACA;AACA;AACA,wDAAwD,qCAAqC;AAC7F;AACA;AACA;AACA;AACA,0DAA0D,qBAAqB;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,YAAY;AACvD,0CAA0C,QAAQ;AAClD,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B;;AAE/B,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD;AACA;AACA;AACA;AACA,4CAA4C;;AAE5C;AACA,uDAAuD;AACvD;AACA;AACA,6BAA6B,EAAE;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C,+BAA+B,iCAAiC;AAChE,cAAc;AACd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO,YAAY;AAClC,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,cAAc;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC,aAAa,QAAQ,QAAQ,UAAU,aAAa;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,cAAc;AAC7B,gBAAgB,OAAO;AACvB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,qBAAqB;AACpC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,UAAU,iBAAiB;AAC3B,UAAU;AACV;AACA;AACA,qCAAqC,mBAAmB,cAAc,EAAE,EAAE;AAC1E,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA,4CAA4C,SAAS;AACrD;AACA;AACA,eAAe,SAAS,GAAG,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,EAAE;AACnB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,UAAU,8CAA8C;AACxD,UAAU;AACV;AACA;AACA;AACA,mCAAmC,mCAAmC;AACtE,eAAe,8CAA8C;AAC7D;AACA;AACA;AACA,eAAe,4BAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,UAAU,yBAAyB;AACnC,UAAU;AACV;AACA;AACA,oCAAoC,iBAAiB;AACrD,eAAe,yBAAyB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,EAAE;AACjB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,UAAU,yBAAyB;AACnC,UAAU;AACV;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,KAAK;AACpB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,UAAU,OAAO,qBAAqB,EAAE;AACxC,UAAU,OAAO,qBAAqB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,KAAK;AACpB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,OAAO;AACtB,eAAe,OAAO,YAAY;AAClC,eAAe,QAAQ;AACvB,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAmB,GAAG,iBAAiB;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,qDAAqD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,UAAU,OAAO,SAAS,EAAE;AAC5B,UAAU,OAAO,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAI;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C;AACA,qCAAqC,YAAY,EAAE;AACnD,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AACpE;AACA,sCAAsC,YAAY,EAAE;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,EAAE;AACnB;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C;AACA,qCAAqC,YAAY,EAAE;AACnD,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AACpE;AACA,qCAAqC,YAAY,EAAE;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK,MAAM,iBAAiB;;AAE5B;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,4DAA4D;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,yCAAyC;AAC7D;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AAAA;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;;;;ACxshBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;;;;;;0DCrBA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAA2D,mBAAmB,gDAAgD,aAAa,KAAK,MAAM,gCAAgC,SAAS,qCAAqC,SAAS,mCAAmC,OAAO,KAAK,OAAO,gBAAgB,aAAa,0BAA0B,mBAAmB,kBAAkB,gBAAgB,UAAU,UAAU,0CAA0C,8BAAwB,oBAAoB,8CAA8C,kCAAkC,YAAY,YAAY,mCAAmC,iBAAiB,eAAe,sBAAsB,oBAAoB,kDAAkD,WAAW,YAAY,SAAS,SAAS,KAAK;AAC3zB;;AAEA;AACA;AACA,8BAA8B,oDAAoD,SAAS,UAAU;AACrG,6EAA6E;AAC7E,kDAAkD;AAClD,iCAAiC;AACjC,uCAAuC;AACvC,4CAA4C;AAC5C,qDAAqD,sBAAsB,qBAAqB,oBAAoB,iBAAiB;AACrI,8BAA8B;AAC9B,6BAA6B;AAC7B,mCAAmC;AACnC,sCAAsC,MAAM,OAAO,oBAAoB;AACvE,kDAAkD;AAClD,yCAAyC;AACzC,yCAAyC;AACzC,6CAA6C;AAC7C,mCAAmC;AACnC,+CAA+C;AAC/C,+CAA+C;AAC/C,6CAA6C;AAC7C,6CAA6C;AAC7C,6CAA6C;AAC7C,2CAA2C;AAC3C,6CAA6C;AAC7C,2CAA2C;AAC3C,2CAA2C;AAC3C,6CAA6C;AAC7C,2CAA2C;AAC3C,6CAA6C;AAC7C,2CAA2C,YAAY;AACvD,qCAAqC,QAAQ,UAAU,aAAa;AACpE,qDAAqD,wCAAwC,qCAAqC,oCAAoC,mCAAmC,gCAAgC;AACzO,yDAAyD;AACzD,oCAAoC,qBAAqB,sBAAsB,gBAAgB,kBAAkB,sBAAsB,mBAAmB;AAC1J,yCAAyC,eAAe,gBAAgB,YAAY,eAAe,mBAAmB,sBAAsB;AAC5I,6CAA6C,QAAQ;AACrD,yCAAyC,sBAAsB,eAAe,uBAAuB,gBAAgB;AACrH,yCAAyC;AACzC,yDAAyD,WAAW,gBAAgB,kBAAkB;AACtG,sEAAsE,kBAAkB;AACxF,qEAAqE,uCAAuC,oCAAoC,mCAAmC,kCAAkC,+BAA+B,aAAa,UAAU,aAAa,oBAAoB,SAAS,UAAU;AAC/T,6EAA6E,UAAU;AACvF,yCAAyC,kBAAkB,uBAAuB,6BAA6B,aAAa,iBAAiB,4BAA4B,kBAAkB;AAC3L,sDAAsD,mBAAmB,YAAY,iBAAiB,eAAe,iBAAiB,mBAAmB,mBAAmB,kBAAkB;AAC9L,8EAA8E,WAAW;AACzF,qEAAqE,0BAA0B,eAAe,mBAAmB;AACjI,oCAAoC,eAAe,2BAA2B;AAC9E,yCAAyC;AACzC,yCAAyC,yBAAyB;AAClE,gCAAgC,eAAe,SAAS,WAAW,cAAc,eAAe,gBAAgB;AAChH,qBAAqB;AACrB,yCAAyC,gBAAgB,sBAAsB,aAAa,SAAS,yBAAyB,uCAAuC,WAAW,aAAa,yBAAyB,qBAAqB,iBAAiB,qBAAqB,aAAa;AAC9R,qCAAqC,YAAY,YAAY,cAAc,gBAAgB,YAAY,eAAe,iBAAiB,iBAAiB;AACxJ,2CAA2C,qBAAqB,eAAe;AAC/E;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,uGAAuG,eAAe,SAAS,eAAe,SAAS,YAAY;AACnK;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,2BAA2B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,4BAA4B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,iCAAiC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,4BAA4B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,moBAAmoB;AACtoB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,2BAA2B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,4BAA4B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,2BAA2B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,2BAA2B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,4BAA4B;AAC/B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;;AAEH,wCAAwC;AACxC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG,gBAAgB,eAAe;;AAElC;AACA;AACA;;AAEA;AACA,GAAG,gBAAgB,eAAe;;AAElC;AACA;AACA;;AAEA;AACA,GAAG,gBAAgB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,CAAC,EAAE,oHAAoH;AACvH;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,0CAA0C,YAAY,YAAY,KAAK,yCAAyC;AAChH;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC,EAAE,+FAA+F;AAClG;AACA;AACA;AACA;AACA,sCAAsC;AACtC,CAAC,+DAA+D;;AAEhE;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,6BAA6B;;AAE7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,mBAAmB,EAAE;AAC5E;AACA,QAAQ;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,0BAA0B,YAAY,EAAE;AACxC;AACA;AACA,0BAA0B,iBAAiB,EAAE;;AAE7C;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;;AAEP;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;;AAEP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;;AAEP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,EAAE,wDAAwD;AAC3D;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,4CAA4C;;AAE/C;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,CAAC,EAAE,eAAe;AAClB;;AAEA;;AAEA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA,cAAc,kBAAkB;AAChC,4BAA4B,MAAM;AAClC;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,yBAAyB;AAC5B;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC,EAAE,8CAA8C;AACjD;;AAEA;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,qDAAqD;AACxD;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,qBAAqB,cAAc;AACnC;;AAEA,QAAQ,OAAO;AACf;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,qBAAqB,cAAc;AACnC;;AAEA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kBAAkB;;AAErB;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,8BAA8B;AAC9B;AACA,mDAAmD;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,gDAAgD;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA,yBAAyB;AACzB;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gCAAgC,oBAAoB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,qIAAqI;AACtI,CAAC,EAAE,WAAW;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,uBAAuB,SAAS;AAChC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C,KAAK;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA,WAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,yJAAyJ;AAC1J,CAAC,EAAE,qDAAqD;AACxD;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA,CAAC,EAAE,0BAA0B;AAC7B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2GAA2G;AAC9G;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,WAAW;AACd;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,eAAe;AAClB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,WAAW;AACd;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,WAAW;AACd;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mBAAmB;AACtB;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;AACA,+DAA+D;AAC/D;AACA,EAAE,YAAY;AACd;AACA;AACA;AACA,kBAAkB,UAAU,SAAS,cAAc;AACnD,KAAK;AACL,kBAAkB,aAAa,UAAU,SAAS,cAAc;AAChE;AACA,GAAG;AACH,gBAAgB,oBAAoB,IAAI;AACxC;AACA;AACA,qBAAqB,KAAK,MAAM;AAChC,GAAG;AACH,qBAAqB,KAAK,MAAM;AAChC;AACA,cAAc;AACd;AACA,0BAA0B;AAC1B,GAAG;AACH,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD,YAAY;AACZ,2BAA2B;AAC3B;AACA,CAAC,KAAK;AACN;AACA,EAAE,KAAK;AACP,2BAA2B;AAC3B;AACA,CAAC,KAAK;AACN;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B,cAAc;AAC1C,4BAA4B,cAAc;AAC1C,4BAA4B,cAAc;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc,OAAO;AACrB;AACA,kBAAkB,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,wBAAwB,OAAO;AAC/B;AACA;;AAEA;AACA;;AAEA;AACA;AACA,mBAAmB,WAAW;AAC9B,uBAAuB,YAAY;AACnC;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA,eAAe,YAAY;AAC3B,mBAAmB,WAAW;AAC9B;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;;AAEA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,OAAO;AACP;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,OAAO;AACP;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sCAAsC,sBAAsB;AAC5D;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,SAAS;AAChC;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;;AAEA,iBAAiB,aAAa;AAC9B;AACA;;AAEA;AACA;AACA,KAAK;AACL,iBAAiB,aAAa;AAC9B;AACA;;AAEA;AACA;;AAEA,YAAY,eAAe;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB,gBAAgB;AACrC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,gBAAgB;AACnC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,mBAAmB,cAAc;AACjC;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,mBAAmB,cAAc;AACjC;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACA,UAAU,6BAA6B;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,YAAY,cAAc;AAC1B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACA,UAAU,6BAA6B;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,cAAc;AAC1B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA,oDAAoD,WAAW;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,WAAW;AAC/D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB,OAAO;AAC1B;;AAEA;AACA;;AAEA,qBAAqB,OAAO;AAC5B;AACA;;AAEA,uBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,GAAG;AAC1B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mBAAmB,WAAW;AAC9B;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,WAAW;AAC9B;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;;AAEA,kCAAkC;AAClC,sCAAsC;AACtC;;AAEA;AACA,qBAAqB,OAAO;AAC5B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;;AAEA;AACA,6BAA6B,cAAc;AAC3C;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,QAAQ;AACvC;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,6BAA6B,mCAAmC;AAChE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,+CAA+C;AAClE;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,qBAAqB,sCAAsC;AAC3D;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,yBAAyB;AACnC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,cAAc;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,QAAQ;AAC/B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iCAAiC,QAAQ;AACzC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,6BAA6B,mCAAmC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,6BAA6B,mCAAmC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,6BAA6B,mCAAmC;AAChE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B,mCAAmC;AAChE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,0BAA0B;AACjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,gCAAgC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC,QAAQ;AACzC;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,oBAAoB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,QAAQ;AACpC;AACA,6BAA6B,QAAQ;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,YAAY;AACf;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,KAAK;AACnC;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,4DAA4D;AAC/D;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,0DAA0D;AAC1D,2CAA2C;;AAE3C;AACA,qFAAqF;AACrF,0BAA0B;AAC1B,iDAAiD;AACjD;AACA;AACA,qCAAqC;;AAErC;AACA,wFAAwF;AACxF,4BAA4B;AAC5B,kDAAkD;AAClD;AACA;AACA,sCAAsC;;AAEtC;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,wCAAwC;AACxC,GAAG;AACH,yCAAyC;AACzC,GAAG;AACH,wCAAwC;AACxC;;AAEA,kCAAkC,gBAAgB,KAAK;AACvD;AACA;AACA;AACA,yDAAyD;AACzD,qDAAqD;AACrD;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA,eAAe,oDAAoD;;AAEnE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;;AAE/D;AACA;AACA;AACA,4DAA4D;AAC5D;;AAEA;AACA,qDAAqD;;AAErD;AACA;AACA,gBAAgB,KAAK;AACrB;AACA,GAAG;AACH,gCAAgC;AAChC;AACA,gBAAgB,KAAK;AACrB;AACA,iBAAiB,KAAK,iBAAiB;AACvC;AACA,gBAAgB,KAAK;AACrB;AACA,gBAAgB;AAChB;AACA,eAAe;;AAEf;AACA;AACA;AACA;;;AAGA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,+CAA+C,UAAU;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,+CAA+C,UAAU;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,gGAAgG;AACnG;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA,oC;AACA,uC;AACA;AACA;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;;AAEA,sDAAsD,IAAI,UAAU,MAAM,wBAAwB,KAAK,YAAY,IAAI,KAAK,aAAa,qBAAqB,WAAW,oBAAoB;;AAE7L;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,UAAU;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,qBAAqB,UAAU;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,qBAAqB,UAAU;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,aAAa;AACjC;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,KAAK;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,qBAAqB,UAAU;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,aAAa;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,KAAK;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,4BAA4B,MAAM;AAClC;AACA,wBAAwB,aAAa;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,mDAAmD;;AAEtD,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,4DAA4D,WAAW;AACvE;AACA,CAAC,cAAc;AACf;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,oDAAoD,YAAY;AACrF;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA,GAAG;AACH;AACA;AACA;;AAEA,CAAC,EAAE,mFAAmF;AACtF;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA,gBAAgB,eAAe;AAC/B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,MAAM;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,aAAa;AACpD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mDAAmD;AACtD;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,6BAA6B,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,KAAK;AACnC;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,KAAK;AACnC;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;;AAEA;AACA;AACA,+DAA+D;AAC/D;AACA,MAAM,YAAY;AAClB;AACA;AACA,kBAAkB,UAAU,SAAS,cAAc;AACnD,KAAK;AACL,kBAAkB,aAAa,UAAU,SAAS,cAAc;AAChE;AACA,GAAG;AACH,gBAAgB,oBAAoB,IAAI;AACxC;AACA;AACA,qBAAqB,KAAK,MAAM;AAChC,GAAG;AACH,qBAAqB,KAAK,MAAM;AAChC;AACA,cAAc;AACd;AACA,0BAA0B;AAC1B,GAAG;AACH,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAiD;AACjD,2BAA2B;AAC3B;AACA,CAAC,KAAK;AACN;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B,gBAAgB,KAAK;AACrB;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,mBAAmB;AACtB;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,aAAa,sBAAsB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,gCAAgC,QAAQ;AACxC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,iBAAiB,eAAe;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,eAAe;AAChC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA,iBAAiB,eAAe;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,mLAAmL;AACtL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,4HAA4H;AAC/H;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,yCAAyC;AAC5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,qIAAqI;AACtI,CAAC,EAAE,kDAAkD;AACrD;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,oDAAoD;AACvD;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA,SAAS,0BAA0B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,0BAA0B;;AAEpM,SAAS,0BAA0B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,0BAA0B;;AAE1W,SAAS,wBAAwB,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,8BAA8B;;AAE/H,UAAU,4BAA4B,EAAE,4BAA4B;;AAEpE,YAAY,4BAA4B,EAAE,4BAA4B;;AAEtE,YAAY,4BAA4B,EAAE,8BAA8B;;AAExE,YAAY,0BAA0B,EAAE,4BAA4B;;AAEpE,YAAY,0BAA0B,EAAE,4BAA4B;;AAEpE,UAAU,wBAAwB,EAAE,gCAAgC,EAAE,kCAAkC,EAAE,8BAA8B;;AAExI,YAAY,wBAAwB,EAAE,kCAAkC,EAAE,8BAA8B;;AAExG,WAAW,wBAAwB,EAAE,8BAA8B;;AAEnE,YAAY,0BAA0B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,+BAA+B,EAAE,kCAAkC,EAAE,iCAAiC,EAAE,kCAAkC,EAAE,8BAA8B;;AAExT,YAAY,0BAA0B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,kCAAkC,EAAE,iCAAiC,EAAE,kCAAkC,EAAE,8BAA8B;;AAEvT,YAAY,2BAA2B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,kCAAkC,EAAE,8BAA8B;;AAEtT,aAAa,0BAA0B,EAAE,0BAA0B;;AAEnE,UAAU,2BAA2B,EAAE,iCAAiC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,4BAA4B;;AAE3M,YAAY,0BAA0B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,0BAA0B;;AAEnX,aAAa,2BAA2B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,0BAA0B;;AAE5S,cAAc,4BAA4B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,4BAA4B;;AAE7K,eAAe,wBAAwB,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,8BAA8B;;AAEvK,WAAW,0BAA0B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,8BAA8B;;AAEtM,cAAc,wBAAwB,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,8BAA8B;;AAErM,YAAY,kCAAkC,EAAE,kCAAkC;;AAElF,cAAc,0BAA0B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,6BAA6B;;AAEjT,cAAc,wBAAwB,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,8BAA8B;;AAE9S,YAAY,wBAAwB,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,8BAA8B;;AAE/S,aAAa,2BAA2B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,6BAA6B;;AAEjT,WAAW,4BAA4B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,4BAA4B;;AAE3S,WAAW,4BAA4B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,4BAA4B;;AAE1S,mBAAmB,4BAA4B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,4BAA4B;;AAE9W,iBAAiB,2BAA2B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAExT,WAAW,2BAA2B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAEhT,kBAAkB,2BAA2B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAErT,cAAc,2BAA2B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAExT,uBAAuB,2BAA2B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAE/T,sBAAsB,0BAA0B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAE5T,aAAa,yBAAyB,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,8BAA8B;;AAE5S,UAAU,2BAA2B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,6BAA6B;;AAE5S,YAAY,6BAA6B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,6BAA6B;;AAEnT,eAAe,4BAA4B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAExT,kBAAkB,0BAA0B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,6BAA6B;;AAEvT,gBAAgB,2BAA2B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,8BAA8B;;AAEpT,oBAAoB,2BAA2B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,8BAA8B;;AAE5T,qBAAqB,2BAA2B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,8BAA8B;;AAExT,gBAAgB,wBAAwB,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE,gCAAgC,EAAE,gCAAgC,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,8BAA8B;AACthB;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAuB;AACtC;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,0FAA0F;AAC7F;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,0CAA0C;AAC7C;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,CAAC,EAAE,mDAAmD;AACtD;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA,OAAO;AACP;AACA,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,+CAA+C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2MAA2M;AAC9M;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA,kBAAkB;AAClB;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2LAA2L;AAC9L;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,MAAM;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,MAAM;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,4BAA4B,gDAAgD;AAC5E;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,qBAAqB;AACxB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,aAAa,OAAO;AAC9B;AACA;AACA;AACA,UAAU,SAAS;AACnB,YAAY,aAAa;AACzB;AACA;AACA,mBAAmB;AACnB;AACA,OAAO,OAAO;AACd;AACA;AACA;AACA;AACA;AACA;AACA,G;AACA;AACA,oBAAoB,MAAM,OAAO;AACjC;AACA,6BAA6B,gBAAgB,UAAU;AACvD;AACA;AACA;AACA;AACA,UAAU,aAAa;AACvB;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC,oDAAoD,WAAW,EAAE;AACjE,yCAAyC;AACzC;AACA;AACA,iBAAiB,KAAK;AACtB,sCAAsC;AACtC;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB;AACA,sBAAsB,4CAA4C;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,aAAa;AAC3B;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;;AAEA,gBAAgB,aAAa,OAAO;AACpC;AACA;;AAEA,gBAAgB,uCAAuC,OAAO;AAC9D;AACA;AACA;AACA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA,cAAc,0BAA0B,OAAO;AAC/C;AACA;AACA,gBAAgB,yBAAyB;AACzC;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uEAAuE,qBAAqB;AAC5F;AACA;AACA;;AAEA,CAAC,EAAE,WAAW;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,4CAA4C;AAC5C;AACA;;AAEA;AACA,6EAA6E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0HAA0H,gBAAgB,GAAG;AAC7I;AACA,gBAAgB;AAChB;AACA;AACA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB,mEAAmE;AACnE,qDAAqD;;AAErD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,mBAAmB;AACtB;AACA,CAAC,EAAE,qBAAqB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C,oCAAoC,EAAE;AAChF;;AAEA,CAAC,EAAE,+JAA+J;AAClK;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,oIAAoI;AACvI;AACA;AACA;AACA;AACA,qCAAqC;AACrC,CAAC,4BAA4B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,SAAS;AAC3B,sCAAsC,SAAS;AAC/C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,eAAe,OAAO;AACtB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qEAAqE,SAAS;AAC9E,0DAA0D,SAAS;AACnE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,sCAAsC;AACtC,CAAC,4BAA4B;;AAE7B;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,yEAAyE,8CAA8C;AACvH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+DAA+D,qBAAqB,EAAE;;AAEtF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAiD,aAAa,kCAAkC,EAAE,EAAE;AACpG,wDAAwD,8BAA8B,EAAE;AACxF;;AAEA;AACA,6BAA6B,iDAAiD,EAAE;AAChF,0BAA0B,2CAA2C,EAAE;AACvE,8BAA8B,uDAAuD,EAAE;AACvF,sBAAsB,cAAc,aAAa,EAAE;AACnD,+BAA+B,mCAAmC,aAAa,EAAE;AACjF,iCAAiC,oBAAoB,aAAa,EAAE;AACpE,yBAAyB,YAAY,aAAa;AAClD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0DAA0D,gBAAgB,EAAE;;AAE5E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,0BAA0B;AAC/D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,qCAAqC;AACrC,CAAC,4BAA4B;;AAE7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,EAAE;AAC5B,0BAA0B,EAAE;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,sCAAsC;AACtC,CAAC,4BAA4B;;AAE7B,YAAY;;AAEZ;AACA,8CAA8C,IAAI,OAAO;AACzD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA,iBAAiB;AACjB;AACA;AACA,GAAG;AACH;AACA,kFAAkF,OAAO;AACzF;AACA,+CAA+C,OAAO;AACtD,GAAG;AACH;AACA;AACA,mDAAmD,OAAO;AAC1D;AACA;;AAEA;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA,mCAAmC,4BAA4B;AAC/D;AACA;;AAEA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,sCAAsC;AACtC,CAAC,uEAAuE;;AAExE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,OAAO;AACtB;AACA;;AAEA,iDAAiD,OAAO;AACxD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,gBAAgB;AACnC;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,OAAO;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,qCAAqC,gBAAgB;AACrD,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,OAAO;AAC3C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,qCAAqC,OAAO;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA,qCAAqC,OAAO;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,OAAO;AACjC;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,OAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,EAAE,uEAAuE;AAC1E;AACA;AACA;AACA;AACA,qCAAqC;AACrC,CAAC,oCAAoC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,QAAQ;AACrB,QAAQ,QAAQ;;AAEhB;AACA,eAAe,QAAQ;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ,YAAY;AACZ;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,2BAA2B;AAC3B;AACA;AACA,wCAAwC;AACxC,2BAA2B;AAC3B;AACA,KAAK,OAAO;AACZ;AACA,cAAc,wBAAwB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,OAAO;AACnC;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,4BAA4B,GAAG,4BAA4B;AACzE,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,gCAAgC;AAChE,cAAc,mEAAmE;AACjF,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,cAAc,kEAAkE;AAChF,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,4BAA4B,GAAG,4BAA4B;AACzE,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,EAAE,eAAe;AAClB;AACA;AACA;AACA;AACA,sCAAsC;AACtC,CAAC,4BAA4B;;AAE7B;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;;AAExC;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,mDAAmD;AACnD,oDAAoD;AACpD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mDAAmD;AACnD,oDAAoD;AACpD,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;;AAEA;AACA,kDAAkD;;AAElD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8CAA8C;AAC9C,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0FAA0F;;AAE1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mDAAmD;AACnD,oDAAoD;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kCAAkC,OAAO;AACzC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC;AAChC,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B,+CAA+C;AAC/C;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,YAAY,gDAAgD;AAC5D;AACA,mBAAmB,OAAO;AAC1B;AACA,sCAAsC,qDAAqD;AAC3F;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,sCAAsC;AACtC,CAAC,4BAA4B;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qIAAqI,mBAAmB;;AAExJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ;AACR,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;AACpB;AACA,8BAA8B;AAC9B;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE;AACtE,KAAK;AACL,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,SAAS;AAC/F,4DAA4D,SAAS;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA,wEAAwE;AACxE,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,EAAE;AACpD,sBAAsB;AACtB;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA,OAAO;AACP,oBAAoB,UAAU;AAC9B;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C,4EAA4E,UAAU;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sCAAsC,OAAO;AAC7C,gEAAgE,OAAO;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C,wDAAwD,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,OAAO;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,wCAAwC;AAC9F;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iFAAiF;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,SAAS,gBAAgB;AACzB;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sEAAsE,6BAA6B;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO;AAChE;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,gEAAgE,QAAQ;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,6DAA6D,OAAO;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO;AACrD,WAAW;AACX;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2CAA2C,QAAQ;AACnD,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B,oEAAoE,OAAO;AAC3E;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,4CAA4C;AAC5C;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,+BAA+B,iCAAiC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,gCAAgC,QAAQ;AACxC,yBAAyB,8BAA8B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,OAAO;AACP,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,8BAA8B,8BAA8B;AAC5D;AACA,+CAA+C;AAC/C,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,6BAA6B;AAC7B,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,wBAAwB,OAAO;AAC/B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,eAAe,QAAQ;AACvB,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,8BAA8B;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,8BAA8B;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO,2DAA2D,iBAAiB,OAAO;AACnJ;AACA,yDAAyD,OAAO,2DAA2D,iBAAiB,OAAO;AACnJ;AACA,mDAAmD,OAAO,mDAAmD,iBAAiB,OAAO;AACrI;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA,iBAAiB,OAAO;AACxB,0BAA0B,OAAO;AACjC;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,iBAAiB,OAAO;AACxB,2BAA2B,OAAO;AAClC,uDAAuD,OAAO;AAC9D,0EAA0E,OAAO;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA,KAAK;AACL;AACA;AACA,iBAAiB,OAAO;AACxB,0BAA0B,OAAO;AACjC,0BAA0B,OAAO,yBAAyB,iBAAiB,OAAO;AAClF;AACA,iBAAiB,OAAO;AACxB;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,MAAM;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,gCAAgC,SAAS;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,oBAAoB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,8EAA8E,OAAO;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,8BAA8B,OAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM,qBAAqB,OAAO;AAClD;AACA,SAAS;AACT;AACA,gBAAgB,QAAQ,sBAAsB,OAAO;AACrD;AACA,mBAAmB,cAAc;AACjC,8BAA8B,kBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,qBAAqB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C,yDAAyD,SAAS;AAClE;AACA;AACA;AACA;AACA,+CAA+C,SAAS;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA,wDAAwD,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA,wDAAwD,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb,WAAW;AACX,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,0BAA0B;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,2EAA2E,4EAA4E;AACvJ,CAAC;AACD,CAAC,GAAG;AACJ;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,yCAAyC;AAC5C;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA,0BAA0B,eAAe;AACzC;AACA,wBAAwB,cAAc;AACtC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC,EAAE,YAAY;AACf;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,2CAA2C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA,GAAG;AACH,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,0EAA0E;AAC1E;AACA;AACA;;AAEA,yBAAyB,cAAc;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,SAAS;AAChC,KAAK;AACL,2BAA2B,YAAY;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;;AAEA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC;;AAEzC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC;;AAEzC,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,iCAAiC,+BAA+B;;AAEhE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iDAAiD,SAAS;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,yCAAyC;AAC3D;;AAEA,mBAAmB,iBAAiB;AACpC,uBAAuB,oBAAoB;AAC3C,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC,EAAE,WAAW;AACd;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gPAAgP;AACnP;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,aAAa;AAChB;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mBAAmB;AACtB;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mBAAmB;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,CAAC,EAAE,2CAA2C;AAC9C;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;AACA;AACA,QAAQ;AACR,cAAc,aAAa,GAAG,eAAe;AAC7C;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uDAAuD;AAC1D;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,sEAAsE;AACzE;;AAEA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA,WAAW;;AAEX;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA,+CAA+C;;AAE/C;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;;AAEA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA,oCAAoC,wDAAwD;;AAE5F,CAAC,EAAE,kBAAkB;AACrB;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA,CAAC,EAAE,wCAAwC;AAC3C;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,CAAC;AACD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA,IAAI;AACJ,2DAA2D;AAC3D;;AAEA;AACA,0DAA0D;;AAE1D;AACA;AACA,0DAA0D;;AAE1D;AACA,EAAE;AACF;;AAEA;;AAEA,CAAC,EAAE,wDAAwD;AAC3D;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,CAAC;AACD;;AAEA,CAAC,EAAE,wGAAwG;AAC3G;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mHAAmH;AACtH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wIAAwI;AAC3I;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA,iCAAiC;AACjC,YAAY;AACZ,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA,CAAC,EAAE,wKAAwK;AAC3K;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kHAAkH;AACrH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,CAAC;AACD;;AAEA,CAAC,EAAE,wEAAwE;AAC3E;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC,qBAAqB;;AAEtB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iFAAiF;;AAEjF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,sBAAsB;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,IAAI;AACd;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,wBAAwB;AACzC;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,uCAAuC;AACxD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,MAAM;AAChB,UAAU,OAAO;AACjB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAU,MAAM;AAChB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,qBAAqB,YAAY;AACjC;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA,UAAU,IAAI;AACd;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA,YAAY,SAAS;AACrB,YAAY,SAAS;AACrB;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,YAAY,SAAS;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;AAED,CAAC,yJAAyJ;AAC1J,CAAC,EAAE,eAAe;AAClB;;AAEA;;AAEA,CAAC,EAAE,wCAAwC;AAC3C;;AAEA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA,MAAM,gBAAgB,EAAE,YAAY,cAAc;;AAElD;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,8BAA8B,sBAAsB,EAAE;AACtD,CAAC;;AAED;AACA;AACA;AACA,0BAA0B,gEAAgE,EAAE;AAC5F,yBAAyB,6BAA6B,EAAE;AACxD,CAAC;AACD;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;;AAEA;;AAEA,CAAC,EAAE,wCAAwC;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA,gCAAgC,aAAa,aAAa;AAC1D,EAAE;AACF;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA,CAAC;;AAED,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,EAAE;AACF,0BAA0B,2BAA2B,EAAE;AACvD,CAAC;AACD;;AAEA,CAAC,EAAE,kPAAkP;AACrP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sBAAsB;AACzB;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,GAAG;AACH;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA,KAAK;AACL;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8CAA8C;AACjD;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,iBAAiB;AAC5C,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD,OAAO;AACzD;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAe;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,OAAO;AACrC;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,6BAA6B,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,UAAU;AACxC;AACA;AACA;AACA;AACA;AACA,kDAAkD,iBAAiB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,KAAK;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD,kCAAkC,aAAa,QAAQ;AACvD;;AAEA,cAAc,KAAK;;AAEnB;AACA;;AAEA;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,KAAK;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4GAA4G;AAC/G;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA,qBAAqB,MAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,6CAA6C;AAChD;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD,cAAc,KAAK;AACnB;AACA;AACA;AACA,CAAC;;;AAGD;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,qFAAqF;AACxF;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6CAA6C;AAChD;;AAEA;AACA;;AAEA,oEAAoE,yCAAyC,wDAAwD,0BAA0B,2BAA2B,0BAA0B,uDAAuD,sCAAsC,GAAG,iBAAiB,wCAAwC,wCAAwC,8CAA8C,wCAAwC,+DAA+D,mFAAmF,6EAA6E,GAAG;AAC7uB,iDAAiD,wCAAwC,eAAe,yBAAyB,GAAG;AACpI;AACA;AACA,KAAK;AACL;AACA;;AAEA,oEAAoE,yCAAyC,gDAAgD,yCAAyC,0BAA0B,0BAA0B,uDAAuD,sCAAsC,GAAG,4CAA4C,wBAAwB,wBAAwB,yFAAyF,GAAG,8BAA8B,gCAAgC,iCAAiC,yCAAyC,gDAAgD,oCAAoC,4CAA4C,8BAA8B,sBAAsB,GAAG,mCAAmC,+DAA+D,GAAG,iCAAiC,gCAAgC,4EAA4E,GAAG,6DAA6D,iRAAiR,2OAA2O,GAAG,qCAAqC,+CAA+C,GAAG,mDAAmD,gCAAgC,kCAAkC,8BAA8B,2BAA2B,GAAG,yDAAyD,2jBAA2jB,2DAA2D,qHAAqH,iBAAiB,8DAA8D,qDAAqD,yBAAyB,oEAAoE,oBAAoB,eAAe,wBAAwB,uHAAuH,0EAA0E,uDAAuD,qDAAqD,oIAAoI,uDAAuD,KAAK,2EAA2E,kGAAkG,mEAAmE,2EAA2E,uFAAuF,sDAAsD,GAAG;AACl4H,iDAAiD,wCAAwC,eAAe,yBAAyB,GAAG;AACpI;AACA;AACA,KAAK;AACL;AACA;;AAEA,kEAAkE,wBAAwB,yCAAyC,sBAAsB,yBAAyB,8BAA8B,iBAAiB,kDAAkD,0CAA0C,yCAAyC,gDAAgD,gDAAgD,uEAAuE,qEAAqE,KAAK,OAAO,kCAAkC,KAAK,qCAAqC,GAAG;AAC7qB,+CAA+C,8CAA8C,8BAA8B,iBAAiB,4IAA4I,GAAG;AAC3R;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,iCAAiC,MAAM;AACvC;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC;AACD,CAAC,EAAE,iFAAiF;AACpF;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,gBAAgB,gCAAgC;AAChD,kBAAkB,0DAA0D;AAC5E;AACA,iBAAiB,gCAAgC;AACjD,kBAAkB,0DAA0D;AAC5E;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA,gBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,KAAK;AACvB;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;AACA,kBAAkB,OAAO,OAAO;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gJAAgJ;AACnJ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,MAAM;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG,gCAAgC;AACnC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG,yEAAyE;AAC5E;AACA,GAAG,4DAA4D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,OAAO;AACV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,sDAAsD;AACzD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,aAAa;AAC3B,eAAe,aAAa;AAC5B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,sEAAsE;AACzE;;AAEA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,cAAc,OAAO;AACrB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,oBAAoB,0BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,KAAK;AACzB;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,KAAK;AACzB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B,6BAA6B;;AAE7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,oPAAoP;AACvP;;AAEA,mDAAmD,+CAA+C,mBAAmB,GAAG,0BAA0B,yGAAyG,GAAG,0BAA0B,sDAAsD,sDAAsD,sDAAsD,wCAAwC,uCAAuC,sCAAsC,oDAAoD,8NAA8N,GAAG,0BAA0B,6xBAA6xB,yrBAAyrB,GAAG,sCAAsC,wVAAwV,6CAA6C,KAAK,OAAO,6CAA6C,KAAK,GAAG,47BAA47B,qCAAqC,6CAA6C,uCAAuC,+CAA+C,6BAA6B,gCAAgC,4CAA4C,KAAK,sLAAsL,yEAAyE,8CAA8C,qBAAqB,sCAAsC,oCAAoC,+CAA+C,6CAA6C,yBAAyB,8BAA8B,+BAA+B,gCAAgC,6BAA6B,kDAAkD,KAAK,gCAAgC,2CAA2C,KAAK,cAAc,GAAG,0BAA0B,iCAAiC,oBAAoB,4BAA4B,0BAA0B,6BAA6B,mEAAmE,uDAAuD,oIAAoI,uBAAuB,oBAAoB,iBAAiB,mGAAmG,mHAAmH,yEAAyE,sDAAsD,4DAA4D,2CAA2C,+CAA+C,6BAA6B,mCAAmC,8BAA8B,wCAAwC,oCAAoC,wDAAwD,wDAAwD,0BAA0B,GAAG;AACtgM,mDAAmD,6EAA6E,iCAAiC,oCAAoC,oDAAoD,6CAA6C,yEAAyE,+CAA+C,GAAG,6IAA6I,gEAAgE,+DAA+D,gFAAgF,wEAAwE,uDAAuD,wDAAwD,6CAA6C,6CAA6C,oCAAoC,gFAAgF,4DAA4D,yFAAyF,GAAG,gDAAgD,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,+BAA+B,iJAAiJ,4BAA4B,oIAAoI,uBAAuB,oBAAoB,iBAAiB,wEAAwE,mCAAmC,yCAAyC,uCAAuC,2BAA2B,aAAa,KAAK,yEAAyE,yEAAyE,oDAAoD,iHAAiH,wCAAwC,GAAG;AAChuF,oDAAoD,yDAAyD,wVAAwV,6CAA6C,KAAK,OAAO,6CAA6C,KAAK,GAAG,47BAA47B,qCAAqC,6CAA6C,uCAAuC,+CAA+C,6BAA6B,gCAAgC,4CAA4C,KAAK,sLAAsL,yEAAyE,8CAA8C,qBAAqB,sCAAsC,oCAAoC,+CAA+C,6CAA6C,yBAAyB,8BAA8B,+BAA+B,gCAAgC,6BAA6B,kDAAkD,KAAK,gCAAgC,2CAA2C,KAAK,cAAc,GAAG,0BAA0B,0BAA0B,oBAAoB,yCAAyC,8BAA8B,0BAA0B,2BAA2B,4BAA4B,oBAAoB,iBAAiB,gBAAgB,mHAAmH,yEAAyE,mDAAmD,qBAAqB,+BAA+B,GAAG;AACnlG,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,gCAAgC,uBAAuB,4BAA4B,oBAAoB,iBAAiB,sEAAsE,4CAA4C,GAAG;;AAEpyB;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,6BAA6B;AAClC,KAAK,4BAA4B;AACjC,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,cAAc;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oBAAoB;AACvB;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,MAAM;AACtB,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAK;AACrB;;AAEA;AACA,kBAAkB,KAAK;AACvB;;AAEA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mDAAmD;AACtD;;AAEA;AACA;;AAEA,gDAAgD,uDAAuD,uBAAuB,uCAAuC,wBAAwB,yBAAyB,4BAA4B,iBAAiB,sDAAsD,0FAA0F,4DAA4D,gCAAgC,mCAAmC,GAAG;AACrhB,gDAAgD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,+BAA+B,wBAAwB,4BAA4B,yBAAyB,iBAAiB,wEAAwE,yCAAyC,GAAG;;AAEpyB;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,4BAA4B;AACjC,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,wBAAwB;AACtC;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,gBAAgB,uBAAuB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mBAAmB;;AAEtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA,CAAC,EAAE,wFAAwF;AAC3F;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,OAAO;AAC1B;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAiB,cAAc;AAC/B;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sHAAsH;AACzH;;AAEA;;AAEA;AACA,+CAA+C,4CAA4C,eAAe,kEAAkE,GAAG;AAC/K,kDAAkD,+CAA+C,uBAAuB,wBAAwB,uBAAuB,6BAA6B,2BAA2B,iBAAiB,oFAAoF,sBAAsB,qDAAqD,GAAG;AAClZ,kDAAkD,2CAA2C,uBAAuB,uBAAuB,0BAA0B,iBAAiB,+BAA+B,kCAAkC,8BAA8B,kCAAkC,wCAAwC,kCAAkC,wCAAwC,kCAAkC,wCAAwC,6BAA6B,GAAG;AACnhB,kDAAkD,+CAA+C,wBAAwB,wBAAwB,uBAAuB,6BAA6B,wBAAwB,uBAAuB,iBAAiB,qBAAqB,sBAAsB,sFAAsF,qDAAqD,GAAG;AAC9b;;AAEA,CAAC,EAAE,cAAc;AACjB;AACA,CAAC,EAAE,SAAS;AACZ;AACA;;AAEA,gDAAgD,6DAA6D,uCAAuC,uBAAuB,6BAA6B,2BAA2B,uCAAuC,2BAA2B,6BAA6B,+BAA+B,0BAA0B,oDAAoD,GAAG,iBAAiB,wCAAwC,4CAA4C,4CAA4C,0CAA0C,sGAAsG,sHAAsH,+EAA+E,+BAA+B,+BAA+B,sBAAsB,GAAG;AAC/+B,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,oCAAoC,gCAAgC,8BAA8B,4BAA4B,kCAAkC,iCAAiC,4BAA4B,iBAAiB,yEAAyE,uFAAuF,0BAA0B,cAAc,KAAK,uCAAuC,GAAG;AAC5hC,iDAAiD,gJAAgJ,4BAA4B,oDAAoD,sCAAsC,KAAK,yBAAyB,kDAAkD,KAAK,0BAA0B,kDAAkD,KAAK,mCAAmC,yEAAyE,4CAA4C,qDAAqD,sBAAsB,8BAA8B,wBAAwB,gCAAgC,2DAA2D,8BAA8B,wBAAwB,iCAAiC,0DAA0D,gDAAgD,GAAG,gDAAgD,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,yBAAyB,6BAA6B,+BAA+B,+BAA+B,yBAAyB,iBAAiB,yEAAyE,qFAAqF,GAAG;;AAEp0D;AACA,GAAG,+BAA+B;AAClC,GAAG,mCAAmC;AACtC,GAAG,iCAAiC;AACpC,GAAG,iCAAiC;AACpC,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA,eAAe,sBAAsB;AACrC;AACA;;AAEA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA,2BAA2B,QAAQ;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wDAAwD;;AAExD;AACA;AACA,oDAAoD;AACpD,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uDAAuD;AACvD,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;;AAEA;AACA,eAAe,SAAS;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kIAAkI;AACrI;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,e;AACA,oB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oD;AACA;AACA;AACA;AACA;;AAEA,cAAc,WAAW,WAAW;AACpC;AACA;AACA;AACA;;AAEA,cAAc,WAAW,YAAY;AACrC;AACA;AACA;AACA;;AAEA,eAAe,YAAY,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,aAAa;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe,YAAY,YAAY;AACvC,eAAe,YAAY,YAAY;AACvC,eAAe,YAAY,aAAa;;AAExC;AACA,wBAAwB,yBAAyB;AACjD,4BAA4B,qBAAqB;AACjD,4BAA4B,yBAAyB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,mBAAmB,YAAY,YAAY;AAC3C,mBAAmB,YAAY,YAAY;AAC3C,mBAAmB,YAAY,aAAa;;AAE5C,qBAAqB,cAAc,cAAc;AACjD,qBAAqB,cAAc,cAAc;AACjD,qBAAqB,cAAc,eAAe;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,+DAA+D;AAClE;AACA,CAAC,EAAE,gFAAgF;AACnF;;AAEA,iDAAiD,uDAAuD,uBAAuB,oBAAoB,mEAAmE,uDAAuD,2GAA2G,uBAAuB,oBAAoB,iBAAiB,mDAAmD,yCAAyC,+CAA+C,6BAA6B,8BAA8B,gCAAgC,gDAAgD,gDAAgD,0BAA0B,GAAG;AACvxB,oGAAoG,6EAA6E,iCAAiC,oCAAoC,oDAAoD,6CAA6C,yEAAyE,+CAA+C,GAAG,6IAA6I,gEAAgE,+DAA+D,gFAAgF,wEAAwE,uDAAuD,wDAAwD,6CAA6C,6CAA6C,oCAAoC,gFAAgF,4DAA4D,yFAAyF,GAAG,4BAA4B,yBAAyB,yBAAyB,sCAAsC,GAAG,gDAAgD,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,+BAA+B,iJAAiJ,4BAA4B,2GAA2G,uBAAuB,oBAAoB,iBAAiB,kEAAkE,mCAAmC,yCAAyC,uCAAuC,oCAAoC,iCAAiC,aAAa,KAAK,yEAAyE,yEAAyE,6DAA6D,iHAAiH,wCAAwC,GAAG;AAC55F,oDAAoD,+CAA+C,uBAAuB,oBAAoB,yCAAyC,yBAAyB,sBAAsB,oBAAoB,iBAAiB,kEAAkE,oBAAoB,uBAAuB,iBAAiB,GAAG;AAC5Y,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,+BAA+B,4BAA4B,wBAAwB,yBAAyB,sBAAsB,oBAAoB,iBAAiB,kEAAkE,kEAAkE,GAAG;AACr2B,qDAAqD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,4BAA4B,uBAAuB,oBAAoB,4BAA4B,yCAAyC,6BAA6B,yBAAyB,oBAAoB,iBAAiB,6DAA6D,oCAAoC,KAAK,OAAO,oEAAoE,KAAK,6BAA6B,oBAAoB,cAAc,GAAG;AACvhC,qDAAqD,iDAAiD,wBAAwB,yBAAyB,oBAAoB,iBAAiB,mDAAmD,oCAAoC,cAAc,KAAK,gEAAgE,GAAG;AACzW,oDAAoD,+CAA+C,oBAAoB,yCAAyC,4BAA4B,oBAAoB,iBAAiB,kEAAkE,qBAAqB,2BAA2B,GAAG;AACtV,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,gCAAgC,uBAAuB,4BAA4B,oBAAoB,iBAAiB,sEAAsE,4CAA4C,GAAG;AACpyB,yDAAyD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,6BAA6B,4BAA4B,qBAAqB,yCAAyC,6BAA6B,4BAA4B,oBAAoB,iBAAiB,6DAA6D,oCAAoC,KAAK,OAAO,qEAAqE,+BAA+B,KAAK,sBAAsB,4BAA4B,GAAG;AAC5hC,uDAAuD,+CAA+C,yCAAyC,iBAAiB,kEAAkE,GAAG;AACrO,uDAAuD,iDAAiD,iBAAiB,wCAAwC,GAAG;;AAEpK;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,6BAA6B;AAClC,KAAK,4BAA4B;AACjC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,4BAA4B;AACjC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,4BAA4B;AACjC,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,iCAAiC;AACtC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,cAAc;AACjB;;AAEA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,cAAc,OAAO;AACrB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,oBAAoB,0BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,KAAK;AACzB;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,KAAK;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,eAAe;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,4PAA4P;AAC/P;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gDAAgD;AACnD;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2EAA2E;AAC9E;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gDAAgD;AACnD;;AAEA;;AAEA,8CAA8C,wCAAwC,eAAe,sDAAsD,GAAG;;AAE9J;AACA,8CAA8C,4CAA4C,2BAA2B,0BAA0B,sBAAsB,uBAAuB,2BAA2B,GAAG,yBAAyB,0EAA0E,GAAG,iBAAiB,8CAA8C,uDAAuD,6EAA6E,GAAG;AACtgB;AACA,uEAAuE,yEAAyE,sBAAsB,iBAAiB,yCAAyC,0CAA0C,6EAA6E,wIAAwI,+CAA+C,GAAG;AACjhB;AACA,8CAA8C,gDAAgD,gDAAgD,0BAA0B,iBAAiB,gEAAgE,wFAAwF,kCAAkC,GAAG;AACtX;AACA,8CAA8C,4CAA4C,2BAA2B,sBAAsB,yBAAyB,0EAA0E,GAAG,iBAAiB,yDAAyD,GAAG;AAC9T,8CAA8C,gDAAgD,yEAAyE,iBAAiB,gEAAgE,0EAA0E,GAAG;AACrU;;AAEA,CAAC,EAAE,cAAc;AACjB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gBAAgB,KAAK;;AAErB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,aAAa;AAC/B;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,iBAAiB;AACrC;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,aAAa;AAC/B;;AAEA,8EAA8E,sBAAsB;AACpG;AACA,YAAY,eAAe;AAC3B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA,CAAC,EAAE,SAAS;AACZ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,kBAAkB;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAkC,MAAM;AACxC;AACA;AACA;AACA,mCAAmC,MAAM;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0FAA0F;AAC7F;AACA;;AAEA,gDAAgD,6CAA6C,kBAAkB,eAAe,kBAAkB,uCAAuC,GAAG;AAC1L,gDAAgD,qDAAqD,kBAAkB,iBAAiB,0DAA0D,6CAA6C,GAAG;;AAElP;AACA,qDAAqD,gCAAgC;AACrF;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,eAAe;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;;AAEA;AACA,gBAAgB,KAAK;AACrB;AACA;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,WAAW;AAC3B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,2NAA2N;AAC9N;;AAEA,8DAA8D,+CAA+C,wBAAwB,0BAA0B,2BAA2B,+BAA+B,4BAA4B,2BAA2B,+BAA+B,2CAA2C,iCAAiC,6BAA6B,GAAG,iBAAiB,iDAAiD,wDAAwD,8MAA8M,2BAA2B,2GAA2G,KAAK,GAAG;AACj3B,8DAA8D,uDAAuD,+BAA+B,2BAA2B,iBAAiB,iBAAiB,mBAAmB,2BAA2B,yDAAyD,6BAA6B,OAAO,OAAO,+DAA+D,OAAO,KAAK,OAAO,oDAAoD,wBAAwB,gBAAgB,OAAO,wEAAwE,oEAAoE,KAAK,GAAG;AAC5qB,8DAA8D,+CAA+C,wBAAwB,wBAAwB,0BAA0B,0BAA0B,wBAAwB,iBAAiB,iDAAiD,wDAAwD,6BAA6B,oCAAoC,gCAAgC,wCAAwC,kCAAkC,wCAAwC,kCAAkC,wCAAwC,kBAAkB,GAAG;AACrpB,8DAA8D,2CAA2C,iBAAiB,wDAAwD,sBAAsB,cAAc,KAAK,kCAAkC,GAAG;;AAEhQ,CAAC,EAAE,cAAc;AACjB;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,yEAAyE;AAC5E;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,qBAAqB;AACxB;AACA;;AAEA,2DAA2D,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,4BAA4B,uBAAuB,uBAAuB,oBAAoB,6BAA6B,+BAA+B,uCAAuC,6BAA6B,6BAA6B,sBAAsB,8BAA8B,iBAAiB,6DAA6D,oCAAoC,KAAK,OAAO,wBAAwB,8CAA8C,+BAA+B,OAAO,uDAAuD,+CAA+C,mDAAmD,8FAA8F,mCAAmC,0BAA0B,kBAAkB,gCAAgC,KAAK,GAAG;AACr8C,4DAA4D,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,4BAA4B,uBAAuB,uBAAuB,oBAAoB,yCAAyC,0BAA0B,6BAA6B,2CAA2C,2BAA2B,6BAA6B,sBAAsB,8BAA8B,iBAAiB,6DAA6D,oCAAoC,KAAK,OAAO,+BAA+B,qDAAqD,gCAAgC,OAAO,yDAAyD,+CAA+C,oDAAoD,qCAAqC,kGAAkG,0BAA0B,kBAAkB,gCAAgC,KAAK,GAAG;AACpgD,0DAA0D,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,4BAA4B,uBAAuB,uBAAuB,oBAAoB,iCAAiC,2BAA2B,uBAAuB,uCAAuC,0BAA0B,6BAA6B,kCAAkC,6BAA6B,sBAAsB,8BAA8B,iBAAiB,6DAA6D,oCAAoC,KAAK,OAAO,wCAAwC,8CAA8C,iCAAiC,OAAO,0EAA0E,sHAAsH,4EAA4E,mCAAmC,0BAA0B,kBAAkB,oCAAoC,KAAK,GAAG;AAClkD,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,mCAAmC,wBAAwB,6BAA6B,sBAAsB,8BAA8B,iBAAiB,kFAAkF,2CAA2C,GAAG;AACp1B,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,mCAAmC,0BAA0B,wBAAwB,8BAA8B,iBAAiB,kFAAkF,iDAAiD,GAAG;;AAEj0B;AACA,GAAG,+BAA+B;AAClC,GAAG,4BAA4B;AAC/B,GAAG,4BAA4B;AAC/B,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;;;AAIA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,UAAU;AACV;AACA;AACA;AACA;;;;AAIA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA,gBAAgB,aAAa;AAC7B;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,aAAa;AAC7B;AACA;;AAEA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA,SAAS;AACT,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA,SAAS;AACT,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;;AAGA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA,oBAAoB,KAAK;AACzB,sBAAsB,KAAK;AAC3B;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA,oBAAoB,KAAK;AACzB,sBAAsB,KAAK;AAC3B;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;AAIA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,qKAAqK;AACxK;;AAEA;;AAEA,sDAAsD,6CAA6C,kCAAkC,iBAAiB,4DAA4D,GAAG;AACrN,wDAAwD,0CAA0C,iBAAiB,yBAAyB,GAAG;;AAE/I,CAAC,EAAE,cAAc;AACjB;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oDAAoD;AACvD;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,gDAAgD,iBAAiB,2BAA2B,EAAE,2BAA2B,EAAE,2BAA2B,mCAAmC,SAAS,qDAAqD,yFAAyF,SAAS,SAAS,2FAA2F,yKAAyK,gIAAgI,WAAW,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,2HAA2H,SAAS,SAAS,mDAAmD,yFAAyF,iDAAiD;;AAE9gD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0FAA0F;AAC7F;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA,GAAG;AACH,2BAA2B,oBAAoB;AAC/C;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,oBAAoB;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU,qBAAqB;AAC/B;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,6BAA6B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,uJAAuJ;AAC1J;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,OAAO,KAAK;AACZ;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA,OAAO;AACP,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA,SAAS;AACT,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,KAAK;;AAExC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,+CAA+C,SAAS;AACxD;AACA;;AAEA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,+DAA+D;AAC1F;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,sDAAsD;AACtD;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,IAAI;AACzB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,kEAAkE;AACrE;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,mBAAmB;AAClE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA,gDAAgD,sDAAsD,yBAAyB,yCAAyC,8BAA8B,yBAAyB,2BAA2B,0BAA0B,2BAA2B,iBAAiB,+HAA+H,2EAA2E,wEAAwE,mDAAmD,uEAAuE,wGAAwG,oFAAoF,GAAG;AAC34B,gDAAgD,8CAA8C,iBAAiB,6BAA6B,GAAG;;AAE/I;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,4BAA4B;AACjC,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mDAAmD;AACtD;AACA,CAAC,EAAE,gFAAgF;AACnF;;AAEA,mDAAmD,+CAA+C,mBAAmB,GAAG,0BAA0B,yGAAyG,GAAG,0BAA0B,sDAAsD,sDAAsD,sDAAsD,wCAAwC,uCAAuC,sCAAsC,oDAAoD,8NAA8N,GAAG,0BAA0B,6xBAA6xB,yrBAAyrB,GAAG,sCAAsC,wVAAwV,6CAA6C,KAAK,OAAO,6CAA6C,KAAK,GAAG,geAAge,6BAA6B,2DAA2D,sCAAsC,oCAAoC,0CAA0C,wCAAwC,oBAAoB,6BAA6B,gBAAgB,GAAG,0BAA0B,iCAAiC,oBAAoB,0BAA0B,mEAAmE,uDAAuD,oIAAoI,uBAAuB,oBAAoB,iBAAiB,mGAAmG,iHAAiH,yEAAyE,sDAAsD,0DAA0D,6BAA6B,8BAA8B,wCAAwC,oCAAoC,wDAAwD,wDAAwD,0BAA0B,GAAG;AAC/nJ,mDAAmD,6EAA6E,iCAAiC,oCAAoC,oDAAoD,6CAA6C,yEAAyE,+CAA+C,GAAG,6IAA6I,gEAAgE,+DAA+D,gFAAgF,wEAAwE,uDAAuD,wDAAwD,6CAA6C,6CAA6C,oCAAoC,gFAAgF,4DAA4D,yFAAyF,GAAG,gDAAgD,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,+BAA+B,iJAAiJ,4BAA4B,oIAAoI,uBAAuB,oBAAoB,iBAAiB,wEAAwE,mCAAmC,yCAAyC,uCAAuC,2BAA2B,aAAa,KAAK,yEAAyE,yEAAyE,oDAAoD,iHAAiH,wCAAwC,GAAG;AAChuF,oDAAoD,yDAAyD,wVAAwV,6CAA6C,KAAK,OAAO,6CAA6C,KAAK,GAAG,geAAge,6BAA6B,2DAA2D,sCAAsC,oCAAoC,0CAA0C,wCAAwC,oBAAoB,6BAA6B,gBAAgB,GAAG,0BAA0B,0BAA0B,oBAAoB,yCAAyC,0BAA0B,4BAA4B,oBAAoB,iBAAiB,gBAAgB,iHAAiH,yEAAyE,qDAAqD,qBAAqB,+BAA+B,GAAG;AAC70D,oDAAoD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,gCAAgC,uBAAuB,4BAA4B,oBAAoB,iBAAiB,sEAAsE,4CAA4C,GAAG;;AAEpyB;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,6BAA6B;AAClC,KAAK,4BAA4B;AACjC,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,+BAA+B;AACpC,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,cAAc;AACjB;;AAEA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,cAAc,OAAO;AACrB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,oBAAoB,0BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,KAAK;AACzB;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,KAAK;AACzB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B,6BAA6B;;AAE7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,oPAAoP;AACvP;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,cAAc,kBAAkB;AAChC;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,cAAc,EAAE;AACzC,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB,cAAc,oBAAoB;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB;AACvB;;AAEA;AACA;AACA;;AAEA,gBAAgB,sBAAsB;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,iEAAiE;;AAEjF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;AACA;;AAEA,gDAAgD,yCAAyC,mBAAmB,wBAAwB,8BAA8B,qDAAqD,0CAA0C,6BAA6B,8BAA8B,+BAA+B,+BAA+B,2DAA2D,sBAAsB,iBAAiB,4CAA4C,qDAAqD,4DAA4D,0DAA0D,+BAA+B,eAAe,gBAAgB,4BAA4B,uDAAuD,qFAAqF,+CAA+C,0DAA0D,wDAAwD,oEAAoE,GAAG;AACjoC,gDAAgD,6EAA6E,iCAAiC,oCAAoC,oDAAoD,6CAA6C,yEAAyE,+CAA+C,GAAG,uHAAuH,0GAA0G,GAAG,gDAAgD,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,wCAAwC,4BAA4B,4BAA4B,6BAA6B,6BAA6B,2EAA2E,4BAA4B,8BAA8B,+BAA+B,2DAA2D,sBAAsB,iBAAiB,oGAAoG,wCAAwC,qCAAqC,uCAAuC,0BAA0B,aAAa,KAAK,qEAAqE,yEAAyE,qMAAqM,mHAAmH,wEAAwE,GAAG;AACvyE,uDAAuD,yCAAyC,oBAAoB,8BAA8B,2BAA2B,uCAAuC,gCAAgC,6BAA6B,8BAA8B,+BAA+B,+BAA+B,2DAA2D,sBAAsB,iBAAiB,4DAA4D,oDAAoD,4DAA4D,4DAA4D,8BAA8B,iCAAiC,+BAA+B,gBAAgB,4BAA4B,uDAAuD,wEAAwE,kCAAkC,kCAAkC,GAAG;AACvgC,gDAAgD,mEAAmE,4DAA4D,GAAG,6CAA6C,+EAA+E,GAAG,6CAA6C,uHAAuH,GAAG,6CAA6C,2CAA2C,GAAG,uBAAuB,6BAA6B,uBAAuB,8BAA8B,+BAA+B,+BAA+B,6BAA6B,8BAA8B,yBAAyB,4BAA4B,4BAA4B,2DAA2D,GAAG,iBAAiB,oGAAoG,wDAAwD,sDAAsD,gEAAgE,GAAG;;AAE1sC;AACA;AACA,KAAK,yBAAyB;AAC9B,KAAK,wBAAwB;AAC7B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,yBAAyB;AAC9B,KAAK,wBAAwB;AAC7B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,yBAAyB;AAC9B,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,aAAa,OAAO;AACpB;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA,aAAa,OAAO;AACpB;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAiB,OAAO;AACxB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,aAAa,OAAO;AACpB;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA,aAAa,OAAO;AACpB;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;;AAEA,iBAAiB,kCAAkC;AACnD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,eAAe,OAAO;AACtB;AACA;AACA,iBAAiB,kCAAkC;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,OAAO;AACtB;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA,oBAAoB,QAAQ;AAC5B;;AAEA;AACA;AACA;;AAEA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,qBAAqB,cAAc;AACnC;AACA;AACA;AACA;AACA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,eAAe,kBAAkB;AACjC,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA,iBAAiB,kBAAkB;AACnC;AACA,wBAAwB,QAAQ;AAChC,0BAA0B,QAAQ;AAClC,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,eAAe,UAAU;AACzB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,OAAO;AACP;AACA,eAAe,OAAO;AACtB,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;;AAEA;;AAEA,iBAAiB,mBAAmB;AACpC;;AAEA;AACA;;AAEA;AACA,mBAAmB,wBAAwB;AAC3C;AACA,qBAAqB,OAAO;AAC5B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B,UAAU;AACxC;AACA;AACA,0BAA0B,QAAQ;AAClC;AACA;AACA,4BAA4B,QAAQ;AACpC;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,eAAe,yBAAyB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,OAAO;AACpB;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,eAAe,kBAAkB;AACjC;AACA,qBAAqB,OAAO;AAC5B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,6RAA6R;AAChS;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,oCAAoC,cAAc;AAClD;AACA;AACA;AACA;;AAEA,qCAAqC,iCAAiC;AACtE,qCAAqC,iCAAiC;;AAEtE;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B;AAC9B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,YAAY,cAAc;AAC1B,UAAU,cAAc;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,GAAG;AACH;AACA,+BAA+B,wCAAwC,EAAE;AACzE,8BAA8B,qCAAqC,EAAE;AACrE,2BAA2B,wBAAwB,EAAE;AACrD,8BAA8B,qBAAqB,EAAE;AACrD,wBAAwB,mBAAmB,EAAE;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,wCAAwC,gDAAgD,gCAAgC,8DAA8D,8BAA8B,2BAA2B,2EAA2E,uCAAuC,gCAAgC,+BAA+B,sBAAsB,yGAAyG,wJAAwJ,2DAA2D,qCAAqC,uEAAuE,wEAAwE,yDAAyD,oCAAoC,6CAA6C,8CAA8C,mCAAmC,qCAAqC,SAAS;;AAE/qC,uCAAuC,gCAAgC,kDAAkD,+BAA+B,8BAA8B,+BAA+B,uCAAuC,gCAAgC,uCAAuC,qEAAqE,SAAS,wBAAwB,gEAAgE,yDAAyD,oGAAoG,mHAAmH,0HAA0H,oCAAoC,8BAA8B,mCAAmC,2CAA2C,0CAA0C,6CAA6C,2BAA2B,6BAA6B,6BAA6B,+HAA+H,iCAAiC,SAAS;AACx1C,EAAE;;AAEF;AACA;;AAEA,SAAS;AACT;;AAEA;AACA;;AAEA,6BAA6B,MAAM,UAAU;AAC7C,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;AACA,8CAA8C,sBAAsB,EAAE;AACtE;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB;;AAEzB;AACA,qCAAqC;;AAErC;AACA;;AAEA,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,mBAAmB;;AAEnB;AACA,mBAAmB;;AAEnB,uBAAuB;;AAEvB,oCAAoC;;AAEpC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,uCAAuC;AACvC,6DAA6D;;AAE7D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe;;AAEf;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA,wBAAwB;AACxB,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,kBAAkB,wBAAwB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B,0BAA0B;AACvD;AACA;AACA,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA;AACA;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B,0BAA0B;AACxD;AACA;AACA;;AAEA,oBAAoB,eAAe;AACnC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,iBAAiB;AACjB,mBAAmB,8CAA8C;AACjE,mBAAmB,+CAA+C;AAClE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,KAAK;;AAEL,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC;AAChC;AACA,GAAG;AACH;;AAEA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,yBAAyB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2DAA2D,aAAa;;AAExE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA,CAAC,EAAE,4TAA4T;AAC/T;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sDAAsD;AACzD;AACA;;AAEA;;AAEA;AACA;AACA,sCAAsC;;AAEtC;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oBAAoB;AACvB;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,qBAAqB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS,YAAY;AACrB;AACA;AACA,GAAG;AACH;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;;AAEA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C;AAC5C,2CAA2C;;AAE3C;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC,EAAE,mBAAmB;AACtB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,wBAAwB;AACtC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC,EAAE,mBAAmB;AACtB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,sDAAsD;AACzD;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA,K;AACA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,EAAE,eAAe;AAClB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,eAAe;AAClB;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6rBAA6rB;AAChsB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,EAAE,eAAe;AAClB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;;AAEA,CAAC,EAAE,sBAAsB;AACzB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mZAAmZ;AACtZ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,gDAAgD;AAChD,8CAA8C;AAC9C,8CAA8C;AAC9C,sCAAsC;AACtC,oCAAoC;AACpC,4BAA4B;AAC5B,kCAAkC;AAClC,oCAAoC;AACpC,0CAA0C;AAC1C,kCAAkC;AAClC;;AAEA;AACA;AACA,6BAA6B,QAAQ;AACrC,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sHAAsH;AACzH;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN,MAAM;AACN;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,cAAc;AACjB;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,qIAAqI;AACtI,CAAC,EAAE,iBAAiB;AACpB;;AAEA;;AAEA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,EAAE;AACF;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,QAAQ,WAAW;;AAEnB;AACA;AACA,QAAQ,UAAU;;AAElB;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iCAAiC,qBAAqB;AACtD,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,cAAc,cAAc;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,MAAM;AACtB;AACA;AACA;;AAEA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,MAAM;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,uC;AACA;AACA;AACA,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,MAAM;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,kDAAkD;AACrD;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,mEAAmE,0BAA0B;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,2BAA2B;AACjG;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,iCAAiC;AAC/C;AACA,WAAW;AACX;AACA;;AAEA;AACA,yBAAyB,yBAAyB;AAClD;AACA,WAAW;AACX;AACA;;AAEA;AACA,cAAc,cAAc;AAC5B;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,GAAG;AACH;AACA;AACA,aAAa;AACb;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;;AAEA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA,CAAC,GAAG;AACJ;AACA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;AACA,qJAAqJ;AACrJ;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA,CAAC,qBAAqB;;AAEtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD,mDAAmD,+BAA+B,+BAA+B;;AAEjH;AACA;AACA;AACA,oFAAoF,0BAA0B;AAC9G;AACA;;;AAGA,+BAA+B,aAAa,2GAA2G,cAAc,sFAAsF,gBAAgB,YAAY,WAAW,sBAAsB,QAAQ,oBAAoB,yKAAyK,qCAAqC,wCAAwC,sCAAsC,wCAAwC,gDAAgD,wCAAwC,uCAAuC,cAAc,iCAAiC,IAAI,KAAK,mDAAmD,qCAAqC,0BAA0B,QAAQ,wBAAwB,oBAAoB,KAAK,IAAI,EAAE,mDAAmD,0BAA0B,SAAS,iCAAiC,iDAAiD,sBAAsB,uCAAuC,6BAA6B,6CAA6C,gCAAgC,+BAA+B,6BAA6B,4BAA4B,iCAAiC,8BAA8B,mDAAmD,8BAA8B,yEAAyE,QAAQ,gBAAgB,mBAAmB,oBAAoB,qBAAqB,mBAAmB,mBAAmB,aAAa,iBAAiB,4BAA4B,iBAAiB,4BAA4B,iBAAiB,4BAA4B,yBAAyB,oCAAoC,wBAAwB,mCAAmC,kBAAkB,6BAA6B,iBAAiB,4BAA4B,oBAAoB,+BAA+B,4BAA4B,uCAAuC,qBAAqB,gCAAgC,iBAAiB,4BAA4B,iBAAiB,4BAA4B,kBAAkB,6BAA6B,gBAAgB,8CAA8C,oBAAoB,kCAAkC,kBAAkB,kCAAkC,qBAAqB,8BAA8B,eAAe,kBAAkB,iCAAiC,qBAAqB,yCAAyC,uBAAuB,kCAAkC,4BAA4B,uDAAuD,sBAAsB,wDAAwD,8BAA8B,kBAAkB,oCAAoC,kBAAkB,oCAAoC,mBAAmB,gCAAgC,kBAAkB,gCAAgC,0BAA0B,oCAAoC,yBAAyB,oCAAoC,kBAAkB,kCAAkC,kBAAkB,aAAa,oCAAoC,qBAAqB,wEAAwE,8BAA8B,6BAA6B,wGAAwG,8BAA8B,mBAAmB,iEAAiE,uBAAuB,6DAA6D,sBAAsB,kBAAkB,iCAAiC,cAAc,kCAAkC,OAAO,qBAAqB,gBAAgB,WAAW,MAAM,WAAW,0BAA0B,SAAS,QAAQ,gBAAgB,sBAAsB,2BAA2B,GAAG,gBAAgB,0CAA0C,kBAAkB,SAAS,6CAA6C,SAAS,kBAAkB,SAAS,qDAAqD,SAAS,cAAc,gEAAgE,SAAS,cAAc,8DAA8D,kBAAkB,8CAA8C,cAAc,mDAAmD,IAAI,2CAA2C,SAAS,OAAO,6IAA6I,mDAAmD,kBAAkB,kBAAkB,wFAAwF,8HAA8H,mEAAmE,GAAG,QAAQ,cAAc,8BAA8B,iFAAiF,qDAAqD,oBAAoB,WAAW,yDAAyD,4BAA4B,qBAAqB,iBAAiB,qGAAqG,gDAAgD,gGAAgG,yCAAyC,aAAa,kBAAkB,4BAA4B,kBAAkB,YAAY,sBAAsB,2BAA2B,oBAAoB,iBAAiB,yBAAyB,eAAe,gBAAgB,iBAAiB,yBAAyB,QAAQ,MAAM,gGAAgG,mBAAmB,6BAA6B,0CAA0C,6BAA6B,+BAA+B,iEAAiE,gCAAgC,wDAAwD,oCAAoC,8BAA8B,+CAA+C,GAAG,aAAa,oBAAoB,cAAc,gFAAgF,WAAW,MAAM,mBAAmB,qGAAqG,WAAW,MAAM,WAAW,8CAA8C,0BAA0B,kHAAkH,yIAAyI,YAAY,iCAAiC,oNAAoN,4CAA4C,6DAA6D,OAAO,kBAAkB,SAAS,mCAAmC,OAAO,cAAc,WAAW,SAAS,SAAS,4BAA4B,OAAO,cAAc,UAAU,mDAAmD,QAAQ,wCAAwC,QAAQ,aAAa,UAAU,2BAA2B,SAAS,cAAc,SAAS,cAAc,aAAa,kBAAkB,SAAS,wCAAwC,UAAU,KAAK,eAAe,4HAA4H,MAAM,gCAAgC,WAAW,MAAM,cAAc,QAAQ,4BAA4B,SAAS,yEAAyE,UAAU,wBAAwB,UAAU,yBAAyB,cAAc,cAAc,MAAM,UAAU,gBAAgB,MAAM,gCAAgC,WAAW,MAAM,cAAc,QAAQ,4BAA4B,SAAS,yEAAyE,UAAU,wBAAwB,UAAU,yBAAyB,WAAW,yCAAyC,SAAS,oBAAoB,MAAM,QAAQ,eAAe,cAAc,cAAc,MAAM,UAAU,oBAAoB,MAAM,gCAAgC,iBAAiB,MAAM,cAAc,QAAQ,4BAA4B,SAAS,yEAAyE,UAAU,wBAAwB,UAAU,yBAAyB,WAAW,yCAAyC,cAAc,cAAc,WAAW,oBAAoB,YAAY,WAAW,kBAAkB,MAAM,UAAU,iBAAiB,MAAM,gCAAgC,YAAY,OAAO,SAAS,UAAU,yBAAyB,SAAS,gDAAgD,YAAY,2BAA2B,UAAU,0BAA0B,gBAAgB,mCAAmC,iBAAiB,cAAc,cAAc,2BAA2B,eAAe,MAAM,gCAAgC,UAAU,OAAO,wCAAwC,cAAc,yCAAyC,uCAAuC,eAAe,MAAM,gCAAgC,UAAU,MAAM,0BAA0B,cAAc,yCAAyC,uCAAuC,QAAQ,IAAI,0BAA0B,OAAO,oBAAoB,OAAO,QAAQ,UAAU,UAAU,WAAW,oBAAoB,UAAU,aAAa,eAAe,aAAa,WAAW,SAAS,SAAS,cAAc,iBAAiB,cAAc,UAAU,mCAAmC,UAAU,mCAAmC,SAAS,cAAc,SAAS,cAAc,QAAQ,cAAc,yLAAyL,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,cAAc,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,gBAAgB,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,iBAAiB,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,cAAc,YAAY,qEAAqE,OAAO,SAAS,WAAW,gBAAgB,cAAc,4FAA4F,QAAQ,SAAS,UAAU,iBAAiB,qBAAqB,8EAA8E,oBAAoB,EAAE,qBAAqB,iFAAiF,oBAAoB,EAAE,aAAa,oBAAoB,UAAU,SAAS,oBAAoB,gBAAgB,oBAAoB,qEAAqE,QAAQ,SAAS,iBAAiB,mBAAmB,yGAAyG,0BAA0B,EAAE,uBAAuB,2EAA2E,uBAAuB,mGAAmG,0BAA0B,mGAAmG,kBAAkB,gHAAgH,4BAA4B,qEAAqE,MAAM,YAAY,SAAS,wCAAwC,cAAc,qKAAqK,kBAAkB,qEAAqE,OAAO,SAAS,UAAU,SAAS,qDAAqD,0BAA0B,sJAAsJ,0CAA0C,EAAE,eAAe,gGAAgG,gBAAgB,6IAA6I,iBAAiB,oHAAoH,sBAAsB,mGAAmG,gCAAgC,EAAE,0BAA0B,EAAE,gBAAgB,6IAA6I,gBAAgB,4FAA4F,SAAS,QAAQ,SAAS,OAAO,UAAU,cAAc,eAAe,iBAAiB,mBAAmB,0CAA0C,yBAAyB,qEAAqE,MAAM,YAAY,SAAS,wCAAwC,yBAAyB,qEAAqE,MAAM,YAAY,SAAS,wCAAwC,4BAA4B,qEAAqE,MAAM,YAAY,SAAS,wCAAwC,eAAe,2GAA2G,cAAc,qLAAqL,cAAc,4IAA4I,mBAAmB,yIAAyI,qBAAqB,yGAAyG,wBAAwB,8HAA8H,iBAAiB,4FAA4F,OAAO,UAAU,UAAU,0CAA0C,gBAAgB,4FAA4F,SAAS,QAAQ,SAAS,OAAO,UAAU,cAAc,eAAe,iBAAiB,mBAAmB,0CAA0C,mBAAmB,4GAA4G,0BAA0B,EAAE,gBAAgB,6IAA6I,iBAAiB,oHAAoH,sBAAsB,mGAAmG,gCAAgC,EAAE,0BAA0B,EAAE,mBAAmB,4FAA4F,OAAO,aAAa,cAAc,wCAAwC,gBAAgB,yJAAyJ,uBAAuB,mGAAmG,0BAA0B,mGAAmG,kBAAkB,gHAAgH,aAAa,oBAAoB,UAAU,SAAS,oBAAoB,gBAAgB,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,mBAAmB,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,SAAS,uBAAuB,kBAAkB,oBAAoB,OAAO,QAAQ,OAAO,QAAQ,OAAO,QAAQ,MAAM,SAAS,OAAO,OAAO,QAAQ,OAAO,YAAY,gBAAgB,oBAAoB,QAAQ,cAAc,aAAa,gBAAgB,oEAAoE,aAAa,iCAAiC,kBAAkB,oBAAoB,KAAK,yBAAyB,MAAM,yBAAyB,UAAU,cAAc,QAAQ,cAAc,KAAK,eAAe,OAAO,iBAAiB,QAAQ,iBAAiB,WAAW,iBAAiB,OAAO,8BAA8B,cAAc,8BAA8B,MAAM,aAAa,KAAK,aAAa,IAAI,aAAa,SAAS,cAAc,SAAS,cAAc,SAAS,cAAc,UAAU,cAAc,SAAS,cAAc,WAAW,cAAc,cAAc,cAAc,cAAc,cAAc,eAAe,cAAc,YAAY,cAAc,aAAa,cAAc,MAAM,cAAc,OAAO,cAAc,MAAM,eAAe,MAAM,eAAe,SAAS,eAAe,aAAa,qBAAqB,kBAAkB,qBAAqB,KAAK,qBAAqB,OAAO,aAAa,oBAAoB,gBAAgB,kBAAkB,gBAAgB,MAAM,aAAa,MAAM,aAAa,MAAM,aAAa,MAAM,aAAa,MAAM,aAAa,MAAM,aAAa,OAAO,aAAa,QAAQ,aAAa,KAAK,aAAa,OAAO,aAAa,MAAM,aAAa,MAAM,aAAa,MAAM,aAAa,OAAO,aAAa,OAAO,aAAa,OAAO,aAAa,MAAM,aAAa,MAAM,aAAa,QAAQ,aAAa,MAAM,aAAa,OAAO,aAAa,QAAQ,aAAa,OAAO,iBAAiB,OAAO,iBAAiB,MAAM,iBAAiB,MAAM,iBAAiB,OAAO,iBAAiB,OAAO,iBAAiB,MAAM,iBAAiB,MAAM,iBAAiB,MAAM,iBAAiB,wBAAwB,eAAe,SAAS,eAAe,WAAW,eAAe,SAAS,eAAe,oBAAoB,iBAAiB,QAAQ,QAAQ,uCAAuC,MAAM,aAAa,uFAAuF,WAAW,2IAA2I,QAAQ,+GAA+G,YAAY,8HAA8H,wKAAwK,kBAAkB,2EAA2E,iBAAiB,4HAA4H,eAAe,0HAA0H,mBAAmB,EAAE,uBAAuB,wGAAwG,mBAAmB,EAAE,oBAAoB,EAAE,mBAAmB,2HAA2H,0BAA0B,qEAAqE,MAAM,aAAa,2CAA2C,iBAAiB,8EAA8E,aAAa,gBAAgB,4HAA4H,eAAe,0HAA0H,mBAAmB,EAAE,mBAAmB,2HAA2H,0BAA0B,qEAAqE,MAAM,aAAa,2CAA2C,eAAe,iIAAiI,mBAAmB,iIAAiI,gBAAgB,uHAAuH,cAAc,iIAAiI,mBAAmB,oIAAoI,mBAAmB,EAAE,iBAAiB,6EAA6E,kBAAkB,wGAAwG,qBAAqB,EAAE,mBAAmB,EAAE,sBAAsB,gBAAgB,GAAG,eAAe,iBAAiB,iIAAiI,iBAAiB,+GAA+G,gBAAgB,wGAAwG,mBAAmB,4HAA4H,qBAAqB,2HAA2H,4BAA4B,qEAAqE,MAAM,aAAa,6CAA6C,uBAAuB,qEAAqE,MAAM,aAAa,eAAe,2BAA2B,qEAAqE,MAAM,aAAa,oBAAoB,wBAAwB,iIAAiI,wBAAwB,+GAA+G,0BAA0B,6HAA6H,gBAAgB,kBAAkB,kIAAkI,mBAAmB,kHAAkH,sBAAsB,kHAAkH,kBAAkB,kOAAkO,oBAAoB,6HAA6H,eAAe,gBAAgB,oJAAoJ,eAAe,uIAAuI,oBAAoB,gJAAgJ,oBAAoB,yJAAyJ,mBAAmB,yJAAyJ,mBAAmB,mJAAmJ,0BAA0B,qEAAqE,MAAM,aAAa,wDAAwD,iBAAiB,oJAAoJ,eAAe,uIAAuI,oBAAoB,gJAAgJ,oBAAoB,yJAAyJ,mBAAmB,yJAAyJ,mBAAmB,mJAAmJ,0BAA0B,qEAAqE,MAAM,aAAa,yDAAyD,eAAe,kBAAkB,qGAAqG,sBAAsB,4GAA4G,0BAA0B,qGAAqG,0BAA0B,qGAAqG,sBAAsB,sGAAsG,oBAAoB,sGAAsG,yBAAyB,mHAAmH,kBAAkB,oCAAoC,yGAAyG,kCAAkC,qEAAqE,MAAM,aAAa,oBAAoB,2BAA2B,sGAAsG,2BAA2B,wFAAwF,8BAA8B,wFAAwF,2BAA2B,yFAAyF,mBAAmB,oBAAoB,mGAAmG,yBAAyB,EAAE,uBAAuB,6EAA6E,uBAAuB,sGAAsG,aAAa,UAAU,yDAAyD,QAAQ,wDAAwD,0BAA0B,YAAY,oBAAoB,UAAU,SAAS,oBAAoB,WAAW,YAAY,kBAAkB,QAAQ,mCAAmC,OAAO,kCAAkC,WAAW,8BAA8B,OAAO,oBAAoB,WAAW,eAAe,YAAY,gBAAgB,uBAAuB,aAAa,oBAAoB,MAAM,OAAO,QAAQ,eAAe,UAAU,sBAAsB,yBAAyB,0BAA0B,4HAA4H,yBAAyB,0HAA0H,6BAA6B,EAAE,6BAA6B,2HAA2H,oCAAoC,qEAAqE,MAAM,aAAa,qDAAqD,2BAA2B,6EAA6E,0BAA0B,iIAAiI,wBAAwB,sKAAsK,qBAAqB,kGAAkG,cAAc,sBAAsB,mEAAmE,cAAc,kCAAkC,OAAO,qBAAqB,gBAAgB,WAAW,MAAM,WAAW,0BAA0B,SAAS,cAAc,oFAAoF,cAAc,sCAAsC,kBAAkB,gBAAgB,0CAA0C,gGAAgG,wBAAwB,kDAAkD,gBAAgB,WAAW,MAAM,yBAAyB,sBAAsB,+BAA+B,qBAAqB,6BAA6B,4CAA4C,yCAAyC,0CAA0C,6BAA6B,6DAA6D,OAAO,YAAY,IAAI,cAAc,IAAI,cAAc,IAAI,eAAe,IAAI,aAAa,IAAI,cAAc,IAAI,aAAa,IAAI,iBAAiB,gBAAgB,OAAO,6BAA6B,cAAc,qBAAqB,oBAAoB,oGAAoG,cAAc,yBAAyB,gBAAgB,gCAAgC,qBAAqB,8FAA8F,KAAK,+BAA+B,oCAAoC,WAAW,MAAM,2BAA2B,sDAAsD,sBAAsB,OAAO,ioHAAioH,cAAc,wCAAwC,cAAc,qBAAqB,cAAc,kEAAkE,cAAc,gEAAgE,kBAAkB,gFAAgF,IAAI,4BAA4B,yCAAyC,8BAA8B,oPAAoP,sCAAsC,2BAA2B,2DAA2D,UAAU,uCAAuC,aAAa,+DAA+D,uCAAuC,aAAa,sCAAsC,6FAA6F,kEAAkE,qBAAqB,cAAc,WAAW,oCAAoC,wDAAwD,oBAAoB,MAAM,2BAA2B,uBAAuB,WAAW,oEAAoE,iCAAiC,iDAAiD,0EAA0E,gCAAgC,wCAAwC,mDAAmD,4EAA4E,uBAAuB,kIAAkI,4CAA4C,IAAI,mCAAmC,kCAAkC,wCAAwC,+EAA+E,uBAAuB,2EAA2E,qBAAqB,oWAAoW,eAAe,qBAAqB,+BAA+B,gCAAgC,+BAA+B,2BAA2B,4BAA4B,qBAAqB,6BAA6B,WAAW,MAAM,eAAe,MAAM,kBAAkB,IAAI,MAAM,KAAK,iBAAiB,SAAS,uBAAuB,yDAAyD,WAAW,uGAAuG,qEAAqE,kBAAkB,+EAA+E,kBAAkB,WAAW,+DAA+D,mCAAmC,2HAA2H,oCAAoC,8EAA8E,yCAAyC,eAAe,mCAAmC,SAAS,uLAAuL,qBAAqB,2BAA2B,uBAAuB,0HAA0H,kBAAkB,qBAAqB,+BAA+B,gCAAgC,+BAA+B,2BAA2B,4BAA4B,qBAAqB,gBAAgB,WAAW,0BAA0B,SAAS,uBAAuB,oCAAoC,SAAS,SAAS,uCAAuC,oCAAoC,wGAAwG,kCAAkC,kBAAkB,oCAAoC,yCAAyC,mBAAmB,mCAAmC,2JAA2J,mBAAmB,uDAAuD,+BAA+B,qBAAqB,QAAQ,qCAAqC,kBAAkB,0BAA0B,uBAAuB,gEAAgE,gCAAgC,WAAW,KAAK,wBAAwB,kBAAkB,WAAW,mBAAmB,mCAAmC,YAAY,mBAAmB,KAAK,+BAA+B,gCAAgC,yHAAyH,YAAY,oCAAoC,sBAAsB,yCAAyC,sDAAsD,2BAA2B,GAAG,OAAO,mCAAmC,wDAAwD,qBAAqB,IAAI,QAAQ,4BAA4B,kBAAkB,2BAA2B,uBAAuB,+GAA+G,QAAQ,eAAe,WAAW,+HAA+H,SAAS,SAAS,eAAe,gJAAgJ,QAAQ,mDAAmD,0BAA0B,mCAAmC,6BAA6B,qHAAqH,SAAS,oCAAoC,eAAe,yCAAyC,oCAAoC,mCAAmC,qCAAqC,6DAA6D,eAAe,kBAAkB,+BAA+B,yCAAyC,QAAQ,2BAA2B,kBAAkB,0BAA0B,uBAAuB,gEAAgE,gCAAgC,WAAW,KAAK,wBAAwB,kBAAkB,WAAW,mBAAmB,mCAAmC,6BAA6B,4BAA4B,WAAW,MAAM,gDAAgD,sBAAsB,cAAc,0OAA0O,mGAAmG,+BAA+B,WAAW,MAAM,gCAAgC,gBAAgB,uBAAuB,mEAAmE,oCAAoC,sBAAsB,yCAAyC,sDAAsD,2BAA2B,GAAG,OAAO,mCAAmC,6BAA6B,kCAAkC,uBAAuB,KAAK,gEAAgE,2BAA2B,2BAA2B,8DAA8D,sCAAsC,oGAAoG,oCAAoC,iDAAiD,qCAAqC,+BAA+B,qDAAqD,yBAAyB,uDAAuD,eAAe,oBAAoB,8CAA8C,8CAA8C,2EAA2E,oCAAoC,SAAS,+BAA+B,mBAAmB,IAAI,iBAAiB,kDAAkD,SAAS,+BAA+B,qBAAqB,IAAI,kCAAkC,mCAAmC,oCAAoC,sBAAsB,yCAAyC,eAAe,mCAAmC,mDAAmD,qBAAqB,GAAG,wBAAwB,+BAA+B,6GAA6G,2GAA2G,WAAW,+CAA+C,WAAW,WAAW,KAAK,oBAAoB,iBAAiB,cAAc,kCAAkC,8BAA8B,kBAAkB,WAAW,uBAAuB,WAAW,MAAM,yBAAyB,8JAA8J,KAAK,YAAY,WAAW,KAAK,0CAA0C,sCAAsC,+CAA+C,uDAAuD,KAAK,qCAAqC,aAAa,6EAA6E,kCAAkC,iBAAiB,aAAa,yEAAyE,YAAY,2BAA2B,0CAA0C,qBAAqB,sDAAsD,uBAAuB,wHAAwH,WAAW,yKAAyK,mCAAmC,wCAAwC,oCAAoC,yCAAyC,eAAe,mCAAmC,yBAAyB,2BAA2B,mHAAmH,gBAAgB,4DAA4D,iBAAiB,iCAAiC,KAAK,EAAE,gEAAgE,aAAa,KAAK,iDAAiD,QAAQ,uBAAuB,uCAAuC,wBAAwB,oDAAoD,mCAAmC,8GAA8G,sIAAsI,WAAW,2KAA2K,uBAAuB,MAAM,sBAAsB,kBAAkB,sBAAsB,iCAAiC,8KAA8K,+DAA+D,2DAA2D,8CAA8C,+CAA+C,qCAAqC,+CAA+C,8CAA8C,4BAA4B,wDAAwD,SAAS,wBAAwB,gCAAgC,EAAE,eAAe,qFAAqF,KAAK,aAAa,IAAI,gCAAgC,SAAS,mCAAmC,SAAS,0GAA0G,mJAAmJ,IAAI,8EAA8E,qCAAqC,2FAA2F,qDAAqD,gCAAgC,kCAAkC,OAAO,qBAAqB,oCAAoC,gBAAgB,WAAW,8BAA8B,yCAAyC,aAAa,2BAA2B,uBAAuB,wDAAwD,gBAAgB,WAAW,MAAM,yBAAyB,4CAA4C,mBAAmB,mBAAmB,uBAAuB,wBAAwB,kGAAkG,6EAA6E,mCAAmC,gBAAgB,kFAAkF,YAAY,WAAW,MAAM,gCAAgC,kLAAkL,+JAA+J,qBAAqB,kBAAkB,2BAA2B,qBAAqB,mCAAmC,iCAAiC,wCAAwC,6BAA6B,mCAAmC,eAAe,2DAA2D,oCAAoC,cAAc,2BAA2B,WAAW,MAAM,UAAU,yCAAyC,yDAAyD,2BAA2B,GAAG,OAAO,mCAAmC,8CAA8C,qBAAqB,oEAAoE,UAAU,sBAAsB,gCAAgC,sEAAsE,uBAAuB,2BAA2B,oBAAoB,GAAG,uBAAuB,6EAA6E,gBAAgB,WAAW,MAAM,yBAAyB,4CAA4C,qBAAqB,gBAAgB,6DAA6D,yCAAyC,QAAQ,6CAA6C,wCAAwC,iCAAiC,sBAAsB,iDAAiD,SAAS,wBAAwB,+BAA+B,kGAAkG,sBAAsB,eAAe,8BAA8B,WAAW,+FAA+F,GAAG,4BAA4B,KAAK,wFAAwF,iBAAiB,oCAAoC,mCAAmC,8GAA8G,GAAG,sCAAsC,kGAAkG,6EAA6E,mCAAmC,gBAAgB,kEAAkE,YAAY,WAAW,MAAM,gCAAgC,yLAAyL,sKAAsK,qBAAqB,kBAAkB,2BAA2B,8KAA8K,mCAAmC,iCAAiC,wCAAwC,6BAA6B,mCAAmC,eAAe,uCAAuC,yHAAyH,+CAA+C,oCAAoC,cAAc,2BAA2B,WAAW,MAAM,UAAU,yCAAyC,yDAAyD,2BAA2B,GAAG,OAAO,mCAAmC,oRAAoR,qBAAqB,uDAAuD,UAAU,qBAAqB,0BAA0B,uBAAuB,mEAAmE,4BAA4B,2BAA2B,8BAA8B,WAAW,MAAM,4CAA4C,uBAAuB,EAAE,kBAAkB,uBAAuB,4BAA4B,mBAAmB,EAAE,uBAAuB,mCAAmC,+BAA+B,WAAW,MAAM,qCAAqC,SAAS,oCAAoC,sBAAsB,yCAAyC,sDAAsD,2BAA2B,GAAG,OAAO,mCAAmC,mBAAmB,kCAAkC,uBAAuB,KAAK,qBAAqB,4DAA4D,kCAAkC,+BAA+B,oCAAoC,4BAA4B,WAAW,MAAM,YAAY,gBAAgB,wBAAwB,mGAAmG,iBAAiB,aAAa,MAAM,WAAW,2FAA2F,gHAAgH,0BAA0B,kBAAkB,eAAe,iDAAiD,0BAA0B,yCAAyC,qCAAqC,mCAAmC,sCAAsC,WAAW,MAAM,yBAAyB,yBAAyB,0CAA0C,uBAAuB,wCAAwC,uBAAuB,4FAA4F,+DAA+D,sBAAsB,aAAa,8BAA8B,mCAAmC,sDAAsD,6DAA6D,oFAAoF,8FAA8F,YAAY,oCAAoC,6BAA6B,yCAAyC,eAAe,mCAAmC,4DAA4D,6BAA6B,yFAAyF,uBAAuB,gGAAgG,yEAAyE,QAAQ,kEAAkE,YAAY,UAAU,aAAa,MAAM,oBAAoB,0BAA0B,kBAAkB,sEAAsE,gBAAgB,WAAW,MAAM,WAAW,sGAAsG,wJAAwJ,yGAAyG,MAAM,uCAAuC,aAAa,yEAAyE,uBAAuB,qBAAqB,kBAAkB,uBAAuB,wBAAwB,kBAAkB,0CAA0C,kCAAkC,mCAAmC,6BAA6B,gEAAgE,oCAAoC,yDAAyD,yCAAyC,yDAAyD,2BAA2B,4CAA4C,OAAO,mCAAmC,2DAA2D,sCAAsC,WAAW,MAAM,2BAA2B,8EAA8E,sBAAsB,+CAA+C,SAAS,WAAW,MAAM,yBAAyB,gFAAgF,6CAA6C,uBAAuB,+CAA+C,eAAe,gFAAgF,iBAAiB,kBAAkB,kBAAkB,mDAAmD,6BAA6B,iFAAiF,wBAAwB,kBAAkB,wBAAwB,kBAAkB,yKAAyK,6IAA6I,WAAW,iBAAiB,qHAAqH,sCAAsC,oBAAoB,kCAAkC,iJAAiJ,cAAc,mCAAmC,yDAAyD,wCAAwC,cAAc,kCAAkC,UAAU,kCAAkC,uBAAuB,IAAI,GAAG,GAAG,uBAAuB,gGAAgG,wEAAwE,MAAM,kEAAkE,iBAAiB,aAAa,MAAM,wBAAwB,kBAAkB,4BAA4B,kBAAkB,2BAA2B,0CAA0C,4BAA4B,mCAAmC,4BAA4B,WAAW,MAAM,yBAAyB,sCAAsC,kCAAkC,oCAAoC,4BAA4B,WAAW,MAAM,yBAAyB,WAAW,mBAAmB,yCAAyC,0DAA0D,KAAK,8BAA8B,4CAA4C,OAAO,mCAAmC,eAAe,kCAAkC,uBAAuB,KAAK,iDAAiD,2BAA2B,uBAAuB,2FAA2F,sBAAsB,oLAAoL,mCAAmC,6BAA6B,sCAAsC,oCAAoC,8FAA8F,oCAAoC,eAAe,yCAAyC,eAAe,mCAAmC,iBAAiB,kCAAkC,uBAAuB,KAAK,QAAQ,yMAAyM,iBAAiB,gCAAgC,gDAAgD,sCAAsC,qBAAqB,wCAAwC,iBAAiB,cAAc,iBAAiB,WAAW,yBAAyB,iBAAiB,kBAAkB,mCAAmC,iBAAiB,kBAAkB,mCAAmC,iBAAiB,kBAAkB,oCAAoC,iBAAiB,kBAAkB,oCAAoC,eAAe,OAAO,QAAQ,eAAe,OAAO,0BAA0B,eAAe,OAAO,wBAAwB,gBAAgB,QAAQ,aAAa,mBAAmB,WAAW,4BAA4B,8BAA8B,+BAA+B,mCAAmC,qCAAqC,qHAAqH,oCAAoC,WAAW,8BAA8B,sCAAsC,kCAAkC,gDAAgD,qCAAqC,2CAA2C,uBAAuB,kBAAkB,uCAAuC,GAAG,MAAM,qCAAqC,2CAA2C,uBAAuB,kBAAkB,uCAAuC,GAAG,8BAA8B,sBAAsB,oCAAoC,wBAAwB,uBAAuB,cAAc,yBAAyB,sBAAsB,sCAAsC,mCAAmC,oCAAoC,iCAAiC,6BAA6B,oBAAoB,WAAW,MAAM,qBAAqB,SAAS,6BAA6B,oBAAoB,WAAW,MAAM,qBAAqB,SAAS,OAAO,uCAAuC,kBAAkB,mCAAmC,qBAAqB,wBAAwB,GAAG,4BAA4B,kBAAkB,mCAAmC,6BAA6B,kBAAkB,mCAAmC,uBAAuB,gBAAgB,sBAAsB,eAAe,qBAAqB,cAAc,6BAA6B,kBAAkB,6CAA6C,4BAA4B,WAAW,gCAAgC,6BAA6B,WAAW,iCAAiC,0BAA0B,WAAW,+BAA+B,4BAA4B,WAAW,gCAAgC,2BAA2B,WAAW,+BAA+B,2BAA2B,WAAW,+BAA+B,2BAA2B,WAAW,+BAA+B,4BAA4B,WAAW,gCAAgC,4BAA4B,WAAW,gCAAgC,4BAA4B,WAAW,gCAAgC,6BAA6B,6CAA6C,qBAAqB,GAAG,6BAA6B,6CAA6C,qBAAqB,GAAG,2BAA2B,WAAW,+BAA+B,6BAA6B,uBAAuB,yCAAyC,6BAA6B,WAAW,iCAAiC,4BAA4B,WAAW,gCAAgC,qCAAqC,kBAAkB,yCAAyC,sCAAsC,WAAW,wBAAwB,wCAAwC,WAAW,kCAAkC,oCAAoC,sDAAsD,+BAA+B,qCAAqC,8BAA8B,+BAA+B,oCAAoC,sDAAsD,+BAA+B,qCAAqC,8BAA8B,+BAA+B,qCAAqC,sDAAsD,gCAAgC,sCAAsC,8BAA8B,gCAAgC,qCAAqC,sDAAsD,gCAAgC,sCAAsC,8BAA8B,gCAAgC,oCAAoC,oCAAoC,oCAAoC,qBAAqB,2CAA2C,+CAA+C,yCAAyC,qCAAqC,8CAA8C,WAAW,sDAAsD,8CAA8C,kBAAkB,yBAAyB,KAAK,KAAK,EAAE,aAAa,qBAAqB,oBAAoB,SAAS,qDAAqD,OAAO,+DAA+D,kBAAkB,+DAA+D,GAAG,MAAM,+DAA+D,kBAAkB,+DAA+D,GAAG,OAAO,+DAA+D,kBAAkB,gEAAgE,GAAG,OAAO,+DAA+D,kBAAkB,gEAAgE,GAAG,MAAM,uCAAuC,kBAAkB,oCAAoC,uBAAuB,gBAAgB,WAAW,MAAM,8BAA8B,SAAS,GAAG,MAAM,uCAAuC,kBAAkB,oCAAoC,uBAAuB,gBAAgB,WAAW,MAAM,6BAA6B,SAAS,GAAG,0BAA0B,wBAAwB,6CAA6C,oDAAoD,2BAA2B,8BAA8B,sCAAsC,gCAAgC,sCAAsC,gCAAgC,yBAAyB,qBAAqB,WAAW,yCAAyC,yCAAyC,EAAE,EAAE,mGAAmG,eAAe,oCAAoC,eAAe,4BAA4B,eAAe,8DAA8D,eAAe,4DAA4D,eAAe,yHAAyH,OAAO,qFAAqF,eAAe,qEAAqE,yKAAyK,QAAQ,kDAAkD,OAAO,8EAA8E,KAAK,oBAAoB,mDAAmD,OAAO,kDAAkD,qBAAqB,mBAAmB,WAAW,oDAAoD,EAAE,6BAA6B,OAAO,kBAAkB,UAAU,qDAAqD,0EAA0E,mBAAmB,cAAc,EAAE,eAAe,kJAAkJ,eAAe,sDAAsD,eAAe,SAAS,mBAAmB,qDAAqD,uBAAuB,wDAAwD,mBAAmB,mDAAmD,qBAAqB,8BAA8B,yCAAyC,6CAA6C,oBAAoB,qBAAqB,mBAAmB,+BAA+B,mDAAmD,qBAAqB,8BAA8B,yCAAyC,6CAA6C,wCAAwC,gBAAgB,6DAA6D,uFAAuF,uCAAuC,uBAAuB,gBAAgB,+DAA+D,qCAAqC,oBAAoB,gCAAgC,IAAI,mBAAmB,8DAA8D,2CAA2C,UAAU,mBAAmB,uHAAuH,iBAAiB,iCAAiC,KAAK,EAAE,sEAAsE,wBAAwB,uBAAuB,qBAAqB,MAAM,yCAAyC,kMAAkM,eAAe,sEAAsE,iBAAiB,+BAA+B,OAAO,4CAA4C,qDAAqD,uBAAuB,kBAAkB,sCAAsC,wDAAwD,+IAA+I,qCAAqC,8FAA8F,IAAI,gDAAgD,qCAAqC,wIAAwI,yBAAyB,2DAA2D,SAAS,SAAS,uJAAuJ,qBAAqB,sCAAsC,wDAAwD,+DAA+D,qCAAqC,4CAA4C,uBAAuB,yHAAyH,iBAAiB,yCAAyC,iCAAiC,2FAA2F,qBAAqB,uFAAuF,oBAAoB,WAAW,iCAAiC,6CAA6C,WAAW,MAAM,WAAW,gBAAgB,4FAA4F,2BAA2B,wBAAwB,WAAW,4PAA4P,EAAE,SAAS,IAAI,0WAA0W,wDAAwD,+DAA+D,qCAAqC,2CAA2C,kDAAkD,wFAAwF,qBAAqB,gEAAgE,yKAAyK,cAAc,6CAA6C,2BAA2B,oLAAoL,0BAA0B,4BAA4B,2BAA2B,2BAA2B,sBAAsB,WAAW,MAAM,WAAW,cAAc,wBAAwB,KAAK,mEAAmE,MAAM,MAAM,YAAY,UAAU,iBAAiB,KAAK,6BAA6B,sBAAsB,kEAAkE,gDAAgD,qBAAqB,WAAW,MAAM,WAAW,+BAA+B,OAAO,yEAAyE,cAAc,8BAA8B,YAAY,yBAAyB,aAAa,WAAW,oBAAoB,sBAAsB,UAAU,wFAAwF,iDAAiD,aAAa,SAAS,mCAAmC,YAAY,uBAAuB,aAAa,qBAAqB,EAAE,qCAAqC,sDAAsD,yDAAyD,0CAA0C,iBAAiB,4BAA4B,UAAU,cAAc,8DAA8D,4BAA4B,cAAc,eAAe,QAAQ,4DAA4D,oCAAoC,WAAW,eAAe,uCAAuC,gCAAgC,sCAAsC,kEAAkE,gBAAgB,8CAA8C,eAAe,kBAAkB,wBAAwB,KAAK,YAAY,iDAAiD,SAAS,MAAM,cAAc,kFAAkF,MAAM,iIAAiI,SAAS,eAAe,0FAA0F,wEAAwE,oHAAoH,gJAAgJ,OAAO,cAAc,0EAA0E,iBAAiB,WAAW,kBAAkB,gFAAgF,GAAG,SAAS,eAAe,4CAA4C,mPAAmP,eAAe,8CAA8C,6JAA6J,oHAAoH,kBAAkB,mGAAmG,mBAAmB,eAAe,oGAAoG,6FAA6F,SAAS,qBAAqB,WAAW,wEAAwE,IAAI,EAAE,+sBAA+sB,cAAc,2BAA2B,wEAAwE,wFAAwF,MAAM,gFAAgF,0EAA0E,4EAA4E,kGAAkG,+CAA+C,iBAAiB,kCAAkC,QAAQ,8DAA8D,iBAAiB,IAAI,mBAAmB,mCAAmC,qCAAqC,KAAK,oBAAoB,uEAAuE,GAAG,gBAAgB,0DAA0D,MAAM,8FAA8F,SAAS,6HAA6H,oCAAoC,qCAAqC,uJAAuJ,6UAA6U,eAAe,uEAAuE,iDAAiD,+CAA+C,oRAAoR,eAAe,yCAAyC,6SAA6S,eAAe,4CAA4C,aAAa,2DAA2D,kDAAkD,oHAAoH,6CAA6C,WAAW,MAAM,WAAW,wCAAwC,SAAS,kBAAkB,2BAA2B,8CAA8C,0BAA0B,OAAO,4DAA4D,QAAQ,iFAAiF,eAAe,wBAAwB,UAAU,iBAAiB,eAAe,8DAA8D,4BAA4B,cAAc,qBAAqB,8BAA8B,iBAAiB,sBAAsB,eAAe,eAAe,aAAa,+YAA+Y,mBAAmB,UAAU,uCAAuC,mCAAmC,iCAAiC,iBAAiB,yBAAyB,UAAU,mDAAmD,+CAA+C,iDAAiD,6BAA6B,oFAAoF,eAAe,UAAU,qBAAqB,kCAAkC,gCAAgC,eAAe,cAAc,eAAe,6BAA6B,IAAI,sCAAsC,iBAAiB,iBAAiB,cAAc,YAAY,wEAAwE,kBAAkB,MAAM,SAAS,6EAA6E,eAAe,uFAAuF,GAAG,gBAAgB,sIAAsI,+GAA+G,oHAAoH,YAAY,WAAW,gDAAgD,yFAAyF,iIAAiI,MAAM,2CAA2C,WAAW,kBAAkB,+DAA+D,GAAG,MAAM,sMAAsM,SAAS,IAAI,iBAAiB,mFAAmF,eAAe,mCAAmC,0DAA0D,yDAAyD,EAAE,0BAA0B,oDAAoD,8DAA8D,IAAI,IAAI,0HAA0H,2DAA2D,MAAM,SAAS,iRAAiR,6FAA6F,GAAG,eAAe,qBAAqB,eAAe,sBAAsB,eAAe,mDAAmD,uEAAuE,6BAA6B,8BAA8B,eAAe,KAAK,kBAAkB,4GAA4G,oFAAoF,sEAAsE,+BAA+B,oBAAoB,2IAA2I,sCAAsC,oDAAoD,+qBAA+qB,6DAA6D,sBAAsB,6FAA6F,eAAe,SAAS,iBAAiB,WAAW,gHAAgH,EAAE,8BAA8B,WAAW,6FAA6F,gBAAgB,aAAa,YAAY,OAAO,EAAE,mBAAmB,WAAW,6FAA6F,gBAAgB,aAAa,YAAY,OAAO,IAAI,GAAG,eAAe,8CAA8C,mDAAmD,qBAAqB,UAAU,6DAA6D,kFAAkF,oKAAoK,SAAS,yBAAyB,6DAA6D,EAAE,uBAAuB,2DAA2D,EAAE,uBAAuB,2DAA2D,EAAE,wJAAwJ,mBAAmB,sCAAsC,kEAAkE,qBAAqB,GAAG,eAAe,6DAA6D,uBAAuB,qFAAqF,gBAAgB,mCAAmC,8CAA8C,4DAA4D,qBAAqB,oDAAoD,yDAAyD,SAAS,eAAe,8BAA8B,kEAAkE,QAAQ,eAAe,SAAS,8BAA8B,8BAA8B,oEAAoE,6BAA6B,8BAA8B,0HAA0H,4FAA4F,eAAe,0CAA0C,qGAAqG,IAAI,6BAA6B,GAAG,eAAe,8BAA8B,oCAAoC,UAAU,oDAAoD,UAAU,4BAA4B,MAAM,oDAAoD,MAAM,cAAc,iBAAiB,OAAO,SAAS,sBAAsB,8EAA8E,yBAAyB,WAAW,+BAA+B,sDAAsD,UAAU,eAAe,sCAAsC,qBAAqB,EAAE,eAAe,kBAAkB,oCAAoC,mHAAmH,+DAA+D,iBAAiB,SAAS,+BAA+B,WAAW,MAAM,WAAW,0CAA0C,SAAS,eAAe,mBAAmB,oBAAoB,6BAA6B,mBAAmB,uCAAuC,kCAAkC,YAAY,gBAAgB,KAAK,0BAA0B,oCAAoC,wCAAwC,sFAAsF,KAAK,aAAa,YAAY,gBAAgB,eAAe,6BAA6B,gEAAgE,YAAY,0BAA0B,wCAAwC,0JAA0J,yCAAyC,mEAAmE,gDAAgD,uBAAuB,sCAAsC,0BAA0B,uEAAuE,SAAS,qDAAqD,IAAI,iDAAiD,oBAAoB,kDAAkD,WAAW,KAAK,WAAW,kBAAkB,UAAU,6EAA6E,mDAAmD,oIAAoI,KAAK,gBAAgB,KAAK,KAAK,iBAAiB,sCAAsC,8CAA8C,4EAA4E,uCAAuC,4CAA4C,wDAAwD,oBAAoB,4BAA4B,8DAA8D,+CAA+C,gBAAgB,WAAW,KAAK,WAAW,kCAAkC,uIAAuI,4BAA4B,mBAAmB,iBAAiB,+CAA+C,qBAAqB,SAAS,gDAAgD,6DAA6D,wBAAwB,sBAAsB,4BAA4B,iBAAiB,uGAAuG,oBAAoB,+FAA+F,mBAAmB,2DAA2D,iBAAiB,yLAAyL,kDAAkD,0BAA0B,QAAQ,6BAA6B,qDAAqD,qBAAqB,qBAAqB,WAAW,MAAM,WAAW,iBAAiB,SAAS,uBAAuB,0CAA0C,sEAAsE,SAAS,8CAA8C,KAAK,oEAAoE,WAAW,4CAA4C,2CAA2C,OAAO,qBAAqB,4DAA4D,eAAe,2PAA2P,6CAA6C,aAAa,EAAE,uBAAuB,gCAAgC,qEAAqE,kBAAkB,iEAAiE,qDAAqD,0DAA0D,WAAW,MAAM,WAAW,gDAAgD,SAAS,8DAA8D,kBAAkB,gBAAgB,kCAAkC,oBAAoB,iVAAiV,QAAQ,iCAAiC,sBAAsB,oBAAoB,wBAAwB,iCAAiC,wBAAwB,iCAAiC,wBAAwB,2BAA2B,wBAAwB,qDAAqD,wBAAwB,mBAAmB,wBAAwB,8DAA8D,wBAAwB,mCAAmC,wBAAwB,kCAAkC,wBAAwB,4BAA4B,wBAAwB,uCAAuC,wBAAwB,gCAAgC,wBAAwB,6CAA6C,wBAAwB,sCAAsC,wBAAwB,gCAAgC,wBAAwB,qCAAqC,wBAAwB,gDAAgD,0BAA0B,uCAAuC,0BAA0B,+BAA+B,0BAA0B,kDAAkD,0BAA0B,2CAA2C,0BAA0B,sBAAsB,0BAA0B,sBAAsB,0BAA0B,sBAAsB,0BAA0B,yCAAyC,0BAA0B,oBAAoB,0BAA0B,iCAAiC,0BAA0B,2BAA2B,0BAA0B,4CAA4C,0BAA0B,+CAA+C,0BAA0B,iCAAiC,0BAA0B,kDAAkD,0BAA0B,uCAAuC,0BAA0B,sCAAsC,0BAA0B,4BAA4B,0BAA0B,2BAA2B,0BAA0B,sCAAsC,0BAA0B,gCAAgC,0BAA0B,sCAAsC,0BAA0B,gCAAgC,0BAA0B,4CAA4C,0BAA0B,2CAA2C,0BAA0B,8BAA8B,0BAA0B,uCAAuC,0BAA0B,mCAAmC,0BAA0B,2CAA2C,0BAA0B,6CAA6C,4BAA4B,eAAe,gBAAgB,WAAW,MAAM,mCAAmC,SAAS,eAAe,kKAAkK,eAAe,u1CAAu1C,eAAe,2BAA2B,qjCAAqjC,KAAK,iBAAiB,gKAAgK,wCAAwC,0EAA0E,wCAAwC,kBAAkB,sMAAsM,IAAI,2CAA2C,qBAAqB,gBAAgB,WAAW,2CAA2C,SAAS,kBAAkB,2CAA2C,8GAA8G,qBAAqB,wGAAwG,qCAAqC,0EAA0E,2CAA2C,+CAA+C,mBAAmB,8CAA8C,wCAAwC,6CAA6C,sCAAsC,wCAAwC,8CAA8C,KAAK,mBAAmB,uFAAuF,kCAAkC,sCAAsC,qCAAqC,gKAAgK,wCAAwC,qCAAqC,0CAA0C,4HAA4H,mCAAmC,YAAY,iCAAiC,WAAW,MAAM,8BAA8B,qBAAqB,4BAA4B,oCAAoC,SAAS,yCAAyC,mEAAmE,WAAW,MAAM,WAAW,2DAA2D,SAAS,wCAAwC,mEAAmE,WAAW,MAAM,WAAW,+CAA+C,UAAU,2BAA2B,2JAA2J,0CAA0C,6DAA6D,MAAM,uCAAuC,sDAAsD,6CAA6C,2CAA2C,qEAAqE,iBAAiB,iBAAiB,gBAAgB,gCAAgC,KAAK,UAAU,mBAAmB,sFAAsF,0CAA0C,mEAAmE,WAAW,MAAM,WAAW,kDAAkD,SAAS,uCAAuC,wCAAwC,WAAW,MAAM,WAAW,kCAAkC,UAAU,mBAAmB,yEAAyE,kCAAkC,gCAAgC,qCAAqC,uEAAuE,mCAAmC,YAAY,iCAAiC,WAAW,MAAM,8BAA8B,sBAAsB,SAAS,2CAA2C,mEAAmE,WAAW,MAAM,WAAW,kDAAkD,UAAU,uBAAuB,8CAA8C,mCAAmC,mCAAmC,qCAAqC,sDAAsD,mCAAmC,0DAA0D,mBAAmB,kFAAkF,6BAA6B,wBAAwB,mBAAmB,uBAAuB,4CAA4C,gCAAgC,0CAA0C,kCAAkC,qBAAqB,mBAAmB,uBAAuB,4CAA4C,gFAAgF,+CAA+C,gCAAgC,0CAA0C,iEAAiE,sEAAsE,6BAA6B,YAAY,kCAAkC,sBAAsB,uDAAuD,cAAc,uCAAuC,mDAAmD,mBAAmB,uBAAuB,4CAA4C,qBAAqB,mCAAmC,+BAA+B,gCAAgC,2LAA2L,2CAA2C,uDAAuD,wCAAwC,8CAA8C,EAAE,gDAAgD,sCAAsC,UAAU,mBAAmB,uBAAuB,4CAA4C,iCAAiC,qCAAqC,UAAU,mBAAmB,4DAA4D,4CAA4C,2CAA2C,uCAAuC,IAAI,oHAAoH,0HAA0H,KAAK,iHAAiH,mBAAmB,gBAAgB,8RAA8R,SAAS,4IAA4I,YAAY,EAAE,4DAA4D,YAAY,EAAE,qEAAqE,wIAAwI,2EAA2E,+CAA+C,YAAY,qCAAqC,qCAAqC,+FAA+F,0CAA0C,0IAA0I,8CAA8C,YAAY,oCAAoC,qCAAqC,gJAAgJ,kCAAkC,sGAAsG,2CAA2C,6FAA6F,sCAAsC,gDAAgD,qCAAqC,4IAA4I,kCAAkC,OAAO,6SAA6S,sDAAsD,+CAA+C,+FAA+F,EAAE,2CAA2C,gDAAgD,iEAAiE,qBAAqB,GAAG,yCAAyC,SAAS,gCAAgC,GAAG,QAAQ,6HAA6H,kBAAkB,oHAAoH,eAAe,wDAAwD,iBAAiB,kBAAkB,YAAY,OAAO,0BAA0B,qFAAqF,+BAA+B,+CAA+C,wCAAwC,iBAAiB,wBAAwB,2BAA2B,gEAAgE,2CAA2C,4BAA4B,oCAAoC,+HAA+H,+BAA+B,2JAA2J,+BAA+B,eAAe,iCAAiC,+BAA+B,kCAAkC,oBAAoB,+HAA+H,iBAAiB,4CAA4C,uCAAuC,4FAA4F,mBAAmB,aAAa,yBAAyB,mIAAmI,yFAAyF,uCAAuC,kBAAkB,iBAAiB,UAAU,6CAA6C,GAAG,KAAK,6DAA6D,mBAAmB,aAAa,yBAAyB,mIAAmI,yFAAyF,2CAA2C,kBAAkB,iBAAiB,UAAU,iFAAiF,GAAG,KAAK,6DAA6D,mBAAmB,aAAa,yBAAyB,mIAAmI,yFAAyF,+CAA+C,kBAAkB,iBAAiB,UAAU,qHAAqH,GAAG,KAAK,iEAAiE,mBAAmB,aAAa,yBAAyB,mIAAmI,yFAAyF,mDAAmD,kBAAkB,iBAAiB,iBAAiB,2JAA2J,GAAG,KAAK,kEAAkE,mBAAmB,aAAa,yBAAyB,mIAAmI,uIAAuI,mDAAmD,kBAAkB,iBAAiB,UAAU,6JAA6J,GAAG,KAAK,kEAAkE,mBAAmB,aAAa,yBAAyB,mIAAmI,6FAA6F,yCAAyC,kBAAkB,iBAAiB,UAAU,qEAAqE,GAAG,KAAK,+DAA+D,mBAAmB,aAAa,yBAAyB,mIAAmI,2FAA2F,qCAAqC,kBAAkB,iBAAiB,UAAU,4BAA4B,GAAG,KAAK,8DAA8D,mBAAmB,aAAa,yBAAyB,mIAAmI,qLAAqL,yDAAyD,kBAAkB,iBAAiB,iBAAiB,oNAAoN,GAAG,KAAK,uEAAuE,mBAAmB,aAAa,yBAAyB,mIAAmI,yFAAyF,+CAA+C,kBAAkB,iBAAiB,UAAU,qHAAqH,GAAG,KAAK,mEAAmE,mBAAmB,aAAa,yBAAyB,mIAAmI,6CAA6C,uCAAuC,kBAAkB,iBAAiB,UAAU,6CAA6C,GAAG,KAAK,8DAA8D,mBAAmB,aAAa,yBAAyB,mIAAmI,qOAAqO,+DAA+D,kBAAkB,iBAAiB,yBAAyB,sRAAsR,GAAG,KAAK,6EAA6E,mBAAmB,aAAa,yBAAyB,mIAAmI,6FAA6F,qCAAqC,kBAAkB,iBAAiB,UAAU,6BAA6B,GAAG,KAAK,6DAA6D,mBAAmB,aAAa,yBAAyB,mIAAmI,yFAAyF,yCAAyC,kBAAkB,iBAAiB,UAAU,+DAA+D,GAAG,KAAK,6DAA6D,mBAAmB,aAAa,yBAAyB,mIAAmI,yIAAyI,yCAAyC,kBAAkB,iBAAiB,gBAAgB,kEAAkE,GAAG,KAAK,iEAAiE,mBAAmB,aAAa,yBAAyB,mIAAmI,2FAA2F,yCAAyC,kBAAkB,iBAAiB,UAAU,kEAAkE,GAAG,KAAK,8DAA8D,mBAAmB,aAAa,yBAAyB,mIAAmI,2FAA2F,uCAAuC,kBAAkB,iBAAiB,UAAU,+CAA+C,GAAG,KAAK,8DAA8D,mBAAmB,aAAa,yBAAyB,mIAAmI,6FAA6F,uCAAuC,kBAAkB,iBAAiB,UAAU,iDAAiD,GAAG,KAAK,6DAA6D,mBAAmB,aAAa,yBAAyB,mIAAmI,6FAA6F,2CAA2C,kBAAkB,iBAAiB,UAAU,yFAAyF,GAAG,KAAK,+DAA+D,mBAAmB,aAAa,yBAAyB,uFAAuF,OAAO,cAAc,gBAAgB,eAAe,gBAAgB,KAAK,gBAAgB,KAAK,gBAAgB,KAAK,gBAAgB,KAAK,gBAAgB,eAAe,gBAAgB,mBAAmB,gBAAgB,cAAc,gBAAgB,SAAS,gBAAgB,2BAA2B,gBAAgB,cAAc,kBAAkB,qCAAqC,6CAA6C,gCAAgC,yCAAyC,+BAA+B,6CAA6C,gCAAgC,yCAAyC,qBAAqB,6CAA6C,sBAAsB,yCAAyC,qBAAqB,6CAA6C,sBAAsB,yCAAyC,qBAAqB,6CAA6C,sBAAsB,yCAAyC,qBAAqB,6CAA6C,sBAAsB,yCAAyC,+BAA+B,8CAA8C,gCAAgC,0CAA0C,mCAAmC,8CAA8C,oCAAoC,0CAA0C,8BAA8B,8CAA8C,+BAA+B,0CAA0C,yBAAyB,8CAA8C,0BAA0B,0CAA0C,2CAA2C,8CAA8C,4CAA4C,0CAA0C,8BAA8B,kDAAkD,0CAA0C,KAAK,qBAAqB,mBAAmB,aAAa,yBAAyB,0HAA0H,sBAAsB,GAAG,KAAK,2BAA2B,mBAAmB,aAAa,yBAAyB,uFAAuF,OAAO,SAAS,gBAAgB,UAAU,gBAAgB,kBAAkB,gBAAgB,YAAY,gBAAgB,mBAAmB,gBAAgB,iBAAiB,gBAAgB,aAAa,gBAAgB,UAAU,gBAAgB,YAAY,gBAAgB,YAAY,gBAAgB,cAAc,gBAAgB,cAAc,gBAAgB,cAAc,gBAAgB,SAAS,kBAAkB,gCAAgC,6CAA6C,2BAA2B,yCAAyC,0BAA0B,6CAA6C,2BAA2B,yCAAyC,kCAAkC,8CAA8C,mCAAmC,0CAA0C,4BAA4B,8CAA8C,6BAA6B,0CAA0C,mCAAmC,8CAA8C,oCAAoC,0CAA0C,iCAAiC,8CAA8C,kCAAkC,0CAA0C,6BAA6B,8CAA8C,8BAA8B,0CAA0C,0BAA0B,+CAA+C,2BAA2B,2CAA2C,4BAA4B,+CAA+C,6BAA6B,2CAA2C,4BAA4B,+CAA+C,6BAA6B,2CAA2C,8BAA8B,+CAA+C,+BAA+B,2CAA2C,8BAA8B,+CAA+C,+BAA+B,2CAA2C,8BAA8B,8CAA8C,+BAA+B,0CAA0C,yBAAyB,8CAA8C,0BAA0B,0CAA0C,0CAA0C,KAAK,qBAAqB,mBAAmB,aAAa,yBAAyB,0HAA0H,sBAAsB,GAAG,KAAK,2BAA2B,mBAAmB,aAAa,yBAAyB,uFAAuF,OAAO,SAAS,kBAAkB,gCAAgC,+CAA+C,2BAA2B,2CAA2C,0CAA0C,KAAK,oBAAoB,mBAAmB,aAAa,yBAAyB,iIAAiI,2BAA2B,6BAA6B,sBAAsB,GAAG,KAAK,0BAA0B,mBAAmB,aAAa,yBAAyB,uFAAuF,OAAO,GAAG,gBAAgB,IAAI,gBAAgB,6BAA6B,kBAAkB,0BAA0B,6CAA6C,qBAAqB,yCAAyC,oBAAoB,6CAA6C,qBAAqB,yCAAyC,6CAA6C,6CAA6C,8CAA8C,yCAAyC,0CAA0C,KAAK,oBAAoB,mBAAmB,aAAa,yBAAyB,2HAA2H,yBAAyB,8BAA8B,yBAAyB,uDAAuD,yBAAyB,6BAA6B,sBAAsB,GAAG,KAAK,+BAA+B,mBAAmB,aAAa,yBAAyB,uFAAuF,OAAO,cAAc,gBAAgB,mBAAmB,gBAAgB,cAAc,kBAAkB,qCAAqC,8CAA8C,gCAAgC,0CAA0C,mCAAmC,8CAA8C,oCAAoC,0CAA0C,8BAA8B,8CAA8C,+BAA+B,0CAA0C,0CAA0C,KAAK,oBAAoB,mBAAmB,aAAa,yBAAyB,0HAA0H,sBAAsB,GAAG,KAAK,2BAA2B,YAAY,uCAAuC,4BAA4B,qCAAqC,4CAA4C,4CAA4C,iLAAiL,gFAAgF,0BAA0B,6BAA6B,qBAAqB,iCAAiC,4BAA4B,WAAW,MAAM,WAAW,0CAA0C,oEAAoE,qBAAqB,kEAAkE,eAAe,gDAAgD,uBAAuB,sDAAsD,YAAY,gCAAgC,2CAA2C,6CAA6C,iCAAiC,kCAAkC,4CAA4C,sCAAsC,wHAAwH,uBAAuB,2DAA2D,UAAU,wBAAwB,6BAA6B,+DAA+D,gCAAgC,gCAAgC,SAAS,+CAA+C,uCAAuC,aAAa,4CAA4C,2CAA2C,IAAI,6BAA6B,KAAK,YAAY,IAAI,qBAAqB,sDAAsD,iCAAiC,wHAAwH,iCAAiC,0DAA0D,wCAAwC,oDAAoD,2BAA2B,6FAA6F,UAAU,wBAAwB,6BAA6B,+DAA+D,gCAAgC,gCAAgC,SAAS,+CAA+C,uCAAuC,aAAa,sGAAsG,mDAAmD,IAAI,uCAAuC,KAAK,YAAY,IAAI,uBAAuB,wDAAwD,iCAAiC,wHAAwH,iCAAiC,0DAA0D,8CAA8C,iKAAiK,0CAA0C,mFAAmF,kBAAkB,eAAe,qCAAqC,iCAAiC,kBAAkB,sCAAsC,qBAAqB,mEAAmE,+EAA+E,iNAAiN,sCAAsC,gDAAgD,mEAAmE,iCAAiC,SAAS,oEAAoE,SAAS,4CAA4C,2BAA2B,8CAA8C,+CAA+C,qBAAqB,iCAAiC,oDAAoD,SAAS,2BAA2B,sBAAsB,sFAAsF,iBAAiB,iCAAiC,sDAAsD,yBAAyB,0BAA0B,SAAS,gCAAgC,gBAAgB,WAAW,MAAM,WAAW,gHAAgH,iBAAiB,OAAO,wTAAwT,2CAA2C,+CAA+C,gGAAgG,8BAA8B,qCAAqC,iCAAiC,iFAAiF,iCAAiC,iFAAiF,0HAA0H,kBAAkB,mCAAmC,YAAY,kBAAkB,+CAA+C,EAAE,eAAe,6CAA6C,WAAW,uBAAuB,WAAW,KAAK,WAAW,yKAAyK,SAAS,uBAAuB,wCAAwC,mBAAmB,+GAA+G,YAAY,uJAAuJ,mBAAmB,YAAY,WAAW,KAAK,WAAW,oBAAoB,sBAAsB,SAAS,iBAAiB,sDAAsD,YAAY,WAAW,uBAAuB,WAAW,2BAA2B,YAAY,WAAW,KAAK,mBAAmB,WAAW,2BAA2B,YAAY,WAAW,2BAA2B,SAAS,mBAAmB,YAAY,WAAW,uBAAuB,WAAW,KAAK,WAAW,2BAA2B,WAAW,2BAA2B,sBAAsB,SAAS,mBAAmB,eAAe,oBAAoB,YAAY,WAAW,6BAA6B,YAAY,WAAW,6BAA6B,SAAS,iBAAiB,uCAAuC,YAAY,aAAa,gCAAgC,aAAa,KAAK,gCAAgC,SAAS,qBAAqB,gDAAgD,mBAAmB,UAAU,yCAAyC,YAAY,WAAW,KAAK,gCAAgC,SAAS,mBAAmB,mBAAmB,6BAA6B,kDAAkD,8EAA8E,iBAAiB,uBAAuB,WAAW,oCAAoC,WAAW,oFAAoF,SAAS,iBAAiB,8BAA8B,WAAW,OAAO,kBAAkB,iEAAiE,SAAS,mBAAmB,2BAA2B,8FAA8F,eAAe,sCAAsC,uBAAuB,yBAAyB,mBAAmB,8BAA8B,iBAAiB,WAAW,KAAK,wBAAwB,WAAW,iCAAiC,WAAW,SAAS,oCAAoC,gBAAgB,WAAW,MAAM,sDAAsD,uDAAuD,YAAY,kEAAkE,iCAAiC,yCAAyC,iCAAiC,oKAAoK,iCAAiC,sJAAsJ,uCAAuC,gBAAgB,WAAW,wBAAwB,WAAW,MAAM,uBAAuB,8BAA8B,8FAA8F,uQAAuQ,iFAAiF,uBAAuB,gBAAgB,EAAE,QAAQ,cAAc,ksBAAksB,EAAE,oBAAoB,MAAM,iEAAiE,0BAA0B,6BAA6B,IAAI,MAAM,8BAA8B,yBAAyB,wFAAwF,OAAO,8BAA8B,gCAAgC,oJAAoJ,OAAO,kBAAkB,0BAA0B,qCAAqC,wBAAwB,4DAA4D,+DAA+D,uBAAuB,8CAA8C,8CAA8C,OAAO,kBAAkB,0BAA0B,wEAAwE,4BAA4B,gCAAgC,0EAA0E,OAAO,kBAAkB,2BAA2B,+HAA+H,sBAAsB,+HAA+H,2BAA2B,iDAAiD,qaAAqa,uBAAuB,yBAAyB,6MAA6M,0BAA0B,sJAAsJ,ybAAyb,iCAAiC,gCAAgC,8IAA8I,yBAAyB,0FAA0F,oNAAoN,yBAAyB,wFAAwF,sNAAsN,sBAAsB,4QAA4Q,8WAA8W,+BAA+B,kCAAkC,2JAA2J,GAAG,mEAAmE,cAAc,mBAAmB,mIAAmI,iBAAiB,qCAAqC,QAAQ,0GAA0G,4DAA4D,gRAAgR,yBAAyB,yBAAyB,iBAAiB,EAAE,EAAE,0BAA0B,WAAW,wBAAwB,WAAW,MAAM,sEAAsE,mSAAmS,SAAS,GAAG,KAAK,mBAAmB,2CAA2C,iEAAiE,mBAAmB,aAAa,yBAAyB,gGAAgG,KAAK,qBAAqB,yBAAyB,MAAM,kEAAkE,6BAA6B,uCAAuC,mBAAmB,yBAAyB,8BAA8B,WAAW,EAAE,iBAAiB,IAAI,QAAQ,QAAQ,EAAE,QAAQ,EAAE,sDAAsD,yCAAyC,yBAAyB,sCAAsC,yJAAyJ,8JAA8J,8BAA8B,WAAW,oEAAoE,YAAY,kBAAkB,SAAS,uBAAuB,gBAAgB,EAAE,qBAAqB,iBAAiB,gCAAgC,cAAc,+BAA+B,eAAe,oCAAoC,4BAA4B,6BAA6B,kBAAkB,qBAAqB,iBAAiB,gCAAgC,cAAc,+BAA+B,eAAe,oCAAoC,4BAA4B,6BAA6B,iBAAiB,wCAAwC,QAAQ,cAAc,6SAA6S,GAAG,iBAAiB,mCAAmC,SAAS,MAAM,UAAU,WAAW,oBAAoB,yHAAyH,eAAe,mBAAmB,IAAI,mBAAmB,cAAc,2CAA2C,mIAAmI,iBAAiB,8CAA8C,4FAA4F,yCAAyC,0EAA0E,kEAAkE,+BAA+B,mEAAmE,oCAAoC,SAAS,+CAA+C,SAAS,yCAAyC,uEAAuE,GAAG,SAAS,cAAc,sfAAsf,EAAE,gBAAgB,cAAc,mBAAmB,sIAAsI,8EAA8E,GAAG,aAAa,uCAAuC,yBAAyB,mBAAmB,OAAO,0EAA0E,eAAe,2BAA2B,mBAAmB,mBAAmB,IAAI,iGAAiG,mBAAmB,WAAW,8BAA8B,SAAS,0BAA0B,kBAAkB,YAAY,IAAI,iEAAiE,mCAAmC,yBAAyB,uBAAuB,QAAQ,6BAA6B,IAAI,2BAA2B,eAAe,KAAK,2BAA2B,2CAA2C,iBAAiB,eAAe,SAAS,UAAU,GAAG,mEAAmE,KAAK,qCAAqC,OAAO,gBAAgB,SAAS,2BAA2B,MAAM,yBAAyB,QAAQ,GAAG,4EAA4E,aAAa,4CAA4C,wBAAwB,GAAG,0BAA0B,EAAE,EAAE,oBAAoB,qBAAqB,KAAK,QAAQ,YAAY,oGAAoG,KAAK,mBAAmB,WAAW,KAAK,UAAU,gBAAgB,gBAAgB,4GAA4G,mBAAmB,iFAAiF,QAAQ,eAAe,0BAA0B,yBAAyB,sBAAsB,WAAW,EAAE,wEAAwE,UAAU,SAAS,qBAAqB,0BAA0B,yBAAyB,oOAAoO,qBAAqB,EAAE,gGAAgG,0GAA0G,WAAW,KAAK,UAAU,EAAE,gGAAgG,WAAW,KAAK,UAAU,EAAE,gGAAgG,WAAW,SAAS,mBAAmB,QAAQ,GAAG,2BAA2B,2HAA2H,aAAa,SAAS,yBAAyB,QAAQ,GAAG,sBAAsB,WAAW,EAAE,uBAAuB,cAAc,0EAA0E,UAAU,UAAU,aAAa,iBAAiB,eAAe,iBAAiB,mBAAmB,6BAA6B,GAAG,wCAAwC,gDAAgD,cAAc,cAAc,oBAAoB,8BAA8B,0BAA0B,UAAU,aAAa,kBAAkB,uBAAuB,4BAA4B,SAAS,KAAK,MAAM,4IAA4I,SAAS,OAAO,cAAc,eAAe,uBAAuB,qNAAqN,eAAe,YAAY,GAAG,yBAAyB,aAAa,SAAS,6BAA6B,yFAAyF,iBAAiB,sDAAsD,QAAQ,GAAG,mFAAmF,UAAU,aAAa,SAAS,uCAAuC,yCAAyC,GAAG,iGAAiG,aAAa,SAAS,MAAM,mBAAmB,8CAA8C,iBAAiB,4BAA4B,qBAAqB,iGAAiG,iBAAiB,qGAAqG,iBAAiB,kEAAkE,iFAAiF,qBAAqB,oBAAoB,+EAA+E,eAAe,yGAAyG,mBAAmB,sHAAsH,qBAAqB,sBAAsB,IAAI,wCAAwC,SAAS,+BAA+B,8DAA8D,4BAA4B,IAAI,KAAK,uCAAuC,0BAA0B,QAAQ,QAAQ,WAAW,MAAM,mCAAmC,sEAAsE,wCAAwC,wBAAwB,4BAA4B,kCAAkC,SAAS,WAAW,KAAK,YAAY,cAAc,gBAAgB,IAAI,gCAAgC,yCAAyC,SAAS,eAAe,gBAAgB,uBAAuB,uBAAuB,KAAK,IAAI,EAAE,YAAY,8KAA8K,cAAc,mBAAmB,qCAAqC,IAAI,EAAE,sBAAsB,YAAY,KAAK,KAAK,YAAY,MAAM,kEAAkE,gCAAgC,mBAAmB,WAAW,kBAAkB,iBAAiB,sBAAsB,iBAAiB,eAAe,kBAAkB,qBAAqB,IAAI,KAAK,cAAc,iGAAiG,gCAAgC,WAAW,yEAAyE,SAAS,iBAAiB,qBAAqB,cAAc,mBAAmB,+GAA+G,YAAY,qMAAqM,oCAAoC,gBAAgB,WAAW,MAAM,sDAAsD,uDAAuD,YAAY,kEAAkE,iCAAiC,yCAAyC,iCAAiC,4NAA4N,iCAAiC,2MAA2M,uCAAuC,wBAAwB,WAAW,MAAM,2BAA2B,WAAW,MAAM,gBAAgB,oHAAoH,WAAW,MAAM,WAAW,iBAAiB,6BAA6B,uGAAuG,6HAA6H,YAAY,WAAW,4HAA4H,uDAAuD,sBAAsB,WAAW,2DAA2D,iDAAiD,iFAAiF,qBAAqB,gBAAgB,EAAE,QAAQ,cAAc,8YAA8Y,EAAE,gBAAgB,cAAc,mBAAmB,kIAAkI,wDAAwD,+CAA+C,gIAAgI,sCAAsC,iBAAiB,oCAAoC,4CAA4C,0DAA0D,sGAAsG,GAAG,aAAa,uCAAuC,EAAE,6CAA6C,+BAA+B,6BAA6B,qEAAqE,mBAAmB,+GAA+G,YAAY,uJAAuJ,iBAAiB,8DAA8D,eAAe,2BAA2B,aAAa,uBAAuB,cAAc,uBAAuB,aAAa,uBAAuB,cAAc,EAAE,oCAAoC,gBAAgB,WAAW,MAAM,sDAAsD,uDAAuD,YAAY,kEAAkE,iCAAiC,yCAAyC,iCAAiC,oKAAoK,iCAAiC,sJAAsJ,uCAAuC,wBAAwB,WAAW,MAAM,2BAA2B,WAAW,MAAM,gBAAgB,yFAAyF,WAAW,MAAM,WAAW,wCAAwC,WAAW,KAAK,WAAW,SAAS,aAAa,aAAa,wHAAwH,2CAA2C,0NAA0N,qBAAqB,2HAA2H,wHAAwH,2CAA2C,WAAW,MAAM,WAAW,iBAAiB,6BAA6B,YAAY,WAAW,KAAK,WAAW,wEAAwE,sBAAsB,WAAW,2DAA2D,iDAAiD,iFAAiF,8BAA8B,gBAAgB,EAAE,QAAQ,cAAc,6lBAA6lB,EAAE,gBAAgB,cAAc,mBAAmB,mIAAmI,iBAAiB,oCAAoC,sDAAsD,0DAA0D,0HAA0H,yCAAyC,8EAA8E,+BAA+B,4EAA4E,GAAG,aAAa,8CAA8C,EAAE,wCAAwC,mBAAmB,uBAAuB,kBAAkB,8GAA8G,mBAAmB,4CAA4C,2BAA2B,KAAK,QAAQ,EAAE,0DAA0D,oBAAoB,4DAA4D,eAAe,qCAAqC,IAAI,2CAA2C,SAAS,yFAAyF,gBAAgB,qBAAqB,sDAAsD,QAAQ,EAAE,SAAS,qBAAqB,cAAc,wGAAwG,KAAK,+CAA+C,0BAA0B,sBAAsB,8BAA8B,gBAAgB,qBAAqB,yEAAyE,QAAQ,EAAE,SAAS,qBAAqB,cAAc,sGAAsG,oDAAoD,gBAAgB,wCAAwC,gHAAgH,cAAc,YAAY,WAAW,KAAK,+BAA+B,6EAA6E,kBAAkB,gBAAgB,QAAQ,WAAW,iBAAiB,OAAO,MAAM,eAAe,WAAW,YAAY,MAAM,yBAAyB,eAAe,kBAAkB,qBAAqB,IAAI,KAAK,eAAe,2EAA2E,aAAa,SAAS,QAAQ,WAAW,YAAY,cAAc,gBAAgB,gCAAgC,OAAO,yBAAyB,qBAAqB,6BAA6B,qCAAqC,UAAU,iBAAiB,oLAAoL,mBAAmB,6LAA6L,kCAAkC,KAAK,QAAQ,EAAE,wBAAwB,8JAA8J,SAAS,MAAM,mBAAmB,UAAU,qCAAqC,0BAA0B,iCAAiC,gFAAgF,gCAAgC,2CAA2C,gEAAgE,QAAQ,yBAAyB,8BAA8B,KAAK,yCAAyC,8FAA8F,2BAA2B,6HAA6H,mBAAmB,+GAA+G,YAAY,uJAAuJ,iBAAiB,qDAAqD,oCAAoC,gBAAgB,WAAW,MAAM,sDAAsD,uDAAuD,YAAY,kEAAkE,iCAAiC,yCAAyC,iCAAiC,oKAAoK,iCAAiC,sJAAsJ,uCAAuC,qJAAqJ,WAAW,MAAM,WAAW,4BAA4B,4CAA4C,WAAW,oHAAoH,uFAAuF,EAAE,4CAA4C,4BAA4B,KAAK,YAAY,2BAA2B,KAAK,iBAAiB,gCAAgC,oBAAoB,MAAM,iCAAiC,SAAS,+BAA+B,sHAAsH,gBAAgB,oEAAoE,oEAAoE,YAAY,IAAI,uDAAuD,wDAAwD,sBAAsB,4BAA4B,mDAAmD,WAAW,gBAAgB,UAAU,0CAA0C,2FAA2F,uBAAuB,qPAAqP,yBAAyB,8BAA8B,KAAK,+DAA+D,sBAAsB,kHAAkH,sCAAsC,4CAA4C,iGAAiG,iDAAiD,IAAI,0FAA0F,gDAAgD,cAAc,KAAK,2FAA2F,0DAA0D,ihBAAihB,aAAa,gBAAgB,UAAU,0CAA0C,2FAA2F,MAAM,kFAAkF,yDAAyD,iDAAiD,qfAAqf,sDAAsD,iBAAiB,+CAA+C,mLAAmL,qBAAqB,gBAAgB,EAAE,eAAe,sNAAsN,MAAM,cAAc,4kBAA4kB,YAAY,oBAAoB,aAAa,yBAAyB,yIAAyI,oCAAoC,wFAAwF,8CAA8C,sCAAsC,aAAa,IAAI,wBAAwB,wCAAwC,GAAG,uDAAuD,qBAAqB,mBAAmB,cAAc,mBAAmB,2IAA2I,2FAA2F,wCAAwC,0EAA0E,8DAA8D,qCAAqC,wJAAwJ,sCAAsC,iBAAiB,qCAAqC,6FAA6F,4DAA4D,0DAA0D,2OAA2O,2BAA2B,8BAA8B,WAAW,KAAK,wBAAwB,WAAW,KAAK,kJAAkJ,yCAAyC,WAAW,SAAS,mBAAmB,GAAG,KAAK,iBAAiB,mBAAmB,YAAY,8CAA8C,EAAE,yCAAyC,WAAW,mDAAmD,cAAc,iDAAiD,UAAU,0CAA0C,eAAe,iCAAiC,EAAE,iCAAiC,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,kCAAkC,EAAE,sCAAsC,EAAE,iCAAiC,EAAE,2BAA2B,EAAE,6CAA6C,QAAQ,uCAAuC,EAAE,8CAA8C,EAAE,2CAA2C,cAAc,uCAAuC,EAAE,8CAA8C,EAAE,2CAA2C,KAAK,KAAK,4BAA4B,EAAE,4BAA4B,EAAE,qCAAqC,EAAE,+BAA+B,EAAE,sCAAsC,EAAE,oCAAoC,EAAE,gCAAgC,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,kCAAkC,EAAE,kCAAkC,EAAE,gCAAgC,EAAE,2BAA2B,QAAQ,8BAA8B,QAAQ,sBAAsB,EAAE,sBAAsB,EAAE,+CAA+C,GAAG,mBAAmB,iDAAiD,+IAA+I,QAAQ,gHAAgH,+FAA+F,gBAAgB,ubAAub,mBAAmB,oBAAoB,4DAA4D,2HAA2H,oDAAoD,GAAG,IAAI,iBAAiB,mBAAmB,8BAA8B,4DAA4D,4BAA4B,uBAAuB,0BAA0B,oBAAoB,KAAK,4BAA4B,qBAAqB,KAAK,yBAAyB,OAAO,mBAAmB,4BAA4B,2DAA2D,EAAE,gFAAgF,4DAA4D,wBAAwB,gBAAgB,uCAAuC,yDAAyD,EAAE,6BAA6B,4EAA4E,mBAAmB,qGAAqG,mBAAmB,2MAA2M,kCAAkC,gYAAgY,iCAAiC,kOAAkO,wBAAwB,uBAAuB,mIAAmI,gCAAgC,2OAA2O,iCAAiC,sJAAsJ,2BAA2B,mBAAmB,0JAA0J,YAAY,2FAA2F,gDAAgD,8FAA8F,4BAA4B,gJAAgJ,qCAAqC,qEAAqE,sBAAsB,wEAAwE,sBAAsB,sJAAsJ,qCAAqC,+QAA+Q,0BAA0B,+EAA+E,WAAW,MAAM,sDAAsD,0BAA0B,aAAa,4DAA4D,aAAa,2DAA2D,OAAO,iGAAiG,oHAAoH,4FAA4F,WAAW,mCAAmC,sBAAsB,+BAA+B,+DAA+D,QAAQ,KAAK,UAAU,cAAc,kBAAkB,kBAAkB,WAAW,kGAAkG,kBAAkB,WAAW,oGAAoG,kBAAkB,oCAAoC,yBAAyB,YAAY,WAAW,KAAK,iCAAiC,MAAM,yBAAyB,gCAAgC,sCAAsC,uEAAuE,+DAA+D,WAAW,4BAA4B,kBAAkB,EAAE,mBAAmB,iCAAiC,uCAAuC,iCAAiC,8IAA8I,iCAAiC,oGAAoG,iDAAiD,kCAAkC,uBAAuB,4DAA4D,eAAe,WAAW,UAAU,+CAA+C,sCAAsC,uBAAuB,KAAK,UAAU,+CAA+C,6BAA6B,YAAY,WAAW,KAAK,WAAW,yEAAyE,OAAO,2DAA2D,uDAAuD,2MAA2M,WAAW,MAAM,mFAAmF,kTAAkT,sMAAsM,2DAA2D,yFAAyF,kEAAkE,oIAAoI,4PAA4P,mBAAmB,wEAAwE,KAAK,mBAAmB,+GAA+G,uDAAuD,mCAAmC,WAAW,MAAM,WAAW,wBAAwB,gEAAgE,yBAAyB,iEAAiE,YAAY,IAAI,KAAK,6DAA6D,+BAA+B,gBAAgB,KAAK,6EAA6E,uGAAuG,4DAA4D,YAAY,KAAK,IAAI,KAAK,eAAe,iBAAiB,WAAW,wFAAwF,mCAAmC,MAAM,oEAAoE,yFAAyF,YAAY,IAAI,KAAK,eAAe,iBAAiB,WAAW,wFAAwF,mCAAmC,OAAO,SAAS,qCAAqC,yCAAyC,qCAAqC,yCAAyC,6CAA6C,iDAAiD,gDAAgD,oDAAoD,uCAAuC,WAAW,6IAA6I,iBAAiB,8BAA8B,cAAc,gCAAgC,qBAAqB,kDAAkD,iGAAiG,qFAAqF,gBAAgB,WAAW,MAAM,kCAAkC,wCAAwC,wCAAwC,WAAW,8GAA8G,IAAI,yFAAyF,sCAAsC,gBAAgB,yBAAyB,sFAAsF,8JAA8J,uBAAuB,yFAAyF,iDAAiD,eAAe,ooEAAooE,MAAM,cAAc,wzBAAwzB,YAAY,gBAAgB,cAAc,mBAAmB,kIAAkI,kuBAAkuB,oDAAoD,4EAA4E,mEAAmE,KAAK,IAAI,iBAAiB,8BAA8B,GAAG,sCAAsC,iBAAiB,oCAAoC,SAAS,+CAA+C,SAAS,GAAG,SAAS,cAAc,8MAA8M,EAAE,gBAAgB,cAAc,mBAAmB,gGAAgG,SAAS,cAAc,4cAA4c,EAAE,KAAK,iHAAiH,cAAc,mBAAmB,gGAAgG,MAAM,uBAAuB,qBAAqB,kBAAkB,OAAO,wGAAwG,aAAa,eAAe,kBAAkB,+CAA+C,sCAAsC,uBAAuB,yBAAyB,WAAW,kEAAkE,qCAAqC,2DAA2D,uBAAuB,qCAAqC,uBAAuB,8BAA8B,KAAK,2CAA2C,yCAAyC,yDAAyD,oBAAoB,QAAQ,uBAAuB,KAAK,+EAA+E,kGAAkG,QAAQ,sBAAsB,6CAA6C,2CAA2C,yEAAyE,kVAAkV,4CAA4C,mCAAmC,oEAAoE,0CAA0C,mCAAmC,oCAAoC,+BAA+B,0BAA0B,oBAAoB,sBAAsB,KAAK,sBAAsB,iCAAiC,mBAAmB,gCAAgC,oBAAoB,6BAA6B,oBAAoB,UAAU,mCAAmC,kBAAkB,+BAA+B,uHAAuH,8BAA8B,8CAA8C,aAAa,eAAe,kCAAkC,kBAAkB,YAAY,sBAAsB,8BAA8B,SAAS,mCAAmC,qCAAqC,aAAa,0DAA0D,6FAA6F,0BAA0B,gCAAgC,uCAAuC,GAAG,IAAI,mBAAmB,mBAAmB,qCAAqC,KAAK,IAAI,gBAAgB,KAAK,gBAAgB,cAAc,kBAAkB,qBAAqB,gDAAgD,sBAAsB,oFAAoF,+BAA+B,oFAAoF,0CAA0C,mBAAmB,cAAc,iBAAiB,MAAM,eAAe,cAAc,EAAE,gBAAgB,uDAAuD,UAAU,qBAAqB,oBAAoB,QAAQ,EAAE,gBAAgB,2BAA2B,qBAAqB,qBAAqB,kCAAkC,2CAA2C,2BAA2B,qEAAqE,mCAAmC,IAAI,0BAA0B,8BAA8B,IAAI,0BAA0B,eAAe,KAAK,mCAAmC,uBAAuB,iCAAiC,0BAA0B,4HAA4H,mRAAmR,KAAK,+BAA+B,kBAAkB,IAAI,+BAA+B,iBAAiB,OAAO,eAAe,8HAA8H,iDAAiD,eAAe,sDAAsD,mBAAmB,yDAAyD,mBAAmB,iFAAiF,aAAa,kBAAkB,KAAK,yBAAyB,iBAAiB,YAAY,WAAW,yBAAyB,iBAAiB,YAAY,WAAW,0BAA0B,iBAAiB,YAAY,WAAW,wBAAwB,iBAAiB,YAAY,WAAW,yBAAyB,iBAAiB,YAAY,WAAW,0BAA0B,iBAAiB,YAAY,WAAW,0BAA0B,iBAAiB,YAAY,WAAW,2BAA2B,iBAAiB,YAAY,WAAW,0BAA0B,iBAAiB,YAAY,WAAW,2BAA2B,iBAAiB,kDAAkD,mBAAmB,iDAAiD,iBAAiB,+CAA+C,cAAc,mBAAmB,eAAe,4BAA4B,qBAAqB,WAAW,EAAE,0CAA0C,sDAAsD,SAAS,2BAA2B,uDAAuD,wBAAwB,4BAA4B,qBAAqB,yBAAyB,4BAA4B,qBAAqB,wBAAwB,+DAA+D,qBAAqB,yBAAyB,+DAA+D,qBAAqB,sBAAsB,oCAAoC,qBAAqB,uBAAuB,oCAAoC,qBAAqB,wBAAwB,mBAAmB,8KAA8K,gBAAgB,oDAAoD,qDAAqD,sDAAsD,sDAAsD,sDAAsD,oDAAoD,0DAA0D,wCAAwC,yBAAyB,2BAA2B,wBAAwB,wBAAwB,2BAA2B,wBAAwB,kCAAkC,uBAAuB,mDAAmD,aAAa,KAAK,IAAI,EAAE,oDAAoD,eAAe,seAAse,SAAS,sBAAsB,oBAAoB,sBAAsB,iEAAiE,oBAAoB,gCAAgC,eAAe,YAAY,WAAW,4BAA4B,SAAS,+BAA+B,eAAe,YAAY,WAAW,4BAA4B,SAAS,+BAA+B,eAAe,YAAY,WAAW,4BAA4B,SAAS,6BAA6B,eAAe,YAAY,WAAW,0BAA0B,SAAS,8BAA8B,eAAe,YAAY,WAAW,2BAA2B,SAAS,+BAA+B,eAAe,YAAY,WAAW,4BAA4B,SAAS,gCAAgC,eAAe,YAAY,WAAW,6BAA6B,SAAS,+BAA+B,eAAe,YAAY,WAAW,4BAA4B,SAAS,gCAAgC,eAAe,YAAY,WAAW,6BAA6B,SAAS,kBAAkB,UAAU,sBAAsB,yBAAyB,EAAE,yDAAyD,mCAAmC,KAAK,4DAA4D,cAAc,wBAAwB,0BAA0B,qBAAqB,0BAA0B,aAAa,MAAM,oBAAoB,wBAAwB,2CAA2C,mBAAmB,wEAAwE,0BAA0B,qDAAqD,2BAA2B,qDAAqD,0BAA0B,6GAA6G,2BAA2B,6GAA6G,yBAAyB,uCAAuC,QAAQ,oHAAoH,4GAA4G,8BAA8B,oJAAoJ,sBAAsB,eAAe,gDAAgD,mDAAmD,mDAAmD,mDAAmD,mDAAmD,sBAAsB,OAAO,kOAAkO,0BAA0B,kCAAkC,0BAA0B,8BAA8B,yBAAyB,gDAAgD,eAAe,yBAAyB,gBAAgB,WAAW,KAAK,uCAAuC,OAAO,+DAA+D,SAAS,YAAY,qCAAqC,SAAS,oCAAoC,kDAAkD,8IAA8I,SAAS,sBAAsB,iBAAiB,mEAAmE,wBAAwB,6DAA6D,yBAAyB,6DAA6D,wBAAwB,eAAe,oCAAoC,YAAY,IAAI,+BAA+B,+BAA+B,WAAW,eAAe,UAAU,iBAAiB,mEAAmE,8BAA8B,qDAAqD,iCAAiC,2BAA2B,kCAAkC,2BAA2B,kCAAkC,2BAA2B,gCAAgC,2BAA2B,iCAAiC,2BAA2B,kCAAkC,2BAA2B,mCAAmC,2BAA2B,kCAAkC,2BAA2B,mCAAmC,2BAA2B,+BAA+B,8CAA8C,iCAAiC,kDAAkD,kCAAkC,mDAAmD,iCAAiC,kDAAkD,kCAAkC,mDAAmD,gCAAgC,gDAAgD,iCAAiC,iDAAiD,gCAAgC,+CAA+C,+BAA+B,gDAAgD,gCAAgC,iDAAiD,iCAAiC,uCAAuC,SAAS,mBAAmB,4BAA4B,mBAAmB,UAAU,yBAAyB,sEAAsE,QAAQ,oBAAoB,2BAA2B,aAAa,yCAAyC,IAAI,mBAAmB,8MAA8M,6BAA6B,0DAA0D,iGAAiG,oCAAoC,8CAA8C,yBAAyB,SAAS,yBAAyB,sEAAsE,KAAK,kCAAkC,6BAA6B,+CAA+C,oBAAoB,SAAS,sBAAsB,mFAAmF,MAAM,4HAA4H,2FAA2F,oDAAoD,wBAAwB,0EAA0E,uCAAuC,gCAAgC,6DAA6D,yBAAyB,aAAa,kBAAkB,oBAAoB,kDAAkD,uCAAuC,kBAAkB,8FAA8F,YAAY,+BAA+B,cAAc,+PAA+P,yEAAyE,SAAS,GAAG,KAAK,sBAAsB,kDAAkD,gCAAgC,gDAAgD,gCAAgC,6DAA6D,mBAAmB,IAAI,oCAAoC,SAAS,uBAAuB,6CAA6C,OAAO,+DAA+D,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,kEAAkE,QAAQ,eAAe,eAAe,MAAM,qBAAqB,yDAAyD,wBAAwB,qFAAqF,qBAAqB,qBAAqB,WAAW,0BAA0B,gCAAgC,gGAAgG,mCAAmC,yBAAyB,+JAA+J,oCAAoC,qCAAqC,mIAAmI,mCAAmC,uHAAuH,mEAAmE,wHAAwH,qCAAqC,uNAAuN,iCAAiC,qFAAqF,mCAAmC,qFAAqF,yCAAyC,qDAAqD,qCAAqC,wCAAwC,kCAAkC,kEAAkE,sCAAsC,uFAAuF,oDAAoD,mBAAmB,EAAE,uBAAuB,mEAAmE,6IAA6I,iCAAiC,mCAAmC,gCAAgC,uCAAuC,iCAAiC,yJAAyJ,kDAAkD,gBAAgB,uBAAuB,2EAA2E,yCAAyC,uEAAuE,oIAAoI,oDAAoD,kCAAkC,YAAY,QAAQ,kHAAkH,oJAAoJ,4CAA4C,iCAAiC,+CAA+C,2BAA2B,0CAA0C,WAAW,0DAA0D,QAAQ,QAAQ,gBAAgB,QAAQ,KAAK,oBAAoB,8CAA8C,mCAAmC,eAAe,mFAAmF,yCAAyC,6CAA6C,2BAA2B,mEAAmE,wDAAwD,UAAU,aAAa,MAAM,cAAc,UAAU,aAAa,MAAM,cAAc,kKAAkK,IAAI,gBAAgB,IAAI,+BAA+B,kBAAkB,mBAAmB,uBAAuB,yBAAyB,YAAY,WAAW,KAAK,WAAW,uDAAuD,gCAAgC,+BAA+B,iCAAiC,gCAAgC,yBAAyB,4HAA4H,KAAK,UAAU,kBAAkB,2BAA2B,6LAA6L,6BAA6B,kBAAkB,gCAAgC,OAAO,wBAAwB,4EAA4E,SAAS,0CAA0C,uBAAuB,6IAA6I,iBAAiB,WAAW,wCAAwC,oCAAoC,0CAA0C,YAAY,WAAW,KAAK,yCAAyC,WAAW,KAAK,WAAW,iGAAiG,8EAA8E,sCAAsC,2MAA2M,kCAAkC,WAAW,oBAAoB,sBAAsB,2GAA2G,WAAW,uBAAuB,WAAW,KAAK,WAAW,yEAAyE,uCAAuC,WAAW,cAAc,eAAe,WAAW,UAAU,IAAI,wCAAwC,mGAAmG,kFAAkF,IAAI,KAAK,WAAW,SAAS,SAAS,4DAA4D,6BAA6B,qBAAqB,YAAY,WAAW,mCAAmC,SAAS,OAAO,oEAAoE,oDAAoD,WAAW,KAAK,WAAW,yBAAyB,WAAW,oBAAoB,qCAAqC,sBAAsB,WAAW,gCAAgC,yBAAyB,OAAO,yDAAyD,SAAS,oBAAoB,wBAAwB,WAAW,MAAM,WAAW,yCAAyC,SAAS,mCAAmC,kCAAkC,WAAW,wBAAwB,WAAW,MAAM,qBAAqB,SAAS,uBAAuB,wCAAwC,EAAE,QAAQ,0CAA0C,QAAQ,mCAAmC,OAAO,qBAAqB,sBAAsB,qCAAqC,iBAAiB,QAAQ,gFAAgF,yBAAyB,qCAAqC,WAAW,MAAM,uCAAuC,iBAAiB,OAAO,oCAAoC,qBAAqB,eAAe,eAAe,mCAAmC,gBAAgB,WAAW,KAAK,yBAAyB,6BAA6B,oCAAoC,kBAAkB,WAAW,KAAK,6BAA6B,kuBAAkuB,qBAAqB,4CAA4C,0BAA0B,eAAe,cAAc,UAAU,mDAAmD,MAAM,iDAAiD,UAAU,sDAAsD,MAAM,8CAA8C,OAAO,mCAAmC,uBAAuB,MAAM,oBAAoB,oDAAoD,KAAK,gBAAgB,yQAAyQ,WAAW,4EAA4E,4BAA4B,qBAAqB,4CAA4C,MAAM,IAAI,0BAA0B,SAAS,YAAY,WAAW,kPAAkP,YAAY,0BAA0B,yBAAyB,UAAU,WAAW,gDAAgD,oBAAoB,qCAAqC,8CAA8C,iBAAiB,EAAE,+GAA+G,uGAAuG,EAAE,8GAA8G,mCAAmC,2CAA2C,+BAA+B,4CAA4C,wBAAwB,kBAAkB,gCAAgC,GAAG,GAAG,0FAA0F,yBAAyB,4CAA4C,yEAAyE,kPAAkP,WAAW,qCAAqC,YAAY,KAAK,WAAW,KAAK,WAAW,qBAAqB,SAAS,wBAAwB,4BAA4B,iBAAiB,8HAA8H,sCAAsC,WAAW,sGAAsG,gFAAgF,0CAA0C,sEAAsE,+CAA+C,yBAAyB,YAAY,YAAY,WAAW,KAAK,4CAA4C,2MAA2M,SAAS,wDAAwD,qBAAqB,mDAAmD,YAAY,WAAW,8BAA8B,SAAS,2CAA2C,+BAA+B,0DAA0D,yCAAyC,SAAS,aAAa,iCAAiC,SAAS,sDAAsD,iBAAiB,EAAE,qCAAqC,iBAAiB,EAAE,yDAAyD,WAAW,mCAAmC,gBAAgB,gCAAgC,6CAA6C,SAAS,8LAA8L,SAAS,iCAAiC,SAAS,mKAAmK,QAAQ,+HAA+H,uCAAuC,sCAAsC,6BAA6B,oCAAoC,kBAAkB,8BAA8B,oHAAoH,OAAO,sCAAsC,oCAAoC,OAAO,gFAAgF,mOAAmO,YAAY,WAAW,2BAA2B,YAAY,WAAW,2BAA2B,gBAAgB,oFAAoF,yBAAyB,sFAAsF,aAAa,mCAAmC,iCAAiC,sIAAsI,2EAA2E,0BAA0B,iCAAiC,kCAAkC,mCAAmC,IAAI,sBAAsB,SAAS,4BAA4B,SAAS,+FAA+F,eAAe,gCAAgC,iBAAiB,WAAW,KAAK,wDAAwD,6EAA6E,SAAS,KAAK,YAAY,kFAAkF,+BAA+B,mCAAmC,mFAAmF,WAAW,MAAM,WAAW,wBAAwB,uBAAuB,WAAW,KAAK,6BAA6B,sCAAsC,4BAA4B,mBAAmB,4BAA4B,4BAA4B,iBAAiB,UAAU,wCAAwC,UAAU,WAAW,kDAAkD,yBAAyB,oCAAoC,WAAW,yBAAyB,uBAAuB,iBAAiB,4DAA4D,sCAAsC,yBAAyB,WAAW,MAAM,WAAW,8BAA8B,qDAAqD,2CAA2C,6BAA6B,mIAAmI,OAAO,wDAAwD,kEAAkE,gBAAgB,WAAW,yCAAyC,SAAS,yKAAyK;;AAE39yO,mCAAmC,aAAa,cAAc,eAAe,+EAA+E,qBAAqB,sBAAsB,WAAW,MAAM,gBAAgB,aAAa,oCAAoC,MAAM,WAAW,+CAA+C,WAAW,EAAE,cAAc,gCAAgC,WAAW,MAAM,mBAAmB,SAAS,kBAAkB,qBAAqB,sBAAsB,+BAA+B,8BAA8B,OAAO,EAAE,kBAAkB,wBAAwB,yBAAyB,iBAAiB,MAAM,EAAE,6BAA6B,eAAe,gCAAgC,0DAA0D,wBAAwB,OAAO,kBAAkB,yBAAyB,gBAAgB,kBAAkB,SAAS,8BAA8B,oHAAoH,4DAA4D,UAAU,QAAQ,YAAY,aAAa,yBAAyB,cAAc,SAAS,YAAY,aAAa,KAAK,mDAAmD,QAAQ,EAAE,+DAA+D,yCAAyC,gCAAgC,yCAAyC,MAAM,4CAA4C,SAAS,+CAA+C,gCAAgC,qBAAqB,gBAAgB,oBAAoB,kCAAkC,uBAAuB,WAAW,MAAM,WAAW,wBAAwB,sCAAsC,yCAAyC,gBAAgB,WAAW,MAAM,WAAW,+CAA+C,yBAAyB,0BAA0B,YAAY,KAAK,WAAW,KAAK,qBAAqB,6BAA6B,SAAS,4BAA4B,SAAS,+BAA+B,WAAW,MAAM,2BAA2B,uBAAuB,SAAS,0BAA0B,2CAA2C,8BAA8B,EAAE,gDAAgD,6BAA6B,iBAAiB,kDAAkD,6BAA6B,YAAY,oFAAoF,8BAA8B,sCAAsC,0DAA0D,kCAAkC,gBAAgB,sFAAsF,8CAA8C,4BAA4B,mEAAmE,gHAAgH,GAAG,UAAU,cAAc,IAAI,MAAM,wBAAwB,WAAW,iCAAiC,MAAM,KAAK,gBAAgB,qCAAqC,KAAK,MAAM,EAAE,+BAA+B,qBAAqB,gGAAgG,yDAAyD,YAAY,gBAAgB,0CAA0C,6GAA6G,KAAK,mBAAmB,gBAAgB,sBAAsB,kBAAkB,qCAAqC,6CAA6C,WAAW,KAAK,WAAW,qFAAqF,sDAAsD,qCAAqC,YAAY,IAAI,iBAAiB,IAAI,gCAAgC,sBAAsB,gDAAgD,IAAI,OAAO,oCAAoC,sCAAsC,0BAA0B,eAAe,SAAS,EAAE,cAAc,2QAA2Q,iFAAiF,gBAAgB,mBAAmB,oBAAoB,0DAA0D,uBAAuB,WAAW,wCAAwC,IAAI,OAAO,kBAAkB,6GAA6G,4BAA4B,8CAA8C,wBAAwB,sCAAsC,wBAAwB,+CAA+C,sBAAsB,uEAAuE,8CAA8C,+CAA+C,kIAAkI,8CAA8C,+CAA+C,kIAAkI,8NAA8N,oKAAoK,WAAW,MAAM,gEAAgE,WAAW,KAAK,UAAU,MAAM,uDAAuD,YAAY,oOAAoO,iLAAiL,aAAa,WAAW,gBAAgB,4VAA4V,mCAAmC,sCAAsC,wBAAwB,8FAA8F,kBAAkB,+fAA+f,6HAA6H,2FAA2F,wPAAwP,gGAAgG,MAAM,4BAA4B,mIAAmI,uCAAuC,weAAwe,qIAAqI,iGAAiG,0DAA0D,MAAM,6CAA6C,yDAAyD,QAAQ,0EAA0E,EAAE,yBAAyB,yDAAyD,4BAA4B,4PAA4P,gGAAgG,mKAAmK,oBAAoB,OAAO,mTAAmT,wGAAwG,wEAAwE,iBAAiB,WAAW,gCAAgC,aAAa,KAAK,oBAAoB,6rBAA6rB,SAAS,yCAAyC,WAAW,6FAA6F,WAAW,MAAM,0BAA0B,4BAA4B,oEAAoE,WAAW,MAAM,qBAAqB,qCAAqC,uDAAuD,WAAW,MAAM,WAAW,wCAAwC,kDAAkD,WAAW,wBAAwB,WAAW,MAAM,WAAW,qCAAqC,oCAAoC,4BAA4B,wHAAwH,YAAY,gCAAgC,WAAW,KAAK,wBAAwB,MAAM,aAAa,MAAM,qQAAqQ,kBAAkB,gEAAgE,qHAAqH,MAAM,6CAA6C,yDAAyD,QAAQ,kEAAkE,KAAK,SAAS,sCAAsC,qTAAqT,oBAAoB,oBAAoB,WAAW,4BAA4B,KAAK,+BAA+B,aAAa,uBAAuB,aAAa,iBAAiB,yDAAyD,gBAAgB,oBAAoB,mBAAmB,2GAA2G,iBAAiB,oBAAoB,iBAAiB,0CAA0C,IAAI,EAAE,oBAAoB,mBAAmB,YAAY,QAAQ,mBAAmB,2DAA2D,IAAI,EAAE,4BAA4B,4DAA4D,YAAY,SAAS,aAAa,kBAAkB,wBAAwB,iBAAiB,MAAM,wBAAwB,cAAc,EAAE,gBAAgB,qBAAqB,gBAAgB,YAAY,+CAA+C,oDAAoD,UAAU,qBAAqB,gCAAgC,QAAQ,EAAE,gBAAgB,iBAAiB,6BAA6B,qBAAqB,qBAAqB,kCAAkC,2BAA2B,kBAAkB,oYAAoY,gBAAgB,sCAAsC,WAAW,MAAM,sBAAsB,oCAAoC,WAAW,iFAAiF,qFAAqF,oBAAoB,cAAc,IAAI,kCAAkC,sBAAsB,mCAAmC,gBAAgB,kBAAkB,MAAM,4JAA4J,+BAA+B,WAAW,KAAK,mBAAmB,QAAQ,qCAAqC,GAAG,mBAAmB,WAAW,MAAM,kBAAkB,+IAA+I,8JAA8J,yDAAyD,YAAY,MAAM,kDAAkD,kCAAkC,EAAE,0CAA0C,sBAAsB,eAAe,wBAAwB,OAAO,sCAAsC,aAAa,iBAAiB,SAAS,qCAAqC,gBAAgB,WAAW,6GAA6G,2BAA2B,uCAAuC,mBAAmB,yGAAyG,IAAI,6BAA6B,QAAQ,eAAe,wBAAwB,MAAM,gBAAgB,kBAAkB,uFAAuF,gBAAgB,+CAA+C,kBAAkB,8HAA8H,GAAG,EAAE,kBAAkB,gBAAgB,sBAAsB,uEAAuE,kBAAkB,mCAAmC,mBAAmB,8BAA8B,EAAE,+BAA+B,4CAA4C,yCAAyC,qBAAqB,iFAAiF,SAAS,+CAA+C,uBAAuB,qDAAqD,kFAAkF,qBAAqB,iBAAiB,uBAAuB,UAAU,uBAAuB,gBAAgB,GAAG,sCAAsC,iCAAiC,YAAY,WAAW,0CAA0C,oBAAoB,uBAAuB,mFAAmF,gHAAgH,qCAAqC,2BAA2B,qDAAqD,sCAAsC,0BAA0B,2BAA2B,iBAAiB,eAAe,kBAAkB,mCAAmC,+CAA+C,sGAAsG,6BAA6B,oCAAoC,0BAA0B,uBAAuB,OAAO,qEAAqE,cAAc,QAAQ,kBAAkB,qBAAqB,YAAY,WAAW,0BAA0B,SAAS,cAAc,+BAA+B,QAAQ,QAAQ,IAAI,gIAAgI,yBAAyB,SAAS,cAAc,qBAAqB,OAAO,uBAAuB,UAAU,eAAe,sCAAsC,2BAA2B,uBAAuB,2BAA2B,SAAS,6EAA6E,iCAAiC,sBAAsB,0BAA0B,UAAU,QAAQ,mBAAmB,wBAAwB,mEAAmE,kDAAkD,sDAAsD,uHAAuH,SAAS,MAAM,mBAAmB,gBAAgB,mBAAmB,eAAe,gBAAgB,qBAAqB,YAAY,WAAW,oBAAoB,SAAS,gBAAgB,mBAAmB,oBAAoB,sBAAsB,uEAAuE,sIAAsI,oCAAoC,2BAA2B,0CAA0C,WAAW,MAAM,WAAW,sCAAsC,SAAS,0CAA0C,WAAW,MAAM,wBAAwB,WAAW,MAAM,WAAW,oCAAoC,WAAW,SAAS,uCAAuC,2BAA2B,kBAAkB,aAAa,uBAAuB,+FAA+F,gCAAgC,iCAAiC,8CAA8C,gBAAgB,kBAAkB,uCAAuC,gBAAgB,2JAA2J,gCAAgC,mDAAmD,qCAAqC,uBAAuB,iBAAiB,YAAY,WAAW,KAAK,wBAAwB,WAAW,8CAA8C,uBAAuB,qBAAqB,6BAA6B,mCAAmC,sDAAsD,WAAW,uBAAuB,WAAW,KAAK,WAAW,yEAAyE,gBAAgB,6CAA6C,4BAA4B,QAAQ,SAAS,mGAAmG,UAAU,SAAS,EAAE,KAAK,cAAc,8BAA8B,qBAAqB,uDAAuD,iBAAiB,gBAAgB,MAAM,0GAA0G,OAAO,6BAA6B,gBAAgB,QAAQ,WAAW,iDAAiD,aAAa,QAAQ,WAAW,+BAA+B,eAAe,QAAQ,WAAW,8BAA8B,gBAAgB,gBAAgB,oHAAoH,gBAAgB,gEAAgE,2BAA2B,WAAW,6DAA6D,iCAAiC,iEAAiE,qBAAqB,+DAA+D,gBAAgB,mBAAmB,cAAc,kBAAkB,gBAAgB,2DAA2D,IAAI,KAAK,eAAe,0CAA0C,wCAAwC,IAAI,KAAK,sCAAsC,0BAA0B,mDAAmD,+BAA+B,gBAAgB,eAAe,iLAAiL,0DAA0D,+BAA+B,iBAAiB,0BAA0B,yBAAyB,KAAK,IAAI,EAAE,YAAY,8KAA8K,gBAAgB,uBAAuB,wCAAwC,IAAI,EAAE,wBAAwB,WAAW,KAAK,KAAK,WAAW,MAAM,qEAAqE,gBAAgB,mBAAmB,qBAAqB,qBAAqB,2CAA2C,mBAAmB,WAAW,kBAAkB,+BAA+B,gCAAgC,KAAK,SAAS,EAAE,kCAAkC,sBAAsB,KAAK,6DAA6D,KAAK,0BAA0B,yDAAyD,cAAc,4GAA4G,UAAU,6BAA6B,kCAAkC,KAAK,SAAS,EAAE,kCAAkC,sBAAsB,KAAK,6CAA6C,KAAK,8CAA8C,6BAA6B,cAAc,oHAAoH,UAAU,qBAAqB,gBAAgB,eAAe,2BAA2B,0BAA0B,uBAAuB,oHAAoH,YAAY,WAAW,sEAAsE,8DAA8D,eAAe,YAAY,eAAe,YAAY,cAAc,wBAAwB,sDAAsD,wBAAwB,sDAAsD,mBAAmB,kBAAkB,eAAe,6FAA6F,uBAAuB,OAAO,4DAA4D,iBAAiB,6BAA6B,OAAO,iDAAiD,eAAe,OAAO,0CAA0C,wHAAwH,WAAW,eAAe,mFAAmF,eAAe,gBAAgB,mEAAmE,EAAE,eAAe,gBAAgB,eAAe,qEAAqE,qBAAqB,iBAAiB,yBAAyB,SAAS,eAAe,WAAW,eAAe,WAAW,yBAAyB,gBAAgB,iBAAiB,kCAAkC,oCAAoC,0BAA0B,qBAAqB,OAAO,2EAA2E,mBAAmB,0BAA0B,2DAA2D,yDAAyD,WAAW,eAAe,mCAAmC,WAAW,gBAAgB,cAAc,mBAAmB,MAAM,iBAAiB,YAAY,WAAW,8HAA8H,mBAAmB,eAAe,wGAAwG,uBAAuB,qCAAqC,WAAW,eAAe,sCAAsC,uDAAuD,WAAW,kFAAkF,kBAAkB,mCAAmC,KAAK,uBAAuB,6BAA6B,QAAQ,+BAA+B,UAAU,kEAAkE,IAAI,OAAO,6DAA6D,QAAQ,WAAW,KAAK,SAAS,4BAA4B,oCAAoC,iBAAiB,6CAA6C,qBAAqB,oBAAoB,WAAW,KAAK,gCAAgC,0GAA0G,iBAAiB,2BAA2B,oDAAoD,IAAI,MAAM,8BAA8B,gBAAgB,qDAAqD,8DAA8D,qBAAqB,YAAY,WAAW,KAAK,SAAS,2BAA2B,eAAe,gBAAgB,eAAe,qEAAqE,qBAAqB,6BAA6B,iCAAiC,wBAAwB,iBAAiB,WAAW,KAAK,6EAA6E,wBAAwB,qBAAqB,SAAS,+CAA+C,wDAAwD,+CAA+C,uCAAuC,uCAAuC,WAAW,KAAK,SAAS,yCAAyC,aAAa,oCAAoC,QAAQ,WAAW,mCAAmC,SAAS,wMAAwM,uBAAuB,uBAAuB,YAAY,WAAW,MAAM,aAAa,2DAA2D,2BAA2B,gDAAgD,aAAa,MAAM,4EAA4E,2RAA2R,iBAAiB,2JAA2J,eAAe,SAAS,mDAAmD,yBAAyB,YAAY,WAAW,2BAA2B,qBAAqB,+BAA+B,yBAAyB,kBAAkB,+CAA+C,yBAAyB,kBAAkB,+CAA+C,iBAAiB,iBAAiB,WAAW,KAAK,sBAAsB,sEAAsE,8CAA8C,KAAK,YAAY,oBAAoB,iCAAiC,wCAAwC,oBAAoB,KAAK,iBAAiB,uBAAuB,mCAAmC,WAAW,6BAA6B,SAAS,iBAAiB,SAAS,8DAA8D,YAAY,WAAW,kCAAkC,SAAS,iBAAiB,0BAA0B,+BAA+B,QAAQ,oBAAoB,KAAK,0CAA0C,+BAA+B,WAAW,8CAA8C,aAAa,WAAW,KAAK,SAAS,QAAQ,cAAc,2CAA2C,qBAAqB,0BAA0B,yBAAyB,oDAAoD,uBAAuB,2DAA2D,0HAA0H,KAAK,WAAW,KAAK,+BAA+B,oDAAoD,qFAAqF,SAAS,qBAAqB,+BAA+B,6CAA6C,WAAW,iEAAiE,2CAA2C,qDAAqD,WAAW,uCAAuC,uCAAuC,WAAW,KAAK,WAAW,QAAQ,WAAW,6BAA6B,aAAa,mBAAmB,oCAAoC,iBAAiB,uBAAuB,mEAAmE,OAAO,wGAAwG,8CAA8C,yBAAyB,UAAU,+CAA+C,KAAK,iBAAiB,WAAW,sFAAsF,iBAAiB,iCAAiC,IAAI,wCAAwC,8BAA8B,MAAM,MAAM,oBAAoB,sDAAsD,kBAAkB,iBAAiB,oCAAoC,yBAAyB,SAAS,uCAAuC,uHAAuH,oBAAoB,SAAS,4CAA4C,oBAAoB,0BAA0B,uCAAuC,WAAW,IAAI,SAAS,MAAM,aAAa,wLAAwL,gCAAgC,iFAAiF,mGAAmG,yPAAyP,mBAAmB,yBAAyB,iBAAiB,yBAAyB,2CAA2C,8CAA8C,0BAA0B,+BAA+B,oFAAoF,8BAA8B,GAAG,cAAc,SAAS,4FAA4F,SAAS,iBAAiB,UAAU,kBAAkB,uBAAuB,8BAA8B,oCAAoC,iCAAiC,gBAAgB,sBAAsB,+BAA+B,wBAAwB,KAAK,kBAAkB,yJAAyJ,6HAA6H,2BAA2B,iGAAiG,WAAW,KAAK,qBAAqB,6CAA6C,SAAS,2BAA2B,2IAA2I,WAAW,KAAK,mCAAmC,6DAA6D,SAAS,6BAA6B,eAAe,SAAS,yCAAyC,yBAAyB,4HAA4H,aAAa,gPAAgP,uCAAuC,KAAK,uBAAuB,EAAE,4BAA4B,0BAA0B,8BAA8B,SAAS,qCAAqC,oCAAoC,WAAW,KAAK,sBAAsB,wIAAwI,SAAS,wCAAwC,YAAY,WAAW,KAAK,cAAc,iBAAiB,4JAA4J,IAAI,wBAAwB,yEAAyE,wBAAwB,2EAA2E,WAAW,KAAK,WAAW,iBAAiB,SAAS,oFAAoF,sEAAsE,YAAY,WAAW,KAAK,qBAAqB,aAAa,qBAAqB,0FAA0F,2DAA2D,SAAS,2BAA2B,8EAA8E,2BAA2B,uBAAuB,sGAAsG,gDAAgD,6CAA6C,SAAS,EAAE,wCAAwC,uCAAuC,0FAA0F,YAAY,MAAM,4JAA4J,YAAY,iDAAiD,iBAAiB,iCAAiC,aAAa,qDAAqD,mEAAmE,+BAA+B,8BAA8B,2DAA2D,wZAAwZ,sCAAsC,wCAAwC,yBAAyB,iCAAiC,4CAA4C,qDAAqD,sBAAsB,QAAQ,iEAAiE,sOAAsO,mBAAmB,kBAAkB,6CAA6C,iIAAiI,mDAAmD,aAAa,mKAAmK,kCAAkC,WAAW,uDAAuD,0DAA0D,iGAAiG,qBAAqB,uFAAuF,QAAQ,IAAI,mFAAmF,mBAAmB,wBAAwB,SAAS,YAAY,YAAY,SAAS,+CAA+C,uBAAuB,uBAAuB,4DAA4D,WAAW,IAAI,iCAAiC,0HAA0H,sCAAsC,0BAA0B,wEAAwE,uCAAuC,oCAAoC,KAAK,4FAA4F,IAAI,kCAAkC,SAAS,mEAAmE,wCAAwC,mDAAmD,aAAa,OAAO,GAAG,mBAAmB,WAAW,mEAAmE,yBAAyB,oBAAoB,sBAAsB,yBAAyB,8CAA8C,iGAAiG,0BAA0B,6CAA6C,8EAA8E,kHAAkH,8CAA8C,sCAAsC,2CAA2C,yDAAyD,uCAAuC,uDAAuD,0CAA0C,mDAAmD,yCAAyC,yDAAyD,wCAAwC,wDAAwD,yCAAyC,yDAAyD,0CAA0C,mDAAmD,2CAA2C,kGAAkG,8CAA8C,iGAAiG,+CAA+C,IAAI,oCAAoC,SAAS,kBAAkB,gDAAgD,IAAI,6IAA6I,SAAS,kBAAkB,wCAAwC,2BAA2B,2CAA2C,8CAA8C,WAAW,mDAAmD,wDAAwD,gCAAgC,OAAO,qBAAqB,yBAAyB,oFAAoF,mCAAmC,+CAA+C,6DAA6D,+FAA+F,qHAAqH;;AAEjo4C,mCAAmC,aAAa,yCAAyC,cAAc,2rBAA2rB,kEAAkE,yBAAyB,uBAAuB,2BAA2B,IAAI,sBAAsB,SAAS,MAAM,iBAAiB,gCAAgC,8CAA8C,iCAAiC,iFAAiF,kTAAkT,KAAK,YAAY,qCAAqC,kEAAkE,8BAA8B,SAAS,0BAA0B,4CAA4C,8ZAA8Z,wBAAwB,YAAY,yBAAyB,YAAY,0BAA0B,sEAAsE,4DAA4D,kHAAkH,uFAAuF,kCAAkC,kBAAkB,uBAAuB,8CAA8C,oBAAoB,mBAAmB,wBAAwB,8DAA8D,OAAO,uBAAuB,0CAA0C,gDAAgD,wBAAwB,gDAAgD,oEAAoE,cAAc,kBAAkB,YAAY,WAAW,4BAA4B,YAAY,4EAA4E,yBAAyB,4BAA4B,yBAAyB,iBAAiB,yCAAyC,6BAA6B,eAAe,SAAS,IAAI,8BAA8B,YAAY,eAAe,OAAO,EAAE,kFAAkF,SAAS,MAAM,qCAAqC,iBAAiB,gFAAgF,yCAAyC,iBAAiB,uFAAuF,kBAAkB,qFAAqF,2BAA2B,yEAAyE,6CAA6C,KAAK,0BAA0B,gCAAgC,6GAA6G,0BAA0B,8FAA8F,WAAW,6FAA6F,SAAS,2BAA2B,2IAA2I,sBAAsB,4CAA4C,OAAO,2EAA2E,iEAAiE,gBAAgB,mBAAmB,6HAA6H,kGAAkG,uHAAuH,6CAA6C,cAAc,gCAAgC,oBAAoB,kBAAkB,WAAW,wCAAwC,iBAAiB,kBAAkB,WAAW,wEAAwE,qBAAqB,WAAW,oFAAoF,6CAA6C,sBAAsB,mFAAmF,mDAAmD,YAAY,WAAW,uFAAuF,iBAAiB,8CAA8C,cAAc,iBAAiB,oDAAoD,OAAO,4EAA4E,cAAc,gDAAgD,6CAA6C,sIAAsI,kFAAkF,iCAAiC,gGAAgG,yrBAAyrB,kCAAkC,sBAAsB,0XAA0X,yCAAyC,yEAAyE,gCAAgC,gEAAgE,iBAAiB,cAAc,yEAAyE,cAAc,kBAAkB,kCAAkC,mBAAmB,kBAAkB,gCAAgC,mBAAmB,mCAAmC,uCAAuC,8BAA8B,WAAW,MAAM,gCAAgC,mBAAmB,qBAAqB,kCAAkC,sBAAsB,oCAAoC,kBAAkB,qCAAqC,sBAAsB,uBAAuB,0DAA0D,qCAAqC,SAAS,oCAAoC,WAAW,MAAM,WAAW,wBAAwB,2DAA2D,iBAAiB,GAAG,mCAAmC,YAAY,SAAS,WAAW,MAAM,4BAA4B,UAAU,sDAAsD,GAAG,WAAW,qCAAqC,OAAO,gDAAgD,oCAAoC,uBAAuB,uBAAuB,uBAAuB,kBAAkB,qEAAqE,kBAAkB,4CAA4C,oEAAoE,sBAAsB,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,wBAAwB,UAAU,EAAE,UAAU,EAAE,iBAAiB,wBAAwB,QAAQ,EAAE,UAAU,EAAE,iBAAiB,wBAAwB,UAAU,EAAE,UAAU,EAAE,iBAAiB,wBAAwB,QAAQ,EAAE,UAAU,EAAE,iBAAiB,gBAAgB,+BAA+B,yBAAyB,iBAAiB,GAAG,8BAA8B,WAAW,6LAA6L,eAAe,wBAAwB,+IAA+I,4CAA4C,8fAA8f,0BAA0B,YAAY,IAAI,KAAK,YAAY,IAAI,kBAAkB,qBAAqB,IAAI,mBAAmB,QAAQ,IAAI,KAAK,QAAQ,IAAI,kBAAkB,qBAAqB,IAAI,+BAA+B,sBAAsB,uBAAuB,gBAAgB,IAAI,KAAK,sDAAsD,QAAQ,mDAAmD,2BAA2B,YAAY,IAAI,KAAK,KAAK,SAAS,KAAK,iCAAiC,6BAA6B,yFAAyF,0GAA0G,sBAAsB,KAAK,wBAAwB,+HAA+H,4IAA4I,sBAAsB,KAAK,0CAA0C,gFAAgF,UAAU,oBAAoB,0EAA0E,+BAA+B,YAAY,qCAAqC,gBAAgB,kCAAkC,WAAW,MAAM,WAAW,QAAQ,aAAa,GAAG,2BAA2B,oCAAoC,oBAAoB,SAAS,aAAa,EAAE,kBAAkB,6CAA6C,qBAAqB,EAAE,KAAK,wBAAwB,4DAA4D,KAAK,oBAAoB,mFAAmF,uCAAuC,gBAAgB,WAAW,MAAM,eAAe,sBAAsB,wBAAwB,kBAAkB,8BAA8B,GAAG,IAAI,aAAa,qBAAqB,GAAG,eAAe,UAAU,WAAW,YAAY,SAAS,WAAW,MAAM,sCAAsC,eAAe,UAAU,oDAAoD,YAAY,GAAG,sCAAsC,oCAAoC,sFAAsF,gBAAgB,OAAO,YAAY,yHAAyH,OAAO,8BAA8B,mBAAmB,0CAA0C,+CAA+C,sCAAsC,uCAAuC,UAAU,eAAe,MAAM,kCAAkC,iCAAiC,UAAU,WAAW,YAAY,2BAA2B,WAAW,MAAM,WAAW,WAAW,YAAY,GAAG,aAAa,iBAAiB,gDAAgD,2CAA2C,wDAAwD,yCAAyC,OAAO,oEAAoE,wBAAwB,uMAAuM,gBAAgB,cAAc,sIAAsI,8HAA8H,wCAAwC,kCAAkC,sDAAsD,WAAW,wIAAwI,2CAA2C,8EAA8E,sCAAsC,2CAA2C,qCAAqC,yDAAyD,qCAAqC,oEAAoE,eAAe,oBAAoB,uBAAuB,IAAI,GAAG,4BAA4B,uIAAuI,kCAAkC,4BAA4B,kFAAkF,mCAAmC,oBAAoB,+EAA+E,gBAAgB,WAAW,YAAY,kDAAkD,KAAK,kFAAkF,aAAa,KAAK,KAAK,MAAM,8CAA8C,0EAA0E,MAAM,oBAAoB,MAAM,oBAAoB,sBAAsB,6BAA6B,kBAAkB,sDAAsD,OAAO,kEAAkE,uCAAuC,8BAA8B,WAAW,kkBAAkkB,sBAAsB,0EAA0E,+CAA+C,WAAW,KAAK,sCAAsC,0CAA0C,kBAAkB,oBAAoB,iBAAiB,MAAM,mFAAmF,iGAAiG,YAAY,gBAAgB,wEAAwE,iBAAiB,GAAG,sCAAsC,iBAAiB,sCAAsC,eAAe,KAAK,oCAAoC,kIAAkI,+BAA+B,gCAAgC,YAAY,mDAAmD,qBAAqB,oBAAoB,+EAA+E,mIAAmI,4BAA4B,iDAAiD,gCAAgC,0BAA0B,iCAAiC,2CAA2C,kCAAkC,wDAAwD,wEAAwE,uBAAuB,2BAA2B,0FAA0F,6FAA6F,0FAA0F,uBAAuB,mCAAmC,oBAAoB,+JAA+J,qCAAqC,oEAAoE,sCAAsC,oEAAoE,gCAAgC,8BAA8B,0BAA0B,KAAK,6HAA6H,sCAAsC,6LAA6L,kCAAkC,0EAA0E,qCAAqC,gBAAgB,qCAAqC,gBAAgB,qCAAqC,6CAA6C,qCAAqC,6CAA6C,gCAAgC,oBAAoB,iCAAiC,oBAAoB,gCAAgC,oBAAoB,iCAAiC,oBAAoB,gCAAgC,8CAA8C,iCAAiC,uEAAuE,gCAAgC,4BAA4B,uBAAuB,qCAAqC,sBAAsB,qFAAqF,uCAAuC,sIAAsI,kCAAkC,gNAAgN,oCAAoC,gCAAgC,kCAAkC,gCAAgC,gFAAgF,oDAAoD,kBAAkB,oBAAoB,+PAA+P,cAAc,+IAA+I,0BAA0B,0HAA0H,WAAW,qCAAqC,kBAAkB,4DAA4D,wIAAwI,4CAA4C,8BAA8B,2CAA2C,KAAK,GAAG,iCAAiC,8DAA8D,+BAA+B,wBAAwB,kCAAkC,kBAAkB,gBAAgB,oCAAoC,oEAAoE,4QAA4Q,gBAAgB,4QAA4Q,qQAAqQ,mCAAmC,kCAAkC,wCAAwC,qBAAqB,oCAAoC,wDAAwD,wCAAwC,qBAAqB,sCAAsC,SAAS,GAAG,0BAA0B,oBAAoB,mNAAmN,0DAA0D,0HAA0H,WAAW,qCAAqC,kBAAkB,4DAA4D,wIAAwI,4CAA4C,8BAA8B,2CAA2C,KAAK,GAAG,+BAA+B,wBAAwB,kCAAkC,kBAAkB,gBAAgB,iCAAiC,8DAA8D,oCAAoC,sFAAsF,qFAAqF,yDAAyD,iCAAiC,WAAW,sFAAsF,mCAAmC,8EAA8E,aAAa,+BAA+B,aAAa,sPAAsP,GAAG,qCAAqC,qDAAqD,sCAAsC,4DAA4D,sCAAsC,SAAS,GAAG,0BAA0B,oBAAoB,qFAAqF,wCAAwC,+HAA+H,OAAO,kHAAkH,oCAAoC,+EAA+E,qFAAqF,yDAAyD,iCAAiC,WAAW,yFAAyF,2BAA2B,+EAA+E,gGAAgG,4BAA4B,kEAAkE,gBAAgB,qEAAqE,8CAA8C,2HAA2H,iEAAiE,cAAc,2DAA2D,cAAc,qEAAqE,cAAc,oEAAoE,cAAc,6DAA6D,cAAc,wEAAwE,cAAc,oEAAoE,cAAc,6DAA6D,cAAc,IAAI,oCAAoC,0MAA0M,yBAAyB,qBAAqB,GAAG,kBAAkB,oBAAoB,mPAAmP,wJAAwJ,gCAAgC,6BAA6B,uDAAuD,oKAAoK,sBAAsB,qJAAqJ,mBAAmB,0HAA0H,WAAW,qCAAqC,kBAAkB,sCAAsC,iCAAiC,KAAK,OAAO,6CAA6C,mKAAmK,GAAG,+BAA+B,wBAAwB,iCAAiC,WAAW,yDAAyD,kBAAkB,sCAAsC,wCAAwC,OAAO,4CAA4C,kKAAkK,OAAO,2CAA2C,4BAA4B,kCAAkC,0TAA0T,0NAA0N,iBAAiB,oCAAoC,4DAA4D,4MAA4M,kDAAkD,kHAAkH,iBAAiB,mCAAmC,cAAc,oCAAoC,wDAAwD,wCAAwC,mBAAmB,iCAAiC,sDAAsD,8BAA8B,sBAAsB,kCAAkC,kBAAkB,gBAAgB,+BAA+B,EAAE,sCAAsC,SAAS,GAAG,YAAY,uBAAuB,uCAAuC,EAAE,+CAA+C,iBAAiB,mMAAmM,4CAA4C,eAAe,6DAA6D,eAAe,mDAAmD,0MAA0M,kJAAkJ,gDAAgD,8CAA8C,qVAAqV,KAAK,4BAA4B,YAAY,IAAI,mCAAmC,wBAAwB,gBAAgB,WAAW,MAAM,4BAA4B,gGAAgG,gBAAgB,WAAW,MAAM,WAAW,2CAA2C,oIAAoI,iCAAiC,6FAA6F,mBAAmB,oBAAoB,wJAAwJ,0CAA0C,0HAA0H,WAAW,qCAAqC,kBAAkB,gHAAgH,iFAAiF,GAAG,uCAAuC,+EAA+E,4CAA4C,KAAK,+BAA+B,wBAAwB,wCAAwC,mBAAmB,mCAAmC,8DAA8D,+CAA+C,gJAAgJ,wBAAwB,uBAAuB,0GAA0G,EAAE,qYAAqY,2CAA2C,QAAQ,gCAAgC,mDAAmD,sCAAsC,8PAA8P,oBAAoB,iEAAiE,oCAAoC,qGAAqG,uCAAuC,kCAAkC,OAAO,gEAAgE,sCAAsC,SAAS,GAAG,2BAA2B,oBAAoB,yEAAyE,0HAA0H,0BAA0B,aAAa,qBAAqB,WAAW,MAAM,WAAW,mEAAmE,mCAAmC,0GAA0G,mBAAmB,6CAA6C,GAAG,iCAAiC,kBAAkB,+BAA+B,0GAA0G,gCAAgC,mEAAmE,sCAAsC,oYAAoY,oBAAoB,iEAAiE,kCAAkC,OAAO,0DAA0D,sCAAsC,sCAAsC,GAAG,oBAAoB,oBAAoB,2HAA2H,0DAA0D,yBAAyB,EAAE,g1BAAg1B,0HAA0H,kXAAkX,uCAAuC,uBAAuB,kBAAkB,yBAAyB,kCAAkC,mBAAmB,+BAA+B,+DAA+D,iCAAiC,cAAc,gCAAgC,SAAS,kNAAkN,sCAAsC,qaAAqa,oBAAoB,iEAAiE,kCAAkC,OAAO,4CAA4C,sCAAsC,qBAAqB,8CAA8C,qDAAqD,WAAW,MAAM,WAAW,2BAA2B,SAAS,GAAG,SAAS,uEAAuE,sBAAsB,8BAA8B,+EAA+E,uEAAuE,uBAAuB,+CAA+C,WAAW,qBAAqB,WAAW,MAAM,WAAW,QAAQ,uKAAuK,GAAG,mBAAmB,YAAY,KAAK,SAAS,WAAW,MAAM,8DAA8D,6CAA6C,yBAAyB,WAAW,MAAM,WAAW,8DAA8D,SAAS,IAAI,iBAAiB,0BAA0B,4GAA4G,qBAAqB,+EAA+E,gGAAgG,8CAA8C,uBAAuB,uEAAuE,sCAAsC,8EAA8E,6CAA6C,kEAAkE,8TAA8T,SAAS,eAAe,gBAAgB,WAAW,MAAM,wCAAwC,qBAAqB,kBAAkB,iBAAiB,WAAW,gBAAgB,WAAW,oBAAoB,SAAS,iDAAiD,sBAAsB,gDAAgD,+CAA+C,sBAAsB,8FAA8F,sHAAsH,qDAAqD,0CAA0C,oDAAoD,eAAe,qKAAqK,uCAAuC,gEAAgE,oCAAoC,0BAA0B,iCAAiC,2BAA2B,sBAAsB,yCAAyC,WAAW,0NAA0N,4DAA4D,mGAAmG,iHAAiH,OAAO,gDAAgD,iEAAiE,8FAA8F,4CAA4C,8EAA8E,KAAK,WAAW,KAAK,mBAAmB,mDAAmD,sCAAsC,uBAAuB,mCAAmC,oPAAoP,oCAAoC,8EAA8E,KAAK,IAAI,yDAAyD,mEAAmE,6BAA6B,WAAW,KAAK,qIAAqI,4HAA4H,qBAAqB,4FAA4F,0GAA0G,iCAAiC,8EAA8E,wCAAwC,0BAA0B,mBAAmB,0CAA0C,iEAAiE,oEAAoE,wBAAwB,sBAAsB,8BAA8B,wCAAwC,KAAK,4BAA4B,8CAA8C,UAAU,iFAAiF,0CAA0C,6KAA6K,qBAAqB,0CAA0C,8BAA8B,kDAAkD,WAAW,MAAM,WAAW,2DAA2D,mBAAmB,oBAAoB,kCAAkC,6BAA6B,yCAAyC,OAAO,wBAAwB,gDAAgD,eAAe,yEAAyE,6CAA6C,qBAAqB,YAAY,8BAA8B,oCAAoC,uCAAuC,iEAAiE,6CAA6C,2BAA2B,0IAA0I,8BAA8B,4DAA4D,mCAAmC,4BAA4B,+EAA+E,uLAAuL,qCAAqC,eAAe,2BAA2B,EAAE,6CAA6C,qBAAqB,aAAa,uBAAuB,eAAe,WAAW,yPAAyP,kCAAkC,8EAA8E,8BAA8B,iDAAiD,qCAAqC,sBAAsB,sFAAsF,iCAAiC,sBAAsB,gEAAgE,QAAQ,0HAA0H,sBAAsB,yGAAyG,WAAW,mMAAmM,6BAA6B,gDAAgD,qCAAqC,sBAAsB,6DAA6D,6CAA6C,YAAY,yBAAyB,KAAK,gDAAgD,2CAA2C,sDAAsD,YAAY,yBAAyB,KAAK,gDAAgD,iHAAiH,iCAAiC,sBAAsB,gEAAgE,mBAAmB,sDAAsD,4BAA4B,oBAAoB,8BAA8B,mBAAmB,2GAA2G,mBAAmB,gCAAgC,4BAA4B,oBAAoB,8BAA8B,mEAAmE,mBAAmB,gCAAgC,4BAA4B,oBAAoB,8BAA8B,qEAAqE,mBAAmB,4CAA4C,4BAA4B,oBAAoB,8BAA8B,mBAAmB,sHAAsH,mBAAmB,iCAAiC,4BAA4B,oBAAoB,8BAA8B,kEAAkE,mBAAmB,kCAAkC,4BAA4B,oBAAoB,8BAA8B,oEAAoE,mBAAmB,6BAA6B,mCAAmC,4BAA4B,oBAAoB,8BAA8B,mBAAmB,qHAAqH,mBAAmB,eAAe,sBAAsB,sCAAsC,4BAA4B,oBAAoB,8BAA8B,mBAAmB,oGAAoG,mBAAmB,iCAAiC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,uEAAuE,mBAAmB,oCAAoC,4BAA4B,oBAAoB,8BAA8B,mBAAmB,mFAAmF,mBAAmB,iCAAiC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,mEAAmE,mBAAmB,wCAAwC,4BAA4B,oBAAoB,8BAA8B,kEAAkE,mBAAmB,iCAAiC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,yDAAyD,mBAAmB,eAAe,sBAAsB,8BAA8B,4BAA4B,oBAAoB,8BAA8B,mBAAmB,kFAAkF,mBAAmB,sDAAsD,4BAA4B,oBAAoB,8BAA8B,mBAAmB,2GAA2G,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,mEAAmE,mBAAmB,gCAAgC,4BAA4B,oBAAoB,8BAA8B,yDAAyD,kEAAkE,mBAAmB,4CAA4C,4BAA4B,oBAAoB,8BAA8B,sEAAsE,mBAAmB,eAAe,sBAAsB,gEAAgE,4BAA4B,oBAAoB,8BAA8B,mBAAmB,qHAAqH,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,qDAAqD,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,uDAAuD,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,gDAAgD,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,iDAAiD,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,sBAAsB,wDAAwD,mBAAmB,mCAAmC,4BAA4B,oBAAoB,8BAA8B,gIAAgI,mBAAmB,gCAAgC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,sDAAsD,mBAAmB,iCAAiC,4BAA4B,oBAAoB,8BAA8B,qBAAqB,sBAAsB,oEAAoE,qBAAqB,iDAAiD,4BAA4B,qBAAqB,mBAAmB,gBAAgB,gCAAgC,0HAA0H,iCAAiC,sBAAsB,wJAAwJ,iCAAiC,eAAe,GAAG,oBAAoB,aAAa,yBAAyB,0HAA0H,qBAAqB,sBAAsB,4IAA4I,GAAG,wBAAwB,0CAA0C,oDAAoD,oEAAoE,gCAAgC,mDAAmD,sBAAsB,iCAAiC,mEAAmE,uBAAuB,uCAAuC,yEAAyE,6BAA6B,8EAA8E,oBAAoB,gBAAgB,qBAAqB,uBAAuB,qDAAqD,kOAAkO,mBAAmB,w9CAAw9C,6CAA6C,wBAAwB,iDAAiD,0BAA0B,iDAAiD,uCAAuC,kHAAkH,8CAA8C,wBAAwB,gCAAgC,sCAAsC,kLAAkL,uCAAuC,oKAAoK,yCAAyC,kKAAkK,4CAA4C,6BAA6B,uCAAuC,oLAAoL,mBAAmB,kBAAkB,WAAW,oEAAoE,8MAA8M,6BAA6B,qBAAqB,4CAA4C,kEAAkE,qBAAqB,yGAAyG,4HAA4H,sHAAsH,kCAAkC,+DAA+D,+BAA+B,gCAAgC,gCAAgC,0BAA0B,qBAAqB,oDAAoD,SAAS,kCAAkC,oBAAoB,8BAA8B,iBAAiB,+BAA+B,iBAAiB,iCAAiC,6GAA6G,qCAAqC,kCAAkC,qCAAqC,wEAAwE,EAAE,oCAAoC,sEAAsE,EAAE,kCAAkC,gCAAgC,iCAAiC,gGAAgG,+BAA+B,WAAW,+DAA+D,gMAAgM,qDAAqD,EAAE,yCAAyC,kDAAkD,6CAA6C,kCAAkC,EAAE,8CAA8C,yCAAyC,wEAAwE,+BAA+B,8CAA8C,mFAAmF,uCAAuC,qBAAqB,2FAA2F,2CAA2C,wFAAwF,OAAO,gCAAgC,wMAAwM,wCAAwC,wDAAwD,sCAAsC,sCAAsC,WAAW,KAAK,WAAW,8CAA8C,0BAA0B,gBAAgB,gBAAgB,2BAA2B,8IAA8I,oOAAoO,iCAAiC,+BAA+B,qCAAqC,sBAAsB,iCAAiC,4DAA4D,iDAAiD,SAAS,0BAA0B,qBAAqB,uFAAuF,qDAAqD,iIAAiI,wCAAwC,EAAE,gDAAgD,YAAY,iEAAiE,SAAS,8CAA8C,0BAA0B,KAAK,KAAK,oBAAoB,aAAa,qCAAqC,kCAAkC,wDAAwD,yCAAyC,kMAAkM,2BAA2B,wCAAwC,uEAAuE,sBAAsB,SAAS,0BAA0B,qBAAqB,+DAA+D,6FAA6F,0BAA0B,qBAAqB,iCAAiC,gCAAgC,WAAW,uDAAuD,MAAM,4FAA4F,uGAAuG,8FAA8F,sBAAsB,2KAA2K,gDAAgD,4BAA4B,SAAS,uNAAuN,sDAAsD,WAAW,KAAK,gCAAgC,wDAAwD,uCAAuC,gCAAgC,0BAA0B,yCAAyC,qBAAqB,8CAA8C,WAAW,0BAA0B,gDAAgD,YAAY,KAAK,8GAA8G,WAAW,KAAK,mCAAmC,0BAA0B,KAAK,8BAA8B,SAAS,6BAA6B,4DAA4D,gCAAgC,KAAK,gCAAgC,+CAA+C,WAAW,qBAAqB,KAAK,OAAO,gCAAgC,KAAK,KAAK,oBAAoB,kBAAkB,oHAAoH,SAAS,kCAAkC,yBAAyB,cAAc,gFAAgF,iBAAiB,iNAAiN,wCAAwC,WAAW,+CAA+C,WAAW,0EAA0E,2BAA2B,0CAA0C,gDAAgD,MAAM,qCAAqC,qBAAqB,4OAA4O,mCAAmC,2FAA2F,qBAAqB,mCAAmC,uEAAuE,WAAW,KAAK,WAAW,uFAAuF,YAAY,WAAW,KAAK,sMAAsM,yEAAyE,iBAAiB,WAAW,uBAAuB,QAAQ,0CAA0C,IAAI,SAAS,8CAA8C,yDAAyD,0BAA0B,UAAU,WAAW,MAAM,WAAW,6DAA6D,SAAS,sCAAsC,yCAAyC,mDAAmD,qBAAqB,2DAA2D,SAAS,GAAG,YAAY,iBAAiB,8BAA8B,kIAAkI,eAAe,6CAA6C,cAAc,0CAA0C,0CAA0C,qBAAqB,iBAAiB,iBAAiB,SAAS,sCAAsC,wCAAwC,qBAAqB,IAAI,eAAe,YAAY,kCAAkC,WAAW,oBAAoB,YAAY,WAAW,8CAA8C,SAAS,iCAAiC,kBAAkB,qBAAqB,oBAAoB,sBAAsB,4BAA4B,8CAA8C,kCAAkC,6FAA6F,eAAe,uBAAuB,QAAQ,6fAA6f,mBAAmB,QAAQ,mCAAmC,GAAG,mBAAmB,QAAQ,iCAAiC,WAAW,qBAAqB,qBAAqB,mBAAmB,MAAM,6FAA6F,6FAA6F,SAAS,yBAAyB,MAAM,gBAAgB,QAAQ,wDAAwD,4BAA4B,GAAG,wFAAwF,4BAA4B,IAAI,eAAe,YAAY,iBAAiB,mBAAmB,iBAAiB,cAAc,6BAA6B,EAAE,SAAS,IAAI,8CAA8C,6BAA6B,EAAE,yCAAyC,qCAAqC,uCAAuC,iCAAiC,6CAA6C,uCAAuC,yCAAyC,mCAAmC,2CAA2C,qCAAqC,2CAA2C,qCAAqC,mDAAmD,6CAA6C,yCAAyC,mCAAmC,EAAE,QAAQ,MAAM,mBAAmB,MAAM,gBAAgB,QAAQ,uDAAuD,+IAA+I,mDAAmD,2BAA2B,0BAA0B,SAAS,uCAAuC,oBAAoB,mCAAmC,aAAa,gCAAgC,QAAQ,kEAAkE,kBAAkB,oCAAoC,YAAY,WAAW,4CAA4C,gCAAgC,8BAA8B,YAAY,WAAW,yEAAyE,gCAAgC,uEAAuE,kCAAkC,oCAAoC,QAAQ,WAAW,wKAAwK,uJAAuJ,uCAAuC,gFAAgF,0DAA0D,2NAA2N,4CAA4C,GAAG,wPAAwP,4CAA4C,IAAI,aAAa,gCAAgC,kCAAkC,+BAA+B,GAAG,gBAAgB,SAAS,oDAAoD,6BAA6B,GAAG,SAAS,uBAAuB,6CAA6C,8DAA8D,YAAY,kCAAkC,0BAA0B,0LAA0L,mCAAmC,kDAAkD,yCAAyC,mKAAmK,6CAA6C,mKAAmK,mDAAmD,0BAA0B,sDAAsD,6BAA6B,yCAAyC,sDAAsD,SAAS,8CAA8C,cAAc,YAAY,sBAAsB,YAAY,0GAA0G,EAAE,YAAY,yBAAyB,KAAK,oEAAoE,QAAQ,mDAAmD,IAAI,KAAK,OAAO,oBAAoB,MAAM,aAAa,gDAAgD,sBAAsB,6CAA6C,4BAA4B,sDAAsD,YAAY,kBAAkB,iBAAiB,WAAW,MAAM,aAAa,2EAA2E,sCAAsC,+BAA+B,wCAAwC,+BAA+B,4CAA4C,mCAAmC,iDAAiD,oCAAoC,0CAA0C,WAAW,MAAM,WAAW,cAAc,YAAY,UAAU,+CAA+C,kCAAkC,QAAQ,0DAA0D,KAAK,0BAA0B,2CAA2C,WAAW,MAAM,WAAW,iBAAiB,eAAe,UAAU,2DAA2D,kCAAkC,6BAA6B,QAAQ,mDAAmD,MAAM,uDAAuD,+CAA+C,0CAA0C,WAAW,MAAM,WAAW,cAAc,YAAY,UAAU,kGAAkG,0BAA0B,2CAA2C,WAAW,MAAM,WAAW,iBAAiB,eAAe,UAAU,oFAAoF,mDAAmD,wIAAwI,KAAK,gBAAgB,KAAK,KAAK,0BAA0B,sCAAsC,+CAA+C,yEAAyE,+CAA+C,yEAAyE,oDAAoD,sBAAsB,mBAAmB,4DAA4D,kCAAkC,kBAAkB,kCAAkC,kBAAkB,uBAAuB,gBAAgB,qBAAqB,2BAA2B,uBAAuB,4CAA4C,iMAAiM,uBAAuB,4CAA4C,sMAAsM,iBAAiB,oBAAoB,UAAU,WAAW,OAAO,iEAAiE,iBAAiB,4BAA4B,4CAA4C,6BAA6B,oOAAoO,UAAU,kIAAkI,WAAW,KAAK,eAAe,0EAA0E,KAAK,KAAK,gCAAgC,wCAAwC,6JAA6J,qDAAqD,2IAA2I,yBAAyB,iGAAiG,qCAAqC,uLAAuL,kBAAkB,8CAA8C,UAAU,eAAe,MAAM,qBAAqB,8EAA8E,gBAAgB,oDAAoD,iBAAiB,MAAM,yCAAyC,iDAAiD,kBAAkB,sHAAsH,aAAa,kBAAkB,2DAA2D,UAAU,8BAA8B,cAAc,YAAY,8BAA8B,MAAM,mEAAmE,gBAAgB,KAAK,UAAU,mLAAmL,cAAc,wHAAwH,aAAa,kBAAkB,OAAO,gBAAgB,WAAW,MAAM,WAAW,2CAA2C,SAAS,uBAAuB,qDAAqD,iCAAiC,uCAAuC,+BAA+B,uCAAuC,0DAA0D,OAAO,EAAE,8BAA8B,0BAA0B,qDAAqD,+CAA+C,KAAK,UAAU,iEAAiE,kBAAkB,6CAA6C,6CAA6C,4DAA4D,gGAAgG,OAAO,2EAA2E,iBAAiB,YAAY,IAAI,KAAK,eAAe,sCAAsC,mBAAmB,kBAAkB,oFAAoF,kBAAkB,uBAAuB,mSAAmS,mBAAmB,cAAc,mBAAmB,uEAAuE,iDAAiD,6KAA6K,sCAAsC,oBAAoB,EAAE,mDAAmD,0DAA0D,+DAA+D,0DAA0D,wEAAwE,+KAA+K,wDAAwD,mLAAmL,YAAY,WAAW,MAAM,sCAAsC,4BAA4B,KAAK,qCAAqC,eAAe,4CAA4C,kCAAkC,aAAa,cAAc,WAAW,WAAW,UAAU,yHAAyH,aAAa,yBAAyB,QAAQ,OAAO,4BAA4B,+CAA+C,wFAAwF,+CAA+C,WAAW,MAAM,8CAA8C,mFAAmF,YAAY,KAAK,wEAAwE,WAAW,MAAM,mBAAmB,4DAA4D,0CAA0C,oHAAoH,oLAAoL,SAAS,mDAAmD,OAAO,mCAAmC,8DAA8D,uDAAuD,0CAA0C,kCAAkC,KAAK,WAAW,2CAA2C,4CAA4C,gBAAgB,kBAAkB,uFAAuF,2CAA2C,gBAAgB,sHAAsH,4DAA4D,gBAAgB,kBAAkB,8KAA8K,4CAA4C,+EAA+E,gDAAgD,0FAA0F,iCAAiC,uCAAuC,2BAA2B,8EAA8E,iCAAiC,mDAAmD,uBAAuB,yCAAyC,kBAAkB,sFAAsF,kBAAkB,+DAA+D,mBAAmB,6GAA6G,8CAA8C,4CAA4C,+BAA+B,+bAA+b,mEAAmE,sGAAsG,sGAAsG,2DAA2D,kOAAkO,WAAW,MAAM,WAAW,sBAAsB,0FAA0F,+XAA+X,oCAAoC,MAAM,gHAAgH,8OAA8O,mqBAAmqB,mBAAmB,mCAAmC,kBAAkB,0GAA0G,8BAA8B,gCAAgC,qLAAqL,gBAAgB,WAAW,uBAAuB,wBAAwB,wEAAwE,8IAA8I,iDAAiD,YAAY,SAAS,WAAW,MAAM,4BAA4B,qGAAqG,oDAAoD,sPAAsP,uIAAuI,2BAA2B,KAAK,8EAA8E,mEAAmE,+EAA+E,MAAM,6EAA6E,IAAI,6CAA6C,wCAAwC,WAAW,MAAM,WAAW,2DAA2D,MAAM,yBAAyB,sBAAsB,6CAA6C,0DAA0D,kJAAkJ,wBAAwB,MAAM,0LAA0L,oBAAoB,6CAA6C,WAAW,MAAM,oBAAoB,8DAA8D,mrBAAmrB,2CAA2C,qEAAqE,yCAAyC,oEAAoE,sCAAsC,yEAAyE,kCAAkC,gBAAgB,+HAA+H,eAAe,qCAAqC,6CAA6C,+CAA+C,4CAA4C,kBAAkB,qDAAqD,mDAAmD,KAAK,gCAAgC,EAAE,gCAAgC,0FAA0F,2BAA2B,wIAAwI,+BAA+B,kBAAkB,gDAAgD,sCAAsC,gBAAgB,mCAAmC,+BAA+B,EAAE,iFAAiF,6EAA6E,kJAAkJ,2BAA2B,4BAA4B,eAAe,mCAAmC,kDAAkD,4CAA4C,4CAA4C,yBAAyB,gBAAgB,WAAW,MAAM,mBAAmB,yGAAyG,+DAA+D,KAAK,gDAAgD,0EAA0E,OAAO,iGAAiG,0CAA0C,4GAA4G,WAAW,MAAM,WAAW,mBAAmB,yCAAyC,sDAAsD,WAAW,MAAM,WAAW,8EAA8E,gDAAgD,WAAW,kBAAkB,wBAAwB,iCAAiC,6BAA6B,kBAAkB,eAAe,yBAAyB,cAAc,wCAAwC,mCAAmC,oCAAoC,2BAA2B,gBAAgB,WAAW,+DAA+D,mBAAmB,YAAY,wCAAwC,oEAAoE,qFAAqF,iFAAiF,gCAAgC,WAAW,MAAM,oBAAoB,8EAA8E,EAAE,2CAA2C,2BAA2B,sBAAsB,2CAA2C,WAAW,6DAA6D,KAAK,mCAAmC,0CAA0C,gCAAgC,WAAW,MAAM,WAAW,iEAAiE,4EAA4E,uFAAuF,qDAAqD,gFAAgF,WAAW,MAAM,WAAW,iDAAiD,6CAA6C,SAAS,2BAA2B,sBAAsB,mGAAmG,UAAU,kBAAkB,oBAAoB,yFAAyF,sCAAsC,8BAA8B,+CAA+C,cAAc,oBAAoB,gBAAgB,WAAW,MAAM,4BAA4B,2KAA2K,yCAAyC,4CAA4C,SAAS,mCAAmC,SAAS,wDAAwD,qBAAqB,wDAAwD,qCAAqC,GAAG,2QAA2Q,gBAAgB,WAAW,iBAAiB,yPAAyP,oCAAoC,wEAAwE,WAAW,wEAAwE,qIAAqI,6BAA6B,yDAAyD,iCAAiC,MAAM,oBAAoB,+CAA+C,mBAAmB,yCAAyC,GAAG,gIAAgI,WAAW,iBAAiB,uCAAuC,iBAAiB,GAAG,oDAAoD,gBAAgB,kBAAkB,WAAW,yCAAyC,kBAAkB,yDAAyD,0BAA0B,+CAA+C,GAAG,oCAAoC,WAAW,iBAAiB,uCAAuC,iBAAiB,sBAAsB,4BAA4B,GAAG,iCAAiC,WAAW,qCAAqC,qFAAqF,YAAY,EAAE,yBAAyB,0CAA0C,aAAa,UAAU,cAAc,6BAA6B,gBAAgB,sFAAsF,iBAAiB,EAAE,sBAAsB,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,QAAQ,4BAA4B,YAAY,oEAAoE,kBAAkB,uEAAuE,kBAAkB,GAAG,mDAAmD,iCAAiC,yDAAyD,wDAAwD,iBAAiB,IAAI,qEAAqE,iCAAiC,8BAA8B,YAAY,kBAAkB,gBAAgB,WAAW,MAAM,WAAW,wCAAwC,OAAO,SAAS,qBAAqB,gJAAgJ,iBAAiB,0CAA0C,wCAAwC,kCAAkC,MAAM,oBAAoB,MAAM,oBAAoB,uNAAuN,+BAA+B,0BAA0B,qDAAqD,0EAA0E,qCAAqC,0CAA0C,WAAW,yBAAyB,gCAAgC,EAAE,uCAAuC,mDAAmD,gFAAgF,sEAAsE,SAAS,qCAAqC,8DAA8D,gCAAgC,iBAAiB,kBAAkB,0EAA0E,sFAAsF,8BAA8B,sEAAsE,0EAA0E,mFAAmF,iBAAiB,IAAI,4DAA4D,0BAA0B,WAAW,MAAM,6BAA6B,uFAAuF,0CAA0C,+CAA+C,0CAA0C,6CAA6C,GAAG,sCAAsC,uCAAuC,uBAAuB,wBAAwB,6BAA6B,kCAAkC,WAAW,4DAA4D,mCAAmC,gDAAgD,yBAAyB,EAAE,yBAAyB,2BAA2B,yBAAyB,EAAE,kEAAkE,iBAAiB,kBAAkB,6BAA6B,2DAA2D,uBAAuB,oCAAoC,6GAA6G,8DAA8D,iBAAiB,IAAI,kCAAkC,qCAAqC,qCAAqC,sGAAsG,+DAA+D,iBAAiB,IAAI,uCAAuC,WAAW,+GAA+G,kJAAkJ,uIAAuI,wEAAwE,uDAAuD,gDAAgD,OAAO,2DAA2D,uCAAuC,sCAAsC,wGAAwG,2KAA2K,2BAA2B,sFAAsF,uDAAuD,8FAA8F,gDAAgD,kFAAkF,mCAAmC,8DAA8D,sCAAsC,oBAAoB,WAAW,+GAA+G,0FAA0F,SAAS,wDAAwD,cAAc,KAAK,sBAAsB,gDAAgD,OAAO,MAAM,EAAE,kDAAkD,yGAAyG,KAAK,4GAA4G,6BAA6B,oKAAoK,wBAAwB,qCAAqC,yDAAyD,UAAU,6BAA6B,wBAAwB,kDAAkD,+JAA+J,yHAAyH,qCAAqC,oBAAoB,sBAAsB,MAAM,yBAAyB,6BAA6B,qLAAqL,2HAA2H,kCAAkC,uBAAuB,+CAA+C,oBAAoB,uBAAuB,iOAAiO,qCAAqC,oBAAoB,uBAAuB,MAAM,4MAA4M,4HAA4H,mCAAmC,wCAAwC,+CAA+C,oBAAoB,uBAAuB,+MAA+M,6CAA6C,6CAA6C,8CAA8C,oBAAoB,uBAAuB,MAAM,2CAA2C,6DAA6D,2JAA2J,0HAA0H,4CAA4C,4CAA4C,sCAAsC,iBAAiB,qBAAqB,8CAA8C,kCAAkC,WAAW,uBAAuB,gYAAgY,qBAAqB,qCAAqC,gCAAgC,EAAE,aAAa,kBAAkB,EAAE,sCAAsC,wKAAwK,kDAAkD,oCAAoC,KAAK,qCAAqC,WAAW,MAAM,cAAc,qBAAqB,WAAW,MAAM,WAAW,YAAY,SAAS,mDAAmD,4FAA4F,SAAS,gBAAgB,oHAAoH,uBAAuB,WAAW,MAAM,6BAA6B,kJAAkJ,iBAAiB,SAAS,oHAAoH,kDAAkD,YAAY,mEAAmE,WAAW,MAAM,WAAW,cAAc,WAAW,qBAAqB,6HAA6H,gBAAgB,2BAA2B,qBAAqB,yBAAyB,MAAM,gCAAgC,mCAAmC,qCAAqC,EAAE,gBAAgB,WAAW,MAAM,WAAW,qBAAqB,SAAS,WAAW,SAAS,SAAS,6HAA6H,+CAA+C,0FAA0F,2BAA2B,uBAAuB,+CAA+C,wBAAwB,WAAW,KAAK,WAAW,KAAK,oCAAoC,4CAA4C,SAAS,SAAS,2CAA2C,kLAAkL,6BAA6B,kBAAkB,iCAAiC,6BAA6B,kCAAkC,oBAAoB,iCAAiC,4CAA4C,KAAK,MAAM,MAAM,OAAO,iCAAiC,qBAAqB,8BAA8B,yDAAyD,2CAA2C,sEAAsE,2DAA2D,MAAM,gCAAgC,8HAA8H,0BAA0B,sCAAsC,mCAAmC,uCAAuC,6DAA6D,wCAAwC,+DAA+D,gDAAgD,sDAAsD,8CAA8C,sBAAsB,mBAAmB,WAAW,MAAM,6BAA6B,sBAAsB,iBAAiB,kCAAkC,iDAAiD,wBAAwB,qBAAqB,uFAAuF,GAAG,qEAAqE,SAAS,yDAAyD,8BAA8B,4fAA4f,WAAW,MAAM,6BAA6B,uEAAuE,gFAAgF,uCAAuC,wCAAwC,uCAAuC,yCAAyC,GAAG,YAAY,6BAA6B,aAAa,gCAAgC,SAAS,kEAAkE,wBAAwB,uCAAuC,OAAO,SAAS,sDAAsD,mNAAmN,qaAAqa,4CAA4C,oCAAoC,iDAAiD,GAAG,oDAAoD,8CAA8C,sEAAsE,GAAG,wRAAwR,yHAAyH,GAAG,kIAAkI,oDAAoD,GAAG,kIAAkI,2EAA2E,2EAA2E,wCAAwC,GAAG,ivBAAivB,qIAAqI,kEAAkE,GAAG,IAAI,aAAa,qCAAqC,0BAA0B,iBAAiB,yCAAyC,4DAA4D,WAAW,uCAAuC,0BAA0B,iBAAiB,iDAAiD,GAAG,IAAI,oBAAoB,4CAA4C,8BAA8B,8BAA8B,8BAA8B,yBAAyB,sBAAsB,0BAA0B,8BAA8B,yBAAyB,uBAAuB,iBAAiB,0CAA0C,yFAAyF,4CAA4C,8CAA8C,4FAA4F,6CAA6C,8DAA8D,4DAA4D,WAAW,wCAAwC,gCAAgC,gCAAgC,mCAAmC,mCAAmC,0BAA0B,0BAA0B,uCAAuC,yBAAyB,yBAAyB,uBAAuB,iBAAiB,iDAAiD,yIAAyI,uIAAuI,GAAG,IAAI,SAAS,oWAAoW,iBAAiB,uZAAuZ,6CAA6C,4CAA4C,yDAAyD,kFAAkF,2KAA2K,gGAAgG,4DAA4D,WAAW,wCAAwC,gCAAgC,gCAAgC,+BAA+B,kDAAkD,yBAAyB,wVAAwV,qBAAqB,yfAAyf,+IAA+I,6BAA6B,+CAA+C,iCAAiC,qFAAqF,WAAW,OAAO,sUAAsU,0IAA0I,WAAW,iEAAiE,OAAO,OAAO,6DAA6D,mCAAmC,kHAAkH,WAAW,OAAO,oGAAoG,WAAW,OAAO,8TAA8T,2DAA2D,GAAG,IAAI,eAAe,6BAA6B,+BAA+B,GAAG,uCAAuC,0BAA0B,iBAAiB,iDAAiD,GAAG,IAAI,UAAU,6FAA6F,yBAAyB,4GAA4G,uLAAuL,6DAA6D,gDAAgD,4DAA4D,WAAW,kIAAkI,gCAAgC,0BAA0B,4BAA4B,yBAAyB,2BAA2B,kFAAkF,sLAAsL,gHAAgH,oPAAoP,gyBAAgyB,qFAAqF,4JAA4J,2JAA2J,qCAAqC,GAAG,IAAI,iBAAiB,0CAA0C,iCAAiC,0BAA0B,qBAAqB,iBAAiB,4CAA4C,yDAAyD,uCAAuC,4DAA4D,WAAW,wCAAwC,uBAAuB,uBAAuB,qBAAqB,iBAAiB,2DAA2D,0BAA0B,8BAA8B,GAAG,IAAI,eAAe,yCAAyC,0BAA0B,iBAAiB,0BAA0B,4FAA4F,2EAA2E,0DAA0D,OAAO,8BAA8B,wEAAwE,OAAO,GAAG,qCAAqC,8BAA8B,2BAA2B,0BAA0B,0BAA0B,+BAA+B,4CAA4C,2BAA2B,0BAA0B,iBAAiB,gEAAgE,+DAA+D,sOAAsO,uDAAuD,kGAAkG,8BAA8B,6BAA6B,GAAG,IAAI,kBAAkB,iDAAiD,2BAA2B,0BAA0B,yBAAyB,yBAAyB,+BAA+B,iBAAiB,wBAAwB,0FAA0F,2EAA2E,mDAAmD,OAAO,8BAA8B,iEAAiE,OAAO,6DAA6D,sEAAsE,4EAA4E,qDAAqD,8DAA8D,0EAA0E,yCAAyC,GAAG,uCAAuC,8BAA8B,2BAA2B,0BAA0B,0BAA0B,+BAA+B,4CAA4C,2BAA2B,0BAA0B,yBAAyB,2BAA2B,+BAA+B,iBAAiB,gEAAgE,+DAA+D,wOAAwO,uDAAuD,yCAAyC,iLAAiL,8BAA8B,6BAA6B,kCAAkC,yJAAyJ,oGAAoG,GAAG,IAAI,QAAQ,2CAA2C,iBAAiB,6BAA6B,GAAG,uCAAuC,0BAA0B,iBAAiB,iDAAiD,GAAG,IAAI,OAAO,mHAAmH,2IAA2I,4DAA4D,WAAW,uCAAuC,0BAA0B,uGAAuG,uJAAuJ,GAAG,IAAI,cAAc,iIAAiI,iBAAiB,iKAAiK,qDAAqD,uDAAuD,4DAA4D,WAAW,uCAAuC,0BAA0B,uBAAuB,uBAAuB,+GAA+G,+JAA+J,qEAAqE,GAAG,IAAI,qBAAqB,4CAA4C,8BAA8B,8BAA8B,8BAA8B,yBAAyB,sBAAsB,8BAA8B,yBAAyB,uBAAuB,qBAAqB,8DAA8D,+FAA+F,yFAAyF,4CAA4C,8CAA8C,4FAA4F,6CAA6C,gHAAgH,qDAAqD,sEAAsE,4DAA4D,WAAW,wCAAwC,uBAAuB,gCAAgC,gCAAgC,mCAAmC,mCAAmC,0BAA0B,0BAA0B,uCAAuC,yBAAyB,yBAAyB,uBAAuB,qBAAqB,8DAA8D,sGAAsG,yIAAyI,uIAAuI,uEAAuE,GAAG,IAAI,cAAc,4CAA4C,8BAA8B,8BAA8B,8BAA8B,yBAAyB,sBAAsB,8BAA8B,yBAAyB,uBAAuB,8DAA8D,+FAA+F,yFAAyF,4CAA4C,8CAA8C,4FAA4F,6CAA6C,4DAA4D,4DAA4D,WAAW,wCAAwC,gCAAgC,gCAAgC,mCAAmC,mCAAmC,0BAA0B,0BAA0B,uCAAuC,yBAAyB,yBAAyB,uBAAuB,8DAA8D,sGAAsG,yIAAyI,uIAAuI,GAAG,IAAI,gBAAgB,qCAAqC,4IAA4I,kLAAkL,4DAA4D,WAAW,wCAAwC,4BAA4B,+BAA+B,sCAAsC,yBAAyB,6BAA6B,yBAAyB,gJAAgJ,yLAAyL,8BAA8B,gCAAgC,qCAAqC,yEAAyE,qJAAqJ,2CAA2C,+HAA+H,4BAA4B,mLAAmL,uSAAuS,iFAAiF,mHAAmH,OAAO,2WAA2W,2GAA2G,2GAA2G,GAAG,IAAI,uBAAuB,4CAA4C,8BAA8B,8BAA8B,8BAA8B,yBAAyB,sBAAsB,8BAA8B,yBAAyB,uBAAuB,0BAA0B,qGAAqG,8IAA8I,yFAAyF,4CAA4C,8CAA8C,4FAA4F,6CAA6C,qDAAqD,+CAA+C,4DAA4D,WAAW,wCAAwC,gCAAgC,gCAAgC,mCAAmC,mCAAmC,0BAA0B,0BAA0B,uCAAuC,gCAAgC,8BAA8B,+BAA+B,sCAAsC,yBAAyB,6BAA6B,yBAAyB,uBAAuB,0BAA0B,8BAA8B,qGAAqG,wIAAwI,yCAAyC,8BAA8B,gCAAgC,qCAAqC,wCAAwC,mDAAmD,kKAAkK,yJAAyJ,qIAAqI,8CAA8C,6EAA6E,mGAAmG,8BAA8B,mHAAmH,OAAO,sHAAsH,GAAG,IAAI,mBAAmB,0CAA0C,0BAA0B,qBAAqB,iBAAiB,2DAA2D,4DAA4D,WAAW,wCAAwC,uBAAuB,uBAAuB,qBAAqB,iBAAiB,2DAA2D,0BAA0B,8BAA8B,GAAG,IAAI,mBAAmB,oDAAoD,sCAAsC,qBAAqB,2BAA2B,uBAAuB,0BAA0B,gDAAgD,sGAAsG,sEAAsE,GAAG,iBAAiB,uCAAuC,kYAAkY,+DAA+D,uEAAuE,+DAA+D,yCAAyC,8DAA8D,uEAAuE,8DAA8D,sEAAsE,w1BAAw1B,6LAA6L,sIAAsI,4DAA4D,WAAW,wCAAwC,yBAAyB,+BAA+B,uBAAuB,iBAAiB,iDAAiD,oDAAoD,GAAG,IAAI,YAAY,0CAA0C,qBAAqB,4BAA4B,uBAAuB,wBAAwB,2BAA2B,wBAAwB,iDAAiD,6CAA6C,8CAA8C,8RAA8R,iIAAiI,wGAAwG,oCAAoC,0WAA0W,8YAA8Y,gCAAgC,yHAAyH,4PAA4P,qUAAqU,uEAAuE,iHAAiH,wEAAwE,4DAA4D,WAAW,wCAAwC,yBAAyB,+BAA+B,uBAAuB,iBAAiB,iDAAiD,qCAAqC,GAAG,IAAI,OAAO,oKAAoK,wBAAwB,8BAA8B,iBAAiB,4QAA4Q,sPAAsP,iGAAiG,iDAAiD,4DAA4D,WAAW,6iBAA6iB,wBAAwB,0BAA0B,gCAAgC,oCAAoC,0BAA0B,wBAAwB,8BAA8B,kCAAkC,oRAAoR,4VAA4V,mDAAmD,sEAAsE,mCAAmC,+JAA+J,wBAAwB,mLAAmL,oCAAoC,6BAA6B,uEAAuE,wFAAwF,iKAAiK,gWAAgW,qCAAqC,uFAAuF,2EAA2E,2FAA2F,kJAAkJ,kHAAkH,2FAA2F,uCAAuC,GAAG,IAAI,eAAe,iIAAiI,0BAA0B,wBAAwB,8BAA8B,qCAAqC,iBAAiB,2NAA2N,sPAAsP,iGAAiG,6NAA6N,iDAAiD,4DAA4D,WAAW,ypBAAypB,wBAAwB,0BAA0B,gCAAgC,oCAAoC,0BAA0B,wBAAwB,8BAA8B,qCAAqC,2OAA2O,2SAA2S,mDAAmD,6FAA6F,mCAAmC,+JAA+J,wBAAwB,mLAAmL,oCAAoC,6BAA6B,uEAAuE,wFAAwF,iKAAiK,gWAAgW,qCAAqC,uFAAuF,2EAA2E,2FAA2F,kJAAkJ,kHAAkH,2FAA2F,uCAAuC,GAAG,IAAI,cAAc,8CAA8C,gCAAgC,8BAA8B,8BAA8B,8BAA8B,8BAA8B,yBAAyB,uBAAuB,8BAA8B,0BAA0B,wBAAwB,4BAA4B,8BAA8B,sGAAsG,2NAA2N,sPAAsP,iGAAiG,+DAA+D,6DAA6D,+gBAA+gB,qHAAqH,+FAA+F,+FAA+F,uFAAuF,+CAA+C,4DAA4D,WAAW,yuBAAyuB,wBAAwB,0BAA0B,gCAAgC,oCAAoC,0BAA0B,wBAAwB,4BAA4B,8BAA8B,2OAA2O,2SAA2S,mDAAmD,0FAA0F,mCAAmC,+JAA+J,wBAAwB,mLAAmL,oCAAoC,6BAA6B,uEAAuE,wFAAwF,iKAAiK,gWAAgW,qCAAqC,uFAAuF,2EAA2E,2FAA2F,kJAAkJ,kHAAkH,2FAA2F,kCAAkC,qCAAqC,GAAG,IAAI,UAAU,4CAA4C,2BAA2B,sBAAsB,0BAA0B,wBAAwB,uBAAuB,uBAAuB,8BAA8B,yOAAyO,sXAAsX,sPAAsP,iGAAiG,wDAAwD,sDAAsD,uDAAuD,iGAAiG,iDAAiD,4DAA4D,WAAW,yuBAAyuB,wBAAwB,0BAA0B,gCAAgC,gCAAgC,0BAA0B,gCAAgC,0BAA0B,oCAAoC,0BAA0B,wBAAwB,uBAAuB,uBAAuB,8BAA8B,kUAAkU,kZAAkZ,mDAAmD,0FAA0F,mCAAmC,+JAA+J,wBAAwB,mLAAmL,oCAAoC,6BAA6B,uEAAuE,wFAAwF,gKAAgK,gWAAgW,qCAAqC,uFAAuF,2EAA2E,2FAA2F,kJAAkJ,kHAAkH,2FAA2F,iHAAiH,+GAA+G,uCAAuC,GAAG,IAAI,SAAS,uCAAuC,0BAA0B,6BAA6B,6BAA6B,sBAAsB,sBAAsB,mCAAmC,kCAAkC,sCAAsC,kCAAkC,8BAA8B,iBAAiB,oHAAoH,gDAAgD,2BAA2B,6CAA6C,OAAO,2BAA2B,6CAA6C,OAAO,iDAAiD,2BAA2B,2BAA2B,sJAAsJ,+EAA+E,mDAAmD,qEAAqE,wGAAwG,qFAAqF,gFAAgF,4DAA4D,WAAW,wCAAwC,2BAA2B,+BAA+B,+BAA+B,yBAAyB,+BAA+B,wBAAwB,sBAAsB,iBAAiB,iDAAiD,8eAA8e,uDAAuD,GAAG,IAAI,aAAa,4CAA4C,oEAAoE,+BAA+B,iBAAiB,uGAAuG,yDAAyD,4DAA4D,WAAW,qDAAqD,gCAAgC,wBAAwB,iCAAiC,iCAAiC,yCAAyC,0CAA0C,+BAA+B,yGAAyG,sGAAsG,8BAA8B,+BAA+B,qCAAqC,8BAA8B,uEAAuE,oCAAoC,iCAAiC,2BAA2B,gCAAgC,2BAA2B,uBAAuB,+BAA+B,iBAAiB,wFAAwF,sCAAsC,+BAA+B,8BAA8B,wDAAwD,mBAAmB,oEAAoE,4DAA4D,OAAO,mEAAmE,kCAAkC,OAAO,mEAAmE,wBAAwB,OAAO,OAAO,wBAAwB,OAAO,2DAA2D,+DAA+D,oOAAoO,+LAA+L,kCAAkC,yDAAyD,0CAA0C,4BAA4B,8HAA8H,0DAA0D,oEAAoE,4EAA4E,OAAO,qEAAqE,mEAAmE,qFAAqF,uFAAuF,6IAA6I,kCAAkC,yDAAyD,iFAAiF,yEAAyE,GAAG,IAAI,YAAY,0GAA0G,kQAAkQ,oCAAoC,yBAAyB,yBAAyB,uBAAuB,iBAAiB,wSAAwS,oCAAoC,6BAA6B,sCAAsC,yDAAyD,qCAAqC,mEAAmE,+CAA+C,sBAAsB,6BAA6B,yFAAyF,yDAAyD,OAAO,sDAAsD,qDAAqD,qFAAqF,gEAAgE,4DAA4D,WAAW,qDAAqD,gCAAgC,wBAAwB,iCAAiC,iCAAiC,iFAAiF,UAAU,yHAAyH,UAAU,+LAA+L,0CAA0C,+BAA+B,yGAAyG,kTAAkT,oCAAoC,iCAAiC,2BAA2B,gCAAgC,8BAA8B,+BAA+B,qCAAqC,kDAAkD,8BAA8B,2BAA2B,yBAAyB,uBAAuB,iBAAiB,+SAA+S,sCAAsC,+BAA+B,8BAA8B,wDAAwD,iBAAiB,sEAAsE,4DAA4D,OAAO,mEAAmE,kCAAkC,OAAO,mEAAmE,wBAAwB,OAAO,OAAO,wBAAwB,OAAO,2DAA2D,+DAA+D,oqBAAoqB,mLAAmL,kCAAkC,yDAAyD,0CAA0C,4BAA4B,4VAA4V,0DAA0D,oEAAoE,4EAA4E,OAAO,qEAAqE,mEAAmE,qFAAqF,uFAAuF,6IAA6I,wCAAwC,qCAAqC,yDAAyD,iFAAiF,0FAA0F,qCAAqC,mEAAmE,GAAG,KAAK,sEAAsE,iBAAiB,iEAAiE,sFAAsF,qCAAqC,2EAA2E,YAAY,+DAA+D,gCAAgC,sFAAsF,gCAAgC,4BAA4B,qCAAqC,6FAA6F,yCAAyC,sFAAsF,gCAAgC,qCAAqC,yGAAyG,yCAAyC,YAAY,IAAI,wBAAwB,+BAA+B,WAAW,+BAA+B,sFAAsF,sCAAsC,GAAG,wKAAwK,sEAAsE,sCAAsC,sEAAsE,qCAAqC,WAAW,mDAAmD,yHAAyH,kBAAkB,YAAY,qBAAqB,KAAK,wCAAwC,uEAAuE,oEAAoE,IAAI,KAAK,yCAAyC,wEAAwE,uBAAuB,YAAY,WAAW,KAAK,WAAW,gCAAgC,+BAA+B,0BAA0B,8BAA8B,WAAW,KAAK,2BAA2B,QAAQ,+HAA+H,sBAAsB,uBAAuB,wFAAwF,qGAAqG,YAAY,WAAW,KAAK,2CAA2C,MAAM,yCAAyC,MAAM,oKAAoK,mFAAmF,kWAAkW,8CAA8C,wBAAwB,mDAAmD,WAAW,MAAM,+BAA+B,EAAE,yKAAyK,oEAAoE,iCAAiC,8HAA8H,oEAAoE,gBAAgB,WAAW,MAAM,2CAA2C,MAAM,sBAAsB,+BAA+B,0FAA0F,uFAAuF,sBAAsB,0MAA0M,KAAK,sFAAsF,uKAAuK,mFAAmF,uGAAuG,sVAAsV,2BAA2B,iCAAiC,6IAA6I,sHAAsH,4LAA4L,+EAA+E,6NAA6N,+BAA+B,qCAAqC,MAAM,6HAA6H,kIAAkI,aAAa,qBAAqB,iKAAiK,+BAA+B,6FAA6F,SAAS,qCAAqC,MAAM,gIAAgI,8CAA8C,iNAAiN,WAAW,uFAAuF,gLAAgL,yDAAyD,0CAA0C,gHAAgH,gjBAAgjB,6GAA6G,yIAAyI,gCAAgC,wBAAwB,sBAAsB,wHAAwH,4EAA4E,qBAAqB,eAAe,0EAA0E,aAAa,oBAAoB,6FAA6F,sNAAsN,yDAAyD,qVAAqV,oBAAoB,mBAAmB,8EAA8E,2JAA2J,sHAAsH,uBAAuB,2DAA2D,WAAW,MAAM,2CAA2C,mFAAmF,2BAA2B,uDAAuD,qIAAqI,2BAA2B,iKAAiK,6JAA6J,6BAA6B,gCAAgC,gGAAgG,sBAAsB,oGAAoG,sBAAsB,kKAAkK,mEAAmE,2BAA2B,wLAAwL,kDAAkD,sBAAsB,KAAK,kBAAkB,qGAAqG,+LAA+L,gGAAgG,+EAA+E,wBAAwB,gCAAgC,+JAA+J,kFAAkF,mBAAmB,+BAA+B,MAAM,4FAA4F,iBAAiB,oEAAoE,sKAAsK,QAAQ,oBAAoB,mEAAmE,oFAAoF,aAAa,yMAAyM,4CAA4C,iDAAiD,+CAA+C,oDAAoD,4CAA4C,yLAAyL,KAAK,2BAA2B,8EAA8E,mBAAmB,uBAAuB,uBAAuB,0CAA0C,oJAAoJ,mBAAmB,YAAY,eAAe,qCAAqC,oCAAoC,eAAe,+CAA+C,gCAAgC,YAAY,OAAO,eAAe,2BAA2B,SAAS,oGAAoG,+DAA+D,sBAAsB,0FAA0F,uCAAuC,sNAAsN,2BAA2B,wGAAwG,uBAAuB,0CAA0C,QAAQ,kGAAkG,0CAA0C,gIAAgI,0EAA0E,kBAAkB,EAAE,iBAAiB,OAAO,iBAAiB,mBAAmB,uBAAuB,sCAAsC,0CAA0C,kRAAkR,4BAA4B,OAAO,yBAAyB,mBAAmB,IAAI,mBAAmB,6BAA6B,IAAI,kGAAkG,QAAQ,EAAE,WAAW,SAAS,6CAA6C,WAAW,gCAAgC,yCAAyC,gEAAgE,iIAAiI,WAAW,KAAK,WAAW,sHAAsH,uHAAuH,QAAQ,u8DAAu8D,o3IAAo3I,yNAAyN,sUAAsU,QAAQ,yBAAyB,iCAAiC,gBAAgB,qlBAAqlB,+BAA+B,YAAY,0BAA0B,iCAAiC,gHAAgH,kEAAkE,uBAAuB,+HAA+H,iBAAiB,WAAW,KAAK,2CAA2C,MAAM,6FAA6F,mDAAmD,sBAAsB,qOAAqO,2CAA2C,+BAA+B,6CAA6C,qHAAqH,sOAAsO,2BAA2B,qEAAqE,uBAAuB,oGAAoG,WAAW,2EAA2E,mBAAmB,8FAA8F,KAAK,wBAAwB,iWAAiW,WAAW,0UAA0U,YAAY,iBAAiB,8BAA8B,8EAA8E,iBAAiB,WAAW,KAAK,WAAW,8BAA8B,oCAAoC,MAAM,iHAAiH,wDAAwD,OAAO,oQAAoQ,wCAAwC,oGAAoG,sCAAsC,MAAM,oHAAoH,yBAAyB,mHAAmH,sEAAsE,6GAA6G,sBAAsB,0PAA0P,QAAQ,wBAAwB,gFAAgF,gBAAgB,iGAAiG,8JAA8J,WAAW,MAAM,2CAA2C,MAAM,oIAAoI,sCAAsC,sBAAsB,wDAAwD,wBAAwB,8DAA8D,wBAAwB,gBAAgB,2CAA2C,2HAA2H,kUAAkU,oCAAoC,4EAA4E,eAAe,yCAAyC,iEAAiE,eAAe,wCAAwC,SAAS,2HAA2H,uGAAuG,QAAQ,oCAAoC,8BAA8B,gIAAgI,MAAM,qBAAqB,WAAW,MAAM,2CAA2C,8BAA8B,gDAAgD,sBAAsB,MAAM,0DAA0D,mSAAmS,kBAAkB,8OAA8O,OAAO,6BAA6B,6DAA6D,wCAAwC,+HAA+H,gBAAgB,WAAW,MAAM,0BAA0B,uGAAuG,yCAAyC,0BAA0B,oEAAoE,oEAAoE,wdAAwd,eAAe,gCAAgC,iEAAiE,mJAAmJ,6CAA6C,WAAW,MAAM,WAAW,0HAA0H,wEAAwE,yGAAyG,+BAA+B,8CAA8C,olBAAolB,qBAAqB,sEAAsE,6IAA6I,KAAK,2BAA2B,+EAA+E,4BAA4B,0EAA0E,UAAU,iIAAiI,qBAAqB,MAAM,+JAA+J,kBAAkB,sGAAsG,qIAAqI,oCAAoC,+BAA+B,WAAW,EAAE,WAAW,MAAM,WAAW,OAAO,oBAAoB,gKAAgK,uBAAuB,YAAY,WAAW,mBAAmB,kBAAkB,6DAA6D,wNAAwN,iBAAiB,gBAAgB,QAAQ,SAAS,OAAO,+EAA+E,uBAAuB,iEAAiE,+EAA+E,QAAQ,SAAS,sDAAsD,IAAI,KAAK,8FAA8F,kCAAkC,yBAAyB,oCAAoC,oHAAoH,kCAAkC,sBAAsB,uKAAuK,WAAW,MAAM,WAAW,gCAAgC,yEAAyE,+BAA+B,oCAAoC,wOAAwO,qBAAqB,gNAAgN,8BAA8B,kQAAkQ,qBAAqB,4JAA4J,sCAAsC,0BAA0B,iFAAiF,qBAAqB,8BAA8B,sBAAsB,gHAAgH,sCAAsC,mIAAmI,mDAAmD,0BAA0B,wDAAwD,QAAQ,6BAA6B,gBAAgB,WAAW,MAAM,kDAAkD,yBAAyB,qBAAqB,iCAAiC,sCAAsC,wLAAwL,iDAAiD,sBAAsB,eAAe,sBAAsB,6DAA6D,gDAAgD,sBAAsB,gCAAgC,qFAAqF,8DAA8D,mDAAmD,4FAA4F,iDAAiD,mCAAmC,WAAW,kNAAkN,8BAA8B,8BAA8B,6EAA6E,uEAAuE,gBAAgB,WAAW,eAAe,+BAA+B,0EAA0E,MAAM,WAAW,KAAK,QAAQ,uBAAuB,qGAAqG,2CAA2C,oBAAoB,eAAe,oBAAoB,4BAA4B,WAAW,2BAA2B,YAAY,WAAW,KAAK,4BAA4B,kMAAkM,2DAA2D,gFAAgF,uJAAuJ,WAAW,mDAAmD,qBAAqB,qBAAqB,yCAAyC,mMAAmM,8BAA8B,WAAW,0CAA0C,2BAA2B,qBAAqB,yCAAyC,+MAA+M,oCAAoC,uEAAuE,gDAAgD,yDAAyD,mBAAmB,oGAAoG,4CAA4C,wGAAwG,qDAAqD,yBAAyB,gFAAgF,MAAM,gCAAgC,iCAAiC,6GAA6G,iCAAiC,0CAA0C,oCAAoC,+CAA+C,yCAAyC,4BAA4B,kCAAkC,iDAAiD,0BAA0B,yEAAyE,6GAA6G,uCAAuC,qEAAqE,8CAA8C,sFAAsF,mSAAmS,iCAAiC,KAAK,SAAS,gBAAgB,UAAU,gBAAgB,oBAAoB,gBAAgB,YAAY,gBAAgB,cAAc,gBAAgB,OAAO,gBAAgB,UAAU,gBAAgB,QAAQ,gBAAgB,MAAM,gBAAgB,OAAO,gBAAgB,SAAS,gBAAgB,aAAa,gBAAgB,IAAI,gBAAgB,IAAI,gBAAgB,QAAQ,kBAAkB,8BAA8B,kEAAkE,qPAAqP,2BAA2B,qBAAqB,4BAA4B,sEAAsE,2BAA2B,qBAAqB,4BAA4B,sEAAsE,qCAAqC,+BAA+B,sCAAsC,4DAA4D,6BAA6B,gCAAgC,+BAA+B,yBAAyB,wBAAwB,+CAA+C,2BAA2B,8BAA8B,4BAA4B,sCAAsC,uKAAuK,yBAAyB,+BAA+B,0BAA0B,kCAAkC,2EAA2E,uBAAuB,6BAA6B,wBAAwB,kHAAkH,wBAAwB,kBAAkB,yBAAyB,sDAAsD,sLAAsL,0BAA0B,oBAAoB,2BAA2B,iIAAiI,4CAA4C,8FAA8F,yDAAyD,wLAAwL,uCAAuC,KAAK,8CAA8C,SAAS,wCAAwC,oCAAoC,4CAA4C,+CAA+C,uFAAuF,yBAAyB,mBAAmB,gBAAgB,kBAAkB,YAAY,sBAAsB,IAAI,mGAAmG,wFAAwF,YAAY,EAAE,mSAAmS,+CAA+C,EAAE,mCAAmC,mGAAmG,8BAA8B,wBAAwB,oCAAoC,qBAAqB,oCAAoC,4BAA4B,kCAAkC,0DAA0D,oCAAoC,4CAA4C,qBAAqB,kCAAkC,qBAAqB,kCAAkC,yBAAyB,sCAAsC,+BAA+B,iCAAiC,+BAA+B,uFAAuF,+BAA+B,gCAAgC,+BAA+B,+BAA+B,yDAAyD,+CAA+C,2EAA2E,mIAAmI,wCAAwC,wDAAwD,wCAAwC,wDAAwD,6CAA6C,uHAAuH,6CAA6C,0BAA0B,+EAA+E,4CAA4C,8BAA8B,oCAAoC,4FAA4F,8FAA8F,0GAA0G,0CAA0C,6EAA6E,mFAAmF,+CAA+C,mBAAmB,iEAAiE,oBAAoB,wHAAwH,6KAA6K,oCAAoC,8DAA8D,sBAAsB,mEAAmE,kBAAkB,oBAAoB,2DAA2D,kBAAkB,oBAAoB,2DAA2D,0BAA0B,uKAAuK,kBAAkB,qBAAqB,+BAA+B,kBAAkB,qBAAqB,+BAA+B,0JAA0J,uCAAuC,gBAAgB,iEAAiE,0NAA0N,sNAAsN,2FAA2F,0CAA0C,+JAA+J,qUAAqU,iDAAiD,kCAAkC,6CAA6C,qCAAqC,sHAAsH,6EAA6E,0CAA0C,kBAAkB,cAAc,uIAAuI,qCAAqC,YAAY,qBAAqB,IAAI,+BAA+B,gIAAgI,gCAAgC,0KAA0K,wCAAwC,qPAAqP,kHAAkH,uCAAuC,yDAAyD,uCAAuC,oEAAoE,MAAM,gDAAgD,2BAA2B,+DAA+D,mBAAmB,oBAAoB,iBAAiB,EAAE,4DAA4D,wBAAwB,iCAAiC,8CAA8C,uFAAuF,OAAO,kBAAkB,kBAAkB,6CAA6C,2BAA2B,mCAAmC,8BAA8B,0CAA0C,yBAAyB,kBAAkB,+DAA+D,sBAAsB,+BAA+B,8BAA8B,wCAAwC,eAAe,oDAAoD,6BAA6B,uFAAuF,OAAO,kBAAkB,kBAAkB,6CAA6C,2BAA2B,mCAAmC,8BAA8B,0CAA0C,yBAAyB,kBAAkB,eAAe,gBAAgB,6BAA6B,uFAAuF,OAAO,kBAAkB,kBAAkB,6CAA6C,2BAA2B,mCAAmC,8BAA8B,0CAA0C,yBAAyB,2IAA2I,kCAAkC,sBAAsB,kCAAkC,qBAAqB,iCAAiC,gFAAgF,iCAAiC,sCAAsC,kCAAkC,qBAAqB,yHAAyH,6dAA6d,qCAAqC,iFAAiF,iCAAiC,gBAAgB,wIAAwI,gBAAgB,2CAA2C,gBAAgB,0DAA0D,6BAA6B,8OAA8O,wCAAwC,WAAW,uCAAuC,0BAA0B,oBAAoB,sHAAsH,8BAA8B,8EAA8E,gLAAgL,SAAS,yBAAyB,2EAA2E,gJAAgJ,kCAAkC,wFAAwF,mCAAmC,sCAAsC,mCAAmC,iEAAiE,mCAAmC,gCAAgC,sCAAsC,gCAAgC,yBAAyB,SAAS,2CAA2C,aAAa,mBAAmB,uIAAuI,uBAAuB,uBAAuB,kCAAkC,IAAI,mBAAmB,0IAA0I,kCAAkC,sBAAsB,kCAAkC,qBAAqB,gCAAgC,sCAAsC,iCAAiC,sCAAsC,sCAAsC,+TAA+T,uCAAuC,8CAA8C,gKAAgK,oFAAoF,uHAAuH,qCAAqC,iBAAiB,sHAAsH,gHAAgH,UAAU,iCAAiC,gCAAgC,KAAK,qCAAqC,qEAAqE,iCAAiC,0VAA0V,uCAAuC,qCAAqC,gBAAgB,IAAI,4CAA4C,sQAAsQ,kCAAkC,+BAA+B,kCAAkC,6BAA6B,gCAAgC,2CAA2C,iCAAiC,wCAAwC,iLAAiL,MAAM,oDAAoD,MAAM,iCAAiC,sCAAsC,4BAA4B,2BAA2B,iFAAiF,KAAK,0CAA0C,qBAAqB,mFAAmF,WAAW,mSAAmS,uCAAuC,+SAA+S,sCAAsC,mBAAmB,0BAA0B,MAAM,mJAAmJ,0QAA0Q,qCAAqC,4DAA4D,+GAA+G,MAAM,qDAAqD,kCAAkC,oBAAoB,sLAAsL,MAAM,qDAAqD,iCAAiC,sEAAsE,WAAW,uIAAuI,qCAAqC,qIAAqI,0CAA0C,WAAW,0DAA0D,8DAA8D,yCAAyC,eAAe,EAAE,gBAAgB,6EAA6E,kBAAkB,KAAK,kHAAkH,iBAAiB,0BAA0B,eAAe,YAAY,8GAA8G,wCAAwC,EAAE,gBAAgB,GAAG,WAAW,uCAAuC,uCAAuC,gBAAgB,GAAG,GAAG,6CAA6C,kCAAkC,0BAA0B,aAAa,yCAAyC,qJAAqJ,kCAAkC,+BAA+B,kCAAkC,6BAA6B,gCAAgC,6FAA6F,iCAAiC,6FAA6F,4HAA4H,MAAM,oDAAoD,MAAM,iCAAiC,sCAAsC,4HAA4H,WAAW,qFAAqF,uCAAuC,+GAA+G,sBAAsB,uFAAuF,iCAAiC,4JAA4J,kCAAkC,4UAA4U,sCAAsC,mBAAmB,0BAA0B,MAAM,0BAA0B,gLAAgL,qCAAqC,4CAA4C,4GAA4G,MAAM,qDAAqD,sCAAsC,oBAAoB,0FAA0F,MAAM,qDAAqD,kCAAkC,oBAAoB,+HAA+H,MAAM,qDAAqD,iCAAiC,mEAAmE,sBAAsB,2IAA2I,WAAW,4HAA4H,qCAAqC,sJAAsJ,uCAAuC,wDAAwD,oBAAoB,2CAA2C,KAAK,8DAA8D,yDAAyD,KAAK,6BAA6B,oCAAoC,2BAA2B,mBAAmB,wCAAwC,EAAE,gBAAgB,KAAK,uCAAuC,uCAAuC,gBAAgB,GAAG,GAAG,6CAA6C,kCAAkC,0BAA0B,aAAa,mBAAmB,6EAA6E,eAAe,eAAe,kCAAkC,sBAAsB,gCAAgC,8FAA8F,iCAAiC,8FAA8F,qCAAqC,sCAAsC,wBAAwB,kBAAkB,uCAAuC,MAAM,gCAAgC,MAAM,kDAAkD,MAAM,gDAAgD,MAAM,iDAAiD,MAAM,iDAAiD,MAAM,eAAe,iCAAiC,qLAAqL,YAAY,gBAAgB,KAAK,mBAAmB,2DAA2D,kCAAkC,sBAAsB,kCAAkC,qBAAqB,gCAAgC,sCAAsC,iCAAiC,sCAAsC,uCAAuC,WAAW,oJAAoJ,gBAAgB,SAAS,qCAAqC,oEAAoE,gCAAgC,8HAA8H,gBAAgB,KAAK,oCAAoC,2DAA2D,0CAA0C,mGAAmG,kCAAkC,sBAAsB,iCAAiC,uIAAuI,iCAAiC,8FAA8F,yCAAyC,2BAA2B,wCAAwC,2BAA2B,kCAAkC,2CAA2C,4EAA4E,oIAAoI,WAAW,kEAAkE,6CAA6C,uFAAuF,OAAO,0IAA0I,kCAAkC,yBAAyB,+DAA+D,yBAAyB,wBAAwB,0JAA0J,gBAAgB,2CAA2C,gBAAgB,sBAAsB,6HAA6H,uCAAuC,mBAAmB,0BAA0B,MAAM,0BAA0B,0EAA0E,+HAA+H,8IAA8I,mCAAmC,sCAAsC,mCAAmC,kEAAkE,iCAAiC,mEAAmE,WAAW,mEAAmE,6CAA6C,+LAA+L,oCAAoC,gBAAgB,8BAA8B,gCAAgC,8BAA8B,EAAE,gBAAgB,EAAE,KAAK,0HAA0H,iBAAiB,cAAc,kCAAkC,2CAA2C,qBAAqB,kGAAkG,EAAE,gBAAgB,GAAG,qBAAqB,EAAE,gBAAgB,KAAK,6CAA6C,kCAAkC,0BAA0B,aAAa,QAAQ,qGAAqG,mBAAmB,gBAAgB,yIAAyI,+HAA+H,6BAA6B,qCAAqC,oBAAoB,SAAS,IAAI,mCAAmC,oFAAoF,SAAS,OAAO,mCAAmC,6BAA6B,SAAS,OAAO,gCAAgC,2BAA2B,mCAAmC,oBAAoB,OAAO,SAAS,oCAAoC,6BAA6B,OAAO,OAAO,kCAAkC,8CAA8C,mCAAmC,8CAA8C,mCAAmC,8BAA8B,sCAAsC,oBAAoB,UAAU,SAAS,sCAAsC,6BAA6B,UAAU,OAAO,sCAAsC,iCAAiC,aAAa,YAAY,uCAAuC,+EAA+E,iCAAiC,4BAA4B,oCAAoC,oBAAoB,QAAQ,SAAS,uCAAuC,gCAAgC,SAAS,8BAA8B,6CAA6C,cAAc,gBAAgB,WAAW,gCAAgC,2DAA2D,sBAAsB,gKAAgK,eAAe,oKAAoK,6CAA6C,qMAAqM,6QAA6Q,kCAAkC,YAAY,oCAAoC,moBAAmoB,kCAAkC,WAAW,8BAA8B,wCAAwC,6BAA6B,mRAAmR,yBAAyB,gEAAgE,2NAA2N,oJAAoJ,KAAK,2HAA2H,wDAAwD,sBAAsB,YAAY,2DAA2D,uBAAuB,oCAAoC,SAAS,wCAAwC,8NAA8N,yCAAyC,uLAAuL,oCAAoC,sDAAsD,kOAAkO,iCAAiC,WAAW,wBAAwB,gDAAgD,IAAI,mUAAmU,yBAAyB,gGAAgG,kBAAkB,gFAAgF,oBAAoB,UAAU,cAAc,iDAAiD,oCAAoC,cAAc,mCAAmC,cAAc,mCAAmC,yBAAyB,qBAAqB,eAAe,6CAA6C,OAAO,cAAc,mCAAmC,8CAA8C,eAAe,yCAAyC,SAAS,eAAe,yBAAyB,yCAAyC,KAAK,kDAAkD,oBAAoB,yKAAyK,mBAAmB,wGAAwG,+CAA+C,6EAA6E,YAAY,uBAAuB,SAAS,iCAAiC,0BAA0B,6BAA6B,sIAAsI,sBAAsB,qCAAqC,YAAY,mCAAmC,qMAAqM,6CAA6C,uEAAuE,sIAAsI,6CAA6C,qBAAqB,oBAAoB,qEAAqE,0CAA0C,qBAAqB,qCAAqC,yBAAyB,iCAAiC,GAAG,2BAA2B,iBAAiB,sFAAsF,2CAA2C,qBAAqB,gCAAgC,yCAAyC,uXAAuX,kCAAkC,mLAAmL,yCAAyC,qBAAqB,2EAA2E,QAAQ,kCAAkC,EAAE,4BAA4B,EAAE,wCAAwC,EAAE,MAAM,+BAA+B,+DAA+D,MAAM,qGAAqG,sCAAsC,uFAAuF,6CAA6C,oBAAoB,SAAS,+BAA+B,iCAAiC,2CAA2C,mCAAmC,gBAAgB,uBAAuB,kEAAkE,qBAAqB,yBAAyB,4BAA4B,cAAc,WAAW,mCAAmC,SAAS,2LAA2L,wCAAwC,yJAAyJ,kBAAkB,kCAAkC,+BAA+B,4DAA4D,yCAAyC,wPAAwP,kCAAkC,wEAAwE,4CAA4C,oBAAoB,sCAAsC,uGAAuG,uCAAuC,oBAAoB,mCAAmC,gBAAgB,yCAAyC,WAAW,kBAAkB,uEAAuE,6BAA6B,iBAAiB,yBAAyB,6BAA6B,IAAI,iCAAiC,2EAA2E,WAAW,MAAM,WAAW,yCAAyC,6BAA6B,yCAAyC,eAAe,gBAAgB,WAAW,MAAM,WAAW,oDAAoD,4CAA4C,+BAA+B,4DAA4D,+DAA+D,2YAA2Y,gBAAgB,cAAc,uBAAuB,8GAA8G,sDAAsD,8cAA8c,yBAAyB,0CAA0C,gBAAgB,OAAO,aAAa,OAAO,OAAO,+BAA+B,qDAAqD,gEAAgE,mBAAmB,KAAK,8GAA8G,6BAA6B,mdAAmd,yCAAyC,2EAA2E,4CAA4C,gCAAgC,+CAA+C,KAAK,8BAA8B,iQAAiQ,6CAA6C,8BAA8B,oFAAoF,+CAA+C,oDAAoD,gCAAgC,SAAS,gBAAgB,yCAAyC,+CAA+C,gCAAgC,SAAS,gBAAgB,wCAAwC,gDAAgD,+BAA+B,iMAAiM,EAAE,WAAW,+CAA+C,iCAAiC,EAAE,WAAW,8CAA8C,gCAAgC,iDAAiD,mCAAmC,2CAA2C,6BAA6B,8CAA8C,6BAA6B,+DAA+D,iDAAiD,8BAA8B,oEAAoE,2CAA2C,0BAA0B,uDAAuD,EAAE,WAAW,GAAG,sGAAsG,4DAA4D,gDAAgD,oDAAoD,uHAAuH,+DAA+D,2EAA2E,uFAAuF,OAAO,oBAAoB,gBAAgB,qBAAqB,gBAAgB,wBAAwB,gBAAgB,UAAU,gBAAgB,WAAW,kBAAkB,4CAA4C,yFAAyF,gDAAgD,oFAAoF,uCAAuC,6BAA6B,gCAAgC,gDAAgD,kNAAkN,kCAAkC,0JAA0J,0NAA0N,qCAAqC,4PAA4P,sCAAsC,MAAM,mBAAmB,kJAAkJ,yFAAyF,YAAY,oCAAoC,uIAAuI,gFAAgF,mCAAmC,8BAA8B,oCAAoC,kIAAkI,oEAAoE,6CAA6C,wCAAwC,8CAA8C,8DAA8D,mCAAmC,8BAA8B,iCAAiC,kDAAkD,mCAAmC,4DAA4D,iCAAiC,qGAAqG,kCAAkC,iDAAiD,mCAAmC,kDAAkD,gCAAgC,aAAa,mDAAmD,iBAAiB,sCAAsC,SAAS,OAAO,8BAA8B,sBAAsB,qDAAqD,WAAW,KAAK,uDAAuD,WAAW,UAAU,qBAAqB,SAAS,qCAAqC,SAAS,OAAO,8BAA8B,sBAAsB,gDAAgD,WAAW,mEAAmE,sBAAsB,oDAAoD,OAAO,kCAAkC,kBAAkB,qDAAqD,WAAW,KAAK,wDAAwD,KAAK,GAAG,kEAAkE,oIAAoI,YAAY,iCAAiC,oDAAoD,mGAAmG,WAAW,KAAK,WAAW,gCAAgC,oDAAoD,2BAA2B,YAAY,iDAAiD,MAAM,iKAAiK,+DAA+D,8FAA8F,4CAA4C,aAAa,mKAAmK,4BAA4B,KAAK,4DAA4D,kFAAkF,OAAO,6CAA6C,sCAAsC,GAAG,+CAA+C,2CAA2C,oCAAoC,yFAAyF,qDAAqD,SAAS,8GAA8G,2GAA2G,oCAAoC,iBAAiB,iGAAiG,iCAAiC,4CAA4C,sCAAsC,wFAAwF,qCAAqC,uDAAuD,wCAAwC,6CAA6C,gCAAgC,8EAA8E,uCAAuC,0CAA0C,gBAAgB,kBAAkB,gBAAgB,WAAW,qDAAqD,SAAS,2CAA2C,uCAAuC,sCAAsC,wDAAwD,mCAAmC,+BAA+B,sCAAsC,iBAAiB,EAAE,mBAAmB,kBAAkB,YAAY,uCAAuC,sDAAsD,uBAAuB,sBAAsB,iBAAiB,uBAAuB,GAAG,KAAK,yRAAyR,kCAAkC,uBAAuB,sBAAsB,iBAAiB,gCAAgC,IAAI,kCAAkC,2GAA2G,qCAAqC,2BAA2B,qCAAqC,8DAA8D,oCAAoC,sDAAsD,qCAAqC,uDAAuD,qCAAqC,uDAAuD,kCAAkC,8BAA8B,qCAAqC,uDAAuD,+CAA+C,iEAAiE,mCAAmC,+BAA+B,8CAA8C,gEAAgE,4CAA4C,wCAAwC,+CAA+C,iEAAiE,6CAA6C,yCAAyC,kCAAkC,oDAAoD,iCAAiC,6BAA6B,qCAAqC,uBAAuB,2CAA2C,6BAA6B,kCAAkC,oBAAoB,6CAA6C,YAAY,uGAAuG,wCAAwC,sBAAsB,0IAA0I,0EAA0E,oYAAoY,kCAAkC,8BAA8B,wGAAwG,0EAA0E,2CAA2C,GAAG,yCAAyC,oCAAoC,iHAAiH,sCAAsC,gBAAgB,kHAAkH,iHAAiH,8GAA8G,sCAAsC,8HAA8H,gBAAgB,IAAI,0CAA0C,gGAAgG,gBAAgB,IAAI,+BAA+B,mFAAmF,iCAAiC,2FAA2F,6CAA6C,mDAAmD,4CAA4C,iCAAiC,gCAAgC,4BAA4B,SAAS,iCAAiC,oBAAoB,oCAAoC,mCAAmC,0BAA0B,+GAA+G,0BAA0B,2FAA2F,yQAAyQ,iLAAiL,yRAAyR,+BAA+B,wRAAwR,iEAAiE,yLAAyL,kCAAkC,WAAW,8DAA8D,6BAA6B,IAAI,wCAAwC,gBAAgB,wCAAwC,mDAAmD,qCAAqC,iCAAiC,sCAAsC,2EAA2E,qCAAqC,iCAAiC,sCAAsC,kHAAkH,wCAAwC,oCAAoC,yCAAyC,iFAAiF,0BAA0B,sBAAsB,2BAA2B,gCAAgC,2BAA2B,uBAAuB,4BAA4B,iCAAiC,iCAAiC,gFAAgF,wCAAwC,oDAAoD,0CAA0C,KAAK,eAAe,2CAA2C,QAAQ,2BAA2B,gBAAgB,WAAW,wBAAwB,sIAAsI,0BAA0B,gIAAgI,uBAAuB,2GAA2G,wBAAwB,2KAA2K,2BAA2B,qFAAqF,mBAAmB,2BAA2B,sFAAsF,4EAA4E,KAAK,iCAAiC,EAAE,yBAAyB,qDAAqD,0CAA0C,SAAS,4CAA4C,+DAA+D,sCAAsC,gCAAgC,iJAAiJ,oCAAoC,0CAA0C,kCAAkC,sKAAsK,4CAA4C,2CAA2C,uFAAuF,QAAQ,qRAAqR,mBAAmB,kBAAkB,qDAAqD,mCAAmC,mBAAmB,sFAAsF,UAAU,yNAAyN,KAAK,qDAAqD,qDAAqD,0HAA0H,mDAAmD,mKAAmK,mDAAmD,6CAA6C,mDAAmD,kGAAkG,gBAAgB,0BAA0B,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,WAAW,MAAM,gEAAgE,wMAAwM,mDAAmD,0CAA0C,sDAAsD,8QAA8Q,mDAAmD,gFAAgF,sDAAsD,moBAAmoB,mDAAmD,iGAAiG,mDAAmD,yDAAyD,wDAAwD,2LAA2L,wDAAwD,gXAAgX,kEAAkE,+BAA+B,qMAAqM,gCAAgC,qNAAqN,mCAAmC,oBAAoB,oCAAoC,qHAAqH,oCAAoC,qBAAqB,mCAAmC,2DAA2D,4BAA4B,oCAAoC,sCAAsC,kKAAkK,eAAe,iEAAiE,YAAY,sCAAsC,6CAA6C,yDAAyD,kCAAkC,mBAAmB,qCAAqC,kBAAkB,8DAA8D,kCAAkC,+WAA+W,mCAAmC,oBAAoB,oCAAoC,gEAAgE,WAAW,iBAAiB,+CAA+C,mBAAmB,WAAW,2CAA2C,mBAAmB,cAAc,qCAAqC,uGAAuG,4HAA4H,MAAM,yMAAyM,mBAAmB,mBAAmB,6BAA6B,+DAA+D,iCAAiC,0PAA0P,oCAAoC,qFAAqF,wTAAwT,MAAM,8SAA8S,kUAAkU,uCAAuC,sEAAsE,iEAAiE,mBAAmB,GAAG,uCAAuC,uIAAuI,kCAAkC,+fAA+f,8BAA8B,0MAA0M,MAAM,8QAA8Q,MAAM,0RAA0R,8KAA8K,gCAAgC,uEAAuE,kCAAkC,WAAW,oEAAoE,0BAA0B,sqBAAsqB,yQAAyQ,IAAI,gCAAgC,0FAA0F,mCAAmC,yBAAyB,6FAA6F,MAAM,yhBAAyhB,MAAM,oPAAoP,yBAAyB,kKAAkK,MAAM,wFAAwF,MAAM,sKAAsK,MAAM,2FAA2F,MAAM,+KAA+K,yXAAyX,iKAAiK,SAAS,oCAAoC,mSAAmS,GAAG,gBAAgB,2BAA2B,gBAAgB,wBAAwB,+CAA+C,mBAAmB,+PAA+P,2BAA2B,eAAe,8BAA8B,qBAAqB,gCAAgC,qBAAqB,oBAAoB,qBAAqB,+GAA+G,yEAAyE,2CAA2C,oBAAoB,iCAAiC,4CAA4C,gCAAgC,yKAAyK,kCAAkC,+EAA+E,kCAAkC,iEAAiE,kBAAkB,odAAod,+BAA+B,wSAAwS,kCAAkC,0HAA0H,iDAAiD,4KAA4K,kCAAkC,uHAAuH,wNAAwN,uCAAuC,wBAAwB,qCAAqC,6XAA6X,4CAA4C,qpBAAqpB,QAAQ,+BAA+B,gBAAgB,cAAc,qGAAqG,4HAA4H,4KAA4K,+BAA+B,kBAAkB,+BAA+B,kQAAkQ,kCAAkC,oBAAoB,mCAAmC,oEAAoE,iCAAiC,gEAAgE,iCAAiC,+FAA+F,kBAAkB,eAAe,kBAAkB,6BAA6B,uCAAuC,8EAA8E,uCAAuC,wVAAwV,mEAAmE,gCAAgC,2CAA2C,4SAA4S,sFAAsF,MAAM,uBAAuB,8CAA8C,OAAO,qRAAqR,+CAA+C,6BAA6B,OAAO,oGAAoG,OAAO,qbAAqb,+BAA+B,sBAAsB,OAAO,mEAAmE,yLAAyL,0BAA0B,wGAAwG,sCAAsC,eAAe,GAAG,YAAY,QAAQ,2VAA2V,sBAAsB,oBAAoB,kBAAkB,eAAe,UAAU;;AAEnrrT;;AAEA;;AAEA,CAAC;;;AAGD,CAAC,qIAAqI;AACtI,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK,O;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,qNAAqN;AACxN;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,wGAAwG;AAC3G;AACA,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;AACrB,qBAAqB;;AAErB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC,EAAE,qJAAqJ;AACxJ;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iOAAiO;AACpO;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,MAAM;AACrC;AACA;AACA,2BAA2B,KAAK;AAChC;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,yBAAyB;AAC5B;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA,wBAAwB,qBAAqB;AAC7C;AACA,KAAK;AACL;AACA,wBAAwB,WAAW;AACnC;AACA,KAAK;AACL;AACA,wBAAwB,WAAW;AACnC;AACA,KAAK;AACL;AACA,wBAAwB,cAAc;AACtC;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,cAAc,cAAc;AAC5B;AACA;;AAEA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,MAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qDAAqD;AACrD,+CAA+C;AAC/C,gCAAgC;AAChC;;AAEA;AACA,gBAAgB,aAAa;AAC7B,sDAAsD;AACtD;AACA,gBAAgB;AAChB;;AAEA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA,2EAA2E;AAC3E,gBAAgB,KAAK;AACrB;AACA;AACA,gBAAgB,aAAa;AAC7B,sDAAsD;AACtD;AACA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA,mEAAmE;AACnE,OAAO;AACP,+DAA+D;AAC/D;AACA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA,wFAAwF;;AAExF;AACA,gBAAgB,kBAAkB;AAClC,wEAAwE;AACxE;;AAEA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA,oDAAoD;;AAEpD;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA,kBAAkB,kBAAkB;AACpC;AACA,sFAAsF;AACtF,SAAS;AACT,kFAAkF;AAClF;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA;AACA,+CAA+C;AAC/C,sEAAsE;;AAEtE;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA,yBAAyB,KAAK;AAC9B;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA,iDAAiD;AACjD,uCAAuC;AACvC;AACA;;AAEA;AACA,gBAAgB;AAChB,oBAAoB;AACpB;;AAEA;AACA,gBAAgB,kBAAkB;AAClC,6CAA6C;AAC7C,4CAA4C;AAC5C,4CAA4C;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,2BAA2B;AAC3B;;AAEA,gBAAgB,aAAa;AAC7B,sDAAsD;AACtD;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD,sBAAsB;AACtB;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;;AAEA;AACA,0CAA0C,yBAAyB;;AAEnE;AACA;AACA,kBAAkB;AAClB,gDAAgD;AAChD,6BAA6B;AAC7B;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,sBAAsB;AACzB;;;;AAIA,yCAAyC,yCAAyC,UAAU,yCAAyC,SAAS,SAAS,8DAA8D,WAAW,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,+BAA+B,SAAS,UAAU,yCAAyC,iDAAiD;;AAEhjB;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB,yDAAyD;AACzD;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,wBAAwB;;AAElE;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;AAEA,gBAAgB,gBAAgB;AAChC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,sCAAsC,KAAK;AAC3C,8CAA8C;AAC9C,WAAW;AACX,0CAA0C;AAC1C;AACA;AACA,oBAAoB,KAAK,qBAAqB;AAC9C;AACA;;AAEA;AACA;AACA,iEAAiE;AACjE,WAAW;AACX,0CAA0C;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAW;AACX;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,sCAAsC,KAAK;AAC3C,8CAA8C;AAC9C,WAAW;AACX,0CAA0C;AAC1C;AACA;AACA,oBAAoB,KAAK,qBAAqB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA,gBAAgB,qBAAqB;AACrC;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;;AAE1B;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,+BAA+B;AAClC;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,CAAC,EAAE,0CAA0C;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,KAAK;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,UAAU;AACpB;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA,mBAAmB;AACnB,KAAK;AACL,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA,gFAAgF,wBAAwB,UAAU;AAClH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,aAAa;AACb,gCAAgC;AAChC;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,8BAA8B;AAC9B;AACA;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,+BAA+B;AAC/B;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,8BAA8B;AAC9B;AACA;AACA,KAAK;AACL;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,aAAa;AACb,8BAA8B;AAC9B;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,8BAA8B;AAC9B;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,aAAa;AACb,+BAA+B;AAC/B;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,+BAA+B;AAC/B;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,+BAA+B;AAC/B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb,+BAA+B;AAC/B;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,0BAA0B,oDAAoD;AAC9E,2BAA2B,wDAAwD;AACnF;AACA,mBAAmB;AACnB;AACA;AACA,4BAA4B,oDAAoD;AAChF,6BAA6B,qDAAqD;AAClF;AACA;AACA;AACA,qBAAqB;AACrB;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,cAAc,oBAAoB;AAClC;AACA;AACA;AACA,wBAAwB,oDAAoD;AAC5E,yBAAyB,8DAA8D;AACvF;AACA,iBAAiB;AACjB;AACA;AACA,wBAAwB,oDAAoD;AAC5E,yBAAyB,8DAA8D;AACvF;AACA,mBAAmB;AACnB,8BAA8B;AAC9B,wBAAwB,oDAAoD;AAC5E,yBAAyB,0DAA0D;AACnF;AACA;AACA;AACA,mBAAmB;AACnB,+BAA+B;AAC/B,wBAAwB,oDAAoD;AAC5E,yBAAyB,0DAA0D;AACnF;AACA;AACA;AACA,mBAAmB;AACnB;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,CAAC;AACD,cAAc,uBAAuB;AACrC;AACA;AACA;AACA,wBAAwB,oDAAoD;AAC5E,yBAAyB,8DAA8D;AACvF;AACA,iBAAiB;AACjB;AACA;AACA,wBAAwB,oDAAoD;AAC5E,yBAAyB,8DAA8D;AACvF;AACA,mBAAmB;AACnB,gCAAgC;AAChC,wBAAwB,oDAAoD;AAC5E,yBAAyB,0DAA0D;AACnF;AACA;AACA;AACA,mBAAmB;AACnB,iCAAiC;AACjC,wBAAwB,oDAAoD;AAC5E,yBAAyB,0DAA0D;AACnF;AACA;AACA;AACA,mBAAmB;AACnB;AACA,CAAC;;AAED;AACA;AACA;AACA,SAAS,OAAO,6CAA6C,gBAAgB,YAAY,+BAA+B;AACxH,SAAS,wDAAwD;AACjE;AACA,CAAC;;AAED;AACA;AACA;AACA,SAAS,OAAO,6CAA6C,iBAAiB,aAAa,+BAA+B;AAC1H,SAAS,uDAAuD;AAChE;AACA,CAAC;;AAED;AACA;AACA,QAAQ,4DAA4D;AACpE,SAAS,OAAO,6CAA6C,0DAA0D;AACvH,SAAS,iEAAiE;AAC1E;AACA,CAAC;;AAED;AACA;AACA,QAAQ,4DAA4D;AACpE,SAAS,OAAO,6CAA6C,0DAA0D;AACvH,SAAS,iEAAiE;AAC1E;AACA,CAAC;;AAED;AACA;AACA,QAAQ,4DAA4D;AACpE,SAAS,OAAO,6CAA6C,4DAA4D;AACzH,SAAS,iEAAiE;AAC1E;AACA,CAAC;;AAED;AACA;AACA,QAAQ,4DAA4D;AACpE,SAAS,OAAO,6CAA6C,4DAA4D;AACzH,SAAS,4EAA4E;AACrF;AACA,CAAC;;;AAGD;AACA;AACA,QAAQ,4DAA4D;AACpE,SAAS,OAAO,6CAA6C,uBAAuB,UAAU,kBAAkB,SAAS,uCAAuC;AAChK,SAAS,iEAAiE;AAC1E;AACA,CAAC;;AAED;AACA;AACA,QAAQ,4DAA4D;AACpE,SAAS,OAAO,6CAA6C,iEAAiE;AAC9H,SAAS,iEAAiE;AAC1E;AACA,CAAC;;AAED;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,oBAAoB;AACpB;AACA,IAAI;AACJ,aAAa,gEAAgE;AAC7E;AACA,oBAAoB;AACpB;AACA,IAAI;AACJ;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,oBAAoB;AACpB;AACA,IAAI;AACJ,aAAa,gEAAgE;AAC7E;AACA,oBAAoB;AACpB;AACA,IAAI;AACJ;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,WAAW,gBAAgB,gCAAgC;AAC3D;AACA,OAAO,yDAAyD;AAChE,OAAO,yDAAyD;AAChE,OAAO;AACP;AACA;AACA,iBAAiB;AACjB;AACA,WAAW,2BAA2B,uBAAuB,sBAAsB,mCAAmC,eAAe,mDAAmD;AACxL;AACA,OAAO,wDAAwD;AAC/D,OAAO,wDAAwD;AAC/D;AACA,8BAA8B;AAC9B;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,WAAW,iBAAiB,gCAAgC;AAC5D;AACA,OAAO,yDAAyD;AAChE,OAAO,yDAAyD;AAChE,OAAO;AACP;AACA;AACA,iBAAiB;AACjB;AACA,WAAW,2BAA2B,uBAAuB,sBAAsB,mCAAmC,eAAe,mDAAmD;AACxL;AACA,OAAO,wDAAwD;AAC/D,OAAO,wDAAwD;AAC/D;AACA,8BAA8B;AAC9B;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,QAAQ,wDAAwD;AAChE,SAAS,oDAAoD;AAC7D;AACA,CAAC;;AAED;AACA;AACA,SAAS,4BAA4B;AACrC,sBAAsB;;AAEtB;AACA;AACA,SAAS,4BAA4B;AACrC,uBAAuB;;;AAGvB;AACA;AACA;AACA,SAAS,OAAO,6CAA6C;AAC7D,gBAAgB,6CAA6C;AAC7D,yBAAyB,aAAa;AACtC;AACA,qBAAqB;AACrB,SAAS,uDAAuD;AAChE;AACA,CAAC;;;;AAID,CAAC,EAAE,qBAAqB;AACxB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC,0CAA0C,yCAAyC,UAAU,yCAAyC,SAAS,SAAS,iEAAiE,qCAAqC,gBAAgB,0DAA0D,2EAA2E,WAAW,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,0DAA0D,SAAS,UAAU,yCAAyC,qCAAqC;;AAE7vB,CAAC,EAAE,qBAAqB;AACxB;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAwD;AACxD,oBAAoB,SAAS,KAAK;AAClC,aAAa;AACb;;;AAGA;;AAEA;AACA,sBAAsB;AACtB,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA,+BAA+B,cAAc,UAAU;AACvD;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;AAGA;AACA,mCAAmC;AACnC;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA,+BAA+B,cAAc,UAAU;AACvD;AACA,kEAAkE,UAAU,UAAU,UAAU;AAChG,6BAA6B,MAAM;AACnC;AACA;AACA;AACA,UAAU;AACV;;AAEA;AACA,yBAAyB;AACzB,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA,+BAA+B,cAAc,UAAU;AACvD;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA,+BAA+B,uBAAuB;AACtD;;AAEA;AACA,0BAA0B;;AAE1B;AACA,yBAAyB;AACzB,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA,+BAA+B,cAAc,UAAU;AACvD;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,GAAG;AACH;AACA,oEAAoE;AACpE;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;;AAEd;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gEAAgE;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA,+BAA+B,cAAc,UAAU;AACvD;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,gBAAgB;AAChC,+BAA+B,cAAc,UAAU;AACvD;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,aAAa,YAAY,YAAY,eAAe;AACxE,oBAAoB,gBAAgB;AACpC;AACA,KAAK;AACL,gFAAgF,aAAa,YAAY,YAAY;AACrH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kCAAkC;AAClC;AACA,0BAA0B,SAAS,KAAK;AACxC;AACA,8BAA8B,SAAS;AACvC,4BAA4B;AAC5B,gCAAgC;AAChC;AACA,oBAAoB;AACpB;AACA,kBAAkB,KAAK;AACvB,+BAA+B;AAC/B;AACA,gCAAgC;AAChC;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA,sBAAsB;AACtB,oBAAoB;AACpB,kBAAkB;AAClB,gBAAgB;AAChB,cAAc,KAAK;AACnB;AACA,0BAA0B,SAAS,KAAK;AACxC;AACA,mCAAmC;AACnC,gCAAgC;AAChC;AACA,oBAAoB;AACpB;AACA,kBAAkB,KAAK;AACvB;AACA,qCAAqC;AACrC,iCAAiC;AACjC;AACA,kCAAkC;AAClC,uCAAuC,MAAM;AAC7C;AACA,wBAAwB,KAAK;AAC7B;AACA,oCAAoC;AACpC;AACA,0BAA0B,KAAK;AAC/B;AACA,0BAA0B;AAC1B;AACA,wBAAwB;AACxB,sBAAsB;AACtB,oBAAoB;AACpB,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA,QAAQ,KAAK;AACb;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA,kCAAkC;AAClC;AACA;AACA,cAAc;;AAEd;AACA;AACA,oDAAoD;AACpD;AACA,kEAAkE,4BAA4B;AAC9F;AACA,wBAAwB;AACxB,KAAK;AACL,2EAA2E,WAAW;AACtF;AACA;;AAEA;AACA,2CAA2C;;AAE3C;AACA;;AAEA,0BAA0B,SAAS,KAAK;AACxC;AACA,qCAAqC;AACrC,gCAAgC;AAChC;AACA,oBAAoB;AACpB;AACA,kBAAkB,KAAK;AACvB;AACA,uCAAuC;AACvC,iCAAiC;AACjC;AACA,oCAAoC;AACpC,uCAAuC,MAAM;AAC7C;AACA,wBAAwB,KAAK;AAC7B;AACA,oCAAoC;AACpC;AACA,0BAA0B,KAAK;AAC/B;AACA,0BAA0B;AAC1B;AACA,wBAAwB;AACxB,sBAAsB;AACtB,oBAAoB;AACpB,kBAAkB;AAClB,gBAAgB;AAChB,cAAc;;AAEd;AACA;AACA;;AAEA;AACA,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gEAAgE;;AAEhE;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;;AAEA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,0CAA0C;AAC1C,+CAA+C,KAAK;AACpD;AACA,OAAO;AACP;;AAEA;AACA,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC,EAAE,sBAAsB;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC,EAAE,4BAA4B;AAC/B;;AAEA;;;AAGA,4CAA4C,2DAA2D,SAAS,uCAAuC,WAAW,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,gEAAgE,4CAA4C,SAAS,SAAS,uGAAuG,WAAW,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,EAAE,iEAAiE,4CAA4C,SAAS,UAAU,yCAAyC,kDAAkD;;AAEjoC,8CAA8C,2DAA2D,SAAS,gBAAgB,sDAAsD,SAAS,SAAS,6GAA6G,WAAW,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,EAAE,gEAAgE,4CAA4C,SAAS,UAAU,yCAAyC,kDAAkD;;AAEpyB,8CAA8C,2DAA2D,SAAS,kBAAkB,sDAAsD,SAAS,SAAS,iIAAiI,WAAW,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,4CAA4C,SAAS,UAAU,yCAAyC,kDAAkD;;AAE/zB,8CAA8C,2DAA2D,SAAS,oBAAoB,sDAAsD,SAAS,SAAS,gJAAgJ,WAAW,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,EAAE,iEAAiE,4CAA4C,SAAS,UAAU,yCAAyC,kDAAkD;;AAEh1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU,gBAAgB;AAC1B;AACA;AACA;AACA;AACA,UAAU,iBAAiB;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC,cAAc;AAC/C,kCAAkC;AAClC,wBAAwB;AACxB,uBAAuB,WAAW;AAClC,aAAa;AACb,mBAAmB;AACnB,wCAAwC;AACxC;AACA,WAAW,sCAAsC;AACjD,iCAAiC;AACjC,sBAAsB,aAAa;AACnC,2CAA2C,6BAA6B;AACxE;AACA;AACA,GAAG;AACH;AACA;AACA,oCAAoC;AACpC,cAAc;AACd;AACA,EAAE;AACF,kCAAkC;AAClC,wBAAwB;AACxB,uBAAuB,oBAAoB;AAC3C,kBAAkB;AAClB,aAAa;AACb;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,0CAA0C;AAC1C;AACA,EAAE;AACF,yCAAyC;AACzC,+BAA+B;AAC/B,EAAE;AACF,qDAAqD;AACrD;AACA,GAAG;AACH,wCAAwC;AACxC;AACA,EAAE;AACF,iDAAiD,8BAA8B;AAC/E;AACA;AACA;;AAEA;;AAEA;AACA;AACA,sCAAsC,eAAe;AACrD;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,oEAAoE;AACpE;AACA;AACA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA,iDAAiD,kCAAkC;AACnF,kCAAkC,6BAA6B;AAC/D,GAAG;;AAEH;AACA;AACA;AACA,GAAG;AACH,oDAAoD;AACpD;AACA,gDAAgD;AAChD;AACA,2FAA2F;AAC3F,OAAO;AACP;AACA,yFAAyF;AACzF,UAAU;AACV,UAAU;AACV,eAAe;AACf,CAAC,eAAe;AAChB,eAAe;AACf,CAAC,KAAK;AACN,eAAe;AACf,CAAC;AACD,CAAC,eAAe;AAChB,eAAe;AACf,CAAC,eAAe;AAChB,eAAe;AACf,CAAC,KAAK;AACN,eAAe;AACf,GAAG;AACH;AACA,KAAK;AACL,uBAAuB;AACvB;AACA;;AAEA;AACA;AACA,4DAA4D;AAC5D;AACA,qDAAqD;AACrD,GAAG;AACH,iDAAiD;AACjD;;AAEA;AACA,sEAAsE;AACtE;AACA,mDAAmD;AACnD,GAAG;AACH,+CAA+C;AAC/C;;AAEA;AACA;AACA,iEAAiE,qBAAqB;;AAEtF;AACA,oEAAoE;AACpE;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK,2BAA2B;;AAEhC;AACA,wCAAwC,oCAAoC;AAC5E,wCAAwC,qCAAqC;AAC7E,oEAAoE;AACpE,cAAc,aAAa;AAC3B;AACA,yCAAyC;AACzC,WAAW;AACX,YAAY;AACZ,UAAU;AACV;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK,iBAAiB;;AAEtB;AACA,wEAAwE;AACxE;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,cAAc,aAAa;AAC3B;AACA,8BAA8B;AAC9B,WAAW;AACX,QAAQ;AACR,qBAAqB;AACrB;AACA,CAAC,KAAK;AACN;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK,iBAAiB;;AAEtB;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA,wEAAwE;AACxE,8BAA8B,+DAA+D,SAAS;AACtG,oCAAoC,2FAA2F;;AAE/H;AACA,8DAA8D;AAC9D,cAAc,aAAa;AAC3B,uDAAuD,kCAAkC,KAAK,0BAA0B,2BAA2B;AACnJ;AACA,4CAA4C,6BAA6B;;AAEzE;AACA,+EAA+E;AAC/E;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK,sBAAsB;;AAE3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,MAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,iCAAiC;AACpC;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,kBAAkB;;AAErB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,SAAS;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA,gBAAgB,YAAY;;AAE5B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,KAAK;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA,KAAK;AACL,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;;;;AAIA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,sBAAsB;AACtC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,iHAAiH;AACpH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,CAAC,EAAE,oBAAoB;AACvB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,UAAU;AACV;AACA;;AAEA,uGAAuG;;AAEvG;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,GAAG;AACH,EAAE;;AAEF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oBAAoB;;AAEvB;;AAEA;AACA;AACA,UAAU;AACV;;AAEA,cAAc;;AAEd;AACA;AACA,UAAU;AACV;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA,CAAC;;;;AAID,CAAC;AACD,CAAC,EAAE,eAAe;AAClB;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB,kBAAkB,KAAK;AACvB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,sBAAsB;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,KAAK;AACf;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,KAAK;AACf;AACA;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,+CAA+C;AAClD;;;AAGA;AACA,gBAAgB;;AAEhB;AACA;AACA;AACA,aAAa,kBAAkB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,oBAAoB;AAClC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,oBAAoB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,eAAe;AAC7B,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAE,oBAAoB;AACvB;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,cAAc,YAAY;AAC1B;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,iJAAiJ;AACpJ;;AAEA;AACA,CAAC,EAAE,aAAa;AAChB;AACA,CAAC,EAAE,SAAS;AACZ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,gBAAgB,aAAa;;AAE7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,+BAA+B;AAC/B,+BAA+B;;AAE/B;;AAEA;AACA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,gBAAgB,OAAO;AACvB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;;;AAGA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA,gBAAgB;AAChB;AACA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;;;AAIA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA,mCAAmC,SAAS;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA,qBAAqB;;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,uCAAuC;AACvC,+BAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;AAIA;AACA;;AAEA;AACA;;AAEA;AACA,sCAAsC;;AAEtC;AACA;;AAEA;AACA,oEAAoE;AACpE,6BAA6B;AAC7B,uBAAuB;;AAEvB;AACA;;AAEA,0BAA0B;;AAE1B,qBAAqB,QAAQ;AAC7B;;AAEA;AACA;;AAEA,iEAAiE;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,qBAAqB,kBAAkB;AACvC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,WAAW;AAC5B;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,+KAA+K;AAClL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA,gCAAgC,eAAe;AAC/C;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,mGAAmG;AACtG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,+IAA+I;AAClJ;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,yBAAyB,yBAAyB;AAClD,GAAG;AACH;AACA,oBAAoB,oBAAoB;AACxC,wBAAwB,oBAAoB;AAC5C,GAAG;AACH;AACA,2BAA2B,WAAW;AACtC,GAAG;AACH;AACA,8BAA8B,WAAW;AACzC,GAAG;AACH;AACA,2BAA2B,6BAA6B;AACxD,GAAG;AACH;AACA,2BAA2B,WAAW;AACtC,GAAG;AACH;AACA,+BAA+B,uCAAuC;AACtE,GAAG;AACH;AACA,0BAA0B,WAAW;AACrC,GAAG;AACH;AACA,0BAA0B,uCAAuC;AACjE,GAAG;AACH;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,GAAG;AACH;AACA;AACA;AACA,uBAAuB,YAAY;AACnC,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,4BAA4B,aAAa;AACzC,GAAG;AACH;AACA,+BAA+B,WAAW;AAC1C,GAAG;AACH;AACA,kCAAkC,uBAAuB;AACzD,GAAG;AACH;AACA,kCAAkC,uBAAuB;AACzD,GAAG;AACH;AACA,6BAA6B,qBAAqB;AAClD,GAAG;AACH;AACA,+BAA+B,eAAe;AAC9C,GAAG;AACH;AACA,+BAA+B,eAAe;AAC9C,GAAG;AACH;AACA,kCAAkC,uBAAuB;AACzD,GAAG;AACH;AACA,kCAAkC,wBAAwB;AAC1D,GAAG;AACH;AACA,6BAA6B,iCAAiC;AAC9D,GAAG;AACH;AACA,6BAA6B,eAAe;AAC5C,GAAG;AACH;AACA,8BAA8B,iCAAiC;AAC/D,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,+BAA+B;;AAE7D;AACA;AACA;AACA;AACA,8BAA8B,kCAAkC;AAChE;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,mBAAmB;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,+BAA+B;AAC/D,kBAAkB,gCAAgC;AAClD;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;;AAEA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,2BAA2B;AAC5C;;AAEA;;AAEA;AACA,WAAW;AACX;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;;AAEZ;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;;AAElB;AACA;;AAEA;AACA,gBAAgB;;AAEhB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,oBAAoB;AACpB;AACA,2DAA2D;;AAE3D;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0DAA0D,SAAS;AACnE;AACA;AACA;;AAEA;AACA,6DAA6D;AAC7D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;;AAEA;AACA;AACA,cAAc;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,yBAAyB;AACnC;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,gDAAgD;AAChD,4CAA4C;;AAE5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,IAAI;AACJ;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,OAAO,OAAO;AACd;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK,kBAAkB;AACvB;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK,kBAAkB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;;AAErC;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;AAEtC,CAAC,GAAG;AACJ;AACA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,4BAA4B;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA,aAAa;AACb,qCAAqC,UAAU;AAC/C;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,qIAAqI;AACtI,CAAC,EAAE,sBAAsB;AACzB;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;;AAEA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,aAAa;AAChB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sEAAsE;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA,qCAAqC,+CAA+C,2BAA2B,2BAA2B,wDAAwD,8BAA8B,uCAAuC,gEAAgE,+BAA+B,qBAAqB,iCAAiC,wFAAwF,mGAAmG,yCAAyC,gNAAgN,2CAA2C,kDAAkD,OAAO;;AAEp7B,uCAAuC,+BAA+B,8BAA8B,qBAAqB,iCAAiC,kCAAkC,OAAO;;AAEnM;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kFAAkF;AACrH,GAAG;;AAEH;AACA;AACA;AACA;AACA,kCAAkC,wBAAwB,EAAE;AAC5D;AACA,IAAI;AACJ;AACA;AACA,kCAAkC,wBAAwB,EAAE;AAC5D;AACA,IAAI;AACJ;AACA;AACA,kCAAkC,wBAAwB,EAAE;AAC5D;AACA,IAAI;AACJ;AACA;AACA,kCAAkC,yBAAyB,EAAE;AAC7D;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA,oCAAoC;;AAEpC;AACA,2CAA2C;;;AAG3C;;AAEA;AACA;AACA,YAAY;;AAEZ;AACA,sBAAsB;AACtB,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA,8BAA8B;AAC9B,kBAAkB;;AAElB,yFAAyF;;AAEzF;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB;AAChB;;AAEA;AACA,iBAAiB;;AAEjB;AACA;AACA,wCAAwC,aAAa,mBAAmB;AACxE;;AAEA;AACA,qCAAqC;;AAErC;AACA;;AAEA;AACA;;AAEA,kBAAkB;AAClB,4CAA4C,YAAY,eAAe;AACvE,6CAA6C,YAAY,mBAAmB;;AAE5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;;AAEA;AACA,6BAA6B,gBAAgB,EAAE;AAC/C,2BAA2B,gBAAgB,EAAE;AAC7C;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;;AAEA,iCAAiC;;AAEjC;;AAEA;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,kBAAkB;;AAElB;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB,YAAY;;AAEZ,sBAAsB;AACtB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;;AAEJ;AACA,GAAG;;AAEH;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,6IAA6I;AAChJ;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA,iCAAiC;;AAEjC;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,sCAAsC,EAAE;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wEAAwE,EAAE;AACxG;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH,YAAY,cAAc;AAC1B;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA;AACA;AACA,wCAAwC,+EAA+E,uBAAuB,mCAAmC,8DAA8D,iDAAiD,wBAAwB,2BAA2B,uBAAuB,uHAAuH,2LAA2L,GAAG,iBAAiB,mCAAmC,yCAAyC,gEAAgE,oDAAoD,8CAA8C,qQAAqQ,yDAAyD,+BAA+B,GAAG;AAC9vC,wCAAwC,qDAAqD,+DAA+D,2BAA2B,uBAAuB,iBAAiB,qBAAqB,2EAA2E,uDAAuD,+BAA+B,6CAA6C,GAAG;;AAErc;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ,yCAAyC,2EAA2E,gCAAgC,mCAAmC,kCAAkC,iDAAiD,wBAAwB,sCAAsC,2BAA2B,sCAAsC,uBAAuB,oCAAoC,iDAAiD,0CAA0C,8BAA8B,qQAAqQ,sBAAsB,iDAAiD,4BAA4B,GAAG,4BAA4B,mEAAmE,GAAG,iBAAiB,wFAAwF,yBAAyB,qEAAqE,qEAAqE,oDAAoD,8CAA8C,qCAAqC,iCAAiC,iEAAiE,2FAA2F,+EAA+E,6EAA6E,yCAAyC,oCAAoC,uCAAuC,0DAA0D,wDAAwD,wDAAwD,4DAA4D,0DAA0D,0DAA0D,qEAAqE,iEAAiE,wJAAwJ,sDAAsD,uDAAuD,sCAAsC,KAAK,uDAAuD,oCAAoC,KAAK,2BAA2B,4CAA4C,8BAA8B,gCAAgC,KAAK,4BAA4B,gHAAgH,2DAA2D,uDAAuD,iDAAiD,4DAA4D,oDAAoD,8DAA8D,yDAAyD,iCAAiC,qDAAqD,6BAA6B,2DAA2D,uDAAuD,yDAAyD,uDAAuD,sMAAsM,yKAAyK,8OAA8O,6LAA6L,wBAAwB,wGAAwG,sEAAsE,qFAAqF,qFAAqF,KAAK,gGAAgG,yEAAyE,oEAAoE,KAAK,wBAAwB,sGAAsG,oEAAoE,qFAAqF,qFAAqF,KAAK,kGAAkG,2EAA2E,sEAAsE,KAAK,kEAAkE,gEAAgE,kEAAkE,gEAAgE,uMAAuM,+EAA+E,2EAA2E,0DAA0D,iEAAiE,6DAA6D,qDAAqD,mCAAmC,sFAAsF,2CAA2C,yFAAyF,qFAAqF,qCAAqC,4CAA4C,OAAO,mCAAmC,kFAAkF,yCAAyC,oFAAoF,iFAAiF,mCAAmC,wCAAwC,OAAO,KAAK,0DAA0D,mCAAmC,oHAAoH,2CAA2C,yFAAyF,qFAAqF,qCAAqC,4CAA4C,OAAO,mCAAmC,8GAA8G,yCAAyC,oFAAoF,iFAAiF,mCAAmC,wCAAwC,OAAO,KAAK,GAAG;AAC1wQ,yCAAyC,qDAAqD,wEAAwE,2BAA2B,uBAAuB,sCAAsC,oCAAoC,iDAAiD,8CAA8C,sBAAsB,iDAAiD,4BAA4B,GAAG,iBAAiB,6CAA6C,kCAAkC,6CAA6C,mCAAmC,kFAAkF,gCAAgC,kBAAkB,iBAAiB,SAAS,oDAAoD,OAAO,mCAAmC,4EAA4E,8BAA8B,kBAAkB,iBAAiB,SAAS,kDAAkD,OAAO,KAAK,mDAAmD,mCAAmC,kFAAkF,+BAA+B,8DAA8D,sCAAsC,oBAAoB,mBAAmB,WAAW,kEAAkE,SAAS,OAAO,mCAAmC,4EAA4E,6BAA6B,4DAA4D,sCAAsC,oBAAoB,mBAAmB,WAAW,kEAAkE,SAAS,OAAO,KAAK,2EAA2E,uDAAuD,+BAA+B,6CAA6C,GAAG;;AAE9lE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA,kCAAkC,uBAAuB,EAAE;AAC3D;;AAEA,wCAAwC,8DAA8D,uBAAuB,4DAA4D,+BAA+B,wBAAwB,wBAAwB,2BAA2B,iCAAiC,iBAAiB,sDAAsD,yKAAyK,yDAAyD,+BAA+B,2BAA2B,GAAG;AAC1qB,wCAAwC,8CAA8C,iBAAiB,6BAA6B,GAAG;;AAEvI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kFAAkF;AACrH,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA,UAAU,gBAAgB;AAC1B;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,8BAA8B;;AAE9B,8BAA8B;;AAE9B,yCAAyC;;AAEzC;;AAEA;AACA;AACA;;AAEA,qBAAqB;;AAErB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;;AAEA,gBAAgB;;AAEhB;AACA,uCAAuC,aAAa,mBAAmB;AACvE;;AAEA;AACA,oCAAoC;;AAEpC;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,MAAM,aAAa;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,gBAAgB;AAChB;AACA,4BAA4B;AAC5B,0BAA0B;AAC1B,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,uBAAuB;AACvB,uBAAuB;AACvB,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB;;AAExB;AACA,6BAA6B;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+CAA+C,SAAS;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6CAA6C,WAAW;AACxD,uCAAuC;AACvC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,OAAO;AAC1B,qBAAqB,uBAAuB;AAC5C,gEAAgE,SAAS;AACzE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA,iBAAiB;;AAEjB;;AAEA;AACA;AACA;;AAEA,qBAAqB,mBAAmB;AACxC;AACA;AACA,IAAI;AACJ,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,EAAE;;AAEF;AACA;AACA,8BAA8B,wBAAwB;AACtD;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,0BAA0B;AAC5C,oCAAoC;AACpC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;;AAEA;AACA;;AAEA,CAAC,EAAE,+MAA+M;AAClN;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iDAAiD,gBAAgB;;AAEjE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,+BAA+B;AAC5E;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;AAEA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,+BAA+B;AAC/B,yDAAyD,+DAA+D,gEAAgE,6BAA6B,oCAAoC,wCAAwC,2CAA2C,GAAG,iBAAiB,uEAAuE,yDAAyD,qGAAqG,gEAAgE,2EAA2E,KAAK,UAAU,0GAA0G,wFAAwF,qCAAqC,gCAAgC,8CAA8C,yBAAyB,6BAA6B,KAAK,KAAK;AACplC,yDAAyD,4DAA4D,mCAAmC,wCAAwC,2BAA2B,2EAA2E,2BAA2B,4BAA4B,+BAA+B,+BAA+B,4CAA4C,iGAAiG,yCAAyC,4BAA4B,mJAAmJ,GAAG,iBAAiB,+BAA+B,iCAAiC,8CAA8C,qCAAqC,+CAA+C,yCAAyC,mDAAmD,4CAA4C,sCAAsC,sMAAsM,8CAA8C,wBAAwB,kCAAkC,kCAAkC,0FAA0F,yFAAyF,GAAG;AAC1oD,wCAAwC;;AAExC,+BAA+B;AAC/B,uDAAuD,+DAA+D,0BAA0B,4CAA4C,yDAAyD,YAAY,uDAAuD,mCAAmC,GAAG,iBAAiB,iDAAiD,oDAAoD,iCAAiC,cAAc,KAAK,4DAA4D,4CAA4C,iFAAiF,wDAAwD,+BAA+B,yBAAyB,GAAG;AACpzB,uDAAuD,4DAA4D,mCAAmC,wCAAwC,2BAA2B,8DAA8D,2BAA2B,4BAA4B,2BAA2B,+BAA+B,4CAA4C,4CAA4C,yCAAyC,4BAA4B,mJAAmJ,GAAG,iBAAiB,4DAA4D,iCAAiC,8CAA8C,qCAAqC,+CAA+C,yCAAyC,mDAAmD,sDAAsD,sMAAsM,8CAA8C,oEAAoE,sBAAsB,kGAAkG,kCAAkC,GAAG,MAAM;;AAExhD;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;;;AAGF;AACA;;AAEA,qEAAqE,aAAa;AAClF;AACA;;AAEA,2BAA2B;;AAE3B;AACA;AACA,GAAG;;;AAGH;;AAEA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,EAAE;;;AAGF;AACA;AACA,yBAAyB;AACzB,UAAU,WAAW;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uDAAuD;;AAEvD;AACA;AACA;AACA,GAAG;;;AAGH;;AAEA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA,KAAK;AACL,GAAG;;;AAGH;AACA;AACA;AACA;AACA,GAAG,EAAE;;AAEL;AACA;AACA;AACA;;AAEA,mBAAmB,qBAAqB;AACxC;AACA;AACA;;AAEA;AACA;;AAEA,0BAA0B,KAAK;AAC/B;AACA;AACA;;AAEA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,EAAE;;;AAGF;AACA;;AAEA,wEAAwE,eAAe;AACvF;AACA;;AAEA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,yBAAyB;AACzB,KAAK;;;AAGL;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,oDAAoD;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4EAA4E;;AAE5E;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD,SAAS;;;AAGT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS,EAAE;;AAEX;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA,SAAS;AACT,8BAA8B;;AAE9B;AACA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA,uEAAuE,QAAQ;AAC/E;;AAEA,oFAAoF;;AAEpF;AACA;;AAEA,8BAA8B,2BAA2B;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA;;AAEA;AACA,OAAO;AACP;AACA,kCAAkC;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,oFAAoF;AACpF;;AAEA;AACA;AACA,KAAK,GAAG;;AAER;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,aAAa;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,cAAc;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,GAAG;AACH,EAAE;;;AAGF;AACA;AACA;AACA;AACA;AACA,2BAA2B;;AAE3B;;AAEA;AACA;AACA,GAAG;AACH;;AAEA,mCAAmC,OAAO;AAC1C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,EAAE;;;AAGF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe;;AAEf;AACA;;AAEA;AACA,qBAAqB,mBAAmB;AACxC;AACA;AACA,KAAK;AACL,uBAAuB,qBAAqB;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB,qBAAqB;AACxC;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;;AAGH,uFAAuF;;AAEvF,8BAA8B;;AAE9B;AACA;;AAEA;AACA;AACA;AACA;AACA,mEAAmE;;AAEnE;AACA;;AAEA,kDAAkD,gCAAgC;AAClF;AACA;AACA,GAAG;;;AAGH;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA,CAAC,EAAE,kOAAkO;AACrO;AACA,CAAC,EAAE,UAAU;AACb;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA,gCAAgC;;AAEhC;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;;AAEpB,gBAAgB,iBAAiB;AACjC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA,iBAAiB,wBAAwB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,uBAAuB;AACvB,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB,qBAAqB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,SAAS;AAC3B,iBAAiB,OAAO;AACxB,sCAAsC;AACtC,iCAAiC;AACjC,iCAAiC;;AAEjC;;AAEA,4DAA4D;;AAE5D;AACA;AACA;AACA,UAAU,qDAAqD;AAC/D,UAAU;AACV;AACA;AACA;AACA;AACA,UAAU,8CAA8C;AACxD,UAAU;AACV;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB,gBAAgB;AAChB,kBAAkB;AAClB,sBAAsB;AACtB,uBAAuB;AACvB,mBAAmB;;AAEnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,6CAA6C;AAC7C,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA,+BAA+B;AAC/B,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,iIAAiI;AACpI,iBAAiB,gJAAgJ,kBAAkB,iBAAiB,aAAa,YAAY,YAAY,eAAe,yBAAyB,yCAAyC,0HAA0H;AACpb,qEAAqE,eAAe,4EAA4E,KAAK,QAAQ,WAAW,yBAAyB,SAAS,eAAe,+BAA+B,cAAc,OAAO,KAAK,QAAQ,OAAO,eAAe,WAAW,cAAc,gBAAgB,UAAU,SAAS,iBAAiB,cAAc,mBAAmB,aAAa,6CAA6C;AACxe,gEAAgE,YAAY,aAAa,WAAW,2BAA2B,EAAE,uCAAuC,WAAW,yCAAyC,EAAE,iBAAiB,2DAA2D,mBAAmB,GAAG,uCAAuC,IAAI,OAAO,8BAA8B,uCAAuC,mBAAmB,iBAAiB,cAAc,IAAI;AAC7e,GAAG,SAAS,aAAa,oEAAoE,eAAe,sCAAsC,eAAe,sDAAsD,eAAe,WAAW,SAAS,KAAK,0FAA0F,gBAAgB;AACzW,4aAA4a,iDAAiD,OAAO,OAAO;AAC3e,KAAK,kBAAkB,WAAW,cAAc,UAAU,UAAU,wGAAwG,0GAA0G,iBAAiB,cAAc,kBAAkB,MAAM,IAAI,yBAAyB,UAAU,UAAU,YAAY,KAAK,sBAAsB,KAAK,sBAAsB;AAChc,KAAK,gCAAgC,OAAO,gCAAgC,mCAAmC,oEAAoE,IAAI,gBAAgB,uBAAuB,IAAI,cAAc,SAAS,eAAe,QAAQ,eAAe,OAAO,aAAa,OAAO,KAAK,YAAY,OAAO,KAAK,WAAW,oBAAoB,cAAc,cAAc,GAAG,aAAa,aAAa,eAAe,IAAI,QAAQ,IAAI,cAAc;AAC5d,mBAAmB,cAAc,+BAA+B,qBAAqB,SAAS,EAAE,OAAO,uCAAuC,WAAW,UAAU,oCAAoC,MAAM,qCAAqC,MAAM,uCAAuC,MAAM,wCAAwC,MAAM,uCAAuC,MAAM,wCAAwC,MAAM,yCAAyC,MAAM,oBAAoB;AACjf,oBAAoB,sBAAsB,cAAc,eAAe,kLAAkL,yBAAyB,YAAY,IAAI,uBAAuB,IAAI,uBAAuB,IAAI,gBAAgB,uBAAuB,kBAAkB,WAAW,YAAY,WAAW,mBAAmB,sBAAsB,SAAS,QAAQ,IAAI;AACjf,gBAAgB,aAAa,IAAI,4BAA4B,eAAe,+CAA+C,iBAAiB,YAAY,WAAW,cAAc,2BAA2B,gBAAgB,IAAI,gBAAgB,IAAI,wBAAwB,qBAAqB,cAAc,YAAY,6BAA6B,YAAY,iBAAiB,kBAAkB,iBAAiB,gBAAgB,yBAAyB,wBAAwB,OAAO,EAAE,kBAAkB;AACpf,aAAa,yBAAyB,wBAAwB,UAAU,qBAAqB,sDAAsD,QAAQ,cAAc,WAAW,YAAY,cAAc,kBAAkB,SAAS,mCAAmC;AAC5Q,oCAAoC,oHAAoH,eAAe,UAAU,0CAA0C,iFAAiF,4BAA4B,cAAc,2BAA2B,uBAAuB,SAAS,oCAAoC,cAAc,gBAAgB,YAAY,iBAAiB,KAAK;AACrf,WAAW,4DAA4D,yBAAyB,cAAc,eAAe,aAAa,4BAA4B,qCAAqC,+BAA+B,SAAS,SAAS,4CAA4C,QAAQ,mCAAmC,mBAAmB,EAAE,SAAS,EAAE,OAAO,yBAAyB,cAAc,+BAA+B;AAChc,0JAA0J,SAAS,sGAAsG,mDAAmD,SAAS,gBAAgB,eAAe,UAAU,QAAQ,qBAAqB,YAAY,wBAAwB,iBAAiB,SAAS,oCAAoC,0BAA0B;AACvgB,oCAAoC,oCAAoC,QAAQ,4BAA4B,cAAc,yGAAyG,eAAe,UAAU,6BAA6B,iFAAiF,2CAA2C,qBAAqB,8BAA8B,4BAA4B,cAAc;AAClf,6BAA6B,qBAAqB,MAAM,SAAS,4BAA4B,cAAc,gBAAgB,SAAS,oBAAoB,SAAS,2BAA2B,UAAU,kBAAkB,gBAAgB,aAAa,uBAAuB,gDAAgD,oBAAoB,yBAAyB,0BAA0B,8BAA8B,4DAA4D,EAAE,gBAAgB;AAC/e,OAAO,cAAc,YAAY,gBAAgB,cAAc,gBAAgB,2BAA2B,0BAA0B,gBAAgB,MAAM,QAAQ,qEAAqE,gCAAgC,gHAAgH,IAAI,OAAO,uBAAuB,2BAA2B,MAAM,2BAA2B,MAAM,2BAA2B;AACtf,EAAE,SAAS,IAAI,8DAA8D,cAAc,IAAI,uEAAuE,aAAa,cAAc,kBAAkB,eAAe,mBAAmB,cAAc,QAAQ,QAAQ,wBAAwB,0CAA0C,4BAA4B,oBAAoB,SAAS,OAAO,qBAAqB,cAAc;AACxb,YAAY,KAAK,qCAAqC,qCAAqC,gLAAgL,oCAAoC,gCAAgC,iBAAiB,gDAAgD,SAAS,iDAAiD,kBAAkB,KAAK;AACje,cAAc,wBAAwB,eAAe,UAAU,qBAAqB,MAAM,SAAS,0BAA0B,cAAc,iDAAiD,uBAAuB,SAAS,2BAA2B,UAAU,yBAAyB,uEAAuE,kBAAkB,kBAAkB,eAAe,yCAAyC,WAAW,8BAA8B;AACte,gBAAgB,oCAAoC,KAAK,WAAW,wDAAwD,iEAAiE,SAAS,eAAe,8BAA8B,eAAe,uBAAuB,eAAe,gEAAgE,eAAe,sDAAsD,eAAe,yCAAyC,eAAe;AACpf,YAAY,+CAA+C,iBAAiB,qDAAqD,yBAAyB,4CAA4C,UAAU,MAAM,QAAQ,KAAK,eAAe,SAAS,aAAa,2BAA2B,aAAa,qCAAqC,eAAe,oDAAoD,uBAAuB,sBAAsB,uCAAuC;AAC5e,GAAG,kCAAkC,kBAAkB,cAAc,0BAA0B,sCAAsC,gBAAgB,oCAAoC,0BAA0B,gBAAgB,kBAAkB,sBAAsB,gBAAgB,2BAA2B,gEAAgE,+BAA+B,iDAAiD;AACtc,+BAA+B,2CAA2C,uMAAuM,YAAY,aAAa,eAAe,KAAK,sIAAsI;AACpc,0DAA0D,cAAc,6BAA6B,wCAAwC,kCAAkC,sCAAsC,aAAa,aAAa,4BAA4B,eAAe,kBAAkB,kBAAkB,kBAAkB,gBAAgB,WAAW,mGAAmG,WAAW;AACzd,6BAA6B,+BAA+B,eAAe,4EAA4E,2HAA2H,eAAe,yBAAyB,IAAI,WAAW,eAAe,gEAAgE,SAAS,SAAS,MAAM,wBAAwB,cAAc,eAAe,eAAe;AACpf,OAAO,kFAAkF,iCAAiC,mCAAmC,OAAO,OAAO,OAAO,OAAO,cAAc,UAAU,WAAW,aAAa,gCAAgC,eAAe,IAAI,WAAW,UAAU,WAAW,aAAa,iEAAiE,KAAK,kBAAkB,KAAK,kBAAkB,KAAK,gCAAgC,QAAQ;AACre,wHAAwH,8EAA8E,4FAA4F,wFAAwF,eAAe,uBAAuB,qBAAqB,aAAa,qCAAqC;AACve,IAAI,QAAQ,WAAW,YAAY,4CAA4C,qBAAqB,QAAQ,cAAc,UAAU,WAAW,aAAa,gCAAgC,gBAAgB,sBAAsB,qFAAqF,KAAK;AAC5T,SAAS,aAAa,sBAAsB,cAAc,gCAAgC,UAAU,UAAU,aAAa,aAAa,mBAAmB,qBAAqB,eAAe,sBAAsB,kBAAkB,sBAAsB,YAAY,kBAAkB,oBAAoB,wBAAwB,gBAAgB,WAAW,qDAAqD,8DAA8D,WAAW;AAChe,0DAA0D,iDAAiD,iBAAiB,gBAAgB,uBAAuB,iBAAiB,KAAK,oHAAoH,KAAK;AAClT,8CAA8C,aAAa,sBAAsB,UAAU,sBAAsB,KAAK,qBAAqB,SAAS,eAAe,uBAAuB,WAAW,4BAA4B,WAAW,aAAa,mCAAmC,4BAA4B,mBAAmB,mBAAmB,qBAAqB,gBAAgB,iGAAiG;AACpe,UAAU,wBAAwB,eAAe,aAAa,qEAAqE,4DAA4D,UAAU,UAAU,iDAAiD,iBAAiB,KAAK,wBAAwB,wCAAwC,kBAAkB,MAAM,uCAAuC,MAAM,mCAAmC,mCAAmC,gBAAgB;AACrf,mBAAmB,qCAAqC,iCAAiC,iCAAiC,yEAAyE,+DAA+D,cAAc,aAAa,eAAe,yBAAyB,aAAa,gBAAgB,cAAc,+BAA+B,aAAa,iBAAiB,mBAAmB,wBAAwB,OAAO,EAAE,cAAc;AAC/e,kCAAkC,cAAc,YAAY,6DAA6D,cAAc,oCAAoC,kEAAkE,mBAAmB,eAAe,cAAc,cAAc,aAAa,eAAe,iBAAiB,QAAQ,uDAAuD,IAAI,sCAAsC,IAAI,yBAAyB,OAAO;AACre,sFAAsF,QAAQ,qBAAqB,IAAI,oDAAoD,IAAI,6GAA6G,MAAM,yCAAyC,iDAAiD,4DAA4D,6BAA6B,iCAAiC;AACtf,KAAK,8CAA8C,GAAG,sCAAsC,2FAA2F,EAAE,qCAAqC,oFAAoF,EAAE,uCAAuC,sGAAsG,EAAE;AACnc,yDAAyD,mCAAmC,WAAW,2BAA2B,EAAE,sBAAsB,oBAAoB,SAAS,mCAAmC,UAAU,EAAE,UAAU,mCAAmC,WAAW,EAAE,UAAU,mCAAmC,WAAW,EAAE,UAAU,oCAAoC,YAAY,EAAE,UAAU,mCAAmC,WAAW,EAAE,+BAA+B;AAC/e,KAAK,uHAAuH,SAAS,GAAG,sBAAsB,kDAAkD,YAAY,EAAE,eAAe,gBAAgB,kBAAkB,gBAAgB,QAAQ,YAAY,KAAK,KAAK,YAAY,MAAM,0BAA0B,UAAU,WAAW,IAAI,MAAM,0DAA0D,YAAY,yBAAyB;AACve,cAAc,SAAS,mBAAmB,iBAAiB,mBAAmB,6BAA6B,EAAE,6CAA6C,QAAQ,mCAAmC,mBAAmB,EAAE,SAAS,EAAE,OAAO,uBAAuB,gBAAgB,gBAAgB,UAAU,UAAU,6FAA6F,yCAAyC,oBAAoB,OAAO;AACxd,gBAAgB,kBAAkB,KAAK,UAAU,UAAU,KAAK,MAAM,uFAAuF,6BAA6B,kBAAkB,sBAAsB,sBAAsB,oBAAoB,oBAAoB,SAAS,kBAAkB,UAAU,iBAAiB,OAAO,6BAA6B,KAAK,KAAK,KAAK,UAAU,OAAO,UAAU,WAAW,OAAO,gCAAgC;AACtd,EAAE,KAAK,gBAAgB,KAAK,KAAK,UAAU,uBAAuB,mBAAmB,sCAAsC,kBAAkB,oBAAoB,KAAK,oCAAoC,aAAa,KAAK,oBAAoB,kBAAkB,8BAA8B,wDAAwD,sBAAsB,KAAK,gEAAgE,UAAU,wBAAwB,aAAa;AACle,SAAS,qBAAqB,YAAY,SAAS,mCAAmC,wBAAwB,kBAAkB,UAAU,QAAQ,IAAI,aAAa,4CAA4C,IAAI,gBAAgB,6FAA6F,oDAAoD,IAAI,2BAA2B,aAAa,IAAI,cAAc,UAAU,sDAAsD;AAClf,oBAAoB,mBAAmB,qBAAqB,KAAK,QAAQ,IAAI,oBAAoB,WAAW,KAAK,uFAAuF,6BAA6B,kBAAkB,sBAAsB,sBAAsB,oBAAoB,oBAAoB,QAAQ,IAAI,aAAa,SAAS,mBAAmB,UAAU,cAAc,eAAe,gBAAgB,+BAA+B,KAAK,KAAK,KAAK,UAAU;AAC/e,UAAU,WAAW,OAAO,gCAAgC,mCAAmC,KAAK,mBAAmB,KAAK,KAAK,UAAU,qBAAqB,KAAK,gBAAgB,kBAAkB,oBAAoB,KAAK,YAAY,IAAI,gBAAgB,aAAa,sEAAsE,KAAK,6EAA6E,WAAW,0BAA0B,aAAa,6BAA6B;AACpf,WAAW,YAAY,SAAS,kBAAkB,YAAY,KAAK,iEAAiE,gBAAgB,cAAc,iBAAiB,wBAAwB,YAAY,oBAAoB,YAAY,KAAK,KAAK,YAAY,wCAAwC,yBAAyB,4BAA4B,kCAAkC,YAAY,KAAK;AAC7Z,8CAA8C,iBAAiB,IAAI,mGAAmG,sBAAsB,IAAI,yBAAyB,kBAAkB,cAAc,eAAe,oBAAoB,UAAU,mDAAmD,aAAa,cAAc,cAAc,kGAAkG,kBAAkB;AACtf,oFAAoF,gBAAgB,wKAAwK,cAAc,6BAA6B,6DAA6D,cAAc,4EAA4E,oBAAoB;AACle,GAAG,0BAA0B,iCAAiC,2CAA2C,YAAY,0BAA0B,EAAE,2BAA2B,2BAA2B,cAAc,sCAAsC,kBAAkB,qGAAqG,aAAa,YAAY,gBAAgB,uCAAuC,yBAAyB,yBAAyB;AACpf,iDAAiD,cAAc,8BAA8B,qBAAqB,uBAAuB,4BAA4B,cAAc,mCAAmC,mBAAmB,qBAAqB,eAAe,cAAc,MAAM,uCAAuC,yBAAyB,QAAQ,WAAW,oBAAoB,eAAe,wBAAwB,sDAAsD;AACre,mBAAmB,gDAAgD,gDAAgD,2BAA2B,6BAA6B,kCAAkC,gCAAgC,kBAAkB,wDAAwD,aAAa,aAAa,gBAAgB,gBAAgB,wBAAwB,OAAO,6DAA6D,sCAAsC,WAAW;AAC9f,+GAA+G,kEAAkE,OAAO,qCAAqC,mDAAmD,sFAAsF,+CAA+C,kFAAkF;AACve,2EAA2E,sEAAsE,8EAA8E,qGAAqG,WAAW,gCAAgC,+BAA+B,mBAAmB,wBAAwB,IAAI,sBAAsB,gBAAgB,iBAAiB;AACpf,8CAA8C,kDAAkD,uEAAuE,OAAO,QAAQ,WAAW,wHAAwH,SAAS,SAAS,SAAS,KAAK,UAAU,WAAW,qBAAqB,oBAAoB,sBAAsB,2BAA2B,iBAAiB,aAAa;AACte,oBAAoB,gBAAgB,kBAAkB,KAAK,SAAS,YAAY,qBAAqB,OAAO,YAAY,qBAAqB,2CAA2C,sCAAsC,iCAAiC,WAAW,gBAAgB,yBAAyB,2BAA2B,gCAAgC,kBAAkB,oBAAoB,KAAK,SAAS,2DAA2D,KAAK,KAAK,iBAAiB,UAAU,cAAc;AAChhB,IAAI,EAAE,OAAO,wCAAwC,2CAA2C,4BAA4B,0DAA0D,8CAA8C,gBAAgB,yDAAyD,+CAA+C,aAAa,YAAY,2BAA2B,mGAAmG;AACnf,uBAAuB,cAAc,SAAS,WAAW,YAAY,SAAS,kBAAkB,6BAA6B,WAAW,6GAA6G,kEAAkE,gHAAgH,+BAA+B,qCAAqC;AAC3e,mCAAmC,SAAS,sCAAsC,WAAW,cAAc,WAAW,uBAAuB,yBAAyB,KAAK,IAAI,yBAAyB,wBAAwB,QAAQ,WAAW,oCAAoC,wBAAwB,QAAQ,IAAI,KAAK,QAAQ,WAAW,8BAA8B,kFAAkF,gBAAgB,eAAe,YAAY;AAC9e,iBAAiB,EAAE,eAAe,KAAK,YAAY,2BAA2B,UAAU,wBAAwB,cAAc,QAAQ,WAAW,mBAAmB,QAAQ,IAAI,mBAAmB,mBAAmB,SAAS,gDAAgD,sBAAsB,YAAY,GAAG,EAAE,kBAAkB,gBAAgB,oBAAoB,WAAW,YAAY,WAAW,yBAAyB,oCAAoC,KAAK,GAAG,EAAE,cAAc;AACne,oBAAoB,iBAAiB,YAAY,mBAAmB,eAAe,uCAAuC,qBAAqB,kBAAkB,WAAW,QAAQ,IAAI,gBAAgB,OAAO,kBAAkB,UAAU,qBAAqB,oBAAoB,YAAY,UAAU,gBAAgB,YAAY,gBAAgB,YAAY,WAAW,uBAAuB,yBAAyB,OAAO,UAAU,kBAAkB,gBAAgB,WAAW,OAAO;AACle,oBAAoB,mBAAmB,OAAO,SAAS,gBAAgB,YAAY,cAAc,cAAc,kBAAkB,iBAAiB,mBAAmB,wBAAwB,kCAAkC,EAAE,gBAAgB,QAAQ,oBAAoB,oBAAoB,kCAAkC,oBAAoB,oBAAoB,iBAAiB,qCAAqC,qCAAqC,iBAAiB,QAAQ,IAAI;AACne,2BAA2B,SAAS,KAAK,sCAAsC,kDAAkD,sEAAsE,iCAAiC,uCAAuC,eAAe,QAAQ,IAAI,gGAAgG,QAAQ,KAAK,KAAK,UAAU,6CAA6C,QAAQ,sBAAsB;AACjf,6BAA6B,EAAE,SAAS,oCAAoC,QAAQ,sBAAsB,uDAAuD,EAAE,SAAS,EAAE,OAAO,iBAAiB,6BAA6B,gBAAgB,KAAK,gBAAgB,KAAK,sBAAsB,2BAA2B,EAAE,WAAW,KAAK,gBAAgB,yBAAyB,WAAW,aAAa,EAAE,WAAW,0DAA0D,SAAS,oBAAoB;AACrf,GAAG,KAAK,YAAY,WAAW,YAAY,2BAA2B,2BAA2B,cAAc,MAAM,sEAAsE,8DAA8D,uHAAuH,IAAI,QAAQ,uEAAuE,sBAAsB;AACzd,GAAG,SAAS,cAAc,MAAM,UAAU,0BAA0B,YAAY,OAAO,EAAE,SAAS,mBAAmB,uCAAuC,eAAe,qCAAqC,eAAe,sBAAsB,cAAc,aAAa,cAAc,oBAAoB,8BAA8B,EAAE,eAAe,cAAc,UAAU,0EAA0E,IAAI,SAAS,qBAAqB;AACre,WAAW,cAAc,EAAE,aAAa,gBAAgB,uBAAuB,GAAG,0CAA0C,oBAAoB,yBAAyB,EAAE,oDAAoD,OAAO,cAAc,GAAG,qBAAqB,gBAAgB,EAAE,6BAA6B,OAAO,0BAA0B,YAAY,WAAW,4BAA4B,UAAU,UAAU,UAAU,SAAS,4BAA4B,aAAa,mBAAmB;AAClf,SAAS,SAAS,OAAO,YAAY,IAAI,QAAQ,uBAAuB,iBAAiB,0BAA0B,mCAAmC,QAAQ,KAAK,EAAE,yBAAyB,0DAA0D,YAAY,gBAAgB,yBAAyB,YAAY,mBAAmB,yBAAyB,YAAY,qBAAqB,UAAU,YAAY,MAAM,GAAG,sBAAsB,QAAQ,OAAO,EAAE,oBAAoB,qBAAqB;AACrf,WAAW,GAAG,mCAAmC,uCAAuC,EAAE,SAAS,GAAG,sBAAsB,KAAK,eAAe,KAAK,eAAe,KAAK,KAAK,wDAAwD,eAAe,qCAAqC,eAAe,4BAA4B,kDAAkD,EAAE,oBAAoB,eAAe,kBAAkB,eAAe,cAAc,eAAe;AAC1d,WAAW,cAAc,yBAAyB,gBAAgB,aAAa,2IAA2I,2CAA2C,cAAc,0BAA0B,kBAAkB,WAAW,WAAW,gBAAgB,QAAQ,kBAAkB,WAAW,WAAW,iEAAiE,QAAQ,aAAa;AAC3e,oBAAoB,UAAU,cAAc,wBAAwB,YAAY,oCAAoC,oBAAoB,EAAE,eAAe,iBAAiB,oCAAoC,8EAA8E,EAAE,qBAAqB,oCAAoC,kCAAkC,EAAE,uBAAuB,eAAe,kDAAkD;AACnd,kCAAkC,oCAAoC,sCAAsC,mCAAmC,8CAA8C,iBAAiB,SAAS,0BAA0B,UAAU,sBAAsB,iBAAiB,yBAAyB,kBAAkB,SAAS,cAAc,kBAAkB,YAAY,MAAM,kBAAkB,kBAAkB,kBAAkB,SAAS,EAAE,WAAW,uBAAuB;AAC3e,oBAAoB,qBAAqB,EAAE,SAAS,gBAAgB,8BAA8B,sBAAsB,oBAAoB,gDAAgD,2BAA2B,+BAA+B,YAAY,wCAAwC,0CAA0C,SAAS,mBAAmB,eAAe,oCAAoC,YAAY,qDAAqD;AACpe,0BAA0B,aAAa,EAAE,sBAAsB,oBAAoB,yBAAyB,mFAAmF,mBAAmB,YAAY,uEAAuE,0EAA0E,SAAS,EAAE,YAAY,kBAAkB,cAAc,WAAW,WAAW,KAAK,yBAAyB;AAC1d,+BAA+B,iFAAiF,2BAA2B,uDAAuD,QAAQ,0DAA0D,iBAAiB,EAAE,WAAW,WAAW,oBAAoB;AACjU,8DAA8D,gBAAgB,EAAE,2GAA2G,SAAS,8DAA8D,uBAAuB,6EAA6E,OAAO,8BAA8B,oBAAoB,QAAQ,uDAAuD;AAC9d,+BAA+B,gCAAgC,SAAS,EAAE,OAAO,yCAAyC,cAAc,cAAc,WAAW,iBAAiB,eAAe,SAAS,EAAE,OAAO,SAAS,WAAW,WAAW,yBAAyB,oBAAoB,4CAA4C,EAAE,YAAY,6DAA6D,uDAAuD,iBAAiB;AAC9d,uFAAuF,wBAAwB,sCAAsC,MAAM,sCAAsC,wCAAwC,EAAE,OAAO,mCAAmC,gBAAgB,gBAAgB,WAAW,aAAa,uBAAuB,gBAAgB,SAAS,EAAE,WAAW,WAAW,yBAAyB,oBAAoB,gBAAgB,SAAS,EAAE;AAC7d,GAAG,aAAa,SAAS,OAAO,2CAA2C,mBAAmB,iBAAiB,8DAA8D,sBAAsB,MAAM,gBAAgB,oBAAoB,uBAAuB,EAAE,UAAU,SAAS,mBAAmB,iBAAiB,yBAAyB,iJAAiJ;AACve,uBAAuB,GAAG,WAAW,+CAA+C,IAAI,oBAAoB,EAAE,YAAY,oBAAoB,OAAO,gCAAgC,oBAAoB,kBAAkB,uBAAuB,aAAa,EAAE,oBAAoB,kBAAkB,yBAAyB,4CAA4C,0BAA0B,EAAE,uCAAuC,qCAAqC,eAAe,SAAS;AAC5e,qCAAqC,iBAAiB,qCAAqC,OAAO,oBAAoB,gBAAgB,gBAAgB,oBAAoB,SAAS,EAAE,gBAAgB,cAAc,yBAAyB,qBAAqB,EAAE,wEAAwE,gDAAgD,kBAAkB,sCAAsC,eAAe,SAAS;AAC3c,gDAAgD,iBAAiB,2FAA2F,OAAO,yCAAyC,gBAAgB,mCAAmC,uBAAuB,gBAAgB,WAAW,cAAc,kBAAkB,SAAS,EAAE,gBAAgB,WAAW,uBAAuB,4BAA4B,GAAG,WAAW,UAAU,iOAAiO,SAAS;AAC5qB,gBAAgB,SAAS,EAAE,uCAAuC,aAAa,iBAAiB,iDAAiD,EAAE,wCAAwC,SAAS,iBAAiB,qBAAqB,qBAAqB,YAAY,EAAE,uCAAuC,gJAAgJ,iBAAiB,gBAAgB;AACre,yCAAyC,yBAAyB,oHAAoH,oCAAoC,gBAAgB,EAAE,2CAA2C,yCAAyC,mDAAmD,iBAAiB,qDAAqD,oCAAoC;AAC7d,KAAK,GAAG,+BAA+B,yBAAyB,GAAG,KAAK,YAAY,EAAE,wCAAwC,uBAAuB,YAAY,EAAE,iBAAiB,uBAAuB,8BAA8B,EAAE,EAAE,yCAAyC,WAAW,iBAAiB,qBAAqB,EAAE,yCAAyC,wDAAwD,iBAAiB;AAC3b,UAAU,wBAAwB,2CAA2C,cAAc,EAAE,kEAAkE,kGAAkG,iBAAiB,cAAc,0DAA0D,6BAA6B,uEAAuE,EAAE,iDAAiD;AACjf,aAAa,iBAAiB,uBAAuB,sBAAsB,YAAY,EAAE,sCAAsC,QAAQ,wCAAwC,SAAS,iBAAiB,4CAA4C,EAAE,sCAAsC,SAAS,iBAAiB,SAAS,EAAE,sCAAsC,aAAa,iBAAiB,oCAAoC,EAAE,sCAAsC,yBAAyB,UAAU,EAAE;AACvf,gBAAgB,uBAAuB,uBAAuB,EAAE,EAAE,4CAA4C,yCAAyC,iBAAiB,2CAA2C,0BAA0B,YAAY,GAAG,EAAE,SAAS,gBAAgB,mCAAmC,mCAAmC,aAAa,4DAA4D,SAAS,EAAE,+BAA+B,kBAAkB;AACle,kCAAkC,iBAAiB,EAAE,iEAAiE,0BAA0B,EAAE,6BAA6B,+CAA+C,YAAY,OAAO,GAAG,UAAU,OAAO,EAAE,mCAAmC,WAAW,uBAAuB,qBAAqB,EAAE,EAAE,SAAS,gBAAgB,mCAAmC,mCAAmC,8BAA8B;AACle,uDAAuD,KAAK,qBAAqB,mCAAmC,wBAAwB,iBAAiB,gBAAgB,UAAU,mDAAmD,wBAAwB,EAAE,KAAK,+IAA+I,2BAA2B,cAAc,WAAW,UAAU,SAAS,eAAe;AAC9e,WAAW,WAAW,WAAW,aAAa,qBAAqB,oBAAoB,sBAAsB,OAAO,aAAa,mCAAmC,UAAU,EAAE,uEAAuE,cAAc,EAAE,EAAE,mCAAmC,WAAW,uBAAuB,cAAc,uBAAuB,GAAG,8DAA8D,mBAAmB,UAAU,UAAU,mCAAmC;AAC9f,eAAe,EAAE,wBAAwB,oBAAoB,oBAAoB,0CAA0C,kBAAkB,IAAI,KAAK,6BAA6B,aAAa,kBAAkB,IAAI,6BAA6B,kBAAkB,0CAA0C,4BAA4B,8BAA8B,YAAY,gBAAgB,IAAI,KAAK,uBAAuB,kEAAkE,EAAE,cAAc,KAAK;AAC5f,yBAAyB,iDAAiD,IAAI,KAAK,oCAAoC,IAAI,4DAA4D,oCAAoC,GAAG,UAAU,YAAY,YAAY,aAAa,KAAK,GAAG,2BAA2B,2BAA2B,IAAI,GAAG,SAAS,EAAE,EAAE,SAAS,cAAc,mCAAmC,mCAAmC,WAAW,qBAAqB;AAC5d,oCAAoC,EAAE,EAAE,mCAAmC,WAAW,uBAAuB,qBAAqB,EAAE,EAAE,SAAS,sBAAsB,iEAAiE,oBAAoB,oBAAoB,qBAAqB,0BAA0B,GAAG,+CAA+C,iBAAiB,kBAAkB,oBAAoB,iBAAiB,SAAS,mBAAmB;AACnd,mCAAmC,gBAAgB,iCAAiC,GAAG,EAAE,KAAK,oBAAoB,wCAAwC,kDAAkD,gDAAgD,mCAAmC,4BAA4B,GAAG,aAAa,mDAAmD,GAAG,iEAAiE,GAAG,IAAI,KAAK,sCAAsC;AACpf,kCAAkC,GAAG,IAAI,gBAAgB,GAAG,OAAO,GAAG,kBAAkB,qFAAqF,uBAAuB,OAAO,oBAAoB,QAAQ,WAAW,OAAO,OAAO,iCAAiC,0BAA0B,EAAE,6BAA6B,2BAA2B,wCAAwC,sBAAsB,sBAAsB,SAAS,KAAK,IAAI;AAC3d,mEAAmE,kCAAkC,mBAAmB,0BAA0B,kBAAkB,IAAI,EAAE,mDAAmD,GAAG,KAAK,oBAAoB,8CAA8C,uCAAuC,WAAW,aAAa,oBAAoB,UAAU,YAAY,4BAA4B,wBAAwB,sCAAsC;AAC1e,iBAAiB,IAAI,kBAAkB,GAAG,eAAe,WAAW,uBAAuB,sBAAsB,sBAAsB,SAAS,KAAK,GAAG,4BAA4B,kBAAkB,IAAI,EAAE,iBAAiB,wEAAwE,sBAAsB,aAAa,wEAAwE,cAAc,UAAU,cAAc,GAAG,wCAAwC,kBAAkB;AACnf,oDAAoD,6BAA6B,IAAI,cAAc,8BAA8B,GAAG,sEAAsE,oBAAoB,IAAI,cAAc,0BAA0B,oBAAoB,GAAG,yBAAyB,GAAG,gDAAgD,YAAY,QAAQ,MAAM,UAAU,+CAA+C,OAAO,gBAAgB,KAAK;AAC5d,YAAY,KAAK,aAAa,MAAM,GAAG,YAAY,KAAK,kBAAkB,MAAM,GAAG,sBAAsB,cAAc,UAAU,0CAA0C,0CAA0C,0CAA0C,kBAAkB,kBAAkB,aAAa,qBAAqB,sCAAsC,GAAG,eAAe,gCAAgC,kEAAkE,0BAA0B;AACzf,GAAG,yCAAyC,sEAAsE,iBAAiB,iBAAiB,oBAAoB,0BAA0B,EAAE,aAAa,GAAG,8CAA8C,qDAAqD,qBAAqB,IAAI,aAAa,oBAAoB,sCAAsC,IAAI,0BAA0B,0BAA0B,gBAAgB;AAC/d,WAAW,uBAAuB,0BAA0B,EAAE,aAAa,GAAG,kEAAkE,UAAU,+EAA+E,0CAA0C,WAAW,KAAK,WAAW,IAAI,eAAe,sBAAsB,iCAAiC,MAAM,gBAAgB,gBAAgB,KAAK,iBAAiB,uBAAuB,KAAK,wCAAwC;AACxf,eAAe,EAAE,8BAA8B,EAAE,sBAAsB,gCAAgC,WAAW,KAAK,4EAA4E,MAAM,kBAAkB,UAAU,UAAU,sGAAsG,uBAAuB,GAAG;AAC/W,uDAAuD,GAAG,KAAK,UAAU,iBAAiB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,iBAAiB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,kBAAkB,MAAM,kBAAkB,oEAAoE,GAAG,SAAS,qBAAqB,KAAK,mBAAmB;AAC9d,aAAa,wDAAwD,qBAAqB,IAAI,gEAAgE,qBAAqB,IAAI,GAAG,IAAI,UAAU,6CAA6C,oCAAoC,GAAG,oBAAoB,GAAG,SAAS,4BAA4B,MAAM,6BAA6B,IAAI,MAAM,6BAA6B,IAAI,MAAM,6BAA6B,IAAI,MAAM,iBAAiB,MAAM;AAC1e,KAAK,IAAI,MAAM,kBAAkB,IAAI,MAAM,kBAAkB,IAAI,MAAM,yBAAyB,MAAM,yBAAyB,MAAM,yBAAyB,4BAA4B,sBAAsB,sEAAsE,wFAAwF,gCAAgC,aAAa,2BAA2B,mBAAmB,QAAQ,KAAK,IAAI,oBAAoB,cAAc;AAC5f,KAAK,8FAA8F,aAAa,aAAa,wEAAwE,GAAG,aAAa,8CAA8C,GAAG,uBAAuB,WAAW,KAAK,WAAW,QAAQ,aAAa,aAAa,wDAAwD,GAAG,aAAa,8BAA8B,GAAG,uBAAuB,WAAW,KAAK,WAAW;AACrf,IAAI,qDAAqD,qBAAqB,MAAM,iDAAiD,gBAAgB,+BAA+B,2DAA2D,GAAG,SAAS,+CAA+C,kBAAkB,MAAM,iDAAiD,gBAAgB,4BAA4B,SAAS,GAAG,wBAAwB,gBAAgB,kBAAkB,YAAY,GAAG;AACpf,EAAE,sCAAsC,8CAA8C,oEAAoE,WAAW,iBAAiB,WAAW,YAAY,uBAAuB,MAAM,mBAAmB,wEAAwE,WAAW,wBAAwB,oBAAoB,QAAQ,gCAAgC,SAAS,EAAE,8BAA8B,SAAS,EAAE,WAAW,iBAAiB;AACpf,iBAAiB,QAAQ,kBAAkB,qBAAqB,SAAS,eAAe,eAAe,mCAAmC,0CAA0C,GAAG,8CAA8C,KAAK,sBAAsB,yCAAyC,mCAAmC,iDAAiD,qBAAqB,WAAW,oBAAoB,IAAI,+DAA+D;AACpf,qBAAqB,aAAa,SAAS,eAAe,QAAQ,wBAAwB,sBAAsB,WAAW,qBAAqB,cAAc,kCAAkC,cAAc,YAAY,QAAQ,uCAAuC,iBAAiB,YAAY,4BAA4B,uBAAuB,eAAe,SAAS,sBAAsB,MAAM,UAAU,kCAAkC,yCAAyC,iBAAiB;AACnf,6BAA6B,8HAA8H,kHAAkH,cAAc,wCAAwC,sBAAsB,YAAY,iCAAiC,IAAI,iBAAiB,cAAc,kCAAkC,wBAAwB,cAAc;AACjf,GAAG,cAAc,2CAA2C,0BAA0B,EAAE,4BAA4B,yBAAyB,qEAAqE,mDAAmD,SAAS,0BAA0B,YAAY,EAAE,0CAA0C,eAAe,iBAAiB,qBAAqB,mBAAmB,6CAA6C;AACrd,4BAA4B,+CAA+C,KAAK,sBAAsB,yCAAyC,sCAAsC,iDAAiD,sBAAsB,WAAW,uBAAuB,IAAI,+DAA+D,GAAG,iBAAiB,cAAc,kBAAkB,uCAAuC,wBAAwB,eAAe;AACne,kBAAkB,yCAAyC,6CAA6C,6BAA6B,8BAA8B,6BAA6B,wBAAwB,EAAE,eAAe,0EAA0E,gBAAgB,wCAAwC,EAAE,4CAA4C,4DAA4D,EAAE,8CAA8C;AACrgB,+CAA+C,wCAAwC,oBAAoB,EAAE,EAAE,UAAU,UAAU,iDAAiD,yBAAyB,IAAI,6CAA6C,GAAG,eAAe,gCAAgC,6BAA6B,WAAW,sCAAsC,UAAU,mBAAmB,gBAAgB,sBAAsB,WAAW;AAC5c,UAAU,IAAI,EAAE,qBAAqB,aAAa,iEAAiE,GAAG,sBAAsB,WAAW,2HAA2H,KAAK,eAAe,iBAAiB,mBAAmB,MAAM,2BAA2B,MAAM,oDAAoD,MAAM,qBAAqB,IAAI,IAAI,EAAE,uCAAuC;AACjf,sCAAsC,EAAE,uBAAuB,mBAAmB,mDAAmD,8CAA8C,4DAA4D,2BAA2B,MAAM,YAAY,OAAO,iBAAiB,uBAAuB,wCAAwC,0DAA0D,8CAA8C;AAC3d,gCAAgC,oCAAoC,+BAA+B,yCAAyC,sBAAsB,+BAA+B,gCAAgC,6BAA6B,gCAAgC,gDAAgD,wBAAwB,yBAAyB,6CAA6C,yBAAyB,mCAAmC;AACxe,0BAA0B,+DAA+D,8DAA8D,yBAAyB,4EAA4E,0EAA0E,QAAQ,iKAAiK,KAAK;AACpf,4FAA4F,uEAAuE,iCAAiC,eAAe,EAAE,GAAG,SAAS,OAAO,oCAAoC,2DAA2D,KAAK,KAAK,2CAA2C,kBAAkB,GAAG,OAAO,eAAe,MAAM,mBAAmB,YAAY,kBAAkB,KAAK;AACne,iCAAiC,0CAA0C,gDAAgD,kGAAkG,+CAA+C,4DAA4D,kBAAkB,GAAG,KAAK,wDAAwD,GAAG,oCAAoC,yCAAyC,aAAa;AACvf,kBAAkB,KAAK,qBAAqB,kBAAkB,GAAG,KAAK,2BAA2B,MAAM,GAAG,EAAE,oCAAoC,oCAAoC,eAAe,oFAAoF,mBAAmB,KAAK,kBAAkB,+BAA+B,EAAE,oCAAoC,kCAAkC,gBAAgB,MAAM,8CAA8C;AAC5e,QAAQ,wBAAwB,MAAM,IAAI,KAAK,EAAE,mBAAmB,+BAA+B,UAAU,kBAAkB,6CAA6C,UAAU,EAAE,uBAAuB,UAAU,EAAE,eAAe,QAAQ,QAAQ,QAAQ,qBAAqB,iBAAiB,YAAY,WAAW,yBAAyB,SAAS,oBAAoB,6BAA6B,WAAW,oBAAoB,SAAS,UAAU,wCAAwC;AAC5e,UAAU,uBAAuB,2DAA2D,qBAAqB,0CAA0C,aAAa,KAAK,2DAA2D,gCAAgC,aAAa,wBAAwB,6DAA6D,+BAA+B,cAAc,iEAAiE,yBAAyB,YAAY,gBAAgB;AAC7gB,OAAO,YAAY,qBAAqB,QAAQ,4DAA4D,YAAY,wEAAwE,4BAA4B,MAAM,oBAAoB,sBAAsB,+CAA+C,4BAA4B,2BAA2B,6CAA6C,yBAAyB,gDAAgD,KAAK;AAC7e,OAAO,sBAAsB,eAAe,0BAA0B,kCAAkC,yEAAyE,eAAe,KAAK;AACrM,0CAA0C,OAAO,+OAA+O,aAAa;AAC7S,ofAAof;AACpf,cAAc,mPAAmP,eAAe,sCAAsC,YAAY,EAAE,KAAK,kBAAkB,aAAa,SAAS,wBAAwB,SAAS,2BAA2B,QAAQ,wBAAwB,WAAW,YAAY,SAAS;AAC7e,GAAG,iBAAiB,aAAa,cAAc,QAAQ,IAAI,cAAc,MAAM,cAAc,OAAO,UAAU,IAAI,uBAAuB,IAAI,gBAAgB,MAAM,gCAAgC,MAAM,sBAAsB,UAAU,KAAK,2RAA2R;AACzgB,IAAI,6FAA6F,KAAK,0CAA0C,iCAAiC,WAAW,WAAW,WAAW,WAAW,WAAW,WAAW,WAAW,QAAQ,wHAAwH,+GAA+G;AAC7e,kBAAkB,mBAAmB,mBAAmB,mBAAmB,4LAA4L,WAAW,WAAW,YAAY,WAAW,WAAW,SAAS,WAAW,WAAW,WAAW,WAAW,YAAY,YAAY,WAAW,WAAW,YAAY,WAAW,WAAW,YAAY,aAAa,YAAY;AACze,YAAY,SAAS,WAAW,WAAW,WAAW,WAAW,WAAW,WAAW,WAAW,YAAY,WAAW,WAAW,2BAA2B,cAAc,YAAY,gBAAgB,oBAAoB,kBAAkB,yBAAyB,wBAAwB,OAAO,EAAE,cAAc,qBAAqB,+BAA+B,wBAAwB,oBAAoB,aAAa,eAAe,sBAAsB,OAAO;AAChd,iDAAiD,4BAA4B,gEAAgE,8CAA8C,SAAS,mCAAmC,UAAU,EAAE,aAAa,8BAA8B,6BAA6B,kDAAkD,QAAQ,mCAAmC,mBAAmB,EAAE,SAAS,EAAE,OAAO,qBAAqB,gBAAgB;AACpe,6PAA6P;AAC7P,EAAE,oCAAoC,UAAU,sBAAsB,OAAO,uBAAuB,mBAAmB,sCAAsC,kBAAkB,oBAAoB,yCAAyC,0CAA0C,uDAAuD,UAAU,2BAA2B,kBAAkB,6BAA6B,qBAAqB,YAAY,SAAS,kBAAkB,gBAAgB,oBAAoB,yBAAyB;AAC1hB,uBAAuB,yCAAyC,uDAAuD,EAAE,iCAAiC,OAAO,WAAW,WAAW,UAAU,WAAW,WAAW,YAAY,6KAA6K;AAChZ,6NAA6N,KAAK,uKAAuK,KAAK;AAC9Y,YAAY,KAAK,iBAAiB,+BAA+B,mBAAmB,aAAa,2CAA2C,WAAW,gBAAgB,kBAAkB,qBAAqB,oBAAoB,kBAAkB,QAAQ,UAAU,UAAU,2CAA2C,kCAAkC,OAAO,uBAAuB,2DAA2D,kDAAkD,UAAU;AAClf,cAAc,qBAAqB,8CAA8C,oCAAoC,QAAQ,WAAW,UAAU,gCAAgC,gCAAgC,OAAO,aAAa,UAAU,WAAW,KAAK,WAAW,oIAAoI,SAAS,SAAS,WAAW,UAAU,WAAW,KAAK;AACtc,iBAAiB,OAAO,OAAO,8FAA8F,YAAY,iCAAiC,gBAAgB,kBAAkB,kBAAkB,YAAY,WAAW,oDAAoD,WAAW,WAAW,oBAAoB,WAAW,cAAc,mBAAmB,aAAa,sCAAsC,KAAK,cAAc,IAAI,qBAAqB,KAAK,KAAK,WAAW;AACnf,YAAY,UAAU,eAAe,aAAa,iCAAiC,aAAa,2BAA2B,cAAc,mBAAmB,IAAI,sBAAsB,IAAI,EAAE,cAAc,aAAa,YAAY,YAAY,YAAY,YAAY,YAAY,YAAY,eAAe,kBAAkB,IAAI,sBAAsB,IAAI,EAAE,cAAc,cAAc,QAAQ,MAAM,mCAAmC,WAAW,0CAA0C,EAAE,OAAO;AAC3e,YAAY,cAAc,KAAK,WAAW,cAAc,SAAS,qBAAqB,oBAAoB,sBAAsB,kBAAkB,cAAc,WAAW,WAAW,YAAY,mCAAmC,gBAAgB,GAAG,UAAU,IAAI,kBAAkB,oBAAoB,iBAAiB,mGAAmG,WAAW,WAAW,UAAU,aAAa,mBAAmB,aAAa;AAC7e,SAAS,KAAK,GAAG,6BAA6B,6DAA6D,uBAAuB,MAAM,sDAAsD,wDAAwD,IAAI,0BAA0B,iCAAiC,WAAW,0BAA0B,+BAA+B,6BAA6B,sCAAsC,0BAA0B;AACtd,YAAY,2BAA2B,EAAE,QAAQ,EAAE,gBAAgB,QAAQ,eAAe,cAAc,gEAAgE,6CAA6C,qDAAqD,WAAW,cAAc,UAAU,IAAI,OAAO,kBAAkB,aAAa,cAAc,mBAAmB,WAAW,iBAAiB,cAAc,SAAS,aAAa,iCAAiC,sBAAsB;AAC/e,uEAAuE,2FAA2F,aAAa,UAAU,WAAW,IAAI,eAAe,aAAa,IAAI,kBAAkB,cAAc,aAAa,mBAAmB,QAAQ,kBAAkB,sCAAsC,kBAAkB,cAAc,kBAAkB,cAAc;AACxa,kDAAkD,mFAAmF,yJAAyJ,yFAAyF,eAAe,iEAAiE,MAAM;AAC7c,aAAa,kGAAkG,iGAAiG,mBAAmB,iDAAiD,EAAE,IAAI,OAAO,kBAAkB,8FAA8F,IAAI,UAAU,mCAAmC,OAAO,aAAa,eAAe;AACre,yEAAyE,qBAAqB,+BAA+B,sBAAsB,sBAAsB,oJAAoJ,MAAM,UAAU,yBAAyB,gBAAgB,MAAM,mBAAmB,MAAM,mBAAmB,UAAU,OAAO,kBAAkB,YAAY,WAAW,iBAAiB;AACnf,cAAc,QAAQ,SAAS,mCAAmC,gDAAgD,2BAA2B,WAAW,IAAI,iGAAiG,UAAU,UAAU,UAAU,UAAU,UAAU,UAAU,aAAa,sBAAsB,IAAI,EAAE,kCAAkC,IAAI,cAAc,eAAe,EAAE,iBAAiB,UAAU;;AAElc,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,CAAC,qIAAqI;AACtI,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC;AACzC;AACA,QAAQ;AACR;AACA;;AAEA;AACA,iCAAiC,aAAa;AAC9C,kCAAkC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA,6CAA6C,iBAAiB;AAC9D,cAAc,gBAAgB;AAC9B;AACA,iDAAiD;AACjD;AACA,cAAc;AACd,wBAAwB;AACxB;AACA,kCAAkC;AAClC,cAAc;AACd,CAAC;AACD;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;;AAEA;AACA,CAAC,EAAE,4EAA4E;AAC/E;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA,CAAC,EAAE,mCAAmC;AACtC;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,G;AACA,cAAc,KAAK;AACnB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,8DAA8D;AAC9D,cAAc,KAAK;AACnB,8CAA8C;AAC9C,gBAAgB,KAAK;AACrB;AACA,4DAA4D;AAC5D;AACA;AACA;AACA,6DAA6D,sBAAsB;AACnF;AACA;AACA;;AAEA,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA,8CAA8C,yBAAyB,uBAAuB;AAC9F;AACA,cAAc,eAAe;AAC7B,2EAA2E;AAC3E;AACA,cAAc,kCAAkC,YAAY,mBAAmB,KAAK,mBAAmB,gBAAgB;AACvH;;AAEA;;AAEA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;;AAEA;AACA,CAAC,EAAE,4EAA4E;AAC/E;;AAEA;;AAEA;;AAEA;AACA;AACA,4CAA4C;AAC5C,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD,iBAAiB;AAClE,cAAc,cAAc;AAC5B;AACA,iDAAiD;AACjD;AACA,cAAc,sBAAsB,oCAAoC,cAAc;AACtF;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA;;AAEA;AACA,CAAC,EAAE,yBAAyB;AAC5B;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,+CAA+C;AACzG,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA;;AAEA;AACA,2BAA2B,WAAW;AACtC,2BAA2B,WAAW;AACtC,+B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA,gDAAgD,yBAAyB,uBAAuB;AAChG;AACA,cAAc,eAAe;AAC7B,2EAA2E;AAC3E;AACA,cAAc,kCAAkC,YAAY,mBAAmB,KAAK,mBAAmB,gBAAgB;AACvH;;AAEA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;;AAEA;AACA,CAAC,EAAE,4EAA4E;AAC/E;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA,GAAG;AACH,gBAAgB,YAAY;AAC5B;AACA,K;AACA;AACA;AACA;AACA,CAAC,EAAE,oCAAoC;AACvC;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,gCAAgC;AACnC;;AAEA;;AAEA;;AAEA;;AAEA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAE,yBAAyB;AAC5B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,K;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,K;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA,aAAa;AACb,aAAa;AACb;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oDAAoD;AACvD;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA,gBAAgB,KAAK;AACrB,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,2EAA2E;AAC9E;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;;AAEA;AACA,uBAAuB;AACvB,iEAAiE;AACjE,gBAAgB;AAChB,iCAAiC;AACjC,iBAAiB,SAAS;AAC1B,eAAe,IAAI,KAAK,MAAM;AAC9B,MAAM;AACN,cAAc;AACd,KAAK;AACL,wCAAwC;AACxC,yBAAyB;AACzB,iBAAiB,IAAI,KAAK,sBAAsB;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA,+BAA+B;;AAE/B;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;;AAEA;AACA;AACA,QAAQ;AACR,WAAW,SAAS,UAAU;;AAE9B;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA,uBAAuB;AACvB;AACA,iBAAiB;AACjB;AACA,cAAc,WAAW;;AAEzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,mDAAmD;AACtD,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,MAAM;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,MAAM;AACrC;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,MAAM;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,MAAM;AACrC;AACA;AACA;AACA,iCAAiC,KAAK;AACtC;AACA;AACA,4BAA4B,MAAM;AAClC;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA,gCAAgC,OAAO;AACvC;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,MAAM;AACrC;AACA;AACA,4BAA4B,MAAM;AAClC;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,MAAM;AACpC;AACA,4BAA4B,MAAM;AAClC;AACA,uBAAuB,MAAM;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA,gBAAgB,YAAY;AAC5B,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA,gBAAgB,YAAY;AAC5B;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA,CAAC,EAAE,SAAS;AACZ;AACA,CAAC,EAAE,6CAA6C;AAChD,aAAa;;AAEb;;AAEA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;;AAGA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,yBAAyB,MAAM;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,kDAAkD;AACrD;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,CAAC,EAAE,yBAAyB;AAC5B;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,8GAA8G;AACjH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sDAAsD,iBAAiB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;;AAEA;AACA;AACA;AACA,sDAAsD,iBAAiB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sDAAsD,iBAAiB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,0CAA0C;AAC7C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA,sBAAsB;AACtB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,CAAC;;AAED,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;;AAEA;AACA,kDAAkD;AAClD;AACA,qCAAqC;;AAErC;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,mCAAmC,+BAA+B;AAClE;;AAEA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,kBAAkB;AAClC;AACA,sCAAsC,WAAW;AACjD;;AAEA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,2BAA2B,YAAY,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,OAAO;AACd,sCAAsC;AACtC;AACA;AACA,+BAA+B,MAAM;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA,2BAA2B,YAAY,EAAE;AACzC;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA,G;;AAEA,UAAU;AACV;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,0CAA0C,mBAAmB;AAC7D;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA,+CAA+C,2CAA2C,OAAO;AACjG;AACA;AACA;AACA,yBAAyB;AACzB;AACA,GAAG;AACH,6BAA6B;AAC7B;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,kFAAkF,MAAM;AACxF;AACA,2DAA2D,UAAU;AACrE;AACA;AACA,O;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD,aAAa;AACb;AACA,eAAe;AACf;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA,2DAA2D;;AAE3D;AACA,oBAAoB;AACpB;AACA;AACA;AACA,OAAO;AACP,KAAK,aAAa,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,SAAS,EAAE,qCAAqC,sBAAsB,iCAAiC,QAAQ,8BAA8B,uBAAuB;;AAEpK,cAAc,qBAAqB;AACnC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY;AACZ,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,+EAA+E;AAClF;;AAEA;AACA;AACA,CAAC;;AAED,kCAAkC,iCAAiC,eAAe,eAAe,gBAAgB,oBAAoB,MAAM,0CAA0C,+BAA+B,aAAa,qBAAqB,mCAAmC,EAAE,EAAE,cAAc,WAAW,UAAU,EAAE,UAAU,MAAM,yCAAyC,EAAE,UAAU,kBAAkB,EAAE,EAAE,aAAa,EAAE,2BAA2B,0BAA0B,YAAY,EAAE,2CAA2C,8BAA8B,EAAE,OAAO,6EAA6E,EAAE,GAAG,EAAE;;AAErpB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,iBAAiB,cAAc;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY;AACZ,GAAG;AACH;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,kCAAkC,OAAO;AACzC;;AAEA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8FAA8F;AACjG;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,SAAS;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA,0BAA0B,mBAAmB;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAE;;AAEF;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,iGAAiG;AACpG;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;AACD,CAAC,EAAE,oCAAoC;AACvC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,8BAA8B;AACpD,sBAAsB,8BAA8B;AACpD,sBAAsB,8BAA8B;;AAEpD;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,mBAAmB,OAAO;AACzD,+BAA+B,mBAAmB,OAAO;AACzD,+BAA+B,mBAAmB,OAAO;AACzD;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD,wCAAwC;AACxC,wCAAwC;AACxC;;AAEA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,sDAAsD;AACtD,wCAAwC;AACxC,wCAAwC;AACxC;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,yCAAyC;AAC5D,mBAAmB,yCAAyC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wCAAwC;AAC3D,mBAAmB,yCAAyC;AAC5D,mBAAmB,yCAAyC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uCAAuC;AAC1D,mBAAmB,wCAAwC;AAC3D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+DAA+D,WAAW;AAC1E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2DAA2D,wBAAwB;;AAEnF;AACA;AACA,2CAA2C,wBAAwB;AACnE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,8EAA8E,4BAA4B,gBAAgB;AAC1H,8EAA8E,2BAA2B,gBAAgB;AACzH,qDAAqD,oDAAoD,gBAAgB;AACzH,qDAAqD,oDAAoD,gBAAgB;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA,oDAAoD,0BAA0B;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA,KAAK,kBAAkB,YAAY,kBAAkB;AACrD;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,4BAA4B,YAAY;;AAExC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE;AACjE,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE;AACjE,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE;AACjF,+BAA+B,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE;AACjF;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,UAAU,OAAO,UAAU,OAAO,SAAS;AACnF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA,mDAAmD;AACnD,CAAC,4BAA4B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oEAAoE;AACpE,6CAA6C;AAC7C,0DAA0D;AAC1D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,mEAAmE,+BAA+B,EAAE;AAC7G;AACA;;AAEA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,uCAAuC;AACvC,wBAAwB;AACxB,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2DAA2D,OAAO;AAClE;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC,uDAAuD;AACvD,gEAAgE;AAChE,oDAAoD;AACpD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D;AACA;AACA,YAAY;AACZ;;AAEA;AACA;;AAEA;AACA,uBAAuB;AACvB,0BAA0B;AAC1B,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,mEAAmE,gCAAgC,EAAE;AACrG;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,kCAAkC,EAAE;AACjE;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,wDAAwD,EAAE;;AAEtF;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D,OAAO;AACrE,UAAU;AACV;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kDAAkD,cAAc;AAChE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gEAAgE;AAChE,0CAA0C;AAC1C,+DAA+D;AAC/D,4CAA4C;AAC5C;AACA;;AAEA;;AAEA;AACA,yBAAyB,uBAAuB;AAChD,yBAAyB,0EAA0E,EAAE;;AAErG;AACA;;AAEA;AACA;AACA;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA;;AAEA;AACA,wBAAwB;AACxB;AACA;;AAEA;;AAEA;AACA;AACA,gEAAgE;AAChE,sCAAsC;AACtC,mDAAmD;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA,4CAA4C,8BAA8B;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX,SAAS;AACT;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB;AACvB,0CAA0C,WAAW,EAAE;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,gCAAgC,cAAc,EAAE;AAChD;;AAEA;AACA,2EAA2E,gBAAgB,EAAE;AAC7F;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,6BAA6B,iBAAiB,EAAE,EAAE;AACvF;;AAEA;;AAEA;AACA,kEAAkE,OAAO;AACzE,yBAAyB,OAAO;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,wEAAwE;AACxE,iDAAiD;AACjD,8DAA8D;AAC9D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAU,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAA8C,cAAc;;AAE5D,CAAC;;AAED,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,4DAA4D;AAC/D;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,KAAK;AACnB;AACA;;AAEA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,G;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,Y;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,8HAA8H;AACjI;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,qIAAqI;AACtI,CAAC,EAAE,uCAAuC;AAC1C,aAAa;;AAEb;;AAEA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,oCAAoC,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,KAAK;AACnB;AACA,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY,mBAAmB;;AAE/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,wHAAwH;AAC3H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,cAAc;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,yBAAyB;AACzB;AACA;AACA,kBAAkB,WAAW;AAC7B,iBAAiB,gBAAgB,UAAU;AAC3C;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oDAAoD,cAAc;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA,WAAW;;AAEX,KAAK;AACL;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,kBAAkB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,qBAAqB;AACxE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB,oBAAoB;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,2BAA2B;AAC7C,kBAAkB,2BAA2B;AAC7C,kBAAkB,2BAA2B;AAC7C,kBAAkB;AAClB,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,aAAa,gBAAgB,aAAa;AACpD;AACA,oDAAoD;AACpD;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;AACA;;AAEA;AACA;;AAEA;AACA,gCAAgC;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,eAAe;AACf,4BAA4B,yBAAyB;AACrD;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,sCAAsC;AAC3D;AACA;;AAEA;AACA,sBAAsB,yBAAyB;AAC/C,sBAAsB,yBAAyB;AAC/C,sBAAsB,yBAAyB;AAC/C,sBAAsB,4BAA4B;AAClD,iCAAiC;AACjC;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,CAAC,GAAG;AACJ;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;;AAEA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,GAAG;AACtC;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,OAAO;AAC7B,sCAAsC,QAAQ;AAC9C,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B,GAAG;AAC/B;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,2BAA2B,OAAO;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,GAAG;AAC/B;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,6BAA6B,OAAO;AACpC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,6BAA6B,OAAO;AACpC,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,6BAA6B,OAAO;AACpC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,GAAG;AAC/B;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,6BAA6B,OAAO;AACpC,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,6BAA6B,OAAO;AACpC,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,OAAO;AAClC,iBAAiB,MAAM;AACvB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,MAAM;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,QAAQ;AACtB;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,2DAA2D;AAC3D;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB;AACxB,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB;AACxB,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,uBAAuB,QAAQ,EAAE;AACjC;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,wBAAwB,QAAQ,EAAE;AAClC;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,gBAAgB;AAChB,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,2DAA2D;AAC3D;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,uBAAuB,QAAQ,EAAE;AACjC;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,wBAAwB,QAAQ,EAAE;AAClC;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,cAAc;AACnC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,qEAAqE;AACrE;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,QAAQ,EAAE;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,QAAQ,EAAE;AAClC;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,8BAA8B,SAAS;AACvC,iCAAiC,SAAS;AAC1C,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA,iBAAiB;AACjB,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,uBAAuB,QAAQ,EAAE;AACjC;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C,GAAG;AAC7C;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,oBAAoB;AAClE;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB;AACrB,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,a;AACA;AACA;AACA,S;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,S;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,a;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uE;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA,uDAAuD,uCAAuC;AAC9F;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,CAAC;;AAED;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA,uCAAuC;AACvC;AACA;AACA;AACA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA,mCAAmC,GAAG;AACtC;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;;;AAGA;AACA;AACA;AACA,oCAAoC,EAAE;AACtC,+BAA+B,EAAE;AACjC,gCAAgC,EAAE;AAClC,+BAA+B,EAAE;AACjC,yCAAyC,EAAE,MAAM,EAAE;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,OAAO;AAC1C,8BAA8B,OAAO;AACrC,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,GAAG;AAC9B;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,uCAAuC,oBAAoB;AAC3D,8BAA8B,OAAO;AACrC,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,SAAS;AAChC,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,SAAS;AAChC,uBAAuB,SAAS;AAChC,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB,kBAAkB,OAAO;AACzB,gBAAgB,OAAO;AACvB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,GAAG;AAC1B;AACA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB,mBAAmB,OAAO;AAC1B,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,uBAAuB,aAAa;AACpC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,OAAO;AAC9B,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,wBAAwB,OAAO;AAC/B,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,sBAAsB,OAAO;AAC7B,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,2BAA2B,GAAG;AAC9B;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,OAAO;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,sBAAsB,OAAO;AAC7B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,MAAM;AAC3B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,2BAA2B,GAAG,yCAAyC,GAAG;AAC1E;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,oBAAoB,KAAK;AACzB,iBAAiB,MAAM;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,OAAO;AAC5B,oBAAoB,OAAO;AAC3B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,MAAM;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,MAAM;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,qBAAqB,MAAM;AAC3B,oBAAoB,SAAS;AAC7B,uBAAuB,OAAO;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,yDAAyD;AACzD,2BAA2B;AAC3B;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,MAAM;AAC3B,sBAAsB,OAAO;AAC7B,uBAAuB,OAAO;AAC9B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,OAAO;AAC5B,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,oBAAoB,KAAK;AACzB,iBAAiB,MAAM;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA,+BAA+B,GAAG,+BAA+B,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,GAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B,0BAA0B,SAAS;AACnC,8BAA8B,SAAS;AACvC,mCAAmC,SAAS;AAC5C,4BAA4B,SAAS;AACrC,iCAAiC,SAAS;AAC1C,+BAA+B,SAAS;AACxC,8BAA8B,OAAO;AACrC;AACA,4BAA4B,OAAO;AACnC,yBAAyB,OAAO;AAChC,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,QAAQ,EAAE;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,QAAQ,EAAE;AAClC;AACA,KAAK;;AAEL;AACA;AACA,qBAAqB,aAAa;AAClC,wBAAwB,OAAO;AAC/B,sBAAsB,OAAO;AAC7B,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,oBAAoB,KAAK;AACzB,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,GAAG;AACxC;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,kDAAkD,EAAE;AACpD,8CAA8C,EAAE;AAChD,0DAA0D,EAAE;AAC5D;AACA,CAAC;AACD;;AAEA;;AAEA;AACA;AACA;AACA,yBAAyB,OAAO;AAChC,2BAA2B,OAAO;AAClC,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,OAAO;AAChC,qBAAqB,MAAM;AAC3B,2BAA2B,OAAO;AAClC,mCAAmC,SAAS;AAC5C,8BAA8B,SAAS;AACvC,qCAAqC,SAAS;AAC9C,gCAAgC,SAAS;AACzC,mCAAmC,6BAA6B;AAChE,wCAAwC,QAAQ;AAChD;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,yBAAyB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F;AAC1F;AACA,iDAAiD;AACjD,+EAA+E;AAC/E,gFAAgF;AAChF,0DAA0D;AAC1D,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD,4FAA4F;AAC5F,8FAA8F;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B,sBAAsB,OAAO;AAC7B,2BAA2B,OAAO;AAClC,qCAAqC,OAAO;AAC5C,mCAAmC,SAAS;AAC5C,8BAA8B,SAAS;AACvC,qCAAqC,SAAS;AAC9C,gCAAgC,SAAS;AACzC,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe;AAC3D;AACA;AACA;AACA,+BAA+B,GAAG;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,GAAG;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,GAAG;AAChF;AACA;AACA;AACA;AACA,6BAA6B,yBAAyB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD,oEAAoE;AACpE,mDAAmD;AACnD,6CAA6C;AAC7C,uDAAuD;AACvD,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF,0FAA0F;AAC1F,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,WAAW;AACpE;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,yBAAyB,oBAAoB;AAC7C;AACA,4BAA4B,MAAM;AAClC,4BAA4B,MAAM;AAClC;AACA,6BAA6B,OAAO;AACpC,2BAA2B,OAAO;AAClC,qCAAqC,OAAO;AAC5C,mCAAmC,SAAS;AAC5C,8BAA8B,SAAS;AACvC,qCAAqC,SAAS;AAC9C,gCAAgC,SAAS;AACzC,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD,CAAC,EAAE,iCAAiC;AACpC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,mBAAmB;AACnB;AACA;AACA;AACA,KAAK;AACL;AACA,mBAAmB;AACnB;AACA;AACA;AACA,KAAK;AACL;AACA,kBAAkB,uLAAuL,2IAA2I,SAAS;AAC7V;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA,CAAC;;AAED,CAAC,EAAE,qBAAqB;AACxB;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,+HAA+H;AAClI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA,CAAC,EAAE,8DAA8D;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;;AAEA,yCAAyC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,wBAAwB;AACtC;AACA;;AAEA;AACA,sBAAsB,cAAc;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wEAAwE;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kDAAkD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB,kBAAkB,OAAO;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uIAAuI;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,mCAAmC;AACrD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA,WAAW,mBAAmB;AAC9B,WAAW,mBAAmB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,KAAK,QAAQ;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,oBAAoB,kBAAkB;;AAEtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,0EAA0E;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA;AACA,wBAAwB,mCAAmC;AAC3D;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;;AAErB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,iDAAiD,oCAAoC;AACrF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;AACA;;AAEA,CAAC,EAAE,4RAA4R;AAC/R;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,iBAAiB;AACjB,eAAe;;AAEf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,qBAAqB;;AAE3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,yBAAyB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,yBAAyB,4CAA4C;;AAErE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,4CAA4C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,4JAA4J;AAC/J;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,mGAAmG;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,gBAAgB;AACtC;;AAEA;AACA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oJAAoJ;AACvJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sGAAsG;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qrBAAqrB;AACxrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,oBAAoB;AAC9B,UAAU,mBAAmB;AAC7B,UAAU,mBAAmB;AAC7B,UAAU,qBAAqB;AAC/B,UAAU,oBAAoB;AAC9B,UAAU,oBAAoB;AAC9B,UAAU,oBAAoB;AAC9B,UAAU,mBAAmB;AAC7B,UAAU,qBAAqB;AAC/B,UAAU,qBAAqB;AAC/B,UAAU,yBAAyB;AACnC;AACA;AACA;AACA;AACA,UAAU,2CAA2C;AACrD,UAAU;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,4BAA4B,eAAe,2BAA2B;AACtE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+BAA+B;AAC/B;AACA,CAAC;;AAED,gCAAgC;AAChC;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,oBAAoB,oBAAoB;AACxC,oBAAoB,oBAAoB;AACxC;AACA,wBAAwB,oBAAoB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oBAAoB;AAC5C,wBAAwB;AACxB,aAAa;AACb;AACA,6BAA6B;AAC7B;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,kEAAkE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,uCAAuC;;AAEnE,gCAAgC,8CAA8C;;AAE9E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,6DAA6D;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,iBAAiB;AAC/B;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oBAAoB,SAAS;AACrD;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,SAAS;AACT;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;;AAGA,SAAS;AACT;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,uIAAuI;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yCAAyC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qNAAqN;AACxN;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,wBAAwB;AAClE;AACA,yCAAyC,uBAAuB;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;;AAExC;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,cAAc,EAAE;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B,yCAAyC,oCAAoC;AAC7E,wCAAwC;AACxC,yBAAyB;AACzB;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAyD;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,oBAAoB,iCAAiC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,4BAA4B,sBAAsB;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,wdAAwd;AAC3d;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB,gBAAgB,OAAO;AACvB;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL,qBAAqB,mBAAmB;AACxC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,uBAAuB,sBAAsB;;AAE7C;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;;AAE7C;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mDAAmD;;AAEnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8GAA8G;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,2DAA2D;AAC3D;AACA;;AAEA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,kBAAkB;AAClB,iBAAiB;AACjB,iBAAiB;AACjB,oBAAoB;AACpB,WAAW,OAAO;AAClB,eAAe,OAAO;AACtB;AACA,YAAY;AACZ,cAAc;AACd,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B,QAAQ;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,cAAc;AACd,aAAa;AACb;AACA,WAAW,OAAO;AAClB,sBAAsB,QAAQ;AAC9B,mBAAmB,QAAQ;AAC3B;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,gCAAgC,cAAc;;AAE9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6FAA6F;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+JAA+J;AAClK;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,eAAe;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6EAA6E;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,kBAAkB,gBAAgB;AAClC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,oBAAoB,EAAE;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,eAAe;AACxE;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6NAA6N;AAChO;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,oGAAoG;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,oCAAoC,oBAAoB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,6BAA6B;AACtE,qCAAqC,sCAAsC;AAC3E;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,IAAI;AACf,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,aAAa,YAAY;AAC5D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,aAAa,YAAY;AAChE;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA8C,aAAa;AAC3D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,YAAY;AAChC;AACA,4CAA4C,UAAU;AACtD;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB,oBAAoB;AACpB;AACA;AACA,aAAa,uBAAuB;AACpC,qBAAqB,uCAAuC;AAC5D,iBAAiB,4CAA4C;AAC7D,yBAAyB,4DAA4D;AACrF,eAAe,4CAA4C;AAC3D,uBAAuB;AACvB;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,wCAAwC;;AAExC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,+CAA+C;;AAE/C;AACA;AACA;AACA;AACA,iDAAiD;AACjD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,+BAA+B;AACvD;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+CAA+C,aAAa;AAC5D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,kCAAkC;AAC1D;AACA;AACA;AACA;AACA;AACA,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;;AAEA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA4B;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB,WAAW,sBAAsB;AACjC,uBAAuB;AACvB,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kCAAkC;AAClC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,8BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,2WAA2W;AAC9W;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,SAAS;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;;;AAGA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;AACA;;AAEA;;AAEA;;AAEA,kBAAkB,sBAAsB;AACxC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAkD,aAAa;AAC/D;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iGAAiG;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,SAAS;AACrB,gBAAgB,QAAQ;AACxB,gBAAgB,OAAO;AACvB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA,YAAY,SAAS;AACrB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gHAAgH;AACnH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA;AACA;AACA;;AAEA;AACA,8BAA8B;AAC9B,8BAA8B;AAC9B,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kJAAkJ;AACrJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,sCAAsC;AACtC;;AAEA;;AAEA;AACA,mCAAmC;AACnC;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kDAAkD;;;AAGlD,sEAAsE;;AAEtE;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kDAAkD;;AAElD,sEAAsE;;AAEtE;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oFAAoF;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA,sCAAsC;AACtC;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,eAAe,GAAG,uBAAuB;AACjF;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,0BAA0B,kCAAkC,EAAE;;AAExF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,+DAA+D;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,mCAAmC;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;AACA;;AAEA,0BAA0B,yBAAyB;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS,oBAAoB;AAC7B;AACA,SAAS,sBAAsB;AAC/B,UAAU,2CAA2C;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,wCAAwC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,aAAa,WAAW;AACxB,aAAa,WAAW;AACxB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,iBAAiB,WAAW;AAC5B,iBAAiB,WAAW;AAC5B;;AAEA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,SAAS;;;AAGT;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,sBAAsB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,+BAA+B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,8BAA8B;AACnD;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,gCAAgC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC,kCAAkC,EAAE;;AAEzE;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,4BAA4B;AAChD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,sBAAsB;AAC3C,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B,0BAA0B;AAC1B,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;;AAEA;AACA,+BAA+B,QAAQ;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,QAAQ;;AAE9C;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mCAAmC,QAAQ;AAC3C;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oCAAoC;AACpC,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wCAAwC,QAAQ;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kSAAkS;AACrS;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,eAAe,GAAG,uBAAuB;AAC7E;;AAEA;AACA;;AAEA,CAAC,EAAE,8OAA8O;AACjP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oDAAoD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,0CAA0C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sEAAsE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,gBAAgB,qFAAqF;;AAErG;;AAEA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,qFAAqF;;AAErG;;AAEA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,qFAAqF;;AAErG;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL,yBAAyB,iDAAiD;;AAE1E,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA,uDAAuD,iBAAiB;;AAExE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,UAAU;AAC5B;AACA;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wIAAwI;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA,CAAC;;AAED,CAAC,EAAE,yEAAyE;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kDAAkD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,+GAA+G;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA,cAAc,8BAA8B;AAC5C;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;;;AAGA;AACA;AACA,mBAAmB,4BAA4B;AAC/C,qBAAqB,iCAAiC;AACtD,oBAAoB;AACpB,SAAS;AACT;AACA,kBAAkB,4BAA4B;AAC9C,qBAAqB,iCAAiC;AACtD,qBAAqB;AACrB;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA,cAAc,wBAAwB;AACtC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,kGAAkG;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,uHAAuH;AAC1H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,4DAA4D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C,yBAAyB;AACvE;AACA;;AAEA;AACA,+CAA+C,yBAAyB;AACxE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+IAA+I;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,uBAAuB;AACzC,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,+DAA+D,+BAA+B;AAC9F;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,gDAAgD,mBAAmB;AACnE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,aAAa;AACb,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C,OAAO;AACnD;AACA;AACA,aAAa;;AAEb;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,iVAAiV;AACpV;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA,2BAA2B;AAC3B;AACA;AACA,wBAAwB;AACxB;;AAEA;;AAEA;AACA;AACA;AACA,8CAA8C;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,+BAA+B;AAChD,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,sBAAsB,eAAe;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,qBAAqB;AAC/C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C,mCAAmC;AACnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;AACA;AACA;;AAEA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,+DAA+D;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C;AAC3C,SAAS;AACT,0BAA0B,mBAAmB;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,iBAAiB;;AAEpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC;AACvC,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD,4CAA4C;AAC5C,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD,uCAAuC;AACvC,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,qJAAqJ;AACxJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,EAAE;AACb;AACA,WAAW,QAAQ;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,KAAK;AACL;AACA;AACA;AACA,oBAAoB;;AAEpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA,yBAAyB,sCAAsC,EAAE;AACjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,sBAAsB,EAAE;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,qBAAqB,EAAE;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,4BAA4B,EAAE;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,8BAA8B,EAAE;AACzD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,yBAAyB,EAAE;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,0BAA0B,EAAE;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,2BAA2B,EAAE;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,4BAA4B,EAAE;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,4CAA4C,EAAE;AACvE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,uCAAuC,EAAE;AAClE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,mBAAmB;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,sBAAsB,EAAE;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,qBAAqB,EAAE;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,kCAAkC,EAAE;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,oCAAoC,EAAE;AAC/D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,yCAAyC,EAAE;AACpE;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,2CAA2C,EAAE;AACtE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,mDAAmD,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,yBAAyB,EAAE;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,0BAA0B,EAAE;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,uBAAuB,EAAE;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,mDAAmD,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,mDAAmD,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,mDAAmD,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,yBAAyB,mDAAmD,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,6BAA6B,EAAE;AACxD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,oCAAoC,EAAE;AAC/D;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,4BAA4B,EAAE;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8HAA8H;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,eAAe;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+BAA+B,wBAAwB;;AAEvD,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;;AAEA,sBAAsB,wBAAwB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,+HAA+H;AAClI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;AACL;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;;AAEA,kBAAkB,oBAAoB;AACtC;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY,eAAe;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,0EAA0E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA,CAAC;;AAED;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,+FAA+F;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kJAAkJ;AACrJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,sPAAsP;AACzP;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,SAAS;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA,uBAAuB,6CAA6C;;AAEpE,KAAK;AACL;AACA;;AAEA;AACA,aAAa,iDAAiD,qBAAqB;AACnF,aAAa,iDAAiD;AAC9D;AACA;AACA,uBAAuB,mBAAmB;;AAE1C,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6FAA6F;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,sBAAsB,mBAAmB;AACzC;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,sIAAsI;AACzI;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB,4BAA4B;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA,+BAA+B,aAAa;AAC5C,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qCAAqC,gDAAgD,EAAE;AACvF;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,yBAAyB;AACzB,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,wPAAwP;AAC3P;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,0BAA0B;AACvD;AACA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uDAAuD;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA,iBAAiB;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mIAAmI;AACtI;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,aAAa,iCAAiC;AAC9C,aAAa;AACb;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL,uBAAuB;;AAEvB,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;;AAEL,uBAAuB;;AAEvB,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA,4BAA4B,2BAA2B,sBAAsB;AAC7E,4BAA4B,2BAA2B,2BAA2B;AAClF,2BAA2B,SAAS,sBAAsB;;AAE1D;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA,CAAC;;AAED,CAAC,EAAE,6JAA6J;AAChK;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mFAAmF;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B,YAAY,kBAAkB;AAC9B,YAAY,kBAAkB;AAC9B,aAAa;AACb,YAAY,2BAA2B;AACvC,YAAY,oCAAoC;AAChD,YAAY,kBAAkB;AAC9B,YAAY,2BAA2B;AACvC,eAAe,iBAAiB;AAChC;AACA,KAAK;;AAEL;AACA,YAAY,kBAAkB;AAC9B,YAAY,kBAAkB;AAC9B,aAAa;AACb,YAAY,kBAAkB;AAC9B,YAAY,2BAA2B;AACvC,YAAY,oCAAoC;AAChD,YAAY,kBAAkB;AAC9B,YAAY,2BAA2B;AACvC,eAAe,iBAAiB;AAChC;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+HAA+H;AAClI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,cAAc,EAAE;AACxD;AACA;;AAEA;AACA;AACA,aAAa;AACb,2CAA2C,yBAAyB;AACpE;AACA;;AAEA;AACA;AACA,aAAa;AACb,2CAA2C,yBAAyB;AACpE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC,cAAc,EAAE;AACxD;AACA;;AAEA;AACA;AACA,aAAa;AACb,2CAA2C,yBAAyB;AACpE;AACA;;AAEA;AACA;AACA,aAAa;AACb,2CAA2C,yBAAyB;AACpE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA,2BAA2B,wBAAwB;AACnD;;AAEA;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA,2BAA2B,8BAA8B;AACzD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,SAAS;;AAET;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,0NAA0N;AAC7N;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uDAAuD,UAAU;AACjE;;AAEA;AACA,uDAAuD,UAAU;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,2CAA2C;AACnE;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,8BAA8B;AACjE;AACA;AACA,mCAAmC,wBAAwB;AAC3D;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,wCAAwC;AAC3E;AACA;AACA,mCAAmC,8BAA8B;AACjE;AACA;AACA,mCAAmC,0BAA0B;AAC7D;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uHAAuH;AAC1H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B,aAAa,iBAAiB;AAC9B,aAAa;AACb;;AAEA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA,KAAK;AACL,iCAAiC,sBAAsB;;AAEvD,KAAK,GAAG,IAAI,UAAU;AACtB;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;;;AAGA,SAAS;;AAET;AACA;;;AAGA,SAAS;;AAET;;AAEA,SAAS;AACT,KAAK;;AAEL;;AAEA,KAAK;;AAEL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA,CAAC;;AAED,CAAC,EAAE,sNAAsN;AACzN;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,kBAAkB;AACpC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4BAA4B;;AAE5B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gGAAgG;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;;AAET;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,eAAe;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4FAA4F;AAC5F;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,KAAK;;AAEL;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,uCAAuC;AACvC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,mBAAmB;;AAE1D;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,mBAAmB,+DAA+D;AAClF;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qMAAqM;AACxM;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,mEAAmE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA,4CAA4C,OAAO;AACnD;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,6LAA6L;AAChM;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;AACA;AACA,aAAa,eAAe;AAC5B,aAAa,eAAe;AAC5B,aAAa;AACb;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL,8BAA8B,sBAAsB;;AAEpD,KAAK;;AAEL;;AAEA,KAAK;;AAEL;AACA;;;AAGA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA,CAAC;;AAED,CAAC,EAAE,uLAAuL;AAC1L;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,cAAc;;AAEpC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gGAAgG;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6CAA6C,4DAA4D;AACzG,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD,2BAA2B,qBAAqB;AAChD,4BAA4B,oBAAoB;AAChD,4BAA4B,uBAAuB;AACnD,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uNAAuN;AAC1N;AACA,CAAC,EAAE,6EAA6E;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB,2BAA2B;AAC3B,2BAA2B;AAC3B,qBAAqB;AACrB,qBAAqB;;AAErB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,yoBAAyoB;AAC5oB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,qDAAqD;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,uBAAuB;;AAE9C,uBAAuB,uBAAuB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB,WAAW;AACX;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK,oBAAoB,cAAc,GAAG;AAC1C;;AAEA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,kDAAkD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,yBAAyB;AAC9D,SAAS;AACT;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA,+BAA+B,mCAAmC;AAClE;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,0BAA0B,mBAAmB;AAC7C;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gCAAgC,kBAAkB,SAAS;;AAE3D;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;;AAEA,8BAA8B,UAAU;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA;AACA,kCAAkC,iBAAiB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,IAAI;AAChB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,mBAAmB;AACnB;AACA,oBAAoB,mBAAmB,SAAS,EAAE;;AAElD;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sMAAsM;AACzM;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe,EAAE;;AAEnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK,EAAE;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kCAAkC;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yGAAyG;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,4CAA4C;AAC5C;AACA;;AAEA,kBAAkB,YAAY;AAC9B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,2BAA2B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,wBAAwB,OAAO,GAAG,OAAO;AACzC;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY,MAAM;AAClB;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,sBAAsB,qBAAqB;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,iCAAiC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,sBAAsB,mBAAmB;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe;AACf;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,YAAY;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,aAAa,eAAe;AAC5B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc;AACd;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kDAAkD,aAAa;AAC/D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8IAA8I;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,kBAAkB;;AAElB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,cAAc;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,UAAU;;AAEjD,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf,WAAW,kBAAkB;AAC7B;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO,mCAAmC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,IAAI;AACf;AACA,WAAW,IAAI;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;;AAEA;;AAEA,cAAc,wBAAwB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA,kBAAkB,UAAU;AAC5B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,2BAA2B;AAC7C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,2BAA2B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,qBAAqB;AACrB;AACA;AACA;AACA,YAAY,eAAe;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,oBAAoB;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,GAAG;AACd,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,GAAG;AACd,YAAY,aAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU,qBAAqB,gBAAgB;AAC9D;AACA,aAAa,OAAO;AACpB,aAAa,EAAE;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B,4BAA4B;AACxD,WAAW,UAAU,QAAQ;AAC7B;AACA;AACA;AACA,4BAA4B,sBAAsB;AAClD,WAAW,cAAc,WAAW;AACpC;AACA;AACA;AACA,4BAA4B,mCAAmC;AAC/D,WAAW,QAAQ,QAAQ,GAAG,QAAQ;AACtC;AACA;AACA;AACA,4BAA4B,iDAAiD;AAC7E,WAAW,iBAAiB,SAAS;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,wEAAwE;AACxE,iBAAiB;AACjB;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,cAAc;AAC3B,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gCAAgC,EAAE;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,+BAA+B,QAAQ,SAAS,KAAK;AACrD;;AAEA;AACA;AACA;AACA;AACA,gCAAgC,MAAM,IAAI,cAAc;AACxD,gCAAgC,cAAc,IAAI,SAAS,aAAa,EAAE;AAC1E;AACA,WAAW,OAAO,4BAA4B,IAAI;AAClD,WAAW,IAAI;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,MAAM,IAAI,cAAc;AACxD,gCAAgC,cAAc,IAAI,SAAS,aAAa,EAAE;AAC1E,iCAAiC,OAAO,IAAI,KAAK;AACjD;AACA,WAAW,OAAO,4BAA4B,QAAQ;AACtD,WAAW,IAAI,iFAAiF;AAChG,WAAW,IAAI;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4nBAA4nB;AAC/nB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA,sBAAsB,OAAO;AAC7B,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA,WAAW,MAAM;AACjB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,sCAAsC,wBAAwB,EAAE;;AAEhE;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;;AAExB;AACA,cAAc,YAAY;AAC1B;AACA,kBAAkB,UAAU;AAC5B;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO,KAAK,GAAG,KAAK;AACpC;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,uBAAuB,EAAE;AAClD,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY,UAAU;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA,kDAAkD,4BAA4B;AAC9E;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA,kDAAkD,4BAA4B;AAC9E;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B,gBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4CAA4C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B,WAAW,MAAM;AACjB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA,wBAAwB,0CAA0C;AAClE;AACA;AACA;;AAEA,CAAC,qIAAqI;AACtI,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,IAAI;AACf;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,OAAO,oBAAoB,SAAS;AACxD;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,gCAAgC;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,gCAAgC;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,2CAA2C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,iBAAiB;AAC5B;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,YAAY;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sCAAsC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,6BAA6B,eAAe;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,cAAc;AACvC,4BAA4B,eAAe;AAC3C,4BAA4B,cAAc;AAC1C,+BAA+B,eAAe;;AAE9C,oCAAoC,cAAc;AAClD,oCAAoC,cAAc;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,SAAS;AACpB;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sDAAsD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;AAGA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,0BAA0B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC,cAAc,EAAE;AACxD;;AAEA;AACA;AACA,2CAA2C,cAAc,EAAE;AAC3D;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,sBAAsB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,wBAAwB,8CAA8C;;AAEtE;AACA,yCAAyC,yBAAyB;;AAElE;AACA;AACA;AACA,yBAAyB,8BAA8B;AACvD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iCAAiC,+CAA+C;AAChF;AACA;AACA,iCAAiC,6CAA6C;AAC9E;AACA;AACA,iCAAiC,YAAY;AAC7C;AACA;AACA,iCAAiC,qDAAqD;AACtF;;AAEA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;;AAEA;AACA;;;AAGA;;AAEA,uBAAuB,MAAM;AAC7B,uBAAuB,MAAM;;AAE7B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C;;AAE7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,sDAAsD;AACtD;AACA,mBAAmB,aAAa;AAChC,oBAAoB,2CAA2C;AAC/D,oBAAoB,qCAAqC;AACzD;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA,oCAAoC,oBAAoB,EAAE;AAC1D;AACA,uBAAuB,iBAAiB;AACxC;AACA,kDAAkD,YAAY;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;;AAEA;AACA,wEAAwE;AACxE;AACA;AACA;AACA;AACA,0EAA0E;AAC1E,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,OAAO;AAClB;AACA,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA,sBAAsB,eAAe;;AAErC;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,aAAa;AACjD;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,sBAAsB,oBAAoB;AAC1C;;AAEA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+CAA+C,mBAAmB;AAClE;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,uCAAuC;AACpE,KAAK;AACL,6BAA6B,yDAAyD;AACtF,KAAK,OAAO;AACZ,6BAA6B,kBAAkB;AAC/C;;AAEA;AACA,8BAA8B,qCAAqC;AACnE,KAAK;AACL,8BAA8B,wDAAwD;AACtF,KAAK,OAAO;AACZ,8BAA8B,mBAAmB;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,WAAW,aAAa;AACxB;AACA,WAAW,OAAO;AAClB,aAAa,IAAI;AACjB,aAAa,aAAa;AAC1B,aAAa,QAAQ;AACrB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,6CAA6C;;AAEhE;;AAEA;AACA;AACA,uBAAuB,WAAW;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,WAAW;AACxF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA,4BAA4B,WAAW;AACvC;AACA;AACA;AACA;AACA;AACA,qFAAqF,WAAW;AAChG;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C;AACA,gCAAgC,WAAW;AAC3C,gDAAgD,cAAc,EAAE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,uFAAuF;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qBAAqB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,mDAAmD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,aAAa,eAAe;AAC5B;AACA,QAAQ,QAAQ,OAAO,UAAU,OAAO,aAAa;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,6BAA6B;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,sBAAsB;;AAEtB;AACA;;AAEA,YAAY;AACZ;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,qCAAqC,EAAE;;AAEnE;AACA;AACA;AACA;AACA,6BAA6B,sCAAsC,EAAE;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,0BAA0B;AACpD;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+BAA+B;AAC/B;;AAEA;AACA;AACA,0BAA0B,uBAAuB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,aAAa;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D;AAC/D,4DAA4D;AAC5D,gEAAgE;AAChE,2DAA2D;;AAE3D;AACA,cAAc,iBAAiB;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,OAAO;AACjC;AACA;;AAEA;AACA,0BAA0B,gCAAgC;AAC1D,6BAA6B,yCAAyC;AACtE,yBAAyB,iBAAiB;AAC1C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,oBAAoB;AAClC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,eAAe;AAC7B;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,+BAA+B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,iBAAiB;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8DAA8D;AAC9D,8DAA8D;AAC9D;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,uBAAuB;AAC7C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C,sBAAsB;AAChE;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,UAAU,EAAE;AACvD;AACA;AACA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,EAAE;AACb;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,UAAU;AACrB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA,sBAAsB,OAAO;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4JAA4J;AAC/J;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mGAAmG;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,wBAAwB,KAAK,IAAI;AACzD,0BAA0B,mBAAmB,OAAO,KAAK,IAAI,KAAK;AAClE,qBAAqB,2BAA2B,KAAK,IAAI;AACzD,qBAAqB,uBAAuB,KAAK,IAAI;AACrD,8BAA8B,wBAAwB,KAAK,KAAK;AAChE,8BAA8B,oBAAoB,KAAK,KAAK;AAC5D,sBAAsB,6BAA6B,KAAK,IAAI;AAC5D;AACA;AACA;AACA;AACA;AACA,MAAM,4CAA4C;AAClD;AACA,OAAO,8CAA8C;AACrD;AACA,OAAO,iDAAiD;AACxD;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,mBAAmB;AAC9B,WAAW,OAAO;AAClB,wBAAwB;AACxB,KAAK,eAAe;AACpB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF;AACpF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,wIAAwI;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA,WAAW,iBAAiB;AAC5B;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA,qDAAqD;;AAErD;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,4BAA4B;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa,gBAAgB,cAAc,EAAE;;AAE7C;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC;;AAEvC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,kBAAkB,iCAAiC;;AAEnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oCAAoC;AAC5D;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA,kDAAkD,OAAO;AACzD;AACA,kCAAkC,SAAS,QAAQ,aAAa;AAChE;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA,0BAA0B,0CAA0C;;AAEpE;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,oBAAoB;AAClC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,eAAe;AAC1B,YAAY;AACZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,sBAAsB,oBAAoB;;AAE1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,eAAe;AAC1B,WAAW,SAAS;AACpB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC,WAAW,OAAO;AAClB,WAAW,gBAAgB;AAC3B,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC,WAAW,SAAS;AACpB,WAAW,gBAAgB;AAC3B,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;AAChC,KAAK;;AAEL;;AAEA;AACA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC,WAAW,SAAS;AACpB,WAAW,gBAAgB;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC,WAAW,SAAS;AACpB,WAAW,gBAAgB;AAC3B,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc,oBAAoB;;AAElC;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,2BAA2B;AACzC,6BAA6B,2DAA2D;AACxF;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,cAAc,2BAA2B;AACzC;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,OAAO;AAClB;AACA,WAAW,EAAE;AACb;AACA,WAAW,kBAAkB;AAC7B;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,OAAO;AAClB,uBAAuB,6BAA6B;AACpD;AACA,WAAW,kBAAkB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,kEAAkE;;AAElE;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,WAAW,OAAO,aAAa,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB,mBAAmB;AACnB;;AAEA;AACA,mBAAmB,+BAA+B,kBAAkB,EAAE,EAAE;;AAExE;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,yCAAyC;;AAE7E,gCAAgC,qCAAqC;;AAErE;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAoB,EAAE;AAC5D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,eAAe;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,yBAAyB,KAAK;AAC5C,QAAQ,YAAY,KAAK,KAAK,eAAe,KAAK;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,iBAAiB;AAC/B;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,OAAO;AAClB;AACA,WAAW,EAAE;AACb;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,OAAO;AAClB,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,gCAAgC;AAChC,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,iBAAiB,EAAE;AACzD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,+DAA+D,SAAS;AACxE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;;AAEhD;AACA;AACA,qDAAqD,IAAI;AACzD;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,OAAO;AAClB,uBAAuB,6BAA6B;AACpD;AACA,WAAW,OAAO;AAClB,uBAAuB,6BAA6B;AACpD;AACA,WAAW,kBAAkB;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,qDAAqD;AACrD;;AAEA,uDAAuD;AACvD;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,6BAA6B,uCAAuC,EAAE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK,oDAAoD;AACzD,KAAK,uDAAuD;;AAE5D;AACA,KAAK,4DAA4D;AACjE,KAAK,yDAAyD;;AAE9D,KAAK,+BAA+B;AACpC,KAAK,0CAA0C;AAC/C,KAAK,wDAAwD;AAC7D,KAAK,qEAAqE;AAC1E,KAAK,8CAA8C;AACnD,KAAK,qDAAqD;;AAE1D,KAAK,iDAAiD;AACtD,KAAK,uDAAuD;AAC5D,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK,uDAAuD;AAC5D;AACA,KAAK,0DAA0D;AAC/D,KAAK,+CAA+C;;AAEpD;AACA;AACA;AACA;;AAEA;AACA,KAAK,4BAA4B;AACjC;AACA,KAAK,kCAAkC;AACvC,KAAK;AACL;;AAEA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,iCAAiC;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA,WAAW,iBAAiB;AAC5B;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,sCAAsC;;AAEhE;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,kCAAkC,qBAAqB;;AAEvD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAoB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,YAAY;AAClC;AACA;AACA,oCAAoC,4BAA4B;AAChE;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA;AACA,WAAW,yDAAyD;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA,mCAAmC,UAAU,GAAG,UAAU;AAC1D;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,0BAA0B,sBAAsB;AAChD;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D,aAAa;AACb,SAAS;AACT;AACA;AACA,sBAAsB,0BAA0B;AAChD;;AAEA;;AAEA;AACA;AACA;AACA;AACA,mDAAmD,iBAAiB;AACpE,qBAAqB;AACrB;AACA;AACA,SAAS;AACT,sBAAsB,wCAAwC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,kBAAkB;AACrE,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA,mEAAmE;AACnE,qBAAqB;AACrB;AACA;AACA;;AAEA,0DAA0D;AAC1D,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,sBAAsB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA,iBAAiB,OAAO;AACxB,iBAAiB,iBAAiB;AAClC,kBAAkB,OAAO;AACzB,kBAAkB,MAAM;AACxB,qBAAqB,OAAO;AAC5B;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC,QAAQ;AACzC;;AAEA;AACA;AACA;AACA,+EAA+E;AAC/E;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC;;AAEvC;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,kCAAkC,QAAQ;AAC1C;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,oBAAoB;AAC1C,oCAAoC;AACpC;AACA,sBAAsB,wCAAwC;AAC9D,4BAA4B,6CAA6C;AACzE,SAAS;AACT;AACA;;AAEA,sBAAsB,yCAAyC;AAC/D,4BAA4B,2BAA2B;AACvD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA;AACA,WAAW,kBAAkB;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;;AAEA,iCAAiC,QAAQ;AACzC;AACA,kBAAkB,2BAA2B;AAC7C,wBAAwB,gDAAgD;AACxE;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0BAA0B;;AAE1B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8hBAA8hB;AACjiB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC,SAAS,aAAa,IAAI,WAAW;AAC5E;AACA;AACA,4BAA4B,oCAAoC;AAChE,wBAAwB;AACxB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA,SAAS;;AAET;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA,oBAAoB,OAAO;AAC3B,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,OAAO;AAC3B,oBAAoB,OAAO;AAC3B,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,iBAAiB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E;AAC/E;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F;AAC9F;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,4BAA4B;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2DAA2D;AAC3D;AACA,SAAS,kBAAkB;AAC3B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA,6CAA6C;AAC7C,+CAA+C;;AAE/C;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iDAAiD;AACjD;;AAEA;AACA,gCAAgC;AAChC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC;;AAErC;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC;AACpC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,2BAA2B,UAAU;AACrC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,8BAA8B,oBAAoB;AAClD;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA,gCAAgC;;AAEhC;AACA;AACA;;AAEA;AACA;;AAEA,uCAAuC;AACvC;;AAEA,CAAC,EAAE,yQAAyQ;AAC5Q;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO,8BAA8B,aAAa,SAAS;AACtE;AACA;AACA;AACA,aAAa,OAAO,GAAG,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C;AAC1C,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,aAAa,OAAO,GAAG,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA,aAAa,OAAO,GAAG,kDAAkD;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,mBAAmB;AACjC;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA,cAAc,0BAA0B;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;;AAEb;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,wBAAwB;AACnE;;AAEA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;;AAEA,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAkB,wCAAwC;AAC1D;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,4BAA4B;AAC1C;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4UAA4U;AAC/U;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA,6BAA6B,qBAAqB,GAAG,yCAAyC;AAC9F;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,4CAA4C;AAC5C;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAa;AAC3C;AACA;AACA,oCAAoC,gBAAgB;AACpD,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,uBAAuB;AAC5E,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA,sBAAsB,yBAAyB;;AAE/C;AACA,sBAAsB,mBAAmB;AACzC;AACA;;AAEA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;AACA;;AAEA;AACA;AACA,oCAAoC;AACpC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mBAAmB,yBAAyB,aAAa;AACpE;AACA,WAAW,iBAAiB,uCAAuC,aAAa;AAChF;AACA;AACA;AACA,aAAa,MAAM;AACnB,OAAO,OAAO;AACd;AACA,OAAO,OAAO;AACd;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA,0BAA0B,sBAAsB;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,+BAA+B;AACnE;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mCAAmC;;AAEjE;AACA;;AAEA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,0HAA0H;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,yCAAyC;;AAEzC;AACA;AACA,WAAW,2BAA2B;AACtC;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kCAAkC;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,uCAAuC;AACvC;AACA;;AAEA;AACA,uCAAuC;AACvC;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAiC,8BAA8B,EAAE;AACjE,kCAAkC,aAAa,EAAE;AACjD,KAAK;AACL;;AAEA;;AAEA,CAAC,EAAE,2GAA2G;AAC9G;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA,YAAY,MAAM;AAClB,OAAO,OAAO;AACd;AACA,OAAO,OAAO;AACd;AACA,OAAO,OAAO;AACd;AACA,OAAO,MAAM;AACb;AACA,OAAO,OAAO;AACd;AACA;AACA,OAAO,OAAO;AACd;AACA;AACA;AACA;AACA;AACA,cAAc,2BAA2B;;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,0BAA0B,yBAAyB;AACnD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,6CAA6C;AAC7C,8CAA8C;AAC9C,uCAAuC;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;AACA,kCAAkC,2DAA2D;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,sBAAsB,mBAAmB;AACzC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,kBAAkB;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,0EAA0E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,aAAa;AACb;AACA,sBAAsB;AACtB;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B,uBAAuB,OAAO;AAC9B,yBAAyB,OAAO;AAChC,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;;AAEA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA,kCAAkC,iCAAiC;AACnE;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,6CAA6C;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,+CAA+C;AAC/E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA,gDAAgD;AAChD;AACA,0BAA0B,yBAAyB;AACnD;AACA,8DAA8D,qBAAqB;AACnF;AACA,0BAA0B,yBAAyB;AACnD;AACA,8DAA8D,qBAAqB;AACnF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,WAAW;AACX,WAAW;AACX;AACA,aAAa;AACb,aAAa;AACb,mBAAmB;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC,wCAAwC;AACxE;AACA;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB,oBAAoB,WAAW;;AAE/B,YAAY;AACZ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB,cAAc;AACd,gBAAgB;AAChB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iCAAiC;AACnD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B,iBAAiB;AAC/C,iCAAiC,iBAAiB;;AAElD,CAAC,EAAE,0FAA0F;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,wBAAwB;AAClD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,mBAAmB;;AAEnB;AACA;AACA,oCAAoC;;AAEpC;AACA;;AAEA,YAAY;AACZ;;AAEA,mBAAmB,WAAW;AAC9B,sBAAsB,kBAAkB;;AAExC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,iBAAiB;;AAEnC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,qCAAqC;AACxD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,+BAA+B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,+BAA+B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB;AACrB,sBAAsB;AACtB;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC,uBAAuB,4BAA4B;AACnD,kBAAkB,mBAAmB;AACrC,uCAAuC,2BAA2B;AAClE,2BAA2B,2BAA2B;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,0BAA0B,EAAE;;AAEjE;AACA;AACA,iCAAiC,qDAAqD,EAAE;AACxF;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,2BAA2B;AACtC,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,2BAA2B;AAC7C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,0DAA0D;AAC1D;;AAEA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,mBAAmB,YAAY;AAC/B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA,8DAA8D,kBAAkB;;AAEhF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,yDAAyD,kBAAkB;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,2BAA2B;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,6BAA6B,0BAA0B,EAAE;AACzD;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC,MAAM,MAAM;AAClD;AACA;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC,MAAM,MAAM;AAClD;AACA;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,YAAY,iBAAiB;AAC7B;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA,mCAAmC,WAAW,EAAE;AAChD;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,GAAG;AACV,YAAY,GAAG;AACf;AACA;AACA;AACA;AACA;AACA,qBAAqB,sDAAsD,EAAE;AAC7E,qBAAqB,sDAAsD;AAC3E;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,kBAAkB;AAC7B,YAAY;AACZ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,QAAQ;AACf,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ,OAAO,GAAG;AACV,OAAO,GAAG;AACV,OAAO,GAAG;AACV,OAAO,OAAO;AACd,OAAO,OAAO;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC,kBAAkB;AACtD,oCAAoC,oCAAoC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,oCAAoC,uDAAuD;AAC3F,oCAAoC,2CAA2C;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,WAAW,OAAO;AAClB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,GAAG;AACT,MAAM,QAAQ;AACd;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,OAAO;AACd,WAAW,OAAO;AAClB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,OAAO;AACb;AACA,MAAM,aAAa;AACnB,MAAM,GAAG;AACT,MAAM,QAAQ;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,kBAAkB;AACzB,WAAW,OAAO;AAClB,MAAM,aAAa;AACnB,MAAM,OAAO;AACb,MAAM,aAAa;AACnB,MAAM,GAAG;AACT,MAAM,QAAQ;AACd;AACA;AACA;;AAEA;AACA;;AAEA;AACA,uBAAuB,iBAAiB;;AAExC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,QAAQ;AACf,OAAO,OAAO;AACd,OAAO,kBAAkB;AACzB,OAAO,OAAO,YAAY;AAC1B,WAAW,OAAO;AAClB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,GAAG;AACT,MAAM,GAAG;AACT,MAAM,GAAG;AACT,MAAM,GAAG;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;;AAEzC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;;AAEb;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA,yCAAyC,sBAAsB;AAC/D;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;;AAEA;;AAEA,0BAA0B,qBAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,WAAW,OAAO;AAClB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,GAAG;AACT,MAAM,GAAG;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA,aAAa,4DAA4D;AACzE;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,aAAa,sDAAsD;AACnE;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,0BAA0B,EAAE;AAChE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;AACA,yEAAyE,eAAe;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,+BAA+B;AAC5D,sCAAsC,gCAAgC;;AAEtE;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA,gCAAgC;;AAEhC,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;;AAE/B;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kCAAkC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kCAAkC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,uCAAuC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,sBAAsB;AACpC;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,+YAA+Y;AAClZ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qEAAqE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,iOAAiO;AACpO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA,eAAe,MAAM;AACrB,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,IAAI;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qEAAqE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sBAAsB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,cAAc,uBAAuB;AACrC;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,6BAA6B;AAC3C;AACA;;AAEA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;AAEA,YAAY;AACZ;;;AAGA;AACA;AACA;AACA;AACA;AACA,IAAI,4BAA4B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,6BAA6B;AAC3C;AACA;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iCAAiC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;;AAEA,cAAc,6BAA6B;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kCAAkC,qBAAqB;AACvD;AACA;AACA;AACA;AACA;;AAEA,kCAAkC,qBAAqB;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6BAA6B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sHAAsH;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ,WAAW;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,qBAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gCAAgC,qCAAqC;AACrE;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,kBAAkB;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,kBAAkB;AACxC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA,kCAAkC,gBAAgB;AAClD;AACA;AACA;;AAEA;AACA,sBAAsB,qBAAqB;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,mBAAmB;AACzC;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,4CAA4C;AAClF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,uCAAuC;AAC3D;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,6BAA6B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2DAA2D,eAAe;AAC1E;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8cAA8c;AACjd;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kIAAkI;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,kBAAkB;AACxC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;;AAEA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA,qDAAqD;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA,qDAAqD;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,WAAW,aAAa;AACxB;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;;AAEA,cAAc,qBAAqB;AACnC;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,kBAAkB,EAAE;;AAEvD;AACA,sCAAsC,oBAAoB,EAAE;;AAE5D;AACA,oCAAoC,oBAAoB,EAAE;AAC1D;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC,2BAA2B;AACnE,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,qCAAqC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oCAAoC,0BAA0B,EAAE;;AAEhE;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,aAAa,EAAE;AAC7C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+CAA+C,8BAA8B;AAC7E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,4SAA4S;AAC/S;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,6CAA6C;;AAEpE,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,aAAa,oDAAoD,qBAAqB;AACtF,aAAa,oDAAoD;AACjE;AACA;AACA,uBAAuB,mBAAmB;;AAE1C,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,mCAAmC;;AAE1D,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,uBAAuB,mBAAmB;;AAE1C,KAAK;AACL;AACA;;AAEA;AACA,uBAAuB,mBAAmB;;AAE1C,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL,4BAA4B,SAAS,+BAA+B;AACpE;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA,iBAAiB,kCAAkC;AACnD,iBAAiB;AACjB;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA,aAAa,oDAAoD;AACjE,aAAa;AACb;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,uLAAuL;AAC1L;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,sBAAsB,wBAAwB;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,sBAAsB,wBAAwB;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB;;AAEvB;AACA;AACA;;AAEA,sBAAsB,iBAAiB;AACvC;;AAEA,8DAA8D;AAC9D;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,oBAAoB;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4DAA4D,yBAAyB,EAAE;AACvF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,iBAAiB;AACrE;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,oBAAoB;AAClC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,6QAA6Q;AAChR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB,kBAAkB,OAAO;AACzB,gBAAgB,OAAO;AACvB,cAAc,iBAAiB;AAC/B,iBAAiB,QAAQ;AACzB,iBAAiB,QAAQ;AACzB,mBAAmB,QAAQ;AAC3B,mBAAmB,OAAO;AAC1B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yEAAyE;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,sBAAsB,eAAe;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,oCAAoC,gFAAgF,EAAE;AACtH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,yBAAyB;AACrD;;AAEA,8BAA8B,cAAc;;AAE5C;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,0BAA0B,oBAAoB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,yBAAyB;AACnD;;AAEA;AACA;;AAEA;;AAEA;AACA,sCAAsC,0BAA0B;AAChE;AACA;AACA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,yBAAyB;AAC/C;AACA;;AAEA;AACA,kCAAkC,gCAAgC;AAClE;AACA;AACA;AACA;AACA;;AAEA,yBAAyB;AACzB;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,EAAE;AACjB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,yBAAyB;AACvC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uCAAuC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,yBAAyB;AACvC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sRAAsR;AACzR;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,6BAA6B;;AAEnD;AACA;AACA;;AAEA;AACA;;AAEA,sDAAsD,4BAA4B,EAAE;AACpF,iDAAiD,yBAAyB,EAAE;;AAE5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,+BAA+B;AACtE;;AAEA;AACA;AACA;AACA;AACA,6CAA6C,oCAAoC;AACjF,uCAAuC,gCAAgC;;AAEvE;AACA;;AAEA;AACA;;AAEA,oCAAoC,gCAAgC;AACpE,+BAA+B,yBAAyB;;AAExD,8BAA8B,+BAA+B;AAC7D;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oDAAoD,sCAAsC;AAC1F,qDAAqD,oCAAoC;;AAEzF,mCAAmC,8CAA8C;AACjF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,8BAA8B,0BAA0B;AACxD,+BAA+B,iCAAiC;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,8BAA8B,0BAA0B;AACxD,+BAA+B,iCAAiC;AAChE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wBAAwB,YAAY;AACpC,iDAAiD,SAAS;AAC1D;AACA;;AAEA,sBAAsB,yBAAyB;AAC/C;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC,0BAA0B;AACnE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,eAAe;AAC5C;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,2BAA2B;AACjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iHAAiH;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4EAA4E;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0CAA0C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,qBAAqB;AAC/C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8BAA8B,gBAAgB;AAC9C,8BAA8B,gBAAgB;;AAE9C;AACA,sBAAsB,qBAAqB;AAC3C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,2BAA2B;AACjD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,sBAAsB,2BAA2B;AACjD;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,sBAAsB,6BAA6B;AACnD;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD;;AAEzD;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,eAAe;AACzC;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,eAAe;AAC3B;;AAEA;AACA;AACA;AACA,sDAAsD;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2CAA2C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,wBAAwB;AAC9C;AACA;;AAEA;AACA,0BAA0B,wBAAwB;AAClD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,OAAO;AACrB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,8BAA8B;AAChE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,oEAAoE;AACrF,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA,uBAAuB,wCAAwC;AAC/D,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,8BAA8B,uBAAuB;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,+BAA+B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA;AACA;AACA;AACA,YAAY,OAAO,+BAA+B,IAAI;AACtD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,2DAA2D;AACxE,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wBAAwB;;AAExB,SAAS;AACT,wBAAwB;;AAExB,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb;AACA,aAAa,cAAc;AAC3B;AACA,aAAa,OAAO;AACpB;AACA,aAAa,gBAAgB;AAC7B;AACA;AACA,YAAY,OAAO,+BAA+B,oBAAoB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,wBAAwB;AAC9C;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,oCAAoC,qBAAqB,EAAE;AAC3D;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,sCAAsC,kBAAkB;AACxD,sCAAsC,kBAAkB;;AAExD;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,4BAA4B;AACtD;;AAEA;AACA;AACA,0BAA0B,4BAA4B;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iDAAiD,0BAA0B,EAAE;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,+BAA+B,4BAA4B;;AAE3D,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gVAAgV;AACnV;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0IAA0I;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,0EAA0E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa,kBAAkB;AAC/B,aAAa;AACb;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,yBAAyB,YAAY;;AAErC,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;;AAGA,aAAa;AACb;AACA;;;AAGA,aAAa;AACb;AACA;;;AAGA;AACA,SAAS;AACT;AACA;;AAEA;AACA,iBAAiB,kBAAkB;AACnC,iBAAiB;AACjB;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,SAAS;AACT,KAAK;AACL;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;;AAGA;AACA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,oHAAoH;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,sEAAsE;AACtE;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,OAAO;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,iCAAiC;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA,4CAA4C,OAAO;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,2BAA2B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB;AACtB,oBAAoB;;AAEpB;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,0BAA0B,6BAA6B;;AAEvD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,8CAA8C;AAC9D;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA,iCAAiC,kBAAkB;AACnD;;AAEA;AACA,kBAAkB,aAAa;AAC/B;;AAEA;AACA,iCAAiC,gBAAgB;AACjD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8CAA8C;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,iBAAiB;AAC5B;AACA;AACA,YAAY,aAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8CAA8C;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK,gBAAgB,eAAe;AACpC;AACA;AACA;AACA;;AAEA;AACA,KAAK,gBAAgB,eAAe;AACpC;AACA;;AAEA;AACA,KAAK,gBAAgB,eAAe;;AAEpC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,yCAAyC;AACzC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,oHAAoH;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA,uDAAuD;;AAEvD;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,qDAAqD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;AACA;;AAEA,mCAAmC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8PAA8P;AACjQ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,6BAA6B,OAAO;AACpC,sBAAsB,OAAO;AAC7B,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,OAAO;AACzB;AACA;;AAEA;;AAEA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,wBAAwB;AACxB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mCAAmC,oBAAoB;AACvD;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oTAAoT;AACvT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,QAAQ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK,qBAAqB,eAAe;AACzC;AACA;AACA;;AAEA;AACA,KAAK,qBAAqB,eAAe;AACzC;AACA;;AAEA;AACA,KAAK,qBAAqB,eAAe;;AAEzC;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,oHAAoH;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mDAAmD;AACnD;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sPAAsP;AACzP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,SAAS,2BAA2B;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,qIAAqI;AACxI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA,wCAAwC;;AAExC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0KAA0K;AAC7K;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;;AAElE;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,6KAA6K;AAChL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA,SAAS;AACT;;AAEA,SAAS;AACT;;AAEA,SAAS;AACT;AACA,KAAK;AACL,yBAAyB,gCAAgC;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;AACL,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B,SAAS;AACT;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B,SAAS;AACT;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B,SAAS;AACT;AACA,uBAAuB,qBAAqB;;AAE5C,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,wFAAwF;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,OAAO;AACzB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,gCAAgC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,OAAO;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,sBAAsB;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,OAAO;AACzB;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8CAA8C;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA,cAAc,OAAO;AACrB,kBAAkB,OAAO;AACzB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E;AAC/E;;AAEA;;AAEA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0GAA0G,eAAe;;AAEzH;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,4BAA4B,IAAI;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC;AACvC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA,0BAA0B,4BAA4B;AACtD;AACA,kCAAkC,sBAAsB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,yBAAyB;;AAEzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;;AAEA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA,sBAAsB,wBAAwB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,kDAAkD;AAC/D,iBAAiB,8DAA8D;AAC/E,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,OAAO;AAC7B,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,6BAA6B,OAAO;AACpC,sBAAsB,OAAO;AAC7B,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,kUAAkU;AACrU;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT,kCAAkC,wBAAwB;;AAE1D,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,yJAAyJ;AAC5J;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C,yCAAyC,EAAE;AACrF;AACA;;AAEA;;AAEA;AACA;AACA,8BAA8B,kBAAkB;AAChD;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qLAAqL;AACxL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,0CAA0C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;AACD;;AAEA;AACA;;AAEA,yBAAyB,eAAe;;AAExC;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;;;AAGA;AACA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;AACA;AACA;;;AAGA;AACA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA;AACA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA;AACA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,aAAa;AACb;AACA;AACA;;;AAGA,aAAa;AACb;AACA;AACA;;;AAGA,aAAa;AACb;AACA,2CAA2C,iBAAiB,iBAAiB;AAC7E;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gMAAgM;AACnM;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sGAAsG;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA,uDAAuD,WAAW;;AAElE,qCAAqC,uBAAuB;AAC5D,qCAAqC,uBAAuB;;AAE5D;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,gBAAgB;AAC9B;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,0BAA0B;AACpD;AACA;AACA;AACA,0BAA0B,0BAA0B;AACpD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;AACA,KAAK;AACL,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,2BAA2B;;AAE3B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,uMAAuM;AAC1M;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA,YAAY,OAAO,+BAA+B,WAAW;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,2CAA2C,eAAe;AAC1D;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB,EAAE;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,yCAAyC;;AAEzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,KAAK;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,wDAAwD;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,oBAAoB;AACtC;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA,cAAc,oCAAoC;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,uBAAuB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,wBAAwB;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,oCAAoC;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,OAAO;AACzB;AACA,sBAAsB,OAAO;AAC7B,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA,aAAa,OAAO,EAAE,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,4BAA4B;AAC1C;AACA;;AAEA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,4BAA4B;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc,wBAAwB;AACtC;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,gBAAgB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C;AAC7C;;AAEA,cAAc,mBAAmB;AACjC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,0BAA0B,2BAA2B;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,6BAA6B;AAC3C;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,uBAAuB;AACzC,qFAAqF;AACrF;AACA,KAAK;AACL,2EAA2E;AAC3E;;AAEA;AACA;AACA,kBAAkB,4BAA4B;AAC9C,oGAAoG;AACpG;AACA,KAAK;AACL,0FAA0F;AAC1F;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wBAAwB;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4CAA4C;AAC5C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC;AACnC;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B;AAC/B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,4BAA4B;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,6BAA6B;AAC3C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,wBAAwB;AACxB;AACA,uBAAuB;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;;AAEA,cAAc,yBAAyB;AACvC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,yBAAyB;AAC7C,oBAAoB,yBAAyB;AAC7C,oBAAoB,yBAAyB;AAC7C,oBAAoB;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,iBAAiB;AACjC,gBAAgB,iBAAiB;AACjC,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;;AAEA;AACA;;AAEA;;AAEA,iDAAiD;AACjD,mDAAmD;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,+BAA+B;AAC1C;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,cAAc;AACxC;AACA,SAAS;AACT;AACA,mBAAmB,+BAA+B;;AAElD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,sDAAsD;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,0BAA0B;AACpD;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,WAAW;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C;;AAE5C;AACA,kBAAkB,2BAA2B;AAC7C;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,yBAAyB;AAC/C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,WAAW,SAAS;AACpB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,0EAA0E;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,4BAA4B;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA,sBAAsB,4BAA4B;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,yBAAyB;AACvC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,cAAc,qBAAqB;AACnC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,6BAA6B;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;;AAEnC;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;;AAEA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,4BAA4B;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,+VAA+V;AAClW;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,yBAAyB,sCAAsC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,WAAW,MAAM;AACjB,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wCAAwC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uIAAuI;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,uBAAuB,WAAW;AAC7D;AACA;AACA,2BAA2B,uBAAuB,WAAW;AAC7D;AACA;;AAEA;;AAEA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,0BAA0B,sBAAsB,WAAW;AAC3D,uBAAuB;AACvB;AACA,KAAK;;AAEL,4BAA4B,wBAAwB,iBAAiB;AACrE;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL,wBAAwB;AACxB;AACA,aAAa,iDAAiD,qBAAqB;AACnF,aAAa,iDAAiD;AAC9D;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;;AAGA,KAAK;;;AAGL;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAsB,WAAW;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;;AAGA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ,YAAY;AACZ,eAAe;;AAEf,yBAAyB,gCAAgC;;AAEzD;AACA;AACA;AACA,aAAa,oCAAoC;AACjD,aAAa;AACb;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,6IAA6I;AAChJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2DAA2D,yBAAyB,EAAE;;AAEtF;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,kBAAkB;;AAE7D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kCAAkC,wBAAwB;AAC1D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,wCAAwC,mCAAmC;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,6DAA6D,iBAAiB;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,kaAAka;AACra;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB,KAAK;AACL,oBAAoB;;AAEpB,KAAK;AACL;AACA,4BAA4B;;AAE5B,SAAS;AACT,2BAA2B;;AAE3B,SAAS;AACT,6BAA6B;;AAE7B,SAAS;AACT,8BAA8B;;AAE9B,SAAS;AACT;AACA;AACA;;AAEA,CAAC,EAAE,oEAAoE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,8BAA8B;;AAE9B,CAAC;;AAED;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;;AAGA,SAAS;AACT;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;;AAGA,SAAS;AACT;AACA;;;AAGA,SAAS;AACT;AACA;;AAEA;AACA,SAAS;AACT;AACA;;;AAGA;AACA;;AAEA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,oBAAoB;AACrC,iBAAiB;AACjB;;AAEA,SAAS;AACT;AACA;AACA;;;AAGA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,iBAAiB,6BAA6B;AAC9C,iBAAiB;AACjB;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;;AAGA;AACA;AACA,CAAC;;AAED,CAAC,EAAE,qGAAqG;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,8CAA8C;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA,KAAK,kBAAkB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,+DAA+D;AAC/D;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA,qBAAqB;AACrB,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,oGAAoG;AAClM;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,qBAAqB,GAAG;AACxB,iBAAiB;AACjB;AACA;AACA,kFAAkF;AAClF;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,EAAE;AACnB;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;AACpB;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF;AACvF,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,yGAAyG;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA,wEAAwE,uDAAuD;AAC/H;AACA;AACA;AACA,qBAAqB,sDAAsD;AAC3E;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,qBAAqB;AACrB;AACA;AACA,qBAAqB,sDAAsD;AAC3E;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+DAA+D;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD,oCAAoC,eAAe;AACnD;AACA;AACA;AACA,wCAAwC,SAAS,+CAA+C;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,+BAA+B,oBAAoB;AACnD,+BAA+B,oBAAoB;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oGAAoG;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,6CAA6C,yBAAyB,EAAE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,6BAA6B,qBAAqB,EAAE;AACpD,6BAA6B,0CAA0C,EAAE;AACzE,iCAAiC,qBAAqB,EAAE;AACxD,wCAAwC,gCAAgC,EAAE;AAC1E,8BAA8B,cAAc;AAC5C;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oCAAoC,8BAA8B;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B,eAAe;AAC5C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,4BAA4B,EAAE;AACnD,oBAAoB,aAAa;;AAEjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB;AACpB,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,2BAA2B,oBAAoB;;AAE/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA,0BAA0B,4BAA4B;AACtD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,0iBAA0iB;AAC7iB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,yBAAyB,eAAe,EAAE;AAC1C,yBAAyB,eAAe;;AAExC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8BAA8B,cAAc;AAC5C,8BAA8B,0BAA0B;AACxD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,oCAAoC,iCAAiC;AACrE,oCAAoC,mCAAmC;AACvE;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,mCAAmC;;AAEnE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,mCAAmC;AACtD;;AAEA,iCAAiC,sBAAsB;AACvD,iCAAiC,wBAAwB;;AAEzD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6CAA6C,kCAAkC;AAC/E,6CAA6C,kCAAkC;;AAE/E;AACA;AACA;;AAEA,8BAA8B,wBAAwB;AACtD,8BAA8B,wBAAwB;;AAEtD,8BAA8B,wBAAwB;AACtD,8BAA8B,wBAAwB;AACtD;AACA;;AAEA,CAAC,EAAE,+CAA+C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,kBAAkB,eAAe;AACjC;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4DAA4D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,2BAA2B;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6GAA6G;AAChH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB,qBAAqB,gBAAgB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB,WAAW;AAC7D;AACA;AACA,2BAA2B,uBAAuB,WAAW;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,gBAAgB;;AAEzC;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,oJAAoJ;AACvJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iCAAiC;;AAEjC;AACA,wDAAwD;AACxD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,2EAA2E;AAC3E;AACA,SAAS,mBAAmB;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,CAAC,EAAE,8RAA8R;AACjS;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,4BAA4B;AAC9C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,oCAAoC,wBAAwB,EAAE;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;;AAET;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,aAAa;;AAE3D;AACA;;AAEA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,0DAA0D,iBAAiB;AAC3E;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA,6BAA6B,0BAA0B;AACvD,6BAA6B,2DAA2D;AACxF,6BAA6B,uDAAuD;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0WAA0W;AAC7W;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iCAAiC;AAC5C;AACA;AACA;AACA,YAAY,OAAO;AACnB,kBAAkB,MAAM;AACxB;AACA,YAAY,OAAO;AACnB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA,YAAY,OAAO;AACnB,iBAAiB,SAAS;AAC1B,qBAAqB,SAAS;AAC9B,kBAAkB,OAAO;AACzB,sBAAsB,SAAS;AAC/B;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA,YAAY,OAAO;AACnB,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,YAAY,IAAI;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qKAAqK;AACxK;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA,yBAAyB,+BAA+B;AACxD;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;AACA;AACA,yBAAyB,+BAA+B;AACxD;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA,4CAA4C;AAC5C;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,gCAAgC;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,aAAa;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA,WAAW,2BAA2B;AACtC;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,eAAe;AACrG;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;;AAEA,CAAC,EAAE,0DAA0D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gGAAgG;AAChG;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,kGAAkG;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,gGAAgG,eAAe;AAC/G;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;;AAEA,+BAA+B,cAAc;AAC7C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;;AAEA;;AAEA,CAAC,EAAE,4GAA4G;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2DAA2D,gBAAgB;AAC3E,mCAAmC,GAAG;AACtC,sBAAsB,IAAI,cAAc,EAAE,EAAE;AAC5C,sBAAsB,IAAI,cAAc,EAAE;AAC1C,4DAA4D,WAAW;AACvE,wCAAwC;AACxC,KAAK;AACL;AACA;AACA;;AAEA;AACA,gCAAgC,UAAU,eAAe,WAAW;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,4BAA4B;AAC1C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,gEAAgE;AAChE;AACA;;AAEA;AACA,eAAe,4CAA4C;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,gCAAgC;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gHAAgH;AACnH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA,kBAAkB,eAAe;;AAEjC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;;AAEA,mCAAmC;AACnC,mCAAmC,UAAU;;AAE7C;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC;AACxC;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL,2BAA2B;;AAE3B,KAAK;;AAEL,iCAAiC;;AAEjC,KAAK;;AAEL,kCAAkC;;AAElC,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL,6BAA6B;;AAE7B,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,sPAAsP;AACzP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,eAAe;AACjC,iBAAiB;;AAEjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8KAA8K;AACjL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,aAAa,EAAE;AACvC;;AAEA;AACA,sBAAsB,sCAAsC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAe;AAChC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,uBAAuB;AACzC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,uBAAuB;AACzC;;AAEA,sBAAsB,sBAAsB;AAC5C;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,aAAa;AAC3B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,sBAAsB;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;;AAEA;AACA;AACA,uCAAuC,sBAAsB;AAC7D;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,sBAAsB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wDAAwD,cAAc;AACtE;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;;AAEA,sBAAsB,kBAAkB;AACxC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kDAAkD,2BAA2B;AAC7E;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,mBAAmB;AACjC;;AAEA,kBAAkB,kBAAkB;AACpC;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sDAAsD,2BAA2B;AACjF;AACA;AACA;;;AAGA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;;AAEA,sBAAsB,kBAAkB;AACxC;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;AACrC;;AAEA,sBAAsB,kBAAkB;AACxC;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD,6BAA6B;AAC/E;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,uBAAuB;AACrC;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;;AAEA,kBAAkB,eAAe;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4IAA4I;AAC/I;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mEAAmE,UAAU;AAC7E,mEAAmE,wBAAwB;;AAE3F;AACA;;AAEA,CAAC,EAAE,+IAA+I;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sCAAsC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gCAAgC,iCAAiC;AACjE,gCAAgC,iCAAiC;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,sBAAsB,8BAA8B;AACpD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8GAA8G;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,6QAA6Q;AAChR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,uBAAuB;AAC5D;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,gGAAgG;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+MAA+M;AAClN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,aAAa,OAAO;AACpB;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gDAAgD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,2BAA2B,EAAE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;;AAEpC;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6IAA6I;AAChJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gDAAgD;AAChD;AACA;;AAEA;;AAEA;AACA;AACA,gDAAgD;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kHAAkH;AACrH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER,uBAAuB;;AAEvB,KAAK;AACL,yBAAyB;;AAEzB,KAAK;AACL,wBAAwB;;AAExB,KAAK;;AAEL,uBAAuB;;AAEvB,KAAK;AACL;;AAEA,uBAAuB;AACvB,mBAAmB;AACnB,yBAAyB;AACzB,0BAA0B;AAC1B,wBAAwB;AACxB,gCAAgC,wBAAwB,YAAY;;AAEpE;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,iFAAiF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,6BAA6B,2BAA2B,SAAS;AACjE;;AAEA;AACA;AACA,kBAAkB;;AAElB;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qNAAqN;AACxN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,+FAA+F;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,gCAAgC,QAAQ,uBAAuB;AAC/D;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,4JAA4J;AAC/J;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;;AAEA,CAAC,EAAE,+NAA+N;AAClO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0CAA0C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6GAA6G;AAChH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL,uBAAuB;;AAEvB,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT,6BAA6B;AAC7B,aAAa,iCAAiC;AAC9C,8BAA8B;AAC9B,aAAa,2CAA2C;AACxD,2BAA2B;AAC3B,aAAa,iCAAiC;AAC9C,4BAA4B;AAC5B,aAAa,kCAAkC;AAC/C;AACA,gCAAgC;AAChC,iBAAiB;AACjB;AACA,gCAAgC;AAChC,iBAAiB;AACjB;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oDAAoD,aAAa;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,iBAAiB,IAAI,aAAa;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,+BAA+B,cAAc,EAAE;AAC/C;;AAEA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;;AAEA,0BAA0B,gBAAgB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;;AAEA,0BAA0B,kBAAkB;;AAE5C,wBAAwB,YAAY;;AAEpC,CAAC,EAAE,sEAAsE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,cAAc,oBAAoB;AAClC;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,8CAA8C;AAC9C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,qDAAqD,cAAc;AACnE;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qFAAqF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iCAAiC,+BAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,8BAA8B;AACpD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;;AAEhC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,eAAe;AACjC;;AAEA,sBAAsB,2BAA2B;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0IAA0I;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,mOAAmO;AACtO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+DAA+D;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA,oBAAoB;AACpB,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,2BAA2B;AAClE,+BAA+B,aAAa;AAC5C,gCAAgC,2BAA2B;AAC3D,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2CAA2C,qCAAqC,EAAE;;AAElF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,gBAAgB;AAC9C;AACA;AACA,iBAAiB;AACjB,8BAA8B,gBAAgB;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,gBAAgB;AACtC;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,qDAAqD;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wDAAwD;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,eAAe;AACjC,sBAAsB,8BAA8B;AACpD;AACA;AACA;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC,sBAAsB,8BAA8B;AACpD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,oCAAoC,2BAA2B,EAAE;;AAEjE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qEAAqE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC,wBAAwB,uBAAuB;AAC/E;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;;AAE5B,SAAS;AACT;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA,+BAA+B,0BAA0B,UAAU;;AAEnE;AACA;;AAEA,CAAC,EAAE,iEAAiE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,KAAK;AACL,iBAAiB,IAAI,aAAa;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oEAAoE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qPAAqP;AACxP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,kGAAkG;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA,aAAa,iCAAiC;AAC9C,aAAa;AACb;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,wJAAwJ;AAC3J;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;AACxD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,2TAA2T;AAC9T;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,6DAA6D,aAAa;AAC1E,6DAA6D,aAAa;;AAE1E;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kRAAkR;AACrR;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,WAAW;AACzC;AACA;AACA;AACA,mBAAmB,gCAAgC;;AAEnD;AACA,8BAA8B,WAAW;AACzC;AACA;AACA;AACA,mBAAmB,gCAAgC;;AAEnD;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA,mBAAmB,gCAAgC;;AAEnD;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA,mBAAmB,gCAAgC;;AAEnD;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,QAAQ;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;;AAE7C;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA,mBAAmB,QAAQ;AAC3B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,yBAAyB;AAC/C;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;;AAE7C;AACA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;;AAEA;AACA;AACA;AACA,aAAa;AACb;;AAEA,uBAAuB,YAAY;AACnC;;AAEA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA,CAAC,EAAE,wDAAwD;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,cAAc,sBAAsB;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wDAAwD;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,kBAAkB,QAAQ;AAC1B;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,eAAe,UAAU;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,QAAQ;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,QAAQ;AAClC;AACA,8BAA8B,YAAY;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B,uBAAuB,cAAc;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA,uBAAuB,cAAc;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,mBAAmB;AACzC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mHAAmH;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,0FAA0F;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,eAAe;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,cAAc,iBAAiB;AAC/B;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,iLAAiL;AACpL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oLAAoL;AACvL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,kBAAkB,QAAQ;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA,KAAK;AACL,uBAAuB;;AAEvB,KAAK;AACL;AACA;AACA;AACA,gCAAgC,oCAAoC,QAAQ;AAC5E;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL,4BAA4B;AAC5B;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;AAEA,CAAC,EAAE,4KAA4K;AAC/K;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA,CAAC,EAAE,kKAAkK;AACrK;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;;AAEA;AACA;;AAEA,CAAC,EAAE,8EAA8E;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,eAAe;AAC7B;AACA;;AAEA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sFAAsF;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,4KAA4K;AAC/K;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,iBAAiB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,gBAAgB;AACtC;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,mBAAmB;AACzC,0BAA0B,sBAAsB;AAChD;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,iIAAiI;AACpI;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC,aAAa;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uGAAuG;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,CAAC;;AAED;;AAEA;AACA;AACA,CAAC;;AAED,+BAA+B;AAC/B;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA,CAAC,EAAE,uKAAuK;AAC1K;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B,yBAAyB;AACzB,uBAAuB;;AAEvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C,0BAA0B,EAAE;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAA2D,yBAAyB;;AAEpF;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,8EAA8E;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,wFAAwF;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;AACA,2BAA2B,sBAAsB;;AAEjD,SAAS;AACT;AACA;AACA;;AAEA;AACA,2BAA2B,sBAAsB;;AAEjD,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,sBAAsB;;AAEjD,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,uBAAuB;AACvB,KAAK;;AAEL;AACA,4BAA4B;AAC5B;;AAEA,SAAS;AACT,4BAA4B;AAC5B;AACA,SAAS;AACT;AACA,gCAAgC;;AAEhC,SAAS;AACT;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;AAEA,CAAC,EAAE,qRAAqR;AACxR;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2CAA2C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;;AAEA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,wCAAwC,iBAAiB;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,6EAA6E;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,sBAAsB,qDAAqD;;AAE3E;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0GAA0G;AAC7G;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,sDAAsD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,sBAAsB;AACnD,6BAA6B,YAAY;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sBAAsB,0BAA0B;AAChD;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,0BAA0B;AAChD;AACA;;AAEA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8IAA8I;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,qCAAqC,UAAU;AAC/C;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4DAA4D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,aAAa,SAAS;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;;AAEA;;AAEA,uBAAuB,4BAA4B;;AAEnD,6BAA6B,kBAAkB;AAC/C;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,aAAa;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,kBAAkB;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,yBAAyB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA,CAAC,EAAE,oDAAoD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,uIAAuI;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,4DAA4D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,YAAY;AAC3B;AACA;AACA;;AAEA,mBAAmB,YAAY;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sDAAsD,UAAU,EAAE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,iDAAiD;AACzE,2BAA2B,iDAAiD;AAC5E,yBAAyB,iDAAiD;AAC1E,0BAA0B,iDAAiD;;AAE3E;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,SAAS,SAAS;AACtC;AACA;AACA;AACA;;AAEA,wEAAwE;AACxE,2DAA2D;AAC3D,6DAA6D;AAC7D,4DAA4D;;AAE5D,8BAA8B,iCAAiC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,8BAA8B,eAAe;AAC7C;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb,SAAS;;AAET;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,oCAAoC,EAAE;;AAErE;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,+BAA+B,4BAA4B,EAAE;;AAE7D;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,8BAA8B;AAChD,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;;AAET;AACA;AACA,sBAAsB,8BAA8B;AACpD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qUAAqU;AACxU;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,iDAAiD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;;;AAGA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,sFAAsF;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD;AAChD;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,kEAAkE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,KAAK;;AAEL;AACA,4BAA4B;;AAE5B,SAAS;AACT;AACA;AACA,gCAAgC;;AAEhC,SAAS;AACT;AACA,KAAK;AACL;AACA,CAAC;;AAED;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;AAEA,CAAC,EAAE,oMAAoM;AACvM;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wCAAwC;;AAExC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA,CAAC,EAAE,oSAAoS;AACvS;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,uFAAuF,gBAAgB;AACvG,SAAS;AACT;AACA,oEAAoE,gBAAgB;AACpF;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yKAAyK;AAC5K;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,2IAA2I;AAC9I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sDAAsD,UAAU,EAAE;AAClE;AACA;;AAEA;AACA;;AAEA,wBAAwB,iDAAiD;AACzE,2BAA2B,iDAAiD;AAC5E,yBAAyB,iDAAiD;AAC1E,0BAA0B,iDAAiD;;AAE3E;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,SAAS,SAAS;AACtC;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;AACxC,aAAa;AACb,wCAAwC;AACxC,aAAa;AACb,wCAAwC;AACxC,aAAa;AACb,wCAAwC;AACxC;;AAEA,8BAA8B,iCAAiC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,iFAAiF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,8BAA8B,eAAe;AAC7C;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb,SAAS;;AAET;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,iCAAiC;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,qZAAqZ;AACxZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL,oBAAoB,mBAAmB,eAAe,gBAAgB;AACtE,qBAAqB,oBAAoB,eAAe,iBAAiB;AACzE,qBAAqB,oBAAoB,eAAe,iBAAiB;AACzE,oBAAoB,mBAAmB,eAAe,gBAAgB;AACtE,qBAAqB,oBAAoB,eAAe,iBAAiB;AACzE,qBAAqB,oBAAoB,eAAe,iBAAiB;;AAEzE;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;AAEA,CAAC,EAAE,4IAA4I;AAC/I;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,wPAAwP;AAC3P;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA,oCAAoC,oBAAoB;AACxD,wCAAwC,mBAAmB;AAC3D;AACA;AACA;AACA,uCAAuC,uBAAuB;AAC9D,wCAAwC,mBAAmB;AAC3D;;AAEA;;AAEA,cAAc,YAAY;AAC1B;AACA;AACA,kBAAkB,YAAY;AAC9B;;AAEA;AACA;;AAEA,CAAC,EAAE,qBAAqB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,0BAA0B;AACxC;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,YAAY;AAC1B;AACA;AACA;;AAEA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gDAAgD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,2DAA2D,yBAAyB;AACpF;;AAEA,CAAC,EAAE,0HAA0H;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,cAAc;AAC5B;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC,oBAAoB,EAAE;AAC9D;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,eAAe;AACtC;AACA;AACA;;AAEA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,2EAA2E;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,uIAAuI;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;AACA;;AAEA,cAAc,kDAAkD;AAChE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,SAAS;AACnC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA4B,eAAe;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA,iDAAiD,eAAe;AAChE;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,aAAa;AACzD,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAiC,sBAAsB,EAAE;AACzD;AACA;AACA,iCAAiC,sBAAsB,EAAE;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,mBAAmB;AAC7C,0BAA0B,mBAAmB;;AAE7C;AACA;AACA,0BAA0B,gBAAgB;;AAE1C;AACA,0BAA0B,iBAAiB;AAC3C;AACA;AACA;AACA,8BAA8B,gBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB,0BAA0B,OAAO;AACjC;AACA;AACA,8BAA8B,gBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,UAAU;AACpC;AACA;AACA;;AAEA;AACA,SAAS,OAAO;;AAEhB;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wIAAwI;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,CAAC,EAAE,SAAS;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,0DAA0D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,mCAAmC;AAC5D,KAAK;AACL;;AAEA;;AAEA,CAAC,EAAE,2KAA2K;AAC9K;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;;AAEA;;AAEA,sBAAsB,OAAO;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,iFAAiF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,oIAAoI;AACvI;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL,wCAAwC;AACxC;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oHAAoH;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qBAAqB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY,yBAAyB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iEAAiE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B,+BAA+B;AAC3D;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA,0BAA0B,mBAAmB;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,kBAAkB;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,oEAAoE,EAAE;AAC3F,qBAAqB,wCAAwC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD,sBAAsB;AACvE;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,+BAA+B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,+BAA+B;AAC7C;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,+BAA+B;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA,oCAAoC,QAAQ;AAC5C;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,QAAQ;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0LAA0L;AAC7L;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS,mCAAmC;AAC5C,SAAS,+BAA+B;AACxC,SAAS,iCAAiC;AAC1C,SAAS;AACT;AACA;AACA,SAAS,mCAAmC;AAC5C,SAAS,+BAA+B;AACxC,SAAS,iCAAiC;AAC1C,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA,sBAAsB,2BAA2B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,2BAA2B;AAChD;AACA,yDAAyD;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mCAAmC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,mEAAmE,UAAU;AAC7E,mEAAmE,wBAAwB;;AAE3F;AACA;;AAEA,CAAC,EAAE,iHAAiH;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+BAA+B;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,oDAAoD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,gUAAgU;AACnU;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA,sBAAsB,UAAU;AAChC,KAAK;AACL;AACA;AACA,sBAAsB,UAAU;AAChC,KAAK;AACL;AACA;AACA;AACA,sBAAsB,UAAU;AAChC,KAAK;AACL;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;AAEA,CAAC,EAAE,2MAA2M;AAC9M;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gCAAgC;AAC5D,4BAA4B,gCAAgC;AAC5D,4BAA4B,gCAAgC;AAC5D,4BAA4B,gCAAgC;;AAE5D;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,qBAAqB,YAAY;AACjC;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA,kBAAkB,QAAQ;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA,CAAC,EAAE,iLAAiL;AACpL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;AACA;AACA,mDAAmD;AACnD;AACA;AACA;;AAEA;;AAEA,wCAAwC;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,2BAA2B,mEAAmE,EAAE;AAChG,2BAA2B,wCAAwC;;AAEnE;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6HAA6H;AAChI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,4CAA4C;AAC5C;AACA;;AAEA,CAAC,EAAE,sIAAsI;AACzI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,wDAAwD;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,sOAAsO;AACzO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;AAEA,CAAC,EAAE,2KAA2K;AAC9K;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,2IAA2I;AAC9I;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,8NAA8N;AACjO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA,2BAA2B;;AAE3B,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA,wBAAwB,gCAAgC,UAAU;AAClE,wBAAwB,gCAAgC,UAAU;AAClE,wBAAwB,gCAAgC,QAAQ;AAChE;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL,4BAA4B,wBAAwB,iBAAiB;AACrE,CAAC;;AAED,CAAC,EAAE,yKAAyK;AAC5K;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,uKAAuK;AAC1K;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,WAAW,EAAE;;AAExC;AACA;AACA,+DAA+D,yBAAyB;AACxF,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mGAAmG;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,wFAAwF;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gCAAgC,oBAAoB,uBAAuB;AAC3E;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA,4BAA4B;;AAE5B,SAAS;AACT,2BAA2B;;AAE3B,SAAS;AACT;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL,6BAA6B;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,4HAA4H;AAC/H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,wDAAwD,kBAAkB;AAC1E;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL,iBAAiB,IAAI,aAAa;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,uEAAuE,aAAa;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,kCAAkC;AACpD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iFAAiF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,iCAAiC,oCAAoC;;AAErE;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,8BAA8B;;AAEpD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,0IAA0I;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qIAAqI;AACxI;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA,CAAC,EAAE,yBAAyB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA,CAAC,EAAE,qEAAqE;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,2BAA2B,iBAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,yBAAyB,+CAA+C;AACxE,4BAA4B;AAC5B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oOAAoO;AACvO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yCAAyC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,gBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4DAA4D,gBAAgB;;AAE5E;AACA;AACA;AACA;;AAEA,qBAAqB,sBAAsB;;AAE3C;AACA;AACA,kBAAkB,6BAA6B;AAC/C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;;AAGL,qBAAqB,sBAAsB;;AAE3C;;AAEA,kBAAkB,4BAA4B;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,uBAAuB;AACrC;AACA,cAAc,0BAA0B;AACxC;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;;AAEA;AACA;AACA,WAAW,uBAAuB;AAClC,WAAW,0BAA0B;AACrC,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA,0BAA0B,4BAA4B;AACtD,kCAAkC,yBAAyB;AAC3D,YAAY;AACZ;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,sBAAsB;AACpC,cAAc,YAAY;AAC1B;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA;AACA,cAAc,MAAM;AACpB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,YAAY;AAC1B;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,MAAM;AACpB;AACA,WAAW,OAAO;AAClB;AACA,cAAc,MAAM;AACpB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,MAAM;AACpB;AACA,cAAc,MAAM;AACpB;AACA;AACA,cAAc,MAAM;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,qDAAqD,UAAU;AAC/D;;AAEA;AACA,8BAA8B;AAC9B,4BAA4B;AAC5B;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,mBAAmB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qDAAqD,6BAA6B,EAAE;;AAEpF;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,mDAAmD,uBAAuB,EAAE;AAC5E;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA,KAAK;AACL,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,qCAAqC,uCAAuC;AAC5E;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB,YAAY;AACZ;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,qLAAqL;AACxL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,mEAAmE,8BAA8B;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,6NAA6N;AAChO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,kFAAkF;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA,aAAa;;AAEb;AACA,mCAAmC,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,wBAAwB,sBAAsB;AAC9C;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;;AAEb;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB,kBAAkB;AAC3C;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,qBAAqB;AAChC,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,8DAA8D,gCAAgC;;AAE9F;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gEAAgE,gCAAgC;AAChG;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA,0DAA0D,gCAAgC;AAC1F;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,cAAc;AACtC;AACA;AACA;AACA,aAAa;AACb;;;AAGA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,6BAA6B,wCAAwC;AACrE;AACA;AACA;AACA,SAAS;AACT;;;AAGA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL,wBAAwB,6BAA6B;AACrD;;AAEA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL,wBAAwB,6BAA6B;AACrD;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,6FAA6F,qBAAqB;AAClH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oCAAoC,sBAAsB;AAC1D;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6FAA6F,qBAAqB;AAClH;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA,gCAAgC,oCAAoC,EAAE;;AAEtE;AACA,yEAAyE,wBAAwB,EAAE;AACnG,0EAA0E,wBAAwB,EAAE;;AAEpG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,iBAAiB;AAC5B,WAAW,QAAQ;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,WAAW,iBAAiB;AAC5B,WAAW,QAAQ;AACnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA,2BAA2B,qBAAqB;;AAEhD;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;;AAET;;AAEA;AACA,mCAAmC,sBAAsB;;AAEzD;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,qBAAqB;AAChC;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,eAAe;AAC1B;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,sBAAsB;;AAEpC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,iCAAiC,QAAQ;;AAEzC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,SAAS;;AAET;AACA;AACA;AACA,iDAAiD,qBAAqB;AACtE,SAAS;;AAET;AACA,6EAA6E,qBAAqB;AAClG,uEAAuE,6BAA6B;;AAEpG;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,yDAAyD,gBAAgB;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iFAAiF,8CAA8C;AAC/H;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,sCAAsC,gBAAgB;;;AAGtD,2BAA2B,gCAAgC;AAC3D;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,sBAAsB,mCAAmC;AACzD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,iBAAiB,UAAU;AAC3B;AACA,iBAAiB,OAAO;AACxB;AACA,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA,WAAW,eAAe;AAC1B,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL,0BAA0B,yBAAyB;AACnD;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA,cAAc,2BAA2B;AACzC;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,eAAe;AAC7B;AACA,cAAc,OAAO;AACrB;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,OAAO;AACrB;AACA;AACA,cAAc,KAAK;AACnB;AACA,cAAc,KAAK;AACnB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,wBAAwB;AACtC;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,iBAAiB;AAC/B;AACA,cAAc,0BAA0B;AACxC;AACA,cAAc,YAAY;AAC1B;AACA,cAAc,YAAY;AAC1B;AACA,cAAc,oBAAoB;AAClC;AACA,cAAc,oBAAoB;AAClC;AACA,cAAc,YAAY;AAC1B;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,8BAA8B;AAC5C;AACA,cAAc,iBAAiB;AAC/B;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,kBAAkB;AAChC;AACA,cAAc,iBAAiB;AAC/B;AACA;;AAEA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA,cAAc,OAAO;AACrB;AACA,cAAc,eAAe;AAC7B;AACA,cAAc,eAAe;AAC7B;AACA,cAAc,eAAe;AAC7B;AACA,cAAc,OAAO;AACrB;AACA,cAAc,iBAAiB;AAC/B;AACA;;AAEA,CAAC,EAAE,gKAAgK;AACnK;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,yBAAyB,iDAAiD;;AAE1E;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA,+BAA+B,uBAAuB,iBAAiB;AACvE,+BAA+B,uBAAuB,iBAAiB;AACvE;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA,iBAAiB,oCAAoC;AACrD,iBAAiB;AACjB;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,oCAAoC;AACrD,iBAAiB;AACjB;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;;AAEA,CAAC,EAAE,2PAA2P;AAC9P;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,sCAAsC,oDAAoD;;AAE1F;AACA,wCAAwC,oDAAoD;;AAE5F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,cAAc;AAChC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,6BAA6B,QAAQ;AACrC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,mBAAmB,EAAE;AACxD,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,0BAA0B,oEAAoE;AAC9F;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA,iBAAiB,OAAO;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,mCAAmC;AACnC,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,qCAAqC;AACrC;AACA;AACA,aAAa;AACb;AACA;;AAEA,yBAAyB,oBAAoB;;AAE7C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,+EAA+E;AAC/E;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET,gFAAgF;;AAEhF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC,iBAAiB,EAAE;AACpD;;AAEA,mEAAmE;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC,iBAAiB,EAAE;AACpD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kDAAkD,kBAAkB;AACpE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,gCAAgC,EAAE;AACpE;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,yBAAyB,uBAAuB,EAAE;AAClD,qCAAqC,qBAAqB,EAAE;AAC5D,+BAA+B,eAAe;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C,yBAAyB,EAAE;;AAErE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,8BAA8B,WAAW,EAAE;;AAE3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gEAAgE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+CAA+C,8BAA8B;AAC7E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,yFAAyF;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qHAAqH;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mEAAmE,8BAA8B;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yPAAyP;AAC5P;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,qFAAqF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,yDAAyD,iJAAiJ,sBAAsB,8HAA8H,sFAAsF,8BAA8B,yBAAyB,2BAA2B,4BAA4B,2BAA2B,mCAAmC,+BAA+B,wDAAwD,GAAG,uKAAuK,6FAA6F,2FAA2F,qCAAqC,GAAG,8BAA8B,qBAAqB,6BAA6B,GAAG,qBAAqB,6BAA6B,GAAG,iCAAiC,iCAAiC,iCAAiC,2CAA2C,iLAAiL,GAAG,0CAA0C,oCAAoC,GAAG,gJAAgJ,oJAAoJ,GAAG,oEAAoE,yBAAyB,2BAA2B,iCAAiC,6BAA6B,oBAAoB,OAAO,OAAO,wBAAwB,OAAO,OAAO,4BAA4B,OAAO,OAAO,qDAAqD,uCAAuC,oCAAoC,uDAAuD,qDAAqD,wIAAwI,oDAAoD,eAAe,WAAW,OAAO,oBAAoB,GAAG,6YAA6Y,qCAAqC,uFAAuF,wNAAwN,oEAAoE,qDAAqD,6HAA6H,GAAG,iBAAiB,sCAAsC,kBAAkB,kCAAkC,kCAAkC,kCAAkC,uCAAuC,mSAAmS,kHAAkH,2FAA2F,GAAG;AAC9yI,0DAA0D,iJAAiJ,sBAAsB,wEAAwE,sFAAsF,8BAA8B,4BAA4B,2BAA2B,mCAAmC,iCAAiC,+BAA+B,oDAAoD,GAAG,uKAAuK,6FAA6F,2FAA2F,qCAAqC,GAAG,yQAAyQ,qCAAqC,uFAAuF,oEAAoE,uHAAuH,GAAG,iBAAiB,sCAAsC,kBAAkB,kCAAkC,kCAAkC,kCAAkC,uCAAuC,uNAAuN,kHAAkH,2FAA2F,GAAG;AACrrE,6DAA6D,iJAAiJ,sBAAsB,8HAA8H,sFAAsF,2BAA2B,2BAA2B,4BAA4B,2BAA2B,mCAAmC,+BAA+B,wDAAwD,GAAG,uKAAuK,6FAA6F,2FAA2F,qCAAqC,GAAG,8BAA8B,qBAAqB,6BAA6B,GAAG,qBAAqB,6BAA6B,GAAG,iCAAiC,iCAAiC,iCAAiC,2CAA2C,iLAAiL,GAAG,0CAA0C,oCAAoC,GAAG,gJAAgJ,oJAAoJ,GAAG,oEAAoE,yBAAyB,2BAA2B,iCAAiC,6BAA6B,oBAAoB,OAAO,OAAO,wBAAwB,OAAO,OAAO,4BAA4B,OAAO,OAAO,qDAAqD,uCAAuC,oCAAoC,uDAAuD,qDAAqD,wIAAwI,oDAAoD,eAAe,WAAW,OAAO,oBAAoB,GAAG,6YAA6Y,qCAAqC,uFAAuF,wNAAwN,oEAAoE,qDAAqD,6HAA6H,GAAG,iBAAiB,sCAAsC,kBAAkB,kCAAkC,kCAAkC,kCAAkC,uCAAuC,mSAAmS,sCAAsC,GAAG;AAC/mI,0DAA0D,8CAA8C,iBAAiB,+BAA+B,GAAG;;AAE3J;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAmD;;AAEnD,mCAAmC,uCAAuC;;AAE1E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,8BAA8B,EAAE;AAChD;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,iBAAiB;AACnC,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,iBAAiB;AAC/B,kBAAkB,wBAAwB;AAC1C,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,QAAQ;AAC1B,wDAAwD,yDAAyD;AACjH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,uBAAuB;AACvB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,2DAA2D,+BAA+B;AAC1F;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,0CAA0C,oCAAoC,6BAA6B,GAAG;;AAE9G,qBAAqB,UAAU;AAC/B;AACA,yBAAyB,UAAU;AACnC,0BAA0B,QAAQ;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA,0CAA0C,oCAAoC,6BAA6B,GAAG;;AAE9G,qBAAqB,UAAU;AAC/B,yBAAyB,UAAU;AACnC,0BAA0B,QAAQ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,6BAA6B,+BAA+B;AAC5D;AACA;AACA;AACA;AACA;AACA,2CAA2C;;AAE3C;AACA,2BAA2B,oBAAoB;AAC/C;AACA,yCAAyC,mBAAmB;AAC5D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC;;AAEtC,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;;AAEA;AACA,cAAc,uBAAuB;AACrC;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B,uDAAuD;;AAEpF;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,6DAA6D;;AAEvG;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA,6CAA6C,aAAa,EAAE;AAC5D,8CAA8C,qBAAqB,EAAE;AACrE,4BAA4B,qBAAqB,aAAa,GAAG;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC;AACzC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,gCAAgC;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,8BAA8B;;AAE9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,kCAAkC,EAAE;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,SAAS,2BAA2B;AACzE,qCAAqC,sBAAsB;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,qBAAqB;AAC/C;AACA;AACA,kCAAkC,qBAAqB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB,uBAAuB,oBAAoB,EAAE;AACtE;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC,mEAAmE;AAC1G,qCAAqC;AACrC;AACA;;AAEA;;AAEA;;AAEA;AACA,6BAA6B,gCAAgC,EAAE;AAC/D;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA,2DAA2D,eAAe;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,uCAAuC,0BAA0B;;AAEjE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA,4BAA4B,sBAAsB,EAAE;;AAEpD;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,+CAA+C;AAC/C;AACA,iBAAiB;;AAEjB;;AAEA;AACA,6CAA6C;;AAE7C;AACA;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;AACA;AACA,6BAA6B,UAAU,EAAE;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,kBAAkB,EAAE;AAC1D;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA,uCAAuC,6CAA6C,EAAE;AACtF,gDAAgD,mDAAmD,EAAE;AACrG;AACA,4CAA4C,8CAA8C,EAAE;AAC5F;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,oCAAoC,EAAE;AACtF;AACA;AACA;AACA;;AAEA;AACA,0EAA0E,qCAAqC;AAC/G;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,UAAU,EAAE;AACrE;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,gBAAgB,EAAE;AAC7C,2BAA2B,kDAAkD,EAAE;;AAE/E;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,6BAA6B,EAAE;AAC1D,2BAA2B,kDAAkD,EAAE;;AAE/E;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,uBAAuB,EAAE;AACpD,2BAA2B,kDAAkD,EAAE;;AAE/E;AACA;;AAEA,CAAC,EAAE,mKAAmK;AACtK;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA,wDAAwD,kBAAkB,EAAE;;AAE5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,qCAAqC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B,yDAAyD,oBAAoB;AAC7E;AACA;AACA;AACA,cAAc;AACd;AACA,sEAAsE;AACtE,sFAAsF;AACtF,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA,oCAAoC,8BAA8B;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,CAAC,EAAE,gDAAgD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL,4BAA4B;AAC5B;AACA,KAAK;AACL,wCAAwC;AACxC;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL,2BAA2B;;AAE3B,KAAK;AACL,iCAAiC;;AAEjC,KAAK;AACL,kCAAkC;;AAElC,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT,2BAA2B;;AAE3B,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA,yBAAyB,2CAA2C;;AAEpE;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT,gCAAgC;;AAEhC,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,0MAA0M;AAC7M;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gDAAgD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,2CAA2C,kBAAkB,EAAE;;AAE/D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,qBAAqB;AACnC;AACA;;AAEA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oGAAoG;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,6DAA6D;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kCAAkC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,2KAA2K;AAC9K;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,2CAA2C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,yBAAyB;;AAEzB;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,wBAAwB;;AAEpD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wDAAwD;;AAExD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,6BAA6B,gCAAgC;AAC7D,gCAAgC,gCAAgC;;AAEhE;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,8CAA8C;;AAE9C,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,WAAW;AAC7B;AACA;AACA;;AAEA,sBAAsB,WAAW;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;;AAEA;AACA,sBAAsB,kCAAkC;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,4BAA4B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,kBAAkB;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,wBAAwB;AACtC;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,eAAe;AACjC,oCAAoC;AACpC;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,cAAc,eAAe;AAC7B;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mLAAmL;AACtL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B,uBAAuB;;AAErD;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA,CAAC,EAAE,4BAA4B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,aAAa,0BAA0B;AACvC;AACA;AACA;;AAEA,CAAC,EAAE,8CAA8C;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,6BAA6B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;;AAET,sBAAsB,SAAS;;AAE/B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,SAAS;;AAET;;AAEA,sBAAsB,SAAS;;AAE/B;;AAEA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,0EAA0E,UAAU;AACpF,0EAA0E,UAAU;AACpF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,2HAA2H;AAC9H;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,oCAAoC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,uGAAuG;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4BAA4B;AAC5B;AACA;;AAEA,KAAK;AACL;AACA,yBAAyB,4BAA4B;;AAErD;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA,4CAA4C;;AAE5C;AACA,SAAS;;AAET,KAAK;;AAEL;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;;AAGA,SAAS;AACT;AACA;AACA;AACA;;;AAGA,SAAS;AACT;AACA,4CAA4C;;AAE5C;AACA,SAAS;;AAET;AACA,CAAC;AACD;;AAEA,CAAC,EAAE,+QAA+Q;AAClR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qHAAqH;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,kBAAkB,8CAA8C;AAChE;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,wEAAwE;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,0CAA0C;;AAE1C;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,wDAAwD;;AAExD;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4LAA4L;AAC/L;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,qFAAqF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,oCAAoC;;AAEpC;AACA,yCAAyC,4BAA4B;AACrE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,iCAAiC,+BAA+B;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,kDAAkD,yBAAyB;;AAE3E;AACA;AACA;AACA,iCAAiC,+BAA+B;AAChE,gDAAgD,yBAAyB;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mHAAmH;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,cAAc;AAC9D,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,uBAAuB;AAC3D,qCAAqC,wBAAwB;AAC7D;;AAEA,2BAA2B;;AAE3B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC;AACpC,sBAAsB;AACtB,2BAA2B;AAC3B,4BAA4B;;AAE5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;;AAEA,6BAA6B,eAAe;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA,qDAAqD,yCAAyC;AAC9F;AACA;AACA;AACA,iCAAiC,iCAAiC;AAClE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA,yDAAyD;AACzD;AACA;AACA,aAAa;AACb,kEAAkE;AAClE,2EAA2E;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,gCAAgC;AACrE;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAqC,gBAAgB;AACrD;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,4CAA4C,+CAA+C;AAC3F,oCAAoC,uBAAuB;AAC3D,4CAA4C,yBAAyB;;AAErE;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,gBAAgB;AACrD;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA,wDAAwD;;AAExD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,wBAAwB;AACpE,sCAAsC,kDAAkD;AACxF,8CAA8C,uCAAuC;AACrF,oCAAoC,uBAAuB;AAC3D,4CAA4C,yBAAyB;;AAErE;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,gBAAgB;AAChD,gCAAgC,gBAAgB;AAChD,oCAAoC,oBAAoB;AACxD,qCAAqC,qBAAqB;;AAE1D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC,gCAAgC;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,2BAA2B,qCAAqC;;AAEhE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,sCAAsC;AAC/E;AACA;;AAEA;AACA,2BAA2B,0DAA0D;AACrF,0CAA0C,iDAAiD;;AAE3F;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,mLAAmL;AACtL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;;AAEA;AACA,kBAAkB,eAAe;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL,wCAAwC;AACxC;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT,2BAA2B,SAAS,kBAAkB;AACtD;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,gSAAgS;AACnS;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;;AAEA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;AACpB,oBAAoB;;AAEpB;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2DAA2D;AAC3D;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;;AAEA;;AAEA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qMAAqM;AACxM;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA,CAAC,EAAE,mGAAmG;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,yBAAyB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;;AAEA,kBAAkB,oBAAoB;AACtC;;AAEA,0BAA0B,eAAe;AACzC;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,gBAAgB;AAClC;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,eAAe;AACzC;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,cAAc;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,8BAA8B,QAAQ;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,eAAe;AAC9F;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,UAAU;AACxE,8DAA8D,wBAAwB;;AAEtF;AACA;;AAEA,CAAC,EAAE,2QAA2Q;AAC9Q;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,gBAAgB;AAC5B;AACA;AACA;AACA,qBAAqB,iBAAiB,EAAE;AACxC,qBAAqB,kBAAkB;;AAEvC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,yDAAyD;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6CAA6C;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,iDAAiD,YAAY;;AAE7D;AACA;AACA,+CAA+C,YAAY;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+CAA+C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,KAAK;AACvC,aAAa;;AAEb;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,8IAA8I;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,2QAA2Q;AAC9Q;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,2CAA2C;;AAE3C;;AAEA;AACA,+DAA+D,6CAA6C;AAC5G,KAAK;AACL;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;;AAEA,CAAC,EAAE,qGAAqG;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,cAAc;AAC5B;AACA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C,IAAI;AAClD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,mEAAmE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mBAAmB;;AAEnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,cAAc,4BAA4B;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,yBAAyB,+BAA+B,EAAE;AAC1D,yBAAyB,oBAAoB;;AAE7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qBAAqB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+DAA+D,gCAAgC;AAC/F;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mEAAmE,qCAAqC;AACxG;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oIAAoI;AACvI;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4CAA4C,uBAAuB,EAAE;;AAErE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,+BAA+B,iBAAiB,EAAE;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,qCAAqC,wBAAwB,EAAE;AAC/D;;AAEA;AACA,qCAAqC,cAAc,EAAE;AACrD;;AAEA;AACA,qCAAqC,eAAe,EAAE;AACtD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;;AAEA;AACA,sDAAsD,WAAW;AACjE,iBAAiB;AACjB,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,cAAc,EAAE;AACnD;AACA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,iKAAiK;AACpK;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mCAAmC;AACnC,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kBAAkB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C,iCAAiC;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6DAA6D;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,qCAAqC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL,uBAAuB;;AAEvB,KAAK;AACL,4BAA4B;;AAE5B,KAAK;;AAEL,uBAAuB;AACvB,SAAS,sBAAsB;AAC/B;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,wBAAwB;AACxB;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT,2BAA2B,4BAA4B,QAAQ;AAC/D;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEA,SAAS;AACT;;AAEA;AACA,gCAAgC,iCAAiC,eAAe;AAChF,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;;AAEA,+BAA+B,8BAA8B,mBAAmB;AAChF;AACA;AACA;AACA,6BAA6B,iCAAiC,eAAe;AAC7E,KAAK;;AAEL,4BAA4B;AAC5B,CAAC;;AAED;;AAEA,CAAC,EAAE,mOAAmO;AACtO;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wCAAwC;;AAEvD;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,uEAAuE;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,kBAAkB,OAAO;AACzB;;AAEA,sBAAsB,OAAO;AAC7B;AACA,8BAA8B,OAAO;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,qBAAqB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA,sBAAsB,cAAc;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;;AAEA;AACA;;AAEA,iCAAiC;AACjC;AACA;;AAEA;;AAEA,YAAY;AACZ;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,8SAA8S;AACjT;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,eAAe;AAC9F;;AAEA;AACA,+DAA+D,eAAe;AAC9E;;AAEA,wCAAwC;AACxC,4CAA4C;AAC5C;;AAEA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8DAA8D,UAAU;AACxE,8DAA8D,wBAAwB;AACtF,8DAA8D,wBAAwB;AACtF;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sLAAsL;AACzL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,iKAAiK;AACpK;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL,uBAAuB,sBAAsB,gBAAgB;AAC7D,uBAAuB;;AAEvB,KAAK;AACL;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,aAAa,6BAA6B;AAC1C;AACA;AACA,KAAK;AACL;AACA,uBAAuB;AACvB;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,4BAA4B;AAC5B;AACA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,yKAAyK;AAC5K;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,sBAAsB;AACtB;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oLAAoL;AACvL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,eAAe;AAC9F;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,wQAAwQ;AAC3Q;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,wBAAwB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,oNAAoN;AACvN;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,cAAc,iBAAiB;AAC/B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uFAAuF;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL,uBAAuB,sBAAsB,gBAAgB;;AAE7D,uBAAuB;;AAEvB,KAAK;AACL,4BAA4B;;AAE5B,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;;AAEA;AACA;;AAEA,4BAA4B;AAC5B;AACA,KAAK;AACL,CAAC;;AAED,CAAC,EAAE,wMAAwM;AAC3M;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,6KAA6K;AAChL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,eAAe;AAC9F;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sMAAsM;AACzM;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,mLAAmL;AACtL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,oNAAoN;AACvN;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wBAAwB,gCAAgC;AACxD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC,4BAA4B,EAAE;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC,4BAA4B,EAAE;AACtE;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,mMAAmM;AACtM;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,2DAA2D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA,CAAC,EAAE,6FAA6F;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA,KAAK;AACL,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA,SAAS;AACT,KAAK;AACL;AACA,uBAAuB,sBAAsB,aAAa;AAC1D;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,CAAC;;AAED;AACA;;AAEA,CAAC,EAAE,iLAAiL;AACpL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,oBAAoB;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,wBAAwB;AACxB;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA,SAAS;AACT;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,sDAAsD;AACtD,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,0BAA0B;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,WAAW;AACtC,2BAA2B,iCAAiC;AAC5D;AACA;AACA;;AAEA,iCAAiC,WAAW;AAC5C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,WAAW;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,gUAAgU;AACnU;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,8DAA8D,UAAU;AACxE,8DAA8D,wBAAwB;;AAEtF;AACA;;AAEA,CAAC,EAAE,qRAAqR;AACxR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa,2CAA2C;AACxD;;AAEA;AACA;AACA,+CAA+C,aAAa;AAC5D;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iBAAiB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uEAAuE,KAAK;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,wBAAwB;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0BAA0B,mBAAmB;AAC7C;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,uBAAuB,EAAE;AACtE;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;;AAEA,CAAC,EAAE,+rBAA+rB;AAClsB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB;AACvB;;AAEA,KAAK;;AAEL,uBAAuB;;AAEvB,KAAK;AACL,4BAA4B;;AAE5B,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL,4BAA4B;AAC5B;AACA,KAAK;AACL,CAAC;;AAED,CAAC,EAAE,uOAAuO;AAC1O;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA,4BAA4B,OAAO;AACnC,4BAA4B,KAAK;AACjC,SAAS;;AAET;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA,aAAa;AACb;;AAEA;AACA,8CAA8C;AAC9C;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,0BAA0B;;AAE3D,6BAA6B,cAAc;;AAE3C;AACA;AACA;AACA;AACA,kDAAkD,aAAa;AAC/D;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,sBAAsB;AACpC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,8CAA8C;AAChE;AACA,aAAa,kCAAkC;AAC/C;AACA;AACA,aAAa,kCAAkC;AAC/C;AACA;AACA,aAAa,iCAAiC;AAC9C;AACA;AACA;;AAEA;AACA;;AAEA,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,kBAAkB,sBAAsB;AACxC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,UAAU;AACtC;AACA;AACA,2BAA2B,aAAa;AACxC;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,WAAW;;AAErC;AACA;AACA;AACA;;AAEA,CAAC,EAAE,kRAAkR;AACrR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,6EAA6E,aAAa;AAC1F;AACA;;AAEA;AACA,+EAA+E,aAAa;;AAE5F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+DAA+D,eAAe;AAC9E;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sMAAsM;AACzM;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,8IAA8I;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,4LAA4L;AAC/L;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,gCAAgC;AAClD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,iBAAiB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA,KAAK;AACL,kBAAkB,eAAe;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,2EAA2E;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA,6BAA6B,4BAA4B,YAAY;;AAErE;AACA;;AAEA,uBAAuB;AACvB;AACA;;AAEA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,4BAA4B;AAC5B;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,iFAAiF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,+DAA+D,WAAW;;AAE1E;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,qNAAqN;AACxN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,eAAe;AAC9F;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wQAAwQ;AAC3Q;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yEAAyE;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;;AAEA,CAAC,EAAE,4LAA4L;AAC/L;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,2BAA2B;AAC7C;;AAEA,sBAAsB,gBAAgB;AACtC;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,uDAAuD;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,iEAAiE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,kQAAkQ;AACrQ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,+DAA+D,WAAW;;AAE1E,aAAa,2CAA2C;AACxD;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC,oCAAoC,mCAAmC;AACvE;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;;AAEA,CAAC,EAAE,8VAA8V;AACjW;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL,uBAAuB,sBAAsB,gBAAgB;AAC7D,uBAAuB;;AAEvB,KAAK;AACL,4BAA4B;;AAE5B,KAAK;AACL;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,aAAa,6BAA6B;AAC1C;AACA;AACA,KAAK;AACL;AACA;AACA,uBAAuB;AACvB;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,4BAA4B;AAC5B;AACA,KAAK;AACL;AACA;;AAEA,CAAC,EAAE,mNAAmN;AACtN;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA,kBAAkB;;AAElB;;AAEA;AACA,cAAc,uBAAuB;AACrC;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oJAAoJ;AACvJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,+EAA+E,eAAe;AAC9F;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,wQAAwQ;AAC3Q;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,yDAAyD;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA,CAAC,EAAE,kNAAkN;AACrN;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,4DAA4D,yBAAyB;AACrF,wBAAwB,iCAAiC,iBAAiB;AAC1E;AACA,CAAC;;AAED;AACA;AACA,uBAAuB,4BAA4B,uBAAuB;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA,aAAa;;AAEb;AACA,SAAS;;AAET;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL,eAAe;;AAEf,uBAAuB;;AAEvB,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;;AAET;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,CAAC,EAAE,yMAAyM;AAC5M;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB;AACvB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,eAAe;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,eAAe,GAAG,eAAe;AAC9D,KAAK;AACL,6BAA6B,eAAe;AAC5C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mDAAmD;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,eAAe;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,iMAAiM;AACpM;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,eAAe;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,eAAe;AAC7B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,kBAAkB;AAChC,kBAAkB,kBAAkB;AACpC;;AAEA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,6KAA6K;AAChL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,cAAc,wBAAwB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,aAAa,yBAAyB,eAAe;AACrD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,oDAAoD;;AAEpD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;;AAEA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,oCAAoC;;AAEpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA,eAAe,WAAW;AAC1B;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,qaAAqa;AACxa;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;;AAED,+BAA+B;AAC/B;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA,CAAC,EAAE,uKAAuK;AAC1K;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+CAA+C,0BAA0B,EAAE;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,eAAe;AACrC,0BAA0B,eAAe;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,CAAC,EAAE,kGAAkG;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAA2D,yBAAyB;;AAEpF;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+EAA+E;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;AACL;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA,4BAA4B;;AAE5B,SAAS;AACT,2BAA2B;;AAE3B,SAAS;AACT,2BAA2B;;AAE3B,SAAS;AACT,KAAK;;AAEL,4BAA4B;AAC5B,CAAC;;AAED;AACA;;AAEA,CAAC,EAAE,yMAAyM;AAC5M;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,CAAC,EAAE,uCAAuC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA;;AAEA,cAAc,UAAU;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA;;AAEA,cAAc,UAAU;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC;AACpC,oCAAoC;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,mBAAmB;;AAErC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,kBAAkB;AAC/C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,OAAO;AACrB;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,UAAU;AACxB,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,OAAO;AACrB,kBAAkB,UAAU;AAC5B,sBAAsB,UAAU;AAChC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA,cAAc,OAAO;AACrB,kBAAkB,UAAU;AAC5B,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,OAAO;AACrB;AACA;;AAEA,cAAc,OAAO;AACrB,kBAAkB,UAAU;AAC5B,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,+BAA+B,EAAE;AACzE,wCAAwC,+BAA+B,EAAE;AACzE,wCAAwC,+BAA+B,EAAE;AACzE,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,cAAc,OAAO;AACrB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC,SAAS;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC,EAAE,0JAA0J;AAC7J;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,WAAW,EAAE;;AAExC;;AAEA;;AAEA;AACA,cAAc,OAAO;;AAErB;AACA;AACA;;AAEA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4CAA4C;AAC5C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,oGAAoG;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,4FAA4F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,2BAA2B;;AAEpD;AACA;AACA;AACA;;;AAGA,KAAK;;AAEL;AACA;;;AAGA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;;;AAGA,SAAS;;AAET,4BAA4B,mBAAmB,cAAc;;AAE7D;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;;AAGA;AACA,SAAS;;AAET,2BAA2B,aAAa,cAAc;AACtD,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;;AAEA;;AAEA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;AACA;;;AAGA,SAAS;;AAET;AACA;AACA;;;AAGA,SAAS;;AAET,4BAA4B,mBAAmB,cAAc;;AAE7D;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;;AAET,2BAA2B,aAAa,cAAc;AACtD;AACA,CAAC;AACD;;AAEA,CAAC,EAAE,gKAAgK;AACnK;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,yCAAyC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;;AAEA,CAAC,EAAE,oBAAoB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,wCAAwC,4BAA4B,EAAE;AACtE;AACA,yEAAyE,2BAA2B,EAAE;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,UAAU;AAC3G;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,iDAAiD,2CAA2C,EAAE;;AAE9F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB,oBAAoB;AAChE,kCAAkC,iBAAiB,qBAAqB;AACxE,iDAAiD,aAAa;AAC9D,8DAA8D,aAAa;AAC3E;AACA,yBAAyB,iCAAiC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,4CAA4C,oBAAoB,wBAAwB,2BAA2B,GAAG;AACtH;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,+DAA+D;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,eAAe,8BAA8B;AAC5E,KAAK;AACL,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA4F;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,uBAAuB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wDAAwD,cAAc;AACtE,gDAAgD,0BAA0B;AAC1E,kCAAkC,kBAAkB;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;;AAE3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;;AAE1D;AACA;AACA;;AAEA,CAAC,EAAE,6DAA6D;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,CAAC,EAAE,qFAAqF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,sCAAsC;AAC1E,qCAAqC,uCAAuC;AAC5E;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,iBAAiB;AAC3D;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,wCAAwC,uDAAuD;;AAE/F;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,gBAAgB;AACpD,qCAAqC,iBAAiB;;AAEtD;AACA;AACA,KAAK;;AAEL;AACA,4BAA4B,mBAAmB;;AAE/C;AACA;AACA;;AAEA;;AAEA,2CAA2C,mCAAmC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,kCAAkC;AAC3G;AACA,aAAa;AACb;AACA;AACA,2CAA2C;AAC3C;;AAEA,6EAA6E,2CAA2C;AACxH,oEAAoE,8BAA8B;AAClG;AACA;AACA;AACA,iBAAiB;;AAEjB,6CAA6C,iBAAiB;AAC9D;AACA;AACA;AACA,oDAAoD,mCAAmC;AACvF;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,kBAAkB;AACjF,aAAa;AACb;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,iCAAiC,cAAc;;AAE/C;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC,uCAAuC;;AAExE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,iCAAiC;AACrE,qCAAqC,4BAA4B;;AAEjE;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iCAAiC,qCAAqC;;AAEtE;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,8CAA8C,EAAE;AACpF,qCAAqC,6DAA6D;AAClG,gCAAgC,2BAA2B,EAAE;AAC7D,gCAAgC,2BAA2B,EAAE;;AAE7D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0DAA0D,UAAU;AACpE,0BAA0B,mBAAmB;AAC7C;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,mDAAmD,yBAAyB;;AAE5E;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,uCAAuC,yBAAyB;;AAEhE;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,uCAAuC,yBAAyB;;AAEhE;AACA;AACA;AACA,qCAAqC,eAAe;AACpD,qCAAqC,4BAA4B;;AAEjE;AACA;;AAEA;;AAEA;AACA,uCAAuC,yBAAyB;;AAEhE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,oCAAoC,6BAA6B;AACjE,2CAA2C,0BAA0B;AACrE;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yGAAyG,+CAA+C;AACxJ,qEAAqE,QAAQ,uBAAuB;AACpG,kCAAkC,oCAAoC;AACtE;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,oDAAoD,4DAA4D;AAChH;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,qBAAqB;AACrB;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB,yBAAyB;;AAEzB;AACA;AACA;;AAEA;AACA;AACA,+CAA+C,oCAAoC;AACnF;;AAEA;;AAEA;AACA;;AAEA,2BAA2B,4BAA4B;;AAEvD;AACA;AACA;AACA,sBAAsB,sBAAsB;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAiD;AACjD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wEAAwE,yBAAyB;AACjG;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,yDAAyD;AAC9H;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qFAAqF,oCAAoC;AACzH;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,qCAAqC,6CAA6C;AAClF;;AAEA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,6DAA6D;AAC/E;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB;AACtB,uBAAuB;;AAEvB,CAAC,EAAE,wNAAwN;AAC3N;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;;AAE9B,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA,aAAa,iCAAiC;AAC9C,aAAa;AACb;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;;AAEA,yBAAyB;;AAEzB,KAAK;AACL,yBAAyB;;AAEzB,KAAK;AACL,2BAA2B;;AAE3B,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC,EAAE,+CAA+C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,eAAe;AACjC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mCAAmC,0BAA0B;AAC7D;AACA;AACA,8BAA8B;AAC9B;;AAEA;;AAEA;AACA;AACA;;AAEA,mEAAmE,aAAa;AAChF;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,oHAAoH;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,yBAAyB;AAC3C;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,8BAA8B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,8DAA8D;AAC9D;AACA;;AAEA,iEAAiE,WAAW;;AAE5E;AACA;AACA;AACA;AACA;AACA,oCAAoC;;AAEpC;AACA;AACA;AACA,8CAA8C;AAC9C;;AAEA,CAAC,EAAE,uFAAuF;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kCAAkC,YAAY;;AAE9C,CAAC,EAAE,gBAAgB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,qFAAqF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC,EAAE,sPAAsP;AACzP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,6BAA6B;;AAE7B,KAAK;AACL,4BAA4B;;AAE5B,KAAK;AACL,iCAAiC;;AAEjC,KAAK;AACL;;AAEA,CAAC,EAAE,+CAA+C;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,wEAAwE;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,+CAA+C;AAC/C;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,+CAA+C,2BAA2B;AAC1E;AACA;AACA;AACA,SAAS;;AAET;AACA,wCAAwC,2BAA2B;AACnE;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,uCAAuC,aAAa;AACpD,KAAK;AACL;;AAEA,CAAC,EAAE,yHAAyH;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,oCAAoC,2BAA2B,EAAE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA,CAAC,EAAE,8DAA8D;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,2BAA2B;;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,2BAA2B;AACzC,0BAA0B;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC;AACnC;;AAEA;AACA,cAAc,2BAA2B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;;AAGA;AACA;;AAEA;;AAEA,gDAAgD,eAAe;AAC/D;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,cAAc,yBAAyB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,qCAAqC;AAC/D;AACA;AACA;;AAEA,qBAAqB,oBAAoB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC,EAAE,uHAAuH;AAC1H;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gCAAgC,sCAAsC,EAAE;AACxE,iCAAiC,kCAAkC;;AAEnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gCAAgC,sCAAsC;;AAEtE;AACA,gCAAgC,sCAAsC;;AAEtE;AACA,gCAAgC,oCAAoC;;AAEpE;AACA,gCAAgC,qCAAqC;;AAErE;AACA,gCAAgC,oCAAoC;;AAEpE;AACA,gCAAgC,qCAAqC;;AAErE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;;AAEA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA,CAAC,EAAE,4GAA4G;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,oBAAoB;AACpB;;AAEA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,qDAAqD,MAAM,IAAI,MAAM,QAAQ,MAAM;;AAEnF;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA,WAAW,OAAO;AAClB;AACA,qBAAqB,OAAO;AAC5B,qBAAqB,OAAO;AAC5B,oBAAoB,MAAM;AAC1B,kBAAkB,OAAO;AACzB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA,cAAc,iBAAiB;AAC/B;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc,mBAAmB;AACjC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;;AAEA;AACA,yDAAyD;AACzD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC,8DAA8D;AAC9D;;AAEA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,uBAAuB;AACrC;;AAEA;AACA,oCAAoC,uBAAuB;AAC3D;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;;AAEA;;AAEA;AACA;AACA,gFAAgF;AAChF;;AAEA;AACA;;AAEA,CAAC,EAAE,iFAAiF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,6BAA6B;AAClD,qBAAqB;AACrB;AACA;;AAEA,CAAC,GAAG;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,uBAAuB;AACrC;AACA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,SAAS;AACvB,0BAA0B;AAC1B;;AAEA;;AAEA,cAAc,SAAS;AACvB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,4BAA4B;AAC/D;AACA,mCAAmC,4BAA4B;AAC/D;AACA;;AAEA,CAAC,EAAE,4DAA4D,EAAE,GAAG;AACpE,CAAC;;;;;;;;;ACzk/KD;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf,WAAW,kBAAkB;AAC7B;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,IAAI;AACf,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO,mCAAmC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,IAAI;AACf;AACA,WAAW,IAAI;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;;AAEA;;AAEA,cAAc,wBAAwB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA;;AAEA;AACA,cAAc,UAAU;AACxB;AACA,kBAAkB,UAAU;AAC5B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,cAAc,qBAAqB;AACnC;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,2BAA2B;AAC7C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,2BAA2B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,qBAAqB;AACrB;AACA;AACA;AACA,YAAY,eAAe;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,oBAAoB;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,GAAG;AACd,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,GAAG;AACd,YAAY,aAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU,qBAAqB,gBAAgB;AAC9D;AACA,aAAa,OAAO;AACpB,aAAa,EAAE;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B,4BAA4B;AACxD,WAAW,UAAU,QAAQ;AAC7B;AACA;AACA;AACA,4BAA4B,sBAAsB;AAClD,WAAW,cAAc,WAAW;AACpC;AACA;AACA;AACA,4BAA4B,mCAAmC;AAC/D,WAAW,QAAQ,QAAQ,GAAG,QAAQ;AACtC;AACA;AACA;AACA,4BAA4B,iDAAiD;AAC7E,WAAW,iBAAiB,SAAS;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,wEAAwE;AACxE,iBAAiB;AACjB;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,cAAc;AAC3B,aAAa,OAAO;AACpB,aAAa,QAAQ;AACrB;AACA,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gCAAgC,EAAE;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,+BAA+B,QAAQ,SAAS,KAAK;AACrD;;AAEA;AACA;AACA;AACA;AACA,gCAAgC,MAAM,IAAI,cAAc;AACxD,gCAAgC,cAAc,IAAI,SAAS,aAAa,EAAE;AAC1E;AACA,WAAW,OAAO,4BAA4B,IAAI;AAClD,WAAW,IAAI;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,MAAM,IAAI,cAAc;AACxD,gCAAgC,cAAc,IAAI,SAAS,aAAa,EAAE;AAC1E,iCAAiC,OAAO,IAAI,KAAK;AACjD;AACA,WAAW,OAAO,4BAA4B,QAAQ;AACtD,WAAW,IAAI,iFAAiF;AAChG,WAAW,IAAI;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACvmCA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;AC9LA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,YAAY;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA,+BAA+B,mCAAmC;AAClE;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,0BAA0B,mBAAmB;AAC7C;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;;AAIA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gCAAgC,kBAAkB,SAAS;;AAE3D;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;AACA;;AAEA,8BAA8B,UAAU;AACxC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA;AACA,kCAAkC,iBAAiB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,IAAI;AAChB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,mBAAmB;AACnB;AACA,oBAAoB,mBAAmB,SAAS,EAAE;;AAElD;;AAEA;AACA;AACA;AACA;;;;;;;;ACpdA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;;;;;;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe,EAAE;;AAEnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mCAAmC;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK,EAAE;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kCAAkC;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACxlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;;AAE5B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC,SAAS,aAAa,IAAI,WAAW;AAC5E;AACA;AACA,4BAA4B,oCAAoC;AAChE,wBAAwB;AACxB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AChOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT,kCAAkC,wBAAwB;;AAE1D,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA,SAAS;AACT;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA,SAAS;AACT;AACA;;;;;;;;AChSA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA,YAAY,OAAO,+BAA+B,WAAW;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;AACA;;;;;;;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,6BAA6B,eAAe;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,cAAc;AACvC,4BAA4B,eAAe;AAC3C,4BAA4B,cAAc;AAC1C,+BAA+B,eAAe;;AAE9C,oCAAoC,cAAc;AAClD,oCAAoC,cAAc;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,SAAS;AACpB;AACA;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzLA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA,WAAW,MAAM;AACjB;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;;AAEA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wCAAwC,cAAc,EAAE;AACxD;;AAEA;AACA;AACA,2CAA2C,cAAc,EAAE;AAC3D;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;;AAExB;AACA,cAAc,YAAY;AAC1B;AACA,kBAAkB,UAAU;AAC5B;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,uBAAuB;;AAE9C,uBAAuB,uBAAuB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB,WAAW;AACX;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,YAAY;AACZ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,kBAAkB;AAC7B,WAAW,kBAAkB;AAC7B,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC9OA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe;AACf;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,OAAO,OAAO;AACd,OAAO,OAAO;AACd,OAAO,OAAO;AACd,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACnPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,aAAa,eAAe;AAC5B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,cAAc;AACd;;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA,WAAW,MAAM;AACjB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,sCAAsC,wBAAwB,EAAE;;AAEhE;;AAEA;AACA;;AAEA;;AAEA;AACA;;;;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA,sBAAsB,OAAO;AAC7B,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,YAAY,UAAU;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;;;;;;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,wBAAwB,OAAO,GAAG,OAAO;AACzC;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY,MAAM;AAClB;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA,kBAAkB,kBAAkB;AACpC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY,iBAAiB;AAC7B,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,sBAAsB;AACxC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 20);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a26b7660c39c5b24119a","/**\r\n * inspired by is-number \r\n * but significantly simplified and sped up by ignoring number and string constructors\r\n * ie these return false:\r\n * new Number(1)\r\n * new String('1')\r\n */\r\n\r\n'use strict';\r\n\r\nvar allBlankCharCodes = require('is-string-blank');\r\n\r\nmodule.exports = function(n) {\r\n var type = typeof n;\r\n if(type === 'string') {\r\n var original = n;\r\n n = +n;\r\n // whitespace strings cast to zero - filter them out\r\n if(n===0 && allBlankCharCodes(original)) return false;\r\n }\r\n else if(type !== 'number') return false;\r\n\r\n return n - n < 1;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fast-isnumeric/index.js\n// module id = 0\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isArray = Array.isArray;\n\n// IE9 fallbacks\n\nvar ab = (typeof ArrayBuffer === 'undefined' || !ArrayBuffer.isView) ?\n {isView: function() { return false; }} :\n ArrayBuffer;\n\nvar dv = (typeof DataView === 'undefined') ?\n function() {} :\n DataView;\n\nfunction isTypedArray(a) {\n return ab.isView(a) && !(a instanceof dv);\n}\nexports.isTypedArray = isTypedArray;\n\nfunction isArrayOrTypedArray(a) {\n return isArray(a) || isTypedArray(a);\n}\nexports.isArrayOrTypedArray = isArrayOrTypedArray;\n\n/*\n * Test whether an input object is 1D.\n *\n * Assumes we already know the object is an array.\n *\n * Looks only at the first element, if the dimensionality is\n * not consistent we won't figure that out here.\n */\nfunction isArray1D(a) {\n return !isArrayOrTypedArray(a[0]);\n}\nexports.isArray1D = isArray1D;\n\n/*\n * Ensures an array has the right amount of storage space. If it doesn't\n * exist, it creates an array. If it does exist, it returns it if too\n * short or truncates it in-place.\n *\n * The goal is to just reuse memory to avoid a bit of excessive garbage\n * collection.\n */\nexports.ensureArray = function(out, n) {\n // TODO: typed array support here? This is only used in\n // traces/carpet/compute_control_points\n if(!isArray(out)) out = [];\n\n // If too long, truncate. (If too short, it will grow\n // automatically so we don't care about that case)\n out.length = n;\n\n return out;\n};\n\n/*\n * TypedArray-compatible concatenation of n arrays\n * if all arrays are the same type it will preserve that type,\n * otherwise it falls back on Array.\n * Also tries to avoid copying, in case one array has zero length\n * But never mutates an existing array\n */\nexports.concat = function() {\n var args = [];\n var allArray = true;\n var totalLen = 0;\n\n var _constructor, arg0, i, argi, posi, leni, out, j;\n\n for(i = 0; i < arguments.length; i++) {\n argi = arguments[i];\n leni = argi.length;\n if(leni) {\n if(arg0) args.push(argi);\n else {\n arg0 = argi;\n posi = leni;\n }\n\n if(isArray(argi)) {\n _constructor = false;\n }\n else {\n allArray = false;\n if(!totalLen) {\n _constructor = argi.constructor;\n }\n else if(_constructor !== argi.constructor) {\n // TODO: in principle we could upgrade here,\n // ie keep typed array but convert all to Float64Array?\n _constructor = false;\n }\n }\n\n totalLen += leni;\n }\n }\n\n if(!totalLen) return [];\n if(!args.length) return arg0;\n\n if(allArray) return arg0.concat.apply(arg0, args);\n if(_constructor) {\n // matching typed arrays\n out = new _constructor(totalLen);\n out.set(arg0);\n for(i = 0; i < args.length; i++) {\n argi = args[i];\n out.set(argi, posi);\n posi += argi.length;\n }\n return out;\n }\n\n // mismatched types or Array + typed\n out = new Array(totalLen);\n for(j = 0; j < arg0.length; j++) out[j] = arg0[j];\n for(i = 0; i < args.length; i++) {\n argi = args[i];\n for(j = 0; j < argi.length; j++) out[posi + j] = argi[j];\n posi += j;\n }\n return out;\n};\n\nexports.maxRowLength = function(z) {\n return _rowLength(z, Math.max, 0);\n};\n\nexports.minRowLength = function(z) {\n return _rowLength(z, Math.min, Infinity);\n};\n\nfunction _rowLength(z, fn, len0) {\n if(isArrayOrTypedArray(z)) {\n if(isArrayOrTypedArray(z[0])) {\n var len = len0;\n for(var i = 0; i < z.length; i++) {\n len = fn(len, z[i].length);\n }\n return len;\n } else {\n return z.length;\n }\n }\n return 0;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/array.js\n// module id = 1\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n/**\n * sanitized modulus function that always returns in the range [0, d)\n * rather than (-d, 0] if v is negative\n */\nfunction mod(v, d) {\n var out = v % d;\n return out < 0 ? out + d : out;\n}\n\n/**\n * sanitized modulus function that always returns in the range [-d/2, d/2]\n * rather than (-d, 0] if v is negative\n */\nfunction modHalf(v, d) {\n return Math.abs(v) > (d / 2) ?\n v - Math.round(v / d) * d :\n v;\n}\n\nmodule.exports = {\n mod: mod,\n modHalf: modHalf\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/mod.js\n// module id = 2\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\n// more info: http://stackoverflow.com/questions/18531624/isplainobject-thing\nmodule.exports = function isPlainObject(obj) {\n\n // We need to be a little less strict in the `imagetest` container because\n // of how async image requests are handled.\n //\n // N.B. isPlainObject(new Constructor()) will return true in `imagetest`\n if(window && window.process && window.process.versions) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj) === Object.prototype\n );\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/is_plain_object.js\n// module id = 3\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n/* eslint-disable no-console */\n\nvar config = require('../plot_api/plot_config');\n\nvar loggers = module.exports = {};\n\n/**\n * ------------------------------------------\n * debugging tools\n * ------------------------------------------\n */\n\nloggers.log = function() {\n if(config.logging > 1) {\n var messages = ['LOG:'];\n\n for(var i = 0; i < arguments.length; i++) {\n messages.push(arguments[i]);\n }\n\n apply(console.trace || console.log, messages);\n }\n};\n\nloggers.warn = function() {\n if(config.logging > 0) {\n var messages = ['WARN:'];\n\n for(var i = 0; i < arguments.length; i++) {\n messages.push(arguments[i]);\n }\n\n apply(console.trace || console.log, messages);\n }\n};\n\nloggers.error = function() {\n if(config.logging > 0) {\n var messages = ['ERROR:'];\n\n for(var i = 0; i < arguments.length; i++) {\n messages.push(arguments[i]);\n }\n\n apply(console.error, messages);\n }\n};\n\n/*\n * Robust apply, for IE9 where console.log doesn't support\n * apply like other functions do\n */\nfunction apply(f, args) {\n if(f && f.apply) {\n try {\n // `this` should always be console, since here we're always\n // applying a method of the console object.\n f.apply(console, args);\n return;\n }\n catch(e) { /* in case apply failed, fall back on the code below */ }\n }\n\n // no apply - just try calling the function on each arg independently\n for(var i = 0; i < args.length; i++) {\n try {\n f(args[i]);\n }\n catch(e) {\n // still fails - last resort simple console.log\n console.log(args[i]);\n }\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/loggers.js\n// module id = 4\n// module chunks = 0","!function() {\n var d3 = {\n version: \"3.5.17\"\n };\n var d3_arraySlice = [].slice, d3_array = function(list) {\n return d3_arraySlice.call(list);\n };\n var d3_document = this.document;\n function d3_documentElement(node) {\n return node && (node.ownerDocument || node.document || node).documentElement;\n }\n function d3_window(node) {\n return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView);\n }\n if (d3_document) {\n try {\n d3_array(d3_document.documentElement.childNodes)[0].nodeType;\n } catch (e) {\n d3_array = function(list) {\n var i = list.length, array = new Array(i);\n while (i--) array[i] = list[i];\n return array;\n };\n }\n }\n if (!Date.now) Date.now = function() {\n return +new Date();\n };\n if (d3_document) {\n try {\n d3_document.createElement(\"DIV\").style.setProperty(\"opacity\", 0, \"\");\n } catch (error) {\n 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;\n d3_element_prototype.setAttribute = function(name, value) {\n d3_element_setAttribute.call(this, name, value + \"\");\n };\n d3_element_prototype.setAttributeNS = function(space, local, value) {\n d3_element_setAttributeNS.call(this, space, local, value + \"\");\n };\n d3_style_prototype.setProperty = function(name, value, priority) {\n d3_style_setProperty.call(this, name, value + \"\", priority);\n };\n }\n }\n d3.ascending = d3_ascending;\n function d3_ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n }\n d3.descending = function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n };\n d3.min = function(array, f) {\n var i = -1, n = array.length, a, b;\n if (arguments.length === 1) {\n while (++i < n) if ((b = array[i]) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = array[i]) != null && a > b) a = b;\n } else {\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;\n }\n return a;\n };\n d3.max = function(array, f) {\n var i = -1, n = array.length, a, b;\n if (arguments.length === 1) {\n while (++i < n) if ((b = array[i]) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = array[i]) != null && b > a) a = b;\n } else {\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {\n a = b;\n break;\n }\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;\n }\n return a;\n };\n d3.extent = function(array, f) {\n var i = -1, n = array.length, a, b, c;\n if (arguments.length === 1) {\n while (++i < n) if ((b = array[i]) != null && b >= b) {\n a = c = b;\n break;\n }\n while (++i < n) if ((b = array[i]) != null) {\n if (a > b) a = b;\n if (c < b) c = b;\n }\n } else {\n while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {\n a = c = b;\n break;\n }\n while (++i < n) if ((b = f.call(array, array[i], i)) != null) {\n if (a > b) a = b;\n if (c < b) c = b;\n }\n }\n return [ a, c ];\n };\n function d3_number(x) {\n return x === null ? NaN : +x;\n }\n function d3_numeric(x) {\n return !isNaN(x);\n }\n d3.sum = function(array, f) {\n var s = 0, n = array.length, a, i = -1;\n if (arguments.length === 1) {\n while (++i < n) if (d3_numeric(a = +array[i])) s += a;\n } else {\n while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;\n }\n return s;\n };\n d3.mean = function(array, f) {\n var s = 0, n = array.length, a, i = -1, j = n;\n if (arguments.length === 1) {\n while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j;\n } else {\n while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j;\n }\n if (j) return s / j;\n };\n d3.quantile = function(values, p) {\n var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;\n return e ? v + e * (values[h] - v) : v;\n };\n d3.median = function(array, f) {\n var numbers = [], n = array.length, a, i = -1;\n if (arguments.length === 1) {\n while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);\n } else {\n while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);\n }\n if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), .5);\n };\n d3.variance = function(array, f) {\n var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0;\n if (arguments.length === 1) {\n while (++i < n) {\n if (d3_numeric(a = d3_number(array[i]))) {\n d = a - m;\n m += d / ++j;\n s += d * (a - m);\n }\n }\n } else {\n while (++i < n) {\n if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) {\n d = a - m;\n m += d / ++j;\n s += d * (a - m);\n }\n }\n }\n if (j > 1) return s / (j - 1);\n };\n d3.deviation = function() {\n var v = d3.variance.apply(this, arguments);\n return v ? Math.sqrt(v) : v;\n };\n function d3_bisector(compare) {\n return {\n left: function(a, x, lo, hi) {\n if (arguments.length < 3) lo = 0;\n if (arguments.length < 4) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (arguments.length < 3) lo = 0;\n if (arguments.length < 4) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1;\n }\n return lo;\n }\n };\n }\n var d3_bisect = d3_bisector(d3_ascending);\n d3.bisectLeft = d3_bisect.left;\n d3.bisect = d3.bisectRight = d3_bisect.right;\n d3.bisector = function(f) {\n return d3_bisector(f.length === 1 ? function(d, x) {\n return d3_ascending(f(d), x);\n } : f);\n };\n d3.shuffle = function(array, i0, i1) {\n if ((m = arguments.length) < 3) {\n i1 = array.length;\n if (m < 2) i0 = 0;\n }\n var m = i1 - i0, t, i;\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;\n }\n return array;\n };\n d3.permute = function(array, indexes) {\n var i = indexes.length, permutes = new Array(i);\n while (i--) permutes[i] = array[indexes[i]];\n return permutes;\n };\n d3.pairs = function(array) {\n var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);\n while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ];\n return pairs;\n };\n d3.transpose = function(matrix) {\n if (!(n = matrix.length)) return [];\n for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) {\n for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) {\n row[j] = matrix[j][i];\n }\n }\n return transpose;\n };\n function d3_transposeLength(d) {\n return d.length;\n }\n d3.zip = function() {\n return d3.transpose(arguments);\n };\n d3.keys = function(map) {\n var keys = [];\n for (var key in map) keys.push(key);\n return keys;\n };\n d3.values = function(map) {\n var values = [];\n for (var key in map) values.push(map[key]);\n return values;\n };\n d3.entries = function(map) {\n var entries = [];\n for (var key in map) entries.push({\n key: key,\n value: map[key]\n });\n return entries;\n };\n d3.merge = function(arrays) {\n var n = arrays.length, m, i = -1, j = 0, merged, array;\n while (++i < n) j += arrays[i].length;\n merged = new Array(j);\n while (--n >= 0) {\n array = arrays[n];\n m = array.length;\n while (--m >= 0) {\n merged[--j] = array[m];\n }\n }\n return merged;\n };\n var abs = Math.abs;\n d3.range = function(start, stop, step) {\n if (arguments.length < 3) {\n step = 1;\n if (arguments.length < 2) {\n stop = start;\n start = 0;\n }\n }\n if ((stop - start) / step === Infinity) throw new Error(\"infinite range\");\n var range = [], k = d3_range_integerScale(abs(step)), i = -1, j;\n start *= k, stop *= k, step *= k;\n if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);\n return range;\n };\n function d3_range_integerScale(x) {\n var k = 1;\n while (x * k % 1) k *= 10;\n return k;\n }\n function d3_class(ctor, properties) {\n for (var key in properties) {\n Object.defineProperty(ctor.prototype, key, {\n value: properties[key],\n enumerable: false\n });\n }\n }\n d3.map = function(object, f) {\n var map = new d3_Map();\n if (object instanceof d3_Map) {\n object.forEach(function(key, value) {\n map.set(key, value);\n });\n } else if (Array.isArray(object)) {\n var i = -1, n = object.length, o;\n if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o);\n } else {\n for (var key in object) map.set(key, object[key]);\n }\n return map;\n };\n function d3_Map() {\n this._ = Object.create(null);\n }\n var d3_map_proto = \"__proto__\", d3_map_zero = \"\\x00\";\n d3_class(d3_Map, {\n has: d3_map_has,\n get: function(key) {\n return this._[d3_map_escape(key)];\n },\n set: function(key, value) {\n return this._[d3_map_escape(key)] = value;\n },\n remove: d3_map_remove,\n keys: d3_map_keys,\n values: function() {\n var values = [];\n for (var key in this._) values.push(this._[key]);\n return values;\n },\n entries: function() {\n var entries = [];\n for (var key in this._) entries.push({\n key: d3_map_unescape(key),\n value: this._[key]\n });\n return entries;\n },\n size: d3_map_size,\n empty: d3_map_empty,\n forEach: function(f) {\n for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);\n }\n });\n function d3_map_escape(key) {\n return (key += \"\") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;\n }\n function d3_map_unescape(key) {\n return (key += \"\")[0] === d3_map_zero ? key.slice(1) : key;\n }\n function d3_map_has(key) {\n return d3_map_escape(key) in this._;\n }\n function d3_map_remove(key) {\n return (key = d3_map_escape(key)) in this._ && delete this._[key];\n }\n function d3_map_keys() {\n var keys = [];\n for (var key in this._) keys.push(d3_map_unescape(key));\n return keys;\n }\n function d3_map_size() {\n var size = 0;\n for (var key in this._) ++size;\n return size;\n }\n function d3_map_empty() {\n for (var key in this._) return false;\n return true;\n }\n d3.nest = function() {\n var nest = {}, keys = [], sortKeys = [], sortValues, rollup;\n function map(mapType, array, depth) {\n if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;\n var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;\n while (++i < n) {\n if (values = valuesByKey.get(keyValue = key(object = array[i]))) {\n values.push(object);\n } else {\n valuesByKey.set(keyValue, [ object ]);\n }\n }\n if (mapType) {\n object = mapType();\n setter = function(keyValue, values) {\n object.set(keyValue, map(mapType, values, depth));\n };\n } else {\n object = {};\n setter = function(keyValue, values) {\n object[keyValue] = map(mapType, values, depth);\n };\n }\n valuesByKey.forEach(setter);\n return object;\n }\n function entries(map, depth) {\n if (depth >= keys.length) return map;\n var array = [], sortKey = sortKeys[depth++];\n map.forEach(function(key, keyMap) {\n array.push({\n key: key,\n values: entries(keyMap, depth)\n });\n });\n return sortKey ? array.sort(function(a, b) {\n return sortKey(a.key, b.key);\n }) : array;\n }\n nest.map = function(array, mapType) {\n return map(mapType, array, 0);\n };\n nest.entries = function(array) {\n return entries(map(d3.map, array, 0), 0);\n };\n nest.key = function(d) {\n keys.push(d);\n return nest;\n };\n nest.sortKeys = function(order) {\n sortKeys[keys.length - 1] = order;\n return nest;\n };\n nest.sortValues = function(order) {\n sortValues = order;\n return nest;\n };\n nest.rollup = function(f) {\n rollup = f;\n return nest;\n };\n return nest;\n };\n d3.set = function(array) {\n var set = new d3_Set();\n if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);\n return set;\n };\n function d3_Set() {\n this._ = Object.create(null);\n }\n d3_class(d3_Set, {\n has: d3_map_has,\n add: function(key) {\n this._[d3_map_escape(key += \"\")] = true;\n return key;\n },\n remove: d3_map_remove,\n values: d3_map_keys,\n size: d3_map_size,\n empty: d3_map_empty,\n forEach: function(f) {\n for (var key in this._) f.call(this, d3_map_unescape(key));\n }\n });\n d3.behavior = {};\n function d3_identity(d) {\n return d;\n }\n d3.rebind = function(target, source) {\n var i = 1, n = arguments.length, method;\n while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);\n return target;\n };\n function d3_rebind(target, source, method) {\n return function() {\n var value = method.apply(source, arguments);\n return value === source ? target : value;\n };\n }\n function d3_vendorSymbol(object, name) {\n if (name in object) return name;\n name = name.charAt(0).toUpperCase() + name.slice(1);\n for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {\n var prefixName = d3_vendorPrefixes[i] + name;\n if (prefixName in object) return prefixName;\n }\n }\n var d3_vendorPrefixes = [ \"webkit\", \"ms\", \"moz\", \"Moz\", \"o\", \"O\" ];\n function d3_noop() {}\n d3.dispatch = function() {\n var dispatch = new d3_dispatch(), i = -1, n = arguments.length;\n while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);\n return dispatch;\n };\n function d3_dispatch() {}\n d3_dispatch.prototype.on = function(type, listener) {\n var i = type.indexOf(\".\"), name = \"\";\n if (i >= 0) {\n name = type.slice(i + 1);\n type = type.slice(0, i);\n }\n if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);\n if (arguments.length === 2) {\n if (listener == null) for (type in this) {\n if (this.hasOwnProperty(type)) this[type].on(name, null);\n }\n return this;\n }\n };\n function d3_dispatch_event(dispatch) {\n var listeners = [], listenerByName = new d3_Map();\n function event() {\n var z = listeners, i = -1, n = z.length, l;\n while (++i < n) if (l = z[i].on) l.apply(this, arguments);\n return dispatch;\n }\n event.on = function(name, listener) {\n var l = listenerByName.get(name), i;\n if (arguments.length < 2) return l && l.on;\n if (l) {\n l.on = null;\n listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));\n listenerByName.remove(name);\n }\n if (listener) listeners.push(listenerByName.set(name, {\n on: listener\n }));\n return dispatch;\n };\n return event;\n }\n d3.event = null;\n function d3_eventPreventDefault() {\n d3.event.preventDefault();\n }\n function d3_eventSource() {\n var e = d3.event, s;\n while (s = e.sourceEvent) e = s;\n return e;\n }\n function d3_eventDispatch(target) {\n var dispatch = new d3_dispatch(), i = 0, n = arguments.length;\n while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);\n dispatch.of = function(thiz, argumentz) {\n return function(e1) {\n try {\n var e0 = e1.sourceEvent = d3.event;\n e1.target = target;\n d3.event = e1;\n dispatch[e1.type].apply(thiz, argumentz);\n } finally {\n d3.event = e0;\n }\n };\n };\n return dispatch;\n }\n d3.requote = function(s) {\n return s.replace(d3_requote_re, \"\\\\$&\");\n };\n var d3_requote_re = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n var d3_subclass = {}.__proto__ ? function(object, prototype) {\n object.__proto__ = prototype;\n } : function(object, prototype) {\n for (var property in prototype) object[property] = prototype[property];\n };\n function d3_selection(groups) {\n d3_subclass(groups, d3_selectionPrototype);\n return groups;\n }\n var d3_select = function(s, n) {\n return n.querySelector(s);\n }, d3_selectAll = function(s, n) {\n return n.querySelectorAll(s);\n }, d3_selectMatches = function(n, s) {\n var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, \"matchesSelector\")];\n d3_selectMatches = function(n, s) {\n return d3_selectMatcher.call(n, s);\n };\n return d3_selectMatches(n, s);\n };\n if (typeof Sizzle === \"function\") {\n d3_select = function(s, n) {\n return Sizzle(s, n)[0] || null;\n };\n d3_selectAll = Sizzle;\n d3_selectMatches = Sizzle.matchesSelector;\n }\n d3.selection = function() {\n return d3.select(d3_document.documentElement);\n };\n var d3_selectionPrototype = d3.selection.prototype = [];\n d3_selectionPrototype.select = function(selector) {\n var subgroups = [], subgroup, subnode, group, node;\n selector = d3_selection_selector(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n subgroups.push(subgroup = []);\n subgroup.parentNode = (group = this[j]).parentNode;\n for (var i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n subgroup.push(subnode = selector.call(node, node.__data__, i, j));\n if (subnode && \"__data__\" in node) subnode.__data__ = node.__data__;\n } else {\n subgroup.push(null);\n }\n }\n }\n return d3_selection(subgroups);\n };\n function d3_selection_selector(selector) {\n return typeof selector === \"function\" ? selector : function() {\n return d3_select(selector, this);\n };\n }\n d3_selectionPrototype.selectAll = function(selector) {\n var subgroups = [], subgroup, node;\n selector = d3_selection_selectorAll(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j)));\n subgroup.parentNode = node;\n }\n }\n }\n return d3_selection(subgroups);\n };\n function d3_selection_selectorAll(selector) {\n return typeof selector === \"function\" ? selector : function() {\n return d3_selectAll(selector, this);\n };\n }\n var d3_nsXhtml = \"http://www.w3.org/1999/xhtml\";\n var d3_nsPrefix = {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: d3_nsXhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n };\n d3.ns = {\n prefix: d3_nsPrefix,\n qualify: function(name) {\n var i = name.indexOf(\":\"), prefix = name;\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return d3_nsPrefix.hasOwnProperty(prefix) ? {\n space: d3_nsPrefix[prefix],\n local: name\n } : name;\n }\n };\n d3_selectionPrototype.attr = function(name, value) {\n if (arguments.length < 2) {\n if (typeof name === \"string\") {\n var node = this.node();\n name = d3.ns.qualify(name);\n return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);\n }\n for (value in name) this.each(d3_selection_attr(value, name[value]));\n return this;\n }\n return this.each(d3_selection_attr(name, value));\n };\n function d3_selection_attr(name, value) {\n name = d3.ns.qualify(name);\n function attrNull() {\n this.removeAttribute(name);\n }\n function attrNullNS() {\n this.removeAttributeNS(name.space, name.local);\n }\n function attrConstant() {\n this.setAttribute(name, value);\n }\n function attrConstantNS() {\n this.setAttributeNS(name.space, name.local, value);\n }\n function attrFunction() {\n var x = value.apply(this, arguments);\n if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);\n }\n function attrFunctionNS() {\n var x = value.apply(this, arguments);\n if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);\n }\n return value == null ? name.local ? attrNullNS : attrNull : typeof value === \"function\" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;\n }\n function d3_collapse(s) {\n return s.trim().replace(/\\s+/g, \" \");\n }\n d3_selectionPrototype.classed = function(name, value) {\n if (arguments.length < 2) {\n if (typeof name === \"string\") {\n var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1;\n if (value = node.classList) {\n while (++i < n) if (!value.contains(name[i])) return false;\n } else {\n value = node.getAttribute(\"class\");\n while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;\n }\n return true;\n }\n for (value in name) this.each(d3_selection_classed(value, name[value]));\n return this;\n }\n return this.each(d3_selection_classed(name, value));\n };\n function d3_selection_classedRe(name) {\n return new RegExp(\"(?:^|\\\\s+)\" + d3.requote(name) + \"(?:\\\\s+|$)\", \"g\");\n }\n function d3_selection_classes(name) {\n return (name + \"\").trim().split(/^|\\s+/);\n }\n function d3_selection_classed(name, value) {\n name = d3_selection_classes(name).map(d3_selection_classedName);\n var n = name.length;\n function classedConstant() {\n var i = -1;\n while (++i < n) name[i](this, value);\n }\n function classedFunction() {\n var i = -1, x = value.apply(this, arguments);\n while (++i < n) name[i](this, x);\n }\n return typeof value === \"function\" ? classedFunction : classedConstant;\n }\n function d3_selection_classedName(name) {\n var re = d3_selection_classedRe(name);\n return function(node, value) {\n if (c = node.classList) return value ? c.add(name) : c.remove(name);\n var c = node.getAttribute(\"class\") || \"\";\n if (value) {\n re.lastIndex = 0;\n if (!re.test(c)) node.setAttribute(\"class\", d3_collapse(c + \" \" + name));\n } else {\n node.setAttribute(\"class\", d3_collapse(c.replace(re, \" \")));\n }\n };\n }\n d3_selectionPrototype.style = function(name, value, priority) {\n var n = arguments.length;\n if (n < 3) {\n if (typeof name !== \"string\") {\n if (n < 2) value = \"\";\n for (priority in name) this.each(d3_selection_style(priority, name[priority], value));\n return this;\n }\n if (n < 2) {\n var node = this.node();\n return d3_window(node).getComputedStyle(node, null).getPropertyValue(name);\n }\n priority = \"\";\n }\n return this.each(d3_selection_style(name, value, priority));\n };\n function d3_selection_style(name, value, priority) {\n function styleNull() {\n this.style.removeProperty(name);\n }\n function styleConstant() {\n this.style.setProperty(name, value, priority);\n }\n function styleFunction() {\n var x = value.apply(this, arguments);\n if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);\n }\n return value == null ? styleNull : typeof value === \"function\" ? styleFunction : styleConstant;\n }\n d3_selectionPrototype.property = function(name, value) {\n if (arguments.length < 2) {\n if (typeof name === \"string\") return this.node()[name];\n for (value in name) this.each(d3_selection_property(value, name[value]));\n return this;\n }\n return this.each(d3_selection_property(name, value));\n };\n function d3_selection_property(name, value) {\n function propertyNull() {\n delete this[name];\n }\n function propertyConstant() {\n this[name] = value;\n }\n function propertyFunction() {\n var x = value.apply(this, arguments);\n if (x == null) delete this[name]; else this[name] = x;\n }\n return value == null ? propertyNull : typeof value === \"function\" ? propertyFunction : propertyConstant;\n }\n d3_selectionPrototype.text = function(value) {\n return arguments.length ? this.each(typeof value === \"function\" ? function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n } : value == null ? function() {\n this.textContent = \"\";\n } : function() {\n this.textContent = value;\n }) : this.node().textContent;\n };\n d3_selectionPrototype.html = function(value) {\n return arguments.length ? this.each(typeof value === \"function\" ? function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n } : value == null ? function() {\n this.innerHTML = \"\";\n } : function() {\n this.innerHTML = value;\n }) : this.node().innerHTML;\n };\n d3_selectionPrototype.append = function(name) {\n name = d3_selection_creator(name);\n return this.select(function() {\n return this.appendChild(name.apply(this, arguments));\n });\n };\n function d3_selection_creator(name) {\n function create() {\n var document = this.ownerDocument, namespace = this.namespaceURI;\n return namespace === d3_nsXhtml && document.documentElement.namespaceURI === d3_nsXhtml ? document.createElement(name) : document.createElementNS(namespace, name);\n }\n function createNS() {\n return this.ownerDocument.createElementNS(name.space, name.local);\n }\n return typeof name === \"function\" ? name : (name = d3.ns.qualify(name)).local ? createNS : create;\n }\n d3_selectionPrototype.insert = function(name, before) {\n name = d3_selection_creator(name);\n before = d3_selection_selector(before);\n return this.select(function() {\n return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null);\n });\n };\n d3_selectionPrototype.remove = function() {\n return this.each(d3_selectionRemove);\n };\n function d3_selectionRemove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n }\n d3_selectionPrototype.data = function(value, key) {\n var i = -1, n = this.length, group, node;\n if (!arguments.length) {\n value = new Array(n = (group = this[0]).length);\n while (++i < n) {\n if (node = group[i]) {\n value[i] = node.__data__;\n }\n }\n return value;\n }\n function bind(group, groupData) {\n var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;\n if (key) {\n var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue;\n for (i = -1; ++i < n; ) {\n if (node = group[i]) {\n if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) {\n exitNodes[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n keyValues[i] = keyValue;\n }\n }\n for (i = -1; ++i < m; ) {\n if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) {\n enterNodes[i] = d3_selection_dataNode(nodeData);\n } else if (node !== true) {\n updateNodes[i] = node;\n node.__data__ = nodeData;\n }\n nodeByKeyValue.set(keyValue, true);\n }\n for (i = -1; ++i < n; ) {\n if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) {\n exitNodes[i] = group[i];\n }\n }\n } else {\n for (i = -1; ++i < n0; ) {\n node = group[i];\n nodeData = groupData[i];\n if (node) {\n node.__data__ = nodeData;\n updateNodes[i] = node;\n } else {\n enterNodes[i] = d3_selection_dataNode(nodeData);\n }\n }\n for (;i < m; ++i) {\n enterNodes[i] = d3_selection_dataNode(groupData[i]);\n }\n for (;i < n; ++i) {\n exitNodes[i] = group[i];\n }\n }\n enterNodes.update = updateNodes;\n enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;\n enter.push(enterNodes);\n update.push(updateNodes);\n exit.push(exitNodes);\n }\n var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);\n if (typeof value === \"function\") {\n while (++i < n) {\n bind(group = this[i], value.call(group, group.parentNode.__data__, i));\n }\n } else {\n while (++i < n) {\n bind(group = this[i], value);\n }\n }\n update.enter = function() {\n return enter;\n };\n update.exit = function() {\n return exit;\n };\n return update;\n };\n function d3_selection_dataNode(data) {\n return {\n __data__: data\n };\n }\n d3_selectionPrototype.datum = function(value) {\n return arguments.length ? this.property(\"__data__\", value) : this.property(\"__data__\");\n };\n d3_selectionPrototype.filter = function(filter) {\n var subgroups = [], subgroup, group, node;\n if (typeof filter !== \"function\") filter = d3_selection_filter(filter);\n for (var j = 0, m = this.length; j < m; j++) {\n subgroups.push(subgroup = []);\n subgroup.parentNode = (group = this[j]).parentNode;\n for (var i = 0, n = group.length; i < n; i++) {\n if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {\n subgroup.push(node);\n }\n }\n }\n return d3_selection(subgroups);\n };\n function d3_selection_filter(selector) {\n return function() {\n return d3_selectMatches(this, selector);\n };\n }\n d3_selectionPrototype.order = function() {\n for (var j = -1, m = this.length; ++j < m; ) {\n for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {\n if (node = group[i]) {\n if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n return this;\n };\n d3_selectionPrototype.sort = function(comparator) {\n comparator = d3_selection_sortComparator.apply(this, arguments);\n for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);\n return this.order();\n };\n function d3_selection_sortComparator(comparator) {\n if (!arguments.length) comparator = d3_ascending;\n return function(a, b) {\n return a && b ? comparator(a.__data__, b.__data__) : !a - !b;\n };\n }\n d3_selectionPrototype.each = function(callback) {\n return d3_selection_each(this, function(node, i, j) {\n callback.call(node, node.__data__, i, j);\n });\n };\n function d3_selection_each(groups, callback) {\n for (var j = 0, m = groups.length; j < m; j++) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {\n if (node = group[i]) callback(node, i, j);\n }\n }\n return groups;\n }\n d3_selectionPrototype.call = function(callback) {\n var args = d3_array(arguments);\n callback.apply(args[0] = this, args);\n return this;\n };\n d3_selectionPrototype.empty = function() {\n return !this.node();\n };\n d3_selectionPrototype.node = function() {\n for (var j = 0, m = this.length; j < m; j++) {\n for (var group = this[j], i = 0, n = group.length; i < n; i++) {\n var node = group[i];\n if (node) return node;\n }\n }\n return null;\n };\n d3_selectionPrototype.size = function() {\n var n = 0;\n d3_selection_each(this, function() {\n ++n;\n });\n return n;\n };\n function d3_selection_enter(selection) {\n d3_subclass(selection, d3_selection_enterPrototype);\n return selection;\n }\n var d3_selection_enterPrototype = [];\n d3.selection.enter = d3_selection_enter;\n d3.selection.enter.prototype = d3_selection_enterPrototype;\n d3_selection_enterPrototype.append = d3_selectionPrototype.append;\n d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;\n d3_selection_enterPrototype.node = d3_selectionPrototype.node;\n d3_selection_enterPrototype.call = d3_selectionPrototype.call;\n d3_selection_enterPrototype.size = d3_selectionPrototype.size;\n d3_selection_enterPrototype.select = function(selector) {\n var subgroups = [], subgroup, subnode, upgroup, group, node;\n for (var j = -1, m = this.length; ++j < m; ) {\n upgroup = (group = this[j]).update;\n subgroups.push(subgroup = []);\n subgroup.parentNode = group.parentNode;\n for (var i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j));\n subnode.__data__ = node.__data__;\n } else {\n subgroup.push(null);\n }\n }\n }\n return d3_selection(subgroups);\n };\n d3_selection_enterPrototype.insert = function(name, before) {\n if (arguments.length < 2) before = d3_selection_enterInsertBefore(this);\n return d3_selectionPrototype.insert.call(this, name, before);\n };\n function d3_selection_enterInsertBefore(enter) {\n var i0, j0;\n return function(d, i, j) {\n var group = enter[j].update, n = group.length, node;\n if (j != j0) j0 = j, i0 = 0;\n if (i >= i0) i0 = i + 1;\n while (!(node = group[i0]) && ++i0 < n) ;\n return node;\n };\n }\n d3.select = function(node) {\n var group;\n if (typeof node === \"string\") {\n group = [ d3_select(node, d3_document) ];\n group.parentNode = d3_document.documentElement;\n } else {\n group = [ node ];\n group.parentNode = d3_documentElement(node);\n }\n return d3_selection([ group ]);\n };\n d3.selectAll = function(nodes) {\n var group;\n if (typeof nodes === \"string\") {\n group = d3_array(d3_selectAll(nodes, d3_document));\n group.parentNode = d3_document.documentElement;\n } else {\n group = d3_array(nodes);\n group.parentNode = null;\n }\n return d3_selection([ group ]);\n };\n d3_selectionPrototype.on = function(type, listener, capture) {\n var n = arguments.length;\n if (n < 3) {\n if (typeof type !== \"string\") {\n if (n < 2) listener = false;\n for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));\n return this;\n }\n if (n < 2) return (n = this.node()[\"__on\" + type]) && n._;\n capture = false;\n }\n return this.each(d3_selection_on(type, listener, capture));\n };\n function d3_selection_on(type, listener, capture) {\n var name = \"__on\" + type, i = type.indexOf(\".\"), wrap = d3_selection_onListener;\n if (i > 0) type = type.slice(0, i);\n var filter = d3_selection_onFilters.get(type);\n if (filter) type = filter, wrap = d3_selection_onFilter;\n function onRemove() {\n var l = this[name];\n if (l) {\n this.removeEventListener(type, l, l.$);\n delete this[name];\n }\n }\n function onAdd() {\n var l = wrap(listener, d3_array(arguments));\n onRemove.call(this);\n this.addEventListener(type, this[name] = l, l.$ = capture);\n l._ = listener;\n }\n function removeAll() {\n var re = new RegExp(\"^__on([^.]+)\" + d3.requote(type) + \"$\"), match;\n for (var name in this) {\n if (match = name.match(re)) {\n var l = this[name];\n this.removeEventListener(match[1], l, l.$);\n delete this[name];\n }\n }\n }\n return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;\n }\n var d3_selection_onFilters = d3.map({\n mouseenter: \"mouseover\",\n mouseleave: \"mouseout\"\n });\n if (d3_document) {\n d3_selection_onFilters.forEach(function(k) {\n if (\"on\" + k in d3_document) d3_selection_onFilters.remove(k);\n });\n }\n function d3_selection_onListener(listener, argumentz) {\n return function(e) {\n var o = d3.event;\n d3.event = e;\n argumentz[0] = this.__data__;\n try {\n listener.apply(this, argumentz);\n } finally {\n d3.event = o;\n }\n };\n }\n function d3_selection_onFilter(listener, argumentz) {\n var l = d3_selection_onListener(listener, argumentz);\n return function(e) {\n var target = this, related = e.relatedTarget;\n if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {\n l.call(target, e);\n }\n };\n }\n var d3_event_dragSelect, d3_event_dragId = 0;\n function d3_event_dragSuppress(node) {\n 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);\n if (d3_event_dragSelect == null) {\n d3_event_dragSelect = \"onselectstart\" in node ? false : d3_vendorSymbol(node.style, \"userSelect\");\n }\n if (d3_event_dragSelect) {\n var style = d3_documentElement(node).style, select = style[d3_event_dragSelect];\n style[d3_event_dragSelect] = \"none\";\n }\n return function(suppressClick) {\n w.on(name, null);\n if (d3_event_dragSelect) style[d3_event_dragSelect] = select;\n if (suppressClick) {\n var off = function() {\n w.on(click, null);\n };\n w.on(click, function() {\n d3_eventPreventDefault();\n off();\n }, true);\n setTimeout(off, 0);\n }\n };\n }\n d3.mouse = function(container) {\n return d3_mousePoint(container, d3_eventSource());\n };\n var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;\n function d3_mousePoint(container, e) {\n if (e.changedTouches) e = e.changedTouches[0];\n var svg = container.ownerSVGElement || container;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n if (d3_mouse_bug44083 < 0) {\n var window = d3_window(container);\n if (window.scrollX || window.scrollY) {\n svg = d3.select(\"body\").append(\"svg\").style({\n position: \"absolute\",\n top: 0,\n left: 0,\n margin: 0,\n padding: 0,\n border: \"none\"\n }, \"important\");\n var ctm = svg[0][0].getScreenCTM();\n d3_mouse_bug44083 = !(ctm.f || ctm.e);\n svg.remove();\n }\n }\n if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX, \n point.y = e.clientY;\n point = point.matrixTransform(container.getScreenCTM().inverse());\n return [ point.x, point.y ];\n }\n var rect = container.getBoundingClientRect();\n return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];\n }\n d3.touch = function(container, touches, identifier) {\n if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;\n if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {\n if ((touch = touches[i]).identifier === identifier) {\n return d3_mousePoint(container, touch);\n }\n }\n };\n d3.behavior.drag = function() {\n 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\");\n function drag() {\n this.on(\"mousedown.drag\", mousedown).on(\"touchstart.drag\", touchstart);\n }\n function dragstart(id, position, subject, move, end) {\n return function() {\n var that = this, target = d3.event.target.correspondingElement || d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = \".drag\" + (dragId == null ? \"\" : \"-\" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId);\n if (origin) {\n dragOffset = origin.apply(that, arguments);\n dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ];\n } else {\n dragOffset = [ 0, 0 ];\n }\n dispatch({\n type: \"dragstart\"\n });\n function moved() {\n var position1 = position(parent, dragId), dx, dy;\n if (!position1) return;\n dx = position1[0] - position0[0];\n dy = position1[1] - position0[1];\n dragged |= dx | dy;\n position0 = position1;\n dispatch({\n type: \"drag\",\n x: position1[0] + dragOffset[0],\n y: position1[1] + dragOffset[1],\n dx: dx,\n dy: dy\n });\n }\n function ended() {\n if (!position(parent, dragId)) return;\n dragSubject.on(move + dragName, null).on(end + dragName, null);\n dragRestore(dragged);\n dispatch({\n type: \"dragend\"\n });\n }\n };\n }\n drag.origin = function(x) {\n if (!arguments.length) return origin;\n origin = x;\n return drag;\n };\n return d3.rebind(drag, event, \"on\");\n };\n function d3_behavior_dragTouchId() {\n return d3.event.changedTouches[0].identifier;\n }\n d3.touches = function(container, touches) {\n if (arguments.length < 2) touches = d3_eventSource().touches;\n return touches ? d3_array(touches).map(function(touch) {\n var point = d3_mousePoint(container, touch);\n point.identifier = touch.identifier;\n return point;\n }) : [];\n };\n var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;\n function d3_sgn(x) {\n return x > 0 ? 1 : x < 0 ? -1 : 0;\n }\n function d3_cross2d(a, b, c) {\n return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);\n }\n function d3_acos(x) {\n return x > 1 ? 0 : x < -1 ? π : Math.acos(x);\n }\n function d3_asin(x) {\n return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x);\n }\n function d3_sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n }\n function d3_cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n }\n function d3_tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n }\n function d3_haversin(x) {\n return (x = Math.sin(x / 2)) * x;\n }\n var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4;\n d3.interpolateZoom = function(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;\n if (d2 < ε2) {\n S = Math.log(w1 / w0) / ρ;\n i = function(t) {\n return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ];\n };\n } else {\n var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / ρ;\n i = function(t) {\n var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));\n return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ];\n };\n }\n i.duration = S * 1e3;\n return i;\n };\n d3.behavior.zoom = function() {\n var view = {\n x: 0,\n y: 0,\n k: 1\n }, 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\"), x0, x1, y0, y1;\n if (!d3_behavior_zoomWheel) {\n d3_behavior_zoomWheel = \"onwheel\" in d3_document ? (d3_behavior_zoomDelta = function() {\n return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);\n }, \"wheel\") : \"onmousewheel\" in d3_document ? (d3_behavior_zoomDelta = function() {\n return d3.event.wheelDelta;\n }, \"mousewheel\") : (d3_behavior_zoomDelta = function() {\n return -d3.event.detail;\n }, \"MozMousePixelScroll\");\n }\n function zoom(g) {\n g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + \".zoom\", mousewheeled).on(\"dblclick.zoom\", dblclicked).on(touchstart, touchstarted);\n }\n zoom.event = function(g) {\n g.each(function() {\n var dispatch = event.of(this, arguments), view1 = view;\n if (d3_transitionInheritId) {\n d3.select(this).transition().each(\"start.zoom\", function() {\n view = this.__chart__ || {\n x: 0,\n y: 0,\n k: 1\n };\n zoomstarted(dispatch);\n }).tween(\"zoom:zoom\", function() {\n 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 ]);\n return function(t) {\n var l = i(t), k = dx / l[2];\n this.__chart__ = view = {\n x: cx - l[0] * k,\n y: cy - l[1] * k,\n k: k\n };\n zoomed(dispatch);\n };\n }).each(\"interrupt.zoom\", function() {\n zoomended(dispatch);\n }).each(\"end.zoom\", function() {\n zoomended(dispatch);\n });\n } else {\n this.__chart__ = view;\n zoomstarted(dispatch);\n zoomed(dispatch);\n zoomended(dispatch);\n }\n });\n };\n zoom.translate = function(_) {\n if (!arguments.length) return [ view.x, view.y ];\n view = {\n x: +_[0],\n y: +_[1],\n k: view.k\n };\n rescale();\n return zoom;\n };\n zoom.scale = function(_) {\n if (!arguments.length) return view.k;\n view = {\n x: view.x,\n y: view.y,\n k: null\n };\n scaleTo(+_);\n rescale();\n return zoom;\n };\n zoom.scaleExtent = function(_) {\n if (!arguments.length) return scaleExtent;\n scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ];\n return zoom;\n };\n zoom.center = function(_) {\n if (!arguments.length) return center;\n center = _ && [ +_[0], +_[1] ];\n return zoom;\n };\n zoom.size = function(_) {\n if (!arguments.length) return size;\n size = _ && [ +_[0], +_[1] ];\n return zoom;\n };\n zoom.duration = function(_) {\n if (!arguments.length) return duration;\n duration = +_;\n return zoom;\n };\n zoom.x = function(z) {\n if (!arguments.length) return x1;\n x1 = z;\n x0 = z.copy();\n view = {\n x: 0,\n y: 0,\n k: 1\n };\n return zoom;\n };\n zoom.y = function(z) {\n if (!arguments.length) return y1;\n y1 = z;\n y0 = z.copy();\n view = {\n x: 0,\n y: 0,\n k: 1\n };\n return zoom;\n };\n function location(p) {\n return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ];\n }\n function point(l) {\n return [ l[0] * view.k + view.x, l[1] * view.k + view.y ];\n }\n function scaleTo(s) {\n view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));\n }\n function translateTo(p, l) {\n l = point(l);\n view.x += p[0] - l[0];\n view.y += p[1] - l[1];\n }\n function zoomTo(that, p, l, k) {\n that.__chart__ = {\n x: view.x,\n y: view.y,\n k: view.k\n };\n scaleTo(Math.pow(2, k));\n translateTo(center0 = p, l);\n that = d3.select(that);\n if (duration > 0) that = that.transition().duration(duration);\n that.call(zoom.event);\n }\n function rescale() {\n if (x1) x1.domain(x0.range().map(function(x) {\n return (x - view.x) / view.k;\n }).map(x0.invert));\n if (y1) y1.domain(y0.range().map(function(y) {\n return (y - view.y) / view.k;\n }).map(y0.invert));\n }\n function zoomstarted(dispatch) {\n if (!zooming++) dispatch({\n type: \"zoomstart\"\n });\n }\n function zoomed(dispatch) {\n rescale();\n dispatch({\n type: \"zoom\",\n scale: view.k,\n translate: [ view.x, view.y ]\n });\n }\n function zoomended(dispatch) {\n if (!--zooming) dispatch({\n type: \"zoomend\"\n }), center0 = null;\n }\n function mousedowned() {\n 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);\n d3_selection_interrupt.call(that);\n zoomstarted(dispatch);\n function moved() {\n dragged = 1;\n translateTo(d3.mouse(that), location0);\n zoomed(dispatch);\n }\n function ended() {\n subject.on(mousemove, null).on(mouseup, null);\n dragRestore(dragged);\n zoomended(dispatch);\n }\n }\n function touchstarted() {\n 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);\n started();\n zoomstarted(dispatch);\n subject.on(mousedown, null).on(touchstart, started);\n function relocate() {\n var touches = d3.touches(that);\n scale0 = view.k;\n touches.forEach(function(t) {\n if (t.identifier in locations0) locations0[t.identifier] = location(t);\n });\n return touches;\n }\n function started() {\n var target = d3.event.target;\n d3.select(target).on(touchmove, moved).on(touchend, ended);\n targets.push(target);\n var changed = d3.event.changedTouches;\n for (var i = 0, n = changed.length; i < n; ++i) {\n locations0[changed[i].identifier] = null;\n }\n var touches = relocate(), now = Date.now();\n if (touches.length === 1) {\n if (now - touchtime < 500) {\n var p = touches[0];\n zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1);\n d3_eventPreventDefault();\n }\n touchtime = now;\n } else if (touches.length > 1) {\n var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1];\n distance0 = dx * dx + dy * dy;\n }\n }\n function moved() {\n var touches = d3.touches(that), p0, l0, p1, l1;\n d3_selection_interrupt.call(that);\n for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {\n p1 = touches[i];\n if (l1 = locations0[p1.identifier]) {\n if (l0) break;\n p0 = p1, l0 = l1;\n }\n }\n if (l1) {\n var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0);\n p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];\n l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];\n scaleTo(scale1 * scale0);\n }\n touchtime = null;\n translateTo(p0, l0);\n zoomed(dispatch);\n }\n function ended() {\n if (d3.event.touches.length) {\n var changed = d3.event.changedTouches;\n for (var i = 0, n = changed.length; i < n; ++i) {\n delete locations0[changed[i].identifier];\n }\n for (var identifier in locations0) {\n return void relocate();\n }\n }\n d3.selectAll(targets).on(zoomName, null);\n subject.on(mousedown, mousedowned).on(touchstart, touchstarted);\n dragRestore();\n zoomended(dispatch);\n }\n }\n function mousewheeled() {\n var dispatch = event.of(this, arguments);\n if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), \n translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch);\n mousewheelTimer = setTimeout(function() {\n mousewheelTimer = null;\n zoomended(dispatch);\n }, 50);\n d3_eventPreventDefault();\n scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k);\n translateTo(center0, translate0);\n zoomed(dispatch);\n }\n function dblclicked() {\n var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2;\n zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);\n }\n return d3.rebind(zoom, event, \"on\");\n };\n var d3_behavior_zoomInfinity = [ 0, Infinity ], d3_behavior_zoomDelta, d3_behavior_zoomWheel;\n d3.color = d3_color;\n function d3_color() {}\n d3_color.prototype.toString = function() {\n return this.rgb() + \"\";\n };\n d3.hsl = d3_hsl;\n function d3_hsl(h, s, l) {\n 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);\n }\n var d3_hslPrototype = d3_hsl.prototype = new d3_color();\n d3_hslPrototype.brighter = function(k) {\n k = Math.pow(.7, arguments.length ? k : 1);\n return new d3_hsl(this.h, this.s, this.l / k);\n };\n d3_hslPrototype.darker = function(k) {\n k = Math.pow(.7, arguments.length ? k : 1);\n return new d3_hsl(this.h, this.s, k * this.l);\n };\n d3_hslPrototype.rgb = function() {\n return d3_hsl_rgb(this.h, this.s, this.l);\n };\n function d3_hsl_rgb(h, s, l) {\n var m1, m2;\n h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;\n s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;\n l = l < 0 ? 0 : l > 1 ? 1 : l;\n m2 = l <= .5 ? l * (1 + s) : l + s - l * s;\n m1 = 2 * l - m2;\n function v(h) {\n if (h > 360) h -= 360; else if (h < 0) h += 360;\n if (h < 60) return m1 + (m2 - m1) * h / 60;\n if (h < 180) return m2;\n if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;\n return m1;\n }\n function vv(h) {\n return Math.round(v(h) * 255);\n }\n return new d3_rgb(vv(h + 120), vv(h), vv(h - 120));\n }\n d3.hcl = d3_hcl;\n function d3_hcl(h, c, l) {\n 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);\n }\n var d3_hclPrototype = d3_hcl.prototype = new d3_color();\n d3_hclPrototype.brighter = function(k) {\n return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));\n };\n d3_hclPrototype.darker = function(k) {\n return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));\n };\n d3_hclPrototype.rgb = function() {\n return d3_hcl_lab(this.h, this.c, this.l).rgb();\n };\n function d3_hcl_lab(h, c, l) {\n if (isNaN(h)) h = 0;\n if (isNaN(c)) c = 0;\n return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);\n }\n d3.lab = d3_lab;\n function d3_lab(l, a, b) {\n 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);\n }\n var d3_lab_K = 18;\n var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;\n var d3_labPrototype = d3_lab.prototype = new d3_color();\n d3_labPrototype.brighter = function(k) {\n return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);\n };\n d3_labPrototype.darker = function(k) {\n return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);\n };\n d3_labPrototype.rgb = function() {\n return d3_lab_rgb(this.l, this.a, this.b);\n };\n function d3_lab_rgb(l, a, b) {\n var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;\n x = d3_lab_xyz(x) * d3_lab_X;\n y = d3_lab_xyz(y) * d3_lab_Y;\n z = d3_lab_xyz(z) * d3_lab_Z;\n return new d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));\n }\n function d3_lab_hcl(l, a, b) {\n 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);\n }\n function d3_lab_xyz(x) {\n return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;\n }\n function d3_xyz_lab(x) {\n return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;\n }\n function d3_xyz_rgb(r) {\n return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));\n }\n d3.rgb = d3_rgb;\n function d3_rgb(r, g, b) {\n 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);\n }\n function d3_rgbNumber(value) {\n return new d3_rgb(value >> 16, value >> 8 & 255, value & 255);\n }\n function d3_rgbString(value) {\n return d3_rgbNumber(value) + \"\";\n }\n var d3_rgbPrototype = d3_rgb.prototype = new d3_color();\n d3_rgbPrototype.brighter = function(k) {\n k = Math.pow(.7, arguments.length ? k : 1);\n var r = this.r, g = this.g, b = this.b, i = 30;\n if (!r && !g && !b) return new d3_rgb(i, i, i);\n if (r && r < i) r = i;\n if (g && g < i) g = i;\n if (b && b < i) b = i;\n return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k));\n };\n d3_rgbPrototype.darker = function(k) {\n k = Math.pow(.7, arguments.length ? k : 1);\n return new d3_rgb(k * this.r, k * this.g, k * this.b);\n };\n d3_rgbPrototype.hsl = function() {\n return d3_rgb_hsl(this.r, this.g, this.b);\n };\n d3_rgbPrototype.toString = function() {\n return \"#\" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);\n };\n function d3_rgb_hex(v) {\n return v < 16 ? \"0\" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);\n }\n function d3_rgb_parse(format, rgb, hsl) {\n var r = 0, g = 0, b = 0, m1, m2, color;\n m1 = /([a-z]+)\\((.*)\\)/.exec(format = format.toLowerCase());\n if (m1) {\n m2 = m1[2].split(\",\");\n switch (m1[1]) {\n case \"hsl\":\n {\n return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);\n }\n\n case \"rgb\":\n {\n return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));\n }\n }\n }\n if (color = d3_rgb_names.get(format)) {\n return rgb(color.r, color.g, color.b);\n }\n if (format != null && format.charAt(0) === \"#\" && !isNaN(color = parseInt(format.slice(1), 16))) {\n if (format.length === 4) {\n r = (color & 3840) >> 4;\n r = r >> 4 | r;\n g = color & 240;\n g = g >> 4 | g;\n b = color & 15;\n b = b << 4 | b;\n } else if (format.length === 7) {\n r = (color & 16711680) >> 16;\n g = (color & 65280) >> 8;\n b = color & 255;\n }\n }\n return rgb(r, g, b);\n }\n function d3_rgb_hsl(r, g, b) {\n 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;\n if (d) {\n s = l < .5 ? d / (max + min) : d / (2 - max - min);\n 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;\n h *= 60;\n } else {\n h = NaN;\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new d3_hsl(h, s, l);\n }\n function d3_rgb_lab(r, g, b) {\n r = d3_rgb_xyz(r);\n g = d3_rgb_xyz(g);\n b = d3_rgb_xyz(b);\n var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);\n return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));\n }\n function d3_rgb_xyz(r) {\n return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);\n }\n function d3_rgb_parseNumber(c) {\n var f = parseFloat(c);\n return c.charAt(c.length - 1) === \"%\" ? Math.round(f * 2.55) : f;\n }\n var d3_rgb_names = d3.map({\n aliceblue: 15792383,\n antiquewhite: 16444375,\n aqua: 65535,\n aquamarine: 8388564,\n azure: 15794175,\n beige: 16119260,\n bisque: 16770244,\n black: 0,\n blanchedalmond: 16772045,\n blue: 255,\n blueviolet: 9055202,\n brown: 10824234,\n burlywood: 14596231,\n cadetblue: 6266528,\n chartreuse: 8388352,\n chocolate: 13789470,\n coral: 16744272,\n cornflowerblue: 6591981,\n cornsilk: 16775388,\n crimson: 14423100,\n cyan: 65535,\n darkblue: 139,\n darkcyan: 35723,\n darkgoldenrod: 12092939,\n darkgray: 11119017,\n darkgreen: 25600,\n darkgrey: 11119017,\n darkkhaki: 12433259,\n darkmagenta: 9109643,\n darkolivegreen: 5597999,\n darkorange: 16747520,\n darkorchid: 10040012,\n darkred: 9109504,\n darksalmon: 15308410,\n darkseagreen: 9419919,\n darkslateblue: 4734347,\n darkslategray: 3100495,\n darkslategrey: 3100495,\n darkturquoise: 52945,\n darkviolet: 9699539,\n deeppink: 16716947,\n deepskyblue: 49151,\n dimgray: 6908265,\n dimgrey: 6908265,\n dodgerblue: 2003199,\n firebrick: 11674146,\n floralwhite: 16775920,\n forestgreen: 2263842,\n fuchsia: 16711935,\n gainsboro: 14474460,\n ghostwhite: 16316671,\n gold: 16766720,\n goldenrod: 14329120,\n gray: 8421504,\n green: 32768,\n greenyellow: 11403055,\n grey: 8421504,\n honeydew: 15794160,\n hotpink: 16738740,\n indianred: 13458524,\n indigo: 4915330,\n ivory: 16777200,\n khaki: 15787660,\n lavender: 15132410,\n lavenderblush: 16773365,\n lawngreen: 8190976,\n lemonchiffon: 16775885,\n lightblue: 11393254,\n lightcoral: 15761536,\n lightcyan: 14745599,\n lightgoldenrodyellow: 16448210,\n lightgray: 13882323,\n lightgreen: 9498256,\n lightgrey: 13882323,\n lightpink: 16758465,\n lightsalmon: 16752762,\n lightseagreen: 2142890,\n lightskyblue: 8900346,\n lightslategray: 7833753,\n lightslategrey: 7833753,\n lightsteelblue: 11584734,\n lightyellow: 16777184,\n lime: 65280,\n limegreen: 3329330,\n linen: 16445670,\n magenta: 16711935,\n maroon: 8388608,\n mediumaquamarine: 6737322,\n mediumblue: 205,\n mediumorchid: 12211667,\n mediumpurple: 9662683,\n mediumseagreen: 3978097,\n mediumslateblue: 8087790,\n mediumspringgreen: 64154,\n mediumturquoise: 4772300,\n mediumvioletred: 13047173,\n midnightblue: 1644912,\n mintcream: 16121850,\n mistyrose: 16770273,\n moccasin: 16770229,\n navajowhite: 16768685,\n navy: 128,\n oldlace: 16643558,\n olive: 8421376,\n olivedrab: 7048739,\n orange: 16753920,\n orangered: 16729344,\n orchid: 14315734,\n palegoldenrod: 15657130,\n palegreen: 10025880,\n paleturquoise: 11529966,\n palevioletred: 14381203,\n papayawhip: 16773077,\n peachpuff: 16767673,\n peru: 13468991,\n pink: 16761035,\n plum: 14524637,\n powderblue: 11591910,\n purple: 8388736,\n rebeccapurple: 6697881,\n red: 16711680,\n rosybrown: 12357519,\n royalblue: 4286945,\n saddlebrown: 9127187,\n salmon: 16416882,\n sandybrown: 16032864,\n seagreen: 3050327,\n seashell: 16774638,\n sienna: 10506797,\n silver: 12632256,\n skyblue: 8900331,\n slateblue: 6970061,\n slategray: 7372944,\n slategrey: 7372944,\n snow: 16775930,\n springgreen: 65407,\n steelblue: 4620980,\n tan: 13808780,\n teal: 32896,\n thistle: 14204888,\n tomato: 16737095,\n turquoise: 4251856,\n violet: 15631086,\n wheat: 16113331,\n white: 16777215,\n whitesmoke: 16119285,\n yellow: 16776960,\n yellowgreen: 10145074\n });\n d3_rgb_names.forEach(function(key, value) {\n d3_rgb_names.set(key, d3_rgbNumber(value));\n });\n function d3_functor(v) {\n return typeof v === \"function\" ? v : function() {\n return v;\n };\n }\n d3.functor = d3_functor;\n d3.xhr = d3_xhrType(d3_identity);\n function d3_xhrType(response) {\n return function(url, mimeType, callback) {\n if (arguments.length === 2 && typeof mimeType === \"function\") callback = mimeType, \n mimeType = null;\n return d3_xhr(url, mimeType, response, callback);\n };\n }\n function d3_xhr(url, mimeType, response, callback) {\n var xhr = {}, dispatch = d3.dispatch(\"beforesend\", \"progress\", \"load\", \"error\"), headers = {}, request = new XMLHttpRequest(), responseType = null;\n if (this.XDomainRequest && !(\"withCredentials\" in request) && /^(http(s)?:)?\\/\\//.test(url)) request = new XDomainRequest();\n \"onload\" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {\n request.readyState > 3 && respond();\n };\n function respond() {\n var status = request.status, result;\n if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {\n try {\n result = response.call(xhr, request);\n } catch (e) {\n dispatch.error.call(xhr, e);\n return;\n }\n dispatch.load.call(xhr, result);\n } else {\n dispatch.error.call(xhr, request);\n }\n }\n request.onprogress = function(event) {\n var o = d3.event;\n d3.event = event;\n try {\n dispatch.progress.call(xhr, request);\n } finally {\n d3.event = o;\n }\n };\n xhr.header = function(name, value) {\n name = (name + \"\").toLowerCase();\n if (arguments.length < 2) return headers[name];\n if (value == null) delete headers[name]; else headers[name] = value + \"\";\n return xhr;\n };\n xhr.mimeType = function(value) {\n if (!arguments.length) return mimeType;\n mimeType = value == null ? null : value + \"\";\n return xhr;\n };\n xhr.responseType = function(value) {\n if (!arguments.length) return responseType;\n responseType = value;\n return xhr;\n };\n xhr.response = function(value) {\n response = value;\n return xhr;\n };\n [ \"get\", \"post\" ].forEach(function(method) {\n xhr[method] = function() {\n return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));\n };\n });\n xhr.send = function(method, data, callback) {\n if (arguments.length === 2 && typeof data === \"function\") callback = data, data = null;\n request.open(method, url, true);\n if (mimeType != null && !(\"accept\" in headers)) headers[\"accept\"] = mimeType + \",*/*\";\n if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);\n if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);\n if (responseType != null) request.responseType = responseType;\n if (callback != null) xhr.on(\"error\", callback).on(\"load\", function(request) {\n callback(null, request);\n });\n dispatch.beforesend.call(xhr, request);\n request.send(data == null ? null : data);\n return xhr;\n };\n xhr.abort = function() {\n request.abort();\n return xhr;\n };\n d3.rebind(xhr, dispatch, \"on\");\n return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));\n }\n function d3_xhr_fixCallback(callback) {\n return callback.length === 1 ? function(error, request) {\n callback(error == null ? request : null);\n } : callback;\n }\n function d3_xhrHasResponse(request) {\n var type = request.responseType;\n return type && type !== \"text\" ? request.response : request.responseText;\n }\n d3.dsv = function(delimiter, mimeType) {\n var reFormat = new RegExp('[\"' + delimiter + \"\\n]\"), delimiterCode = delimiter.charCodeAt(0);\n function dsv(url, row, callback) {\n if (arguments.length < 3) callback = row, row = null;\n var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);\n xhr.row = function(_) {\n return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;\n };\n return xhr;\n }\n function response(request) {\n return dsv.parse(request.responseText);\n }\n function typedResponse(f) {\n return function(request) {\n return dsv.parse(request.responseText, f);\n };\n }\n dsv.parse = function(text, f) {\n var o;\n return dsv.parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = new Function(\"d\", \"return {\" + row.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n o = f ? function(row, i) {\n return f(a(row), i);\n } : a;\n });\n };\n dsv.parseRows = function(text, f) {\n var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;\n function token() {\n if (I >= N) return EOF;\n if (eol) return eol = false, EOL;\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, '\"');\n }\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true; else if (c === 13) {\n eol = true;\n if (text.charCodeAt(I) === 10) ++I, ++k;\n } else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n return text.slice(j);\n }\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n return rows;\n };\n dsv.format = function(rows) {\n if (Array.isArray(rows[0])) return dsv.formatRows(rows);\n var fieldSet = new d3_Set(), fields = [];\n rows.forEach(function(row) {\n for (var field in row) {\n if (!fieldSet.has(field)) {\n fields.push(fieldSet.add(field));\n }\n }\n });\n return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n };\n dsv.formatRows = function(rows) {\n return rows.map(formatRow).join(\"\\n\");\n };\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n function formatValue(text) {\n return reFormat.test(text) ? '\"' + text.replace(/\\\"/g, '\"\"') + '\"' : text;\n }\n return dsv;\n };\n d3.csv = d3.dsv(\",\", \"text/csv\");\n d3.tsv = d3.dsv(\"\t\", \"text/tab-separated-values\");\n var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, \"requestAnimationFrame\")] || function(callback) {\n setTimeout(callback, 17);\n };\n d3.timer = function() {\n d3_timer.apply(this, arguments);\n };\n function d3_timer(callback, delay, then) {\n var n = arguments.length;\n if (n < 2) delay = 0;\n if (n < 3) then = Date.now();\n var time = then + delay, timer = {\n c: callback,\n t: time,\n n: null\n };\n if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;\n d3_timer_queueTail = timer;\n if (!d3_timer_interval) {\n d3_timer_timeout = clearTimeout(d3_timer_timeout);\n d3_timer_interval = 1;\n d3_timer_frame(d3_timer_step);\n }\n return timer;\n }\n function d3_timer_step() {\n var now = d3_timer_mark(), delay = d3_timer_sweep() - now;\n if (delay > 24) {\n if (isFinite(delay)) {\n clearTimeout(d3_timer_timeout);\n d3_timer_timeout = setTimeout(d3_timer_step, delay);\n }\n d3_timer_interval = 0;\n } else {\n d3_timer_interval = 1;\n d3_timer_frame(d3_timer_step);\n }\n }\n d3.timer.flush = function() {\n d3_timer_mark();\n d3_timer_sweep();\n };\n function d3_timer_mark() {\n var now = Date.now(), timer = d3_timer_queueHead;\n while (timer) {\n if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;\n timer = timer.n;\n }\n return now;\n }\n function d3_timer_sweep() {\n var t0, t1 = d3_timer_queueHead, time = Infinity;\n while (t1) {\n if (t1.c) {\n if (t1.t < time) time = t1.t;\n t1 = (t0 = t1).n;\n } else {\n t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;\n }\n }\n d3_timer_queueTail = t0;\n return time;\n }\n function d3_format_precision(x, p) {\n return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);\n }\n d3.round = function(x, n) {\n return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);\n };\n var d3_formatPrefixes = [ \"y\", \"z\", \"a\", \"f\", \"p\", \"n\", \"µ\", \"m\", \"\", \"k\", \"M\", \"G\", \"T\", \"P\", \"E\", \"Z\", \"Y\" ].map(d3_formatPrefix);\n d3.formatPrefix = function(value, precision) {\n var i = 0;\n if (value = +value) {\n if (value < 0) value *= -1;\n if (precision) value = d3.round(value, d3_format_precision(value, precision));\n i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);\n i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));\n }\n return d3_formatPrefixes[8 + i / 3];\n };\n function d3_formatPrefix(d, i) {\n var k = Math.pow(10, abs(8 - i) * 3);\n return {\n scale: i > 8 ? function(d) {\n return d / k;\n } : function(d) {\n return d * k;\n },\n symbol: d\n };\n }\n function d3_locale_numberFormat(locale) {\n var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) {\n var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0;\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = locale_grouping[j = (j + 1) % locale_grouping.length];\n }\n return t.reverse().join(locale_thousands);\n } : d3_identity;\n return function(specifier) {\n var match = d3_format_re.exec(specifier), fill = match[1] || \" \", align = match[2] || \">\", sign = match[3] || \"-\", symbol = match[4] || \"\", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = \"\", suffix = \"\", integer = false, exponent = true;\n if (precision) precision = +precision.substring(1);\n if (zfill || fill === \"0\" && align === \"=\") {\n zfill = fill = \"0\";\n align = \"=\";\n }\n switch (type) {\n case \"n\":\n comma = true;\n type = \"g\";\n break;\n\n case \"%\":\n scale = 100;\n suffix = \"%\";\n type = \"f\";\n break;\n\n case \"p\":\n scale = 100;\n suffix = \"%\";\n type = \"r\";\n break;\n\n case \"b\":\n case \"o\":\n case \"x\":\n case \"X\":\n if (symbol === \"#\") prefix = \"0\" + type.toLowerCase();\n\n case \"c\":\n exponent = false;\n\n case \"d\":\n integer = true;\n precision = 0;\n break;\n\n case \"s\":\n scale = -1;\n type = \"r\";\n break;\n }\n if (symbol === \"$\") prefix = locale_currency[0], suffix = locale_currency[1];\n if (type == \"r\" && !precision) type = \"g\";\n if (precision != null) {\n if (type == \"g\") precision = Math.max(1, Math.min(21, precision)); else if (type == \"e\" || type == \"f\") precision = Math.max(0, Math.min(20, precision));\n }\n type = d3_format_types.get(type) || d3_format_typeDefault;\n var zcomma = zfill && comma;\n return function(value) {\n var fullSuffix = suffix;\n if (integer && value % 1) return \"\";\n var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, \"-\") : sign === \"-\" ? \"\" : sign;\n if (scale < 0) {\n var unit = d3.formatPrefix(value, precision);\n value = unit.scale(value);\n fullSuffix = unit.symbol + suffix;\n } else {\n value *= scale;\n }\n value = type(value, precision);\n var i = value.lastIndexOf(\".\"), before, after;\n if (i < 0) {\n var j = exponent ? value.lastIndexOf(\"e\") : -1;\n if (j < 0) before = value, after = \"\"; else before = value.substring(0, j), after = value.substring(j);\n } else {\n before = value.substring(0, i);\n after = locale_decimal + value.substring(i + 1);\n }\n if (!zfill && comma) before = formatGroup(before, Infinity);\n var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : \"\";\n if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity);\n negative += prefix;\n value = before + after;\n return (align === \"<\" ? negative + value + padding : align === \">\" ? padding + negative + value : align === \"^\" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix;\n };\n };\n }\n var d3_format_re = /(?:([^{])?([<>=^]))?([+\\- ])?([$#])?(0)?(\\d+)?(,)?(\\.-?\\d+)?([a-z%])?/i;\n var d3_format_types = d3.map({\n b: function(x) {\n return x.toString(2);\n },\n c: function(x) {\n return String.fromCharCode(x);\n },\n o: function(x) {\n return x.toString(8);\n },\n x: function(x) {\n return x.toString(16);\n },\n X: function(x) {\n return x.toString(16).toUpperCase();\n },\n g: function(x, p) {\n return x.toPrecision(p);\n },\n e: function(x, p) {\n return x.toExponential(p);\n },\n f: function(x, p) {\n return x.toFixed(p);\n },\n r: function(x, p) {\n return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));\n }\n });\n function d3_format_typeDefault(x) {\n return x + \"\";\n }\n var d3_time = d3.time = {}, d3_date = Date;\n function d3_date_utc() {\n this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);\n }\n d3_date_utc.prototype = {\n getDate: function() {\n return this._.getUTCDate();\n },\n getDay: function() {\n return this._.getUTCDay();\n },\n getFullYear: function() {\n return this._.getUTCFullYear();\n },\n getHours: function() {\n return this._.getUTCHours();\n },\n getMilliseconds: function() {\n return this._.getUTCMilliseconds();\n },\n getMinutes: function() {\n return this._.getUTCMinutes();\n },\n getMonth: function() {\n return this._.getUTCMonth();\n },\n getSeconds: function() {\n return this._.getUTCSeconds();\n },\n getTime: function() {\n return this._.getTime();\n },\n getTimezoneOffset: function() {\n return 0;\n },\n valueOf: function() {\n return this._.valueOf();\n },\n setDate: function() {\n d3_time_prototype.setUTCDate.apply(this._, arguments);\n },\n setDay: function() {\n d3_time_prototype.setUTCDay.apply(this._, arguments);\n },\n setFullYear: function() {\n d3_time_prototype.setUTCFullYear.apply(this._, arguments);\n },\n setHours: function() {\n d3_time_prototype.setUTCHours.apply(this._, arguments);\n },\n setMilliseconds: function() {\n d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);\n },\n setMinutes: function() {\n d3_time_prototype.setUTCMinutes.apply(this._, arguments);\n },\n setMonth: function() {\n d3_time_prototype.setUTCMonth.apply(this._, arguments);\n },\n setSeconds: function() {\n d3_time_prototype.setUTCSeconds.apply(this._, arguments);\n },\n setTime: function() {\n d3_time_prototype.setTime.apply(this._, arguments);\n }\n };\n var d3_time_prototype = Date.prototype;\n function d3_time_interval(local, step, number) {\n function round(date) {\n var d0 = local(date), d1 = offset(d0, 1);\n return date - d0 < d1 - date ? d0 : d1;\n }\n function ceil(date) {\n step(date = local(new d3_date(date - 1)), 1);\n return date;\n }\n function offset(date, k) {\n step(date = new d3_date(+date), k);\n return date;\n }\n function range(t0, t1, dt) {\n var time = ceil(t0), times = [];\n if (dt > 1) {\n while (time < t1) {\n if (!(number(time) % dt)) times.push(new Date(+time));\n step(time, 1);\n }\n } else {\n while (time < t1) times.push(new Date(+time)), step(time, 1);\n }\n return times;\n }\n function range_utc(t0, t1, dt) {\n try {\n d3_date = d3_date_utc;\n var utc = new d3_date_utc();\n utc._ = t0;\n return range(utc, t1, dt);\n } finally {\n d3_date = Date;\n }\n }\n local.floor = local;\n local.round = round;\n local.ceil = ceil;\n local.offset = offset;\n local.range = range;\n var utc = local.utc = d3_time_interval_utc(local);\n utc.floor = utc;\n utc.round = d3_time_interval_utc(round);\n utc.ceil = d3_time_interval_utc(ceil);\n utc.offset = d3_time_interval_utc(offset);\n utc.range = range_utc;\n return local;\n }\n function d3_time_interval_utc(method) {\n return function(date, k) {\n try {\n d3_date = d3_date_utc;\n var utc = new d3_date_utc();\n utc._ = date;\n return method(utc, k)._;\n } finally {\n d3_date = Date;\n }\n };\n }\n d3_time.year = d3_time_interval(function(date) {\n date = d3_time.day(date);\n date.setMonth(0, 1);\n return date;\n }, function(date, offset) {\n date.setFullYear(date.getFullYear() + offset);\n }, function(date) {\n return date.getFullYear();\n });\n d3_time.years = d3_time.year.range;\n d3_time.years.utc = d3_time.year.utc.range;\n d3_time.day = d3_time_interval(function(date) {\n var day = new d3_date(2e3, 0);\n day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n return day;\n }, function(date, offset) {\n date.setDate(date.getDate() + offset);\n }, function(date) {\n return date.getDate() - 1;\n });\n d3_time.days = d3_time.day.range;\n d3_time.days.utc = d3_time.day.utc.range;\n d3_time.dayOfYear = function(date) {\n var year = d3_time.year(date);\n return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);\n };\n [ \"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\" ].forEach(function(day, i) {\n i = 7 - i;\n var interval = d3_time[day] = d3_time_interval(function(date) {\n (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);\n return date;\n }, function(date, offset) {\n date.setDate(date.getDate() + Math.floor(offset) * 7);\n }, function(date) {\n var day = d3_time.year(date).getDay();\n return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);\n });\n d3_time[day + \"s\"] = interval.range;\n d3_time[day + \"s\"].utc = interval.utc.range;\n d3_time[day + \"OfYear\"] = function(date) {\n var day = d3_time.year(date).getDay();\n return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7);\n };\n });\n d3_time.week = d3_time.sunday;\n d3_time.weeks = d3_time.sunday.range;\n d3_time.weeks.utc = d3_time.sunday.utc.range;\n d3_time.weekOfYear = d3_time.sundayOfYear;\n function d3_locale_timeFormat(locale) {\n var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths;\n function d3_time_format(template) {\n var n = template.length;\n function format(date) {\n var string = [], i = -1, j = 0, c, p, f;\n while (++i < n) {\n if (template.charCodeAt(i) === 37) {\n string.push(template.slice(j, i));\n if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);\n if (f = d3_time_formats[c]) c = f(date, p == null ? c === \"e\" ? \" \" : \"0\" : p);\n string.push(c);\n j = i + 1;\n }\n }\n string.push(template.slice(j, i));\n return string.join(\"\");\n }\n format.parse = function(string) {\n var d = {\n y: 1900,\n m: 0,\n d: 1,\n H: 0,\n M: 0,\n S: 0,\n L: 0,\n Z: null\n }, i = d3_time_parse(d, template, string, 0);\n if (i != string.length) return null;\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)();\n if (\"j\" in d) date.setFullYear(d.y, 0, d.j); else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"W\" in d ? 1 : 0;\n date.setFullYear(d.y, 0, 1);\n date.setFullYear(d.y, 0, \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7);\n } else date.setFullYear(d.y, d.m, d.d);\n date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L);\n return localZ ? date._ : date;\n };\n format.toString = function() {\n return template;\n };\n return format;\n }\n function d3_time_parse(date, template, string, j) {\n var c, p, t, i = 0, n = template.length, m = string.length;\n while (i < n) {\n if (j >= m) return -1;\n c = template.charCodeAt(i++);\n if (c === 37) {\n t = template.charAt(i++);\n p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t];\n if (!p || (j = p(date, string, j)) < 0) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n return j;\n }\n d3_time_format.utc = function(template) {\n var local = d3_time_format(template);\n function format(date) {\n try {\n d3_date = d3_date_utc;\n var utc = new d3_date();\n utc._ = date;\n return local(utc);\n } finally {\n d3_date = Date;\n }\n }\n format.parse = function(string) {\n try {\n d3_date = d3_date_utc;\n var date = local.parse(string);\n return date && date._;\n } finally {\n d3_date = Date;\n }\n };\n format.toString = local.toString;\n return format;\n };\n d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti;\n var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths);\n locale_periods.forEach(function(p, i) {\n d3_time_periodLookup.set(p.toLowerCase(), i);\n });\n var d3_time_formats = {\n a: function(d) {\n return locale_shortDays[d.getDay()];\n },\n A: function(d) {\n return locale_days[d.getDay()];\n },\n b: function(d) {\n return locale_shortMonths[d.getMonth()];\n },\n B: function(d) {\n return locale_months[d.getMonth()];\n },\n c: d3_time_format(locale_dateTime),\n d: function(d, p) {\n return d3_time_formatPad(d.getDate(), p, 2);\n },\n e: function(d, p) {\n return d3_time_formatPad(d.getDate(), p, 2);\n },\n H: function(d, p) {\n return d3_time_formatPad(d.getHours(), p, 2);\n },\n I: function(d, p) {\n return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);\n },\n j: function(d, p) {\n return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3);\n },\n L: function(d, p) {\n return d3_time_formatPad(d.getMilliseconds(), p, 3);\n },\n m: function(d, p) {\n return d3_time_formatPad(d.getMonth() + 1, p, 2);\n },\n M: function(d, p) {\n return d3_time_formatPad(d.getMinutes(), p, 2);\n },\n p: function(d) {\n return locale_periods[+(d.getHours() >= 12)];\n },\n S: function(d, p) {\n return d3_time_formatPad(d.getSeconds(), p, 2);\n },\n U: function(d, p) {\n return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2);\n },\n w: function(d) {\n return d.getDay();\n },\n W: function(d, p) {\n return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2);\n },\n x: d3_time_format(locale_date),\n X: d3_time_format(locale_time),\n y: function(d, p) {\n return d3_time_formatPad(d.getFullYear() % 100, p, 2);\n },\n Y: function(d, p) {\n return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);\n },\n Z: d3_time_zone,\n \"%\": function() {\n return \"%\";\n }\n };\n var d3_time_parsers = {\n a: d3_time_parseWeekdayAbbrev,\n A: d3_time_parseWeekday,\n b: d3_time_parseMonthAbbrev,\n B: d3_time_parseMonth,\n c: d3_time_parseLocaleFull,\n d: d3_time_parseDay,\n e: d3_time_parseDay,\n H: d3_time_parseHour24,\n I: d3_time_parseHour24,\n j: d3_time_parseDayOfYear,\n L: d3_time_parseMilliseconds,\n m: d3_time_parseMonthNumber,\n M: d3_time_parseMinutes,\n p: d3_time_parseAmPm,\n S: d3_time_parseSeconds,\n U: d3_time_parseWeekNumberSunday,\n w: d3_time_parseWeekdayNumber,\n W: d3_time_parseWeekNumberMonday,\n x: d3_time_parseLocaleDate,\n X: d3_time_parseLocaleTime,\n y: d3_time_parseYear,\n Y: d3_time_parseFullYear,\n Z: d3_time_parseZone,\n \"%\": d3_time_parseLiteralPercent\n };\n function d3_time_parseWeekdayAbbrev(date, string, i) {\n d3_time_dayAbbrevRe.lastIndex = 0;\n var n = d3_time_dayAbbrevRe.exec(string.slice(i));\n return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n function d3_time_parseWeekday(date, string, i) {\n d3_time_dayRe.lastIndex = 0;\n var n = d3_time_dayRe.exec(string.slice(i));\n return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n function d3_time_parseMonthAbbrev(date, string, i) {\n d3_time_monthAbbrevRe.lastIndex = 0;\n var n = d3_time_monthAbbrevRe.exec(string.slice(i));\n return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n function d3_time_parseMonth(date, string, i) {\n d3_time_monthRe.lastIndex = 0;\n var n = d3_time_monthRe.exec(string.slice(i));\n return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n function d3_time_parseLocaleFull(date, string, i) {\n return d3_time_parse(date, d3_time_formats.c.toString(), string, i);\n }\n function d3_time_parseLocaleDate(date, string, i) {\n return d3_time_parse(date, d3_time_formats.x.toString(), string, i);\n }\n function d3_time_parseLocaleTime(date, string, i) {\n return d3_time_parse(date, d3_time_formats.X.toString(), string, i);\n }\n function d3_time_parseAmPm(date, string, i) {\n var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (date.p = n, i);\n }\n return d3_time_format;\n }\n var d3_time_formatPads = {\n \"-\": \"\",\n _: \" \",\n \"0\": \"0\"\n }, d3_time_numberRe = /^\\s*\\d+/, d3_time_percentRe = /^%/;\n function d3_time_formatPad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\", string = (sign ? -value : value) + \"\", length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n function d3_time_formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(d3.requote).join(\"|\") + \")\", \"i\");\n }\n function d3_time_formatLookup(names) {\n var map = new d3_Map(), i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n function d3_time_parseWeekdayNumber(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 1));\n return n ? (date.w = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseWeekNumberSunday(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i));\n return n ? (date.U = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseWeekNumberMonday(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i));\n return n ? (date.W = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseFullYear(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 4));\n return n ? (date.y = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseYear(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 2));\n return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1;\n }\n function d3_time_parseZone(date, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string, \n i + 5) : -1;\n }\n function d3_time_expandYear(d) {\n return d + (d > 68 ? 1900 : 2e3);\n }\n function d3_time_parseMonthNumber(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 2));\n return n ? (date.m = n[0] - 1, i + n[0].length) : -1;\n }\n function d3_time_parseDay(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 2));\n return n ? (date.d = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseDayOfYear(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 3));\n return n ? (date.j = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseHour24(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 2));\n return n ? (date.H = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseMinutes(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 2));\n return n ? (date.M = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseSeconds(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 2));\n return n ? (date.S = +n[0], i + n[0].length) : -1;\n }\n function d3_time_parseMilliseconds(date, string, i) {\n d3_time_numberRe.lastIndex = 0;\n var n = d3_time_numberRe.exec(string.slice(i, i + 3));\n return n ? (date.L = +n[0], i + n[0].length) : -1;\n }\n function d3_time_zone(d) {\n var z = d.getTimezoneOffset(), zs = z > 0 ? \"-\" : \"+\", zh = abs(z) / 60 | 0, zm = abs(z) % 60;\n return zs + d3_time_formatPad(zh, \"0\", 2) + d3_time_formatPad(zm, \"0\", 2);\n }\n function d3_time_parseLiteralPercent(date, string, i) {\n d3_time_percentRe.lastIndex = 0;\n var n = d3_time_percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n function d3_time_formatMulti(formats) {\n var n = formats.length, i = -1;\n while (++i < n) formats[i][0] = this(formats[i][0]);\n return function(date) {\n var i = 0, f = formats[i];\n while (!f[1](date)) f = formats[++i];\n return f[0](date);\n };\n }\n d3.locale = function(locale) {\n return {\n numberFormat: d3_locale_numberFormat(locale),\n timeFormat: d3_locale_timeFormat(locale)\n };\n };\n var d3_locale_enUS = d3.locale({\n decimal: \".\",\n thousands: \",\",\n grouping: [ 3 ],\n currency: [ \"$\", \"\" ],\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [ \"AM\", \"PM\" ],\n days: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ],\n shortDays: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ],\n months: [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ],\n shortMonths: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ]\n });\n d3.format = d3_locale_enUS.numberFormat;\n d3.geo = {};\n function d3_adder() {}\n d3_adder.prototype = {\n s: 0,\n t: 0,\n add: function(y) {\n d3_adderSum(y, this.t, d3_adderTemp);\n d3_adderSum(d3_adderTemp.s, this.s, this);\n if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t;\n },\n reset: function() {\n this.s = this.t = 0;\n },\n valueOf: function() {\n return this.s;\n }\n };\n var d3_adderTemp = new d3_adder();\n function d3_adderSum(a, b, o) {\n var x = o.s = a + b, bv = x - a, av = x - bv;\n o.t = a - av + (b - bv);\n }\n d3.geo.stream = function(object, listener) {\n if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) {\n d3_geo_streamObjectType[object.type](object, listener);\n } else {\n d3_geo_streamGeometry(object, listener);\n }\n };\n function d3_geo_streamGeometry(geometry, listener) {\n if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {\n d3_geo_streamGeometryType[geometry.type](geometry, listener);\n }\n }\n var d3_geo_streamObjectType = {\n Feature: function(feature, listener) {\n d3_geo_streamGeometry(feature.geometry, listener);\n },\n FeatureCollection: function(object, listener) {\n var features = object.features, i = -1, n = features.length;\n while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);\n }\n };\n var d3_geo_streamGeometryType = {\n Sphere: function(object, listener) {\n listener.sphere();\n },\n Point: function(object, listener) {\n object = object.coordinates;\n listener.point(object[0], object[1], object[2]);\n },\n MultiPoint: function(object, listener) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]);\n },\n LineString: function(object, listener) {\n d3_geo_streamLine(object.coordinates, listener, 0);\n },\n MultiLineString: function(object, listener) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);\n },\n Polygon: function(object, listener) {\n d3_geo_streamPolygon(object.coordinates, listener);\n },\n MultiPolygon: function(object, listener) {\n var coordinates = object.coordinates, i = -1, n = coordinates.length;\n while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);\n },\n GeometryCollection: function(object, listener) {\n var geometries = object.geometries, i = -1, n = geometries.length;\n while (++i < n) d3_geo_streamGeometry(geometries[i], listener);\n }\n };\n function d3_geo_streamLine(coordinates, listener, closed) {\n var i = -1, n = coordinates.length - closed, coordinate;\n listener.lineStart();\n while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]);\n listener.lineEnd();\n }\n function d3_geo_streamPolygon(coordinates, listener) {\n var i = -1, n = coordinates.length;\n listener.polygonStart();\n while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);\n listener.polygonEnd();\n }\n d3.geo.area = function(object) {\n d3_geo_areaSum = 0;\n d3.geo.stream(object, d3_geo_area);\n return d3_geo_areaSum;\n };\n var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder();\n var d3_geo_area = {\n sphere: function() {\n d3_geo_areaSum += 4 * π;\n },\n point: d3_noop,\n lineStart: d3_noop,\n lineEnd: d3_noop,\n polygonStart: function() {\n d3_geo_areaRingSum.reset();\n d3_geo_area.lineStart = d3_geo_areaRingStart;\n },\n polygonEnd: function() {\n var area = 2 * d3_geo_areaRingSum;\n d3_geo_areaSum += area < 0 ? 4 * π + area : area;\n d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;\n }\n };\n function d3_geo_areaRingStart() {\n var λ00, φ00, λ0, cosφ0, sinφ0;\n d3_geo_area.point = function(λ, φ) {\n d3_geo_area.point = nextPoint;\n λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), \n sinφ0 = Math.sin(φ);\n };\n function nextPoint(λ, φ) {\n λ *= d3_radians;\n φ = φ * d3_radians / 2 + π / 4;\n var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ);\n d3_geo_areaRingSum.add(Math.atan2(v, u));\n λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;\n }\n d3_geo_area.lineEnd = function() {\n nextPoint(λ00, φ00);\n };\n }\n function d3_geo_cartesian(spherical) {\n var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);\n return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];\n }\n function d3_geo_cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n function d3_geo_cartesianCross(a, b) {\n return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];\n }\n function d3_geo_cartesianAdd(a, b) {\n a[0] += b[0];\n a[1] += b[1];\n a[2] += b[2];\n }\n function d3_geo_cartesianScale(vector, k) {\n return [ vector[0] * k, vector[1] * k, vector[2] * k ];\n }\n function d3_geo_cartesianNormalize(d) {\n var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l;\n d[1] /= l;\n d[2] /= l;\n }\n function d3_geo_spherical(cartesian) {\n return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ];\n }\n function d3_geo_sphericalEqual(a, b) {\n return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε;\n }\n d3.geo.bounds = function() {\n var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range;\n var bound = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n bound.point = ringPoint;\n bound.lineStart = ringStart;\n bound.lineEnd = ringEnd;\n dλSum = 0;\n d3_geo_area.polygonStart();\n },\n polygonEnd: function() {\n d3_geo_area.polygonEnd();\n bound.point = point;\n bound.lineStart = lineStart;\n bound.lineEnd = lineEnd;\n if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90;\n range[0] = λ0, range[1] = λ1;\n }\n };\n function point(λ, φ) {\n ranges.push(range = [ λ0 = λ, λ1 = λ ]);\n if (φ < φ0) φ0 = φ;\n if (φ > φ1) φ1 = φ;\n }\n function linePoint(λ, φ) {\n var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]);\n if (p0) {\n var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal);\n d3_geo_cartesianNormalize(inflection);\n inflection = d3_geo_spherical(inflection);\n var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180;\n if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) {\n var φi = inflection[1] * d3_degrees;\n if (φi > φ1) φ1 = φi;\n } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) {\n var φi = -inflection[1] * d3_degrees;\n if (φi < φ0) φ0 = φi;\n } else {\n if (φ < φ0) φ0 = φ;\n if (φ > φ1) φ1 = φ;\n }\n if (antimeridian) {\n if (λ < λ_) {\n if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;\n } else {\n if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;\n }\n } else {\n if (λ1 >= λ0) {\n if (λ < λ0) λ0 = λ;\n if (λ > λ1) λ1 = λ;\n } else {\n if (λ > λ_) {\n if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;\n } else {\n if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;\n }\n }\n }\n } else {\n point(λ, φ);\n }\n p0 = p, λ_ = λ;\n }\n function lineStart() {\n bound.point = linePoint;\n }\n function lineEnd() {\n range[0] = λ0, range[1] = λ1;\n bound.point = point;\n p0 = null;\n }\n function ringPoint(λ, φ) {\n if (p0) {\n var dλ = λ - λ_;\n dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ;\n } else λ__ = λ, φ__ = φ;\n d3_geo_area.point(λ, φ);\n linePoint(λ, φ);\n }\n function ringStart() {\n d3_geo_area.lineStart();\n }\n function ringEnd() {\n ringPoint(λ__, φ__);\n d3_geo_area.lineEnd();\n if (abs(dλSum) > ε) λ0 = -(λ1 = 180);\n range[0] = λ0, range[1] = λ1;\n p0 = null;\n }\n function angle(λ0, λ1) {\n return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1;\n }\n function compareRanges(a, b) {\n return a[0] - b[0];\n }\n function withinRange(x, range) {\n return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;\n }\n return function(feature) {\n φ1 = λ1 = -(λ0 = φ0 = Infinity);\n ranges = [];\n d3.geo.stream(feature, bound);\n var n = ranges.length;\n if (n) {\n ranges.sort(compareRanges);\n for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) {\n b = ranges[i];\n if (withinRange(b[0], a) || withinRange(b[1], a)) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n }\n var best = -Infinity, dλ;\n for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) {\n b = merged[i];\n if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1];\n }\n }\n ranges = range = null;\n return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ];\n };\n }();\n d3.geo.centroid = function(object) {\n d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;\n d3.geo.stream(object, d3_geo_centroid);\n var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z;\n if (m < ε2) {\n x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1;\n if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0;\n m = x * x + y * y + z * z;\n if (m < ε2) return [ NaN, NaN ];\n }\n return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ];\n };\n var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2;\n var d3_geo_centroid = {\n sphere: d3_noop,\n point: d3_geo_centroidPoint,\n lineStart: d3_geo_centroidLineStart,\n lineEnd: d3_geo_centroidLineEnd,\n polygonStart: function() {\n d3_geo_centroid.lineStart = d3_geo_centroidRingStart;\n },\n polygonEnd: function() {\n d3_geo_centroid.lineStart = d3_geo_centroidLineStart;\n }\n };\n function d3_geo_centroidPoint(λ, φ) {\n λ *= d3_radians;\n var cosφ = Math.cos(φ *= d3_radians);\n d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));\n }\n function d3_geo_centroidPointXYZ(x, y, z) {\n ++d3_geo_centroidW0;\n d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0;\n d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0;\n d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0;\n }\n function d3_geo_centroidLineStart() {\n var x0, y0, z0;\n d3_geo_centroid.point = function(λ, φ) {\n λ *= d3_radians;\n var cosφ = Math.cos(φ *= d3_radians);\n x0 = cosφ * Math.cos(λ);\n y0 = cosφ * Math.sin(λ);\n z0 = Math.sin(φ);\n d3_geo_centroid.point = nextPoint;\n d3_geo_centroidPointXYZ(x0, y0, z0);\n };\n function nextPoint(λ, φ) {\n λ *= d3_radians;\n var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);\n d3_geo_centroidW1 += w;\n d3_geo_centroidX1 += w * (x0 + (x0 = x));\n d3_geo_centroidY1 += w * (y0 + (y0 = y));\n d3_geo_centroidZ1 += w * (z0 + (z0 = z));\n d3_geo_centroidPointXYZ(x0, y0, z0);\n }\n }\n function d3_geo_centroidLineEnd() {\n d3_geo_centroid.point = d3_geo_centroidPoint;\n }\n function d3_geo_centroidRingStart() {\n var λ00, φ00, x0, y0, z0;\n d3_geo_centroid.point = function(λ, φ) {\n λ00 = λ, φ00 = φ;\n d3_geo_centroid.point = nextPoint;\n λ *= d3_radians;\n var cosφ = Math.cos(φ *= d3_radians);\n x0 = cosφ * Math.cos(λ);\n y0 = cosφ * Math.sin(λ);\n z0 = Math.sin(φ);\n d3_geo_centroidPointXYZ(x0, y0, z0);\n };\n d3_geo_centroid.lineEnd = function() {\n nextPoint(λ00, φ00);\n d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;\n d3_geo_centroid.point = d3_geo_centroidPoint;\n };\n function nextPoint(λ, φ) {\n λ *= d3_radians;\n var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u);\n d3_geo_centroidX2 += v * cx;\n d3_geo_centroidY2 += v * cy;\n d3_geo_centroidZ2 += v * cz;\n d3_geo_centroidW1 += w;\n d3_geo_centroidX1 += w * (x0 + (x0 = x));\n d3_geo_centroidY1 += w * (y0 + (y0 = y));\n d3_geo_centroidZ1 += w * (z0 + (z0 = z));\n d3_geo_centroidPointXYZ(x0, y0, z0);\n }\n }\n function d3_geo_compose(a, b) {\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n if (a.invert && b.invert) compose.invert = function(x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n return compose;\n }\n function d3_true() {\n return true;\n }\n function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) {\n var subject = [], clip = [];\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n];\n if (d3_geo_sphericalEqual(p0, p1)) {\n listener.lineStart();\n for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);\n listener.lineEnd();\n return;\n }\n var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false);\n a.o = b;\n subject.push(a);\n clip.push(b);\n a = new d3_geo_clipPolygonIntersection(p1, segment, null, false);\n b = new d3_geo_clipPolygonIntersection(p1, null, a, true);\n a.o = b;\n subject.push(a);\n clip.push(b);\n });\n clip.sort(compare);\n d3_geo_clipPolygonLinkCircular(subject);\n d3_geo_clipPolygonLinkCircular(clip);\n if (!subject.length) return;\n for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) {\n clip[i].e = entry = !entry;\n }\n var start = subject[0], points, point;\n while (1) {\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n listener.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, listener);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, listener);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n listener.lineEnd();\n }\n }\n function d3_geo_clipPolygonLinkCircular(array) {\n if (!(n = array.length)) return;\n var n, i = 0, a = array[0], b;\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n a.n = b = array[0];\n b.p = a;\n }\n function d3_geo_clipPolygonIntersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other;\n this.e = entry;\n this.v = false;\n this.n = this.p = null;\n }\n function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) {\n return function(rotate, listener) {\n var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]);\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = d3.merge(segments);\n var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon);\n if (segments.length) {\n if (!polygonStarted) listener.polygonStart(), polygonStarted = true;\n d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener);\n } else if (clipStartInside) {\n if (!polygonStarted) listener.polygonStart(), polygonStarted = true;\n listener.lineStart();\n interpolate(null, null, 1, listener);\n listener.lineEnd();\n }\n if (polygonStarted) listener.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function() {\n listener.polygonStart();\n listener.lineStart();\n interpolate(null, null, 1, listener);\n listener.lineEnd();\n listener.polygonEnd();\n }\n };\n function point(λ, φ) {\n var point = rotate(λ, φ);\n if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ);\n }\n function pointLine(λ, φ) {\n var point = rotate(λ, φ);\n line.point(point[0], point[1]);\n }\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n var segments;\n var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygonStarted = false, polygon, ring;\n function pointRing(λ, φ) {\n ring.push([ λ, φ ]);\n var point = rotate(λ, φ);\n ringListener.point(point[0], point[1]);\n }\n function ringStart() {\n ringListener.lineStart();\n ring = [];\n }\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringListener.lineEnd();\n var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;\n ring.pop();\n polygon.push(ring);\n ring = null;\n if (!n) return;\n if (clean & 1) {\n segment = ringSegments[0];\n var n = segment.length - 1, i = -1, point;\n if (n > 0) {\n if (!polygonStarted) listener.polygonStart(), polygonStarted = true;\n listener.lineStart();\n while (++i < n) listener.point((point = segment[i])[0], point[1]);\n listener.lineEnd();\n }\n return;\n }\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));\n }\n return clip;\n };\n }\n function d3_geo_clipSegmentLength1(segment) {\n return segment.length > 1;\n }\n function d3_geo_clipBufferListener() {\n var lines = [], line;\n return {\n lineStart: function() {\n lines.push(line = []);\n },\n point: function(λ, φ) {\n line.push([ λ, φ ]);\n },\n lineEnd: d3_noop,\n buffer: function() {\n var buffer = lines;\n lines = [];\n line = null;\n return buffer;\n },\n rejoin: function() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n }\n };\n }\n function d3_geo_clipSort(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]);\n }\n var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]);\n function d3_geo_clipAntimeridianLine(listener) {\n var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;\n return {\n lineStart: function() {\n listener.lineStart();\n clean = 1;\n },\n point: function(λ1, φ1) {\n var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0);\n if (abs(dλ - π) < ε) {\n listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ);\n listener.point(sλ0, φ0);\n listener.lineEnd();\n listener.lineStart();\n listener.point(sλ1, φ0);\n listener.point(λ1, φ0);\n clean = 0;\n } else if (sλ0 !== sλ1 && dλ >= π) {\n if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;\n if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;\n φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);\n listener.point(sλ0, φ0);\n listener.lineEnd();\n listener.lineStart();\n listener.point(sλ1, φ0);\n clean = 0;\n }\n listener.point(λ0 = λ1, φ0 = φ1);\n sλ0 = sλ1;\n },\n lineEnd: function() {\n listener.lineEnd();\n λ0 = φ0 = NaN;\n },\n clean: function() {\n return 2 - clean;\n }\n };\n }\n function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {\n var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);\n return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;\n }\n function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {\n var φ;\n if (from == null) {\n φ = direction * halfπ;\n listener.point(-π, φ);\n listener.point(0, φ);\n listener.point(π, φ);\n listener.point(π, 0);\n listener.point(π, -φ);\n listener.point(0, -φ);\n listener.point(-π, -φ);\n listener.point(-π, 0);\n listener.point(-π, φ);\n } else if (abs(from[0] - to[0]) > ε) {\n var s = from[0] < to[0] ? π : -π;\n φ = direction * s / 2;\n listener.point(-s, φ);\n listener.point(0, φ);\n listener.point(s, φ);\n } else {\n listener.point(to[0], to[1]);\n }\n }\n function d3_geo_pointInPolygon(point, polygon) {\n var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0;\n d3_geo_areaRingSum.reset();\n for (var i = 0, n = polygon.length; i < n; ++i) {\n var ring = polygon[i], m = ring.length;\n if (!m) continue;\n var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1;\n while (true) {\n if (j === m) j = 0;\n point = ring[j];\n var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ;\n d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));\n polarAngle += antimeridian ? dλ + sdλ * τ : dλ;\n if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) {\n var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point));\n d3_geo_cartesianNormalize(arc);\n var intersection = d3_geo_cartesianCross(meridianNormal, arc);\n d3_geo_cartesianNormalize(intersection);\n var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]);\n if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) {\n winding += antimeridian ^ dλ >= 0 ? 1 : -1;\n }\n }\n if (!j++) break;\n λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;\n }\n }\n return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < -ε) ^ winding & 1;\n }\n function d3_geo_clipCircle(radius) {\n var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);\n return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]);\n function visible(λ, φ) {\n return Math.cos(λ) * Math.cos(φ) > cr;\n }\n function clipLine(listener) {\n var point0, c0, v0, v00, clean;\n return {\n lineStart: function() {\n v00 = v0 = false;\n clean = 1;\n },\n point: function(λ, φ) {\n var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0;\n if (!point0 && (v00 = v0 = v)) listener.lineStart();\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {\n point1[0] += ε;\n point1[1] += ε;\n v = visible(point1[0], point1[1]);\n }\n }\n if (v !== v0) {\n clean = 0;\n if (v) {\n listener.lineStart();\n point2 = intersect(point1, point0);\n listener.point(point2[0], point2[1]);\n } else {\n point2 = intersect(point0, point1);\n listener.point(point2[0], point2[1]);\n listener.lineEnd();\n }\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t;\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n clean = 0;\n if (smallRadius) {\n listener.lineStart();\n listener.point(t[0][0], t[0][1]);\n listener.point(t[1][0], t[1][1]);\n listener.lineEnd();\n } else {\n listener.point(t[1][0], t[1][1]);\n listener.lineEnd();\n listener.lineStart();\n listener.point(t[0][0], t[0][1]);\n }\n }\n }\n if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) {\n listener.point(point1[0], point1[1]);\n }\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function() {\n if (v0) listener.lineEnd();\n point0 = null;\n },\n clean: function() {\n return clean | (v00 && v0) << 1;\n }\n };\n }\n function intersect(a, b, two) {\n var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b);\n var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;\n if (!determinant) return !two && a;\n var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);\n d3_geo_cartesianAdd(A, B);\n var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1);\n if (t2 < 0) return;\n var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu);\n d3_geo_cartesianAdd(q, A);\n q = d3_geo_spherical(q);\n if (!two) return q;\n var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z;\n if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z;\n var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε;\n if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z;\n if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) {\n var q1 = d3_geo_cartesianScale(u, (-w + t) / uu);\n d3_geo_cartesianAdd(q1, A);\n return [ q, d3_geo_spherical(q1) ];\n }\n }\n function code(λ, φ) {\n var r = smallRadius ? radius : π - radius, code = 0;\n if (λ < -r) code |= 1; else if (λ > r) code |= 2;\n if (φ < -r) code |= 4; else if (φ > r) code |= 8;\n return code;\n }\n }\n function d3_geom_clipLine(x0, y0, x1, y1) {\n return function(line) {\n var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n if (t0 > 0) line.a = {\n x: ax + t0 * dx,\n y: ay + t0 * dy\n };\n if (t1 < 1) line.b = {\n x: ax + t1 * dx,\n y: ay + t1 * dy\n };\n return line;\n };\n }\n var d3_geo_clipExtentMAX = 1e9;\n d3.geo.clipExtent = function() {\n var x0, y0, x1, y1, stream, clip, clipExtent = {\n stream: function(output) {\n if (stream) stream.valid = false;\n stream = clip(output);\n stream.valid = true;\n return stream;\n },\n extent: function(_) {\n if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];\n clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]);\n if (stream) stream.valid = false, stream = null;\n return clipExtent;\n }\n };\n return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]);\n };\n function d3_geo_clipExtent(x0, y0, x1, y1) {\n return function(listener) {\n var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring;\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n listener = bufferListener;\n segments = [];\n polygon = [];\n clean = true;\n },\n polygonEnd: function() {\n listener = listener_;\n segments = d3.merge(segments);\n var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length;\n if (inside || visible) {\n listener.polygonStart();\n if (inside) {\n listener.lineStart();\n interpolate(null, null, 1, listener);\n listener.lineEnd();\n }\n if (visible) {\n d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener);\n }\n listener.polygonEnd();\n }\n segments = polygon = ring = null;\n }\n };\n function insidePolygon(p) {\n var wn = 0, n = polygon.length, y = p[1];\n for (var i = 0; i < n; ++i) {\n for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) {\n b = v[j];\n if (a[1] <= y) {\n if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn;\n } else {\n if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn;\n }\n a = b;\n }\n }\n return wn !== 0;\n }\n function interpolate(from, to, direction, listener) {\n var a = 0, a1 = 0;\n if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) {\n do {\n listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n } while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n listener.point(to[0], to[1]);\n }\n }\n function pointVisible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n function point(x, y) {\n if (pointVisible(x, y)) listener.point(x, y);\n }\n var x__, y__, v__, x_, y_, v_, first, clean;\n function lineStart() {\n clip.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n }\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferListener.rejoin();\n segments.push(bufferListener.buffer());\n }\n clip.point = point;\n if (v_) listener.lineEnd();\n }\n function linePoint(x, y) {\n x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x));\n y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y));\n var v = pointVisible(x, y);\n if (polygon) ring.push([ x, y ]);\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n if (v) {\n listener.lineStart();\n listener.point(x, y);\n }\n } else {\n if (v && v_) listener.point(x, y); else {\n var l = {\n a: {\n x: x_,\n y: y_\n },\n b: {\n x: x,\n y: y\n }\n };\n if (clipLine(l)) {\n if (!v_) {\n listener.lineStart();\n listener.point(l.a.x, l.a.y);\n }\n listener.point(l.b.x, l.b.y);\n if (!v) listener.lineEnd();\n clean = false;\n } else if (v) {\n listener.lineStart();\n listener.point(x, y);\n clean = false;\n }\n }\n }\n x_ = x, y_ = y, v_ = v;\n }\n return clip;\n };\n function corner(p, direction) {\n return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;\n }\n function compare(a, b) {\n return comparePoints(a.x, b.x);\n }\n function comparePoints(a, b) {\n var ca = corner(a, 1), cb = corner(b, 1);\n return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];\n }\n }\n function d3_geo_conic(projectAt) {\n var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1);\n p.parallels = function(_) {\n if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ];\n return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);\n };\n return p;\n }\n function d3_geo_conicEqualArea(φ0, φ1) {\n var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;\n function forward(λ, φ) {\n var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;\n return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];\n }\n forward.invert = function(x, y) {\n var ρ0_y = ρ0 - y;\n return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];\n };\n return forward;\n }\n (d3.geo.conicEqualArea = function() {\n return d3_geo_conic(d3_geo_conicEqualArea);\n }).raw = d3_geo_conicEqualArea;\n d3.geo.albers = function() {\n return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070);\n };\n d3.geo.albersUsa = function() {\n var lower48 = d3.geo.albers();\n var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]);\n var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]);\n var point, pointStream = {\n point: function(x, y) {\n point = [ x, y ];\n }\n }, lower48Point, alaskaPoint, hawaiiPoint;\n function albersUsa(coordinates) {\n var x = coordinates[0], y = coordinates[1];\n point = null;\n (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y);\n return point;\n }\n albersUsa.invert = function(coordinates) {\n var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;\n return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates);\n };\n albersUsa.stream = function(stream) {\n var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream);\n return {\n point: function(x, y) {\n lower48Stream.point(x, y);\n alaskaStream.point(x, y);\n hawaiiStream.point(x, y);\n },\n sphere: function() {\n lower48Stream.sphere();\n alaskaStream.sphere();\n hawaiiStream.sphere();\n },\n lineStart: function() {\n lower48Stream.lineStart();\n alaskaStream.lineStart();\n hawaiiStream.lineStart();\n },\n lineEnd: function() {\n lower48Stream.lineEnd();\n alaskaStream.lineEnd();\n hawaiiStream.lineEnd();\n },\n polygonStart: function() {\n lower48Stream.polygonStart();\n alaskaStream.polygonStart();\n hawaiiStream.polygonStart();\n },\n polygonEnd: function() {\n lower48Stream.polygonEnd();\n alaskaStream.polygonEnd();\n hawaiiStream.polygonEnd();\n }\n };\n };\n albersUsa.precision = function(_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_);\n alaska.precision(_);\n hawaii.precision(_);\n return albersUsa;\n };\n albersUsa.scale = function(_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_);\n alaska.scale(_ * .35);\n hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n albersUsa.translate = function(_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(), x = +_[0], y = +_[1];\n lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point;\n alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;\n hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;\n return albersUsa;\n };\n return albersUsa.scale(1070);\n };\n var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {\n point: d3_noop,\n lineStart: d3_noop,\n lineEnd: d3_noop,\n polygonStart: function() {\n d3_geo_pathAreaPolygon = 0;\n d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;\n },\n polygonEnd: function() {\n d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;\n d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2);\n }\n };\n function d3_geo_pathAreaRingStart() {\n var x00, y00, x0, y0;\n d3_geo_pathArea.point = function(x, y) {\n d3_geo_pathArea.point = nextPoint;\n x00 = x0 = x, y00 = y0 = y;\n };\n function nextPoint(x, y) {\n d3_geo_pathAreaPolygon += y0 * x - x0 * y;\n x0 = x, y0 = y;\n }\n d3_geo_pathArea.lineEnd = function() {\n nextPoint(x00, y00);\n };\n }\n var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1;\n var d3_geo_pathBounds = {\n point: d3_geo_pathBoundsPoint,\n lineStart: d3_noop,\n lineEnd: d3_noop,\n polygonStart: d3_noop,\n polygonEnd: d3_noop\n };\n function d3_geo_pathBoundsPoint(x, y) {\n if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x;\n if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x;\n if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y;\n if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y;\n }\n function d3_geo_pathBuffer() {\n var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = [];\n var stream = {\n point: point,\n lineStart: function() {\n stream.point = pointLineStart;\n },\n lineEnd: lineEnd,\n polygonStart: function() {\n stream.lineEnd = lineEndPolygon;\n },\n polygonEnd: function() {\n stream.lineEnd = lineEnd;\n stream.point = point;\n },\n pointRadius: function(_) {\n pointCircle = d3_geo_pathBufferCircle(_);\n return stream;\n },\n result: function() {\n if (buffer.length) {\n var result = buffer.join(\"\");\n buffer = [];\n return result;\n }\n }\n };\n function point(x, y) {\n buffer.push(\"M\", x, \",\", y, pointCircle);\n }\n function pointLineStart(x, y) {\n buffer.push(\"M\", x, \",\", y);\n stream.point = pointLine;\n }\n function pointLine(x, y) {\n buffer.push(\"L\", x, \",\", y);\n }\n function lineEnd() {\n stream.point = point;\n }\n function lineEndPolygon() {\n buffer.push(\"Z\");\n }\n return stream;\n }\n function d3_geo_pathBufferCircle(radius) {\n return \"m0,\" + radius + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + -2 * radius + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + 2 * radius + \"z\";\n }\n var d3_geo_pathCentroid = {\n point: d3_geo_pathCentroidPoint,\n lineStart: d3_geo_pathCentroidLineStart,\n lineEnd: d3_geo_pathCentroidLineEnd,\n polygonStart: function() {\n d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;\n },\n polygonEnd: function() {\n d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;\n d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;\n d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;\n }\n };\n function d3_geo_pathCentroidPoint(x, y) {\n d3_geo_centroidX0 += x;\n d3_geo_centroidY0 += y;\n ++d3_geo_centroidZ0;\n }\n function d3_geo_pathCentroidLineStart() {\n var x0, y0;\n d3_geo_pathCentroid.point = function(x, y) {\n d3_geo_pathCentroid.point = nextPoint;\n d3_geo_pathCentroidPoint(x0 = x, y0 = y);\n };\n function nextPoint(x, y) {\n var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);\n d3_geo_centroidX1 += z * (x0 + x) / 2;\n d3_geo_centroidY1 += z * (y0 + y) / 2;\n d3_geo_centroidZ1 += z;\n d3_geo_pathCentroidPoint(x0 = x, y0 = y);\n }\n }\n function d3_geo_pathCentroidLineEnd() {\n d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;\n }\n function d3_geo_pathCentroidRingStart() {\n var x00, y00, x0, y0;\n d3_geo_pathCentroid.point = function(x, y) {\n d3_geo_pathCentroid.point = nextPoint;\n d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y);\n };\n function nextPoint(x, y) {\n var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);\n d3_geo_centroidX1 += z * (x0 + x) / 2;\n d3_geo_centroidY1 += z * (y0 + y) / 2;\n d3_geo_centroidZ1 += z;\n z = y0 * x - x0 * y;\n d3_geo_centroidX2 += z * (x0 + x);\n d3_geo_centroidY2 += z * (y0 + y);\n d3_geo_centroidZ2 += z * 3;\n d3_geo_pathCentroidPoint(x0 = x, y0 = y);\n }\n d3_geo_pathCentroid.lineEnd = function() {\n nextPoint(x00, y00);\n };\n }\n function d3_geo_pathContext(context) {\n var pointRadius = 4.5;\n var stream = {\n point: point,\n lineStart: function() {\n stream.point = pointLineStart;\n },\n lineEnd: lineEnd,\n polygonStart: function() {\n stream.lineEnd = lineEndPolygon;\n },\n polygonEnd: function() {\n stream.lineEnd = lineEnd;\n stream.point = point;\n },\n pointRadius: function(_) {\n pointRadius = _;\n return stream;\n },\n result: d3_noop\n };\n function point(x, y) {\n context.moveTo(x + pointRadius, y);\n context.arc(x, y, pointRadius, 0, τ);\n }\n function pointLineStart(x, y) {\n context.moveTo(x, y);\n stream.point = pointLine;\n }\n function pointLine(x, y) {\n context.lineTo(x, y);\n }\n function lineEnd() {\n stream.point = point;\n }\n function lineEndPolygon() {\n context.closePath();\n }\n return stream;\n }\n function d3_geo_resample(project) {\n var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16;\n function resample(stream) {\n return (maxDepth ? resampleRecursive : resampleNone)(stream);\n }\n function resampleNone(stream) {\n return d3_geo_transformPoint(stream, function(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n });\n }\n function resampleRecursive(stream) {\n var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;\n var resample = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function() {\n stream.polygonStart();\n resample.lineStart = ringStart;\n },\n polygonEnd: function() {\n stream.polygonEnd();\n resample.lineStart = lineStart;\n }\n };\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n function lineStart() {\n x0 = NaN;\n resample.point = linePoint;\n stream.lineStart();\n }\n function linePoint(λ, φ) {\n var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);\n resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n function lineEnd() {\n resample.point = point;\n stream.lineEnd();\n }\n function ringStart() {\n lineStart();\n resample.point = ringPoint;\n resample.lineEnd = ringEnd;\n }\n function ringPoint(λ, φ) {\n linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resample.point = linePoint;\n }\n function ringEnd() {\n resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);\n resample.lineEnd = lineEnd;\n lineEnd();\n }\n return resample;\n }\n function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;\n if (d2 > 4 * δ2 && depth--) {\n var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;\n if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {\n resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);\n }\n }\n }\n resample.precision = function(_) {\n if (!arguments.length) return Math.sqrt(δ2);\n maxDepth = (δ2 = _ * _) > 0 && 16;\n return resample;\n };\n return resample;\n }\n d3.geo.path = function() {\n var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream;\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream);\n d3.geo.stream(object, cacheStream);\n }\n return contextStream.result();\n }\n path.area = function(object) {\n d3_geo_pathAreaSum = 0;\n d3.geo.stream(object, projectStream(d3_geo_pathArea));\n return d3_geo_pathAreaSum;\n };\n path.centroid = function(object) {\n d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;\n d3.geo.stream(object, projectStream(d3_geo_pathCentroid));\n return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ];\n };\n path.bounds = function(object) {\n d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity);\n d3.geo.stream(object, projectStream(d3_geo_pathBounds));\n return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ];\n };\n path.projection = function(_) {\n if (!arguments.length) return projection;\n projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;\n return reset();\n };\n path.context = function(_) {\n if (!arguments.length) return context;\n contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return reset();\n };\n path.pointRadius = function(_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n function reset() {\n cacheStream = null;\n return path;\n }\n return path.projection(d3.geo.albersUsa()).context(null);\n };\n function d3_geo_pathProjectStream(project) {\n var resample = d3_geo_resample(function(x, y) {\n return project([ x * d3_degrees, y * d3_degrees ]);\n });\n return function(stream) {\n return d3_geo_projectionRadians(resample(stream));\n };\n }\n d3.geo.transform = function(methods) {\n return {\n stream: function(stream) {\n var transform = new d3_geo_transform(stream);\n for (var k in methods) transform[k] = methods[k];\n return transform;\n }\n };\n };\n function d3_geo_transform(stream) {\n this.stream = stream;\n }\n d3_geo_transform.prototype = {\n point: function(x, y) {\n this.stream.point(x, y);\n },\n sphere: function() {\n this.stream.sphere();\n },\n lineStart: function() {\n this.stream.lineStart();\n },\n lineEnd: function() {\n this.stream.lineEnd();\n },\n polygonStart: function() {\n this.stream.polygonStart();\n },\n polygonEnd: function() {\n this.stream.polygonEnd();\n }\n };\n function d3_geo_transformPoint(stream, point) {\n return {\n point: point,\n sphere: function() {\n stream.sphere();\n },\n lineStart: function() {\n stream.lineStart();\n },\n lineEnd: function() {\n stream.lineEnd();\n },\n polygonStart: function() {\n stream.polygonStart();\n },\n polygonEnd: function() {\n stream.polygonEnd();\n }\n };\n }\n d3.geo.projection = d3_geo_projection;\n d3.geo.projectionMutator = d3_geo_projectionMutator;\n function d3_geo_projection(project) {\n return d3_geo_projectionMutator(function() {\n return project;\n })();\n }\n function d3_geo_projectionMutator(projectAt) {\n var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {\n x = project(x, y);\n return [ x[0] * k + δx, δy - x[1] * k ];\n }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream;\n function projection(point) {\n point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);\n return [ point[0] * k + δx, δy - point[1] * k ];\n }\n function invert(point) {\n point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);\n return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];\n }\n projection.stream = function(output) {\n if (stream) stream.valid = false;\n stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output))));\n stream.valid = true;\n return stream;\n };\n projection.clipAngle = function(_) {\n if (!arguments.length) return clipAngle;\n preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians);\n return invalidate();\n };\n projection.clipExtent = function(_) {\n if (!arguments.length) return clipExtent;\n clipExtent = _;\n postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity;\n return invalidate();\n };\n projection.scale = function(_) {\n if (!arguments.length) return k;\n k = +_;\n return reset();\n };\n projection.translate = function(_) {\n if (!arguments.length) return [ x, y ];\n x = +_[0];\n y = +_[1];\n return reset();\n };\n projection.center = function(_) {\n if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];\n λ = _[0] % 360 * d3_radians;\n φ = _[1] % 360 * d3_radians;\n return reset();\n };\n projection.rotate = function(_) {\n if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];\n δλ = _[0] % 360 * d3_radians;\n δφ = _[1] % 360 * d3_radians;\n δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;\n return reset();\n };\n d3.rebind(projection, projectResample, \"precision\");\n function reset() {\n projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);\n var center = project(λ, φ);\n δx = x - center[0] * k;\n δy = y + center[1] * k;\n return invalidate();\n }\n function invalidate() {\n if (stream) stream.valid = false, stream = null;\n return projection;\n }\n return function() {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return reset();\n };\n }\n function d3_geo_projectionRadians(stream) {\n return d3_geo_transformPoint(stream, function(x, y) {\n stream.point(x * d3_radians, y * d3_radians);\n });\n }\n function d3_geo_equirectangular(λ, φ) {\n return [ λ, φ ];\n }\n (d3.geo.equirectangular = function() {\n return d3_geo_projection(d3_geo_equirectangular);\n }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;\n d3.geo.rotation = function(rotate) {\n rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);\n return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;\n }\n forward.invert = function(coordinates) {\n coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);\n return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;\n };\n return forward;\n };\n function d3_geo_identityRotation(λ, φ) {\n return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];\n }\n d3_geo_identityRotation.invert = d3_geo_equirectangular;\n function d3_geo_rotation(δλ, δφ, δγ) {\n return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation;\n }\n function d3_geo_forwardRotationλ(δλ) {\n return function(λ, φ) {\n return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];\n };\n }\n function d3_geo_rotationλ(δλ) {\n var rotation = d3_geo_forwardRotationλ(δλ);\n rotation.invert = d3_geo_forwardRotationλ(-δλ);\n return rotation;\n }\n function d3_geo_rotationφγ(δφ, δγ) {\n var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);\n function rotation(λ, φ) {\n var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;\n return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ];\n }\n rotation.invert = function(λ, φ) {\n var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;\n return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ];\n };\n return rotation;\n }\n d3.geo.circle = function() {\n var origin = [ 0, 0 ], angle, precision = 6, interpolate;\n function circle() {\n var center = typeof origin === \"function\" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];\n interpolate(null, null, 1, {\n point: function(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= d3_degrees, x[1] *= d3_degrees;\n }\n });\n return {\n type: \"Polygon\",\n coordinates: [ ring ]\n };\n }\n circle.origin = function(x) {\n if (!arguments.length) return origin;\n origin = x;\n return circle;\n };\n circle.angle = function(x) {\n if (!arguments.length) return angle;\n interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);\n return circle;\n };\n circle.precision = function(_) {\n if (!arguments.length) return precision;\n interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);\n return circle;\n };\n return circle.angle(90);\n };\n function d3_geo_circleInterpolate(radius, precision) {\n var cr = Math.cos(radius), sr = Math.sin(radius);\n return function(from, to, direction, listener) {\n var step = direction * precision;\n if (from != null) {\n from = d3_geo_circleAngle(cr, from);\n to = d3_geo_circleAngle(cr, to);\n if (direction > 0 ? from < to : from > to) from += direction * τ;\n } else {\n from = radius + direction * τ;\n to = radius - .5 * step;\n }\n for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) {\n listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);\n }\n };\n }\n function d3_geo_circleAngle(cr, point) {\n var a = d3_geo_cartesian(point);\n a[0] -= cr;\n d3_geo_cartesianNormalize(a);\n var angle = d3_acos(-a[1]);\n return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);\n }\n d3.geo.distance = function(a, b) {\n var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t;\n return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);\n };\n d3.geo.graticule = function() {\n var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5;\n function graticule() {\n return {\n type: \"MultiLineString\",\n coordinates: lines()\n };\n }\n function lines() {\n return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) {\n return abs(x % DX) > ε;\n }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) {\n return abs(y % DY) > ε;\n }).map(y));\n }\n graticule.lines = function() {\n return lines().map(function(coordinates) {\n return {\n type: \"LineString\",\n coordinates: coordinates\n };\n });\n };\n graticule.outline = function() {\n return {\n type: \"Polygon\",\n coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ]\n };\n };\n graticule.extent = function(_) {\n if (!arguments.length) return graticule.minorExtent();\n return graticule.majorExtent(_).minorExtent(_);\n };\n graticule.majorExtent = function(_) {\n if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ];\n X0 = +_[0][0], X1 = +_[1][0];\n Y0 = +_[0][1], Y1 = +_[1][1];\n if (X0 > X1) _ = X0, X0 = X1, X1 = _;\n if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;\n return graticule.precision(precision);\n };\n graticule.minorExtent = function(_) {\n if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];\n x0 = +_[0][0], x1 = +_[1][0];\n y0 = +_[0][1], y1 = +_[1][1];\n if (x0 > x1) _ = x0, x0 = x1, x1 = _;\n if (y0 > y1) _ = y0, y0 = y1, y1 = _;\n return graticule.precision(precision);\n };\n graticule.step = function(_) {\n if (!arguments.length) return graticule.minorStep();\n return graticule.majorStep(_).minorStep(_);\n };\n graticule.majorStep = function(_) {\n if (!arguments.length) return [ DX, DY ];\n DX = +_[0], DY = +_[1];\n return graticule;\n };\n graticule.minorStep = function(_) {\n if (!arguments.length) return [ dx, dy ];\n dx = +_[0], dy = +_[1];\n return graticule;\n };\n graticule.precision = function(_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = d3_geo_graticuleX(y0, y1, 90);\n y = d3_geo_graticuleY(x0, x1, precision);\n X = d3_geo_graticuleX(Y0, Y1, 90);\n Y = d3_geo_graticuleY(X0, X1, precision);\n return graticule;\n };\n return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]);\n };\n function d3_geo_graticuleX(y0, y1, dy) {\n var y = d3.range(y0, y1 - ε, dy).concat(y1);\n return function(x) {\n return y.map(function(y) {\n return [ x, y ];\n });\n };\n }\n function d3_geo_graticuleY(x0, x1, dx) {\n var x = d3.range(x0, x1 - ε, dx).concat(x1);\n return function(y) {\n return x.map(function(x) {\n return [ x, y ];\n });\n };\n }\n function d3_source(d) {\n return d.source;\n }\n function d3_target(d) {\n return d.target;\n }\n d3.geo.greatArc = function() {\n var source = d3_source, source_, target = d3_target, target_;\n function greatArc() {\n return {\n type: \"LineString\",\n coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ]\n };\n }\n greatArc.distance = function() {\n return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments));\n };\n greatArc.source = function(_) {\n if (!arguments.length) return source;\n source = _, source_ = typeof _ === \"function\" ? null : _;\n return greatArc;\n };\n greatArc.target = function(_) {\n if (!arguments.length) return target;\n target = _, target_ = typeof _ === \"function\" ? null : _;\n return greatArc;\n };\n greatArc.precision = function() {\n return arguments.length ? greatArc : 0;\n };\n return greatArc;\n };\n d3.geo.interpolate = function(source, target) {\n return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);\n };\n function d3_geo_interpolate(x0, y0, x1, y1) {\n var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d);\n var interpolate = d ? function(t) {\n var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;\n return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];\n } : function() {\n return [ x0 * d3_degrees, y0 * d3_degrees ];\n };\n interpolate.distance = d;\n return interpolate;\n }\n d3.geo.length = function(object) {\n d3_geo_lengthSum = 0;\n d3.geo.stream(object, d3_geo_length);\n return d3_geo_lengthSum;\n };\n var d3_geo_lengthSum;\n var d3_geo_length = {\n sphere: d3_noop,\n point: d3_noop,\n lineStart: d3_geo_lengthLineStart,\n lineEnd: d3_noop,\n polygonStart: d3_noop,\n polygonEnd: d3_noop\n };\n function d3_geo_lengthLineStart() {\n var λ0, sinφ0, cosφ0;\n d3_geo_length.point = function(λ, φ) {\n λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ);\n d3_geo_length.point = nextPoint;\n };\n d3_geo_length.lineEnd = function() {\n d3_geo_length.point = d3_geo_length.lineEnd = d3_noop;\n };\n function nextPoint(λ, φ) {\n var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t);\n d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ);\n λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ;\n }\n }\n function d3_geo_azimuthal(scale, angle) {\n function azimuthal(λ, φ) {\n var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);\n return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];\n }\n azimuthal.invert = function(x, y) {\n var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);\n return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];\n };\n return azimuthal;\n }\n var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {\n return Math.sqrt(2 / (1 + cosλcosφ));\n }, function(ρ) {\n return 2 * Math.asin(ρ / 2);\n });\n (d3.geo.azimuthalEqualArea = function() {\n return d3_geo_projection(d3_geo_azimuthalEqualArea);\n }).raw = d3_geo_azimuthalEqualArea;\n var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {\n var c = Math.acos(cosλcosφ);\n return c && c / Math.sin(c);\n }, d3_identity);\n (d3.geo.azimuthalEquidistant = function() {\n return d3_geo_projection(d3_geo_azimuthalEquidistant);\n }).raw = d3_geo_azimuthalEquidistant;\n function d3_geo_conicConformal(φ0, φ1) {\n var cosφ0 = Math.cos(φ0), t = function(φ) {\n return Math.tan(π / 4 + φ / 2);\n }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n;\n if (!n) return d3_geo_mercator;\n function forward(λ, φ) {\n if (F > 0) {\n if (φ < -halfπ + ε) φ = -halfπ + ε;\n } else {\n if (φ > halfπ - ε) φ = halfπ - ε;\n }\n var ρ = F / Math.pow(t(φ), n);\n return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ];\n }\n forward.invert = function(x, y) {\n var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);\n return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ];\n };\n return forward;\n }\n (d3.geo.conicConformal = function() {\n return d3_geo_conic(d3_geo_conicConformal);\n }).raw = d3_geo_conicConformal;\n function d3_geo_conicEquidistant(φ0, φ1) {\n var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;\n if (abs(n) < ε) return d3_geo_equirectangular;\n function forward(λ, φ) {\n var ρ = G - φ;\n return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ];\n }\n forward.invert = function(x, y) {\n var ρ0_y = G - y;\n return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ];\n };\n return forward;\n }\n (d3.geo.conicEquidistant = function() {\n return d3_geo_conic(d3_geo_conicEquidistant);\n }).raw = d3_geo_conicEquidistant;\n var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {\n return 1 / cosλcosφ;\n }, Math.atan);\n (d3.geo.gnomonic = function() {\n return d3_geo_projection(d3_geo_gnomonic);\n }).raw = d3_geo_gnomonic;\n function d3_geo_mercator(λ, φ) {\n return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ];\n }\n d3_geo_mercator.invert = function(x, y) {\n return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ];\n };\n function d3_geo_mercatorProjection(project) {\n var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto;\n m.scale = function() {\n var v = scale.apply(m, arguments);\n return v === m ? clipAuto ? m.clipExtent(null) : m : v;\n };\n m.translate = function() {\n var v = translate.apply(m, arguments);\n return v === m ? clipAuto ? m.clipExtent(null) : m : v;\n };\n m.clipExtent = function(_) {\n var v = clipExtent.apply(m, arguments);\n if (v === m) {\n if (clipAuto = _ == null) {\n var k = π * scale(), t = translate();\n clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]);\n }\n } else if (clipAuto) {\n v = null;\n }\n return v;\n };\n return m.clipExtent(null);\n }\n (d3.geo.mercator = function() {\n return d3_geo_mercatorProjection(d3_geo_mercator);\n }).raw = d3_geo_mercator;\n var d3_geo_orthographic = d3_geo_azimuthal(function() {\n return 1;\n }, Math.asin);\n (d3.geo.orthographic = function() {\n return d3_geo_projection(d3_geo_orthographic);\n }).raw = d3_geo_orthographic;\n var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {\n return 1 / (1 + cosλcosφ);\n }, function(ρ) {\n return 2 * Math.atan(ρ);\n });\n (d3.geo.stereographic = function() {\n return d3_geo_projection(d3_geo_stereographic);\n }).raw = d3_geo_stereographic;\n function d3_geo_transverseMercator(λ, φ) {\n return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ];\n }\n d3_geo_transverseMercator.invert = function(x, y) {\n return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ];\n };\n (d3.geo.transverseMercator = function() {\n var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate;\n projection.center = function(_) {\n return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]);\n };\n projection.rotate = function(_) {\n return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), \n [ _[0], _[1], _[2] - 90 ]);\n };\n return rotate([ 0, 0, 90 ]);\n }).raw = d3_geo_transverseMercator;\n d3.geom = {};\n function d3_geom_pointX(d) {\n return d[0];\n }\n function d3_geom_pointY(d) {\n return d[1];\n }\n d3.geom.hull = function(vertices) {\n var x = d3_geom_pointX, y = d3_geom_pointY;\n if (arguments.length) return hull(vertices);\n function hull(data) {\n if (data.length < 3) return [];\n var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = [];\n for (i = 0; i < n; i++) {\n points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]);\n }\n points.sort(d3_geom_hullOrder);\n for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]);\n var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints);\n var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = [];\n for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]);\n for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]);\n return polygon;\n }\n hull.x = function(_) {\n return arguments.length ? (x = _, hull) : x;\n };\n hull.y = function(_) {\n return arguments.length ? (y = _, hull) : y;\n };\n return hull;\n };\n function d3_geom_hullUpper(points) {\n var n = points.length, hull = [ 0, 1 ], hs = 2;\n for (var i = 2; i < n; i++) {\n while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs;\n hull[hs++] = i;\n }\n return hull.slice(0, hs);\n }\n function d3_geom_hullOrder(a, b) {\n return a[0] - b[0] || a[1] - b[1];\n }\n d3.geom.polygon = function(coordinates) {\n d3_subclass(coordinates, d3_geom_polygonPrototype);\n return coordinates;\n };\n var d3_geom_polygonPrototype = d3.geom.polygon.prototype = [];\n d3_geom_polygonPrototype.area = function() {\n var i = -1, n = this.length, a, b = this[n - 1], area = 0;\n while (++i < n) {\n a = b;\n b = this[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n return area * .5;\n };\n d3_geom_polygonPrototype.centroid = function(k) {\n var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c;\n if (!arguments.length) k = -1 / (6 * this.area());\n while (++i < n) {\n a = b;\n b = this[i];\n c = a[0] * b[1] - b[0] * a[1];\n x += (a[0] + b[0]) * c;\n y += (a[1] + b[1]) * c;\n }\n return [ x * k, y * k ];\n };\n d3_geom_polygonPrototype.clip = function(subject) {\n 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;\n while (++i < n) {\n input = subject.slice();\n subject.length = 0;\n b = this[i];\n c = input[(m = input.length - closed) - 1];\n j = -1;\n while (++j < m) {\n d = input[j];\n if (d3_geom_polygonInside(d, a, b)) {\n if (!d3_geom_polygonInside(c, a, b)) {\n subject.push(d3_geom_polygonIntersect(c, d, a, b));\n }\n subject.push(d);\n } else if (d3_geom_polygonInside(c, a, b)) {\n subject.push(d3_geom_polygonIntersect(c, d, a, b));\n }\n c = d;\n }\n if (closed) subject.push(subject[0]);\n a = b;\n }\n return subject;\n };\n function d3_geom_polygonInside(p, a, b) {\n return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);\n }\n function d3_geom_polygonIntersect(c, d, a, b) {\n var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);\n return [ x1 + ua * x21, y1 + ua * y21 ];\n }\n function d3_geom_polygonClosed(coordinates) {\n var a = coordinates[0], b = coordinates[coordinates.length - 1];\n return !(a[0] - b[0] || a[1] - b[1]);\n }\n var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = [];\n function d3_geom_voronoiBeach() {\n d3_geom_voronoiRedBlackNode(this);\n this.edge = this.site = this.circle = null;\n }\n function d3_geom_voronoiCreateBeach(site) {\n var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach();\n beach.site = site;\n return beach;\n }\n function d3_geom_voronoiDetachBeach(beach) {\n d3_geom_voronoiDetachCircle(beach);\n d3_geom_voronoiBeaches.remove(beach);\n d3_geom_voronoiBeachPool.push(beach);\n d3_geom_voronoiRedBlackNode(beach);\n }\n function d3_geom_voronoiRemoveBeach(beach) {\n var circle = beach.circle, x = circle.x, y = circle.cy, vertex = {\n x: x,\n y: y\n }, previous = beach.P, next = beach.N, disappearing = [ beach ];\n d3_geom_voronoiDetachBeach(beach);\n var lArc = previous;\n while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) {\n previous = lArc.P;\n disappearing.unshift(lArc);\n d3_geom_voronoiDetachBeach(lArc);\n lArc = previous;\n }\n disappearing.unshift(lArc);\n d3_geom_voronoiDetachCircle(lArc);\n var rArc = next;\n while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) {\n next = rArc.N;\n disappearing.push(rArc);\n d3_geom_voronoiDetachBeach(rArc);\n rArc = next;\n }\n disappearing.push(rArc);\n d3_geom_voronoiDetachCircle(rArc);\n var nArcs = disappearing.length, iArc;\n for (iArc = 1; iArc < nArcs; ++iArc) {\n rArc = disappearing[iArc];\n lArc = disappearing[iArc - 1];\n d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);\n }\n lArc = disappearing[0];\n rArc = disappearing[nArcs - 1];\n rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex);\n d3_geom_voronoiAttachCircle(lArc);\n d3_geom_voronoiAttachCircle(rArc);\n }\n function d3_geom_voronoiAddBeach(site) {\n var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._;\n while (node) {\n dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x;\n if (dxl > ε) node = node.L; else {\n dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix);\n if (dxr > ε) {\n if (!node.R) {\n lArc = node;\n break;\n }\n node = node.R;\n } else {\n if (dxl > -ε) {\n lArc = node.P;\n rArc = node;\n } else if (dxr > -ε) {\n lArc = node;\n rArc = node.N;\n } else {\n lArc = rArc = node;\n }\n break;\n }\n }\n }\n var newArc = d3_geom_voronoiCreateBeach(site);\n d3_geom_voronoiBeaches.insert(lArc, newArc);\n if (!lArc && !rArc) return;\n if (lArc === rArc) {\n d3_geom_voronoiDetachCircle(lArc);\n rArc = d3_geom_voronoiCreateBeach(lArc.site);\n d3_geom_voronoiBeaches.insert(newArc, rArc);\n newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);\n d3_geom_voronoiAttachCircle(lArc);\n d3_geom_voronoiAttachCircle(rArc);\n return;\n }\n if (!rArc) {\n newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);\n return;\n }\n d3_geom_voronoiDetachCircle(lArc);\n d3_geom_voronoiDetachCircle(rArc);\n var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = {\n x: (cy * hb - by * hc) / d + ax,\n y: (bx * hc - cx * hb) / d + ay\n };\n d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);\n newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex);\n rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex);\n d3_geom_voronoiAttachCircle(lArc);\n d3_geom_voronoiAttachCircle(rArc);\n }\n function d3_geom_voronoiLeftBreakPoint(arc, directrix) {\n var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;\n if (!pby2) return rfocx;\n var lArc = arc.P;\n if (!lArc) return -Infinity;\n site = lArc.site;\n var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;\n if (!plby2) return lfocx;\n var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;\n if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;\n return (rfocx + lfocx) / 2;\n }\n function d3_geom_voronoiRightBreakPoint(arc, directrix) {\n var rArc = arc.N;\n if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix);\n var site = arc.site;\n return site.y === directrix ? site.x : Infinity;\n }\n function d3_geom_voronoiCell(site) {\n this.site = site;\n this.edges = [];\n }\n d3_geom_voronoiCell.prototype.prepare = function() {\n var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge;\n while (iHalfEdge--) {\n edge = halfEdges[iHalfEdge].edge;\n if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1);\n }\n halfEdges.sort(d3_geom_voronoiHalfEdgeOrder);\n return halfEdges.length;\n };\n function d3_geom_voronoiCloseCells(extent) {\n var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end;\n while (iCell--) {\n cell = cells[iCell];\n if (!cell || !cell.prepare()) continue;\n halfEdges = cell.edges;\n nHalfEdges = halfEdges.length;\n iHalfEdge = 0;\n while (iHalfEdge < nHalfEdges) {\n end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y;\n start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y;\n if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) {\n halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? {\n x: x0,\n y: abs(x2 - x0) < ε ? y2 : y1\n } : abs(y3 - y1) < ε && x1 - x3 > ε ? {\n x: abs(y2 - y1) < ε ? x2 : x1,\n y: y1\n } : abs(x3 - x1) < ε && y3 - y0 > ε ? {\n x: x1,\n y: abs(x2 - x1) < ε ? y2 : y0\n } : abs(y3 - y0) < ε && x3 - x0 > ε ? {\n x: abs(y2 - y0) < ε ? x2 : x0,\n y: y0\n } : null), cell.site, null));\n ++nHalfEdges;\n }\n }\n }\n }\n function d3_geom_voronoiHalfEdgeOrder(a, b) {\n return b.angle - a.angle;\n }\n function d3_geom_voronoiCircle() {\n d3_geom_voronoiRedBlackNode(this);\n this.x = this.y = this.arc = this.site = this.cy = null;\n }\n function d3_geom_voronoiAttachCircle(arc) {\n var lArc = arc.P, rArc = arc.N;\n if (!lArc || !rArc) return;\n var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;\n if (lSite === rSite) return;\n var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;\n var d = 2 * (ax * cy - ay * cx);\n if (d >= -ε2) return;\n var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by;\n var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle();\n circle.arc = arc;\n circle.site = cSite;\n circle.x = x + bx;\n circle.y = cy + Math.sqrt(x * x + y * y);\n circle.cy = cy;\n arc.circle = circle;\n var before = null, node = d3_geom_voronoiCircles._;\n while (node) {\n if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {\n if (node.L) node = node.L; else {\n before = node.P;\n break;\n }\n } else {\n if (node.R) node = node.R; else {\n before = node;\n break;\n }\n }\n }\n d3_geom_voronoiCircles.insert(before, circle);\n if (!before) d3_geom_voronoiFirstCircle = circle;\n }\n function d3_geom_voronoiDetachCircle(arc) {\n var circle = arc.circle;\n if (circle) {\n if (!circle.P) d3_geom_voronoiFirstCircle = circle.N;\n d3_geom_voronoiCircles.remove(circle);\n d3_geom_voronoiCirclePool.push(circle);\n d3_geom_voronoiRedBlackNode(circle);\n arc.circle = null;\n }\n }\n function d3_geom_voronoiClipEdges(extent) {\n 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;\n while (i--) {\n e = edges[i];\n if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) {\n e.a = e.b = null;\n edges.splice(i, 1);\n }\n }\n }\n function d3_geom_voronoiConnectEdge(edge, extent) {\n var vb = edge.b;\n if (vb) return true;\n var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;\n if (ry === ly) {\n if (fx < x0 || fx >= x1) return;\n if (lx > rx) {\n if (!va) va = {\n x: fx,\n y: y0\n }; else if (va.y >= y1) return;\n vb = {\n x: fx,\n y: y1\n };\n } else {\n if (!va) va = {\n x: fx,\n y: y1\n }; else if (va.y < y0) return;\n vb = {\n x: fx,\n y: y0\n };\n }\n } else {\n fm = (lx - rx) / (ry - ly);\n fb = fy - fm * fx;\n if (fm < -1 || fm > 1) {\n if (lx > rx) {\n if (!va) va = {\n x: (y0 - fb) / fm,\n y: y0\n }; else if (va.y >= y1) return;\n vb = {\n x: (y1 - fb) / fm,\n y: y1\n };\n } else {\n if (!va) va = {\n x: (y1 - fb) / fm,\n y: y1\n }; else if (va.y < y0) return;\n vb = {\n x: (y0 - fb) / fm,\n y: y0\n };\n }\n } else {\n if (ly < ry) {\n if (!va) va = {\n x: x0,\n y: fm * x0 + fb\n }; else if (va.x >= x1) return;\n vb = {\n x: x1,\n y: fm * x1 + fb\n };\n } else {\n if (!va) va = {\n x: x1,\n y: fm * x1 + fb\n }; else if (va.x < x0) return;\n vb = {\n x: x0,\n y: fm * x0 + fb\n };\n }\n }\n }\n edge.a = va;\n edge.b = vb;\n return true;\n }\n function d3_geom_voronoiEdge(lSite, rSite) {\n this.l = lSite;\n this.r = rSite;\n this.a = this.b = null;\n }\n function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) {\n var edge = new d3_geom_voronoiEdge(lSite, rSite);\n d3_geom_voronoiEdges.push(edge);\n if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va);\n if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb);\n d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite));\n d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite));\n return edge;\n }\n function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) {\n var edge = new d3_geom_voronoiEdge(lSite, null);\n edge.a = va;\n edge.b = vb;\n d3_geom_voronoiEdges.push(edge);\n return edge;\n }\n function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) {\n if (!edge.a && !edge.b) {\n edge.a = vertex;\n edge.l = lSite;\n edge.r = rSite;\n } else if (edge.l === rSite) {\n edge.b = vertex;\n } else {\n edge.a = vertex;\n }\n }\n function d3_geom_voronoiHalfEdge(edge, lSite, rSite) {\n var va = edge.a, vb = edge.b;\n this.edge = edge;\n this.site = lSite;\n this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y);\n }\n d3_geom_voronoiHalfEdge.prototype = {\n start: function() {\n return this.edge.l === this.site ? this.edge.a : this.edge.b;\n },\n end: function() {\n return this.edge.l === this.site ? this.edge.b : this.edge.a;\n }\n };\n function d3_geom_voronoiRedBlackTree() {\n this._ = null;\n }\n function d3_geom_voronoiRedBlackNode(node) {\n node.U = node.C = node.L = node.R = node.P = node.N = null;\n }\n d3_geom_voronoiRedBlackTree.prototype = {\n insert: function(after, node) {\n var parent, grandpa, uncle;\n if (after) {\n node.P = after;\n node.N = after.N;\n if (after.N) after.N.P = node;\n after.N = node;\n if (after.R) {\n after = after.R;\n while (after.L) after = after.L;\n after.L = node;\n } else {\n after.R = node;\n }\n parent = after;\n } else if (this._) {\n after = d3_geom_voronoiRedBlackFirst(this._);\n node.P = null;\n node.N = after;\n after.P = after.L = node;\n parent = after;\n } else {\n node.P = node.N = null;\n this._ = node;\n parent = null;\n }\n node.L = node.R = null;\n node.U = parent;\n node.C = true;\n after = node;\n while (parent && parent.C) {\n grandpa = parent.U;\n if (parent === grandpa.L) {\n uncle = grandpa.R;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.R) {\n d3_geom_voronoiRedBlackRotateLeft(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n d3_geom_voronoiRedBlackRotateRight(this, grandpa);\n }\n } else {\n uncle = grandpa.L;\n if (uncle && uncle.C) {\n parent.C = uncle.C = false;\n grandpa.C = true;\n after = grandpa;\n } else {\n if (after === parent.L) {\n d3_geom_voronoiRedBlackRotateRight(this, parent);\n after = parent;\n parent = after.U;\n }\n parent.C = false;\n grandpa.C = true;\n d3_geom_voronoiRedBlackRotateLeft(this, grandpa);\n }\n }\n parent = after.U;\n }\n this._.C = false;\n },\n remove: function(node) {\n if (node.N) node.N.P = node.P;\n if (node.P) node.P.N = node.N;\n node.N = node.P = null;\n var parent = node.U, sibling, left = node.L, right = node.R, next, red;\n if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right);\n if (parent) {\n if (parent.L === node) parent.L = next; else parent.R = next;\n } else {\n this._ = next;\n }\n if (left && right) {\n red = next.C;\n next.C = node.C;\n next.L = left;\n left.U = next;\n if (next !== right) {\n parent = next.U;\n next.U = node.U;\n node = next.R;\n parent.L = node;\n next.R = right;\n right.U = next;\n } else {\n next.U = parent;\n parent = next;\n node = next.R;\n }\n } else {\n red = node.C;\n node = next;\n }\n if (node) node.U = parent;\n if (red) return;\n if (node && node.C) {\n node.C = false;\n return;\n }\n do {\n if (node === this._) break;\n if (node === parent.L) {\n sibling = parent.R;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n d3_geom_voronoiRedBlackRotateLeft(this, parent);\n sibling = parent.R;\n }\n if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {\n if (!sibling.R || !sibling.R.C) {\n sibling.L.C = false;\n sibling.C = true;\n d3_geom_voronoiRedBlackRotateRight(this, sibling);\n sibling = parent.R;\n }\n sibling.C = parent.C;\n parent.C = sibling.R.C = false;\n d3_geom_voronoiRedBlackRotateLeft(this, parent);\n node = this._;\n break;\n }\n } else {\n sibling = parent.L;\n if (sibling.C) {\n sibling.C = false;\n parent.C = true;\n d3_geom_voronoiRedBlackRotateRight(this, parent);\n sibling = parent.L;\n }\n if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {\n if (!sibling.L || !sibling.L.C) {\n sibling.R.C = false;\n sibling.C = true;\n d3_geom_voronoiRedBlackRotateLeft(this, sibling);\n sibling = parent.L;\n }\n sibling.C = parent.C;\n parent.C = sibling.L.C = false;\n d3_geom_voronoiRedBlackRotateRight(this, parent);\n node = this._;\n break;\n }\n }\n sibling.C = true;\n node = parent;\n parent = parent.U;\n } while (!node.C);\n if (node) node.C = false;\n }\n };\n function d3_geom_voronoiRedBlackRotateLeft(tree, node) {\n var p = node, q = node.R, parent = p.U;\n if (parent) {\n if (parent.L === p) parent.L = q; else parent.R = q;\n } else {\n tree._ = q;\n }\n q.U = parent;\n p.U = q;\n p.R = q.L;\n if (p.R) p.R.U = p;\n q.L = p;\n }\n function d3_geom_voronoiRedBlackRotateRight(tree, node) {\n var p = node, q = node.L, parent = p.U;\n if (parent) {\n if (parent.L === p) parent.L = q; else parent.R = q;\n } else {\n tree._ = q;\n }\n q.U = parent;\n p.U = q;\n p.L = q.R;\n if (p.L) p.L.U = p;\n q.R = p;\n }\n function d3_geom_voronoiRedBlackFirst(node) {\n while (node.L) node = node.L;\n return node;\n }\n function d3_geom_voronoi(sites, bbox) {\n var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle;\n d3_geom_voronoiEdges = [];\n d3_geom_voronoiCells = new Array(sites.length);\n d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree();\n d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree();\n while (true) {\n circle = d3_geom_voronoiFirstCircle;\n if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) {\n if (site.x !== x0 || site.y !== y0) {\n d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site);\n d3_geom_voronoiAddBeach(site);\n x0 = site.x, y0 = site.y;\n }\n site = sites.pop();\n } else if (circle) {\n d3_geom_voronoiRemoveBeach(circle.arc);\n } else {\n break;\n }\n }\n if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox);\n var diagram = {\n cells: d3_geom_voronoiCells,\n edges: d3_geom_voronoiEdges\n };\n d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null;\n return diagram;\n }\n function d3_geom_voronoiVertexOrder(a, b) {\n return b.y - a.y || b.x - a.x;\n }\n d3.geom.voronoi = function(points) {\n var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;\n if (points) return voronoi(points);\n function voronoi(data) {\n var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1];\n d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) {\n var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) {\n var s = e.start();\n return [ s.x, s.y ];\n }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : [];\n polygon.point = data[i];\n });\n return polygons;\n }\n function sites(data) {\n return data.map(function(d, i) {\n return {\n x: Math.round(fx(d, i) / ε) * ε,\n y: Math.round(fy(d, i) / ε) * ε,\n i: i\n };\n });\n }\n voronoi.links = function(data) {\n return d3_geom_voronoi(sites(data)).edges.filter(function(edge) {\n return edge.l && edge.r;\n }).map(function(edge) {\n return {\n source: data[edge.l.i],\n target: data[edge.r.i]\n };\n });\n };\n voronoi.triangles = function(data) {\n var triangles = [];\n d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) {\n var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l;\n while (++j < m) {\n e0 = e1;\n s0 = s1;\n e1 = edges[j].edge;\n s1 = e1.l === site ? e1.r : e1.l;\n if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) {\n triangles.push([ data[i], data[s0.i], data[s1.i] ]);\n }\n }\n });\n return triangles;\n };\n voronoi.x = function(_) {\n return arguments.length ? (fx = d3_functor(x = _), voronoi) : x;\n };\n voronoi.y = function(_) {\n return arguments.length ? (fy = d3_functor(y = _), voronoi) : y;\n };\n voronoi.clipExtent = function(_) {\n if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent;\n clipExtent = _ == null ? d3_geom_voronoiClipExtent : _;\n return voronoi;\n };\n voronoi.size = function(_) {\n if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1];\n return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]);\n };\n return voronoi;\n };\n var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ];\n function d3_geom_voronoiTriangleArea(a, b, c) {\n return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);\n }\n d3.geom.delaunay = function(vertices) {\n return d3.geom.voronoi().triangles(vertices);\n };\n d3.geom.quadtree = function(points, x1, y1, x2, y2) {\n var x = d3_geom_pointX, y = d3_geom_pointY, compat;\n if (compat = arguments.length) {\n x = d3_geom_quadtreeCompatX;\n y = d3_geom_quadtreeCompatY;\n if (compat === 3) {\n y2 = y1;\n x2 = x1;\n y1 = x1 = 0;\n }\n return quadtree(points);\n }\n function quadtree(data) {\n var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_;\n if (x1 != null) {\n x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2;\n } else {\n x2_ = y2_ = -(x1_ = y1_ = Infinity);\n xs = [], ys = [];\n n = data.length;\n if (compat) for (i = 0; i < n; ++i) {\n d = data[i];\n if (d.x < x1_) x1_ = d.x;\n if (d.y < y1_) y1_ = d.y;\n if (d.x > x2_) x2_ = d.x;\n if (d.y > y2_) y2_ = d.y;\n xs.push(d.x);\n ys.push(d.y);\n } else for (i = 0; i < n; ++i) {\n var x_ = +fx(d = data[i], i), y_ = +fy(d, i);\n if (x_ < x1_) x1_ = x_;\n if (y_ < y1_) y1_ = y_;\n if (x_ > x2_) x2_ = x_;\n if (y_ > y2_) y2_ = y_;\n xs.push(x_);\n ys.push(y_);\n }\n }\n var dx = x2_ - x1_, dy = y2_ - y1_;\n if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy;\n function insert(n, d, x, y, x1, y1, x2, y2) {\n if (isNaN(x) || isNaN(y)) return;\n if (n.leaf) {\n var nx = n.x, ny = n.y;\n if (nx != null) {\n if (abs(nx - x) + abs(ny - y) < .01) {\n insertChild(n, d, x, y, x1, y1, x2, y2);\n } else {\n var nPoint = n.point;\n n.x = n.y = n.point = null;\n insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);\n insertChild(n, d, x, y, x1, y1, x2, y2);\n }\n } else {\n n.x = x, n.y = y, n.point = d;\n }\n } else {\n insertChild(n, d, x, y, x1, y1, x2, y2);\n }\n }\n function insertChild(n, d, x, y, x1, y1, x2, y2) {\n var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right;\n n.leaf = false;\n n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());\n if (right) x1 = xm; else x2 = xm;\n if (below) y1 = ym; else y2 = ym;\n insert(n, d, x, y, x1, y1, x2, y2);\n }\n var root = d3_geom_quadtreeNode();\n root.add = function(d) {\n insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_);\n };\n root.visit = function(f) {\n d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);\n };\n root.find = function(point) {\n return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_);\n };\n i = -1;\n if (x1 == null) {\n while (++i < n) {\n insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);\n }\n --i;\n } else data.forEach(root.add);\n xs = ys = data = d = null;\n return root;\n }\n quadtree.x = function(_) {\n return arguments.length ? (x = _, quadtree) : x;\n };\n quadtree.y = function(_) {\n return arguments.length ? (y = _, quadtree) : y;\n };\n quadtree.extent = function(_) {\n if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ];\n if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], \n y2 = +_[1][1];\n return quadtree;\n };\n quadtree.size = function(_) {\n if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ];\n if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1];\n return quadtree;\n };\n return quadtree;\n };\n function d3_geom_quadtreeCompatX(d) {\n return d.x;\n }\n function d3_geom_quadtreeCompatY(d) {\n return d.y;\n }\n function d3_geom_quadtreeNode() {\n return {\n leaf: true,\n nodes: [],\n point: null,\n x: null,\n y: null\n };\n }\n function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {\n if (!f(node, x1, y1, x2, y2)) {\n var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;\n if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);\n if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);\n if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);\n if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);\n }\n }\n function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) {\n var minDistance2 = Infinity, closestPoint;\n (function find(node, x1, y1, x2, y2) {\n if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) return;\n if (point = node.point) {\n var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy;\n if (distance2 < minDistance2) {\n var distance = Math.sqrt(minDistance2 = distance2);\n x0 = x - distance, y0 = y - distance;\n x3 = x + distance, y3 = y + distance;\n closestPoint = point;\n }\n }\n var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym;\n for (var i = below << 1 | right, j = i + 4; i < j; ++i) {\n if (node = children[i & 3]) switch (i & 3) {\n case 0:\n find(node, x1, y1, xm, ym);\n break;\n\n case 1:\n find(node, xm, y1, x2, ym);\n break;\n\n case 2:\n find(node, x1, ym, xm, y2);\n break;\n\n case 3:\n find(node, xm, ym, x2, y2);\n break;\n }\n }\n })(root, x0, y0, x3, y3);\n return closestPoint;\n }\n d3.interpolateRgb = d3_interpolateRgb;\n function d3_interpolateRgb(a, b) {\n a = d3.rgb(a);\n b = d3.rgb(b);\n var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;\n return function(t) {\n return \"#\" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));\n };\n }\n d3.interpolateObject = d3_interpolateObject;\n function d3_interpolateObject(a, b) {\n var i = {}, c = {}, k;\n for (k in a) {\n if (k in b) {\n i[k] = d3_interpolate(a[k], b[k]);\n } else {\n c[k] = a[k];\n }\n }\n for (k in b) {\n if (!(k in a)) {\n c[k] = b[k];\n }\n }\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n }\n d3.interpolateNumber = d3_interpolateNumber;\n function d3_interpolateNumber(a, b) {\n a = +a, b = +b;\n return function(t) {\n return a * (1 - t) + b * t;\n };\n }\n d3.interpolateString = d3_interpolateString;\n function d3_interpolateString(a, b) {\n var bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];\n a = a + \"\", b = b + \"\";\n while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) {\n if ((bs = bm.index) > bi) {\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) {\n if (s[i]) s[i] += bm; else s[++i] = bm;\n } else {\n s[++i] = null;\n q.push({\n i: i,\n x: d3_interpolateNumber(am, bm)\n });\n }\n bi = d3_interpolate_numberB.lastIndex;\n }\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; else s[++i] = bs;\n }\n return s.length < 2 ? q[0] ? (b = q[0].x, function(t) {\n return b(t) + \"\";\n }) : function() {\n return b;\n } : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n }\n var d3_interpolate_numberA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, \"g\");\n d3.interpolate = d3_interpolate;\n function d3_interpolate(a, b) {\n var i = d3.interpolators.length, f;\n while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;\n return f;\n }\n d3.interpolators = [ function(a, b) {\n var t = typeof b;\n 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);\n } ];\n d3.interpolateArray = d3_interpolateArray;\n function d3_interpolateArray(a, b) {\n var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;\n for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i]));\n for (;i < na; ++i) c[i] = a[i];\n for (;i < nb; ++i) c[i] = b[i];\n return function(t) {\n for (i = 0; i < n0; ++i) c[i] = x[i](t);\n return c;\n };\n }\n var d3_ease_default = function() {\n return d3_identity;\n };\n var d3_ease = d3.map({\n linear: d3_ease_default,\n poly: d3_ease_poly,\n quad: function() {\n return d3_ease_quad;\n },\n cubic: function() {\n return d3_ease_cubic;\n },\n sin: function() {\n return d3_ease_sin;\n },\n exp: function() {\n return d3_ease_exp;\n },\n circle: function() {\n return d3_ease_circle;\n },\n elastic: d3_ease_elastic,\n back: d3_ease_back,\n bounce: function() {\n return d3_ease_bounce;\n }\n });\n var d3_ease_mode = d3.map({\n \"in\": d3_identity,\n out: d3_ease_reverse,\n \"in-out\": d3_ease_reflect,\n \"out-in\": function(f) {\n return d3_ease_reflect(d3_ease_reverse(f));\n }\n });\n d3.ease = function(name) {\n var i = name.indexOf(\"-\"), t = i >= 0 ? name.slice(0, i) : name, m = i >= 0 ? name.slice(i + 1) : \"in\";\n t = d3_ease.get(t) || d3_ease_default;\n m = d3_ease_mode.get(m) || d3_identity;\n return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));\n };\n function d3_ease_clamp(f) {\n return function(t) {\n return t <= 0 ? 0 : t >= 1 ? 1 : f(t);\n };\n }\n function d3_ease_reverse(f) {\n return function(t) {\n return 1 - f(1 - t);\n };\n }\n function d3_ease_reflect(f) {\n return function(t) {\n return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));\n };\n }\n function d3_ease_quad(t) {\n return t * t;\n }\n function d3_ease_cubic(t) {\n return t * t * t;\n }\n function d3_ease_cubicInOut(t) {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n var t2 = t * t, t3 = t2 * t;\n return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);\n }\n function d3_ease_poly(e) {\n return function(t) {\n return Math.pow(t, e);\n };\n }\n function d3_ease_sin(t) {\n return 1 - Math.cos(t * halfπ);\n }\n function d3_ease_exp(t) {\n return Math.pow(2, 10 * (t - 1));\n }\n function d3_ease_circle(t) {\n return 1 - Math.sqrt(1 - t * t);\n }\n function d3_ease_elastic(a, p) {\n var s;\n if (arguments.length < 2) p = .45;\n if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4;\n return function(t) {\n return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p);\n };\n }\n function d3_ease_back(s) {\n if (!s) s = 1.70158;\n return function(t) {\n return t * t * ((s + 1) * t - s);\n };\n }\n function d3_ease_bounce(t) {\n return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;\n }\n d3.interpolateHcl = d3_interpolateHcl;\n function d3_interpolateHcl(a, b) {\n a = d3.hcl(a);\n b = d3.hcl(b);\n var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;\n if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;\n if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;\n return function(t) {\n return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + \"\";\n };\n }\n d3.interpolateHsl = d3_interpolateHsl;\n function d3_interpolateHsl(a, b) {\n a = d3.hsl(a);\n b = d3.hsl(b);\n var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al;\n if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;\n if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;\n return function(t) {\n return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + \"\";\n };\n }\n d3.interpolateLab = d3_interpolateLab;\n function d3_interpolateLab(a, b) {\n a = d3.lab(a);\n b = d3.lab(b);\n var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;\n return function(t) {\n return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + \"\";\n };\n }\n d3.interpolateRound = d3_interpolateRound;\n function d3_interpolateRound(a, b) {\n b -= a;\n return function(t) {\n return Math.round(a + b * t);\n };\n }\n d3.transform = function(string) {\n var g = d3_document.createElementNS(d3.ns.prefix.svg, \"g\");\n return (d3.transform = function(string) {\n if (string != null) {\n g.setAttribute(\"transform\", string);\n var t = g.transform.baseVal.consolidate();\n }\n return new d3_transform(t ? t.matrix : d3_transformIdentity);\n })(string);\n };\n function d3_transform(m) {\n var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;\n if (r0[0] * r1[1] < r1[0] * r0[1]) {\n r0[0] *= -1;\n r0[1] *= -1;\n kx *= -1;\n kz *= -1;\n }\n this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;\n this.translate = [ m.e, m.f ];\n this.scale = [ kx, ky ];\n this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;\n }\n d3_transform.prototype.toString = function() {\n return \"translate(\" + this.translate + \")rotate(\" + this.rotate + \")skewX(\" + this.skew + \")scale(\" + this.scale + \")\";\n };\n function d3_transformDot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n }\n function d3_transformNormalize(a) {\n var k = Math.sqrt(d3_transformDot(a, a));\n if (k) {\n a[0] /= k;\n a[1] /= k;\n }\n return k;\n }\n function d3_transformCombine(a, b, k) {\n a[0] += k * b[0];\n a[1] += k * b[1];\n return a;\n }\n var d3_transformIdentity = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0\n };\n d3.interpolateTransform = d3_interpolateTransform;\n function d3_interpolateTransformPop(s) {\n return s.length ? s.pop() + \",\" : \"\";\n }\n function d3_interpolateTranslate(ta, tb, s, q) {\n if (ta[0] !== tb[0] || ta[1] !== tb[1]) {\n var i = s.push(\"translate(\", null, \",\", null, \")\");\n q.push({\n i: i - 4,\n x: d3_interpolateNumber(ta[0], tb[0])\n }, {\n i: i - 2,\n x: d3_interpolateNumber(ta[1], tb[1])\n });\n } else if (tb[0] || tb[1]) {\n s.push(\"translate(\" + tb + \")\");\n }\n }\n function d3_interpolateRotate(ra, rb, s, q) {\n if (ra !== rb) {\n if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;\n q.push({\n i: s.push(d3_interpolateTransformPop(s) + \"rotate(\", null, \")\") - 2,\n x: d3_interpolateNumber(ra, rb)\n });\n } else if (rb) {\n s.push(d3_interpolateTransformPop(s) + \"rotate(\" + rb + \")\");\n }\n }\n function d3_interpolateSkew(wa, wb, s, q) {\n if (wa !== wb) {\n q.push({\n i: s.push(d3_interpolateTransformPop(s) + \"skewX(\", null, \")\") - 2,\n x: d3_interpolateNumber(wa, wb)\n });\n } else if (wb) {\n s.push(d3_interpolateTransformPop(s) + \"skewX(\" + wb + \")\");\n }\n }\n function d3_interpolateScale(ka, kb, s, q) {\n if (ka[0] !== kb[0] || ka[1] !== kb[1]) {\n var i = s.push(d3_interpolateTransformPop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({\n i: i - 4,\n x: d3_interpolateNumber(ka[0], kb[0])\n }, {\n i: i - 2,\n x: d3_interpolateNumber(ka[1], kb[1])\n });\n } else if (kb[0] !== 1 || kb[1] !== 1) {\n s.push(d3_interpolateTransformPop(s) + \"scale(\" + kb + \")\");\n }\n }\n function d3_interpolateTransform(a, b) {\n var s = [], q = [];\n a = d3.transform(a), b = d3.transform(b);\n d3_interpolateTranslate(a.translate, b.translate, s, q);\n d3_interpolateRotate(a.rotate, b.rotate, s, q);\n d3_interpolateSkew(a.skew, b.skew, s, q);\n d3_interpolateScale(a.scale, b.scale, s, q);\n a = b = null;\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n }\n function d3_uninterpolateNumber(a, b) {\n b = (b -= a = +a) || 1 / b;\n return function(x) {\n return (x - a) / b;\n };\n }\n function d3_uninterpolateClamp(a, b) {\n b = (b -= a = +a) || 1 / b;\n return function(x) {\n return Math.max(0, Math.min(1, (x - a) / b));\n };\n }\n d3.layout = {};\n d3.layout.bundle = function() {\n return function(links) {\n var paths = [], i = -1, n = links.length;\n while (++i < n) paths.push(d3_layout_bundlePath(links[i]));\n return paths;\n };\n };\n function d3_layout_bundlePath(link) {\n var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];\n while (start !== lca) {\n start = start.parent;\n points.push(start);\n }\n var k = points.length;\n while (end !== lca) {\n points.splice(k, 0, end);\n end = end.parent;\n }\n return points;\n }\n function d3_layout_bundleAncestors(node) {\n var ancestors = [], parent = node.parent;\n while (parent != null) {\n ancestors.push(node);\n node = parent;\n parent = parent.parent;\n }\n ancestors.push(node);\n return ancestors;\n }\n function d3_layout_bundleLeastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;\n while (aNode === bNode) {\n sharedNode = aNode;\n aNode = aNodes.pop();\n bNode = bNodes.pop();\n }\n return sharedNode;\n }\n d3.layout.chord = function() {\n var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;\n function relayout() {\n var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;\n chords = [];\n groups = [];\n k = 0, i = -1;\n while (++i < n) {\n x = 0, j = -1;\n while (++j < n) {\n x += matrix[i][j];\n }\n groupSums.push(x);\n subgroupIndex.push(d3.range(n));\n k += x;\n }\n if (sortGroups) {\n groupIndex.sort(function(a, b) {\n return sortGroups(groupSums[a], groupSums[b]);\n });\n }\n if (sortSubgroups) {\n subgroupIndex.forEach(function(d, i) {\n d.sort(function(a, b) {\n return sortSubgroups(matrix[i][a], matrix[i][b]);\n });\n });\n }\n k = (τ - padding * n) / k;\n x = 0, i = -1;\n while (++i < n) {\n x0 = x, j = -1;\n while (++j < n) {\n var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;\n subgroups[di + \"-\" + dj] = {\n index: di,\n subindex: dj,\n startAngle: a0,\n endAngle: a1,\n value: v\n };\n }\n groups[di] = {\n index: di,\n startAngle: x0,\n endAngle: x,\n value: groupSums[di]\n };\n x += padding;\n }\n i = -1;\n while (++i < n) {\n j = i - 1;\n while (++j < n) {\n var source = subgroups[i + \"-\" + j], target = subgroups[j + \"-\" + i];\n if (source.value || target.value) {\n chords.push(source.value < target.value ? {\n source: target,\n target: source\n } : {\n source: source,\n target: target\n });\n }\n }\n }\n if (sortChords) resort();\n }\n function resort() {\n chords.sort(function(a, b) {\n return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);\n });\n }\n chord.matrix = function(x) {\n if (!arguments.length) return matrix;\n n = (matrix = x) && matrix.length;\n chords = groups = null;\n return chord;\n };\n chord.padding = function(x) {\n if (!arguments.length) return padding;\n padding = x;\n chords = groups = null;\n return chord;\n };\n chord.sortGroups = function(x) {\n if (!arguments.length) return sortGroups;\n sortGroups = x;\n chords = groups = null;\n return chord;\n };\n chord.sortSubgroups = function(x) {\n if (!arguments.length) return sortSubgroups;\n sortSubgroups = x;\n chords = null;\n return chord;\n };\n chord.sortChords = function(x) {\n if (!arguments.length) return sortChords;\n sortChords = x;\n if (chords) resort();\n return chord;\n };\n chord.chords = function() {\n if (!chords) relayout();\n return chords;\n };\n chord.groups = function() {\n if (!groups) relayout();\n return groups;\n };\n return chord;\n };\n d3.layout.force = function() {\n var force = {}, event = d3.dispatch(\"start\", \"tick\", \"end\"), timer, size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges;\n function repulse(node) {\n return function(quad, x1, _, x2) {\n if (quad.point !== node) {\n var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy;\n if (dw * dw / theta2 < dn) {\n if (dn < chargeDistance2) {\n var k = quad.charge / dn;\n node.px -= dx * k;\n node.py -= dy * k;\n }\n return true;\n }\n if (quad.point && dn && dn < chargeDistance2) {\n var k = quad.pointCharge / dn;\n node.px -= dx * k;\n node.py -= dy * k;\n }\n }\n return !quad.charge;\n };\n }\n force.tick = function() {\n if ((alpha *= .99) < .005) {\n timer = null;\n event.end({\n type: \"end\",\n alpha: alpha = 0\n });\n return true;\n }\n var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;\n for (i = 0; i < m; ++i) {\n o = links[i];\n s = o.source;\n t = o.target;\n x = t.x - s.x;\n y = t.y - s.y;\n if (l = x * x + y * y) {\n l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;\n x *= l;\n y *= l;\n t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5);\n t.y -= y * k;\n s.x += x * (k = 1 - k);\n s.y += y * k;\n }\n }\n if (k = alpha * gravity) {\n x = size[0] / 2;\n y = size[1] / 2;\n i = -1;\n if (k) while (++i < n) {\n o = nodes[i];\n o.x += (x - o.x) * k;\n o.y += (y - o.y) * k;\n }\n }\n if (charge) {\n d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);\n i = -1;\n while (++i < n) {\n if (!(o = nodes[i]).fixed) {\n q.visit(repulse(o));\n }\n }\n }\n i = -1;\n while (++i < n) {\n o = nodes[i];\n if (o.fixed) {\n o.x = o.px;\n o.y = o.py;\n } else {\n o.x -= (o.px - (o.px = o.x)) * friction;\n o.y -= (o.py - (o.py = o.y)) * friction;\n }\n }\n event.tick({\n type: \"tick\",\n alpha: alpha\n });\n };\n force.nodes = function(x) {\n if (!arguments.length) return nodes;\n nodes = x;\n return force;\n };\n force.links = function(x) {\n if (!arguments.length) return links;\n links = x;\n return force;\n };\n force.size = function(x) {\n if (!arguments.length) return size;\n size = x;\n return force;\n };\n force.linkDistance = function(x) {\n if (!arguments.length) return linkDistance;\n linkDistance = typeof x === \"function\" ? x : +x;\n return force;\n };\n force.distance = force.linkDistance;\n force.linkStrength = function(x) {\n if (!arguments.length) return linkStrength;\n linkStrength = typeof x === \"function\" ? x : +x;\n return force;\n };\n force.friction = function(x) {\n if (!arguments.length) return friction;\n friction = +x;\n return force;\n };\n force.charge = function(x) {\n if (!arguments.length) return charge;\n charge = typeof x === \"function\" ? x : +x;\n return force;\n };\n force.chargeDistance = function(x) {\n if (!arguments.length) return Math.sqrt(chargeDistance2);\n chargeDistance2 = x * x;\n return force;\n };\n force.gravity = function(x) {\n if (!arguments.length) return gravity;\n gravity = +x;\n return force;\n };\n force.theta = function(x) {\n if (!arguments.length) return Math.sqrt(theta2);\n theta2 = x * x;\n return force;\n };\n force.alpha = function(x) {\n if (!arguments.length) return alpha;\n x = +x;\n if (alpha) {\n if (x > 0) {\n alpha = x;\n } else {\n timer.c = null, timer.t = NaN, timer = null;\n event.end({\n type: \"end\",\n alpha: alpha = 0\n });\n }\n } else if (x > 0) {\n event.start({\n type: \"start\",\n alpha: alpha = x\n });\n timer = d3_timer(force.tick);\n }\n return force;\n };\n force.start = function() {\n var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;\n for (i = 0; i < n; ++i) {\n (o = nodes[i]).index = i;\n o.weight = 0;\n }\n for (i = 0; i < m; ++i) {\n o = links[i];\n if (typeof o.source == \"number\") o.source = nodes[o.source];\n if (typeof o.target == \"number\") o.target = nodes[o.target];\n ++o.source.weight;\n ++o.target.weight;\n }\n for (i = 0; i < n; ++i) {\n o = nodes[i];\n if (isNaN(o.x)) o.x = position(\"x\", w);\n if (isNaN(o.y)) o.y = position(\"y\", h);\n if (isNaN(o.px)) o.px = o.x;\n if (isNaN(o.py)) o.py = o.y;\n }\n distances = [];\n 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;\n strengths = [];\n 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;\n charges = [];\n 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;\n function position(dimension, size) {\n if (!neighbors) {\n neighbors = new Array(n);\n for (j = 0; j < n; ++j) {\n neighbors[j] = [];\n }\n for (j = 0; j < m; ++j) {\n var o = links[j];\n neighbors[o.source.index].push(o.target);\n neighbors[o.target.index].push(o.source);\n }\n }\n var candidates = neighbors[i], j = -1, l = candidates.length, x;\n while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x;\n return Math.random() * size;\n }\n return force.resume();\n };\n force.resume = function() {\n return force.alpha(.1);\n };\n force.stop = function() {\n return force.alpha(0);\n };\n force.drag = function() {\n 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);\n if (!arguments.length) return drag;\n this.on(\"mouseover.force\", d3_layout_forceMouseover).on(\"mouseout.force\", d3_layout_forceMouseout).call(drag);\n };\n function dragmove(d) {\n d.px = d3.event.x, d.py = d3.event.y;\n force.resume();\n }\n return d3.rebind(force, event, \"on\");\n };\n function d3_layout_forceDragstart(d) {\n d.fixed |= 2;\n }\n function d3_layout_forceDragend(d) {\n d.fixed &= ~6;\n }\n function d3_layout_forceMouseover(d) {\n d.fixed |= 4;\n d.px = d.x, d.py = d.y;\n }\n function d3_layout_forceMouseout(d) {\n d.fixed &= ~4;\n }\n function d3_layout_forceAccumulate(quad, alpha, charges) {\n var cx = 0, cy = 0;\n quad.charge = 0;\n if (!quad.leaf) {\n var nodes = quad.nodes, n = nodes.length, i = -1, c;\n while (++i < n) {\n c = nodes[i];\n if (c == null) continue;\n d3_layout_forceAccumulate(c, alpha, charges);\n quad.charge += c.charge;\n cx += c.charge * c.cx;\n cy += c.charge * c.cy;\n }\n }\n if (quad.point) {\n if (!quad.leaf) {\n quad.point.x += Math.random() - .5;\n quad.point.y += Math.random() - .5;\n }\n var k = alpha * charges[quad.point.index];\n quad.charge += quad.pointCharge = k;\n cx += k * quad.point.x;\n cy += k * quad.point.y;\n }\n quad.cx = cx / quad.charge;\n quad.cy = cy / quad.charge;\n }\n var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity;\n d3.layout.hierarchy = function() {\n var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;\n function hierarchy(root) {\n var stack = [ root ], nodes = [], node;\n root.depth = 0;\n while ((node = stack.pop()) != null) {\n nodes.push(node);\n if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) {\n var n, childs, child;\n while (--n >= 0) {\n stack.push(child = childs[n]);\n child.parent = node;\n child.depth = node.depth + 1;\n }\n if (value) node.value = 0;\n node.children = childs;\n } else {\n if (value) node.value = +value.call(hierarchy, node, node.depth) || 0;\n delete node.children;\n }\n }\n d3_layout_hierarchyVisitAfter(root, function(node) {\n var childs, parent;\n if (sort && (childs = node.children)) childs.sort(sort);\n if (value && (parent = node.parent)) parent.value += node.value;\n });\n return nodes;\n }\n hierarchy.sort = function(x) {\n if (!arguments.length) return sort;\n sort = x;\n return hierarchy;\n };\n hierarchy.children = function(x) {\n if (!arguments.length) return children;\n children = x;\n return hierarchy;\n };\n hierarchy.value = function(x) {\n if (!arguments.length) return value;\n value = x;\n return hierarchy;\n };\n hierarchy.revalue = function(root) {\n if (value) {\n d3_layout_hierarchyVisitBefore(root, function(node) {\n if (node.children) node.value = 0;\n });\n d3_layout_hierarchyVisitAfter(root, function(node) {\n var parent;\n if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0;\n if (parent = node.parent) parent.value += node.value;\n });\n }\n return root;\n };\n return hierarchy;\n };\n function d3_layout_hierarchyRebind(object, hierarchy) {\n d3.rebind(object, hierarchy, \"sort\", \"children\", \"value\");\n object.nodes = object;\n object.links = d3_layout_hierarchyLinks;\n return object;\n }\n function d3_layout_hierarchyVisitBefore(node, callback) {\n var nodes = [ node ];\n while ((node = nodes.pop()) != null) {\n callback(node);\n if ((children = node.children) && (n = children.length)) {\n var n, children;\n while (--n >= 0) nodes.push(children[n]);\n }\n }\n }\n function d3_layout_hierarchyVisitAfter(node, callback) {\n var nodes = [ node ], nodes2 = [];\n while ((node = nodes.pop()) != null) {\n nodes2.push(node);\n if ((children = node.children) && (n = children.length)) {\n var i = -1, n, children;\n while (++i < n) nodes.push(children[i]);\n }\n }\n while ((node = nodes2.pop()) != null) {\n callback(node);\n }\n }\n function d3_layout_hierarchyChildren(d) {\n return d.children;\n }\n function d3_layout_hierarchyValue(d) {\n return d.value;\n }\n function d3_layout_hierarchySort(a, b) {\n return b.value - a.value;\n }\n function d3_layout_hierarchyLinks(nodes) {\n return d3.merge(nodes.map(function(parent) {\n return (parent.children || []).map(function(child) {\n return {\n source: parent,\n target: child\n };\n });\n }));\n }\n d3.layout.partition = function() {\n var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];\n function position(node, x, dx, dy) {\n var children = node.children;\n node.x = x;\n node.y = node.depth * dy;\n node.dx = dx;\n node.dy = dy;\n if (children && (n = children.length)) {\n var i = -1, n, c, d;\n dx = node.value ? dx / node.value : 0;\n while (++i < n) {\n position(c = children[i], x, d = c.value * dx, dy);\n x += d;\n }\n }\n }\n function depth(node) {\n var children = node.children, d = 0;\n if (children && (n = children.length)) {\n var i = -1, n;\n while (++i < n) d = Math.max(d, depth(children[i]));\n }\n return 1 + d;\n }\n function partition(d, i) {\n var nodes = hierarchy.call(this, d, i);\n position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));\n return nodes;\n }\n partition.size = function(x) {\n if (!arguments.length) return size;\n size = x;\n return partition;\n };\n return d3_layout_hierarchyRebind(partition, hierarchy);\n };\n d3.layout.pie = function() {\n var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ, padAngle = 0;\n function pie(data) {\n var n = data.length, values = data.map(function(d, i) {\n return +value.call(pie, d, i);\n }), a = +(typeof startAngle === \"function\" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === \"function\" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === \"function\" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v;\n if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {\n return values[j] - values[i];\n } : function(i, j) {\n return sort(data[i], data[j]);\n });\n index.forEach(function(i) {\n arcs[i] = {\n data: data[i],\n value: v = values[i],\n startAngle: a,\n endAngle: a += v * k + pa,\n padAngle: p\n };\n });\n return arcs;\n }\n pie.value = function(_) {\n if (!arguments.length) return value;\n value = _;\n return pie;\n };\n pie.sort = function(_) {\n if (!arguments.length) return sort;\n sort = _;\n return pie;\n };\n pie.startAngle = function(_) {\n if (!arguments.length) return startAngle;\n startAngle = _;\n return pie;\n };\n pie.endAngle = function(_) {\n if (!arguments.length) return endAngle;\n endAngle = _;\n return pie;\n };\n pie.padAngle = function(_) {\n if (!arguments.length) return padAngle;\n padAngle = _;\n return pie;\n };\n return pie;\n };\n var d3_layout_pieSortByValue = {};\n d3.layout.stack = function() {\n var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;\n function stack(data, index) {\n if (!(n = data.length)) return data;\n var series = data.map(function(d, i) {\n return values.call(stack, d, i);\n });\n var points = series.map(function(d) {\n return d.map(function(v, i) {\n return [ x.call(stack, v, i), y.call(stack, v, i) ];\n });\n });\n var orders = order.call(stack, points, index);\n series = d3.permute(series, orders);\n points = d3.permute(points, orders);\n var offsets = offset.call(stack, points, index);\n var m = series[0].length, n, i, j, o;\n for (j = 0; j < m; ++j) {\n out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);\n for (i = 1; i < n; ++i) {\n out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);\n }\n }\n return data;\n }\n stack.values = function(x) {\n if (!arguments.length) return values;\n values = x;\n return stack;\n };\n stack.order = function(x) {\n if (!arguments.length) return order;\n order = typeof x === \"function\" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;\n return stack;\n };\n stack.offset = function(x) {\n if (!arguments.length) return offset;\n offset = typeof x === \"function\" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;\n return stack;\n };\n stack.x = function(z) {\n if (!arguments.length) return x;\n x = z;\n return stack;\n };\n stack.y = function(z) {\n if (!arguments.length) return y;\n y = z;\n return stack;\n };\n stack.out = function(z) {\n if (!arguments.length) return out;\n out = z;\n return stack;\n };\n return stack;\n };\n function d3_layout_stackX(d) {\n return d.x;\n }\n function d3_layout_stackY(d) {\n return d.y;\n }\n function d3_layout_stackOut(d, y0, y) {\n d.y0 = y0;\n d.y = y;\n }\n var d3_layout_stackOrders = d3.map({\n \"inside-out\": function(data) {\n 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) {\n return max[a] - max[b];\n }), top = 0, bottom = 0, tops = [], bottoms = [];\n for (i = 0; i < n; ++i) {\n j = index[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n return bottoms.reverse().concat(tops);\n },\n reverse: function(data) {\n return d3.range(data.length).reverse();\n },\n \"default\": d3_layout_stackOrderDefault\n });\n var d3_layout_stackOffsets = d3.map({\n silhouette: function(data) {\n var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];\n for (j = 0; j < m; ++j) {\n for (i = 0, o = 0; i < n; i++) o += data[i][j][1];\n if (o > max) max = o;\n sums.push(o);\n }\n for (j = 0; j < m; ++j) {\n y0[j] = (max - sums[j]) / 2;\n }\n return y0;\n },\n wiggle: function(data) {\n var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];\n y0[0] = o = o0 = 0;\n for (j = 1; j < m; ++j) {\n for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];\n for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {\n for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {\n s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;\n }\n s2 += s3 * data[i][j][1];\n }\n y0[j] = o -= s1 ? s2 / s1 * dx : 0;\n if (o < o0) o0 = o;\n }\n for (j = 0; j < m; ++j) y0[j] -= o0;\n return y0;\n },\n expand: function(data) {\n var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];\n for (j = 0; j < m; ++j) {\n for (i = 0, o = 0; i < n; i++) o += data[i][j][1];\n 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;\n }\n for (j = 0; j < m; ++j) y0[j] = 0;\n return y0;\n },\n zero: d3_layout_stackOffsetZero\n });\n function d3_layout_stackOrderDefault(data) {\n return d3.range(data.length);\n }\n function d3_layout_stackOffsetZero(data) {\n var j = -1, m = data[0].length, y0 = [];\n while (++j < m) y0[j] = 0;\n return y0;\n }\n function d3_layout_stackMaxIndex(array) {\n var i = 1, j = 0, v = array[0][1], k, n = array.length;\n for (;i < n; ++i) {\n if ((k = array[i][1]) > v) {\n j = i;\n v = k;\n }\n }\n return j;\n }\n function d3_layout_stackReduceSum(d) {\n return d.reduce(d3_layout_stackSum, 0);\n }\n function d3_layout_stackSum(p, d) {\n return p + d[1];\n }\n d3.layout.histogram = function() {\n var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;\n function histogram(data, i) {\n 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;\n while (++i < m) {\n bin = bins[i] = [];\n bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);\n bin.y = 0;\n }\n if (m > 0) {\n i = -1;\n while (++i < n) {\n x = values[i];\n if (x >= range[0] && x <= range[1]) {\n bin = bins[d3.bisect(thresholds, x, 1, m) - 1];\n bin.y += k;\n bin.push(data[i]);\n }\n }\n }\n return bins;\n }\n histogram.value = function(x) {\n if (!arguments.length) return valuer;\n valuer = x;\n return histogram;\n };\n histogram.range = function(x) {\n if (!arguments.length) return ranger;\n ranger = d3_functor(x);\n return histogram;\n };\n histogram.bins = function(x) {\n if (!arguments.length) return binner;\n binner = typeof x === \"number\" ? function(range) {\n return d3_layout_histogramBinFixed(range, x);\n } : d3_functor(x);\n return histogram;\n };\n histogram.frequency = function(x) {\n if (!arguments.length) return frequency;\n frequency = !!x;\n return histogram;\n };\n return histogram;\n };\n function d3_layout_histogramBinSturges(range, values) {\n return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));\n }\n function d3_layout_histogramBinFixed(range, n) {\n var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];\n while (++x <= n) f[x] = m * x + b;\n return f;\n }\n function d3_layout_histogramRange(values) {\n return [ d3.min(values), d3.max(values) ];\n }\n d3.layout.pack = function() {\n var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius;\n function pack(d, i) {\n 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() {\n return radius;\n };\n root.x = root.y = 0;\n d3_layout_hierarchyVisitAfter(root, function(d) {\n d.r = +r(d.value);\n });\n d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings);\n if (padding) {\n var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2;\n d3_layout_hierarchyVisitAfter(root, function(d) {\n d.r += dr;\n });\n d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings);\n d3_layout_hierarchyVisitAfter(root, function(d) {\n d.r -= dr;\n });\n }\n d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h));\n return nodes;\n }\n pack.size = function(_) {\n if (!arguments.length) return size;\n size = _;\n return pack;\n };\n pack.radius = function(_) {\n if (!arguments.length) return radius;\n radius = _ == null || typeof _ === \"function\" ? _ : +_;\n return pack;\n };\n pack.padding = function(_) {\n if (!arguments.length) return padding;\n padding = +_;\n return pack;\n };\n return d3_layout_hierarchyRebind(pack, hierarchy);\n };\n function d3_layout_packSort(a, b) {\n return a.value - b.value;\n }\n function d3_layout_packInsert(a, b) {\n var c = a._pack_next;\n a._pack_next = b;\n b._pack_prev = a;\n b._pack_next = c;\n c._pack_prev = b;\n }\n function d3_layout_packSplice(a, b) {\n a._pack_next = b;\n b._pack_prev = a;\n }\n function d3_layout_packIntersects(a, b) {\n var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;\n return .999 * dr * dr > dx * dx + dy * dy;\n }\n function d3_layout_packSiblings(node) {\n if (!(nodes = node.children) || !(n = nodes.length)) return;\n var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;\n function bound(node) {\n xMin = Math.min(node.x - node.r, xMin);\n xMax = Math.max(node.x + node.r, xMax);\n yMin = Math.min(node.y - node.r, yMin);\n yMax = Math.max(node.y + node.r, yMax);\n }\n nodes.forEach(d3_layout_packLink);\n a = nodes[0];\n a.x = -a.r;\n a.y = 0;\n bound(a);\n if (n > 1) {\n b = nodes[1];\n b.x = b.r;\n b.y = 0;\n bound(b);\n if (n > 2) {\n c = nodes[2];\n d3_layout_packPlace(a, b, c);\n bound(c);\n d3_layout_packInsert(a, c);\n a._pack_prev = c;\n d3_layout_packInsert(c, b);\n b = a._pack_next;\n for (i = 3; i < n; i++) {\n d3_layout_packPlace(a, b, c = nodes[i]);\n var isect = 0, s1 = 1, s2 = 1;\n for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {\n if (d3_layout_packIntersects(j, c)) {\n isect = 1;\n break;\n }\n }\n if (isect == 1) {\n for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {\n if (d3_layout_packIntersects(k, c)) {\n break;\n }\n }\n }\n if (isect) {\n if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);\n i--;\n } else {\n d3_layout_packInsert(a, c);\n b = c;\n bound(c);\n }\n }\n }\n }\n var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;\n for (i = 0; i < n; i++) {\n c = nodes[i];\n c.x -= cx;\n c.y -= cy;\n cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));\n }\n node.r = cr;\n nodes.forEach(d3_layout_packUnlink);\n }\n function d3_layout_packLink(node) {\n node._pack_next = node._pack_prev = node;\n }\n function d3_layout_packUnlink(node) {\n delete node._pack_next;\n delete node._pack_prev;\n }\n function d3_layout_packTransform(node, x, y, k) {\n var children = node.children;\n node.x = x += k * node.x;\n node.y = y += k * node.y;\n node.r *= k;\n if (children) {\n var i = -1, n = children.length;\n while (++i < n) d3_layout_packTransform(children[i], x, y, k);\n }\n }\n function d3_layout_packPlace(a, b, c) {\n var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;\n if (db && (dx || dy)) {\n var da = b.r + c.r, dc = dx * dx + dy * dy;\n da *= da;\n db *= db;\n var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);\n c.x = a.x + x * dx + y * dy;\n c.y = a.y + x * dy - y * dx;\n } else {\n c.x = a.x + db;\n c.y = a.y;\n }\n }\n d3.layout.tree = function() {\n var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = null;\n function tree(d, i) {\n var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0);\n d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z;\n d3_layout_hierarchyVisitBefore(root1, secondWalk);\n if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode); else {\n var left = root0, right = root0, bottom = root0;\n d3_layout_hierarchyVisitBefore(root0, function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1);\n d3_layout_hierarchyVisitBefore(root0, function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n return nodes;\n }\n function wrapTree(root0) {\n var root1 = {\n A: null,\n children: [ root0 ]\n }, queue = [ root1 ], node1;\n while ((node1 = queue.pop()) != null) {\n for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) {\n queue.push((children[i] = child = {\n _: children[i],\n parent: node1,\n children: (child = children[i].children) && child.slice() || [],\n A: null,\n a: null,\n z: 0,\n m: 0,\n c: 0,\n s: 0,\n t: null,\n i: i\n }).a = child);\n }\n }\n return root1.children[0];\n }\n function firstWalk(v) {\n var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;\n if (children.length) {\n d3_layout_treeShift(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n function apportion(v, w, ancestor) {\n if (w) {\n 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;\n while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {\n vom = d3_layout_treeLeft(vom);\n vop = d3_layout_treeRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !d3_layout_treeRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !d3_layout_treeLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n function sizeNode(node) {\n node.x *= size[0];\n node.y = node.depth * size[1];\n }\n tree.separation = function(x) {\n if (!arguments.length) return separation;\n separation = x;\n return tree;\n };\n tree.size = function(x) {\n if (!arguments.length) return nodeSize ? null : size;\n nodeSize = (size = x) == null ? sizeNode : null;\n return tree;\n };\n tree.nodeSize = function(x) {\n if (!arguments.length) return nodeSize ? size : null;\n nodeSize = (size = x) == null ? null : sizeNode;\n return tree;\n };\n return d3_layout_hierarchyRebind(tree, hierarchy);\n };\n function d3_layout_treeSeparation(a, b) {\n return a.parent == b.parent ? 1 : 2;\n }\n function d3_layout_treeLeft(v) {\n var children = v.children;\n return children.length ? children[0] : v.t;\n }\n function d3_layout_treeRight(v) {\n var children = v.children, n;\n return (n = children.length) ? children[n - 1] : v.t;\n }\n function d3_layout_treeMove(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n }\n function d3_layout_treeShift(v) {\n var shift = 0, change = 0, children = v.children, i = children.length, w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n }\n function d3_layout_treeAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n }\n d3.layout.cluster = function() {\n var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false;\n function cluster(d, i) {\n var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;\n d3_layout_hierarchyVisitAfter(root, function(node) {\n var children = node.children;\n if (children && children.length) {\n node.x = d3_layout_clusterX(children);\n node.y = d3_layout_clusterY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;\n d3_layout_hierarchyVisitAfter(root, nodeSize ? function(node) {\n node.x = (node.x - root.x) * size[0];\n node.y = (root.y - node.y) * size[1];\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * size[0];\n node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];\n });\n return nodes;\n }\n cluster.separation = function(x) {\n if (!arguments.length) return separation;\n separation = x;\n return cluster;\n };\n cluster.size = function(x) {\n if (!arguments.length) return nodeSize ? null : size;\n nodeSize = (size = x) == null;\n return cluster;\n };\n cluster.nodeSize = function(x) {\n if (!arguments.length) return nodeSize ? size : null;\n nodeSize = (size = x) != null;\n return cluster;\n };\n return d3_layout_hierarchyRebind(cluster, hierarchy);\n };\n function d3_layout_clusterY(children) {\n return 1 + d3.max(children, function(child) {\n return child.y;\n });\n }\n function d3_layout_clusterX(children) {\n return children.reduce(function(x, child) {\n return x + child.x;\n }, 0) / children.length;\n }\n function d3_layout_clusterLeft(node) {\n var children = node.children;\n return children && children.length ? d3_layout_clusterLeft(children[0]) : node;\n }\n function d3_layout_clusterRight(node) {\n var children = node.children, n;\n return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;\n }\n d3.layout.treemap = function() {\n var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = \"squarify\", ratio = .5 * (1 + Math.sqrt(5));\n function scale(children, k) {\n var i = -1, n = children.length, child, area;\n while (++i < n) {\n area = (child = children[i]).value * (k < 0 ? 0 : k);\n child.area = isNaN(area) || area <= 0 ? 0 : area;\n }\n }\n function squarify(node) {\n var children = node.children;\n if (children && children.length) {\n var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === \"slice\" ? rect.dx : mode === \"dice\" ? rect.dy : mode === \"slice-dice\" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;\n scale(remaining, rect.dx * rect.dy / node.value);\n row.area = 0;\n while ((n = remaining.length) > 0) {\n row.push(child = remaining[n - 1]);\n row.area += child.area;\n if (mode !== \"squarify\" || (score = worst(row, u)) <= best) {\n remaining.pop();\n best = score;\n } else {\n row.area -= row.pop().area;\n position(row, u, rect, false);\n u = Math.min(rect.dx, rect.dy);\n row.length = row.area = 0;\n best = Infinity;\n }\n }\n if (row.length) {\n position(row, u, rect, true);\n row.length = row.area = 0;\n }\n children.forEach(squarify);\n }\n }\n function stickify(node) {\n var children = node.children;\n if (children && children.length) {\n var rect = pad(node), remaining = children.slice(), child, row = [];\n scale(remaining, rect.dx * rect.dy / node.value);\n row.area = 0;\n while (child = remaining.pop()) {\n row.push(child);\n row.area += child.area;\n if (child.z != null) {\n position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);\n row.length = row.area = 0;\n }\n }\n children.forEach(stickify);\n }\n }\n function worst(row, u) {\n var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;\n while (++i < n) {\n if (!(r = row[i].area)) continue;\n if (r < rmin) rmin = r;\n if (r > rmax) rmax = r;\n }\n s *= s;\n u *= u;\n return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;\n }\n function position(row, u, rect, flush) {\n var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;\n if (u == rect.dx) {\n if (flush || v > rect.dy) v = rect.dy;\n while (++i < n) {\n o = row[i];\n o.x = x;\n o.y = y;\n o.dy = v;\n x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);\n }\n o.z = true;\n o.dx += rect.x + rect.dx - x;\n rect.y += v;\n rect.dy -= v;\n } else {\n if (flush || v > rect.dx) v = rect.dx;\n while (++i < n) {\n o = row[i];\n o.x = x;\n o.y = y;\n o.dx = v;\n y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);\n }\n o.z = false;\n o.dy += rect.y + rect.dy - y;\n rect.x += v;\n rect.dx -= v;\n }\n }\n function treemap(d) {\n var nodes = stickies || hierarchy(d), root = nodes[0];\n root.x = root.y = 0;\n if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0;\n if (stickies) hierarchy.revalue(root);\n scale([ root ], root.dx * root.dy / root.value);\n (stickies ? stickify : squarify)(root);\n if (sticky) stickies = nodes;\n return nodes;\n }\n treemap.size = function(x) {\n if (!arguments.length) return size;\n size = x;\n return treemap;\n };\n treemap.padding = function(x) {\n if (!arguments.length) return padding;\n function padFunction(node) {\n var p = x.call(treemap, node, node.depth);\n return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === \"number\" ? [ p, p, p, p ] : p);\n }\n function padConstant(node) {\n return d3_layout_treemapPad(node, x);\n }\n var type;\n pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === \"function\" ? padFunction : type === \"number\" ? (x = [ x, x, x, x ], \n padConstant) : padConstant;\n return treemap;\n };\n treemap.round = function(x) {\n if (!arguments.length) return round != Number;\n round = x ? Math.round : Number;\n return treemap;\n };\n treemap.sticky = function(x) {\n if (!arguments.length) return sticky;\n sticky = x;\n stickies = null;\n return treemap;\n };\n treemap.ratio = function(x) {\n if (!arguments.length) return ratio;\n ratio = x;\n return treemap;\n };\n treemap.mode = function(x) {\n if (!arguments.length) return mode;\n mode = x + \"\";\n return treemap;\n };\n return d3_layout_hierarchyRebind(treemap, hierarchy);\n };\n function d3_layout_treemapPadNull(node) {\n return {\n x: node.x,\n y: node.y,\n dx: node.dx,\n dy: node.dy\n };\n }\n function d3_layout_treemapPad(node, padding) {\n 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];\n if (dx < 0) {\n x += dx / 2;\n dx = 0;\n }\n if (dy < 0) {\n y += dy / 2;\n dy = 0;\n }\n return {\n x: x,\n y: y,\n dx: dx,\n dy: dy\n };\n }\n d3.random = {\n normal: function(µ, σ) {\n var n = arguments.length;\n if (n < 2) σ = 1;\n if (n < 1) µ = 0;\n return function() {\n var x, y, r;\n do {\n x = Math.random() * 2 - 1;\n y = Math.random() * 2 - 1;\n r = x * x + y * y;\n } while (!r || r > 1);\n return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);\n };\n },\n logNormal: function() {\n var random = d3.random.normal.apply(d3, arguments);\n return function() {\n return Math.exp(random());\n };\n },\n bates: function(m) {\n var random = d3.random.irwinHall(m);\n return function() {\n return random() / m;\n };\n },\n irwinHall: function(m) {\n return function() {\n for (var s = 0, j = 0; j < m; j++) s += Math.random();\n return s;\n };\n }\n };\n d3.scale = {};\n function d3_scaleExtent(domain) {\n var start = domain[0], stop = domain[domain.length - 1];\n return start < stop ? [ start, stop ] : [ stop, start ];\n }\n function d3_scaleRange(scale) {\n return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());\n }\n function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {\n var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);\n return function(x) {\n return i(u(x));\n };\n }\n function d3_scale_nice(domain, nice) {\n var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;\n if (x1 < x0) {\n dx = i0, i0 = i1, i1 = dx;\n dx = x0, x0 = x1, x1 = dx;\n }\n domain[i0] = nice.floor(x0);\n domain[i1] = nice.ceil(x1);\n return domain;\n }\n function d3_scale_niceStep(step) {\n return step ? {\n floor: function(x) {\n return Math.floor(x / step) * step;\n },\n ceil: function(x) {\n return Math.ceil(x / step) * step;\n }\n } : d3_scale_niceIdentity;\n }\n var d3_scale_niceIdentity = {\n floor: d3_identity,\n ceil: d3_identity\n };\n function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {\n var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;\n if (domain[k] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n while (++j <= k) {\n u.push(uninterpolate(domain[j - 1], domain[j]));\n i.push(interpolate(range[j - 1], range[j]));\n }\n return function(x) {\n var j = d3.bisect(domain, x, 1, k) - 1;\n return i[j](u[j](x));\n };\n }\n d3.scale.linear = function() {\n return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false);\n };\n function d3_scale_linear(domain, range, interpolate, clamp) {\n var output, input;\n function rescale() {\n var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;\n output = linear(domain, range, uninterpolate, interpolate);\n input = linear(range, domain, uninterpolate, d3_interpolate);\n return scale;\n }\n function scale(x) {\n return output(x);\n }\n scale.invert = function(y) {\n return input(y);\n };\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n domain = x.map(Number);\n return rescale();\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n return rescale();\n };\n scale.rangeRound = function(x) {\n return scale.range(x).interpolate(d3_interpolateRound);\n };\n scale.clamp = function(x) {\n if (!arguments.length) return clamp;\n clamp = x;\n return rescale();\n };\n scale.interpolate = function(x) {\n if (!arguments.length) return interpolate;\n interpolate = x;\n return rescale();\n };\n scale.ticks = function(m) {\n return d3_scale_linearTicks(domain, m);\n };\n scale.tickFormat = function(m, format) {\n return d3_scale_linearTickFormat(domain, m, format);\n };\n scale.nice = function(m) {\n d3_scale_linearNice(domain, m);\n return rescale();\n };\n scale.copy = function() {\n return d3_scale_linear(domain, range, interpolate, clamp);\n };\n return rescale();\n }\n function d3_scale_linearRebind(scale, linear) {\n return d3.rebind(scale, linear, \"range\", \"rangeRound\", \"interpolate\", \"clamp\");\n }\n function d3_scale_linearNice(domain, m) {\n d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));\n d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));\n return domain;\n }\n function d3_scale_linearTickRange(domain, m) {\n if (m == null) m = 10;\n 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;\n if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;\n extent[0] = Math.ceil(extent[0] / step) * step;\n extent[1] = Math.floor(extent[1] / step) * step + step * .5;\n extent[2] = step;\n return extent;\n }\n function d3_scale_linearTicks(domain, m) {\n return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));\n }\n function d3_scale_linearTickFormat(domain, m, format) {\n var range = d3_scale_linearTickRange(domain, m);\n if (format) {\n var match = d3_format_re.exec(format);\n match.shift();\n if (match[8] === \"s\") {\n var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1])));\n if (!match[7]) match[7] = \".\" + d3_scale_linearPrecision(prefix.scale(range[2]));\n match[8] = \"f\";\n format = d3.format(match.join(\"\"));\n return function(d) {\n return format(prefix.scale(d)) + prefix.symbol;\n };\n }\n if (!match[7]) match[7] = \".\" + d3_scale_linearFormatPrecision(match[8], range);\n format = match.join(\"\");\n } else {\n format = \",.\" + d3_scale_linearPrecision(range[2]) + \"f\";\n }\n return d3.format(format);\n }\n var d3_scale_linearFormatSignificant = {\n s: 1,\n g: 1,\n p: 1,\n r: 1,\n e: 1\n };\n function d3_scale_linearPrecision(value) {\n return -Math.floor(Math.log(value) / Math.LN10 + .01);\n }\n function d3_scale_linearFormatPrecision(type, range) {\n var p = d3_scale_linearPrecision(range[2]);\n 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;\n }\n d3.scale.log = function() {\n return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]);\n };\n function d3_scale_log(linear, base, positive, domain) {\n function log(x) {\n return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base);\n }\n function pow(x) {\n return positive ? Math.pow(base, x) : -Math.pow(base, -x);\n }\n function scale(x) {\n return linear(log(x));\n }\n scale.invert = function(x) {\n return pow(linear.invert(x));\n };\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n positive = x[0] >= 0;\n linear.domain((domain = x.map(Number)).map(log));\n return scale;\n };\n scale.base = function(_) {\n if (!arguments.length) return base;\n base = +_;\n linear.domain(domain.map(log));\n return scale;\n };\n scale.nice = function() {\n var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative);\n linear.domain(niced);\n domain = niced.map(pow);\n return scale;\n };\n scale.ticks = function() {\n 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;\n if (isFinite(j - i)) {\n if (positive) {\n for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k);\n ticks.push(pow(i));\n } else {\n ticks.push(pow(i));\n for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k);\n }\n for (i = 0; ticks[i] < u; i++) {}\n for (j = ticks.length; ticks[j - 1] > v; j--) {}\n ticks = ticks.slice(i, j);\n }\n return ticks;\n };\n scale.tickFormat = function(n, format) {\n if (!arguments.length) return d3_scale_logFormat;\n if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== \"function\") format = d3.format(format);\n var k = Math.max(1, base * n / scale.ticks().length);\n return function(d) {\n var i = d / pow(Math.round(log(d)));\n if (i * base < base - .5) i *= base;\n return i <= k ? format(d) : \"\";\n };\n };\n scale.copy = function() {\n return d3_scale_log(linear.copy(), base, positive, domain);\n };\n return d3_scale_linearRebind(scale, linear);\n }\n var d3_scale_logFormat = d3.format(\".0e\"), d3_scale_logNiceNegative = {\n floor: function(x) {\n return -Math.ceil(-x);\n },\n ceil: function(x) {\n return -Math.floor(-x);\n }\n };\n d3.scale.pow = function() {\n return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]);\n };\n function d3_scale_pow(linear, exponent, domain) {\n var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);\n function scale(x) {\n return linear(powp(x));\n }\n scale.invert = function(x) {\n return powb(linear.invert(x));\n };\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n linear.domain((domain = x.map(Number)).map(powp));\n return scale;\n };\n scale.ticks = function(m) {\n return d3_scale_linearTicks(domain, m);\n };\n scale.tickFormat = function(m, format) {\n return d3_scale_linearTickFormat(domain, m, format);\n };\n scale.nice = function(m) {\n return scale.domain(d3_scale_linearNice(domain, m));\n };\n scale.exponent = function(x) {\n if (!arguments.length) return exponent;\n powp = d3_scale_powPow(exponent = x);\n powb = d3_scale_powPow(1 / exponent);\n linear.domain(domain.map(powp));\n return scale;\n };\n scale.copy = function() {\n return d3_scale_pow(linear.copy(), exponent, domain);\n };\n return d3_scale_linearRebind(scale, linear);\n }\n function d3_scale_powPow(e) {\n return function(x) {\n return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);\n };\n }\n d3.scale.sqrt = function() {\n return d3.scale.pow().exponent(.5);\n };\n d3.scale.ordinal = function() {\n return d3_scale_ordinal([], {\n t: \"range\",\n a: [ [] ]\n });\n };\n function d3_scale_ordinal(domain, ranger) {\n var index, range, rangeBand;\n function scale(x) {\n return range[((index.get(x) || (ranger.t === \"range\" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];\n }\n function steps(start, step) {\n return d3.range(domain.length).map(function(i) {\n return start + step * i;\n });\n }\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n domain = [];\n index = new d3_Map();\n var i = -1, n = x.length, xi;\n while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));\n return scale[ranger.t].apply(scale, ranger.a);\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n rangeBand = 0;\n ranger = {\n t: \"range\",\n a: arguments\n };\n return scale;\n };\n scale.rangePoints = function(x, padding) {\n if (arguments.length < 2) padding = 0;\n var start = x[0], stop = x[1], step = domain.length < 2 ? (start = (start + stop) / 2, \n 0) : (stop - start) / (domain.length - 1 + padding);\n range = steps(start + step * padding / 2, step);\n rangeBand = 0;\n ranger = {\n t: \"rangePoints\",\n a: arguments\n };\n return scale;\n };\n scale.rangeRoundPoints = function(x, padding) {\n if (arguments.length < 2) padding = 0;\n var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), \n 0) : (stop - start) / (domain.length - 1 + padding) | 0;\n range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step);\n rangeBand = 0;\n ranger = {\n t: \"rangeRoundPoints\",\n a: arguments\n };\n return scale;\n };\n scale.rangeBands = function(x, padding, outerPadding) {\n if (arguments.length < 2) padding = 0;\n if (arguments.length < 3) outerPadding = padding;\n var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);\n range = steps(start + step * outerPadding, step);\n if (reverse) range.reverse();\n rangeBand = step * (1 - padding);\n ranger = {\n t: \"rangeBands\",\n a: arguments\n };\n return scale;\n };\n scale.rangeRoundBands = function(x, padding, outerPadding) {\n if (arguments.length < 2) padding = 0;\n if (arguments.length < 3) outerPadding = padding;\n var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding));\n range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);\n if (reverse) range.reverse();\n rangeBand = Math.round(step * (1 - padding));\n ranger = {\n t: \"rangeRoundBands\",\n a: arguments\n };\n return scale;\n };\n scale.rangeBand = function() {\n return rangeBand;\n };\n scale.rangeExtent = function() {\n return d3_scaleExtent(ranger.a[0]);\n };\n scale.copy = function() {\n return d3_scale_ordinal(domain, ranger);\n };\n return scale.domain(domain);\n }\n d3.scale.category10 = function() {\n return d3.scale.ordinal().range(d3_category10);\n };\n d3.scale.category20 = function() {\n return d3.scale.ordinal().range(d3_category20);\n };\n d3.scale.category20b = function() {\n return d3.scale.ordinal().range(d3_category20b);\n };\n d3.scale.category20c = function() {\n return d3.scale.ordinal().range(d3_category20c);\n };\n var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString);\n 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);\n 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);\n 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);\n d3.scale.quantile = function() {\n return d3_scale_quantile([], []);\n };\n function d3_scale_quantile(domain, range) {\n var thresholds;\n function rescale() {\n var k = 0, q = range.length;\n thresholds = [];\n while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);\n return scale;\n }\n function scale(x) {\n if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)];\n }\n scale.domain = function(x) {\n if (!arguments.length) return domain;\n domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending);\n return rescale();\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n return rescale();\n };\n scale.quantiles = function() {\n return thresholds;\n };\n scale.invertExtent = function(y) {\n y = range.indexOf(y);\n return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ];\n };\n scale.copy = function() {\n return d3_scale_quantile(domain, range);\n };\n return rescale();\n }\n d3.scale.quantize = function() {\n return d3_scale_quantize(0, 1, [ 0, 1 ]);\n };\n function d3_scale_quantize(x0, x1, range) {\n var kx, i;\n function scale(x) {\n return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];\n }\n function rescale() {\n kx = range.length / (x1 - x0);\n i = range.length - 1;\n return scale;\n }\n scale.domain = function(x) {\n if (!arguments.length) return [ x0, x1 ];\n x0 = +x[0];\n x1 = +x[x.length - 1];\n return rescale();\n };\n scale.range = function(x) {\n if (!arguments.length) return range;\n range = x;\n return rescale();\n };\n scale.invertExtent = function(y) {\n y = range.indexOf(y);\n y = y < 0 ? NaN : y / kx + x0;\n return [ y, y + 1 / kx ];\n };\n scale.copy = function() {\n return d3_scale_quantize(x0, x1, range);\n };\n return rescale();\n }\n d3.scale.threshold = function() {\n return d3_scale_threshold([ .5 ], [ 0, 1 ]);\n };\n function d3_scale_threshold(domain, range) {\n function scale(x) {\n if (x <= x) return range[d3.bisect(domain, x)];\n }\n scale.domain = function(_) {\n if (!arguments.length) return domain;\n domain = _;\n return scale;\n };\n scale.range = function(_) {\n if (!arguments.length) return range;\n range = _;\n return scale;\n };\n scale.invertExtent = function(y) {\n y = range.indexOf(y);\n return [ domain[y - 1], domain[y] ];\n };\n scale.copy = function() {\n return d3_scale_threshold(domain, range);\n };\n return scale;\n }\n d3.scale.identity = function() {\n return d3_scale_identity([ 0, 1 ]);\n };\n function d3_scale_identity(domain) {\n function identity(x) {\n return +x;\n }\n identity.invert = identity;\n identity.domain = identity.range = function(x) {\n if (!arguments.length) return domain;\n domain = x.map(identity);\n return identity;\n };\n identity.ticks = function(m) {\n return d3_scale_linearTicks(domain, m);\n };\n identity.tickFormat = function(m, format) {\n return d3_scale_linearTickFormat(domain, m, format);\n };\n identity.copy = function() {\n return d3_scale_identity(domain);\n };\n return identity;\n }\n d3.svg = {};\n function d3_zero() {\n return 0;\n }\n d3.svg.arc = function() {\n 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;\n function arc() {\n var r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfπ, a1 = endAngle.apply(this, arguments) - halfπ, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1;\n if (r1 < r0) rc = r1, r1 = r0, r0 = rc;\n if (da >= τε) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : \"\") + \"Z\";\n var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = [];\n if (ap = (+padAngle.apply(this, arguments) || 0) / 2) {\n rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments);\n if (!cw) p1 *= -1;\n if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap));\n if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap));\n }\n if (r1) {\n x0 = r1 * Math.cos(a0 + p1);\n y0 = r1 * Math.sin(a0 + p1);\n x1 = r1 * Math.cos(a1 - p1);\n y1 = r1 * Math.sin(a1 - p1);\n var l1 = Math.abs(a1 - a0 - 2 * p1) <= π ? 0 : 1;\n if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) {\n var h1 = (a0 + a1) / 2;\n x0 = r1 * Math.cos(h1);\n y0 = r1 * Math.sin(h1);\n x1 = y1 = null;\n }\n } else {\n x0 = y0 = 0;\n }\n if (r0) {\n x2 = r0 * Math.cos(a1 - p0);\n y2 = r0 * Math.sin(a1 - p0);\n x3 = r0 * Math.cos(a0 + p0);\n y3 = r0 * Math.sin(a0 + p0);\n var l0 = Math.abs(a0 - a1 + 2 * p0) <= π ? 0 : 1;\n if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) {\n var h0 = (a0 + a1) / 2;\n x2 = r0 * Math.cos(h0);\n y2 = r0 * Math.sin(h0);\n x3 = y3 = null;\n }\n } else {\n x2 = y2 = 0;\n }\n if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {\n cr = r0 < r1 ^ cw ? 0 : 1;\n var rc1 = rc, rc0 = rc;\n if (da < π) {\n var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = Math.min(rc, (r0 - lc) / (kc - 1));\n rc1 = Math.min(rc, (r1 - lc) / (kc + 1));\n }\n if (x1 != null) {\n var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw);\n if (rc === rc1) {\n path.push(\"M\", t30[0], \"A\", rc1, \",\", rc1, \" 0 0,\", cr, \" \", t30[1], \"A\", r1, \",\", r1, \" 0 \", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), \",\", cw, \" \", t12[1], \"A\", rc1, \",\", rc1, \" 0 0,\", cr, \" \", t12[0]);\n } else {\n path.push(\"M\", t30[0], \"A\", rc1, \",\", rc1, \" 0 1,\", cr, \" \", t12[0]);\n }\n } else {\n path.push(\"M\", x0, \",\", y0);\n }\n if (x3 != null) {\n var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw);\n if (rc === rc0) {\n path.push(\"L\", t21[0], \"A\", rc0, \",\", rc0, \" 0 0,\", cr, \" \", t21[1], \"A\", r0, \",\", r0, \" 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,\", cr, \" \", t03[0]);\n } else {\n path.push(\"L\", t21[0], \"A\", rc0, \",\", rc0, \" 0 0,\", cr, \" \", t03[0]);\n }\n } else {\n path.push(\"L\", x2, \",\", y2);\n }\n } else {\n path.push(\"M\", x0, \",\", y0);\n if (x1 != null) path.push(\"A\", r1, \",\", r1, \" 0 \", l1, \",\", cw, \" \", x1, \",\", y1);\n path.push(\"L\", x2, \",\", y2);\n if (x3 != null) path.push(\"A\", r0, \",\", r0, \" 0 \", l0, \",\", 1 - cw, \" \", x3, \",\", y3);\n }\n path.push(\"Z\");\n return path.join(\"\");\n }\n function circleSegment(r1, cw) {\n return \"M0,\" + r1 + \"A\" + r1 + \",\" + r1 + \" 0 1,\" + cw + \" 0,\" + -r1 + \"A\" + r1 + \",\" + r1 + \" 0 1,\" + cw + \" 0,\" + r1;\n }\n arc.innerRadius = function(v) {\n if (!arguments.length) return innerRadius;\n innerRadius = d3_functor(v);\n return arc;\n };\n arc.outerRadius = function(v) {\n if (!arguments.length) return outerRadius;\n outerRadius = d3_functor(v);\n return arc;\n };\n arc.cornerRadius = function(v) {\n if (!arguments.length) return cornerRadius;\n cornerRadius = d3_functor(v);\n return arc;\n };\n arc.padRadius = function(v) {\n if (!arguments.length) return padRadius;\n padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : d3_functor(v);\n return arc;\n };\n arc.startAngle = function(v) {\n if (!arguments.length) return startAngle;\n startAngle = d3_functor(v);\n return arc;\n };\n arc.endAngle = function(v) {\n if (!arguments.length) return endAngle;\n endAngle = d3_functor(v);\n return arc;\n };\n arc.padAngle = function(v) {\n if (!arguments.length) return padAngle;\n padAngle = d3_functor(v);\n return arc;\n };\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - halfπ;\n return [ Math.cos(a) * r, Math.sin(a) * r ];\n };\n return arc;\n };\n var d3_svg_arcAuto = \"auto\";\n function d3_svg_arcInnerRadius(d) {\n return d.innerRadius;\n }\n function d3_svg_arcOuterRadius(d) {\n return d.outerRadius;\n }\n function d3_svg_arcStartAngle(d) {\n return d.startAngle;\n }\n function d3_svg_arcEndAngle(d) {\n return d.endAngle;\n }\n function d3_svg_arcPadAngle(d) {\n return d && d.padAngle;\n }\n function d3_svg_arcSweep(x0, y0, x1, y1) {\n return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;\n }\n function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) {\n var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3;\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ];\n }\n function d3_svg_line(projection) {\n var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;\n function line(data) {\n var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);\n function segment() {\n segments.push(\"M\", interpolate(projection(points), tension));\n }\n while (++i < n) {\n if (defined.call(this, d = data[i], i)) {\n points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);\n } else if (points.length) {\n segment();\n points = [];\n }\n }\n if (points.length) segment();\n return segments.length ? segments.join(\"\") : null;\n }\n line.x = function(_) {\n if (!arguments.length) return x;\n x = _;\n return line;\n };\n line.y = function(_) {\n if (!arguments.length) return y;\n y = _;\n return line;\n };\n line.defined = function(_) {\n if (!arguments.length) return defined;\n defined = _;\n return line;\n };\n line.interpolate = function(_) {\n if (!arguments.length) return interpolateKey;\n if (typeof _ === \"function\") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;\n return line;\n };\n line.tension = function(_) {\n if (!arguments.length) return tension;\n tension = _;\n return line;\n };\n return line;\n }\n d3.svg.line = function() {\n return d3_svg_line(d3_identity);\n };\n var d3_svg_lineInterpolators = d3.map({\n linear: d3_svg_lineLinear,\n \"linear-closed\": d3_svg_lineLinearClosed,\n step: d3_svg_lineStep,\n \"step-before\": d3_svg_lineStepBefore,\n \"step-after\": d3_svg_lineStepAfter,\n basis: d3_svg_lineBasis,\n \"basis-open\": d3_svg_lineBasisOpen,\n \"basis-closed\": d3_svg_lineBasisClosed,\n bundle: d3_svg_lineBundle,\n cardinal: d3_svg_lineCardinal,\n \"cardinal-open\": d3_svg_lineCardinalOpen,\n \"cardinal-closed\": d3_svg_lineCardinalClosed,\n monotone: d3_svg_lineMonotone\n });\n d3_svg_lineInterpolators.forEach(function(key, value) {\n value.key = key;\n value.closed = /-closed$/.test(key);\n });\n function d3_svg_lineLinear(points) {\n return points.length > 1 ? points.join(\"L\") : points + \"Z\";\n }\n function d3_svg_lineLinearClosed(points) {\n return points.join(\"L\") + \"Z\";\n }\n function d3_svg_lineStep(points) {\n var i = 0, n = points.length, p = points[0], path = [ p[0], \",\", p[1] ];\n while (++i < n) path.push(\"H\", (p[0] + (p = points[i])[0]) / 2, \"V\", p[1]);\n if (n > 1) path.push(\"H\", p[0]);\n return path.join(\"\");\n }\n function d3_svg_lineStepBefore(points) {\n var i = 0, n = points.length, p = points[0], path = [ p[0], \",\", p[1] ];\n while (++i < n) path.push(\"V\", (p = points[i])[1], \"H\", p[0]);\n return path.join(\"\");\n }\n function d3_svg_lineStepAfter(points) {\n var i = 0, n = points.length, p = points[0], path = [ p[0], \",\", p[1] ];\n while (++i < n) path.push(\"H\", (p = points[i])[0], \"V\", p[1]);\n return path.join(\"\");\n }\n function d3_svg_lineCardinalOpen(points, tension) {\n return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension));\n }\n function d3_svg_lineCardinalClosed(points, tension) {\n return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), \n points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));\n }\n function d3_svg_lineCardinal(points, tension) {\n return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));\n }\n function d3_svg_lineHermite(points, tangents) {\n if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {\n return d3_svg_lineLinear(points);\n }\n var quad = points.length != tangents.length, path = \"\", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;\n if (quad) {\n path += \"Q\" + (p[0] - t0[0] * 2 / 3) + \",\" + (p[1] - t0[1] * 2 / 3) + \",\" + p[0] + \",\" + p[1];\n p0 = points[1];\n pi = 2;\n }\n if (tangents.length > 1) {\n t = tangents[1];\n p = points[pi];\n pi++;\n path += \"C\" + (p0[0] + t0[0]) + \",\" + (p0[1] + t0[1]) + \",\" + (p[0] - t[0]) + \",\" + (p[1] - t[1]) + \",\" + p[0] + \",\" + p[1];\n for (var i = 2; i < tangents.length; i++, pi++) {\n p = points[pi];\n t = tangents[i];\n path += \"S\" + (p[0] - t[0]) + \",\" + (p[1] - t[1]) + \",\" + p[0] + \",\" + p[1];\n }\n }\n if (quad) {\n var lp = points[pi];\n path += \"Q\" + (p[0] + t[0] * 2 / 3) + \",\" + (p[1] + t[1] * 2 / 3) + \",\" + lp[0] + \",\" + lp[1];\n }\n return path;\n }\n function d3_svg_lineCardinalTangents(points, tension) {\n var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;\n while (++i < n) {\n p0 = p1;\n p1 = p2;\n p2 = points[i];\n tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);\n }\n return tangents;\n }\n function d3_svg_lineBasis(points) {\n if (points.length < 3) return d3_svg_lineLinear(points);\n var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, \",\", y0, \"L\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];\n points.push(points[n - 1]);\n while (++i <= n) {\n pi = points[i];\n px.shift();\n px.push(pi[0]);\n py.shift();\n py.push(pi[1]);\n d3_svg_lineBasisBezier(path, px, py);\n }\n points.pop();\n path.push(\"L\", pi);\n return path.join(\"\");\n }\n function d3_svg_lineBasisOpen(points) {\n if (points.length < 4) return d3_svg_lineLinear(points);\n var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];\n while (++i < 3) {\n pi = points[i];\n px.push(pi[0]);\n py.push(pi[1]);\n }\n path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + \",\" + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));\n --i;\n while (++i < n) {\n pi = points[i];\n px.shift();\n px.push(pi[0]);\n py.shift();\n py.push(pi[1]);\n d3_svg_lineBasisBezier(path, px, py);\n }\n return path.join(\"\");\n }\n function d3_svg_lineBasisClosed(points) {\n var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];\n while (++i < 4) {\n pi = points[i % n];\n px.push(pi[0]);\n py.push(pi[1]);\n }\n path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), \",\", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];\n --i;\n while (++i < m) {\n pi = points[i % n];\n px.shift();\n px.push(pi[0]);\n py.shift();\n py.push(pi[1]);\n d3_svg_lineBasisBezier(path, px, py);\n }\n return path.join(\"\");\n }\n function d3_svg_lineBundle(points, tension) {\n var n = points.length - 1;\n if (n) {\n var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;\n while (++i <= n) {\n p = points[i];\n t = i / n;\n p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);\n p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);\n }\n }\n return d3_svg_lineBasis(points);\n }\n function d3_svg_lineDot4(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n 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 ];\n function d3_svg_lineBasisBezier(path, x, y) {\n 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));\n }\n function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n }\n function d3_svg_lineFiniteDifferences(points) {\n var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);\n while (++i < j) {\n m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;\n }\n m[i] = d;\n return m;\n }\n function d3_svg_lineMonotoneTangents(points) {\n var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;\n while (++i < j) {\n d = d3_svg_lineSlope(points[i], points[i + 1]);\n if (abs(d) < ε) {\n m[i] = m[i + 1] = 0;\n } else {\n a = m[i] / d;\n b = m[i + 1] / d;\n s = a * a + b * b;\n if (s > 9) {\n s = d * 3 / Math.sqrt(s);\n m[i] = s * a;\n m[i + 1] = s * b;\n }\n }\n }\n i = -1;\n while (++i <= j) {\n s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));\n tangents.push([ s || 0, m[i] * s || 0 ]);\n }\n return tangents;\n }\n function d3_svg_lineMonotone(points) {\n return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));\n }\n d3.svg.line.radial = function() {\n var line = d3_svg_line(d3_svg_lineRadial);\n line.radius = line.x, delete line.x;\n line.angle = line.y, delete line.y;\n return line;\n };\n function d3_svg_lineRadial(points) {\n var point, i = -1, n = points.length, r, a;\n while (++i < n) {\n point = points[i];\n r = point[0];\n a = point[1] - halfπ;\n point[0] = r * Math.cos(a);\n point[1] = r * Math.sin(a);\n }\n return points;\n }\n function d3_svg_area(projection) {\n var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = \"L\", tension = .7;\n function area(data) {\n var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {\n return x;\n } : d3_functor(x1), fy1 = y0 === y1 ? function() {\n return y;\n } : d3_functor(y1), x, y;\n function segment() {\n segments.push(\"M\", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), \"Z\");\n }\n while (++i < n) {\n if (defined.call(this, d = data[i], i)) {\n points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);\n points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);\n } else if (points0.length) {\n segment();\n points0 = [];\n points1 = [];\n }\n }\n if (points0.length) segment();\n return segments.length ? segments.join(\"\") : null;\n }\n area.x = function(_) {\n if (!arguments.length) return x1;\n x0 = x1 = _;\n return area;\n };\n area.x0 = function(_) {\n if (!arguments.length) return x0;\n x0 = _;\n return area;\n };\n area.x1 = function(_) {\n if (!arguments.length) return x1;\n x1 = _;\n return area;\n };\n area.y = function(_) {\n if (!arguments.length) return y1;\n y0 = y1 = _;\n return area;\n };\n area.y0 = function(_) {\n if (!arguments.length) return y0;\n y0 = _;\n return area;\n };\n area.y1 = function(_) {\n if (!arguments.length) return y1;\n y1 = _;\n return area;\n };\n area.defined = function(_) {\n if (!arguments.length) return defined;\n defined = _;\n return area;\n };\n area.interpolate = function(_) {\n if (!arguments.length) return interpolateKey;\n if (typeof _ === \"function\") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;\n interpolateReverse = interpolate.reverse || interpolate;\n L = interpolate.closed ? \"M\" : \"L\";\n return area;\n };\n area.tension = function(_) {\n if (!arguments.length) return tension;\n tension = _;\n return area;\n };\n return area;\n }\n d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;\n d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;\n d3.svg.area = function() {\n return d3_svg_area(d3_identity);\n };\n d3.svg.area.radial = function() {\n var area = d3_svg_area(d3_svg_lineRadial);\n area.radius = area.x, delete area.x;\n area.innerRadius = area.x0, delete area.x0;\n area.outerRadius = area.x1, delete area.x1;\n area.angle = area.y, delete area.y;\n area.startAngle = area.y0, delete area.y0;\n area.endAngle = area.y1, delete area.y1;\n return area;\n };\n d3.svg.chord = function() {\n var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;\n function chord(d, i) {\n var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);\n 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\";\n }\n function subgroup(self, f, d, i) {\n var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ;\n return {\n r: r,\n a0: a0,\n a1: a1,\n p0: [ r * Math.cos(a0), r * Math.sin(a0) ],\n p1: [ r * Math.cos(a1), r * Math.sin(a1) ]\n };\n }\n function equals(a, b) {\n return a.a0 == b.a0 && a.a1 == b.a1;\n }\n function arc(r, p, a) {\n return \"A\" + r + \",\" + r + \" 0 \" + +(a > π) + \",1 \" + p;\n }\n function curve(r0, p0, r1, p1) {\n return \"Q 0,0 \" + p1;\n }\n chord.radius = function(v) {\n if (!arguments.length) return radius;\n radius = d3_functor(v);\n return chord;\n };\n chord.source = function(v) {\n if (!arguments.length) return source;\n source = d3_functor(v);\n return chord;\n };\n chord.target = function(v) {\n if (!arguments.length) return target;\n target = d3_functor(v);\n return chord;\n };\n chord.startAngle = function(v) {\n if (!arguments.length) return startAngle;\n startAngle = d3_functor(v);\n return chord;\n };\n chord.endAngle = function(v) {\n if (!arguments.length) return endAngle;\n endAngle = d3_functor(v);\n return chord;\n };\n return chord;\n };\n function d3_svg_chordRadius(d) {\n return d.radius;\n }\n d3.svg.diagonal = function() {\n var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;\n function diagonal(d, i) {\n var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {\n x: p0.x,\n y: m\n }, {\n x: p3.x,\n y: m\n }, p3 ];\n p = p.map(projection);\n return \"M\" + p[0] + \"C\" + p[1] + \" \" + p[2] + \" \" + p[3];\n }\n diagonal.source = function(x) {\n if (!arguments.length) return source;\n source = d3_functor(x);\n return diagonal;\n };\n diagonal.target = function(x) {\n if (!arguments.length) return target;\n target = d3_functor(x);\n return diagonal;\n };\n diagonal.projection = function(x) {\n if (!arguments.length) return projection;\n projection = x;\n return diagonal;\n };\n return diagonal;\n };\n function d3_svg_diagonalProjection(d) {\n return [ d.x, d.y ];\n }\n d3.svg.diagonal.radial = function() {\n var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;\n diagonal.projection = function(x) {\n return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;\n };\n return diagonal;\n };\n function d3_svg_diagonalRadialProjection(projection) {\n return function() {\n var d = projection.apply(this, arguments), r = d[0], a = d[1] - halfπ;\n return [ r * Math.cos(a), r * Math.sin(a) ];\n };\n }\n d3.svg.symbol = function() {\n var type = d3_svg_symbolType, size = d3_svg_symbolSize;\n function symbol(d, i) {\n return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));\n }\n symbol.type = function(x) {\n if (!arguments.length) return type;\n type = d3_functor(x);\n return symbol;\n };\n symbol.size = function(x) {\n if (!arguments.length) return size;\n size = d3_functor(x);\n return symbol;\n };\n return symbol;\n };\n function d3_svg_symbolSize() {\n return 64;\n }\n function d3_svg_symbolType() {\n return \"circle\";\n }\n function d3_svg_symbolCircle(size) {\n var r = Math.sqrt(size / π);\n return \"M0,\" + r + \"A\" + r + \",\" + r + \" 0 1,1 0,\" + -r + \"A\" + r + \",\" + r + \" 0 1,1 0,\" + r + \"Z\";\n }\n var d3_svg_symbols = d3.map({\n circle: d3_svg_symbolCircle,\n cross: function(size) {\n var r = Math.sqrt(size / 5) / 2;\n 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\";\n },\n diamond: function(size) {\n var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;\n return \"M0,\" + -ry + \"L\" + rx + \",0\" + \" 0,\" + ry + \" \" + -rx + \",0\" + \"Z\";\n },\n square: function(size) {\n var r = Math.sqrt(size) / 2;\n return \"M\" + -r + \",\" + -r + \"L\" + r + \",\" + -r + \" \" + r + \",\" + r + \" \" + -r + \",\" + r + \"Z\";\n },\n \"triangle-down\": function(size) {\n var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;\n return \"M0,\" + ry + \"L\" + rx + \",\" + -ry + \" \" + -rx + \",\" + -ry + \"Z\";\n },\n \"triangle-up\": function(size) {\n var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;\n return \"M0,\" + -ry + \"L\" + rx + \",\" + ry + \" \" + -rx + \",\" + ry + \"Z\";\n }\n });\n d3.svg.symbolTypes = d3_svg_symbols.keys();\n var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);\n d3_selectionPrototype.transition = function(name) {\n var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name), subgroups = [], subgroup, node, transition = d3_transitionInherit || {\n time: Date.now(),\n ease: d3_ease_cubicInOut,\n delay: 0,\n duration: 250\n };\n for (var j = -1, m = this.length; ++j < m; ) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) d3_transitionNode(node, i, ns, id, transition);\n subgroup.push(node);\n }\n }\n return d3_transition(subgroups, ns, id);\n };\n d3_selectionPrototype.interrupt = function(name) {\n return this.each(name == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name)));\n };\n var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace());\n function d3_selection_interruptNS(ns) {\n return function() {\n var lock, activeId, active;\n if ((lock = this[ns]) && (active = lock[activeId = lock.active])) {\n active.timer.c = null;\n active.timer.t = NaN;\n if (--lock.count) delete lock[activeId]; else delete this[ns];\n lock.active += .5;\n active.event && active.event.interrupt.call(this, this.__data__, active.index);\n }\n };\n }\n function d3_transition(groups, ns, id) {\n d3_subclass(groups, d3_transitionPrototype);\n groups.namespace = ns;\n groups.id = id;\n return groups;\n }\n var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit;\n d3_transitionPrototype.call = d3_selectionPrototype.call;\n d3_transitionPrototype.empty = d3_selectionPrototype.empty;\n d3_transitionPrototype.node = d3_selectionPrototype.node;\n d3_transitionPrototype.size = d3_selectionPrototype.size;\n d3.transition = function(selection, name) {\n return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name) : selection : d3.selection().transition(selection);\n };\n d3.transition.prototype = d3_transitionPrototype;\n d3_transitionPrototype.select = function(selector) {\n var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnode, node;\n selector = d3_selection_selector(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n d3_transitionNode(subnode, i, ns, id, node[ns][id]);\n subgroup.push(subnode);\n } else {\n subgroup.push(null);\n }\n }\n }\n return d3_transition(subgroups, ns, id);\n };\n d3_transitionPrototype.selectAll = function(selector) {\n var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnodes, node, subnode, transition;\n selector = d3_selection_selectorAll(selector);\n for (var j = -1, m = this.length; ++j < m; ) {\n for (var group = this[j], i = -1, n = group.length; ++i < n; ) {\n if (node = group[i]) {\n transition = node[ns][id];\n subnodes = selector.call(node, node.__data__, i, j);\n subgroups.push(subgroup = []);\n for (var k = -1, o = subnodes.length; ++k < o; ) {\n if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition);\n subgroup.push(subnode);\n }\n }\n }\n }\n return d3_transition(subgroups, ns, id);\n };\n d3_transitionPrototype.filter = function(filter) {\n var subgroups = [], subgroup, group, node;\n if (typeof filter !== \"function\") filter = d3_selection_filter(filter);\n for (var j = 0, m = this.length; j < m; j++) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = 0, n = group.length; i < n; i++) {\n if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {\n subgroup.push(node);\n }\n }\n }\n return d3_transition(subgroups, this.namespace, this.id);\n };\n d3_transitionPrototype.tween = function(name, tween) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 2) return this.node()[ns][id].tween.get(name);\n return d3_selection_each(this, tween == null ? function(node) {\n node[ns][id].tween.remove(name);\n } : function(node) {\n node[ns][id].tween.set(name, tween);\n });\n };\n function d3_transition_tween(groups, name, value, tween) {\n var id = groups.id, ns = groups.namespace;\n return d3_selection_each(groups, typeof value === \"function\" ? function(node, i, j) {\n node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j)));\n } : (value = tween(value), function(node) {\n node[ns][id].tween.set(name, value);\n }));\n }\n d3_transitionPrototype.attr = function(nameNS, value) {\n if (arguments.length < 2) {\n for (value in nameNS) this.attr(value, nameNS[value]);\n return this;\n }\n var interpolate = nameNS == \"transform\" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS);\n function attrNull() {\n this.removeAttribute(name);\n }\n function attrNullNS() {\n this.removeAttributeNS(name.space, name.local);\n }\n function attrTween(b) {\n return b == null ? attrNull : (b += \"\", function() {\n var a = this.getAttribute(name), i;\n return a !== b && (i = interpolate(a, b), function(t) {\n this.setAttribute(name, i(t));\n });\n });\n }\n function attrTweenNS(b) {\n return b == null ? attrNullNS : (b += \"\", function() {\n var a = this.getAttributeNS(name.space, name.local), i;\n return a !== b && (i = interpolate(a, b), function(t) {\n this.setAttributeNS(name.space, name.local, i(t));\n });\n });\n }\n return d3_transition_tween(this, \"attr.\" + nameNS, value, name.local ? attrTweenNS : attrTween);\n };\n d3_transitionPrototype.attrTween = function(nameNS, tween) {\n var name = d3.ns.qualify(nameNS);\n function attrTween(d, i) {\n var f = tween.call(this, d, i, this.getAttribute(name));\n return f && function(t) {\n this.setAttribute(name, f(t));\n };\n }\n function attrTweenNS(d, i) {\n var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));\n return f && function(t) {\n this.setAttributeNS(name.space, name.local, f(t));\n };\n }\n return this.tween(\"attr.\" + nameNS, name.local ? attrTweenNS : attrTween);\n };\n d3_transitionPrototype.style = function(name, value, priority) {\n var n = arguments.length;\n if (n < 3) {\n if (typeof name !== \"string\") {\n if (n < 2) value = \"\";\n for (priority in name) this.style(priority, name[priority], value);\n return this;\n }\n priority = \"\";\n }\n function styleNull() {\n this.style.removeProperty(name);\n }\n function styleString(b) {\n return b == null ? styleNull : (b += \"\", function() {\n var a = d3_window(this).getComputedStyle(this, null).getPropertyValue(name), i;\n return a !== b && (i = d3_interpolate(a, b), function(t) {\n this.style.setProperty(name, i(t), priority);\n });\n });\n }\n return d3_transition_tween(this, \"style.\" + name, value, styleString);\n };\n d3_transitionPrototype.styleTween = function(name, tween, priority) {\n if (arguments.length < 3) priority = \"\";\n function styleTween(d, i) {\n var f = tween.call(this, d, i, d3_window(this).getComputedStyle(this, null).getPropertyValue(name));\n return f && function(t) {\n this.style.setProperty(name, f(t), priority);\n };\n }\n return this.tween(\"style.\" + name, styleTween);\n };\n d3_transitionPrototype.text = function(value) {\n return d3_transition_tween(this, \"text\", value, d3_transition_text);\n };\n function d3_transition_text(b) {\n if (b == null) b = \"\";\n return function() {\n this.textContent = b;\n };\n }\n d3_transitionPrototype.remove = function() {\n var ns = this.namespace;\n return this.each(\"end.transition\", function() {\n var p;\n if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this);\n });\n };\n d3_transitionPrototype.ease = function(value) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 1) return this.node()[ns][id].ease;\n if (typeof value !== \"function\") value = d3.ease.apply(d3, arguments);\n return d3_selection_each(this, function(node) {\n node[ns][id].ease = value;\n });\n };\n d3_transitionPrototype.delay = function(value) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 1) return this.node()[ns][id].delay;\n return d3_selection_each(this, typeof value === \"function\" ? function(node, i, j) {\n node[ns][id].delay = +value.call(node, node.__data__, i, j);\n } : (value = +value, function(node) {\n node[ns][id].delay = value;\n }));\n };\n d3_transitionPrototype.duration = function(value) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 1) return this.node()[ns][id].duration;\n return d3_selection_each(this, typeof value === \"function\" ? function(node, i, j) {\n node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j));\n } : (value = Math.max(1, value), function(node) {\n node[ns][id].duration = value;\n }));\n };\n d3_transitionPrototype.each = function(type, listener) {\n var id = this.id, ns = this.namespace;\n if (arguments.length < 2) {\n var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;\n try {\n d3_transitionInheritId = id;\n d3_selection_each(this, function(node, i, j) {\n d3_transitionInherit = node[ns][id];\n type.call(node, node.__data__, i, j);\n });\n } finally {\n d3_transitionInherit = inherit;\n d3_transitionInheritId = inheritId;\n }\n } else {\n d3_selection_each(this, function(node) {\n var transition = node[ns][id];\n (transition.event || (transition.event = d3.dispatch(\"start\", \"end\", \"interrupt\"))).on(type, listener);\n });\n }\n return this;\n };\n d3_transitionPrototype.transition = function() {\n var id0 = this.id, id1 = ++d3_transitionId, ns = this.namespace, subgroups = [], subgroup, group, node, transition;\n for (var j = 0, m = this.length; j < m; j++) {\n subgroups.push(subgroup = []);\n for (var group = this[j], i = 0, n = group.length; i < n; i++) {\n if (node = group[i]) {\n transition = node[ns][id0];\n d3_transitionNode(node, i, ns, id1, {\n time: transition.time,\n ease: transition.ease,\n delay: transition.delay + transition.duration,\n duration: transition.duration\n });\n }\n subgroup.push(node);\n }\n }\n return d3_transition(subgroups, ns, id1);\n };\n function d3_transitionNamespace(name) {\n return name == null ? \"__transition__\" : \"__transition_\" + name + \"__\";\n }\n function d3_transitionNode(node, i, ns, id, inherit) {\n var lock = node[ns] || (node[ns] = {\n active: 0,\n count: 0\n }), transition = lock[id], time, timer, duration, ease, tweens;\n function schedule(elapsed) {\n var delay = transition.delay;\n timer.t = delay + time;\n if (delay <= elapsed) return start(elapsed - delay);\n timer.c = start;\n }\n function start(elapsed) {\n var activeId = lock.active, active = lock[activeId];\n if (active) {\n active.timer.c = null;\n active.timer.t = NaN;\n --lock.count;\n delete lock[activeId];\n active.event && active.event.interrupt.call(node, node.__data__, active.index);\n }\n for (var cancelId in lock) {\n if (+cancelId < id) {\n var cancel = lock[cancelId];\n cancel.timer.c = null;\n cancel.timer.t = NaN;\n --lock.count;\n delete lock[cancelId];\n }\n }\n timer.c = tick;\n d3_timer(function() {\n if (timer.c && tick(elapsed || 1)) {\n timer.c = null;\n timer.t = NaN;\n }\n return 1;\n }, 0, time);\n lock.active = id;\n transition.event && transition.event.start.call(node, node.__data__, i);\n tweens = [];\n transition.tween.forEach(function(key, value) {\n if (value = value.call(node, node.__data__, i)) {\n tweens.push(value);\n }\n });\n ease = transition.ease;\n duration = transition.duration;\n }\n function tick(elapsed) {\n var t = elapsed / duration, e = ease(t), n = tweens.length;\n while (n > 0) {\n tweens[--n].call(node, e);\n }\n if (t >= 1) {\n transition.event && transition.event.end.call(node, node.__data__, i);\n if (--lock.count) delete lock[id]; else delete node[ns];\n return 1;\n }\n }\n if (!transition) {\n time = inherit.time;\n timer = d3_timer(schedule, 0, time);\n transition = lock[id] = {\n tween: new d3_Map(),\n time: time,\n timer: timer,\n delay: inherit.delay,\n duration: inherit.duration,\n ease: inherit.ease,\n index: i\n };\n inherit = null;\n ++lock.count;\n }\n }\n d3.svg.axis = function() {\n var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_;\n function axis(g) {\n g.each(function() {\n var g = d3.select(this);\n var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();\n var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(\".tick\").data(ticks, scale1), tickEnter = tick.enter().insert(\"g\", \".domain\").attr(\"class\", \"tick\").style(\"opacity\", ε), tickExit = d3.transition(tick.exit()).style(\"opacity\", ε).remove(), tickUpdate = d3.transition(tick.order()).style(\"opacity\", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform;\n var range = d3_scaleRange(scale1), path = g.selectAll(\".domain\").data([ 0 ]), pathUpdate = (path.enter().append(\"path\").attr(\"class\", \"domain\"), \n d3.transition(path));\n tickEnter.append(\"line\");\n tickEnter.append(\"text\");\n 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, x1, x2, y1, y2;\n if (orient === \"bottom\" || orient === \"top\") {\n tickTransform = d3_svg_axisX, x1 = \"x\", y1 = \"y\", x2 = \"x2\", y2 = \"y2\";\n text.attr(\"dy\", sign < 0 ? \"0em\" : \".71em\").style(\"text-anchor\", \"middle\");\n pathUpdate.attr(\"d\", \"M\" + range[0] + \",\" + sign * outerTickSize + \"V0H\" + range[1] + \"V\" + sign * outerTickSize);\n } else {\n tickTransform = d3_svg_axisY, x1 = \"y\", y1 = \"x\", x2 = \"y2\", y2 = \"x2\";\n text.attr(\"dy\", \".32em\").style(\"text-anchor\", sign < 0 ? \"end\" : \"start\");\n pathUpdate.attr(\"d\", \"M\" + sign * outerTickSize + \",\" + range[0] + \"H0V\" + range[1] + \"H\" + sign * outerTickSize);\n }\n lineEnter.attr(y2, sign * innerTickSize);\n textEnter.attr(y1, sign * tickSpacing);\n lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize);\n textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);\n if (scale1.rangeBand) {\n var x = scale1, dx = x.rangeBand() / 2;\n scale0 = scale1 = function(d) {\n return x(d) + dx;\n };\n } else if (scale0.rangeBand) {\n scale0 = scale1;\n } else {\n tickExit.call(tickTransform, scale1, scale0);\n }\n tickEnter.call(tickTransform, scale0, scale1);\n tickUpdate.call(tickTransform, scale1, scale1);\n });\n }\n axis.scale = function(x) {\n if (!arguments.length) return scale;\n scale = x;\n return axis;\n };\n axis.orient = function(x) {\n if (!arguments.length) return orient;\n orient = x in d3_svg_axisOrients ? x + \"\" : d3_svg_axisDefaultOrient;\n return axis;\n };\n axis.ticks = function() {\n if (!arguments.length) return tickArguments_;\n tickArguments_ = d3_array(arguments);\n return axis;\n };\n axis.tickValues = function(x) {\n if (!arguments.length) return tickValues;\n tickValues = x;\n return axis;\n };\n axis.tickFormat = function(x) {\n if (!arguments.length) return tickFormat_;\n tickFormat_ = x;\n return axis;\n };\n axis.tickSize = function(x) {\n var n = arguments.length;\n if (!n) return innerTickSize;\n innerTickSize = +x;\n outerTickSize = +arguments[n - 1];\n return axis;\n };\n axis.innerTickSize = function(x) {\n if (!arguments.length) return innerTickSize;\n innerTickSize = +x;\n return axis;\n };\n axis.outerTickSize = function(x) {\n if (!arguments.length) return outerTickSize;\n outerTickSize = +x;\n return axis;\n };\n axis.tickPadding = function(x) {\n if (!arguments.length) return tickPadding;\n tickPadding = +x;\n return axis;\n };\n axis.tickSubdivide = function() {\n return arguments.length && axis;\n };\n return axis;\n };\n var d3_svg_axisDefaultOrient = \"bottom\", d3_svg_axisOrients = {\n top: 1,\n right: 1,\n bottom: 1,\n left: 1\n };\n function d3_svg_axisX(selection, x0, x1) {\n selection.attr(\"transform\", function(d) {\n var v0 = x0(d);\n return \"translate(\" + (isFinite(v0) ? v0 : x1(d)) + \",0)\";\n });\n }\n function d3_svg_axisY(selection, y0, y1) {\n selection.attr(\"transform\", function(d) {\n var v0 = y0(d);\n return \"translate(0,\" + (isFinite(v0) ? v0 : y1(d)) + \")\";\n });\n }\n d3.svg.brush = function() {\n 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];\n function brush(g) {\n g.each(function() {\n var g = d3.select(this).style(\"pointer-events\", \"all\").style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\").on(\"mousedown.brush\", brushstart).on(\"touchstart.brush\", brushstart);\n var background = g.selectAll(\".background\").data([ 0 ]);\n background.enter().append(\"rect\").attr(\"class\", \"background\").style(\"visibility\", \"hidden\").style(\"cursor\", \"crosshair\");\n g.selectAll(\".extent\").data([ 0 ]).enter().append(\"rect\").attr(\"class\", \"extent\").style(\"cursor\", \"move\");\n var resize = g.selectAll(\".resize\").data(resizes, d3_identity);\n resize.exit().remove();\n resize.enter().append(\"g\").attr(\"class\", function(d) {\n return \"resize \" + d;\n }).style(\"cursor\", function(d) {\n return d3_svg_brushCursor[d];\n }).append(\"rect\").attr(\"x\", function(d) {\n return /[ew]$/.test(d) ? -3 : null;\n }).attr(\"y\", function(d) {\n return /^[ns]/.test(d) ? -3 : null;\n }).attr(\"width\", 6).attr(\"height\", 6).style(\"visibility\", \"hidden\");\n resize.style(\"display\", brush.empty() ? \"none\" : null);\n var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range;\n if (x) {\n range = d3_scaleRange(x);\n backgroundUpdate.attr(\"x\", range[0]).attr(\"width\", range[1] - range[0]);\n redrawX(gUpdate);\n }\n if (y) {\n range = d3_scaleRange(y);\n backgroundUpdate.attr(\"y\", range[0]).attr(\"height\", range[1] - range[0]);\n redrawY(gUpdate);\n }\n redraw(gUpdate);\n });\n }\n brush.event = function(g) {\n g.each(function() {\n var event_ = event.of(this, arguments), extent1 = {\n x: xExtent,\n y: yExtent,\n i: xExtentDomain,\n j: yExtentDomain\n }, extent0 = this.__chart__ || extent1;\n this.__chart__ = extent1;\n if (d3_transitionInheritId) {\n d3.select(this).transition().each(\"start.brush\", function() {\n xExtentDomain = extent0.i;\n yExtentDomain = extent0.j;\n xExtent = extent0.x;\n yExtent = extent0.y;\n event_({\n type: \"brushstart\"\n });\n }).tween(\"brush:brush\", function() {\n var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y);\n xExtentDomain = yExtentDomain = null;\n return function(t) {\n xExtent = extent1.x = xi(t);\n yExtent = extent1.y = yi(t);\n event_({\n type: \"brush\",\n mode: \"resize\"\n });\n };\n }).each(\"end.brush\", function() {\n xExtentDomain = extent1.i;\n yExtentDomain = extent1.j;\n event_({\n type: \"brush\",\n mode: \"resize\"\n });\n event_({\n type: \"brushend\"\n });\n });\n } else {\n event_({\n type: \"brushstart\"\n });\n event_({\n type: \"brush\",\n mode: \"resize\"\n });\n event_({\n type: \"brushend\"\n });\n }\n });\n };\n function redraw(g) {\n g.selectAll(\".resize\").attr(\"transform\", function(d) {\n return \"translate(\" + xExtent[+/e$/.test(d)] + \",\" + yExtent[+/^s/.test(d)] + \")\";\n });\n }\n function redrawX(g) {\n g.select(\".extent\").attr(\"x\", xExtent[0]);\n g.selectAll(\".extent,.n>rect,.s>rect\").attr(\"width\", xExtent[1] - xExtent[0]);\n }\n function redrawY(g) {\n g.select(\".extent\").attr(\"y\", yExtent[0]);\n g.selectAll(\".extent,.e>rect,.w>rect\").attr(\"height\", yExtent[1] - yExtent[0]);\n }\n function brushstart() {\n 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;\n var w = d3.select(d3_window(target)).on(\"keydown.brush\", keydown).on(\"keyup.brush\", keyup);\n if (d3.event.changedTouches) {\n w.on(\"touchmove.brush\", brushmove).on(\"touchend.brush\", brushend);\n } else {\n w.on(\"mousemove.brush\", brushmove).on(\"mouseup.brush\", brushend);\n }\n g.interrupt().selectAll(\"*\").interrupt();\n if (dragging) {\n origin[0] = xExtent[0] - origin[0];\n origin[1] = yExtent[0] - origin[1];\n } else if (resizing) {\n var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);\n offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ];\n origin[0] = xExtent[ex];\n origin[1] = yExtent[ey];\n } else if (d3.event.altKey) center = origin.slice();\n g.style(\"pointer-events\", \"none\").selectAll(\".resize\").style(\"display\", null);\n d3.select(\"body\").style(\"cursor\", eventTarget.style(\"cursor\"));\n event_({\n type: \"brushstart\"\n });\n brushmove();\n function keydown() {\n if (d3.event.keyCode == 32) {\n if (!dragging) {\n center = null;\n origin[0] -= xExtent[1];\n origin[1] -= yExtent[1];\n dragging = 2;\n }\n d3_eventPreventDefault();\n }\n }\n function keyup() {\n if (d3.event.keyCode == 32 && dragging == 2) {\n origin[0] += xExtent[1];\n origin[1] += yExtent[1];\n dragging = 0;\n d3_eventPreventDefault();\n }\n }\n function brushmove() {\n var point = d3.mouse(target), moved = false;\n if (offset) {\n point[0] += offset[0];\n point[1] += offset[1];\n }\n if (!dragging) {\n if (d3.event.altKey) {\n if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ];\n origin[0] = xExtent[+(point[0] < center[0])];\n origin[1] = yExtent[+(point[1] < center[1])];\n } else center = null;\n }\n if (resizingX && move1(point, x, 0)) {\n redrawX(g);\n moved = true;\n }\n if (resizingY && move1(point, y, 1)) {\n redrawY(g);\n moved = true;\n }\n if (moved) {\n redraw(g);\n event_({\n type: \"brush\",\n mode: dragging ? \"move\" : \"resize\"\n });\n }\n }\n function move1(point, scale, i) {\n var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max;\n if (dragging) {\n r0 -= position;\n r1 -= size + position;\n }\n min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];\n if (dragging) {\n max = (min += position) + size;\n } else {\n if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));\n if (position < min) {\n max = min;\n min = position;\n } else {\n max = position;\n }\n }\n if (extent[0] != min || extent[1] != max) {\n if (i) yExtentDomain = null; else xExtentDomain = null;\n extent[0] = min;\n extent[1] = max;\n return true;\n }\n }\n function brushend() {\n brushmove();\n g.style(\"pointer-events\", \"all\").selectAll(\".resize\").style(\"display\", brush.empty() ? \"none\" : null);\n d3.select(\"body\").style(\"cursor\", null);\n 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);\n dragRestore();\n event_({\n type: \"brushend\"\n });\n }\n }\n brush.x = function(z) {\n if (!arguments.length) return x;\n x = z;\n resizes = d3_svg_brushResizes[!x << 1 | !y];\n return brush;\n };\n brush.y = function(z) {\n if (!arguments.length) return y;\n y = z;\n resizes = d3_svg_brushResizes[!x << 1 | !y];\n return brush;\n };\n brush.clamp = function(z) {\n if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null;\n if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z;\n return brush;\n };\n brush.extent = function(z) {\n var x0, x1, y0, y1, t;\n if (!arguments.length) {\n if (x) {\n if (xExtentDomain) {\n x0 = xExtentDomain[0], x1 = xExtentDomain[1];\n } else {\n x0 = xExtent[0], x1 = xExtent[1];\n if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);\n if (x1 < x0) t = x0, x0 = x1, x1 = t;\n }\n }\n if (y) {\n if (yExtentDomain) {\n y0 = yExtentDomain[0], y1 = yExtentDomain[1];\n } else {\n y0 = yExtent[0], y1 = yExtent[1];\n if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);\n if (y1 < y0) t = y0, y0 = y1, y1 = t;\n }\n }\n return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];\n }\n if (x) {\n x0 = z[0], x1 = z[1];\n if (y) x0 = x0[0], x1 = x1[0];\n xExtentDomain = [ x0, x1 ];\n if (x.invert) x0 = x(x0), x1 = x(x1);\n if (x1 < x0) t = x0, x0 = x1, x1 = t;\n if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ];\n }\n if (y) {\n y0 = z[0], y1 = z[1];\n if (x) y0 = y0[1], y1 = y1[1];\n yExtentDomain = [ y0, y1 ];\n if (y.invert) y0 = y(y0), y1 = y(y1);\n if (y1 < y0) t = y0, y0 = y1, y1 = t;\n if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ];\n }\n return brush;\n };\n brush.clear = function() {\n if (!brush.empty()) {\n xExtent = [ 0, 0 ], yExtent = [ 0, 0 ];\n xExtentDomain = yExtentDomain = null;\n }\n return brush;\n };\n brush.empty = function() {\n return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1];\n };\n return d3.rebind(brush, event, \"on\");\n };\n var d3_svg_brushCursor = {\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n };\n var d3_svg_brushResizes = [ [ \"n\", \"e\", \"s\", \"w\", \"nw\", \"ne\", \"se\", \"sw\" ], [ \"e\", \"w\" ], [ \"n\", \"s\" ], [] ];\n var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat;\n var d3_time_formatUtc = d3_time_format.utc;\n var d3_time_formatIso = d3_time_formatUtc(\"%Y-%m-%dT%H:%M:%S.%LZ\");\n d3_time_format.iso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\") ? d3_time_formatIsoNative : d3_time_formatIso;\n function d3_time_formatIsoNative(date) {\n return date.toISOString();\n }\n d3_time_formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n d3_time_formatIsoNative.toString = d3_time_formatIso.toString;\n d3_time.second = d3_time_interval(function(date) {\n return new d3_date(Math.floor(date / 1e3) * 1e3);\n }, function(date, offset) {\n date.setTime(date.getTime() + Math.floor(offset) * 1e3);\n }, function(date) {\n return date.getSeconds();\n });\n d3_time.seconds = d3_time.second.range;\n d3_time.seconds.utc = d3_time.second.utc.range;\n d3_time.minute = d3_time_interval(function(date) {\n return new d3_date(Math.floor(date / 6e4) * 6e4);\n }, function(date, offset) {\n date.setTime(date.getTime() + Math.floor(offset) * 6e4);\n }, function(date) {\n return date.getMinutes();\n });\n d3_time.minutes = d3_time.minute.range;\n d3_time.minutes.utc = d3_time.minute.utc.range;\n d3_time.hour = d3_time_interval(function(date) {\n var timezone = date.getTimezoneOffset() / 60;\n return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);\n }, function(date, offset) {\n date.setTime(date.getTime() + Math.floor(offset) * 36e5);\n }, function(date) {\n return date.getHours();\n });\n d3_time.hours = d3_time.hour.range;\n d3_time.hours.utc = d3_time.hour.utc.range;\n d3_time.month = d3_time_interval(function(date) {\n date = d3_time.day(date);\n date.setDate(1);\n return date;\n }, function(date, offset) {\n date.setMonth(date.getMonth() + offset);\n }, function(date) {\n return date.getMonth();\n });\n d3_time.months = d3_time.month.range;\n d3_time.months.utc = d3_time.month.utc.range;\n function d3_time_scale(linear, methods, format) {\n function scale(x) {\n return linear(x);\n }\n scale.invert = function(x) {\n return d3_time_scaleDate(linear.invert(x));\n };\n scale.domain = function(x) {\n if (!arguments.length) return linear.domain().map(d3_time_scaleDate);\n linear.domain(x);\n return scale;\n };\n function tickMethod(extent, count) {\n var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target);\n return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) {\n return d / 31536e6;\n }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i];\n }\n scale.nice = function(interval, skip) {\n var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === \"number\" && tickMethod(extent, interval);\n if (method) interval = method[0], skip = method[1];\n function skipped(date) {\n return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length;\n }\n return scale.domain(d3_scale_nice(domain, skip > 1 ? {\n floor: function(date) {\n while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1);\n return date;\n },\n ceil: function(date) {\n while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1);\n return date;\n }\n } : interval));\n };\n scale.ticks = function(interval, skip) {\n var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === \"number\" ? tickMethod(extent, interval) : !interval.range && [ {\n range: interval\n }, skip ];\n if (method) interval = method[0], skip = method[1];\n return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip);\n };\n scale.tickFormat = function() {\n return format;\n };\n scale.copy = function() {\n return d3_time_scale(linear.copy(), methods, format);\n };\n return d3_scale_linearRebind(scale, linear);\n }\n function d3_time_scaleDate(t) {\n return new Date(t);\n }\n var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];\n var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ];\n var d3_time_scaleLocalFormat = d3_time_format.multi([ [ \".%L\", function(d) {\n return d.getMilliseconds();\n } ], [ \":%S\", function(d) {\n return d.getSeconds();\n } ], [ \"%I:%M\", function(d) {\n return d.getMinutes();\n } ], [ \"%I %p\", function(d) {\n return d.getHours();\n } ], [ \"%a %d\", function(d) {\n return d.getDay() && d.getDate() != 1;\n } ], [ \"%b %d\", function(d) {\n return d.getDate() != 1;\n } ], [ \"%B\", function(d) {\n return d.getMonth();\n } ], [ \"%Y\", d3_true ] ]);\n var d3_time_scaleMilliseconds = {\n range: function(start, stop, step) {\n return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate);\n },\n floor: d3_identity,\n ceil: d3_identity\n };\n d3_time_scaleLocalMethods.year = d3_time.year;\n d3_time.scale = function() {\n return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);\n };\n var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) {\n return [ m[0].utc, m[1] ];\n });\n var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ \".%L\", function(d) {\n return d.getUTCMilliseconds();\n } ], [ \":%S\", function(d) {\n return d.getUTCSeconds();\n } ], [ \"%I:%M\", function(d) {\n return d.getUTCMinutes();\n } ], [ \"%I %p\", function(d) {\n return d.getUTCHours();\n } ], [ \"%a %d\", function(d) {\n return d.getUTCDay() && d.getUTCDate() != 1;\n } ], [ \"%b %d\", function(d) {\n return d.getUTCDate() != 1;\n } ], [ \"%B\", function(d) {\n return d.getUTCMonth();\n } ], [ \"%Y\", d3_true ] ]);\n d3_time_scaleUtcMethods.year = d3_time.year.utc;\n d3_time.scale.utc = function() {\n return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat);\n };\n d3.text = d3_xhrType(function(request) {\n return request.responseText;\n });\n d3.json = function(url, callback) {\n return d3_xhr(url, \"application/json\", d3_json, callback);\n };\n function d3_json(request) {\n return JSON.parse(request.responseText);\n }\n d3.html = function(url, callback) {\n return d3_xhr(url, \"text/html\", d3_html, callback);\n };\n function d3_html(request) {\n var range = d3_document.createRange();\n range.selectNode(d3_document.body);\n return range.createContextualFragment(request.responseText);\n }\n d3.xml = d3_xhrType(function(request) {\n return request.responseXML;\n });\n if (typeof define === \"function\" && define.amd) this.d3 = d3, define(d3); else if (typeof module === \"object\" && module.exports) module.exports = d3; else this.d3 = d3;\n}();\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/d3/d3.js\n// module id = 5\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n\nmodule.exports = {\n /**\n * Standardize all missing data in calcdata to use undefined\n * never null or NaN.\n * That way we can use !==undefined, or !== BADNUM,\n * to test for real data\n */\n BADNUM: undefined,\n\n /*\n * Limit certain operations to well below floating point max value\n * to avoid glitches: Make sure that even when you multiply it by the\n * number of pixels on a giant screen it still works\n */\n FP_SAFE: Number.MAX_VALUE / 10000,\n\n /*\n * conversion of date units to milliseconds\n * year and month constants are marked \"AVG\"\n * to remind us that not all years and months\n * have the same length\n */\n ONEAVGYEAR: 31557600000, // 365.25 days\n ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR\n ONEDAY: 86400000,\n ONEHOUR: 3600000,\n ONEMIN: 60000,\n ONESEC: 1000,\n\n /*\n * For fast conversion btwn world calendars and epoch ms, the Julian Day Number\n * of the unix epoch. From calendars.instance().newDate(1970, 1, 1).toJD()\n */\n EPOCHJD: 2440587.5,\n\n /*\n * Are two values nearly equal? Compare to 1PPM\n */\n ALMOST_EQUAL: 1 - 1e-6,\n\n /*\n * If we're asked to clip a non-positive log value, how far off-screen\n * do we put it?\n */\n LOG_CLIP: 10,\n\n /*\n * not a number, but for displaying numbers: the \"minus sign\" symbol is\n * wider than the regular ascii dash \"-\"\n */\n MINUS_SIGN: '\\u2212'\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/constants/numerical.js\n// module id = 6\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar isNumeric = require('fast-isnumeric');\nvar isArrayOrTypedArray = require('./array').isArrayOrTypedArray;\n\n/**\n * convert a string s (such as 'xaxis.range[0]')\n * representing a property of nested object into set and get methods\n * also return the string and object so we don't have to keep track of them\n * allows [-1] for an array index, to set a property inside all elements\n * of an array\n * eg if obj = {arr: [{a: 1}, {a: 2}]}\n * you can do p = nestedProperty(obj, 'arr[-1].a')\n * but you cannot set the array itself this way, to do that\n * just set the whole array.\n * eg if obj = {arr: [1, 2, 3]}\n * you can't do nestedProperty(obj, 'arr[-1]').set(5)\n * but you can do nestedProperty(obj, 'arr').set([5, 5, 5])\n */\nmodule.exports = function nestedProperty(container, propStr) {\n if(isNumeric(propStr)) propStr = String(propStr);\n else if(typeof propStr !== 'string' ||\n propStr.substr(propStr.length - 4) === '[-1]') {\n throw 'bad property string';\n }\n\n var j = 0,\n propParts = propStr.split('.'),\n indexed,\n indices,\n i;\n\n // check for parts of the nesting hierarchy that are numbers (ie array elements)\n while(j < propParts.length) {\n // look for non-bracket chars, then any number of [##] blocks\n indexed = String(propParts[j]).match(/^([^\\[\\]]*)((\\[\\-?[0-9]*\\])+)$/);\n if(indexed) {\n if(indexed[1]) propParts[j] = indexed[1];\n // allow propStr to start with bracketed array indices\n else if(j === 0) propParts.splice(0, 1);\n else throw 'bad property string';\n\n indices = indexed[2]\n .substr(1, indexed[2].length - 2)\n .split('][');\n\n for(i = 0; i < indices.length; i++) {\n j++;\n propParts.splice(j, 0, Number(indices[i]));\n }\n }\n j++;\n }\n\n if(typeof container !== 'object') {\n return badContainer(container, propStr, propParts);\n }\n\n return {\n set: npSet(container, propParts, propStr),\n get: npGet(container, propParts),\n astr: propStr,\n parts: propParts,\n obj: container\n };\n};\n\nfunction npGet(cont, parts) {\n return function() {\n var curCont = cont,\n curPart,\n allSame,\n out,\n i,\n j;\n\n for(i = 0; i < parts.length - 1; i++) {\n curPart = parts[i];\n if(curPart === -1) {\n allSame = true;\n out = [];\n for(j = 0; j < curCont.length; j++) {\n out[j] = npGet(curCont[j], parts.slice(i + 1))();\n if(out[j] !== out[0]) allSame = false;\n }\n return allSame ? out[0] : out;\n }\n if(typeof curPart === 'number' && !isArrayOrTypedArray(curCont)) {\n return undefined;\n }\n curCont = curCont[curPart];\n if(typeof curCont !== 'object' || curCont === null) {\n return undefined;\n }\n }\n\n // only hit this if parts.length === 1\n if(typeof curCont !== 'object' || curCont === null) return undefined;\n\n out = curCont[parts[i]];\n if(out === null) return undefined;\n return out;\n };\n}\n\n/*\n * Can this value be deleted? We can delete `undefined`, and `null` except INSIDE an\n * *args* array.\n *\n * Previously we also deleted some `{}` and `[]`, in order to try and make set/unset\n * a net noop; but this causes far more complication than it's worth, and still had\n * lots of exceptions. See https://github.com/plotly/plotly.js/issues/1410\n *\n * *args* arrays get passed directly to API methods and we should respect null if\n * the user put it there, but otherwise null is deleted as we use it as code\n * in restyle/relayout/update for \"delete this value\" whereas undefined means\n * \"ignore this edit\"\n */\nvar ARGS_PATTERN = /(^|\\.)args\\[/;\nfunction isDeletable(val, propStr) {\n return (val === undefined) || (val === null && !propStr.match(ARGS_PATTERN));\n}\n\nfunction npSet(cont, parts, propStr) {\n return function(val) {\n var curCont = cont,\n propPart = '',\n containerLevels = [[cont, propPart]],\n toDelete = isDeletable(val, propStr),\n curPart,\n i;\n\n for(i = 0; i < parts.length - 1; i++) {\n curPart = parts[i];\n\n if(typeof curPart === 'number' && !isArrayOrTypedArray(curCont)) {\n throw 'array index but container is not an array';\n }\n\n // handle special -1 array index\n if(curPart === -1) {\n toDelete = !setArrayAll(curCont, parts.slice(i + 1), val, propStr);\n if(toDelete) break;\n else return;\n }\n\n if(!checkNewContainer(curCont, curPart, parts[i + 1], toDelete)) {\n break;\n }\n\n curCont = curCont[curPart];\n\n if(typeof curCont !== 'object' || curCont === null) {\n throw 'container is not an object';\n }\n\n propPart = joinPropStr(propPart, curPart);\n\n containerLevels.push([curCont, propPart]);\n }\n\n if(toDelete) {\n if(i === parts.length - 1) {\n delete curCont[parts[i]];\n\n // The one bit of pruning we still do: drop `undefined` from the end of arrays.\n // In case someone has already unset previous items, continue until we hit a\n // non-undefined value.\n if(Array.isArray(curCont) && +parts[i] === curCont.length - 1) {\n while(curCont.length && curCont[curCont.length - 1] === undefined) {\n curCont.pop();\n }\n }\n }\n }\n else curCont[parts[i]] = val;\n };\n}\n\nfunction joinPropStr(propStr, newPart) {\n var toAdd = newPart;\n if(isNumeric(newPart)) toAdd = '[' + newPart + ']';\n else if(propStr) toAdd = '.' + newPart;\n\n return propStr + toAdd;\n}\n\n// handle special -1 array index\nfunction setArrayAll(containerArray, innerParts, val, propStr) {\n var arrayVal = isArrayOrTypedArray(val),\n allSet = true,\n thisVal = val,\n thisPropStr = propStr.replace('-1', 0),\n deleteThis = arrayVal ? false : isDeletable(val, thisPropStr),\n firstPart = innerParts[0],\n i;\n\n for(i = 0; i < containerArray.length; i++) {\n thisPropStr = propStr.replace('-1', i);\n if(arrayVal) {\n thisVal = val[i % val.length];\n deleteThis = isDeletable(thisVal, thisPropStr);\n }\n if(deleteThis) allSet = false;\n if(!checkNewContainer(containerArray, i, firstPart, deleteThis)) {\n continue;\n }\n npSet(containerArray[i], innerParts, propStr.replace('-1', i))(thisVal);\n }\n return allSet;\n}\n\n/**\n * make new sub-container as needed.\n * returns false if there's no container and none is needed\n * because we're only deleting an attribute\n */\nfunction checkNewContainer(container, part, nextPart, toDelete) {\n if(container[part] === undefined) {\n if(toDelete) return false;\n\n if(typeof nextPart === 'number') container[part] = [];\n else container[part] = {};\n }\n return true;\n}\n\nfunction badContainer(container, propStr, propParts) {\n return {\n set: function() { throw 'bad container'; },\n get: function() {},\n astr: propStr,\n parts: propParts,\n obj: container\n };\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/nested_property.js\n// module id = 7\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar isPlainObject = require('./is_plain_object.js');\nvar isArray = Array.isArray;\n\nfunction primitivesLoopSplice(source, target) {\n var i, value;\n for(i = 0; i < source.length; i++) {\n value = source[i];\n if(value !== null && typeof(value) === 'object') {\n return false;\n }\n if(value !== void(0)) {\n target[i] = value;\n }\n }\n return true;\n}\n\nexports.extendFlat = function() {\n return _extend(arguments, false, false, false);\n};\n\nexports.extendDeep = function() {\n return _extend(arguments, true, false, false);\n};\n\nexports.extendDeepAll = function() {\n return _extend(arguments, true, true, false);\n};\n\nexports.extendDeepNoArrays = function() {\n return _extend(arguments, true, false, true);\n};\n\n/*\n * Inspired by https://github.com/justmoon/node-extend/blob/master/index.js\n * All credit to the jQuery authors for perfecting this amazing utility.\n *\n * API difference with jQuery version:\n * - No optional boolean (true -> deep extend) first argument,\n * use `extendFlat` for first-level only extend and\n * use `extendDeep` for a deep extend.\n *\n * Other differences with jQuery version:\n * - Uses a modern (and faster) isPlainObject routine.\n * - Expected to work with object {} and array [] arguments only.\n * - Does not check for circular structure.\n * FYI: jQuery only does a check across one level.\n * Warning: this might result in infinite loops.\n *\n */\nfunction _extend(inputs, isDeep, keepAllKeys, noArrayCopies) {\n var target = inputs[0],\n length = inputs.length;\n\n var input, key, src, copy, copyIsArray, clone, allPrimitives;\n\n // TODO does this do the right thing for typed arrays?\n\n if(length === 2 && isArray(target) && isArray(inputs[1]) && target.length === 0) {\n\n allPrimitives = primitivesLoopSplice(inputs[1], target);\n\n if(allPrimitives) {\n return target;\n } else {\n target.splice(0, target.length); // reset target and continue to next block\n }\n }\n\n for(var i = 1; i < length; i++) {\n input = inputs[i];\n\n for(key in input) {\n src = target[key];\n copy = input[key];\n\n // Stop early and just transfer the array if array copies are disallowed:\n if(noArrayCopies && isArray(copy)) {\n target[key] = copy;\n }\n\n // recurse if we're merging plain objects or arrays\n else if(isDeep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n if(copyIsArray) {\n copyIsArray = false;\n clone = src && isArray(src) ? src : [];\n } else {\n clone = src && isPlainObject(src) ? src : {};\n }\n\n // never move original objects, clone them\n target[key] = _extend([clone, copy], isDeep, keepAllKeys, noArrayCopies);\n }\n\n // don't bring in undefined values, except for extendDeepAll\n else if(typeof copy !== 'undefined' || keepAllKeys) {\n target[key] = copy;\n }\n }\n }\n\n return target;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/extend.js\n// module id = 8\n// module chunks = 0","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 9\n// module chunks = 0","// TinyColor v1.4.1\n// https://github.com/bgrins/TinyColor\n// Brian Grinstead, MIT License\n\n(function(Math) {\n\nvar trimLeft = /^\\s+/,\n trimRight = /\\s+$/,\n tinyCounter = 0,\n mathRound = Math.round,\n mathMin = Math.min,\n mathMax = Math.max,\n mathRandom = Math.random;\n\nfunction tinycolor (color, opts) {\n\n color = (color) ? color : '';\n opts = opts || { };\n\n // If input is already a tinycolor, return itself\n if (color instanceof tinycolor) {\n return color;\n }\n // If we are called as a function, call using new instead\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color, opts);\n }\n\n var rgb = inputToRGB(color);\n this._originalInput = color,\n this._r = rgb.r,\n this._g = rgb.g,\n this._b = rgb.b,\n this._a = rgb.a,\n this._roundA = mathRound(100*this._a) / 100,\n this._format = opts.format || rgb.format;\n this._gradientType = opts.gradientType;\n\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this._r < 1) { this._r = mathRound(this._r); }\n if (this._g < 1) { this._g = mathRound(this._g); }\n if (this._b < 1) { this._b = mathRound(this._b); }\n\n this._ok = rgb.ok;\n this._tc_id = tinyCounter++;\n}\n\ntinycolor.prototype = {\n isDark: function() {\n return this.getBrightness() < 128;\n },\n isLight: function() {\n return !this.isDark();\n },\n isValid: function() {\n return this._ok;\n },\n getOriginalInput: function() {\n return this._originalInput;\n },\n getFormat: function() {\n return this._format;\n },\n getAlpha: function() {\n return this._a;\n },\n getBrightness: function() {\n //http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n },\n getLuminance: function() {\n //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var RsRGB, GsRGB, BsRGB, R, G, B;\n RsRGB = rgb.r/255;\n GsRGB = rgb.g/255;\n BsRGB = rgb.b/255;\n\n if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}\n if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}\n if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}\n return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);\n },\n setAlpha: function(value) {\n this._a = boundAlpha(value);\n this._roundA = mathRound(100*this._a) / 100;\n return this;\n },\n toHsv: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };\n },\n toHsvString: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);\n return (this._a == 1) ?\n \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" :\n \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \"+ this._roundA + \")\";\n },\n toHsl: function() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };\n },\n toHslString: function() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);\n return (this._a == 1) ?\n \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" :\n \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \"+ this._roundA + \")\";\n },\n toHex: function(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function(allow3Char) {\n return '#' + this.toHex(allow3Char);\n },\n toHex8: function(allow4Char) {\n return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);\n },\n toHex8String: function(allow4Char) {\n return '#' + this.toHex8(allow4Char);\n },\n toRgb: function() {\n return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };\n },\n toRgbString: function() {\n return (this._a == 1) ?\n \"rgb(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \")\" :\n \"rgba(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \", \" + this._roundA + \")\";\n },\n toPercentageRgb: function() {\n return { r: mathRound(bound01(this._r, 255) * 100) + \"%\", g: mathRound(bound01(this._g, 255) * 100) + \"%\", b: mathRound(bound01(this._b, 255) * 100) + \"%\", a: this._a };\n },\n toPercentageRgbString: function() {\n return (this._a == 1) ?\n \"rgb(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%)\" :\n \"rgba(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%, \" + this._roundA + \")\";\n },\n toName: function() {\n if (this._a === 0) {\n return \"transparent\";\n }\n\n if (this._a < 1) {\n return false;\n }\n\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function(secondColor) {\n var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? \"GradientType = 1, \" : \"\";\n\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);\n }\n\n return \"progid:DXImageTransform.Microsoft.gradient(\"+gradientType+\"startColorstr=\"+hex8String+\",endColorstr=\"+secondHex8String+\")\";\n },\n toString: function(format) {\n var formatSet = !!format;\n format = format || this._format;\n\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === \"hex\" || format === \"hex6\" || format === \"hex3\" || format === \"hex4\" || format === \"hex8\" || format === \"name\");\n\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === \"name\" && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === \"rgb\") {\n formattedString = this.toRgbString();\n }\n if (format === \"prgb\") {\n formattedString = this.toPercentageRgbString();\n }\n if (format === \"hex\" || format === \"hex6\") {\n formattedString = this.toHexString();\n }\n if (format === \"hex3\") {\n formattedString = this.toHexString(true);\n }\n if (format === \"hex4\") {\n formattedString = this.toHex8String(true);\n }\n if (format === \"hex8\") {\n formattedString = this.toHex8String();\n }\n if (format === \"name\") {\n formattedString = this.toName();\n }\n if (format === \"hsl\") {\n formattedString = this.toHslString();\n }\n if (format === \"hsv\") {\n formattedString = this.toHsvString();\n }\n\n return formattedString || this.toHexString();\n },\n clone: function() {\n return tinycolor(this.toString());\n },\n\n _applyModification: function(fn, args) {\n var color = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color._r;\n this._g = color._g;\n this._b = color._b;\n this.setAlpha(color._a);\n return this;\n },\n lighten: function() {\n return this._applyModification(lighten, arguments);\n },\n brighten: function() {\n return this._applyModification(brighten, arguments);\n },\n darken: function() {\n return this._applyModification(darken, arguments);\n },\n desaturate: function() {\n return this._applyModification(desaturate, arguments);\n },\n saturate: function() {\n return this._applyModification(saturate, arguments);\n },\n greyscale: function() {\n return this._applyModification(greyscale, arguments);\n },\n spin: function() {\n return this._applyModification(spin, arguments);\n },\n\n _applyCombination: function(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function() {\n return this._applyCombination(analogous, arguments);\n },\n complement: function() {\n return this._applyCombination(complement, arguments);\n },\n monochromatic: function() {\n return this._applyCombination(monochromatic, arguments);\n },\n splitcomplement: function() {\n return this._applyCombination(splitcomplement, arguments);\n },\n triad: function() {\n return this._applyCombination(triad, arguments);\n },\n tetrad: function() {\n return this._applyCombination(tetrad, arguments);\n }\n};\n\n// If input is an object, force 1 into \"1.0\" to handle ratios properly\n// String input requires \"1.0\" as input, so 1 will be treated as 1\ntinycolor.fromRatio = function(color, opts) {\n if (typeof color == \"object\") {\n var newColor = {};\n for (var i in color) {\n if (color.hasOwnProperty(i)) {\n if (i === \"a\") {\n newColor[i] = color[i];\n }\n else {\n newColor[i] = convertToPercentage(color[i]);\n }\n }\n }\n color = newColor;\n }\n\n return tinycolor(color, opts);\n};\n\n// Given a string or object, convert that input to RGB\n// Possible string inputs:\n//\n// \"red\"\n// \"#f00\" or \"f00\"\n// \"#ff0000\" or \"ff0000\"\n// \"#ff000000\" or \"ff000000\"\n// \"rgb 255 0 0\" or \"rgb (255, 0, 0)\"\n// \"rgb 1.0 0 0\" or \"rgb (1, 0, 0)\"\n// \"rgba (255, 0, 0, 1)\" or \"rgba 255, 0, 0, 1\"\n// \"rgba (1.0, 0, 0, 1)\" or \"rgba 1.0, 0, 0, 1\"\n// \"hsl(0, 100%, 50%)\" or \"hsl 0 100% 50%\"\n// \"hsla(0, 100%, 50%, 1)\" or \"hsla 0 100% 50%, 1\"\n// \"hsv(0, 100%, 100%)\" or \"hsv 0 100% 100%\"\n//\nfunction inputToRGB(color) {\n\n var rgb = { r: 0, g: 0, b: 0 };\n var a = 1;\n var s = null;\n var v = null;\n var l = null;\n var ok = false;\n var format = false;\n\n if (typeof color == \"string\") {\n color = stringInputToObject(color);\n }\n\n if (typeof color == \"object\") {\n if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {\n rgb = rgbToRgb(color.r, color.g, color.b);\n ok = true;\n format = String(color.r).substr(-1) === \"%\" ? \"prgb\" : \"rgb\";\n }\n else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {\n s = convertToPercentage(color.s);\n v = convertToPercentage(color.v);\n rgb = hsvToRgb(color.h, s, v);\n ok = true;\n format = \"hsv\";\n }\n else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {\n s = convertToPercentage(color.s);\n l = convertToPercentage(color.l);\n rgb = hslToRgb(color.h, s, l);\n ok = true;\n format = \"hsl\";\n }\n\n if (color.hasOwnProperty(\"a\")) {\n a = color.a;\n }\n }\n\n a = boundAlpha(a);\n\n return {\n ok: ok,\n format: color.format || format,\n r: mathMin(255, mathMax(rgb.r, 0)),\n g: mathMin(255, mathMax(rgb.g, 0)),\n b: mathMin(255, mathMax(rgb.b, 0)),\n a: a\n };\n}\n\n\n// Conversion Functions\n// --------------------\n\n// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:\n// \n\n// `rgbToRgb`\n// Handle bounds / percentage checking to conform to CSS color spec\n// \n// *Assumes:* r, g, b in [0, 255] or [0, 1]\n// *Returns:* { r, g, b } in [0, 255]\nfunction rgbToRgb(r, g, b){\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n}\n\n// `rgbToHsl`\n// Converts an RGB color value to HSL.\n// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]\n// *Returns:* { h, s, l } in [0,1]\nfunction rgbToHsl(r, g, b) {\n\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min) {\n h = s = 0; // achromatic\n }\n else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n\n h /= 6;\n }\n\n return { h: h, s: s, l: l };\n}\n\n// `hslToRgb`\n// Converts an HSL color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\nfunction hslToRgb(h, s, l) {\n var r, g, b;\n\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n\n function hue2rgb(p, q, t) {\n if(t < 0) t += 1;\n if(t > 1) t -= 1;\n if(t < 1/6) return p + (q - p) * 6 * t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n }\n\n if(s === 0) {\n r = g = b = l; // achromatic\n }\n else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n}\n\n// `rgbToHsv`\n// Converts an RGB color value to HSV\n// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]\n// *Returns:* { h, s, v } in [0,1]\nfunction rgbToHsv(r, g, b) {\n\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, v = max;\n\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n\n if(max == min) {\n h = 0; // achromatic\n }\n else {\n switch(max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h, s: s, v: v };\n}\n\n// `hsvToRgb`\n// Converts an HSV color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\n function hsvToRgb(h, s, v) {\n\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n\n var i = Math.floor(h),\n f = h - i,\n p = v * (1 - s),\n q = v * (1 - f * s),\n t = v * (1 - (1 - f) * s),\n mod = i % 6,\n r = [v, q, p, p, t, v][mod],\n g = [t, v, v, q, p, p][mod],\n b = [p, p, t, v, v, q][mod];\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n}\n\n// `rgbToHex`\n// Converts an RGB color to hex\n// Assumes r, g, and b are contained in the set [0, 255]\n// Returns a 3 or 6 character hex\nfunction rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n 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)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n}\n\n// `rgbaToHex`\n// Converts an RGBA color plus alpha transparency to hex\n// Assumes r, g, b are contained in the set [0, 255] and\n// a in [0, 1]. Returns a 4 or 8 character rgba hex\nfunction rgbaToHex(r, g, b, a, allow4Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16)),\n pad2(convertDecimalToHex(a))\n ];\n\n // Return a 4 character hex if possible\n 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)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);\n }\n\n return hex.join(\"\");\n}\n\n// `rgbaToArgbHex`\n// Converts an RGBA color to an ARGB Hex8 string\n// Rarely used, but required for \"toFilter()\"\nfunction rgbaToArgbHex(r, g, b, a) {\n\n var hex = [\n pad2(convertDecimalToHex(a)),\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n return hex.join(\"\");\n}\n\n// `equals`\n// Can be called with any tinycolor input\ntinycolor.equals = function (color1, color2) {\n if (!color1 || !color2) { return false; }\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n};\n\ntinycolor.random = function() {\n return tinycolor.fromRatio({\n r: mathRandom(),\n g: mathRandom(),\n b: mathRandom()\n });\n};\n\n\n// Modification Functions\n// ----------------------\n// Thanks to less.js for some of the basics here\n// \n\nfunction desaturate(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\n\nfunction saturate(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\n\nfunction greyscale(color) {\n return tinycolor(color).desaturate(100);\n}\n\nfunction lighten (color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\nfunction brighten(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var rgb = tinycolor(color).toRgb();\n rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));\n rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));\n rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));\n return tinycolor(rgb);\n}\n\nfunction darken (color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\n// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n// Values outside of this range will be wrapped into this range.\nfunction spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}\n\n// Combination Functions\n// ---------------------\n// Thanks to jQuery xColor for some of the ideas behind these\n// \n\nfunction complement(color) {\n var hsl = tinycolor(color).toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return tinycolor(hsl);\n}\n\nfunction triad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })\n ];\n}\n\nfunction tetrad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })\n ];\n}\n\nfunction splitcomplement(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),\n tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})\n ];\n}\n\nfunction analogous(color, results, slices) {\n results = results || 6;\n slices = slices || 30;\n\n var hsl = tinycolor(color).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color)];\n\n for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(tinycolor(hsl));\n }\n return ret;\n}\n\nfunction monochromatic(color, results) {\n results = results || 6;\n var hsv = tinycolor(color).toHsv();\n var h = hsv.h, s = hsv.s, v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n\n while (results--) {\n ret.push(tinycolor({ h: h, s: s, v: v}));\n v = (v + modification) % 1;\n }\n\n return ret;\n}\n\n// Utility Functions\n// ---------------------\n\ntinycolor.mix = function(color1, color2, amount) {\n amount = (amount === 0) ? 0 : (amount || 50);\n\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n\n var p = amount / 100;\n\n var rgba = {\n r: ((rgb2.r - rgb1.r) * p) + rgb1.r,\n g: ((rgb2.g - rgb1.g) * p) + rgb1.g,\n b: ((rgb2.b - rgb1.b) * p) + rgb1.b,\n a: ((rgb2.a - rgb1.a) * p) + rgb1.a\n };\n\n return tinycolor(rgba);\n};\n\n\n// Readability Functions\n// ---------------------\n// false\n// tinycolor.isReadable(\"#000\", \"#111\",{level:\"AA\",size:\"large\"}) => false\ntinycolor.isReadable = function(color1, color2, wcag2) {\n var readability = tinycolor.readability(color1, color2);\n var wcag2Parms, out;\n\n out = false;\n\n wcag2Parms = validateWCAG2Parms(wcag2);\n switch (wcag2Parms.level + wcag2Parms.size) {\n case \"AAsmall\":\n case \"AAAlarge\":\n out = readability >= 4.5;\n break;\n case \"AAlarge\":\n out = readability >= 3;\n break;\n case \"AAAsmall\":\n out = readability >= 7;\n break;\n }\n return out;\n\n};\n\n// `mostReadable`\n// Given a base color and a list of possible foreground or background\n// colors for that base, returns the most readable color.\n// Optionally returns Black or White if the most readable color is unreadable.\n// *Example*\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:false}).toHexString(); // \"#112255\"\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:true}).toHexString(); // \"#ffffff\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"large\"}).toHexString(); // \"#faf3f3\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"small\"}).toHexString(); // \"#ffffff\"\ntinycolor.mostReadable = function(baseColor, colorList, args) {\n var bestColor = null;\n var bestScore = 0;\n var readability;\n var includeFallbackColors, level, size ;\n args = args || {};\n includeFallbackColors = args.includeFallbackColors ;\n level = args.level;\n size = args.size;\n\n for (var i= 0; i < colorList.length ; i++) {\n readability = tinycolor.readability(baseColor, colorList[i]);\n if (readability > bestScore) {\n bestScore = readability;\n bestColor = tinycolor(colorList[i]);\n }\n }\n\n if (tinycolor.isReadable(baseColor, bestColor, {\"level\":level,\"size\":size}) || !includeFallbackColors) {\n return bestColor;\n }\n else {\n args.includeFallbackColors=false;\n return tinycolor.mostReadable(baseColor,[\"#fff\", \"#000\"],args);\n }\n};\n\n\n// Big List of Colors\n// ------------------\n// \nvar names = tinycolor.names = {\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n};\n\n// Make it easy to access colors via `hexNames[hex]`\nvar hexNames = tinycolor.hexNames = flip(names);\n\n\n// Utilities\n// ---------\n\n// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`\nfunction flip(o) {\n var flipped = { };\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n}\n\n// Return a valid alpha value [0,1] with all invalid values being set to 1\nfunction boundAlpha(a) {\n a = parseFloat(a);\n\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n\n return a;\n}\n\n// Take input from [0, n] and return it as [0, 1]\nfunction bound01(n, max) {\n if (isOnePointZero(n)) { n = \"100%\"; }\n\n var processPercent = isPercentage(n);\n n = mathMin(max, mathMax(0, parseFloat(n)));\n\n // Automatically convert percentage into number\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n\n // Handle floating point rounding errors\n if ((Math.abs(n - max) < 0.000001)) {\n return 1;\n }\n\n // Convert into [0, 1] range if it isn't already\n return (n % max) / parseFloat(max);\n}\n\n// Force a number between 0 and 1\nfunction clamp01(val) {\n return mathMin(1, mathMax(0, val));\n}\n\n// Parse a base-16 hex value into a base-10 integer\nfunction parseIntFromHex(val) {\n return parseInt(val, 16);\n}\n\n// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1\n// \nfunction isOnePointZero(n) {\n return typeof n == \"string\" && n.indexOf('.') != -1 && parseFloat(n) === 1;\n}\n\n// Check to see if string passed in is a percentage\nfunction isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}\n\n// Force a hex value to have 2 characters\nfunction pad2(c) {\n return c.length == 1 ? '0' + c : '' + c;\n}\n\n// Replace a decimal with it's percentage value\nfunction convertToPercentage(n) {\n if (n <= 1) {\n n = (n * 100) + \"%\";\n }\n\n return n;\n}\n\n// Converts a decimal to a hex value\nfunction convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n}\n// Converts a hex value to a decimal\nfunction convertHexToDecimal(h) {\n return (parseIntFromHex(h) / 255);\n}\n\nvar matchers = (function() {\n\n // \n var CSS_INTEGER = \"[-\\\\+]?\\\\d+%?\";\n\n // \n var CSS_NUMBER = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\";\n\n // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.\n var CSS_UNIT = \"(?:\" + CSS_NUMBER + \")|(?:\" + CSS_INTEGER + \")\";\n\n // Actual matching.\n // Parentheses and commas are optional, but not required.\n // Whitespace can take the place of commas or opening paren\n var PERMISSIVE_MATCH3 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n var PERMISSIVE_MATCH4 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n\n return {\n CSS_UNIT: new RegExp(CSS_UNIT),\n rgb: new RegExp(\"rgb\" + PERMISSIVE_MATCH3),\n rgba: new RegExp(\"rgba\" + PERMISSIVE_MATCH4),\n hsl: new RegExp(\"hsl\" + PERMISSIVE_MATCH3),\n hsla: new RegExp(\"hsla\" + PERMISSIVE_MATCH4),\n hsv: new RegExp(\"hsv\" + PERMISSIVE_MATCH3),\n hsva: new RegExp(\"hsva\" + PERMISSIVE_MATCH4),\n hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n})();\n\n// `isValidCSSUnit`\n// Take in a single string / number and check to see if it looks like a CSS unit\n// (see `matchers` above for definition).\nfunction isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}\n\n// `stringInputToObject`\n// Permissive string parsing. Take in a number of formats, and output an object\n// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`\nfunction stringInputToObject(color) {\n\n color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();\n var named = false;\n if (names[color]) {\n color = names[color];\n named = true;\n }\n else if (color == 'transparent') {\n return { r: 0, g: 0, b: 0, a: 0, format: \"name\" };\n }\n\n // Try to match string input using regular expressions.\n // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]\n // Just return an object and let the conversion functions handle that.\n // This way the result will be the same whether the tinycolor is initialized with string or object.\n var match;\n if ((match = matchers.rgb.exec(color))) {\n return { r: match[1], g: match[2], b: match[3] };\n }\n if ((match = matchers.rgba.exec(color))) {\n return { r: match[1], g: match[2], b: match[3], a: match[4] };\n }\n if ((match = matchers.hsl.exec(color))) {\n return { h: match[1], s: match[2], l: match[3] };\n }\n if ((match = matchers.hsla.exec(color))) {\n return { h: match[1], s: match[2], l: match[3], a: match[4] };\n }\n if ((match = matchers.hsv.exec(color))) {\n return { h: match[1], s: match[2], v: match[3] };\n }\n if ((match = matchers.hsva.exec(color))) {\n return { h: match[1], s: match[2], v: match[3], a: match[4] };\n }\n if ((match = matchers.hex8.exec(color))) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n a: convertHexToDecimal(match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if ((match = matchers.hex6.exec(color))) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n if ((match = matchers.hex4.exec(color))) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n a: convertHexToDecimal(match[4] + '' + match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if ((match = matchers.hex3.exec(color))) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n\n return false;\n}\n\nfunction validateWCAG2Parms(parms) {\n // return valid WCAG2 parms for isReadable.\n // If input parms are invalid, return {\"level\":\"AA\", \"size\":\"small\"}\n var level, size;\n parms = parms || {\"level\":\"AA\", \"size\":\"small\"};\n level = (parms.level || \"AA\").toUpperCase();\n size = (parms.size || \"small\").toLowerCase();\n if (level !== \"AA\" && level !== \"AAA\") {\n level = \"AA\";\n }\n if (size !== \"small\" && size !== \"large\") {\n size = \"small\";\n }\n return {\"level\":level, \"size\":size};\n}\n\n// Node: Export function\nif (typeof module !== \"undefined\" && module.exports) {\n module.exports = tinycolor;\n}\n// AMD/requirejs: Define the module\nelse if (typeof define === 'function' && define.amd) {\n define(function () {return tinycolor;});\n}\n// Browser: Expose to window\nelse {\n window.tinycolor = tinycolor;\n}\n\n})(Math);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/tinycolor2/tinycolor.js\n// module id = 10\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar fxAttrs = require('../components/fx/attributes');\n\nmodule.exports = {\n type: {\n valType: 'enumerated',\n \n values: [], // listed dynamically\n dflt: 'scatter',\n editType: 'calc+clearAxisTypes',\n _noTemplating: true // we handle this at a higher level\n },\n visible: {\n valType: 'enumerated',\n values: [true, false, 'legendonly'],\n \n dflt: true,\n editType: 'calc',\n \n },\n showlegend: {\n valType: 'boolean',\n \n dflt: true,\n editType: 'style',\n \n },\n legendgroup: {\n valType: 'string',\n \n dflt: '',\n editType: 'style',\n \n },\n opacity: {\n valType: 'number',\n \n min: 0,\n max: 1,\n dflt: 1,\n editType: 'style',\n \n },\n name: {\n valType: 'string',\n \n editType: 'style',\n \n },\n uid: {\n valType: 'string',\n \n editType: 'plot'\n },\n ids: {\n valType: 'data_array',\n editType: 'calc',\n \n },\n customdata: {\n valType: 'data_array',\n editType: 'calc',\n \n },\n\n // N.B. these cannot be 'data_array' as they do not have the same length as\n // other data arrays and arrayOk attributes in general\n //\n // Maybe add another valType:\n // https://github.com/plotly/plotly.js/issues/1894\n selectedpoints: {\n valType: 'any',\n \n editType: 'calc',\n \n },\n\n hoverinfo: {\n valType: 'flaglist',\n \n flags: ['x', 'y', 'z', 'text', 'name'],\n extras: ['all', 'none', 'skip'],\n arrayOk: true,\n dflt: 'all',\n editType: 'none',\n \n },\n hoverlabel: fxAttrs.hoverlabel,\n stream: {\n token: {\n valType: 'string',\n noBlank: true,\n strict: true,\n \n editType: 'calc',\n \n },\n maxpoints: {\n valType: 'number',\n min: 0,\n max: 10000,\n dflt: 500,\n \n editType: 'calc',\n \n },\n editType: 'calc'\n },\n transforms: {\n _isLinkedToArray: 'transform',\n editType: 'calc',\n \n },\n uirevision: {\n valType: 'any',\n \n editType: 'none',\n \n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/plots/attributes.js\n// module id = 11\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n/*\n * make a font attribute group\n *\n * @param {object} opts\n * @param {string}\n * opts.description: where & how this font is used\n * @param {optional bool} arrayOk:\n * should each part (family, size, color) be arrayOk? default false.\n * @param {string} editType:\n * the editType for all pieces of this font\n * @param {optional string} colorEditType:\n * a separate editType just for color\n *\n * @return {object} attributes object containing {family, size, color} as specified\n */\nmodule.exports = function(opts) {\n var editType = opts.editType;\n var colorEditType = opts.colorEditType;\n if(colorEditType === undefined) colorEditType = editType;\n var attrs = {\n family: {\n valType: 'string',\n \n noBlank: true,\n strict: true,\n editType: editType,\n \n },\n size: {\n valType: 'number',\n \n min: 1,\n editType: editType\n },\n color: {\n valType: 'color',\n \n editType: colorEditType\n },\n editType: editType,\n // blank strings so compress_attributes can remove\n // TODO - that's uber hacky... better solution?\n \n };\n\n if(opts.arrayOk) {\n attrs.family.arrayOk = true;\n attrs.size.arrayOk = true;\n attrs.color.arrayOk = true;\n }\n\n return attrs;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/plots/font_attributes.js\n// module id = 12\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar tinycolor = require('tinycolor2');\n\nvar scales = {\n 'Greys': [\n [0, 'rgb(0,0,0)'], [1, 'rgb(255,255,255)']\n ],\n\n 'YlGnBu': [\n [0, 'rgb(8,29,88)'], [0.125, 'rgb(37,52,148)'],\n [0.25, 'rgb(34,94,168)'], [0.375, 'rgb(29,145,192)'],\n [0.5, 'rgb(65,182,196)'], [0.625, 'rgb(127,205,187)'],\n [0.75, 'rgb(199,233,180)'], [0.875, 'rgb(237,248,217)'],\n [1, 'rgb(255,255,217)']\n ],\n\n 'Greens': [\n [0, 'rgb(0,68,27)'], [0.125, 'rgb(0,109,44)'],\n [0.25, 'rgb(35,139,69)'], [0.375, 'rgb(65,171,93)'],\n [0.5, 'rgb(116,196,118)'], [0.625, 'rgb(161,217,155)'],\n [0.75, 'rgb(199,233,192)'], [0.875, 'rgb(229,245,224)'],\n [1, 'rgb(247,252,245)']\n ],\n\n 'YlOrRd': [\n [0, 'rgb(128,0,38)'], [0.125, 'rgb(189,0,38)'],\n [0.25, 'rgb(227,26,28)'], [0.375, 'rgb(252,78,42)'],\n [0.5, 'rgb(253,141,60)'], [0.625, 'rgb(254,178,76)'],\n [0.75, 'rgb(254,217,118)'], [0.875, 'rgb(255,237,160)'],\n [1, 'rgb(255,255,204)']\n ],\n\n 'Bluered': [\n [0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']\n ],\n\n // modified RdBu based on\n // www.sandia.gov/~kmorel/documents/ColorMaps/ColorMapsExpanded.pdf\n 'RdBu': [\n [0, 'rgb(5,10,172)'], [0.35, 'rgb(106,137,247)'],\n [0.5, 'rgb(190,190,190)'], [0.6, 'rgb(220,170,132)'],\n [0.7, 'rgb(230,145,90)'], [1, 'rgb(178,10,28)']\n ],\n\n // Scale for non-negative numeric values\n 'Reds': [\n [0, 'rgb(220,220,220)'], [0.2, 'rgb(245,195,157)'],\n [0.4, 'rgb(245,160,105)'], [1, 'rgb(178,10,28)']\n ],\n\n // Scale for non-positive numeric values\n 'Blues': [\n [0, 'rgb(5,10,172)'], [0.35, 'rgb(40,60,190)'],\n [0.5, 'rgb(70,100,245)'], [0.6, 'rgb(90,120,245)'],\n [0.7, 'rgb(106,137,247)'], [1, 'rgb(220,220,220)']\n ],\n\n 'Picnic': [\n [0, 'rgb(0,0,255)'], [0.1, 'rgb(51,153,255)'],\n [0.2, 'rgb(102,204,255)'], [0.3, 'rgb(153,204,255)'],\n [0.4, 'rgb(204,204,255)'], [0.5, 'rgb(255,255,255)'],\n [0.6, 'rgb(255,204,255)'], [0.7, 'rgb(255,153,255)'],\n [0.8, 'rgb(255,102,204)'], [0.9, 'rgb(255,102,102)'],\n [1, 'rgb(255,0,0)']\n ],\n\n 'Rainbow': [\n [0, 'rgb(150,0,90)'], [0.125, 'rgb(0,0,200)'],\n [0.25, 'rgb(0,25,255)'], [0.375, 'rgb(0,152,255)'],\n [0.5, 'rgb(44,255,150)'], [0.625, 'rgb(151,255,0)'],\n [0.75, 'rgb(255,234,0)'], [0.875, 'rgb(255,111,0)'],\n [1, 'rgb(255,0,0)']\n ],\n\n 'Portland': [\n [0, 'rgb(12,51,131)'], [0.25, 'rgb(10,136,186)'],\n [0.5, 'rgb(242,211,56)'], [0.75, 'rgb(242,143,56)'],\n [1, 'rgb(217,30,30)']\n ],\n\n 'Jet': [\n [0, 'rgb(0,0,131)'], [0.125, 'rgb(0,60,170)'],\n [0.375, 'rgb(5,255,255)'], [0.625, 'rgb(255,255,0)'],\n [0.875, 'rgb(250,0,0)'], [1, 'rgb(128,0,0)']\n ],\n\n 'Hot': [\n [0, 'rgb(0,0,0)'], [0.3, 'rgb(230,0,0)'],\n [0.6, 'rgb(255,210,0)'], [1, 'rgb(255,255,255)']\n ],\n\n 'Blackbody': [\n [0, 'rgb(0,0,0)'], [0.2, 'rgb(230,0,0)'],\n [0.4, 'rgb(230,210,0)'], [0.7, 'rgb(255,255,255)'],\n [1, 'rgb(160,200,255)']\n ],\n\n 'Earth': [\n [0, 'rgb(0,0,130)'], [0.1, 'rgb(0,180,180)'],\n [0.2, 'rgb(40,210,40)'], [0.4, 'rgb(230,230,50)'],\n [0.6, 'rgb(120,70,20)'], [1, 'rgb(255,255,255)']\n ],\n\n 'Electric': [\n [0, 'rgb(0,0,0)'], [0.15, 'rgb(30,0,100)'],\n [0.4, 'rgb(120,0,100)'], [0.6, 'rgb(160,90,0)'],\n [0.8, 'rgb(230,200,0)'], [1, 'rgb(255,250,220)']\n ],\n\n 'Viridis': [\n [0, '#440154'], [0.06274509803921569, '#48186a'],\n [0.12549019607843137, '#472d7b'], [0.18823529411764706, '#424086'],\n [0.25098039215686274, '#3b528b'], [0.3137254901960784, '#33638d'],\n [0.3764705882352941, '#2c728e'], [0.4392156862745098, '#26828e'],\n [0.5019607843137255, '#21918c'], [0.5647058823529412, '#1fa088'],\n [0.6274509803921569, '#28ae80'], [0.6901960784313725, '#3fbc73'],\n [0.7529411764705882, '#5ec962'], [0.8156862745098039, '#84d44b'],\n [0.8784313725490196, '#addc30'], [0.9411764705882353, '#d8e219'],\n [1, '#fde725']\n ],\n\n 'Cividis': [\n [0.000000, 'rgb(0,32,76)'], [0.058824, 'rgb(0,42,102)'],\n [0.117647, 'rgb(0,52,110)'], [0.176471, 'rgb(39,63,108)'],\n [0.235294, 'rgb(60,74,107)'], [0.294118, 'rgb(76,85,107)'],\n [0.352941, 'rgb(91,95,109)'], [0.411765, 'rgb(104,106,112)'],\n [0.470588, 'rgb(117,117,117)'], [0.529412, 'rgb(131,129,120)'],\n [0.588235, 'rgb(146,140,120)'], [0.647059, 'rgb(161,152,118)'],\n [0.705882, 'rgb(176,165,114)'], [0.764706, 'rgb(192,177,109)'],\n [0.823529, 'rgb(209,191,102)'], [0.882353, 'rgb(225,204,92)'],\n [0.941176, 'rgb(243,219,79)'], [1.000000, 'rgb(255,233,69)']\n ]\n};\n\nvar defaultScale = scales.RdBu;\n\nfunction getScale(scl, dflt) {\n if(!dflt) dflt = defaultScale;\n if(!scl) return dflt;\n\n function parseScale() {\n try {\n scl = scales[scl] || JSON.parse(scl);\n } catch(e) {\n scl = dflt;\n }\n }\n\n if(typeof scl === 'string') {\n parseScale();\n // occasionally scl is double-JSON encoded...\n if(typeof scl === 'string') parseScale();\n }\n\n if(!isValidScaleArray(scl)) return dflt;\n return scl;\n}\n\n\nfunction isValidScaleArray(scl) {\n var highestVal = 0;\n\n if(!Array.isArray(scl) || scl.length < 2) return false;\n\n if(!scl[0] || !scl[scl.length - 1]) return false;\n\n if(+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;\n\n for(var i = 0; i < scl.length; i++) {\n var si = scl[i];\n\n if(si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) {\n return false;\n }\n\n highestVal = +si[0];\n }\n\n return true;\n}\n\nfunction isValidScale(scl) {\n if(scales[scl] !== undefined) return true;\n else return isValidScaleArray(scl);\n}\n\nmodule.exports = {\n scales: scales,\n defaultScale: defaultScale,\n\n get: getScale,\n isValid: isValidScale\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/components/colorscale/scales.js\n// module id = 13\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n/*\n * make a regex for matching counter ids/names ie xaxis, xaxis2, xaxis10...\n *\n * @param {string} head: the head of the pattern, eg 'x' matches 'x', 'x2', 'x10' etc.\n * 'xy' is a special case for cartesian subplots: it matches 'x2y3' etc\n * @param {Optional(string)} tail: a fixed piece after the id\n * eg counterRegex('scene', '.annotations') for scene2.annotations etc.\n * @param {boolean} openEnded: if true, the string may continue past the match.\n * @param {boolean} matchBeginning: if false, the string may start before the match.\n */\nexports.counter = function(head, tail, openEnded, matchBeginning) {\n var fullTail = (tail || '') + (openEnded ? '' : '$');\n var startWithPrefix = matchBeginning === false ? '' : '^';\n if(head === 'xy') {\n return new RegExp(startWithPrefix + 'x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?' + fullTail);\n }\n return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/regex.js\n// module id = 14\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Loggers = require('./lib/loggers');\nvar noop = require('./lib/noop');\nvar pushUnique = require('./lib/push_unique');\nvar isPlainObject = require('./lib/is_plain_object');\nvar ExtendModule = require('./lib/extend');\n\nvar basePlotAttributes = require('./plots/attributes');\nvar baseLayoutAttributes = require('./plots/layout_attributes');\n\nvar extendFlat = ExtendModule.extendFlat;\nvar extendDeepAll = ExtendModule.extendDeepAll;\n\nexports.modules = {};\nexports.allCategories = {};\nexports.allTypes = [];\nexports.subplotsRegistry = {};\nexports.transformsRegistry = {};\nexports.componentsRegistry = {};\nexports.layoutArrayContainers = [];\nexports.layoutArrayRegexes = [];\nexports.traceLayoutAttributes = {};\nexports.localeRegistry = {};\nexports.apiMethodRegistry = {};\n\n/**\n * Top-level register routine, exported as Plotly.register\n *\n * @param {object array or array of objects} _modules :\n * module object or list of module object to register.\n *\n * A valid `moduleType: 'trace'` module has fields:\n * - name {string} : the trace type\n * - categories {array} : categories associated with this trace type,\n * tested with Register.traceIs()\n * - meta {object} : meta info (mostly for plot-schema)\n *\n * A valid `moduleType: 'locale'` module has fields:\n * - name {string} : the locale name. Should be a 2-digit language string ('en', 'de')\n * optionally with a country/region code ('en-GB', 'de-CH'). If a country\n * code is used but the base language locale has not yet been supplied,\n * we will use this locale for the base as well.\n * - dictionary {object} : the dictionary mapping input strings to localized strings\n * generally the keys should be the literal input strings, but\n * if default translations are provided you can use any string as a key.\n * - format {object} : a `d3.locale` format specifier for this locale\n * any omitted keys we'll fall back on en-US.\n *\n * A valid `moduleType: 'transform'` module has fields:\n * - name {string} : transform name\n * - transform {function} : default-level transform function\n * - calcTransform {function} : calc-level transform function\n * - attributes {object} : transform attributes declarations\n * - supplyDefaults {function} : attributes default-supply function\n *\n * A valid `moduleType: 'component'` module has fields:\n * - name {string} : the component name, used it with Register.getComponentMethod()\n * to employ component method.\n *\n * A valid `moduleType: 'apiMethod'` module has fields:\n * - name {string} : the api method name.\n * - fn {function} : the api method called with Register.call();\n *\n */\nexports.register = function register(_modules) {\n if(!_modules) {\n throw new Error('No argument passed to Plotly.register.');\n } else if(_modules && !Array.isArray(_modules)) {\n _modules = [_modules];\n }\n\n for(var i = 0; i < _modules.length; i++) {\n var newModule = _modules[i];\n\n if(!newModule) {\n throw new Error('Invalid module was attempted to be registered!');\n }\n\n switch(newModule.moduleType) {\n case 'trace':\n registerTraceModule(newModule);\n break;\n case 'transform':\n registerTransformModule(newModule);\n break;\n case 'component':\n registerComponentModule(newModule);\n break;\n case 'locale':\n registerLocale(newModule);\n break;\n case 'apiMethod':\n var name = newModule.name;\n exports.apiMethodRegistry[name] = newModule.fn;\n break;\n default:\n throw new Error('Invalid module was attempted to be registered!');\n }\n }\n};\n\n/**\n * Get registered module using trace object or trace type\n *\n * @param {object||string} trace\n * trace object with prop 'type' or trace type as a string\n * @return {object}\n * module object corresponding to trace type\n */\nexports.getModule = function(trace) {\n var _module = exports.modules[getTraceType(trace)];\n if(!_module) return false;\n return _module._module;\n};\n\n/**\n * Determine if this trace type is in a given category\n *\n * @param {object||string} traceType\n * a trace (object) or trace type (string)\n * @param {string} category\n * category in question\n * @return {boolean}\n */\nexports.traceIs = function(traceType, category) {\n traceType = getTraceType(traceType);\n\n // old plot.ly workspace hack, nothing to see here\n if(traceType === 'various') return false;\n\n var _module = exports.modules[traceType];\n\n if(!_module) {\n if(traceType && traceType !== 'area') {\n Loggers.log('Unrecognized trace type ' + traceType + '.');\n }\n\n _module = exports.modules[basePlotAttributes.type.dflt];\n }\n\n return !!_module.categories[category];\n};\n\n/**\n * Determine if this trace has a transform of the given type and return\n * array of matching indices.\n *\n * @param {object} data\n * a trace object (member of data or fullData)\n * @param {string} type\n * type of trace to test\n * @return {array}\n * array of matching indices. If none found, returns []\n */\nexports.getTransformIndices = function(data, type) {\n var indices = [];\n var transforms = data.transforms || [];\n for(var i = 0; i < transforms.length; i++) {\n if(transforms[i].type === type) {\n indices.push(i);\n }\n }\n return indices;\n};\n\n/**\n * Determine if this trace has a transform of the given type\n *\n * @param {object} data\n * a trace object (member of data or fullData)\n * @param {string} type\n * type of trace to test\n * @return {boolean}\n */\nexports.hasTransform = function(data, type) {\n var transforms = data.transforms || [];\n for(var i = 0; i < transforms.length; i++) {\n if(transforms[i].type === type) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Retrieve component module method. Falls back on noop if either the\n * module or the method is missing, so the result can always be safely called\n *\n * @param {string} name\n * name of component (as declared in component module)\n * @param {string} method\n * name of component module method\n * @return {function}\n */\nexports.getComponentMethod = function(name, method) {\n var _module = exports.componentsRegistry[name];\n\n if(!_module) return noop;\n return _module[method] || noop;\n};\n\n/**\n * Call registered api method.\n *\n * @param {string} name : api method name\n * @param {...array} args : arguments passed to api method\n * @return {any} : returns api method output\n */\nexports.call = function() {\n var name = arguments[0];\n var args = [].slice.call(arguments, 1);\n return exports.apiMethodRegistry[name].apply(null, args);\n};\n\nfunction registerTraceModule(_module) {\n var thisType = _module.name;\n var categoriesIn = _module.categories;\n var meta = _module.meta;\n\n if(exports.modules[thisType]) {\n Loggers.log('Type ' + thisType + ' already registered');\n return;\n }\n\n if(!exports.subplotsRegistry[_module.basePlotModule.name]) {\n registerSubplot(_module.basePlotModule);\n }\n\n var categoryObj = {};\n for(var i = 0; i < categoriesIn.length; i++) {\n categoryObj[categoriesIn[i]] = true;\n exports.allCategories[categoriesIn[i]] = true;\n }\n\n exports.modules[thisType] = {\n _module: _module,\n categories: categoryObj\n };\n\n if(meta && Object.keys(meta).length) {\n exports.modules[thisType].meta = meta;\n }\n\n exports.allTypes.push(thisType);\n\n for(var componentName in exports.componentsRegistry) {\n mergeComponentAttrsToTrace(componentName, thisType);\n }\n\n /*\n * Collect all trace layout attributes in one place for easier lookup later\n * but don't merge them into the base schema as it would confuse the docs\n * (at least after https://github.com/plotly/documentation/issues/202 gets done!)\n */\n if(_module.layoutAttributes) {\n extendFlat(exports.traceLayoutAttributes, _module.layoutAttributes);\n }\n}\n\nfunction registerSubplot(_module) {\n var plotType = _module.name;\n\n if(exports.subplotsRegistry[plotType]) {\n Loggers.log('Plot type ' + plotType + ' already registered.');\n return;\n }\n\n // relayout array handling will look for component module methods with this\n // name and won't find them because this is a subplot module... but that\n // should be fine, it will just fall back on redrawing the plot.\n findArrayRegexps(_module);\n\n // not sure what's best for the 'cartesian' type at this point\n exports.subplotsRegistry[plotType] = _module;\n\n for(var componentName in exports.componentsRegistry) {\n mergeComponentAttrsToSubplot(componentName, _module.name);\n }\n}\n\nfunction registerComponentModule(_module) {\n if(typeof _module.name !== 'string') {\n throw new Error('Component module *name* must be a string.');\n }\n\n var name = _module.name;\n exports.componentsRegistry[name] = _module;\n\n if(_module.layoutAttributes) {\n if(_module.layoutAttributes._isLinkedToArray) {\n pushUnique(exports.layoutArrayContainers, name);\n }\n findArrayRegexps(_module);\n }\n\n for(var traceType in exports.modules) {\n mergeComponentAttrsToTrace(name, traceType);\n }\n\n for(var subplotName in exports.subplotsRegistry) {\n mergeComponentAttrsToSubplot(name, subplotName);\n }\n\n for(var transformType in exports.transformsRegistry) {\n mergeComponentAttrsToTransform(name, transformType);\n }\n\n if(_module.schema && _module.schema.layout) {\n extendDeepAll(baseLayoutAttributes, _module.schema.layout);\n }\n}\n\nfunction registerTransformModule(_module) {\n if(typeof _module.name !== 'string') {\n throw new Error('Transform module *name* must be a string.');\n }\n\n var prefix = 'Transform module ' + _module.name;\n var hasTransform = typeof _module.transform === 'function';\n var hasCalcTransform = typeof _module.calcTransform === 'function';\n\n if(!hasTransform && !hasCalcTransform) {\n throw new Error(prefix + ' is missing a *transform* or *calcTransform* method.');\n }\n if(hasTransform && hasCalcTransform) {\n Loggers.log([\n prefix + ' has both a *transform* and *calcTransform* methods.',\n 'Please note that all *transform* methods are executed',\n 'before all *calcTransform* methods.'\n ].join(' '));\n }\n if(!isPlainObject(_module.attributes)) {\n Loggers.log(prefix + ' registered without an *attributes* object.');\n }\n if(typeof _module.supplyDefaults !== 'function') {\n Loggers.log(prefix + ' registered without a *supplyDefaults* method.');\n }\n\n exports.transformsRegistry[_module.name] = _module;\n\n for(var componentName in exports.componentsRegistry) {\n mergeComponentAttrsToTransform(componentName, _module.name);\n }\n}\n\nfunction registerLocale(_module) {\n var locale = _module.name;\n var baseLocale = locale.split('-')[0];\n\n var newDict = _module.dictionary;\n var newFormat = _module.format;\n var hasDict = newDict && Object.keys(newDict).length;\n var hasFormat = newFormat && Object.keys(newFormat).length;\n\n var locales = exports.localeRegistry;\n\n var localeObj = locales[locale];\n if(!localeObj) locales[locale] = localeObj = {};\n\n // Should we use this dict for the base locale?\n // In case we're overwriting a previous dict for this locale, check\n // whether the base matches the full locale dict now. If we're not\n // overwriting, locales[locale] is undefined so this just checks if\n // baseLocale already had a dict or not.\n // Same logic for dateFormats\n if(baseLocale !== locale) {\n var baseLocaleObj = locales[baseLocale];\n if(!baseLocaleObj) locales[baseLocale] = baseLocaleObj = {};\n\n if(hasDict && baseLocaleObj.dictionary === localeObj.dictionary) {\n baseLocaleObj.dictionary = newDict;\n }\n if(hasFormat && baseLocaleObj.format === localeObj.format) {\n baseLocaleObj.format = newFormat;\n }\n }\n\n if(hasDict) localeObj.dictionary = newDict;\n if(hasFormat) localeObj.format = newFormat;\n}\n\nfunction findArrayRegexps(_module) {\n if(_module.layoutAttributes) {\n var arrayAttrRegexps = _module.layoutAttributes._arrayAttrRegexps;\n if(arrayAttrRegexps) {\n for(var i = 0; i < arrayAttrRegexps.length; i++) {\n pushUnique(exports.layoutArrayRegexes, arrayAttrRegexps[i]);\n }\n }\n }\n}\n\nfunction mergeComponentAttrsToTrace(componentName, traceType) {\n var componentSchema = exports.componentsRegistry[componentName].schema;\n if(!componentSchema || !componentSchema.traces) return;\n\n var traceAttrs = componentSchema.traces[traceType];\n if(traceAttrs) {\n extendDeepAll(exports.modules[traceType]._module.attributes, traceAttrs);\n }\n}\n\nfunction mergeComponentAttrsToTransform(componentName, transformType) {\n var componentSchema = exports.componentsRegistry[componentName].schema;\n if(!componentSchema || !componentSchema.transforms) return;\n\n var transformAttrs = componentSchema.transforms[transformType];\n if(transformAttrs) {\n extendDeepAll(exports.transformsRegistry[transformType].attributes, transformAttrs);\n }\n}\n\nfunction mergeComponentAttrsToSubplot(componentName, subplotName) {\n var componentSchema = exports.componentsRegistry[componentName].schema;\n if(!componentSchema || !componentSchema.subplots) return;\n\n var subplotModule = exports.subplotsRegistry[subplotName];\n var subplotAttrs = subplotModule.layoutAttributes;\n var subplotAttr = subplotModule.attr === 'subplot' ? subplotModule.name : subplotModule.attr;\n if(Array.isArray(subplotAttr)) subplotAttr = subplotAttr[0];\n\n var componentLayoutAttrs = componentSchema.subplots[subplotAttr];\n if(subplotAttrs && componentLayoutAttrs) {\n extendDeepAll(subplotAttrs, componentLayoutAttrs);\n }\n}\n\nfunction getTraceType(traceType) {\n if(typeof traceType === 'object') traceType = traceType.type;\n return traceType;\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/registry.js\n// module id = 15\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n// Simple helper functions\n// none of these need any external deps\n\nmodule.exports = function noop() {};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/noop.js\n// module id = 16\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n/**\n * Push array with unique items\n *\n * Ignores falsy items, except 0 so we can use it to construct arrays of indices.\n *\n * @param {array} array\n * array to be filled\n * @param {any} item\n * item to be or not to be inserted\n * @return {array}\n * ref to array (now possibly containing one more item)\n *\n */\nmodule.exports = function pushUnique(array, item) {\n if(item instanceof RegExp) {\n var itemStr = item.toString(),\n i;\n for(i = 0; i < array.length; i++) {\n if(array[i] instanceof RegExp && array[i].toString() === itemStr) {\n return array;\n }\n }\n array.push(item);\n }\n else if((item || item === 0) && array.indexOf(item) === -1) array.push(item);\n\n return array;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/push_unique.js\n// module id = 17\n// module chunks = 0","/**\n* Copyright 2012-2018, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n// Simple helper functions\n// none of these need any external deps\n\nmodule.exports = function identity(d) { return d; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/plotly.js/src/lib/identity.js\n// module id = 18\n// module chunks = 0","module.exports = {\"name\":\"plotlywidget\",\"version\":\"0.6.0\",\"description\":\"The plotly.py ipywidgets library\",\"author\":\"The plotly.py team\",\"license\":\"MIT\",\"main\":\"src/index.js\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/plotly/plotly.py\"},\"keywords\":[\"jupyter\",\"widgets\",\"ipython\",\"ipywidgets\",\"plotly\"],\"files\":[\"src/**/*.js\",\"dist/*.js\"],\"scripts\":{\"clean\":\"rimraf dist/ && rimraf ../plotlywidget/static\",\"prepublish\":\"webpack\",\"test\":\"echo \\\"Error: no test specified\\\" && exit 1\"},\"devDependencies\":{\"webpack\":\"^3.10.0\",\"rimraf\":\"^2.6.1\",\"ify-loader\":\"^1.1.0\"},\"dependencies\":{\"plotly.js\":\"1.43.1\",\"@jupyter-widgets/base\":\"^1.0.0\",\"lodash\":\"^4.17.4\"},\"jupyterlab\":{\"extension\":\"src/jupyterlab-plugin\"}}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./package.json\n// module id = 19\n// module chunks = 0","// Export widget models and views, and the npm package version number.\nmodule.exports = require('./Figure.js');\nmodule.exports['version'] = require('../package.json').version;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/index.js\n// module id = 20\n// module chunks = 0","var widgets = require(\"@jupyter-widgets/base\");\nvar _ = require(\"lodash\");\n\nwindow.PlotlyConfig = {MathJaxConfig: 'local'};\nvar Plotly = require(\"plotly.js/dist/plotly\");\nvar PlotlyIndex = require(\"plotly.js/src/lib/index\");\nvar semver_range = \"^\" + require(\"../package.json\").version;\n\n// Model\n// =====\n/**\n * A FigureModel holds a mirror copy of the state of a FigureWidget on\n * the Python side. There is a one-to-one relationship between JavaScript\n * FigureModels and Python FigureWidgets. The JavaScript FigureModel is\n * initialized as soon as a Python FigureWidget initialized, this happens\n * even before the widget is first displayed in the Notebook\n * @type {widgets.DOMWidgetModel}\n */\nvar FigureModel = widgets.DOMWidgetModel.extend({\n\n defaults: _.extend(widgets.DOMWidgetModel.prototype.defaults(), {\n // Model metadata\n // --------------\n _model_name: \"FigureModel\",\n _view_name: \"FigureView\",\n _model_module: \"plotlywidget\",\n _view_module: \"plotlywidget\",\n _view_module_version: semver_range,\n _model_module_version: semver_range,\n\n // Data and Layout\n // ---------------\n // The _data and _layout properties are synchronized with the\n // Python side on initialization only. After initialization, these\n // properties are kept in sync through the use of the _py2js_*\n // messages\n _data: [],\n _layout: {},\n _config: {},\n\n // Python -> JS messages\n // ---------------------\n // Messages are implemented using trait properties. This is done so\n // that we can take advantage of ipywidget's binary serialization\n // protocol.\n //\n // Messages are sent by the Python side by assigning the message\n // contents to the appropriate _py2js_* property, and then immediately\n // setting it to None. Messages are received by the JavaScript\n // side by registering property change callbacks in the initialize\n // methods for FigureModel and FigureView. e.g. (where this is a\n // FigureModel):\n //\n // this.on('change:_py2js_addTraces', this.do_addTraces, this);\n //\n // Message handling methods, do_addTraces, are responsible for\n // performing the appropriate action if the message contents are\n // not null\n\n /**\n * @typedef {null|Object} Py2JsAddTracesMsg\n * @property {Array.} trace_data\n * Array of traces to append to the end of the figure's current traces\n * @property {Number} trace_edit_id\n * Edit ID to use when returning trace deltas using\n * the _js2py_traceDeltas message.\n * @property {Number} layout_edit_id\n * Edit ID to use when returning layout deltas using\n * the _js2py_layoutDelta message.\n */\n _py2js_addTraces: null,\n\n /**\n * @typedef {null|Object} Py2JsDeleteTracesMsg\n * @property {Array.} delete_inds\n * Array of indexes of traces to be deleted, in ascending order\n * @property {Number} trace_edit_id\n * Edit ID to use when returning trace deltas using\n * the _js2py_traceDeltas message.\n * @property {Number} layout_edit_id\n * Edit ID to use when returning layout deltas using\n * the _js2py_layoutDelta message.\n */\n _py2js_deleteTraces: null,\n\n /**\n * @typedef {null|Object} Py2JsMoveTracesMsg\n * @property {Array.} current_trace_inds\n * Array of the current indexes of traces to be moved\n * @property {Array.} new_trace_inds\n * Array of the new indexes that traces should be moved to.\n */\n _py2js_moveTraces: null,\n\n\n /**\n * @typedef {null|Object} Py2JsRestyleMsg\n * @property {Object} restyle_data\n * Restyle data as accepted by Plotly.restyle\n * @property {null|Array.} restyle_traces\n * Array of indexes of the traces that the resytle operation applies\n * to, or null to apply the operation to all traces\n * @property {Number} trace_edit_id\n * Edit ID to use when returning trace deltas using\n * the _js2py_traceDeltas message\n * @property {Number} layout_edit_id\n * Edit ID to use when returning layout deltas using\n * the _js2py_layoutDelta message\n * @property {null|String} source_view_id\n * view_id of the FigureView that triggered the original restyle\n * event (e.g. by clicking the legend), or null if the restyle was\n * triggered from Python\n */\n _py2js_restyle: null,\n\n /**\n * @typedef {null|Object} Py2JsRelayoutMsg\n * @property {Object} relayout_data\n * Relayout data as accepted by Plotly.relayout\n * @property {Number} layout_edit_id\n * Edit ID to use when returning layout deltas using\n * the _js2py_layoutDelta message\n * @property {null|String} source_view_id\n * view_id of the FigureView that triggered the original relayout\n * event (e.g. by clicking the zoom button), or null if the\n * relayout was triggered from Python\n */\n _py2js_relayout: null,\n\n /**\n * @typedef {null|Object} Py2JsUpdateMsg\n * @property {Object} style_data\n * Style data as accepted by Plotly.update\n * @property {Object} layout_data\n * Layout data as accepted by Plotly.update\n * @property {Array.} style_traces\n * Array of indexes of the traces that the update operation applies\n * to, or null to apply the operation to all traces\n * @property {Number} trace_edit_id\n * Edit ID to use when returning trace deltas using\n * the _js2py_traceDeltas message\n * @property {Number} layout_edit_id\n * Edit ID to use when returning layout deltas using\n * the _js2py_layoutDelta message\n * @property {null|String} source_view_id\n * view_id of the FigureView that triggered the original update\n * event (e.g. by clicking a button), or null if the update was\n * triggered from Python\n */\n _py2js_update: null,\n\n /**\n * @typedef {null|Object} Py2JsAnimateMsg\n * @property {Object} style_data\n * Style data as accepted by Plotly.animate\n * @property {Object} layout_data\n * Layout data as accepted by Plotly.animate\n * @property {Array.} style_traces\n * Array of indexes of the traces that the animate operation applies\n * to, or null to apply the operation to all traces\n * @property {Object} animation_opts\n * Animation options as accepted by Plotly.animate\n * @property {Number} trace_edit_id\n * Edit ID to use when returning trace deltas using\n * the _js2py_traceDeltas message\n * @property {Number} layout_edit_id\n * Edit ID to use when returning layout deltas using\n * the _js2py_layoutDelta message\n * @property {null|String} source_view_id\n * view_id of the FigureView that triggered the original animate\n * event (e.g. by clicking a button), or null if the update was\n * triggered from Python\n */\n _py2js_animate: null,\n\n /**\n * @typedef {null|Object} Py2JsRemoveLayoutPropsMsg\n * @property {Array.>} remove_props\n * Array of property paths to remove. Each propery path is an\n * array of property names or array indexes that locate a property\n * inside the _layout object\n */\n _py2js_removeLayoutProps: null,\n\n /**\n * @typedef {null|Object} Py2JsRemoveTracePropsMsg\n * @property {Number} remove_trace\n * The index of the trace from which to remove properties\n * @property {Array.>} remove_props\n * Array of property paths to remove. Each propery path is an\n * array of property names or array indexes that locate a property\n * inside the _data[remove_trace] object\n */\n _py2js_removeTraceProps: null,\n\n\n // JS -> Python messages\n // ---------------------\n // Messages are sent by the JavaScript side by assigning the\n // message contents to the appropriate _js2py_* property and then\n // calling the `touch` method on the view that triggered the\n // change. e.g. (where this is a FigureView):\n //\n // this.model.set('_js2py_restyle', data);\n // this.touch();\n //\n // The Python side is responsible for setting the property to None\n // after receiving the message.\n //\n // Message trigger logic is described in the corresponding\n // handle_plotly_* methods of FigureView\n\n /**\n * @typedef {null|Object} Js2PyRestyleMsg\n * @property {Object} style_data\n * Style data that was passed to Plotly.restyle\n * @property {Array.} style_traces\n * Array of indexes of the traces that the restyle operation\n * was applied to, or null if applied to all traces\n * @property {String} source_view_id\n * view_id of the FigureView that triggered the original restyle\n * event (e.g. by clicking the legend)\n */\n _js2py_restyle: null,\n\n /**\n * @typedef {null|Object} Js2PyRelayoutMsg\n * @property {Object} relayout_data\n * Relayout data that was passed to Plotly.relayout\n * @property {String} source_view_id\n * view_id of the FigureView that triggered the original relayout\n * event (e.g. by clicking the zoom button)\n */\n _js2py_relayout: null,\n\n /**\n * @typedef {null|Object} Js2PyUpdateMsg\n * @property {Object} style_data\n * Style data that was passed to Plotly.update\n * @property {Object} layout_data\n * Layout data that was passed to Plotly.update\n * @property {Array.} style_traces\n * Array of indexes of the traces that the update operation applied\n * to, or null if applied to all traces\n * @property {String} source_view_id\n * view_id of the FigureView that triggered the original relayout\n * event (e.g. by clicking the zoom button)\n */\n _js2py_update: null,\n\n /**\n * @typedef {null|Object} Js2PyLayoutDeltaMsg\n * @property {Object} layout_delta\n * The layout delta object that contains all of the properties of\n * _fullLayout that are not identical to those in the\n * FigureModel's _layout property\n * @property {Number} layout_edit_id\n * Edit ID of message that triggered the creation of layout delta\n */\n _js2py_layoutDelta: null,\n\n /**\n * @typedef {null|Object} Js2PyTraceDeltasMsg\n * @property {Array.} trace_deltas\n * Array of trace delta objects. Each trace delta contains the\n * trace's uid along with all of the properties of _fullData that\n * are not identical to those in the FigureModel's _data property\n * @property {Number} trace_edit_id\n * Edit ID of message that triggered the creation of trace deltas\n */\n _js2py_traceDeltas: null,\n\n\n /**\n * Object representing a collection of points for use in click, hover,\n * and selection events\n * @typedef {Object} Points\n * @property {Array.} trace_indexes\n * Array of the trace index for each point\n * @property {Array.} point_indexes\n * Array of the index of each point in its own trace\n * @property {null|Array.} xs\n * Array of the x coordinate of each point (for cartesian trace types)\n * or null (for non-cartesian trace types)\n * @property {null|Array.} ys\n * Array of the y coordinate of each point (for cartesian trace types)\n * or null (for non-cartesian trace types\n * @property {null|Array.} zs\n * Array of the z coordinate of each point (for 3D cartesian\n * trace types)\n * or null (for non-3D-cartesian trace types)\n */\n\n /**\n * Object representing the state of the input devices during a\n * plotly event\n * @typedef {Object} InputDeviceState\n * @property {boolean} alt - true if alt key pressed,\n * false otherwise\n * @property {boolean} ctrl - true if ctrl key pressed,\n * false otherwise\n * @property {boolean} meta - true if meta key pressed,\n * false otherwise\n * @property {boolean} shift - true if shift key pressed,\n * false otherwise\n *\n * @property {boolean} button\n * Indicates which button was pressed on the mouse to trigger the\n * event.\n * 0: Main button pressed, usually the left button or the\n * un-initialized state\n * 1: Auxiliary button pressed, usually the wheel button or\n * the middle button (if present)\n * 2: Secondary button pressed, usually the right button\n * 3: Fourth button, typically the Browser Back button\n * 4: Fifth button, typically the Browser Forward button\n *\n * @property {boolean} buttons\n * Indicates which buttons were pressed on the mouse when the event\n * is triggered.\n * 0 : No button or un-initialized\n * 1 : Primary button (usually left)\n * 2 : Secondary button (usually right)\n * 4 : Auxilary button (usually middle or mouse wheel button)\n * 8 : 4th button (typically the \"Browser Back\" button)\n * 16 : 5th button (typically the \"Browser Forward\" button)\n *\n * Combinations of buttons are represented by the sum of the codes\n * above. e.g. a value of 7 indicates buttons 1 (primary),\n * 2 (secondary), and 4 (auxilary) were pressed during the event\n */\n\n /**\n * @typedef {Object} BoxSelectorState\n * @property {Array.} xrange\n * Two element array containing the x-range of the box selection\n * @property {Array.} yrange\n * Two element array containing the y-range of the box selection\n */\n\n /**\n * @typedef {Object} LassoSelectorState\n * @property {Array.} xs\n * Array of the x-coordinates of the lasso selection region\n * @property {Array.} ys\n * Array of the y-coordinates of the lasso selection region\n */\n\n /**\n * Object representing the state of the selection tool during a\n * plotly_select event\n * @typedef {Object} Selector\n * @property {String} type\n * Selection type. One of: 'box', or 'lasso'\n * @property {BoxSelectorState|LassoSelectorState} selector_state\n */\n\n /**\n * @typedef {null|Object} Js2PyPointsCallbackMsg\n * @property {string} event_type\n * Name of the triggering event. One of 'plotly_click',\n * 'plotly_hover', 'plotly_unhover', or 'plotly_selected'\n * @property {null|Points} points\n * Points object for event\n * @property {null|InputDeviceState} device_state\n * InputDeviceState object for event\n * @property {null|Selector} selector\n * State of the selection tool for 'plotly_selected' events, null\n * for other event types\n */\n _js2py_pointsCallback: null,\n\n // Message tracking\n // ----------------\n /**\n * @type {Number}\n * layout_edit_id of the last layout modification operation\n * requested by the Python side\n */\n _last_layout_edit_id: 0,\n\n /**\n * @type {Number}\n * trace_edit_id of the last trace modification operation\n * requested by the Python side\n */\n _last_trace_edit_id: 0\n }),\n\n /**\n * Initialize FigureModel. Called when the Python FigureWidget is first\n * constructed\n */\n initialize: function() {\n FigureModel.__super__.initialize.apply(this, arguments);\n\n this.on(\"change:_data\", this.do_data, this);\n this.on(\"change:_layout\", this.do_layout, this);\n this.on(\"change:_py2js_addTraces\", this.do_addTraces, this);\n this.on(\"change:_py2js_deleteTraces\", this.do_deleteTraces, this);\n this.on(\"change:_py2js_moveTraces\", this.do_moveTraces, this);\n this.on(\"change:_py2js_restyle\", this.do_restyle, this);\n this.on(\"change:_py2js_relayout\", this.do_relayout, this);\n this.on(\"change:_py2js_update\", this.do_update, this);\n this.on(\"change:_py2js_animate\", this.do_animate, this);\n this.on(\"change:_py2js_removeLayoutProps\",\n this.do_removeLayoutProps, this);\n this.on(\"change:_py2js_removeTraceProps\",\n this.do_removeTraceProps, this);\n },\n\n /**\n * Input a trace index specification and return an Array of trace\n * indexes where:\n *\n * - null|undefined -> Array of all traces\n * - Trace index as Number -> Single element array of input index\n * - Array of trace indexes -> Input array unchanged\n *\n * @param {undefined|null|Number|Array.} trace_indexes\n * @returns {Array.}\n * Array of trace indexes\n * @private\n */\n _normalize_trace_indexes: function (trace_indexes) {\n if (trace_indexes === null || trace_indexes === undefined) {\n var numTraces = this.get(\"_data\").length;\n trace_indexes = _.range(numTraces);\n }\n if (!Array.isArray(trace_indexes)) {\n // Make sure idx is an array\n trace_indexes = [trace_indexes];\n }\n return trace_indexes\n },\n\n /**\n * Log changes to the _data trait\n *\n * This should only happed on FigureModel initialization\n */\n do_data: function () {\n\n },\n\n /**\n * Log changes to the _layout trait\n *\n * This should only happed on FigureModel initialization\n */\n do_layout: function () {\n\n },\n\n /**\n * Handle addTraces message\n */\n do_addTraces: function () {\n // add trace to plot\n /** @type {Py2JsAddTracesMsg} */\n var msgData = this.get(\"_py2js_addTraces\");\n\n if (msgData !== null) {\n var currentTraces = this.get(\"_data\");\n var newTraces = msgData.trace_data;\n _.forEach(newTraces, function (newTrace) {\n currentTraces.push(newTrace);\n })\n }\n },\n\n /**\n * Handle deleteTraces message\n */\n do_deleteTraces: function () {\n // remove traces from plot\n\n /** @type {Py2JsDeleteTracesMsg} */\n var msgData = this.get(\"_py2js_deleteTraces\");\n\n if (msgData !== null) {\n var delete_inds = msgData.delete_inds;\n var tracesData = this.get(\"_data\");\n\n // Remove del inds in reverse order so indexes remain valid\n // throughout loop\n delete_inds.slice().reverse().forEach(function (del_ind) {\n tracesData.splice(del_ind, 1);\n });\n }\n },\n\n /**\n * Handle moveTraces message\n */\n do_moveTraces: function () {\n\n /** @type {Py2JsMoveTracesMsg} */\n var msgData = this.get(\"_py2js_moveTraces\");\n\n if (msgData !== null) {\n var tracesData = this.get(\"_data\");\n var currentInds = msgData.current_trace_inds;\n var newInds = msgData.new_trace_inds;\n\n performMoveTracesLike(tracesData, currentInds, newInds);\n }\n },\n\n /**\n * Handle restyle message\n */\n do_restyle: function () {\n\n /** @type {Py2JsRestyleMsg} */\n var msgData = this.get(\"_py2js_restyle\");\n if (msgData !== null) {\n var restyleData = msgData.restyle_data;\n var restyleTraces = this._normalize_trace_indexes(\n msgData.restyle_traces);\n performRestyleLike(this.get(\"_data\"), restyleData, restyleTraces);\n }\n },\n\n /**\n * Handle relayout message\n */\n do_relayout: function () {\n\n /** @type {Py2JsRelayoutMsg} */\n var msgData = this.get(\"_py2js_relayout\");\n\n if (msgData !== null) {\n performRelayoutLike(this.get(\"_layout\"), msgData.relayout_data);\n }\n },\n\n /**\n * Handle update message\n */\n do_update: function() {\n\n /** @type {Py2JsUpdateMsg} */\n var msgData = this.get(\"_py2js_update\");\n\n if (msgData !== null) {\n var style = msgData.style_data;\n var layout = msgData.layout_data;\n var styleTraces = this._normalize_trace_indexes(\n msgData.style_traces);\n performRestyleLike(this.get(\"_data\"), style, styleTraces);\n performRelayoutLike(this.get(\"_layout\"), layout);\n }\n },\n\n /**\n * Handle animate message\n */\n do_animate: function () {\n\n /** @type {Py2JsAnimateMsg} */\n var msgData = this.get(\"_py2js_animate\");\n if (msgData !== null) {\n\n var styles = msgData.style_data;\n var layout = msgData.layout_data;\n var trace_indexes = this._normalize_trace_indexes(\n msgData.style_traces);\n\n for (var i = 0; i < styles.length; i++) {\n var style = styles[i];\n var trace_index = trace_indexes[i];\n var trace = this.get(\"_data\")[trace_index];\n performRelayoutLike(trace, style);\n }\n\n performRelayoutLike(this.get(\"_layout\"), layout);\n }\n },\n\n /**\n * Handle removeLayoutProps message\n */\n do_removeLayoutProps: function () {\n /** @type {Py2JsRemoveLayoutPropsMsg} */\n var msgData = this.get(\"_py2js_removeLayoutProps\");\n\n if (msgData !== null) {\n var keyPaths = msgData.remove_props;\n var layout = this.get(\"_layout\");\n performRemoveProps(layout, keyPaths);\n }\n },\n\n /**\n * Handle removeTraceProps message\n */\n do_removeTraceProps: function () {\n /** @type {Py2JsRemoveTracePropsMsg} */\n var msgData = this.get(\"_py2js_removeTraceProps\");\n if (msgData !== null) {\n var keyPaths = msgData.remove_props;\n var traceIndex = msgData.remove_trace;\n var trace = this.get(\"_data\")[traceIndex];\n\n performRemoveProps(trace, keyPaths);\n }\n }\n}, {\n serializers: _.extend({\n _data: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _layout: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_addTraces: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_deleteTraces: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_moveTraces: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_restyle: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_relayout: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_update: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_animate: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_removeLayoutProps: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _py2js_removeTraceProps: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _js2py_restyle: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _js2py_relayout: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _js2py_update: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _js2py_layoutDelta: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _js2py_traceDeltas: { deserialize: py2js_deserializer,\n serialize: js2py_serializer},\n _js2py_pointsCallback: { deserialize: py2js_deserializer,\n serialize: js2py_serializer}\n }, widgets.DOMWidgetModel.serializers)\n});\n\n// View\n// ====\n/**\n * A FigureView manages the visual presentation of a single Plotly.js\n * figure for a single notebook output cell. Each FigureView has a\n * reference to FigureModel. Multiple views may share a single model\n * instance, as is the case when a Python FigureWidget is displayed in\n * multiple notebook output cells.\n *\n * @type {widgets.DOMWidgetView}\n */\nvar FigureView = widgets.DOMWidgetView.extend({\n\n /**\n * The perform_render method is called by processPhosphorMessage\n * after the widget's DOM element has been attached to the notebook\n * output cell. This happens after the initialize of the\n * FigureModel, and it won't happen at all if the Python FigureWidget\n * is never displayed in a notebook output cell\n */\n perform_render: function() {\n\n var that = this;\n\n // Wire up message property callbacks\n // ----------------------------------\n // Python -> JS event properties\n this.model.on(\"change:_py2js_addTraces\",\n this.do_addTraces, this);\n this.model.on(\"change:_py2js_deleteTraces\",\n this.do_deleteTraces, this);\n this.model.on(\"change:_py2js_moveTraces\",\n this.do_moveTraces, this);\n this.model.on(\"change:_py2js_restyle\",\n this.do_restyle, this);\n this.model.on(\"change:_py2js_relayout\",\n this.do_relayout, this);\n this.model.on(\"change:_py2js_update\",\n this.do_update, this);\n this.model.on(\"change:_py2js_animate\",\n this.do_animate, this);\n\n // MathJax configuration\n // ---------------------\n if (window.MathJax) {\n MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});\n }\n\n // Get message ids\n // ---------------------\n var layout_edit_id = this.model.get(\"_last_layout_edit_id\");\n var trace_edit_id = this.model.get(\"_last_trace_edit_id\");\n\n // Set view UID\n // ------------\n this.viewID = PlotlyIndex.randstr();\n\n // Initialize Plotly.js figure\n // ---------------------------\n // We must clone the model's data and layout properties so that\n // the model is not directly mutated by the Plotly.js library.\n var initialTraces = _.cloneDeep(this.model.get(\"_data\"));\n var initialLayout = _.cloneDeep(this.model.get(\"_layout\"));\n var config = this.model.get(\"_config\");\n\n Plotly.newPlot(that.el, initialTraces, initialLayout, config).then(\n function () {\n\n // ### Send trace deltas ###\n // We create an array of deltas corresponding to the new\n // traces.\n that._sendTraceDeltas(trace_edit_id);\n\n // ### Send layout delta ###\n that._sendLayoutDelta(layout_edit_id);\n\n // Wire up plotly event callbacks\n that.el.on(\"plotly_restyle\",\n function (update) {\n that.handle_plotly_restyle(update)\n });\n that.el.on(\"plotly_relayout\",\n function (update) {\n that.handle_plotly_relayout(update)\n });\n that.el.on(\"plotly_update\",\n function (update) {\n that.handle_plotly_update(update)\n });\n that.el.on(\"plotly_click\",\n function (update) {\n that.handle_plotly_click(update)\n });\n that.el.on(\"plotly_hover\",\n function (update) {\n that.handle_plotly_hover(update)\n });\n that.el.on(\"plotly_unhover\",\n function (update) {\n that.handle_plotly_unhover(update)\n });\n that.el.on(\"plotly_selected\",\n function (update) {\n that.handle_plotly_selected(update)\n });\n that.el.on(\"plotly_doubleclick\",\n function (update) {\n that.handle_plotly_doubleclick(update)\n });\n\n // Emit event indicating that the widget has finished\n // rendering\n var event = new CustomEvent(\"plotlywidget-after-render\",\n { \"detail\": {\"element\": that.el, 'viewID': that.viewID}});\n\n // Dispatch/Trigger/Fire the event\n document.dispatchEvent(event);\n });\n },\n\n /**\n * Respond to phosphorjs events\n */\n processPhosphorMessage: function(msg) {\n FigureView.__super__.processPhosphorMessage.apply(this, arguments);\n var that = this;\n switch (msg.type) {\n case 'before-attach':\n // Render an initial empty figure. This establishes with\n // the page that the element will not be empty, avoiding\n // some occasions where the dynamic sizing behavior leads\n // to collapsed figure dimensions.\n var axisHidden = {\n showgrid: false, showline: false, tickvals: []};\n\n Plotly.newPlot(that.el, [], {\n xaxis: axisHidden, yaxis: axisHidden\n });\n\n window.addEventListener(\"resize\", function(){\n that.autosizeFigure();\n });\n break;\n case 'after-attach':\n // Rendering actual figure in the after-attach event allows\n // Plotly.js to size the figure to fill the available element\n this.perform_render();\n break;\n case 'resize':\n this.autosizeFigure();\n break\n }\n },\n\n autosizeFigure: function() {\n var that = this;\n var layout = that.model.get('_layout');\n if (_.isNil(layout) ||\n _.isNil(layout.width)) {\n Plotly.Plots.resize(that.el).then(function(){\n var layout_edit_id = that.model.get(\n \"_last_layout_edit_id\");\n that._sendLayoutDelta(layout_edit_id);\n });\n }\n },\n\n /**\n * Purge Plotly.js data structures from the notebook output display\n * element when the view is destroyed\n */\n destroy: function() {\n Plotly.purge(this.el);\n },\n\n /**\n * Return the figure's _fullData array merged with its data array\n *\n * The merge ensures that for any properties that el._fullData and\n * el.data have in common, we return the version from el.data\n *\n * Named colorscales are one example of why this is needed. The el.data\n * array will hold named colorscale strings (e.g. 'Viridis'), while the\n * el._fullData array will hold the actual colorscale array. e.g.\n *\n * el.data[0].marker.colorscale == 'Viridis' but\n * el._fullData[0].marker.colorscale = [[..., ...], ...]\n *\n * Performing the merge allows our FigureModel to retain the 'Viridis'\n * string, rather than having it overridded by the colorscale array.\n *\n */\n getFullData: function () {\n return _.mergeWith({}, this.el._fullData, this.el.data,\n fullMergeCustomizer)\n },\n\n /**\n * Return the figure's _fullLayout object merged with its layout object\n *\n * See getFullData documentation for discussion of why the merge is\n * necessary\n */\n getFullLayout: function () {\n return _.mergeWith({}, this.el._fullLayout, this.el.layout,\n fullMergeCustomizer);\n },\n\n /**\n * Build Points data structure from data supplied by the plotly_click,\n * plotly_hover, or plotly_select events\n * @param {Object} data\n * @returns {null|Points}\n */\n buildPointsObject: function (data) {\n\n var pointsObject;\n if (data.hasOwnProperty(\"points\")) {\n // Most cartesian plots\n var pointObjects = data[\"points\"];\n var numPoints = pointObjects.length;\n pointsObject = {\n \"trace_indexes\": new Array(numPoints),\n \"point_indexes\": new Array(numPoints),\n \"xs\": new Array(numPoints),\n \"ys\": new Array(numPoints)};\n\n\n for (var p = 0; p < numPoints; p++) {\n pointsObject[\"trace_indexes\"][p] =\n pointObjects[p][\"curveNumber\"];\n pointsObject[\"point_indexes\"][p] =\n pointObjects[p][\"pointNumber\"];\n pointsObject[\"xs\"][p] =\n pointObjects[p][\"x\"];\n pointsObject[\"ys\"][p] =\n pointObjects[p][\"y\"];\n }\n\n // Add z if present\n var hasZ = pointObjects[0] !==\n undefined && pointObjects[0].hasOwnProperty(\"z\");\n if (hasZ) {\n pointsObject[\"zs\"] = new Array(numPoints);\n for (p = 0; p < numPoints; p++) {\n pointsObject[\"zs\"][p] = pointObjects[p][\"z\"];\n }\n }\n\n return pointsObject\n } else {\n return null\n }\n },\n\n /**\n * Build InputDeviceState data structure from data supplied by the\n * plotly_click, plotly_hover, or plotly_select events\n * @param {Object} data\n * @returns {null|InputDeviceState}\n */\n buildInputDeviceStateObject: function (data) {\n var event = data[\"event\"];\n if (event === undefined) {\n return null;\n } else {\n /** @type {InputDeviceState} */\n var inputDeviceState = {\n // Keyboard modifiers\n \"alt\": event[\"altKey\"],\n \"ctrl\": event[\"ctrlKey\"],\n \"meta\": event[\"metaKey\"],\n \"shift\": event[\"shiftKey\"],\n\n // Mouse buttons\n \"button\": event[\"button\"],\n \"buttons\": event[\"buttons\"]\n };\n return inputDeviceState\n }\n },\n\n /**\n * Build Selector data structure from data supplied by the\n * plotly_select event\n * @param data\n * @returns {null|Selector}\n */\n buildSelectorObject: function(data) {\n\n var selectorObject;\n\n if (data.hasOwnProperty(\"range\")) {\n // Box selection\n selectorObject = {\n type: \"box\",\n selector_state: {\n xrange: data[\"range\"][\"x\"],\n yrange: data[\"range\"][\"y\"]\n }\n };\n } else if (data.hasOwnProperty(\"lassoPoints\")) {\n // Lasso selection\n selectorObject = {\n type: \"lasso\",\n selector_state: {\n xs: data[\"lassoPoints\"][\"x\"],\n ys: data[\"lassoPoints\"][\"y\"]\n }\n };\n } else {\n selectorObject = null;\n }\n return selectorObject\n },\n\n /**\n * Handle ploty_restyle events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_restyle: function (data) {\n\n if (data === null || data === undefined) {\n // No data to report to the Python side\n return\n }\n\n if (data[0] && data[0].hasOwnProperty(\"_doNotReportToPy\")) {\n // Restyle originated on the Python side\n return\n }\n\n // Unpack data\n var styleData = data[0];\n var styleTraces = data[1];\n\n // Construct restyle message to send to the Python side\n /** @type {Js2PyRestyleMsg} */\n var restyleMsg = {\n style_data: styleData,\n style_traces: styleTraces,\n source_view_id: this.viewID\n };\n\n this.model.set(\"_js2py_restyle\", restyleMsg);\n this.touch();\n },\n\n /**\n * Handle plotly_relayout events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_relayout: function (data) {\n\n if (data === null || data === undefined) {\n // No data to report to the Python side\n return\n }\n\n if (data.hasOwnProperty(\"_doNotReportToPy\")) {\n // Relayout originated on the Python side\n return\n }\n\n /** @type {Js2PyRelayoutMsg} */\n var relayoutMsg = {\n relayout_data: data,\n source_view_id: this.viewID\n };\n\n this.model.set(\"_js2py_relayout\", relayoutMsg);\n this.touch();\n },\n\n /**\n * Handle plotly_update events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_update: function (data) {\n\n if (data === null || data === undefined) {\n // No data to report to the Python side\n return\n }\n\n if (data[\"data\"] &&\n data[\"data\"][0].hasOwnProperty(\"_doNotReportToPy\")) {\n // Update originated on the Python side\n return\n }\n\n /** @type {Js2PyUpdateMsg} */\n var updateMsg = {\n style_data: data[\"data\"][0],\n style_traces: data[\"data\"][1],\n layout_data: data[\"layout\"],\n source_view_id: this.viewID\n };\n\n // Log message\n this.model.set(\"_js2py_update\", updateMsg);\n this.touch();\n },\n\n /**\n * Handle plotly_click events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_click: function (data) {\n this._send_points_callback_message(data, \"plotly_click\");\n },\n\n /**\n * Handle plotly_hover events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_hover: function (data) {\n this._send_points_callback_message(data, \"plotly_hover\");\n },\n\n /**\n * Handle plotly_unhover events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_unhover: function (data) {\n this._send_points_callback_message(data, \"plotly_unhover\");\n },\n\n /**\n * Handle plotly_selected events emitted by the Plotly.js library\n * @param data\n */\n handle_plotly_selected: function (data) {\n this._send_points_callback_message(data, \"plotly_selected\");\n },\n\n /**\n * Build and send a points callback message to the Python side\n *\n * @param {Object} data\n * data object as provided by the plotly_click, plotly_hover,\n * plotly_unhover, or plotly_selected events\n * @param {String} event_type\n * Name of the triggering event. One of 'plotly_click',\n * 'plotly_hover', 'plotly_unhover', or 'plotly_selected'\n * @private\n */\n _send_points_callback_message: function (data, event_type) {\n if (data === null || data === undefined) {\n // No data to report to the Python side\n return;\n }\n\n /** @type {Js2PyPointsCallbackMsg} */\n var pointsMsg = {\n event_type: event_type,\n points: this.buildPointsObject(data),\n device_state: this.buildInputDeviceStateObject(data),\n selector: this.buildSelectorObject(data)\n };\n\n if (pointsMsg[\"points\"] !== null &&\n pointsMsg[\"points\"] !== undefined) {\n\n this.model.set(\"_js2py_pointsCallback\", pointsMsg);\n this.touch();\n }\n },\n\n /**\n * Stub for future handling of plotly_doubleclick\n * @param data\n */\n handle_plotly_doubleclick: function (data) {},\n\n\n /**\n * Handle Plotly.addTraces request\n */\n do_addTraces: function () {\n\n /** @type {Py2JsAddTracesMsg} */\n var msgData = this.model.get(\"_py2js_addTraces\");\n\n if (msgData !== null) {\n\n // Save off original number of traces\n var prevNumTraces = this.el.data.length;\n\n var that = this;\n Plotly.addTraces(this.el, msgData.trace_data).then(function () {\n\n // ### Send trace deltas ###\n that._sendTraceDeltas(msgData.trace_edit_id);\n\n // ### Send layout delta ###\n var layout_edit_id = msgData.layout_edit_id;\n that._sendLayoutDelta(layout_edit_id);\n });\n }\n },\n\n /**\n * Handle Plotly.deleteTraces request\n */\n do_deleteTraces: function () {\n\n /** @type {Py2JsDeleteTracesMsg} */\n var msgData = this.model.get(\"_py2js_deleteTraces\");\n\n if (msgData !== null){\n var delete_inds = msgData.delete_inds;\n var that = this;\n Plotly.deleteTraces(this.el, delete_inds).then(function () {\n\n // ### Send trace deltas ###\n var trace_edit_id = msgData.trace_edit_id;\n that._sendTraceDeltas(trace_edit_id);\n\n // ### Send layout delta ###\n var layout_edit_id = msgData.layout_edit_id;\n that._sendLayoutDelta(layout_edit_id);\n });\n }\n },\n\n /**\n * Handle Plotly.moveTraces request\n */\n do_moveTraces: function () {\n\n /** @type {Py2JsMoveTracesMsg} */\n var msgData = this.model.get(\"_py2js_moveTraces\");\n\n if (msgData !== null){\n // Unpack message\n var currentInds = msgData.current_trace_inds;\n var newInds = msgData.new_trace_inds;\n\n // Check if the new trace indexes are actually different than\n // the current indexes\n var inds_equal = _.isEqual(currentInds, newInds);\n\n if (!inds_equal) {\n Plotly.moveTraces(this.el, currentInds, newInds)\n }\n }\n },\n\n /**\n * Handle Plotly.restyle request\n */\n do_restyle: function () {\n\n /** @type {Py2JsRestyleMsg} */\n var msgData = this.model.get(\"_py2js_restyle\");\n if (msgData !== null) {\n var restyleData = msgData.restyle_data;\n var traceIndexes = this.model._normalize_trace_indexes(\n msgData.restyle_traces);\n\n restyleData[\"_doNotReportToPy\"] = true;\n Plotly.restyle(this.el, restyleData, traceIndexes);\n\n // ### Send trace deltas ###\n // We create an array of deltas corresponding to the restyled\n // traces.\n this._sendTraceDeltas(msgData.trace_edit_id);\n\n // ### Send layout delta ###\n var layout_edit_id = msgData.layout_edit_id;\n this._sendLayoutDelta(layout_edit_id);\n }\n },\n\n /**\n * Handle Plotly.relayout request\n */\n do_relayout: function () {\n\n /** @type {Py2JsRelayoutMsg} */\n var msgData = this.model.get(\"_py2js_relayout\");\n if (msgData !== null) {\n if (msgData.source_view_id !== this.viewID) {\n var relayoutData = msgData.relayout_data;\n relayoutData[\"_doNotReportToPy\"] = true;\n Plotly.relayout(this.el, msgData.relayout_data);\n }\n\n // ### Send layout delta ###\n var layout_edit_id = msgData.layout_edit_id;\n this._sendLayoutDelta(layout_edit_id);\n }\n },\n\n /**\n * Handle Plotly.update request\n */\n do_update: function () {\n\n /** @type {Py2JsUpdateMsg} */\n var msgData = this.model.get(\"_py2js_update\");\n\n if (msgData !== null) {\n var style = msgData.style_data || {};\n var layout = msgData.layout_data || {};\n var traceIndexes = this.model._normalize_trace_indexes(\n msgData.style_traces);\n\n style[\"_doNotReportToPy\"] = true;\n Plotly.update(this.el, style, layout, traceIndexes);\n\n // ### Send trace deltas ###\n // We create an array of deltas corresponding to the updated\n // traces.\n this._sendTraceDeltas(msgData.trace_edit_id);\n\n // ### Send layout delta ###\n var layout_edit_id = msgData.layout_edit_id;\n this._sendLayoutDelta(layout_edit_id);\n }\n },\n\n /**\n * Handle Plotly.animate request\n */\n do_animate: function() {\n\n /** @type {Py2JsAnimateMsg} */\n var msgData = this.model.get(\"_py2js_animate\");\n\n if (msgData !== null) {\n\n // Unpack params\n // var animationData = msgData[0];\n var animationOpts = msgData.animation_opts;\n\n var styles = msgData.style_data;\n var layout = msgData.layout_data;\n var traceIndexes = this.model._normalize_trace_indexes(\n msgData.style_traces);\n\n var animationData = {\n data: styles,\n layout: layout,\n traces: traceIndexes\n };\n\n animationData[\"_doNotReportToPy\"] = true;\n var that = this;\n\n Plotly.animate(this.el, animationData, animationOpts).then(\n function () {\n\n // ### Send trace deltas ###\n // We create an array of deltas corresponding to the\n // animated traces.\n that._sendTraceDeltas(msgData.trace_edit_id);\n\n // ### Send layout delta ###\n var layout_edit_id = msgData.layout_edit_id;\n that._sendLayoutDelta(layout_edit_id);\n });\n\n }\n },\n\n /**\n * Construct layout delta object and send layoutDelta message to the\n * Python side\n *\n * @param layout_edit_id\n * Edit ID of message that triggered the creation of the layout delta\n * @private\n */\n _sendLayoutDelta: function(layout_edit_id) {\n // ### Handle layout delta ###\n var layout_delta = createDeltaObject(\n this.getFullLayout(),\n this.model.get(\"_layout\"));\n\n /** @type{Js2PyLayoutDeltaMsg} */\n var layoutDeltaMsg = {\n layout_delta: layout_delta,\n layout_edit_id: layout_edit_id};\n\n this.model.set(\"_js2py_layoutDelta\", layoutDeltaMsg);\n this.touch();\n },\n\n /**\n * Construct trace deltas array for the requested trace indexes and\n * send traceDeltas message to the Python side\n * Array of indexes of traces for which to compute deltas\n * @param trace_edit_id\n * Edit ID of message that triggered the creation of trace deltas\n * @private\n */\n _sendTraceDeltas: function (trace_edit_id) {\n\n var trace_data = this.model.get(\"_data\");\n var traceIndexes = _.range(trace_data.length);\n var trace_deltas = new Array(traceIndexes.length);\n\n var fullData = this.getFullData();\n for (var i = 0; i < traceIndexes.length; i++) {\n var traceInd = traceIndexes[i];\n trace_deltas[i] = createDeltaObject(\n fullData[traceInd], trace_data[traceInd]);\n }\n\n /** @type{Js2PyTraceDeltasMsg} */\n var traceDeltasMsg = {\n trace_deltas: trace_deltas,\n trace_edit_id: trace_edit_id};\n\n this.model.set(\"_js2py_traceDeltas\", traceDeltasMsg);\n this.touch();\n }\n});\n\n// Serialization\n/**\n * Create a mapping from numpy dtype strings to corresponding typed array\n * constructors\n */\nvar numpy_dtype_to_typedarray_type = {\n int8: Int8Array,\n int16: Int16Array,\n int32: Int32Array,\n uint8: Uint8Array,\n uint16: Uint16Array,\n uint32: Uint32Array,\n float32: Float32Array,\n float64: Float64Array\n};\n\nfunction serializeTypedArray(v) {\n var numpyType;\n if (v instanceof Int8Array) {\n numpyType = 'int8';\n } else if (v instanceof Int16Array) {\n numpyType = 'int16';\n } else if (v instanceof Int32Array) {\n numpyType = 'int32';\n } else if (v instanceof Uint8Array) {\n numpyType = 'uint8';\n } else if (v instanceof Uint16Array) {\n numpyType = 'uint16';\n } else if (v instanceof Uint32Array) {\n numpyType = 'uint32';\n } else if (v instanceof Float32Array) {\n numpyType = 'float32';\n } else if (v instanceof Float64Array) {\n numpyType = 'float64';\n } else {\n // Don't understand it, return as is\n return v;\n }\n var res = {\n dtype: numpyType,\n shape: [v.length],\n value: v.buffer\n };\n return res\n}\n\n/**\n * ipywidget JavaScript -> Python serializer\n */\nfunction js2py_serializer(v, widgetManager) {\n var res;\n\n if (_.isTypedArray(v)) {\n res = serializeTypedArray(v);\n } else if (Array.isArray(v)) {\n // Serialize array elements recursively\n res = new Array(v.length);\n for (var i = 0; i < v.length; i++) {\n res[i] = js2py_serializer(v[i]);\n }\n } else if (_.isPlainObject(v)) {\n // Serialize object properties recursively\n res = {};\n for (var p in v) {\n if (v.hasOwnProperty(p)) {\n res[p] = js2py_serializer(v[p]);\n }\n }\n } else if (v === undefined) {\n // Translate undefined into '_undefined_' sentinal string. The\n // Python _js_to_py deserializer will convert this into an\n // Undefined object\n res = \"_undefined_\";\n } else {\n // Primitive value to transfer directly\n res = v;\n }\n return res\n}\n\n/**\n * ipywidget Python -> Javascript deserializer\n */\nfunction py2js_deserializer(v, widgetManager) {\n var res;\n\n if (Array.isArray(v)) {\n // Deserialize array elements recursively\n res = new Array(v.length);\n for (var i = 0; i < v.length; i++) {\n res[i] = py2js_deserializer(v[i]);\n }\n } else if (_.isPlainObject(v)) {\n if ((_.has(v, 'value') || _.has(v, 'buffer')) &&\n _.has(v, 'dtype') &&\n _.has(v, 'shape')) {\n // Deserialize special buffer/dtype/shape objects into typed arrays\n // These objects correspond to numpy arrays on the Python side\n //\n // Note plotly.py<=3.1.1 called the buffer object `buffer`\n // This was renamed `value` in 3.2 to work around a naming conflict\n // when saving widget state to a notebook.\n var typedarray_type = numpy_dtype_to_typedarray_type[v.dtype];\n var buffer = _.has(v, 'value')? v.value.buffer: v.buffer.buffer;\n res = new typedarray_type(buffer);\n } else {\n // Deserialize object properties recursively\n res = {};\n for (var p in v) {\n if (v.hasOwnProperty(p)) {\n res[p] = py2js_deserializer(v[p]);\n }\n }\n }\n } else if (v === \"_undefined_\") {\n // Convert the _undefined_ sentinal into undefined\n res = undefined;\n } else {\n // Accept primitive value directly\n res = v;\n }\n return res\n}\n\n/**\n * Return whether the input value is a typed array\n * @param potentialTypedArray\n * Value to examine\n * @returns {boolean}\n */\nfunction isTypedArray(potentialTypedArray) {\n return ArrayBuffer.isView(potentialTypedArray) &&\n !(potentialTypedArray instanceof DataView);\n}\n\n/**\n * Customizer for use with lodash's mergeWith function\n *\n * The customizer ensures that typed arrays are not converted into standard\n * arrays during the recursive merge\n *\n * See: https://lodash.com/docs/latest#mergeWith\n */\nfunction fullMergeCustomizer(objValue, srcValue, key) {\n if (key[0] === '_') {\n // Don't recurse into private properties\n return null\n } else if (isTypedArray(srcValue)) {\n // Return typed arrays directly, don't recurse inside\n return srcValue\n }\n}\n\n/**\n * Reform a Plotly.relayout like operation on an input object\n *\n * @param {Object} parentObj\n * The object that the relayout operation should be applied to\n * @param {Object} relayoutData\n * An relayout object as accepted by Plotly.relayout\n *\n * Examples:\n * var d = {foo {bar [5, 10]}};\n * performRelayoutLike(d, {'foo.bar': [0, 1]});\n * d -> {foo: {bar: [0, 1]}}\n *\n * var d = {foo {bar [5, 10]}};\n * performRelayoutLike(d, {'baz': 34});\n * d -> {foo: {bar: [5, 10]}, baz: 34}\n *\n * var d = {foo: {bar: [5, 10]};\n * performRelayoutLike(d, {'foo.baz[1]': 17});\n * d -> {foo: {bar: [5, 17]}}\n *\n */\nfunction performRelayoutLike(parentObj, relayoutData) {\n // Perform a relayout style operation on a given parent object\n for (var rawKey in relayoutData) {\n if (!relayoutData.hasOwnProperty(rawKey)) {\n continue\n }\n\n // Extract value for this key\n var relayoutVal = relayoutData[rawKey];\n\n // Set property value\n if (relayoutVal === null) {\n _.unset(parentObj, rawKey);\n } else {\n _.set(parentObj, rawKey, relayoutVal);\n }\n }\n}\n\n/**\n * Perform a Plotly.restyle like operation on an input object array\n *\n * @param {Array.} parentArray\n * The object that the restyle operation should be applied to\n * @param {Object} restyleData\n * A restyle object as accepted by Plotly.restyle\n * @param {Array.} restyleTraces\n * Array of indexes of the traces that the resytle operation applies to\n *\n * Examples:\n * var d = [{foo: {bar: 1}}, {}, {}]\n * performRestyleLike(d, {'foo.bar': 2}, [0])\n * d -> [{foo: {bar: 2}}, {}, {}]\n *\n * var d = [{foo: {bar: 1}}, {}, {}]\n * performRestyleLike(d, {'foo.bar': 2}, [0, 1, 2])\n * d -> [{foo: {bar: 2}}, {foo: {bar: 2}}, {foo: {bar: 2}}]\n *\n * var d = [{foo: {bar: 1}}, {}, {}]\n * performRestyleLike(d, {'foo.bar': [2, 3, 4]}, [0, 1, 2])\n * d -> [{foo: {bar: 2}}, {foo: {bar: 3}}, {foo: {bar: 4}}]\n *\n */\nfunction performRestyleLike(parentArray, restyleData, restyleTraces) {\n // Loop over the properties of restyleData\n for (var rawKey in restyleData) {\n if (!restyleData.hasOwnProperty(rawKey)) { continue }\n\n // Extract value for property and normalize into a value list\n var valArray = restyleData[rawKey];\n if (!Array.isArray(valArray)) {\n valArray = [valArray]\n }\n\n // Loop over the indexes of the traces being restyled\n for (var i = 0; i < restyleTraces.length; i++) {\n\n // Get trace object\n var traceInd = restyleTraces[i];\n var trace = parentArray[traceInd];\n\n // Extract value for this trace\n var singleVal = valArray[i % valArray.length];\n\n // Set property value\n if (singleVal === null) {\n _.unset(trace, rawKey);\n } else if (singleVal !== undefined){\n _.set(trace, rawKey, singleVal);\n }\n }\n }\n}\n\n/**\n * Perform a Plotly.moveTraces like operation on an input object array\n * @param parentArray\n * The object that the moveTraces operation should be applied to\n * @param currentInds\n * Array of the current indexes of traces to be moved\n * @param newInds\n * Array of the new indexes that traces selected by currentInds should be\n * moved to.\n *\n * Examples:\n * var d = [{foo: 0}, {foo: 1}, {foo: 2}]\n * performMoveTracesLike(d, [0, 1], [2, 0])\n * d -> [{foo: 1}, {foo: 2}, {foo: 0}]\n *\n * var d = [{foo: 0}, {foo: 1}, {foo: 2}]\n * performMoveTracesLike(d, [0, 2], [1, 2])\n * d -> [{foo: 1}, {foo: 0}, {foo: 2}]\n */\nfunction performMoveTracesLike(parentArray, currentInds, newInds) {\n\n // ### Remove by currentInds in reverse order ###\n var movingTracesData = [];\n for (var ci = currentInds.length - 1; ci >= 0; ci--) {\n // Insert moving parentArray at beginning of the list\n movingTracesData.splice(0, 0, parentArray[currentInds[ci]]);\n parentArray.splice(currentInds[ci], 1);\n }\n\n // ### Sort newInds and movingTracesData by newInds ###\n var newIndexSortedArrays = _(newInds).zip(movingTracesData)\n .sortBy(0)\n .unzip()\n .value();\n\n newInds = newIndexSortedArrays[0];\n movingTracesData = newIndexSortedArrays[1];\n\n // ### Insert by newInds in forward order ###\n for (var ni = 0; ni < newInds.length; ni++) {\n parentArray.splice(newInds[ni], 0, movingTracesData[ni]);\n }\n}\n\n/**\n * Remove nested properties from a parent object\n * @param {Object} parentObj\n * Parent object from which properties or nested properties should be removed\n * @param {Array.>} keyPaths\n * Array of key paths for properties that should be removed. Each key path\n * is an array of properties names or array indexes that reference a\n * property to be removed\n *\n * Examples:\n * var d = {foo: [{bar: 0}, {bar: 1}], baz: 32}\n * performRemoveProps(d, ['baz'])\n * d -> {foo: [{bar: 0}, {bar: 1}]}\n *\n * var d = {foo: [{bar: 0}, {bar: 1}], baz: 32}\n * performRemoveProps(d, ['foo[1].bar', 'baz'])\n * d -> {foo: [{bar: 0}, {}]}\n *\n */\nfunction performRemoveProps(parentObj, keyPaths) {\n\n for(var i=0; i < keyPaths.length; i++) {\n var keyPath = keyPaths[i];\n _.unset(parentObj, keyPath);\n }\n}\n\n\n/**\n * Return object that contains all properties in fullObj that are not\n * identical to the corresponding properties in removeObj\n *\n * Properties of fullObj and removeObj may be objects or arrays of objects\n *\n * Returned object is a deep clone of the properties of the input objects\n *\n * @param {Object} fullObj\n * @param {Object} removeObj\n *\n * Examples:\n * var fullD = {foo: [{bar: 0}, {bar: 1}], baz: 32}\n * var removeD = {baz: 32}\n * createDeltaObject(fullD, removeD)\n * -> {foo: [{bar: 0}, {bar: 1}]}\n *\n * var fullD = {foo: [{bar: 0}, {bar: 1}], baz: 32}\n * var removeD = {baz: 45}\n * createDeltaObject(fullD, removeD)\n * -> {foo: [{bar: 0}, {bar: 1}], baz: 32}\n *\n * var fullD = {foo: [{bar: 0}, {bar: 1}], baz: 32}\n * var removeD = {foo: [{bar: 0}, {bar: 1}]}\n * createDeltaObject(fullD, removeD)\n * -> {baz: 32}\n *\n */\nfunction createDeltaObject(fullObj, removeObj) {\n\n // Initialize result as object or array\n var res;\n if(Array.isArray(fullObj)) {\n res = new Array(fullObj.length);\n } else {\n res = {};\n }\n\n // Initialize removeObj to empty object if not specified\n if (removeObj === null || removeObj === undefined) {\n removeObj = {};\n }\n\n // Iterate over object properties or array indices\n for (var p in fullObj) {\n if (p[0] !== \"_\" && // Don't consider private properties\n fullObj.hasOwnProperty(p) && // Exclude parent properties\n fullObj[p] !== null // Exclude cases where fullObj doesn't\n // have the property\n ) {\n // Compute object equality\n var props_equal;\n props_equal = _.isEqual(fullObj[p], removeObj[p]);\n\n // Perform recursive comparison if props are not equal\n if (!props_equal || p === \"uid\") { // Let uids through\n\n // property has non-null value in fullObj that doesn't\n // match the value in removeObj\n var fullVal = fullObj[p];\n if (removeObj.hasOwnProperty(p) &&\n typeof fullVal === \"object\") {\n // Recurse over object properties\n if(Array.isArray(fullVal)) {\n\n if (fullVal.length > 0 &&\n typeof(fullVal[0]) === \"object\") {\n // We have an object array\n res[p] = new Array(fullVal.length);\n for (var i = 0; i < fullVal.length; i++) {\n if (!Array.isArray(removeObj[p]) ||\n removeObj[p].length <= i) {\n\n res[p][i] = fullVal[i]\n } else {\n res[p][i] = createDeltaObject(fullVal[i],\n removeObj[p][i]);\n }\n }\n } else {\n // We have a primitive array or typed array\n res[p] = fullVal;\n }\n } else { // object\n var full_obj = createDeltaObject(fullVal,\n removeObj[p]);\n if (Object.keys(full_obj).length > 0) {\n // new object is not empty\n res[p] = full_obj;\n }\n }\n } else if (typeof fullVal === \"object\" &&\n !Array.isArray(fullVal)) {\n // Return 'clone' of fullVal\n // We don't use a standard clone method so that we keep\n // the special case handling of this method\n res[p] = createDeltaObject(fullVal, {});\n\n } else if (fullVal !== undefined &&\n typeof fullVal !== 'function') {\n // No recursion necessary, Just keep value from fullObj.\n // But skip values with function type\n res[p] = fullVal;\n }\n }\n }\n }\n return res\n}\n\nmodule.exports = {\n FigureView : FigureView,\n FigureModel: FigureModel\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/Figure.js\n// module id = 21\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@jupyter-widgets/base\"\n// module id = 22\n// module chunks = 0","/**\n * @license\n * Lodash \n * Copyright JS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined;\n\n /** Used as the semantic version number. */\n var VERSION = '4.17.5';\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Error message constants. */\n var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',\n FUNC_ERROR_TEXT = 'Expected a function';\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500;\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n /** Used to compose bitmasks for function metadata. */\n var WRAP_BIND_FLAG = 1,\n WRAP_BIND_KEY_FLAG = 2,\n WRAP_CURRY_BOUND_FLAG = 4,\n WRAP_CURRY_FLAG = 8,\n WRAP_CURRY_RIGHT_FLAG = 16,\n WRAP_PARTIAL_FLAG = 32,\n WRAP_PARTIAL_RIGHT_FLAG = 64,\n WRAP_ARY_FLAG = 128,\n WRAP_REARG_FLAG = 256,\n WRAP_FLIP_FLAG = 512;\n\n /** Used as default options for `_.truncate`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2,\n LAZY_WHILE_FLAG = 3;\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /** Used to associate wrap methods with their bit flags. */\n var wrapFlags = [\n ['ary', WRAP_ARY_FLAG],\n ['bind', WRAP_BIND_FLAG],\n ['bindKey', WRAP_BIND_KEY_FLAG],\n ['curry', WRAP_CURRY_FLAG],\n ['curryRight', WRAP_CURRY_RIGHT_FLAG],\n ['flip', WRAP_FLIP_FLAG],\n ['partial', WRAP_PARTIAL_FLAG],\n ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],\n ['rearg', WRAP_REARG_FLAG]\n ];\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n domExcTag = '[object DOMException]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]',\n weakSetTag = '[object WeakSet]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,\n reUnescapedHtml = /[&<>\"']/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g,\n reHasRegExpChar = RegExp(reRegExpChar.source);\n\n /** Used to match leading and trailing whitespace. */\n var reTrim = /^\\s+|\\s+$/g,\n reTrimStart = /^\\s+/,\n reTrimEnd = /\\s+$/;\n\n /** Used to match wrap detail comments. */\n var reWrapComment = /\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,\n reWrapDetails = /\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,\n reSplitDetails = /,? & /;\n\n /** Used to match words composed of alphanumeric characters. */\n var reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i;\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n /** Used to match Latin Unicode letters (excluding mathematical operators). */\n var reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to compose unicode character classes. */\n var rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n /** Used to compose unicode capture groups. */\n var rsApos = \"['\\u2019]\",\n rsAstral = '[' + rsAstralRange + ']',\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n /** Used to compose unicode regexes. */\n var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n /** Used to match apostrophes. */\n var reApos = RegExp(rsApos, 'g');\n\n /**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\n var reComboMark = RegExp(rsCombo, 'g');\n\n /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\n var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n /** Used to match complex or compound words. */\n var reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n ].join('|'), 'g');\n\n /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\n var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n /** Used to detect strings that need a more robust regexp to match words. */\n var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\n 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\n '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\n typedArrayTags[errorTag] = typedArrayTags[funcTag] =\n typedArrayTags[mapTag] = typedArrayTags[numberTag] =\n typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\n typedArrayTags[setTag] = typedArrayTags[stringTag] =\n typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\n cloneableTags[boolTag] = cloneableTags[dateTag] =\n cloneableTags[float32Tag] = cloneableTags[float64Tag] =\n cloneableTags[int8Tag] = cloneableTags[int16Tag] =\n cloneableTags[int32Tag] = cloneableTags[mapTag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[setTag] =\n cloneableTags[stringTag] = cloneableTags[symbolTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map Latin Unicode letters to basic Latin letters. */\n var deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseFloat = parseFloat,\n freeParseInt = parseInt;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n /** Used as a reference to the global object. */\n var root = freeGlobal || freeSelf || Function('return this')();\n\n /** Detect free variable `exports`. */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports;\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports && freeGlobal.process;\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n }());\n\n /* Node.js helper references. */\n var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,\n nodeIsDate = nodeUtil && nodeUtil.isDate,\n nodeIsMap = nodeUtil && nodeUtil.isMap,\n nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,\n nodeIsSet = nodeUtil && nodeUtil.isSet,\n nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array == null ? 0 : array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the last element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initAccum) {\n var length = array == null ? 0 : array.length;\n if (initAccum && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n var asciiSize = baseProperty('length');\n\n /**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function asciiToArray(string) {\n return string.split('');\n }\n\n /**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function asciiWords(string) {\n return string.match(reAsciiWord) || [];\n }\n\n /**\n * The base implementation of methods like `_.findKey` and `_.findLastKey`,\n * without support for iteratee shorthands, which iterates over `collection`\n * using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFindKey(collection, predicate, eachFunc) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = key;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n }\n\n /**\n * This function is like `baseIndexOf` except that it accepts a comparator.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOfWith(array, value, fromIndex, comparator) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (comparator(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value;\n }\n\n /**\n * The base implementation of `_.mean` and `_.meanBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the mean.\n */\n function baseMean(array, iteratee) {\n var length = array == null ? 0 : array.length;\n return length ? (baseSum(array, iteratee) / length) : NAN;\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sum` and `_.sumBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(array, iteratee) {\n var result,\n index = -1,\n length = array.length;\n\n while (++index < length) {\n var current = iteratee(array[index]);\n if (current !== undefined) {\n result = result === undefined ? current : (result + current);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\n * of key-value pairs for `object` corresponding to the property names of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the key-value pairs.\n */\n function baseToPairs(object, props) {\n return arrayMap(props, function(key) {\n return [key, object[key]];\n });\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function(value) {\n return func(value);\n };\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key);\n }\n\n /**\n * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the first unmatched string symbol.\n */\n function charsStartIndex(strSymbols, chrSymbols) {\n var index = -1,\n length = strSymbols.length;\n\n while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the last unmatched string symbol.\n */\n function charsEndIndex(strSymbols, chrSymbols) {\n var index = strSymbols.length;\n\n while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Gets the number of `placeholder` occurrences in `array`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} placeholder The placeholder to search for.\n * @returns {number} Returns the placeholder count.\n */\n function countHolders(array, placeholder) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n if (array[length] === placeholder) {\n ++result;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n var deburrLetter = basePropertyOf(deburredLetters);\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n var escapeHtmlChar = basePropertyOf(htmlEscapes);\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined : object[key];\n }\n\n /**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\n function hasUnicode(string) {\n return reHasUnicode.test(string);\n }\n\n /**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\n function hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n }\n\n /**\n * Converts `iterator` to an array.\n *\n * @private\n * @param {Object} iterator The iterator to convert.\n * @returns {Array} Returns the converted array.\n */\n function iteratorToArray(iterator) {\n var data,\n result = [];\n\n while (!(data = iterator.next()).done) {\n result.push(data.value);\n }\n return result;\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value === placeholder || value === PLACEHOLDER) {\n array[index] = PLACEHOLDER;\n result[resIndex++] = index;\n }\n }\n return result;\n }\n\n /**\n * Gets the value at `key`, unless `key` is \"__proto__\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function safeGet(object, key) {\n return key == '__proto__'\n ? undefined\n : object[key];\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n }\n\n /**\n * Converts `set` to its value-value pairs.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the value-value pairs.\n */\n function setToPairs(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = [value, value];\n });\n return result;\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * A specialized version of `_.lastIndexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictLastIndexOf(array, value, fromIndex) {\n var index = fromIndex + 1;\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return index;\n }\n\n /**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\n function stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n }\n\n /**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n var unescapeHtmlChar = basePropertyOf(htmlUnescapes);\n\n /**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n function unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n }\n\n /**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function unicodeToArray(string) {\n return string.match(reUnicode) || [];\n }\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the `context` object.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Util\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // Create a suped-up `defer` in Node.js.\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n var runInContext = (function runInContext(context) {\n context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));\n\n /** Built-in constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = context['__core-js_shared__'];\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n }());\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString = objectProto.toString;\n\n /** Used to infer the `Object` constructor. */\n var objectCtorString = funcToString.call(Object);\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Built-in value references. */\n var Buffer = moduleExports ? context.Buffer : undefined,\n Symbol = context.Symbol,\n Uint8Array = context.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,\n symIterator = Symbol ? Symbol.iterator : undefined,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n var defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n }());\n\n /** Mocked built-ins. */\n var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,\n ctxNow = Date && Date.now !== root.Date.now && Date.now,\n ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeFloor = Math.floor,\n nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeIsFinite = context.isFinite,\n nativeJoin = arrayProto.join,\n nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = Date.now,\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random,\n nativeReverse = arrayProto.reverse;\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(context, 'DataView'),\n Map = getNative(context, 'Map'),\n Promise = getNative(context, 'Promise'),\n Set = getNative(context, 'Set'),\n WeakMap = getNative(context, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit method\n * chain sequences. Methods that operate on and return arrays, collections,\n * and functions can be chained together. Methods that retrieve a single value\n * or may return a primitive value will automatically end the chain sequence\n * and return the unwrapped value. Otherwise, the value must be unwrapped\n * with `_#value`.\n *\n * Explicit chain sequences, which must be unwrapped with `_#value`, may be\n * enabled using `_.chain`.\n *\n * The execution of chained methods is lazy, that is, it's deferred until\n * `_#value` is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion.\n * Shortcut fusion is an optimization to merge iteratee calls; this avoids\n * the creation of intermediate arrays and can greatly reduce the number of\n * iteratee executions. Sections of a chain sequence qualify for shortcut\n * fusion if the section is applied to an array and iteratees accept only\n * one argument. The heuristic for whether a section qualifies for shortcut\n * fusion is subject to change.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\n * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\n * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\n * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\n * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\n * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\n * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\n * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\n * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\n * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\n * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\n * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\n * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\n * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\n * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\n * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\n * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\n * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\n * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\n * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\n * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\n * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\n * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\n * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\n * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\n * `zipObject`, `zipObjectDeep`, and `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\n * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,\n * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,\n * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,\n * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,\n * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,\n * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,\n * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,\n * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,\n * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,\n * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,\n * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,\n * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,\n * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,\n * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,\n * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,\n * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,\n * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,\n * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,\n * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,\n * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,\n * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,\n * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,\n * `upperFirst`, `value`, and `words`\n *\n * @name _\n * @constructor\n * @category Seq\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // Returns an unwrapped value.\n * wrapped.reduce(_.add);\n * // => 6\n *\n * // Returns a wrapped value.\n * var squares = wrapped.map(square);\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n }());\n\n /**\n * The function whose prototype chain sequence wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable explicit method chain sequences.\n */\n function LodashWrapper(value, chainAll) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__chain__ = !!chainAll;\n this.__index__ = 0;\n this.__values__ = undefined;\n }\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': lodash\n }\n };\n\n // Ensure wrappers are instances of `baseLodash`.\n lodash.prototype = baseLodash.prototype;\n lodash.prototype.constructor = lodash;\n\n LodashWrapper.prototype = baseCreate(baseLodash.prototype);\n LodashWrapper.prototype.constructor = LodashWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @constructor\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = MAX_ARRAY_LENGTH;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = copyArray(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = copyArray(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = copyArray(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || (!isRight && arrLength == length && takeCount == length)) {\n return baseWrapperValue(array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n // Ensure `LazyWrapper` is an instance of `baseLodash`.\n LazyWrapper.prototype = baseCreate(baseLodash.prototype);\n LazyWrapper.prototype.constructor = LazyWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n }\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n }\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear;\n Hash.prototype['delete'] = hashDelete;\n Hash.prototype.get = hashGet;\n Hash.prototype.has = hashHas;\n Hash.prototype.set = hashSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear;\n ListCache.prototype['delete'] = listCacheDelete;\n ListCache.prototype.get = listCacheGet;\n ListCache.prototype.has = listCacheHas;\n ListCache.prototype.set = listCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key);\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key);\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear;\n MapCache.prototype['delete'] = mapCacheDelete;\n MapCache.prototype.get = mapCacheGet;\n MapCache.prototype.has = mapCacheHas;\n MapCache.prototype.set = mapCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n }\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value);\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\n SetCache.prototype.has = setCacheHas;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key);\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key);\n }\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear;\n Stack.prototype['delete'] = stackDelete;\n Stack.prototype.get = stackGet;\n Stack.prototype.has = stackHas;\n Stack.prototype.set = stackSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.sample` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @returns {*} Returns the random element.\n */\n function arraySample(array) {\n var length = array.length;\n return length ? array[baseRandom(0, length - 1)] : undefined;\n }\n\n /**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n }\n\n /**\n * A specialized version of `_.shuffle` for arrays.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function arrayShuffle(array) {\n return shuffleSelf(copyArray(array));\n }\n\n /**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n }\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n }\n\n /**\n * The base implementation of `_.at` without support for individual paths.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {string[]} paths The property paths to pick.\n * @returns {Array} Returns the picked elements.\n */\n function baseAt(object, paths) {\n var index = -1,\n length = paths.length,\n result = Array(length),\n skip = object == null;\n\n while (++index < length) {\n result[index] = skip ? undefined : get(object, paths[index]);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\n function baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n }\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n\n return result;\n }\n\n if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n\n return result;\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n }\n\n /**\n * The base implementation of `_.conforms` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n */\n function baseConforms(source) {\n var props = keys(source);\n return function(object) {\n return baseConformsTo(object, source, props);\n };\n }\n\n /**\n * The base implementation of `_.conformsTo` which accepts `props` to check.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n */\n function baseConformsTo(object, source, props) {\n var length = props.length;\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (length--) {\n var key = props[length],\n predicate = source[key],\n value = object[key];\n\n if ((value === undefined && !(key in object)) || !predicate(value)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts `args`\n * to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Array} args The arguments to provide to `func`.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return object && baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from `props`.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the function names.\n */\n function baseFunctions(object, props) {\n return arrayFilter(props, function(key) {\n return isFunction(object[key]);\n });\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n }\n\n /**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n function baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n }\n\n /**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\n function baseGt(value, other) {\n return value > other;\n }\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object);\n }\n\n /**\n * The base implementation of `_.inRange` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to check.\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n */\n function baseInRange(number, start, end) {\n return number >= nativeMin(start, end) && number < nativeMax(start, end);\n }\n\n /**\n * The base implementation of methods like `_.intersection`, without support\n * for iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of shared values.\n */\n function baseIntersection(arrays, iteratee, comparator) {\n var includes = comparator ? arrayIncludesWith : arrayIncludes,\n length = arrays[0].length,\n othLength = arrays.length,\n othIndex = othLength,\n caches = Array(othLength),\n maxLength = Infinity,\n result = [];\n\n while (othIndex--) {\n var array = arrays[othIndex];\n if (othIndex && iteratee) {\n array = arrayMap(array, baseUnary(iteratee));\n }\n maxLength = nativeMin(array.length, maxLength);\n caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\n ? new SetCache(othIndex && array)\n : undefined;\n }\n array = arrays[0];\n\n var index = -1,\n seen = caches[0];\n\n outer:\n while (++index < length && result.length < maxLength) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (!(seen\n ? cacheHas(seen, computed)\n : includes(result, computed, comparator)\n )) {\n othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if (!(cache\n ? cacheHas(cache, computed)\n : includes(arrays[othIndex], computed, comparator))\n ) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.invert` and `_.invertBy` which inverts\n * `object` with values transformed by `iteratee` and set by `setter`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform values.\n * @param {Object} accumulator The initial inverted object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseInverter(object, setter, iteratee, accumulator) {\n baseForOwn(object, function(value, key, object) {\n setter(accumulator, iteratee(value), key, object);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.invoke` without support for individual\n * method arguments.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function baseInvoke(object, path, args) {\n path = castPath(path, object);\n object = parent(object, path);\n var func = object == null ? object : object[toKey(last(path))];\n return func == null ? undefined : apply(func, object, args);\n }\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n }\n\n /**\n * The base implementation of `_.isArrayBuffer` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n */\n function baseIsArrayBuffer(value) {\n return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;\n }\n\n /**\n * The base implementation of `_.isDate` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n */\n function baseIsDate(value) {\n return isObjectLike(value) && baseGetTag(value) == dateTag;\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n }\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n }\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n }\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n }\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n }\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\n function baseLt(value, other) {\n return value < other;\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n if (isObject(srcValue)) {\n stack || (stack = new Stack);\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n }\n\n /**\n * The base implementation of `_.nth` which doesn't coerce arguments.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {number} n The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n */\n function baseNth(array, n) {\n var length = array.length;\n if (!length) {\n return;\n }\n n += n < 0 ? length : 0;\n return isIndex(n, length) ? array[n] : undefined;\n }\n\n /**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseOrderBy(collection, iteratees, orders) {\n var index = -1;\n iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\n function basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n }\n\n /**\n * The base implementation of `_.pullAllBy` without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n */\n function basePullAll(array, values, iteratee, comparator) {\n var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\n index = -1,\n length = values.length,\n seen = array;\n\n if (array === values) {\n values = copyArray(values);\n }\n if (iteratee) {\n seen = arrayMap(array, baseUnary(iteratee));\n }\n while (++index < length) {\n var fromIndex = 0,\n value = values[index],\n computed = iteratee ? iteratee(value) : value;\n\n while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\n if (seen !== array) {\n splice.call(seen, fromIndex, 1);\n }\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * indexes or capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0,\n lastIndex = length - 1;\n\n while (length--) {\n var index = indexes[length];\n if (length == lastIndex || index !== previous) {\n var previous = index;\n if (isIndex(index)) {\n splice.call(array, index, 1);\n } else {\n baseUnset(array, index);\n }\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\n function baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n }\n\n /**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\n function baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n }\n\n /**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\n function baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n }\n\n /**\n * The base implementation of `_.sample`.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n */\n function baseSample(collection) {\n return arraySample(values(collection));\n }\n\n /**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n };\n\n /**\n * The base implementation of `_.shuffle`.\n *\n * @private\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function baseShuffle(collection) {\n return shuffleSelf(values(collection));\n }\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\n * performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndex(array, value, retHighest) {\n var low = 0,\n high = array == null ? low : array.length;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if (computed !== null && !isSymbol(computed) &&\n (retHighest ? (computed <= value) : (computed < value))) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return baseSortedIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\n * which invokes `iteratee` for `value` and each element of `array` to compute\n * their sort ranking. The iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The iteratee invoked per element.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndexBy(array, value, iteratee, retHighest) {\n value = iteratee(value);\n\n var low = 0,\n high = array == null ? 0 : array.length,\n valIsNaN = value !== value,\n valIsNull = value === null,\n valIsSymbol = isSymbol(value),\n valIsUndefined = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n othIsDefined = computed !== undefined,\n othIsNull = computed === null,\n othIsReflexive = computed === computed,\n othIsSymbol = isSymbol(computed);\n\n if (valIsNaN) {\n var setLow = retHighest || othIsReflexive;\n } else if (valIsUndefined) {\n setLow = othIsReflexive && (retHighest || othIsDefined);\n } else if (valIsNull) {\n setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);\n } else if (valIsSymbol) {\n setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);\n } else if (othIsNull || othIsSymbol) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseSortedUniq(array, iteratee) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n if (!index || !eq(computed, seen)) {\n var seen = computed;\n result[resIndex++] = value === 0 ? 0 : value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toNumber` which doesn't ensure correct\n * conversions of binary, hexadecimal, or octal string values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n */\n function baseToNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n return +value;\n }\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\n function baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n }\n\n /**\n * The base implementation of `_.update`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to update.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseUpdate(object, path, updater, customizer) {\n return baseSet(object, path, updater(baseGet(object, path)), customizer);\n }\n\n /**\n * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\n * without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) &&\n predicate(array[index], index, array)) {}\n\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to perform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n return arrayReduce(actions, function(result, action) {\n return action.func.apply(action.thisArg, arrayPush([result], action.args));\n }, result);\n }\n\n /**\n * The base implementation of methods like `_.xor`, without support for\n * iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of values.\n */\n function baseXor(arrays, iteratee, comparator) {\n var length = arrays.length;\n if (length < 2) {\n return length ? baseUniq(arrays[0]) : [];\n }\n var index = -1,\n result = Array(length);\n\n while (++index < length) {\n var array = arrays[index],\n othIndex = -1;\n\n while (++othIndex < length) {\n if (othIndex != index) {\n result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);\n }\n }\n }\n return baseUniq(baseFlatten(result, 1), iteratee, comparator);\n }\n\n /**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\n function baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n }\n\n /**\n * Casts `value` to an empty array if it's not an array like object.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array|Object} Returns the cast array-like object.\n */\n function castArrayLikeObject(value) {\n return isArrayLikeObject(value) ? value : [];\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity;\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n }\n\n /**\n * A `baseRest` alias which can be replaced with `identity` by module\n * replacement plugins.\n *\n * @private\n * @type {Function}\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n var castRest = baseRest;\n\n /**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\n function castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n }\n\n /**\n * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).\n *\n * @private\n * @param {number|Object} id The timer id or timeout object of the timer to clear.\n */\n var clearTimeout = ctxClearTimeout || function(id) {\n return root.clearTimeout(id);\n };\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n }\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n }\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n }\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n }\n\n /**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersLength = holders.length,\n leftIndex = -1,\n leftLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(leftLength + rangeLength),\n isUncurried = !isCurried;\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n }\n while (rangeLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersIndex = -1,\n holdersLength = holders.length,\n rightIndex = -1,\n rightLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(rangeLength + rightLength),\n isUncurried = !isCurried;\n\n while (++argsIndex < rangeLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n }\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n }\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, getIteratee(iteratee, 2), accumulator);\n };\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the optional `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createBind(func, bitmask, thisArg) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\n function createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n }\n\n /**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtor(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors. See\n // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a function that wraps `func` to enable currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {number} arity The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCurry(func, bitmask, arity) {\n var Ctor = createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length,\n placeholder = getHolder(wrapper);\n\n while (index--) {\n args[index] = arguments[index];\n }\n var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\n ? []\n : replaceHolders(args, placeholder);\n\n length -= holders.length;\n if (length < arity) {\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, undefined,\n args, holders, undefined, undefined, arity - length);\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return apply(fn, this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = getIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return flatRest(function(funcs) {\n var length = funcs.length,\n index = length,\n prereq = LodashWrapper.prototype.thru;\n\n if (fromRight) {\n funcs.reverse();\n }\n while (index--) {\n var func = funcs[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\n var wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? index : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined;\n\n if (data && isLaziable(data[0]) &&\n data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&\n !data[4].length && data[9] == 1\n ) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func))\n ? wrapper[funcName]()\n : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value)) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n });\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with optional `this`\n * binding of `thisArg`, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided\n * to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & WRAP_ARY_FLAG,\n isBind = bitmask & WRAP_BIND_FLAG,\n isBindKey = bitmask & WRAP_BIND_KEY_FLAG,\n isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),\n isFlip = bitmask & WRAP_FLIP_FLAG,\n Ctor = isBindKey ? undefined : createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length;\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (isCurried) {\n var placeholder = getHolder(wrapper),\n holdersCount = countHolders(args, placeholder);\n }\n if (partials) {\n args = composeArgs(args, partials, holders, isCurried);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\n }\n length -= holdersCount;\n if (isCurried && length < arity) {\n var newHolders = replaceHolders(args, placeholder);\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, thisArg,\n args, newHolders, argPos, ary, arity - length\n );\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n length = args.length;\n if (argPos) {\n args = reorder(args, argPos);\n } else if (isFlip && length > 1) {\n args.reverse();\n }\n if (isAry && ary < length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtor(fn);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.invertBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} toIteratee The function to resolve iteratees.\n * @returns {Function} Returns the new inverter function.\n */\n function createInverter(setter, toIteratee) {\n return function(object, iteratee) {\n return baseInverter(object, setter, toIteratee(iteratee), {});\n };\n }\n\n /**\n * Creates a function that performs a mathematical operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @param {number} [defaultValue] The value used for `undefined` arguments.\n * @returns {Function} Returns the new mathematical operation function.\n */\n function createMathOperation(operator, defaultValue) {\n return function(value, other) {\n var result;\n if (value === undefined && other === undefined) {\n return defaultValue;\n }\n if (value !== undefined) {\n result = value;\n }\n if (other !== undefined) {\n if (result === undefined) {\n return other;\n }\n if (typeof value == 'string' || typeof other == 'string') {\n value = baseToString(value);\n other = baseToString(other);\n } else {\n value = baseToNumber(value);\n other = baseToNumber(other);\n }\n result = operator(value, other);\n }\n return result;\n };\n }\n\n /**\n * Creates a function like `_.over`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over iteratees.\n * @returns {Function} Returns the new over function.\n */\n function createOver(arrayFunc) {\n return flatRest(function(iteratees) {\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n return baseRest(function(args) {\n var thisArg = this;\n return arrayFunc(iteratees, function(iteratee) {\n return apply(iteratee, thisArg, args);\n });\n });\n });\n }\n\n /**\n * Creates the padding for `string` based on `length`. The `chars` string\n * is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {number} length The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padding for `string`.\n */\n function createPadding(length, chars) {\n chars = chars === undefined ? ' ' : baseToString(chars);\n\n var charsLength = chars.length;\n if (charsLength < 2) {\n return charsLength ? baseRepeat(chars, length) : chars;\n }\n var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n return hasUnicode(chars)\n ? castSlice(stringToArray(result), 0, length).join('')\n : result.slice(0, length);\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the `this` binding\n * of `thisArg` and `partials` prepended to the arguments it receives.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to\n * the new function.\n * @returns {Function} Returns the new wrapped function.\n */\n function createPartial(func, bitmask, thisArg, partials) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength),\n fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n return apply(fn, isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\n function createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n }\n\n /**\n * Creates a function that performs a relational operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @returns {Function} Returns the new relational operation function.\n */\n function createRelationalOperation(operator) {\n return function(value, other) {\n if (!(typeof value == 'string' && typeof other == 'string')) {\n value = toNumber(value);\n other = toNumber(other);\n }\n return operator(value, other);\n };\n }\n\n /**\n * Creates a function that wraps `func` to continue currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {Function} wrapFunc The function to create the `func` wrapper.\n * @param {*} placeholder The placeholder value.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\n var isCurry = bitmask & WRAP_CURRY_FLAG,\n newHolders = isCurry ? holders : undefined,\n newHoldersRight = isCurry ? undefined : holders,\n newPartials = isCurry ? partials : undefined,\n newPartialsRight = isCurry ? undefined : partials;\n\n bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);\n\n if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {\n bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);\n }\n var newData = [\n func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\n newHoldersRight, argPos, ary, arity\n ];\n\n var result = wrapFunc.apply(undefined, newData);\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return setWrapToString(result, func, bitmask);\n }\n\n /**\n * Creates a function like `_.round`.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n number = toNumber(number);\n precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);\n if (precision) {\n // Shift with exponential notation to avoid floating-point issues.\n // See [MDN](https://mdn.io/round#Examples) for more details.\n var pair = (toString(number) + 'e').split('e'),\n value = func(pair[0] + 'e' + (+pair[1] + precision));\n\n pair = (toString(value) + 'e').split('e');\n return +(pair[0] + 'e' + (+pair[1] - precision));\n }\n return func(number);\n };\n }\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n };\n\n /**\n * Creates a `_.toPairs` or `_.toPairsIn` function.\n *\n * @private\n * @param {Function} keysFunc The function to get the keys of a given object.\n * @returns {Function} Returns the new pairs function.\n */\n function createToPairs(keysFunc) {\n return function(object) {\n var tag = getTag(object);\n if (tag == mapTag) {\n return mapToArray(object);\n }\n if (tag == setTag) {\n return setToPairs(object);\n }\n return baseToPairs(object, keysFunc(object));\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags.\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * 512 - `_.flip`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);\n arity = arity === undefined ? arity : toInteger(arity);\n length -= holders ? holders.length : 0;\n\n if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func);\n\n var newData = [\n func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\n argPos, ary, arity\n ];\n\n if (data) {\n mergeData(newData, data);\n }\n func = newData[0];\n bitmask = newData[1];\n thisArg = newData[2];\n partials = newData[3];\n holders = newData[4];\n arity = newData[9] = newData[9] === undefined\n ? (isBindKey ? 0 : func.length)\n : nativeMax(newData[9] - length, 0);\n\n if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {\n bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);\n }\n if (!bitmask || bitmask == WRAP_BIND_FLAG) {\n var result = createBind(func, bitmask, thisArg);\n } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {\n result = createCurry(func, bitmask, arity);\n } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {\n result = createPartial(func, bitmask, thisArg, partials);\n } else {\n result = createHybrid.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setWrapToString(setter(result, newData), func, bitmask);\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source\n * objects into destination objects that are passed thru.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to merge.\n * @param {Object} object The parent object of `objValue`.\n * @param {Object} source The parent object of `srcValue`.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {\n if (isObject(objValue) && isObject(srcValue)) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, objValue);\n baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);\n stack['delete'](srcValue);\n }\n return objValue;\n }\n\n /**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\n function customOmitClone(value) {\n return isPlainObject(value) ? undefined : value;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n function flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = (func.name + ''),\n array = realNames[result],\n length = hasOwnProperty.call(realNames, result) ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the argument placeholder value for `func`.\n *\n * @private\n * @param {Function} func The function to inspect.\n * @returns {*} Returns the placeholder value.\n */\n function getHolder(func) {\n var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\n return object.placeholder;\n }\n\n /**\n * Gets the appropriate \"iteratee\" function. If `_.iteratee` is customized,\n * this function returns the custom method, otherwise it returns `baseIteratee`.\n * If arguments are provided, the chosen function is invoked with them and\n * its result is returned.\n *\n * @private\n * @param {*} [value] The value to convert to an iteratee.\n * @param {number} [arity] The arity of the created iteratee.\n * @returns {Function} Returns the chosen function or its result.\n */\n function getIteratee() {\n var result = lodash.iteratee || iteratee;\n result = result === iteratee ? baseIteratee : result;\n return arguments.length ? result(arguments[0], arguments[1]) : result;\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n }\n\n /**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\n function getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n }\n\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n };\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n };\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag;\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Extracts wrapper details from the `source` body comment.\n *\n * @private\n * @param {string} source The source to inspect.\n * @returns {Array} Returns the wrapper details.\n */\n function getWrapDetails(source) {\n var match = source.match(reWrapDetails);\n return match ? match[1].split(reSplitDetails) : [];\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n }\n\n /**\n * Inserts wrapper `details` in a comment at the top of the `source` body.\n *\n * @private\n * @param {string} source The source to modify.\n * @returns {Array} details The details to insert.\n * @returns {string} Returns the modified source.\n */\n function insertWrapDetails(source, details) {\n var length = details.length;\n if (!length) {\n return source;\n }\n var lastIndex = length - 1;\n details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];\n details = details.join(length > 2 ? ', ' : ' ');\n return source.replace(reWrapComment, '{\\n/* [wrapped with ' + details + '] */\\n');\n }\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\n * else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func),\n other = lodash[funcName];\n\n if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n return false;\n }\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n }\n\n /**\n * Checks if `func` is capable of being masked.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `func` is maskable, else `false`.\n */\n var isMaskable = coreJsData ? isFunction : stubFalse;\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n }\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers used to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and\n * `_.rearg` modify function arguments, making the order in which they are\n * executed important, preventing the merging of metadata. However, we make\n * an exception for a safe combined case where curried functions have `_.ary`\n * and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);\n\n var isCombo =\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||\n ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & WRAP_BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : value;\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = value;\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & WRAP_ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\n function objectToString(value) {\n return nativeObjectToString.call(value);\n }\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n }\n\n /**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\n function parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = copyArray(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity\n * function to avoid garbage collection pauses in V8. See\n * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = shortOut(baseSetData);\n\n /**\n * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n var setTimeout = ctxSetTimeout || function(func, wait) {\n return root.setTimeout(func, wait);\n };\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString);\n\n /**\n * Sets the `toString` method of `wrapper` to mimic the source of `reference`\n * with wrapper details in a comment at the top of the source body.\n *\n * @private\n * @param {Function} wrapper The function to modify.\n * @param {Function} reference The reference function.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Function} Returns `wrapper`.\n */\n function setWrapToString(wrapper, reference, bitmask) {\n var source = (reference + '');\n return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));\n }\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n }\n\n /**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\n function shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n }\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n });\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n }\n\n /**\n * Updates wrapper `details` based on `bitmask` flags.\n *\n * @private\n * @returns {Array} details The details to modify.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Array} Returns `details`.\n */\n function updateWrapDetails(details, bitmask) {\n arrayEach(wrapFlags, function(pair) {\n var value = '_.' + pair[0];\n if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {\n details.push(value);\n }\n });\n return details.sort();\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n if (wrapper instanceof LazyWrapper) {\n return wrapper.clone();\n }\n var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\n result.__actions__ = copyArray(wrapper.__actions__);\n result.__index__ = wrapper.__index__;\n result.__values__ = wrapper.__values__;\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `array` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the new array of chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {\n size = 1;\n } else {\n size = nativeMax(toInteger(size), 0);\n }\n var length = array == null ? 0 : array.length;\n if (!length || size < 1) {\n return [];\n }\n var index = 0,\n resIndex = 0,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[resIndex++] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates a new array concatenating `array` with any additional arrays\n * and/or values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to concatenate.\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var other = _.concat(array, 2, [3], [[4]]);\n *\n * console.log(other);\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n function concat() {\n var length = arguments.length;\n if (!length) {\n return [];\n }\n var args = Array(length - 1),\n array = arguments[0],\n index = length;\n\n while (index--) {\n args[index - 1] = arguments[index];\n }\n return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `iteratee` which\n * is invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * **Note:** Unlike `_.pullAllBy`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var differenceBy = baseRest(function(array, values) {\n var iteratee = last(values);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `comparator`\n * which is invoked to compare elements of `array` to `values`. The order and\n * references of result values are determined by the first array. The comparator\n * is invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.pullAllWith`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n *\n * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }]\n */\n var differenceWith = baseRest(function(array, values) {\n var comparator = last(values);\n if (isArrayLikeObject(comparator)) {\n comparator = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.dropRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropRightWhile(users, ['active', false]);\n * // => objects for ['barney']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropRightWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.dropWhile(users, function(o) { return !o.active; });\n * // => objects for ['pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropWhile(users, ['active', false]);\n * // => objects for ['pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n function fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index);\n }\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\n * // => 2\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastIndex(users, ['active', false]);\n * // => 2\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n function findLastIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length - 1;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = fromIndex < 0\n ? nativeMax(length + index, 0)\n : nativeMin(index, length - 1);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index, true);\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n }\n\n /**\n * Recursively flattens `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, [3, [4]], 5]]);\n * // => [1, 2, 3, 4, 5]\n */\n function flattenDeep(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, INFINITY) : [];\n }\n\n /**\n * Recursively flatten `array` up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * var array = [1, [2, [3, [4]], 5]];\n *\n * _.flattenDepth(array, 1);\n * // => [1, 2, [3, [4]], 5]\n *\n * _.flattenDepth(array, 2);\n * // => [1, 2, 3, [4], 5]\n */\n function flattenDepth(array, depth) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(array, depth);\n }\n\n /**\n * The inverse of `_.toPairs`; this method returns an object composed\n * from key-value `pairs`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} pairs The key-value pairs.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.fromPairs([['a', 1], ['b', 2]]);\n * // => { 'a': 1, 'b': 2 }\n */\n function fromPairs(pairs) {\n var index = -1,\n length = pairs == null ? 0 : pairs.length,\n result = {};\n\n while (++index < length) {\n var pair = pairs[index];\n result[pair[0]] = pair[1];\n }\n return result;\n }\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return (array && array.length) ? array[0] : undefined;\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 0, -1) : [];\n }\n\n /**\n * Creates an array of unique values that are included in all given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersection([2, 1], [2, 3]);\n * // => [2]\n */\n var intersection = baseRest(function(arrays) {\n var mapped = arrayMap(arrays, castArrayLikeObject);\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped)\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `iteratee`\n * which is invoked for each element of each `arrays` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [2.1]\n *\n * // The `_.property` iteratee shorthand.\n * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }]\n */\n var intersectionBy = baseRest(function(arrays) {\n var iteratee = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n if (iteratee === last(mapped)) {\n iteratee = undefined;\n } else {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `comparator`\n * which is invoked to compare elements of `arrays`. The order and references\n * of result values are determined by the first array. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.intersectionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }]\n */\n var intersectionWith = baseRest(function(arrays) {\n var comparator = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n comparator = typeof comparator == 'function' ? comparator : undefined;\n if (comparator) {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, undefined, comparator)\n : [];\n });\n\n /**\n * Converts all elements in `array` into a string separated by `separator`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to convert.\n * @param {string} [separator=','] The element separator.\n * @returns {string} Returns the joined string.\n * @example\n *\n * _.join(['a', 'b', 'c'], '~');\n * // => 'a~b~c'\n */\n function join(array, separator) {\n return array == null ? '' : nativeJoin.call(array, separator);\n }\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // Search from the `fromIndex`.\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);\n }\n return value === value\n ? strictLastIndexOf(array, value, index)\n : baseFindIndex(array, baseIsNaN, index, true);\n }\n\n /**\n * Gets the element at index `n` of `array`. If `n` is negative, the nth\n * element from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.11.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=0] The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n *\n * _.nth(array, 1);\n * // => 'b'\n *\n * _.nth(array, -2);\n * // => 'c';\n */\n function nth(array, n) {\n return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;\n }\n\n /**\n * Removes all given values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\n * to remove elements from an array by predicate.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pull(array, 'a', 'c');\n * console.log(array);\n * // => ['b', 'b']\n */\n var pull = baseRest(pullAll);\n\n /**\n * This method is like `_.pull` except that it accepts an array of values to remove.\n *\n * **Note:** Unlike `_.difference`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pullAll(array, ['a', 'c']);\n * console.log(array);\n * // => ['b', 'b']\n */\n function pullAll(array, values) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values)\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `iteratee` which is\n * invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The iteratee is invoked with one argument: (value).\n *\n * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n *\n * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\n * console.log(array);\n * // => [{ 'x': 2 }]\n */\n function pullAllBy(array, values, iteratee) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, getIteratee(iteratee, 2))\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `comparator` which\n * is invoked to compare elements of `array` to `values`. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\n *\n * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\n * console.log(array);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\n */\n function pullAllWith(array, values, comparator) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, undefined, comparator)\n : array;\n }\n\n /**\n * Removes elements from `array` corresponding to `indexes` and returns an\n * array of removed elements.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n * var pulled = _.pullAt(array, [1, 3]);\n *\n * console.log(array);\n * // => ['a', 'c']\n *\n * console.log(pulled);\n * // => ['b', 'd']\n */\n var pullAt = flatRest(function(array, indexes) {\n var length = array == null ? 0 : array.length,\n result = baseAt(array, indexes);\n\n basePullAt(array, arrayMap(indexes, function(index) {\n return isIndex(index, length) ? +index : index;\n }).sort(compareAscending));\n\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is invoked\n * with three arguments: (value, index, array).\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\n * to pull elements from an array by value.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getIteratee(predicate, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Reverses `array` so that the first element becomes the last, the second\n * element becomes the second to last, and so on.\n *\n * **Note:** This method mutates `array` and is based on\n * [`Array#reverse`](https://mdn.io/Array/reverse).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.reverse(array);\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function reverse(array) {\n return array == null ? array : nativeReverse.call(array);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n * returned.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n else {\n start = start == null ? 0 : toInteger(start);\n end = end === undefined ? length : toInteger(end);\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n */\n function sortedIndex(array, value) {\n return baseSortedIndex(array, value);\n }\n\n /**\n * This method is like `_.sortedIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedIndexBy(objects, { 'x': 4 }, 'x');\n * // => 0\n */\n function sortedIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));\n }\n\n /**\n * This method is like `_.indexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedIndexOf([4, 5, 5, 5, 6], 5);\n * // => 1\n */\n function sortedIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value);\n if (index < length && eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 5, 5, 5, 6], 5);\n * // => 4\n */\n function sortedLastIndex(array, value) {\n return baseSortedIndex(array, value, true);\n }\n\n /**\n * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 1\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');\n * // => 1\n */\n function sortedLastIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);\n }\n\n /**\n * This method is like `_.lastIndexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);\n * // => 3\n */\n function sortedLastIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value, true) - 1;\n if (eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.uniq` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniq([1, 1, 2]);\n * // => [1, 2]\n */\n function sortedUniq(array) {\n return (array && array.length)\n ? baseSortedUniq(array)\n : [];\n }\n\n /**\n * This method is like `_.uniqBy` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n * // => [1.1, 2.3]\n */\n function sortedUniqBy(array, iteratee) {\n return (array && array.length)\n ? baseSortedUniq(array, getIteratee(iteratee, 2))\n : [];\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.tail([1, 2, 3]);\n * // => [2, 3]\n */\n function tail(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 1, length) : [];\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n if (!(array && array.length)) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.takeRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeRightWhile(users, ['active', false]);\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeRightWhile(users, 'active');\n * // => []\n */\n function takeRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.takeWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeWhile(users, ['active', false]);\n * // => objects for ['barney', 'fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeWhile(users, 'active');\n * // => []\n */\n function takeWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\n var union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n });\n\n /**\n * This method is like `_.union` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which uniqueness is computed. Result values are chosen from the first\n * array in which the value occurs. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.unionBy([2.1], [1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n var unionBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.union` except that it accepts `comparator` which\n * is invoked to compare elements of `arrays`. Result values are chosen from\n * the first array in which the value occurs. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.unionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var unionWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\n function uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return (array && array.length) ? baseUniq(array, undefined, comparator) : [];\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @since 1.2.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n *\n * _.unzip(zipped);\n * // => [['a', 'b'], [1, 2], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var length = 0;\n array = arrayFilter(array, function(group) {\n if (isArrayLikeObject(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n return baseTimes(length, function(index) {\n return arrayMap(array, baseProperty(index));\n });\n }\n\n /**\n * This method is like `_.unzip` except that it accepts `iteratee` to specify\n * how regrouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * regrouped values.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee) {\n if (!(array && array.length)) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n return arrayMap(result, function(group) {\n return apply(iteratee, undefined, group);\n });\n }\n\n /**\n * Creates an array excluding all given values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.pull`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.xor\n * @example\n *\n * _.without([2, 1, 2, 3], 1, 2);\n * // => [3]\n */\n var without = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the\n * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the given arrays. The order of result values is determined by the order\n * they occur in the arrays.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.without\n * @example\n *\n * _.xor([2, 1], [2, 3]);\n * // => [1, 3]\n */\n var xor = baseRest(function(arrays) {\n return baseXor(arrayFilter(arrays, isArrayLikeObject));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which by which they're compared. The order of result values is determined\n * by the order they occur in the arrays. The iteratee is invoked with one\n * argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2, 3.4]\n *\n * // The `_.property` iteratee shorthand.\n * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var xorBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `comparator` which is\n * invoked to compare elements of `arrays`. The order of result values is\n * determined by the order they occur in the arrays. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.xorWith(objects, others, _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var xorWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);\n });\n\n /**\n * Creates an array of grouped elements, the first of which contains the\n * first elements of the given arrays, the second of which contains the\n * second elements of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n */\n var zip = baseRest(unzip);\n\n /**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\n function zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n }\n\n /**\n * This method is like `_.zipObject` except that it supports property paths.\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\n * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\n function zipObjectDeep(props, values) {\n return baseZipObject(props || [], values || [], baseSet);\n }\n\n /**\n * This method is like `_.zip` except that it accepts `iteratee` to specify\n * how grouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * grouped values.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\n * return a + b + c;\n * });\n * // => [111, 222]\n */\n var zipWith = baseRest(function(arrays) {\n var length = arrays.length,\n iteratee = length > 1 ? arrays[length - 1] : undefined;\n\n iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;\n return unzipWith(arrays, iteratee);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` wrapper instance that wraps `value` with explicit method\n * chain sequences enabled. The result of such sequences must be unwrapped\n * with `_#value`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Seq\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _\n * .chain(users)\n * .sortBy('age')\n * .map(function(o) {\n * return o.user + ' is ' + o.age;\n * })\n * .head()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor\n * is invoked with one argument; (value). The purpose of this method is to\n * \"tap into\" a method chain sequence in order to modify intermediate results.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * // Mutate input array.\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor) {\n interceptor(value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n * The purpose of this method is to \"pass thru\" values replacing intermediate\n * results in a method chain sequence.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor) {\n return interceptor(value);\n }\n\n /**\n * This method is the wrapper version of `_.at`.\n *\n * @name at\n * @memberOf _\n * @since 1.0.0\n * @category Seq\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _(object).at(['a[0].b.c', 'a[1]']).value();\n * // => [3, 4]\n */\n var wrapperAt = flatRest(function(paths) {\n var length = paths.length,\n start = length ? paths[0] : 0,\n value = this.__wrapped__,\n interceptor = function(object) { return baseAt(object, paths); };\n\n if (length > 1 || this.__actions__.length ||\n !(value instanceof LazyWrapper) || !isIndex(start)) {\n return this.thru(interceptor);\n }\n value = value.slice(start, +start + (length ? 1 : 0));\n value.__actions__.push({\n 'func': thru,\n 'args': [interceptor],\n 'thisArg': undefined\n });\n return new LodashWrapper(value, this.__chain__).thru(function(array) {\n if (length && !array.length) {\n array.push(undefined);\n }\n return array;\n });\n });\n\n /**\n * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\n *\n * @name chain\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // A sequence without explicit chaining.\n * _(users).head();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // A sequence with explicit chaining.\n * _(users)\n * .chain()\n * .head()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chain sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Gets the next value on a wrapped object following the\n * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\n *\n * @name next\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the next iterator value.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 1 }\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 2 }\n *\n * wrapped.next();\n * // => { 'done': true, 'value': undefined }\n */\n function wrapperNext() {\n if (this.__values__ === undefined) {\n this.__values__ = toArray(this.value());\n }\n var done = this.__index__ >= this.__values__.length,\n value = done ? undefined : this.__values__[this.__index__++];\n\n return { 'done': done, 'value': value };\n }\n\n /**\n * Enables the wrapper to be iterable.\n *\n * @name Symbol.iterator\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the wrapper object.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped[Symbol.iterator]() === wrapped;\n * // => true\n *\n * Array.from(wrapped);\n * // => [1, 2]\n */\n function wrapperToIterator() {\n return this;\n }\n\n /**\n * Creates a clone of the chain sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @param {*} value The value to plant.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2]).map(square);\n * var other = wrapped.plant([3, 4]);\n *\n * other.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n clone.__index__ = 0;\n clone.__values__ = undefined;\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * This method is the wrapper version of `_.reverse`.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({\n 'func': thru,\n 'args': [reverse],\n 'thisArg': undefined\n });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(reverse);\n }\n\n /**\n * Executes the chain sequence to resolve the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @since 0.1.0\n * @alias toJSON, valueOf\n * @category Seq\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': 1, '6': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n ++result[key];\n } else {\n baseAssignValue(result, key, 1);\n }\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n */\n function filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=collection.length-1] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(findLastIndex);\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDeep([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMapDeep(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), INFINITY);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDepth([1, 2], duplicate, 2);\n * // => [[1, 1], [2, 2]]\n */\n function flatMapDepth(collection, iteratee, depth) {\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(map(collection, iteratee), depth);\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @alias eachRight\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEach\n * @example\n *\n * _.forEachRight([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `2` then `1`.\n */\n function forEachRight(collection, iteratee) {\n var func = isArray(collection) ? arrayEachRight : baseEachRight;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n });\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n }\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `path` is a function, it's invoked\n * for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke each method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invokeMap([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invokeMap = baseRest(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the last element responsible for generating the key. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var array = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.keyBy(array, function(o) {\n * return String.fromCharCode(o.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.keyBy(array, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n */\n var keyBy = createAggregator(function(result, value, key) {\n baseAssignValue(result, key, value);\n });\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.sortBy` except that it allows specifying the sort\n * orders of the iteratees to sort by. If `orders` is unspecified, all values\n * are sorted in ascending order. Otherwise, specify an order of \"desc\" for\n * descending or \"asc\" for ascending sort order of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @param {string[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // Sort by `user` in ascending order and by `age` in descending order.\n * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n */\n function orderBy(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n orders = guard ? undefined : orders;\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseOrderBy(collection, iteratees, orders);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n }\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduce\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n function reduceRight(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduceRight : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(getIteratee(predicate, 3)));\n }\n\n /**\n * Gets a random element from `collection`.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n */\n function sample(collection) {\n var func = isArray(collection) ? arraySample : baseSample;\n return func(collection);\n }\n\n /**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\n function sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n var func = isArray(collection) ? arrayShuffle : baseShuffle;\n return func(collection);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]\n */\n var sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\n var now = ctxNow || function() {\n return root.Date.now();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it's called `n` or more times.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => Logs 'done saving!' after the two async saves have completed.\n */\n function after(n, func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that invokes `func`, with up to `n` arguments,\n * ignoring any additional arguments.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n n = guard ? undefined : n;\n n = (func && n == null) ? func.length : n;\n return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it's called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery(element).on('click', _.before(5, addContactToList));\n * // => Allows adding up to 4 contacts to the list.\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and `partials` prepended to the arguments it receives.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind`, this method doesn't set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * function greet(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = baseRest(function(func, thisArg, partials) {\n var bitmask = WRAP_BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bind));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` with `partials`\n * prepended to the arguments it receives.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist. See\n * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Function\n * @param {Object} object The object to invoke the method on.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = baseRest(function(object, key, partials) {\n var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bindKey));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts arguments of `func` and either invokes\n * `func` returning its result, if at least `arity` number of arguments have\n * been provided, or returns a function that accepts the remaining `func`\n * arguments, and so on. The arity of `func` may be specified if `func.length`\n * is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n function curry(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curry.placeholder;\n return result;\n }\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n function curryRight(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curryRight.placeholder;\n return result;\n }\n\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\n function debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n }\n\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // => Logs 'deferred' after one millisecond.\n */\n var defer = baseRest(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => Logs 'later' after one second.\n */\n var delay = baseRest(function(func, wait, args) {\n return baseDelay(func, toNumber(wait) || 0, args);\n });\n\n /**\n * Creates a function that invokes `func` with arguments reversed.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to flip arguments for.\n * @returns {Function} Returns the new flipped function.\n * @example\n *\n * var flipped = _.flip(function() {\n * return _.toArray(arguments);\n * });\n *\n * flipped('a', 'b', 'c', 'd');\n * // => ['d', 'c', 'b', 'a']\n */\n function flip(func) {\n return createWrap(func, WRAP_FLIP_FLAG);\n }\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache;\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first invocation. The `func` is\n * invoked with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with its arguments transformed.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms=[_.identity]]\n * The argument transforms.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var func = _.overArgs(function(x, y) {\n * return [x, y];\n * }, [square, doubled]);\n *\n * func(9, 3);\n * // => [81, 6]\n *\n * func(10, 5);\n * // => [100, 10]\n */\n var overArgs = castRest(function(func, transforms) {\n transforms = (transforms.length == 1 && isArray(transforms[0]))\n ? arrayMap(transforms[0], baseUnary(getIteratee()))\n : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));\n\n var funcsLength = transforms.length;\n return baseRest(function(args) {\n var index = -1,\n length = nativeMin(args.length, funcsLength);\n\n while (++index < length) {\n args[index] = transforms[index].call(this, args[index]);\n }\n return apply(func, this, args);\n });\n });\n\n /**\n * Creates a function that invokes `func` with `partials` prepended to the\n * arguments it receives. This method is like `_.bind` except it does **not**\n * alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 0.2.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // Partially applied with placeholders.\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partial));\n return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);\n });\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to the arguments it receives.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // Partially applied with placeholders.\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partialRight));\n return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);\n });\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified `indexes` where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, [2, 0, 1]);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n */\n var rearg = flatRest(function(func, indexes) {\n return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as\n * an array.\n *\n * **Note:** This method is based on the\n * [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start === undefined ? start : toInteger(start);\n return baseRest(func, start);\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * create function and an array of arguments much like\n * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).\n *\n * **Note:** This method is based on the\n * [spread operator](https://mdn.io/spread_operator).\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @param {number} [start=0] The start position of the spread.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start == null ? 0 : nativeMax(toInteger(start), 0);\n return baseRest(function(args) {\n var array = args[start],\n otherArgs = castSlice(args, 0, start);\n\n if (array) {\n arrayPush(otherArgs, array);\n }\n return apply(func, this, otherArgs);\n });\n }\n\n /**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n }\n\n /**\n * Creates a function that accepts up to one argument, ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.unary(parseInt));\n * // => [6, 8, 10]\n */\n function unary(func) {\n return ary(func, 1);\n }\n\n /**\n * Creates a function that provides `value` to `wrapper` as its first\n * argument. Any additional arguments provided to the function are appended\n * to those provided to the `wrapper`. The wrapper is invoked with the `this`\n * binding of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} [wrapper=identity] The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '

' + func(text) + '

';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '

fred, barney, & pebbles

'\n */\n function wrap(value, wrapper) {\n return partial(castFunction(wrapper), value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Casts `value` as an array if it's not one.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Lang\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast array.\n * @example\n *\n * _.castArray(1);\n * // => [1]\n *\n * _.castArray({ 'a': 1 });\n * // => [{ 'a': 1 }]\n *\n * _.castArray('abc');\n * // => ['abc']\n *\n * _.castArray(null);\n * // => [null]\n *\n * _.castArray(undefined);\n * // => [undefined]\n *\n * _.castArray();\n * // => []\n *\n * var array = [1, 2, 3];\n * console.log(_.castArray(array) === array);\n * // => true\n */\n function castArray() {\n if (!arguments.length) {\n return [];\n }\n var value = arguments[0];\n return isArray(value) ? value : [value];\n }\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.clone` except that it accepts `customizer` which\n * is invoked to produce the cloned value. If `customizer` returns `undefined`,\n * cloning is handled by the method instead. The `customizer` is invoked with\n * up to four arguments; (value [, index|key, object, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeepWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * }\n *\n * var el = _.cloneWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 0\n */\n function cloneWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\n function cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.cloneWith` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the deep cloned value.\n * @see _.cloneWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * }\n *\n * var el = _.cloneDeepWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 20\n */\n function cloneDeepWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * Checks if `object` conforms to `source` by invoking the predicate\n * properties of `source` with the corresponding property values of `object`.\n *\n * **Note:** This method is equivalent to `_.conforms` when `source` is\n * partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 1; } });\n * // => true\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 2; } });\n * // => false\n */\n function conformsTo(object, source) {\n return source == null || baseConformsTo(object, source, keys(source));\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n * @see _.lt\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n var gt = createRelationalOperation(baseGt);\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to\n * `other`, else `false`.\n * @see _.lte\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n var gte = createRelationalOperation(function(value, other) {\n return value >= other;\n });\n\n /**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n };\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray;\n\n /**\n * Checks if `value` is classified as an `ArrayBuffer` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n * @example\n *\n * _.isArrayBuffer(new ArrayBuffer(2));\n * // => true\n *\n * _.isArrayBuffer(new Array(2));\n * // => false\n */\n var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n }\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n }\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false ||\n (isObjectLike(value) && baseGetTag(value) == boolTag);\n }\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse;\n\n /**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;\n\n /**\n * Checks if `value` is likely a DOM element.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('');\n * // => false\n */\n function isElement(value) {\n return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\n function isEqual(value, other) {\n return baseIsEqual(value, other);\n }\n\n /**\n * This method is like `_.isEqual` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with up to\n * six arguments: (objValue, othValue [, index|key, object, other, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, othValue) {\n * if (isGreeting(objValue) && isGreeting(othValue)) {\n * return true;\n * }\n * }\n *\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqualWith(array, other, customizer);\n * // => true\n */\n function isEqualWith(value, other, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n var result = customizer ? customizer(value, other) : undefined;\n return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on\n * [`Number.isFinite`](https://mdn.io/Number/isFinite).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.\n * @example\n *\n * _.isFinite(3);\n * // => true\n *\n * _.isFinite(Number.MIN_VALUE);\n * // => true\n *\n * _.isFinite(Infinity);\n * // => false\n *\n * _.isFinite('3');\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n }\n\n /**\n * Checks if `value` is an integer.\n *\n * **Note:** This method is based on\n * [`Number.isInteger`](https://mdn.io/Number/isInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n *\n * _.isInteger(3);\n * // => true\n *\n * _.isInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isInteger(Infinity);\n * // => false\n *\n * _.isInteger('3');\n * // => false\n */\n function isInteger(value) {\n return typeof value == 'number' && value == toInteger(value);\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return value != null && typeof value == 'object';\n }\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\n /**\n * Performs a partial deep comparison between `object` and `source` to\n * determine if `object` contains equivalent property values.\n *\n * **Note:** This method is equivalent to `_.matches` when `source` is\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.isMatch(object, { 'b': 2 });\n * // => true\n *\n * _.isMatch(object, { 'b': 1 });\n * // => false\n */\n function isMatch(object, source) {\n return object === source || baseIsMatch(object, source, getMatchData(source));\n }\n\n /**\n * This method is like `_.isMatch` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with five\n * arguments: (objValue, srcValue, index|key, object, source).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, srcValue) {\n * if (isGreeting(objValue) && isGreeting(srcValue)) {\n * return true;\n * }\n * }\n *\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatchWith(object, source, customizer);\n * // => true\n */\n function isMatchWith(object, source, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseIsMatch(object, source, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is based on\n * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n * `undefined` and other non-number values.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some\n // ActiveX objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a pristine native function.\n *\n * **Note:** This method can't reliably detect native functions in the presence\n * of the core-js package because core-js circumvents this kind of detection.\n * Despite multiple requests, the core-js maintainer has made it clear: any\n * attempt to fix the detection will be obstructed. As a result, we're left\n * with little choice but to throw an error. Unfortunately, this also affects\n * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),\n * which rely on core-js.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (isMaskable(value)) {\n throw new Error(CORE_ERROR_TEXT);\n }\n return baseIsNative(value);\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is `null` or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\n * @example\n *\n * _.isNil(null);\n * // => true\n *\n * _.isNil(void 0);\n * // => true\n *\n * _.isNil(NaN);\n * // => false\n */\n function isNil(value) {\n return value == null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\n /**\n * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\n * double precision number which isn't the result of a rounded unsafe integer.\n *\n * **Note:** This method is based on\n * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.\n * @example\n *\n * _.isSafeInteger(3);\n * // => true\n *\n * _.isSafeInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isSafeInteger(Infinity);\n * // => false\n *\n * _.isSafeInteger('3');\n * // => false\n */\n function isSafeInteger(value) {\n return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n }\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined;\n }\n\n /**\n * Checks if `value` is classified as a `WeakMap` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.\n * @example\n *\n * _.isWeakMap(new WeakMap);\n * // => true\n *\n * _.isWeakMap(new Map);\n * // => false\n */\n function isWeakMap(value) {\n return isObjectLike(value) && getTag(value) == weakMapTag;\n }\n\n /**\n * Checks if `value` is classified as a `WeakSet` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.\n * @example\n *\n * _.isWeakSet(new WeakSet);\n * // => true\n *\n * _.isWeakSet(new Set);\n * // => false\n */\n function isWeakSet(value) {\n return isObjectLike(value) && baseGetTag(value) == weakSetTag;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n * @see _.gt\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n var lt = createRelationalOperation(baseLt);\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to\n * `other`, else `false`.\n * @see _.gte\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n var lte = createRelationalOperation(function(value, other) {\n return value <= other;\n });\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * _.toArray({ 'a': 1, 'b': 2 });\n * // => [1, 2]\n *\n * _.toArray('abc');\n * // => ['a', 'b', 'c']\n *\n * _.toArray(1);\n * // => []\n *\n * _.toArray(null);\n * // => []\n */\n function toArray(value) {\n if (!value) {\n return [];\n }\n if (isArrayLike(value)) {\n return isString(value) ? stringToArray(value) : copyArray(value);\n }\n if (symIterator && value[symIterator]) {\n return iteratorToArray(value[symIterator]());\n }\n var tag = getTag(value),\n func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\n\n return func(value);\n }\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n }\n\n /**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\n function toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n }\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n }\n\n /**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return copyObject(value, keysIn(value));\n }\n\n /**\n * Converts `value` to a safe integer. A safe integer can be compared and\n * represented correctly.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toSafeInteger(3.2);\n * // => 3\n *\n * _.toSafeInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toSafeInteger(Infinity);\n * // => 9007199254740991\n *\n * _.toSafeInteger('3.2');\n * // => 3\n */\n function toSafeInteger(value) {\n return value\n ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)\n : (value === 0 ? value : 0);\n }\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n });\n\n /**\n * This method is like `_.assign` except that it iterates over own and\n * inherited source properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assign\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assignIn({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }\n */\n var assignIn = createAssigner(function(object, source) {\n copyObject(source, keysIn(source), object);\n });\n\n /**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n });\n\n /**\n * This method is like `_.assign` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignInWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keys(source), object, customizer);\n });\n\n /**\n * Creates an array of values corresponding to `paths` of `object`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Array} Returns the picked values.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _.at(object, ['a[0].b.c', 'a[1]']);\n * // => [3, 4]\n */\n var at = flatRest(baseAt);\n\n /**\n * Creates an object that inherits from the `prototype` object. If a\n * `properties` object is given, its own enumerable string keyed properties\n * are assigned to the created object.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties) {\n var result = baseCreate(prototype);\n return properties == null ? result : baseAssign(result, properties);\n }\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n });\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaults\n * @example\n *\n * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });\n * // => { 'a': { 'b': 2, 'c': 3 } }\n */\n var defaultsDeep = baseRest(function(args) {\n args.push(undefined, customDefaultsMerge);\n return apply(mergeWith, undefined, args);\n });\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(o) { return o.age < 40; });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // The `_.matches` iteratee shorthand.\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n function findKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);\n }\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(o) { return o.age < 40; });\n * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n function findLastKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);\n }\n\n /**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\n function forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\n */\n function forInRight(object, iteratee) {\n return object == null\n ? object\n : baseForRight(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forOwn(object, iteratee) {\n return object && baseForOwn(object, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\n */\n function forOwnRight(object, iteratee) {\n return object && baseForOwnRight(object, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an array of function property names from own enumerable properties\n * of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functionsIn\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functions(new Foo);\n * // => ['a', 'b']\n */\n function functions(object) {\n return object == null ? [] : baseFunctions(object, keys(object));\n }\n\n /**\n * Creates an array of function property names from own and inherited\n * enumerable properties of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functions\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functionsIn(new Foo);\n * // => ['a', 'b', 'c']\n */\n function functionsIn(object) {\n return object == null ? [] : baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite\n * property assignments of previous values.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Object\n * @param {Object} object The object to invert.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n */\n var invert = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n result[value] = key;\n }, constant(identity));\n\n /**\n * This method is like `_.invert` except that the inverted object is generated\n * from the results of running each element of `object` thru `iteratee`. The\n * corresponding inverted value of each inverted key is an array of keys\n * responsible for generating the inverted value. The iteratee is invoked\n * with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Object\n * @param {Object} object The object to invert.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invertBy(object);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n *\n * _.invertBy(object, function(value) {\n * return 'group' + value;\n * });\n * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\n */\n var invertBy = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }, getIteratee);\n\n /**\n * Invokes the method at `path` of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n *\n * _.invoke(object, 'a[0].b.c.slice', 1, 3);\n * // => [2, 3]\n */\n var invoke = baseRest(baseInvoke);\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * string keyed property of `object` thru `iteratee`. The iteratee is invoked\n * with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapValues\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n function mapKeys(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, iteratee(value, key, object), value);\n });\n return result;\n }\n\n /**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n function mapValues(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n }\n\n /**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\n var merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n });\n\n /**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\n var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n });\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\n var omit = flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = arrayMap(paths, function(path) {\n path = castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n copyObject(object, getAllKeysIn(object), result);\n if (isDeep) {\n result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n baseUnset(result, paths[length]);\n }\n return result;\n });\n\n /**\n * The opposite of `_.pickBy`; this method creates an object composed of\n * the own and inherited enumerable string keyed properties of `object` that\n * `predicate` doesn't return truthy for. The predicate is invoked with two\n * arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omitBy(object, _.isNumber);\n * // => { 'b': '2' }\n */\n function omitBy(object, predicate) {\n return pickBy(object, negate(getIteratee(predicate)));\n }\n\n /**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\n var pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n });\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = getIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n }\n\n /**\n * This method is like `_.get` except that if the resolved value is a\n * function it's invoked with the `this` binding of its parent object and\n * its result is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a[0].b.c3', 'default');\n * // => 'default'\n *\n * _.result(object, 'a[0].b.c3', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length;\n\n // Ensure the loop is entered when path is empty.\n if (!length) {\n length = 1;\n object = undefined;\n }\n while (++index < length) {\n var value = object == null ? undefined : object[toKey(path[index])];\n if (value === undefined) {\n index = length;\n value = defaultValue;\n }\n object = isFunction(value) ? value.call(object) : value;\n }\n return object;\n }\n\n /**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n }\n\n /**\n * This method is like `_.set` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.setWith(object, '[0][1]', 'a', Object);\n * // => { '0': { '1': 'a' } }\n */\n function setWith(object, path, value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseSet(object, path, value, customizer);\n }\n\n /**\n * Creates an array of own enumerable string keyed-value pairs for `object`\n * which can be consumed by `_.fromPairs`. If `object` is a map or set, its\n * entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entries\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairs(new Foo);\n * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n */\n var toPairs = createToPairs(keys);\n\n /**\n * Creates an array of own and inherited enumerable string keyed-value pairs\n * for `object` which can be consumed by `_.fromPairs`. If `object` is a map\n * or set, its entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entriesIn\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairsIn(new Foo);\n * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)\n */\n var toPairsIn = createToPairs(keysIn);\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own\n * enumerable string keyed properties thru `iteratee`, with each invocation\n * potentially mutating the `accumulator` object. If `accumulator` is not\n * provided, a new object with the same `[[Prototype]]` will be used. The\n * iteratee is invoked with four arguments: (accumulator, value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * }, []);\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function transform(object, iteratee, accumulator) {\n var isArr = isArray(object),\n isArrLike = isArr || isBuffer(object) || isTypedArray(object);\n\n iteratee = getIteratee(iteratee, 4);\n if (accumulator == null) {\n var Ctor = object && object.constructor;\n if (isArrLike) {\n accumulator = isArr ? new Ctor : [];\n }\n else if (isObject(object)) {\n accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n }\n else {\n accumulator = {};\n }\n }\n (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Removes the property at `path` of `object`.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n * _.unset(object, 'a[0].b.c');\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n *\n * _.unset(object, ['a', '0', 'b', 'c']);\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n */\n function unset(object, path) {\n return object == null ? true : baseUnset(object, path);\n }\n\n /**\n * This method is like `_.set` except that accepts `updater` to produce the\n * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\n * is invoked with one argument: (value).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.update(object, 'a[0].b.c', function(n) { return n * n; });\n * console.log(object.a[0].b.c);\n * // => 9\n *\n * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\n * console.log(object.x[0].y.z);\n * // => 0\n */\n function update(object, path, updater) {\n return object == null ? object : baseUpdate(object, path, castFunction(updater));\n }\n\n /**\n * This method is like `_.update` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.updateWith(object, '[0][1]', _.constant('a'), Object);\n * // => { '0': { '1': 'a' } }\n */\n function updateWith(object, path, updater, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable string keyed property\n * values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return object == null ? [] : baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Clamps `number` within the inclusive `lower` and `upper` bounds.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Number\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n * @example\n *\n * _.clamp(-10, -5, 5);\n * // => -5\n *\n * _.clamp(10, -5, 5);\n * // => 5\n */\n function clamp(number, lower, upper) {\n if (upper === undefined) {\n upper = lower;\n lower = undefined;\n }\n if (upper !== undefined) {\n upper = toNumber(upper);\n upper = upper === upper ? upper : 0;\n }\n if (lower !== undefined) {\n lower = toNumber(lower);\n lower = lower === lower ? lower : 0;\n }\n return baseClamp(toNumber(number), lower, upper);\n }\n\n /**\n * Checks if `n` is between `start` and up to, but not including, `end`. If\n * `end` is not specified, it's set to `start` with `start` then set to `0`.\n * If `start` is greater than `end` the params are swapped to support\n * negative ranges.\n *\n * @static\n * @memberOf _\n * @since 3.3.0\n * @category Number\n * @param {number} number The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n * @see _.range, _.rangeRight\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n *\n * _.inRange(-3, -2, -6);\n * // => true\n */\n function inRange(number, start, end) {\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n number = toNumber(number);\n return baseInRange(number, start, end);\n }\n\n /**\n * Produces a random number between the inclusive `lower` and `upper` bounds.\n * If only one argument is provided a number between `0` and the given number\n * is returned. If `floating` is `true`, or either `lower` or `upper` are\n * floats, a floating-point number is returned instead of an integer.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Number\n * @param {number} [lower=0] The lower bound.\n * @param {number} [upper=1] The upper bound.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(lower, upper, floating) {\n if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\n upper = floating = undefined;\n }\n if (floating === undefined) {\n if (typeof upper == 'boolean') {\n floating = upper;\n upper = undefined;\n }\n else if (typeof lower == 'boolean') {\n floating = lower;\n lower = undefined;\n }\n }\n if (lower === undefined && upper === undefined) {\n lower = 0;\n upper = 1;\n }\n else {\n lower = toFinite(lower);\n if (upper === undefined) {\n upper = lower;\n lower = 0;\n } else {\n upper = toFinite(upper);\n }\n }\n if (lower > upper) {\n var temp = lower;\n lower = upper;\n upper = temp;\n }\n if (floating || lower % 1 || upper % 1) {\n var rand = nativeRandom();\n return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\n }\n return baseRandom(lower, upper);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n });\n\n /**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\n function capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n }\n\n /**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search up to.\n * @returns {boolean} Returns `true` if `string` ends with `target`,\n * else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = toString(string);\n target = baseToString(target);\n\n var length = string.length;\n position = position === undefined\n ? length\n : baseClamp(toInteger(position), 0, length);\n\n var end = position;\n position -= target.length;\n return position >= 0 && string.slice(position, end) == target;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"^\", \"$\", \"\\\", \".\", \"*\", \"+\",\n * \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n */\n function escapeRegExp(string) {\n string = toString(string);\n return (string && reHasRegExpChar.test(string))\n ? string.replace(reRegExpChar, '\\\\$&')\n : string;\n }\n\n /**\n * Converts `string` to\n * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__FOO_BAR__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string`, as space separated words, to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.lowerCase('--Foo-Bar--');\n * // => 'foo bar'\n *\n * _.lowerCase('fooBar');\n * // => 'foo bar'\n *\n * _.lowerCase('__FOO_BAR__');\n * // => 'foo bar'\n */\n var lowerCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toLowerCase();\n });\n\n /**\n * Converts the first character of `string` to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.lowerFirst('Fred');\n * // => 'fred'\n *\n * _.lowerFirst('FRED');\n * // => 'fRED'\n */\n var lowerFirst = createCaseFirst('toLowerCase');\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n if (!length || strLength >= length) {\n return string;\n }\n var mid = (length - strLength) / 2;\n return (\n createPadding(nativeFloor(mid), chars) +\n string +\n createPadding(nativeCeil(mid), chars)\n );\n }\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padEnd('abc', 6);\n * // => 'abc '\n *\n * _.padEnd('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padEnd('abc', 3);\n * // => 'abc'\n */\n function padEnd(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (string + createPadding(length - strLength, chars))\n : string;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padStart('abc', 6);\n * // => ' abc'\n *\n * _.padStart('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padStart('abc', 3);\n * // => 'abc'\n */\n function padStart(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (createPadding(length - strLength, chars) + string)\n : string;\n }\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\n * hexadecimal, in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the\n * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix=10] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n if (guard || radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=1] The number of times to repeat the string.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n, guard) {\n if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n return baseRepeat(toString(string), n);\n }\n\n /**\n * Replaces matches for `pattern` in `string` with `replacement`.\n *\n * **Note:** This method is based on\n * [`String#replace`](https://mdn.io/String/replace).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to modify.\n * @param {RegExp|string} pattern The pattern to replace.\n * @param {Function|string} replacement The match replacement.\n * @returns {string} Returns the modified string.\n * @example\n *\n * _.replace('Hi Fred', 'Fred', 'Barney');\n * // => 'Hi Barney'\n */\n function replace() {\n var args = arguments,\n string = toString(args[0]);\n\n return args.length < 3 ? string : string.replace(args[1], args[2]);\n }\n\n /**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Splits `string` by `separator`.\n *\n * **Note:** This method is based on\n * [`String#split`](https://mdn.io/String/split).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to split.\n * @param {RegExp|string} separator The separator pattern to split by.\n * @param {number} [limit] The length to truncate results to.\n * @returns {Array} Returns the string segments.\n * @example\n *\n * _.split('a-b-c', '-', 2);\n * // => ['a', 'b']\n */\n function split(string, separator, limit) {\n if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\n separator = limit = undefined;\n }\n limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;\n if (!limit) {\n return [];\n }\n string = toString(string);\n if (string && (\n typeof separator == 'string' ||\n (separator != null && !isRegExp(separator))\n )) {\n separator = baseToString(separator);\n if (!separator && hasUnicode(string)) {\n return castSlice(stringToArray(string), 0, limit);\n }\n }\n return string.split(separator, limit);\n }\n\n /**\n * Converts `string` to\n * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @since 3.1.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar--');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__FOO_BAR__');\n * // => 'FOO BAR'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + upperFirst(word);\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`,\n * else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = toString(string);\n position = position == null\n ? 0\n : baseClamp(toInteger(position), 0, string.length);\n\n target = baseToString(target);\n return string.slice(position, position + target.length) == target;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='lodash.templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<%- value %>');\n * compiled({ 'value': '